1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038 |
- /*
- Ext JS 4.1 - JavaScript Library
- Copyright (c) 2006-2012, Sencha Inc.
- All rights reserved.
- licensing@sencha.com
- http://www.sencha.com/license
- Open Source License
- ------------------------------------------------------------------------------------------
- This version of Ext JS is licensed under the terms of the Open Source GPL 3.0 license.
- http://www.gnu.org/licenses/gpl.html
- There are several FLOSS exceptions available for use with this release for
- open source applications that are distributed under a license other than GPL.
- * Open Source License Exception for Applications
- http://www.sencha.com/products/floss-exception.php
- * Open Source License Exception for Development
- http://www.sencha.com/products/ux-exception.php
- Alternate Licensing
- ------------------------------------------------------------------------------------------
- Commercial and OEM Licenses are available for an alternate download of Ext JS.
- This is the appropriate option if you are creating proprietary applications and you are
- not prepared to distribute and share the source code of your application under the
- GPL v3 license. Please visit http://www.sencha.com/license for more details.
- --
- This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT OF THIRD-PARTY INTELLECTUAL PROPERTY RIGHTS. See the GNU General Public License for more details.
- */
- //@tag foundation,core
- var Ext = Ext || {};
- Ext._startTime = new Date().getTime();
- (function() {
- var global = this,
- objectPrototype = Object.prototype,
- toString = objectPrototype.toString,
- enumerables = true,
- enumerablesTest = { toString: 1 },
- emptyFn = function () {},
-
-
- callOverrideParent = function () {
- var method = callOverrideParent.caller.caller;
- return method.$owner.prototype[method.$name].apply(this, arguments);
- },
- i;
- Ext.global = global;
- for (i in enumerablesTest) {
- enumerables = null;
- }
- if (enumerables) {
- enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable',
- 'toLocaleString', 'toString', 'constructor'];
- }
-
- Ext.enumerables = enumerables;
-
- Ext.apply = function(object, config, defaults) {
- if (defaults) {
- Ext.apply(object, defaults);
- }
- if (object && config && typeof config === 'object') {
- var i, j, k;
- for (i in config) {
- object[i] = config[i];
- }
- if (enumerables) {
- for (j = enumerables.length; j--;) {
- k = enumerables[j];
- if (config.hasOwnProperty(k)) {
- object[k] = config[k];
- }
- }
- }
- }
- return object;
- };
- Ext.buildSettings = Ext.apply({
- baseCSSPrefix: 'x-',
- scopeResetCSS: false
- }, Ext.buildSettings || {});
- Ext.apply(Ext, {
-
- name: Ext.sandboxName || 'Ext',
-
- emptyFn: emptyFn,
-
- emptyString: new String(),
- baseCSSPrefix: Ext.buildSettings.baseCSSPrefix,
-
- applyIf: function(object, config) {
- var property;
- if (object) {
- for (property in config) {
- if (object[property] === undefined) {
- object[property] = config[property];
- }
- }
- }
- return object;
- },
-
- iterate: function(object, fn, scope) {
- if (Ext.isEmpty(object)) {
- return;
- }
- if (scope === undefined) {
- scope = object;
- }
- if (Ext.isIterable(object)) {
- Ext.Array.each.call(Ext.Array, object, fn, scope);
- }
- else {
- Ext.Object.each.call(Ext.Object, object, fn, scope);
- }
- }
- });
- Ext.apply(Ext, {
-
- extend: (function() {
-
- var objectConstructor = objectPrototype.constructor,
- inlineOverrides = function(o) {
- for (var m in o) {
- if (!o.hasOwnProperty(m)) {
- continue;
- }
- this[m] = o[m];
- }
- };
- return function(subclass, superclass, overrides) {
-
- if (Ext.isObject(superclass)) {
- overrides = superclass;
- superclass = subclass;
- subclass = overrides.constructor !== objectConstructor ? overrides.constructor : function() {
- superclass.apply(this, arguments);
- };
- }
-
- var F = function() {},
- subclassProto, superclassProto = superclass.prototype;
- F.prototype = superclassProto;
- subclassProto = subclass.prototype = new F();
- subclassProto.constructor = subclass;
- subclass.superclass = superclassProto;
- if (superclassProto.constructor === objectConstructor) {
- superclassProto.constructor = superclass;
- }
- subclass.override = function(overrides) {
- Ext.override(subclass, overrides);
- };
- subclassProto.override = inlineOverrides;
- subclassProto.proto = subclassProto;
- subclass.override(overrides);
- subclass.extend = function(o) {
- return Ext.extend(subclass, o);
- };
- return subclass;
- };
- }()),
-
- override: function (target, overrides) {
- if (target.$isClass) {
- target.override(overrides);
- } else if (typeof target == 'function') {
- Ext.apply(target.prototype, overrides);
- } else {
- var owner = target.self,
- name, value;
- if (owner && owner.$isClass) {
- for (name in overrides) {
- if (overrides.hasOwnProperty(name)) {
- value = overrides[name];
- if (typeof value == 'function') {
- value.$name = name;
- value.$owner = owner;
- value.$previous = target.hasOwnProperty(name)
- ? target[name]
- : callOverrideParent;
- }
- target[name] = value;
- }
- }
- } else {
- Ext.apply(target, overrides);
- }
- }
- return target;
- }
- });
-
- Ext.apply(Ext, {
-
- valueFrom: function(value, defaultValue, allowBlank){
- return Ext.isEmpty(value, allowBlank) ? defaultValue : value;
- },
-
- typeOf: function(value) {
- var type,
- typeToString;
-
- if (value === null) {
- return 'null';
- }
- type = typeof value;
- if (type === 'undefined' || type === 'string' || type === 'number' || type === 'boolean') {
- return type;
- }
- typeToString = toString.call(value);
- switch(typeToString) {
- case '[object Array]':
- return 'array';
- case '[object Date]':
- return 'date';
- case '[object Boolean]':
- return 'boolean';
- case '[object Number]':
- return 'number';
- case '[object RegExp]':
- return 'regexp';
- }
- if (type === 'function') {
- return 'function';
- }
- if (type === 'object') {
- if (value.nodeType !== undefined) {
- if (value.nodeType === 3) {
- return (/\S/).test(value.nodeValue) ? 'textnode' : 'whitespace';
- }
- else {
- return 'element';
- }
- }
- return 'object';
- }
- },
-
- isEmpty: function(value, allowEmptyString) {
- return (value === null) || (value === undefined) || (!allowEmptyString ? value === '' : false) || (Ext.isArray(value) && value.length === 0);
- },
-
- isArray: ('isArray' in Array) ? Array.isArray : function(value) {
- return toString.call(value) === '[object Array]';
- },
-
- isDate: function(value) {
- return toString.call(value) === '[object Date]';
- },
-
- isObject: (toString.call(null) === '[object Object]') ?
- function(value) {
-
- return value !== null && value !== undefined && toString.call(value) === '[object Object]' && value.ownerDocument === undefined;
- } :
- function(value) {
- return toString.call(value) === '[object Object]';
- },
-
- isSimpleObject: function(value) {
- return value instanceof Object && value.constructor === Object;
- },
-
- isPrimitive: function(value) {
- var type = typeof value;
- return type === 'string' || type === 'number' || type === 'boolean';
- },
-
- isFunction:
-
-
- (typeof document !== 'undefined' && typeof document.getElementsByTagName('body') === 'function') ? function(value) {
- return toString.call(value) === '[object Function]';
- } : function(value) {
- return typeof value === 'function';
- },
-
- isNumber: function(value) {
- return typeof value === 'number' && isFinite(value);
- },
-
- isNumeric: function(value) {
- return !isNaN(parseFloat(value)) && isFinite(value);
- },
-
- isString: function(value) {
- return typeof value === 'string';
- },
-
- isBoolean: function(value) {
- return typeof value === 'boolean';
- },
-
- isElement: function(value) {
- return value ? value.nodeType === 1 : false;
- },
-
- isTextNode: function(value) {
- return value ? value.nodeName === "#text" : false;
- },
-
- isDefined: function(value) {
- return typeof value !== 'undefined';
- },
-
- isIterable: function(value) {
- var type = typeof value,
- checkLength = false;
- if (value && type != 'string') {
-
- if (type == 'function') {
-
-
- if (Ext.isSafari) {
- checkLength = value instanceof NodeList || value instanceof HTMLCollection;
- }
- } else {
- checkLength = true;
- }
- }
- return checkLength ? value.length !== undefined : false;
- }
- });
- Ext.apply(Ext, {
-
- clone: function(item) {
- var type,
- i,
- j,
- k,
- clone,
- key;
-
- if (item === null || item === undefined) {
- return item;
- }
-
-
-
- if (item.nodeType && item.cloneNode) {
- return item.cloneNode(true);
- }
- type = toString.call(item);
-
- if (type === '[object Date]') {
- return new Date(item.getTime());
- }
-
- if (type === '[object Array]') {
- i = item.length;
- clone = [];
- while (i--) {
- clone[i] = Ext.clone(item[i]);
- }
- }
-
- else if (type === '[object Object]' && item.constructor === Object) {
- clone = {};
- for (key in item) {
- clone[key] = Ext.clone(item[key]);
- }
- if (enumerables) {
- for (j = enumerables.length; j--;) {
- k = enumerables[j];
- clone[k] = item[k];
- }
- }
- }
- return clone || item;
- },
-
- getUniqueGlobalNamespace: function() {
- var uniqueGlobalNamespace = this.uniqueGlobalNamespace,
- i;
- if (uniqueGlobalNamespace === undefined) {
- i = 0;
- do {
- uniqueGlobalNamespace = 'ExtBox' + (++i);
- } while (Ext.global[uniqueGlobalNamespace] !== undefined);
- Ext.global[uniqueGlobalNamespace] = Ext;
- this.uniqueGlobalNamespace = uniqueGlobalNamespace;
- }
- return uniqueGlobalNamespace;
- },
-
-
- functionFactoryCache: {},
-
- cacheableFunctionFactory: function() {
- var me = this,
- args = Array.prototype.slice.call(arguments),
- cache = me.functionFactoryCache,
- idx, fn, ln;
-
- if (Ext.isSandboxed) {
- ln = args.length;
- if (ln > 0) {
- ln--;
- args[ln] = 'var Ext=window.' + Ext.name + ';' + args[ln];
- }
- }
- idx = args.join('');
- fn = cache[idx];
- if (!fn) {
- fn = Function.prototype.constructor.apply(Function.prototype, args);
-
- cache[idx] = fn;
- }
- return fn;
- },
-
- functionFactory: function() {
- var me = this,
- args = Array.prototype.slice.call(arguments),
- ln;
-
- if (Ext.isSandboxed) {
- ln = args.length;
- if (ln > 0) {
- ln--;
- args[ln] = 'var Ext=window.' + Ext.name + ';' + args[ln];
- }
- }
-
- return Function.prototype.constructor.apply(Function.prototype, args);
- },
-
- Logger: {
- verbose: emptyFn,
- log: emptyFn,
- info: emptyFn,
- warn: emptyFn,
- error: function(message) {
- throw new Error(message);
- },
- deprecate: emptyFn
- }
- });
-
- Ext.type = Ext.typeOf;
- }());
- Ext.globalEval = Ext.global.execScript
- ? function(code) {
- execScript(code);
- }
- : function($$code) {
-
-
- (function(){
- eval($$code);
- }());
- };
- //@tag foundation,core
- //@require ../Ext.js
- (function() {
- var version = '4.1.1.1', Version;
- Ext.Version = Version = Ext.extend(Object, {
-
- constructor: function(version) {
- var parts, releaseStartIndex;
- if (version instanceof Version) {
- return version;
- }
- this.version = this.shortVersion = String(version).toLowerCase().replace(/_/g, '.').replace(/[\-+]/g, '');
- releaseStartIndex = this.version.search(/([^\d\.])/);
- if (releaseStartIndex !== -1) {
- this.release = this.version.substr(releaseStartIndex, version.length);
- this.shortVersion = this.version.substr(0, releaseStartIndex);
- }
- this.shortVersion = this.shortVersion.replace(/[^\d]/g, '');
- parts = this.version.split('.');
- this.major = parseInt(parts.shift() || 0, 10);
- this.minor = parseInt(parts.shift() || 0, 10);
- this.patch = parseInt(parts.shift() || 0, 10);
- this.build = parseInt(parts.shift() || 0, 10);
- return this;
- },
-
- toString: function() {
- return this.version;
- },
-
- valueOf: function() {
- return this.version;
- },
-
- getMajor: function() {
- return this.major || 0;
- },
-
- getMinor: function() {
- return this.minor || 0;
- },
-
- getPatch: function() {
- return this.patch || 0;
- },
-
- getBuild: function() {
- return this.build || 0;
- },
-
- getRelease: function() {
- return this.release || '';
- },
-
- isGreaterThan: function(target) {
- return Version.compare(this.version, target) === 1;
- },
-
- isGreaterThanOrEqual: function(target) {
- return Version.compare(this.version, target) >= 0;
- },
-
- isLessThan: function(target) {
- return Version.compare(this.version, target) === -1;
- },
-
- isLessThanOrEqual: function(target) {
- return Version.compare(this.version, target) <= 0;
- },
-
- equals: function(target) {
- return Version.compare(this.version, target) === 0;
- },
-
- match: function(target) {
- target = String(target);
- return this.version.substr(0, target.length) === target;
- },
-
- toArray: function() {
- return [this.getMajor(), this.getMinor(), this.getPatch(), this.getBuild(), this.getRelease()];
- },
-
- getShortVersion: function() {
- return this.shortVersion;
- },
-
- gt: function() {
- return this.isGreaterThan.apply(this, arguments);
- },
-
- lt: function() {
- return this.isLessThan.apply(this, arguments);
- },
-
- gtEq: function() {
- return this.isGreaterThanOrEqual.apply(this, arguments);
- },
-
- ltEq: function() {
- return this.isLessThanOrEqual.apply(this, arguments);
- }
- });
- Ext.apply(Version, {
-
- releaseValueMap: {
- 'dev': -6,
- 'alpha': -5,
- 'a': -5,
- 'beta': -4,
- 'b': -4,
- 'rc': -3,
- '#': -2,
- 'p': -1,
- 'pl': -1
- },
-
- getComponentValue: function(value) {
- return !value ? 0 : (isNaN(value) ? this.releaseValueMap[value] || value : parseInt(value, 10));
- },
-
- compare: function(current, target) {
- var currentValue, targetValue, i;
- current = new Version(current).toArray();
- target = new Version(target).toArray();
- for (i = 0; i < Math.max(current.length, target.length); i++) {
- currentValue = this.getComponentValue(current[i]);
- targetValue = this.getComponentValue(target[i]);
- if (currentValue < targetValue) {
- return -1;
- } else if (currentValue > targetValue) {
- return 1;
- }
- }
- return 0;
- }
- });
-
- Ext.apply(Ext, {
-
- versions: {},
-
- lastRegisteredVersion: null,
-
- setVersion: function(packageName, version) {
- Ext.versions[packageName] = new Version(version);
- Ext.lastRegisteredVersion = Ext.versions[packageName];
- return this;
- },
-
- getVersion: function(packageName) {
- if (packageName === undefined) {
- return Ext.lastRegisteredVersion;
- }
- return Ext.versions[packageName];
- },
-
- deprecate: function(packageName, since, closure, scope) {
- if (Version.compare(Ext.getVersion(packageName), since) < 1) {
- closure.call(scope);
- }
- }
- });
- Ext.setVersion('core', version);
- }());
- //@tag foundation,core
- //@require ../version/Version.js
- Ext.String = (function() {
- var trimRegex = /^[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000]+|[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000]+$/g,
- escapeRe = /('|\\)/g,
- formatRe = /\{(\d+)\}/g,
- escapeRegexRe = /([-.*+?\^${}()|\[\]\/\\])/g,
- basicTrimRe = /^\s+|\s+$/g,
- whitespaceRe = /\s+/,
- varReplace = /(^[^a-z]*|[^\w])/gi,
- charToEntity,
- entityToChar,
- charToEntityRegex,
- entityToCharRegex,
- htmlEncodeReplaceFn = function(match, capture) {
- return charToEntity[capture];
- },
- htmlDecodeReplaceFn = function(match, capture) {
- return (capture in entityToChar) ? entityToChar[capture] : String.fromCharCode(parseInt(capture.substr(2), 10));
- };
- return {
-
- createVarName: function(s) {
- return s.replace(varReplace, '');
- },
-
- htmlEncode: function(value) {
- return (!value) ? value : String(value).replace(charToEntityRegex, htmlEncodeReplaceFn);
- },
-
- htmlDecode: function(value) {
- return (!value) ? value : String(value).replace(entityToCharRegex, htmlDecodeReplaceFn);
- },
-
- addCharacterEntities: function(newEntities) {
- var charKeys = [],
- entityKeys = [],
- key, echar;
- for (key in newEntities) {
- echar = newEntities[key];
- entityToChar[key] = echar;
- charToEntity[echar] = key;
- charKeys.push(echar);
- entityKeys.push(key);
- }
- charToEntityRegex = new RegExp('(' + charKeys.join('|') + ')', 'g');
- entityToCharRegex = new RegExp('(' + entityKeys.join('|') + '|&#[0-9]{1,5};' + ')', 'g');
- },
-
- resetCharacterEntities: function() {
- charToEntity = {};
- entityToChar = {};
-
- this.addCharacterEntities({
- '&' : '&',
- '>' : '>',
- '<' : '<',
- '"' : '"',
- ''' : "'"
- });
- },
-
- urlAppend : function(url, string) {
- if (!Ext.isEmpty(string)) {
- return url + (url.indexOf('?') === -1 ? '?' : '&') + string;
- }
- return url;
- },
-
- trim: function(string) {
- return string.replace(trimRegex, "");
- },
-
- capitalize: function(string) {
- return string.charAt(0).toUpperCase() + string.substr(1);
- },
-
- uncapitalize: function(string) {
- return string.charAt(0).toLowerCase() + string.substr(1);
- },
-
- ellipsis: function(value, len, word) {
- if (value && value.length > len) {
- if (word) {
- var vs = value.substr(0, len - 2),
- index = Math.max(vs.lastIndexOf(' '), vs.lastIndexOf('.'), vs.lastIndexOf('!'), vs.lastIndexOf('?'));
- if (index !== -1 && index >= (len - 15)) {
- return vs.substr(0, index) + "...";
- }
- }
- return value.substr(0, len - 3) + "...";
- }
- return value;
- },
-
- escapeRegex: function(string) {
- return string.replace(escapeRegexRe, "\\$1");
- },
-
- escape: function(string) {
- return string.replace(escapeRe, "\\$1");
- },
-
- toggle: function(string, value, other) {
- return string === value ? other : value;
- },
-
- leftPad: function(string, size, character) {
- var result = String(string);
- character = character || " ";
- while (result.length < size) {
- result = character + result;
- }
- return result;
- },
-
- format: function(format) {
- var args = Ext.Array.toArray(arguments, 1);
- return format.replace(formatRe, function(m, i) {
- return args[i];
- });
- },
-
- repeat: function(pattern, count, sep) {
- for (var buf = [], i = count; i--; ) {
- buf.push(pattern);
- }
- return buf.join(sep || '');
- },
-
- splitWords: function (words) {
- if (words && typeof words == 'string') {
- return words.replace(basicTrimRe, '').split(whitespaceRe);
- }
- return words || [];
- }
- };
- }());
- Ext.String.resetCharacterEntities();
- Ext.htmlEncode = Ext.String.htmlEncode;
- Ext.htmlDecode = Ext.String.htmlDecode;
- Ext.urlAppend = Ext.String.urlAppend;
- //@tag foundation,core
- //@require String.js
- //@define Ext.Number
- Ext.Number = new function() {
- var me = this,
- isToFixedBroken = (0.9).toFixed() !== '1',
- math = Math;
- Ext.apply(this, {
-
- constrain: function(number, min, max) {
- var x = parseFloat(number);
-
-
-
-
-
-
-
- return (x < min) ? min : ((x > max) ? max : x);
- },
-
- snap : function(value, increment, minValue, maxValue) {
- var m;
-
-
- if (value === undefined || value < minValue) {
- return minValue || 0;
- }
- if (increment) {
- m = value % increment;
- if (m !== 0) {
- value -= m;
- if (m * 2 >= increment) {
- value += increment;
- } else if (m * 2 < -increment) {
- value -= increment;
- }
- }
- }
- return me.constrain(value, minValue, maxValue);
- },
-
- snapInRange : function(value, increment, minValue, maxValue) {
- var tween;
-
- minValue = (minValue || 0);
-
- if (value === undefined || value < minValue) {
- return minValue;
- }
-
- if (increment && (tween = ((value - minValue) % increment))) {
- value -= tween;
- tween *= 2;
- if (tween >= increment) {
- value += increment;
- }
- }
-
- if (maxValue !== undefined) {
- if (value > (maxValue = me.snapInRange(maxValue, increment, minValue))) {
- value = maxValue;
- }
- }
- return value;
- },
-
- toFixed: isToFixedBroken ? function(value, precision) {
- precision = precision || 0;
- var pow = math.pow(10, precision);
- return (math.round(value * pow) / pow).toFixed(precision);
- } : function(value, precision) {
- return value.toFixed(precision);
- },
-
- from: function(value, defaultValue) {
- if (isFinite(value)) {
- value = parseFloat(value);
- }
- return !isNaN(value) ? value : defaultValue;
- },
-
- randomInt: function (from, to) {
- return math.floor(math.random() * (to - from + 1) + from);
- }
- });
-
- Ext.num = function() {
- return me.from.apply(this, arguments);
- };
- };
- //@tag foundation,core
- //@require Number.js
- (function() {
- var arrayPrototype = Array.prototype,
- slice = arrayPrototype.slice,
- supportsSplice = (function () {
- var array = [],
- lengthBefore,
- j = 20;
- if (!array.splice) {
- return false;
- }
-
-
- while (j--) {
- array.push("A");
- }
- array.splice(15, 0, "F", "F", "F", "F", "F","F","F","F","F","F","F","F","F","F","F","F","F","F","F","F","F");
- lengthBefore = array.length;
- array.splice(13, 0, "XXX");
- if (lengthBefore+1 != array.length) {
- return false;
- }
-
- return true;
- }()),
- supportsForEach = 'forEach' in arrayPrototype,
- supportsMap = 'map' in arrayPrototype,
- supportsIndexOf = 'indexOf' in arrayPrototype,
- supportsEvery = 'every' in arrayPrototype,
- supportsSome = 'some' in arrayPrototype,
- supportsFilter = 'filter' in arrayPrototype,
- supportsSort = (function() {
- var a = [1,2,3,4,5].sort(function(){ return 0; });
- return a[0] === 1 && a[1] === 2 && a[2] === 3 && a[3] === 4 && a[4] === 5;
- }()),
- supportsSliceOnNodeList = true,
- ExtArray,
- erase,
- replace,
- splice;
- try {
-
- if (typeof document !== 'undefined') {
- slice.call(document.getElementsByTagName('body'));
- }
- } catch (e) {
- supportsSliceOnNodeList = false;
- }
- function fixArrayIndex (array, index) {
- return (index < 0) ? Math.max(0, array.length + index)
- : Math.min(array.length, index);
- }
-
- function replaceSim (array, index, removeCount, insert) {
- var add = insert ? insert.length : 0,
- length = array.length,
- pos = fixArrayIndex(array, index),
- remove,
- tailOldPos,
- tailNewPos,
- tailCount,
- lengthAfterRemove,
- i;
-
- if (pos === length) {
- if (add) {
- array.push.apply(array, insert);
- }
- } else {
- remove = Math.min(removeCount, length - pos);
- tailOldPos = pos + remove;
- tailNewPos = tailOldPos + add - remove;
- tailCount = length - tailOldPos;
- lengthAfterRemove = length - remove;
- if (tailNewPos < tailOldPos) {
- for (i = 0; i < tailCount; ++i) {
- array[tailNewPos+i] = array[tailOldPos+i];
- }
- } else if (tailNewPos > tailOldPos) {
- for (i = tailCount; i--; ) {
- array[tailNewPos+i] = array[tailOldPos+i];
- }
- }
- if (add && pos === lengthAfterRemove) {
- array.length = lengthAfterRemove;
- array.push.apply(array, insert);
- } else {
- array.length = lengthAfterRemove + add;
- for (i = 0; i < add; ++i) {
- array[pos+i] = insert[i];
- }
- }
- }
- return array;
- }
- function replaceNative (array, index, removeCount, insert) {
- if (insert && insert.length) {
- if (index < array.length) {
- array.splice.apply(array, [index, removeCount].concat(insert));
- } else {
- array.push.apply(array, insert);
- }
- } else {
- array.splice(index, removeCount);
- }
- return array;
- }
- function eraseSim (array, index, removeCount) {
- return replaceSim(array, index, removeCount);
- }
- function eraseNative (array, index, removeCount) {
- array.splice(index, removeCount);
- return array;
- }
- function spliceSim (array, index, removeCount) {
- var pos = fixArrayIndex(array, index),
- removed = array.slice(index, fixArrayIndex(array, pos+removeCount));
- if (arguments.length < 4) {
- replaceSim(array, pos, removeCount);
- } else {
- replaceSim(array, pos, removeCount, slice.call(arguments, 3));
- }
- return removed;
- }
- function spliceNative (array) {
- return array.splice.apply(array, slice.call(arguments, 1));
- }
- erase = supportsSplice ? eraseNative : eraseSim;
- replace = supportsSplice ? replaceNative : replaceSim;
- splice = supportsSplice ? spliceNative : spliceSim;
-
- ExtArray = Ext.Array = {
-
- each: function(array, fn, scope, reverse) {
- array = ExtArray.from(array);
- var i,
- ln = array.length;
- if (reverse !== true) {
- for (i = 0; i < ln; i++) {
- if (fn.call(scope || array[i], array[i], i, array) === false) {
- return i;
- }
- }
- }
- else {
- for (i = ln - 1; i > -1; i--) {
- if (fn.call(scope || array[i], array[i], i, array) === false) {
- return i;
- }
- }
- }
- return true;
- },
-
- forEach: supportsForEach ? function(array, fn, scope) {
- return array.forEach(fn, scope);
- } : function(array, fn, scope) {
- var i = 0,
- ln = array.length;
- for (; i < ln; i++) {
- fn.call(scope, array[i], i, array);
- }
- },
-
- indexOf: supportsIndexOf ? function(array, item, from) {
- return array.indexOf(item, from);
- } : function(array, item, from) {
- var i, length = array.length;
- for (i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++) {
- if (array[i] === item) {
- return i;
- }
- }
- return -1;
- },
-
- contains: supportsIndexOf ? function(array, item) {
- return array.indexOf(item) !== -1;
- } : function(array, item) {
- var i, ln;
- for (i = 0, ln = array.length; i < ln; i++) {
- if (array[i] === item) {
- return true;
- }
- }
- return false;
- },
-
- toArray: function(iterable, start, end){
- if (!iterable || !iterable.length) {
- return [];
- }
- if (typeof iterable === 'string') {
- iterable = iterable.split('');
- }
- if (supportsSliceOnNodeList) {
- return slice.call(iterable, start || 0, end || iterable.length);
- }
- var array = [],
- i;
- start = start || 0;
- end = end ? ((end < 0) ? iterable.length + end : end) : iterable.length;
- for (i = start; i < end; i++) {
- array.push(iterable[i]);
- }
- return array;
- },
-
- pluck: function(array, propertyName) {
- var ret = [],
- i, ln, item;
- for (i = 0, ln = array.length; i < ln; i++) {
- item = array[i];
- ret.push(item[propertyName]);
- }
- return ret;
- },
-
- map: supportsMap ? function(array, fn, scope) {
- return array.map(fn, scope);
- } : function(array, fn, scope) {
- var results = [],
- i = 0,
- len = array.length;
- for (; i < len; i++) {
- results[i] = fn.call(scope, array[i], i, array);
- }
- return results;
- },
-
- every: supportsEvery ? function(array, fn, scope) {
- return array.every(fn, scope);
- } : function(array, fn, scope) {
- var i = 0,
- ln = array.length;
- for (; i < ln; ++i) {
- if (!fn.call(scope, array[i], i, array)) {
- return false;
- }
- }
- return true;
- },
-
- some: supportsSome ? function(array, fn, scope) {
- return array.some(fn, scope);
- } : function(array, fn, scope) {
- var i = 0,
- ln = array.length;
- for (; i < ln; ++i) {
- if (fn.call(scope, array[i], i, array)) {
- return true;
- }
- }
- return false;
- },
-
- clean: function(array) {
- var results = [],
- i = 0,
- ln = array.length,
- item;
- for (; i < ln; i++) {
- item = array[i];
- if (!Ext.isEmpty(item)) {
- results.push(item);
- }
- }
- return results;
- },
-
- unique: function(array) {
- var clone = [],
- i = 0,
- ln = array.length,
- item;
- for (; i < ln; i++) {
- item = array[i];
- if (ExtArray.indexOf(clone, item) === -1) {
- clone.push(item);
- }
- }
- return clone;
- },
-
- filter: supportsFilter ? function(array, fn, scope) {
- return array.filter(fn, scope);
- } : function(array, fn, scope) {
- var results = [],
- i = 0,
- ln = array.length;
- for (; i < ln; i++) {
- if (fn.call(scope, array[i], i, array)) {
- results.push(array[i]);
- }
- }
- return results;
- },
-
- from: function(value, newReference) {
- if (value === undefined || value === null) {
- return [];
- }
- if (Ext.isArray(value)) {
- return (newReference) ? slice.call(value) : value;
- }
- var type = typeof value;
-
-
- if (value && value.length !== undefined && type !== 'string' && (type !== 'function' || !value.apply)) {
- return ExtArray.toArray(value);
- }
- return [value];
- },
-
- remove: function(array, item) {
- var index = ExtArray.indexOf(array, item);
- if (index !== -1) {
- erase(array, index, 1);
- }
- return array;
- },
-
- include: function(array, item) {
- if (!ExtArray.contains(array, item)) {
- array.push(item);
- }
- },
-
- clone: function(array) {
- return slice.call(array);
- },
-
- merge: function() {
- var args = slice.call(arguments),
- array = [],
- i, ln;
- for (i = 0, ln = args.length; i < ln; i++) {
- array = array.concat(args[i]);
- }
- return ExtArray.unique(array);
- },
-
- intersect: function() {
- var intersection = [],
- arrays = slice.call(arguments),
- arraysLength,
- array,
- arrayLength,
- minArray,
- minArrayIndex,
- minArrayCandidate,
- minArrayLength,
- element,
- elementCandidate,
- elementCount,
- i, j, k;
- if (!arrays.length) {
- return intersection;
- }
-
- arraysLength = arrays.length;
- for (i = minArrayIndex = 0; i < arraysLength; i++) {
- minArrayCandidate = arrays[i];
- if (!minArray || minArrayCandidate.length < minArray.length) {
- minArray = minArrayCandidate;
- minArrayIndex = i;
- }
- }
- minArray = ExtArray.unique(minArray);
- erase(arrays, minArrayIndex, 1);
-
-
-
- minArrayLength = minArray.length;
- arraysLength = arrays.length;
- for (i = 0; i < minArrayLength; i++) {
- element = minArray[i];
- elementCount = 0;
- for (j = 0; j < arraysLength; j++) {
- array = arrays[j];
- arrayLength = array.length;
- for (k = 0; k < arrayLength; k++) {
- elementCandidate = array[k];
- if (element === elementCandidate) {
- elementCount++;
- break;
- }
- }
- }
- if (elementCount === arraysLength) {
- intersection.push(element);
- }
- }
- return intersection;
- },
-
- difference: function(arrayA, arrayB) {
- var clone = slice.call(arrayA),
- ln = clone.length,
- i, j, lnB;
- for (i = 0,lnB = arrayB.length; i < lnB; i++) {
- for (j = 0; j < ln; j++) {
- if (clone[j] === arrayB[i]) {
- erase(clone, j, 1);
- j--;
- ln--;
- }
- }
- }
- return clone;
- },
-
-
- slice: ([1,2].slice(1, undefined).length ?
- function (array, begin, end) {
- return slice.call(array, begin, end);
- } :
-
- function (array, begin, end) {
-
-
- if (typeof begin === 'undefined') {
- return slice.call(array);
- }
- if (typeof end === 'undefined') {
- return slice.call(array, begin);
- }
- return slice.call(array, begin, end);
- }
- ),
-
- sort: supportsSort ? function(array, sortFn) {
- if (sortFn) {
- return array.sort(sortFn);
- } else {
- return array.sort();
- }
- } : function(array, sortFn) {
- var length = array.length,
- i = 0,
- comparison,
- j, min, tmp;
- for (; i < length; i++) {
- min = i;
- for (j = i + 1; j < length; j++) {
- if (sortFn) {
- comparison = sortFn(array[j], array[min]);
- if (comparison < 0) {
- min = j;
- }
- } else if (array[j] < array[min]) {
- min = j;
- }
- }
- if (min !== i) {
- tmp = array[i];
- array[i] = array[min];
- array[min] = tmp;
- }
- }
- return array;
- },
-
- flatten: function(array) {
- var worker = [];
- function rFlatten(a) {
- var i, ln, v;
- for (i = 0, ln = a.length; i < ln; i++) {
- v = a[i];
- if (Ext.isArray(v)) {
- rFlatten(v);
- } else {
- worker.push(v);
- }
- }
- return worker;
- }
- return rFlatten(array);
- },
-
- min: function(array, comparisonFn) {
- var min = array[0],
- i, ln, item;
- for (i = 0, ln = array.length; i < ln; i++) {
- item = array[i];
- if (comparisonFn) {
- if (comparisonFn(min, item) === 1) {
- min = item;
- }
- }
- else {
- if (item < min) {
- min = item;
- }
- }
- }
- return min;
- },
-
- max: function(array, comparisonFn) {
- var max = array[0],
- i, ln, item;
- for (i = 0, ln = array.length; i < ln; i++) {
- item = array[i];
- if (comparisonFn) {
- if (comparisonFn(max, item) === -1) {
- max = item;
- }
- }
- else {
- if (item > max) {
- max = item;
- }
- }
- }
- return max;
- },
-
- mean: function(array) {
- return array.length > 0 ? ExtArray.sum(array) / array.length : undefined;
- },
-
- sum: function(array) {
- var sum = 0,
- i, ln, item;
- for (i = 0,ln = array.length; i < ln; i++) {
- item = array[i];
- sum += item;
- }
- return sum;
- },
-
- toMap: function(array, getKey, scope) {
- var map = {},
- i = array.length;
- if (!getKey) {
- while (i--) {
- map[array[i]] = i+1;
- }
- } else if (typeof getKey == 'string') {
- while (i--) {
- map[array[i][getKey]] = i+1;
- }
- } else {
- while (i--) {
- map[getKey.call(scope, array[i])] = i+1;
- }
- }
- return map;
- },
-
- erase: erase,
-
- insert: function (array, index, items) {
- return replace(array, index, 0, items);
- },
-
- replace: replace,
-
- splice: splice,
-
- push: function(array) {
- var len = arguments.length,
- i = 1,
- newItem;
- if (array === undefined) {
- array = [];
- } else if (!Ext.isArray(array)) {
- array = [array];
- }
- for (; i < len; i++) {
- newItem = arguments[i];
- Array.prototype.push[Ext.isArray(newItem) ? 'apply' : 'call'](array, newItem);
- }
- return array;
- }
- };
-
- Ext.each = ExtArray.each;
-
- ExtArray.union = ExtArray.merge;
-
- Ext.min = ExtArray.min;
-
- Ext.max = ExtArray.max;
-
- Ext.sum = ExtArray.sum;
-
- Ext.mean = ExtArray.mean;
-
- Ext.flatten = ExtArray.flatten;
-
- Ext.clean = ExtArray.clean;
-
- Ext.unique = ExtArray.unique;
-
- Ext.pluck = ExtArray.pluck;
-
- Ext.toArray = function() {
- return ExtArray.toArray.apply(ExtArray, arguments);
- };
- }());
- //@tag foundation,core
- //@require Array.js
- Ext.Function = {
-
- flexSetter: function(fn) {
- return function(a, b) {
- var k, i;
- if (a === null) {
- return this;
- }
- if (typeof a !== 'string') {
- for (k in a) {
- if (a.hasOwnProperty(k)) {
- fn.call(this, k, a[k]);
- }
- }
- if (Ext.enumerables) {
- for (i = Ext.enumerables.length; i--;) {
- k = Ext.enumerables[i];
- if (a.hasOwnProperty(k)) {
- fn.call(this, k, a[k]);
- }
- }
- }
- } else {
- fn.call(this, a, b);
- }
- return this;
- };
- },
-
- bind: function(fn, scope, args, appendArgs) {
- if (arguments.length === 2) {
- return function() {
- return fn.apply(scope, arguments);
- };
- }
- var method = fn,
- slice = Array.prototype.slice;
- return function() {
- var callArgs = args || arguments;
- if (appendArgs === true) {
- callArgs = slice.call(arguments, 0);
- callArgs = callArgs.concat(args);
- }
- else if (typeof appendArgs == 'number') {
- callArgs = slice.call(arguments, 0);
- Ext.Array.insert(callArgs, appendArgs, args);
- }
- return method.apply(scope || Ext.global, callArgs);
- };
- },
-
- pass: function(fn, args, scope) {
- if (!Ext.isArray(args)) {
- if (Ext.isIterable(args)) {
- args = Ext.Array.clone(args);
- } else {
- args = args !== undefined ? [args] : [];
- }
- }
- return function() {
- var fnArgs = [].concat(args);
- fnArgs.push.apply(fnArgs, arguments);
- return fn.apply(scope || this, fnArgs);
- };
- },
-
- alias: function(object, methodName) {
- return function() {
- return object[methodName].apply(object, arguments);
- };
- },
-
- clone: function(method) {
- return function() {
- return method.apply(this, arguments);
- };
- },
-
- createInterceptor: function(origFn, newFn, scope, returnValue) {
- var method = origFn;
- if (!Ext.isFunction(newFn)) {
- return origFn;
- }
- else {
- return function() {
- var me = this,
- args = arguments;
- newFn.target = me;
- newFn.method = origFn;
- return (newFn.apply(scope || me || Ext.global, args) !== false) ? origFn.apply(me || Ext.global, args) : returnValue || null;
- };
- }
- },
-
- createDelayed: function(fn, delay, scope, args, appendArgs) {
- if (scope || args) {
- fn = Ext.Function.bind(fn, scope, args, appendArgs);
- }
- return function() {
- var me = this,
- args = Array.prototype.slice.call(arguments);
- setTimeout(function() {
- fn.apply(me, args);
- }, delay);
- };
- },
-
- defer: function(fn, millis, scope, args, appendArgs) {
- fn = Ext.Function.bind(fn, scope, args, appendArgs);
- if (millis > 0) {
- return setTimeout(Ext.supports.TimeoutActualLateness ? function () {
- fn();
- } : fn, millis);
- }
- fn();
- return 0;
- },
-
- createSequence: function(originalFn, newFn, scope) {
- if (!newFn) {
- return originalFn;
- }
- else {
- return function() {
- var result = originalFn.apply(this, arguments);
- newFn.apply(scope || this, arguments);
- return result;
- };
- }
- },
-
- createBuffered: function(fn, buffer, scope, args) {
- var timerId;
- return function() {
- var callArgs = args || Array.prototype.slice.call(arguments, 0),
- me = scope || this;
- if (timerId) {
- clearTimeout(timerId);
- }
- timerId = setTimeout(function(){
- fn.apply(me, callArgs);
- }, buffer);
- };
- },
-
- createThrottled: function(fn, interval, scope) {
- var lastCallTime, elapsed, lastArgs, timer, execute = function() {
- fn.apply(scope || this, lastArgs);
- lastCallTime = new Date().getTime();
- };
- return function() {
- elapsed = new Date().getTime() - lastCallTime;
- lastArgs = arguments;
- clearTimeout(timer);
- if (!lastCallTime || (elapsed >= interval)) {
- execute();
- } else {
- timer = setTimeout(execute, interval - elapsed);
- }
- };
- },
-
- interceptBefore: function(object, methodName, fn, scope) {
- var method = object[methodName] || Ext.emptyFn;
- return (object[methodName] = function() {
- var ret = fn.apply(scope || this, arguments);
- method.apply(this, arguments);
- return ret;
- });
- },
-
- interceptAfter: function(object, methodName, fn, scope) {
- var method = object[methodName] || Ext.emptyFn;
- return (object[methodName] = function() {
- method.apply(this, arguments);
- return fn.apply(scope || this, arguments);
- });
- }
- };
- Ext.defer = Ext.Function.alias(Ext.Function, 'defer');
- Ext.pass = Ext.Function.alias(Ext.Function, 'pass');
- Ext.bind = Ext.Function.alias(Ext.Function, 'bind');
- //@tag foundation,core
- //@require Function.js
- (function() {
- var TemplateClass = function(){},
- ExtObject = Ext.Object = {
-
- chain: function (object) {
- TemplateClass.prototype = object;
- var result = new TemplateClass();
- TemplateClass.prototype = null;
- return result;
- },
-
- toQueryObjects: function(name, value, recursive) {
- var self = ExtObject.toQueryObjects,
- objects = [],
- i, ln;
- if (Ext.isArray(value)) {
- for (i = 0, ln = value.length; i < ln; i++) {
- if (recursive) {
- objects = objects.concat(self(name + '[' + i + ']', value[i], true));
- }
- else {
- objects.push({
- name: name,
- value: value[i]
- });
- }
- }
- }
- else if (Ext.isObject(value)) {
- for (i in value) {
- if (value.hasOwnProperty(i)) {
- if (recursive) {
- objects = objects.concat(self(name + '[' + i + ']', value[i], true));
- }
- else {
- objects.push({
- name: name,
- value: value[i]
- });
- }
- }
- }
- }
- else {
- objects.push({
- name: name,
- value: value
- });
- }
- return objects;
- },
-
- toQueryString: function(object, recursive) {
- var paramObjects = [],
- params = [],
- i, j, ln, paramObject, value;
- for (i in object) {
- if (object.hasOwnProperty(i)) {
- paramObjects = paramObjects.concat(ExtObject.toQueryObjects(i, object[i], recursive));
- }
- }
- for (j = 0, ln = paramObjects.length; j < ln; j++) {
- paramObject = paramObjects[j];
- value = paramObject.value;
- if (Ext.isEmpty(value)) {
- value = '';
- }
- else if (Ext.isDate(value)) {
- value = Ext.Date.toString(value);
- }
- params.push(encodeURIComponent(paramObject.name) + '=' + encodeURIComponent(String(value)));
- }
- return params.join('&');
- },
-
- fromQueryString: function(queryString, recursive) {
- var parts = queryString.replace(/^\?/, '').split('&'),
- object = {},
- temp, components, name, value, i, ln,
- part, j, subLn, matchedKeys, matchedName,
- keys, key, nextKey;
- for (i = 0, ln = parts.length; i < ln; i++) {
- part = parts[i];
- if (part.length > 0) {
- components = part.split('=');
- name = decodeURIComponent(components[0]);
- value = (components[1] !== undefined) ? decodeURIComponent(components[1]) : '';
- if (!recursive) {
- if (object.hasOwnProperty(name)) {
- if (!Ext.isArray(object[name])) {
- object[name] = [object[name]];
- }
- object[name].push(value);
- }
- else {
- object[name] = value;
- }
- }
- else {
- matchedKeys = name.match(/(\[):?([^\]]*)\]/g);
- matchedName = name.match(/^([^\[]+)/);
- name = matchedName[0];
- keys = [];
- if (matchedKeys === null) {
- object[name] = value;
- continue;
- }
- for (j = 0, subLn = matchedKeys.length; j < subLn; j++) {
- key = matchedKeys[j];
- key = (key.length === 2) ? '' : key.substring(1, key.length - 1);
- keys.push(key);
- }
- keys.unshift(name);
- temp = object;
- for (j = 0, subLn = keys.length; j < subLn; j++) {
- key = keys[j];
- if (j === subLn - 1) {
- if (Ext.isArray(temp) && key === '') {
- temp.push(value);
- }
- else {
- temp[key] = value;
- }
- }
- else {
- if (temp[key] === undefined || typeof temp[key] === 'string') {
- nextKey = keys[j+1];
- temp[key] = (Ext.isNumeric(nextKey) || nextKey === '') ? [] : {};
- }
- temp = temp[key];
- }
- }
- }
- }
- }
- return object;
- },
-
- each: function(object, fn, scope) {
- for (var property in object) {
- if (object.hasOwnProperty(property)) {
- if (fn.call(scope || object, property, object[property], object) === false) {
- return;
- }
- }
- }
- },
-
- merge: function(destination) {
- var i = 1,
- ln = arguments.length,
- mergeFn = ExtObject.merge,
- cloneFn = Ext.clone,
- object, key, value, sourceKey;
- for (; i < ln; i++) {
- object = arguments[i];
- for (key in object) {
- value = object[key];
- if (value && value.constructor === Object) {
- sourceKey = destination[key];
- if (sourceKey && sourceKey.constructor === Object) {
- mergeFn(sourceKey, value);
- }
- else {
- destination[key] = cloneFn(value);
- }
- }
- else {
- destination[key] = value;
- }
- }
- }
- return destination;
- },
-
- mergeIf: function(destination) {
- var i = 1,
- ln = arguments.length,
- cloneFn = Ext.clone,
- object, key, value;
- for (; i < ln; i++) {
- object = arguments[i];
- for (key in object) {
- if (!(key in destination)) {
- value = object[key];
- if (value && value.constructor === Object) {
- destination[key] = cloneFn(value);
- }
- else {
- destination[key] = value;
- }
- }
- }
- }
- return destination;
- },
-
- getKey: function(object, value) {
- for (var property in object) {
- if (object.hasOwnProperty(property) && object[property] === value) {
- return property;
- }
- }
- return null;
- },
-
- getValues: function(object) {
- var values = [],
- property;
- for (property in object) {
- if (object.hasOwnProperty(property)) {
- values.push(object[property]);
- }
- }
- return values;
- },
-
- getKeys: (typeof Object.keys == 'function')
- ? function(object){
- if (!object) {
- return [];
- }
- return Object.keys(object);
- }
- : function(object) {
- var keys = [],
- property;
- for (property in object) {
- if (object.hasOwnProperty(property)) {
- keys.push(property);
- }
- }
- return keys;
- },
-
- getSize: function(object) {
- var size = 0,
- property;
- for (property in object) {
- if (object.hasOwnProperty(property)) {
- size++;
- }
- }
- return size;
- },
-
- classify: function(object) {
- var prototype = object,
- objectProperties = [],
- propertyClassesMap = {},
- objectClass = function() {
- var i = 0,
- ln = objectProperties.length,
- property;
- for (; i < ln; i++) {
- property = objectProperties[i];
- this[property] = new propertyClassesMap[property]();
- }
- },
- key, value;
- for (key in object) {
- if (object.hasOwnProperty(key)) {
- value = object[key];
- if (value && value.constructor === Object) {
- objectProperties.push(key);
- propertyClassesMap[key] = ExtObject.classify(value);
- }
- }
- }
- objectClass.prototype = prototype;
- return objectClass;
- }
- };
- Ext.merge = Ext.Object.merge;
- Ext.mergeIf = Ext.Object.mergeIf;
- Ext.urlEncode = function() {
- var args = Ext.Array.from(arguments),
- prefix = '';
-
- if ((typeof args[1] === 'string')) {
- prefix = args[1] + '&';
- args[1] = false;
- }
- return prefix + ExtObject.toQueryString.apply(ExtObject, args);
- };
- Ext.urlDecode = function() {
- return ExtObject.fromQueryString.apply(ExtObject, arguments);
- };
- }());
- //@tag foundation,core
- //@require Object.js
- //@define Ext.Date
- (function() {
- function xf(format) {
- var args = Array.prototype.slice.call(arguments, 1);
- return format.replace(/\{(\d+)\}/g, function(m, i) {
- return args[i];
- });
- }
- Ext.Date = {
-
- now: Date.now || function() {
- return +new Date();
- },
-
- toString: function(date) {
- var pad = Ext.String.leftPad;
- return date.getFullYear() + "-"
- + pad(date.getMonth() + 1, 2, '0') + "-"
- + pad(date.getDate(), 2, '0') + "T"
- + pad(date.getHours(), 2, '0') + ":"
- + pad(date.getMinutes(), 2, '0') + ":"
- + pad(date.getSeconds(), 2, '0');
- },
-
- getElapsed: function(dateA, dateB) {
- return Math.abs(dateA - (dateB || new Date()));
- },
-
- useStrict: false,
-
- formatCodeToRegex: function(character, currentGroup) {
-
- var p = utilDate.parseCodes[character];
- if (p) {
- p = typeof p == 'function'? p() : p;
- utilDate.parseCodes[character] = p;
- }
- return p ? Ext.applyIf({
- c: p.c ? xf(p.c, currentGroup || "{0}") : p.c
- }, p) : {
- g: 0,
- c: null,
- s: Ext.String.escapeRegex(character)
- };
- },
-
- parseFunctions: {
- "MS": function(input, strict) {
-
-
- var re = new RegExp('\\/Date\\(([-+])?(\\d+)(?:[+-]\\d{4})?\\)\\/'),
- r = (input || '').match(re);
- return r? new Date(((r[1] || '') + r[2]) * 1) : null;
- }
- },
- parseRegexes: [],
-
- formatFunctions: {
- "MS": function() {
-
- return '\\/Date(' + this.getTime() + ')\\/';
- }
- },
- y2kYear : 50,
-
- MILLI : "ms",
-
- SECOND : "s",
-
- MINUTE : "mi",
-
- HOUR : "h",
-
- DAY : "d",
-
- MONTH : "mo",
-
- YEAR : "y",
-
- defaults: {},
-
-
- dayNames : [
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday"
- ],
-
-
-
- monthNames : [
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
- ],
-
-
-
- monthNumbers : {
- January: 0,
- Jan: 0,
- February: 1,
- Feb: 1,
- March: 2,
- Mar: 2,
- April: 3,
- Apr: 3,
- May: 4,
- June: 5,
- Jun: 5,
- July: 6,
- Jul: 6,
- August: 7,
- Aug: 7,
- September: 8,
- Sep: 8,
- October: 9,
- Oct: 9,
- November: 10,
- Nov: 10,
- December: 11,
- Dec: 11
- },
-
-
-
-
- defaultFormat : "m/d/Y",
-
-
-
- getShortMonthName : function(month) {
- return Ext.Date.monthNames[month].substring(0, 3);
- },
-
-
-
- getShortDayName : function(day) {
- return Ext.Date.dayNames[day].substring(0, 3);
- },
-
-
-
- getMonthNumber : function(name) {
-
- return Ext.Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
- },
-
-
- formatContainsHourInfo : (function(){
- var stripEscapeRe = /(\\.)/g,
- hourInfoRe = /([gGhHisucUOPZ]|MS)/;
- return function(format){
- return hourInfoRe.test(format.replace(stripEscapeRe, ''));
- };
- }()),
-
- formatContainsDateInfo : (function(){
- var stripEscapeRe = /(\\.)/g,
- dateInfoRe = /([djzmnYycU]|MS)/;
- return function(format){
- return dateInfoRe.test(format.replace(stripEscapeRe, ''));
- };
- }()),
-
-
- unescapeFormat: (function() {
- var slashRe = /\\/gi;
- return function(format) {
-
-
-
- return format.replace(slashRe, '');
- }
- }()),
-
- formatCodes : {
- d: "Ext.String.leftPad(this.getDate(), 2, '0')",
- D: "Ext.Date.getShortDayName(this.getDay())",
- j: "this.getDate()",
- l: "Ext.Date.dayNames[this.getDay()]",
- N: "(this.getDay() ? this.getDay() : 7)",
- S: "Ext.Date.getSuffix(this)",
- w: "this.getDay()",
- z: "Ext.Date.getDayOfYear(this)",
- W: "Ext.String.leftPad(Ext.Date.getWeekOfYear(this), 2, '0')",
- F: "Ext.Date.monthNames[this.getMonth()]",
- m: "Ext.String.leftPad(this.getMonth() + 1, 2, '0')",
- M: "Ext.Date.getShortMonthName(this.getMonth())",
- n: "(this.getMonth() + 1)",
- t: "Ext.Date.getDaysInMonth(this)",
- L: "(Ext.Date.isLeapYear(this) ? 1 : 0)",
- o: "(this.getFullYear() + (Ext.Date.getWeekOfYear(this) == 1 && this.getMonth() > 0 ? +1 : (Ext.Date.getWeekOfYear(this) >= 52 && this.getMonth() < 11 ? -1 : 0)))",
- Y: "Ext.String.leftPad(this.getFullYear(), 4, '0')",
- y: "('' + this.getFullYear()).substring(2, 4)",
- a: "(this.getHours() < 12 ? 'am' : 'pm')",
- A: "(this.getHours() < 12 ? 'AM' : 'PM')",
- g: "((this.getHours() % 12) ? this.getHours() % 12 : 12)",
- G: "this.getHours()",
- h: "Ext.String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0')",
- H: "Ext.String.leftPad(this.getHours(), 2, '0')",
- i: "Ext.String.leftPad(this.getMinutes(), 2, '0')",
- s: "Ext.String.leftPad(this.getSeconds(), 2, '0')",
- u: "Ext.String.leftPad(this.getMilliseconds(), 3, '0')",
- O: "Ext.Date.getGMTOffset(this)",
- P: "Ext.Date.getGMTOffset(this, true)",
- T: "Ext.Date.getTimezone(this)",
- Z: "(this.getTimezoneOffset() * -60)",
- c: function() {
- var c, code, i, l, e;
- for (c = "Y-m-dTH:i:sP", code = [], i = 0, l = c.length; i < l; ++i) {
- e = c.charAt(i);
- code.push(e == "T" ? "'T'" : utilDate.getFormatCode(e));
- }
- return code.join(" + ");
- },
-
- U: "Math.round(this.getTime() / 1000)"
- },
-
- isValid : function(y, m, d, h, i, s, ms) {
-
- h = h || 0;
- i = i || 0;
- s = s || 0;
- ms = ms || 0;
-
- var dt = utilDate.add(new Date(y < 100 ? 100 : y, m - 1, d, h, i, s, ms), utilDate.YEAR, y < 100 ? y - 100 : 0);
- return y == dt.getFullYear() &&
- m == dt.getMonth() + 1 &&
- d == dt.getDate() &&
- h == dt.getHours() &&
- i == dt.getMinutes() &&
- s == dt.getSeconds() &&
- ms == dt.getMilliseconds();
- },
-
- parse : function(input, format, strict) {
- var p = utilDate.parseFunctions;
- if (p[format] == null) {
- utilDate.createParser(format);
- }
- return p[format](input, Ext.isDefined(strict) ? strict : utilDate.useStrict);
- },
-
- parseDate: function(input, format, strict){
- return utilDate.parse(input, format, strict);
- },
-
- getFormatCode : function(character) {
- var f = utilDate.formatCodes[character];
- if (f) {
- f = typeof f == 'function'? f() : f;
- utilDate.formatCodes[character] = f;
- }
-
- return f || ("'" + Ext.String.escape(character) + "'");
- },
-
- createFormat : function(format) {
- var code = [],
- special = false,
- ch = '',
- i;
- for (i = 0; i < format.length; ++i) {
- ch = format.charAt(i);
- if (!special && ch == "\\") {
- special = true;
- } else if (special) {
- special = false;
- code.push("'" + Ext.String.escape(ch) + "'");
- } else {
- code.push(utilDate.getFormatCode(ch));
- }
- }
- utilDate.formatFunctions[format] = Ext.functionFactory("return " + code.join('+'));
- },
-
- createParser : (function() {
- var code = [
- "var dt, y, m, d, h, i, s, ms, o, z, zz, u, v,",
- "def = Ext.Date.defaults,",
- "results = String(input).match(Ext.Date.parseRegexes[{0}]);",
- "if(results){",
- "{1}",
- "if(u != null){",
- "v = new Date(u * 1000);",
- "}else{",
-
-
-
- "dt = Ext.Date.clearTime(new Date);",
-
- "y = Ext.Number.from(y, Ext.Number.from(def.y, dt.getFullYear()));",
- "m = Ext.Number.from(m, Ext.Number.from(def.m - 1, dt.getMonth()));",
- "d = Ext.Number.from(d, Ext.Number.from(def.d, dt.getDate()));",
-
- "h = Ext.Number.from(h, Ext.Number.from(def.h, dt.getHours()));",
- "i = Ext.Number.from(i, Ext.Number.from(def.i, dt.getMinutes()));",
- "s = Ext.Number.from(s, Ext.Number.from(def.s, dt.getSeconds()));",
- "ms = Ext.Number.from(ms, Ext.Number.from(def.ms, dt.getMilliseconds()));",
- "if(z >= 0 && y >= 0){",
-
-
-
-
- "v = Ext.Date.add(new Date(y < 100 ? 100 : y, 0, 1, h, i, s, ms), Ext.Date.YEAR, y < 100 ? y - 100 : 0);",
-
- "v = !strict? v : (strict === true && (z <= 364 || (Ext.Date.isLeapYear(v) && z <= 365))? Ext.Date.add(v, Ext.Date.DAY, z) : null);",
- "}else if(strict === true && !Ext.Date.isValid(y, m + 1, d, h, i, s, ms)){",
- "v = null;",
- "}else{",
-
-
- "v = Ext.Date.add(new Date(y < 100 ? 100 : y, m, d, h, i, s, ms), Ext.Date.YEAR, y < 100 ? y - 100 : 0);",
- "}",
- "}",
- "}",
- "if(v){",
-
- "if(zz != null){",
-
- "v = Ext.Date.add(v, Ext.Date.SECOND, -v.getTimezoneOffset() * 60 - zz);",
- "}else if(o){",
-
- "v = Ext.Date.add(v, Ext.Date.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn));",
- "}",
- "}",
- "return v;"
- ].join('\n');
- return function(format) {
- var regexNum = utilDate.parseRegexes.length,
- currentGroup = 1,
- calc = [],
- regex = [],
- special = false,
- ch = "",
- i = 0,
- len = format.length,
- atEnd = [],
- obj;
- for (; i < len; ++i) {
- ch = format.charAt(i);
- if (!special && ch == "\\") {
- special = true;
- } else if (special) {
- special = false;
- regex.push(Ext.String.escape(ch));
- } else {
- obj = utilDate.formatCodeToRegex(ch, currentGroup);
- currentGroup += obj.g;
- regex.push(obj.s);
- if (obj.g && obj.c) {
- if (obj.calcAtEnd) {
- atEnd.push(obj.c);
- } else {
- calc.push(obj.c);
- }
- }
- }
- }
-
- calc = calc.concat(atEnd);
- utilDate.parseRegexes[regexNum] = new RegExp("^" + regex.join('') + "$", 'i');
- utilDate.parseFunctions[format] = Ext.functionFactory("input", "strict", xf(code, regexNum, calc.join('')));
- };
- }()),
-
- parseCodes : {
-
- d: {
- g:1,
- c:"d = parseInt(results[{0}], 10);\n",
- s:"(3[0-1]|[1-2][0-9]|0[1-9])"
- },
- j: {
- g:1,
- c:"d = parseInt(results[{0}], 10);\n",
- s:"(3[0-1]|[1-2][0-9]|[1-9])"
- },
- D: function() {
- for (var a = [], i = 0; i < 7; a.push(utilDate.getShortDayName(i)), ++i);
- return {
- g:0,
- c:null,
- s:"(?:" + a.join("|") +")"
- };
- },
- l: function() {
- return {
- g:0,
- c:null,
- s:"(?:" + utilDate.dayNames.join("|") + ")"
- };
- },
- N: {
- g:0,
- c:null,
- s:"[1-7]"
- },
-
- S: {
- g:0,
- c:null,
- s:"(?:st|nd|rd|th)"
- },
-
- w: {
- g:0,
- c:null,
- s:"[0-6]"
- },
- z: {
- g:1,
- c:"z = parseInt(results[{0}], 10);\n",
- s:"(\\d{1,3})"
- },
- W: {
- g:0,
- c:null,
- s:"(?:\\d{2})"
- },
- F: function() {
- return {
- g:1,
- c:"m = parseInt(Ext.Date.getMonthNumber(results[{0}]), 10);\n",
- s:"(" + utilDate.monthNames.join("|") + ")"
- };
- },
- M: function() {
- for (var a = [], i = 0; i < 12; a.push(utilDate.getShortMonthName(i)), ++i);
- return Ext.applyIf({
- s:"(" + a.join("|") + ")"
- }, utilDate.formatCodeToRegex("F"));
- },
- m: {
- g:1,
- c:"m = parseInt(results[{0}], 10) - 1;\n",
- s:"(1[0-2]|0[1-9])"
- },
- n: {
- g:1,
- c:"m = parseInt(results[{0}], 10) - 1;\n",
- s:"(1[0-2]|[1-9])"
- },
- t: {
- g:0,
- c:null,
- s:"(?:\\d{2})"
- },
- L: {
- g:0,
- c:null,
- s:"(?:1|0)"
- },
- o: function() {
- return utilDate.formatCodeToRegex("Y");
- },
- Y: {
- g:1,
- c:"y = parseInt(results[{0}], 10);\n",
- s:"(\\d{4})"
- },
- y: {
- g:1,
- c:"var ty = parseInt(results[{0}], 10);\n"
- + "y = ty > Ext.Date.y2kYear ? 1900 + ty : 2000 + ty;\n",
- s:"(\\d{1,2})"
- },
-
-
- a: {
- g:1,
- c:"if (/(am)/i.test(results[{0}])) {\n"
- + "if (!h || h == 12) { h = 0; }\n"
- + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
- s:"(am|pm|AM|PM)",
- calcAtEnd: true
- },
-
-
- A: {
- g:1,
- c:"if (/(am)/i.test(results[{0}])) {\n"
- + "if (!h || h == 12) { h = 0; }\n"
- + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
- s:"(AM|PM|am|pm)",
- calcAtEnd: true
- },
-
- g: {
- g:1,
- c:"h = parseInt(results[{0}], 10);\n",
- s:"(1[0-2]|[0-9])"
- },
- G: {
- g:1,
- c:"h = parseInt(results[{0}], 10);\n",
- s:"(2[0-3]|1[0-9]|[0-9])"
- },
- h: {
- g:1,
- c:"h = parseInt(results[{0}], 10);\n",
- s:"(1[0-2]|0[1-9])"
- },
- H: {
- g:1,
- c:"h = parseInt(results[{0}], 10);\n",
- s:"(2[0-3]|[0-1][0-9])"
- },
- i: {
- g:1,
- c:"i = parseInt(results[{0}], 10);\n",
- s:"([0-5][0-9])"
- },
- s: {
- g:1,
- c:"s = parseInt(results[{0}], 10);\n",
- s:"([0-5][0-9])"
- },
- u: {
- g:1,
- c:"ms = results[{0}]; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n",
- s:"(\\d+)"
- },
- O: {
- g:1,
- c:[
- "o = results[{0}];",
- "var sn = o.substring(0,1),",
- "hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60),",
- "mn = o.substring(3,5) % 60;",
- "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + Ext.String.leftPad(hr, 2, '0') + Ext.String.leftPad(mn, 2, '0')) : null;\n"
- ].join("\n"),
- s: "([+-]\\d{4})"
- },
- P: {
- g:1,
- c:[
- "o = results[{0}];",
- "var sn = o.substring(0,1),",
- "hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60),",
- "mn = o.substring(4,6) % 60;",
- "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + Ext.String.leftPad(hr, 2, '0') + Ext.String.leftPad(mn, 2, '0')) : null;\n"
- ].join("\n"),
- s: "([+-]\\d{2}:\\d{2})"
- },
- T: {
- g:0,
- c:null,
- s:"[A-Z]{1,4}"
- },
- Z: {
- g:1,
- c:"zz = results[{0}] * 1;\n"
- + "zz = (-43200 <= zz && zz <= 50400)? zz : null;\n",
- s:"([+-]?\\d{1,5})"
- },
- c: function() {
- var calc = [],
- arr = [
- utilDate.formatCodeToRegex("Y", 1),
- utilDate.formatCodeToRegex("m", 2),
- utilDate.formatCodeToRegex("d", 3),
- utilDate.formatCodeToRegex("H", 4),
- utilDate.formatCodeToRegex("i", 5),
- utilDate.formatCodeToRegex("s", 6),
- {c:"ms = results[7] || '0'; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n"},
- {c:[
- "if(results[8]) {",
- "if(results[8] == 'Z'){",
- "zz = 0;",
- "}else if (results[8].indexOf(':') > -1){",
- utilDate.formatCodeToRegex("P", 8).c,
- "}else{",
- utilDate.formatCodeToRegex("O", 8).c,
- "}",
- "}"
- ].join('\n')}
- ],
- i,
- l;
- for (i = 0, l = arr.length; i < l; ++i) {
- calc.push(arr[i].c);
- }
- return {
- g:1,
- c:calc.join(""),
- s:[
- arr[0].s,
- "(?:", "-", arr[1].s,
- "(?:", "-", arr[2].s,
- "(?:",
- "(?:T| )?",
- arr[3].s, ":", arr[4].s,
- "(?::", arr[5].s, ")?",
- "(?:(?:\\.|,)(\\d+))?",
- "(Z|(?:[-+]\\d{2}(?::)?\\d{2}))?",
- ")?",
- ")?",
- ")?"
- ].join("")
- };
- },
- U: {
- g:1,
- c:"u = parseInt(results[{0}], 10);\n",
- s:"(-?\\d+)"
- }
- },
-
-
- dateFormat: function(date, format) {
- return utilDate.format(date, format);
- },
-
- isEqual: function(date1, date2) {
-
- if (date1 && date2) {
- return (date1.getTime() === date2.getTime());
- }
-
- return !(date1 || date2);
- },
-
- format: function(date, format) {
- var formatFunctions = utilDate.formatFunctions;
- if (!Ext.isDate(date)) {
- return '';
- }
- if (formatFunctions[format] == null) {
- utilDate.createFormat(format);
- }
- return formatFunctions[format].call(date) + '';
- },
-
- getTimezone : function(date) {
-
-
-
-
-
-
-
-
-
-
-
-
- return date.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, "");
- },
-
- getGMTOffset : function(date, colon) {
- var offset = date.getTimezoneOffset();
- return (offset > 0 ? "-" : "+")
- + Ext.String.leftPad(Math.floor(Math.abs(offset) / 60), 2, "0")
- + (colon ? ":" : "")
- + Ext.String.leftPad(Math.abs(offset % 60), 2, "0");
- },
-
- getDayOfYear: function(date) {
- var num = 0,
- d = Ext.Date.clone(date),
- m = date.getMonth(),
- i;
- for (i = 0, d.setDate(1), d.setMonth(0); i < m; d.setMonth(++i)) {
- num += utilDate.getDaysInMonth(d);
- }
- return num + date.getDate() - 1;
- },
-
- getWeekOfYear : (function() {
-
- var ms1d = 864e5,
- ms7d = 7 * ms1d;
- return function(date) {
- var DC3 = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate() + 3) / ms1d,
- AWN = Math.floor(DC3 / 7),
- Wyr = new Date(AWN * ms7d).getUTCFullYear();
- return AWN - Math.floor(Date.UTC(Wyr, 0, 7) / ms7d) + 1;
- };
- }()),
-
- isLeapYear : function(date) {
- var year = date.getFullYear();
- return !!((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));
- },
-
- getFirstDayOfMonth : function(date) {
- var day = (date.getDay() - (date.getDate() - 1)) % 7;
- return (day < 0) ? (day + 7) : day;
- },
-
- getLastDayOfMonth : function(date) {
- return utilDate.getLastDateOfMonth(date).getDay();
- },
-
- getFirstDateOfMonth : function(date) {
- return new Date(date.getFullYear(), date.getMonth(), 1);
- },
-
- getLastDateOfMonth : function(date) {
- return new Date(date.getFullYear(), date.getMonth(), utilDate.getDaysInMonth(date));
- },
-
- getDaysInMonth: (function() {
- var daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
- return function(date) {
- var m = date.getMonth();
- return m == 1 && utilDate.isLeapYear(date) ? 29 : daysInMonth[m];
- };
- }()),
-
-
- getSuffix : function(date) {
- switch (date.getDate()) {
- case 1:
- case 21:
- case 31:
- return "st";
- case 2:
- case 22:
- return "nd";
- case 3:
- case 23:
- return "rd";
- default:
- return "th";
- }
- },
-
-
- clone : function(date) {
- return new Date(date.getTime());
- },
-
- isDST : function(date) {
-
-
- return new Date(date.getFullYear(), 0, 1).getTimezoneOffset() != date.getTimezoneOffset();
- },
-
- clearTime : function(date, clone) {
- if (clone) {
- return Ext.Date.clearTime(Ext.Date.clone(date));
- }
-
- var d = date.getDate(),
- hr,
- c;
-
- date.setHours(0);
- date.setMinutes(0);
- date.setSeconds(0);
- date.setMilliseconds(0);
- if (date.getDate() != d) {
-
-
-
- for (hr = 1, c = utilDate.add(date, Ext.Date.HOUR, hr); c.getDate() != d; hr++, c = utilDate.add(date, Ext.Date.HOUR, hr));
- date.setDate(d);
- date.setHours(c.getHours());
- }
- return date;
- },
-
- add : function(date, interval, value) {
- var d = Ext.Date.clone(date),
- Date = Ext.Date,
- day;
- if (!interval || value === 0) {
- return d;
- }
- switch(interval.toLowerCase()) {
- case Ext.Date.MILLI:
- d.setMilliseconds(d.getMilliseconds() + value);
- break;
- case Ext.Date.SECOND:
- d.setSeconds(d.getSeconds() + value);
- break;
- case Ext.Date.MINUTE:
- d.setMinutes(d.getMinutes() + value);
- break;
- case Ext.Date.HOUR:
- d.setHours(d.getHours() + value);
- break;
- case Ext.Date.DAY:
- d.setDate(d.getDate() + value);
- break;
- case Ext.Date.MONTH:
- day = date.getDate();
- if (day > 28) {
- day = Math.min(day, Ext.Date.getLastDateOfMonth(Ext.Date.add(Ext.Date.getFirstDateOfMonth(date), Ext.Date.MONTH, value)).getDate());
- }
- d.setDate(day);
- d.setMonth(date.getMonth() + value);
- break;
- case Ext.Date.YEAR:
- day = date.getDate();
- if (day > 28) {
- day = Math.min(day, Ext.Date.getLastDateOfMonth(Ext.Date.add(Ext.Date.getFirstDateOfMonth(date), Ext.Date.YEAR, value)).getDate());
- }
- d.setDate(day);
- d.setFullYear(date.getFullYear() + value);
- break;
- }
- return d;
- },
-
- between : function(date, start, end) {
- var t = date.getTime();
- return start.getTime() <= t && t <= end.getTime();
- },
-
- compat: function() {
- var nativeDate = window.Date,
- p, u,
- statics = ['useStrict', 'formatCodeToRegex', 'parseFunctions', 'parseRegexes', 'formatFunctions', 'y2kYear', 'MILLI', 'SECOND', 'MINUTE', 'HOUR', 'DAY', 'MONTH', 'YEAR', 'defaults', 'dayNames', 'monthNames', 'monthNumbers', 'getShortMonthName', 'getShortDayName', 'getMonthNumber', 'formatCodes', 'isValid', 'parseDate', 'getFormatCode', 'createFormat', 'createParser', 'parseCodes'],
- proto = ['dateFormat', 'format', 'getTimezone', 'getGMTOffset', 'getDayOfYear', 'getWeekOfYear', 'isLeapYear', 'getFirstDayOfMonth', 'getLastDayOfMonth', 'getDaysInMonth', 'getSuffix', 'clone', 'isDST', 'clearTime', 'add', 'between'],
- sLen = statics.length,
- pLen = proto.length,
- stat, prot, s;
-
- for (s = 0; s < sLen; s++) {
- stat = statics[s];
- nativeDate[stat] = utilDate[stat];
- }
-
- for (p = 0; p < pLen; p++) {
- prot = proto[p];
- nativeDate.prototype[prot] = function() {
- var args = Array.prototype.slice.call(arguments);
- args.unshift(this);
- return utilDate[prot].apply(utilDate, args);
- };
- }
- }
- };
- var utilDate = Ext.Date;
- }());
- //@tag foundation,core
- //@require ../lang/Date.js
- (function(flexSetter) {
- var noArgs = [],
- Base = function(){};
-
- Ext.apply(Base, {
- $className: 'Ext.Base',
- $isClass: true,
-
- create: function() {
- return Ext.create.apply(Ext, [this].concat(Array.prototype.slice.call(arguments, 0)));
- },
-
- extend: function(parent) {
- var parentPrototype = parent.prototype,
- basePrototype, prototype, i, ln, name, statics;
- prototype = this.prototype = Ext.Object.chain(parentPrototype);
- prototype.self = this;
- this.superclass = prototype.superclass = parentPrototype;
- if (!parent.$isClass) {
- basePrototype = Ext.Base.prototype;
- for (i in basePrototype) {
- if (i in prototype) {
- prototype[i] = basePrototype[i];
- }
- }
- }
-
- statics = parentPrototype.$inheritableStatics;
- if (statics) {
- for (i = 0,ln = statics.length; i < ln; i++) {
- name = statics[i];
- if (!this.hasOwnProperty(name)) {
- this[name] = parent[name];
- }
- }
- }
- if (parent.$onExtended) {
- this.$onExtended = parent.$onExtended.slice();
- }
- prototype.config = new prototype.configClass();
- prototype.initConfigList = prototype.initConfigList.slice();
- prototype.initConfigMap = Ext.clone(prototype.initConfigMap);
- prototype.configMap = Ext.Object.chain(prototype.configMap);
- },
-
- $onExtended: [],
-
- triggerExtended: function() {
- var callbacks = this.$onExtended,
- ln = callbacks.length,
- i, callback;
- if (ln > 0) {
- for (i = 0; i < ln; i++) {
- callback = callbacks[i];
- callback.fn.apply(callback.scope || this, arguments);
- }
- }
- },
-
- onExtended: function(fn, scope) {
- this.$onExtended.push({
- fn: fn,
- scope: scope
- });
- return this;
- },
-
- addConfig: function(config, fullMerge) {
- var prototype = this.prototype,
- configNameCache = Ext.Class.configNameCache,
- hasConfig = prototype.configMap,
- initConfigList = prototype.initConfigList,
- initConfigMap = prototype.initConfigMap,
- defaultConfig = prototype.config,
- initializedName, name, value;
- for (name in config) {
- if (config.hasOwnProperty(name)) {
- if (!hasConfig[name]) {
- hasConfig[name] = true;
- }
- value = config[name];
- initializedName = configNameCache[name].initialized;
- if (!initConfigMap[name] && value !== null && !prototype[initializedName]) {
- initConfigMap[name] = true;
- initConfigList.push(name);
- }
- }
- }
- if (fullMerge) {
- Ext.merge(defaultConfig, config);
- }
- else {
- Ext.mergeIf(defaultConfig, config);
- }
- prototype.configClass = Ext.Object.classify(defaultConfig);
- },
-
- addStatics: function(members) {
- var member, name;
- for (name in members) {
- if (members.hasOwnProperty(name)) {
- member = members[name];
- if (typeof member == 'function' && !member.$isClass && member !== Ext.emptyFn && member !== Ext.identityFn) {
- member.$owner = this;
- member.$name = name;
- }
- this[name] = member;
- }
- }
- return this;
- },
-
- addInheritableStatics: function(members) {
- var inheritableStatics,
- hasInheritableStatics,
- prototype = this.prototype,
- name, member;
- inheritableStatics = prototype.$inheritableStatics;
- hasInheritableStatics = prototype.$hasInheritableStatics;
- if (!inheritableStatics) {
- inheritableStatics = prototype.$inheritableStatics = [];
- hasInheritableStatics = prototype.$hasInheritableStatics = {};
- }
- for (name in members) {
- if (members.hasOwnProperty(name)) {
- member = members[name];
- this[name] = member;
- if (!hasInheritableStatics[name]) {
- hasInheritableStatics[name] = true;
- inheritableStatics.push(name);
- }
- }
- }
- return this;
- },
-
- addMembers: function(members) {
- var prototype = this.prototype,
- enumerables = Ext.enumerables,
- names = [],
- i, ln, name, member;
- for (name in members) {
- names.push(name);
- }
- if (enumerables) {
- names.push.apply(names, enumerables);
- }
- for (i = 0,ln = names.length; i < ln; i++) {
- name = names[i];
- if (members.hasOwnProperty(name)) {
- member = members[name];
- if (typeof member == 'function' && !member.$isClass && member !== Ext.emptyFn) {
- member.$owner = this;
- member.$name = name;
- }
- prototype[name] = member;
- }
- }
- return this;
- },
-
- addMember: function(name, member) {
- if (typeof member == 'function' && !member.$isClass && member !== Ext.emptyFn) {
- member.$owner = this;
- member.$name = name;
- }
- this.prototype[name] = member;
- return this;
- },
-
- implement: function() {
- this.addMembers.apply(this, arguments);
- },
-
- borrow: function(fromClass, members) {
- var prototype = this.prototype,
- fromPrototype = fromClass.prototype,
- i, ln, name, fn, toBorrow;
- members = Ext.Array.from(members);
- for (i = 0,ln = members.length; i < ln; i++) {
- name = members[i];
- toBorrow = fromPrototype[name];
- if (typeof toBorrow == 'function') {
- fn = Ext.Function.clone(toBorrow);
- fn.$owner = this;
- fn.$name = name;
- prototype[name] = fn;
- }
- else {
- prototype[name] = toBorrow;
- }
- }
- return this;
- },
-
- override: function(members) {
- var me = this,
- enumerables = Ext.enumerables,
- target = me.prototype,
- cloneFunction = Ext.Function.clone,
- name, index, member, statics, names, previous;
- if (arguments.length === 2) {
- name = members;
- members = {};
- members[name] = arguments[1];
- enumerables = null;
- }
- do {
- names = [];
- statics = null;
- for (name in members) {
- if (name == 'statics') {
- statics = members[name];
- } else if (name == 'config') {
- me.addConfig(members[name], true);
- } else {
- names.push(name);
- }
- }
- if (enumerables) {
- names.push.apply(names, enumerables);
- }
- for (index = names.length; index--; ) {
- name = names[index];
- if (members.hasOwnProperty(name)) {
- member = members[name];
- if (typeof member == 'function' && !member.$className && member !== Ext.emptyFn) {
- if (typeof member.$owner != 'undefined') {
- member = cloneFunction(member);
- }
- member.$owner = me;
- member.$name = name;
- previous = target[name];
- if (previous) {
- member.$previous = previous;
- }
- }
- target[name] = member;
- }
- }
- target = me;
- members = statics;
- } while (members);
- return this;
- },
-
- callParent: function(args) {
- var method;
-
- return (method = this.callParent.caller) && (method.$previous ||
- ((method = method.$owner ? method : method.caller) &&
- method.$owner.superclass.self[method.$name])).apply(this, args || noArgs);
- },
-
- callSuper: function(args) {
- var method;
-
- return (method = this.callSuper.caller) &&
- ((method = method.$owner ? method : method.caller) &&
- method.$owner.superclass.self[method.$name]).apply(this, args || noArgs);
- },
-
- mixin: function(name, mixinClass) {
- var mixin = mixinClass.prototype,
- prototype = this.prototype,
- key;
- if (typeof mixin.onClassMixedIn != 'undefined') {
- mixin.onClassMixedIn.call(mixinClass, this);
- }
- if (!prototype.hasOwnProperty('mixins')) {
- if ('mixins' in prototype) {
- prototype.mixins = Ext.Object.chain(prototype.mixins);
- }
- else {
- prototype.mixins = {};
- }
- }
- for (key in mixin) {
- if (key === 'mixins') {
- Ext.merge(prototype.mixins, mixin[key]);
- }
- else if (typeof prototype[key] == 'undefined' && key != 'mixinId' && key != 'config') {
- prototype[key] = mixin[key];
- }
- }
- if ('config' in mixin) {
- this.addConfig(mixin.config, false);
- }
- prototype.mixins[name] = mixin;
- },
-
- getName: function() {
- return Ext.getClassName(this);
- },
-
- createAlias: flexSetter(function(alias, origin) {
- this.override(alias, function() {
- return this[origin].apply(this, arguments);
- });
- }),
-
- addXtype: function(xtype) {
- var prototype = this.prototype,
- xtypesMap = prototype.xtypesMap,
- xtypes = prototype.xtypes,
- xtypesChain = prototype.xtypesChain;
- if (!prototype.hasOwnProperty('xtypesMap')) {
- xtypesMap = prototype.xtypesMap = Ext.merge({}, prototype.xtypesMap || {});
- xtypes = prototype.xtypes = prototype.xtypes ? [].concat(prototype.xtypes) : [];
- xtypesChain = prototype.xtypesChain = prototype.xtypesChain ? [].concat(prototype.xtypesChain) : [];
- prototype.xtype = xtype;
- }
- if (!xtypesMap[xtype]) {
- xtypesMap[xtype] = true;
- xtypes.push(xtype);
- xtypesChain.push(xtype);
- Ext.ClassManager.setAlias(this, 'widget.' + xtype);
- }
- return this;
- }
- });
- Base.implement({
-
- isInstance: true,
-
- $className: 'Ext.Base',
-
- configClass: Ext.emptyFn,
-
- initConfigList: [],
-
- configMap: {},
-
- initConfigMap: {},
-
- statics: function() {
- var method = this.statics.caller,
- self = this.self;
- if (!method) {
- return self;
- }
- return method.$owner;
- },
-
- callParent: function(args) {
-
-
-
-
- var method,
- superMethod = (method = this.callParent.caller) && (method.$previous ||
- ((method = method.$owner ? method : method.caller) &&
- method.$owner.superclass[method.$name]));
- return superMethod.apply(this, args || noArgs);
- },
-
- callSuper: function(args) {
-
-
-
-
- var method,
- superMethod = (method = this.callSuper.caller) &&
- ((method = method.$owner ? method : method.caller) &&
- method.$owner.superclass[method.$name]);
- return superMethod.apply(this, args || noArgs);
- },
-
- self: Base,
-
- constructor: function() {
- return this;
- },
-
- initConfig: function(config) {
- var instanceConfig = config,
- configNameCache = Ext.Class.configNameCache,
- defaultConfig = new this.configClass(),
- defaultConfigList = this.initConfigList,
- hasConfig = this.configMap,
- nameMap, i, ln, name, initializedName;
- this.initConfig = Ext.emptyFn;
- this.initialConfig = instanceConfig || {};
- this.config = config = (instanceConfig) ? Ext.merge(defaultConfig, config) : defaultConfig;
- if (instanceConfig) {
- defaultConfigList = defaultConfigList.slice();
- for (name in instanceConfig) {
- if (hasConfig[name]) {
- if (instanceConfig[name] !== null) {
- defaultConfigList.push(name);
- this[configNameCache[name].initialized] = false;
- }
- }
- }
- }
- for (i = 0,ln = defaultConfigList.length; i < ln; i++) {
- name = defaultConfigList[i];
- nameMap = configNameCache[name];
- initializedName = nameMap.initialized;
- if (!this[initializedName]) {
- this[initializedName] = true;
- this[nameMap.set].call(this, config[name]);
- }
- }
- return this;
- },
-
- hasConfig: function(name) {
- return Boolean(this.configMap[name]);
- },
-
- setConfig: function(config, applyIfNotSet) {
- if (!config) {
- return this;
- }
- var configNameCache = Ext.Class.configNameCache,
- currentConfig = this.config,
- hasConfig = this.configMap,
- initialConfig = this.initialConfig,
- name, value;
- applyIfNotSet = Boolean(applyIfNotSet);
- for (name in config) {
- if (applyIfNotSet && initialConfig.hasOwnProperty(name)) {
- continue;
- }
- value = config[name];
- currentConfig[name] = value;
- if (hasConfig[name]) {
- this[configNameCache[name].set](value);
- }
- }
- return this;
- },
-
- getConfig: function(name) {
- var configNameCache = Ext.Class.configNameCache;
- return this[configNameCache[name].get]();
- },
-
- getInitialConfig: function(name) {
- var config = this.config;
- if (!name) {
- return config;
- }
- else {
- return config[name];
- }
- },
-
- onConfigUpdate: function(names, callback, scope) {
- var self = this.self,
- i, ln, name,
- updaterName, updater, newUpdater;
- names = Ext.Array.from(names);
- scope = scope || this;
- for (i = 0,ln = names.length; i < ln; i++) {
- name = names[i];
- updaterName = 'update' + Ext.String.capitalize(name);
- updater = this[updaterName] || Ext.emptyFn;
- newUpdater = function() {
- updater.apply(this, arguments);
- scope[callback].apply(scope, arguments);
- };
- newUpdater.$name = updaterName;
- newUpdater.$owner = self;
- this[updaterName] = newUpdater;
- }
- },
-
- destroy: function() {
- this.destroy = Ext.emptyFn;
- }
- });
-
- Base.prototype.callOverridden = Base.prototype.callParent;
- Ext.Base = Base;
- }(Ext.Function.flexSetter));
- //@tag foundation,core
- //@require Base.js
- (function() {
- var ExtClass,
- Base = Ext.Base,
- baseStaticMembers = [],
- baseStaticMember, baseStaticMemberLength;
- for (baseStaticMember in Base) {
- if (Base.hasOwnProperty(baseStaticMember)) {
- baseStaticMembers.push(baseStaticMember);
- }
- }
- baseStaticMemberLength = baseStaticMembers.length;
-
- function makeCtor (className) {
- function constructor () {
-
-
- return this.constructor.apply(this, arguments) || null;
- }
- return constructor;
- }
-
- Ext.Class = ExtClass = function(Class, data, onCreated) {
- if (typeof Class != 'function') {
- onCreated = data;
- data = Class;
- Class = null;
- }
- if (!data) {
- data = {};
- }
- Class = ExtClass.create(Class, data);
- ExtClass.process(Class, data, onCreated);
- return Class;
- };
- Ext.apply(ExtClass, {
-
- onBeforeCreated: function(Class, data, hooks) {
- Class.addMembers(data);
- hooks.onCreated.call(Class, Class);
- },
-
- create: function(Class, data) {
- var name, i;
- if (!Class) {
- Class = makeCtor(
- );
- }
- for (i = 0; i < baseStaticMemberLength; i++) {
- name = baseStaticMembers[i];
- Class[name] = Base[name];
- }
- return Class;
- },
-
- process: function(Class, data, onCreated) {
- var preprocessorStack = data.preprocessors || ExtClass.defaultPreprocessors,
- registeredPreprocessors = this.preprocessors,
- hooks = {
- onBeforeCreated: this.onBeforeCreated
- },
- preprocessors = [],
- preprocessor, preprocessorsProperties,
- i, ln, j, subLn, preprocessorProperty, process;
- delete data.preprocessors;
- for (i = 0,ln = preprocessorStack.length; i < ln; i++) {
- preprocessor = preprocessorStack[i];
- if (typeof preprocessor == 'string') {
- preprocessor = registeredPreprocessors[preprocessor];
- preprocessorsProperties = preprocessor.properties;
- if (preprocessorsProperties === true) {
- preprocessors.push(preprocessor.fn);
- }
- else if (preprocessorsProperties) {
- for (j = 0,subLn = preprocessorsProperties.length; j < subLn; j++) {
- preprocessorProperty = preprocessorsProperties[j];
- if (data.hasOwnProperty(preprocessorProperty)) {
- preprocessors.push(preprocessor.fn);
- break;
- }
- }
- }
- }
- else {
- preprocessors.push(preprocessor);
- }
- }
- hooks.onCreated = onCreated ? onCreated : Ext.emptyFn;
- hooks.preprocessors = preprocessors;
- this.doProcess(Class, data, hooks);
- },
-
- doProcess: function(Class, data, hooks){
- var me = this,
- preprocessor = hooks.preprocessors.shift();
- if (!preprocessor) {
- hooks.onBeforeCreated.apply(me, arguments);
- return;
- }
- if (preprocessor.call(me, Class, data, hooks, me.doProcess) !== false) {
- me.doProcess(Class, data, hooks);
- }
- },
-
- preprocessors: {},
-
- registerPreprocessor: function(name, fn, properties, position, relativeTo) {
- if (!position) {
- position = 'last';
- }
- if (!properties) {
- properties = [name];
- }
- this.preprocessors[name] = {
- name: name,
- properties: properties || false,
- fn: fn
- };
- this.setDefaultPreprocessorPosition(name, position, relativeTo);
- return this;
- },
-
- getPreprocessor: function(name) {
- return this.preprocessors[name];
- },
-
- getPreprocessors: function() {
- return this.preprocessors;
- },
-
- defaultPreprocessors: [],
-
- getDefaultPreprocessors: function() {
- return this.defaultPreprocessors;
- },
-
- setDefaultPreprocessors: function(preprocessors) {
- this.defaultPreprocessors = Ext.Array.from(preprocessors);
- return this;
- },
-
- setDefaultPreprocessorPosition: function(name, offset, relativeName) {
- var defaultPreprocessors = this.defaultPreprocessors,
- index;
- if (typeof offset == 'string') {
- if (offset === 'first') {
- defaultPreprocessors.unshift(name);
- return this;
- }
- else if (offset === 'last') {
- defaultPreprocessors.push(name);
- return this;
- }
- offset = (offset === 'after') ? 1 : -1;
- }
- index = Ext.Array.indexOf(defaultPreprocessors, relativeName);
- if (index !== -1) {
- Ext.Array.splice(defaultPreprocessors, Math.max(0, index + offset), 0, name);
- }
- return this;
- },
- configNameCache: {},
- getConfigNameMap: function(name) {
- var cache = this.configNameCache,
- map = cache[name],
- capitalizedName;
- if (!map) {
- capitalizedName = name.charAt(0).toUpperCase() + name.substr(1);
- map = cache[name] = {
- internal: name,
- initialized: '_is' + capitalizedName + 'Initialized',
- apply: 'apply' + capitalizedName,
- update: 'update' + capitalizedName,
- 'set': 'set' + capitalizedName,
- 'get': 'get' + capitalizedName,
- doSet : 'doSet' + capitalizedName,
- changeEvent: name.toLowerCase() + 'change'
- };
- }
- return map;
- }
- });
-
- ExtClass.registerPreprocessor('extend', function(Class, data) {
- var Base = Ext.Base,
- basePrototype = Base.prototype,
- extend = data.extend,
- Parent, parentPrototype, i;
- delete data.extend;
- if (extend && extend !== Object) {
- Parent = extend;
- }
- else {
- Parent = Base;
- }
- parentPrototype = Parent.prototype;
- if (!Parent.$isClass) {
- for (i in basePrototype) {
- if (!parentPrototype[i]) {
- parentPrototype[i] = basePrototype[i];
- }
- }
- }
- Class.extend(Parent);
- Class.triggerExtended.apply(Class, arguments);
- if (data.onClassExtended) {
- Class.onExtended(data.onClassExtended, Class);
- delete data.onClassExtended;
- }
- }, true);
-
- ExtClass.registerPreprocessor('statics', function(Class, data) {
- Class.addStatics(data.statics);
- delete data.statics;
- });
-
- ExtClass.registerPreprocessor('inheritableStatics', function(Class, data) {
- Class.addInheritableStatics(data.inheritableStatics);
- delete data.inheritableStatics;
- });
-
- ExtClass.registerPreprocessor('config', function(Class, data) {
- var config = data.config,
- prototype = Class.prototype;
- delete data.config;
- Ext.Object.each(config, function(name, value) {
- var nameMap = ExtClass.getConfigNameMap(name),
- internalName = nameMap.internal,
- initializedName = nameMap.initialized,
- applyName = nameMap.apply,
- updateName = nameMap.update,
- setName = nameMap.set,
- getName = nameMap.get,
- hasOwnSetter = (setName in prototype) || data.hasOwnProperty(setName),
- hasOwnApplier = (applyName in prototype) || data.hasOwnProperty(applyName),
- hasOwnUpdater = (updateName in prototype) || data.hasOwnProperty(updateName),
- optimizedGetter, customGetter;
- if (value === null || (!hasOwnSetter && !hasOwnApplier && !hasOwnUpdater)) {
- prototype[internalName] = value;
- prototype[initializedName] = true;
- }
- else {
- prototype[initializedName] = false;
- }
- if (!hasOwnSetter) {
- data[setName] = function(value) {
- var oldValue = this[internalName],
- applier = this[applyName],
- updater = this[updateName];
- if (!this[initializedName]) {
- this[initializedName] = true;
- }
- if (applier) {
- value = applier.call(this, value, oldValue);
- }
- if (typeof value != 'undefined') {
- this[internalName] = value;
- if (updater && value !== oldValue) {
- updater.call(this, value, oldValue);
- }
- }
- return this;
- };
- }
- if (!(getName in prototype) || data.hasOwnProperty(getName)) {
- customGetter = data[getName] || false;
- if (customGetter) {
- optimizedGetter = function() {
- return customGetter.apply(this, arguments);
- };
- }
- else {
- optimizedGetter = function() {
- return this[internalName];
- };
- }
- data[getName] = function() {
- var currentGetter;
- if (!this[initializedName]) {
- this[initializedName] = true;
- this[setName](this.config[name]);
- }
- currentGetter = this[getName];
- if ('$previous' in currentGetter) {
- currentGetter.$previous = optimizedGetter;
- }
- else {
- this[getName] = optimizedGetter;
- }
- return optimizedGetter.apply(this, arguments);
- };
- }
- });
- Class.addConfig(config, true);
- });
-
- ExtClass.registerPreprocessor('mixins', function(Class, data, hooks) {
- var mixins = data.mixins,
- name, mixin, i, ln;
- delete data.mixins;
- Ext.Function.interceptBefore(hooks, 'onCreated', function() {
- if (mixins instanceof Array) {
- for (i = 0,ln = mixins.length; i < ln; i++) {
- mixin = mixins[i];
- name = mixin.prototype.mixinId || mixin.$className;
- Class.mixin(name, mixin);
- }
- }
- else {
- for (var mixinName in mixins) {
- if (mixins.hasOwnProperty(mixinName)) {
- Class.mixin(mixinName, mixins[mixinName]);
- }
- }
- }
- });
- });
-
- Ext.extend = function(Class, Parent, members) {
- if (arguments.length === 2 && Ext.isObject(Parent)) {
- members = Parent;
- Parent = Class;
- Class = null;
- }
- var cls;
- if (!Parent) {
- throw new Error("[Ext.extend] Attempting to extend from a class which has not been loaded on the page.");
- }
- members.extend = Parent;
- members.preprocessors = [
- 'extend'
- ,'statics'
- ,'inheritableStatics'
- ,'mixins'
- ,'config'
- ];
- if (Class) {
- cls = new ExtClass(Class, members);
-
- cls.prototype.constructor = Class;
- } else {
- cls = new ExtClass(members);
- }
- cls.prototype.override = function(o) {
- for (var m in o) {
- if (o.hasOwnProperty(m)) {
- this[m] = o[m];
- }
- }
- };
- return cls;
- };
- }());
- //@tag foundation,core
- //@require Class.js
- (function(Class, alias, arraySlice, arrayFrom, global) {
-
- function makeCtor () {
- function constructor () {
-
-
- return this.constructor.apply(this, arguments) || null;
- }
- return constructor;
- }
- var Manager = Ext.ClassManager = {
-
- classes: {},
-
- existCache: {},
-
- namespaceRewrites: [{
- from: 'Ext.',
- to: Ext
- }],
-
- maps: {
- alternateToName: {},
- aliasToName: {},
- nameToAliases: {},
- nameToAlternates: {}
- },
-
- enableNamespaceParseCache: true,
-
- namespaceParseCache: {},
-
- instantiators: [],
-
- isCreated: function(className) {
- var existCache = this.existCache,
- i, ln, part, root, parts;
- if (this.classes[className] || existCache[className]) {
- return true;
- }
- root = global;
- parts = this.parseNamespace(className);
- for (i = 0, ln = parts.length; i < ln; i++) {
- part = parts[i];
- if (typeof part != 'string') {
- root = part;
- } else {
- if (!root || !root[part]) {
- return false;
- }
- root = root[part];
- }
- }
- existCache[className] = true;
- this.triggerCreated(className);
- return true;
- },
-
- createdListeners: [],
-
- nameCreatedListeners: {},
-
- triggerCreated: function(className) {
- var listeners = this.createdListeners,
- nameListeners = this.nameCreatedListeners,
- alternateNames = this.maps.nameToAlternates[className],
- names = [className],
- i, ln, j, subLn, listener, name;
- for (i = 0,ln = listeners.length; i < ln; i++) {
- listener = listeners[i];
- listener.fn.call(listener.scope, className);
- }
- if (alternateNames) {
- names.push.apply(names, alternateNames);
- }
- for (i = 0,ln = names.length; i < ln; i++) {
- name = names[i];
- listeners = nameListeners[name];
- if (listeners) {
- for (j = 0,subLn = listeners.length; j < subLn; j++) {
- listener = listeners[j];
- listener.fn.call(listener.scope, name);
- }
- delete nameListeners[name];
- }
- }
- },
-
- onCreated: function(fn, scope, className) {
- var listeners = this.createdListeners,
- nameListeners = this.nameCreatedListeners,
- listener = {
- fn: fn,
- scope: scope
- };
- if (className) {
- if (this.isCreated(className)) {
- fn.call(scope, className);
- return;
- }
- if (!nameListeners[className]) {
- nameListeners[className] = [];
- }
- nameListeners[className].push(listener);
- }
- else {
- listeners.push(listener);
- }
- },
-
- parseNamespace: function(namespace) {
- var cache = this.namespaceParseCache,
- parts,
- rewrites,
- root,
- name,
- rewrite, from, to, i, ln;
- if (this.enableNamespaceParseCache) {
- if (cache.hasOwnProperty(namespace)) {
- return cache[namespace];
- }
- }
- parts = [];
- rewrites = this.namespaceRewrites;
- root = global;
- name = namespace;
- for (i = 0, ln = rewrites.length; i < ln; i++) {
- rewrite = rewrites[i];
- from = rewrite.from;
- to = rewrite.to;
- if (name === from || name.substring(0, from.length) === from) {
- name = name.substring(from.length);
- if (typeof to != 'string') {
- root = to;
- } else {
- parts = parts.concat(to.split('.'));
- }
- break;
- }
- }
- parts.push(root);
- parts = parts.concat(name.split('.'));
- if (this.enableNamespaceParseCache) {
- cache[namespace] = parts;
- }
- return parts;
- },
-
- setNamespace: function(name, value) {
- var root = global,
- parts = this.parseNamespace(name),
- ln = parts.length - 1,
- leaf = parts[ln],
- i, part;
- for (i = 0; i < ln; i++) {
- part = parts[i];
- if (typeof part != 'string') {
- root = part;
- } else {
- if (!root[part]) {
- root[part] = {};
- }
- root = root[part];
- }
- }
- root[leaf] = value;
- return root[leaf];
- },
-
- createNamespaces: function() {
- var root = global,
- parts, part, i, j, ln, subLn;
- for (i = 0, ln = arguments.length; i < ln; i++) {
- parts = this.parseNamespace(arguments[i]);
- for (j = 0, subLn = parts.length; j < subLn; j++) {
- part = parts[j];
- if (typeof part != 'string') {
- root = part;
- } else {
- if (!root[part]) {
- root[part] = {};
- }
- root = root[part];
- }
- }
- }
- return root;
- },
-
- set: function(name, value) {
- var me = this,
- maps = me.maps,
- nameToAlternates = maps.nameToAlternates,
- targetName = me.getName(value),
- alternates;
- me.classes[name] = me.setNamespace(name, value);
- if (targetName && targetName !== name) {
- maps.alternateToName[name] = targetName;
- alternates = nameToAlternates[targetName] || (nameToAlternates[targetName] = []);
- alternates.push(name);
- }
- return this;
- },
-
- get: function(name) {
- var classes = this.classes,
- root,
- parts,
- part, i, ln;
- if (classes[name]) {
- return classes[name];
- }
- root = global;
- parts = this.parseNamespace(name);
- for (i = 0, ln = parts.length; i < ln; i++) {
- part = parts[i];
- if (typeof part != 'string') {
- root = part;
- } else {
- if (!root || !root[part]) {
- return null;
- }
- root = root[part];
- }
- }
- return root;
- },
-
- setAlias: function(cls, alias) {
- var aliasToNameMap = this.maps.aliasToName,
- nameToAliasesMap = this.maps.nameToAliases,
- className;
- if (typeof cls == 'string') {
- className = cls;
- } else {
- className = this.getName(cls);
- }
- if (alias && aliasToNameMap[alias] !== className) {
- aliasToNameMap[alias] = className;
- }
- if (!nameToAliasesMap[className]) {
- nameToAliasesMap[className] = [];
- }
- if (alias) {
- Ext.Array.include(nameToAliasesMap[className], alias);
- }
- return this;
- },
-
- addNameAliasMappings: function(aliases){
- var aliasToNameMap = this.maps.aliasToName,
- nameToAliasesMap = this.maps.nameToAliases,
- className, aliasList, alias, i;
- for (className in aliases) {
- aliasList = nameToAliasesMap[className] ||
- (nameToAliasesMap[className] = []);
- for (i = 0; i < aliases[className].length; i++) {
- alias = aliases[className][i];
- if (!aliasToNameMap[alias]) {
- aliasToNameMap[alias] = className;
- aliasList.push(alias);
- }
- }
- }
- return this;
- },
-
- addNameAlternateMappings: function(alternates) {
- var alternateToName = this.maps.alternateToName,
- nameToAlternates = this.maps.nameToAlternates,
- className, aliasList, alternate, i;
- for (className in alternates) {
- aliasList = nameToAlternates[className] ||
- (nameToAlternates[className] = []);
- for (i = 0; i < alternates[className].length; i++) {
- alternate = alternates[className];
- if (!alternateToName[alternate]) {
- alternateToName[alternate] = className;
- aliasList.push(alternate);
- }
- }
- }
- return this;
- },
-
- getByAlias: function(alias) {
- return this.get(this.getNameByAlias(alias));
- },
-
- getNameByAlias: function(alias) {
- return this.maps.aliasToName[alias] || '';
- },
-
- getNameByAlternate: function(alternate) {
- return this.maps.alternateToName[alternate] || '';
- },
-
- getAliasesByName: function(name) {
- return this.maps.nameToAliases[name] || [];
- },
-
- getName: function(object) {
- return object && object.$className || '';
- },
-
- getClass: function(object) {
- return object && object.self || null;
- },
-
- create: function(className, data, createdFn) {
- var ctor = makeCtor();
- if (typeof data == 'function') {
- data = data(ctor);
- }
- data.$className = className;
- return new Class(ctor, data, function() {
- var postprocessorStack = data.postprocessors || Manager.defaultPostprocessors,
- registeredPostprocessors = Manager.postprocessors,
- postprocessors = [],
- postprocessor, i, ln, j, subLn, postprocessorProperties, postprocessorProperty;
- delete data.postprocessors;
- for (i = 0,ln = postprocessorStack.length; i < ln; i++) {
- postprocessor = postprocessorStack[i];
- if (typeof postprocessor == 'string') {
- postprocessor = registeredPostprocessors[postprocessor];
- postprocessorProperties = postprocessor.properties;
- if (postprocessorProperties === true) {
- postprocessors.push(postprocessor.fn);
- }
- else if (postprocessorProperties) {
- for (j = 0,subLn = postprocessorProperties.length; j < subLn; j++) {
- postprocessorProperty = postprocessorProperties[j];
- if (data.hasOwnProperty(postprocessorProperty)) {
- postprocessors.push(postprocessor.fn);
- break;
- }
- }
- }
- }
- else {
- postprocessors.push(postprocessor);
- }
- }
- data.postprocessors = postprocessors;
- data.createdFn = createdFn;
- Manager.processCreate(className, this, data);
- });
- },
-
- processCreate: function(className, cls, clsData){
- var me = this,
- postprocessor = clsData.postprocessors.shift(),
- createdFn = clsData.createdFn;
- if (!postprocessor) {
- if (className) {
- me.set(className, cls);
- }
- if (createdFn) {
- createdFn.call(cls, cls);
- }
- if (className) {
- me.triggerCreated(className);
- }
- return;
- }
- if (postprocessor.call(me, className, cls, clsData, me.processCreate) !== false) {
- me.processCreate(className, cls, clsData);
- }
- },
- createOverride: function (className, data, createdFn) {
- var me = this,
- overriddenClassName = data.override,
- requires = data.requires,
- uses = data.uses,
- classReady = function () {
- var cls, temp;
- if (requires) {
- temp = requires;
- requires = null;
-
-
-
- Ext.Loader.require(temp, classReady);
- } else {
-
-
- cls = me.get(overriddenClassName);
-
- delete data.override;
- delete data.requires;
- delete data.uses;
- Ext.override(cls, data);
-
-
-
- me.triggerCreated(className);
- if (uses) {
- Ext.Loader.addUsedClasses(uses);
- }
- if (createdFn) {
- createdFn.call(cls);
- }
- }
- };
- me.existCache[className] = true;
-
- me.onCreated(classReady, me, overriddenClassName);
-
- return me;
- },
-
- instantiateByAlias: function() {
- var alias = arguments[0],
- args = arraySlice.call(arguments),
- className = this.getNameByAlias(alias);
- if (!className) {
- className = this.maps.aliasToName[alias];
- Ext.syncRequire(className);
- }
- args[0] = className;
- return this.instantiate.apply(this, args);
- },
-
- instantiate: function() {
- var name = arguments[0],
- nameType = typeof name,
- args = arraySlice.call(arguments, 1),
- alias = name,
- possibleName, cls;
- if (nameType != 'function') {
- if (nameType != 'string' && args.length === 0) {
- args = [name];
- name = name.xclass;
- }
- cls = this.get(name);
- }
- else {
- cls = name;
- }
-
- if (!cls) {
- possibleName = this.getNameByAlias(name);
- if (possibleName) {
- name = possibleName;
- cls = this.get(name);
- }
- }
-
- if (!cls) {
- possibleName = this.getNameByAlternate(name);
- if (possibleName) {
- name = possibleName;
- cls = this.get(name);
- }
- }
-
- if (!cls) {
- Ext.syncRequire(name);
- cls = this.get(name);
- }
- return this.getInstantiator(args.length)(cls, args);
- },
-
- dynInstantiate: function(name, args) {
- args = arrayFrom(args, true);
- args.unshift(name);
- return this.instantiate.apply(this, args);
- },
-
- getInstantiator: function(length) {
- var instantiators = this.instantiators,
- instantiator,
- i,
- args;
- instantiator = instantiators[length];
- if (!instantiator) {
- i = length;
- args = [];
- for (i = 0; i < length; i++) {
- args.push('a[' + i + ']');
- }
- instantiator = instantiators[length] = new Function('c', 'a', 'return new c(' + args.join(',') + ')');
- }
- return instantiator;
- },
-
- postprocessors: {},
-
- defaultPostprocessors: [],
-
- registerPostprocessor: function(name, fn, properties, position, relativeTo) {
- if (!position) {
- position = 'last';
- }
- if (!properties) {
- properties = [name];
- }
- this.postprocessors[name] = {
- name: name,
- properties: properties || false,
- fn: fn
- };
- this.setDefaultPostprocessorPosition(name, position, relativeTo);
- return this;
- },
-
- setDefaultPostprocessors: function(postprocessors) {
- this.defaultPostprocessors = arrayFrom(postprocessors);
- return this;
- },
-
- setDefaultPostprocessorPosition: function(name, offset, relativeName) {
- var defaultPostprocessors = this.defaultPostprocessors,
- index;
- if (typeof offset == 'string') {
- if (offset === 'first') {
- defaultPostprocessors.unshift(name);
- return this;
- }
- else if (offset === 'last') {
- defaultPostprocessors.push(name);
- return this;
- }
- offset = (offset === 'after') ? 1 : -1;
- }
- index = Ext.Array.indexOf(defaultPostprocessors, relativeName);
- if (index !== -1) {
- Ext.Array.splice(defaultPostprocessors, Math.max(0, index + offset), 0, name);
- }
- return this;
- },
-
- getNamesByExpression: function(expression) {
- var nameToAliasesMap = this.maps.nameToAliases,
- names = [],
- name, alias, aliases, possibleName, regex, i, ln;
- if (expression.indexOf('*') !== -1) {
- expression = expression.replace(/\*/g, '(.*?)');
- regex = new RegExp('^' + expression + '$');
- for (name in nameToAliasesMap) {
- if (nameToAliasesMap.hasOwnProperty(name)) {
- aliases = nameToAliasesMap[name];
- if (name.search(regex) !== -1) {
- names.push(name);
- }
- else {
- for (i = 0, ln = aliases.length; i < ln; i++) {
- alias = aliases[i];
- if (alias.search(regex) !== -1) {
- names.push(name);
- break;
- }
- }
- }
- }
- }
- } else {
- possibleName = this.getNameByAlias(expression);
- if (possibleName) {
- names.push(possibleName);
- } else {
- possibleName = this.getNameByAlternate(expression);
- if (possibleName) {
- names.push(possibleName);
- } else {
- names.push(expression);
- }
- }
- }
- return names;
- }
- };
-
- Manager.registerPostprocessor('alias', function(name, cls, data) {
- var aliases = data.alias,
- i, ln;
- for (i = 0,ln = aliases.length; i < ln; i++) {
- alias = aliases[i];
- this.setAlias(cls, alias);
- }
- }, ['xtype', 'alias']);
-
- Manager.registerPostprocessor('singleton', function(name, cls, data, fn) {
- fn.call(this, name, new cls(), data);
- return false;
- });
-
- Manager.registerPostprocessor('alternateClassName', function(name, cls, data) {
- var alternates = data.alternateClassName,
- i, ln, alternate;
- if (!(alternates instanceof Array)) {
- alternates = [alternates];
- }
- for (i = 0, ln = alternates.length; i < ln; i++) {
- alternate = alternates[i];
- this.set(alternate, cls);
- }
- });
- Ext.apply(Ext, {
-
- create: alias(Manager, 'instantiate'),
-
- widget: function(name, config) {
-
-
-
-
-
-
-
- var xtype = name,
- alias, className, T, load;
- if (typeof xtype != 'string') {
-
- config = name;
- xtype = config.xtype;
- } else {
- config = config || {};
- }
-
- if (config.isComponent) {
- return config;
- }
- alias = 'widget.' + xtype;
- className = Manager.getNameByAlias(alias);
-
- if (!className) {
- load = true;
- }
-
- T = Manager.get(className);
- if (load || !T) {
- return Manager.instantiateByAlias(alias, config);
- }
- return new T(config);
- },
-
- createByAlias: alias(Manager, 'instantiateByAlias'),
-
- define: function (className, data, createdFn) {
- if (data.override) {
- return Manager.createOverride.apply(Manager, arguments);
- }
- return Manager.create.apply(Manager, arguments);
- },
-
- getClassName: alias(Manager, 'getName'),
-
- getDisplayName: function(object) {
- if (object) {
- if (object.displayName) {
- return object.displayName;
- }
- if (object.$name && object.$class) {
- return Ext.getClassName(object.$class) + '#' + object.$name;
- }
- if (object.$className) {
- return object.$className;
- }
- }
- return 'Anonymous';
- },
-
- getClass: alias(Manager, 'getClass'),
-
- namespace: alias(Manager, 'createNamespaces')
- });
-
- Ext.createWidget = Ext.widget;
-
- Ext.ns = Ext.namespace;
- Class.registerPreprocessor('className', function(cls, data) {
- if (data.$className) {
- cls.$className = data.$className;
- }
- }, true, 'first');
- Class.registerPreprocessor('alias', function(cls, data) {
- var prototype = cls.prototype,
- xtypes = arrayFrom(data.xtype),
- aliases = arrayFrom(data.alias),
- widgetPrefix = 'widget.',
- widgetPrefixLength = widgetPrefix.length,
- xtypesChain = Array.prototype.slice.call(prototype.xtypesChain || []),
- xtypesMap = Ext.merge({}, prototype.xtypesMap || {}),
- i, ln, alias, xtype;
- for (i = 0,ln = aliases.length; i < ln; i++) {
- alias = aliases[i];
- if (alias.substring(0, widgetPrefixLength) === widgetPrefix) {
- xtype = alias.substring(widgetPrefixLength);
- Ext.Array.include(xtypes, xtype);
- }
- }
- cls.xtype = data.xtype = xtypes[0];
- data.xtypes = xtypes;
- for (i = 0,ln = xtypes.length; i < ln; i++) {
- xtype = xtypes[i];
- if (!xtypesMap[xtype]) {
- xtypesMap[xtype] = true;
- xtypesChain.push(xtype);
- }
- }
- data.xtypesChain = xtypesChain;
- data.xtypesMap = xtypesMap;
- Ext.Function.interceptAfter(data, 'onClassCreated', function() {
- var mixins = prototype.mixins,
- key, mixin;
- for (key in mixins) {
- if (mixins.hasOwnProperty(key)) {
- mixin = mixins[key];
- xtypes = mixin.xtypes;
- if (xtypes) {
- for (i = 0,ln = xtypes.length; i < ln; i++) {
- xtype = xtypes[i];
- if (!xtypesMap[xtype]) {
- xtypesMap[xtype] = true;
- xtypesChain.push(xtype);
- }
- }
- }
- }
- }
- });
- for (i = 0,ln = xtypes.length; i < ln; i++) {
- xtype = xtypes[i];
- Ext.Array.include(aliases, widgetPrefix + xtype);
- }
- data.alias = aliases;
- }, ['xtype', 'alias']);
- }(Ext.Class, Ext.Function.alias, Array.prototype.slice, Ext.Array.from, Ext.global));
- //@tag foundation,core
- //@require ClassManager.js
- //@define Ext.Loader
- Ext.Loader = new function() {
- var Loader = this,
- Manager = Ext.ClassManager,
- Class = Ext.Class,
- flexSetter = Ext.Function.flexSetter,
- alias = Ext.Function.alias,
- pass = Ext.Function.pass,
- defer = Ext.Function.defer,
- arrayErase = Ext.Array.erase,
- dependencyProperties = ['extend', 'mixins', 'requires'],
- isInHistory = {},
- history = [],
- slashDotSlashRe = /\/\.\//g,
- dotRe = /\./g;
- Ext.apply(Loader, {
-
- isInHistory: isInHistory,
-
- history: history,
-
- config: {
-
- enabled: false,
-
- scriptChainDelay : false,
-
- disableCaching: true,
-
- disableCachingParam: '_dc',
-
- garbageCollect : false,
-
- paths: {
- 'Ext': '.'
- },
-
- preserveScripts : true,
-
- scriptCharset : undefined
- },
-
- setConfig: function(name, value) {
- if (Ext.isObject(name) && arguments.length === 1) {
- Ext.merge(Loader.config, name);
- }
- else {
- Loader.config[name] = (Ext.isObject(value)) ? Ext.merge(Loader.config[name], value) : value;
- }
- return Loader;
- },
-
- getConfig: function(name) {
- if (name) {
- return Loader.config[name];
- }
- return Loader.config;
- },
-
- setPath: flexSetter(function(name, path) {
- Loader.config.paths[name] = path;
- return Loader;
- }),
-
- addClassPathMappings: function(paths) {
- var name;
- for(name in paths){
- Loader.config.paths[name] = paths[name];
- }
- return Loader;
- },
-
- getPath: function(className) {
- var path = '',
- paths = Loader.config.paths,
- prefix = Loader.getPrefix(className);
- if (prefix.length > 0) {
- if (prefix === className) {
- return paths[prefix];
- }
- path = paths[prefix];
- className = className.substring(prefix.length + 1);
- }
- if (path.length > 0) {
- path += '/';
- }
- return path.replace(slashDotSlashRe, '/') + className.replace(dotRe, "/") + '.js';
- },
-
- getPrefix: function(className) {
- var paths = Loader.config.paths,
- prefix, deepestPrefix = '';
- if (paths.hasOwnProperty(className)) {
- return className;
- }
- for (prefix in paths) {
- if (paths.hasOwnProperty(prefix) && prefix + '.' === className.substring(0, prefix.length + 1)) {
- if (prefix.length > deepestPrefix.length) {
- deepestPrefix = prefix;
- }
- }
- }
- return deepestPrefix;
- },
-
- isAClassNameWithAKnownPrefix: function(className) {
- var prefix = Loader.getPrefix(className);
-
- return prefix !== '' && prefix !== className;
- },
-
- require: function(expressions, fn, scope, excludes) {
- if (fn) {
- fn.call(scope);
- }
- },
-
- syncRequire: function() {},
-
- exclude: function(excludes) {
- return {
- require: function(expressions, fn, scope) {
- return Loader.require(expressions, fn, scope, excludes);
- },
- syncRequire: function(expressions, fn, scope) {
- return Loader.syncRequire(expressions, fn, scope, excludes);
- }
- };
- },
-
- onReady: function(fn, scope, withDomReady, options) {
- var oldFn;
- if (withDomReady !== false && Ext.onDocumentReady) {
- oldFn = fn;
- fn = function() {
- Ext.onDocumentReady(oldFn, scope, options);
- };
- }
- fn.call(scope);
- }
- });
- var queue = [],
- isClassFileLoaded = {},
- isFileLoaded = {},
- classNameToFilePathMap = {},
- scriptElements = {},
- readyListeners = [],
- usedClasses = [],
- requiresMap = {};
- Ext.apply(Loader, {
-
- documentHead: typeof document != 'undefined' && (document.head || document.getElementsByTagName('head')[0]),
-
- isLoading: false,
-
- queue: queue,
-
- isClassFileLoaded: isClassFileLoaded,
-
- isFileLoaded: isFileLoaded,
-
- readyListeners: readyListeners,
-
- optionalRequires: usedClasses,
-
- requiresMap: requiresMap,
-
- numPendingFiles: 0,
-
- numLoadedFiles: 0,
-
- hasFileLoadError: false,
-
- classNameToFilePathMap: classNameToFilePathMap,
-
- scriptsLoading: 0,
-
- syncModeEnabled: false,
- scriptElements: scriptElements,
-
- refreshQueue: function() {
- var ln = queue.length,
- i, item, j, requires;
-
- if (!ln && !Loader.scriptsLoading) {
- return Loader.triggerReady();
- }
- for (i = 0; i < ln; i++) {
- item = queue[i];
- if (item) {
- requires = item.requires;
-
-
- if (requires.length > Loader.numLoadedFiles) {
- continue;
- }
-
- for (j = 0; j < requires.length; ) {
- if (Manager.isCreated(requires[j])) {
-
- arrayErase(requires, j, 1);
- }
- else {
- j++;
- }
- }
-
- if (item.requires.length === 0) {
- arrayErase(queue, i, 1);
- item.callback.call(item.scope);
- Loader.refreshQueue();
- break;
- }
- }
- }
- return Loader;
- },
-
- injectScriptElement: function(url, onLoad, onError, scope, charset) {
- var script = document.createElement('script'),
- dispatched = false,
- config = Loader.config,
- onLoadFn = function() {
- if(!dispatched) {
- dispatched = true;
- script.onload = script.onreadystatechange = script.onerror = null;
- if (typeof config.scriptChainDelay == 'number') {
-
- defer(onLoad, config.scriptChainDelay, scope);
- } else {
- onLoad.call(scope);
- }
- Loader.cleanupScriptElement(script, config.preserveScripts === false, config.garbageCollect);
- }
- },
- onErrorFn = function(arg) {
- defer(onError, 1, scope);
- Loader.cleanupScriptElement(script, config.preserveScripts === false, config.garbageCollect);
- };
- script.type = 'text/javascript';
- script.onerror = onErrorFn;
- charset = charset || config.scriptCharset;
- if (charset) {
- script.charset = charset;
- }
-
- if ('addEventListener' in script ) {
- script.onload = onLoadFn;
- } else if ('readyState' in script) {
- script.onreadystatechange = function() {
- if ( this.readyState == 'loaded' || this.readyState == 'complete' ) {
- onLoadFn();
- }
- };
- } else {
- script.onload = onLoadFn;
- }
- script.src = url;
- (Loader.documentHead || document.getElementsByTagName('head')[0]).appendChild(script);
- return script;
- },
-
- removeScriptElement: function(url) {
- if (scriptElements[url]) {
- Loader.cleanupScriptElement(scriptElements[url], true, !!Loader.getConfig('garbageCollect'));
- delete scriptElements[url];
- }
- return Loader;
- },
-
- cleanupScriptElement: function(script, remove, collect) {
- var prop;
- script.onload = script.onreadystatechange = script.onerror = null;
- if (remove) {
- Ext.removeNode(script);
- if (collect) {
- for (prop in script) {
- try {
- script[prop] = null;
- delete script[prop];
- } catch (cleanEx) {
-
- }
- }
- }
- }
- return Loader;
- },
-
- loadScript: function (options) {
- var config = Loader.getConfig(),
- isString = typeof options == 'string',
- url = isString ? options : options.url,
- onError = !isString && options.onError,
- onLoad = !isString && options.onLoad,
- scope = !isString && options.scope,
- onScriptError = function() {
- Loader.numPendingFiles--;
- Loader.scriptsLoading--;
- if (onError) {
- onError.call(scope, "Failed loading '" + url + "', please verify that the file exists");
- }
- if (Loader.numPendingFiles + Loader.scriptsLoading === 0) {
- Loader.refreshQueue();
- }
- },
- onScriptLoad = function () {
- Loader.numPendingFiles--;
- Loader.scriptsLoading--;
- if (onLoad) {
- onLoad.call(scope);
- }
- if (Loader.numPendingFiles + Loader.scriptsLoading === 0) {
- Loader.refreshQueue();
- }
- },
- src;
- Loader.isLoading = true;
- Loader.numPendingFiles++;
- Loader.scriptsLoading++;
- src = config.disableCaching ?
- (url + '?' + config.disableCachingParam + '=' + Ext.Date.now()) : url;
- scriptElements[url] = Loader.injectScriptElement(src, onScriptLoad, onScriptError);
- },
-
- loadScriptFile: function(url, onLoad, onError, scope, synchronous) {
- if (isFileLoaded[url]) {
- return Loader;
- }
- var config = Loader.getConfig(),
- noCacheUrl = url + (config.disableCaching ? ('?' + config.disableCachingParam + '=' + Ext.Date.now()) : ''),
- isCrossOriginRestricted = false,
- xhr, status, onScriptError,
- debugSourceURL = "";
- scope = scope || Loader;
- Loader.isLoading = true;
- if (!synchronous) {
- onScriptError = function() {
- };
- scriptElements[url] = Loader.injectScriptElement(noCacheUrl, onLoad, onScriptError, scope);
- } else {
- if (typeof XMLHttpRequest != 'undefined') {
- xhr = new XMLHttpRequest();
- } else {
- xhr = new ActiveXObject('Microsoft.XMLHTTP');
- }
- try {
- xhr.open('GET', noCacheUrl, false);
- xhr.send(null);
- } catch (e) {
- isCrossOriginRestricted = true;
- }
- status = (xhr.status === 1223) ? 204 :
- (xhr.status === 0 && (self.location || {}).protocol == 'file:') ? 200 : xhr.status;
- isCrossOriginRestricted = isCrossOriginRestricted || (status === 0);
- if (isCrossOriginRestricted
- ) {
- }
- else if ((status >= 200 && status < 300) || (status === 304)
- ) {
-
-
- if (!Ext.isIE) {
- debugSourceURL = "\n//@ sourceURL=" + url;
- }
- Ext.globalEval(xhr.responseText + debugSourceURL);
- onLoad.call(scope);
- }
- else {
- }
-
- xhr = null;
- }
- },
-
- syncRequire: function() {
- var syncModeEnabled = Loader.syncModeEnabled;
- if (!syncModeEnabled) {
- Loader.syncModeEnabled = true;
- }
- Loader.require.apply(Loader, arguments);
- if (!syncModeEnabled) {
- Loader.syncModeEnabled = false;
- }
- Loader.refreshQueue();
- },
-
- require: function(expressions, fn, scope, excludes) {
- var excluded = {},
- included = {},
- excludedClassNames = [],
- possibleClassNames = [],
- classNames = [],
- references = [],
- callback,
- syncModeEnabled,
- filePath, expression, exclude, className,
- possibleClassName, i, j, ln, subLn;
- if (excludes) {
-
- excludes = (typeof excludes === 'string') ? [ excludes ] : excludes;
- for (i = 0,ln = excludes.length; i < ln; i++) {
- exclude = excludes[i];
- if (typeof exclude == 'string' && exclude.length > 0) {
- excludedClassNames = Manager.getNamesByExpression(exclude);
- for (j = 0,subLn = excludedClassNames.length; j < subLn; j++) {
- excluded[excludedClassNames[j]] = true;
- }
- }
- }
- }
-
- expressions = (typeof expressions === 'string') ? [ expressions ] : (expressions ? expressions : []);
- if (fn) {
- if (fn.length > 0) {
- callback = function() {
- var classes = [],
- i, ln;
- for (i = 0,ln = references.length; i < ln; i++) {
- classes.push(Manager.get(references[i]));
- }
- return fn.apply(this, classes);
- };
- }
- else {
- callback = fn;
- }
- }
- else {
- callback = Ext.emptyFn;
- }
- scope = scope || Ext.global;
- for (i = 0,ln = expressions.length; i < ln; i++) {
- expression = expressions[i];
- if (typeof expression == 'string' && expression.length > 0) {
- possibleClassNames = Manager.getNamesByExpression(expression);
- subLn = possibleClassNames.length;
- for (j = 0; j < subLn; j++) {
- possibleClassName = possibleClassNames[j];
- if (excluded[possibleClassName] !== true) {
- references.push(possibleClassName);
- if (!Manager.isCreated(possibleClassName) && !included[possibleClassName]) {
- included[possibleClassName] = true;
- classNames.push(possibleClassName);
- }
- }
- }
- }
- }
-
-
- if (classNames.length > 0) {
- if (!Loader.config.enabled) {
- throw new Error("Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. " +
- "Missing required class" + ((classNames.length > 1) ? "es" : "") + ": " + classNames.join(', '));
- }
- }
- else {
- callback.call(scope);
- return Loader;
- }
- syncModeEnabled = Loader.syncModeEnabled;
- if (!syncModeEnabled) {
- queue.push({
- requires: classNames.slice(),
-
- callback: callback,
- scope: scope
- });
- }
- ln = classNames.length;
- for (i = 0; i < ln; i++) {
- className = classNames[i];
- filePath = Loader.getPath(className);
-
-
-
- if (syncModeEnabled && isClassFileLoaded.hasOwnProperty(className)) {
- Loader.numPendingFiles--;
- Loader.removeScriptElement(filePath);
- delete isClassFileLoaded[className];
- }
- if (!isClassFileLoaded.hasOwnProperty(className)) {
- isClassFileLoaded[className] = false;
- classNameToFilePathMap[className] = filePath;
- Loader.numPendingFiles++;
- Loader.loadScriptFile(
- filePath,
- pass(Loader.onFileLoaded, [className, filePath], Loader),
- pass(Loader.onFileLoadError, [className, filePath], Loader),
- Loader,
- syncModeEnabled
- );
- }
- }
- if (syncModeEnabled) {
- callback.call(scope);
- if (ln === 1) {
- return Manager.get(className);
- }
- }
- return Loader;
- },
-
- onFileLoaded: function(className, filePath) {
- Loader.numLoadedFiles++;
- isClassFileLoaded[className] = true;
- isFileLoaded[filePath] = true;
- Loader.numPendingFiles--;
- if (Loader.numPendingFiles === 0) {
- Loader.refreshQueue();
- }
- },
-
- onFileLoadError: function(className, filePath, errorMessage, isSynchronous) {
- Loader.numPendingFiles--;
- Loader.hasFileLoadError = true;
- },
-
- addUsedClasses: function (classes) {
- var cls, i, ln;
- if (classes) {
- classes = (typeof classes == 'string') ? [classes] : classes;
- for (i = 0, ln = classes.length; i < ln; i++) {
- cls = classes[i];
- if (typeof cls == 'string' && !Ext.Array.contains(usedClasses, cls)) {
- usedClasses.push(cls);
- }
- }
- }
- return Loader;
- },
-
- triggerReady: function() {
- var listener,
- i, refClasses = usedClasses;
- if (Loader.isLoading) {
- Loader.isLoading = false;
- if (refClasses.length !== 0) {
-
- refClasses = refClasses.slice();
- usedClasses.length = 0;
-
-
- Loader.require(refClasses, Loader.triggerReady, Loader);
- return Loader;
- }
- }
-
-
-
- while (readyListeners.length && !Loader.isLoading) {
-
-
- listener = readyListeners.shift();
- listener.fn.call(listener.scope);
- }
- return Loader;
- },
-
- onReady: function(fn, scope, withDomReady, options) {
- var oldFn;
- if (withDomReady !== false && Ext.onDocumentReady) {
- oldFn = fn;
- fn = function() {
- Ext.onDocumentReady(oldFn, scope, options);
- };
- }
- if (!Loader.isLoading) {
- fn.call(scope);
- }
- else {
- readyListeners.push({
- fn: fn,
- scope: scope
- });
- }
- },
-
- historyPush: function(className) {
- if (className && isClassFileLoaded.hasOwnProperty(className) && !isInHistory[className]) {
- isInHistory[className] = true;
- history.push(className);
- }
- return Loader;
- }
- });
-
- Ext.disableCacheBuster = function (disable, path) {
- var date = new Date();
- date.setTime(date.getTime() + (disable ? 10*365 : -1) * 24*60*60*1000);
- date = date.toGMTString();
- document.cookie = 'ext-cache=1; expires=' + date + '; path='+(path || '/');
- };
-
- Ext.require = alias(Loader, 'require');
-
- Ext.syncRequire = alias(Loader, 'syncRequire');
-
- Ext.exclude = alias(Loader, 'exclude');
-
- Ext.onReady = function(fn, scope, options) {
- Loader.onReady(fn, scope, true, options);
- };
-
- Class.registerPreprocessor('loader', function(cls, data, hooks, continueFn) {
- var me = this,
- dependencies = [],
- dependency,
- className = Manager.getName(cls),
- i, j, ln, subLn, value, propertyName, propertyValue,
- requiredMap, requiredDep;
-
- for (i = 0,ln = dependencyProperties.length; i < ln; i++) {
- propertyName = dependencyProperties[i];
- if (data.hasOwnProperty(propertyName)) {
- propertyValue = data[propertyName];
- if (typeof propertyValue == 'string') {
- dependencies.push(propertyValue);
- }
- else if (propertyValue instanceof Array) {
- for (j = 0, subLn = propertyValue.length; j < subLn; j++) {
- value = propertyValue[j];
- if (typeof value == 'string') {
- dependencies.push(value);
- }
- }
- }
- else if (typeof propertyValue != 'function') {
- for (j in propertyValue) {
- if (propertyValue.hasOwnProperty(j)) {
- value = propertyValue[j];
- if (typeof value == 'string') {
- dependencies.push(value);
- }
- }
- }
- }
- }
- }
- if (dependencies.length === 0) {
- return;
- }
- Loader.require(dependencies, function() {
- for (i = 0,ln = dependencyProperties.length; i < ln; i++) {
- propertyName = dependencyProperties[i];
- if (data.hasOwnProperty(propertyName)) {
- propertyValue = data[propertyName];
- if (typeof propertyValue == 'string') {
- data[propertyName] = Manager.get(propertyValue);
- }
- else if (propertyValue instanceof Array) {
- for (j = 0, subLn = propertyValue.length; j < subLn; j++) {
- value = propertyValue[j];
- if (typeof value == 'string') {
- data[propertyName][j] = Manager.get(value);
- }
- }
- }
- else if (typeof propertyValue != 'function') {
- for (var k in propertyValue) {
- if (propertyValue.hasOwnProperty(k)) {
- value = propertyValue[k];
- if (typeof value == 'string') {
- data[propertyName][k] = Manager.get(value);
- }
- }
- }
- }
- }
- }
- continueFn.call(me, cls, data, hooks);
- });
- return false;
- }, true, 'after', 'className');
-
- Manager.registerPostprocessor('uses', function(name, cls, data) {
- var uses = data.uses;
- if (uses) {
- Loader.addUsedClasses(uses);
- }
- });
- Manager.onCreated(Loader.historyPush);
- };
- if (Ext._classPathMetadata) {
- Ext.Loader.addClassPathMappings(Ext._classPathMetadata);
- Ext._classPathMetadata = null;
- }
- (function() {
- var scripts = document.getElementsByTagName('script'),
- currentScript = scripts[scripts.length - 1],
- src = currentScript.src,
- path = src.substring(0, src.lastIndexOf('/') + 1),
- Loader = Ext.Loader;
- Loader.setConfig({
- enabled: true,
- disableCaching: true,
- paths: {
- 'Ext': path + 'src'
- }
- });
- })();
- Ext._endTime = new Date().getTime();
- if (Ext._beforereadyhandler){
- Ext._beforereadyhandler();
- }
- //@tag foundation,core
- //@require ../class/Loader.js
- Ext.Error = Ext.extend(Error, {
- statics: {
-
- ignore: false,
-
-
-
- raise: function(err){
- err = err || {};
- if (Ext.isString(err)) {
- err = { msg: err };
- }
- var method = this.raise.caller,
- msg;
- if (method) {
- if (method.$name) {
- err.sourceMethod = method.$name;
- }
- if (method.$owner) {
- err.sourceClass = method.$owner.$className;
- }
- }
- if (Ext.Error.handle(err) !== true) {
- msg = Ext.Error.prototype.toString.call(err);
- Ext.log({
- msg: msg,
- level: 'error',
- dump: err,
- stack: true
- });
- throw new Ext.Error(err);
- }
- },
-
- handle: function(){
- return Ext.Error.ignore;
- }
- },
-
- name: 'Ext.Error',
-
- constructor: function(config){
- if (Ext.isString(config)) {
- config = { msg: config };
- }
- var me = this;
- Ext.apply(me, config);
- me.message = me.message || me.msg;
-
- },
-
- toString: function(){
- var me = this,
- className = me.sourceClass ? me.sourceClass : '',
- methodName = me.sourceMethod ? '.' + me.sourceMethod + '(): ' : '',
- msg = me.msg || '(No description provided)';
- return className + methodName + msg;
- }
- });
- Ext.deprecated = function (suggestion) {
- return Ext.emptyFn;
- };
- //@tag extras,core
- //@require ../lang/Error.js
- Ext.JSON = (new(function() {
- var me = this,
- encodingFunction,
- decodingFunction,
- useNative = null,
- useHasOwn = !! {}.hasOwnProperty,
- isNative = function() {
- if (useNative === null) {
- useNative = Ext.USE_NATIVE_JSON && window.JSON && JSON.toString() == '[object JSON]';
- }
- return useNative;
- },
- pad = function(n) {
- return n < 10 ? "0" + n : n;
- },
- doDecode = function(json) {
- return eval("(" + json + ')');
- },
- doEncode = function(o, newline) {
-
- if (o === null || o === undefined) {
- return "null";
- } else if (Ext.isDate(o)) {
- return Ext.JSON.encodeDate(o);
- } else if (Ext.isString(o)) {
- return Ext.JSON.encodeString(o);
- } else if (typeof o == "number") {
-
- return isFinite(o) ? String(o) : "null";
- } else if (Ext.isBoolean(o)) {
- return String(o);
- }
-
-
- else if (o.toJSON) {
- return o.toJSON();
- } else if (Ext.isArray(o)) {
- return encodeArray(o, newline);
- } else if (Ext.isObject(o)) {
- return encodeObject(o, newline);
- } else if (typeof o === "function") {
- return "null";
- }
- return 'undefined';
- },
- m = {
- "\b": '\\b',
- "\t": '\\t',
- "\n": '\\n',
- "\f": '\\f',
- "\r": '\\r',
- '"': '\\"',
- "\\": '\\\\',
- '\x0b': '\\u000b'
- },
- charToReplace = /[\\\"\x00-\x1f\x7f-\uffff]/g,
- encodeString = function(s) {
- return '"' + s.replace(charToReplace, function(a) {
- var c = m[a];
- return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"';
- },
- encodeArray = function(o, newline) {
- var a = ["[", ""],
- len = o.length,
- i;
- for (i = 0; i < len; i += 1) {
- a.push(Ext.JSON.encodeValue(o[i]), ',');
- }
-
- a[a.length - 1] = ']';
- return a.join("");
- },
- encodeObject = function(o, newline) {
- var a = ["{", ""],
- i;
- for (i in o) {
- if (!useHasOwn || o.hasOwnProperty(i)) {
- a.push(Ext.JSON.encodeValue(i), ":", Ext.JSON.encodeValue(o[i]), ',');
- }
- }
-
- a[a.length - 1] = '}';
- return a.join("");
- };
-
-
- me.encodeString = encodeString;
-
- me.encodeValue = doEncode;
-
- me.encodeDate = function(o) {
- return '"' + o.getFullYear() + "-"
- + pad(o.getMonth() + 1) + "-"
- + pad(o.getDate()) + "T"
- + pad(o.getHours()) + ":"
- + pad(o.getMinutes()) + ":"
- + pad(o.getSeconds()) + '"';
- };
-
- me.encode = function(o) {
- if (!encodingFunction) {
-
- encodingFunction = isNative() ? JSON.stringify : me.encodeValue;
- }
- return encodingFunction(o);
- };
-
- me.decode = function(json, safe) {
- if (!decodingFunction) {
-
- decodingFunction = isNative() ? JSON.parse : doDecode;
- }
- try {
- return decodingFunction(json);
- } catch (e) {
- if (safe === true) {
- return null;
- }
- Ext.Error.raise({
- sourceClass: "Ext.JSON",
- sourceMethod: "decode",
- msg: "You're trying to decode an invalid JSON String: " + json
- });
- }
- };
- })());
- Ext.encode = Ext.JSON.encode;
- Ext.decode = Ext.JSON.decode;
- //@tag extras,core
- //@require misc/JSON.js
- Ext.apply(Ext, {
- userAgent: navigator.userAgent.toLowerCase(),
- cache: {},
- idSeed: 1000,
- windowId: 'ext-window',
- documentId: 'ext-document',
-
- isReady: false,
-
- enableGarbageCollector: true,
-
- enableListenerCollection: true,
- addCacheEntry: function(id, el, dom) {
- dom = dom || el.dom;
- var key = id || (el && el.id) || dom.id,
- entry = Ext.cache[key] || (Ext.cache[key] = {
- data: {},
- events: {},
- dom: dom,
-
- skipGarbageCollection: !!(dom.getElementById || dom.navigator)
- });
- if (el) {
- el.$cache = entry;
-
-
- entry.el = el;
- }
- return entry;
- },
-
- updateCacheEntry: function(cacheItem, dom){
- cacheItem.dom = dom;
- if (cacheItem.el) {
- cacheItem.el.dom = dom;
- }
- return cacheItem;
- },
-
- id: function(el, prefix) {
- var me = this,
- sandboxPrefix = '';
- el = Ext.getDom(el, true) || {};
- if (el === document) {
- el.id = me.documentId;
- }
- else if (el === window) {
- el.id = me.windowId;
- }
- if (!el.id) {
- if (me.isSandboxed) {
- sandboxPrefix = Ext.sandboxName.toLowerCase() + '-';
- }
- el.id = sandboxPrefix + (prefix || "ext-gen") + (++Ext.idSeed);
- }
- return el.id;
- },
- escapeId: (function(){
- var validIdRe = /^[a-zA-Z_][a-zA-Z0-9_\-]*$/i,
- escapeRx = /([\W]{1})/g,
- leadingNumRx = /^(\d)/g,
- escapeFn = function(match, capture){
- return "\\" + capture;
- },
- numEscapeFn = function(match, capture){
- return '\\00' + capture.charCodeAt(0).toString(16) + ' ';
- };
- return function(id) {
- return validIdRe.test(id)
- ? id
-
-
- : id.replace(escapeRx, escapeFn)
- .replace(leadingNumRx, numEscapeFn);
- };
- }()),
-
- getBody: (function() {
- var body;
- return function() {
- return body || (body = Ext.get(document.body));
- };
- }()),
-
- getHead: (function() {
- var head;
- return function() {
- return head || (head = Ext.get(document.getElementsByTagName("head")[0]));
- };
- }()),
-
- getDoc: (function() {
- var doc;
- return function() {
- return doc || (doc = Ext.get(document));
- };
- }()),
-
- getCmp: function(id) {
- return Ext.ComponentManager.get(id);
- },
-
- getOrientation: function() {
- return window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
- },
-
- destroy: function() {
- var ln = arguments.length,
- i, arg;
- for (i = 0; i < ln; i++) {
- arg = arguments[i];
- if (arg) {
- if (Ext.isArray(arg)) {
- this.destroy.apply(this, arg);
- }
- else if (Ext.isFunction(arg.destroy)) {
- arg.destroy();
- }
- else if (arg.dom) {
- arg.remove();
- }
- }
- }
- },
-
- callback: function(callback, scope, args, delay){
- if(Ext.isFunction(callback)){
- args = args || [];
- scope = scope || window;
- if (delay) {
- Ext.defer(callback, delay, scope, args);
- } else {
- callback.apply(scope, args);
- }
- }
- },
-
- htmlEncode : function(value) {
- return Ext.String.htmlEncode(value);
- },
-
- htmlDecode : function(value) {
- return Ext.String.htmlDecode(value);
- },
-
- urlAppend : function(url, s) {
- return Ext.String.urlAppend(url, s);
- }
- });
- Ext.ns = Ext.namespace;
- window.undefined = window.undefined;
- (function(){
- var check = function(regex){
- return regex.test(Ext.userAgent);
- },
- isStrict = document.compatMode == "CSS1Compat",
- version = function (is, regex) {
- var m;
- return (is && (m = regex.exec(Ext.userAgent))) ? parseFloat(m[1]) : 0;
- },
- docMode = document.documentMode,
- isOpera = check(/opera/),
- isOpera10_5 = isOpera && check(/version\/10\.5/),
- isChrome = check(/\bchrome\b/),
- isWebKit = check(/webkit/),
- isSafari = !isChrome && check(/safari/),
- isSafari2 = isSafari && check(/applewebkit\/4/),
- isSafari3 = isSafari && check(/version\/3/),
- isSafari4 = isSafari && check(/version\/4/),
- isSafari5_0 = isSafari && check(/version\/5\.0/),
- isSafari5 = isSafari && check(/version\/5/),
- isIE = !isOpera && check(/msie/),
- isIE7 = isIE && ((check(/msie 7/) && docMode != 8 && docMode != 9) || docMode == 7),
- isIE8 = isIE && ((check(/msie 8/) && docMode != 7 && docMode != 9) || docMode == 8),
- isIE9 = isIE && ((check(/msie 9/) && docMode != 7 && docMode != 8) || docMode == 9),
- isIE6 = isIE && check(/msie 6/),
- isGecko = !isWebKit && check(/gecko/),
- isGecko3 = isGecko && check(/rv:1\.9/),
- isGecko4 = isGecko && check(/rv:2\.0/),
- isGecko5 = isGecko && check(/rv:5\./),
- isGecko10 = isGecko && check(/rv:10\./),
- isFF3_0 = isGecko3 && check(/rv:1\.9\.0/),
- isFF3_5 = isGecko3 && check(/rv:1\.9\.1/),
- isFF3_6 = isGecko3 && check(/rv:1\.9\.2/),
- isWindows = check(/windows|win32/),
- isMac = check(/macintosh|mac os x/),
- isLinux = check(/linux/),
- scrollbarSize = null,
- chromeVersion = version(true, /\bchrome\/(\d+\.\d+)/),
- firefoxVersion = version(true, /\bfirefox\/(\d+\.\d+)/),
- ieVersion = version(isIE, /msie (\d+\.\d+)/),
- operaVersion = version(isOpera, /version\/(\d+\.\d+)/),
- safariVersion = version(isSafari, /version\/(\d+\.\d+)/),
- webKitVersion = version(isWebKit, /webkit\/(\d+\.\d+)/),
- isSecure = /^https/i.test(window.location.protocol),
- nullLog;
-
- try {
- document.execCommand("BackgroundImageCache", false, true);
- } catch(e) {}
- nullLog = function () {};
- nullLog.info = nullLog.warn = nullLog.error = Ext.emptyFn;
- Ext.setVersion('extjs', '4.1.1.1');
- Ext.apply(Ext, {
-
- SSL_SECURE_URL : isSecure && isIE ? 'javascript:\'\'' : 'about:blank',
-
-
- scopeResetCSS : Ext.buildSettings.scopeResetCSS,
-
-
- resetCls: Ext.buildSettings.baseCSSPrefix + 'reset',
-
- enableNestedListenerRemoval : false,
-
- USE_NATIVE_JSON : false,
-
- getDom : function(el, strict) {
- if (!el || !document) {
- return null;
- }
- if (el.dom) {
- return el.dom;
- } else {
- if (typeof el == 'string') {
- var e = Ext.getElementById(el);
-
-
- if (e && isIE && strict) {
- if (el == e.getAttribute('id')) {
- return e;
- } else {
- return null;
- }
- }
- return e;
- } else {
- return el;
- }
- }
- },
-
- removeNode : isIE6 || isIE7 || isIE8
- ? (function() {
- var d;
- return function(n){
- if(n && n.tagName.toUpperCase() != 'BODY'){
- (Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n) : Ext.EventManager.removeAll(n);
- var cache = Ext.cache,
- id = n.id;
- if (cache[id]) {
- delete cache[id].dom;
- delete cache[id];
- }
- if (isIE8 && n.parentNode) {
- n.parentNode.removeChild(n);
- }
- d = d || document.createElement('div');
- d.appendChild(n);
- d.innerHTML = '';
- }
- };
- }())
- : function(n) {
- if (n && n.parentNode && n.tagName.toUpperCase() != 'BODY') {
- (Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n) : Ext.EventManager.removeAll(n);
- var cache = Ext.cache,
- id = n.id;
- if (cache[id]) {
- delete cache[id].dom;
- delete cache[id];
- }
- n.parentNode.removeChild(n);
- }
- },
- isStrict: isStrict,
- isIEQuirks: isIE && !isStrict,
-
- isOpera : isOpera,
-
- isOpera10_5 : isOpera10_5,
-
- isWebKit : isWebKit,
-
- isChrome : isChrome,
-
- isSafari : isSafari,
-
- isSafari3 : isSafari3,
-
- isSafari4 : isSafari4,
-
- isSafari5 : isSafari5,
-
- isSafari5_0 : isSafari5_0,
-
- isSafari2 : isSafari2,
-
- isIE : isIE,
-
- isIE6 : isIE6,
-
- isIE7 : isIE7,
-
- isIE8 : isIE8,
-
- isIE9 : isIE9,
-
- isGecko : isGecko,
-
- isGecko3 : isGecko3,
-
- isGecko4 : isGecko4,
-
- isGecko5 : isGecko5,
-
- isGecko10 : isGecko10,
-
- isFF3_0 : isFF3_0,
-
- isFF3_5 : isFF3_5,
-
- isFF3_6 : isFF3_6,
-
- isFF4 : 4 <= firefoxVersion && firefoxVersion < 5,
-
- isFF5 : 5 <= firefoxVersion && firefoxVersion < 6,
-
- isFF10 : 10 <= firefoxVersion && firefoxVersion < 11,
-
- isLinux : isLinux,
-
- isWindows : isWindows,
-
- isMac : isMac,
-
- chromeVersion: chromeVersion,
-
- firefoxVersion: firefoxVersion,
-
- ieVersion: ieVersion,
-
- operaVersion: operaVersion,
-
- safariVersion: safariVersion,
-
- webKitVersion: webKitVersion,
-
- isSecure: isSecure,
-
-
- BLANK_IMAGE_URL : (isIE6 || isIE7) ? '/' + '/www.sencha.com/s.gif' : 'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',
-
- value : function(v, defaultValue, allowBlank){
- return Ext.isEmpty(v, allowBlank) ? defaultValue : v;
- },
-
- escapeRe : function(s) {
- return s.replace(/([-.*+?\^${}()|\[\]\/\\])/g, "\\$1");
- },
-
- addBehaviors : function(o){
- if(!Ext.isReady){
- Ext.onReady(function(){
- Ext.addBehaviors(o);
- });
- } else {
- var cache = {},
- parts,
- b,
- s;
- for (b in o) {
- if ((parts = b.split('@'))[1]) {
- s = parts[0];
- if(!cache[s]){
- cache[s] = Ext.select(s);
- }
- cache[s].on(parts[1], o[b]);
- }
- }
- cache = null;
- }
- },
-
- getScrollbarSize: function (force) {
- if (!Ext.isReady) {
- return {};
- }
- if (force || !scrollbarSize) {
- var db = document.body,
- div = document.createElement('div');
- div.style.width = div.style.height = '100px';
- div.style.overflow = 'scroll';
- div.style.position = 'absolute';
- db.appendChild(div);
-
- scrollbarSize = {
- width: div.offsetWidth - div.clientWidth,
- height: div.offsetHeight - div.clientHeight
- };
- db.removeChild(div);
- }
- return scrollbarSize;
- },
-
- getScrollBarWidth: function(force){
- var size = Ext.getScrollbarSize(force);
- return size.width + 2;
- },
-
- copyTo : function(dest, source, names, usePrototypeKeys){
- if(typeof names == 'string'){
- names = names.split(/[,;\s]/);
- }
- var n,
- nLen = names.length,
- name;
- for(n = 0; n < nLen; n++) {
- name = names[n];
- if(usePrototypeKeys || source.hasOwnProperty(name)){
- dest[name] = source[name];
- }
- }
- return dest;
- },
-
- destroyMembers : function(o){
- for (var i = 1, a = arguments, len = a.length; i < len; i++) {
- Ext.destroy(o[a[i]]);
- delete o[a[i]];
- }
- },
-
- log :
- nullLog,
-
- partition : function(arr, truth){
- var ret = [[],[]],
- a, v,
- aLen = arr.length;
- for (a = 0; a < aLen; a++) {
- v = arr[a];
- ret[ (truth && truth(v, a, arr)) || (!truth && v) ? 0 : 1].push(v);
- }
- return ret;
- },
-
- invoke : function(arr, methodName){
- var ret = [],
- args = Array.prototype.slice.call(arguments, 2),
- a, v,
- aLen = arr.length;
- for (a = 0; a < aLen; a++) {
- v = arr[a];
- if (v && typeof v[methodName] == 'function') {
- ret.push(v[methodName].apply(v, args));
- } else {
- ret.push(undefined);
- }
- }
- return ret;
- },
-
- zip : function(){
- var parts = Ext.partition(arguments, function( val ){ return typeof val != 'function'; }),
- arrs = parts[0],
- fn = parts[1][0],
- len = Ext.max(Ext.pluck(arrs, "length")),
- ret = [],
- i,
- j,
- aLen;
- for (i = 0; i < len; i++) {
- ret[i] = [];
- if(fn){
- ret[i] = fn.apply(fn, Ext.pluck(arrs, i));
- }else{
- for (j = 0, aLen = arrs.length; j < aLen; j++){
- ret[i].push( arrs[j][i] );
- }
- }
- }
- return ret;
- },
-
- toSentence: function(items, connector) {
- var length = items.length,
- head,
- tail;
- if (length <= 1) {
- return items[0];
- } else {
- head = items.slice(0, length - 1);
- tail = items[length - 1];
- return Ext.util.Format.format("{0} {1} {2}", head.join(", "), connector || 'and', tail);
- }
- },
-
- useShims: isIE6
- });
- }());
- Ext.application = function(config) {
- Ext.require('Ext.app.Application');
- Ext.onReady(function() {
- new Ext.app.Application(config);
- });
- };
- //@tag extras,core
- //@require ../Ext-more.js
- //@define Ext.util.Format
- (function() {
- Ext.ns('Ext.util');
- Ext.util.Format = {};
- var UtilFormat = Ext.util.Format,
- stripTagsRE = /<\/?[^>]+>/gi,
- stripScriptsRe = /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,
- nl2brRe = /\r?\n/g,
-
- formatCleanRe = /[^\d\.]/g,
-
-
- I18NFormatCleanRe;
- Ext.apply(UtilFormat, {
-
-
- thousandSeparator: ',',
-
-
-
- decimalSeparator: '.',
-
-
-
- currencyPrecision: 2,
-
-
-
- currencySign: '$',
-
-
-
- currencyAtEnd: false,
-
-
- undef : function(value) {
- return value !== undefined ? value : "";
- },
-
- defaultValue : function(value, defaultValue) {
- return value !== undefined && value !== '' ? value : defaultValue;
- },
-
- substr : 'ab'.substr(-1) != 'b'
- ? function (value, start, length) {
- var str = String(value);
- return (start < 0)
- ? str.substr(Math.max(str.length + start, 0), length)
- : str.substr(start, length);
- }
- : function(value, start, length) {
- return String(value).substr(start, length);
- },
-
- lowercase : function(value) {
- return String(value).toLowerCase();
- },
-
- uppercase : function(value) {
- return String(value).toUpperCase();
- },
-
- usMoney : function(v) {
- return UtilFormat.currency(v, '$', 2);
- },
-
- currency: function(v, currencySign, decimals, end) {
- var negativeSign = '',
- format = ",0",
- i = 0;
- v = v - 0;
- if (v < 0) {
- v = -v;
- negativeSign = '-';
- }
- decimals = Ext.isDefined(decimals) ? decimals : UtilFormat.currencyPrecision;
- format += format + (decimals > 0 ? '.' : '');
- for (; i < decimals; i++) {
- format += '0';
- }
- v = UtilFormat.number(v, format);
- if ((end || UtilFormat.currencyAtEnd) === true) {
- return Ext.String.format("{0}{1}{2}", negativeSign, v, currencySign || UtilFormat.currencySign);
- } else {
- return Ext.String.format("{0}{1}{2}", negativeSign, currencySign || UtilFormat.currencySign, v);
- }
- },
-
- date: function(v, format) {
- if (!v) {
- return "";
- }
- if (!Ext.isDate(v)) {
- v = new Date(Date.parse(v));
- }
- return Ext.Date.dateFormat(v, format || Ext.Date.defaultFormat);
- },
-
- dateRenderer : function(format) {
- return function(v) {
- return UtilFormat.date(v, format);
- };
- },
-
- stripTags : function(v) {
- return !v ? v : String(v).replace(stripTagsRE, "");
- },
-
- stripScripts : function(v) {
- return !v ? v : String(v).replace(stripScriptsRe, "");
- },
-
- fileSize : function(size) {
- if (size < 1024) {
- return size + " bytes";
- } else if (size < 1048576) {
- return (Math.round(((size*10) / 1024))/10) + " KB";
- } else {
- return (Math.round(((size*10) / 1048576))/10) + " MB";
- }
- },
-
- math : (function(){
- var fns = {};
- return function(v, a){
- if (!fns[a]) {
- fns[a] = Ext.functionFactory('v', 'return v ' + a + ';');
- }
- return fns[a](v);
- };
- }()),
-
- round : function(value, precision) {
- var result = Number(value);
- if (typeof precision == 'number') {
- precision = Math.pow(10, precision);
- result = Math.round(value * precision) / precision;
- }
- return result;
- },
-
- number : function(v, formatString) {
- if (!formatString) {
- return v;
- }
- v = Ext.Number.from(v, NaN);
- if (isNaN(v)) {
- return '';
- }
- var comma = UtilFormat.thousandSeparator,
- dec = UtilFormat.decimalSeparator,
- i18n = false,
- neg = v < 0,
- hasComma,
- psplit,
- fnum,
- cnum,
- parr,
- j,
- m,
- n,
- i;
- v = Math.abs(v);
-
-
-
-
- if (formatString.substr(formatString.length - 2) == '/i') {
- if (!I18NFormatCleanRe) {
- I18NFormatCleanRe = new RegExp('[^\\d\\' + UtilFormat.decimalSeparator + ']','g');
- }
- formatString = formatString.substr(0, formatString.length - 2);
- i18n = true;
- hasComma = formatString.indexOf(comma) != -1;
- psplit = formatString.replace(I18NFormatCleanRe, '').split(dec);
- } else {
- hasComma = formatString.indexOf(',') != -1;
- psplit = formatString.replace(formatCleanRe, '').split('.');
- }
- if (psplit.length > 2) {
- } else if (psplit.length > 1) {
- v = Ext.Number.toFixed(v, psplit[1].length);
- } else {
- v = Ext.Number.toFixed(v, 0);
- }
- fnum = v.toString();
- psplit = fnum.split('.');
- if (hasComma) {
- cnum = psplit[0];
- parr = [];
- j = cnum.length;
- m = Math.floor(j / 3);
- n = cnum.length % 3 || 3;
- for (i = 0; i < j; i += n) {
- if (i !== 0) {
- n = 3;
- }
- parr[parr.length] = cnum.substr(i, n);
- m -= 1;
- }
- fnum = parr.join(comma);
- if (psplit[1]) {
- fnum += dec + psplit[1];
- }
- } else {
- if (psplit[1]) {
- fnum = psplit[0] + dec + psplit[1];
- }
- }
- if (neg) {
-
- neg = fnum.replace(/[^1-9]/g, '') !== '';
- }
- return (neg ? '-' : '') + formatString.replace(/[\d,?\.?]+/, fnum);
- },
-
- numberRenderer : function(format) {
- return function(v) {
- return UtilFormat.number(v, format);
- };
- },
-
- plural : function(v, s, p) {
- return v +' ' + (v == 1 ? s : (p ? p : s+'s'));
- },
-
- nl2br : function(v) {
- return Ext.isEmpty(v) ? '' : v.replace(nl2brRe, '<br/>');
- },
-
- capitalize: Ext.String.capitalize,
-
- ellipsis: Ext.String.ellipsis,
-
- format: Ext.String.format,
-
- htmlDecode: Ext.String.htmlDecode,
-
- htmlEncode: Ext.String.htmlEncode,
-
- leftPad: Ext.String.leftPad,
-
- trim : Ext.String.trim,
-
- parseBox : function(box) {
- box = Ext.isEmpty(box) ? '' : box;
- if (Ext.isNumber(box)) {
- box = box.toString();
- }
- var parts = box.split(' '),
- ln = parts.length;
- if (ln == 1) {
- parts[1] = parts[2] = parts[3] = parts[0];
- }
- else if (ln == 2) {
- parts[2] = parts[0];
- parts[3] = parts[1];
- }
- else if (ln == 3) {
- parts[3] = parts[1];
- }
- return {
- top :parseInt(parts[0], 10) || 0,
- right :parseInt(parts[1], 10) || 0,
- bottom:parseInt(parts[2], 10) || 0,
- left :parseInt(parts[3], 10) || 0
- };
- },
-
- escapeRegex : function(s) {
- return s.replace(/([\-.*+?\^${}()|\[\]\/\\])/g, "\\$1");
- }
- });
- }());
- //@tag extras,core
- //@require Format.js
- //@define Ext.util.TaskManager
- //@define Ext.TaskManager
- Ext.define('Ext.util.TaskRunner', {
-
- interval: 10,
-
- timerId: null,
- constructor: function (interval) {
- var me = this;
- if (typeof interval == 'number') {
- me.interval = interval;
- } else if (interval) {
- Ext.apply(me, interval);
- }
- me.tasks = [];
- me.timerFn = Ext.Function.bind(me.onTick, me);
- },
-
- newTask: function (config) {
- var task = new Ext.util.TaskRunner.Task(config);
- task.manager = this;
- return task;
- },
-
- start: function(task) {
- var me = this,
- now = new Date().getTime();
- if (!task.pending) {
- me.tasks.push(task);
- task.pending = true;
- }
- task.stopped = false;
- task.taskStartTime = now;
- task.taskRunTime = task.fireOnStart !== false ? 0 : task.taskStartTime;
- task.taskRunCount = 0;
- if (!me.firing) {
- if (task.fireOnStart !== false) {
- me.startTimer(0, now);
- } else {
- me.startTimer(task.interval, now);
- }
- }
- return task;
- },
-
- stop: function(task) {
-
-
-
- if (!task.stopped) {
- task.stopped = true;
- if (task.onStop) {
- task.onStop.call(task.scope || task, task);
- }
- }
- return task;
- },
-
- stopAll: function() {
-
- Ext.each(this.tasks, this.stop, this);
- },
-
- firing: false,
- nextExpires: 1e99,
-
- onTick: function () {
- var me = this,
- tasks = me.tasks,
- now = new Date().getTime(),
- nextExpires = 1e99,
- len = tasks.length,
- expires, newTasks, i, task, rt, remove;
- me.timerId = null;
- me.firing = true;
-
-
-
-
- for (i = 0; i < len || i < (len = tasks.length); ++i) {
- task = tasks[i];
- if (!(remove = task.stopped)) {
- expires = task.taskRunTime + task.interval;
- if (expires <= now) {
- rt = 1;
- try {
- rt = task.run.apply(task.scope || task, task.args || [++task.taskRunCount]);
- } catch (taskError) {
- try {
- if (task.onError) {
- rt = task.onError.call(task.scope || task, task, taskError);
- }
- } catch (ignore) { }
- }
- task.taskRunTime = now;
- if (rt === false || task.taskRunCount === task.repeat) {
- me.stop(task);
- remove = true;
- } else {
- remove = task.stopped;
- expires = now + task.interval;
- }
- }
- if (!remove && task.duration && task.duration <= (now - task.taskStartTime)) {
- me.stop(task);
- remove = true;
- }
- }
- if (remove) {
- task.pending = false;
-
-
-
-
-
- if (!newTasks) {
- newTasks = tasks.slice(0, i);
-
-
-
- }
- } else {
- if (newTasks) {
- newTasks.push(task);
- }
- if (nextExpires > expires) {
- nextExpires = expires;
- }
- }
- }
- if (newTasks) {
-
-
- me.tasks = newTasks;
- }
- me.firing = false;
- if (me.tasks.length) {
-
-
-
- me.startTimer(nextExpires - now, new Date().getTime());
- }
- },
-
- startTimer: function (timeout, now) {
- var me = this,
- expires = now + timeout,
- timerId = me.timerId;
-
-
- if (timerId && me.nextExpires - expires > me.interval) {
- clearTimeout(timerId);
- timerId = null;
- }
- if (!timerId) {
- if (timeout < me.interval) {
- timeout = me.interval;
- }
- me.timerId = setTimeout(me.timerFn, timeout);
- me.nextExpires = expires;
- }
- }
- },
- function () {
- var me = this,
- proto = me.prototype;
-
- proto.destroy = proto.stopAll;
-
- Ext.util.TaskManager = Ext.TaskManager = new me();
-
- me.Task = new Ext.Class({
- isTask: true,
-
- stopped: true,
-
- fireOnStart: false,
- constructor: function (config) {
- Ext.apply(this, config);
- },
-
- restart: function (interval) {
- if (interval !== undefined) {
- this.interval = interval;
- }
- this.manager.start(this);
- },
-
- start: function (interval) {
- if (this.stopped) {
- this.restart(interval);
- }
- },
-
- stop: function () {
- this.manager.stop(this);
- }
- });
- proto = me.Task.prototype;
-
- proto.destroy = proto.stop;
- });
- //@tag extras,core
- //@require ../util/TaskManager.js
- Ext.define('Ext.perf.Accumulator', (function () {
- var currentFrame = null,
- khrome = Ext.global['chrome'],
- formatTpl,
-
-
- getTimestamp = function () {
- getTimestamp = function () {
- return new Date().getTime();
- };
-
- var interval, toolbox;
-
- if (Ext.isChrome && khrome && khrome.Interval) {
- interval = new khrome.Interval();
- interval.start();
- getTimestamp = function () {
- return interval.microseconds() / 1000;
- };
- } else if (window.ActiveXObject) {
- try {
-
- toolbox = new ActiveXObject('SenchaToolbox.Toolbox');
- Ext.senchaToolbox = toolbox;
- getTimestamp = function () {
- return toolbox.milliseconds;
- };
- } catch (e) {
-
- }
- } else if (Date.now) {
- getTimestamp = Date.now;
- }
- Ext.perf.getTimestamp = Ext.perf.Accumulator.getTimestamp = getTimestamp;
- return getTimestamp();
- };
- function adjustSet (set, time) {
- set.sum += time;
- set.min = Math.min(set.min, time);
- set.max = Math.max(set.max, time);
- }
- function leaveFrame (time) {
- var totalTime = time ? time : (getTimestamp() - this.time),
- me = this,
- accum = me.accum;
- ++accum.count;
- if (! --accum.depth) {
- adjustSet(accum.total, totalTime);
- }
- adjustSet(accum.pure, totalTime - me.childTime);
- currentFrame = me.parent;
- if (currentFrame) {
- ++currentFrame.accum.childCount;
- currentFrame.childTime += totalTime;
- }
- }
- function makeSet () {
- return {
- min: Number.MAX_VALUE,
- max: 0,
- sum: 0
- };
- }
- function makeTap (me, fn) {
- return function () {
- var frame = me.enter(),
- ret = fn.apply(this, arguments);
- frame.leave();
- return ret;
- };
- }
- function round (x) {
- return Math.round(x * 100) / 100;
- }
- function setToJSON (count, childCount, calibration, set) {
- var data = {
- avg: 0,
- min: set.min,
- max: set.max,
- sum: 0
- };
- if (count) {
- calibration = calibration || 0;
- data.sum = set.sum - childCount * calibration;
- data.avg = data.sum / count;
-
-
- }
- return data;
- }
- return {
- constructor: function (name) {
- var me = this;
- me.count = me.childCount = me.depth = me.maxDepth = 0;
- me.pure = makeSet();
- me.total = makeSet();
- me.name = name;
- },
- statics: {
- getTimestamp: getTimestamp
- },
- format: function (calibration) {
- if (!formatTpl) {
- formatTpl = new Ext.XTemplate([
- '{name} - {count} call(s)',
- '<tpl if="count">',
- '<tpl if="childCount">',
- ' ({childCount} children)',
- '</tpl>',
- '<tpl if="depth - 1">',
- ' ({depth} deep)',
- '</tpl>',
- '<tpl for="times">',
- ', {type}: {[this.time(values.sum)]} msec (',
-
- 'avg={[this.time(values.sum / parent.count)]}',
-
- ')',
- '</tpl>',
- '</tpl>'
- ].join(''), {
- time: function (t) {
- return Math.round(t * 100) / 100;
- }
- });
- }
- var data = this.getData(calibration);
- data.name = this.name;
- data.pure.type = 'Pure';
- data.total.type = 'Total';
- data.times = [data.pure, data.total];
- return formatTpl.apply(data);
- },
- getData: function (calibration) {
- var me = this;
- return {
- count: me.count,
- childCount: me.childCount,
- depth: me.maxDepth,
- pure: setToJSON(me.count, me.childCount, calibration, me.pure),
- total: setToJSON(me.count, me.childCount, calibration, me.total)
- };
- },
- enter: function () {
- var me = this,
- frame = {
- accum: me,
- leave: leaveFrame,
- childTime: 0,
- parent: currentFrame
- };
- ++me.depth;
- if (me.maxDepth < me.depth) {
- me.maxDepth = me.depth;
- }
- currentFrame = frame;
- frame.time = getTimestamp();
- return frame;
- },
- monitor: function (fn, scope, args) {
- var frame = this.enter();
- if (args) {
- fn.apply(scope, args);
- } else {
- fn.call(scope);
- }
- frame.leave();
- },
- report: function () {
- Ext.log(this.format());
- },
- tap: function (className, methodName) {
- var me = this,
- methods = typeof methodName == 'string' ? [methodName] : methodName,
- klass, statik, i, parts, length, name, src,
- tapFunc;
- tapFunc = function(){
- if (typeof className == 'string') {
- klass = Ext.global;
- parts = className.split('.');
- for (i = 0, length = parts.length; i < length; ++i) {
- klass = klass[parts[i]];
- }
- } else {
- klass = className;
- }
- for (i = 0, length = methods.length; i < length; ++i) {
- name = methods[i];
- statik = name.charAt(0) == '!';
- if (statik) {
- name = name.substring(1);
- } else {
- statik = !(name in klass.prototype);
- }
- src = statik ? klass : klass.prototype;
- src[name] = makeTap(me, src[name]);
- }
- };
- Ext.ClassManager.onCreated(tapFunc, me, className);
- return me;
- }
- };
- }()),
- function () {
- Ext.perf.getTimestamp = this.getTimestamp;
- });
- //@tag extras,core
- //@require Accumulator.js
- Ext.define('Ext.perf.Monitor', {
- singleton: true,
- alternateClassName: 'Ext.Perf',
- requires: [
- 'Ext.perf.Accumulator'
- ],
- constructor: function () {
- this.accumulators = [];
- this.accumulatorsByName = {};
- },
- calibrate: function () {
- var accum = new Ext.perf.Accumulator('$'),
- total = accum.total,
- getTimestamp = Ext.perf.Accumulator.getTimestamp,
- count = 0,
- frame,
- endTime,
- startTime;
- startTime = getTimestamp();
- do {
- frame = accum.enter();
- frame.leave();
- ++count;
- } while (total.sum < 100);
- endTime = getTimestamp();
- return (endTime - startTime) / count;
- },
- get: function (name) {
- var me = this,
- accum = me.accumulatorsByName[name];
- if (!accum) {
- me.accumulatorsByName[name] = accum = new Ext.perf.Accumulator(name);
- me.accumulators.push(accum);
- }
- return accum;
- },
- enter: function (name) {
- return this.get(name).enter();
- },
- monitor: function (name, fn, scope) {
- this.get(name).monitor(fn, scope);
- },
- report: function () {
- var me = this,
- accumulators = me.accumulators,
- calibration = me.calibrate();
- accumulators.sort(function (a, b) {
- return (a.name < b.name) ? -1 : ((b.name < a.name) ? 1 : 0);
- });
- me.updateGC();
- Ext.log('Calibration: ' + Math.round(calibration * 100) / 100 + ' msec/sample');
- Ext.each(accumulators, function (accum) {
- Ext.log(accum.format(calibration));
- });
- },
- getData: function (all) {
- var ret = {},
- accumulators = this.accumulators;
- Ext.each(accumulators, function (accum) {
- if (all || accum.count) {
- ret[accum.name] = accum.getData();
- }
- });
- return ret;
- },
- reset: function(){
- Ext.each(this.accumulators, function(accum){
- var me = accum;
- me.count = me.childCount = me.depth = me.maxDepth = 0;
- me.pure = {
- min: Number.MAX_VALUE,
- max: 0,
- sum: 0
- };
- me.total = {
- min: Number.MAX_VALUE,
- max: 0,
- sum: 0
- };
- });
- },
- updateGC: function () {
- var accumGC = this.accumulatorsByName.GC,
- toolbox = Ext.senchaToolbox,
- bucket;
- if (accumGC) {
- accumGC.count = toolbox.garbageCollectionCounter || 0;
- if (accumGC.count) {
- bucket = accumGC.pure;
- accumGC.total.sum = bucket.sum = toolbox.garbageCollectionMilliseconds;
- bucket.min = bucket.max = bucket.sum / accumGC.count;
- bucket = accumGC.total;
- bucket.min = bucket.max = bucket.sum / accumGC.count;
- }
- }
- },
- watchGC: function () {
- Ext.perf.getTimestamp();
- var toolbox = Ext.senchaToolbox;
- if (toolbox) {
- this.get("GC");
- toolbox.watchGarbageCollector(false);
- }
- },
- setup: function (config) {
- if (!config) {
- config = {
-
-
- render: {
- 'Ext.AbstractComponent': 'render'
- },
- layout: {
- 'Ext.layout.Context': 'run'
- }
- };
- }
- this.currentConfig = config;
- var key, prop,
- accum, className, methods;
- for (key in config) {
- if (config.hasOwnProperty(key)) {
- prop = config[key];
- accum = Ext.Perf.get(key);
- for (className in prop) {
- if (prop.hasOwnProperty(className)) {
- methods = prop[className];
- accum.tap(className, methods);
- }
- }
- }
- }
- this.watchGC();
- }
- });
- //@tag extras,core
- //@require perf/Monitor.js
- //@define Ext.Supports
- Ext.is = {
- init : function(navigator) {
- var platforms = this.platforms,
- ln = platforms.length,
- i, platform;
- navigator = navigator || window.navigator;
- for (i = 0; i < ln; i++) {
- platform = platforms[i];
- this[platform.identity] = platform.regex.test(navigator[platform.property]);
- }
-
- this.Desktop = this.Mac || this.Windows || (this.Linux && !this.Android);
-
- this.Tablet = this.iPad;
-
- this.Phone = !this.Desktop && !this.Tablet;
-
- this.iOS = this.iPhone || this.iPad || this.iPod;
-
-
- this.Standalone = !!window.navigator.standalone;
- },
-
-
- platforms: [{
- property: 'platform',
- regex: /iPhone/i,
- identity: 'iPhone'
- },
-
-
- {
- property: 'platform',
- regex: /iPod/i,
- identity: 'iPod'
- },
-
-
- {
- property: 'userAgent',
- regex: /iPad/i,
- identity: 'iPad'
- },
-
-
- {
- property: 'userAgent',
- regex: /Blackberry/i,
- identity: 'Blackberry'
- },
-
-
- {
- property: 'userAgent',
- regex: /Android/i,
- identity: 'Android'
- },
-
-
- {
- property: 'platform',
- regex: /Mac/i,
- identity: 'Mac'
- },
-
-
- {
- property: 'platform',
- regex: /Win/i,
- identity: 'Windows'
- },
-
-
- {
- property: 'platform',
- regex: /Linux/i,
- identity: 'Linux'
- }]
- };
- Ext.is.init();
- (function(){
-
-
-
- var getStyle = function(element, styleName){
- var view = element.ownerDocument.defaultView,
- style = (view ? view.getComputedStyle(element, null) : element.currentStyle) || element.style;
- return style[styleName];
- };
- Ext.supports = {
-
- init : function() {
- var me = this,
- doc = document,
- tests = me.tests,
- n = tests.length,
- div = n && Ext.isReady && doc.createElement('div'),
- test, notRun = [];
- if (div) {
- div.innerHTML = [
- '<div style="height:30px;width:50px;">',
- '<div style="height:20px;width:20px;"></div>',
- '</div>',
- '<div style="width: 200px; height: 200px; position: relative; padding: 5px;">',
- '<div style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></div>',
- '</div>',
- '<div style="position: absolute; left: 10%; top: 10%;"></div>',
- '<div style="float:left; background-color:transparent;"></div>'
- ].join('');
- doc.body.appendChild(div);
- }
- while (n--) {
- test = tests[n];
- if (div || test.early) {
- me[test.identity] = test.fn.call(me, doc, div);
- } else {
- notRun.push(test);
- }
- }
- if (div) {
- doc.body.removeChild(div);
- }
- me.tests = notRun;
- },
-
- PointerEvents: 'pointerEvents' in document.documentElement.style,
-
- CSS3BoxShadow: 'boxShadow' in document.documentElement.style || 'WebkitBoxShadow' in document.documentElement.style || 'MozBoxShadow' in document.documentElement.style,
-
- ClassList: !!document.documentElement.classList,
-
- OrientationChange: ((typeof window.orientation != 'undefined') && ('onorientationchange' in window)),
-
- DeviceMotion: ('ondevicemotion' in window),
-
-
-
- Touch: ('ontouchstart' in window) && (!Ext.is.Desktop),
-
- TimeoutActualLateness: (function(){
- setTimeout(function(){
- Ext.supports.TimeoutActualLateness = arguments.length !== 0;
- }, 0);
- }()),
- tests: [
-
- {
- identity: 'Transitions',
- fn: function(doc, div) {
- var prefix = [
- 'webkit',
- 'Moz',
- 'o',
- 'ms',
- 'khtml'
- ],
- TE = 'TransitionEnd',
- transitionEndName = [
- prefix[0] + TE,
- 'transitionend',
- prefix[2] + TE,
- prefix[3] + TE,
- prefix[4] + TE
- ],
- ln = prefix.length,
- i = 0,
- out = false;
- for (; i < ln; i++) {
- if (getStyle(div, prefix[i] + "TransitionProperty")) {
- Ext.supports.CSS3Prefix = prefix[i];
- Ext.supports.CSS3TransitionEnd = transitionEndName[i];
- out = true;
- break;
- }
- }
- return out;
- }
- },
-
- {
- identity: 'RightMargin',
- fn: function(doc, div) {
- var view = doc.defaultView;
- return !(view && view.getComputedStyle(div.firstChild.firstChild, null).marginRight != '0px');
- }
- },
-
- {
- identity: 'DisplayChangeInputSelectionBug',
- early: true,
- fn: function() {
- var webKitVersion = Ext.webKitVersion;
-
- return 0 < webKitVersion && webKitVersion < 533;
- }
- },
-
- {
- identity: 'DisplayChangeTextAreaSelectionBug',
- early: true,
- fn: function() {
- var webKitVersion = Ext.webKitVersion;
-
- return 0 < webKitVersion && webKitVersion < 534.24;
- }
- },
-
- {
- identity: 'TransparentColor',
- fn: function(doc, div, view) {
- view = doc.defaultView;
- return !(view && view.getComputedStyle(div.lastChild, null).backgroundColor != 'transparent');
- }
- },
-
- {
- identity: 'ComputedStyle',
- fn: function(doc, div, view) {
- view = doc.defaultView;
- return view && view.getComputedStyle;
- }
- },
-
- {
- identity: 'Svg',
- fn: function(doc) {
- return !!doc.createElementNS && !!doc.createElementNS( "http:/" + "/www.w3.org/2000/svg", "svg").createSVGRect;
- }
- },
-
- {
- identity: 'Canvas',
- fn: function(doc) {
- return !!doc.createElement('canvas').getContext;
- }
- },
-
- {
- identity: 'Vml',
- fn: function(doc) {
- var d = doc.createElement("div");
- d.innerHTML = "<!--[if vml]><br/><br/><![endif]-->";
- return (d.childNodes.length == 2);
- }
- },
-
- {
- identity: 'Float',
- fn: function(doc, div) {
- return !!div.lastChild.style.cssFloat;
- }
- },
-
- {
- identity: 'AudioTag',
- fn: function(doc) {
- return !!doc.createElement('audio').canPlayType;
- }
- },
-
- {
- identity: 'History',
- fn: function() {
- var history = window.history;
- return !!(history && history.pushState);
- }
- },
-
- {
- identity: 'CSS3DTransform',
- fn: function() {
- return (typeof WebKitCSSMatrix != 'undefined' && new WebKitCSSMatrix().hasOwnProperty('m41'));
- }
- },
-
- {
- identity: 'CSS3LinearGradient',
- fn: function(doc, div) {
- var property = 'background-image:',
- webkit = '-webkit-gradient(linear, left top, right bottom, from(black), to(white))',
- w3c = 'linear-gradient(left top, black, white)',
- moz = '-moz-' + w3c,
- opera = '-o-' + w3c,
- options = [property + webkit, property + w3c, property + moz, property + opera];
- div.style.cssText = options.join(';');
- return ("" + div.style.backgroundImage).indexOf('gradient') !== -1;
- }
- },
-
- {
- identity: 'CSS3BorderRadius',
- fn: function(doc, div) {
- var domPrefixes = ['borderRadius', 'BorderRadius', 'MozBorderRadius', 'WebkitBorderRadius', 'OBorderRadius', 'KhtmlBorderRadius'],
- pass = false,
- i;
- for (i = 0; i < domPrefixes.length; i++) {
- if (document.body.style[domPrefixes[i]] !== undefined) {
- return true;
- }
- }
- return pass;
- }
- },
-
- {
- identity: 'GeoLocation',
- fn: function() {
- return (typeof navigator != 'undefined' && typeof navigator.geolocation != 'undefined') || (typeof google != 'undefined' && typeof google.gears != 'undefined');
- }
- },
-
- {
- identity: 'MouseEnterLeave',
- fn: function(doc, div){
- return ('onmouseenter' in div && 'onmouseleave' in div);
- }
- },
-
- {
- identity: 'MouseWheel',
- fn: function(doc, div) {
- return ('onmousewheel' in div);
- }
- },
-
- {
- identity: 'Opacity',
- fn: function(doc, div){
-
- if (Ext.isIE6 || Ext.isIE7 || Ext.isIE8) {
- return false;
- }
- div.firstChild.style.cssText = 'opacity:0.73';
- return div.firstChild.style.opacity == '0.73';
- }
- },
-
- {
- identity: 'Placeholder',
- fn: function(doc) {
- return 'placeholder' in doc.createElement('input');
- }
- },
-
- {
- identity: 'Direct2DBug',
- fn: function() {
- return Ext.isString(document.body.style.msTransformOrigin);
- }
- },
-
- {
- identity: 'BoundingClientRect',
- fn: function(doc, div) {
- return Ext.isFunction(div.getBoundingClientRect);
- }
- },
- {
- identity: 'IncludePaddingInWidthCalculation',
- fn: function(doc, div){
- return div.childNodes[1].firstChild.offsetWidth == 210;
- }
- },
- {
- identity: 'IncludePaddingInHeightCalculation',
- fn: function(doc, div){
- return div.childNodes[1].firstChild.offsetHeight == 210;
- }
- },
-
- {
- identity: 'ArraySort',
- fn: function() {
- var a = [1,2,3,4,5].sort(function(){ return 0; });
- return a[0] === 1 && a[1] === 2 && a[2] === 3 && a[3] === 4 && a[4] === 5;
- }
- },
-
- {
- identity: 'Range',
- fn: function() {
- return !!document.createRange;
- }
- },
-
- {
- identity: 'CreateContextualFragment',
- fn: function() {
- var range = Ext.supports.Range ? document.createRange() : false;
- return range && !!range.createContextualFragment;
- }
- },
-
- {
- identity: 'WindowOnError',
- fn: function () {
-
- return Ext.isIE || Ext.isGecko || Ext.webKitVersion >= 534.16;
- }
- },
-
- {
- identity: 'TextAreaMaxLength',
- fn: function(){
- var el = document.createElement('textarea');
- return ('maxlength' in el);
- }
- },
-
-
- {
- identity: 'GetPositionPercentage',
- fn: function(doc, div){
- return getStyle(div.childNodes[2], 'left') == '10%';
- }
- }
- ]
- };
- }());
- Ext.supports.init();
- //@tag dom,core
- //@require ../Support.js
- //@define Ext.util.DelayedTask
- Ext.util.DelayedTask = function(fn, scope, args) {
- var me = this,
- id,
- call = function() {
- clearInterval(id);
- id = null;
- fn.apply(scope, args || []);
- };
-
- this.delay = function(delay, newFn, newScope, newArgs) {
- me.cancel();
- fn = newFn || fn;
- scope = newScope || scope;
- args = newArgs || args;
- id = setInterval(call, delay);
- };
-
- this.cancel = function(){
- if (id) {
- clearInterval(id);
- id = null;
- }
- };
- };
- //@tag dom,core
- //@define Ext.util.Event
- //@require Ext.util.DelayedTask
- Ext.require('Ext.util.DelayedTask', function() {
-
- Ext.util.Event = Ext.extend(Object, (function() {
- var noOptions = {};
- function createTargeted(handler, listener, o, scope){
- return function(){
- if (o.target === arguments[0]){
- handler.apply(scope, arguments);
- }
- };
- }
- function createBuffered(handler, listener, o, scope) {
- listener.task = new Ext.util.DelayedTask();
- return function() {
- listener.task.delay(o.buffer, handler, scope, Ext.Array.toArray(arguments));
- };
- }
- function createDelayed(handler, listener, o, scope) {
- return function() {
- var task = new Ext.util.DelayedTask();
- if (!listener.tasks) {
- listener.tasks = [];
- }
- listener.tasks.push(task);
- task.delay(o.delay || 10, handler, scope, Ext.Array.toArray(arguments));
- };
- }
- function createSingle(handler, listener, o, scope) {
- return function() {
- var event = listener.ev;
- if (event.removeListener(listener.fn, scope) && event.observable) {
-
-
- event.observable.hasListeners[event.name]--;
- }
- return handler.apply(scope, arguments);
- };
- }
- return {
-
- isEvent: true,
- constructor: function(observable, name) {
- this.name = name;
- this.observable = observable;
- this.listeners = [];
- },
- addListener: function(fn, scope, options) {
- var me = this,
- listener;
- scope = scope || me.observable;
- if (!me.isListening(fn, scope)) {
- listener = me.createListener(fn, scope, options);
- if (me.firing) {
-
- me.listeners = me.listeners.slice(0);
- }
- me.listeners.push(listener);
- }
- },
- createListener: function(fn, scope, options) {
- options = options || noOptions;
- scope = scope || this.observable;
- var listener = {
- fn: fn,
- scope: scope,
- o: options,
- ev: this
- },
- handler = fn;
-
-
- if (options.single) {
- handler = createSingle(handler, listener, options, scope);
- }
- if (options.target) {
- handler = createTargeted(handler, listener, options, scope);
- }
- if (options.delay) {
- handler = createDelayed(handler, listener, options, scope);
- }
- if (options.buffer) {
- handler = createBuffered(handler, listener, options, scope);
- }
- listener.fireFn = handler;
- return listener;
- },
- findListener: function(fn, scope) {
- var listeners = this.listeners,
- i = listeners.length,
- listener,
- s;
- while (i--) {
- listener = listeners[i];
- if (listener) {
- s = listener.scope;
-
-
-
- if (listener.fn == fn && (s == (scope || this.observable))) {
- return i;
- }
- }
- }
- return - 1;
- },
- isListening: function(fn, scope) {
- return this.findListener(fn, scope) !== -1;
- },
- removeListener: function(fn, scope) {
- var me = this,
- index,
- listener,
- k;
- index = me.findListener(fn, scope);
- if (index != -1) {
- listener = me.listeners[index];
- if (me.firing) {
- me.listeners = me.listeners.slice(0);
- }
-
- if (listener.task) {
- listener.task.cancel();
- delete listener.task;
- }
-
- k = listener.tasks && listener.tasks.length;
- if (k) {
- while (k--) {
- listener.tasks[k].cancel();
- }
- delete listener.tasks;
- }
-
- Ext.Array.erase(me.listeners, index, 1);
- return true;
- }
- return false;
- },
-
- clearListeners: function() {
- var listeners = this.listeners,
- i = listeners.length;
- while (i--) {
- this.removeListener(listeners[i].fn, listeners[i].scope);
- }
- },
- fire: function() {
- var me = this,
- listeners = me.listeners,
- count = listeners.length,
- i,
- args,
- listener;
- if (count > 0) {
- me.firing = true;
- for (i = 0; i < count; i++) {
- listener = listeners[i];
- args = arguments.length ? Array.prototype.slice.call(arguments, 0) : [];
- if (listener.o) {
- args.push(listener.o);
- }
- if (listener && listener.fireFn.apply(listener.scope || me.observable, args) === false) {
- return (me.firing = false);
- }
- }
- }
- me.firing = false;
- return true;
- }
- };
- }()));
- });
- //@tag dom,core
- //@require util/Event.js
- //@define Ext.EventManager
- Ext.EventManager = new function() {
- var EventManager = this,
- doc = document,
- win = window,
- initExtCss = function() {
-
- var bd = doc.body || doc.getElementsByTagName('body')[0],
- baseCSSPrefix = Ext.baseCSSPrefix,
- cls = [baseCSSPrefix + 'body'],
- htmlCls = [],
- supportsLG = Ext.supports.CSS3LinearGradient,
- supportsBR = Ext.supports.CSS3BorderRadius,
- resetCls = [],
- html,
- resetElementSpec;
- if (!bd) {
- return false;
- }
- html = bd.parentNode;
- function add (c) {
- cls.push(baseCSSPrefix + c);
- }
-
- if (Ext.isIE) {
- add('ie');
-
-
-
-
-
-
-
-
-
-
-
- if (Ext.isIE6) {
- add('ie6');
- } else {
- add('ie7p');
- if (Ext.isIE7) {
- add('ie7');
- } else {
- add('ie8p');
- if (Ext.isIE8) {
- add('ie8');
- } else {
- add('ie9p');
- if (Ext.isIE9) {
- add('ie9');
- }
- }
- }
- }
- if (Ext.isIE6 || Ext.isIE7) {
- add('ie7m');
- }
- if (Ext.isIE6 || Ext.isIE7 || Ext.isIE8) {
- add('ie8m');
- }
- if (Ext.isIE7 || Ext.isIE8) {
- add('ie78');
- }
- }
- if (Ext.isGecko) {
- add('gecko');
- if (Ext.isGecko3) {
- add('gecko3');
- }
- if (Ext.isGecko4) {
- add('gecko4');
- }
- if (Ext.isGecko5) {
- add('gecko5');
- }
- }
- if (Ext.isOpera) {
- add('opera');
- }
- if (Ext.isWebKit) {
- add('webkit');
- }
- if (Ext.isSafari) {
- add('safari');
- if (Ext.isSafari2) {
- add('safari2');
- }
- if (Ext.isSafari3) {
- add('safari3');
- }
- if (Ext.isSafari4) {
- add('safari4');
- }
- if (Ext.isSafari5) {
- add('safari5');
- }
- if (Ext.isSafari5_0) {
- add('safari5_0')
- }
- }
- if (Ext.isChrome) {
- add('chrome');
- }
- if (Ext.isMac) {
- add('mac');
- }
- if (Ext.isLinux) {
- add('linux');
- }
- if (!supportsBR) {
- add('nbr');
- }
- if (!supportsLG) {
- add('nlg');
- }
-
-
-
- if (Ext.scopeResetCSS) {
-
- resetElementSpec = Ext.resetElementSpec = {
- cls: baseCSSPrefix + 'reset'
- };
-
- if (!supportsLG) {
- resetCls.push(baseCSSPrefix + 'nlg');
- }
-
- if (!supportsBR) {
- resetCls.push(baseCSSPrefix + 'nbr');
- }
-
- if (resetCls.length) {
- resetElementSpec.cn = {
- cls: resetCls.join(' ')
- };
- }
-
- Ext.resetElement = Ext.getBody().createChild(resetElementSpec);
- if (resetCls.length) {
- Ext.resetElement = Ext.get(Ext.resetElement.dom.firstChild);
- }
- }
-
- else {
- Ext.resetElement = Ext.getBody();
- add('reset');
- }
-
- if (html) {
- if (Ext.isStrict && (Ext.isIE6 || Ext.isIE7)) {
- Ext.isBorderBox = false;
- }
- else {
- Ext.isBorderBox = true;
- }
- if(Ext.isBorderBox) {
- htmlCls.push(baseCSSPrefix + 'border-box');
- }
- if (Ext.isStrict) {
- htmlCls.push(baseCSSPrefix + 'strict');
- } else {
- htmlCls.push(baseCSSPrefix + 'quirks');
- }
- Ext.fly(html, '_internal').addCls(htmlCls);
- }
- Ext.fly(bd, '_internal').addCls(cls);
- return true;
- };
- Ext.apply(EventManager, {
-
- hasBoundOnReady: false,
-
- hasFiredReady: false,
-
- deferReadyEvent : 1,
-
- onReadyChain : [],
-
- readyEvent:
- (function () {
- var event = new Ext.util.Event();
- event.fire = function () {
- Ext._beforeReadyTime = Ext._beforeReadyTime || new Date().getTime();
- event.self.prototype.fire.apply(event, arguments);
- Ext._afterReadytime = new Date().getTime();
- };
- return event;
- }()),
-
- idleEvent: new Ext.util.Event(),
-
- isReadyPaused: function(){
- return (/[?&]ext-pauseReadyFire\b/i.test(location.search) && !Ext._continueFireReady);
- },
-
- bindReadyEvent: function() {
- if (EventManager.hasBoundOnReady) {
- return;
- }
-
- if ( doc.readyState == 'complete' ) {
- EventManager.onReadyEvent({
- type: doc.readyState || 'body'
- });
- } else {
- document.addEventListener('DOMContentLoaded', EventManager.onReadyEvent, false);
- window.addEventListener('load', EventManager.onReadyEvent, false);
- EventManager.hasBoundOnReady = true;
- }
- },
- onReadyEvent : function(e) {
- if (e && e.type) {
- EventManager.onReadyChain.push(e.type);
- }
- if (EventManager.hasBoundOnReady) {
- document.removeEventListener('DOMContentLoaded', EventManager.onReadyEvent, false);
- window.removeEventListener('load', EventManager.onReadyEvent, false);
- }
- if (!Ext.isReady) {
- EventManager.fireDocReady();
- }
- },
-
- fireDocReady: function() {
- if (!Ext.isReady) {
- Ext._readyTime = new Date().getTime();
- Ext.isReady = true;
- Ext.supports.init();
- EventManager.onWindowUnload();
- EventManager.readyEvent.onReadyChain = EventManager.onReadyChain;
- if (Ext.isNumber(EventManager.deferReadyEvent)) {
- Ext.Function.defer(EventManager.fireReadyEvent, EventManager.deferReadyEvent);
- EventManager.hasDocReadyTimer = true;
- } else {
- EventManager.fireReadyEvent();
- }
- }
- },
-
- fireReadyEvent: function(){
- var readyEvent = EventManager.readyEvent;
-
-
- EventManager.hasDocReadyTimer = false;
- EventManager.isFiring = true;
-
-
-
- while (readyEvent.listeners.length && !EventManager.isReadyPaused()) {
- readyEvent.fire();
- }
- EventManager.isFiring = false;
- EventManager.hasFiredReady = true;
- },
-
- onDocumentReady: function(fn, scope, options) {
- options = options || {};
-
- options.single = true;
- EventManager.readyEvent.addListener(fn, scope, options);
-
-
- if (!(EventManager.isFiring || EventManager.hasDocReadyTimer)) {
- if (Ext.isReady) {
- EventManager.fireReadyEvent();
- } else {
- EventManager.bindReadyEvent();
- }
- }
- },
-
-
- stoppedMouseDownEvent: new Ext.util.Event(),
-
- propRe: /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate|freezeEvent)$/,
-
- getId : function(element) {
- var id;
- element = Ext.getDom(element);
- if (element === doc || element === win) {
- id = element === doc ? Ext.documentId : Ext.windowId;
- }
- else {
- id = Ext.id(element);
- }
- if (!Ext.cache[id]) {
- Ext.addCacheEntry(id, null, element);
- }
- return id;
- },
-
- prepareListenerConfig: function(element, config, isRemove) {
- var propRe = EventManager.propRe,
- key, value, args;
-
- for (key in config) {
- if (config.hasOwnProperty(key)) {
-
- if (!propRe.test(key)) {
- value = config[key];
-
-
- if (typeof value == 'function') {
-
- args = [element, key, value, config.scope, config];
- } else {
-
- args = [element, key, value.fn, value.scope, value];
- }
- if (isRemove) {
- EventManager.removeListener.apply(EventManager, args);
- } else {
- EventManager.addListener.apply(EventManager, args);
- }
- }
- }
- }
- },
- mouseEnterLeaveRe: /mouseenter|mouseleave/,
-
- normalizeEvent: function(eventName, fn) {
- if (EventManager.mouseEnterLeaveRe.test(eventName) && !Ext.supports.MouseEnterLeave) {
- if (fn) {
- fn = Ext.Function.createInterceptor(fn, EventManager.contains);
- }
- eventName = eventName == 'mouseenter' ? 'mouseover' : 'mouseout';
- } else if (eventName == 'mousewheel' && !Ext.supports.MouseWheel && !Ext.isOpera) {
- eventName = 'DOMMouseScroll';
- }
- return {
- eventName: eventName,
- fn: fn
- };
- },
-
- contains: function(event) {
- var parent = event.browserEvent.currentTarget,
- child = EventManager.getRelatedTarget(event);
- if (parent && parent.firstChild) {
- while (child) {
- if (child === parent) {
- return false;
- }
- child = child.parentNode;
- if (child && (child.nodeType != 1)) {
- child = null;
- }
- }
- }
- return true;
- },
-
- addListener: function(element, eventName, fn, scope, options) {
-
- if (typeof eventName !== 'string') {
- EventManager.prepareListenerConfig(element, eventName);
- return;
- }
- var dom = element.dom || Ext.getDom(element),
- bind, wrap;
-
- options = options || {};
- bind = EventManager.normalizeEvent(eventName, fn);
- wrap = EventManager.createListenerWrap(dom, eventName, bind.fn, scope, options);
- if (dom.attachEvent) {
- dom.attachEvent('on' + bind.eventName, wrap);
- } else {
- dom.addEventListener(bind.eventName, wrap, options.capture || false);
- }
- if (dom == doc && eventName == 'mousedown') {
- EventManager.stoppedMouseDownEvent.addListener(wrap);
- }
-
- EventManager.getEventListenerCache(element.dom ? element : dom, eventName).push({
- fn: fn,
- wrap: wrap,
- scope: scope
- });
- },
-
- removeListener : function(element, eventName, fn, scope) {
-
- if (typeof eventName !== 'string') {
- EventManager.prepareListenerConfig(element, eventName, true);
- return;
- }
- var dom = Ext.getDom(element),
- el = element.dom ? element : Ext.get(dom),
- cache = EventManager.getEventListenerCache(el, eventName),
- bindName = EventManager.normalizeEvent(eventName).eventName,
- i = cache.length, j,
- listener, wrap, tasks;
- while (i--) {
- listener = cache[i];
- if (listener && (!fn || listener.fn == fn) && (!scope || listener.scope === scope)) {
- wrap = listener.wrap;
-
- if (wrap.task) {
- clearTimeout(wrap.task);
- delete wrap.task;
- }
-
- j = wrap.tasks && wrap.tasks.length;
- if (j) {
- while (j--) {
- clearTimeout(wrap.tasks[j]);
- }
- delete wrap.tasks;
- }
- if (dom.detachEvent) {
- dom.detachEvent('on' + bindName, wrap);
- } else {
- dom.removeEventListener(bindName, wrap, false);
- }
- if (wrap && dom == doc && eventName == 'mousedown') {
- EventManager.stoppedMouseDownEvent.removeListener(wrap);
- }
-
- Ext.Array.erase(cache, i, 1);
- }
- }
- },
-
- removeAll : function(element) {
- var el = element.dom ? element : Ext.get(element),
- cache, events, eventName;
- if (!el) {
- return;
- }
- cache = (el.$cache || el.getCache());
- events = cache.events;
- for (eventName in events) {
- if (events.hasOwnProperty(eventName)) {
- EventManager.removeListener(el, eventName);
- }
- }
- cache.events = {};
- },
-
- purgeElement : function(element, eventName) {
- var dom = Ext.getDom(element),
- i = 0, len;
- if (eventName) {
- EventManager.removeListener(element, eventName);
- }
- else {
- EventManager.removeAll(element);
- }
- if (dom && dom.childNodes) {
- for (len = element.childNodes.length; i < len; i++) {
- EventManager.purgeElement(element.childNodes[i], eventName);
- }
- }
- },
-
- createListenerWrap : function(dom, ename, fn, scope, options) {
- options = options || {};
- var f, gen, escapeRx = /\\/g, wrap = function(e, args) {
-
- if (!gen) {
- f = ['if(!' + Ext.name + ') {return;}'];
- if(options.buffer || options.delay || options.freezeEvent) {
- f.push('e = new X.EventObjectImpl(e, ' + (options.freezeEvent ? 'true' : 'false' ) + ');');
- } else {
- f.push('e = X.EventObject.setEvent(e);');
- }
- if (options.delegate) {
-
-
- f.push('var result, t = e.getTarget("' + (options.delegate + '').replace(escapeRx, '\\\\') + '", this);');
- f.push('if(!t) {return;}');
- } else {
- f.push('var t = e.target, result;');
- }
- if (options.target) {
- f.push('if(e.target !== options.target) {return;}');
- }
- if(options.stopEvent) {
- f.push('e.stopEvent();');
- } else {
- if(options.preventDefault) {
- f.push('e.preventDefault();');
- }
- if(options.stopPropagation) {
- f.push('e.stopPropagation();');
- }
- }
- if(options.normalized === false) {
- f.push('e = e.browserEvent;');
- }
- if(options.buffer) {
- f.push('(wrap.task && clearTimeout(wrap.task));');
- f.push('wrap.task = setTimeout(function() {');
- }
- if(options.delay) {
- f.push('wrap.tasks = wrap.tasks || [];');
- f.push('wrap.tasks.push(setTimeout(function() {');
- }
-
- f.push('result = fn.call(scope || dom, e, t, options);');
- if(options.single) {
- f.push('evtMgr.removeListener(dom, ename, fn, scope);');
- }
-
-
- if (ename !== 'mousemove') {
- f.push('if (evtMgr.idleEvent.listeners.length) {');
- f.push('evtMgr.idleEvent.fire();');
- f.push('}');
- }
- if(options.delay) {
- f.push('}, ' + options.delay + '));');
- }
- if(options.buffer) {
- f.push('}, ' + options.buffer + ');');
- }
- f.push('return result;')
- gen = Ext.cacheableFunctionFactory('e', 'options', 'fn', 'scope', 'ename', 'dom', 'wrap', 'args', 'X', 'evtMgr', f.join('\n'));
- }
- return gen.call(dom, e, options, fn, scope, ename, dom, wrap, args, Ext, EventManager);
- };
- return wrap;
- },
-
- getEventListenerCache : function(element, eventName) {
- var elementCache, eventCache;
- if (!element) {
- return [];
- }
- if (element.$cache) {
- elementCache = element.$cache;
- } else {
-
- elementCache = Ext.cache[EventManager.getId(element)];
- }
- eventCache = elementCache.events || (elementCache.events = {});
- return eventCache[eventName] || (eventCache[eventName] = []);
- },
-
- mouseLeaveRe: /(mouseout|mouseleave)/,
- mouseEnterRe: /(mouseover|mouseenter)/,
-
- stopEvent: function(event) {
- EventManager.stopPropagation(event);
- EventManager.preventDefault(event);
- },
-
- stopPropagation: function(event) {
- event = event.browserEvent || event;
- if (event.stopPropagation) {
- event.stopPropagation();
- } else {
- event.cancelBubble = true;
- }
- },
-
- preventDefault: function(event) {
- event = event.browserEvent || event;
- if (event.preventDefault) {
- event.preventDefault();
- } else {
- event.returnValue = false;
-
- try {
-
- if (event.ctrlKey || event.keyCode > 111 && event.keyCode < 124) {
- event.keyCode = -1;
- }
- } catch (e) {
-
- }
- }
- },
-
- getRelatedTarget: function(event) {
- event = event.browserEvent || event;
- var target = event.relatedTarget;
- if (!target) {
- if (EventManager.mouseLeaveRe.test(event.type)) {
- target = event.toElement;
- } else if (EventManager.mouseEnterRe.test(event.type)) {
- target = event.fromElement;
- }
- }
- return EventManager.resolveTextNode(target);
- },
-
- getPageX: function(event) {
- return EventManager.getPageXY(event)[0];
- },
-
- getPageY: function(event) {
- return EventManager.getPageXY(event)[1];
- },
-
- getPageXY: function(event) {
- event = event.browserEvent || event;
- var x = event.pageX,
- y = event.pageY,
- docEl = doc.documentElement,
- body = doc.body;
-
- if (!x && x !== 0) {
- x = event.clientX + (docEl && docEl.scrollLeft || body && body.scrollLeft || 0) - (docEl && docEl.clientLeft || body && body.clientLeft || 0);
- y = event.clientY + (docEl && docEl.scrollTop || body && body.scrollTop || 0) - (docEl && docEl.clientTop || body && body.clientTop || 0);
- }
- return [x, y];
- },
-
- getTarget: function(event) {
- event = event.browserEvent || event;
- return EventManager.resolveTextNode(event.target || event.srcElement);
- },
-
-
-
-
- resolveTextNode: Ext.isGecko ?
- function(node) {
- if (!node) {
- return;
- }
-
- var s = HTMLElement.prototype.toString.call(node);
- if (s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]') {
- return;
- }
- return node.nodeType == 3 ? node.parentNode: node;
- }: function(node) {
- return node && node.nodeType == 3 ? node.parentNode: node;
- },
-
-
- curWidth: 0,
- curHeight: 0,
-
- onWindowResize: function(fn, scope, options) {
- var resize = EventManager.resizeEvent;
- if (!resize) {
- EventManager.resizeEvent = resize = new Ext.util.Event();
- EventManager.on(win, 'resize', EventManager.fireResize, null, {buffer: 100});
- }
- resize.addListener(fn, scope, options);
- },
-
- fireResize: function() {
- var w = Ext.Element.getViewWidth(),
- h = Ext.Element.getViewHeight();
-
- if (EventManager.curHeight != h || EventManager.curWidth != w) {
- EventManager.curHeight = h;
- EventManager.curWidth = w;
- EventManager.resizeEvent.fire(w, h);
- }
- },
-
- removeResizeListener: function(fn, scope) {
- var resize = EventManager.resizeEvent;
- if (resize) {
- resize.removeListener(fn, scope);
- }
- },
-
- onWindowUnload: function(fn, scope, options) {
- var unload = EventManager.unloadEvent;
- if (!unload) {
- EventManager.unloadEvent = unload = new Ext.util.Event();
- EventManager.addListener(win, 'unload', EventManager.fireUnload);
- }
- if (fn) {
- unload.addListener(fn, scope, options);
- }
- },
-
- fireUnload: function() {
-
- try {
-
- doc = win = undefined;
- var gridviews, i, ln,
- el, cache;
- EventManager.unloadEvent.fire();
-
- if (Ext.isGecko3) {
- gridviews = Ext.ComponentQuery.query('gridview');
- i = 0;
- ln = gridviews.length;
- for (; i < ln; i++) {
- gridviews[i].scrollToTop();
- }
- }
-
- cache = Ext.cache;
- for (el in cache) {
- if (cache.hasOwnProperty(el)) {
- EventManager.removeAll(el);
- }
- }
- } catch(e) {
- }
- },
-
- removeUnloadListener: function(fn, scope) {
- var unload = EventManager.unloadEvent;
- if (unload) {
- unload.removeListener(fn, scope);
- }
- },
-
- useKeyDown: Ext.isWebKit ?
- parseInt(navigator.userAgent.match(/AppleWebKit\/(\d+)/)[1], 10) >= 525 :
- !((Ext.isGecko && !Ext.isWindows) || Ext.isOpera),
-
- getKeyEvent: function() {
- return EventManager.useKeyDown ? 'keydown' : 'keypress';
- }
- });
-
- if(!('addEventListener' in document) && document.attachEvent) {
- Ext.apply( EventManager, {
-
-
- pollScroll : function() {
- var scrollable = true;
- try {
- document.documentElement.doScroll('left');
- } catch(e) {
- scrollable = false;
- }
-
- if (scrollable && document.body) {
- EventManager.onReadyEvent({
- type:'doScroll'
- });
- } else {
-
- EventManager.scrollTimeout = setTimeout(EventManager.pollScroll, 20);
- }
- return scrollable;
- },
-
- scrollTimeout: null,
-
- readyStatesRe : /complete/i,
-
- checkReadyState: function() {
- var state = document.readyState;
- if (EventManager.readyStatesRe.test(state)) {
- EventManager.onReadyEvent({
- type: state
- });
- }
- },
- bindReadyEvent: function() {
- var topContext = true;
- if (EventManager.hasBoundOnReady) {
- return;
- }
-
- try {
- topContext = window.frameElement === undefined;
- } catch(e) {
-
-
- topContext = false;
- }
- if (!topContext || !doc.documentElement.doScroll) {
- EventManager.pollScroll = Ext.emptyFn;
- }
-
- if (EventManager.pollScroll() === true) {
- return;
- }
-
- if (doc.readyState == 'complete' ) {
- EventManager.onReadyEvent({type: 'already ' + (doc.readyState || 'body') });
- } else {
- doc.attachEvent('onreadystatechange', EventManager.checkReadyState);
- window.attachEvent('onload', EventManager.onReadyEvent);
- EventManager.hasBoundOnReady = true;
- }
- },
- onReadyEvent : function(e) {
- if (e && e.type) {
- EventManager.onReadyChain.push(e.type);
- }
- if (EventManager.hasBoundOnReady) {
- document.detachEvent('onreadystatechange', EventManager.checkReadyState);
- window.detachEvent('onload', EventManager.onReadyEvent);
- }
- if (Ext.isNumber(EventManager.scrollTimeout)) {
- clearTimeout(EventManager.scrollTimeout);
- delete EventManager.scrollTimeout;
- }
- if (!Ext.isReady) {
- EventManager.fireDocReady();
- }
- },
-
- onReadyChain : []
- });
- }
-
- Ext.onReady = function(fn, scope, options) {
- Ext.Loader.onReady(fn, scope, true, options);
- };
-
- Ext.onDocumentReady = EventManager.onDocumentReady;
-
- EventManager.on = EventManager.addListener;
-
- EventManager.un = EventManager.removeListener;
- Ext.onReady(initExtCss);
- };
- //@tag dom,core
- //@require EventManager.js
- //@define Ext.EventObject
- Ext.define('Ext.EventObjectImpl', {
- uses: ['Ext.util.Point'],
-
- BACKSPACE: 8,
-
- TAB: 9,
-
- NUM_CENTER: 12,
-
- ENTER: 13,
-
- RETURN: 13,
-
- SHIFT: 16,
-
- CTRL: 17,
-
- ALT: 18,
-
- PAUSE: 19,
-
- CAPS_LOCK: 20,
-
- ESC: 27,
-
- SPACE: 32,
-
- PAGE_UP: 33,
-
- PAGE_DOWN: 34,
-
- END: 35,
-
- HOME: 36,
-
- LEFT: 37,
-
- UP: 38,
-
- RIGHT: 39,
-
- DOWN: 40,
-
- PRINT_SCREEN: 44,
-
- INSERT: 45,
-
- DELETE: 46,
-
- ZERO: 48,
-
- ONE: 49,
-
- TWO: 50,
-
- THREE: 51,
-
- FOUR: 52,
-
- FIVE: 53,
-
- SIX: 54,
-
- SEVEN: 55,
-
- EIGHT: 56,
-
- NINE: 57,
-
- A: 65,
-
- B: 66,
-
- C: 67,
-
- D: 68,
-
- E: 69,
-
- F: 70,
-
- G: 71,
-
- H: 72,
-
- I: 73,
-
- J: 74,
-
- K: 75,
-
- L: 76,
-
- M: 77,
-
- N: 78,
-
- O: 79,
-
- P: 80,
-
- Q: 81,
-
- R: 82,
-
- S: 83,
-
- T: 84,
-
- U: 85,
-
- V: 86,
-
- W: 87,
-
- X: 88,
-
- Y: 89,
-
- Z: 90,
-
- CONTEXT_MENU: 93,
-
- NUM_ZERO: 96,
-
- NUM_ONE: 97,
-
- NUM_TWO: 98,
-
- NUM_THREE: 99,
-
- NUM_FOUR: 100,
-
- NUM_FIVE: 101,
-
- NUM_SIX: 102,
-
- NUM_SEVEN: 103,
-
- NUM_EIGHT: 104,
-
- NUM_NINE: 105,
-
- NUM_MULTIPLY: 106,
-
- NUM_PLUS: 107,
-
- NUM_MINUS: 109,
-
- NUM_PERIOD: 110,
-
- NUM_DIVISION: 111,
-
- F1: 112,
-
- F2: 113,
-
- F3: 114,
-
- F4: 115,
-
- F5: 116,
-
- F6: 117,
-
- F7: 118,
-
- F8: 119,
-
- F9: 120,
-
- F10: 121,
-
- F11: 122,
-
- F12: 123,
-
- WHEEL_SCALE: (function () {
- var scale;
- if (Ext.isGecko) {
-
- scale = 3;
- } else if (Ext.isMac) {
-
-
-
- if (Ext.isSafari && Ext.webKitVersion >= 532.0) {
-
-
-
-
-
-
- scale = 120;
- } else {
-
-
- scale = 12;
- }
-
-
-
-
- scale *= 3;
- } else {
-
- scale = 120;
- }
- return scale;
- }()),
-
- clickRe: /(dbl)?click/,
-
- safariKeys: {
- 3: 13,
- 63234: 37,
- 63235: 39,
- 63232: 38,
- 63233: 40,
- 63276: 33,
- 63277: 34,
- 63272: 46,
- 63273: 36,
- 63275: 35
- },
-
- btnMap: Ext.isIE ? {
- 1: 0,
- 4: 1,
- 2: 2
- } : {
- 0: 0,
- 1: 1,
- 2: 2
- },
-
-
-
-
- constructor: function(event, freezeEvent){
- if (event) {
- this.setEvent(event.browserEvent || event, freezeEvent);
- }
- },
- setEvent: function(event, freezeEvent){
- var me = this, button, options;
- if (event == me || (event && event.browserEvent)) {
- return event;
- }
- me.browserEvent = event;
- if (event) {
-
- button = event.button ? me.btnMap[event.button] : (event.which ? event.which - 1 : -1);
- if (me.clickRe.test(event.type) && button == -1) {
- button = 0;
- }
- options = {
- type: event.type,
- button: button,
- shiftKey: event.shiftKey,
-
- ctrlKey: event.ctrlKey || event.metaKey || false,
- altKey: event.altKey,
-
- keyCode: event.keyCode,
- charCode: event.charCode,
-
- target: Ext.EventManager.getTarget(event),
- relatedTarget: Ext.EventManager.getRelatedTarget(event),
- currentTarget: event.currentTarget,
- xy: (freezeEvent ? me.getXY() : null)
- };
- } else {
- options = {
- button: -1,
- shiftKey: false,
- ctrlKey: false,
- altKey: false,
- keyCode: 0,
- charCode: 0,
- target: null,
- xy: [0, 0]
- };
- }
- Ext.apply(me, options);
- return me;
- },
-
- stopEvent: function(){
- this.stopPropagation();
- this.preventDefault();
- },
-
- preventDefault: function(){
- if (this.browserEvent) {
- Ext.EventManager.preventDefault(this.browserEvent);
- }
- },
-
- stopPropagation: function(){
- var browserEvent = this.browserEvent;
- if (browserEvent) {
- if (browserEvent.type == 'mousedown') {
- Ext.EventManager.stoppedMouseDownEvent.fire(this);
- }
- Ext.EventManager.stopPropagation(browserEvent);
- }
- },
-
- getCharCode: function(){
- return this.charCode || this.keyCode;
- },
-
- getKey: function(){
- return this.normalizeKey(this.keyCode || this.charCode);
- },
-
- normalizeKey: function(key){
-
- return Ext.isWebKit ? (this.safariKeys[key] || key) : key;
- },
-
- getPageX: function(){
- return this.getX();
- },
-
- getPageY: function(){
- return this.getY();
- },
-
- getX: function() {
- return this.getXY()[0];
- },
-
- getY: function() {
- return this.getXY()[1];
- },
-
- getXY: function() {
- if (!this.xy) {
-
- this.xy = Ext.EventManager.getPageXY(this.browserEvent);
- }
- return this.xy;
- },
-
- getTarget : function(selector, maxDepth, returnEl){
- if (selector) {
- return Ext.fly(this.target).findParent(selector, maxDepth, returnEl);
- }
- return returnEl ? Ext.get(this.target) : this.target;
- },
-
- getRelatedTarget : function(selector, maxDepth, returnEl){
- if (selector) {
- return Ext.fly(this.relatedTarget).findParent(selector, maxDepth, returnEl);
- }
- return returnEl ? Ext.get(this.relatedTarget) : this.relatedTarget;
- },
-
- correctWheelDelta : function (delta) {
- var scale = this.WHEEL_SCALE,
- ret = Math.round(delta / scale);
- if (!ret && delta) {
- ret = (delta < 0) ? -1 : 1;
- }
- return ret;
- },
-
- getWheelDeltas : function () {
- var me = this,
- event = me.browserEvent,
- dx = 0, dy = 0;
- if (Ext.isDefined(event.wheelDeltaX)) {
- dx = event.wheelDeltaX;
- dy = event.wheelDeltaY;
- } else if (event.wheelDelta) {
- dy = event.wheelDelta;
- } else if (event.detail) {
- dy = -event.detail;
-
-
- if (dy > 100) {
- dy = 3;
- } else if (dy < -100) {
- dy = -3;
- }
-
-
- if (Ext.isDefined(event.axis) && event.axis === event.HORIZONTAL_AXIS) {
- dx = dy;
- dy = 0;
- }
- }
- return {
- x: me.correctWheelDelta(dx),
- y: me.correctWheelDelta(dy)
- };
- },
-
- getWheelDelta : function(){
- var deltas = this.getWheelDeltas();
- return deltas.y;
- },
-
- within : function(el, related, allowEl){
- if(el){
- var t = related ? this.getRelatedTarget() : this.getTarget(),
- result;
- if (t) {
- result = Ext.fly(el).contains(t);
- if (!result && allowEl) {
- result = t == Ext.getDom(el);
- }
- return result;
- }
- }
- return false;
- },
-
- isNavKeyPress : function(){
- var me = this,
- k = this.normalizeKey(me.keyCode);
- return (k >= 33 && k <= 40) ||
- k == me.RETURN ||
- k == me.TAB ||
- k == me.ESC;
- },
-
- isSpecialKey : function(){
- var k = this.normalizeKey(this.keyCode);
- return (this.type == 'keypress' && this.ctrlKey) ||
- this.isNavKeyPress() ||
- (k == this.BACKSPACE) ||
- (k >= 16 && k <= 20) ||
- (k >= 44 && k <= 46);
- },
-
- getPoint : function(){
- var xy = this.getXY();
- return new Ext.util.Point(xy[0], xy[1]);
- },
-
- hasModifier : function(){
- return this.ctrlKey || this.altKey || this.shiftKey || this.metaKey;
- },
-
- injectEvent: (function () {
- var API,
- dispatchers = {},
- crazyIEButtons;
-
-
-
- if (!Ext.isIE && document.createEvent) {
- API = {
- createHtmlEvent: function (doc, type, bubbles, cancelable) {
- var event = doc.createEvent('HTMLEvents');
- event.initEvent(type, bubbles, cancelable);
- return event;
- },
- createMouseEvent: function (doc, type, bubbles, cancelable, detail,
- clientX, clientY, ctrlKey, altKey, shiftKey, metaKey,
- button, relatedTarget) {
- var event = doc.createEvent('MouseEvents'),
- view = doc.defaultView || window;
- if (event.initMouseEvent) {
- event.initMouseEvent(type, bubbles, cancelable, view, detail,
- clientX, clientY, clientX, clientY, ctrlKey, altKey,
- shiftKey, metaKey, button, relatedTarget);
- } else {
- event = doc.createEvent('UIEvents');
- event.initEvent(type, bubbles, cancelable);
- event.view = view;
- event.detail = detail;
- event.screenX = clientX;
- event.screenY = clientY;
- event.clientX = clientX;
- event.clientY = clientY;
- event.ctrlKey = ctrlKey;
- event.altKey = altKey;
- event.metaKey = metaKey;
- event.shiftKey = shiftKey;
- event.button = button;
- event.relatedTarget = relatedTarget;
- }
- return event;
- },
- createUIEvent: function (doc, type, bubbles, cancelable, detail) {
- var event = doc.createEvent('UIEvents'),
- view = doc.defaultView || window;
- event.initUIEvent(type, bubbles, cancelable, view, detail);
- return event;
- },
- fireEvent: function (target, type, event) {
- target.dispatchEvent(event);
- },
- fixTarget: function (target) {
-
- if (target == window && !target.dispatchEvent) {
- return document;
- }
- return target;
- }
- };
- } else if (document.createEventObject) {
- crazyIEButtons = { 0: 1, 1: 4, 2: 2 };
- API = {
- createHtmlEvent: function (doc, type, bubbles, cancelable) {
- var event = doc.createEventObject();
- event.bubbles = bubbles;
- event.cancelable = cancelable;
- return event;
- },
- createMouseEvent: function (doc, type, bubbles, cancelable, detail,
- clientX, clientY, ctrlKey, altKey, shiftKey, metaKey,
- button, relatedTarget) {
- var event = doc.createEventObject();
- event.bubbles = bubbles;
- event.cancelable = cancelable;
- event.detail = detail;
- event.screenX = clientX;
- event.screenY = clientY;
- event.clientX = clientX;
- event.clientY = clientY;
- event.ctrlKey = ctrlKey;
- event.altKey = altKey;
- event.shiftKey = shiftKey;
- event.metaKey = metaKey;
- event.button = crazyIEButtons[button] || button;
- event.relatedTarget = relatedTarget;
- return event;
- },
- createUIEvent: function (doc, type, bubbles, cancelable, detail) {
- var event = doc.createEventObject();
- event.bubbles = bubbles;
- event.cancelable = cancelable;
- return event;
- },
- fireEvent: function (target, type, event) {
- target.fireEvent('on' + type, event);
- },
- fixTarget: function (target) {
- if (target == document) {
-
-
- return document.documentElement;
- }
- return target;
- }
- };
- }
-
-
- Ext.Object.each({
- load: [false, false],
- unload: [false, false],
- select: [true, false],
- change: [true, false],
- submit: [true, true],
- reset: [true, false],
- resize: [true, false],
- scroll: [true, false]
- },
- function (name, value) {
- var bubbles = value[0], cancelable = value[1];
- dispatchers[name] = function (targetEl, srcEvent) {
- var e = API.createHtmlEvent(name, bubbles, cancelable);
- API.fireEvent(targetEl, name, e);
- };
- });
-
-
- function createMouseEventDispatcher (type, detail) {
- var cancelable = (type != 'mousemove');
- return function (targetEl, srcEvent) {
- var xy = srcEvent.getXY(),
- e = API.createMouseEvent(targetEl.ownerDocument, type, true, cancelable,
- detail, xy[0], xy[1], srcEvent.ctrlKey, srcEvent.altKey,
- srcEvent.shiftKey, srcEvent.metaKey, srcEvent.button,
- srcEvent.relatedTarget);
- API.fireEvent(targetEl, type, e);
- };
- }
- Ext.each(['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mousemove', 'mouseout'],
- function (eventName) {
- dispatchers[eventName] = createMouseEventDispatcher(eventName, 1);
- });
-
-
- Ext.Object.each({
- focusin: [true, false],
- focusout: [true, false],
- activate: [true, true],
- focus: [false, false],
- blur: [false, false]
- },
- function (name, value) {
- var bubbles = value[0], cancelable = value[1];
- dispatchers[name] = function (targetEl, srcEvent) {
- var e = API.createUIEvent(targetEl.ownerDocument, name, bubbles, cancelable, 1);
- API.fireEvent(targetEl, name, e);
- };
- });
-
- if (!API) {
-
- dispatchers = {};
- API = {
- fixTarget: function (t) {
- return t;
- }
- };
- }
- function cannotInject (target, srcEvent) {
- }
- return function (target) {
- var me = this,
- dispatcher = dispatchers[me.type] || cannotInject,
- t = target ? (target.dom || target) : me.getTarget();
- t = API.fixTarget(t);
- dispatcher(t, me);
- };
- }())
- }, function() {
- Ext.EventObject = new Ext.EventObjectImpl();
- });
- //@tag dom,core
- //@require ../EventObject.js
- Ext.define('Ext.dom.AbstractQuery', {
-
- select: function(q, root) {
- var results = [],
- nodes,
- i,
- j,
- qlen,
- nlen;
- root = root || document;
- if (typeof root == 'string') {
- root = document.getElementById(root);
- }
- q = q.split(",");
- for (i = 0,qlen = q.length; i < qlen; i++) {
- if (typeof q[i] == 'string') {
-
-
- if (typeof q[i][0] == '@') {
- nodes = root.getAttributeNode(q[i].substring(1));
- results.push(nodes);
- } else {
- nodes = root.querySelectorAll(q[i]);
- for (j = 0,nlen = nodes.length; j < nlen; j++) {
- results.push(nodes[j]);
- }
- }
- }
- }
- return results;
- },
-
- selectNode: function(q, root) {
- return this.select(q, root)[0];
- },
-
- is: function(el, q) {
- if (typeof el == "string") {
- el = document.getElementById(el);
- }
- return this.select(q).indexOf(el) !== -1;
- }
- });
- //@tag dom,core
- //@require AbstractQuery.js
- Ext.define('Ext.dom.AbstractHelper', {
- emptyTags : /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i,
- confRe : /(?:tag|children|cn|html|tpl|tplData)$/i,
- endRe : /end/i,
-
- attributeTransform: { cls : 'class', htmlFor : 'for' },
- closeTags: {},
- decamelizeName : (function () {
- var camelCaseRe = /([a-z])([A-Z])/g,
- cache = {};
- function decamel (match, p1, p2) {
- return p1 + '-' + p2.toLowerCase();
- }
- return function (s) {
- return cache[s] || (cache[s] = s.replace(camelCaseRe, decamel));
- };
- }()),
- generateMarkup: function(spec, buffer) {
- var me = this,
- attr, val, tag, i, closeTags;
- if (typeof spec == "string") {
- buffer.push(spec);
- } else if (Ext.isArray(spec)) {
- for (i = 0; i < spec.length; i++) {
- if (spec[i]) {
- me.generateMarkup(spec[i], buffer);
- }
- }
- } else {
- tag = spec.tag || 'div';
- buffer.push('<', tag);
- for (attr in spec) {
- if (spec.hasOwnProperty(attr)) {
- val = spec[attr];
- if (!me.confRe.test(attr)) {
- if (typeof val == "object") {
- buffer.push(' ', attr, '="');
- me.generateStyles(val, buffer).push('"');
- } else {
- buffer.push(' ', me.attributeTransform[attr] || attr, '="', val, '"');
- }
- }
- }
- }
-
- if (me.emptyTags.test(tag)) {
- buffer.push('/>');
- } else {
- buffer.push('>');
-
- if ((val = spec.tpl)) {
- val.applyOut(spec.tplData, buffer);
- }
- if ((val = spec.html)) {
- buffer.push(val);
- }
- if ((val = spec.cn || spec.children)) {
- me.generateMarkup(val, buffer);
- }
-
- closeTags = me.closeTags;
- buffer.push(closeTags[tag] || (closeTags[tag] = '</' + tag + '>'));
- }
- }
- return buffer;
- },
-
- generateStyles: function (styles, buffer) {
- var a = buffer || [],
- name;
- for (name in styles) {
- if (styles.hasOwnProperty(name)) {
- a.push(this.decamelizeName(name), ':', styles[name], ';');
- }
- }
- return buffer || a.join('');
- },
-
- markup: function(spec) {
- if (typeof spec == "string") {
- return spec;
- }
- var buf = this.generateMarkup(spec, []);
- return buf.join('');
- },
-
- applyStyles: function(el, styles) {
- if (styles) {
- var i = 0,
- len,
- style;
- el = Ext.fly(el);
- if (typeof styles == 'function') {
- styles = styles.call();
- }
- if (typeof styles == 'string'){
- styles = Ext.util.Format.trim(styles).split(/\s*(?::|;)\s*/);
- for(len = styles.length; i < len;){
- el.setStyle(styles[i++], styles[i++]);
- }
- } else if (Ext.isObject(styles)) {
- el.setStyle(styles);
- }
- }
- },
-
- insertHtml: function(where, el, html) {
- var hash = {},
- hashVal,
- setStart,
- range,
- frag,
- rangeEl,
- rs;
- where = where.toLowerCase();
-
- hash['beforebegin'] = ['BeforeBegin', 'previousSibling'];
- hash['afterend'] = ['AfterEnd', 'nextSibling'];
- range = el.ownerDocument.createRange();
- setStart = 'setStart' + (this.endRe.test(where) ? 'After' : 'Before');
- if (hash[where]) {
- range[setStart](el);
- frag = range.createContextualFragment(html);
- el.parentNode.insertBefore(frag, where == 'beforebegin' ? el : el.nextSibling);
- return el[(where == 'beforebegin' ? 'previous' : 'next') + 'Sibling'];
- }
- else {
- rangeEl = (where == 'afterbegin' ? 'first' : 'last') + 'Child';
- if (el.firstChild) {
- range[setStart](el[rangeEl]);
- frag = range.createContextualFragment(html);
- if (where == 'afterbegin') {
- el.insertBefore(frag, el.firstChild);
- }
- else {
- el.appendChild(frag);
- }
- }
- else {
- el.innerHTML = html;
- }
- return el[rangeEl];
- }
- throw 'Illegal insertion point -> "' + where + '"';
- },
-
- insertBefore: function(el, o, returnElement) {
- return this.doInsert(el, o, returnElement, 'beforebegin');
- },
-
- insertAfter: function(el, o, returnElement) {
- return this.doInsert(el, o, returnElement, 'afterend', 'nextSibling');
- },
-
- insertFirst: function(el, o, returnElement) {
- return this.doInsert(el, o, returnElement, 'afterbegin', 'firstChild');
- },
-
- append: function(el, o, returnElement) {
- return this.doInsert(el, o, returnElement, 'beforeend', '', true);
- },
-
- overwrite: function(el, o, returnElement) {
- el = Ext.getDom(el);
- el.innerHTML = this.markup(o);
- return returnElement ? Ext.get(el.firstChild) : el.firstChild;
- },
- doInsert: function(el, o, returnElement, pos, sibling, append) {
- var newNode = this.insertHtml(pos, Ext.getDom(el), this.markup(o));
- return returnElement ? Ext.get(newNode, true) : newNode;
- }
- });
- //@tag dom,core
- //@require AbstractHelper.js
- //@require Ext.Supports
- //@require Ext.EventManager
- //@define Ext.dom.AbstractElement
- (function() {
- var document = window.document,
- trimRe = /^\s+|\s+$/g,
- whitespaceRe = /\s/;
- if (!Ext.cache){
- Ext.cache = {};
- }
- Ext.define('Ext.dom.AbstractElement', {
- inheritableStatics: {
-
- get: function(el) {
- var me = this,
- El = Ext.dom.Element,
- cacheItem,
- extEl,
- dom,
- id;
- if (!el) {
- return null;
- }
- if (typeof el == "string") {
- if (el == Ext.windowId) {
- return El.get(window);
- } else if (el == Ext.documentId) {
- return El.get(document);
- }
-
- cacheItem = Ext.cache[el];
-
-
-
-
- if (cacheItem && cacheItem.skipGarbageCollection) {
- extEl = cacheItem.el;
- return extEl;
- }
-
- if (!(dom = document.getElementById(el))) {
- return null;
- }
- if (cacheItem && cacheItem.el) {
- extEl = Ext.updateCacheEntry(cacheItem, dom).el;
- } else {
-
- extEl = new El(dom, !!cacheItem);
- }
- return extEl;
- } else if (el.tagName) {
- if (!(id = el.id)) {
- id = Ext.id(el);
- }
- cacheItem = Ext.cache[id];
- if (cacheItem && cacheItem.el) {
- extEl = Ext.updateCacheEntry(cacheItem, el).el;
- } else {
-
- extEl = new El(el, !!cacheItem);
- }
- return extEl;
- } else if (el instanceof me) {
- if (el != me.docEl && el != me.winEl) {
- id = el.id;
-
-
- cacheItem = Ext.cache[id];
- if (cacheItem) {
- Ext.updateCacheEntry(cacheItem, document.getElementById(id) || el.dom);
- }
- }
- return el;
- } else if (el.isComposite) {
- return el;
- } else if (Ext.isArray(el)) {
- return me.select(el);
- } else if (el === document) {
-
- if (!me.docEl) {
- me.docEl = Ext.Object.chain(El.prototype);
- me.docEl.dom = document;
- me.docEl.id = Ext.id(document);
- me.addToCache(me.docEl);
- }
- return me.docEl;
- } else if (el === window) {
- if (!me.winEl) {
- me.winEl = Ext.Object.chain(El.prototype);
- me.winEl.dom = window;
- me.winEl.id = Ext.id(window);
- me.addToCache(me.winEl);
- }
- return me.winEl;
- }
- return null;
- },
- addToCache: function(el, id) {
- if (el) {
- Ext.addCacheEntry(id, el);
- }
- return el;
- },
- addMethods: function() {
- this.override.apply(this, arguments);
- },
-
- mergeClsList: function() {
- var clsList, clsHash = {},
- i, length, j, listLength, clsName, result = [],
- changed = false;
- for (i = 0, length = arguments.length; i < length; i++) {
- clsList = arguments[i];
- if (Ext.isString(clsList)) {
- clsList = clsList.replace(trimRe, '').split(whitespaceRe);
- }
- if (clsList) {
- for (j = 0, listLength = clsList.length; j < listLength; j++) {
- clsName = clsList[j];
- if (!clsHash[clsName]) {
- if (i) {
- changed = true;
- }
- clsHash[clsName] = true;
- }
- }
- }
- }
- for (clsName in clsHash) {
- result.push(clsName);
- }
- result.changed = changed;
- return result;
- },
-
- removeCls: function(existingClsList, removeClsList) {
- var clsHash = {},
- i, length, clsName, result = [],
- changed = false;
- if (existingClsList) {
- if (Ext.isString(existingClsList)) {
- existingClsList = existingClsList.replace(trimRe, '').split(whitespaceRe);
- }
- for (i = 0, length = existingClsList.length; i < length; i++) {
- clsHash[existingClsList[i]] = true;
- }
- }
- if (removeClsList) {
- if (Ext.isString(removeClsList)) {
- removeClsList = removeClsList.split(whitespaceRe);
- }
- for (i = 0, length = removeClsList.length; i < length; i++) {
- clsName = removeClsList[i];
- if (clsHash[clsName]) {
- changed = true;
- delete clsHash[clsName];
- }
- }
- }
- for (clsName in clsHash) {
- result.push(clsName);
- }
- result.changed = changed;
- return result;
- },
-
- VISIBILITY: 1,
-
- DISPLAY: 2,
-
- OFFSETS: 3,
-
- ASCLASS: 4
- },
- constructor: function(element, forceNew) {
- var me = this,
- dom = typeof element == 'string'
- ? document.getElementById(element)
- : element,
- id;
- if (!dom) {
- return null;
- }
- id = dom.id;
- if (!forceNew && id && Ext.cache[id]) {
-
- return Ext.cache[id].el;
- }
-
- me.dom = dom;
-
- me.id = id || Ext.id(dom);
- me.self.addToCache(me);
- },
-
- set: function(o, useSet) {
- var el = this.dom,
- attr,
- value;
- for (attr in o) {
- if (o.hasOwnProperty(attr)) {
- value = o[attr];
- if (attr == 'style') {
- this.applyStyles(value);
- }
- else if (attr == 'cls') {
- el.className = value;
- }
- else if (useSet !== false) {
- if (value === undefined) {
- el.removeAttribute(attr);
- } else {
- el.setAttribute(attr, value);
- }
- }
- else {
- el[attr] = value;
- }
- }
- }
- return this;
- },
-
- defaultUnit: "px",
-
- is: function(simpleSelector) {
- return Ext.DomQuery.is(this.dom, simpleSelector);
- },
-
- getValue: function(asNumber) {
- var val = this.dom.value;
- return asNumber ? parseInt(val, 10) : val;
- },
-
- remove: function() {
- var me = this,
- dom = me.dom;
- if (dom) {
- Ext.removeNode(dom);
- delete me.dom;
- }
- },
-
- contains: function(el) {
- if (!el) {
- return false;
- }
- var me = this,
- dom = el.dom || el;
-
- return (dom === me.dom) || Ext.dom.AbstractElement.isAncestor(me.dom, dom);
- },
-
- getAttribute: function(name, ns) {
- var dom = this.dom;
- return dom.getAttributeNS(ns, name) || dom.getAttribute(ns + ":" + name) || dom.getAttribute(name) || dom[name];
- },
-
- update: function(html) {
- if (this.dom) {
- this.dom.innerHTML = html;
- }
- return this;
- },
-
- setHTML: function(html) {
- if(this.dom) {
- this.dom.innerHTML = html;
- }
- return this;
- },
-
- getHTML: function() {
- return this.dom ? this.dom.innerHTML : '';
- },
-
- hide: function() {
- this.setVisible(false);
- return this;
- },
-
- show: function() {
- this.setVisible(true);
- return this;
- },
-
- setVisible: function(visible, animate) {
- var me = this,
- statics = me.self,
- mode = me.getVisibilityMode(),
- prefix = Ext.baseCSSPrefix;
- switch (mode) {
- case statics.VISIBILITY:
- me.removeCls([prefix + 'hidden-display', prefix + 'hidden-offsets']);
- me[visible ? 'removeCls' : 'addCls'](prefix + 'hidden-visibility');
- break;
- case statics.DISPLAY:
- me.removeCls([prefix + 'hidden-visibility', prefix + 'hidden-offsets']);
- me[visible ? 'removeCls' : 'addCls'](prefix + 'hidden-display');
- break;
- case statics.OFFSETS:
- me.removeCls([prefix + 'hidden-visibility', prefix + 'hidden-display']);
- me[visible ? 'removeCls' : 'addCls'](prefix + 'hidden-offsets');
- break;
- }
- return me;
- },
- getVisibilityMode: function() {
-
-
-
- var data = (this.$cache || this.getCache()).data,
- visMode = data.visibilityMode;
- if (visMode === undefined) {
- data.visibilityMode = visMode = this.self.DISPLAY;
- }
-
- return visMode;
- },
-
- setVisibilityMode: function(mode) {
- (this.$cache || this.getCache()).data.visibilityMode = mode;
- return this;
- },
-
- getCache: function() {
- var me = this,
- id = me.dom.id || Ext.id(me.dom);
-
-
-
- me.$cache = Ext.cache[id] || Ext.addCacheEntry(id, null, me.dom);
-
- return me.$cache;
- }
-
- }, function() {
- var AbstractElement = this;
-
- Ext.getDetachedBody = function () {
- var detachedEl = AbstractElement.detachedBodyEl;
- if (!detachedEl) {
- detachedEl = document.createElement('div');
- AbstractElement.detachedBodyEl = detachedEl = new AbstractElement.Fly(detachedEl);
- detachedEl.isDetachedBody = true;
- }
- return detachedEl;
- };
-
- Ext.getElementById = function (id) {
- var el = document.getElementById(id),
- detachedBodyEl;
- if (!el && (detachedBodyEl = AbstractElement.detachedBodyEl)) {
- el = detachedBodyEl.dom.querySelector('#' + Ext.escapeId(id));
- }
- return el;
- };
-
- Ext.get = function(el) {
- return Ext.dom.Element.get(el);
- };
- this.addStatics({
-
- Fly: new Ext.Class({
- extend: AbstractElement,
-
- isFly: true,
- constructor: function(dom) {
- this.dom = dom;
- },
-
- attach: function (dom) {
-
- this.dom = dom;
-
-
- this.$cache = dom.id ? Ext.cache[dom.id] : null;
- return this;
- }
- }),
- _flyweights: {},
-
- fly: function(dom, named) {
- var fly = null,
- _flyweights = AbstractElement._flyweights;
- named = named || '_global';
- dom = Ext.getDom(dom);
- if (dom) {
- fly = _flyweights[named] || (_flyweights[named] = new AbstractElement.Fly());
-
-
- fly.dom = dom;
-
-
- fly.$cache = dom.id ? Ext.cache[dom.id] : null;
- }
- return fly;
- }
- });
-
- Ext.fly = function() {
- return AbstractElement.fly.apply(AbstractElement, arguments);
- };
- (function (proto) {
-
- proto.destroy = proto.remove;
-
- if (document.querySelector) {
- proto.getById = function (id, asDom) {
-
-
- var dom = document.getElementById(id) ||
- this.dom.querySelector('#'+Ext.escapeId(id));
- return asDom ? dom : (dom ? Ext.get(dom) : null);
- };
- } else {
- proto.getById = function (id, asDom) {
- var dom = document.getElementById(id);
- return asDom ? dom : (dom ? Ext.get(dom) : null);
- };
- }
- }(this.prototype));
- });
- }());
- //@tag dom,core
- //@require AbstractElement.js
- //@define Ext.dom.AbstractElement-static
- //@define Ext.dom.AbstractElement
- Ext.dom.AbstractElement.addInheritableStatics({
- unitRe: /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i,
- camelRe: /(-[a-z])/gi,
- cssRe: /([a-z0-9\-]+)\s*:\s*([^;\s]+(?:\s*[^;\s]+)*);?/gi,
- opacityRe: /alpha\(opacity=(.*)\)/i,
- propertyCache: {},
- defaultUnit : "px",
- borders: {l: 'border-left-width', r: 'border-right-width', t: 'border-top-width', b: 'border-bottom-width'},
- paddings: {l: 'padding-left', r: 'padding-right', t: 'padding-top', b: 'padding-bottom'},
- margins: {l: 'margin-left', r: 'margin-right', t: 'margin-top', b: 'margin-bottom'},
-
- addUnits: function(size, units) {
-
- if (typeof size == 'number') {
- return size + (units || this.defaultUnit || 'px');
- }
-
- if (size === "" || size == "auto" || size === undefined || size === null) {
- return size || '';
- }
-
- if (!this.unitRe.test(size)) {
- return size || '';
- }
- return size;
- },
-
- isAncestor: function(p, c) {
- var ret = false;
- p = Ext.getDom(p);
- c = Ext.getDom(c);
- if (p && c) {
- if (p.contains) {
- return p.contains(c);
- } else if (p.compareDocumentPosition) {
- return !!(p.compareDocumentPosition(c) & 16);
- } else {
- while ((c = c.parentNode)) {
- ret = c == p || ret;
- }
- }
- }
- return ret;
- },
-
- parseBox: function(box) {
- if (typeof box != 'string') {
- box = box.toString();
- }
- var parts = box.split(' '),
- ln = parts.length;
- if (ln == 1) {
- parts[1] = parts[2] = parts[3] = parts[0];
- }
- else if (ln == 2) {
- parts[2] = parts[0];
- parts[3] = parts[1];
- }
- else if (ln == 3) {
- parts[3] = parts[1];
- }
- return {
- top :parseFloat(parts[0]) || 0,
- right :parseFloat(parts[1]) || 0,
- bottom:parseFloat(parts[2]) || 0,
- left :parseFloat(parts[3]) || 0
- };
- },
-
- unitizeBox: function(box, units) {
- var a = this.addUnits,
- b = this.parseBox(box);
- return a(b.top, units) + ' ' +
- a(b.right, units) + ' ' +
- a(b.bottom, units) + ' ' +
- a(b.left, units);
- },
-
- camelReplaceFn: function(m, a) {
- return a.charAt(1).toUpperCase();
- },
-
- normalize: function(prop) {
-
- if (prop == 'float') {
- prop = Ext.supports.Float ? 'cssFloat' : 'styleFloat';
- }
- return this.propertyCache[prop] || (this.propertyCache[prop] = prop.replace(this.camelRe, this.camelReplaceFn));
- },
-
- getDocumentHeight: function() {
- return Math.max(!Ext.isStrict ? document.body.scrollHeight : document.documentElement.scrollHeight, this.getViewportHeight());
- },
-
- getDocumentWidth: function() {
- return Math.max(!Ext.isStrict ? document.body.scrollWidth : document.documentElement.scrollWidth, this.getViewportWidth());
- },
-
- getViewportHeight: function(){
- return window.innerHeight;
- },
-
- getViewportWidth: function() {
- return window.innerWidth;
- },
-
- getViewSize: function() {
- return {
- width: window.innerWidth,
- height: window.innerHeight
- };
- },
-
- getOrientation: function() {
- if (Ext.supports.OrientationChange) {
- return (window.orientation == 0) ? 'portrait' : 'landscape';
- }
- return (window.innerHeight > window.innerWidth) ? 'portrait' : 'landscape';
- },
-
- fromPoint: function(x, y) {
- return Ext.get(document.elementFromPoint(x, y));
- },
-
- parseStyles: function(styles){
- var out = {},
- cssRe = this.cssRe,
- matches;
- if (styles) {
-
-
-
-
- cssRe.lastIndex = 0;
- while ((matches = cssRe.exec(styles))) {
- out[matches[1]] = matches[2];
- }
- }
- return out;
- }
- });
- (function(){
- var doc = document,
- AbstractElement = Ext.dom.AbstractElement,
- activeElement = null,
- isCSS1 = doc.compatMode == "CSS1Compat",
- flyInstance,
- fly = function (el) {
- if (!flyInstance) {
- flyInstance = new AbstractElement.Fly();
- }
- flyInstance.attach(el);
- return flyInstance;
- };
-
-
-
- if (!('activeElement' in doc) && doc.addEventListener) {
- doc.addEventListener('focus',
- function (ev) {
- if (ev && ev.target) {
- activeElement = (ev.target == doc) ? null : ev.target;
- }
- }, true);
- }
-
- function makeSelectionRestoreFn (activeEl, start, end) {
- return function () {
- activeEl.selectionStart = start;
- activeEl.selectionEnd = end;
- };
- }
- AbstractElement.addInheritableStatics({
-
- getActiveElement: function () {
- return doc.activeElement || activeElement;
- },
-
- getRightMarginFixCleaner: function (target) {
- var supports = Ext.supports,
- hasInputBug = supports.DisplayChangeInputSelectionBug,
- hasTextAreaBug = supports.DisplayChangeTextAreaSelectionBug,
- activeEl,
- tag,
- start,
- end;
- if (hasInputBug || hasTextAreaBug) {
- activeEl = doc.activeElement || activeElement;
- tag = activeEl && activeEl.tagName;
- if ((hasTextAreaBug && tag == 'TEXTAREA') ||
- (hasInputBug && tag == 'INPUT' && activeEl.type == 'text')) {
- if (Ext.dom.Element.isAncestor(target, activeEl)) {
- start = activeEl.selectionStart;
- end = activeEl.selectionEnd;
- if (Ext.isNumber(start) && Ext.isNumber(end)) {
-
-
-
-
- return makeSelectionRestoreFn(activeEl, start, end);
- }
- }
- }
- }
- return Ext.emptyFn;
- },
- getViewWidth: function(full) {
- return full ? Ext.dom.Element.getDocumentWidth() : Ext.dom.Element.getViewportWidth();
- },
- getViewHeight: function(full) {
- return full ? Ext.dom.Element.getDocumentHeight() : Ext.dom.Element.getViewportHeight();
- },
- getDocumentHeight: function() {
- return Math.max(!isCSS1 ? doc.body.scrollHeight : doc.documentElement.scrollHeight, Ext.dom.Element.getViewportHeight());
- },
- getDocumentWidth: function() {
- return Math.max(!isCSS1 ? doc.body.scrollWidth : doc.documentElement.scrollWidth, Ext.dom.Element.getViewportWidth());
- },
- getViewportHeight: function(){
- return Ext.isIE ?
- (Ext.isStrict ? doc.documentElement.clientHeight : doc.body.clientHeight) :
- self.innerHeight;
- },
- getViewportWidth: function() {
- return (!Ext.isStrict && !Ext.isOpera) ? doc.body.clientWidth :
- Ext.isIE ? doc.documentElement.clientWidth : self.innerWidth;
- },
- getY: function(el) {
- return Ext.dom.Element.getXY(el)[1];
- },
- getX: function(el) {
- return Ext.dom.Element.getXY(el)[0];
- },
- getXY: function(el) {
- var bd = doc.body,
- docEl = doc.documentElement,
- leftBorder = 0,
- topBorder = 0,
- ret = [0,0],
- round = Math.round,
- box,
- scroll;
- el = Ext.getDom(el);
- if(el != doc && el != bd){
-
-
- if (Ext.isIE) {
- try {
- box = el.getBoundingClientRect();
-
- topBorder = docEl.clientTop || bd.clientTop;
- leftBorder = docEl.clientLeft || bd.clientLeft;
- } catch (ex) {
- box = { left: 0, top: 0 };
- }
- } else {
- box = el.getBoundingClientRect();
- }
- scroll = fly(document).getScroll();
- ret = [round(box.left + scroll.left - leftBorder), round(box.top + scroll.top - topBorder)];
- }
- return ret;
- },
- setXY: function(el, xy) {
- (el = Ext.fly(el, '_setXY')).position();
- var pts = el.translatePoints(xy),
- style = el.dom.style,
- pos;
- for (pos in pts) {
- if (!isNaN(pts[pos])) {
- style[pos] = pts[pos] + "px";
- }
- }
- },
- setX: function(el, x) {
- Ext.dom.Element.setXY(el, [x, false]);
- },
- setY: function(el, y) {
- Ext.dom.Element.setXY(el, [false, y]);
- },
-
- serializeForm: function(form) {
- var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements,
- hasSubmit = false,
- encoder = encodeURIComponent,
- data = '',
- eLen = fElements.length,
- element, name, type, options, hasValue, e,
- o, oLen, opt;
- for (e = 0; e < eLen; e++) {
- element = fElements[e];
- name = element.name;
- type = element.type;
- options = element.options;
- if (!element.disabled && name) {
- if (/select-(one|multiple)/i.test(type)) {
- oLen = options.length;
- for (o = 0; o < oLen; o++) {
- opt = options[o];
- if (opt.selected) {
- hasValue = opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttributeNode('value').specified;
- data += Ext.String.format("{0}={1}&", encoder(name), encoder(hasValue ? opt.value : opt.text));
- }
- }
- } else if (!(/file|undefined|reset|button/i.test(type))) {
- if (!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)) {
- data += encoder(name) + '=' + encoder(element.value) + '&';
- hasSubmit = /submit/i.test(type);
- }
- }
- }
- }
- return data.substr(0, data.length - 1);
- }
- });
- }());
- //@tag dom,core
- //@require Ext.dom.AbstractElement-static
- //@define Ext.dom.AbstractElement-alignment
- Ext.dom.AbstractElement.override({
-
- getAnchorXY: function(anchor, local, size) {
-
-
- anchor = (anchor || "tl").toLowerCase();
- size = size || {};
- var me = this,
- vp = me.dom == document.body || me.dom == document,
- width = size.width || vp ? window.innerWidth: me.getWidth(),
- height = size.height || vp ? window.innerHeight: me.getHeight(),
- xy,
- rnd = Math.round,
- myXY = me.getXY(),
- extraX = vp ? 0: !local ? myXY[0] : 0,
- extraY = vp ? 0: !local ? myXY[1] : 0,
- hash = {
- c: [rnd(width * 0.5), rnd(height * 0.5)],
- t: [rnd(width * 0.5), 0],
- l: [0, rnd(height * 0.5)],
- r: [width, rnd(height * 0.5)],
- b: [rnd(width * 0.5), height],
- tl: [0, 0],
- bl: [0, height],
- br: [width, height],
- tr: [width, 0]
- };
- xy = hash[anchor];
- return [xy[0] + extraX, xy[1] + extraY];
- },
- alignToRe: /^([a-z]+)-([a-z]+)(\?)?$/,
-
- getAlignToXY: function(el, position, offsets, local) {
- local = !!local;
- el = Ext.get(el);
- offsets = offsets || [0, 0];
- if (!position || position == '?') {
- position = 'tl-bl?';
- }
- else if (! (/-/).test(position) && position !== "") {
- position = 'tl-' + position;
- }
- position = position.toLowerCase();
- var me = this,
- matches = position.match(this.alignToRe),
- dw = window.innerWidth,
- dh = window.innerHeight,
- p1 = "",
- p2 = "",
- a1,
- a2,
- x,
- y,
- swapX,
- swapY,
- p1x,
- p1y,
- p2x,
- p2y,
- width,
- height,
- region,
- constrain;
- if (!matches) {
- throw "Element.alignTo with an invalid alignment " + position;
- }
- p1 = matches[1];
- p2 = matches[2];
- constrain = !!matches[3];
-
-
- a1 = me.getAnchorXY(p1, true);
- a2 = el.getAnchorXY(p2, local);
- x = a2[0] - a1[0] + offsets[0];
- y = a2[1] - a1[1] + offsets[1];
- if (constrain) {
- width = me.getWidth();
- height = me.getHeight();
- region = el.getPageBox();
-
-
-
- p1y = p1.charAt(0);
- p1x = p1.charAt(p1.length - 1);
- p2y = p2.charAt(0);
- p2x = p2.charAt(p2.length - 1);
- swapY = ((p1y == "t" && p2y == "b") || (p1y == "b" && p2y == "t"));
- swapX = ((p1x == "r" && p2x == "l") || (p1x == "l" && p2x == "r"));
- if (x + width > dw) {
- x = swapX ? region.left - width: dw - width;
- }
- if (x < 0) {
- x = swapX ? region.right: 0;
- }
- if (y + height > dh) {
- y = swapY ? region.top - height: dh - height;
- }
- if (y < 0) {
- y = swapY ? region.bottom: 0;
- }
- }
- return [x, y];
- },
-
- getAnchor: function(){
- var data = (this.$cache || this.getCache()).data,
- anchor;
-
- if (!this.dom) {
- return;
- }
- anchor = data._anchor;
- if(!anchor){
- anchor = data._anchor = {};
- }
- return anchor;
- },
-
- adjustForConstraints: function(xy, parent) {
- var vector = this.getConstrainVector(parent, xy);
- if (vector) {
- xy[0] += vector[0];
- xy[1] += vector[1];
- }
- return xy;
- }
- });
- //@tag dom,core
- //@require Ext.dom.AbstractElement-alignment
- //@define Ext.dom.AbstractElement-insertion
- //@define Ext.dom.AbstractElement
- Ext.dom.AbstractElement.addMethods({
-
- appendChild: function(el) {
- return Ext.get(el).appendTo(this);
- },
-
- appendTo: function(el) {
- Ext.getDom(el).appendChild(this.dom);
- return this;
- },
-
- insertBefore: function(el) {
- el = Ext.getDom(el);
- el.parentNode.insertBefore(this.dom, el);
- return this;
- },
-
- insertAfter: function(el) {
- el = Ext.getDom(el);
- el.parentNode.insertBefore(this.dom, el.nextSibling);
- return this;
- },
-
- insertFirst: function(el, returnDom) {
- el = el || {};
- if (el.nodeType || el.dom || typeof el == 'string') {
- el = Ext.getDom(el);
- this.dom.insertBefore(el, this.dom.firstChild);
- return !returnDom ? Ext.get(el) : el;
- }
- else {
- return this.createChild(el, this.dom.firstChild, returnDom);
- }
- },
-
- insertSibling: function(el, where, returnDom){
- var me = this,
- isAfter = (where || 'before').toLowerCase() == 'after',
- rt, insertEl, eLen, e;
- if (Ext.isArray(el)) {
- insertEl = me;
- eLen = el.length;
-
- for (e = 0; e < eLen; e++) {
- rt = Ext.fly(insertEl, '_internal').insertSibling(el[e], where, returnDom);
- if (isAfter) {
- insertEl = rt;
- }
- }
- return rt;
- }
- el = el || {};
- if(el.nodeType || el.dom){
- rt = me.dom.parentNode.insertBefore(Ext.getDom(el), isAfter ? me.dom.nextSibling : me.dom);
- if (!returnDom) {
- rt = Ext.get(rt);
- }
- }else{
- if (isAfter && !me.dom.nextSibling) {
- rt = Ext.core.DomHelper.append(me.dom.parentNode, el, !returnDom);
- } else {
- rt = Ext.core.DomHelper[isAfter ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom);
- }
- }
- return rt;
- },
-
- replace: function(el) {
- el = Ext.get(el);
- this.insertBefore(el);
- el.remove();
- return this;
- },
-
- replaceWith: function(el){
- var me = this;
- if(el.nodeType || el.dom || typeof el == 'string'){
- el = Ext.get(el);
- me.dom.parentNode.insertBefore(el, me.dom);
- }else{
- el = Ext.core.DomHelper.insertBefore(me.dom, el);
- }
- delete Ext.cache[me.id];
- Ext.removeNode(me.dom);
- me.id = Ext.id(me.dom = el);
- Ext.dom.AbstractElement.addToCache(me.isFlyweight ? new Ext.dom.AbstractElement(me.dom) : me);
- return me;
- },
-
- createChild: function(config, insertBefore, returnDom) {
- config = config || {tag:'div'};
- if (insertBefore) {
- return Ext.core.DomHelper.insertBefore(insertBefore, config, returnDom !== true);
- }
- else {
- return Ext.core.DomHelper[!this.dom.firstChild ? 'insertFirst' : 'append'](this.dom, config, returnDom !== true);
- }
- },
-
- wrap: function(config, returnDom, selector) {
- var newEl = Ext.core.DomHelper.insertBefore(this.dom, config || {tag: "div"}, true),
- target = newEl;
-
- if (selector) {
- target = Ext.DomQuery.selectNode(selector, newEl.dom);
- }
- target.appendChild(this.dom);
- return returnDom ? newEl.dom : newEl;
- },
-
- insertHtml: function(where, html, returnEl) {
- var el = Ext.core.DomHelper.insertHtml(where, this.dom, html);
- return returnEl ? Ext.get(el) : el;
- }
- });
- //@tag dom,core
- //@require Ext.dom.AbstractElement-insertion
- //@define Ext.dom.AbstractElement-position
- //@define Ext.dom.AbstractElement
- (function(){
- var Element = Ext.dom.AbstractElement;
- Element.override({
-
- getX: function(el) {
- return this.getXY(el)[0];
- },
-
- getY: function(el) {
- return this.getXY(el)[1];
- },
-
- getXY: function() {
-
- var point = window.webkitConvertPointFromNodeToPage(this.dom, new WebKitPoint(0, 0));
- return [point.x, point.y];
- },
-
- getOffsetsTo: function(el){
- var o = this.getXY(),
- e = Ext.fly(el, '_internal').getXY();
- return [o[0]-e[0],o[1]-e[1]];
- },
-
- setX: function(x){
- return this.setXY([x, this.getY()]);
- },
-
- setY: function(y) {
- return this.setXY([this.getX(), y]);
- },
-
- setLeft: function(left) {
- this.setStyle('left', Element.addUnits(left));
- return this;
- },
-
- setTop: function(top) {
- this.setStyle('top', Element.addUnits(top));
- return this;
- },
-
- setRight: function(right) {
- this.setStyle('right', Element.addUnits(right));
- return this;
- },
-
- setBottom: function(bottom) {
- this.setStyle('bottom', Element.addUnits(bottom));
- return this;
- },
-
- setXY: function(pos) {
- var me = this,
- pts,
- style,
- pt;
- if (arguments.length > 1) {
- pos = [pos, arguments[1]];
- }
-
- pts = me.translatePoints(pos);
- style = me.dom.style;
- for (pt in pts) {
- if (!pts.hasOwnProperty(pt)) {
- continue;
- }
- if (!isNaN(pts[pt])) {
- style[pt] = pts[pt] + "px";
- }
- }
- return me;
- },
-
- getLeft: function(local) {
- return parseInt(this.getStyle('left'), 10) || 0;
- },
-
- getRight: function(local) {
- return parseInt(this.getStyle('right'), 10) || 0;
- },
-
- getTop: function(local) {
- return parseInt(this.getStyle('top'), 10) || 0;
- },
-
- getBottom: function(local) {
- return parseInt(this.getStyle('bottom'), 10) || 0;
- },
-
- translatePoints: function(x, y) {
- y = isNaN(x[1]) ? y : x[1];
- x = isNaN(x[0]) ? x : x[0];
- var me = this,
- relative = me.isStyle('position', 'relative'),
- o = me.getXY(),
- l = parseInt(me.getStyle('left'), 10),
- t = parseInt(me.getStyle('top'), 10);
- l = !isNaN(l) ? l : (relative ? 0 : me.dom.offsetLeft);
- t = !isNaN(t) ? t : (relative ? 0 : me.dom.offsetTop);
- return {left: (x - o[0] + l), top: (y - o[1] + t)};
- },
-
- setBox: function(box) {
- var me = this,
- width = box.width,
- height = box.height,
- top = box.top,
- left = box.left;
- if (left !== undefined) {
- me.setLeft(left);
- }
- if (top !== undefined) {
- me.setTop(top);
- }
- if (width !== undefined) {
- me.setWidth(width);
- }
- if (height !== undefined) {
- me.setHeight(height);
- }
- return this;
- },
-
- getBox: function(contentBox, local) {
- var me = this,
- dom = me.dom,
- width = dom.offsetWidth,
- height = dom.offsetHeight,
- xy, box, l, r, t, b;
- if (!local) {
- xy = me.getXY();
- }
- else if (contentBox) {
- xy = [0,0];
- }
- else {
- xy = [parseInt(me.getStyle("left"), 10) || 0, parseInt(me.getStyle("top"), 10) || 0];
- }
- if (!contentBox) {
- box = {
- x: xy[0],
- y: xy[1],
- 0: xy[0],
- 1: xy[1],
- width: width,
- height: height
- };
- }
- else {
- l = me.getBorderWidth.call(me, "l") + me.getPadding.call(me, "l");
- r = me.getBorderWidth.call(me, "r") + me.getPadding.call(me, "r");
- t = me.getBorderWidth.call(me, "t") + me.getPadding.call(me, "t");
- b = me.getBorderWidth.call(me, "b") + me.getPadding.call(me, "b");
- box = {
- x: xy[0] + l,
- y: xy[1] + t,
- 0: xy[0] + l,
- 1: xy[1] + t,
- width: width - (l + r),
- height: height - (t + b)
- };
- }
- box.left = box.x;
- box.top = box.y;
- box.right = box.x + box.width;
- box.bottom = box.y + box.height;
- return box;
- },
-
- getPageBox: function(getRegion) {
- var me = this,
- el = me.dom,
- w = el.offsetWidth,
- h = el.offsetHeight,
- xy = me.getXY(),
- t = xy[1],
- r = xy[0] + w,
- b = xy[1] + h,
- l = xy[0];
- if (!el) {
- return new Ext.util.Region();
- }
- if (getRegion) {
- return new Ext.util.Region(t, r, b, l);
- }
- else {
- return {
- left: l,
- top: t,
- width: w,
- height: h,
- right: r,
- bottom: b
- };
- }
- }
- });
- }());
- //@tag dom,core
- //@require Ext.dom.AbstractElement-position
- //@define Ext.dom.AbstractElement-style
- //@define Ext.dom.AbstractElement
- (function(){
-
- var Element = Ext.dom.AbstractElement,
- view = document.defaultView,
- array = Ext.Array,
- trimRe = /^\s+|\s+$/g,
- wordsRe = /\w/g,
- spacesRe = /\s+/,
- transparentRe = /^(?:transparent|(?:rgba[(](?:\s*\d+\s*[,]){3}\s*0\s*[)]))$/i,
- hasClassList = Ext.supports.ClassList,
- PADDING = 'padding',
- MARGIN = 'margin',
- BORDER = 'border',
- LEFT_SUFFIX = '-left',
- RIGHT_SUFFIX = '-right',
- TOP_SUFFIX = '-top',
- BOTTOM_SUFFIX = '-bottom',
- WIDTH = '-width',
-
- borders = {l: BORDER + LEFT_SUFFIX + WIDTH, r: BORDER + RIGHT_SUFFIX + WIDTH, t: BORDER + TOP_SUFFIX + WIDTH, b: BORDER + BOTTOM_SUFFIX + WIDTH},
- paddings = {l: PADDING + LEFT_SUFFIX, r: PADDING + RIGHT_SUFFIX, t: PADDING + TOP_SUFFIX, b: PADDING + BOTTOM_SUFFIX},
- margins = {l: MARGIN + LEFT_SUFFIX, r: MARGIN + RIGHT_SUFFIX, t: MARGIN + TOP_SUFFIX, b: MARGIN + BOTTOM_SUFFIX};
- Element.override({
-
- styleHooks: {},
-
- addStyles : function(sides, styles){
- var totalSize = 0,
- sidesArr = (sides || '').match(wordsRe),
- i,
- len = sidesArr.length,
- side,
- styleSides = [];
- if (len == 1) {
- totalSize = Math.abs(parseFloat(this.getStyle(styles[sidesArr[0]])) || 0);
- } else if (len) {
- for (i = 0; i < len; i++) {
- side = sidesArr[i];
- styleSides.push(styles[side]);
- }
-
- styleSides = this.getStyle(styleSides);
- for (i=0; i < len; i++) {
- side = sidesArr[i];
- totalSize += Math.abs(parseFloat(styleSides[styles[side]]) || 0);
- }
- }
- return totalSize;
- },
-
- addCls: hasClassList ?
- function (className) {
- var me = this,
- dom = me.dom,
- classList,
- newCls,
- i,
- len,
- cls;
- if (typeof(className) == 'string') {
-
- className = className.replace(trimRe, '').split(spacesRe);
- }
-
-
- if (dom && className && !!(len = className.length)) {
- if (!dom.className) {
- dom.className = className.join(' ');
- } else {
- classList = dom.classList;
- for (i = 0; i < len; ++i) {
- cls = className[i];
- if (cls) {
- if (!classList.contains(cls)) {
- if (newCls) {
- newCls.push(cls);
- } else {
- newCls = dom.className.replace(trimRe, '');
- newCls = newCls ? [newCls, cls] : [cls];
- }
- }
- }
- }
- if (newCls) {
- dom.className = newCls.join(' ');
- }
- }
- }
- return me;
- } :
- function(className) {
- var me = this,
- dom = me.dom,
- changed,
- elClasses;
- if (dom && className && className.length) {
- elClasses = Ext.Element.mergeClsList(dom.className, className);
- if (elClasses.changed) {
- dom.className = elClasses.join(' ');
- }
- }
- return me;
- },
-
- removeCls: function(className) {
- var me = this,
- dom = me.dom,
- len,
- elClasses;
- if (typeof(className) == 'string') {
-
- className = className.replace(trimRe, '').split(spacesRe);
- }
- if (dom && dom.className && className && !!(len = className.length)) {
- if (len == 1 && hasClassList) {
- if (className[0]) {
- dom.classList.remove(className[0]);
- }
- } else {
- elClasses = Ext.Element.removeCls(dom.className, className);
- if (elClasses.changed) {
- dom.className = elClasses.join(' ');
- }
- }
- }
- return me;
- },
-
- radioCls: function(className) {
- var cn = this.dom.parentNode.childNodes,
- v,
- i, len;
- className = Ext.isArray(className) ? className: [className];
- for (i = 0, len = cn.length; i < len; i++) {
- v = cn[i];
- if (v && v.nodeType == 1) {
- Ext.fly(v, '_internal').removeCls(className);
- }
- }
- return this.addCls(className);
- },
-
- toggleCls: hasClassList ?
- function (className) {
- var me = this,
- dom = me.dom;
- if (dom) {
- className = className.replace(trimRe, '');
- if (className) {
- dom.classList.toggle(className);
- }
- }
- return me;
- } :
- function(className) {
- var me = this;
- return me.hasCls(className) ? me.removeCls(className) : me.addCls(className);
- },
-
- hasCls: hasClassList ?
- function (className) {
- var dom = this.dom;
- return (dom && className) ? dom.classList.contains(className) : false;
- } :
- function(className) {
- var dom = this.dom;
- return dom ? className && (' '+dom.className+' ').indexOf(' '+className+' ') != -1 : false;
- },
-
- replaceCls: function(oldClassName, newClassName){
- return this.removeCls(oldClassName).addCls(newClassName);
- },
-
- isStyle: function(style, val) {
- return this.getStyle(style) == val;
- },
-
- getStyle: function (property, inline) {
- var me = this,
- dom = me.dom,
- multiple = typeof property != 'string',
- hooks = me.styleHooks,
- prop = property,
- props = prop,
- len = 1,
- domStyle, camel, values, hook, out, style, i;
- if (multiple) {
- values = {};
- prop = props[0];
- i = 0;
- if (!(len = props.length)) {
- return values;
- }
- }
- if (!dom || dom.documentElement) {
- return values || '';
- }
- domStyle = dom.style;
- if (inline) {
- style = domStyle;
- } else {
-
-
-
-
- style = dom.ownerDocument.defaultView.getComputedStyle(dom, null);
-
- if (!style) {
- inline = true;
- style = domStyle;
- }
- }
- do {
- hook = hooks[prop];
- if (!hook) {
- hooks[prop] = hook = { name: Element.normalize(prop) };
- }
- if (hook.get) {
- out = hook.get(dom, me, inline, style);
- } else {
- camel = hook.name;
- out = style[camel];
- }
- if (!multiple) {
- return out;
- }
- values[prop] = out;
- prop = props[++i];
- } while (i < len);
- return values;
- },
- getStyles: function () {
- var props = Ext.Array.slice(arguments),
- len = props.length,
- inline;
- if (len && typeof props[len-1] == 'boolean') {
- inline = props.pop();
- }
- return this.getStyle(props, inline);
- },
-
- isTransparent: function (prop) {
- var value = this.getStyle(prop);
- return value ? transparentRe.test(value) : false;
- },
-
- setStyle: function(prop, value) {
- var me = this,
- dom = me.dom,
- hooks = me.styleHooks,
- style = dom.style,
- name = prop,
- hook;
-
- if (typeof name == 'string') {
- hook = hooks[name];
- if (!hook) {
- hooks[name] = hook = { name: Element.normalize(name) };
- }
- value = (value == null) ? '' : value;
- if (hook.set) {
- hook.set(dom, value, me);
- } else {
- style[hook.name] = value;
- }
- if (hook.afterSet) {
- hook.afterSet(dom, value, me);
- }
- } else {
- for (name in prop) {
- if (prop.hasOwnProperty(name)) {
- hook = hooks[name];
- if (!hook) {
- hooks[name] = hook = { name: Element.normalize(name) };
- }
- value = prop[name];
- value = (value == null) ? '' : value;
- if (hook.set) {
- hook.set(dom, value, me);
- } else {
- style[hook.name] = value;
- }
- if (hook.afterSet) {
- hook.afterSet(dom, value, me);
- }
- }
- }
- }
- return me;
- },
-
- getHeight: function(contentHeight) {
- var dom = this.dom,
- height = contentHeight ? (dom.clientHeight - this.getPadding("tb")) : dom.offsetHeight;
- return height > 0 ? height: 0;
- },
-
- getWidth: function(contentWidth) {
- var dom = this.dom,
- width = contentWidth ? (dom.clientWidth - this.getPadding("lr")) : dom.offsetWidth;
- return width > 0 ? width: 0;
- },
-
- setWidth: function(width) {
- var me = this;
- me.dom.style.width = Element.addUnits(width);
- return me;
- },
-
- setHeight: function(height) {
- var me = this;
- me.dom.style.height = Element.addUnits(height);
- return me;
- },
-
- getBorderWidth: function(side){
- return this.addStyles(side, borders);
- },
-
- getPadding: function(side){
- return this.addStyles(side, paddings);
- },
- margins : margins,
-
- applyStyles: function(styles) {
- if (styles) {
- var i,
- len,
- dom = this.dom;
- if (typeof styles == 'function') {
- styles = styles.call();
- }
- if (typeof styles == 'string') {
- styles = Ext.util.Format.trim(styles).split(/\s*(?::|;)\s*/);
- for (i = 0, len = styles.length; i < len;) {
- dom.style[Element.normalize(styles[i++])] = styles[i++];
- }
- }
- else if (typeof styles == 'object') {
- this.setStyle(styles);
- }
- }
- },
-
- setSize: function(width, height) {
- var me = this,
- style = me.dom.style;
- if (Ext.isObject(width)) {
-
- height = width.height;
- width = width.width;
- }
- style.width = Element.addUnits(width);
- style.height = Element.addUnits(height);
- return me;
- },
-
- getViewSize: function() {
- var doc = document,
- dom = this.dom;
- if (dom == doc || dom == doc.body) {
- return {
- width: Element.getViewportWidth(),
- height: Element.getViewportHeight()
- };
- }
- else {
- return {
- width: dom.clientWidth,
- height: dom.clientHeight
- };
- }
- },
-
- getSize: function(contentSize) {
- var dom = this.dom;
- return {
- width: Math.max(0, contentSize ? (dom.clientWidth - this.getPadding("lr")) : dom.offsetWidth),
- height: Math.max(0, contentSize ? (dom.clientHeight - this.getPadding("tb")) : dom.offsetHeight)
- };
- },
-
- repaint: function(){
- var dom = this.dom;
- this.addCls(Ext.baseCSSPrefix + 'repaint');
- setTimeout(function(){
- Ext.fly(dom).removeCls(Ext.baseCSSPrefix + 'repaint');
- }, 1);
- return this;
- },
-
- getMargin: function(side){
- var me = this,
- hash = {t:"top", l:"left", r:"right", b: "bottom"},
- key,
- o,
- margins;
- if (!side) {
- margins = [];
- for (key in me.margins) {
- if(me.margins.hasOwnProperty(key)) {
- margins.push(me.margins[key]);
- }
- }
- o = me.getStyle(margins);
- if(o && typeof o == 'object') {
-
- for (key in me.margins) {
- if(me.margins.hasOwnProperty(key)) {
- o[hash[key]] = parseFloat(o[me.margins[key]]) || 0;
- }
- }
- }
- return o;
- } else {
- return me.addStyles.call(me, side, me.margins);
- }
- },
-
- mask: function(msg, msgCls, transparent) {
- var me = this,
- dom = me.dom,
- data = (me.$cache || me.getCache()).data,
- el = data.mask,
- mask,
- size,
- cls = '',
- prefix = Ext.baseCSSPrefix;
- me.addCls(prefix + 'masked');
- if (me.getStyle("position") == "static") {
- me.addCls(prefix + 'masked-relative');
- }
- if (el) {
- el.remove();
- }
- if (msgCls && typeof msgCls == 'string' ) {
- cls = ' ' + msgCls;
- }
- else {
- cls = ' ' + prefix + 'mask-gray';
- }
- mask = me.createChild({
- cls: prefix + 'mask' + ((transparent !== false) ? '' : (' ' + prefix + 'mask-gray')),
- html: msg ? ('<div class="' + (msgCls || (prefix + 'mask-message')) + '">' + msg + '</div>') : ''
- });
- size = me.getSize();
- data.mask = mask;
- if (dom === document.body) {
- size.height = window.innerHeight;
- if (me.orientationHandler) {
- Ext.EventManager.unOrientationChange(me.orientationHandler, me);
- }
- me.orientationHandler = function() {
- size = me.getSize();
- size.height = window.innerHeight;
- mask.setSize(size);
- };
- Ext.EventManager.onOrientationChange(me.orientationHandler, me);
- }
- mask.setSize(size);
- if (Ext.is.iPad) {
- Ext.repaint();
- }
- },
-
- unmask: function() {
- var me = this,
- data = (me.$cache || me.getCache()).data,
- mask = data.mask,
- prefix = Ext.baseCSSPrefix;
- if (mask) {
- mask.remove();
- delete data.mask;
- }
- me.removeCls([prefix + 'masked', prefix + 'masked-relative']);
- if (me.dom === document.body) {
- Ext.EventManager.unOrientationChange(me.orientationHandler, me);
- delete me.orientationHandler;
- }
- }
- });
-
- Element.populateStyleMap = function (map, order) {
- var baseStyles = ['margin-', 'padding-', 'border-width-'],
- beforeAfter = ['before', 'after'],
- index, style, name, i;
- for (index = baseStyles.length; index--; ) {
- for (i = 2; i--; ) {
- style = baseStyles[index] + beforeAfter[i];
-
- map[Element.normalize(style)] = map[style] = {
- name: Element.normalize(baseStyles[index] + order[i])
- };
- }
- }
- };
- Ext.onReady(function () {
- var supports = Ext.supports,
- styleHooks,
- colorStyles, i, name, camel;
- function fixTransparent (dom, el, inline, style) {
- var value = style[this.name] || '';
- return transparentRe.test(value) ? 'transparent' : value;
- }
- function fixRightMargin (dom, el, inline, style) {
- var result = style.marginRight,
- domStyle, display;
-
-
- if (result != '0px') {
- domStyle = dom.style;
- display = domStyle.display;
- domStyle.display = 'inline-block';
- result = (inline ? style : dom.ownerDocument.defaultView.getComputedStyle(dom, null)).marginRight;
- domStyle.display = display;
- }
- return result;
- }
- function fixRightMarginAndInputFocus (dom, el, inline, style) {
- var result = style.marginRight,
- domStyle, cleaner, display;
- if (result != '0px') {
- domStyle = dom.style;
- cleaner = Element.getRightMarginFixCleaner(dom);
- display = domStyle.display;
- domStyle.display = 'inline-block';
- result = (inline ? style : dom.ownerDocument.defaultView.getComputedStyle(dom, '')).marginRight;
- domStyle.display = display;
- cleaner();
- }
- return result;
- }
- styleHooks = Element.prototype.styleHooks;
-
- Element.populateStyleMap(styleHooks, ['left', 'right']);
-
-
- if (supports.init) {
- supports.init();
- }
-
- if (!supports.RightMargin) {
- styleHooks.marginRight = styleHooks['margin-right'] = {
- name: 'marginRight',
-
-
- get: (supports.DisplayChangeInputSelectionBug || supports.DisplayChangeTextAreaSelectionBug) ?
- fixRightMarginAndInputFocus : fixRightMargin
- };
- }
- if (!supports.TransparentColor) {
- colorStyles = ['background-color', 'border-color', 'color', 'outline-color'];
- for (i = colorStyles.length; i--; ) {
- name = colorStyles[i];
- camel = Element.normalize(name);
- styleHooks[name] = styleHooks[camel] = {
- name: camel,
- get: fixTransparent
- };
- }
- }
- });
- }());
- //@tag dom,core
- //@require Ext.dom.AbstractElement-style
- //@define Ext.dom.AbstractElement-traversal
- //@define Ext.dom.AbstractElement
- Ext.dom.AbstractElement.override({
-
- findParent: function(simpleSelector, limit, returnEl) {
- var target = this.dom,
- topmost = document.documentElement,
- depth = 0,
- stopEl;
- limit = limit || 50;
- if (isNaN(limit)) {
- stopEl = Ext.getDom(limit);
- limit = Number.MAX_VALUE;
- }
- while (target && target.nodeType == 1 && depth < limit && target != topmost && target != stopEl) {
- if (Ext.DomQuery.is(target, simpleSelector)) {
- return returnEl ? Ext.get(target) : target;
- }
- depth++;
- target = target.parentNode;
- }
- return null;
- },
-
- findParentNode: function(simpleSelector, limit, returnEl) {
- var p = Ext.fly(this.dom.parentNode, '_internal');
- return p ? p.findParent(simpleSelector, limit, returnEl) : null;
- },
-
- up: function(simpleSelector, limit) {
- return this.findParentNode(simpleSelector, limit, true);
- },
-
- select: function(selector, composite) {
- return Ext.dom.Element.select(selector, this.dom, composite);
- },
-
- query: function(selector) {
- return Ext.DomQuery.select(selector, this.dom);
- },
-
- down: function(selector, returnDom) {
- var n = Ext.DomQuery.selectNode(selector, this.dom);
- return returnDom ? n : Ext.get(n);
- },
-
- child: function(selector, returnDom) {
- var node,
- me = this,
- id;
-
-
- id = Ext.id(me.dom);
-
- id = Ext.escapeId(id);
- node = Ext.DomQuery.selectNode('#' + id + " > " + selector, me.dom);
- return returnDom ? node : Ext.get(node);
- },
-
- parent: function(selector, returnDom) {
- return this.matchNode('parentNode', 'parentNode', selector, returnDom);
- },
-
- next: function(selector, returnDom) {
- return this.matchNode('nextSibling', 'nextSibling', selector, returnDom);
- },
-
- prev: function(selector, returnDom) {
- return this.matchNode('previousSibling', 'previousSibling', selector, returnDom);
- },
-
- first: function(selector, returnDom) {
- return this.matchNode('nextSibling', 'firstChild', selector, returnDom);
- },
-
- last: function(selector, returnDom) {
- return this.matchNode('previousSibling', 'lastChild', selector, returnDom);
- },
- matchNode: function(dir, start, selector, returnDom) {
- if (!this.dom) {
- return null;
- }
- var n = this.dom[start];
- while (n) {
- if (n.nodeType == 1 && (!selector || Ext.DomQuery.is(n, selector))) {
- return !returnDom ? Ext.get(n) : n;
- }
- n = n[dir];
- }
- return null;
- },
- isAncestor: function(element) {
- return this.self.isAncestor.call(this.self, this.dom, element);
- }
- });
- //@tag dom,core
- //@define Ext.DomHelper
- //@define Ext.core.DomHelper
- //@require Ext.dom.AbstractElement-traversal
- (function() {
- var afterbegin = 'afterbegin',
- afterend = 'afterend',
- beforebegin = 'beforebegin',
- beforeend = 'beforeend',
- ts = '<table>',
- te = '</table>',
- tbs = ts+'<tbody>',
- tbe = '</tbody>'+te,
- trs = tbs + '<tr>',
- tre = '</tr>'+tbe,
- detachedDiv = document.createElement('div'),
- bbValues = ['BeforeBegin', 'previousSibling'],
- aeValues = ['AfterEnd', 'nextSibling'],
- bb_ae_PositionHash = {
- beforebegin: bbValues,
- afterend: aeValues
- },
- fullPositionHash = {
- beforebegin: bbValues,
- afterend: aeValues,
- afterbegin: ['AfterBegin', 'firstChild'],
- beforeend: ['BeforeEnd', 'lastChild']
- };
- Ext.define('Ext.dom.Helper', {
- extend: 'Ext.dom.AbstractHelper',
- requires:['Ext.dom.AbstractElement'],
- tableRe: /^table|tbody|tr|td$/i,
- tableElRe: /td|tr|tbody/i,
-
- useDom : false,
-
- createDom: function(o, parentNode){
- var el,
- doc = document,
- useSet,
- attr,
- val,
- cn,
- i, l;
- if (Ext.isArray(o)) {
- el = doc.createDocumentFragment();
- for (i = 0, l = o.length; i < l; i++) {
- this.createDom(o[i], el);
- }
- } else if (typeof o == 'string') {
- el = doc.createTextNode(o);
- } else {
- el = doc.createElement(o.tag || 'div');
- useSet = !!el.setAttribute;
- for (attr in o) {
- if (!this.confRe.test(attr)) {
- val = o[attr];
- if (attr == 'cls') {
- el.className = val;
- } else {
- if (useSet) {
- el.setAttribute(attr, val);
- } else {
- el[attr] = val;
- }
- }
- }
- }
- Ext.DomHelper.applyStyles(el, o.style);
- if ((cn = o.children || o.cn)) {
- this.createDom(cn, el);
- } else if (o.html) {
- el.innerHTML = o.html;
- }
- }
- if (parentNode) {
- parentNode.appendChild(el);
- }
- return el;
- },
- ieTable: function(depth, openingTags, htmlContent, closingTags){
- detachedDiv.innerHTML = [openingTags, htmlContent, closingTags].join('');
- var i = -1,
- el = detachedDiv,
- ns;
- while (++i < depth) {
- el = el.firstChild;
- }
-
- ns = el.nextSibling;
- if (ns) {
- el = document.createDocumentFragment();
- while (ns) {
- el.appendChild(ns);
- ns = ns.nextSibling;
- }
- }
- return el;
- },
-
- insertIntoTable: function(tag, where, destinationEl, html) {
- var node,
- before,
- bb = where == beforebegin,
- ab = where == afterbegin,
- be = where == beforeend,
- ae = where == afterend;
- if (tag == 'td' && (ab || be) || !this.tableElRe.test(tag) && (bb || ae)) {
- return null;
- }
- before = bb ? destinationEl :
- ae ? destinationEl.nextSibling :
- ab ? destinationEl.firstChild : null;
- if (bb || ae) {
- destinationEl = destinationEl.parentNode;
- }
- if (tag == 'td' || (tag == 'tr' && (be || ab))) {
- node = this.ieTable(4, trs, html, tre);
- } else if ((tag == 'tbody' && (be || ab)) ||
- (tag == 'tr' && (bb || ae))) {
- node = this.ieTable(3, tbs, html, tbe);
- } else {
- node = this.ieTable(2, ts, html, te);
- }
- destinationEl.insertBefore(node, before);
- return node;
- },
-
- createContextualFragment: function(html) {
- var fragment = document.createDocumentFragment(),
- length, childNodes;
- detachedDiv.innerHTML = html;
- childNodes = detachedDiv.childNodes;
- length = childNodes.length;
-
- while (length--) {
- fragment.appendChild(childNodes[0]);
- }
- return fragment;
- },
- applyStyles: function(el, styles) {
- if (styles) {
- el = Ext.fly(el);
- if (typeof styles == "function") {
- styles = styles.call();
- }
- if (typeof styles == "string") {
- styles = Ext.dom.Element.parseStyles(styles);
- }
- if (typeof styles == "object") {
- el.setStyle(styles);
- }
- }
- },
-
- createHtml: function(spec) {
- return this.markup(spec);
- },
- doInsert: function(el, o, returnElement, pos, sibling, append) {
-
- el = el.dom || Ext.getDom(el);
- var newNode;
- if (this.useDom) {
- newNode = this.createDom(o, null);
- if (append) {
- el.appendChild(newNode);
- }
- else {
- (sibling == 'firstChild' ? el : el.parentNode).insertBefore(newNode, el[sibling] || el);
- }
- } else {
- newNode = this.insertHtml(pos, el, this.markup(o));
- }
- return returnElement ? Ext.get(newNode, true) : newNode;
- },
-
- overwrite: function(el, html, returnElement) {
- var newNode;
- el = Ext.getDom(el);
- html = this.markup(html);
-
- if (Ext.isIE && this.tableRe.test(el.tagName)) {
-
- while (el.firstChild) {
- el.removeChild(el.firstChild);
- }
- if (html) {
- newNode = this.insertHtml('afterbegin', el, html);
- return returnElement ? Ext.get(newNode) : newNode;
- }
- return null;
- }
- el.innerHTML = html;
- return returnElement ? Ext.get(el.firstChild) : el.firstChild;
- },
- insertHtml: function(where, el, html) {
- var hashVal,
- range,
- rangeEl,
- setStart,
- frag;
- where = where.toLowerCase();
-
- if (el.insertAdjacentHTML) {
-
- if (Ext.isIE && this.tableRe.test(el.tagName) && (frag = this.insertIntoTable(el.tagName.toLowerCase(), where, el, html))) {
- return frag;
- }
- if ((hashVal = fullPositionHash[where])) {
- el.insertAdjacentHTML(hashVal[0], html);
- return el[hashVal[1]];
- }
-
- } else {
-
- if (el.nodeType === 3) {
- where = where === 'afterbegin' ? 'beforebegin' : where;
- where = where === 'beforeend' ? 'afterend' : where;
- }
- range = Ext.supports.CreateContextualFragment ? el.ownerDocument.createRange() : undefined;
- setStart = 'setStart' + (this.endRe.test(where) ? 'After' : 'Before');
- if (bb_ae_PositionHash[where]) {
- if (range) {
- range[setStart](el);
- frag = range.createContextualFragment(html);
- } else {
- frag = this.createContextualFragment(html);
- }
- el.parentNode.insertBefore(frag, where == beforebegin ? el : el.nextSibling);
- return el[(where == beforebegin ? 'previous' : 'next') + 'Sibling'];
- } else {
- rangeEl = (where == afterbegin ? 'first' : 'last') + 'Child';
- if (el.firstChild) {
- if (range) {
- range[setStart](el[rangeEl]);
- frag = range.createContextualFragment(html);
- } else {
- frag = this.createContextualFragment(html);
- }
- if (where == afterbegin) {
- el.insertBefore(frag, el.firstChild);
- } else {
- el.appendChild(frag);
- }
- } else {
- el.innerHTML = html;
- }
- return el[rangeEl];
- }
- }
- },
-
- createTemplate: function(o) {
- var html = this.markup(o);
- return new Ext.Template(html);
- }
- }, function() {
- Ext.ns('Ext.core');
- Ext.DomHelper = Ext.core.DomHelper = new this;
- });
- }());
- //@tag dom,core
- //@require Helper.js
- //@define Ext.dom.Query
- //@define Ext.core.Query
- //@define Ext.DomQuery
- Ext.ns('Ext.core');
- Ext.dom.Query = Ext.core.DomQuery = Ext.DomQuery = (function(){
- var cache = {},
- simpleCache = {},
- valueCache = {},
- nonSpace = /\S/,
- trimRe = /^\s+|\s+$/g,
- tplRe = /\{(\d+)\}/g,
- modeRe = /^(\s?[\/>+~]\s?|\s|$)/,
- tagTokenRe = /^(#)?([\w\-\*\\]+)/,
- nthRe = /(\d*)n\+?(\d*)/,
- nthRe2 = /\D/,
- startIdRe = /^\s*\#/,
-
-
-
- isIE = window.ActiveXObject ? true : false,
- key = 30803,
- longHex = /\\([0-9a-fA-F]{6})/g,
- shortHex = /\\([0-9a-fA-F]{1,6})\s{0,1}/g,
- nonHex = /\\([^0-9a-fA-F]{1})/g,
- escapes = /\\/g,
- num, hasEscapes,
-
-
- longHexToChar = function($0, $1) {
- return String.fromCharCode(parseInt($1, 16));
- },
-
- shortToLongHex = function($0, $1) {
- while ($1.length < 6) {
- $1 = '0' + $1;
- }
- return '\\' + $1;
- },
-
- charToLongHex = function($0, $1) {
- num = $1.charCodeAt(0).toString(16);
- if (num.length === 1) {
- num = '0' + num;
- }
- return '\\0000' + num;
- },
-
-
-
- unescapeCssSelector = function (selector) {
- return (hasEscapes)
- ? selector.replace(longHex, longHexToChar)
- : selector;
- },
-
-
- setupEscapes = function(path){
- hasEscapes = (path.indexOf('\\') > -1);
- if (hasEscapes) {
- path = path
- .replace(shortHex, shortToLongHex)
- .replace(nonHex, charToLongHex)
- .replace(escapes, '\\\\');
- }
- return path;
- };
-
-
- eval("var batch = 30803;");
-
-
- function child(parent, index){
- var i = 0,
- n = parent.firstChild;
- while(n){
- if(n.nodeType == 1){
- if(++i == index){
- return n;
- }
- }
- n = n.nextSibling;
- }
- return null;
- }
-
- function next(n){
- while((n = n.nextSibling) && n.nodeType != 1);
- return n;
- }
-
- function prev(n){
- while((n = n.previousSibling) && n.nodeType != 1);
- return n;
- }
-
-
- function children(parent){
- var n = parent.firstChild,
- nodeIndex = -1,
- nextNode;
- while(n){
- nextNode = n.nextSibling;
-
- if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
- parent.removeChild(n);
- }else{
-
- n.nodeIndex = ++nodeIndex;
- }
- n = nextNode;
- }
- return this;
- }
-
-
- function byClassName(nodeSet, cls){
- cls = unescapeCssSelector(cls);
- if(!cls){
- return nodeSet;
- }
- var result = [], ri = -1,
- i, ci;
- for(i = 0, ci; ci = nodeSet[i]; i++){
- if((' '+ci.className+' ').indexOf(cls) != -1){
- result[++ri] = ci;
- }
- }
- return result;
- }
- function attrValue(n, attr){
-
- if(!n.tagName && typeof n.length != "undefined"){
- n = n[0];
- }
- if(!n){
- return null;
- }
- if(attr == "for"){
- return n.htmlFor;
- }
- if(attr == "class" || attr == "className"){
- return n.className;
- }
- return n.getAttribute(attr) || n[attr];
- }
-
-
-
- function getNodes(ns, mode, tagName){
- var result = [], ri = -1, cs,
- i, ni, j, ci, cn, utag, n, cj;
- if(!ns){
- return result;
- }
- tagName = tagName || "*";
-
- if(typeof ns.getElementsByTagName != "undefined"){
- ns = [ns];
- }
-
-
- if(!mode){
- for(i = 0, ni; ni = ns[i]; i++){
- cs = ni.getElementsByTagName(tagName);
- for(j = 0, ci; ci = cs[j]; j++){
- result[++ri] = ci;
- }
- }
-
-
- } else if(mode == "/" || mode == ">"){
- utag = tagName.toUpperCase();
- for(i = 0, ni, cn; ni = ns[i]; i++){
- cn = ni.childNodes;
- for(j = 0, cj; cj = cn[j]; j++){
- if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){
- result[++ri] = cj;
- }
- }
- }
-
-
- }else if(mode == "+"){
- utag = tagName.toUpperCase();
- for(i = 0, n; n = ns[i]; i++){
- while((n = n.nextSibling) && n.nodeType != 1);
- if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
- result[++ri] = n;
- }
- }
-
-
- }else if(mode == "~"){
- utag = tagName.toUpperCase();
- for(i = 0, n; n = ns[i]; i++){
- while((n = n.nextSibling)){
- if (n.nodeName == utag || n.nodeName == tagName || tagName == '*'){
- result[++ri] = n;
- }
- }
- }
- }
- return result;
- }
- function concat(a, b){
- if(b.slice){
- return a.concat(b);
- }
- for(var i = 0, l = b.length; i < l; i++){
- a[a.length] = b[i];
- }
- return a;
- }
- function byTag(cs, tagName){
- if(cs.tagName || cs == document){
- cs = [cs];
- }
- if(!tagName){
- return cs;
- }
- var result = [], ri = -1,
- i, ci;
- tagName = tagName.toLowerCase();
- for(i = 0, ci; ci = cs[i]; i++){
- if(ci.nodeType == 1 && ci.tagName.toLowerCase() == tagName){
- result[++ri] = ci;
- }
- }
- return result;
- }
- function byId(cs, id){
- id = unescapeCssSelector(id);
- if(cs.tagName || cs == document){
- cs = [cs];
- }
- if(!id){
- return cs;
- }
- var result = [], ri = -1,
- i, ci;
- for(i = 0, ci; ci = cs[i]; i++){
- if(ci && ci.id == id){
- result[++ri] = ci;
- return result;
- }
- }
- return result;
- }
-
-
- function byAttribute(cs, attr, value, op, custom){
- var result = [],
- ri = -1,
- useGetStyle = custom == "{",
- fn = Ext.DomQuery.operators[op],
- a,
- xml,
- hasXml,
- i, ci;
- value = unescapeCssSelector(value);
- for(i = 0, ci; ci = cs[i]; i++){
-
- if(ci.nodeType != 1){
- continue;
- }
-
- if(!hasXml){
- xml = Ext.DomQuery.isXml(ci);
- hasXml = true;
- }
-
- if(!xml){
- if(useGetStyle){
- a = Ext.DomQuery.getStyle(ci, attr);
- } else if (attr == "class" || attr == "className"){
- a = ci.className;
- } else if (attr == "for"){
- a = ci.htmlFor;
- } else if (attr == "href"){
-
-
- a = ci.getAttribute("href", 2);
- } else{
- a = ci.getAttribute(attr);
- }
- }else{
- a = ci.getAttribute(attr);
- }
- if((fn && fn(a, value)) || (!fn && a)){
- result[++ri] = ci;
- }
- }
- return result;
- }
- function byPseudo(cs, name, value){
- value = unescapeCssSelector(value);
- return Ext.DomQuery.pseudos[name](cs, value);
- }
- function nodupIEXml(cs){
- var d = ++key,
- r,
- i, len, c;
- cs[0].setAttribute("_nodup", d);
- r = [cs[0]];
- for(i = 1, len = cs.length; i < len; i++){
- c = cs[i];
- if(!c.getAttribute("_nodup") != d){
- c.setAttribute("_nodup", d);
- r[r.length] = c;
- }
- }
- for(i = 0, len = cs.length; i < len; i++){
- cs[i].removeAttribute("_nodup");
- }
- return r;
- }
- function nodup(cs){
- if(!cs){
- return [];
- }
- var len = cs.length, c, i, r = cs, cj, ri = -1, d, j;
- if(!len || typeof cs.nodeType != "undefined" || len == 1){
- return cs;
- }
- if(isIE && typeof cs[0].selectSingleNode != "undefined"){
- return nodupIEXml(cs);
- }
- d = ++key;
- cs[0]._nodup = d;
- for(i = 1; c = cs[i]; i++){
- if(c._nodup != d){
- c._nodup = d;
- }else{
- r = [];
- for(j = 0; j < i; j++){
- r[++ri] = cs[j];
- }
- for(j = i+1; cj = cs[j]; j++){
- if(cj._nodup != d){
- cj._nodup = d;
- r[++ri] = cj;
- }
- }
- return r;
- }
- }
- return r;
- }
- function quickDiffIEXml(c1, c2){
- var d = ++key,
- r = [],
- i, len;
- for(i = 0, len = c1.length; i < len; i++){
- c1[i].setAttribute("_qdiff", d);
- }
- for(i = 0, len = c2.length; i < len; i++){
- if(c2[i].getAttribute("_qdiff") != d){
- r[r.length] = c2[i];
- }
- }
- for(i = 0, len = c1.length; i < len; i++){
- c1[i].removeAttribute("_qdiff");
- }
- return r;
- }
- function quickDiff(c1, c2){
- var len1 = c1.length,
- d = ++key,
- r = [],
- i, len;
- if(!len1){
- return c2;
- }
- if(isIE && typeof c1[0].selectSingleNode != "undefined"){
- return quickDiffIEXml(c1, c2);
- }
- for(i = 0; i < len1; i++){
- c1[i]._qdiff = d;
- }
- for(i = 0, len = c2.length; i < len; i++){
- if(c2[i]._qdiff != d){
- r[r.length] = c2[i];
- }
- }
- return r;
- }
- function quickId(ns, mode, root, id){
- if(ns == root){
- id = unescapeCssSelector(id);
- var d = root.ownerDocument || root;
- return d.getElementById(id);
- }
- ns = getNodes(ns, mode, "*");
- return byId(ns, id);
- }
- return {
- getStyle : function(el, name){
- return Ext.fly(el).getStyle(name);
- },
-
- compile : function(path, type){
- type = type || "select";
-
- var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"],
- mode,
- lastPath,
- matchers = Ext.DomQuery.matchers,
- matchersLn = matchers.length,
- modeMatch,
-
- lmode = path.match(modeRe),
- tokenMatch, matched, j, t, m;
- path = setupEscapes(path);
- if(lmode && lmode[1]){
- fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
- path = path.replace(lmode[1], "");
- }
-
- while(path.substr(0, 1)=="/"){
- path = path.substr(1);
- }
- while(path && lastPath != path){
- lastPath = path;
- tokenMatch = path.match(tagTokenRe);
- if(type == "select"){
- if(tokenMatch){
-
- if(tokenMatch[1] == "#"){
- fn[fn.length] = 'n = quickId(n, mode, root, "'+tokenMatch[2]+'");';
- }else{
- fn[fn.length] = 'n = getNodes(n, mode, "'+tokenMatch[2]+'");';
- }
- path = path.replace(tokenMatch[0], "");
- }else if(path.substr(0, 1) != '@'){
- fn[fn.length] = 'n = getNodes(n, mode, "*");';
- }
-
- }else{
- if(tokenMatch){
- if(tokenMatch[1] == "#"){
- fn[fn.length] = 'n = byId(n, "'+tokenMatch[2]+'");';
- }else{
- fn[fn.length] = 'n = byTag(n, "'+tokenMatch[2]+'");';
- }
- path = path.replace(tokenMatch[0], "");
- }
- }
- while(!(modeMatch = path.match(modeRe))){
- matched = false;
- for(j = 0; j < matchersLn; j++){
- t = matchers[j];
- m = path.match(t.re);
- if(m){
- fn[fn.length] = t.select.replace(tplRe, function(x, i){
- return m[i];
- });
- path = path.replace(m[0], "");
- matched = true;
- break;
- }
- }
-
- if(!matched){
- Ext.Error.raise({
- sourceClass: 'Ext.DomQuery',
- sourceMethod: 'compile',
- msg: 'Error parsing selector. Parsing failed at "' + path + '"'
- });
- }
- }
- if(modeMatch[1]){
- fn[fn.length] = 'mode="'+modeMatch[1].replace(trimRe, "")+'";';
- path = path.replace(modeMatch[1], "");
- }
- }
-
- fn[fn.length] = "return nodup(n);\n}";
-
- eval(fn.join(""));
- return f;
- },
-
- jsSelect: function(path, root, type){
-
- root = root || document;
- if(typeof root == "string"){
- root = document.getElementById(root);
- }
- var paths = path.split(","),
- results = [],
- i, len, subPath, result;
-
- for(i = 0, len = paths.length; i < len; i++){
- subPath = paths[i].replace(trimRe, "");
-
- if(!cache[subPath]){
-
- cache[subPath] = Ext.DomQuery.compile(subPath, type);
- if(!cache[subPath]){
- Ext.Error.raise({
- sourceClass: 'Ext.DomQuery',
- sourceMethod: 'jsSelect',
- msg: subPath + ' is not a valid selector'
- });
- }
- } else {
-
-
- setupEscapes(subPath);
- }
- result = cache[subPath](root);
- if(result && result != document){
- results = results.concat(result);
- }
- }
-
-
- if(paths.length > 1){
- return nodup(results);
- }
- return results;
- },
- isXml: function(el) {
- var docEl = (el ? el.ownerDocument || el : 0).documentElement;
- return docEl ? docEl.nodeName !== "HTML" : false;
- },
-
- select : document.querySelectorAll ? function(path, root, type) {
- root = root || document;
- if (!Ext.DomQuery.isXml(root)) {
- try {
-
- if (root.parentNode && (root.nodeType !== 9) && path.indexOf(',') === -1 && !startIdRe.test(path)) {
- path = '#' + Ext.escapeId(Ext.id(root)) + ' ' + path;
- root = root.parentNode;
- }
- return Ext.Array.toArray(root.querySelectorAll(path));
- }
- catch (e) {
- }
- }
- return Ext.DomQuery.jsSelect.call(this, path, root, type);
- } : function(path, root, type) {
- return Ext.DomQuery.jsSelect.call(this, path, root, type);
- },
-
- selectNode : function(path, root){
- return Ext.DomQuery.select(path, root)[0];
- },
-
- selectValue : function(path, root, defaultValue){
- path = path.replace(trimRe, "");
- if (!valueCache[path]) {
- valueCache[path] = Ext.DomQuery.compile(path, "select");
- } else {
- setupEscapes(path);
- }
-
- var n = valueCache[path](root),
- v;
-
- n = n[0] ? n[0] : n;
-
-
-
-
- if (typeof n.normalize == 'function') {
- n.normalize();
- }
- v = (n && n.firstChild ? n.firstChild.nodeValue : null);
- return ((v === null||v === undefined||v==='') ? defaultValue : v);
- },
-
- selectNumber : function(path, root, defaultValue){
- var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
- return parseFloat(v);
- },
-
- is : function(el, ss){
- if(typeof el == "string"){
- el = document.getElementById(el);
- }
- var isArray = Ext.isArray(el),
- result = Ext.DomQuery.filter(isArray ? el : [el], ss);
- return isArray ? (result.length == el.length) : (result.length > 0);
- },
-
- filter : function(els, ss, nonMatches){
- ss = ss.replace(trimRe, "");
- if (!simpleCache[ss]) {
- simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
- } else {
- setupEscapes(ss);
- }
-
- var result = simpleCache[ss](els);
- return nonMatches ? quickDiff(result, els) : result;
- },
-
- matchers : [{
- re: /^\.([\w\-\\]+)/,
- select: 'n = byClassName(n, " {1} ");'
- }, {
- re: /^\:([\w\-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
- select: 'n = byPseudo(n, "{1}", "{2}");'
- },{
- re: /^(?:([\[\{])(?:@)?([\w\-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
- select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
- }, {
- re: /^#([\w\-\\]+)/,
- select: 'n = byId(n, "{1}");'
- },{
- re: /^@([\w\-]+)/,
- select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
- }
- ],
-
- operators : {
- "=" : function(a, v){
- return a == v;
- },
- "!=" : function(a, v){
- return a != v;
- },
- "^=" : function(a, v){
- return a && a.substr(0, v.length) == v;
- },
- "$=" : function(a, v){
- return a && a.substr(a.length-v.length) == v;
- },
- "*=" : function(a, v){
- return a && a.indexOf(v) !== -1;
- },
- "%=" : function(a, v){
- return (a % v) == 0;
- },
- "|=" : function(a, v){
- return a && (a == v || a.substr(0, v.length+1) == v+'-');
- },
- "~=" : function(a, v){
- return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
- }
- },
-
- pseudos : {
- "first-child" : function(c){
- var r = [], ri = -1, n,
- i, ci;
- for(i = 0; (ci = n = c[i]); i++){
- while((n = n.previousSibling) && n.nodeType != 1);
- if(!n){
- r[++ri] = ci;
- }
- }
- return r;
- },
- "last-child" : function(c){
- var r = [], ri = -1, n,
- i, ci;
- for(i = 0; (ci = n = c[i]); i++){
- while((n = n.nextSibling) && n.nodeType != 1);
- if(!n){
- r[++ri] = ci;
- }
- }
- return r;
- },
- "nth-child" : function(c, a) {
- var r = [], ri = -1,
- m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),
- f = (m[1] || 1) - 0, l = m[2] - 0,
- i, n, j, cn, pn;
- for(i = 0; n = c[i]; i++){
- pn = n.parentNode;
- if (batch != pn._batch) {
- j = 0;
- for(cn = pn.firstChild; cn; cn = cn.nextSibling){
- if(cn.nodeType == 1){
- cn.nodeIndex = ++j;
- }
- }
- pn._batch = batch;
- }
- if (f == 1) {
- if (l == 0 || n.nodeIndex == l){
- r[++ri] = n;
- }
- } else if ((n.nodeIndex + l) % f == 0){
- r[++ri] = n;
- }
- }
- return r;
- },
- "only-child" : function(c){
- var r = [], ri = -1,
- i, ci;
- for(i = 0; ci = c[i]; i++){
- if(!prev(ci) && !next(ci)){
- r[++ri] = ci;
- }
- }
- return r;
- },
- "empty" : function(c){
- var r = [], ri = -1,
- i, ci, cns, j, cn, empty;
- for(i = 0, ci; ci = c[i]; i++){
- cns = ci.childNodes;
- j = 0;
- empty = true;
- while(cn = cns[j]){
- ++j;
- if(cn.nodeType == 1 || cn.nodeType == 3){
- empty = false;
- break;
- }
- }
- if(empty){
- r[++ri] = ci;
- }
- }
- return r;
- },
- "contains" : function(c, v){
- var r = [], ri = -1,
- i, ci;
- for(i = 0; ci = c[i]; i++){
- if((ci.textContent||ci.innerText||ci.text||'').indexOf(v) != -1){
- r[++ri] = ci;
- }
- }
- return r;
- },
- "nodeValue" : function(c, v){
- var r = [], ri = -1,
- i, ci;
- for(i = 0; ci = c[i]; i++){
- if(ci.firstChild && ci.firstChild.nodeValue == v){
- r[++ri] = ci;
- }
- }
- return r;
- },
- "checked" : function(c){
- var r = [], ri = -1,
- i, ci;
- for(i = 0; ci = c[i]; i++){
- if(ci.checked == true){
- r[++ri] = ci;
- }
- }
- return r;
- },
- "not" : function(c, ss){
- return Ext.DomQuery.filter(c, ss, true);
- },
- "any" : function(c, selectors){
- var ss = selectors.split('|'),
- r = [], ri = -1, s,
- i, ci, j;
- for(i = 0; ci = c[i]; i++){
- for(j = 0; s = ss[j]; j++){
- if(Ext.DomQuery.is(ci, s)){
- r[++ri] = ci;
- break;
- }
- }
- }
- return r;
- },
- "odd" : function(c){
- return this["nth-child"](c, "odd");
- },
- "even" : function(c){
- return this["nth-child"](c, "even");
- },
- "nth" : function(c, a){
- return c[a-1] || [];
- },
- "first" : function(c){
- return c[0] || [];
- },
- "last" : function(c){
- return c[c.length-1] || [];
- },
- "has" : function(c, ss){
- var s = Ext.DomQuery.select,
- r = [], ri = -1,
- i, ci;
- for(i = 0; ci = c[i]; i++){
- if(s(ss, ci).length > 0){
- r[++ri] = ci;
- }
- }
- return r;
- },
- "next" : function(c, ss){
- var is = Ext.DomQuery.is,
- r = [], ri = -1,
- i, ci, n;
- for(i = 0; ci = c[i]; i++){
- n = next(ci);
- if(n && is(n, ss)){
- r[++ri] = ci;
- }
- }
- return r;
- },
- "prev" : function(c, ss){
- var is = Ext.DomQuery.is,
- r = [], ri = -1,
- i, ci, n;
- for(i = 0; ci = c[i]; i++){
- n = prev(ci);
- if(n && is(n, ss)){
- r[++ri] = ci;
- }
- }
- return r;
- }
- }
- };
- }());
- Ext.query = Ext.DomQuery.select;
- //@tag dom,core
- //@require Query.js
- //@define Ext.dom.Element
- //@require Ext.dom.AbstractElement
- (function() {
- var HIDDEN = 'hidden',
- DOC = document,
- VISIBILITY = "visibility",
- DISPLAY = "display",
- NONE = "none",
- XMASKED = Ext.baseCSSPrefix + "masked",
- XMASKEDRELATIVE = Ext.baseCSSPrefix + "masked-relative",
- EXTELMASKMSG = Ext.baseCSSPrefix + "mask-msg",
- bodyRe = /^body/i,
- visFly,
-
- noBoxAdjust = Ext.isStrict ? {
- select: 1
- }: {
- input: 1,
- select: 1,
- textarea: 1
- },
-
- isScrolled = function(c) {
- var r = [], ri = -1,
- i, ci;
- for (i = 0; ci = c[i]; i++) {
- if (ci.scrollTop > 0 || ci.scrollLeft > 0) {
- r[++ri] = ci;
- }
- }
- return r;
- },
- Element = Ext.define('Ext.dom.Element', {
- extend: 'Ext.dom.AbstractElement',
- alternateClassName: ['Ext.Element', 'Ext.core.Element'],
- addUnits: function() {
- return this.self.addUnits.apply(this.self, arguments);
- },
-
- focus: function(defer, dom) {
- var me = this,
- scrollTop,
- body;
- dom = dom || me.dom;
- body = (dom.ownerDocument || DOC).body || DOC.body;
- try {
- if (Number(defer)) {
- Ext.defer(me.focus, defer, me, [null, dom]);
- } else {
-
-
- if (dom.offsetHeight > Element.getViewHeight()) {
- scrollTop = body.scrollTop;
- }
- dom.focus();
- if (scrollTop !== undefined) {
- body.scrollTop = scrollTop;
- }
- }
- } catch(e) {
- }
- return me;
- },
-
- blur: function() {
- try {
- this.dom.blur();
- } catch(e) {
- }
- return this;
- },
-
- isBorderBox: function() {
- var box = Ext.isBorderBox;
- if (box) {
- box = !((this.dom.tagName || "").toLowerCase() in noBoxAdjust);
- }
- return box;
- },
-
- hover: function(overFn, outFn, scope, options) {
- var me = this;
- me.on('mouseenter', overFn, scope || me.dom, options);
- me.on('mouseleave', outFn, scope || me.dom, options);
- return me;
- },
-
- getAttributeNS: function(ns, name) {
- return this.getAttribute(name, ns);
- },
- getAttribute: (Ext.isIE && !(Ext.isIE9 && DOC.documentMode === 9)) ?
- function(name, ns) {
- var d = this.dom,
- type;
- if (ns) {
- type = typeof d[ns + ":" + name];
- if (type != 'undefined' && type != 'unknown') {
- return d[ns + ":" + name] || null;
- }
- return null;
- }
- if (name === "for") {
- name = "htmlFor";
- }
- return d[name] || null;
- } : function(name, ns) {
- var d = this.dom;
- if (ns) {
- return d.getAttributeNS(ns, name) || d.getAttribute(ns + ":" + name);
- }
- return d.getAttribute(name) || d[name] || null;
- },
-
- cacheScrollValues: function() {
- var me = this,
- scrolledDescendants,
- el, i,
- scrollValues = [],
- result = function() {
- for (i = 0; i < scrolledDescendants.length; i++) {
- el = scrolledDescendants[i];
- el.scrollLeft = scrollValues[i][0];
- el.scrollTop = scrollValues[i][1];
- }
- };
- if (!Ext.DomQuery.pseudos.isScrolled) {
- Ext.DomQuery.pseudos.isScrolled = isScrolled;
- }
- scrolledDescendants = me.query(':isScrolled');
- for (i = 0; i < scrolledDescendants.length; i++) {
- el = scrolledDescendants[i];
- scrollValues[i] = [el.scrollLeft, el.scrollTop];
- }
- return result;
- },
-
- autoBoxAdjust: true,
-
- isVisible : function(deep) {
- var me = this,
- dom = me.dom,
- stopNode = dom.ownerDocument.documentElement;
- if (!visFly) {
- visFly = new Element.Fly();
- }
- while (dom !== stopNode) {
-
-
- if (!dom || dom.nodeType === 11 || (visFly.attach(dom)).isStyle(VISIBILITY, HIDDEN) || visFly.isStyle(DISPLAY, NONE)) {
- return false;
- }
-
- if (!deep) {
- break;
- }
- dom = dom.parentNode;
- }
- return true;
- },
-
- isDisplayed : function() {
- return !this.isStyle(DISPLAY, NONE);
- },
-
- enableDisplayMode : function(display) {
- var me = this;
-
- me.setVisibilityMode(Element.DISPLAY);
- if (!Ext.isEmpty(display)) {
- (me.$cache || me.getCache()).data.originalDisplay = display;
- }
- return me;
- },
-
- mask : function(msg, msgCls , elHeight) {
- var me = this,
- dom = me.dom,
-
-
- setExpression = dom.style.setExpression,
- data = (me.$cache || me.getCache()).data,
- maskEl = data.maskEl,
- maskMsg = data.maskMsg;
- if (!(bodyRe.test(dom.tagName) && me.getStyle('position') == 'static')) {
- me.addCls(XMASKEDRELATIVE);
- }
-
-
- if (maskEl) {
- maskEl.remove();
- }
-
- if (maskMsg) {
- maskMsg.remove();
- }
- Ext.DomHelper.append(dom, [{
- cls : Ext.baseCSSPrefix + "mask"
- }, {
- cls : msgCls ? EXTELMASKMSG + " " + msgCls : EXTELMASKMSG,
- cn : {
- tag: 'div',
- html: msg || ''
- }
- }]);
-
- maskMsg = Ext.get(dom.lastChild);
- maskEl = Ext.get(maskMsg.dom.previousSibling);
- data.maskMsg = maskMsg;
- data.maskEl = maskEl;
- me.addCls(XMASKED);
- maskEl.setDisplayed(true);
- if (typeof msg == 'string') {
- maskMsg.setDisplayed(true);
- maskMsg.center(me);
- } else {
- maskMsg.setDisplayed(false);
- }
-
-
-
-
-
- if (!Ext.supports.IncludePaddingInWidthCalculation && setExpression) {
-
- try {
- maskEl.dom.style.setExpression('width', 'this.parentNode.clientWidth + "px"');
- } catch (e) {}
- }
-
-
- if (!Ext.supports.IncludePaddingInHeightCalculation && setExpression) {
-
- try {
- maskEl.dom.style.setExpression('height', 'this.parentNode.' + (dom == DOC.body ? 'scrollHeight' : 'offsetHeight') + ' + "px"');
- } catch (e) {}
- }
-
- else if (Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && me.getStyle('height') == 'auto') {
- maskEl.setSize(undefined, elHeight || me.getHeight());
- }
- return maskEl;
- },
-
- unmask : function() {
- var me = this,
- data = (me.$cache || me.getCache()).data,
- maskEl = data.maskEl,
- maskMsg = data.maskMsg,
- style;
- if (maskEl) {
- style = maskEl.dom.style;
-
- if (style.clearExpression) {
- style.clearExpression('width');
- style.clearExpression('height');
- }
-
- if (maskEl) {
- maskEl.remove();
- delete data.maskEl;
- }
-
- if (maskMsg) {
- maskMsg.remove();
- delete data.maskMsg;
- }
-
- me.removeCls([XMASKED, XMASKEDRELATIVE]);
- }
- },
-
- isMasked : function() {
- var me = this,
- data = (me.$cache || me.getCache()).data,
- maskEl = data.maskEl,
- maskMsg = data.maskMsg,
- hasMask = false;
- if (maskEl && maskEl.isVisible()) {
- if (maskMsg) {
- maskMsg.center(me);
- }
- hasMask = true;
- }
- return hasMask;
- },
-
- createShim : function() {
- var el = DOC.createElement('iframe'),
- shim;
- el.frameBorder = '0';
- el.className = Ext.baseCSSPrefix + 'shim';
- el.src = Ext.SSL_SECURE_URL;
- shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
- shim.autoBoxAdjust = false;
- return shim;
- },
-
- addKeyListener : function(key, fn, scope){
- var config;
- if(typeof key != 'object' || Ext.isArray(key)){
- config = {
- target: this,
- key: key,
- fn: fn,
- scope: scope
- };
- }else{
- config = {
- target: this,
- key : key.key,
- shift : key.shift,
- ctrl : key.ctrl,
- alt : key.alt,
- fn: fn,
- scope: scope
- };
- }
- return new Ext.util.KeyMap(config);
- },
-
- addKeyMap : function(config) {
- return new Ext.util.KeyMap(Ext.apply({
- target: this
- }, config));
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- on: function(eventName, fn, scope, options) {
- Ext.EventManager.on(this, eventName, fn, scope || this, options);
- return this;
- },
-
- un: function(eventName, fn, scope) {
- Ext.EventManager.un(this, eventName, fn, scope || this);
- return this;
- },
-
- removeAllListeners: function() {
- Ext.EventManager.removeAll(this);
- return this;
- },
-
- purgeAllListeners: function() {
- Ext.EventManager.purgeElement(this);
- return this;
- }
- }, function() {
- var EC = Ext.cache,
- El = this,
- AbstractElement = Ext.dom.AbstractElement,
- focusRe = /a|button|embed|iframe|img|input|object|select|textarea/i,
- nonSpaceRe = /\S/,
- scriptTagRe = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig,
- replaceScriptTagRe = /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,
- srcRe = /\ssrc=([\'\"])(.*?)\1/i,
- typeRe = /\stype=([\'\"])(.*?)\1/i,
- useDocForId = !(Ext.isIE6 || Ext.isIE7 || Ext.isIE8);
- El.boxMarkup = '<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>';
-
-
-
-
- function garbageCollect() {
- if (!Ext.enableGarbageCollector) {
- clearInterval(El.collectorThreadId);
- } else {
- var eid,
- d,
- o,
- t;
- for (eid in EC) {
- if (!EC.hasOwnProperty(eid)) {
- continue;
- }
- o = EC[eid];
-
- if (o.skipGarbageCollection) {
- continue;
- }
- d = o.dom;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (!d.parentNode || (!d.offsetParent && !Ext.getElementById(eid))) {
- if (d && Ext.enableListenerCollection) {
- Ext.EventManager.removeAll(d);
- }
- delete EC[eid];
- }
- }
-
- if (Ext.isIE) {
- t = {};
- for (eid in EC) {
- if (!EC.hasOwnProperty(eid)) {
- continue;
- }
- t[eid] = EC[eid];
- }
- EC = Ext.cache = t;
- }
- }
- }
- El.collectorThreadId = setInterval(garbageCollect, 30000);
-
- El.addMethods({
-
- monitorMouseLeave: function(delay, handler, scope) {
- var me = this,
- timer,
- listeners = {
- mouseleave: function(e) {
- timer = setTimeout(Ext.Function.bind(handler, scope||me, [e]), delay);
- },
- mouseenter: function() {
- clearTimeout(timer);
- },
- freezeEvent: true
- };
- me.on(listeners);
- return listeners;
- },
-
- swallowEvent : function(eventName, preventDefault) {
- var me = this,
- e, eLen;
- function fn(e) {
- e.stopPropagation();
- if (preventDefault) {
- e.preventDefault();
- }
- }
- if (Ext.isArray(eventName)) {
- eLen = eventName.length;
- for (e = 0; e < eLen; e++) {
- me.on(eventName[e], fn);
- }
- return me;
- }
- me.on(eventName, fn);
- return me;
- },
-
- relayEvent : function(eventName, observable) {
- this.on(eventName, function(e) {
- observable.fireEvent(eventName, e);
- });
- },
-
- clean : function(forceReclean) {
- var me = this,
- dom = me.dom,
- data = (me.$cache || me.getCache()).data,
- n = dom.firstChild,
- ni = -1,
- nx;
- if (data.isCleaned && forceReclean !== true) {
- return me;
- }
- while (n) {
- nx = n.nextSibling;
- if (n.nodeType == 3) {
-
- if (!(nonSpaceRe.test(n.nodeValue))) {
- dom.removeChild(n);
-
- } else if (nx && nx.nodeType == 3) {
- n.appendData(Ext.String.trim(nx.data));
- dom.removeChild(nx);
- nx = n.nextSibling;
- n.nodeIndex = ++ni;
- }
- } else {
-
- Ext.fly(n).clean();
- n.nodeIndex = ++ni;
- }
- n = nx;
- }
- data.isCleaned = true;
- return me;
- },
-
- load : function(options) {
- this.getLoader().load(options);
- return this;
- },
-
- getLoader : function() {
- var me = this,
- data = (me.$cache || me.getCache()).data,
- loader = data.loader;
- if (!loader) {
- data.loader = loader = new Ext.ElementLoader({
- target: me
- });
- }
- return loader;
- },
-
- syncContent: function(source) {
- source = Ext.getDom(source);
- var me = this,
- sourceNodes = source.childNodes,
- sourceLen = sourceNodes.length,
- dest = me.dom,
- destNodes = dest.childNodes,
- destLen = destNodes.length,
- i, destNode, sourceNode,
- nodeType;
-
- dest.style.cssText = source.style.cssText;
- dest.className = source.className;
-
- if (sourceLen !== destLen) {
- source.innerHTML = dest.innerHTML;
- return;
- }
-
-
- for (i = 0; i < sourceLen; i++) {
- sourceNode = sourceNodes[i];
- destNode = destNodes[i];
- nodeType = sourceNode.nodeType;
-
- if (nodeType !== destNode.nodeType || (nodeType === 1 && sourceNode.tagName !== destNode.tagName)) {
- dest.innerHTML = source.innerHTML;
- return;
- }
-
- if (nodeType === 3) {
- destNode.data = sourceNode.data;
- }
-
- else {
- if (sourceNode.id && destNode.id !== sourceNode.id) {
- destNode.id = sourceNode.id;
- }
- destNode.style.cssText = sourceNode.style.cssText;
- destNode.className = sourceNode.className;
- Ext.fly(destNode).syncContent(sourceNode);
- }
- }
- },
-
- update : function(html, loadScripts, callback) {
- var me = this,
- id,
- dom,
- interval;
- if (!me.dom) {
- return me;
- }
- html = html || '';
- dom = me.dom;
- if (loadScripts !== true) {
- dom.innerHTML = html;
- Ext.callback(callback, me);
- return me;
- }
- id = Ext.id();
- html += '<span id="' + id + '"></span>';
- interval = setInterval(function() {
- var hd,
- match,
- attrs,
- srcMatch,
- typeMatch,
- el,
- s;
- if (!(el = DOC.getElementById(id))) {
- return false;
- }
- clearInterval(interval);
- Ext.removeNode(el);
- hd = Ext.getHead().dom;
- while ((match = scriptTagRe.exec(html))) {
- attrs = match[1];
- srcMatch = attrs ? attrs.match(srcRe) : false;
- if (srcMatch && srcMatch[2]) {
- s = DOC.createElement("script");
- s.src = srcMatch[2];
- typeMatch = attrs.match(typeRe);
- if (typeMatch && typeMatch[2]) {
- s.type = typeMatch[2];
- }
- hd.appendChild(s);
- } else if (match[2] && match[2].length > 0) {
- if (window.execScript) {
- window.execScript(match[2]);
- } else {
- window.eval(match[2]);
- }
- }
- }
- Ext.callback(callback, me);
- }, 20);
- dom.innerHTML = html.replace(replaceScriptTagRe, '');
- return me;
- },
-
- removeAllListeners : function() {
- this.removeAnchor();
- Ext.EventManager.removeAll(this.dom);
- return this;
- },
-
- createProxy : function(config, renderTo, matchBox) {
- config = (typeof config == 'object') ? config : {tag : "div", cls: config};
- var me = this,
- proxy = renderTo ? Ext.DomHelper.append(renderTo, config, true) :
- Ext.DomHelper.insertBefore(me.dom, config, true);
- proxy.setVisibilityMode(Element.DISPLAY);
- proxy.hide();
- if (matchBox && me.setBox && me.getBox) {
- proxy.setBox(me.getBox());
- }
- return proxy;
- },
-
-
- getScopeParent: function() {
- var parent = this.dom.parentNode;
- if (Ext.scopeResetCSS) {
-
- parent = parent.parentNode;
- if (!Ext.supports.CSS3LinearGradient || !Ext.supports.CSS3BorderRadius) {
-
-
- parent = parent.parentNode;
- }
- }
- return parent;
- },
-
- needsTabIndex: function() {
- if (this.dom) {
- if ((this.dom.nodeName === 'a') && (!this.dom.href)) {
- return true;
- }
- return !focusRe.test(this.dom.nodeName);
- }
- },
-
- focusable: function () {
- var dom = this.dom,
- nodeName = dom.nodeName,
- canFocus = false;
- if (!dom.disabled) {
- if (focusRe.test(nodeName)) {
- if ((nodeName !== 'a') || dom.href) {
- canFocus = true;
- }
- } else {
- canFocus = !isNaN(dom.tabIndex);
- }
- }
- return canFocus && this.isVisible(true);
- }
- });
- if (Ext.isIE) {
- El.prototype.getById = function (id, asDom) {
- var dom = this.dom,
- cacheItem, el, ret;
- if (dom) {
-
-
- el = (useDocForId && DOC.getElementById(id)) || dom.all[id];
- if (el) {
- if (asDom) {
- ret = el;
- } else {
-
-
- cacheItem = EC[id];
- if (cacheItem && cacheItem.el) {
- ret = Ext.updateCacheEntry(cacheItem, el).el;
- } else {
- ret = new Element(el);
- }
- }
- return ret;
- }
- }
- return asDom ? Ext.getDom(id) : El.get(id);
- };
- }
- El.createAlias({
-
- addListener: 'on',
-
- removeListener: 'un',
-
- clearListeners: 'removeAllListeners'
- });
- El.Fly = AbstractElement.Fly = new Ext.Class({
- extend: El,
- constructor: function(dom) {
- this.dom = dom;
- },
-
- attach: AbstractElement.Fly.prototype.attach
- });
- if (Ext.isIE) {
- Ext.getElementById = function (id) {
- var el = DOC.getElementById(id),
- detachedBodyEl;
- if (!el && (detachedBodyEl = AbstractElement.detachedBodyEl)) {
- el = detachedBodyEl.dom.all[id];
- }
- return el;
- };
- } else if (!DOC.querySelector) {
- Ext.getDetachedBody = Ext.getBody;
- Ext.getElementById = function (id) {
- return DOC.getElementById(id);
- };
- }
- });
- }());
- //@tag dom,core
- //@require Element.js
- //@define Ext.dom.Element-alignment
- //@define Ext.dom.Element
- Ext.dom.Element.override((function() {
- var doc = document,
- win = window,
- alignRe = /^([a-z]+)-([a-z]+)(\?)?$/,
- round = Math.round;
- return {
-
- getAnchorXY: function(anchor, local, mySize) {
-
-
- anchor = (anchor || "tl").toLowerCase();
- mySize = mySize || {};
- var me = this,
- isViewport = me.dom == doc.body || me.dom == doc,
- myWidth = mySize.width || isViewport ? Ext.dom.Element.getViewWidth() : me.getWidth(),
- myHeight = mySize.height || isViewport ? Ext.dom.Element.getViewHeight() : me.getHeight(),
- xy,
- myPos = me.getXY(),
- scroll = me.getScroll(),
- extraX = isViewport ? scroll.left : !local ? myPos[0] : 0,
- extraY = isViewport ? scroll.top : !local ? myPos[1] : 0;
-
-
- switch (anchor) {
- case 'tl' : xy = [ 0, 0];
- break;
- case 'bl' : xy = [ 0, myHeight];
- break;
- case 'tr' : xy = [ myWidth, 0];
- break;
- case 'c' : xy = [ round(myWidth * 0.5), round(myHeight * 0.5)];
- break;
- case 't' : xy = [ round(myWidth * 0.5), 0];
- break;
- case 'l' : xy = [ 0, round(myHeight * 0.5)];
- break;
- case 'r' : xy = [ myWidth, round(myHeight * 0.5)];
- break;
- case 'b' : xy = [ round(myWidth * 0.5), myHeight];
- break;
- case 'br' : xy = [ myWidth, myHeight];
- }
- return [xy[0] + extraX, xy[1] + extraY];
- },
-
- getAlignToXY : function(alignToEl, posSpec, offset) {
- alignToEl = Ext.get(alignToEl);
- if (!alignToEl || !alignToEl.dom) {
- }
- offset = offset || [0,0];
- posSpec = (!posSpec || posSpec == "?" ? "tl-bl?" : (!(/-/).test(posSpec) && posSpec !== "" ? "tl-" + posSpec : posSpec || "tl-bl")).toLowerCase();
- var me = this,
- myPosition,
- alignToElPosition,
- x,
- y,
- myWidth,
- myHeight,
- alignToElRegion,
- viewportWidth = Ext.dom.Element.getViewWidth() - 10,
- viewportHeight = Ext.dom.Element.getViewHeight() - 10,
- p1y,
- p1x,
- p2y,
- p2x,
- swapY,
- swapX,
- docElement = doc.documentElement,
- docBody = doc.body,
- scrollX = (docElement.scrollLeft || docBody.scrollLeft || 0),
- scrollY = (docElement.scrollTop || docBody.scrollTop || 0),
- constrain,
- align1,
- align2,
- alignMatch = posSpec.match(alignRe);
- align1 = alignMatch[1];
- align2 = alignMatch[2];
- constrain = !!alignMatch[3];
-
-
- myPosition = me.getAnchorXY(align1, true);
- alignToElPosition = alignToEl.getAnchorXY(align2, false);
- x = alignToElPosition[0] - myPosition[0] + offset[0];
- y = alignToElPosition[1] - myPosition[1] + offset[1];
-
- if (constrain) {
- myWidth = me.getWidth();
- myHeight = me.getHeight();
- alignToElRegion = alignToEl.getRegion();
-
-
-
- p1y = align1.charAt(0);
- p1x = align1.charAt(align1.length - 1);
- p2y = align2.charAt(0);
- p2x = align2.charAt(align2.length - 1);
- swapY = ((p1y == "t" && p2y == "b") || (p1y == "b" && p2y == "t"));
- swapX = ((p1x == "r" && p2x == "l") || (p1x == "l" && p2x == "r"));
- if (x + myWidth > viewportWidth + scrollX) {
- x = swapX ? alignToElRegion.left - myWidth : viewportWidth + scrollX - myWidth;
- }
- if (x < scrollX) {
- x = swapX ? alignToElRegion.right : scrollX;
- }
- if (y + myHeight > viewportHeight + scrollY) {
- y = swapY ? alignToElRegion.top - myHeight : viewportHeight + scrollY - myHeight;
- }
- if (y < scrollY) {
- y = swapY ? alignToElRegion.bottom : scrollY;
- }
- }
- return [x,y];
- },
-
- anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback) {
- var me = this,
- dom = me.dom,
- scroll = !Ext.isEmpty(monitorScroll),
- action = function() {
- Ext.fly(dom).alignTo(el, alignment, offsets, animate);
- Ext.callback(callback, Ext.fly(dom));
- },
- anchor = this.getAnchor();
-
- this.removeAnchor();
- Ext.apply(anchor, {
- fn: action,
- scroll: scroll
- });
- Ext.EventManager.onWindowResize(action, null);
- if (scroll) {
- Ext.EventManager.on(win, 'scroll', action, null,
- {buffer: !isNaN(monitorScroll) ? monitorScroll : 50});
- }
- action.call(me);
- return me;
- },
-
- removeAnchor : function() {
- var me = this,
- anchor = this.getAnchor();
- if (anchor && anchor.fn) {
- Ext.EventManager.removeResizeListener(anchor.fn);
- if (anchor.scroll) {
- Ext.EventManager.un(win, 'scroll', anchor.fn);
- }
- delete anchor.fn;
- }
- return me;
- },
- getAlignVector: function(el, spec, offset) {
- var me = this,
- myPos = me.getXY(),
- alignedPos = me.getAlignToXY(el, spec, offset);
- el = Ext.get(el);
- alignedPos[0] -= myPos[0];
- alignedPos[1] -= myPos[1];
- return alignedPos;
- },
-
- alignTo: function(element, position, offsets, animate) {
- var me = this;
- return me.setXY(me.getAlignToXY(element, position, offsets),
- me.anim && !!animate ? me.anim(animate) : false);
- },
-
- getConstrainVector: function(constrainTo, proposedPosition) {
- if (!(constrainTo instanceof Ext.util.Region)) {
- constrainTo = Ext.get(constrainTo).getViewRegion();
- }
- var thisRegion = this.getRegion(),
- vector = [0, 0],
- shadowSize = (this.shadow && !this.shadowDisabled) ? this.shadow.getShadowSize() : undefined,
- overflowed = false;
-
- if (proposedPosition) {
- thisRegion.translateBy(proposedPosition[0] - thisRegion.x, proposedPosition[1] - thisRegion.y);
- }
-
- if (shadowSize) {
- constrainTo.adjust(shadowSize[0], -shadowSize[1], -shadowSize[2], shadowSize[3]);
- }
-
- if (thisRegion.right > constrainTo.right) {
- overflowed = true;
- vector[0] = (constrainTo.right - thisRegion.right);
- }
- if (thisRegion.left + vector[0] < constrainTo.left) {
- overflowed = true;
- vector[0] = (constrainTo.left - thisRegion.left);
- }
-
- if (thisRegion.bottom > constrainTo.bottom) {
- overflowed = true;
- vector[1] = (constrainTo.bottom - thisRegion.bottom);
- }
- if (thisRegion.top + vector[1] < constrainTo.top) {
- overflowed = true;
- vector[1] = (constrainTo.top - thisRegion.top);
- }
- return overflowed ? vector : false;
- },
-
- getCenterXY : function(){
- return this.getAlignToXY(doc, 'c-c');
- },
-
- center : function(centerIn){
- return this.alignTo(centerIn || doc, 'c-c');
- }
- };
- }()));
- //@tag dom,core
- //@require Ext.dom.Element-alignment
- //@define Ext.dom.Element-anim
- //@define Ext.dom.Element
- Ext.dom.Element.override({
-
- animate: function(config) {
- var me = this,
- listeners,
- anim,
- animId = me.dom.id || Ext.id(me.dom);
- if (!Ext.fx.Manager.hasFxBlock(animId)) {
-
- if (config.listeners) {
- listeners = config.listeners;
- delete config.listeners;
- }
- if (config.internalListeners) {
- config.listeners = config.internalListeners;
- delete config.internalListeners;
- }
- anim = new Ext.fx.Anim(me.anim(config));
- if (listeners) {
- anim.on(listeners);
- }
- Ext.fx.Manager.queueFx(anim);
- }
- return me;
- },
-
- anim: function(config) {
- if (!Ext.isObject(config)) {
- return (config) ? {} : false;
- }
- var me = this,
- duration = config.duration || Ext.fx.Anim.prototype.duration,
- easing = config.easing || 'ease',
- animConfig;
- if (config.stopAnimation) {
- me.stopAnimation();
- }
- Ext.applyIf(config, Ext.fx.Manager.getFxDefaults(me.id));
-
- Ext.fx.Manager.setFxDefaults(me.id, {
- delay: 0
- });
- animConfig = {
-
- target: me.dom,
- remove: config.remove,
- alternate: config.alternate || false,
- duration: duration,
- easing: easing,
- callback: config.callback,
- listeners: config.listeners,
- iterations: config.iterations || 1,
- scope: config.scope,
- block: config.block,
- concurrent: config.concurrent,
- delay: config.delay || 0,
- paused: true,
- keyframes: config.keyframes,
- from: config.from || {},
- to: Ext.apply({}, config)
- };
- Ext.apply(animConfig.to, config.to);
-
- delete animConfig.to.to;
- delete animConfig.to.from;
- delete animConfig.to.remove;
- delete animConfig.to.alternate;
- delete animConfig.to.keyframes;
- delete animConfig.to.iterations;
- delete animConfig.to.listeners;
- delete animConfig.to.target;
- delete animConfig.to.paused;
- delete animConfig.to.callback;
- delete animConfig.to.scope;
- delete animConfig.to.duration;
- delete animConfig.to.easing;
- delete animConfig.to.concurrent;
- delete animConfig.to.block;
- delete animConfig.to.stopAnimation;
- delete animConfig.to.delay;
- return animConfig;
- },
-
- slideIn: function(anchor, obj, slideOut) {
- var me = this,
- elStyle = me.dom.style,
- beforeAnim,
- wrapAnim,
- restoreScroll,
- wrapDomParentNode;
- anchor = anchor || "t";
- obj = obj || {};
- beforeAnim = function() {
- var animScope = this,
- listeners = obj.listeners,
- box, originalStyles, anim, wrap;
- if (!slideOut) {
- me.fixDisplay();
- }
- box = me.getBox();
- if ((anchor == 't' || anchor == 'b') && box.height === 0) {
- box.height = me.dom.scrollHeight;
- }
- else if ((anchor == 'l' || anchor == 'r') && box.width === 0) {
- box.width = me.dom.scrollWidth;
- }
- originalStyles = me.getStyles('width', 'height', 'left', 'right', 'top', 'bottom', 'position', 'z-index', true);
- me.setSize(box.width, box.height);
-
- if (obj.preserveScroll) {
- restoreScroll = me.cacheScrollValues();
- }
- wrap = me.wrap({
- id: Ext.id() + '-anim-wrap-for-' + me.id,
- style: {
- visibility: slideOut ? 'visible' : 'hidden'
- }
- });
- wrapDomParentNode = wrap.dom.parentNode;
- wrap.setPositioning(me.getPositioning());
- if (wrap.isStyle('position', 'static')) {
- wrap.position('relative');
- }
- me.clearPositioning('auto');
- wrap.clip();
-
- if (restoreScroll) {
- restoreScroll();
- }
-
-
-
- me.setStyle({
- visibility: '',
- position: 'absolute'
- });
- if (slideOut) {
- wrap.setSize(box.width, box.height);
- }
- switch (anchor) {
- case 't':
- anim = {
- from: {
- width: box.width + 'px',
- height: '0px'
- },
- to: {
- width: box.width + 'px',
- height: box.height + 'px'
- }
- };
- elStyle.bottom = '0px';
- break;
- case 'l':
- anim = {
- from: {
- width: '0px',
- height: box.height + 'px'
- },
- to: {
- width: box.width + 'px',
- height: box.height + 'px'
- }
- };
- elStyle.right = '0px';
- break;
- case 'r':
- anim = {
- from: {
- x: box.x + box.width,
- width: '0px',
- height: box.height + 'px'
- },
- to: {
- x: box.x,
- width: box.width + 'px',
- height: box.height + 'px'
- }
- };
- break;
- case 'b':
- anim = {
- from: {
- y: box.y + box.height,
- width: box.width + 'px',
- height: '0px'
- },
- to: {
- y: box.y,
- width: box.width + 'px',
- height: box.height + 'px'
- }
- };
- break;
- case 'tl':
- anim = {
- from: {
- x: box.x,
- y: box.y,
- width: '0px',
- height: '0px'
- },
- to: {
- width: box.width + 'px',
- height: box.height + 'px'
- }
- };
- elStyle.bottom = '0px';
- elStyle.right = '0px';
- break;
- case 'bl':
- anim = {
- from: {
- y: box.y + box.height,
- width: '0px',
- height: '0px'
- },
- to: {
- y: box.y,
- width: box.width + 'px',
- height: box.height + 'px'
- }
- };
- elStyle.bottom = '0px';
- break;
- case 'br':
- anim = {
- from: {
- x: box.x + box.width,
- y: box.y + box.height,
- width: '0px',
- height: '0px'
- },
- to: {
- x: box.x,
- y: box.y,
- width: box.width + 'px',
- height: box.height + 'px'
- }
- };
- break;
- case 'tr':
- anim = {
- from: {
- x: box.x + box.width,
- width: '0px',
- height: '0px'
- },
- to: {
- x: box.x,
- width: box.width + 'px',
- height: box.height + 'px'
- }
- };
- elStyle.right = '0px';
- break;
- }
- wrap.show();
- wrapAnim = Ext.apply({}, obj);
- delete wrapAnim.listeners;
- wrapAnim = new Ext.fx.Anim(Ext.applyIf(wrapAnim, {
- target: wrap,
- duration: 500,
- easing: 'ease-out',
- from: slideOut ? anim.to : anim.from,
- to: slideOut ? anim.from : anim.to
- }));
-
- wrapAnim.on('afteranimate', function() {
- me.setStyle(originalStyles);
- if (slideOut) {
- if (obj.useDisplay) {
- me.setDisplayed(false);
- } else {
- me.hide();
- }
- }
- if (wrap.dom) {
- if (wrap.dom.parentNode) {
- wrap.dom.parentNode.insertBefore(me.dom, wrap.dom);
- } else {
- wrapDomParentNode.appendChild(me.dom);
- }
- wrap.remove();
- }
-
- if (restoreScroll) {
- restoreScroll();
- }
-
- animScope.end();
- });
-
- if (listeners) {
- wrapAnim.on(listeners);
- }
- };
- me.animate({
-
- duration: obj.duration ? Math.max(obj.duration, 500) * 2 : 1000,
- listeners: {
- beforeanimate: beforeAnim
- }
- });
- return me;
- },
-
- slideOut: function(anchor, o) {
- return this.slideIn(anchor, o, true);
- },
-
- puff: function(obj) {
- var me = this,
- beforeAnim,
- box = me.getBox(),
- originalStyles = me.getStyles('width', 'height', 'left', 'right', 'top', 'bottom', 'position', 'z-index', 'font-size', 'opacity', true);
- obj = Ext.applyIf(obj || {}, {
- easing: 'ease-out',
- duration: 500,
- useDisplay: false
- });
- beforeAnim = function() {
- me.clearOpacity();
- me.show();
- this.to = {
- width: box.width * 2,
- height: box.height * 2,
- x: box.x - (box.width / 2),
- y: box.y - (box.height /2),
- opacity: 0,
- fontSize: '200%'
- };
- this.on('afteranimate',function() {
- if (me.dom) {
- if (obj.useDisplay) {
- me.setDisplayed(false);
- } else {
- me.hide();
- }
- me.setStyle(originalStyles);
- obj.callback.call(obj.scope);
- }
- });
- };
- me.animate({
- duration: obj.duration,
- easing: obj.easing,
- listeners: {
- beforeanimate: {
- fn: beforeAnim
- }
- }
- });
- return me;
- },
-
- switchOff: function(obj) {
- var me = this,
- beforeAnim;
- obj = Ext.applyIf(obj || {}, {
- easing: 'ease-in',
- duration: 500,
- remove: false,
- useDisplay: false
- });
- beforeAnim = function() {
- var animScope = this,
- size = me.getSize(),
- xy = me.getXY(),
- keyframe, position;
- me.clearOpacity();
- me.clip();
- position = me.getPositioning();
- keyframe = new Ext.fx.Animator({
- target: me,
- duration: obj.duration,
- easing: obj.easing,
- keyframes: {
- 33: {
- opacity: 0.3
- },
- 66: {
- height: 1,
- y: xy[1] + size.height / 2
- },
- 100: {
- width: 1,
- x: xy[0] + size.width / 2
- }
- }
- });
- keyframe.on('afteranimate', function() {
- if (obj.useDisplay) {
- me.setDisplayed(false);
- } else {
- me.hide();
- }
- me.clearOpacity();
- me.setPositioning(position);
- me.setSize(size);
-
- animScope.end();
- });
- };
-
- me.animate({
-
- duration: (Math.max(obj.duration, 500) * 2),
- listeners: {
- beforeanimate: {
- fn: beforeAnim
- }
- }
- });
- return me;
- },
-
- frame : function(color, count, obj){
- var me = this,
- beforeAnim;
- color = color || '#C3DAF9';
- count = count || 1;
- obj = obj || {};
- beforeAnim = function() {
- me.show();
- var animScope = this,
- box = me.getBox(),
- proxy = Ext.getBody().createChild({
- id: me.id + '-anim-proxy',
- style: {
- position : 'absolute',
- 'pointer-events': 'none',
- 'z-index': 35000,
- border : '0px solid ' + color
- }
- }),
- proxyAnim;
- proxyAnim = new Ext.fx.Anim({
- target: proxy,
- duration: obj.duration || 1000,
- iterations: count,
- from: {
- top: box.y,
- left: box.x,
- borderWidth: 0,
- opacity: 1,
- height: box.height,
- width: box.width
- },
- to: {
- top: box.y - 20,
- left: box.x - 20,
- borderWidth: 10,
- opacity: 0,
- height: box.height + 40,
- width: box.width + 40
- }
- });
- proxyAnim.on('afteranimate', function() {
- proxy.remove();
-
- animScope.end();
- });
- };
- me.animate({
-
- duration: (Math.max(obj.duration, 500) * 2) || 2000,
- listeners: {
- beforeanimate: {
- fn: beforeAnim
- }
- }
- });
- return me;
- },
-
- ghost: function(anchor, obj) {
- var me = this,
- beforeAnim;
- anchor = anchor || "b";
- beforeAnim = function() {
- var width = me.getWidth(),
- height = me.getHeight(),
- xy = me.getXY(),
- position = me.getPositioning(),
- to = {
- opacity: 0
- };
- switch (anchor) {
- case 't':
- to.y = xy[1] - height;
- break;
- case 'l':
- to.x = xy[0] - width;
- break;
- case 'r':
- to.x = xy[0] + width;
- break;
- case 'b':
- to.y = xy[1] + height;
- break;
- case 'tl':
- to.x = xy[0] - width;
- to.y = xy[1] - height;
- break;
- case 'bl':
- to.x = xy[0] - width;
- to.y = xy[1] + height;
- break;
- case 'br':
- to.x = xy[0] + width;
- to.y = xy[1] + height;
- break;
- case 'tr':
- to.x = xy[0] + width;
- to.y = xy[1] - height;
- break;
- }
- this.to = to;
- this.on('afteranimate', function () {
- if (me.dom) {
- me.hide();
- me.clearOpacity();
- me.setPositioning(position);
- }
- });
- };
- me.animate(Ext.applyIf(obj || {}, {
- duration: 500,
- easing: 'ease-out',
- listeners: {
- beforeanimate: {
- fn: beforeAnim
- }
- }
- }));
- return me;
- },
-
- highlight: function(color, o) {
- var me = this,
- dom = me.dom,
- from = {},
- restore, to, attr, lns, event, fn;
- o = o || {};
- lns = o.listeners || {};
- attr = o.attr || 'backgroundColor';
- from[attr] = color || 'ffff9c';
- if (!o.to) {
- to = {};
- to[attr] = o.endColor || me.getColor(attr, 'ffffff', '');
- }
- else {
- to = o.to;
- }
-
- o.listeners = Ext.apply(Ext.apply({}, lns), {
- beforeanimate: function() {
- restore = dom.style[attr];
- me.clearOpacity();
- me.show();
- event = lns.beforeanimate;
- if (event) {
- fn = event.fn || event;
- return fn.apply(event.scope || lns.scope || window, arguments);
- }
- },
- afteranimate: function() {
- if (dom) {
- dom.style[attr] = restore;
- }
- event = lns.afteranimate;
- if (event) {
- fn = event.fn || event;
- fn.apply(event.scope || lns.scope || window, arguments);
- }
- }
- });
- me.animate(Ext.apply({}, o, {
- duration: 1000,
- easing: 'ease-in',
- from: from,
- to: to
- }));
- return me;
- },
-
- pause: function(ms) {
- var me = this;
- Ext.fx.Manager.setFxDefaults(me.id, {
- delay: ms
- });
- return me;
- },
-
- fadeIn: function(o) {
- var me = this;
- me.animate(Ext.apply({}, o, {
- opacity: 1,
- internalListeners: {
- beforeanimate: function(anim){
-
-
- if (me.isStyle('display', 'none')) {
- me.setDisplayed('');
- } else {
- me.show();
- }
- }
- }
- }));
- return this;
- },
-
- fadeOut: function(o) {
- var me = this;
- o = Ext.apply({
- opacity: 0,
- internalListeners: {
- afteranimate: function(anim){
- var dom = me.dom;
- if (dom && anim.to.opacity === 0) {
- if (o.useDisplay) {
- me.setDisplayed(false);
- } else {
- me.hide();
- }
- }
- }
- }
- }, o);
- me.animate(o);
- return me;
- },
-
- scale: function(w, h, o) {
- this.animate(Ext.apply({}, o, {
- width: w,
- height: h
- }));
- return this;
- },
-
- shift: function(config) {
- this.animate(config);
- return this;
- }
- });
- //@tag dom,core
- //@require Ext.dom.Element-anim
- //@define Ext.dom.Element-dd
- //@define Ext.dom.Element
- Ext.dom.Element.override({
-
- initDD : function(group, config, overrides){
- var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);
- return Ext.apply(dd, overrides);
- },
-
- initDDProxy : function(group, config, overrides){
- var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);
- return Ext.apply(dd, overrides);
- },
-
- initDDTarget : function(group, config, overrides){
- var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);
- return Ext.apply(dd, overrides);
- }
- });
- //@tag dom,core
- //@require Ext.dom.Element-dd
- //@define Ext.dom.Element-fx
- //@define Ext.dom.Element
- (function() {
- var Element = Ext.dom.Element,
- VISIBILITY = "visibility",
- DISPLAY = "display",
- NONE = "none",
- HIDDEN = 'hidden',
- VISIBLE = 'visible',
- OFFSETS = "offsets",
- ASCLASS = "asclass",
- NOSIZE = 'nosize',
- ORIGINALDISPLAY = 'originalDisplay',
- VISMODE = 'visibilityMode',
- ISVISIBLE = 'isVisible',
- OFFSETCLASS = Ext.baseCSSPrefix + 'hide-offsets',
- getDisplay = function(el) {
- var data = (el.$cache || el.getCache()).data,
- display = data[ORIGINALDISPLAY];
-
- if (display === undefined) {
- data[ORIGINALDISPLAY] = display = '';
- }
- return display;
- },
- getVisMode = function(el){
- var data = (el.$cache || el.getCache()).data,
- visMode = data[VISMODE];
-
- if (visMode === undefined) {
- data[VISMODE] = visMode = Element.VISIBILITY;
- }
- return visMode;
- };
- Element.override({
-
- originalDisplay : "",
- visibilityMode : 1,
-
- setVisible : function(visible, animate) {
- var me = this,
- dom = me.dom,
- visMode = getVisMode(me);
-
- if (typeof animate == 'string') {
- switch (animate) {
- case DISPLAY:
- visMode = Element.DISPLAY;
- break;
- case VISIBILITY:
- visMode = Element.VISIBILITY;
- break;
- case OFFSETS:
- visMode = Element.OFFSETS;
- break;
- case NOSIZE:
- case ASCLASS:
- visMode = Element.ASCLASS;
- break;
- }
- me.setVisibilityMode(visMode);
- animate = false;
- }
- if (!animate || !me.anim) {
- if (visMode == Element.DISPLAY) {
- return me.setDisplayed(visible);
- } else if (visMode == Element.OFFSETS) {
- me[visible?'removeCls':'addCls'](OFFSETCLASS);
- } else if (visMode == Element.VISIBILITY) {
- me.fixDisplay();
-
- dom.style.visibility = visible ? '' : HIDDEN;
- } else if (visMode == Element.ASCLASS) {
- me[visible?'removeCls':'addCls'](me.visibilityCls || Element.visibilityCls);
- }
- } else {
-
- if (visible) {
- me.setOpacity(0.01);
- me.setVisible(true);
- }
- if (!Ext.isObject(animate)) {
- animate = {
- duration: 350,
- easing: 'ease-in'
- };
- }
- me.animate(Ext.applyIf({
- callback: function() {
- if (!visible) {
- me.setVisible(false).setOpacity(1);
- }
- },
- to: {
- opacity: (visible) ? 1 : 0
- }
- }, animate));
- }
- (me.$cache || me.getCache()).data[ISVISIBLE] = visible;
- return me;
- },
-
- hasMetrics : function(){
- var visMode = getVisMode(this);
- return this.isVisible() || (visMode == Element.OFFSETS) || (visMode == Element.VISIBILITY);
- },
-
- toggle : function(animate){
- var me = this;
- me.setVisible(!me.isVisible(), me.anim(animate));
- return me;
- },
-
- setDisplayed : function(value) {
- if(typeof value == "boolean"){
- value = value ? getDisplay(this) : NONE;
- }
- this.setStyle(DISPLAY, value);
- return this;
- },
-
- fixDisplay : function(){
- var me = this;
- if (me.isStyle(DISPLAY, NONE)) {
- me.setStyle(VISIBILITY, HIDDEN);
- me.setStyle(DISPLAY, getDisplay(me));
- if (me.isStyle(DISPLAY, NONE)) {
- me.setStyle(DISPLAY, "block");
- }
- }
- },
-
- hide : function(animate){
-
- if (typeof animate == 'string'){
- this.setVisible(false, animate);
- return this;
- }
- this.setVisible(false, this.anim(animate));
- return this;
- },
-
- show : function(animate){
-
- if (typeof animate == 'string'){
- this.setVisible(true, animate);
- return this;
- }
- this.setVisible(true, this.anim(animate));
- return this;
- }
- });
- }());
- //@tag dom,core
- //@require Ext.dom.Element-fx
- //@define Ext.dom.Element-position
- //@define Ext.dom.Element
- (function() {
- var Element = Ext.dom.Element,
- LEFT = "left",
- RIGHT = "right",
- TOP = "top",
- BOTTOM = "bottom",
- POSITION = "position",
- STATIC = "static",
- RELATIVE = "relative",
- AUTO = "auto",
- ZINDEX = "z-index",
- BODY = 'BODY',
- PADDING = 'padding',
- BORDER = 'border',
- SLEFT = '-left',
- SRIGHT = '-right',
- STOP = '-top',
- SBOTTOM = '-bottom',
- SWIDTH = '-width',
-
- borders = {l: BORDER + SLEFT + SWIDTH, r: BORDER + SRIGHT + SWIDTH, t: BORDER + STOP + SWIDTH, b: BORDER + SBOTTOM + SWIDTH},
- paddings = {l: PADDING + SLEFT, r: PADDING + SRIGHT, t: PADDING + STOP, b: PADDING + SBOTTOM},
- paddingsTLRB = [paddings.l, paddings.r, paddings.t, paddings.b],
- bordersTLRB = [borders.l, borders.r, borders.t, borders.b],
- positionTopLeft = ['position', 'top', 'left'];
- Element.override({
- getX: function() {
- return Element.getX(this.dom);
- },
- getY: function() {
- return Element.getY(this.dom);
- },
-
- getXY: function() {
- return Element.getXY(this.dom);
- },
-
- getOffsetsTo : function(el){
- var o = this.getXY(),
- e = Ext.fly(el, '_internal').getXY();
- return [o[0] - e[0],o[1] - e[1]];
- },
- setX: function(x, animate) {
- return this.setXY([x, this.getY()], animate);
- },
- setY: function(y, animate) {
- return this.setXY([this.getX(), y], animate);
- },
- setLeft: function(left) {
- this.setStyle(LEFT, this.addUnits(left));
- return this;
- },
- setTop: function(top) {
- this.setStyle(TOP, this.addUnits(top));
- return this;
- },
- setRight: function(right) {
- this.setStyle(RIGHT, this.addUnits(right));
- return this;
- },
- setBottom: function(bottom) {
- this.setStyle(BOTTOM, this.addUnits(bottom));
- return this;
- },
-
- setXY: function(pos, animate) {
- var me = this;
- if (!animate || !me.anim) {
- Element.setXY(me.dom, pos);
- }
- else {
- if (!Ext.isObject(animate)) {
- animate = {};
- }
- me.animate(Ext.applyIf({ to: { x: pos[0], y: pos[1] } }, animate));
- }
- return me;
- },
- pxRe: /^\d+(?:\.\d*)?px$/i,
-
- getLocalX: function() {
- var me = this,
- offsetParent,
- x = me.getStyle(LEFT);
- if (!x || x === AUTO) {
- return 0;
- }
- if (x && me.pxRe.test(x)) {
- return parseFloat(x);
- }
- x = me.getX();
- offsetParent = me.dom.offsetParent;
- if (offsetParent) {
- x -= Ext.fly(offsetParent).getX();
- }
- return x;
- },
-
- getLocalY: function() {
- var me = this,
- offsetParent,
- y = me.getStyle(TOP);
- if (!y || y === AUTO) {
- return 0;
- }
- if (y && me.pxRe.test(y)) {
- return parseFloat(y);
- }
- y = me.getY();
- offsetParent = me.dom.offsetParent;
- if (offsetParent) {
- y -= Ext.fly(offsetParent).getY();
- }
- return y;
- },
- getLeft: function(local) {
- return local ? this.getLocalX() : this.getX();
- },
- getRight: function(local) {
- return (local ? this.getLocalX() : this.getX()) + this.getWidth();
- },
- getTop: function(local) {
- return local ? this.getLocalY() : this.getY();
- },
- getBottom: function(local) {
- return (local ? this.getLocalY() : this.getY()) + this.getHeight();
- },
- translatePoints: function(x, y) {
- var me = this,
- styles = me.getStyle(positionTopLeft),
- relative = styles.position == 'relative',
- left = parseFloat(styles.left),
- top = parseFloat(styles.top),
- xy = me.getXY();
- if (Ext.isArray(x)) {
- y = x[1];
- x = x[0];
- }
- if (isNaN(left)) {
- left = relative ? 0 : me.dom.offsetLeft;
- }
- if (isNaN(top)) {
- top = relative ? 0 : me.dom.offsetTop;
- }
- left = (typeof x == 'number') ? x - xy[0] + left : undefined;
- top = (typeof y == 'number') ? y - xy[1] + top : undefined;
- return {
- left: left,
- top: top
- };
- },
- setBox: function(box, adjust, animate) {
- var me = this,
- w = box.width,
- h = box.height;
- if ((adjust && !me.autoBoxAdjust) && !me.isBorderBox()) {
- w -= (me.getBorderWidth("lr") + me.getPadding("lr"));
- h -= (me.getBorderWidth("tb") + me.getPadding("tb"));
- }
- me.setBounds(box.x, box.y, w, h, animate);
- return me;
- },
- getBox: function(contentBox, local) {
- var me = this,
- xy,
- left,
- top,
- paddingWidth,
- bordersWidth,
- l, r, t, b, w, h, bx;
- if (!local) {
- xy = me.getXY();
- } else {
- xy = me.getStyle([LEFT, TOP]);
- xy = [ parseFloat(xy.left) || 0, parseFloat(xy.top) || 0];
- }
- w = me.getWidth();
- h = me.getHeight();
- if (!contentBox) {
- bx = {
- x: xy[0],
- y: xy[1],
- 0: xy[0],
- 1: xy[1],
- width: w,
- height: h
- };
- } else {
- paddingWidth = me.getStyle(paddingsTLRB);
- bordersWidth = me.getStyle(bordersTLRB);
- l = (parseFloat(bordersWidth[borders.l]) || 0) + (parseFloat(paddingWidth[paddings.l]) || 0);
- r = (parseFloat(bordersWidth[borders.r]) || 0) + (parseFloat(paddingWidth[paddings.r]) || 0);
- t = (parseFloat(bordersWidth[borders.t]) || 0) + (parseFloat(paddingWidth[paddings.t]) || 0);
- b = (parseFloat(bordersWidth[borders.b]) || 0) + (parseFloat(paddingWidth[paddings.b]) || 0);
- bx = {
- x: xy[0] + l,
- y: xy[1] + t,
- 0: xy[0] + l,
- 1: xy[1] + t,
- width: w - (l + r),
- height: h - (t + b)
- };
- }
- bx.right = bx.x + bx.width;
- bx.bottom = bx.y + bx.height;
- return bx;
- },
- getPageBox: function(getRegion) {
- var me = this,
- el = me.dom,
- isDoc = el.nodeName == BODY,
- w = isDoc ? Ext.dom.AbstractElement.getViewWidth() : el.offsetWidth,
- h = isDoc ? Ext.dom.AbstractElement.getViewHeight() : el.offsetHeight,
- xy = me.getXY(),
- t = xy[1],
- r = xy[0] + w,
- b = xy[1] + h,
- l = xy[0];
- if (getRegion) {
- return new Ext.util.Region(t, r, b, l);
- }
- else {
- return {
- left: l,
- top: t,
- width: w,
- height: h,
- right: r,
- bottom: b
- };
- }
- },
-
- setLocation : function(x, y, animate) {
- return this.setXY([x, y], animate);
- },
-
- moveTo : function(x, y, animate) {
- return this.setXY([x, y], animate);
- },
-
- position : function(pos, zIndex, x, y) {
- var me = this;
- if (!pos && me.isStyle(POSITION, STATIC)) {
- me.setStyle(POSITION, RELATIVE);
- } else if (pos) {
- me.setStyle(POSITION, pos);
- }
- if (zIndex) {
- me.setStyle(ZINDEX, zIndex);
- }
- if (x || y) {
- me.setXY([x || false, y || false]);
- }
- },
-
- clearPositioning : function(value) {
- value = value || '';
- this.setStyle({
- left : value,
- right : value,
- top : value,
- bottom : value,
- "z-index" : "",
- position : STATIC
- });
- return this;
- },
-
- getPositioning : function(){
- var styles = this.getStyle([LEFT, TOP, POSITION, RIGHT, BOTTOM, ZINDEX]);
- styles[RIGHT] = styles[LEFT] ? '' : styles[RIGHT];
- styles[BOTTOM] = styles[TOP] ? '' : styles[BOTTOM];
- return styles;
- },
-
- setPositioning : function(pc) {
- var me = this,
- style = me.dom.style;
- me.setStyle(pc);
- if (pc.right == AUTO) {
- style.right = "";
- }
- if (pc.bottom == AUTO) {
- style.bottom = "";
- }
- return me;
- },
-
- move: function(direction, distance, animate) {
- var me = this,
- xy = me.getXY(),
- x = xy[0],
- y = xy[1],
- left = [x - distance, y],
- right = [x + distance, y],
- top = [x, y - distance],
- bottom = [x, y + distance],
- hash = {
- l: left,
- left: left,
- r: right,
- right: right,
- t: top,
- top: top,
- up: top,
- b: bottom,
- bottom: bottom,
- down: bottom
- };
- direction = direction.toLowerCase();
- me.moveTo(hash[direction][0], hash[direction][1], animate);
- },
-
- setLeftTop: function(left, top) {
- var style = this.dom.style;
- style.left = Element.addUnits(left);
- style.top = Element.addUnits(top);
- return this;
- },
-
- getRegion: function() {
- return this.getPageBox(true);
- },
-
- getViewRegion: function() {
- var me = this,
- isBody = me.dom.nodeName == BODY,
- scroll, pos, top, left, width, height;
-
- if (isBody) {
- scroll = me.getScroll();
- left = scroll.left;
- top = scroll.top;
- width = Ext.dom.AbstractElement.getViewportWidth();
- height = Ext.dom.AbstractElement.getViewportHeight();
- }
- else {
- pos = me.getXY();
- left = pos[0] + me.getBorderWidth('l') + me.getPadding('l');
- top = pos[1] + me.getBorderWidth('t') + me.getPadding('t');
- width = me.getWidth(true);
- height = me.getHeight(true);
- }
- return new Ext.util.Region(top, left + width - 1, top + height - 1, left);
- },
-
- setBounds: function(x, y, width, height, animate) {
- var me = this;
- if (!animate || !me.anim) {
- me.setSize(width, height);
- me.setLocation(x, y);
- } else {
- if (!Ext.isObject(animate)) {
- animate = {};
- }
- me.animate(Ext.applyIf({
- to: {
- x: x,
- y: y,
- width: me.adjustWidth(width),
- height: me.adjustHeight(height)
- }
- }, animate));
- }
- return me;
- },
-
- setRegion: function(region, animate) {
- return this.setBounds(region.left, region.top, region.right - region.left, region.bottom - region.top, animate);
- }
- });
- }());
- //@tag dom,core
- //@require Ext.dom.Element-position
- //@define Ext.dom.Element-scroll
- //@define Ext.dom.Element
- Ext.dom.Element.override({
-
- isScrollable: function() {
- var dom = this.dom;
- return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;
- },
-
- getScroll: function() {
- var d = this.dom,
- doc = document,
- body = doc.body,
- docElement = doc.documentElement,
- l,
- t,
- ret;
- if (d == doc || d == body) {
- if (Ext.isIE && Ext.isStrict) {
- l = docElement.scrollLeft;
- t = docElement.scrollTop;
- } else {
- l = window.pageXOffset;
- t = window.pageYOffset;
- }
- ret = {
- left: l || (body ? body.scrollLeft : 0),
- top : t || (body ? body.scrollTop : 0)
- };
- } else {
- ret = {
- left: d.scrollLeft,
- top : d.scrollTop
- };
- }
- return ret;
- },
-
- scrollBy: function(deltaX, deltaY, animate) {
- var me = this,
- dom = me.dom;
-
- if (deltaX.length) {
- animate = deltaY;
- deltaY = deltaX[1];
- deltaX = deltaX[0];
- } else if (typeof deltaX != 'number') {
- animate = deltaY;
- deltaY = deltaX.y;
- deltaX = deltaX.x;
- }
- if (deltaX) {
- me.scrollTo('left', Math.max(Math.min(dom.scrollLeft + deltaX, dom.scrollWidth - dom.clientWidth), 0), animate);
- }
- if (deltaY) {
- me.scrollTo('top', Math.max(Math.min(dom.scrollTop + deltaY, dom.scrollHeight - dom.clientHeight), 0), animate);
- }
- return me;
- },
-
- scrollTo: function(side, value, animate) {
-
- var top = /top/i.test(side),
- me = this,
- dom = me.dom,
- animCfg,
- prop;
- if (!animate || !me.anim) {
-
- prop = 'scroll' + (top ? 'Top' : 'Left');
- dom[prop] = value;
-
- dom[prop] = value;
- }
- else {
- animCfg = {
- to: {}
- };
- animCfg.to['scroll' + (top ? 'Top' : 'Left')] = value;
- if (Ext.isObject(animate)) {
- Ext.applyIf(animCfg, animate);
- }
- me.animate(animCfg);
- }
- return me;
- },
-
- scrollIntoView: function(container, hscroll, animate) {
- container = Ext.getDom(container) || Ext.getBody().dom;
- var el = this.dom,
- offsets = this.getOffsetsTo(container),
-
- left = offsets[0] + container.scrollLeft,
- top = offsets[1] + container.scrollTop,
- bottom = top + el.offsetHeight,
- right = left + el.offsetWidth,
-
- ctClientHeight = container.clientHeight,
- ctScrollTop = parseInt(container.scrollTop, 10),
- ctScrollLeft = parseInt(container.scrollLeft, 10),
- ctBottom = ctScrollTop + ctClientHeight,
- ctRight = ctScrollLeft + container.clientWidth,
- newPos;
- if (el.offsetHeight > ctClientHeight || top < ctScrollTop) {
- newPos = top;
- } else if (bottom > ctBottom) {
- newPos = bottom - ctClientHeight;
- }
- if (newPos != null) {
- Ext.get(container).scrollTo('top', newPos, animate);
- }
- if (hscroll !== false) {
- newPos = null;
- if (el.offsetWidth > container.clientWidth || left < ctScrollLeft) {
- newPos = left;
- } else if (right > ctRight) {
- newPos = right - container.clientWidth;
- }
- if (newPos != null) {
- Ext.get(container).scrollTo('left', newPos, animate);
- }
- }
- return this;
- },
-
- scrollChildIntoView: function(child, hscroll) {
- Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);
- },
-
- scroll: function(direction, distance, animate) {
- if (!this.isScrollable()) {
- return false;
- }
- var el = this.dom,
- l = el.scrollLeft, t = el.scrollTop,
- w = el.scrollWidth, h = el.scrollHeight,
- cw = el.clientWidth, ch = el.clientHeight,
- scrolled = false, v,
- hash = {
- l: Math.min(l + distance, w - cw),
- r: v = Math.max(l - distance, 0),
- t: Math.max(t - distance, 0),
- b: Math.min(t + distance, h - ch)
- };
- hash.d = hash.b;
- hash.u = hash.t;
- direction = direction.substr(0, 1);
- if ((v = hash[direction]) > -1) {
- scrolled = true;
- this.scrollTo(direction == 'l' || direction == 'r' ? 'left' : 'top', v, this.anim(animate));
- }
- return scrolled;
- }
- });
- //@tag dom,core
- //@require Ext.dom.Element-scroll
- //@define Ext.dom.Element-style
- //@define Ext.dom.Element
- (function() {
- var Element = Ext.dom.Element,
- view = document.defaultView,
- adjustDirect2DTableRe = /table-row|table-.*-group/,
- INTERNAL = '_internal',
- HIDDEN = 'hidden',
- HEIGHT = 'height',
- WIDTH = 'width',
- ISCLIPPED = 'isClipped',
- OVERFLOW = 'overflow',
- OVERFLOWX = 'overflow-x',
- OVERFLOWY = 'overflow-y',
- ORIGINALCLIP = 'originalClip',
- DOCORBODYRE = /#document|body/i,
-
-
- styleHooks,
- edges, k, edge, borderWidth;
- if (!view || !view.getComputedStyle) {
- Element.prototype.getStyle = function (property, inline) {
- var me = this,
- dom = me.dom,
- multiple = typeof property != 'string',
- hooks = me.styleHooks,
- prop = property,
- props = prop,
- len = 1,
- isInline = inline,
- camel, domStyle, values, hook, out, style, i;
- if (multiple) {
- values = {};
- prop = props[0];
- i = 0;
- if (!(len = props.length)) {
- return values;
- }
- }
- if (!dom || dom.documentElement) {
- return values || '';
- }
- domStyle = dom.style;
- if (inline) {
- style = domStyle;
- } else {
- style = dom.currentStyle;
-
- if (!style) {
- isInline = true;
- style = domStyle;
- }
- }
- do {
- hook = hooks[prop];
- if (!hook) {
- hooks[prop] = hook = { name: Element.normalize(prop) };
- }
- if (hook.get) {
- out = hook.get(dom, me, isInline, style);
- } else {
- camel = hook.name;
-
-
-
-
- if (hook.canThrow) {
- try {
- out = style[camel];
- } catch (e) {
- out = '';
- }
- } else {
-
-
- out = style ? style[camel] : '';
- }
- }
- if (!multiple) {
- return out;
- }
- values[prop] = out;
- prop = props[++i];
- } while (i < len);
- return values;
- };
- }
- Element.override({
- getHeight: function(contentHeight, preciseHeight) {
- var me = this,
- dom = me.dom,
- hidden = me.isStyle('display', 'none'),
- height,
- floating;
- if (hidden) {
- return 0;
- }
- height = Math.max(dom.offsetHeight, dom.clientHeight) || 0;
-
- if (Ext.supports.Direct2DBug) {
- floating = me.adjustDirect2DDimension(HEIGHT);
- if (preciseHeight) {
- height += floating;
- }
- else if (floating > 0 && floating < 0.5) {
- height++;
- }
- }
- if (contentHeight) {
- height -= me.getBorderWidth("tb") + me.getPadding("tb");
- }
- return (height < 0) ? 0 : height;
- },
- getWidth: function(contentWidth, preciseWidth) {
- var me = this,
- dom = me.dom,
- hidden = me.isStyle('display', 'none'),
- rect, width, floating;
- if (hidden) {
- return 0;
- }
-
-
-
-
-
-
- if (Ext.supports.BoundingClientRect) {
- rect = dom.getBoundingClientRect();
- width = rect.right - rect.left;
- width = preciseWidth ? width : Math.ceil(width);
- } else {
- width = dom.offsetWidth;
- }
- width = Math.max(width, dom.clientWidth) || 0;
-
- if (Ext.supports.Direct2DBug) {
-
- floating = me.adjustDirect2DDimension(WIDTH);
- if (preciseWidth) {
- width += floating;
- }
-
-
-
- else if (floating > 0 && floating < 0.5) {
- width++;
- }
- }
- if (contentWidth) {
- width -= me.getBorderWidth("lr") + me.getPadding("lr");
- }
- return (width < 0) ? 0 : width;
- },
- setWidth: function(width, animate) {
- var me = this;
- width = me.adjustWidth(width);
- if (!animate || !me.anim) {
- me.dom.style.width = me.addUnits(width);
- }
- else {
- if (!Ext.isObject(animate)) {
- animate = {};
- }
- me.animate(Ext.applyIf({
- to: {
- width: width
- }
- }, animate));
- }
- return me;
- },
- setHeight : function(height, animate) {
- var me = this;
- height = me.adjustHeight(height);
- if (!animate || !me.anim) {
- me.dom.style.height = me.addUnits(height);
- }
- else {
- if (!Ext.isObject(animate)) {
- animate = {};
- }
- me.animate(Ext.applyIf({
- to: {
- height: height
- }
- }, animate));
- }
- return me;
- },
- applyStyles: function(style) {
- Ext.DomHelper.applyStyles(this.dom, style);
- return this;
- },
- setSize: function(width, height, animate) {
- var me = this;
- if (Ext.isObject(width)) {
- animate = height;
- height = width.height;
- width = width.width;
- }
- width = me.adjustWidth(width);
- height = me.adjustHeight(height);
- if (!animate || !me.anim) {
- me.dom.style.width = me.addUnits(width);
- me.dom.style.height = me.addUnits(height);
- }
- else {
- if (animate === true) {
- animate = {};
- }
- me.animate(Ext.applyIf({
- to: {
- width: width,
- height: height
- }
- }, animate));
- }
- return me;
- },
- getViewSize : function() {
- var me = this,
- dom = me.dom,
- isDoc = DOCORBODYRE.test(dom.nodeName),
- ret;
-
- if (isDoc) {
- ret = {
- width : Element.getViewWidth(),
- height : Element.getViewHeight()
- };
- } else {
- ret = {
- width : dom.clientWidth,
- height : dom.clientHeight
- };
- }
- return ret;
- },
- getSize: function(contentSize) {
- return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};
- },
-
-
- adjustWidth : function(width) {
- var me = this,
- isNum = (typeof width == 'number');
- if (isNum && me.autoBoxAdjust && !me.isBorderBox()) {
- width -= (me.getBorderWidth("lr") + me.getPadding("lr"));
- }
- return (isNum && width < 0) ? 0 : width;
- },
-
- adjustHeight : function(height) {
- var me = this,
- isNum = (typeof height == "number");
- if (isNum && me.autoBoxAdjust && !me.isBorderBox()) {
- height -= (me.getBorderWidth("tb") + me.getPadding("tb"));
- }
- return (isNum && height < 0) ? 0 : height;
- },
-
- getColor : function(attr, defaultValue, prefix) {
- var v = this.getStyle(attr),
- color = prefix || prefix === '' ? prefix : '#',
- h, len, i=0;
- if (!v || (/transparent|inherit/.test(v))) {
- return defaultValue;
- }
- if (/^r/.test(v)) {
- v = v.slice(4, v.length - 1).split(',');
- len = v.length;
- for (; i<len; i++) {
- h = parseInt(v[i], 10);
- color += (h < 16 ? '0' : '') + h.toString(16);
- }
- } else {
- v = v.replace('#', '');
- color += v.length == 3 ? v.replace(/^(\w)(\w)(\w)$/, '$1$1$2$2$3$3') : v;
- }
- return(color.length > 5 ? color.toLowerCase() : defaultValue);
- },
-
- setOpacity: function(opacity, animate) {
- var me = this;
- if (!me.dom) {
- return me;
- }
- if (!animate || !me.anim) {
- me.setStyle('opacity', opacity);
- }
- else {
- if (typeof animate != 'object') {
- animate = {
- duration: 350,
- easing: 'ease-in'
- };
- }
- me.animate(Ext.applyIf({
- to: {
- opacity: opacity
- }
- }, animate));
- }
- return me;
- },
-
- clearOpacity : function() {
- return this.setOpacity('');
- },
-
- adjustDirect2DDimension: function(dimension) {
- var me = this,
- dom = me.dom,
- display = me.getStyle('display'),
- inlineDisplay = dom.style.display,
- inlinePosition = dom.style.position,
- originIndex = dimension === WIDTH ? 0 : 1,
- currentStyle = dom.currentStyle,
- floating;
- if (display === 'inline') {
- dom.style.display = 'inline-block';
- }
- dom.style.position = display.match(adjustDirect2DTableRe) ? 'absolute' : 'static';
-
-
-
-
-
- floating = (parseFloat(currentStyle[dimension]) || parseFloat(currentStyle.msTransformOrigin.split(' ')[originIndex]) * 2) % 1;
- dom.style.position = inlinePosition;
- if (display === 'inline') {
- dom.style.display = inlineDisplay;
- }
- return floating;
- },
-
- clip : function() {
- var me = this,
- data = (me.$cache || me.getCache()).data,
- style;
- if (!data[ISCLIPPED]) {
- data[ISCLIPPED] = true;
- style = me.getStyle([OVERFLOW, OVERFLOWX, OVERFLOWY]);
- data[ORIGINALCLIP] = {
- o: style[OVERFLOW],
- x: style[OVERFLOWX],
- y: style[OVERFLOWY]
- };
- me.setStyle(OVERFLOW, HIDDEN);
- me.setStyle(OVERFLOWX, HIDDEN);
- me.setStyle(OVERFLOWY, HIDDEN);
- }
- return me;
- },
-
- unclip : function() {
- var me = this,
- data = (me.$cache || me.getCache()).data,
- clip;
- if (data[ISCLIPPED]) {
- data[ISCLIPPED] = false;
- clip = data[ORIGINALCLIP];
- if (clip.o) {
- me.setStyle(OVERFLOW, clip.o);
- }
- if (clip.x) {
- me.setStyle(OVERFLOWX, clip.x);
- }
- if (clip.y) {
- me.setStyle(OVERFLOWY, clip.y);
- }
- }
- return me;
- },
-
- boxWrap : function(cls) {
- cls = cls || Ext.baseCSSPrefix + 'box';
- var el = Ext.get(this.insertHtml("beforeBegin", "<div class='" + cls + "'>" + Ext.String.format(Element.boxMarkup, cls) + "</div>"));
- Ext.DomQuery.selectNode('.' + cls + '-mc', el.dom).appendChild(this.dom);
- return el;
- },
-
- getComputedHeight : function() {
- var me = this,
- h = Math.max(me.dom.offsetHeight, me.dom.clientHeight);
- if (!h) {
- h = parseFloat(me.getStyle(HEIGHT)) || 0;
- if (!me.isBorderBox()) {
- h += me.getFrameWidth('tb');
- }
- }
- return h;
- },
-
- getComputedWidth : function() {
- var me = this,
- w = Math.max(me.dom.offsetWidth, me.dom.clientWidth);
- if (!w) {
- w = parseFloat(me.getStyle(WIDTH)) || 0;
- if (!me.isBorderBox()) {
- w += me.getFrameWidth('lr');
- }
- }
- return w;
- },
-
- getFrameWidth : function(sides, onlyContentBox) {
- return (onlyContentBox && this.isBorderBox()) ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));
- },
-
- addClsOnOver : function(className, testFn, scope) {
- var me = this,
- dom = me.dom,
- hasTest = Ext.isFunction(testFn);
-
- me.hover(
- function() {
- if (hasTest && testFn.call(scope || me, me) === false) {
- return;
- }
- Ext.fly(dom, INTERNAL).addCls(className);
- },
- function() {
- Ext.fly(dom, INTERNAL).removeCls(className);
- }
- );
- return me;
- },
-
- addClsOnFocus : function(className, testFn, scope) {
- var me = this,
- dom = me.dom,
- hasTest = Ext.isFunction(testFn);
-
- me.on("focus", function() {
- if (hasTest && testFn.call(scope || me, me) === false) {
- return false;
- }
- Ext.fly(dom, INTERNAL).addCls(className);
- });
- me.on("blur", function() {
- Ext.fly(dom, INTERNAL).removeCls(className);
- });
- return me;
- },
-
- addClsOnClick : function(className, testFn, scope) {
- var me = this,
- dom = me.dom,
- hasTest = Ext.isFunction(testFn);
-
- me.on("mousedown", function() {
- if (hasTest && testFn.call(scope || me, me) === false) {
- return false;
- }
- Ext.fly(dom, INTERNAL).addCls(className);
- var d = Ext.getDoc(),
- fn = function() {
- Ext.fly(dom, INTERNAL).removeCls(className);
- d.removeListener("mouseup", fn);
- };
- d.on("mouseup", fn);
- });
- return me;
- },
-
- getStyleSize : function() {
- var me = this,
- d = this.dom,
- isDoc = DOCORBODYRE.test(d.nodeName),
- s ,
- w, h;
-
- if (isDoc) {
- return {
- width : Element.getViewWidth(),
- height : Element.getViewHeight()
- };
- }
- s = me.getStyle([HEIGHT, WIDTH], true);
-
- if (s.width && s.width != 'auto') {
- w = parseFloat(s.width);
- if (me.isBorderBox()) {
- w -= me.getFrameWidth('lr');
- }
- }
-
- if (s.height && s.height != 'auto') {
- h = parseFloat(s.height);
- if (me.isBorderBox()) {
- h -= me.getFrameWidth('tb');
- }
- }
-
- return {width: w || me.getWidth(true), height: h || me.getHeight(true)};
- },
-
- selectable : function() {
- var me = this;
- me.dom.unselectable = "off";
-
- me.on('selectstart', function (e) {
- e.stopPropagation();
- return true;
- });
- me.applyStyles("-moz-user-select: text; -khtml-user-select: text;");
- me.removeCls(Ext.baseCSSPrefix + 'unselectable');
- return me;
- },
-
- unselectable : function() {
- var me = this;
- me.dom.unselectable = "on";
- me.swallowEvent("selectstart", true);
- me.applyStyles("-moz-user-select:-moz-none;-khtml-user-select:none;");
- me.addCls(Ext.baseCSSPrefix + 'unselectable');
- return me;
- }
- });
- Element.prototype.styleHooks = styleHooks = Ext.dom.AbstractElement.prototype.styleHooks;
- if (Ext.isIE6 || Ext.isIE7) {
- styleHooks.fontSize = styleHooks['font-size'] = {
- name: 'fontSize',
- canThrow: true
- };
-
- styleHooks.fontStyle = styleHooks['font-style'] = {
- name: 'fontStyle',
- canThrow: true
- };
-
- styleHooks.fontFamily = styleHooks['font-family'] = {
- name: 'fontFamily',
- canThrow: true
- };
- }
- if (Ext.isIEQuirks || Ext.isIE && Ext.ieVersion <= 8) {
- function getBorderWidth (dom, el, inline, style) {
- if (style[this.styleName] == 'none') {
- return '0px';
- }
- return style[this.name];
- }
- edges = ['Top','Right','Bottom','Left'];
- k = edges.length;
- while (k--) {
- edge = edges[k];
- borderWidth = 'border' + edge + 'Width';
- styleHooks['border-'+edge.toLowerCase()+'-width'] = styleHooks[borderWidth] = {
- name: borderWidth,
- styleName: 'border' + edge + 'Style',
- get: getBorderWidth
- };
- }
- }
- }());
- Ext.onReady(function () {
- var opacityRe = /alpha\(opacity=(.*)\)/i,
- trimRe = /^\s+|\s+$/g,
- hooks = Ext.dom.Element.prototype.styleHooks;
-
- hooks.opacity = {
- name: 'opacity',
- afterSet: function(dom, value, el) {
- if (el.isLayer) {
- el.onOpacitySet(value);
- }
- }
- };
- if (!Ext.supports.Opacity && Ext.isIE) {
- Ext.apply(hooks.opacity, {
- get: function (dom) {
- var filter = dom.style.filter,
- match, opacity;
- if (filter.match) {
- match = filter.match(opacityRe);
- if (match) {
- opacity = parseFloat(match[1]);
- if (!isNaN(opacity)) {
- return opacity ? opacity / 100 : 0;
- }
- }
- }
- return 1;
- },
- set: function (dom, value) {
- var style = dom.style,
- val = style.filter.replace(opacityRe, '').replace(trimRe, '');
- style.zoom = 1;
-
- if (typeof(value) == 'number' && value >= 0 && value < 1) {
- value *= 100;
- style.filter = val + (val.length ? ' ' : '') + 'alpha(opacity='+value+')';
- } else {
- style.filter = val;
- }
- }
- });
- }
-
-
- });
- //@tag dom,core
- //@require Ext.dom.Element-style
- //@define Ext.dom.Element-traversal
- //@define Ext.dom.Element
- Ext.dom.Element.override({
- select: function(selector) {
- return Ext.dom.Element.select(selector, false, this.dom);
- }
- });
- //@tag dom,core
- //@require Ext.dom.Element-traversal
- Ext.define('Ext.dom.CompositeElementLite', {
- alternateClassName: 'Ext.CompositeElementLite',
- requires: ['Ext.dom.Element', 'Ext.dom.Query'],
- statics: {
-
- importElementMethods: function() {
- var name,
- elementPrototype = Ext.dom.Element.prototype,
- prototype = this.prototype;
- for (name in elementPrototype) {
- if (typeof elementPrototype[name] == 'function'){
- (function(key) {
- prototype[key] = prototype[key] || function() {
- return this.invoke(key, arguments);
- };
- }).call(prototype, name);
- }
- }
- }
- },
- constructor: function(elements, root) {
-
- this.elements = [];
- this.add(elements, root);
- this.el = new Ext.dom.AbstractElement.Fly();
- },
-
- isComposite: true,
-
- getElement: function(el) {
-
- return this.el.attach(el);
- },
-
- transformElement: function(el) {
- return Ext.getDom(el);
- },
-
- getCount: function() {
- return this.elements.length;
- },
-
- add: function(els, root) {
- var elements = this.elements,
- i, ln;
- if (!els) {
- return this;
- }
- if (typeof els == "string") {
- els = Ext.dom.Element.selectorFunction(els, root);
- }
- else if (els.isComposite) {
- els = els.elements;
- }
- else if (!Ext.isIterable(els)) {
- els = [els];
- }
- for (i = 0, ln = els.length; i < ln; ++i) {
- elements.push(this.transformElement(els[i]));
- }
- return this;
- },
- invoke: function(fn, args) {
- var elements = this.elements,
- ln = elements.length,
- element,
- i;
- fn = Ext.dom.Element.prototype[fn];
- for (i = 0; i < ln; i++) {
- element = elements[i];
- if (element) {
- fn.apply(this.getElement(element), args);
- }
- }
- return this;
- },
-
- item: function(index) {
- var el = this.elements[index],
- out = null;
- if (el) {
- out = this.getElement(el);
- }
- return out;
- },
-
- addListener: function(eventName, handler, scope, opt) {
- var els = this.elements,
- len = els.length,
- i, e;
- for (i = 0; i < len; i++) {
- e = els[i];
- if (e) {
- Ext.EventManager.on(e, eventName, handler, scope || e, opt);
- }
- }
- return this;
- },
-
- each: function(fn, scope) {
- var me = this,
- els = me.elements,
- len = els.length,
- i, e;
- for (i = 0; i < len; i++) {
- e = els[i];
- if (e) {
- e = this.getElement(e);
- if (fn.call(scope || e, e, me, i) === false) {
- break;
- }
- }
- }
- return me;
- },
-
- fill: function(els) {
- var me = this;
- me.elements = [];
- me.add(els);
- return me;
- },
-
- filter: function(selector) {
- var me = this,
- els = me.elements,
- len = els.length,
- out = [],
- i = 0,
- isFunc = typeof selector == 'function',
- add,
- el;
- for (; i < len; i++) {
- el = els[i];
- add = false;
- if (el) {
- el = me.getElement(el);
- if (isFunc) {
- add = selector.call(el, el, me, i) !== false;
- } else {
- add = el.is(selector);
- }
-
- if (add) {
- out.push(me.transformElement(el));
- }
- }
- }
- me.elements = out;
- return me;
- },
-
- indexOf: function(el) {
- return Ext.Array.indexOf(this.elements, this.transformElement(el));
- },
-
- replaceElement: function(el, replacement, domReplace) {
- var index = !isNaN(el) ? el : this.indexOf(el),
- d;
- if (index > -1) {
- replacement = Ext.getDom(replacement);
- if (domReplace) {
- d = this.elements[index];
- d.parentNode.insertBefore(replacement, d);
- Ext.removeNode(d);
- }
- Ext.Array.splice(this.elements, index, 1, replacement);
- }
- return this;
- },
-
- clear: function() {
- this.elements = [];
- },
- addElements: function(els, root) {
- if (!els) {
- return this;
- }
- if (typeof els == "string") {
- els = Ext.dom.Element.selectorFunction(els, root);
- }
- var yels = this.elements,
- eLen = els.length,
- e;
- for (e = 0; e < eLen; e++) {
- yels.push(Ext.get(els[e]));
- }
- return this;
- },
-
- first: function() {
- return this.item(0);
- },
-
- last: function() {
- return this.item(this.getCount() - 1);
- },
-
- contains: function(el) {
- return this.indexOf(el) != -1;
- },
-
- removeElement: function(keys, removeDom) {
- keys = [].concat(keys);
- var me = this,
- elements = me.elements,
- kLen = keys.length,
- val, el, k;
- for (k = 0; k < kLen; k++) {
- val = keys[k];
- if ((el = (elements[val] || elements[val = me.indexOf(val)]))) {
- if (removeDom) {
- if (el.dom) {
- el.remove();
- } else {
- Ext.removeNode(el);
- }
- }
- Ext.Array.erase(elements, val, 1);
- }
- }
- return me;
- }
- }, function() {
- this.importElementMethods();
- this.prototype.on = this.prototype.addListener;
- if (Ext.DomQuery){
- Ext.dom.Element.selectorFunction = Ext.DomQuery.select;
- }
-
- Ext.dom.Element.select = function(selector, root) {
- var elements;
- if (typeof selector == "string") {
- elements = Ext.dom.Element.selectorFunction(selector, root);
- }
- else if (selector.length !== undefined) {
- elements = selector;
- }
- else {
- }
- return new Ext.CompositeElementLite(elements);
- };
-
- Ext.select = function() {
- return Ext.dom.Element.select.apply(Ext.dom.Element, arguments);
- };
- });
- //@tag dom,core
- Ext.define('Ext.dom.CompositeElement', {
- alternateClassName: 'Ext.CompositeElement',
- extend: 'Ext.dom.CompositeElementLite',
-
- getElement: function(el) {
-
- return el;
- },
-
- transformElement: function(el) {
- return Ext.get(el);
- }
- }, function() {
-
- Ext.dom.Element.select = function(selector, unique, root) {
- var elements;
- if (typeof selector == "string") {
- elements = Ext.dom.Element.selectorFunction(selector, root);
- }
- else if (selector.length !== undefined) {
- elements = selector;
- }
- else {
- }
- return (unique === true) ? new Ext.CompositeElement(elements) : new Ext.CompositeElementLite(elements);
- };
- });
- Ext.select = Ext.Element.select;
|