ext-core-debug.js 475 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038
  1. /*
  2. Ext JS 4.1 - JavaScript Library
  3. Copyright (c) 2006-2012, Sencha Inc.
  4. All rights reserved.
  5. licensing@sencha.com
  6. http://www.sencha.com/license
  7. Open Source License
  8. ------------------------------------------------------------------------------------------
  9. This version of Ext JS is licensed under the terms of the Open Source GPL 3.0 license.
  10. http://www.gnu.org/licenses/gpl.html
  11. There are several FLOSS exceptions available for use with this release for
  12. open source applications that are distributed under a license other than GPL.
  13. * Open Source License Exception for Applications
  14. http://www.sencha.com/products/floss-exception.php
  15. * Open Source License Exception for Development
  16. http://www.sencha.com/products/ux-exception.php
  17. Alternate Licensing
  18. ------------------------------------------------------------------------------------------
  19. Commercial and OEM Licenses are available for an alternate download of Ext JS.
  20. This is the appropriate option if you are creating proprietary applications and you are
  21. not prepared to distribute and share the source code of your application under the
  22. GPL v3 license. Please visit http://www.sencha.com/license for more details.
  23. --
  24. 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.
  25. */
  26. //@tag foundation,core
  27. var Ext = Ext || {};
  28. Ext._startTime = new Date().getTime();
  29. (function() {
  30. var global = this,
  31. objectPrototype = Object.prototype,
  32. toString = objectPrototype.toString,
  33. enumerables = true,
  34. enumerablesTest = { toString: 1 },
  35. emptyFn = function () {},
  36. callOverrideParent = function () {
  37. var method = callOverrideParent.caller.caller;
  38. return method.$owner.prototype[method.$name].apply(this, arguments);
  39. },
  40. i;
  41. Ext.global = global;
  42. for (i in enumerablesTest) {
  43. enumerables = null;
  44. }
  45. if (enumerables) {
  46. enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable',
  47. 'toLocaleString', 'toString', 'constructor'];
  48. }
  49. Ext.enumerables = enumerables;
  50. Ext.apply = function(object, config, defaults) {
  51. if (defaults) {
  52. Ext.apply(object, defaults);
  53. }
  54. if (object && config && typeof config === 'object') {
  55. var i, j, k;
  56. for (i in config) {
  57. object[i] = config[i];
  58. }
  59. if (enumerables) {
  60. for (j = enumerables.length; j--;) {
  61. k = enumerables[j];
  62. if (config.hasOwnProperty(k)) {
  63. object[k] = config[k];
  64. }
  65. }
  66. }
  67. }
  68. return object;
  69. };
  70. Ext.buildSettings = Ext.apply({
  71. baseCSSPrefix: 'x-',
  72. scopeResetCSS: false
  73. }, Ext.buildSettings || {});
  74. Ext.apply(Ext, {
  75. name: Ext.sandboxName || 'Ext',
  76. emptyFn: emptyFn,
  77. emptyString: new String(),
  78. baseCSSPrefix: Ext.buildSettings.baseCSSPrefix,
  79. applyIf: function(object, config) {
  80. var property;
  81. if (object) {
  82. for (property in config) {
  83. if (object[property] === undefined) {
  84. object[property] = config[property];
  85. }
  86. }
  87. }
  88. return object;
  89. },
  90. iterate: function(object, fn, scope) {
  91. if (Ext.isEmpty(object)) {
  92. return;
  93. }
  94. if (scope === undefined) {
  95. scope = object;
  96. }
  97. if (Ext.isIterable(object)) {
  98. Ext.Array.each.call(Ext.Array, object, fn, scope);
  99. }
  100. else {
  101. Ext.Object.each.call(Ext.Object, object, fn, scope);
  102. }
  103. }
  104. });
  105. Ext.apply(Ext, {
  106. extend: (function() {
  107. var objectConstructor = objectPrototype.constructor,
  108. inlineOverrides = function(o) {
  109. for (var m in o) {
  110. if (!o.hasOwnProperty(m)) {
  111. continue;
  112. }
  113. this[m] = o[m];
  114. }
  115. };
  116. return function(subclass, superclass, overrides) {
  117. if (Ext.isObject(superclass)) {
  118. overrides = superclass;
  119. superclass = subclass;
  120. subclass = overrides.constructor !== objectConstructor ? overrides.constructor : function() {
  121. superclass.apply(this, arguments);
  122. };
  123. }
  124. var F = function() {},
  125. subclassProto, superclassProto = superclass.prototype;
  126. F.prototype = superclassProto;
  127. subclassProto = subclass.prototype = new F();
  128. subclassProto.constructor = subclass;
  129. subclass.superclass = superclassProto;
  130. if (superclassProto.constructor === objectConstructor) {
  131. superclassProto.constructor = superclass;
  132. }
  133. subclass.override = function(overrides) {
  134. Ext.override(subclass, overrides);
  135. };
  136. subclassProto.override = inlineOverrides;
  137. subclassProto.proto = subclassProto;
  138. subclass.override(overrides);
  139. subclass.extend = function(o) {
  140. return Ext.extend(subclass, o);
  141. };
  142. return subclass;
  143. };
  144. }()),
  145. override: function (target, overrides) {
  146. if (target.$isClass) {
  147. target.override(overrides);
  148. } else if (typeof target == 'function') {
  149. Ext.apply(target.prototype, overrides);
  150. } else {
  151. var owner = target.self,
  152. name, value;
  153. if (owner && owner.$isClass) {
  154. for (name in overrides) {
  155. if (overrides.hasOwnProperty(name)) {
  156. value = overrides[name];
  157. if (typeof value == 'function') {
  158. value.$name = name;
  159. value.$owner = owner;
  160. value.$previous = target.hasOwnProperty(name)
  161. ? target[name]
  162. : callOverrideParent;
  163. }
  164. target[name] = value;
  165. }
  166. }
  167. } else {
  168. Ext.apply(target, overrides);
  169. }
  170. }
  171. return target;
  172. }
  173. });
  174. Ext.apply(Ext, {
  175. valueFrom: function(value, defaultValue, allowBlank){
  176. return Ext.isEmpty(value, allowBlank) ? defaultValue : value;
  177. },
  178. typeOf: function(value) {
  179. var type,
  180. typeToString;
  181. if (value === null) {
  182. return 'null';
  183. }
  184. type = typeof value;
  185. if (type === 'undefined' || type === 'string' || type === 'number' || type === 'boolean') {
  186. return type;
  187. }
  188. typeToString = toString.call(value);
  189. switch(typeToString) {
  190. case '[object Array]':
  191. return 'array';
  192. case '[object Date]':
  193. return 'date';
  194. case '[object Boolean]':
  195. return 'boolean';
  196. case '[object Number]':
  197. return 'number';
  198. case '[object RegExp]':
  199. return 'regexp';
  200. }
  201. if (type === 'function') {
  202. return 'function';
  203. }
  204. if (type === 'object') {
  205. if (value.nodeType !== undefined) {
  206. if (value.nodeType === 3) {
  207. return (/\S/).test(value.nodeValue) ? 'textnode' : 'whitespace';
  208. }
  209. else {
  210. return 'element';
  211. }
  212. }
  213. return 'object';
  214. }
  215. },
  216. isEmpty: function(value, allowEmptyString) {
  217. return (value === null) || (value === undefined) || (!allowEmptyString ? value === '' : false) || (Ext.isArray(value) && value.length === 0);
  218. },
  219. isArray: ('isArray' in Array) ? Array.isArray : function(value) {
  220. return toString.call(value) === '[object Array]';
  221. },
  222. isDate: function(value) {
  223. return toString.call(value) === '[object Date]';
  224. },
  225. isObject: (toString.call(null) === '[object Object]') ?
  226. function(value) {
  227. return value !== null && value !== undefined && toString.call(value) === '[object Object]' && value.ownerDocument === undefined;
  228. } :
  229. function(value) {
  230. return toString.call(value) === '[object Object]';
  231. },
  232. isSimpleObject: function(value) {
  233. return value instanceof Object && value.constructor === Object;
  234. },
  235. isPrimitive: function(value) {
  236. var type = typeof value;
  237. return type === 'string' || type === 'number' || type === 'boolean';
  238. },
  239. isFunction:
  240. (typeof document !== 'undefined' && typeof document.getElementsByTagName('body') === 'function') ? function(value) {
  241. return toString.call(value) === '[object Function]';
  242. } : function(value) {
  243. return typeof value === 'function';
  244. },
  245. isNumber: function(value) {
  246. return typeof value === 'number' && isFinite(value);
  247. },
  248. isNumeric: function(value) {
  249. return !isNaN(parseFloat(value)) && isFinite(value);
  250. },
  251. isString: function(value) {
  252. return typeof value === 'string';
  253. },
  254. isBoolean: function(value) {
  255. return typeof value === 'boolean';
  256. },
  257. isElement: function(value) {
  258. return value ? value.nodeType === 1 : false;
  259. },
  260. isTextNode: function(value) {
  261. return value ? value.nodeName === "#text" : false;
  262. },
  263. isDefined: function(value) {
  264. return typeof value !== 'undefined';
  265. },
  266. isIterable: function(value) {
  267. var type = typeof value,
  268. checkLength = false;
  269. if (value && type != 'string') {
  270. if (type == 'function') {
  271. if (Ext.isSafari) {
  272. checkLength = value instanceof NodeList || value instanceof HTMLCollection;
  273. }
  274. } else {
  275. checkLength = true;
  276. }
  277. }
  278. return checkLength ? value.length !== undefined : false;
  279. }
  280. });
  281. Ext.apply(Ext, {
  282. clone: function(item) {
  283. var type,
  284. i,
  285. j,
  286. k,
  287. clone,
  288. key;
  289. if (item === null || item === undefined) {
  290. return item;
  291. }
  292. if (item.nodeType && item.cloneNode) {
  293. return item.cloneNode(true);
  294. }
  295. type = toString.call(item);
  296. if (type === '[object Date]') {
  297. return new Date(item.getTime());
  298. }
  299. if (type === '[object Array]') {
  300. i = item.length;
  301. clone = [];
  302. while (i--) {
  303. clone[i] = Ext.clone(item[i]);
  304. }
  305. }
  306. else if (type === '[object Object]' && item.constructor === Object) {
  307. clone = {};
  308. for (key in item) {
  309. clone[key] = Ext.clone(item[key]);
  310. }
  311. if (enumerables) {
  312. for (j = enumerables.length; j--;) {
  313. k = enumerables[j];
  314. clone[k] = item[k];
  315. }
  316. }
  317. }
  318. return clone || item;
  319. },
  320. getUniqueGlobalNamespace: function() {
  321. var uniqueGlobalNamespace = this.uniqueGlobalNamespace,
  322. i;
  323. if (uniqueGlobalNamespace === undefined) {
  324. i = 0;
  325. do {
  326. uniqueGlobalNamespace = 'ExtBox' + (++i);
  327. } while (Ext.global[uniqueGlobalNamespace] !== undefined);
  328. Ext.global[uniqueGlobalNamespace] = Ext;
  329. this.uniqueGlobalNamespace = uniqueGlobalNamespace;
  330. }
  331. return uniqueGlobalNamespace;
  332. },
  333. functionFactoryCache: {},
  334. cacheableFunctionFactory: function() {
  335. var me = this,
  336. args = Array.prototype.slice.call(arguments),
  337. cache = me.functionFactoryCache,
  338. idx, fn, ln;
  339. if (Ext.isSandboxed) {
  340. ln = args.length;
  341. if (ln > 0) {
  342. ln--;
  343. args[ln] = 'var Ext=window.' + Ext.name + ';' + args[ln];
  344. }
  345. }
  346. idx = args.join('');
  347. fn = cache[idx];
  348. if (!fn) {
  349. fn = Function.prototype.constructor.apply(Function.prototype, args);
  350. cache[idx] = fn;
  351. }
  352. return fn;
  353. },
  354. functionFactory: function() {
  355. var me = this,
  356. args = Array.prototype.slice.call(arguments),
  357. ln;
  358. if (Ext.isSandboxed) {
  359. ln = args.length;
  360. if (ln > 0) {
  361. ln--;
  362. args[ln] = 'var Ext=window.' + Ext.name + ';' + args[ln];
  363. }
  364. }
  365. return Function.prototype.constructor.apply(Function.prototype, args);
  366. },
  367. Logger: {
  368. verbose: emptyFn,
  369. log: emptyFn,
  370. info: emptyFn,
  371. warn: emptyFn,
  372. error: function(message) {
  373. throw new Error(message);
  374. },
  375. deprecate: emptyFn
  376. }
  377. });
  378. Ext.type = Ext.typeOf;
  379. }());
  380. Ext.globalEval = Ext.global.execScript
  381. ? function(code) {
  382. execScript(code);
  383. }
  384. : function($$code) {
  385. (function(){
  386. eval($$code);
  387. }());
  388. };
  389. //@tag foundation,core
  390. //@require ../Ext.js
  391. (function() {
  392. var version = '4.1.1.1', Version;
  393. Ext.Version = Version = Ext.extend(Object, {
  394. constructor: function(version) {
  395. var parts, releaseStartIndex;
  396. if (version instanceof Version) {
  397. return version;
  398. }
  399. this.version = this.shortVersion = String(version).toLowerCase().replace(/_/g, '.').replace(/[\-+]/g, '');
  400. releaseStartIndex = this.version.search(/([^\d\.])/);
  401. if (releaseStartIndex !== -1) {
  402. this.release = this.version.substr(releaseStartIndex, version.length);
  403. this.shortVersion = this.version.substr(0, releaseStartIndex);
  404. }
  405. this.shortVersion = this.shortVersion.replace(/[^\d]/g, '');
  406. parts = this.version.split('.');
  407. this.major = parseInt(parts.shift() || 0, 10);
  408. this.minor = parseInt(parts.shift() || 0, 10);
  409. this.patch = parseInt(parts.shift() || 0, 10);
  410. this.build = parseInt(parts.shift() || 0, 10);
  411. return this;
  412. },
  413. toString: function() {
  414. return this.version;
  415. },
  416. valueOf: function() {
  417. return this.version;
  418. },
  419. getMajor: function() {
  420. return this.major || 0;
  421. },
  422. getMinor: function() {
  423. return this.minor || 0;
  424. },
  425. getPatch: function() {
  426. return this.patch || 0;
  427. },
  428. getBuild: function() {
  429. return this.build || 0;
  430. },
  431. getRelease: function() {
  432. return this.release || '';
  433. },
  434. isGreaterThan: function(target) {
  435. return Version.compare(this.version, target) === 1;
  436. },
  437. isGreaterThanOrEqual: function(target) {
  438. return Version.compare(this.version, target) >= 0;
  439. },
  440. isLessThan: function(target) {
  441. return Version.compare(this.version, target) === -1;
  442. },
  443. isLessThanOrEqual: function(target) {
  444. return Version.compare(this.version, target) <= 0;
  445. },
  446. equals: function(target) {
  447. return Version.compare(this.version, target) === 0;
  448. },
  449. match: function(target) {
  450. target = String(target);
  451. return this.version.substr(0, target.length) === target;
  452. },
  453. toArray: function() {
  454. return [this.getMajor(), this.getMinor(), this.getPatch(), this.getBuild(), this.getRelease()];
  455. },
  456. getShortVersion: function() {
  457. return this.shortVersion;
  458. },
  459. gt: function() {
  460. return this.isGreaterThan.apply(this, arguments);
  461. },
  462. lt: function() {
  463. return this.isLessThan.apply(this, arguments);
  464. },
  465. gtEq: function() {
  466. return this.isGreaterThanOrEqual.apply(this, arguments);
  467. },
  468. ltEq: function() {
  469. return this.isLessThanOrEqual.apply(this, arguments);
  470. }
  471. });
  472. Ext.apply(Version, {
  473. releaseValueMap: {
  474. 'dev': -6,
  475. 'alpha': -5,
  476. 'a': -5,
  477. 'beta': -4,
  478. 'b': -4,
  479. 'rc': -3,
  480. '#': -2,
  481. 'p': -1,
  482. 'pl': -1
  483. },
  484. getComponentValue: function(value) {
  485. return !value ? 0 : (isNaN(value) ? this.releaseValueMap[value] || value : parseInt(value, 10));
  486. },
  487. compare: function(current, target) {
  488. var currentValue, targetValue, i;
  489. current = new Version(current).toArray();
  490. target = new Version(target).toArray();
  491. for (i = 0; i < Math.max(current.length, target.length); i++) {
  492. currentValue = this.getComponentValue(current[i]);
  493. targetValue = this.getComponentValue(target[i]);
  494. if (currentValue < targetValue) {
  495. return -1;
  496. } else if (currentValue > targetValue) {
  497. return 1;
  498. }
  499. }
  500. return 0;
  501. }
  502. });
  503. Ext.apply(Ext, {
  504. versions: {},
  505. lastRegisteredVersion: null,
  506. setVersion: function(packageName, version) {
  507. Ext.versions[packageName] = new Version(version);
  508. Ext.lastRegisteredVersion = Ext.versions[packageName];
  509. return this;
  510. },
  511. getVersion: function(packageName) {
  512. if (packageName === undefined) {
  513. return Ext.lastRegisteredVersion;
  514. }
  515. return Ext.versions[packageName];
  516. },
  517. deprecate: function(packageName, since, closure, scope) {
  518. if (Version.compare(Ext.getVersion(packageName), since) < 1) {
  519. closure.call(scope);
  520. }
  521. }
  522. });
  523. Ext.setVersion('core', version);
  524. }());
  525. //@tag foundation,core
  526. //@require ../version/Version.js
  527. Ext.String = (function() {
  528. 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,
  529. escapeRe = /('|\\)/g,
  530. formatRe = /\{(\d+)\}/g,
  531. escapeRegexRe = /([-.*+?\^${}()|\[\]\/\\])/g,
  532. basicTrimRe = /^\s+|\s+$/g,
  533. whitespaceRe = /\s+/,
  534. varReplace = /(^[^a-z]*|[^\w])/gi,
  535. charToEntity,
  536. entityToChar,
  537. charToEntityRegex,
  538. entityToCharRegex,
  539. htmlEncodeReplaceFn = function(match, capture) {
  540. return charToEntity[capture];
  541. },
  542. htmlDecodeReplaceFn = function(match, capture) {
  543. return (capture in entityToChar) ? entityToChar[capture] : String.fromCharCode(parseInt(capture.substr(2), 10));
  544. };
  545. return {
  546. createVarName: function(s) {
  547. return s.replace(varReplace, '');
  548. },
  549. htmlEncode: function(value) {
  550. return (!value) ? value : String(value).replace(charToEntityRegex, htmlEncodeReplaceFn);
  551. },
  552. htmlDecode: function(value) {
  553. return (!value) ? value : String(value).replace(entityToCharRegex, htmlDecodeReplaceFn);
  554. },
  555. addCharacterEntities: function(newEntities) {
  556. var charKeys = [],
  557. entityKeys = [],
  558. key, echar;
  559. for (key in newEntities) {
  560. echar = newEntities[key];
  561. entityToChar[key] = echar;
  562. charToEntity[echar] = key;
  563. charKeys.push(echar);
  564. entityKeys.push(key);
  565. }
  566. charToEntityRegex = new RegExp('(' + charKeys.join('|') + ')', 'g');
  567. entityToCharRegex = new RegExp('(' + entityKeys.join('|') + '|&#[0-9]{1,5};' + ')', 'g');
  568. },
  569. resetCharacterEntities: function() {
  570. charToEntity = {};
  571. entityToChar = {};
  572. this.addCharacterEntities({
  573. '&amp;' : '&',
  574. '&gt;' : '>',
  575. '&lt;' : '<',
  576. '&quot;' : '"',
  577. '&#39;' : "'"
  578. });
  579. },
  580. urlAppend : function(url, string) {
  581. if (!Ext.isEmpty(string)) {
  582. return url + (url.indexOf('?') === -1 ? '?' : '&') + string;
  583. }
  584. return url;
  585. },
  586. trim: function(string) {
  587. return string.replace(trimRegex, "");
  588. },
  589. capitalize: function(string) {
  590. return string.charAt(0).toUpperCase() + string.substr(1);
  591. },
  592. uncapitalize: function(string) {
  593. return string.charAt(0).toLowerCase() + string.substr(1);
  594. },
  595. ellipsis: function(value, len, word) {
  596. if (value && value.length > len) {
  597. if (word) {
  598. var vs = value.substr(0, len - 2),
  599. index = Math.max(vs.lastIndexOf(' '), vs.lastIndexOf('.'), vs.lastIndexOf('!'), vs.lastIndexOf('?'));
  600. if (index !== -1 && index >= (len - 15)) {
  601. return vs.substr(0, index) + "...";
  602. }
  603. }
  604. return value.substr(0, len - 3) + "...";
  605. }
  606. return value;
  607. },
  608. escapeRegex: function(string) {
  609. return string.replace(escapeRegexRe, "\\$1");
  610. },
  611. escape: function(string) {
  612. return string.replace(escapeRe, "\\$1");
  613. },
  614. toggle: function(string, value, other) {
  615. return string === value ? other : value;
  616. },
  617. leftPad: function(string, size, character) {
  618. var result = String(string);
  619. character = character || " ";
  620. while (result.length < size) {
  621. result = character + result;
  622. }
  623. return result;
  624. },
  625. format: function(format) {
  626. var args = Ext.Array.toArray(arguments, 1);
  627. return format.replace(formatRe, function(m, i) {
  628. return args[i];
  629. });
  630. },
  631. repeat: function(pattern, count, sep) {
  632. for (var buf = [], i = count; i--; ) {
  633. buf.push(pattern);
  634. }
  635. return buf.join(sep || '');
  636. },
  637. splitWords: function (words) {
  638. if (words && typeof words == 'string') {
  639. return words.replace(basicTrimRe, '').split(whitespaceRe);
  640. }
  641. return words || [];
  642. }
  643. };
  644. }());
  645. Ext.String.resetCharacterEntities();
  646. Ext.htmlEncode = Ext.String.htmlEncode;
  647. Ext.htmlDecode = Ext.String.htmlDecode;
  648. Ext.urlAppend = Ext.String.urlAppend;
  649. //@tag foundation,core
  650. //@require String.js
  651. //@define Ext.Number
  652. Ext.Number = new function() {
  653. var me = this,
  654. isToFixedBroken = (0.9).toFixed() !== '1',
  655. math = Math;
  656. Ext.apply(this, {
  657. constrain: function(number, min, max) {
  658. var x = parseFloat(number);
  659. return (x < min) ? min : ((x > max) ? max : x);
  660. },
  661. snap : function(value, increment, minValue, maxValue) {
  662. var m;
  663. if (value === undefined || value < minValue) {
  664. return minValue || 0;
  665. }
  666. if (increment) {
  667. m = value % increment;
  668. if (m !== 0) {
  669. value -= m;
  670. if (m * 2 >= increment) {
  671. value += increment;
  672. } else if (m * 2 < -increment) {
  673. value -= increment;
  674. }
  675. }
  676. }
  677. return me.constrain(value, minValue, maxValue);
  678. },
  679. snapInRange : function(value, increment, minValue, maxValue) {
  680. var tween;
  681. minValue = (minValue || 0);
  682. if (value === undefined || value < minValue) {
  683. return minValue;
  684. }
  685. if (increment && (tween = ((value - minValue) % increment))) {
  686. value -= tween;
  687. tween *= 2;
  688. if (tween >= increment) {
  689. value += increment;
  690. }
  691. }
  692. if (maxValue !== undefined) {
  693. if (value > (maxValue = me.snapInRange(maxValue, increment, minValue))) {
  694. value = maxValue;
  695. }
  696. }
  697. return value;
  698. },
  699. toFixed: isToFixedBroken ? function(value, precision) {
  700. precision = precision || 0;
  701. var pow = math.pow(10, precision);
  702. return (math.round(value * pow) / pow).toFixed(precision);
  703. } : function(value, precision) {
  704. return value.toFixed(precision);
  705. },
  706. from: function(value, defaultValue) {
  707. if (isFinite(value)) {
  708. value = parseFloat(value);
  709. }
  710. return !isNaN(value) ? value : defaultValue;
  711. },
  712. randomInt: function (from, to) {
  713. return math.floor(math.random() * (to - from + 1) + from);
  714. }
  715. });
  716. Ext.num = function() {
  717. return me.from.apply(this, arguments);
  718. };
  719. };
  720. //@tag foundation,core
  721. //@require Number.js
  722. (function() {
  723. var arrayPrototype = Array.prototype,
  724. slice = arrayPrototype.slice,
  725. supportsSplice = (function () {
  726. var array = [],
  727. lengthBefore,
  728. j = 20;
  729. if (!array.splice) {
  730. return false;
  731. }
  732. while (j--) {
  733. array.push("A");
  734. }
  735. 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");
  736. lengthBefore = array.length;
  737. array.splice(13, 0, "XXX");
  738. if (lengthBefore+1 != array.length) {
  739. return false;
  740. }
  741. return true;
  742. }()),
  743. supportsForEach = 'forEach' in arrayPrototype,
  744. supportsMap = 'map' in arrayPrototype,
  745. supportsIndexOf = 'indexOf' in arrayPrototype,
  746. supportsEvery = 'every' in arrayPrototype,
  747. supportsSome = 'some' in arrayPrototype,
  748. supportsFilter = 'filter' in arrayPrototype,
  749. supportsSort = (function() {
  750. var a = [1,2,3,4,5].sort(function(){ return 0; });
  751. return a[0] === 1 && a[1] === 2 && a[2] === 3 && a[3] === 4 && a[4] === 5;
  752. }()),
  753. supportsSliceOnNodeList = true,
  754. ExtArray,
  755. erase,
  756. replace,
  757. splice;
  758. try {
  759. if (typeof document !== 'undefined') {
  760. slice.call(document.getElementsByTagName('body'));
  761. }
  762. } catch (e) {
  763. supportsSliceOnNodeList = false;
  764. }
  765. function fixArrayIndex (array, index) {
  766. return (index < 0) ? Math.max(0, array.length + index)
  767. : Math.min(array.length, index);
  768. }
  769. function replaceSim (array, index, removeCount, insert) {
  770. var add = insert ? insert.length : 0,
  771. length = array.length,
  772. pos = fixArrayIndex(array, index),
  773. remove,
  774. tailOldPos,
  775. tailNewPos,
  776. tailCount,
  777. lengthAfterRemove,
  778. i;
  779. if (pos === length) {
  780. if (add) {
  781. array.push.apply(array, insert);
  782. }
  783. } else {
  784. remove = Math.min(removeCount, length - pos);
  785. tailOldPos = pos + remove;
  786. tailNewPos = tailOldPos + add - remove;
  787. tailCount = length - tailOldPos;
  788. lengthAfterRemove = length - remove;
  789. if (tailNewPos < tailOldPos) {
  790. for (i = 0; i < tailCount; ++i) {
  791. array[tailNewPos+i] = array[tailOldPos+i];
  792. }
  793. } else if (tailNewPos > tailOldPos) {
  794. for (i = tailCount; i--; ) {
  795. array[tailNewPos+i] = array[tailOldPos+i];
  796. }
  797. }
  798. if (add && pos === lengthAfterRemove) {
  799. array.length = lengthAfterRemove;
  800. array.push.apply(array, insert);
  801. } else {
  802. array.length = lengthAfterRemove + add;
  803. for (i = 0; i < add; ++i) {
  804. array[pos+i] = insert[i];
  805. }
  806. }
  807. }
  808. return array;
  809. }
  810. function replaceNative (array, index, removeCount, insert) {
  811. if (insert && insert.length) {
  812. if (index < array.length) {
  813. array.splice.apply(array, [index, removeCount].concat(insert));
  814. } else {
  815. array.push.apply(array, insert);
  816. }
  817. } else {
  818. array.splice(index, removeCount);
  819. }
  820. return array;
  821. }
  822. function eraseSim (array, index, removeCount) {
  823. return replaceSim(array, index, removeCount);
  824. }
  825. function eraseNative (array, index, removeCount) {
  826. array.splice(index, removeCount);
  827. return array;
  828. }
  829. function spliceSim (array, index, removeCount) {
  830. var pos = fixArrayIndex(array, index),
  831. removed = array.slice(index, fixArrayIndex(array, pos+removeCount));
  832. if (arguments.length < 4) {
  833. replaceSim(array, pos, removeCount);
  834. } else {
  835. replaceSim(array, pos, removeCount, slice.call(arguments, 3));
  836. }
  837. return removed;
  838. }
  839. function spliceNative (array) {
  840. return array.splice.apply(array, slice.call(arguments, 1));
  841. }
  842. erase = supportsSplice ? eraseNative : eraseSim;
  843. replace = supportsSplice ? replaceNative : replaceSim;
  844. splice = supportsSplice ? spliceNative : spliceSim;
  845. ExtArray = Ext.Array = {
  846. each: function(array, fn, scope, reverse) {
  847. array = ExtArray.from(array);
  848. var i,
  849. ln = array.length;
  850. if (reverse !== true) {
  851. for (i = 0; i < ln; i++) {
  852. if (fn.call(scope || array[i], array[i], i, array) === false) {
  853. return i;
  854. }
  855. }
  856. }
  857. else {
  858. for (i = ln - 1; i > -1; i--) {
  859. if (fn.call(scope || array[i], array[i], i, array) === false) {
  860. return i;
  861. }
  862. }
  863. }
  864. return true;
  865. },
  866. forEach: supportsForEach ? function(array, fn, scope) {
  867. return array.forEach(fn, scope);
  868. } : function(array, fn, scope) {
  869. var i = 0,
  870. ln = array.length;
  871. for (; i < ln; i++) {
  872. fn.call(scope, array[i], i, array);
  873. }
  874. },
  875. indexOf: supportsIndexOf ? function(array, item, from) {
  876. return array.indexOf(item, from);
  877. } : function(array, item, from) {
  878. var i, length = array.length;
  879. for (i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++) {
  880. if (array[i] === item) {
  881. return i;
  882. }
  883. }
  884. return -1;
  885. },
  886. contains: supportsIndexOf ? function(array, item) {
  887. return array.indexOf(item) !== -1;
  888. } : function(array, item) {
  889. var i, ln;
  890. for (i = 0, ln = array.length; i < ln; i++) {
  891. if (array[i] === item) {
  892. return true;
  893. }
  894. }
  895. return false;
  896. },
  897. toArray: function(iterable, start, end){
  898. if (!iterable || !iterable.length) {
  899. return [];
  900. }
  901. if (typeof iterable === 'string') {
  902. iterable = iterable.split('');
  903. }
  904. if (supportsSliceOnNodeList) {
  905. return slice.call(iterable, start || 0, end || iterable.length);
  906. }
  907. var array = [],
  908. i;
  909. start = start || 0;
  910. end = end ? ((end < 0) ? iterable.length + end : end) : iterable.length;
  911. for (i = start; i < end; i++) {
  912. array.push(iterable[i]);
  913. }
  914. return array;
  915. },
  916. pluck: function(array, propertyName) {
  917. var ret = [],
  918. i, ln, item;
  919. for (i = 0, ln = array.length; i < ln; i++) {
  920. item = array[i];
  921. ret.push(item[propertyName]);
  922. }
  923. return ret;
  924. },
  925. map: supportsMap ? function(array, fn, scope) {
  926. return array.map(fn, scope);
  927. } : function(array, fn, scope) {
  928. var results = [],
  929. i = 0,
  930. len = array.length;
  931. for (; i < len; i++) {
  932. results[i] = fn.call(scope, array[i], i, array);
  933. }
  934. return results;
  935. },
  936. every: supportsEvery ? function(array, fn, scope) {
  937. return array.every(fn, scope);
  938. } : function(array, fn, scope) {
  939. var i = 0,
  940. ln = array.length;
  941. for (; i < ln; ++i) {
  942. if (!fn.call(scope, array[i], i, array)) {
  943. return false;
  944. }
  945. }
  946. return true;
  947. },
  948. some: supportsSome ? function(array, fn, scope) {
  949. return array.some(fn, scope);
  950. } : function(array, fn, scope) {
  951. var i = 0,
  952. ln = array.length;
  953. for (; i < ln; ++i) {
  954. if (fn.call(scope, array[i], i, array)) {
  955. return true;
  956. }
  957. }
  958. return false;
  959. },
  960. clean: function(array) {
  961. var results = [],
  962. i = 0,
  963. ln = array.length,
  964. item;
  965. for (; i < ln; i++) {
  966. item = array[i];
  967. if (!Ext.isEmpty(item)) {
  968. results.push(item);
  969. }
  970. }
  971. return results;
  972. },
  973. unique: function(array) {
  974. var clone = [],
  975. i = 0,
  976. ln = array.length,
  977. item;
  978. for (; i < ln; i++) {
  979. item = array[i];
  980. if (ExtArray.indexOf(clone, item) === -1) {
  981. clone.push(item);
  982. }
  983. }
  984. return clone;
  985. },
  986. filter: supportsFilter ? function(array, fn, scope) {
  987. return array.filter(fn, scope);
  988. } : function(array, fn, scope) {
  989. var results = [],
  990. i = 0,
  991. ln = array.length;
  992. for (; i < ln; i++) {
  993. if (fn.call(scope, array[i], i, array)) {
  994. results.push(array[i]);
  995. }
  996. }
  997. return results;
  998. },
  999. from: function(value, newReference) {
  1000. if (value === undefined || value === null) {
  1001. return [];
  1002. }
  1003. if (Ext.isArray(value)) {
  1004. return (newReference) ? slice.call(value) : value;
  1005. }
  1006. var type = typeof value;
  1007. if (value && value.length !== undefined && type !== 'string' && (type !== 'function' || !value.apply)) {
  1008. return ExtArray.toArray(value);
  1009. }
  1010. return [value];
  1011. },
  1012. remove: function(array, item) {
  1013. var index = ExtArray.indexOf(array, item);
  1014. if (index !== -1) {
  1015. erase(array, index, 1);
  1016. }
  1017. return array;
  1018. },
  1019. include: function(array, item) {
  1020. if (!ExtArray.contains(array, item)) {
  1021. array.push(item);
  1022. }
  1023. },
  1024. clone: function(array) {
  1025. return slice.call(array);
  1026. },
  1027. merge: function() {
  1028. var args = slice.call(arguments),
  1029. array = [],
  1030. i, ln;
  1031. for (i = 0, ln = args.length; i < ln; i++) {
  1032. array = array.concat(args[i]);
  1033. }
  1034. return ExtArray.unique(array);
  1035. },
  1036. intersect: function() {
  1037. var intersection = [],
  1038. arrays = slice.call(arguments),
  1039. arraysLength,
  1040. array,
  1041. arrayLength,
  1042. minArray,
  1043. minArrayIndex,
  1044. minArrayCandidate,
  1045. minArrayLength,
  1046. element,
  1047. elementCandidate,
  1048. elementCount,
  1049. i, j, k;
  1050. if (!arrays.length) {
  1051. return intersection;
  1052. }
  1053. arraysLength = arrays.length;
  1054. for (i = minArrayIndex = 0; i < arraysLength; i++) {
  1055. minArrayCandidate = arrays[i];
  1056. if (!minArray || minArrayCandidate.length < minArray.length) {
  1057. minArray = minArrayCandidate;
  1058. minArrayIndex = i;
  1059. }
  1060. }
  1061. minArray = ExtArray.unique(minArray);
  1062. erase(arrays, minArrayIndex, 1);
  1063. minArrayLength = minArray.length;
  1064. arraysLength = arrays.length;
  1065. for (i = 0; i < minArrayLength; i++) {
  1066. element = minArray[i];
  1067. elementCount = 0;
  1068. for (j = 0; j < arraysLength; j++) {
  1069. array = arrays[j];
  1070. arrayLength = array.length;
  1071. for (k = 0; k < arrayLength; k++) {
  1072. elementCandidate = array[k];
  1073. if (element === elementCandidate) {
  1074. elementCount++;
  1075. break;
  1076. }
  1077. }
  1078. }
  1079. if (elementCount === arraysLength) {
  1080. intersection.push(element);
  1081. }
  1082. }
  1083. return intersection;
  1084. },
  1085. difference: function(arrayA, arrayB) {
  1086. var clone = slice.call(arrayA),
  1087. ln = clone.length,
  1088. i, j, lnB;
  1089. for (i = 0,lnB = arrayB.length; i < lnB; i++) {
  1090. for (j = 0; j < ln; j++) {
  1091. if (clone[j] === arrayB[i]) {
  1092. erase(clone, j, 1);
  1093. j--;
  1094. ln--;
  1095. }
  1096. }
  1097. }
  1098. return clone;
  1099. },
  1100. slice: ([1,2].slice(1, undefined).length ?
  1101. function (array, begin, end) {
  1102. return slice.call(array, begin, end);
  1103. } :
  1104. function (array, begin, end) {
  1105. if (typeof begin === 'undefined') {
  1106. return slice.call(array);
  1107. }
  1108. if (typeof end === 'undefined') {
  1109. return slice.call(array, begin);
  1110. }
  1111. return slice.call(array, begin, end);
  1112. }
  1113. ),
  1114. sort: supportsSort ? function(array, sortFn) {
  1115. if (sortFn) {
  1116. return array.sort(sortFn);
  1117. } else {
  1118. return array.sort();
  1119. }
  1120. } : function(array, sortFn) {
  1121. var length = array.length,
  1122. i = 0,
  1123. comparison,
  1124. j, min, tmp;
  1125. for (; i < length; i++) {
  1126. min = i;
  1127. for (j = i + 1; j < length; j++) {
  1128. if (sortFn) {
  1129. comparison = sortFn(array[j], array[min]);
  1130. if (comparison < 0) {
  1131. min = j;
  1132. }
  1133. } else if (array[j] < array[min]) {
  1134. min = j;
  1135. }
  1136. }
  1137. if (min !== i) {
  1138. tmp = array[i];
  1139. array[i] = array[min];
  1140. array[min] = tmp;
  1141. }
  1142. }
  1143. return array;
  1144. },
  1145. flatten: function(array) {
  1146. var worker = [];
  1147. function rFlatten(a) {
  1148. var i, ln, v;
  1149. for (i = 0, ln = a.length; i < ln; i++) {
  1150. v = a[i];
  1151. if (Ext.isArray(v)) {
  1152. rFlatten(v);
  1153. } else {
  1154. worker.push(v);
  1155. }
  1156. }
  1157. return worker;
  1158. }
  1159. return rFlatten(array);
  1160. },
  1161. min: function(array, comparisonFn) {
  1162. var min = array[0],
  1163. i, ln, item;
  1164. for (i = 0, ln = array.length; i < ln; i++) {
  1165. item = array[i];
  1166. if (comparisonFn) {
  1167. if (comparisonFn(min, item) === 1) {
  1168. min = item;
  1169. }
  1170. }
  1171. else {
  1172. if (item < min) {
  1173. min = item;
  1174. }
  1175. }
  1176. }
  1177. return min;
  1178. },
  1179. max: function(array, comparisonFn) {
  1180. var max = array[0],
  1181. i, ln, item;
  1182. for (i = 0, ln = array.length; i < ln; i++) {
  1183. item = array[i];
  1184. if (comparisonFn) {
  1185. if (comparisonFn(max, item) === -1) {
  1186. max = item;
  1187. }
  1188. }
  1189. else {
  1190. if (item > max) {
  1191. max = item;
  1192. }
  1193. }
  1194. }
  1195. return max;
  1196. },
  1197. mean: function(array) {
  1198. return array.length > 0 ? ExtArray.sum(array) / array.length : undefined;
  1199. },
  1200. sum: function(array) {
  1201. var sum = 0,
  1202. i, ln, item;
  1203. for (i = 0,ln = array.length; i < ln; i++) {
  1204. item = array[i];
  1205. sum += item;
  1206. }
  1207. return sum;
  1208. },
  1209. toMap: function(array, getKey, scope) {
  1210. var map = {},
  1211. i = array.length;
  1212. if (!getKey) {
  1213. while (i--) {
  1214. map[array[i]] = i+1;
  1215. }
  1216. } else if (typeof getKey == 'string') {
  1217. while (i--) {
  1218. map[array[i][getKey]] = i+1;
  1219. }
  1220. } else {
  1221. while (i--) {
  1222. map[getKey.call(scope, array[i])] = i+1;
  1223. }
  1224. }
  1225. return map;
  1226. },
  1227. erase: erase,
  1228. insert: function (array, index, items) {
  1229. return replace(array, index, 0, items);
  1230. },
  1231. replace: replace,
  1232. splice: splice,
  1233. push: function(array) {
  1234. var len = arguments.length,
  1235. i = 1,
  1236. newItem;
  1237. if (array === undefined) {
  1238. array = [];
  1239. } else if (!Ext.isArray(array)) {
  1240. array = [array];
  1241. }
  1242. for (; i < len; i++) {
  1243. newItem = arguments[i];
  1244. Array.prototype.push[Ext.isArray(newItem) ? 'apply' : 'call'](array, newItem);
  1245. }
  1246. return array;
  1247. }
  1248. };
  1249. Ext.each = ExtArray.each;
  1250. ExtArray.union = ExtArray.merge;
  1251. Ext.min = ExtArray.min;
  1252. Ext.max = ExtArray.max;
  1253. Ext.sum = ExtArray.sum;
  1254. Ext.mean = ExtArray.mean;
  1255. Ext.flatten = ExtArray.flatten;
  1256. Ext.clean = ExtArray.clean;
  1257. Ext.unique = ExtArray.unique;
  1258. Ext.pluck = ExtArray.pluck;
  1259. Ext.toArray = function() {
  1260. return ExtArray.toArray.apply(ExtArray, arguments);
  1261. };
  1262. }());
  1263. //@tag foundation,core
  1264. //@require Array.js
  1265. Ext.Function = {
  1266. flexSetter: function(fn) {
  1267. return function(a, b) {
  1268. var k, i;
  1269. if (a === null) {
  1270. return this;
  1271. }
  1272. if (typeof a !== 'string') {
  1273. for (k in a) {
  1274. if (a.hasOwnProperty(k)) {
  1275. fn.call(this, k, a[k]);
  1276. }
  1277. }
  1278. if (Ext.enumerables) {
  1279. for (i = Ext.enumerables.length; i--;) {
  1280. k = Ext.enumerables[i];
  1281. if (a.hasOwnProperty(k)) {
  1282. fn.call(this, k, a[k]);
  1283. }
  1284. }
  1285. }
  1286. } else {
  1287. fn.call(this, a, b);
  1288. }
  1289. return this;
  1290. };
  1291. },
  1292. bind: function(fn, scope, args, appendArgs) {
  1293. if (arguments.length === 2) {
  1294. return function() {
  1295. return fn.apply(scope, arguments);
  1296. };
  1297. }
  1298. var method = fn,
  1299. slice = Array.prototype.slice;
  1300. return function() {
  1301. var callArgs = args || arguments;
  1302. if (appendArgs === true) {
  1303. callArgs = slice.call(arguments, 0);
  1304. callArgs = callArgs.concat(args);
  1305. }
  1306. else if (typeof appendArgs == 'number') {
  1307. callArgs = slice.call(arguments, 0);
  1308. Ext.Array.insert(callArgs, appendArgs, args);
  1309. }
  1310. return method.apply(scope || Ext.global, callArgs);
  1311. };
  1312. },
  1313. pass: function(fn, args, scope) {
  1314. if (!Ext.isArray(args)) {
  1315. if (Ext.isIterable(args)) {
  1316. args = Ext.Array.clone(args);
  1317. } else {
  1318. args = args !== undefined ? [args] : [];
  1319. }
  1320. }
  1321. return function() {
  1322. var fnArgs = [].concat(args);
  1323. fnArgs.push.apply(fnArgs, arguments);
  1324. return fn.apply(scope || this, fnArgs);
  1325. };
  1326. },
  1327. alias: function(object, methodName) {
  1328. return function() {
  1329. return object[methodName].apply(object, arguments);
  1330. };
  1331. },
  1332. clone: function(method) {
  1333. return function() {
  1334. return method.apply(this, arguments);
  1335. };
  1336. },
  1337. createInterceptor: function(origFn, newFn, scope, returnValue) {
  1338. var method = origFn;
  1339. if (!Ext.isFunction(newFn)) {
  1340. return origFn;
  1341. }
  1342. else {
  1343. return function() {
  1344. var me = this,
  1345. args = arguments;
  1346. newFn.target = me;
  1347. newFn.method = origFn;
  1348. return (newFn.apply(scope || me || Ext.global, args) !== false) ? origFn.apply(me || Ext.global, args) : returnValue || null;
  1349. };
  1350. }
  1351. },
  1352. createDelayed: function(fn, delay, scope, args, appendArgs) {
  1353. if (scope || args) {
  1354. fn = Ext.Function.bind(fn, scope, args, appendArgs);
  1355. }
  1356. return function() {
  1357. var me = this,
  1358. args = Array.prototype.slice.call(arguments);
  1359. setTimeout(function() {
  1360. fn.apply(me, args);
  1361. }, delay);
  1362. };
  1363. },
  1364. defer: function(fn, millis, scope, args, appendArgs) {
  1365. fn = Ext.Function.bind(fn, scope, args, appendArgs);
  1366. if (millis > 0) {
  1367. return setTimeout(Ext.supports.TimeoutActualLateness ? function () {
  1368. fn();
  1369. } : fn, millis);
  1370. }
  1371. fn();
  1372. return 0;
  1373. },
  1374. createSequence: function(originalFn, newFn, scope) {
  1375. if (!newFn) {
  1376. return originalFn;
  1377. }
  1378. else {
  1379. return function() {
  1380. var result = originalFn.apply(this, arguments);
  1381. newFn.apply(scope || this, arguments);
  1382. return result;
  1383. };
  1384. }
  1385. },
  1386. createBuffered: function(fn, buffer, scope, args) {
  1387. var timerId;
  1388. return function() {
  1389. var callArgs = args || Array.prototype.slice.call(arguments, 0),
  1390. me = scope || this;
  1391. if (timerId) {
  1392. clearTimeout(timerId);
  1393. }
  1394. timerId = setTimeout(function(){
  1395. fn.apply(me, callArgs);
  1396. }, buffer);
  1397. };
  1398. },
  1399. createThrottled: function(fn, interval, scope) {
  1400. var lastCallTime, elapsed, lastArgs, timer, execute = function() {
  1401. fn.apply(scope || this, lastArgs);
  1402. lastCallTime = new Date().getTime();
  1403. };
  1404. return function() {
  1405. elapsed = new Date().getTime() - lastCallTime;
  1406. lastArgs = arguments;
  1407. clearTimeout(timer);
  1408. if (!lastCallTime || (elapsed >= interval)) {
  1409. execute();
  1410. } else {
  1411. timer = setTimeout(execute, interval - elapsed);
  1412. }
  1413. };
  1414. },
  1415. interceptBefore: function(object, methodName, fn, scope) {
  1416. var method = object[methodName] || Ext.emptyFn;
  1417. return (object[methodName] = function() {
  1418. var ret = fn.apply(scope || this, arguments);
  1419. method.apply(this, arguments);
  1420. return ret;
  1421. });
  1422. },
  1423. interceptAfter: function(object, methodName, fn, scope) {
  1424. var method = object[methodName] || Ext.emptyFn;
  1425. return (object[methodName] = function() {
  1426. method.apply(this, arguments);
  1427. return fn.apply(scope || this, arguments);
  1428. });
  1429. }
  1430. };
  1431. Ext.defer = Ext.Function.alias(Ext.Function, 'defer');
  1432. Ext.pass = Ext.Function.alias(Ext.Function, 'pass');
  1433. Ext.bind = Ext.Function.alias(Ext.Function, 'bind');
  1434. //@tag foundation,core
  1435. //@require Function.js
  1436. (function() {
  1437. var TemplateClass = function(){},
  1438. ExtObject = Ext.Object = {
  1439. chain: function (object) {
  1440. TemplateClass.prototype = object;
  1441. var result = new TemplateClass();
  1442. TemplateClass.prototype = null;
  1443. return result;
  1444. },
  1445. toQueryObjects: function(name, value, recursive) {
  1446. var self = ExtObject.toQueryObjects,
  1447. objects = [],
  1448. i, ln;
  1449. if (Ext.isArray(value)) {
  1450. for (i = 0, ln = value.length; i < ln; i++) {
  1451. if (recursive) {
  1452. objects = objects.concat(self(name + '[' + i + ']', value[i], true));
  1453. }
  1454. else {
  1455. objects.push({
  1456. name: name,
  1457. value: value[i]
  1458. });
  1459. }
  1460. }
  1461. }
  1462. else if (Ext.isObject(value)) {
  1463. for (i in value) {
  1464. if (value.hasOwnProperty(i)) {
  1465. if (recursive) {
  1466. objects = objects.concat(self(name + '[' + i + ']', value[i], true));
  1467. }
  1468. else {
  1469. objects.push({
  1470. name: name,
  1471. value: value[i]
  1472. });
  1473. }
  1474. }
  1475. }
  1476. }
  1477. else {
  1478. objects.push({
  1479. name: name,
  1480. value: value
  1481. });
  1482. }
  1483. return objects;
  1484. },
  1485. toQueryString: function(object, recursive) {
  1486. var paramObjects = [],
  1487. params = [],
  1488. i, j, ln, paramObject, value;
  1489. for (i in object) {
  1490. if (object.hasOwnProperty(i)) {
  1491. paramObjects = paramObjects.concat(ExtObject.toQueryObjects(i, object[i], recursive));
  1492. }
  1493. }
  1494. for (j = 0, ln = paramObjects.length; j < ln; j++) {
  1495. paramObject = paramObjects[j];
  1496. value = paramObject.value;
  1497. if (Ext.isEmpty(value)) {
  1498. value = '';
  1499. }
  1500. else if (Ext.isDate(value)) {
  1501. value = Ext.Date.toString(value);
  1502. }
  1503. params.push(encodeURIComponent(paramObject.name) + '=' + encodeURIComponent(String(value)));
  1504. }
  1505. return params.join('&');
  1506. },
  1507. fromQueryString: function(queryString, recursive) {
  1508. var parts = queryString.replace(/^\?/, '').split('&'),
  1509. object = {},
  1510. temp, components, name, value, i, ln,
  1511. part, j, subLn, matchedKeys, matchedName,
  1512. keys, key, nextKey;
  1513. for (i = 0, ln = parts.length; i < ln; i++) {
  1514. part = parts[i];
  1515. if (part.length > 0) {
  1516. components = part.split('=');
  1517. name = decodeURIComponent(components[0]);
  1518. value = (components[1] !== undefined) ? decodeURIComponent(components[1]) : '';
  1519. if (!recursive) {
  1520. if (object.hasOwnProperty(name)) {
  1521. if (!Ext.isArray(object[name])) {
  1522. object[name] = [object[name]];
  1523. }
  1524. object[name].push(value);
  1525. }
  1526. else {
  1527. object[name] = value;
  1528. }
  1529. }
  1530. else {
  1531. matchedKeys = name.match(/(\[):?([^\]]*)\]/g);
  1532. matchedName = name.match(/^([^\[]+)/);
  1533. name = matchedName[0];
  1534. keys = [];
  1535. if (matchedKeys === null) {
  1536. object[name] = value;
  1537. continue;
  1538. }
  1539. for (j = 0, subLn = matchedKeys.length; j < subLn; j++) {
  1540. key = matchedKeys[j];
  1541. key = (key.length === 2) ? '' : key.substring(1, key.length - 1);
  1542. keys.push(key);
  1543. }
  1544. keys.unshift(name);
  1545. temp = object;
  1546. for (j = 0, subLn = keys.length; j < subLn; j++) {
  1547. key = keys[j];
  1548. if (j === subLn - 1) {
  1549. if (Ext.isArray(temp) && key === '') {
  1550. temp.push(value);
  1551. }
  1552. else {
  1553. temp[key] = value;
  1554. }
  1555. }
  1556. else {
  1557. if (temp[key] === undefined || typeof temp[key] === 'string') {
  1558. nextKey = keys[j+1];
  1559. temp[key] = (Ext.isNumeric(nextKey) || nextKey === '') ? [] : {};
  1560. }
  1561. temp = temp[key];
  1562. }
  1563. }
  1564. }
  1565. }
  1566. }
  1567. return object;
  1568. },
  1569. each: function(object, fn, scope) {
  1570. for (var property in object) {
  1571. if (object.hasOwnProperty(property)) {
  1572. if (fn.call(scope || object, property, object[property], object) === false) {
  1573. return;
  1574. }
  1575. }
  1576. }
  1577. },
  1578. merge: function(destination) {
  1579. var i = 1,
  1580. ln = arguments.length,
  1581. mergeFn = ExtObject.merge,
  1582. cloneFn = Ext.clone,
  1583. object, key, value, sourceKey;
  1584. for (; i < ln; i++) {
  1585. object = arguments[i];
  1586. for (key in object) {
  1587. value = object[key];
  1588. if (value && value.constructor === Object) {
  1589. sourceKey = destination[key];
  1590. if (sourceKey && sourceKey.constructor === Object) {
  1591. mergeFn(sourceKey, value);
  1592. }
  1593. else {
  1594. destination[key] = cloneFn(value);
  1595. }
  1596. }
  1597. else {
  1598. destination[key] = value;
  1599. }
  1600. }
  1601. }
  1602. return destination;
  1603. },
  1604. mergeIf: function(destination) {
  1605. var i = 1,
  1606. ln = arguments.length,
  1607. cloneFn = Ext.clone,
  1608. object, key, value;
  1609. for (; i < ln; i++) {
  1610. object = arguments[i];
  1611. for (key in object) {
  1612. if (!(key in destination)) {
  1613. value = object[key];
  1614. if (value && value.constructor === Object) {
  1615. destination[key] = cloneFn(value);
  1616. }
  1617. else {
  1618. destination[key] = value;
  1619. }
  1620. }
  1621. }
  1622. }
  1623. return destination;
  1624. },
  1625. getKey: function(object, value) {
  1626. for (var property in object) {
  1627. if (object.hasOwnProperty(property) && object[property] === value) {
  1628. return property;
  1629. }
  1630. }
  1631. return null;
  1632. },
  1633. getValues: function(object) {
  1634. var values = [],
  1635. property;
  1636. for (property in object) {
  1637. if (object.hasOwnProperty(property)) {
  1638. values.push(object[property]);
  1639. }
  1640. }
  1641. return values;
  1642. },
  1643. getKeys: (typeof Object.keys == 'function')
  1644. ? function(object){
  1645. if (!object) {
  1646. return [];
  1647. }
  1648. return Object.keys(object);
  1649. }
  1650. : function(object) {
  1651. var keys = [],
  1652. property;
  1653. for (property in object) {
  1654. if (object.hasOwnProperty(property)) {
  1655. keys.push(property);
  1656. }
  1657. }
  1658. return keys;
  1659. },
  1660. getSize: function(object) {
  1661. var size = 0,
  1662. property;
  1663. for (property in object) {
  1664. if (object.hasOwnProperty(property)) {
  1665. size++;
  1666. }
  1667. }
  1668. return size;
  1669. },
  1670. classify: function(object) {
  1671. var prototype = object,
  1672. objectProperties = [],
  1673. propertyClassesMap = {},
  1674. objectClass = function() {
  1675. var i = 0,
  1676. ln = objectProperties.length,
  1677. property;
  1678. for (; i < ln; i++) {
  1679. property = objectProperties[i];
  1680. this[property] = new propertyClassesMap[property]();
  1681. }
  1682. },
  1683. key, value;
  1684. for (key in object) {
  1685. if (object.hasOwnProperty(key)) {
  1686. value = object[key];
  1687. if (value && value.constructor === Object) {
  1688. objectProperties.push(key);
  1689. propertyClassesMap[key] = ExtObject.classify(value);
  1690. }
  1691. }
  1692. }
  1693. objectClass.prototype = prototype;
  1694. return objectClass;
  1695. }
  1696. };
  1697. Ext.merge = Ext.Object.merge;
  1698. Ext.mergeIf = Ext.Object.mergeIf;
  1699. Ext.urlEncode = function() {
  1700. var args = Ext.Array.from(arguments),
  1701. prefix = '';
  1702. if ((typeof args[1] === 'string')) {
  1703. prefix = args[1] + '&';
  1704. args[1] = false;
  1705. }
  1706. return prefix + ExtObject.toQueryString.apply(ExtObject, args);
  1707. };
  1708. Ext.urlDecode = function() {
  1709. return ExtObject.fromQueryString.apply(ExtObject, arguments);
  1710. };
  1711. }());
  1712. //@tag foundation,core
  1713. //@require Object.js
  1714. //@define Ext.Date
  1715. (function() {
  1716. function xf(format) {
  1717. var args = Array.prototype.slice.call(arguments, 1);
  1718. return format.replace(/\{(\d+)\}/g, function(m, i) {
  1719. return args[i];
  1720. });
  1721. }
  1722. Ext.Date = {
  1723. now: Date.now || function() {
  1724. return +new Date();
  1725. },
  1726. toString: function(date) {
  1727. var pad = Ext.String.leftPad;
  1728. return date.getFullYear() + "-"
  1729. + pad(date.getMonth() + 1, 2, '0') + "-"
  1730. + pad(date.getDate(), 2, '0') + "T"
  1731. + pad(date.getHours(), 2, '0') + ":"
  1732. + pad(date.getMinutes(), 2, '0') + ":"
  1733. + pad(date.getSeconds(), 2, '0');
  1734. },
  1735. getElapsed: function(dateA, dateB) {
  1736. return Math.abs(dateA - (dateB || new Date()));
  1737. },
  1738. useStrict: false,
  1739. formatCodeToRegex: function(character, currentGroup) {
  1740. var p = utilDate.parseCodes[character];
  1741. if (p) {
  1742. p = typeof p == 'function'? p() : p;
  1743. utilDate.parseCodes[character] = p;
  1744. }
  1745. return p ? Ext.applyIf({
  1746. c: p.c ? xf(p.c, currentGroup || "{0}") : p.c
  1747. }, p) : {
  1748. g: 0,
  1749. c: null,
  1750. s: Ext.String.escapeRegex(character)
  1751. };
  1752. },
  1753. parseFunctions: {
  1754. "MS": function(input, strict) {
  1755. var re = new RegExp('\\/Date\\(([-+])?(\\d+)(?:[+-]\\d{4})?\\)\\/'),
  1756. r = (input || '').match(re);
  1757. return r? new Date(((r[1] || '') + r[2]) * 1) : null;
  1758. }
  1759. },
  1760. parseRegexes: [],
  1761. formatFunctions: {
  1762. "MS": function() {
  1763. return '\\/Date(' + this.getTime() + ')\\/';
  1764. }
  1765. },
  1766. y2kYear : 50,
  1767. MILLI : "ms",
  1768. SECOND : "s",
  1769. MINUTE : "mi",
  1770. HOUR : "h",
  1771. DAY : "d",
  1772. MONTH : "mo",
  1773. YEAR : "y",
  1774. defaults: {},
  1775. dayNames : [
  1776. "Sunday",
  1777. "Monday",
  1778. "Tuesday",
  1779. "Wednesday",
  1780. "Thursday",
  1781. "Friday",
  1782. "Saturday"
  1783. ],
  1784. monthNames : [
  1785. "January",
  1786. "February",
  1787. "March",
  1788. "April",
  1789. "May",
  1790. "June",
  1791. "July",
  1792. "August",
  1793. "September",
  1794. "October",
  1795. "November",
  1796. "December"
  1797. ],
  1798. monthNumbers : {
  1799. January: 0,
  1800. Jan: 0,
  1801. February: 1,
  1802. Feb: 1,
  1803. March: 2,
  1804. Mar: 2,
  1805. April: 3,
  1806. Apr: 3,
  1807. May: 4,
  1808. June: 5,
  1809. Jun: 5,
  1810. July: 6,
  1811. Jul: 6,
  1812. August: 7,
  1813. Aug: 7,
  1814. September: 8,
  1815. Sep: 8,
  1816. October: 9,
  1817. Oct: 9,
  1818. November: 10,
  1819. Nov: 10,
  1820. December: 11,
  1821. Dec: 11
  1822. },
  1823. defaultFormat : "m/d/Y",
  1824. getShortMonthName : function(month) {
  1825. return Ext.Date.monthNames[month].substring(0, 3);
  1826. },
  1827. getShortDayName : function(day) {
  1828. return Ext.Date.dayNames[day].substring(0, 3);
  1829. },
  1830. getMonthNumber : function(name) {
  1831. return Ext.Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
  1832. },
  1833. formatContainsHourInfo : (function(){
  1834. var stripEscapeRe = /(\\.)/g,
  1835. hourInfoRe = /([gGhHisucUOPZ]|MS)/;
  1836. return function(format){
  1837. return hourInfoRe.test(format.replace(stripEscapeRe, ''));
  1838. };
  1839. }()),
  1840. formatContainsDateInfo : (function(){
  1841. var stripEscapeRe = /(\\.)/g,
  1842. dateInfoRe = /([djzmnYycU]|MS)/;
  1843. return function(format){
  1844. return dateInfoRe.test(format.replace(stripEscapeRe, ''));
  1845. };
  1846. }()),
  1847. unescapeFormat: (function() {
  1848. var slashRe = /\\/gi;
  1849. return function(format) {
  1850. return format.replace(slashRe, '');
  1851. }
  1852. }()),
  1853. formatCodes : {
  1854. d: "Ext.String.leftPad(this.getDate(), 2, '0')",
  1855. D: "Ext.Date.getShortDayName(this.getDay())",
  1856. j: "this.getDate()",
  1857. l: "Ext.Date.dayNames[this.getDay()]",
  1858. N: "(this.getDay() ? this.getDay() : 7)",
  1859. S: "Ext.Date.getSuffix(this)",
  1860. w: "this.getDay()",
  1861. z: "Ext.Date.getDayOfYear(this)",
  1862. W: "Ext.String.leftPad(Ext.Date.getWeekOfYear(this), 2, '0')",
  1863. F: "Ext.Date.monthNames[this.getMonth()]",
  1864. m: "Ext.String.leftPad(this.getMonth() + 1, 2, '0')",
  1865. M: "Ext.Date.getShortMonthName(this.getMonth())",
  1866. n: "(this.getMonth() + 1)",
  1867. t: "Ext.Date.getDaysInMonth(this)",
  1868. L: "(Ext.Date.isLeapYear(this) ? 1 : 0)",
  1869. o: "(this.getFullYear() + (Ext.Date.getWeekOfYear(this) == 1 && this.getMonth() > 0 ? +1 : (Ext.Date.getWeekOfYear(this) >= 52 && this.getMonth() < 11 ? -1 : 0)))",
  1870. Y: "Ext.String.leftPad(this.getFullYear(), 4, '0')",
  1871. y: "('' + this.getFullYear()).substring(2, 4)",
  1872. a: "(this.getHours() < 12 ? 'am' : 'pm')",
  1873. A: "(this.getHours() < 12 ? 'AM' : 'PM')",
  1874. g: "((this.getHours() % 12) ? this.getHours() % 12 : 12)",
  1875. G: "this.getHours()",
  1876. h: "Ext.String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0')",
  1877. H: "Ext.String.leftPad(this.getHours(), 2, '0')",
  1878. i: "Ext.String.leftPad(this.getMinutes(), 2, '0')",
  1879. s: "Ext.String.leftPad(this.getSeconds(), 2, '0')",
  1880. u: "Ext.String.leftPad(this.getMilliseconds(), 3, '0')",
  1881. O: "Ext.Date.getGMTOffset(this)",
  1882. P: "Ext.Date.getGMTOffset(this, true)",
  1883. T: "Ext.Date.getTimezone(this)",
  1884. Z: "(this.getTimezoneOffset() * -60)",
  1885. c: function() {
  1886. var c, code, i, l, e;
  1887. for (c = "Y-m-dTH:i:sP", code = [], i = 0, l = c.length; i < l; ++i) {
  1888. e = c.charAt(i);
  1889. code.push(e == "T" ? "'T'" : utilDate.getFormatCode(e));
  1890. }
  1891. return code.join(" + ");
  1892. },
  1893. U: "Math.round(this.getTime() / 1000)"
  1894. },
  1895. isValid : function(y, m, d, h, i, s, ms) {
  1896. h = h || 0;
  1897. i = i || 0;
  1898. s = s || 0;
  1899. ms = ms || 0;
  1900. var dt = utilDate.add(new Date(y < 100 ? 100 : y, m - 1, d, h, i, s, ms), utilDate.YEAR, y < 100 ? y - 100 : 0);
  1901. return y == dt.getFullYear() &&
  1902. m == dt.getMonth() + 1 &&
  1903. d == dt.getDate() &&
  1904. h == dt.getHours() &&
  1905. i == dt.getMinutes() &&
  1906. s == dt.getSeconds() &&
  1907. ms == dt.getMilliseconds();
  1908. },
  1909. parse : function(input, format, strict) {
  1910. var p = utilDate.parseFunctions;
  1911. if (p[format] == null) {
  1912. utilDate.createParser(format);
  1913. }
  1914. return p[format](input, Ext.isDefined(strict) ? strict : utilDate.useStrict);
  1915. },
  1916. parseDate: function(input, format, strict){
  1917. return utilDate.parse(input, format, strict);
  1918. },
  1919. getFormatCode : function(character) {
  1920. var f = utilDate.formatCodes[character];
  1921. if (f) {
  1922. f = typeof f == 'function'? f() : f;
  1923. utilDate.formatCodes[character] = f;
  1924. }
  1925. return f || ("'" + Ext.String.escape(character) + "'");
  1926. },
  1927. createFormat : function(format) {
  1928. var code = [],
  1929. special = false,
  1930. ch = '',
  1931. i;
  1932. for (i = 0; i < format.length; ++i) {
  1933. ch = format.charAt(i);
  1934. if (!special && ch == "\\") {
  1935. special = true;
  1936. } else if (special) {
  1937. special = false;
  1938. code.push("'" + Ext.String.escape(ch) + "'");
  1939. } else {
  1940. code.push(utilDate.getFormatCode(ch));
  1941. }
  1942. }
  1943. utilDate.formatFunctions[format] = Ext.functionFactory("return " + code.join('+'));
  1944. },
  1945. createParser : (function() {
  1946. var code = [
  1947. "var dt, y, m, d, h, i, s, ms, o, z, zz, u, v,",
  1948. "def = Ext.Date.defaults,",
  1949. "results = String(input).match(Ext.Date.parseRegexes[{0}]);",
  1950. "if(results){",
  1951. "{1}",
  1952. "if(u != null){",
  1953. "v = new Date(u * 1000);",
  1954. "}else{",
  1955. "dt = Ext.Date.clearTime(new Date);",
  1956. "y = Ext.Number.from(y, Ext.Number.from(def.y, dt.getFullYear()));",
  1957. "m = Ext.Number.from(m, Ext.Number.from(def.m - 1, dt.getMonth()));",
  1958. "d = Ext.Number.from(d, Ext.Number.from(def.d, dt.getDate()));",
  1959. "h = Ext.Number.from(h, Ext.Number.from(def.h, dt.getHours()));",
  1960. "i = Ext.Number.from(i, Ext.Number.from(def.i, dt.getMinutes()));",
  1961. "s = Ext.Number.from(s, Ext.Number.from(def.s, dt.getSeconds()));",
  1962. "ms = Ext.Number.from(ms, Ext.Number.from(def.ms, dt.getMilliseconds()));",
  1963. "if(z >= 0 && y >= 0){",
  1964. "v = Ext.Date.add(new Date(y < 100 ? 100 : y, 0, 1, h, i, s, ms), Ext.Date.YEAR, y < 100 ? y - 100 : 0);",
  1965. "v = !strict? v : (strict === true && (z <= 364 || (Ext.Date.isLeapYear(v) && z <= 365))? Ext.Date.add(v, Ext.Date.DAY, z) : null);",
  1966. "}else if(strict === true && !Ext.Date.isValid(y, m + 1, d, h, i, s, ms)){",
  1967. "v = null;",
  1968. "}else{",
  1969. "v = Ext.Date.add(new Date(y < 100 ? 100 : y, m, d, h, i, s, ms), Ext.Date.YEAR, y < 100 ? y - 100 : 0);",
  1970. "}",
  1971. "}",
  1972. "}",
  1973. "if(v){",
  1974. "if(zz != null){",
  1975. "v = Ext.Date.add(v, Ext.Date.SECOND, -v.getTimezoneOffset() * 60 - zz);",
  1976. "}else if(o){",
  1977. "v = Ext.Date.add(v, Ext.Date.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn));",
  1978. "}",
  1979. "}",
  1980. "return v;"
  1981. ].join('\n');
  1982. return function(format) {
  1983. var regexNum = utilDate.parseRegexes.length,
  1984. currentGroup = 1,
  1985. calc = [],
  1986. regex = [],
  1987. special = false,
  1988. ch = "",
  1989. i = 0,
  1990. len = format.length,
  1991. atEnd = [],
  1992. obj;
  1993. for (; i < len; ++i) {
  1994. ch = format.charAt(i);
  1995. if (!special && ch == "\\") {
  1996. special = true;
  1997. } else if (special) {
  1998. special = false;
  1999. regex.push(Ext.String.escape(ch));
  2000. } else {
  2001. obj = utilDate.formatCodeToRegex(ch, currentGroup);
  2002. currentGroup += obj.g;
  2003. regex.push(obj.s);
  2004. if (obj.g && obj.c) {
  2005. if (obj.calcAtEnd) {
  2006. atEnd.push(obj.c);
  2007. } else {
  2008. calc.push(obj.c);
  2009. }
  2010. }
  2011. }
  2012. }
  2013. calc = calc.concat(atEnd);
  2014. utilDate.parseRegexes[regexNum] = new RegExp("^" + regex.join('') + "$", 'i');
  2015. utilDate.parseFunctions[format] = Ext.functionFactory("input", "strict", xf(code, regexNum, calc.join('')));
  2016. };
  2017. }()),
  2018. parseCodes : {
  2019. d: {
  2020. g:1,
  2021. c:"d = parseInt(results[{0}], 10);\n",
  2022. s:"(3[0-1]|[1-2][0-9]|0[1-9])"
  2023. },
  2024. j: {
  2025. g:1,
  2026. c:"d = parseInt(results[{0}], 10);\n",
  2027. s:"(3[0-1]|[1-2][0-9]|[1-9])"
  2028. },
  2029. D: function() {
  2030. for (var a = [], i = 0; i < 7; a.push(utilDate.getShortDayName(i)), ++i);
  2031. return {
  2032. g:0,
  2033. c:null,
  2034. s:"(?:" + a.join("|") +")"
  2035. };
  2036. },
  2037. l: function() {
  2038. return {
  2039. g:0,
  2040. c:null,
  2041. s:"(?:" + utilDate.dayNames.join("|") + ")"
  2042. };
  2043. },
  2044. N: {
  2045. g:0,
  2046. c:null,
  2047. s:"[1-7]"
  2048. },
  2049. S: {
  2050. g:0,
  2051. c:null,
  2052. s:"(?:st|nd|rd|th)"
  2053. },
  2054. w: {
  2055. g:0,
  2056. c:null,
  2057. s:"[0-6]"
  2058. },
  2059. z: {
  2060. g:1,
  2061. c:"z = parseInt(results[{0}], 10);\n",
  2062. s:"(\\d{1,3})"
  2063. },
  2064. W: {
  2065. g:0,
  2066. c:null,
  2067. s:"(?:\\d{2})"
  2068. },
  2069. F: function() {
  2070. return {
  2071. g:1,
  2072. c:"m = parseInt(Ext.Date.getMonthNumber(results[{0}]), 10);\n",
  2073. s:"(" + utilDate.monthNames.join("|") + ")"
  2074. };
  2075. },
  2076. M: function() {
  2077. for (var a = [], i = 0; i < 12; a.push(utilDate.getShortMonthName(i)), ++i);
  2078. return Ext.applyIf({
  2079. s:"(" + a.join("|") + ")"
  2080. }, utilDate.formatCodeToRegex("F"));
  2081. },
  2082. m: {
  2083. g:1,
  2084. c:"m = parseInt(results[{0}], 10) - 1;\n",
  2085. s:"(1[0-2]|0[1-9])"
  2086. },
  2087. n: {
  2088. g:1,
  2089. c:"m = parseInt(results[{0}], 10) - 1;\n",
  2090. s:"(1[0-2]|[1-9])"
  2091. },
  2092. t: {
  2093. g:0,
  2094. c:null,
  2095. s:"(?:\\d{2})"
  2096. },
  2097. L: {
  2098. g:0,
  2099. c:null,
  2100. s:"(?:1|0)"
  2101. },
  2102. o: function() {
  2103. return utilDate.formatCodeToRegex("Y");
  2104. },
  2105. Y: {
  2106. g:1,
  2107. c:"y = parseInt(results[{0}], 10);\n",
  2108. s:"(\\d{4})"
  2109. },
  2110. y: {
  2111. g:1,
  2112. c:"var ty = parseInt(results[{0}], 10);\n"
  2113. + "y = ty > Ext.Date.y2kYear ? 1900 + ty : 2000 + ty;\n",
  2114. s:"(\\d{1,2})"
  2115. },
  2116. a: {
  2117. g:1,
  2118. c:"if (/(am)/i.test(results[{0}])) {\n"
  2119. + "if (!h || h == 12) { h = 0; }\n"
  2120. + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
  2121. s:"(am|pm|AM|PM)",
  2122. calcAtEnd: true
  2123. },
  2124. A: {
  2125. g:1,
  2126. c:"if (/(am)/i.test(results[{0}])) {\n"
  2127. + "if (!h || h == 12) { h = 0; }\n"
  2128. + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
  2129. s:"(AM|PM|am|pm)",
  2130. calcAtEnd: true
  2131. },
  2132. g: {
  2133. g:1,
  2134. c:"h = parseInt(results[{0}], 10);\n",
  2135. s:"(1[0-2]|[0-9])"
  2136. },
  2137. G: {
  2138. g:1,
  2139. c:"h = parseInt(results[{0}], 10);\n",
  2140. s:"(2[0-3]|1[0-9]|[0-9])"
  2141. },
  2142. h: {
  2143. g:1,
  2144. c:"h = parseInt(results[{0}], 10);\n",
  2145. s:"(1[0-2]|0[1-9])"
  2146. },
  2147. H: {
  2148. g:1,
  2149. c:"h = parseInt(results[{0}], 10);\n",
  2150. s:"(2[0-3]|[0-1][0-9])"
  2151. },
  2152. i: {
  2153. g:1,
  2154. c:"i = parseInt(results[{0}], 10);\n",
  2155. s:"([0-5][0-9])"
  2156. },
  2157. s: {
  2158. g:1,
  2159. c:"s = parseInt(results[{0}], 10);\n",
  2160. s:"([0-5][0-9])"
  2161. },
  2162. u: {
  2163. g:1,
  2164. c:"ms = results[{0}]; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n",
  2165. s:"(\\d+)"
  2166. },
  2167. O: {
  2168. g:1,
  2169. c:[
  2170. "o = results[{0}];",
  2171. "var sn = o.substring(0,1),",
  2172. "hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60),",
  2173. "mn = o.substring(3,5) % 60;",
  2174. "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"
  2175. ].join("\n"),
  2176. s: "([+-]\\d{4})"
  2177. },
  2178. P: {
  2179. g:1,
  2180. c:[
  2181. "o = results[{0}];",
  2182. "var sn = o.substring(0,1),",
  2183. "hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60),",
  2184. "mn = o.substring(4,6) % 60;",
  2185. "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"
  2186. ].join("\n"),
  2187. s: "([+-]\\d{2}:\\d{2})"
  2188. },
  2189. T: {
  2190. g:0,
  2191. c:null,
  2192. s:"[A-Z]{1,4}"
  2193. },
  2194. Z: {
  2195. g:1,
  2196. c:"zz = results[{0}] * 1;\n"
  2197. + "zz = (-43200 <= zz && zz <= 50400)? zz : null;\n",
  2198. s:"([+-]?\\d{1,5})"
  2199. },
  2200. c: function() {
  2201. var calc = [],
  2202. arr = [
  2203. utilDate.formatCodeToRegex("Y", 1),
  2204. utilDate.formatCodeToRegex("m", 2),
  2205. utilDate.formatCodeToRegex("d", 3),
  2206. utilDate.formatCodeToRegex("H", 4),
  2207. utilDate.formatCodeToRegex("i", 5),
  2208. utilDate.formatCodeToRegex("s", 6),
  2209. {c:"ms = results[7] || '0'; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n"},
  2210. {c:[
  2211. "if(results[8]) {",
  2212. "if(results[8] == 'Z'){",
  2213. "zz = 0;",
  2214. "}else if (results[8].indexOf(':') > -1){",
  2215. utilDate.formatCodeToRegex("P", 8).c,
  2216. "}else{",
  2217. utilDate.formatCodeToRegex("O", 8).c,
  2218. "}",
  2219. "}"
  2220. ].join('\n')}
  2221. ],
  2222. i,
  2223. l;
  2224. for (i = 0, l = arr.length; i < l; ++i) {
  2225. calc.push(arr[i].c);
  2226. }
  2227. return {
  2228. g:1,
  2229. c:calc.join(""),
  2230. s:[
  2231. arr[0].s,
  2232. "(?:", "-", arr[1].s,
  2233. "(?:", "-", arr[2].s,
  2234. "(?:",
  2235. "(?:T| )?",
  2236. arr[3].s, ":", arr[4].s,
  2237. "(?::", arr[5].s, ")?",
  2238. "(?:(?:\\.|,)(\\d+))?",
  2239. "(Z|(?:[-+]\\d{2}(?::)?\\d{2}))?",
  2240. ")?",
  2241. ")?",
  2242. ")?"
  2243. ].join("")
  2244. };
  2245. },
  2246. U: {
  2247. g:1,
  2248. c:"u = parseInt(results[{0}], 10);\n",
  2249. s:"(-?\\d+)"
  2250. }
  2251. },
  2252. dateFormat: function(date, format) {
  2253. return utilDate.format(date, format);
  2254. },
  2255. isEqual: function(date1, date2) {
  2256. if (date1 && date2) {
  2257. return (date1.getTime() === date2.getTime());
  2258. }
  2259. return !(date1 || date2);
  2260. },
  2261. format: function(date, format) {
  2262. var formatFunctions = utilDate.formatFunctions;
  2263. if (!Ext.isDate(date)) {
  2264. return '';
  2265. }
  2266. if (formatFunctions[format] == null) {
  2267. utilDate.createFormat(format);
  2268. }
  2269. return formatFunctions[format].call(date) + '';
  2270. },
  2271. getTimezone : function(date) {
  2272. return date.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, "");
  2273. },
  2274. getGMTOffset : function(date, colon) {
  2275. var offset = date.getTimezoneOffset();
  2276. return (offset > 0 ? "-" : "+")
  2277. + Ext.String.leftPad(Math.floor(Math.abs(offset) / 60), 2, "0")
  2278. + (colon ? ":" : "")
  2279. + Ext.String.leftPad(Math.abs(offset % 60), 2, "0");
  2280. },
  2281. getDayOfYear: function(date) {
  2282. var num = 0,
  2283. d = Ext.Date.clone(date),
  2284. m = date.getMonth(),
  2285. i;
  2286. for (i = 0, d.setDate(1), d.setMonth(0); i < m; d.setMonth(++i)) {
  2287. num += utilDate.getDaysInMonth(d);
  2288. }
  2289. return num + date.getDate() - 1;
  2290. },
  2291. getWeekOfYear : (function() {
  2292. var ms1d = 864e5,
  2293. ms7d = 7 * ms1d;
  2294. return function(date) {
  2295. var DC3 = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate() + 3) / ms1d,
  2296. AWN = Math.floor(DC3 / 7),
  2297. Wyr = new Date(AWN * ms7d).getUTCFullYear();
  2298. return AWN - Math.floor(Date.UTC(Wyr, 0, 7) / ms7d) + 1;
  2299. };
  2300. }()),
  2301. isLeapYear : function(date) {
  2302. var year = date.getFullYear();
  2303. return !!((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));
  2304. },
  2305. getFirstDayOfMonth : function(date) {
  2306. var day = (date.getDay() - (date.getDate() - 1)) % 7;
  2307. return (day < 0) ? (day + 7) : day;
  2308. },
  2309. getLastDayOfMonth : function(date) {
  2310. return utilDate.getLastDateOfMonth(date).getDay();
  2311. },
  2312. getFirstDateOfMonth : function(date) {
  2313. return new Date(date.getFullYear(), date.getMonth(), 1);
  2314. },
  2315. getLastDateOfMonth : function(date) {
  2316. return new Date(date.getFullYear(), date.getMonth(), utilDate.getDaysInMonth(date));
  2317. },
  2318. getDaysInMonth: (function() {
  2319. var daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  2320. return function(date) {
  2321. var m = date.getMonth();
  2322. return m == 1 && utilDate.isLeapYear(date) ? 29 : daysInMonth[m];
  2323. };
  2324. }()),
  2325. getSuffix : function(date) {
  2326. switch (date.getDate()) {
  2327. case 1:
  2328. case 21:
  2329. case 31:
  2330. return "st";
  2331. case 2:
  2332. case 22:
  2333. return "nd";
  2334. case 3:
  2335. case 23:
  2336. return "rd";
  2337. default:
  2338. return "th";
  2339. }
  2340. },
  2341. clone : function(date) {
  2342. return new Date(date.getTime());
  2343. },
  2344. isDST : function(date) {
  2345. return new Date(date.getFullYear(), 0, 1).getTimezoneOffset() != date.getTimezoneOffset();
  2346. },
  2347. clearTime : function(date, clone) {
  2348. if (clone) {
  2349. return Ext.Date.clearTime(Ext.Date.clone(date));
  2350. }
  2351. var d = date.getDate(),
  2352. hr,
  2353. c;
  2354. date.setHours(0);
  2355. date.setMinutes(0);
  2356. date.setSeconds(0);
  2357. date.setMilliseconds(0);
  2358. if (date.getDate() != d) {
  2359. for (hr = 1, c = utilDate.add(date, Ext.Date.HOUR, hr); c.getDate() != d; hr++, c = utilDate.add(date, Ext.Date.HOUR, hr));
  2360. date.setDate(d);
  2361. date.setHours(c.getHours());
  2362. }
  2363. return date;
  2364. },
  2365. add : function(date, interval, value) {
  2366. var d = Ext.Date.clone(date),
  2367. Date = Ext.Date,
  2368. day;
  2369. if (!interval || value === 0) {
  2370. return d;
  2371. }
  2372. switch(interval.toLowerCase()) {
  2373. case Ext.Date.MILLI:
  2374. d.setMilliseconds(d.getMilliseconds() + value);
  2375. break;
  2376. case Ext.Date.SECOND:
  2377. d.setSeconds(d.getSeconds() + value);
  2378. break;
  2379. case Ext.Date.MINUTE:
  2380. d.setMinutes(d.getMinutes() + value);
  2381. break;
  2382. case Ext.Date.HOUR:
  2383. d.setHours(d.getHours() + value);
  2384. break;
  2385. case Ext.Date.DAY:
  2386. d.setDate(d.getDate() + value);
  2387. break;
  2388. case Ext.Date.MONTH:
  2389. day = date.getDate();
  2390. if (day > 28) {
  2391. day = Math.min(day, Ext.Date.getLastDateOfMonth(Ext.Date.add(Ext.Date.getFirstDateOfMonth(date), Ext.Date.MONTH, value)).getDate());
  2392. }
  2393. d.setDate(day);
  2394. d.setMonth(date.getMonth() + value);
  2395. break;
  2396. case Ext.Date.YEAR:
  2397. day = date.getDate();
  2398. if (day > 28) {
  2399. day = Math.min(day, Ext.Date.getLastDateOfMonth(Ext.Date.add(Ext.Date.getFirstDateOfMonth(date), Ext.Date.YEAR, value)).getDate());
  2400. }
  2401. d.setDate(day);
  2402. d.setFullYear(date.getFullYear() + value);
  2403. break;
  2404. }
  2405. return d;
  2406. },
  2407. between : function(date, start, end) {
  2408. var t = date.getTime();
  2409. return start.getTime() <= t && t <= end.getTime();
  2410. },
  2411. compat: function() {
  2412. var nativeDate = window.Date,
  2413. p, u,
  2414. 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'],
  2415. proto = ['dateFormat', 'format', 'getTimezone', 'getGMTOffset', 'getDayOfYear', 'getWeekOfYear', 'isLeapYear', 'getFirstDayOfMonth', 'getLastDayOfMonth', 'getDaysInMonth', 'getSuffix', 'clone', 'isDST', 'clearTime', 'add', 'between'],
  2416. sLen = statics.length,
  2417. pLen = proto.length,
  2418. stat, prot, s;
  2419. for (s = 0; s < sLen; s++) {
  2420. stat = statics[s];
  2421. nativeDate[stat] = utilDate[stat];
  2422. }
  2423. for (p = 0; p < pLen; p++) {
  2424. prot = proto[p];
  2425. nativeDate.prototype[prot] = function() {
  2426. var args = Array.prototype.slice.call(arguments);
  2427. args.unshift(this);
  2428. return utilDate[prot].apply(utilDate, args);
  2429. };
  2430. }
  2431. }
  2432. };
  2433. var utilDate = Ext.Date;
  2434. }());
  2435. //@tag foundation,core
  2436. //@require ../lang/Date.js
  2437. (function(flexSetter) {
  2438. var noArgs = [],
  2439. Base = function(){};
  2440. Ext.apply(Base, {
  2441. $className: 'Ext.Base',
  2442. $isClass: true,
  2443. create: function() {
  2444. return Ext.create.apply(Ext, [this].concat(Array.prototype.slice.call(arguments, 0)));
  2445. },
  2446. extend: function(parent) {
  2447. var parentPrototype = parent.prototype,
  2448. basePrototype, prototype, i, ln, name, statics;
  2449. prototype = this.prototype = Ext.Object.chain(parentPrototype);
  2450. prototype.self = this;
  2451. this.superclass = prototype.superclass = parentPrototype;
  2452. if (!parent.$isClass) {
  2453. basePrototype = Ext.Base.prototype;
  2454. for (i in basePrototype) {
  2455. if (i in prototype) {
  2456. prototype[i] = basePrototype[i];
  2457. }
  2458. }
  2459. }
  2460. statics = parentPrototype.$inheritableStatics;
  2461. if (statics) {
  2462. for (i = 0,ln = statics.length; i < ln; i++) {
  2463. name = statics[i];
  2464. if (!this.hasOwnProperty(name)) {
  2465. this[name] = parent[name];
  2466. }
  2467. }
  2468. }
  2469. if (parent.$onExtended) {
  2470. this.$onExtended = parent.$onExtended.slice();
  2471. }
  2472. prototype.config = new prototype.configClass();
  2473. prototype.initConfigList = prototype.initConfigList.slice();
  2474. prototype.initConfigMap = Ext.clone(prototype.initConfigMap);
  2475. prototype.configMap = Ext.Object.chain(prototype.configMap);
  2476. },
  2477. $onExtended: [],
  2478. triggerExtended: function() {
  2479. var callbacks = this.$onExtended,
  2480. ln = callbacks.length,
  2481. i, callback;
  2482. if (ln > 0) {
  2483. for (i = 0; i < ln; i++) {
  2484. callback = callbacks[i];
  2485. callback.fn.apply(callback.scope || this, arguments);
  2486. }
  2487. }
  2488. },
  2489. onExtended: function(fn, scope) {
  2490. this.$onExtended.push({
  2491. fn: fn,
  2492. scope: scope
  2493. });
  2494. return this;
  2495. },
  2496. addConfig: function(config, fullMerge) {
  2497. var prototype = this.prototype,
  2498. configNameCache = Ext.Class.configNameCache,
  2499. hasConfig = prototype.configMap,
  2500. initConfigList = prototype.initConfigList,
  2501. initConfigMap = prototype.initConfigMap,
  2502. defaultConfig = prototype.config,
  2503. initializedName, name, value;
  2504. for (name in config) {
  2505. if (config.hasOwnProperty(name)) {
  2506. if (!hasConfig[name]) {
  2507. hasConfig[name] = true;
  2508. }
  2509. value = config[name];
  2510. initializedName = configNameCache[name].initialized;
  2511. if (!initConfigMap[name] && value !== null && !prototype[initializedName]) {
  2512. initConfigMap[name] = true;
  2513. initConfigList.push(name);
  2514. }
  2515. }
  2516. }
  2517. if (fullMerge) {
  2518. Ext.merge(defaultConfig, config);
  2519. }
  2520. else {
  2521. Ext.mergeIf(defaultConfig, config);
  2522. }
  2523. prototype.configClass = Ext.Object.classify(defaultConfig);
  2524. },
  2525. addStatics: function(members) {
  2526. var member, name;
  2527. for (name in members) {
  2528. if (members.hasOwnProperty(name)) {
  2529. member = members[name];
  2530. if (typeof member == 'function' && !member.$isClass && member !== Ext.emptyFn && member !== Ext.identityFn) {
  2531. member.$owner = this;
  2532. member.$name = name;
  2533. }
  2534. this[name] = member;
  2535. }
  2536. }
  2537. return this;
  2538. },
  2539. addInheritableStatics: function(members) {
  2540. var inheritableStatics,
  2541. hasInheritableStatics,
  2542. prototype = this.prototype,
  2543. name, member;
  2544. inheritableStatics = prototype.$inheritableStatics;
  2545. hasInheritableStatics = prototype.$hasInheritableStatics;
  2546. if (!inheritableStatics) {
  2547. inheritableStatics = prototype.$inheritableStatics = [];
  2548. hasInheritableStatics = prototype.$hasInheritableStatics = {};
  2549. }
  2550. for (name in members) {
  2551. if (members.hasOwnProperty(name)) {
  2552. member = members[name];
  2553. this[name] = member;
  2554. if (!hasInheritableStatics[name]) {
  2555. hasInheritableStatics[name] = true;
  2556. inheritableStatics.push(name);
  2557. }
  2558. }
  2559. }
  2560. return this;
  2561. },
  2562. addMembers: function(members) {
  2563. var prototype = this.prototype,
  2564. enumerables = Ext.enumerables,
  2565. names = [],
  2566. i, ln, name, member;
  2567. for (name in members) {
  2568. names.push(name);
  2569. }
  2570. if (enumerables) {
  2571. names.push.apply(names, enumerables);
  2572. }
  2573. for (i = 0,ln = names.length; i < ln; i++) {
  2574. name = names[i];
  2575. if (members.hasOwnProperty(name)) {
  2576. member = members[name];
  2577. if (typeof member == 'function' && !member.$isClass && member !== Ext.emptyFn) {
  2578. member.$owner = this;
  2579. member.$name = name;
  2580. }
  2581. prototype[name] = member;
  2582. }
  2583. }
  2584. return this;
  2585. },
  2586. addMember: function(name, member) {
  2587. if (typeof member == 'function' && !member.$isClass && member !== Ext.emptyFn) {
  2588. member.$owner = this;
  2589. member.$name = name;
  2590. }
  2591. this.prototype[name] = member;
  2592. return this;
  2593. },
  2594. implement: function() {
  2595. this.addMembers.apply(this, arguments);
  2596. },
  2597. borrow: function(fromClass, members) {
  2598. var prototype = this.prototype,
  2599. fromPrototype = fromClass.prototype,
  2600. i, ln, name, fn, toBorrow;
  2601. members = Ext.Array.from(members);
  2602. for (i = 0,ln = members.length; i < ln; i++) {
  2603. name = members[i];
  2604. toBorrow = fromPrototype[name];
  2605. if (typeof toBorrow == 'function') {
  2606. fn = Ext.Function.clone(toBorrow);
  2607. fn.$owner = this;
  2608. fn.$name = name;
  2609. prototype[name] = fn;
  2610. }
  2611. else {
  2612. prototype[name] = toBorrow;
  2613. }
  2614. }
  2615. return this;
  2616. },
  2617. override: function(members) {
  2618. var me = this,
  2619. enumerables = Ext.enumerables,
  2620. target = me.prototype,
  2621. cloneFunction = Ext.Function.clone,
  2622. name, index, member, statics, names, previous;
  2623. if (arguments.length === 2) {
  2624. name = members;
  2625. members = {};
  2626. members[name] = arguments[1];
  2627. enumerables = null;
  2628. }
  2629. do {
  2630. names = [];
  2631. statics = null;
  2632. for (name in members) {
  2633. if (name == 'statics') {
  2634. statics = members[name];
  2635. } else if (name == 'config') {
  2636. me.addConfig(members[name], true);
  2637. } else {
  2638. names.push(name);
  2639. }
  2640. }
  2641. if (enumerables) {
  2642. names.push.apply(names, enumerables);
  2643. }
  2644. for (index = names.length; index--; ) {
  2645. name = names[index];
  2646. if (members.hasOwnProperty(name)) {
  2647. member = members[name];
  2648. if (typeof member == 'function' && !member.$className && member !== Ext.emptyFn) {
  2649. if (typeof member.$owner != 'undefined') {
  2650. member = cloneFunction(member);
  2651. }
  2652. member.$owner = me;
  2653. member.$name = name;
  2654. previous = target[name];
  2655. if (previous) {
  2656. member.$previous = previous;
  2657. }
  2658. }
  2659. target[name] = member;
  2660. }
  2661. }
  2662. target = me;
  2663. members = statics;
  2664. } while (members);
  2665. return this;
  2666. },
  2667. callParent: function(args) {
  2668. var method;
  2669. return (method = this.callParent.caller) && (method.$previous ||
  2670. ((method = method.$owner ? method : method.caller) &&
  2671. method.$owner.superclass.self[method.$name])).apply(this, args || noArgs);
  2672. },
  2673. callSuper: function(args) {
  2674. var method;
  2675. return (method = this.callSuper.caller) &&
  2676. ((method = method.$owner ? method : method.caller) &&
  2677. method.$owner.superclass.self[method.$name]).apply(this, args || noArgs);
  2678. },
  2679. mixin: function(name, mixinClass) {
  2680. var mixin = mixinClass.prototype,
  2681. prototype = this.prototype,
  2682. key;
  2683. if (typeof mixin.onClassMixedIn != 'undefined') {
  2684. mixin.onClassMixedIn.call(mixinClass, this);
  2685. }
  2686. if (!prototype.hasOwnProperty('mixins')) {
  2687. if ('mixins' in prototype) {
  2688. prototype.mixins = Ext.Object.chain(prototype.mixins);
  2689. }
  2690. else {
  2691. prototype.mixins = {};
  2692. }
  2693. }
  2694. for (key in mixin) {
  2695. if (key === 'mixins') {
  2696. Ext.merge(prototype.mixins, mixin[key]);
  2697. }
  2698. else if (typeof prototype[key] == 'undefined' && key != 'mixinId' && key != 'config') {
  2699. prototype[key] = mixin[key];
  2700. }
  2701. }
  2702. if ('config' in mixin) {
  2703. this.addConfig(mixin.config, false);
  2704. }
  2705. prototype.mixins[name] = mixin;
  2706. },
  2707. getName: function() {
  2708. return Ext.getClassName(this);
  2709. },
  2710. createAlias: flexSetter(function(alias, origin) {
  2711. this.override(alias, function() {
  2712. return this[origin].apply(this, arguments);
  2713. });
  2714. }),
  2715. addXtype: function(xtype) {
  2716. var prototype = this.prototype,
  2717. xtypesMap = prototype.xtypesMap,
  2718. xtypes = prototype.xtypes,
  2719. xtypesChain = prototype.xtypesChain;
  2720. if (!prototype.hasOwnProperty('xtypesMap')) {
  2721. xtypesMap = prototype.xtypesMap = Ext.merge({}, prototype.xtypesMap || {});
  2722. xtypes = prototype.xtypes = prototype.xtypes ? [].concat(prototype.xtypes) : [];
  2723. xtypesChain = prototype.xtypesChain = prototype.xtypesChain ? [].concat(prototype.xtypesChain) : [];
  2724. prototype.xtype = xtype;
  2725. }
  2726. if (!xtypesMap[xtype]) {
  2727. xtypesMap[xtype] = true;
  2728. xtypes.push(xtype);
  2729. xtypesChain.push(xtype);
  2730. Ext.ClassManager.setAlias(this, 'widget.' + xtype);
  2731. }
  2732. return this;
  2733. }
  2734. });
  2735. Base.implement({
  2736. isInstance: true,
  2737. $className: 'Ext.Base',
  2738. configClass: Ext.emptyFn,
  2739. initConfigList: [],
  2740. configMap: {},
  2741. initConfigMap: {},
  2742. statics: function() {
  2743. var method = this.statics.caller,
  2744. self = this.self;
  2745. if (!method) {
  2746. return self;
  2747. }
  2748. return method.$owner;
  2749. },
  2750. callParent: function(args) {
  2751. var method,
  2752. superMethod = (method = this.callParent.caller) && (method.$previous ||
  2753. ((method = method.$owner ? method : method.caller) &&
  2754. method.$owner.superclass[method.$name]));
  2755. return superMethod.apply(this, args || noArgs);
  2756. },
  2757. callSuper: function(args) {
  2758. var method,
  2759. superMethod = (method = this.callSuper.caller) &&
  2760. ((method = method.$owner ? method : method.caller) &&
  2761. method.$owner.superclass[method.$name]);
  2762. return superMethod.apply(this, args || noArgs);
  2763. },
  2764. self: Base,
  2765. constructor: function() {
  2766. return this;
  2767. },
  2768. initConfig: function(config) {
  2769. var instanceConfig = config,
  2770. configNameCache = Ext.Class.configNameCache,
  2771. defaultConfig = new this.configClass(),
  2772. defaultConfigList = this.initConfigList,
  2773. hasConfig = this.configMap,
  2774. nameMap, i, ln, name, initializedName;
  2775. this.initConfig = Ext.emptyFn;
  2776. this.initialConfig = instanceConfig || {};
  2777. this.config = config = (instanceConfig) ? Ext.merge(defaultConfig, config) : defaultConfig;
  2778. if (instanceConfig) {
  2779. defaultConfigList = defaultConfigList.slice();
  2780. for (name in instanceConfig) {
  2781. if (hasConfig[name]) {
  2782. if (instanceConfig[name] !== null) {
  2783. defaultConfigList.push(name);
  2784. this[configNameCache[name].initialized] = false;
  2785. }
  2786. }
  2787. }
  2788. }
  2789. for (i = 0,ln = defaultConfigList.length; i < ln; i++) {
  2790. name = defaultConfigList[i];
  2791. nameMap = configNameCache[name];
  2792. initializedName = nameMap.initialized;
  2793. if (!this[initializedName]) {
  2794. this[initializedName] = true;
  2795. this[nameMap.set].call(this, config[name]);
  2796. }
  2797. }
  2798. return this;
  2799. },
  2800. hasConfig: function(name) {
  2801. return Boolean(this.configMap[name]);
  2802. },
  2803. setConfig: function(config, applyIfNotSet) {
  2804. if (!config) {
  2805. return this;
  2806. }
  2807. var configNameCache = Ext.Class.configNameCache,
  2808. currentConfig = this.config,
  2809. hasConfig = this.configMap,
  2810. initialConfig = this.initialConfig,
  2811. name, value;
  2812. applyIfNotSet = Boolean(applyIfNotSet);
  2813. for (name in config) {
  2814. if (applyIfNotSet && initialConfig.hasOwnProperty(name)) {
  2815. continue;
  2816. }
  2817. value = config[name];
  2818. currentConfig[name] = value;
  2819. if (hasConfig[name]) {
  2820. this[configNameCache[name].set](value);
  2821. }
  2822. }
  2823. return this;
  2824. },
  2825. getConfig: function(name) {
  2826. var configNameCache = Ext.Class.configNameCache;
  2827. return this[configNameCache[name].get]();
  2828. },
  2829. getInitialConfig: function(name) {
  2830. var config = this.config;
  2831. if (!name) {
  2832. return config;
  2833. }
  2834. else {
  2835. return config[name];
  2836. }
  2837. },
  2838. onConfigUpdate: function(names, callback, scope) {
  2839. var self = this.self,
  2840. i, ln, name,
  2841. updaterName, updater, newUpdater;
  2842. names = Ext.Array.from(names);
  2843. scope = scope || this;
  2844. for (i = 0,ln = names.length; i < ln; i++) {
  2845. name = names[i];
  2846. updaterName = 'update' + Ext.String.capitalize(name);
  2847. updater = this[updaterName] || Ext.emptyFn;
  2848. newUpdater = function() {
  2849. updater.apply(this, arguments);
  2850. scope[callback].apply(scope, arguments);
  2851. };
  2852. newUpdater.$name = updaterName;
  2853. newUpdater.$owner = self;
  2854. this[updaterName] = newUpdater;
  2855. }
  2856. },
  2857. destroy: function() {
  2858. this.destroy = Ext.emptyFn;
  2859. }
  2860. });
  2861. Base.prototype.callOverridden = Base.prototype.callParent;
  2862. Ext.Base = Base;
  2863. }(Ext.Function.flexSetter));
  2864. //@tag foundation,core
  2865. //@require Base.js
  2866. (function() {
  2867. var ExtClass,
  2868. Base = Ext.Base,
  2869. baseStaticMembers = [],
  2870. baseStaticMember, baseStaticMemberLength;
  2871. for (baseStaticMember in Base) {
  2872. if (Base.hasOwnProperty(baseStaticMember)) {
  2873. baseStaticMembers.push(baseStaticMember);
  2874. }
  2875. }
  2876. baseStaticMemberLength = baseStaticMembers.length;
  2877. function makeCtor (className) {
  2878. function constructor () {
  2879. return this.constructor.apply(this, arguments) || null;
  2880. }
  2881. return constructor;
  2882. }
  2883. Ext.Class = ExtClass = function(Class, data, onCreated) {
  2884. if (typeof Class != 'function') {
  2885. onCreated = data;
  2886. data = Class;
  2887. Class = null;
  2888. }
  2889. if (!data) {
  2890. data = {};
  2891. }
  2892. Class = ExtClass.create(Class, data);
  2893. ExtClass.process(Class, data, onCreated);
  2894. return Class;
  2895. };
  2896. Ext.apply(ExtClass, {
  2897. onBeforeCreated: function(Class, data, hooks) {
  2898. Class.addMembers(data);
  2899. hooks.onCreated.call(Class, Class);
  2900. },
  2901. create: function(Class, data) {
  2902. var name, i;
  2903. if (!Class) {
  2904. Class = makeCtor(
  2905. );
  2906. }
  2907. for (i = 0; i < baseStaticMemberLength; i++) {
  2908. name = baseStaticMembers[i];
  2909. Class[name] = Base[name];
  2910. }
  2911. return Class;
  2912. },
  2913. process: function(Class, data, onCreated) {
  2914. var preprocessorStack = data.preprocessors || ExtClass.defaultPreprocessors,
  2915. registeredPreprocessors = this.preprocessors,
  2916. hooks = {
  2917. onBeforeCreated: this.onBeforeCreated
  2918. },
  2919. preprocessors = [],
  2920. preprocessor, preprocessorsProperties,
  2921. i, ln, j, subLn, preprocessorProperty, process;
  2922. delete data.preprocessors;
  2923. for (i = 0,ln = preprocessorStack.length; i < ln; i++) {
  2924. preprocessor = preprocessorStack[i];
  2925. if (typeof preprocessor == 'string') {
  2926. preprocessor = registeredPreprocessors[preprocessor];
  2927. preprocessorsProperties = preprocessor.properties;
  2928. if (preprocessorsProperties === true) {
  2929. preprocessors.push(preprocessor.fn);
  2930. }
  2931. else if (preprocessorsProperties) {
  2932. for (j = 0,subLn = preprocessorsProperties.length; j < subLn; j++) {
  2933. preprocessorProperty = preprocessorsProperties[j];
  2934. if (data.hasOwnProperty(preprocessorProperty)) {
  2935. preprocessors.push(preprocessor.fn);
  2936. break;
  2937. }
  2938. }
  2939. }
  2940. }
  2941. else {
  2942. preprocessors.push(preprocessor);
  2943. }
  2944. }
  2945. hooks.onCreated = onCreated ? onCreated : Ext.emptyFn;
  2946. hooks.preprocessors = preprocessors;
  2947. this.doProcess(Class, data, hooks);
  2948. },
  2949. doProcess: function(Class, data, hooks){
  2950. var me = this,
  2951. preprocessor = hooks.preprocessors.shift();
  2952. if (!preprocessor) {
  2953. hooks.onBeforeCreated.apply(me, arguments);
  2954. return;
  2955. }
  2956. if (preprocessor.call(me, Class, data, hooks, me.doProcess) !== false) {
  2957. me.doProcess(Class, data, hooks);
  2958. }
  2959. },
  2960. preprocessors: {},
  2961. registerPreprocessor: function(name, fn, properties, position, relativeTo) {
  2962. if (!position) {
  2963. position = 'last';
  2964. }
  2965. if (!properties) {
  2966. properties = [name];
  2967. }
  2968. this.preprocessors[name] = {
  2969. name: name,
  2970. properties: properties || false,
  2971. fn: fn
  2972. };
  2973. this.setDefaultPreprocessorPosition(name, position, relativeTo);
  2974. return this;
  2975. },
  2976. getPreprocessor: function(name) {
  2977. return this.preprocessors[name];
  2978. },
  2979. getPreprocessors: function() {
  2980. return this.preprocessors;
  2981. },
  2982. defaultPreprocessors: [],
  2983. getDefaultPreprocessors: function() {
  2984. return this.defaultPreprocessors;
  2985. },
  2986. setDefaultPreprocessors: function(preprocessors) {
  2987. this.defaultPreprocessors = Ext.Array.from(preprocessors);
  2988. return this;
  2989. },
  2990. setDefaultPreprocessorPosition: function(name, offset, relativeName) {
  2991. var defaultPreprocessors = this.defaultPreprocessors,
  2992. index;
  2993. if (typeof offset == 'string') {
  2994. if (offset === 'first') {
  2995. defaultPreprocessors.unshift(name);
  2996. return this;
  2997. }
  2998. else if (offset === 'last') {
  2999. defaultPreprocessors.push(name);
  3000. return this;
  3001. }
  3002. offset = (offset === 'after') ? 1 : -1;
  3003. }
  3004. index = Ext.Array.indexOf(defaultPreprocessors, relativeName);
  3005. if (index !== -1) {
  3006. Ext.Array.splice(defaultPreprocessors, Math.max(0, index + offset), 0, name);
  3007. }
  3008. return this;
  3009. },
  3010. configNameCache: {},
  3011. getConfigNameMap: function(name) {
  3012. var cache = this.configNameCache,
  3013. map = cache[name],
  3014. capitalizedName;
  3015. if (!map) {
  3016. capitalizedName = name.charAt(0).toUpperCase() + name.substr(1);
  3017. map = cache[name] = {
  3018. internal: name,
  3019. initialized: '_is' + capitalizedName + 'Initialized',
  3020. apply: 'apply' + capitalizedName,
  3021. update: 'update' + capitalizedName,
  3022. 'set': 'set' + capitalizedName,
  3023. 'get': 'get' + capitalizedName,
  3024. doSet : 'doSet' + capitalizedName,
  3025. changeEvent: name.toLowerCase() + 'change'
  3026. };
  3027. }
  3028. return map;
  3029. }
  3030. });
  3031. ExtClass.registerPreprocessor('extend', function(Class, data) {
  3032. var Base = Ext.Base,
  3033. basePrototype = Base.prototype,
  3034. extend = data.extend,
  3035. Parent, parentPrototype, i;
  3036. delete data.extend;
  3037. if (extend && extend !== Object) {
  3038. Parent = extend;
  3039. }
  3040. else {
  3041. Parent = Base;
  3042. }
  3043. parentPrototype = Parent.prototype;
  3044. if (!Parent.$isClass) {
  3045. for (i in basePrototype) {
  3046. if (!parentPrototype[i]) {
  3047. parentPrototype[i] = basePrototype[i];
  3048. }
  3049. }
  3050. }
  3051. Class.extend(Parent);
  3052. Class.triggerExtended.apply(Class, arguments);
  3053. if (data.onClassExtended) {
  3054. Class.onExtended(data.onClassExtended, Class);
  3055. delete data.onClassExtended;
  3056. }
  3057. }, true);
  3058. ExtClass.registerPreprocessor('statics', function(Class, data) {
  3059. Class.addStatics(data.statics);
  3060. delete data.statics;
  3061. });
  3062. ExtClass.registerPreprocessor('inheritableStatics', function(Class, data) {
  3063. Class.addInheritableStatics(data.inheritableStatics);
  3064. delete data.inheritableStatics;
  3065. });
  3066. ExtClass.registerPreprocessor('config', function(Class, data) {
  3067. var config = data.config,
  3068. prototype = Class.prototype;
  3069. delete data.config;
  3070. Ext.Object.each(config, function(name, value) {
  3071. var nameMap = ExtClass.getConfigNameMap(name),
  3072. internalName = nameMap.internal,
  3073. initializedName = nameMap.initialized,
  3074. applyName = nameMap.apply,
  3075. updateName = nameMap.update,
  3076. setName = nameMap.set,
  3077. getName = nameMap.get,
  3078. hasOwnSetter = (setName in prototype) || data.hasOwnProperty(setName),
  3079. hasOwnApplier = (applyName in prototype) || data.hasOwnProperty(applyName),
  3080. hasOwnUpdater = (updateName in prototype) || data.hasOwnProperty(updateName),
  3081. optimizedGetter, customGetter;
  3082. if (value === null || (!hasOwnSetter && !hasOwnApplier && !hasOwnUpdater)) {
  3083. prototype[internalName] = value;
  3084. prototype[initializedName] = true;
  3085. }
  3086. else {
  3087. prototype[initializedName] = false;
  3088. }
  3089. if (!hasOwnSetter) {
  3090. data[setName] = function(value) {
  3091. var oldValue = this[internalName],
  3092. applier = this[applyName],
  3093. updater = this[updateName];
  3094. if (!this[initializedName]) {
  3095. this[initializedName] = true;
  3096. }
  3097. if (applier) {
  3098. value = applier.call(this, value, oldValue);
  3099. }
  3100. if (typeof value != 'undefined') {
  3101. this[internalName] = value;
  3102. if (updater && value !== oldValue) {
  3103. updater.call(this, value, oldValue);
  3104. }
  3105. }
  3106. return this;
  3107. };
  3108. }
  3109. if (!(getName in prototype) || data.hasOwnProperty(getName)) {
  3110. customGetter = data[getName] || false;
  3111. if (customGetter) {
  3112. optimizedGetter = function() {
  3113. return customGetter.apply(this, arguments);
  3114. };
  3115. }
  3116. else {
  3117. optimizedGetter = function() {
  3118. return this[internalName];
  3119. };
  3120. }
  3121. data[getName] = function() {
  3122. var currentGetter;
  3123. if (!this[initializedName]) {
  3124. this[initializedName] = true;
  3125. this[setName](this.config[name]);
  3126. }
  3127. currentGetter = this[getName];
  3128. if ('$previous' in currentGetter) {
  3129. currentGetter.$previous = optimizedGetter;
  3130. }
  3131. else {
  3132. this[getName] = optimizedGetter;
  3133. }
  3134. return optimizedGetter.apply(this, arguments);
  3135. };
  3136. }
  3137. });
  3138. Class.addConfig(config, true);
  3139. });
  3140. ExtClass.registerPreprocessor('mixins', function(Class, data, hooks) {
  3141. var mixins = data.mixins,
  3142. name, mixin, i, ln;
  3143. delete data.mixins;
  3144. Ext.Function.interceptBefore(hooks, 'onCreated', function() {
  3145. if (mixins instanceof Array) {
  3146. for (i = 0,ln = mixins.length; i < ln; i++) {
  3147. mixin = mixins[i];
  3148. name = mixin.prototype.mixinId || mixin.$className;
  3149. Class.mixin(name, mixin);
  3150. }
  3151. }
  3152. else {
  3153. for (var mixinName in mixins) {
  3154. if (mixins.hasOwnProperty(mixinName)) {
  3155. Class.mixin(mixinName, mixins[mixinName]);
  3156. }
  3157. }
  3158. }
  3159. });
  3160. });
  3161. Ext.extend = function(Class, Parent, members) {
  3162. if (arguments.length === 2 && Ext.isObject(Parent)) {
  3163. members = Parent;
  3164. Parent = Class;
  3165. Class = null;
  3166. }
  3167. var cls;
  3168. if (!Parent) {
  3169. throw new Error("[Ext.extend] Attempting to extend from a class which has not been loaded on the page.");
  3170. }
  3171. members.extend = Parent;
  3172. members.preprocessors = [
  3173. 'extend'
  3174. ,'statics'
  3175. ,'inheritableStatics'
  3176. ,'mixins'
  3177. ,'config'
  3178. ];
  3179. if (Class) {
  3180. cls = new ExtClass(Class, members);
  3181. cls.prototype.constructor = Class;
  3182. } else {
  3183. cls = new ExtClass(members);
  3184. }
  3185. cls.prototype.override = function(o) {
  3186. for (var m in o) {
  3187. if (o.hasOwnProperty(m)) {
  3188. this[m] = o[m];
  3189. }
  3190. }
  3191. };
  3192. return cls;
  3193. };
  3194. }());
  3195. //@tag foundation,core
  3196. //@require Class.js
  3197. (function(Class, alias, arraySlice, arrayFrom, global) {
  3198. function makeCtor () {
  3199. function constructor () {
  3200. return this.constructor.apply(this, arguments) || null;
  3201. }
  3202. return constructor;
  3203. }
  3204. var Manager = Ext.ClassManager = {
  3205. classes: {},
  3206. existCache: {},
  3207. namespaceRewrites: [{
  3208. from: 'Ext.',
  3209. to: Ext
  3210. }],
  3211. maps: {
  3212. alternateToName: {},
  3213. aliasToName: {},
  3214. nameToAliases: {},
  3215. nameToAlternates: {}
  3216. },
  3217. enableNamespaceParseCache: true,
  3218. namespaceParseCache: {},
  3219. instantiators: [],
  3220. isCreated: function(className) {
  3221. var existCache = this.existCache,
  3222. i, ln, part, root, parts;
  3223. if (this.classes[className] || existCache[className]) {
  3224. return true;
  3225. }
  3226. root = global;
  3227. parts = this.parseNamespace(className);
  3228. for (i = 0, ln = parts.length; i < ln; i++) {
  3229. part = parts[i];
  3230. if (typeof part != 'string') {
  3231. root = part;
  3232. } else {
  3233. if (!root || !root[part]) {
  3234. return false;
  3235. }
  3236. root = root[part];
  3237. }
  3238. }
  3239. existCache[className] = true;
  3240. this.triggerCreated(className);
  3241. return true;
  3242. },
  3243. createdListeners: [],
  3244. nameCreatedListeners: {},
  3245. triggerCreated: function(className) {
  3246. var listeners = this.createdListeners,
  3247. nameListeners = this.nameCreatedListeners,
  3248. alternateNames = this.maps.nameToAlternates[className],
  3249. names = [className],
  3250. i, ln, j, subLn, listener, name;
  3251. for (i = 0,ln = listeners.length; i < ln; i++) {
  3252. listener = listeners[i];
  3253. listener.fn.call(listener.scope, className);
  3254. }
  3255. if (alternateNames) {
  3256. names.push.apply(names, alternateNames);
  3257. }
  3258. for (i = 0,ln = names.length; i < ln; i++) {
  3259. name = names[i];
  3260. listeners = nameListeners[name];
  3261. if (listeners) {
  3262. for (j = 0,subLn = listeners.length; j < subLn; j++) {
  3263. listener = listeners[j];
  3264. listener.fn.call(listener.scope, name);
  3265. }
  3266. delete nameListeners[name];
  3267. }
  3268. }
  3269. },
  3270. onCreated: function(fn, scope, className) {
  3271. var listeners = this.createdListeners,
  3272. nameListeners = this.nameCreatedListeners,
  3273. listener = {
  3274. fn: fn,
  3275. scope: scope
  3276. };
  3277. if (className) {
  3278. if (this.isCreated(className)) {
  3279. fn.call(scope, className);
  3280. return;
  3281. }
  3282. if (!nameListeners[className]) {
  3283. nameListeners[className] = [];
  3284. }
  3285. nameListeners[className].push(listener);
  3286. }
  3287. else {
  3288. listeners.push(listener);
  3289. }
  3290. },
  3291. parseNamespace: function(namespace) {
  3292. var cache = this.namespaceParseCache,
  3293. parts,
  3294. rewrites,
  3295. root,
  3296. name,
  3297. rewrite, from, to, i, ln;
  3298. if (this.enableNamespaceParseCache) {
  3299. if (cache.hasOwnProperty(namespace)) {
  3300. return cache[namespace];
  3301. }
  3302. }
  3303. parts = [];
  3304. rewrites = this.namespaceRewrites;
  3305. root = global;
  3306. name = namespace;
  3307. for (i = 0, ln = rewrites.length; i < ln; i++) {
  3308. rewrite = rewrites[i];
  3309. from = rewrite.from;
  3310. to = rewrite.to;
  3311. if (name === from || name.substring(0, from.length) === from) {
  3312. name = name.substring(from.length);
  3313. if (typeof to != 'string') {
  3314. root = to;
  3315. } else {
  3316. parts = parts.concat(to.split('.'));
  3317. }
  3318. break;
  3319. }
  3320. }
  3321. parts.push(root);
  3322. parts = parts.concat(name.split('.'));
  3323. if (this.enableNamespaceParseCache) {
  3324. cache[namespace] = parts;
  3325. }
  3326. return parts;
  3327. },
  3328. setNamespace: function(name, value) {
  3329. var root = global,
  3330. parts = this.parseNamespace(name),
  3331. ln = parts.length - 1,
  3332. leaf = parts[ln],
  3333. i, part;
  3334. for (i = 0; i < ln; i++) {
  3335. part = parts[i];
  3336. if (typeof part != 'string') {
  3337. root = part;
  3338. } else {
  3339. if (!root[part]) {
  3340. root[part] = {};
  3341. }
  3342. root = root[part];
  3343. }
  3344. }
  3345. root[leaf] = value;
  3346. return root[leaf];
  3347. },
  3348. createNamespaces: function() {
  3349. var root = global,
  3350. parts, part, i, j, ln, subLn;
  3351. for (i = 0, ln = arguments.length; i < ln; i++) {
  3352. parts = this.parseNamespace(arguments[i]);
  3353. for (j = 0, subLn = parts.length; j < subLn; j++) {
  3354. part = parts[j];
  3355. if (typeof part != 'string') {
  3356. root = part;
  3357. } else {
  3358. if (!root[part]) {
  3359. root[part] = {};
  3360. }
  3361. root = root[part];
  3362. }
  3363. }
  3364. }
  3365. return root;
  3366. },
  3367. set: function(name, value) {
  3368. var me = this,
  3369. maps = me.maps,
  3370. nameToAlternates = maps.nameToAlternates,
  3371. targetName = me.getName(value),
  3372. alternates;
  3373. me.classes[name] = me.setNamespace(name, value);
  3374. if (targetName && targetName !== name) {
  3375. maps.alternateToName[name] = targetName;
  3376. alternates = nameToAlternates[targetName] || (nameToAlternates[targetName] = []);
  3377. alternates.push(name);
  3378. }
  3379. return this;
  3380. },
  3381. get: function(name) {
  3382. var classes = this.classes,
  3383. root,
  3384. parts,
  3385. part, i, ln;
  3386. if (classes[name]) {
  3387. return classes[name];
  3388. }
  3389. root = global;
  3390. parts = this.parseNamespace(name);
  3391. for (i = 0, ln = parts.length; i < ln; i++) {
  3392. part = parts[i];
  3393. if (typeof part != 'string') {
  3394. root = part;
  3395. } else {
  3396. if (!root || !root[part]) {
  3397. return null;
  3398. }
  3399. root = root[part];
  3400. }
  3401. }
  3402. return root;
  3403. },
  3404. setAlias: function(cls, alias) {
  3405. var aliasToNameMap = this.maps.aliasToName,
  3406. nameToAliasesMap = this.maps.nameToAliases,
  3407. className;
  3408. if (typeof cls == 'string') {
  3409. className = cls;
  3410. } else {
  3411. className = this.getName(cls);
  3412. }
  3413. if (alias && aliasToNameMap[alias] !== className) {
  3414. aliasToNameMap[alias] = className;
  3415. }
  3416. if (!nameToAliasesMap[className]) {
  3417. nameToAliasesMap[className] = [];
  3418. }
  3419. if (alias) {
  3420. Ext.Array.include(nameToAliasesMap[className], alias);
  3421. }
  3422. return this;
  3423. },
  3424. addNameAliasMappings: function(aliases){
  3425. var aliasToNameMap = this.maps.aliasToName,
  3426. nameToAliasesMap = this.maps.nameToAliases,
  3427. className, aliasList, alias, i;
  3428. for (className in aliases) {
  3429. aliasList = nameToAliasesMap[className] ||
  3430. (nameToAliasesMap[className] = []);
  3431. for (i = 0; i < aliases[className].length; i++) {
  3432. alias = aliases[className][i];
  3433. if (!aliasToNameMap[alias]) {
  3434. aliasToNameMap[alias] = className;
  3435. aliasList.push(alias);
  3436. }
  3437. }
  3438. }
  3439. return this;
  3440. },
  3441. addNameAlternateMappings: function(alternates) {
  3442. var alternateToName = this.maps.alternateToName,
  3443. nameToAlternates = this.maps.nameToAlternates,
  3444. className, aliasList, alternate, i;
  3445. for (className in alternates) {
  3446. aliasList = nameToAlternates[className] ||
  3447. (nameToAlternates[className] = []);
  3448. for (i = 0; i < alternates[className].length; i++) {
  3449. alternate = alternates[className];
  3450. if (!alternateToName[alternate]) {
  3451. alternateToName[alternate] = className;
  3452. aliasList.push(alternate);
  3453. }
  3454. }
  3455. }
  3456. return this;
  3457. },
  3458. getByAlias: function(alias) {
  3459. return this.get(this.getNameByAlias(alias));
  3460. },
  3461. getNameByAlias: function(alias) {
  3462. return this.maps.aliasToName[alias] || '';
  3463. },
  3464. getNameByAlternate: function(alternate) {
  3465. return this.maps.alternateToName[alternate] || '';
  3466. },
  3467. getAliasesByName: function(name) {
  3468. return this.maps.nameToAliases[name] || [];
  3469. },
  3470. getName: function(object) {
  3471. return object && object.$className || '';
  3472. },
  3473. getClass: function(object) {
  3474. return object && object.self || null;
  3475. },
  3476. create: function(className, data, createdFn) {
  3477. var ctor = makeCtor();
  3478. if (typeof data == 'function') {
  3479. data = data(ctor);
  3480. }
  3481. data.$className = className;
  3482. return new Class(ctor, data, function() {
  3483. var postprocessorStack = data.postprocessors || Manager.defaultPostprocessors,
  3484. registeredPostprocessors = Manager.postprocessors,
  3485. postprocessors = [],
  3486. postprocessor, i, ln, j, subLn, postprocessorProperties, postprocessorProperty;
  3487. delete data.postprocessors;
  3488. for (i = 0,ln = postprocessorStack.length; i < ln; i++) {
  3489. postprocessor = postprocessorStack[i];
  3490. if (typeof postprocessor == 'string') {
  3491. postprocessor = registeredPostprocessors[postprocessor];
  3492. postprocessorProperties = postprocessor.properties;
  3493. if (postprocessorProperties === true) {
  3494. postprocessors.push(postprocessor.fn);
  3495. }
  3496. else if (postprocessorProperties) {
  3497. for (j = 0,subLn = postprocessorProperties.length; j < subLn; j++) {
  3498. postprocessorProperty = postprocessorProperties[j];
  3499. if (data.hasOwnProperty(postprocessorProperty)) {
  3500. postprocessors.push(postprocessor.fn);
  3501. break;
  3502. }
  3503. }
  3504. }
  3505. }
  3506. else {
  3507. postprocessors.push(postprocessor);
  3508. }
  3509. }
  3510. data.postprocessors = postprocessors;
  3511. data.createdFn = createdFn;
  3512. Manager.processCreate(className, this, data);
  3513. });
  3514. },
  3515. processCreate: function(className, cls, clsData){
  3516. var me = this,
  3517. postprocessor = clsData.postprocessors.shift(),
  3518. createdFn = clsData.createdFn;
  3519. if (!postprocessor) {
  3520. if (className) {
  3521. me.set(className, cls);
  3522. }
  3523. if (createdFn) {
  3524. createdFn.call(cls, cls);
  3525. }
  3526. if (className) {
  3527. me.triggerCreated(className);
  3528. }
  3529. return;
  3530. }
  3531. if (postprocessor.call(me, className, cls, clsData, me.processCreate) !== false) {
  3532. me.processCreate(className, cls, clsData);
  3533. }
  3534. },
  3535. createOverride: function (className, data, createdFn) {
  3536. var me = this,
  3537. overriddenClassName = data.override,
  3538. requires = data.requires,
  3539. uses = data.uses,
  3540. classReady = function () {
  3541. var cls, temp;
  3542. if (requires) {
  3543. temp = requires;
  3544. requires = null;
  3545. Ext.Loader.require(temp, classReady);
  3546. } else {
  3547. cls = me.get(overriddenClassName);
  3548. delete data.override;
  3549. delete data.requires;
  3550. delete data.uses;
  3551. Ext.override(cls, data);
  3552. me.triggerCreated(className);
  3553. if (uses) {
  3554. Ext.Loader.addUsedClasses(uses);
  3555. }
  3556. if (createdFn) {
  3557. createdFn.call(cls);
  3558. }
  3559. }
  3560. };
  3561. me.existCache[className] = true;
  3562. me.onCreated(classReady, me, overriddenClassName);
  3563. return me;
  3564. },
  3565. instantiateByAlias: function() {
  3566. var alias = arguments[0],
  3567. args = arraySlice.call(arguments),
  3568. className = this.getNameByAlias(alias);
  3569. if (!className) {
  3570. className = this.maps.aliasToName[alias];
  3571. Ext.syncRequire(className);
  3572. }
  3573. args[0] = className;
  3574. return this.instantiate.apply(this, args);
  3575. },
  3576. instantiate: function() {
  3577. var name = arguments[0],
  3578. nameType = typeof name,
  3579. args = arraySlice.call(arguments, 1),
  3580. alias = name,
  3581. possibleName, cls;
  3582. if (nameType != 'function') {
  3583. if (nameType != 'string' && args.length === 0) {
  3584. args = [name];
  3585. name = name.xclass;
  3586. }
  3587. cls = this.get(name);
  3588. }
  3589. else {
  3590. cls = name;
  3591. }
  3592. if (!cls) {
  3593. possibleName = this.getNameByAlias(name);
  3594. if (possibleName) {
  3595. name = possibleName;
  3596. cls = this.get(name);
  3597. }
  3598. }
  3599. if (!cls) {
  3600. possibleName = this.getNameByAlternate(name);
  3601. if (possibleName) {
  3602. name = possibleName;
  3603. cls = this.get(name);
  3604. }
  3605. }
  3606. if (!cls) {
  3607. Ext.syncRequire(name);
  3608. cls = this.get(name);
  3609. }
  3610. return this.getInstantiator(args.length)(cls, args);
  3611. },
  3612. dynInstantiate: function(name, args) {
  3613. args = arrayFrom(args, true);
  3614. args.unshift(name);
  3615. return this.instantiate.apply(this, args);
  3616. },
  3617. getInstantiator: function(length) {
  3618. var instantiators = this.instantiators,
  3619. instantiator,
  3620. i,
  3621. args;
  3622. instantiator = instantiators[length];
  3623. if (!instantiator) {
  3624. i = length;
  3625. args = [];
  3626. for (i = 0; i < length; i++) {
  3627. args.push('a[' + i + ']');
  3628. }
  3629. instantiator = instantiators[length] = new Function('c', 'a', 'return new c(' + args.join(',') + ')');
  3630. }
  3631. return instantiator;
  3632. },
  3633. postprocessors: {},
  3634. defaultPostprocessors: [],
  3635. registerPostprocessor: function(name, fn, properties, position, relativeTo) {
  3636. if (!position) {
  3637. position = 'last';
  3638. }
  3639. if (!properties) {
  3640. properties = [name];
  3641. }
  3642. this.postprocessors[name] = {
  3643. name: name,
  3644. properties: properties || false,
  3645. fn: fn
  3646. };
  3647. this.setDefaultPostprocessorPosition(name, position, relativeTo);
  3648. return this;
  3649. },
  3650. setDefaultPostprocessors: function(postprocessors) {
  3651. this.defaultPostprocessors = arrayFrom(postprocessors);
  3652. return this;
  3653. },
  3654. setDefaultPostprocessorPosition: function(name, offset, relativeName) {
  3655. var defaultPostprocessors = this.defaultPostprocessors,
  3656. index;
  3657. if (typeof offset == 'string') {
  3658. if (offset === 'first') {
  3659. defaultPostprocessors.unshift(name);
  3660. return this;
  3661. }
  3662. else if (offset === 'last') {
  3663. defaultPostprocessors.push(name);
  3664. return this;
  3665. }
  3666. offset = (offset === 'after') ? 1 : -1;
  3667. }
  3668. index = Ext.Array.indexOf(defaultPostprocessors, relativeName);
  3669. if (index !== -1) {
  3670. Ext.Array.splice(defaultPostprocessors, Math.max(0, index + offset), 0, name);
  3671. }
  3672. return this;
  3673. },
  3674. getNamesByExpression: function(expression) {
  3675. var nameToAliasesMap = this.maps.nameToAliases,
  3676. names = [],
  3677. name, alias, aliases, possibleName, regex, i, ln;
  3678. if (expression.indexOf('*') !== -1) {
  3679. expression = expression.replace(/\*/g, '(.*?)');
  3680. regex = new RegExp('^' + expression + '$');
  3681. for (name in nameToAliasesMap) {
  3682. if (nameToAliasesMap.hasOwnProperty(name)) {
  3683. aliases = nameToAliasesMap[name];
  3684. if (name.search(regex) !== -1) {
  3685. names.push(name);
  3686. }
  3687. else {
  3688. for (i = 0, ln = aliases.length; i < ln; i++) {
  3689. alias = aliases[i];
  3690. if (alias.search(regex) !== -1) {
  3691. names.push(name);
  3692. break;
  3693. }
  3694. }
  3695. }
  3696. }
  3697. }
  3698. } else {
  3699. possibleName = this.getNameByAlias(expression);
  3700. if (possibleName) {
  3701. names.push(possibleName);
  3702. } else {
  3703. possibleName = this.getNameByAlternate(expression);
  3704. if (possibleName) {
  3705. names.push(possibleName);
  3706. } else {
  3707. names.push(expression);
  3708. }
  3709. }
  3710. }
  3711. return names;
  3712. }
  3713. };
  3714. Manager.registerPostprocessor('alias', function(name, cls, data) {
  3715. var aliases = data.alias,
  3716. i, ln;
  3717. for (i = 0,ln = aliases.length; i < ln; i++) {
  3718. alias = aliases[i];
  3719. this.setAlias(cls, alias);
  3720. }
  3721. }, ['xtype', 'alias']);
  3722. Manager.registerPostprocessor('singleton', function(name, cls, data, fn) {
  3723. fn.call(this, name, new cls(), data);
  3724. return false;
  3725. });
  3726. Manager.registerPostprocessor('alternateClassName', function(name, cls, data) {
  3727. var alternates = data.alternateClassName,
  3728. i, ln, alternate;
  3729. if (!(alternates instanceof Array)) {
  3730. alternates = [alternates];
  3731. }
  3732. for (i = 0, ln = alternates.length; i < ln; i++) {
  3733. alternate = alternates[i];
  3734. this.set(alternate, cls);
  3735. }
  3736. });
  3737. Ext.apply(Ext, {
  3738. create: alias(Manager, 'instantiate'),
  3739. widget: function(name, config) {
  3740. var xtype = name,
  3741. alias, className, T, load;
  3742. if (typeof xtype != 'string') {
  3743. config = name;
  3744. xtype = config.xtype;
  3745. } else {
  3746. config = config || {};
  3747. }
  3748. if (config.isComponent) {
  3749. return config;
  3750. }
  3751. alias = 'widget.' + xtype;
  3752. className = Manager.getNameByAlias(alias);
  3753. if (!className) {
  3754. load = true;
  3755. }
  3756. T = Manager.get(className);
  3757. if (load || !T) {
  3758. return Manager.instantiateByAlias(alias, config);
  3759. }
  3760. return new T(config);
  3761. },
  3762. createByAlias: alias(Manager, 'instantiateByAlias'),
  3763. define: function (className, data, createdFn) {
  3764. if (data.override) {
  3765. return Manager.createOverride.apply(Manager, arguments);
  3766. }
  3767. return Manager.create.apply(Manager, arguments);
  3768. },
  3769. getClassName: alias(Manager, 'getName'),
  3770. getDisplayName: function(object) {
  3771. if (object) {
  3772. if (object.displayName) {
  3773. return object.displayName;
  3774. }
  3775. if (object.$name && object.$class) {
  3776. return Ext.getClassName(object.$class) + '#' + object.$name;
  3777. }
  3778. if (object.$className) {
  3779. return object.$className;
  3780. }
  3781. }
  3782. return 'Anonymous';
  3783. },
  3784. getClass: alias(Manager, 'getClass'),
  3785. namespace: alias(Manager, 'createNamespaces')
  3786. });
  3787. Ext.createWidget = Ext.widget;
  3788. Ext.ns = Ext.namespace;
  3789. Class.registerPreprocessor('className', function(cls, data) {
  3790. if (data.$className) {
  3791. cls.$className = data.$className;
  3792. }
  3793. }, true, 'first');
  3794. Class.registerPreprocessor('alias', function(cls, data) {
  3795. var prototype = cls.prototype,
  3796. xtypes = arrayFrom(data.xtype),
  3797. aliases = arrayFrom(data.alias),
  3798. widgetPrefix = 'widget.',
  3799. widgetPrefixLength = widgetPrefix.length,
  3800. xtypesChain = Array.prototype.slice.call(prototype.xtypesChain || []),
  3801. xtypesMap = Ext.merge({}, prototype.xtypesMap || {}),
  3802. i, ln, alias, xtype;
  3803. for (i = 0,ln = aliases.length; i < ln; i++) {
  3804. alias = aliases[i];
  3805. if (alias.substring(0, widgetPrefixLength) === widgetPrefix) {
  3806. xtype = alias.substring(widgetPrefixLength);
  3807. Ext.Array.include(xtypes, xtype);
  3808. }
  3809. }
  3810. cls.xtype = data.xtype = xtypes[0];
  3811. data.xtypes = xtypes;
  3812. for (i = 0,ln = xtypes.length; i < ln; i++) {
  3813. xtype = xtypes[i];
  3814. if (!xtypesMap[xtype]) {
  3815. xtypesMap[xtype] = true;
  3816. xtypesChain.push(xtype);
  3817. }
  3818. }
  3819. data.xtypesChain = xtypesChain;
  3820. data.xtypesMap = xtypesMap;
  3821. Ext.Function.interceptAfter(data, 'onClassCreated', function() {
  3822. var mixins = prototype.mixins,
  3823. key, mixin;
  3824. for (key in mixins) {
  3825. if (mixins.hasOwnProperty(key)) {
  3826. mixin = mixins[key];
  3827. xtypes = mixin.xtypes;
  3828. if (xtypes) {
  3829. for (i = 0,ln = xtypes.length; i < ln; i++) {
  3830. xtype = xtypes[i];
  3831. if (!xtypesMap[xtype]) {
  3832. xtypesMap[xtype] = true;
  3833. xtypesChain.push(xtype);
  3834. }
  3835. }
  3836. }
  3837. }
  3838. }
  3839. });
  3840. for (i = 0,ln = xtypes.length; i < ln; i++) {
  3841. xtype = xtypes[i];
  3842. Ext.Array.include(aliases, widgetPrefix + xtype);
  3843. }
  3844. data.alias = aliases;
  3845. }, ['xtype', 'alias']);
  3846. }(Ext.Class, Ext.Function.alias, Array.prototype.slice, Ext.Array.from, Ext.global));
  3847. //@tag foundation,core
  3848. //@require ClassManager.js
  3849. //@define Ext.Loader
  3850. Ext.Loader = new function() {
  3851. var Loader = this,
  3852. Manager = Ext.ClassManager,
  3853. Class = Ext.Class,
  3854. flexSetter = Ext.Function.flexSetter,
  3855. alias = Ext.Function.alias,
  3856. pass = Ext.Function.pass,
  3857. defer = Ext.Function.defer,
  3858. arrayErase = Ext.Array.erase,
  3859. dependencyProperties = ['extend', 'mixins', 'requires'],
  3860. isInHistory = {},
  3861. history = [],
  3862. slashDotSlashRe = /\/\.\//g,
  3863. dotRe = /\./g;
  3864. Ext.apply(Loader, {
  3865. isInHistory: isInHistory,
  3866. history: history,
  3867. config: {
  3868. enabled: false,
  3869. scriptChainDelay : false,
  3870. disableCaching: true,
  3871. disableCachingParam: '_dc',
  3872. garbageCollect : false,
  3873. paths: {
  3874. 'Ext': '.'
  3875. },
  3876. preserveScripts : true,
  3877. scriptCharset : undefined
  3878. },
  3879. setConfig: function(name, value) {
  3880. if (Ext.isObject(name) && arguments.length === 1) {
  3881. Ext.merge(Loader.config, name);
  3882. }
  3883. else {
  3884. Loader.config[name] = (Ext.isObject(value)) ? Ext.merge(Loader.config[name], value) : value;
  3885. }
  3886. return Loader;
  3887. },
  3888. getConfig: function(name) {
  3889. if (name) {
  3890. return Loader.config[name];
  3891. }
  3892. return Loader.config;
  3893. },
  3894. setPath: flexSetter(function(name, path) {
  3895. Loader.config.paths[name] = path;
  3896. return Loader;
  3897. }),
  3898. addClassPathMappings: function(paths) {
  3899. var name;
  3900. for(name in paths){
  3901. Loader.config.paths[name] = paths[name];
  3902. }
  3903. return Loader;
  3904. },
  3905. getPath: function(className) {
  3906. var path = '',
  3907. paths = Loader.config.paths,
  3908. prefix = Loader.getPrefix(className);
  3909. if (prefix.length > 0) {
  3910. if (prefix === className) {
  3911. return paths[prefix];
  3912. }
  3913. path = paths[prefix];
  3914. className = className.substring(prefix.length + 1);
  3915. }
  3916. if (path.length > 0) {
  3917. path += '/';
  3918. }
  3919. return path.replace(slashDotSlashRe, '/') + className.replace(dotRe, "/") + '.js';
  3920. },
  3921. getPrefix: function(className) {
  3922. var paths = Loader.config.paths,
  3923. prefix, deepestPrefix = '';
  3924. if (paths.hasOwnProperty(className)) {
  3925. return className;
  3926. }
  3927. for (prefix in paths) {
  3928. if (paths.hasOwnProperty(prefix) && prefix + '.' === className.substring(0, prefix.length + 1)) {
  3929. if (prefix.length > deepestPrefix.length) {
  3930. deepestPrefix = prefix;
  3931. }
  3932. }
  3933. }
  3934. return deepestPrefix;
  3935. },
  3936. isAClassNameWithAKnownPrefix: function(className) {
  3937. var prefix = Loader.getPrefix(className);
  3938. return prefix !== '' && prefix !== className;
  3939. },
  3940. require: function(expressions, fn, scope, excludes) {
  3941. if (fn) {
  3942. fn.call(scope);
  3943. }
  3944. },
  3945. syncRequire: function() {},
  3946. exclude: function(excludes) {
  3947. return {
  3948. require: function(expressions, fn, scope) {
  3949. return Loader.require(expressions, fn, scope, excludes);
  3950. },
  3951. syncRequire: function(expressions, fn, scope) {
  3952. return Loader.syncRequire(expressions, fn, scope, excludes);
  3953. }
  3954. };
  3955. },
  3956. onReady: function(fn, scope, withDomReady, options) {
  3957. var oldFn;
  3958. if (withDomReady !== false && Ext.onDocumentReady) {
  3959. oldFn = fn;
  3960. fn = function() {
  3961. Ext.onDocumentReady(oldFn, scope, options);
  3962. };
  3963. }
  3964. fn.call(scope);
  3965. }
  3966. });
  3967. var queue = [],
  3968. isClassFileLoaded = {},
  3969. isFileLoaded = {},
  3970. classNameToFilePathMap = {},
  3971. scriptElements = {},
  3972. readyListeners = [],
  3973. usedClasses = [],
  3974. requiresMap = {};
  3975. Ext.apply(Loader, {
  3976. documentHead: typeof document != 'undefined' && (document.head || document.getElementsByTagName('head')[0]),
  3977. isLoading: false,
  3978. queue: queue,
  3979. isClassFileLoaded: isClassFileLoaded,
  3980. isFileLoaded: isFileLoaded,
  3981. readyListeners: readyListeners,
  3982. optionalRequires: usedClasses,
  3983. requiresMap: requiresMap,
  3984. numPendingFiles: 0,
  3985. numLoadedFiles: 0,
  3986. hasFileLoadError: false,
  3987. classNameToFilePathMap: classNameToFilePathMap,
  3988. scriptsLoading: 0,
  3989. syncModeEnabled: false,
  3990. scriptElements: scriptElements,
  3991. refreshQueue: function() {
  3992. var ln = queue.length,
  3993. i, item, j, requires;
  3994. if (!ln && !Loader.scriptsLoading) {
  3995. return Loader.triggerReady();
  3996. }
  3997. for (i = 0; i < ln; i++) {
  3998. item = queue[i];
  3999. if (item) {
  4000. requires = item.requires;
  4001. if (requires.length > Loader.numLoadedFiles) {
  4002. continue;
  4003. }
  4004. for (j = 0; j < requires.length; ) {
  4005. if (Manager.isCreated(requires[j])) {
  4006. arrayErase(requires, j, 1);
  4007. }
  4008. else {
  4009. j++;
  4010. }
  4011. }
  4012. if (item.requires.length === 0) {
  4013. arrayErase(queue, i, 1);
  4014. item.callback.call(item.scope);
  4015. Loader.refreshQueue();
  4016. break;
  4017. }
  4018. }
  4019. }
  4020. return Loader;
  4021. },
  4022. injectScriptElement: function(url, onLoad, onError, scope, charset) {
  4023. var script = document.createElement('script'),
  4024. dispatched = false,
  4025. config = Loader.config,
  4026. onLoadFn = function() {
  4027. if(!dispatched) {
  4028. dispatched = true;
  4029. script.onload = script.onreadystatechange = script.onerror = null;
  4030. if (typeof config.scriptChainDelay == 'number') {
  4031. defer(onLoad, config.scriptChainDelay, scope);
  4032. } else {
  4033. onLoad.call(scope);
  4034. }
  4035. Loader.cleanupScriptElement(script, config.preserveScripts === false, config.garbageCollect);
  4036. }
  4037. },
  4038. onErrorFn = function(arg) {
  4039. defer(onError, 1, scope);
  4040. Loader.cleanupScriptElement(script, config.preserveScripts === false, config.garbageCollect);
  4041. };
  4042. script.type = 'text/javascript';
  4043. script.onerror = onErrorFn;
  4044. charset = charset || config.scriptCharset;
  4045. if (charset) {
  4046. script.charset = charset;
  4047. }
  4048. if ('addEventListener' in script ) {
  4049. script.onload = onLoadFn;
  4050. } else if ('readyState' in script) {
  4051. script.onreadystatechange = function() {
  4052. if ( this.readyState == 'loaded' || this.readyState == 'complete' ) {
  4053. onLoadFn();
  4054. }
  4055. };
  4056. } else {
  4057. script.onload = onLoadFn;
  4058. }
  4059. script.src = url;
  4060. (Loader.documentHead || document.getElementsByTagName('head')[0]).appendChild(script);
  4061. return script;
  4062. },
  4063. removeScriptElement: function(url) {
  4064. if (scriptElements[url]) {
  4065. Loader.cleanupScriptElement(scriptElements[url], true, !!Loader.getConfig('garbageCollect'));
  4066. delete scriptElements[url];
  4067. }
  4068. return Loader;
  4069. },
  4070. cleanupScriptElement: function(script, remove, collect) {
  4071. var prop;
  4072. script.onload = script.onreadystatechange = script.onerror = null;
  4073. if (remove) {
  4074. Ext.removeNode(script);
  4075. if (collect) {
  4076. for (prop in script) {
  4077. try {
  4078. script[prop] = null;
  4079. delete script[prop];
  4080. } catch (cleanEx) {
  4081. }
  4082. }
  4083. }
  4084. }
  4085. return Loader;
  4086. },
  4087. loadScript: function (options) {
  4088. var config = Loader.getConfig(),
  4089. isString = typeof options == 'string',
  4090. url = isString ? options : options.url,
  4091. onError = !isString && options.onError,
  4092. onLoad = !isString && options.onLoad,
  4093. scope = !isString && options.scope,
  4094. onScriptError = function() {
  4095. Loader.numPendingFiles--;
  4096. Loader.scriptsLoading--;
  4097. if (onError) {
  4098. onError.call(scope, "Failed loading '" + url + "', please verify that the file exists");
  4099. }
  4100. if (Loader.numPendingFiles + Loader.scriptsLoading === 0) {
  4101. Loader.refreshQueue();
  4102. }
  4103. },
  4104. onScriptLoad = function () {
  4105. Loader.numPendingFiles--;
  4106. Loader.scriptsLoading--;
  4107. if (onLoad) {
  4108. onLoad.call(scope);
  4109. }
  4110. if (Loader.numPendingFiles + Loader.scriptsLoading === 0) {
  4111. Loader.refreshQueue();
  4112. }
  4113. },
  4114. src;
  4115. Loader.isLoading = true;
  4116. Loader.numPendingFiles++;
  4117. Loader.scriptsLoading++;
  4118. src = config.disableCaching ?
  4119. (url + '?' + config.disableCachingParam + '=' + Ext.Date.now()) : url;
  4120. scriptElements[url] = Loader.injectScriptElement(src, onScriptLoad, onScriptError);
  4121. },
  4122. loadScriptFile: function(url, onLoad, onError, scope, synchronous) {
  4123. if (isFileLoaded[url]) {
  4124. return Loader;
  4125. }
  4126. var config = Loader.getConfig(),
  4127. noCacheUrl = url + (config.disableCaching ? ('?' + config.disableCachingParam + '=' + Ext.Date.now()) : ''),
  4128. isCrossOriginRestricted = false,
  4129. xhr, status, onScriptError,
  4130. debugSourceURL = "";
  4131. scope = scope || Loader;
  4132. Loader.isLoading = true;
  4133. if (!synchronous) {
  4134. onScriptError = function() {
  4135. };
  4136. scriptElements[url] = Loader.injectScriptElement(noCacheUrl, onLoad, onScriptError, scope);
  4137. } else {
  4138. if (typeof XMLHttpRequest != 'undefined') {
  4139. xhr = new XMLHttpRequest();
  4140. } else {
  4141. xhr = new ActiveXObject('Microsoft.XMLHTTP');
  4142. }
  4143. try {
  4144. xhr.open('GET', noCacheUrl, false);
  4145. xhr.send(null);
  4146. } catch (e) {
  4147. isCrossOriginRestricted = true;
  4148. }
  4149. status = (xhr.status === 1223) ? 204 :
  4150. (xhr.status === 0 && (self.location || {}).protocol == 'file:') ? 200 : xhr.status;
  4151. isCrossOriginRestricted = isCrossOriginRestricted || (status === 0);
  4152. if (isCrossOriginRestricted
  4153. ) {
  4154. }
  4155. else if ((status >= 200 && status < 300) || (status === 304)
  4156. ) {
  4157. if (!Ext.isIE) {
  4158. debugSourceURL = "\n//@ sourceURL=" + url;
  4159. }
  4160. Ext.globalEval(xhr.responseText + debugSourceURL);
  4161. onLoad.call(scope);
  4162. }
  4163. else {
  4164. }
  4165. xhr = null;
  4166. }
  4167. },
  4168. syncRequire: function() {
  4169. var syncModeEnabled = Loader.syncModeEnabled;
  4170. if (!syncModeEnabled) {
  4171. Loader.syncModeEnabled = true;
  4172. }
  4173. Loader.require.apply(Loader, arguments);
  4174. if (!syncModeEnabled) {
  4175. Loader.syncModeEnabled = false;
  4176. }
  4177. Loader.refreshQueue();
  4178. },
  4179. require: function(expressions, fn, scope, excludes) {
  4180. var excluded = {},
  4181. included = {},
  4182. excludedClassNames = [],
  4183. possibleClassNames = [],
  4184. classNames = [],
  4185. references = [],
  4186. callback,
  4187. syncModeEnabled,
  4188. filePath, expression, exclude, className,
  4189. possibleClassName, i, j, ln, subLn;
  4190. if (excludes) {
  4191. excludes = (typeof excludes === 'string') ? [ excludes ] : excludes;
  4192. for (i = 0,ln = excludes.length; i < ln; i++) {
  4193. exclude = excludes[i];
  4194. if (typeof exclude == 'string' && exclude.length > 0) {
  4195. excludedClassNames = Manager.getNamesByExpression(exclude);
  4196. for (j = 0,subLn = excludedClassNames.length; j < subLn; j++) {
  4197. excluded[excludedClassNames[j]] = true;
  4198. }
  4199. }
  4200. }
  4201. }
  4202. expressions = (typeof expressions === 'string') ? [ expressions ] : (expressions ? expressions : []);
  4203. if (fn) {
  4204. if (fn.length > 0) {
  4205. callback = function() {
  4206. var classes = [],
  4207. i, ln;
  4208. for (i = 0,ln = references.length; i < ln; i++) {
  4209. classes.push(Manager.get(references[i]));
  4210. }
  4211. return fn.apply(this, classes);
  4212. };
  4213. }
  4214. else {
  4215. callback = fn;
  4216. }
  4217. }
  4218. else {
  4219. callback = Ext.emptyFn;
  4220. }
  4221. scope = scope || Ext.global;
  4222. for (i = 0,ln = expressions.length; i < ln; i++) {
  4223. expression = expressions[i];
  4224. if (typeof expression == 'string' && expression.length > 0) {
  4225. possibleClassNames = Manager.getNamesByExpression(expression);
  4226. subLn = possibleClassNames.length;
  4227. for (j = 0; j < subLn; j++) {
  4228. possibleClassName = possibleClassNames[j];
  4229. if (excluded[possibleClassName] !== true) {
  4230. references.push(possibleClassName);
  4231. if (!Manager.isCreated(possibleClassName) && !included[possibleClassName]) {
  4232. included[possibleClassName] = true;
  4233. classNames.push(possibleClassName);
  4234. }
  4235. }
  4236. }
  4237. }
  4238. }
  4239. if (classNames.length > 0) {
  4240. if (!Loader.config.enabled) {
  4241. throw new Error("Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. " +
  4242. "Missing required class" + ((classNames.length > 1) ? "es" : "") + ": " + classNames.join(', '));
  4243. }
  4244. }
  4245. else {
  4246. callback.call(scope);
  4247. return Loader;
  4248. }
  4249. syncModeEnabled = Loader.syncModeEnabled;
  4250. if (!syncModeEnabled) {
  4251. queue.push({
  4252. requires: classNames.slice(),
  4253. callback: callback,
  4254. scope: scope
  4255. });
  4256. }
  4257. ln = classNames.length;
  4258. for (i = 0; i < ln; i++) {
  4259. className = classNames[i];
  4260. filePath = Loader.getPath(className);
  4261. if (syncModeEnabled && isClassFileLoaded.hasOwnProperty(className)) {
  4262. Loader.numPendingFiles--;
  4263. Loader.removeScriptElement(filePath);
  4264. delete isClassFileLoaded[className];
  4265. }
  4266. if (!isClassFileLoaded.hasOwnProperty(className)) {
  4267. isClassFileLoaded[className] = false;
  4268. classNameToFilePathMap[className] = filePath;
  4269. Loader.numPendingFiles++;
  4270. Loader.loadScriptFile(
  4271. filePath,
  4272. pass(Loader.onFileLoaded, [className, filePath], Loader),
  4273. pass(Loader.onFileLoadError, [className, filePath], Loader),
  4274. Loader,
  4275. syncModeEnabled
  4276. );
  4277. }
  4278. }
  4279. if (syncModeEnabled) {
  4280. callback.call(scope);
  4281. if (ln === 1) {
  4282. return Manager.get(className);
  4283. }
  4284. }
  4285. return Loader;
  4286. },
  4287. onFileLoaded: function(className, filePath) {
  4288. Loader.numLoadedFiles++;
  4289. isClassFileLoaded[className] = true;
  4290. isFileLoaded[filePath] = true;
  4291. Loader.numPendingFiles--;
  4292. if (Loader.numPendingFiles === 0) {
  4293. Loader.refreshQueue();
  4294. }
  4295. },
  4296. onFileLoadError: function(className, filePath, errorMessage, isSynchronous) {
  4297. Loader.numPendingFiles--;
  4298. Loader.hasFileLoadError = true;
  4299. },
  4300. addUsedClasses: function (classes) {
  4301. var cls, i, ln;
  4302. if (classes) {
  4303. classes = (typeof classes == 'string') ? [classes] : classes;
  4304. for (i = 0, ln = classes.length; i < ln; i++) {
  4305. cls = classes[i];
  4306. if (typeof cls == 'string' && !Ext.Array.contains(usedClasses, cls)) {
  4307. usedClasses.push(cls);
  4308. }
  4309. }
  4310. }
  4311. return Loader;
  4312. },
  4313. triggerReady: function() {
  4314. var listener,
  4315. i, refClasses = usedClasses;
  4316. if (Loader.isLoading) {
  4317. Loader.isLoading = false;
  4318. if (refClasses.length !== 0) {
  4319. refClasses = refClasses.slice();
  4320. usedClasses.length = 0;
  4321. Loader.require(refClasses, Loader.triggerReady, Loader);
  4322. return Loader;
  4323. }
  4324. }
  4325. while (readyListeners.length && !Loader.isLoading) {
  4326. listener = readyListeners.shift();
  4327. listener.fn.call(listener.scope);
  4328. }
  4329. return Loader;
  4330. },
  4331. onReady: function(fn, scope, withDomReady, options) {
  4332. var oldFn;
  4333. if (withDomReady !== false && Ext.onDocumentReady) {
  4334. oldFn = fn;
  4335. fn = function() {
  4336. Ext.onDocumentReady(oldFn, scope, options);
  4337. };
  4338. }
  4339. if (!Loader.isLoading) {
  4340. fn.call(scope);
  4341. }
  4342. else {
  4343. readyListeners.push({
  4344. fn: fn,
  4345. scope: scope
  4346. });
  4347. }
  4348. },
  4349. historyPush: function(className) {
  4350. if (className && isClassFileLoaded.hasOwnProperty(className) && !isInHistory[className]) {
  4351. isInHistory[className] = true;
  4352. history.push(className);
  4353. }
  4354. return Loader;
  4355. }
  4356. });
  4357. Ext.disableCacheBuster = function (disable, path) {
  4358. var date = new Date();
  4359. date.setTime(date.getTime() + (disable ? 10*365 : -1) * 24*60*60*1000);
  4360. date = date.toGMTString();
  4361. document.cookie = 'ext-cache=1; expires=' + date + '; path='+(path || '/');
  4362. };
  4363. Ext.require = alias(Loader, 'require');
  4364. Ext.syncRequire = alias(Loader, 'syncRequire');
  4365. Ext.exclude = alias(Loader, 'exclude');
  4366. Ext.onReady = function(fn, scope, options) {
  4367. Loader.onReady(fn, scope, true, options);
  4368. };
  4369. Class.registerPreprocessor('loader', function(cls, data, hooks, continueFn) {
  4370. var me = this,
  4371. dependencies = [],
  4372. dependency,
  4373. className = Manager.getName(cls),
  4374. i, j, ln, subLn, value, propertyName, propertyValue,
  4375. requiredMap, requiredDep;
  4376. for (i = 0,ln = dependencyProperties.length; i < ln; i++) {
  4377. propertyName = dependencyProperties[i];
  4378. if (data.hasOwnProperty(propertyName)) {
  4379. propertyValue = data[propertyName];
  4380. if (typeof propertyValue == 'string') {
  4381. dependencies.push(propertyValue);
  4382. }
  4383. else if (propertyValue instanceof Array) {
  4384. for (j = 0, subLn = propertyValue.length; j < subLn; j++) {
  4385. value = propertyValue[j];
  4386. if (typeof value == 'string') {
  4387. dependencies.push(value);
  4388. }
  4389. }
  4390. }
  4391. else if (typeof propertyValue != 'function') {
  4392. for (j in propertyValue) {
  4393. if (propertyValue.hasOwnProperty(j)) {
  4394. value = propertyValue[j];
  4395. if (typeof value == 'string') {
  4396. dependencies.push(value);
  4397. }
  4398. }
  4399. }
  4400. }
  4401. }
  4402. }
  4403. if (dependencies.length === 0) {
  4404. return;
  4405. }
  4406. Loader.require(dependencies, function() {
  4407. for (i = 0,ln = dependencyProperties.length; i < ln; i++) {
  4408. propertyName = dependencyProperties[i];
  4409. if (data.hasOwnProperty(propertyName)) {
  4410. propertyValue = data[propertyName];
  4411. if (typeof propertyValue == 'string') {
  4412. data[propertyName] = Manager.get(propertyValue);
  4413. }
  4414. else if (propertyValue instanceof Array) {
  4415. for (j = 0, subLn = propertyValue.length; j < subLn; j++) {
  4416. value = propertyValue[j];
  4417. if (typeof value == 'string') {
  4418. data[propertyName][j] = Manager.get(value);
  4419. }
  4420. }
  4421. }
  4422. else if (typeof propertyValue != 'function') {
  4423. for (var k in propertyValue) {
  4424. if (propertyValue.hasOwnProperty(k)) {
  4425. value = propertyValue[k];
  4426. if (typeof value == 'string') {
  4427. data[propertyName][k] = Manager.get(value);
  4428. }
  4429. }
  4430. }
  4431. }
  4432. }
  4433. }
  4434. continueFn.call(me, cls, data, hooks);
  4435. });
  4436. return false;
  4437. }, true, 'after', 'className');
  4438. Manager.registerPostprocessor('uses', function(name, cls, data) {
  4439. var uses = data.uses;
  4440. if (uses) {
  4441. Loader.addUsedClasses(uses);
  4442. }
  4443. });
  4444. Manager.onCreated(Loader.historyPush);
  4445. };
  4446. if (Ext._classPathMetadata) {
  4447. Ext.Loader.addClassPathMappings(Ext._classPathMetadata);
  4448. Ext._classPathMetadata = null;
  4449. }
  4450. (function() {
  4451. var scripts = document.getElementsByTagName('script'),
  4452. currentScript = scripts[scripts.length - 1],
  4453. src = currentScript.src,
  4454. path = src.substring(0, src.lastIndexOf('/') + 1),
  4455. Loader = Ext.Loader;
  4456. Loader.setConfig({
  4457. enabled: true,
  4458. disableCaching: true,
  4459. paths: {
  4460. 'Ext': path + 'src'
  4461. }
  4462. });
  4463. })();
  4464. Ext._endTime = new Date().getTime();
  4465. if (Ext._beforereadyhandler){
  4466. Ext._beforereadyhandler();
  4467. }
  4468. //@tag foundation,core
  4469. //@require ../class/Loader.js
  4470. Ext.Error = Ext.extend(Error, {
  4471. statics: {
  4472. ignore: false,
  4473. raise: function(err){
  4474. err = err || {};
  4475. if (Ext.isString(err)) {
  4476. err = { msg: err };
  4477. }
  4478. var method = this.raise.caller,
  4479. msg;
  4480. if (method) {
  4481. if (method.$name) {
  4482. err.sourceMethod = method.$name;
  4483. }
  4484. if (method.$owner) {
  4485. err.sourceClass = method.$owner.$className;
  4486. }
  4487. }
  4488. if (Ext.Error.handle(err) !== true) {
  4489. msg = Ext.Error.prototype.toString.call(err);
  4490. Ext.log({
  4491. msg: msg,
  4492. level: 'error',
  4493. dump: err,
  4494. stack: true
  4495. });
  4496. throw new Ext.Error(err);
  4497. }
  4498. },
  4499. handle: function(){
  4500. return Ext.Error.ignore;
  4501. }
  4502. },
  4503. name: 'Ext.Error',
  4504. constructor: function(config){
  4505. if (Ext.isString(config)) {
  4506. config = { msg: config };
  4507. }
  4508. var me = this;
  4509. Ext.apply(me, config);
  4510. me.message = me.message || me.msg;
  4511. },
  4512. toString: function(){
  4513. var me = this,
  4514. className = me.sourceClass ? me.sourceClass : '',
  4515. methodName = me.sourceMethod ? '.' + me.sourceMethod + '(): ' : '',
  4516. msg = me.msg || '(No description provided)';
  4517. return className + methodName + msg;
  4518. }
  4519. });
  4520. Ext.deprecated = function (suggestion) {
  4521. return Ext.emptyFn;
  4522. };
  4523. //@tag extras,core
  4524. //@require ../lang/Error.js
  4525. Ext.JSON = (new(function() {
  4526. var me = this,
  4527. encodingFunction,
  4528. decodingFunction,
  4529. useNative = null,
  4530. useHasOwn = !! {}.hasOwnProperty,
  4531. isNative = function() {
  4532. if (useNative === null) {
  4533. useNative = Ext.USE_NATIVE_JSON && window.JSON && JSON.toString() == '[object JSON]';
  4534. }
  4535. return useNative;
  4536. },
  4537. pad = function(n) {
  4538. return n < 10 ? "0" + n : n;
  4539. },
  4540. doDecode = function(json) {
  4541. return eval("(" + json + ')');
  4542. },
  4543. doEncode = function(o, newline) {
  4544. if (o === null || o === undefined) {
  4545. return "null";
  4546. } else if (Ext.isDate(o)) {
  4547. return Ext.JSON.encodeDate(o);
  4548. } else if (Ext.isString(o)) {
  4549. return Ext.JSON.encodeString(o);
  4550. } else if (typeof o == "number") {
  4551. return isFinite(o) ? String(o) : "null";
  4552. } else if (Ext.isBoolean(o)) {
  4553. return String(o);
  4554. }
  4555. else if (o.toJSON) {
  4556. return o.toJSON();
  4557. } else if (Ext.isArray(o)) {
  4558. return encodeArray(o, newline);
  4559. } else if (Ext.isObject(o)) {
  4560. return encodeObject(o, newline);
  4561. } else if (typeof o === "function") {
  4562. return "null";
  4563. }
  4564. return 'undefined';
  4565. },
  4566. m = {
  4567. "\b": '\\b',
  4568. "\t": '\\t',
  4569. "\n": '\\n',
  4570. "\f": '\\f',
  4571. "\r": '\\r',
  4572. '"': '\\"',
  4573. "\\": '\\\\',
  4574. '\x0b': '\\u000b'
  4575. },
  4576. charToReplace = /[\\\"\x00-\x1f\x7f-\uffff]/g,
  4577. encodeString = function(s) {
  4578. return '"' + s.replace(charToReplace, function(a) {
  4579. var c = m[a];
  4580. return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
  4581. }) + '"';
  4582. },
  4583. encodeArray = function(o, newline) {
  4584. var a = ["[", ""],
  4585. len = o.length,
  4586. i;
  4587. for (i = 0; i < len; i += 1) {
  4588. a.push(Ext.JSON.encodeValue(o[i]), ',');
  4589. }
  4590. a[a.length - 1] = ']';
  4591. return a.join("");
  4592. },
  4593. encodeObject = function(o, newline) {
  4594. var a = ["{", ""],
  4595. i;
  4596. for (i in o) {
  4597. if (!useHasOwn || o.hasOwnProperty(i)) {
  4598. a.push(Ext.JSON.encodeValue(i), ":", Ext.JSON.encodeValue(o[i]), ',');
  4599. }
  4600. }
  4601. a[a.length - 1] = '}';
  4602. return a.join("");
  4603. };
  4604. me.encodeString = encodeString;
  4605. me.encodeValue = doEncode;
  4606. me.encodeDate = function(o) {
  4607. return '"' + o.getFullYear() + "-"
  4608. + pad(o.getMonth() + 1) + "-"
  4609. + pad(o.getDate()) + "T"
  4610. + pad(o.getHours()) + ":"
  4611. + pad(o.getMinutes()) + ":"
  4612. + pad(o.getSeconds()) + '"';
  4613. };
  4614. me.encode = function(o) {
  4615. if (!encodingFunction) {
  4616. encodingFunction = isNative() ? JSON.stringify : me.encodeValue;
  4617. }
  4618. return encodingFunction(o);
  4619. };
  4620. me.decode = function(json, safe) {
  4621. if (!decodingFunction) {
  4622. decodingFunction = isNative() ? JSON.parse : doDecode;
  4623. }
  4624. try {
  4625. return decodingFunction(json);
  4626. } catch (e) {
  4627. if (safe === true) {
  4628. return null;
  4629. }
  4630. Ext.Error.raise({
  4631. sourceClass: "Ext.JSON",
  4632. sourceMethod: "decode",
  4633. msg: "You're trying to decode an invalid JSON String: " + json
  4634. });
  4635. }
  4636. };
  4637. })());
  4638. Ext.encode = Ext.JSON.encode;
  4639. Ext.decode = Ext.JSON.decode;
  4640. //@tag extras,core
  4641. //@require misc/JSON.js
  4642. Ext.apply(Ext, {
  4643. userAgent: navigator.userAgent.toLowerCase(),
  4644. cache: {},
  4645. idSeed: 1000,
  4646. windowId: 'ext-window',
  4647. documentId: 'ext-document',
  4648. isReady: false,
  4649. enableGarbageCollector: true,
  4650. enableListenerCollection: true,
  4651. addCacheEntry: function(id, el, dom) {
  4652. dom = dom || el.dom;
  4653. var key = id || (el && el.id) || dom.id,
  4654. entry = Ext.cache[key] || (Ext.cache[key] = {
  4655. data: {},
  4656. events: {},
  4657. dom: dom,
  4658. skipGarbageCollection: !!(dom.getElementById || dom.navigator)
  4659. });
  4660. if (el) {
  4661. el.$cache = entry;
  4662. entry.el = el;
  4663. }
  4664. return entry;
  4665. },
  4666. updateCacheEntry: function(cacheItem, dom){
  4667. cacheItem.dom = dom;
  4668. if (cacheItem.el) {
  4669. cacheItem.el.dom = dom;
  4670. }
  4671. return cacheItem;
  4672. },
  4673. id: function(el, prefix) {
  4674. var me = this,
  4675. sandboxPrefix = '';
  4676. el = Ext.getDom(el, true) || {};
  4677. if (el === document) {
  4678. el.id = me.documentId;
  4679. }
  4680. else if (el === window) {
  4681. el.id = me.windowId;
  4682. }
  4683. if (!el.id) {
  4684. if (me.isSandboxed) {
  4685. sandboxPrefix = Ext.sandboxName.toLowerCase() + '-';
  4686. }
  4687. el.id = sandboxPrefix + (prefix || "ext-gen") + (++Ext.idSeed);
  4688. }
  4689. return el.id;
  4690. },
  4691. escapeId: (function(){
  4692. var validIdRe = /^[a-zA-Z_][a-zA-Z0-9_\-]*$/i,
  4693. escapeRx = /([\W]{1})/g,
  4694. leadingNumRx = /^(\d)/g,
  4695. escapeFn = function(match, capture){
  4696. return "\\" + capture;
  4697. },
  4698. numEscapeFn = function(match, capture){
  4699. return '\\00' + capture.charCodeAt(0).toString(16) + ' ';
  4700. };
  4701. return function(id) {
  4702. return validIdRe.test(id)
  4703. ? id
  4704. : id.replace(escapeRx, escapeFn)
  4705. .replace(leadingNumRx, numEscapeFn);
  4706. };
  4707. }()),
  4708. getBody: (function() {
  4709. var body;
  4710. return function() {
  4711. return body || (body = Ext.get(document.body));
  4712. };
  4713. }()),
  4714. getHead: (function() {
  4715. var head;
  4716. return function() {
  4717. return head || (head = Ext.get(document.getElementsByTagName("head")[0]));
  4718. };
  4719. }()),
  4720. getDoc: (function() {
  4721. var doc;
  4722. return function() {
  4723. return doc || (doc = Ext.get(document));
  4724. };
  4725. }()),
  4726. getCmp: function(id) {
  4727. return Ext.ComponentManager.get(id);
  4728. },
  4729. getOrientation: function() {
  4730. return window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
  4731. },
  4732. destroy: function() {
  4733. var ln = arguments.length,
  4734. i, arg;
  4735. for (i = 0; i < ln; i++) {
  4736. arg = arguments[i];
  4737. if (arg) {
  4738. if (Ext.isArray(arg)) {
  4739. this.destroy.apply(this, arg);
  4740. }
  4741. else if (Ext.isFunction(arg.destroy)) {
  4742. arg.destroy();
  4743. }
  4744. else if (arg.dom) {
  4745. arg.remove();
  4746. }
  4747. }
  4748. }
  4749. },
  4750. callback: function(callback, scope, args, delay){
  4751. if(Ext.isFunction(callback)){
  4752. args = args || [];
  4753. scope = scope || window;
  4754. if (delay) {
  4755. Ext.defer(callback, delay, scope, args);
  4756. } else {
  4757. callback.apply(scope, args);
  4758. }
  4759. }
  4760. },
  4761. htmlEncode : function(value) {
  4762. return Ext.String.htmlEncode(value);
  4763. },
  4764. htmlDecode : function(value) {
  4765. return Ext.String.htmlDecode(value);
  4766. },
  4767. urlAppend : function(url, s) {
  4768. return Ext.String.urlAppend(url, s);
  4769. }
  4770. });
  4771. Ext.ns = Ext.namespace;
  4772. window.undefined = window.undefined;
  4773. (function(){
  4774. var check = function(regex){
  4775. return regex.test(Ext.userAgent);
  4776. },
  4777. isStrict = document.compatMode == "CSS1Compat",
  4778. version = function (is, regex) {
  4779. var m;
  4780. return (is && (m = regex.exec(Ext.userAgent))) ? parseFloat(m[1]) : 0;
  4781. },
  4782. docMode = document.documentMode,
  4783. isOpera = check(/opera/),
  4784. isOpera10_5 = isOpera && check(/version\/10\.5/),
  4785. isChrome = check(/\bchrome\b/),
  4786. isWebKit = check(/webkit/),
  4787. isSafari = !isChrome && check(/safari/),
  4788. isSafari2 = isSafari && check(/applewebkit\/4/),
  4789. isSafari3 = isSafari && check(/version\/3/),
  4790. isSafari4 = isSafari && check(/version\/4/),
  4791. isSafari5_0 = isSafari && check(/version\/5\.0/),
  4792. isSafari5 = isSafari && check(/version\/5/),
  4793. isIE = !isOpera && check(/msie/),
  4794. isIE7 = isIE && ((check(/msie 7/) && docMode != 8 && docMode != 9) || docMode == 7),
  4795. isIE8 = isIE && ((check(/msie 8/) && docMode != 7 && docMode != 9) || docMode == 8),
  4796. isIE9 = isIE && ((check(/msie 9/) && docMode != 7 && docMode != 8) || docMode == 9),
  4797. isIE6 = isIE && check(/msie 6/),
  4798. isGecko = !isWebKit && check(/gecko/),
  4799. isGecko3 = isGecko && check(/rv:1\.9/),
  4800. isGecko4 = isGecko && check(/rv:2\.0/),
  4801. isGecko5 = isGecko && check(/rv:5\./),
  4802. isGecko10 = isGecko && check(/rv:10\./),
  4803. isFF3_0 = isGecko3 && check(/rv:1\.9\.0/),
  4804. isFF3_5 = isGecko3 && check(/rv:1\.9\.1/),
  4805. isFF3_6 = isGecko3 && check(/rv:1\.9\.2/),
  4806. isWindows = check(/windows|win32/),
  4807. isMac = check(/macintosh|mac os x/),
  4808. isLinux = check(/linux/),
  4809. scrollbarSize = null,
  4810. chromeVersion = version(true, /\bchrome\/(\d+\.\d+)/),
  4811. firefoxVersion = version(true, /\bfirefox\/(\d+\.\d+)/),
  4812. ieVersion = version(isIE, /msie (\d+\.\d+)/),
  4813. operaVersion = version(isOpera, /version\/(\d+\.\d+)/),
  4814. safariVersion = version(isSafari, /version\/(\d+\.\d+)/),
  4815. webKitVersion = version(isWebKit, /webkit\/(\d+\.\d+)/),
  4816. isSecure = /^https/i.test(window.location.protocol),
  4817. nullLog;
  4818. try {
  4819. document.execCommand("BackgroundImageCache", false, true);
  4820. } catch(e) {}
  4821. nullLog = function () {};
  4822. nullLog.info = nullLog.warn = nullLog.error = Ext.emptyFn;
  4823. Ext.setVersion('extjs', '4.1.1.1');
  4824. Ext.apply(Ext, {
  4825. SSL_SECURE_URL : isSecure && isIE ? 'javascript:\'\'' : 'about:blank',
  4826. scopeResetCSS : Ext.buildSettings.scopeResetCSS,
  4827. resetCls: Ext.buildSettings.baseCSSPrefix + 'reset',
  4828. enableNestedListenerRemoval : false,
  4829. USE_NATIVE_JSON : false,
  4830. getDom : function(el, strict) {
  4831. if (!el || !document) {
  4832. return null;
  4833. }
  4834. if (el.dom) {
  4835. return el.dom;
  4836. } else {
  4837. if (typeof el == 'string') {
  4838. var e = Ext.getElementById(el);
  4839. if (e && isIE && strict) {
  4840. if (el == e.getAttribute('id')) {
  4841. return e;
  4842. } else {
  4843. return null;
  4844. }
  4845. }
  4846. return e;
  4847. } else {
  4848. return el;
  4849. }
  4850. }
  4851. },
  4852. removeNode : isIE6 || isIE7 || isIE8
  4853. ? (function() {
  4854. var d;
  4855. return function(n){
  4856. if(n && n.tagName.toUpperCase() != 'BODY'){
  4857. (Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n) : Ext.EventManager.removeAll(n);
  4858. var cache = Ext.cache,
  4859. id = n.id;
  4860. if (cache[id]) {
  4861. delete cache[id].dom;
  4862. delete cache[id];
  4863. }
  4864. if (isIE8 && n.parentNode) {
  4865. n.parentNode.removeChild(n);
  4866. }
  4867. d = d || document.createElement('div');
  4868. d.appendChild(n);
  4869. d.innerHTML = '';
  4870. }
  4871. };
  4872. }())
  4873. : function(n) {
  4874. if (n && n.parentNode && n.tagName.toUpperCase() != 'BODY') {
  4875. (Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n) : Ext.EventManager.removeAll(n);
  4876. var cache = Ext.cache,
  4877. id = n.id;
  4878. if (cache[id]) {
  4879. delete cache[id].dom;
  4880. delete cache[id];
  4881. }
  4882. n.parentNode.removeChild(n);
  4883. }
  4884. },
  4885. isStrict: isStrict,
  4886. isIEQuirks: isIE && !isStrict,
  4887. isOpera : isOpera,
  4888. isOpera10_5 : isOpera10_5,
  4889. isWebKit : isWebKit,
  4890. isChrome : isChrome,
  4891. isSafari : isSafari,
  4892. isSafari3 : isSafari3,
  4893. isSafari4 : isSafari4,
  4894. isSafari5 : isSafari5,
  4895. isSafari5_0 : isSafari5_0,
  4896. isSafari2 : isSafari2,
  4897. isIE : isIE,
  4898. isIE6 : isIE6,
  4899. isIE7 : isIE7,
  4900. isIE8 : isIE8,
  4901. isIE9 : isIE9,
  4902. isGecko : isGecko,
  4903. isGecko3 : isGecko3,
  4904. isGecko4 : isGecko4,
  4905. isGecko5 : isGecko5,
  4906. isGecko10 : isGecko10,
  4907. isFF3_0 : isFF3_0,
  4908. isFF3_5 : isFF3_5,
  4909. isFF3_6 : isFF3_6,
  4910. isFF4 : 4 <= firefoxVersion && firefoxVersion < 5,
  4911. isFF5 : 5 <= firefoxVersion && firefoxVersion < 6,
  4912. isFF10 : 10 <= firefoxVersion && firefoxVersion < 11,
  4913. isLinux : isLinux,
  4914. isWindows : isWindows,
  4915. isMac : isMac,
  4916. chromeVersion: chromeVersion,
  4917. firefoxVersion: firefoxVersion,
  4918. ieVersion: ieVersion,
  4919. operaVersion: operaVersion,
  4920. safariVersion: safariVersion,
  4921. webKitVersion: webKitVersion,
  4922. isSecure: isSecure,
  4923. BLANK_IMAGE_URL : (isIE6 || isIE7) ? '/' + '/www.sencha.com/s.gif' : 'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',
  4924. value : function(v, defaultValue, allowBlank){
  4925. return Ext.isEmpty(v, allowBlank) ? defaultValue : v;
  4926. },
  4927. escapeRe : function(s) {
  4928. return s.replace(/([-.*+?\^${}()|\[\]\/\\])/g, "\\$1");
  4929. },
  4930. addBehaviors : function(o){
  4931. if(!Ext.isReady){
  4932. Ext.onReady(function(){
  4933. Ext.addBehaviors(o);
  4934. });
  4935. } else {
  4936. var cache = {},
  4937. parts,
  4938. b,
  4939. s;
  4940. for (b in o) {
  4941. if ((parts = b.split('@'))[1]) {
  4942. s = parts[0];
  4943. if(!cache[s]){
  4944. cache[s] = Ext.select(s);
  4945. }
  4946. cache[s].on(parts[1], o[b]);
  4947. }
  4948. }
  4949. cache = null;
  4950. }
  4951. },
  4952. getScrollbarSize: function (force) {
  4953. if (!Ext.isReady) {
  4954. return {};
  4955. }
  4956. if (force || !scrollbarSize) {
  4957. var db = document.body,
  4958. div = document.createElement('div');
  4959. div.style.width = div.style.height = '100px';
  4960. div.style.overflow = 'scroll';
  4961. div.style.position = 'absolute';
  4962. db.appendChild(div);
  4963. scrollbarSize = {
  4964. width: div.offsetWidth - div.clientWidth,
  4965. height: div.offsetHeight - div.clientHeight
  4966. };
  4967. db.removeChild(div);
  4968. }
  4969. return scrollbarSize;
  4970. },
  4971. getScrollBarWidth: function(force){
  4972. var size = Ext.getScrollbarSize(force);
  4973. return size.width + 2;
  4974. },
  4975. copyTo : function(dest, source, names, usePrototypeKeys){
  4976. if(typeof names == 'string'){
  4977. names = names.split(/[,;\s]/);
  4978. }
  4979. var n,
  4980. nLen = names.length,
  4981. name;
  4982. for(n = 0; n < nLen; n++) {
  4983. name = names[n];
  4984. if(usePrototypeKeys || source.hasOwnProperty(name)){
  4985. dest[name] = source[name];
  4986. }
  4987. }
  4988. return dest;
  4989. },
  4990. destroyMembers : function(o){
  4991. for (var i = 1, a = arguments, len = a.length; i < len; i++) {
  4992. Ext.destroy(o[a[i]]);
  4993. delete o[a[i]];
  4994. }
  4995. },
  4996. log :
  4997. nullLog,
  4998. partition : function(arr, truth){
  4999. var ret = [[],[]],
  5000. a, v,
  5001. aLen = arr.length;
  5002. for (a = 0; a < aLen; a++) {
  5003. v = arr[a];
  5004. ret[ (truth && truth(v, a, arr)) || (!truth && v) ? 0 : 1].push(v);
  5005. }
  5006. return ret;
  5007. },
  5008. invoke : function(arr, methodName){
  5009. var ret = [],
  5010. args = Array.prototype.slice.call(arguments, 2),
  5011. a, v,
  5012. aLen = arr.length;
  5013. for (a = 0; a < aLen; a++) {
  5014. v = arr[a];
  5015. if (v && typeof v[methodName] == 'function') {
  5016. ret.push(v[methodName].apply(v, args));
  5017. } else {
  5018. ret.push(undefined);
  5019. }
  5020. }
  5021. return ret;
  5022. },
  5023. zip : function(){
  5024. var parts = Ext.partition(arguments, function( val ){ return typeof val != 'function'; }),
  5025. arrs = parts[0],
  5026. fn = parts[1][0],
  5027. len = Ext.max(Ext.pluck(arrs, "length")),
  5028. ret = [],
  5029. i,
  5030. j,
  5031. aLen;
  5032. for (i = 0; i < len; i++) {
  5033. ret[i] = [];
  5034. if(fn){
  5035. ret[i] = fn.apply(fn, Ext.pluck(arrs, i));
  5036. }else{
  5037. for (j = 0, aLen = arrs.length; j < aLen; j++){
  5038. ret[i].push( arrs[j][i] );
  5039. }
  5040. }
  5041. }
  5042. return ret;
  5043. },
  5044. toSentence: function(items, connector) {
  5045. var length = items.length,
  5046. head,
  5047. tail;
  5048. if (length <= 1) {
  5049. return items[0];
  5050. } else {
  5051. head = items.slice(0, length - 1);
  5052. tail = items[length - 1];
  5053. return Ext.util.Format.format("{0} {1} {2}", head.join(", "), connector || 'and', tail);
  5054. }
  5055. },
  5056. useShims: isIE6
  5057. });
  5058. }());
  5059. Ext.application = function(config) {
  5060. Ext.require('Ext.app.Application');
  5061. Ext.onReady(function() {
  5062. new Ext.app.Application(config);
  5063. });
  5064. };
  5065. //@tag extras,core
  5066. //@require ../Ext-more.js
  5067. //@define Ext.util.Format
  5068. (function() {
  5069. Ext.ns('Ext.util');
  5070. Ext.util.Format = {};
  5071. var UtilFormat = Ext.util.Format,
  5072. stripTagsRE = /<\/?[^>]+>/gi,
  5073. stripScriptsRe = /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,
  5074. nl2brRe = /\r?\n/g,
  5075. formatCleanRe = /[^\d\.]/g,
  5076. I18NFormatCleanRe;
  5077. Ext.apply(UtilFormat, {
  5078. thousandSeparator: ',',
  5079. decimalSeparator: '.',
  5080. currencyPrecision: 2,
  5081. currencySign: '$',
  5082. currencyAtEnd: false,
  5083. undef : function(value) {
  5084. return value !== undefined ? value : "";
  5085. },
  5086. defaultValue : function(value, defaultValue) {
  5087. return value !== undefined && value !== '' ? value : defaultValue;
  5088. },
  5089. substr : 'ab'.substr(-1) != 'b'
  5090. ? function (value, start, length) {
  5091. var str = String(value);
  5092. return (start < 0)
  5093. ? str.substr(Math.max(str.length + start, 0), length)
  5094. : str.substr(start, length);
  5095. }
  5096. : function(value, start, length) {
  5097. return String(value).substr(start, length);
  5098. },
  5099. lowercase : function(value) {
  5100. return String(value).toLowerCase();
  5101. },
  5102. uppercase : function(value) {
  5103. return String(value).toUpperCase();
  5104. },
  5105. usMoney : function(v) {
  5106. return UtilFormat.currency(v, '$', 2);
  5107. },
  5108. currency: function(v, currencySign, decimals, end) {
  5109. var negativeSign = '',
  5110. format = ",0",
  5111. i = 0;
  5112. v = v - 0;
  5113. if (v < 0) {
  5114. v = -v;
  5115. negativeSign = '-';
  5116. }
  5117. decimals = Ext.isDefined(decimals) ? decimals : UtilFormat.currencyPrecision;
  5118. format += format + (decimals > 0 ? '.' : '');
  5119. for (; i < decimals; i++) {
  5120. format += '0';
  5121. }
  5122. v = UtilFormat.number(v, format);
  5123. if ((end || UtilFormat.currencyAtEnd) === true) {
  5124. return Ext.String.format("{0}{1}{2}", negativeSign, v, currencySign || UtilFormat.currencySign);
  5125. } else {
  5126. return Ext.String.format("{0}{1}{2}", negativeSign, currencySign || UtilFormat.currencySign, v);
  5127. }
  5128. },
  5129. date: function(v, format) {
  5130. if (!v) {
  5131. return "";
  5132. }
  5133. if (!Ext.isDate(v)) {
  5134. v = new Date(Date.parse(v));
  5135. }
  5136. return Ext.Date.dateFormat(v, format || Ext.Date.defaultFormat);
  5137. },
  5138. dateRenderer : function(format) {
  5139. return function(v) {
  5140. return UtilFormat.date(v, format);
  5141. };
  5142. },
  5143. stripTags : function(v) {
  5144. return !v ? v : String(v).replace(stripTagsRE, "");
  5145. },
  5146. stripScripts : function(v) {
  5147. return !v ? v : String(v).replace(stripScriptsRe, "");
  5148. },
  5149. fileSize : function(size) {
  5150. if (size < 1024) {
  5151. return size + " bytes";
  5152. } else if (size < 1048576) {
  5153. return (Math.round(((size*10) / 1024))/10) + " KB";
  5154. } else {
  5155. return (Math.round(((size*10) / 1048576))/10) + " MB";
  5156. }
  5157. },
  5158. math : (function(){
  5159. var fns = {};
  5160. return function(v, a){
  5161. if (!fns[a]) {
  5162. fns[a] = Ext.functionFactory('v', 'return v ' + a + ';');
  5163. }
  5164. return fns[a](v);
  5165. };
  5166. }()),
  5167. round : function(value, precision) {
  5168. var result = Number(value);
  5169. if (typeof precision == 'number') {
  5170. precision = Math.pow(10, precision);
  5171. result = Math.round(value * precision) / precision;
  5172. }
  5173. return result;
  5174. },
  5175. number : function(v, formatString) {
  5176. if (!formatString) {
  5177. return v;
  5178. }
  5179. v = Ext.Number.from(v, NaN);
  5180. if (isNaN(v)) {
  5181. return '';
  5182. }
  5183. var comma = UtilFormat.thousandSeparator,
  5184. dec = UtilFormat.decimalSeparator,
  5185. i18n = false,
  5186. neg = v < 0,
  5187. hasComma,
  5188. psplit,
  5189. fnum,
  5190. cnum,
  5191. parr,
  5192. j,
  5193. m,
  5194. n,
  5195. i;
  5196. v = Math.abs(v);
  5197. if (formatString.substr(formatString.length - 2) == '/i') {
  5198. if (!I18NFormatCleanRe) {
  5199. I18NFormatCleanRe = new RegExp('[^\\d\\' + UtilFormat.decimalSeparator + ']','g');
  5200. }
  5201. formatString = formatString.substr(0, formatString.length - 2);
  5202. i18n = true;
  5203. hasComma = formatString.indexOf(comma) != -1;
  5204. psplit = formatString.replace(I18NFormatCleanRe, '').split(dec);
  5205. } else {
  5206. hasComma = formatString.indexOf(',') != -1;
  5207. psplit = formatString.replace(formatCleanRe, '').split('.');
  5208. }
  5209. if (psplit.length > 2) {
  5210. } else if (psplit.length > 1) {
  5211. v = Ext.Number.toFixed(v, psplit[1].length);
  5212. } else {
  5213. v = Ext.Number.toFixed(v, 0);
  5214. }
  5215. fnum = v.toString();
  5216. psplit = fnum.split('.');
  5217. if (hasComma) {
  5218. cnum = psplit[0];
  5219. parr = [];
  5220. j = cnum.length;
  5221. m = Math.floor(j / 3);
  5222. n = cnum.length % 3 || 3;
  5223. for (i = 0; i < j; i += n) {
  5224. if (i !== 0) {
  5225. n = 3;
  5226. }
  5227. parr[parr.length] = cnum.substr(i, n);
  5228. m -= 1;
  5229. }
  5230. fnum = parr.join(comma);
  5231. if (psplit[1]) {
  5232. fnum += dec + psplit[1];
  5233. }
  5234. } else {
  5235. if (psplit[1]) {
  5236. fnum = psplit[0] + dec + psplit[1];
  5237. }
  5238. }
  5239. if (neg) {
  5240. neg = fnum.replace(/[^1-9]/g, '') !== '';
  5241. }
  5242. return (neg ? '-' : '') + formatString.replace(/[\d,?\.?]+/, fnum);
  5243. },
  5244. numberRenderer : function(format) {
  5245. return function(v) {
  5246. return UtilFormat.number(v, format);
  5247. };
  5248. },
  5249. plural : function(v, s, p) {
  5250. return v +' ' + (v == 1 ? s : (p ? p : s+'s'));
  5251. },
  5252. nl2br : function(v) {
  5253. return Ext.isEmpty(v) ? '' : v.replace(nl2brRe, '<br/>');
  5254. },
  5255. capitalize: Ext.String.capitalize,
  5256. ellipsis: Ext.String.ellipsis,
  5257. format: Ext.String.format,
  5258. htmlDecode: Ext.String.htmlDecode,
  5259. htmlEncode: Ext.String.htmlEncode,
  5260. leftPad: Ext.String.leftPad,
  5261. trim : Ext.String.trim,
  5262. parseBox : function(box) {
  5263. box = Ext.isEmpty(box) ? '' : box;
  5264. if (Ext.isNumber(box)) {
  5265. box = box.toString();
  5266. }
  5267. var parts = box.split(' '),
  5268. ln = parts.length;
  5269. if (ln == 1) {
  5270. parts[1] = parts[2] = parts[3] = parts[0];
  5271. }
  5272. else if (ln == 2) {
  5273. parts[2] = parts[0];
  5274. parts[3] = parts[1];
  5275. }
  5276. else if (ln == 3) {
  5277. parts[3] = parts[1];
  5278. }
  5279. return {
  5280. top :parseInt(parts[0], 10) || 0,
  5281. right :parseInt(parts[1], 10) || 0,
  5282. bottom:parseInt(parts[2], 10) || 0,
  5283. left :parseInt(parts[3], 10) || 0
  5284. };
  5285. },
  5286. escapeRegex : function(s) {
  5287. return s.replace(/([\-.*+?\^${}()|\[\]\/\\])/g, "\\$1");
  5288. }
  5289. });
  5290. }());
  5291. //@tag extras,core
  5292. //@require Format.js
  5293. //@define Ext.util.TaskManager
  5294. //@define Ext.TaskManager
  5295. Ext.define('Ext.util.TaskRunner', {
  5296. interval: 10,
  5297. timerId: null,
  5298. constructor: function (interval) {
  5299. var me = this;
  5300. if (typeof interval == 'number') {
  5301. me.interval = interval;
  5302. } else if (interval) {
  5303. Ext.apply(me, interval);
  5304. }
  5305. me.tasks = [];
  5306. me.timerFn = Ext.Function.bind(me.onTick, me);
  5307. },
  5308. newTask: function (config) {
  5309. var task = new Ext.util.TaskRunner.Task(config);
  5310. task.manager = this;
  5311. return task;
  5312. },
  5313. start: function(task) {
  5314. var me = this,
  5315. now = new Date().getTime();
  5316. if (!task.pending) {
  5317. me.tasks.push(task);
  5318. task.pending = true;
  5319. }
  5320. task.stopped = false;
  5321. task.taskStartTime = now;
  5322. task.taskRunTime = task.fireOnStart !== false ? 0 : task.taskStartTime;
  5323. task.taskRunCount = 0;
  5324. if (!me.firing) {
  5325. if (task.fireOnStart !== false) {
  5326. me.startTimer(0, now);
  5327. } else {
  5328. me.startTimer(task.interval, now);
  5329. }
  5330. }
  5331. return task;
  5332. },
  5333. stop: function(task) {
  5334. if (!task.stopped) {
  5335. task.stopped = true;
  5336. if (task.onStop) {
  5337. task.onStop.call(task.scope || task, task);
  5338. }
  5339. }
  5340. return task;
  5341. },
  5342. stopAll: function() {
  5343. Ext.each(this.tasks, this.stop, this);
  5344. },
  5345. firing: false,
  5346. nextExpires: 1e99,
  5347. onTick: function () {
  5348. var me = this,
  5349. tasks = me.tasks,
  5350. now = new Date().getTime(),
  5351. nextExpires = 1e99,
  5352. len = tasks.length,
  5353. expires, newTasks, i, task, rt, remove;
  5354. me.timerId = null;
  5355. me.firing = true;
  5356. for (i = 0; i < len || i < (len = tasks.length); ++i) {
  5357. task = tasks[i];
  5358. if (!(remove = task.stopped)) {
  5359. expires = task.taskRunTime + task.interval;
  5360. if (expires <= now) {
  5361. rt = 1;
  5362. try {
  5363. rt = task.run.apply(task.scope || task, task.args || [++task.taskRunCount]);
  5364. } catch (taskError) {
  5365. try {
  5366. if (task.onError) {
  5367. rt = task.onError.call(task.scope || task, task, taskError);
  5368. }
  5369. } catch (ignore) { }
  5370. }
  5371. task.taskRunTime = now;
  5372. if (rt === false || task.taskRunCount === task.repeat) {
  5373. me.stop(task);
  5374. remove = true;
  5375. } else {
  5376. remove = task.stopped;
  5377. expires = now + task.interval;
  5378. }
  5379. }
  5380. if (!remove && task.duration && task.duration <= (now - task.taskStartTime)) {
  5381. me.stop(task);
  5382. remove = true;
  5383. }
  5384. }
  5385. if (remove) {
  5386. task.pending = false;
  5387. if (!newTasks) {
  5388. newTasks = tasks.slice(0, i);
  5389. }
  5390. } else {
  5391. if (newTasks) {
  5392. newTasks.push(task);
  5393. }
  5394. if (nextExpires > expires) {
  5395. nextExpires = expires;
  5396. }
  5397. }
  5398. }
  5399. if (newTasks) {
  5400. me.tasks = newTasks;
  5401. }
  5402. me.firing = false;
  5403. if (me.tasks.length) {
  5404. me.startTimer(nextExpires - now, new Date().getTime());
  5405. }
  5406. },
  5407. startTimer: function (timeout, now) {
  5408. var me = this,
  5409. expires = now + timeout,
  5410. timerId = me.timerId;
  5411. if (timerId && me.nextExpires - expires > me.interval) {
  5412. clearTimeout(timerId);
  5413. timerId = null;
  5414. }
  5415. if (!timerId) {
  5416. if (timeout < me.interval) {
  5417. timeout = me.interval;
  5418. }
  5419. me.timerId = setTimeout(me.timerFn, timeout);
  5420. me.nextExpires = expires;
  5421. }
  5422. }
  5423. },
  5424. function () {
  5425. var me = this,
  5426. proto = me.prototype;
  5427. proto.destroy = proto.stopAll;
  5428. Ext.util.TaskManager = Ext.TaskManager = new me();
  5429. me.Task = new Ext.Class({
  5430. isTask: true,
  5431. stopped: true,
  5432. fireOnStart: false,
  5433. constructor: function (config) {
  5434. Ext.apply(this, config);
  5435. },
  5436. restart: function (interval) {
  5437. if (interval !== undefined) {
  5438. this.interval = interval;
  5439. }
  5440. this.manager.start(this);
  5441. },
  5442. start: function (interval) {
  5443. if (this.stopped) {
  5444. this.restart(interval);
  5445. }
  5446. },
  5447. stop: function () {
  5448. this.manager.stop(this);
  5449. }
  5450. });
  5451. proto = me.Task.prototype;
  5452. proto.destroy = proto.stop;
  5453. });
  5454. //@tag extras,core
  5455. //@require ../util/TaskManager.js
  5456. Ext.define('Ext.perf.Accumulator', (function () {
  5457. var currentFrame = null,
  5458. khrome = Ext.global['chrome'],
  5459. formatTpl,
  5460. getTimestamp = function () {
  5461. getTimestamp = function () {
  5462. return new Date().getTime();
  5463. };
  5464. var interval, toolbox;
  5465. if (Ext.isChrome && khrome && khrome.Interval) {
  5466. interval = new khrome.Interval();
  5467. interval.start();
  5468. getTimestamp = function () {
  5469. return interval.microseconds() / 1000;
  5470. };
  5471. } else if (window.ActiveXObject) {
  5472. try {
  5473. toolbox = new ActiveXObject('SenchaToolbox.Toolbox');
  5474. Ext.senchaToolbox = toolbox;
  5475. getTimestamp = function () {
  5476. return toolbox.milliseconds;
  5477. };
  5478. } catch (e) {
  5479. }
  5480. } else if (Date.now) {
  5481. getTimestamp = Date.now;
  5482. }
  5483. Ext.perf.getTimestamp = Ext.perf.Accumulator.getTimestamp = getTimestamp;
  5484. return getTimestamp();
  5485. };
  5486. function adjustSet (set, time) {
  5487. set.sum += time;
  5488. set.min = Math.min(set.min, time);
  5489. set.max = Math.max(set.max, time);
  5490. }
  5491. function leaveFrame (time) {
  5492. var totalTime = time ? time : (getTimestamp() - this.time),
  5493. me = this,
  5494. accum = me.accum;
  5495. ++accum.count;
  5496. if (! --accum.depth) {
  5497. adjustSet(accum.total, totalTime);
  5498. }
  5499. adjustSet(accum.pure, totalTime - me.childTime);
  5500. currentFrame = me.parent;
  5501. if (currentFrame) {
  5502. ++currentFrame.accum.childCount;
  5503. currentFrame.childTime += totalTime;
  5504. }
  5505. }
  5506. function makeSet () {
  5507. return {
  5508. min: Number.MAX_VALUE,
  5509. max: 0,
  5510. sum: 0
  5511. };
  5512. }
  5513. function makeTap (me, fn) {
  5514. return function () {
  5515. var frame = me.enter(),
  5516. ret = fn.apply(this, arguments);
  5517. frame.leave();
  5518. return ret;
  5519. };
  5520. }
  5521. function round (x) {
  5522. return Math.round(x * 100) / 100;
  5523. }
  5524. function setToJSON (count, childCount, calibration, set) {
  5525. var data = {
  5526. avg: 0,
  5527. min: set.min,
  5528. max: set.max,
  5529. sum: 0
  5530. };
  5531. if (count) {
  5532. calibration = calibration || 0;
  5533. data.sum = set.sum - childCount * calibration;
  5534. data.avg = data.sum / count;
  5535. }
  5536. return data;
  5537. }
  5538. return {
  5539. constructor: function (name) {
  5540. var me = this;
  5541. me.count = me.childCount = me.depth = me.maxDepth = 0;
  5542. me.pure = makeSet();
  5543. me.total = makeSet();
  5544. me.name = name;
  5545. },
  5546. statics: {
  5547. getTimestamp: getTimestamp
  5548. },
  5549. format: function (calibration) {
  5550. if (!formatTpl) {
  5551. formatTpl = new Ext.XTemplate([
  5552. '{name} - {count} call(s)',
  5553. '<tpl if="count">',
  5554. '<tpl if="childCount">',
  5555. ' ({childCount} children)',
  5556. '</tpl>',
  5557. '<tpl if="depth - 1">',
  5558. ' ({depth} deep)',
  5559. '</tpl>',
  5560. '<tpl for="times">',
  5561. ', {type}: {[this.time(values.sum)]} msec (',
  5562. 'avg={[this.time(values.sum / parent.count)]}',
  5563. ')',
  5564. '</tpl>',
  5565. '</tpl>'
  5566. ].join(''), {
  5567. time: function (t) {
  5568. return Math.round(t * 100) / 100;
  5569. }
  5570. });
  5571. }
  5572. var data = this.getData(calibration);
  5573. data.name = this.name;
  5574. data.pure.type = 'Pure';
  5575. data.total.type = 'Total';
  5576. data.times = [data.pure, data.total];
  5577. return formatTpl.apply(data);
  5578. },
  5579. getData: function (calibration) {
  5580. var me = this;
  5581. return {
  5582. count: me.count,
  5583. childCount: me.childCount,
  5584. depth: me.maxDepth,
  5585. pure: setToJSON(me.count, me.childCount, calibration, me.pure),
  5586. total: setToJSON(me.count, me.childCount, calibration, me.total)
  5587. };
  5588. },
  5589. enter: function () {
  5590. var me = this,
  5591. frame = {
  5592. accum: me,
  5593. leave: leaveFrame,
  5594. childTime: 0,
  5595. parent: currentFrame
  5596. };
  5597. ++me.depth;
  5598. if (me.maxDepth < me.depth) {
  5599. me.maxDepth = me.depth;
  5600. }
  5601. currentFrame = frame;
  5602. frame.time = getTimestamp();
  5603. return frame;
  5604. },
  5605. monitor: function (fn, scope, args) {
  5606. var frame = this.enter();
  5607. if (args) {
  5608. fn.apply(scope, args);
  5609. } else {
  5610. fn.call(scope);
  5611. }
  5612. frame.leave();
  5613. },
  5614. report: function () {
  5615. Ext.log(this.format());
  5616. },
  5617. tap: function (className, methodName) {
  5618. var me = this,
  5619. methods = typeof methodName == 'string' ? [methodName] : methodName,
  5620. klass, statik, i, parts, length, name, src,
  5621. tapFunc;
  5622. tapFunc = function(){
  5623. if (typeof className == 'string') {
  5624. klass = Ext.global;
  5625. parts = className.split('.');
  5626. for (i = 0, length = parts.length; i < length; ++i) {
  5627. klass = klass[parts[i]];
  5628. }
  5629. } else {
  5630. klass = className;
  5631. }
  5632. for (i = 0, length = methods.length; i < length; ++i) {
  5633. name = methods[i];
  5634. statik = name.charAt(0) == '!';
  5635. if (statik) {
  5636. name = name.substring(1);
  5637. } else {
  5638. statik = !(name in klass.prototype);
  5639. }
  5640. src = statik ? klass : klass.prototype;
  5641. src[name] = makeTap(me, src[name]);
  5642. }
  5643. };
  5644. Ext.ClassManager.onCreated(tapFunc, me, className);
  5645. return me;
  5646. }
  5647. };
  5648. }()),
  5649. function () {
  5650. Ext.perf.getTimestamp = this.getTimestamp;
  5651. });
  5652. //@tag extras,core
  5653. //@require Accumulator.js
  5654. Ext.define('Ext.perf.Monitor', {
  5655. singleton: true,
  5656. alternateClassName: 'Ext.Perf',
  5657. requires: [
  5658. 'Ext.perf.Accumulator'
  5659. ],
  5660. constructor: function () {
  5661. this.accumulators = [];
  5662. this.accumulatorsByName = {};
  5663. },
  5664. calibrate: function () {
  5665. var accum = new Ext.perf.Accumulator('$'),
  5666. total = accum.total,
  5667. getTimestamp = Ext.perf.Accumulator.getTimestamp,
  5668. count = 0,
  5669. frame,
  5670. endTime,
  5671. startTime;
  5672. startTime = getTimestamp();
  5673. do {
  5674. frame = accum.enter();
  5675. frame.leave();
  5676. ++count;
  5677. } while (total.sum < 100);
  5678. endTime = getTimestamp();
  5679. return (endTime - startTime) / count;
  5680. },
  5681. get: function (name) {
  5682. var me = this,
  5683. accum = me.accumulatorsByName[name];
  5684. if (!accum) {
  5685. me.accumulatorsByName[name] = accum = new Ext.perf.Accumulator(name);
  5686. me.accumulators.push(accum);
  5687. }
  5688. return accum;
  5689. },
  5690. enter: function (name) {
  5691. return this.get(name).enter();
  5692. },
  5693. monitor: function (name, fn, scope) {
  5694. this.get(name).monitor(fn, scope);
  5695. },
  5696. report: function () {
  5697. var me = this,
  5698. accumulators = me.accumulators,
  5699. calibration = me.calibrate();
  5700. accumulators.sort(function (a, b) {
  5701. return (a.name < b.name) ? -1 : ((b.name < a.name) ? 1 : 0);
  5702. });
  5703. me.updateGC();
  5704. Ext.log('Calibration: ' + Math.round(calibration * 100) / 100 + ' msec/sample');
  5705. Ext.each(accumulators, function (accum) {
  5706. Ext.log(accum.format(calibration));
  5707. });
  5708. },
  5709. getData: function (all) {
  5710. var ret = {},
  5711. accumulators = this.accumulators;
  5712. Ext.each(accumulators, function (accum) {
  5713. if (all || accum.count) {
  5714. ret[accum.name] = accum.getData();
  5715. }
  5716. });
  5717. return ret;
  5718. },
  5719. reset: function(){
  5720. Ext.each(this.accumulators, function(accum){
  5721. var me = accum;
  5722. me.count = me.childCount = me.depth = me.maxDepth = 0;
  5723. me.pure = {
  5724. min: Number.MAX_VALUE,
  5725. max: 0,
  5726. sum: 0
  5727. };
  5728. me.total = {
  5729. min: Number.MAX_VALUE,
  5730. max: 0,
  5731. sum: 0
  5732. };
  5733. });
  5734. },
  5735. updateGC: function () {
  5736. var accumGC = this.accumulatorsByName.GC,
  5737. toolbox = Ext.senchaToolbox,
  5738. bucket;
  5739. if (accumGC) {
  5740. accumGC.count = toolbox.garbageCollectionCounter || 0;
  5741. if (accumGC.count) {
  5742. bucket = accumGC.pure;
  5743. accumGC.total.sum = bucket.sum = toolbox.garbageCollectionMilliseconds;
  5744. bucket.min = bucket.max = bucket.sum / accumGC.count;
  5745. bucket = accumGC.total;
  5746. bucket.min = bucket.max = bucket.sum / accumGC.count;
  5747. }
  5748. }
  5749. },
  5750. watchGC: function () {
  5751. Ext.perf.getTimestamp();
  5752. var toolbox = Ext.senchaToolbox;
  5753. if (toolbox) {
  5754. this.get("GC");
  5755. toolbox.watchGarbageCollector(false);
  5756. }
  5757. },
  5758. setup: function (config) {
  5759. if (!config) {
  5760. config = {
  5761. render: {
  5762. 'Ext.AbstractComponent': 'render'
  5763. },
  5764. layout: {
  5765. 'Ext.layout.Context': 'run'
  5766. }
  5767. };
  5768. }
  5769. this.currentConfig = config;
  5770. var key, prop,
  5771. accum, className, methods;
  5772. for (key in config) {
  5773. if (config.hasOwnProperty(key)) {
  5774. prop = config[key];
  5775. accum = Ext.Perf.get(key);
  5776. for (className in prop) {
  5777. if (prop.hasOwnProperty(className)) {
  5778. methods = prop[className];
  5779. accum.tap(className, methods);
  5780. }
  5781. }
  5782. }
  5783. }
  5784. this.watchGC();
  5785. }
  5786. });
  5787. //@tag extras,core
  5788. //@require perf/Monitor.js
  5789. //@define Ext.Supports
  5790. Ext.is = {
  5791. init : function(navigator) {
  5792. var platforms = this.platforms,
  5793. ln = platforms.length,
  5794. i, platform;
  5795. navigator = navigator || window.navigator;
  5796. for (i = 0; i < ln; i++) {
  5797. platform = platforms[i];
  5798. this[platform.identity] = platform.regex.test(navigator[platform.property]);
  5799. }
  5800. this.Desktop = this.Mac || this.Windows || (this.Linux && !this.Android);
  5801. this.Tablet = this.iPad;
  5802. this.Phone = !this.Desktop && !this.Tablet;
  5803. this.iOS = this.iPhone || this.iPad || this.iPod;
  5804. this.Standalone = !!window.navigator.standalone;
  5805. },
  5806. platforms: [{
  5807. property: 'platform',
  5808. regex: /iPhone/i,
  5809. identity: 'iPhone'
  5810. },
  5811. {
  5812. property: 'platform',
  5813. regex: /iPod/i,
  5814. identity: 'iPod'
  5815. },
  5816. {
  5817. property: 'userAgent',
  5818. regex: /iPad/i,
  5819. identity: 'iPad'
  5820. },
  5821. {
  5822. property: 'userAgent',
  5823. regex: /Blackberry/i,
  5824. identity: 'Blackberry'
  5825. },
  5826. {
  5827. property: 'userAgent',
  5828. regex: /Android/i,
  5829. identity: 'Android'
  5830. },
  5831. {
  5832. property: 'platform',
  5833. regex: /Mac/i,
  5834. identity: 'Mac'
  5835. },
  5836. {
  5837. property: 'platform',
  5838. regex: /Win/i,
  5839. identity: 'Windows'
  5840. },
  5841. {
  5842. property: 'platform',
  5843. regex: /Linux/i,
  5844. identity: 'Linux'
  5845. }]
  5846. };
  5847. Ext.is.init();
  5848. (function(){
  5849. var getStyle = function(element, styleName){
  5850. var view = element.ownerDocument.defaultView,
  5851. style = (view ? view.getComputedStyle(element, null) : element.currentStyle) || element.style;
  5852. return style[styleName];
  5853. };
  5854. Ext.supports = {
  5855. init : function() {
  5856. var me = this,
  5857. doc = document,
  5858. tests = me.tests,
  5859. n = tests.length,
  5860. div = n && Ext.isReady && doc.createElement('div'),
  5861. test, notRun = [];
  5862. if (div) {
  5863. div.innerHTML = [
  5864. '<div style="height:30px;width:50px;">',
  5865. '<div style="height:20px;width:20px;"></div>',
  5866. '</div>',
  5867. '<div style="width: 200px; height: 200px; position: relative; padding: 5px;">',
  5868. '<div style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></div>',
  5869. '</div>',
  5870. '<div style="position: absolute; left: 10%; top: 10%;"></div>',
  5871. '<div style="float:left; background-color:transparent;"></div>'
  5872. ].join('');
  5873. doc.body.appendChild(div);
  5874. }
  5875. while (n--) {
  5876. test = tests[n];
  5877. if (div || test.early) {
  5878. me[test.identity] = test.fn.call(me, doc, div);
  5879. } else {
  5880. notRun.push(test);
  5881. }
  5882. }
  5883. if (div) {
  5884. doc.body.removeChild(div);
  5885. }
  5886. me.tests = notRun;
  5887. },
  5888. PointerEvents: 'pointerEvents' in document.documentElement.style,
  5889. CSS3BoxShadow: 'boxShadow' in document.documentElement.style || 'WebkitBoxShadow' in document.documentElement.style || 'MozBoxShadow' in document.documentElement.style,
  5890. ClassList: !!document.documentElement.classList,
  5891. OrientationChange: ((typeof window.orientation != 'undefined') && ('onorientationchange' in window)),
  5892. DeviceMotion: ('ondevicemotion' in window),
  5893. Touch: ('ontouchstart' in window) && (!Ext.is.Desktop),
  5894. TimeoutActualLateness: (function(){
  5895. setTimeout(function(){
  5896. Ext.supports.TimeoutActualLateness = arguments.length !== 0;
  5897. }, 0);
  5898. }()),
  5899. tests: [
  5900. {
  5901. identity: 'Transitions',
  5902. fn: function(doc, div) {
  5903. var prefix = [
  5904. 'webkit',
  5905. 'Moz',
  5906. 'o',
  5907. 'ms',
  5908. 'khtml'
  5909. ],
  5910. TE = 'TransitionEnd',
  5911. transitionEndName = [
  5912. prefix[0] + TE,
  5913. 'transitionend',
  5914. prefix[2] + TE,
  5915. prefix[3] + TE,
  5916. prefix[4] + TE
  5917. ],
  5918. ln = prefix.length,
  5919. i = 0,
  5920. out = false;
  5921. for (; i < ln; i++) {
  5922. if (getStyle(div, prefix[i] + "TransitionProperty")) {
  5923. Ext.supports.CSS3Prefix = prefix[i];
  5924. Ext.supports.CSS3TransitionEnd = transitionEndName[i];
  5925. out = true;
  5926. break;
  5927. }
  5928. }
  5929. return out;
  5930. }
  5931. },
  5932. {
  5933. identity: 'RightMargin',
  5934. fn: function(doc, div) {
  5935. var view = doc.defaultView;
  5936. return !(view && view.getComputedStyle(div.firstChild.firstChild, null).marginRight != '0px');
  5937. }
  5938. },
  5939. {
  5940. identity: 'DisplayChangeInputSelectionBug',
  5941. early: true,
  5942. fn: function() {
  5943. var webKitVersion = Ext.webKitVersion;
  5944. return 0 < webKitVersion && webKitVersion < 533;
  5945. }
  5946. },
  5947. {
  5948. identity: 'DisplayChangeTextAreaSelectionBug',
  5949. early: true,
  5950. fn: function() {
  5951. var webKitVersion = Ext.webKitVersion;
  5952. return 0 < webKitVersion && webKitVersion < 534.24;
  5953. }
  5954. },
  5955. {
  5956. identity: 'TransparentColor',
  5957. fn: function(doc, div, view) {
  5958. view = doc.defaultView;
  5959. return !(view && view.getComputedStyle(div.lastChild, null).backgroundColor != 'transparent');
  5960. }
  5961. },
  5962. {
  5963. identity: 'ComputedStyle',
  5964. fn: function(doc, div, view) {
  5965. view = doc.defaultView;
  5966. return view && view.getComputedStyle;
  5967. }
  5968. },
  5969. {
  5970. identity: 'Svg',
  5971. fn: function(doc) {
  5972. return !!doc.createElementNS && !!doc.createElementNS( "http:/" + "/www.w3.org/2000/svg", "svg").createSVGRect;
  5973. }
  5974. },
  5975. {
  5976. identity: 'Canvas',
  5977. fn: function(doc) {
  5978. return !!doc.createElement('canvas').getContext;
  5979. }
  5980. },
  5981. {
  5982. identity: 'Vml',
  5983. fn: function(doc) {
  5984. var d = doc.createElement("div");
  5985. d.innerHTML = "<!--[if vml]><br/><br/><![endif]-->";
  5986. return (d.childNodes.length == 2);
  5987. }
  5988. },
  5989. {
  5990. identity: 'Float',
  5991. fn: function(doc, div) {
  5992. return !!div.lastChild.style.cssFloat;
  5993. }
  5994. },
  5995. {
  5996. identity: 'AudioTag',
  5997. fn: function(doc) {
  5998. return !!doc.createElement('audio').canPlayType;
  5999. }
  6000. },
  6001. {
  6002. identity: 'History',
  6003. fn: function() {
  6004. var history = window.history;
  6005. return !!(history && history.pushState);
  6006. }
  6007. },
  6008. {
  6009. identity: 'CSS3DTransform',
  6010. fn: function() {
  6011. return (typeof WebKitCSSMatrix != 'undefined' && new WebKitCSSMatrix().hasOwnProperty('m41'));
  6012. }
  6013. },
  6014. {
  6015. identity: 'CSS3LinearGradient',
  6016. fn: function(doc, div) {
  6017. var property = 'background-image:',
  6018. webkit = '-webkit-gradient(linear, left top, right bottom, from(black), to(white))',
  6019. w3c = 'linear-gradient(left top, black, white)',
  6020. moz = '-moz-' + w3c,
  6021. opera = '-o-' + w3c,
  6022. options = [property + webkit, property + w3c, property + moz, property + opera];
  6023. div.style.cssText = options.join(';');
  6024. return ("" + div.style.backgroundImage).indexOf('gradient') !== -1;
  6025. }
  6026. },
  6027. {
  6028. identity: 'CSS3BorderRadius',
  6029. fn: function(doc, div) {
  6030. var domPrefixes = ['borderRadius', 'BorderRadius', 'MozBorderRadius', 'WebkitBorderRadius', 'OBorderRadius', 'KhtmlBorderRadius'],
  6031. pass = false,
  6032. i;
  6033. for (i = 0; i < domPrefixes.length; i++) {
  6034. if (document.body.style[domPrefixes[i]] !== undefined) {
  6035. return true;
  6036. }
  6037. }
  6038. return pass;
  6039. }
  6040. },
  6041. {
  6042. identity: 'GeoLocation',
  6043. fn: function() {
  6044. return (typeof navigator != 'undefined' && typeof navigator.geolocation != 'undefined') || (typeof google != 'undefined' && typeof google.gears != 'undefined');
  6045. }
  6046. },
  6047. {
  6048. identity: 'MouseEnterLeave',
  6049. fn: function(doc, div){
  6050. return ('onmouseenter' in div && 'onmouseleave' in div);
  6051. }
  6052. },
  6053. {
  6054. identity: 'MouseWheel',
  6055. fn: function(doc, div) {
  6056. return ('onmousewheel' in div);
  6057. }
  6058. },
  6059. {
  6060. identity: 'Opacity',
  6061. fn: function(doc, div){
  6062. if (Ext.isIE6 || Ext.isIE7 || Ext.isIE8) {
  6063. return false;
  6064. }
  6065. div.firstChild.style.cssText = 'opacity:0.73';
  6066. return div.firstChild.style.opacity == '0.73';
  6067. }
  6068. },
  6069. {
  6070. identity: 'Placeholder',
  6071. fn: function(doc) {
  6072. return 'placeholder' in doc.createElement('input');
  6073. }
  6074. },
  6075. {
  6076. identity: 'Direct2DBug',
  6077. fn: function() {
  6078. return Ext.isString(document.body.style.msTransformOrigin);
  6079. }
  6080. },
  6081. {
  6082. identity: 'BoundingClientRect',
  6083. fn: function(doc, div) {
  6084. return Ext.isFunction(div.getBoundingClientRect);
  6085. }
  6086. },
  6087. {
  6088. identity: 'IncludePaddingInWidthCalculation',
  6089. fn: function(doc, div){
  6090. return div.childNodes[1].firstChild.offsetWidth == 210;
  6091. }
  6092. },
  6093. {
  6094. identity: 'IncludePaddingInHeightCalculation',
  6095. fn: function(doc, div){
  6096. return div.childNodes[1].firstChild.offsetHeight == 210;
  6097. }
  6098. },
  6099. {
  6100. identity: 'ArraySort',
  6101. fn: function() {
  6102. var a = [1,2,3,4,5].sort(function(){ return 0; });
  6103. return a[0] === 1 && a[1] === 2 && a[2] === 3 && a[3] === 4 && a[4] === 5;
  6104. }
  6105. },
  6106. {
  6107. identity: 'Range',
  6108. fn: function() {
  6109. return !!document.createRange;
  6110. }
  6111. },
  6112. {
  6113. identity: 'CreateContextualFragment',
  6114. fn: function() {
  6115. var range = Ext.supports.Range ? document.createRange() : false;
  6116. return range && !!range.createContextualFragment;
  6117. }
  6118. },
  6119. {
  6120. identity: 'WindowOnError',
  6121. fn: function () {
  6122. return Ext.isIE || Ext.isGecko || Ext.webKitVersion >= 534.16;
  6123. }
  6124. },
  6125. {
  6126. identity: 'TextAreaMaxLength',
  6127. fn: function(){
  6128. var el = document.createElement('textarea');
  6129. return ('maxlength' in el);
  6130. }
  6131. },
  6132. {
  6133. identity: 'GetPositionPercentage',
  6134. fn: function(doc, div){
  6135. return getStyle(div.childNodes[2], 'left') == '10%';
  6136. }
  6137. }
  6138. ]
  6139. };
  6140. }());
  6141. Ext.supports.init();
  6142. //@tag dom,core
  6143. //@require ../Support.js
  6144. //@define Ext.util.DelayedTask
  6145. Ext.util.DelayedTask = function(fn, scope, args) {
  6146. var me = this,
  6147. id,
  6148. call = function() {
  6149. clearInterval(id);
  6150. id = null;
  6151. fn.apply(scope, args || []);
  6152. };
  6153. this.delay = function(delay, newFn, newScope, newArgs) {
  6154. me.cancel();
  6155. fn = newFn || fn;
  6156. scope = newScope || scope;
  6157. args = newArgs || args;
  6158. id = setInterval(call, delay);
  6159. };
  6160. this.cancel = function(){
  6161. if (id) {
  6162. clearInterval(id);
  6163. id = null;
  6164. }
  6165. };
  6166. };
  6167. //@tag dom,core
  6168. //@define Ext.util.Event
  6169. //@require Ext.util.DelayedTask
  6170. Ext.require('Ext.util.DelayedTask', function() {
  6171. Ext.util.Event = Ext.extend(Object, (function() {
  6172. var noOptions = {};
  6173. function createTargeted(handler, listener, o, scope){
  6174. return function(){
  6175. if (o.target === arguments[0]){
  6176. handler.apply(scope, arguments);
  6177. }
  6178. };
  6179. }
  6180. function createBuffered(handler, listener, o, scope) {
  6181. listener.task = new Ext.util.DelayedTask();
  6182. return function() {
  6183. listener.task.delay(o.buffer, handler, scope, Ext.Array.toArray(arguments));
  6184. };
  6185. }
  6186. function createDelayed(handler, listener, o, scope) {
  6187. return function() {
  6188. var task = new Ext.util.DelayedTask();
  6189. if (!listener.tasks) {
  6190. listener.tasks = [];
  6191. }
  6192. listener.tasks.push(task);
  6193. task.delay(o.delay || 10, handler, scope, Ext.Array.toArray(arguments));
  6194. };
  6195. }
  6196. function createSingle(handler, listener, o, scope) {
  6197. return function() {
  6198. var event = listener.ev;
  6199. if (event.removeListener(listener.fn, scope) && event.observable) {
  6200. event.observable.hasListeners[event.name]--;
  6201. }
  6202. return handler.apply(scope, arguments);
  6203. };
  6204. }
  6205. return {
  6206. isEvent: true,
  6207. constructor: function(observable, name) {
  6208. this.name = name;
  6209. this.observable = observable;
  6210. this.listeners = [];
  6211. },
  6212. addListener: function(fn, scope, options) {
  6213. var me = this,
  6214. listener;
  6215. scope = scope || me.observable;
  6216. if (!me.isListening(fn, scope)) {
  6217. listener = me.createListener(fn, scope, options);
  6218. if (me.firing) {
  6219. me.listeners = me.listeners.slice(0);
  6220. }
  6221. me.listeners.push(listener);
  6222. }
  6223. },
  6224. createListener: function(fn, scope, options) {
  6225. options = options || noOptions;
  6226. scope = scope || this.observable;
  6227. var listener = {
  6228. fn: fn,
  6229. scope: scope,
  6230. o: options,
  6231. ev: this
  6232. },
  6233. handler = fn;
  6234. if (options.single) {
  6235. handler = createSingle(handler, listener, options, scope);
  6236. }
  6237. if (options.target) {
  6238. handler = createTargeted(handler, listener, options, scope);
  6239. }
  6240. if (options.delay) {
  6241. handler = createDelayed(handler, listener, options, scope);
  6242. }
  6243. if (options.buffer) {
  6244. handler = createBuffered(handler, listener, options, scope);
  6245. }
  6246. listener.fireFn = handler;
  6247. return listener;
  6248. },
  6249. findListener: function(fn, scope) {
  6250. var listeners = this.listeners,
  6251. i = listeners.length,
  6252. listener,
  6253. s;
  6254. while (i--) {
  6255. listener = listeners[i];
  6256. if (listener) {
  6257. s = listener.scope;
  6258. if (listener.fn == fn && (s == (scope || this.observable))) {
  6259. return i;
  6260. }
  6261. }
  6262. }
  6263. return - 1;
  6264. },
  6265. isListening: function(fn, scope) {
  6266. return this.findListener(fn, scope) !== -1;
  6267. },
  6268. removeListener: function(fn, scope) {
  6269. var me = this,
  6270. index,
  6271. listener,
  6272. k;
  6273. index = me.findListener(fn, scope);
  6274. if (index != -1) {
  6275. listener = me.listeners[index];
  6276. if (me.firing) {
  6277. me.listeners = me.listeners.slice(0);
  6278. }
  6279. if (listener.task) {
  6280. listener.task.cancel();
  6281. delete listener.task;
  6282. }
  6283. k = listener.tasks && listener.tasks.length;
  6284. if (k) {
  6285. while (k--) {
  6286. listener.tasks[k].cancel();
  6287. }
  6288. delete listener.tasks;
  6289. }
  6290. Ext.Array.erase(me.listeners, index, 1);
  6291. return true;
  6292. }
  6293. return false;
  6294. },
  6295. clearListeners: function() {
  6296. var listeners = this.listeners,
  6297. i = listeners.length;
  6298. while (i--) {
  6299. this.removeListener(listeners[i].fn, listeners[i].scope);
  6300. }
  6301. },
  6302. fire: function() {
  6303. var me = this,
  6304. listeners = me.listeners,
  6305. count = listeners.length,
  6306. i,
  6307. args,
  6308. listener;
  6309. if (count > 0) {
  6310. me.firing = true;
  6311. for (i = 0; i < count; i++) {
  6312. listener = listeners[i];
  6313. args = arguments.length ? Array.prototype.slice.call(arguments, 0) : [];
  6314. if (listener.o) {
  6315. args.push(listener.o);
  6316. }
  6317. if (listener && listener.fireFn.apply(listener.scope || me.observable, args) === false) {
  6318. return (me.firing = false);
  6319. }
  6320. }
  6321. }
  6322. me.firing = false;
  6323. return true;
  6324. }
  6325. };
  6326. }()));
  6327. });
  6328. //@tag dom,core
  6329. //@require util/Event.js
  6330. //@define Ext.EventManager
  6331. Ext.EventManager = new function() {
  6332. var EventManager = this,
  6333. doc = document,
  6334. win = window,
  6335. initExtCss = function() {
  6336. var bd = doc.body || doc.getElementsByTagName('body')[0],
  6337. baseCSSPrefix = Ext.baseCSSPrefix,
  6338. cls = [baseCSSPrefix + 'body'],
  6339. htmlCls = [],
  6340. supportsLG = Ext.supports.CSS3LinearGradient,
  6341. supportsBR = Ext.supports.CSS3BorderRadius,
  6342. resetCls = [],
  6343. html,
  6344. resetElementSpec;
  6345. if (!bd) {
  6346. return false;
  6347. }
  6348. html = bd.parentNode;
  6349. function add (c) {
  6350. cls.push(baseCSSPrefix + c);
  6351. }
  6352. if (Ext.isIE) {
  6353. add('ie');
  6354. if (Ext.isIE6) {
  6355. add('ie6');
  6356. } else {
  6357. add('ie7p');
  6358. if (Ext.isIE7) {
  6359. add('ie7');
  6360. } else {
  6361. add('ie8p');
  6362. if (Ext.isIE8) {
  6363. add('ie8');
  6364. } else {
  6365. add('ie9p');
  6366. if (Ext.isIE9) {
  6367. add('ie9');
  6368. }
  6369. }
  6370. }
  6371. }
  6372. if (Ext.isIE6 || Ext.isIE7) {
  6373. add('ie7m');
  6374. }
  6375. if (Ext.isIE6 || Ext.isIE7 || Ext.isIE8) {
  6376. add('ie8m');
  6377. }
  6378. if (Ext.isIE7 || Ext.isIE8) {
  6379. add('ie78');
  6380. }
  6381. }
  6382. if (Ext.isGecko) {
  6383. add('gecko');
  6384. if (Ext.isGecko3) {
  6385. add('gecko3');
  6386. }
  6387. if (Ext.isGecko4) {
  6388. add('gecko4');
  6389. }
  6390. if (Ext.isGecko5) {
  6391. add('gecko5');
  6392. }
  6393. }
  6394. if (Ext.isOpera) {
  6395. add('opera');
  6396. }
  6397. if (Ext.isWebKit) {
  6398. add('webkit');
  6399. }
  6400. if (Ext.isSafari) {
  6401. add('safari');
  6402. if (Ext.isSafari2) {
  6403. add('safari2');
  6404. }
  6405. if (Ext.isSafari3) {
  6406. add('safari3');
  6407. }
  6408. if (Ext.isSafari4) {
  6409. add('safari4');
  6410. }
  6411. if (Ext.isSafari5) {
  6412. add('safari5');
  6413. }
  6414. if (Ext.isSafari5_0) {
  6415. add('safari5_0')
  6416. }
  6417. }
  6418. if (Ext.isChrome) {
  6419. add('chrome');
  6420. }
  6421. if (Ext.isMac) {
  6422. add('mac');
  6423. }
  6424. if (Ext.isLinux) {
  6425. add('linux');
  6426. }
  6427. if (!supportsBR) {
  6428. add('nbr');
  6429. }
  6430. if (!supportsLG) {
  6431. add('nlg');
  6432. }
  6433. if (Ext.scopeResetCSS) {
  6434. resetElementSpec = Ext.resetElementSpec = {
  6435. cls: baseCSSPrefix + 'reset'
  6436. };
  6437. if (!supportsLG) {
  6438. resetCls.push(baseCSSPrefix + 'nlg');
  6439. }
  6440. if (!supportsBR) {
  6441. resetCls.push(baseCSSPrefix + 'nbr');
  6442. }
  6443. if (resetCls.length) {
  6444. resetElementSpec.cn = {
  6445. cls: resetCls.join(' ')
  6446. };
  6447. }
  6448. Ext.resetElement = Ext.getBody().createChild(resetElementSpec);
  6449. if (resetCls.length) {
  6450. Ext.resetElement = Ext.get(Ext.resetElement.dom.firstChild);
  6451. }
  6452. }
  6453. else {
  6454. Ext.resetElement = Ext.getBody();
  6455. add('reset');
  6456. }
  6457. if (html) {
  6458. if (Ext.isStrict && (Ext.isIE6 || Ext.isIE7)) {
  6459. Ext.isBorderBox = false;
  6460. }
  6461. else {
  6462. Ext.isBorderBox = true;
  6463. }
  6464. if(Ext.isBorderBox) {
  6465. htmlCls.push(baseCSSPrefix + 'border-box');
  6466. }
  6467. if (Ext.isStrict) {
  6468. htmlCls.push(baseCSSPrefix + 'strict');
  6469. } else {
  6470. htmlCls.push(baseCSSPrefix + 'quirks');
  6471. }
  6472. Ext.fly(html, '_internal').addCls(htmlCls);
  6473. }
  6474. Ext.fly(bd, '_internal').addCls(cls);
  6475. return true;
  6476. };
  6477. Ext.apply(EventManager, {
  6478. hasBoundOnReady: false,
  6479. hasFiredReady: false,
  6480. deferReadyEvent : 1,
  6481. onReadyChain : [],
  6482. readyEvent:
  6483. (function () {
  6484. var event = new Ext.util.Event();
  6485. event.fire = function () {
  6486. Ext._beforeReadyTime = Ext._beforeReadyTime || new Date().getTime();
  6487. event.self.prototype.fire.apply(event, arguments);
  6488. Ext._afterReadytime = new Date().getTime();
  6489. };
  6490. return event;
  6491. }()),
  6492. idleEvent: new Ext.util.Event(),
  6493. isReadyPaused: function(){
  6494. return (/[?&]ext-pauseReadyFire\b/i.test(location.search) && !Ext._continueFireReady);
  6495. },
  6496. bindReadyEvent: function() {
  6497. if (EventManager.hasBoundOnReady) {
  6498. return;
  6499. }
  6500. if ( doc.readyState == 'complete' ) {
  6501. EventManager.onReadyEvent({
  6502. type: doc.readyState || 'body'
  6503. });
  6504. } else {
  6505. document.addEventListener('DOMContentLoaded', EventManager.onReadyEvent, false);
  6506. window.addEventListener('load', EventManager.onReadyEvent, false);
  6507. EventManager.hasBoundOnReady = true;
  6508. }
  6509. },
  6510. onReadyEvent : function(e) {
  6511. if (e && e.type) {
  6512. EventManager.onReadyChain.push(e.type);
  6513. }
  6514. if (EventManager.hasBoundOnReady) {
  6515. document.removeEventListener('DOMContentLoaded', EventManager.onReadyEvent, false);
  6516. window.removeEventListener('load', EventManager.onReadyEvent, false);
  6517. }
  6518. if (!Ext.isReady) {
  6519. EventManager.fireDocReady();
  6520. }
  6521. },
  6522. fireDocReady: function() {
  6523. if (!Ext.isReady) {
  6524. Ext._readyTime = new Date().getTime();
  6525. Ext.isReady = true;
  6526. Ext.supports.init();
  6527. EventManager.onWindowUnload();
  6528. EventManager.readyEvent.onReadyChain = EventManager.onReadyChain;
  6529. if (Ext.isNumber(EventManager.deferReadyEvent)) {
  6530. Ext.Function.defer(EventManager.fireReadyEvent, EventManager.deferReadyEvent);
  6531. EventManager.hasDocReadyTimer = true;
  6532. } else {
  6533. EventManager.fireReadyEvent();
  6534. }
  6535. }
  6536. },
  6537. fireReadyEvent: function(){
  6538. var readyEvent = EventManager.readyEvent;
  6539. EventManager.hasDocReadyTimer = false;
  6540. EventManager.isFiring = true;
  6541. while (readyEvent.listeners.length && !EventManager.isReadyPaused()) {
  6542. readyEvent.fire();
  6543. }
  6544. EventManager.isFiring = false;
  6545. EventManager.hasFiredReady = true;
  6546. },
  6547. onDocumentReady: function(fn, scope, options) {
  6548. options = options || {};
  6549. options.single = true;
  6550. EventManager.readyEvent.addListener(fn, scope, options);
  6551. if (!(EventManager.isFiring || EventManager.hasDocReadyTimer)) {
  6552. if (Ext.isReady) {
  6553. EventManager.fireReadyEvent();
  6554. } else {
  6555. EventManager.bindReadyEvent();
  6556. }
  6557. }
  6558. },
  6559. stoppedMouseDownEvent: new Ext.util.Event(),
  6560. propRe: /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate|freezeEvent)$/,
  6561. getId : function(element) {
  6562. var id;
  6563. element = Ext.getDom(element);
  6564. if (element === doc || element === win) {
  6565. id = element === doc ? Ext.documentId : Ext.windowId;
  6566. }
  6567. else {
  6568. id = Ext.id(element);
  6569. }
  6570. if (!Ext.cache[id]) {
  6571. Ext.addCacheEntry(id, null, element);
  6572. }
  6573. return id;
  6574. },
  6575. prepareListenerConfig: function(element, config, isRemove) {
  6576. var propRe = EventManager.propRe,
  6577. key, value, args;
  6578. for (key in config) {
  6579. if (config.hasOwnProperty(key)) {
  6580. if (!propRe.test(key)) {
  6581. value = config[key];
  6582. if (typeof value == 'function') {
  6583. args = [element, key, value, config.scope, config];
  6584. } else {
  6585. args = [element, key, value.fn, value.scope, value];
  6586. }
  6587. if (isRemove) {
  6588. EventManager.removeListener.apply(EventManager, args);
  6589. } else {
  6590. EventManager.addListener.apply(EventManager, args);
  6591. }
  6592. }
  6593. }
  6594. }
  6595. },
  6596. mouseEnterLeaveRe: /mouseenter|mouseleave/,
  6597. normalizeEvent: function(eventName, fn) {
  6598. if (EventManager.mouseEnterLeaveRe.test(eventName) && !Ext.supports.MouseEnterLeave) {
  6599. if (fn) {
  6600. fn = Ext.Function.createInterceptor(fn, EventManager.contains);
  6601. }
  6602. eventName = eventName == 'mouseenter' ? 'mouseover' : 'mouseout';
  6603. } else if (eventName == 'mousewheel' && !Ext.supports.MouseWheel && !Ext.isOpera) {
  6604. eventName = 'DOMMouseScroll';
  6605. }
  6606. return {
  6607. eventName: eventName,
  6608. fn: fn
  6609. };
  6610. },
  6611. contains: function(event) {
  6612. var parent = event.browserEvent.currentTarget,
  6613. child = EventManager.getRelatedTarget(event);
  6614. if (parent && parent.firstChild) {
  6615. while (child) {
  6616. if (child === parent) {
  6617. return false;
  6618. }
  6619. child = child.parentNode;
  6620. if (child && (child.nodeType != 1)) {
  6621. child = null;
  6622. }
  6623. }
  6624. }
  6625. return true;
  6626. },
  6627. addListener: function(element, eventName, fn, scope, options) {
  6628. if (typeof eventName !== 'string') {
  6629. EventManager.prepareListenerConfig(element, eventName);
  6630. return;
  6631. }
  6632. var dom = element.dom || Ext.getDom(element),
  6633. bind, wrap;
  6634. options = options || {};
  6635. bind = EventManager.normalizeEvent(eventName, fn);
  6636. wrap = EventManager.createListenerWrap(dom, eventName, bind.fn, scope, options);
  6637. if (dom.attachEvent) {
  6638. dom.attachEvent('on' + bind.eventName, wrap);
  6639. } else {
  6640. dom.addEventListener(bind.eventName, wrap, options.capture || false);
  6641. }
  6642. if (dom == doc && eventName == 'mousedown') {
  6643. EventManager.stoppedMouseDownEvent.addListener(wrap);
  6644. }
  6645. EventManager.getEventListenerCache(element.dom ? element : dom, eventName).push({
  6646. fn: fn,
  6647. wrap: wrap,
  6648. scope: scope
  6649. });
  6650. },
  6651. removeListener : function(element, eventName, fn, scope) {
  6652. if (typeof eventName !== 'string') {
  6653. EventManager.prepareListenerConfig(element, eventName, true);
  6654. return;
  6655. }
  6656. var dom = Ext.getDom(element),
  6657. el = element.dom ? element : Ext.get(dom),
  6658. cache = EventManager.getEventListenerCache(el, eventName),
  6659. bindName = EventManager.normalizeEvent(eventName).eventName,
  6660. i = cache.length, j,
  6661. listener, wrap, tasks;
  6662. while (i--) {
  6663. listener = cache[i];
  6664. if (listener && (!fn || listener.fn == fn) && (!scope || listener.scope === scope)) {
  6665. wrap = listener.wrap;
  6666. if (wrap.task) {
  6667. clearTimeout(wrap.task);
  6668. delete wrap.task;
  6669. }
  6670. j = wrap.tasks && wrap.tasks.length;
  6671. if (j) {
  6672. while (j--) {
  6673. clearTimeout(wrap.tasks[j]);
  6674. }
  6675. delete wrap.tasks;
  6676. }
  6677. if (dom.detachEvent) {
  6678. dom.detachEvent('on' + bindName, wrap);
  6679. } else {
  6680. dom.removeEventListener(bindName, wrap, false);
  6681. }
  6682. if (wrap && dom == doc && eventName == 'mousedown') {
  6683. EventManager.stoppedMouseDownEvent.removeListener(wrap);
  6684. }
  6685. Ext.Array.erase(cache, i, 1);
  6686. }
  6687. }
  6688. },
  6689. removeAll : function(element) {
  6690. var el = element.dom ? element : Ext.get(element),
  6691. cache, events, eventName;
  6692. if (!el) {
  6693. return;
  6694. }
  6695. cache = (el.$cache || el.getCache());
  6696. events = cache.events;
  6697. for (eventName in events) {
  6698. if (events.hasOwnProperty(eventName)) {
  6699. EventManager.removeListener(el, eventName);
  6700. }
  6701. }
  6702. cache.events = {};
  6703. },
  6704. purgeElement : function(element, eventName) {
  6705. var dom = Ext.getDom(element),
  6706. i = 0, len;
  6707. if (eventName) {
  6708. EventManager.removeListener(element, eventName);
  6709. }
  6710. else {
  6711. EventManager.removeAll(element);
  6712. }
  6713. if (dom && dom.childNodes) {
  6714. for (len = element.childNodes.length; i < len; i++) {
  6715. EventManager.purgeElement(element.childNodes[i], eventName);
  6716. }
  6717. }
  6718. },
  6719. createListenerWrap : function(dom, ename, fn, scope, options) {
  6720. options = options || {};
  6721. var f, gen, escapeRx = /\\/g, wrap = function(e, args) {
  6722. if (!gen) {
  6723. f = ['if(!' + Ext.name + ') {return;}'];
  6724. if(options.buffer || options.delay || options.freezeEvent) {
  6725. f.push('e = new X.EventObjectImpl(e, ' + (options.freezeEvent ? 'true' : 'false' ) + ');');
  6726. } else {
  6727. f.push('e = X.EventObject.setEvent(e);');
  6728. }
  6729. if (options.delegate) {
  6730. f.push('var result, t = e.getTarget("' + (options.delegate + '').replace(escapeRx, '\\\\') + '", this);');
  6731. f.push('if(!t) {return;}');
  6732. } else {
  6733. f.push('var t = e.target, result;');
  6734. }
  6735. if (options.target) {
  6736. f.push('if(e.target !== options.target) {return;}');
  6737. }
  6738. if(options.stopEvent) {
  6739. f.push('e.stopEvent();');
  6740. } else {
  6741. if(options.preventDefault) {
  6742. f.push('e.preventDefault();');
  6743. }
  6744. if(options.stopPropagation) {
  6745. f.push('e.stopPropagation();');
  6746. }
  6747. }
  6748. if(options.normalized === false) {
  6749. f.push('e = e.browserEvent;');
  6750. }
  6751. if(options.buffer) {
  6752. f.push('(wrap.task && clearTimeout(wrap.task));');
  6753. f.push('wrap.task = setTimeout(function() {');
  6754. }
  6755. if(options.delay) {
  6756. f.push('wrap.tasks = wrap.tasks || [];');
  6757. f.push('wrap.tasks.push(setTimeout(function() {');
  6758. }
  6759. f.push('result = fn.call(scope || dom, e, t, options);');
  6760. if(options.single) {
  6761. f.push('evtMgr.removeListener(dom, ename, fn, scope);');
  6762. }
  6763. if (ename !== 'mousemove') {
  6764. f.push('if (evtMgr.idleEvent.listeners.length) {');
  6765. f.push('evtMgr.idleEvent.fire();');
  6766. f.push('}');
  6767. }
  6768. if(options.delay) {
  6769. f.push('}, ' + options.delay + '));');
  6770. }
  6771. if(options.buffer) {
  6772. f.push('}, ' + options.buffer + ');');
  6773. }
  6774. f.push('return result;')
  6775. gen = Ext.cacheableFunctionFactory('e', 'options', 'fn', 'scope', 'ename', 'dom', 'wrap', 'args', 'X', 'evtMgr', f.join('\n'));
  6776. }
  6777. return gen.call(dom, e, options, fn, scope, ename, dom, wrap, args, Ext, EventManager);
  6778. };
  6779. return wrap;
  6780. },
  6781. getEventListenerCache : function(element, eventName) {
  6782. var elementCache, eventCache;
  6783. if (!element) {
  6784. return [];
  6785. }
  6786. if (element.$cache) {
  6787. elementCache = element.$cache;
  6788. } else {
  6789. elementCache = Ext.cache[EventManager.getId(element)];
  6790. }
  6791. eventCache = elementCache.events || (elementCache.events = {});
  6792. return eventCache[eventName] || (eventCache[eventName] = []);
  6793. },
  6794. mouseLeaveRe: /(mouseout|mouseleave)/,
  6795. mouseEnterRe: /(mouseover|mouseenter)/,
  6796. stopEvent: function(event) {
  6797. EventManager.stopPropagation(event);
  6798. EventManager.preventDefault(event);
  6799. },
  6800. stopPropagation: function(event) {
  6801. event = event.browserEvent || event;
  6802. if (event.stopPropagation) {
  6803. event.stopPropagation();
  6804. } else {
  6805. event.cancelBubble = true;
  6806. }
  6807. },
  6808. preventDefault: function(event) {
  6809. event = event.browserEvent || event;
  6810. if (event.preventDefault) {
  6811. event.preventDefault();
  6812. } else {
  6813. event.returnValue = false;
  6814. try {
  6815. if (event.ctrlKey || event.keyCode > 111 && event.keyCode < 124) {
  6816. event.keyCode = -1;
  6817. }
  6818. } catch (e) {
  6819. }
  6820. }
  6821. },
  6822. getRelatedTarget: function(event) {
  6823. event = event.browserEvent || event;
  6824. var target = event.relatedTarget;
  6825. if (!target) {
  6826. if (EventManager.mouseLeaveRe.test(event.type)) {
  6827. target = event.toElement;
  6828. } else if (EventManager.mouseEnterRe.test(event.type)) {
  6829. target = event.fromElement;
  6830. }
  6831. }
  6832. return EventManager.resolveTextNode(target);
  6833. },
  6834. getPageX: function(event) {
  6835. return EventManager.getPageXY(event)[0];
  6836. },
  6837. getPageY: function(event) {
  6838. return EventManager.getPageXY(event)[1];
  6839. },
  6840. getPageXY: function(event) {
  6841. event = event.browserEvent || event;
  6842. var x = event.pageX,
  6843. y = event.pageY,
  6844. docEl = doc.documentElement,
  6845. body = doc.body;
  6846. if (!x && x !== 0) {
  6847. x = event.clientX + (docEl && docEl.scrollLeft || body && body.scrollLeft || 0) - (docEl && docEl.clientLeft || body && body.clientLeft || 0);
  6848. y = event.clientY + (docEl && docEl.scrollTop || body && body.scrollTop || 0) - (docEl && docEl.clientTop || body && body.clientTop || 0);
  6849. }
  6850. return [x, y];
  6851. },
  6852. getTarget: function(event) {
  6853. event = event.browserEvent || event;
  6854. return EventManager.resolveTextNode(event.target || event.srcElement);
  6855. },
  6856. resolveTextNode: Ext.isGecko ?
  6857. function(node) {
  6858. if (!node) {
  6859. return;
  6860. }
  6861. var s = HTMLElement.prototype.toString.call(node);
  6862. if (s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]') {
  6863. return;
  6864. }
  6865. return node.nodeType == 3 ? node.parentNode: node;
  6866. }: function(node) {
  6867. return node && node.nodeType == 3 ? node.parentNode: node;
  6868. },
  6869. curWidth: 0,
  6870. curHeight: 0,
  6871. onWindowResize: function(fn, scope, options) {
  6872. var resize = EventManager.resizeEvent;
  6873. if (!resize) {
  6874. EventManager.resizeEvent = resize = new Ext.util.Event();
  6875. EventManager.on(win, 'resize', EventManager.fireResize, null, {buffer: 100});
  6876. }
  6877. resize.addListener(fn, scope, options);
  6878. },
  6879. fireResize: function() {
  6880. var w = Ext.Element.getViewWidth(),
  6881. h = Ext.Element.getViewHeight();
  6882. if (EventManager.curHeight != h || EventManager.curWidth != w) {
  6883. EventManager.curHeight = h;
  6884. EventManager.curWidth = w;
  6885. EventManager.resizeEvent.fire(w, h);
  6886. }
  6887. },
  6888. removeResizeListener: function(fn, scope) {
  6889. var resize = EventManager.resizeEvent;
  6890. if (resize) {
  6891. resize.removeListener(fn, scope);
  6892. }
  6893. },
  6894. onWindowUnload: function(fn, scope, options) {
  6895. var unload = EventManager.unloadEvent;
  6896. if (!unload) {
  6897. EventManager.unloadEvent = unload = new Ext.util.Event();
  6898. EventManager.addListener(win, 'unload', EventManager.fireUnload);
  6899. }
  6900. if (fn) {
  6901. unload.addListener(fn, scope, options);
  6902. }
  6903. },
  6904. fireUnload: function() {
  6905. try {
  6906. doc = win = undefined;
  6907. var gridviews, i, ln,
  6908. el, cache;
  6909. EventManager.unloadEvent.fire();
  6910. if (Ext.isGecko3) {
  6911. gridviews = Ext.ComponentQuery.query('gridview');
  6912. i = 0;
  6913. ln = gridviews.length;
  6914. for (; i < ln; i++) {
  6915. gridviews[i].scrollToTop();
  6916. }
  6917. }
  6918. cache = Ext.cache;
  6919. for (el in cache) {
  6920. if (cache.hasOwnProperty(el)) {
  6921. EventManager.removeAll(el);
  6922. }
  6923. }
  6924. } catch(e) {
  6925. }
  6926. },
  6927. removeUnloadListener: function(fn, scope) {
  6928. var unload = EventManager.unloadEvent;
  6929. if (unload) {
  6930. unload.removeListener(fn, scope);
  6931. }
  6932. },
  6933. useKeyDown: Ext.isWebKit ?
  6934. parseInt(navigator.userAgent.match(/AppleWebKit\/(\d+)/)[1], 10) >= 525 :
  6935. !((Ext.isGecko && !Ext.isWindows) || Ext.isOpera),
  6936. getKeyEvent: function() {
  6937. return EventManager.useKeyDown ? 'keydown' : 'keypress';
  6938. }
  6939. });
  6940. if(!('addEventListener' in document) && document.attachEvent) {
  6941. Ext.apply( EventManager, {
  6942. pollScroll : function() {
  6943. var scrollable = true;
  6944. try {
  6945. document.documentElement.doScroll('left');
  6946. } catch(e) {
  6947. scrollable = false;
  6948. }
  6949. if (scrollable && document.body) {
  6950. EventManager.onReadyEvent({
  6951. type:'doScroll'
  6952. });
  6953. } else {
  6954. EventManager.scrollTimeout = setTimeout(EventManager.pollScroll, 20);
  6955. }
  6956. return scrollable;
  6957. },
  6958. scrollTimeout: null,
  6959. readyStatesRe : /complete/i,
  6960. checkReadyState: function() {
  6961. var state = document.readyState;
  6962. if (EventManager.readyStatesRe.test(state)) {
  6963. EventManager.onReadyEvent({
  6964. type: state
  6965. });
  6966. }
  6967. },
  6968. bindReadyEvent: function() {
  6969. var topContext = true;
  6970. if (EventManager.hasBoundOnReady) {
  6971. return;
  6972. }
  6973. try {
  6974. topContext = window.frameElement === undefined;
  6975. } catch(e) {
  6976. topContext = false;
  6977. }
  6978. if (!topContext || !doc.documentElement.doScroll) {
  6979. EventManager.pollScroll = Ext.emptyFn;
  6980. }
  6981. if (EventManager.pollScroll() === true) {
  6982. return;
  6983. }
  6984. if (doc.readyState == 'complete' ) {
  6985. EventManager.onReadyEvent({type: 'already ' + (doc.readyState || 'body') });
  6986. } else {
  6987. doc.attachEvent('onreadystatechange', EventManager.checkReadyState);
  6988. window.attachEvent('onload', EventManager.onReadyEvent);
  6989. EventManager.hasBoundOnReady = true;
  6990. }
  6991. },
  6992. onReadyEvent : function(e) {
  6993. if (e && e.type) {
  6994. EventManager.onReadyChain.push(e.type);
  6995. }
  6996. if (EventManager.hasBoundOnReady) {
  6997. document.detachEvent('onreadystatechange', EventManager.checkReadyState);
  6998. window.detachEvent('onload', EventManager.onReadyEvent);
  6999. }
  7000. if (Ext.isNumber(EventManager.scrollTimeout)) {
  7001. clearTimeout(EventManager.scrollTimeout);
  7002. delete EventManager.scrollTimeout;
  7003. }
  7004. if (!Ext.isReady) {
  7005. EventManager.fireDocReady();
  7006. }
  7007. },
  7008. onReadyChain : []
  7009. });
  7010. }
  7011. Ext.onReady = function(fn, scope, options) {
  7012. Ext.Loader.onReady(fn, scope, true, options);
  7013. };
  7014. Ext.onDocumentReady = EventManager.onDocumentReady;
  7015. EventManager.on = EventManager.addListener;
  7016. EventManager.un = EventManager.removeListener;
  7017. Ext.onReady(initExtCss);
  7018. };
  7019. //@tag dom,core
  7020. //@require EventManager.js
  7021. //@define Ext.EventObject
  7022. Ext.define('Ext.EventObjectImpl', {
  7023. uses: ['Ext.util.Point'],
  7024. BACKSPACE: 8,
  7025. TAB: 9,
  7026. NUM_CENTER: 12,
  7027. ENTER: 13,
  7028. RETURN: 13,
  7029. SHIFT: 16,
  7030. CTRL: 17,
  7031. ALT: 18,
  7032. PAUSE: 19,
  7033. CAPS_LOCK: 20,
  7034. ESC: 27,
  7035. SPACE: 32,
  7036. PAGE_UP: 33,
  7037. PAGE_DOWN: 34,
  7038. END: 35,
  7039. HOME: 36,
  7040. LEFT: 37,
  7041. UP: 38,
  7042. RIGHT: 39,
  7043. DOWN: 40,
  7044. PRINT_SCREEN: 44,
  7045. INSERT: 45,
  7046. DELETE: 46,
  7047. ZERO: 48,
  7048. ONE: 49,
  7049. TWO: 50,
  7050. THREE: 51,
  7051. FOUR: 52,
  7052. FIVE: 53,
  7053. SIX: 54,
  7054. SEVEN: 55,
  7055. EIGHT: 56,
  7056. NINE: 57,
  7057. A: 65,
  7058. B: 66,
  7059. C: 67,
  7060. D: 68,
  7061. E: 69,
  7062. F: 70,
  7063. G: 71,
  7064. H: 72,
  7065. I: 73,
  7066. J: 74,
  7067. K: 75,
  7068. L: 76,
  7069. M: 77,
  7070. N: 78,
  7071. O: 79,
  7072. P: 80,
  7073. Q: 81,
  7074. R: 82,
  7075. S: 83,
  7076. T: 84,
  7077. U: 85,
  7078. V: 86,
  7079. W: 87,
  7080. X: 88,
  7081. Y: 89,
  7082. Z: 90,
  7083. CONTEXT_MENU: 93,
  7084. NUM_ZERO: 96,
  7085. NUM_ONE: 97,
  7086. NUM_TWO: 98,
  7087. NUM_THREE: 99,
  7088. NUM_FOUR: 100,
  7089. NUM_FIVE: 101,
  7090. NUM_SIX: 102,
  7091. NUM_SEVEN: 103,
  7092. NUM_EIGHT: 104,
  7093. NUM_NINE: 105,
  7094. NUM_MULTIPLY: 106,
  7095. NUM_PLUS: 107,
  7096. NUM_MINUS: 109,
  7097. NUM_PERIOD: 110,
  7098. NUM_DIVISION: 111,
  7099. F1: 112,
  7100. F2: 113,
  7101. F3: 114,
  7102. F4: 115,
  7103. F5: 116,
  7104. F6: 117,
  7105. F7: 118,
  7106. F8: 119,
  7107. F9: 120,
  7108. F10: 121,
  7109. F11: 122,
  7110. F12: 123,
  7111. WHEEL_SCALE: (function () {
  7112. var scale;
  7113. if (Ext.isGecko) {
  7114. scale = 3;
  7115. } else if (Ext.isMac) {
  7116. if (Ext.isSafari && Ext.webKitVersion >= 532.0) {
  7117. scale = 120;
  7118. } else {
  7119. scale = 12;
  7120. }
  7121. scale *= 3;
  7122. } else {
  7123. scale = 120;
  7124. }
  7125. return scale;
  7126. }()),
  7127. clickRe: /(dbl)?click/,
  7128. safariKeys: {
  7129. 3: 13,
  7130. 63234: 37,
  7131. 63235: 39,
  7132. 63232: 38,
  7133. 63233: 40,
  7134. 63276: 33,
  7135. 63277: 34,
  7136. 63272: 46,
  7137. 63273: 36,
  7138. 63275: 35
  7139. },
  7140. btnMap: Ext.isIE ? {
  7141. 1: 0,
  7142. 4: 1,
  7143. 2: 2
  7144. } : {
  7145. 0: 0,
  7146. 1: 1,
  7147. 2: 2
  7148. },
  7149. constructor: function(event, freezeEvent){
  7150. if (event) {
  7151. this.setEvent(event.browserEvent || event, freezeEvent);
  7152. }
  7153. },
  7154. setEvent: function(event, freezeEvent){
  7155. var me = this, button, options;
  7156. if (event == me || (event && event.browserEvent)) {
  7157. return event;
  7158. }
  7159. me.browserEvent = event;
  7160. if (event) {
  7161. button = event.button ? me.btnMap[event.button] : (event.which ? event.which - 1 : -1);
  7162. if (me.clickRe.test(event.type) && button == -1) {
  7163. button = 0;
  7164. }
  7165. options = {
  7166. type: event.type,
  7167. button: button,
  7168. shiftKey: event.shiftKey,
  7169. ctrlKey: event.ctrlKey || event.metaKey || false,
  7170. altKey: event.altKey,
  7171. keyCode: event.keyCode,
  7172. charCode: event.charCode,
  7173. target: Ext.EventManager.getTarget(event),
  7174. relatedTarget: Ext.EventManager.getRelatedTarget(event),
  7175. currentTarget: event.currentTarget,
  7176. xy: (freezeEvent ? me.getXY() : null)
  7177. };
  7178. } else {
  7179. options = {
  7180. button: -1,
  7181. shiftKey: false,
  7182. ctrlKey: false,
  7183. altKey: false,
  7184. keyCode: 0,
  7185. charCode: 0,
  7186. target: null,
  7187. xy: [0, 0]
  7188. };
  7189. }
  7190. Ext.apply(me, options);
  7191. return me;
  7192. },
  7193. stopEvent: function(){
  7194. this.stopPropagation();
  7195. this.preventDefault();
  7196. },
  7197. preventDefault: function(){
  7198. if (this.browserEvent) {
  7199. Ext.EventManager.preventDefault(this.browserEvent);
  7200. }
  7201. },
  7202. stopPropagation: function(){
  7203. var browserEvent = this.browserEvent;
  7204. if (browserEvent) {
  7205. if (browserEvent.type == 'mousedown') {
  7206. Ext.EventManager.stoppedMouseDownEvent.fire(this);
  7207. }
  7208. Ext.EventManager.stopPropagation(browserEvent);
  7209. }
  7210. },
  7211. getCharCode: function(){
  7212. return this.charCode || this.keyCode;
  7213. },
  7214. getKey: function(){
  7215. return this.normalizeKey(this.keyCode || this.charCode);
  7216. },
  7217. normalizeKey: function(key){
  7218. return Ext.isWebKit ? (this.safariKeys[key] || key) : key;
  7219. },
  7220. getPageX: function(){
  7221. return this.getX();
  7222. },
  7223. getPageY: function(){
  7224. return this.getY();
  7225. },
  7226. getX: function() {
  7227. return this.getXY()[0];
  7228. },
  7229. getY: function() {
  7230. return this.getXY()[1];
  7231. },
  7232. getXY: function() {
  7233. if (!this.xy) {
  7234. this.xy = Ext.EventManager.getPageXY(this.browserEvent);
  7235. }
  7236. return this.xy;
  7237. },
  7238. getTarget : function(selector, maxDepth, returnEl){
  7239. if (selector) {
  7240. return Ext.fly(this.target).findParent(selector, maxDepth, returnEl);
  7241. }
  7242. return returnEl ? Ext.get(this.target) : this.target;
  7243. },
  7244. getRelatedTarget : function(selector, maxDepth, returnEl){
  7245. if (selector) {
  7246. return Ext.fly(this.relatedTarget).findParent(selector, maxDepth, returnEl);
  7247. }
  7248. return returnEl ? Ext.get(this.relatedTarget) : this.relatedTarget;
  7249. },
  7250. correctWheelDelta : function (delta) {
  7251. var scale = this.WHEEL_SCALE,
  7252. ret = Math.round(delta / scale);
  7253. if (!ret && delta) {
  7254. ret = (delta < 0) ? -1 : 1;
  7255. }
  7256. return ret;
  7257. },
  7258. getWheelDeltas : function () {
  7259. var me = this,
  7260. event = me.browserEvent,
  7261. dx = 0, dy = 0;
  7262. if (Ext.isDefined(event.wheelDeltaX)) {
  7263. dx = event.wheelDeltaX;
  7264. dy = event.wheelDeltaY;
  7265. } else if (event.wheelDelta) {
  7266. dy = event.wheelDelta;
  7267. } else if (event.detail) {
  7268. dy = -event.detail;
  7269. if (dy > 100) {
  7270. dy = 3;
  7271. } else if (dy < -100) {
  7272. dy = -3;
  7273. }
  7274. if (Ext.isDefined(event.axis) && event.axis === event.HORIZONTAL_AXIS) {
  7275. dx = dy;
  7276. dy = 0;
  7277. }
  7278. }
  7279. return {
  7280. x: me.correctWheelDelta(dx),
  7281. y: me.correctWheelDelta(dy)
  7282. };
  7283. },
  7284. getWheelDelta : function(){
  7285. var deltas = this.getWheelDeltas();
  7286. return deltas.y;
  7287. },
  7288. within : function(el, related, allowEl){
  7289. if(el){
  7290. var t = related ? this.getRelatedTarget() : this.getTarget(),
  7291. result;
  7292. if (t) {
  7293. result = Ext.fly(el).contains(t);
  7294. if (!result && allowEl) {
  7295. result = t == Ext.getDom(el);
  7296. }
  7297. return result;
  7298. }
  7299. }
  7300. return false;
  7301. },
  7302. isNavKeyPress : function(){
  7303. var me = this,
  7304. k = this.normalizeKey(me.keyCode);
  7305. return (k >= 33 && k <= 40) ||
  7306. k == me.RETURN ||
  7307. k == me.TAB ||
  7308. k == me.ESC;
  7309. },
  7310. isSpecialKey : function(){
  7311. var k = this.normalizeKey(this.keyCode);
  7312. return (this.type == 'keypress' && this.ctrlKey) ||
  7313. this.isNavKeyPress() ||
  7314. (k == this.BACKSPACE) ||
  7315. (k >= 16 && k <= 20) ||
  7316. (k >= 44 && k <= 46);
  7317. },
  7318. getPoint : function(){
  7319. var xy = this.getXY();
  7320. return new Ext.util.Point(xy[0], xy[1]);
  7321. },
  7322. hasModifier : function(){
  7323. return this.ctrlKey || this.altKey || this.shiftKey || this.metaKey;
  7324. },
  7325. injectEvent: (function () {
  7326. var API,
  7327. dispatchers = {},
  7328. crazyIEButtons;
  7329. if (!Ext.isIE && document.createEvent) {
  7330. API = {
  7331. createHtmlEvent: function (doc, type, bubbles, cancelable) {
  7332. var event = doc.createEvent('HTMLEvents');
  7333. event.initEvent(type, bubbles, cancelable);
  7334. return event;
  7335. },
  7336. createMouseEvent: function (doc, type, bubbles, cancelable, detail,
  7337. clientX, clientY, ctrlKey, altKey, shiftKey, metaKey,
  7338. button, relatedTarget) {
  7339. var event = doc.createEvent('MouseEvents'),
  7340. view = doc.defaultView || window;
  7341. if (event.initMouseEvent) {
  7342. event.initMouseEvent(type, bubbles, cancelable, view, detail,
  7343. clientX, clientY, clientX, clientY, ctrlKey, altKey,
  7344. shiftKey, metaKey, button, relatedTarget);
  7345. } else {
  7346. event = doc.createEvent('UIEvents');
  7347. event.initEvent(type, bubbles, cancelable);
  7348. event.view = view;
  7349. event.detail = detail;
  7350. event.screenX = clientX;
  7351. event.screenY = clientY;
  7352. event.clientX = clientX;
  7353. event.clientY = clientY;
  7354. event.ctrlKey = ctrlKey;
  7355. event.altKey = altKey;
  7356. event.metaKey = metaKey;
  7357. event.shiftKey = shiftKey;
  7358. event.button = button;
  7359. event.relatedTarget = relatedTarget;
  7360. }
  7361. return event;
  7362. },
  7363. createUIEvent: function (doc, type, bubbles, cancelable, detail) {
  7364. var event = doc.createEvent('UIEvents'),
  7365. view = doc.defaultView || window;
  7366. event.initUIEvent(type, bubbles, cancelable, view, detail);
  7367. return event;
  7368. },
  7369. fireEvent: function (target, type, event) {
  7370. target.dispatchEvent(event);
  7371. },
  7372. fixTarget: function (target) {
  7373. if (target == window && !target.dispatchEvent) {
  7374. return document;
  7375. }
  7376. return target;
  7377. }
  7378. };
  7379. } else if (document.createEventObject) {
  7380. crazyIEButtons = { 0: 1, 1: 4, 2: 2 };
  7381. API = {
  7382. createHtmlEvent: function (doc, type, bubbles, cancelable) {
  7383. var event = doc.createEventObject();
  7384. event.bubbles = bubbles;
  7385. event.cancelable = cancelable;
  7386. return event;
  7387. },
  7388. createMouseEvent: function (doc, type, bubbles, cancelable, detail,
  7389. clientX, clientY, ctrlKey, altKey, shiftKey, metaKey,
  7390. button, relatedTarget) {
  7391. var event = doc.createEventObject();
  7392. event.bubbles = bubbles;
  7393. event.cancelable = cancelable;
  7394. event.detail = detail;
  7395. event.screenX = clientX;
  7396. event.screenY = clientY;
  7397. event.clientX = clientX;
  7398. event.clientY = clientY;
  7399. event.ctrlKey = ctrlKey;
  7400. event.altKey = altKey;
  7401. event.shiftKey = shiftKey;
  7402. event.metaKey = metaKey;
  7403. event.button = crazyIEButtons[button] || button;
  7404. event.relatedTarget = relatedTarget;
  7405. return event;
  7406. },
  7407. createUIEvent: function (doc, type, bubbles, cancelable, detail) {
  7408. var event = doc.createEventObject();
  7409. event.bubbles = bubbles;
  7410. event.cancelable = cancelable;
  7411. return event;
  7412. },
  7413. fireEvent: function (target, type, event) {
  7414. target.fireEvent('on' + type, event);
  7415. },
  7416. fixTarget: function (target) {
  7417. if (target == document) {
  7418. return document.documentElement;
  7419. }
  7420. return target;
  7421. }
  7422. };
  7423. }
  7424. Ext.Object.each({
  7425. load: [false, false],
  7426. unload: [false, false],
  7427. select: [true, false],
  7428. change: [true, false],
  7429. submit: [true, true],
  7430. reset: [true, false],
  7431. resize: [true, false],
  7432. scroll: [true, false]
  7433. },
  7434. function (name, value) {
  7435. var bubbles = value[0], cancelable = value[1];
  7436. dispatchers[name] = function (targetEl, srcEvent) {
  7437. var e = API.createHtmlEvent(name, bubbles, cancelable);
  7438. API.fireEvent(targetEl, name, e);
  7439. };
  7440. });
  7441. function createMouseEventDispatcher (type, detail) {
  7442. var cancelable = (type != 'mousemove');
  7443. return function (targetEl, srcEvent) {
  7444. var xy = srcEvent.getXY(),
  7445. e = API.createMouseEvent(targetEl.ownerDocument, type, true, cancelable,
  7446. detail, xy[0], xy[1], srcEvent.ctrlKey, srcEvent.altKey,
  7447. srcEvent.shiftKey, srcEvent.metaKey, srcEvent.button,
  7448. srcEvent.relatedTarget);
  7449. API.fireEvent(targetEl, type, e);
  7450. };
  7451. }
  7452. Ext.each(['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mousemove', 'mouseout'],
  7453. function (eventName) {
  7454. dispatchers[eventName] = createMouseEventDispatcher(eventName, 1);
  7455. });
  7456. Ext.Object.each({
  7457. focusin: [true, false],
  7458. focusout: [true, false],
  7459. activate: [true, true],
  7460. focus: [false, false],
  7461. blur: [false, false]
  7462. },
  7463. function (name, value) {
  7464. var bubbles = value[0], cancelable = value[1];
  7465. dispatchers[name] = function (targetEl, srcEvent) {
  7466. var e = API.createUIEvent(targetEl.ownerDocument, name, bubbles, cancelable, 1);
  7467. API.fireEvent(targetEl, name, e);
  7468. };
  7469. });
  7470. if (!API) {
  7471. dispatchers = {};
  7472. API = {
  7473. fixTarget: function (t) {
  7474. return t;
  7475. }
  7476. };
  7477. }
  7478. function cannotInject (target, srcEvent) {
  7479. }
  7480. return function (target) {
  7481. var me = this,
  7482. dispatcher = dispatchers[me.type] || cannotInject,
  7483. t = target ? (target.dom || target) : me.getTarget();
  7484. t = API.fixTarget(t);
  7485. dispatcher(t, me);
  7486. };
  7487. }())
  7488. }, function() {
  7489. Ext.EventObject = new Ext.EventObjectImpl();
  7490. });
  7491. //@tag dom,core
  7492. //@require ../EventObject.js
  7493. Ext.define('Ext.dom.AbstractQuery', {
  7494. select: function(q, root) {
  7495. var results = [],
  7496. nodes,
  7497. i,
  7498. j,
  7499. qlen,
  7500. nlen;
  7501. root = root || document;
  7502. if (typeof root == 'string') {
  7503. root = document.getElementById(root);
  7504. }
  7505. q = q.split(",");
  7506. for (i = 0,qlen = q.length; i < qlen; i++) {
  7507. if (typeof q[i] == 'string') {
  7508. if (typeof q[i][0] == '@') {
  7509. nodes = root.getAttributeNode(q[i].substring(1));
  7510. results.push(nodes);
  7511. } else {
  7512. nodes = root.querySelectorAll(q[i]);
  7513. for (j = 0,nlen = nodes.length; j < nlen; j++) {
  7514. results.push(nodes[j]);
  7515. }
  7516. }
  7517. }
  7518. }
  7519. return results;
  7520. },
  7521. selectNode: function(q, root) {
  7522. return this.select(q, root)[0];
  7523. },
  7524. is: function(el, q) {
  7525. if (typeof el == "string") {
  7526. el = document.getElementById(el);
  7527. }
  7528. return this.select(q).indexOf(el) !== -1;
  7529. }
  7530. });
  7531. //@tag dom,core
  7532. //@require AbstractQuery.js
  7533. Ext.define('Ext.dom.AbstractHelper', {
  7534. emptyTags : /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i,
  7535. confRe : /(?:tag|children|cn|html|tpl|tplData)$/i,
  7536. endRe : /end/i,
  7537. attributeTransform: { cls : 'class', htmlFor : 'for' },
  7538. closeTags: {},
  7539. decamelizeName : (function () {
  7540. var camelCaseRe = /([a-z])([A-Z])/g,
  7541. cache = {};
  7542. function decamel (match, p1, p2) {
  7543. return p1 + '-' + p2.toLowerCase();
  7544. }
  7545. return function (s) {
  7546. return cache[s] || (cache[s] = s.replace(camelCaseRe, decamel));
  7547. };
  7548. }()),
  7549. generateMarkup: function(spec, buffer) {
  7550. var me = this,
  7551. attr, val, tag, i, closeTags;
  7552. if (typeof spec == "string") {
  7553. buffer.push(spec);
  7554. } else if (Ext.isArray(spec)) {
  7555. for (i = 0; i < spec.length; i++) {
  7556. if (spec[i]) {
  7557. me.generateMarkup(spec[i], buffer);
  7558. }
  7559. }
  7560. } else {
  7561. tag = spec.tag || 'div';
  7562. buffer.push('<', tag);
  7563. for (attr in spec) {
  7564. if (spec.hasOwnProperty(attr)) {
  7565. val = spec[attr];
  7566. if (!me.confRe.test(attr)) {
  7567. if (typeof val == "object") {
  7568. buffer.push(' ', attr, '="');
  7569. me.generateStyles(val, buffer).push('"');
  7570. } else {
  7571. buffer.push(' ', me.attributeTransform[attr] || attr, '="', val, '"');
  7572. }
  7573. }
  7574. }
  7575. }
  7576. if (me.emptyTags.test(tag)) {
  7577. buffer.push('/>');
  7578. } else {
  7579. buffer.push('>');
  7580. if ((val = spec.tpl)) {
  7581. val.applyOut(spec.tplData, buffer);
  7582. }
  7583. if ((val = spec.html)) {
  7584. buffer.push(val);
  7585. }
  7586. if ((val = spec.cn || spec.children)) {
  7587. me.generateMarkup(val, buffer);
  7588. }
  7589. closeTags = me.closeTags;
  7590. buffer.push(closeTags[tag] || (closeTags[tag] = '</' + tag + '>'));
  7591. }
  7592. }
  7593. return buffer;
  7594. },
  7595. generateStyles: function (styles, buffer) {
  7596. var a = buffer || [],
  7597. name;
  7598. for (name in styles) {
  7599. if (styles.hasOwnProperty(name)) {
  7600. a.push(this.decamelizeName(name), ':', styles[name], ';');
  7601. }
  7602. }
  7603. return buffer || a.join('');
  7604. },
  7605. markup: function(spec) {
  7606. if (typeof spec == "string") {
  7607. return spec;
  7608. }
  7609. var buf = this.generateMarkup(spec, []);
  7610. return buf.join('');
  7611. },
  7612. applyStyles: function(el, styles) {
  7613. if (styles) {
  7614. var i = 0,
  7615. len,
  7616. style;
  7617. el = Ext.fly(el);
  7618. if (typeof styles == 'function') {
  7619. styles = styles.call();
  7620. }
  7621. if (typeof styles == 'string'){
  7622. styles = Ext.util.Format.trim(styles).split(/\s*(?::|;)\s*/);
  7623. for(len = styles.length; i < len;){
  7624. el.setStyle(styles[i++], styles[i++]);
  7625. }
  7626. } else if (Ext.isObject(styles)) {
  7627. el.setStyle(styles);
  7628. }
  7629. }
  7630. },
  7631. insertHtml: function(where, el, html) {
  7632. var hash = {},
  7633. hashVal,
  7634. setStart,
  7635. range,
  7636. frag,
  7637. rangeEl,
  7638. rs;
  7639. where = where.toLowerCase();
  7640. hash['beforebegin'] = ['BeforeBegin', 'previousSibling'];
  7641. hash['afterend'] = ['AfterEnd', 'nextSibling'];
  7642. range = el.ownerDocument.createRange();
  7643. setStart = 'setStart' + (this.endRe.test(where) ? 'After' : 'Before');
  7644. if (hash[where]) {
  7645. range[setStart](el);
  7646. frag = range.createContextualFragment(html);
  7647. el.parentNode.insertBefore(frag, where == 'beforebegin' ? el : el.nextSibling);
  7648. return el[(where == 'beforebegin' ? 'previous' : 'next') + 'Sibling'];
  7649. }
  7650. else {
  7651. rangeEl = (where == 'afterbegin' ? 'first' : 'last') + 'Child';
  7652. if (el.firstChild) {
  7653. range[setStart](el[rangeEl]);
  7654. frag = range.createContextualFragment(html);
  7655. if (where == 'afterbegin') {
  7656. el.insertBefore(frag, el.firstChild);
  7657. }
  7658. else {
  7659. el.appendChild(frag);
  7660. }
  7661. }
  7662. else {
  7663. el.innerHTML = html;
  7664. }
  7665. return el[rangeEl];
  7666. }
  7667. throw 'Illegal insertion point -> "' + where + '"';
  7668. },
  7669. insertBefore: function(el, o, returnElement) {
  7670. return this.doInsert(el, o, returnElement, 'beforebegin');
  7671. },
  7672. insertAfter: function(el, o, returnElement) {
  7673. return this.doInsert(el, o, returnElement, 'afterend', 'nextSibling');
  7674. },
  7675. insertFirst: function(el, o, returnElement) {
  7676. return this.doInsert(el, o, returnElement, 'afterbegin', 'firstChild');
  7677. },
  7678. append: function(el, o, returnElement) {
  7679. return this.doInsert(el, o, returnElement, 'beforeend', '', true);
  7680. },
  7681. overwrite: function(el, o, returnElement) {
  7682. el = Ext.getDom(el);
  7683. el.innerHTML = this.markup(o);
  7684. return returnElement ? Ext.get(el.firstChild) : el.firstChild;
  7685. },
  7686. doInsert: function(el, o, returnElement, pos, sibling, append) {
  7687. var newNode = this.insertHtml(pos, Ext.getDom(el), this.markup(o));
  7688. return returnElement ? Ext.get(newNode, true) : newNode;
  7689. }
  7690. });
  7691. //@tag dom,core
  7692. //@require AbstractHelper.js
  7693. //@require Ext.Supports
  7694. //@require Ext.EventManager
  7695. //@define Ext.dom.AbstractElement
  7696. (function() {
  7697. var document = window.document,
  7698. trimRe = /^\s+|\s+$/g,
  7699. whitespaceRe = /\s/;
  7700. if (!Ext.cache){
  7701. Ext.cache = {};
  7702. }
  7703. Ext.define('Ext.dom.AbstractElement', {
  7704. inheritableStatics: {
  7705. get: function(el) {
  7706. var me = this,
  7707. El = Ext.dom.Element,
  7708. cacheItem,
  7709. extEl,
  7710. dom,
  7711. id;
  7712. if (!el) {
  7713. return null;
  7714. }
  7715. if (typeof el == "string") {
  7716. if (el == Ext.windowId) {
  7717. return El.get(window);
  7718. } else if (el == Ext.documentId) {
  7719. return El.get(document);
  7720. }
  7721. cacheItem = Ext.cache[el];
  7722. if (cacheItem && cacheItem.skipGarbageCollection) {
  7723. extEl = cacheItem.el;
  7724. return extEl;
  7725. }
  7726. if (!(dom = document.getElementById(el))) {
  7727. return null;
  7728. }
  7729. if (cacheItem && cacheItem.el) {
  7730. extEl = Ext.updateCacheEntry(cacheItem, dom).el;
  7731. } else {
  7732. extEl = new El(dom, !!cacheItem);
  7733. }
  7734. return extEl;
  7735. } else if (el.tagName) {
  7736. if (!(id = el.id)) {
  7737. id = Ext.id(el);
  7738. }
  7739. cacheItem = Ext.cache[id];
  7740. if (cacheItem && cacheItem.el) {
  7741. extEl = Ext.updateCacheEntry(cacheItem, el).el;
  7742. } else {
  7743. extEl = new El(el, !!cacheItem);
  7744. }
  7745. return extEl;
  7746. } else if (el instanceof me) {
  7747. if (el != me.docEl && el != me.winEl) {
  7748. id = el.id;
  7749. cacheItem = Ext.cache[id];
  7750. if (cacheItem) {
  7751. Ext.updateCacheEntry(cacheItem, document.getElementById(id) || el.dom);
  7752. }
  7753. }
  7754. return el;
  7755. } else if (el.isComposite) {
  7756. return el;
  7757. } else if (Ext.isArray(el)) {
  7758. return me.select(el);
  7759. } else if (el === document) {
  7760. if (!me.docEl) {
  7761. me.docEl = Ext.Object.chain(El.prototype);
  7762. me.docEl.dom = document;
  7763. me.docEl.id = Ext.id(document);
  7764. me.addToCache(me.docEl);
  7765. }
  7766. return me.docEl;
  7767. } else if (el === window) {
  7768. if (!me.winEl) {
  7769. me.winEl = Ext.Object.chain(El.prototype);
  7770. me.winEl.dom = window;
  7771. me.winEl.id = Ext.id(window);
  7772. me.addToCache(me.winEl);
  7773. }
  7774. return me.winEl;
  7775. }
  7776. return null;
  7777. },
  7778. addToCache: function(el, id) {
  7779. if (el) {
  7780. Ext.addCacheEntry(id, el);
  7781. }
  7782. return el;
  7783. },
  7784. addMethods: function() {
  7785. this.override.apply(this, arguments);
  7786. },
  7787. mergeClsList: function() {
  7788. var clsList, clsHash = {},
  7789. i, length, j, listLength, clsName, result = [],
  7790. changed = false;
  7791. for (i = 0, length = arguments.length; i < length; i++) {
  7792. clsList = arguments[i];
  7793. if (Ext.isString(clsList)) {
  7794. clsList = clsList.replace(trimRe, '').split(whitespaceRe);
  7795. }
  7796. if (clsList) {
  7797. for (j = 0, listLength = clsList.length; j < listLength; j++) {
  7798. clsName = clsList[j];
  7799. if (!clsHash[clsName]) {
  7800. if (i) {
  7801. changed = true;
  7802. }
  7803. clsHash[clsName] = true;
  7804. }
  7805. }
  7806. }
  7807. }
  7808. for (clsName in clsHash) {
  7809. result.push(clsName);
  7810. }
  7811. result.changed = changed;
  7812. return result;
  7813. },
  7814. removeCls: function(existingClsList, removeClsList) {
  7815. var clsHash = {},
  7816. i, length, clsName, result = [],
  7817. changed = false;
  7818. if (existingClsList) {
  7819. if (Ext.isString(existingClsList)) {
  7820. existingClsList = existingClsList.replace(trimRe, '').split(whitespaceRe);
  7821. }
  7822. for (i = 0, length = existingClsList.length; i < length; i++) {
  7823. clsHash[existingClsList[i]] = true;
  7824. }
  7825. }
  7826. if (removeClsList) {
  7827. if (Ext.isString(removeClsList)) {
  7828. removeClsList = removeClsList.split(whitespaceRe);
  7829. }
  7830. for (i = 0, length = removeClsList.length; i < length; i++) {
  7831. clsName = removeClsList[i];
  7832. if (clsHash[clsName]) {
  7833. changed = true;
  7834. delete clsHash[clsName];
  7835. }
  7836. }
  7837. }
  7838. for (clsName in clsHash) {
  7839. result.push(clsName);
  7840. }
  7841. result.changed = changed;
  7842. return result;
  7843. },
  7844. VISIBILITY: 1,
  7845. DISPLAY: 2,
  7846. OFFSETS: 3,
  7847. ASCLASS: 4
  7848. },
  7849. constructor: function(element, forceNew) {
  7850. var me = this,
  7851. dom = typeof element == 'string'
  7852. ? document.getElementById(element)
  7853. : element,
  7854. id;
  7855. if (!dom) {
  7856. return null;
  7857. }
  7858. id = dom.id;
  7859. if (!forceNew && id && Ext.cache[id]) {
  7860. return Ext.cache[id].el;
  7861. }
  7862. me.dom = dom;
  7863. me.id = id || Ext.id(dom);
  7864. me.self.addToCache(me);
  7865. },
  7866. set: function(o, useSet) {
  7867. var el = this.dom,
  7868. attr,
  7869. value;
  7870. for (attr in o) {
  7871. if (o.hasOwnProperty(attr)) {
  7872. value = o[attr];
  7873. if (attr == 'style') {
  7874. this.applyStyles(value);
  7875. }
  7876. else if (attr == 'cls') {
  7877. el.className = value;
  7878. }
  7879. else if (useSet !== false) {
  7880. if (value === undefined) {
  7881. el.removeAttribute(attr);
  7882. } else {
  7883. el.setAttribute(attr, value);
  7884. }
  7885. }
  7886. else {
  7887. el[attr] = value;
  7888. }
  7889. }
  7890. }
  7891. return this;
  7892. },
  7893. defaultUnit: "px",
  7894. is: function(simpleSelector) {
  7895. return Ext.DomQuery.is(this.dom, simpleSelector);
  7896. },
  7897. getValue: function(asNumber) {
  7898. var val = this.dom.value;
  7899. return asNumber ? parseInt(val, 10) : val;
  7900. },
  7901. remove: function() {
  7902. var me = this,
  7903. dom = me.dom;
  7904. if (dom) {
  7905. Ext.removeNode(dom);
  7906. delete me.dom;
  7907. }
  7908. },
  7909. contains: function(el) {
  7910. if (!el) {
  7911. return false;
  7912. }
  7913. var me = this,
  7914. dom = el.dom || el;
  7915. return (dom === me.dom) || Ext.dom.AbstractElement.isAncestor(me.dom, dom);
  7916. },
  7917. getAttribute: function(name, ns) {
  7918. var dom = this.dom;
  7919. return dom.getAttributeNS(ns, name) || dom.getAttribute(ns + ":" + name) || dom.getAttribute(name) || dom[name];
  7920. },
  7921. update: function(html) {
  7922. if (this.dom) {
  7923. this.dom.innerHTML = html;
  7924. }
  7925. return this;
  7926. },
  7927. setHTML: function(html) {
  7928. if(this.dom) {
  7929. this.dom.innerHTML = html;
  7930. }
  7931. return this;
  7932. },
  7933. getHTML: function() {
  7934. return this.dom ? this.dom.innerHTML : '';
  7935. },
  7936. hide: function() {
  7937. this.setVisible(false);
  7938. return this;
  7939. },
  7940. show: function() {
  7941. this.setVisible(true);
  7942. return this;
  7943. },
  7944. setVisible: function(visible, animate) {
  7945. var me = this,
  7946. statics = me.self,
  7947. mode = me.getVisibilityMode(),
  7948. prefix = Ext.baseCSSPrefix;
  7949. switch (mode) {
  7950. case statics.VISIBILITY:
  7951. me.removeCls([prefix + 'hidden-display', prefix + 'hidden-offsets']);
  7952. me[visible ? 'removeCls' : 'addCls'](prefix + 'hidden-visibility');
  7953. break;
  7954. case statics.DISPLAY:
  7955. me.removeCls([prefix + 'hidden-visibility', prefix + 'hidden-offsets']);
  7956. me[visible ? 'removeCls' : 'addCls'](prefix + 'hidden-display');
  7957. break;
  7958. case statics.OFFSETS:
  7959. me.removeCls([prefix + 'hidden-visibility', prefix + 'hidden-display']);
  7960. me[visible ? 'removeCls' : 'addCls'](prefix + 'hidden-offsets');
  7961. break;
  7962. }
  7963. return me;
  7964. },
  7965. getVisibilityMode: function() {
  7966. var data = (this.$cache || this.getCache()).data,
  7967. visMode = data.visibilityMode;
  7968. if (visMode === undefined) {
  7969. data.visibilityMode = visMode = this.self.DISPLAY;
  7970. }
  7971. return visMode;
  7972. },
  7973. setVisibilityMode: function(mode) {
  7974. (this.$cache || this.getCache()).data.visibilityMode = mode;
  7975. return this;
  7976. },
  7977. getCache: function() {
  7978. var me = this,
  7979. id = me.dom.id || Ext.id(me.dom);
  7980. me.$cache = Ext.cache[id] || Ext.addCacheEntry(id, null, me.dom);
  7981. return me.$cache;
  7982. }
  7983. }, function() {
  7984. var AbstractElement = this;
  7985. Ext.getDetachedBody = function () {
  7986. var detachedEl = AbstractElement.detachedBodyEl;
  7987. if (!detachedEl) {
  7988. detachedEl = document.createElement('div');
  7989. AbstractElement.detachedBodyEl = detachedEl = new AbstractElement.Fly(detachedEl);
  7990. detachedEl.isDetachedBody = true;
  7991. }
  7992. return detachedEl;
  7993. };
  7994. Ext.getElementById = function (id) {
  7995. var el = document.getElementById(id),
  7996. detachedBodyEl;
  7997. if (!el && (detachedBodyEl = AbstractElement.detachedBodyEl)) {
  7998. el = detachedBodyEl.dom.querySelector('#' + Ext.escapeId(id));
  7999. }
  8000. return el;
  8001. };
  8002. Ext.get = function(el) {
  8003. return Ext.dom.Element.get(el);
  8004. };
  8005. this.addStatics({
  8006. Fly: new Ext.Class({
  8007. extend: AbstractElement,
  8008. isFly: true,
  8009. constructor: function(dom) {
  8010. this.dom = dom;
  8011. },
  8012. attach: function (dom) {
  8013. this.dom = dom;
  8014. this.$cache = dom.id ? Ext.cache[dom.id] : null;
  8015. return this;
  8016. }
  8017. }),
  8018. _flyweights: {},
  8019. fly: function(dom, named) {
  8020. var fly = null,
  8021. _flyweights = AbstractElement._flyweights;
  8022. named = named || '_global';
  8023. dom = Ext.getDom(dom);
  8024. if (dom) {
  8025. fly = _flyweights[named] || (_flyweights[named] = new AbstractElement.Fly());
  8026. fly.dom = dom;
  8027. fly.$cache = dom.id ? Ext.cache[dom.id] : null;
  8028. }
  8029. return fly;
  8030. }
  8031. });
  8032. Ext.fly = function() {
  8033. return AbstractElement.fly.apply(AbstractElement, arguments);
  8034. };
  8035. (function (proto) {
  8036. proto.destroy = proto.remove;
  8037. if (document.querySelector) {
  8038. proto.getById = function (id, asDom) {
  8039. var dom = document.getElementById(id) ||
  8040. this.dom.querySelector('#'+Ext.escapeId(id));
  8041. return asDom ? dom : (dom ? Ext.get(dom) : null);
  8042. };
  8043. } else {
  8044. proto.getById = function (id, asDom) {
  8045. var dom = document.getElementById(id);
  8046. return asDom ? dom : (dom ? Ext.get(dom) : null);
  8047. };
  8048. }
  8049. }(this.prototype));
  8050. });
  8051. }());
  8052. //@tag dom,core
  8053. //@require AbstractElement.js
  8054. //@define Ext.dom.AbstractElement-static
  8055. //@define Ext.dom.AbstractElement
  8056. Ext.dom.AbstractElement.addInheritableStatics({
  8057. unitRe: /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i,
  8058. camelRe: /(-[a-z])/gi,
  8059. cssRe: /([a-z0-9\-]+)\s*:\s*([^;\s]+(?:\s*[^;\s]+)*);?/gi,
  8060. opacityRe: /alpha\(opacity=(.*)\)/i,
  8061. propertyCache: {},
  8062. defaultUnit : "px",
  8063. borders: {l: 'border-left-width', r: 'border-right-width', t: 'border-top-width', b: 'border-bottom-width'},
  8064. paddings: {l: 'padding-left', r: 'padding-right', t: 'padding-top', b: 'padding-bottom'},
  8065. margins: {l: 'margin-left', r: 'margin-right', t: 'margin-top', b: 'margin-bottom'},
  8066. addUnits: function(size, units) {
  8067. if (typeof size == 'number') {
  8068. return size + (units || this.defaultUnit || 'px');
  8069. }
  8070. if (size === "" || size == "auto" || size === undefined || size === null) {
  8071. return size || '';
  8072. }
  8073. if (!this.unitRe.test(size)) {
  8074. return size || '';
  8075. }
  8076. return size;
  8077. },
  8078. isAncestor: function(p, c) {
  8079. var ret = false;
  8080. p = Ext.getDom(p);
  8081. c = Ext.getDom(c);
  8082. if (p && c) {
  8083. if (p.contains) {
  8084. return p.contains(c);
  8085. } else if (p.compareDocumentPosition) {
  8086. return !!(p.compareDocumentPosition(c) & 16);
  8087. } else {
  8088. while ((c = c.parentNode)) {
  8089. ret = c == p || ret;
  8090. }
  8091. }
  8092. }
  8093. return ret;
  8094. },
  8095. parseBox: function(box) {
  8096. if (typeof box != 'string') {
  8097. box = box.toString();
  8098. }
  8099. var parts = box.split(' '),
  8100. ln = parts.length;
  8101. if (ln == 1) {
  8102. parts[1] = parts[2] = parts[3] = parts[0];
  8103. }
  8104. else if (ln == 2) {
  8105. parts[2] = parts[0];
  8106. parts[3] = parts[1];
  8107. }
  8108. else if (ln == 3) {
  8109. parts[3] = parts[1];
  8110. }
  8111. return {
  8112. top :parseFloat(parts[0]) || 0,
  8113. right :parseFloat(parts[1]) || 0,
  8114. bottom:parseFloat(parts[2]) || 0,
  8115. left :parseFloat(parts[3]) || 0
  8116. };
  8117. },
  8118. unitizeBox: function(box, units) {
  8119. var a = this.addUnits,
  8120. b = this.parseBox(box);
  8121. return a(b.top, units) + ' ' +
  8122. a(b.right, units) + ' ' +
  8123. a(b.bottom, units) + ' ' +
  8124. a(b.left, units);
  8125. },
  8126. camelReplaceFn: function(m, a) {
  8127. return a.charAt(1).toUpperCase();
  8128. },
  8129. normalize: function(prop) {
  8130. if (prop == 'float') {
  8131. prop = Ext.supports.Float ? 'cssFloat' : 'styleFloat';
  8132. }
  8133. return this.propertyCache[prop] || (this.propertyCache[prop] = prop.replace(this.camelRe, this.camelReplaceFn));
  8134. },
  8135. getDocumentHeight: function() {
  8136. return Math.max(!Ext.isStrict ? document.body.scrollHeight : document.documentElement.scrollHeight, this.getViewportHeight());
  8137. },
  8138. getDocumentWidth: function() {
  8139. return Math.max(!Ext.isStrict ? document.body.scrollWidth : document.documentElement.scrollWidth, this.getViewportWidth());
  8140. },
  8141. getViewportHeight: function(){
  8142. return window.innerHeight;
  8143. },
  8144. getViewportWidth: function() {
  8145. return window.innerWidth;
  8146. },
  8147. getViewSize: function() {
  8148. return {
  8149. width: window.innerWidth,
  8150. height: window.innerHeight
  8151. };
  8152. },
  8153. getOrientation: function() {
  8154. if (Ext.supports.OrientationChange) {
  8155. return (window.orientation == 0) ? 'portrait' : 'landscape';
  8156. }
  8157. return (window.innerHeight > window.innerWidth) ? 'portrait' : 'landscape';
  8158. },
  8159. fromPoint: function(x, y) {
  8160. return Ext.get(document.elementFromPoint(x, y));
  8161. },
  8162. parseStyles: function(styles){
  8163. var out = {},
  8164. cssRe = this.cssRe,
  8165. matches;
  8166. if (styles) {
  8167. cssRe.lastIndex = 0;
  8168. while ((matches = cssRe.exec(styles))) {
  8169. out[matches[1]] = matches[2];
  8170. }
  8171. }
  8172. return out;
  8173. }
  8174. });
  8175. (function(){
  8176. var doc = document,
  8177. AbstractElement = Ext.dom.AbstractElement,
  8178. activeElement = null,
  8179. isCSS1 = doc.compatMode == "CSS1Compat",
  8180. flyInstance,
  8181. fly = function (el) {
  8182. if (!flyInstance) {
  8183. flyInstance = new AbstractElement.Fly();
  8184. }
  8185. flyInstance.attach(el);
  8186. return flyInstance;
  8187. };
  8188. if (!('activeElement' in doc) && doc.addEventListener) {
  8189. doc.addEventListener('focus',
  8190. function (ev) {
  8191. if (ev && ev.target) {
  8192. activeElement = (ev.target == doc) ? null : ev.target;
  8193. }
  8194. }, true);
  8195. }
  8196. function makeSelectionRestoreFn (activeEl, start, end) {
  8197. return function () {
  8198. activeEl.selectionStart = start;
  8199. activeEl.selectionEnd = end;
  8200. };
  8201. }
  8202. AbstractElement.addInheritableStatics({
  8203. getActiveElement: function () {
  8204. return doc.activeElement || activeElement;
  8205. },
  8206. getRightMarginFixCleaner: function (target) {
  8207. var supports = Ext.supports,
  8208. hasInputBug = supports.DisplayChangeInputSelectionBug,
  8209. hasTextAreaBug = supports.DisplayChangeTextAreaSelectionBug,
  8210. activeEl,
  8211. tag,
  8212. start,
  8213. end;
  8214. if (hasInputBug || hasTextAreaBug) {
  8215. activeEl = doc.activeElement || activeElement;
  8216. tag = activeEl && activeEl.tagName;
  8217. if ((hasTextAreaBug && tag == 'TEXTAREA') ||
  8218. (hasInputBug && tag == 'INPUT' && activeEl.type == 'text')) {
  8219. if (Ext.dom.Element.isAncestor(target, activeEl)) {
  8220. start = activeEl.selectionStart;
  8221. end = activeEl.selectionEnd;
  8222. if (Ext.isNumber(start) && Ext.isNumber(end)) {
  8223. return makeSelectionRestoreFn(activeEl, start, end);
  8224. }
  8225. }
  8226. }
  8227. }
  8228. return Ext.emptyFn;
  8229. },
  8230. getViewWidth: function(full) {
  8231. return full ? Ext.dom.Element.getDocumentWidth() : Ext.dom.Element.getViewportWidth();
  8232. },
  8233. getViewHeight: function(full) {
  8234. return full ? Ext.dom.Element.getDocumentHeight() : Ext.dom.Element.getViewportHeight();
  8235. },
  8236. getDocumentHeight: function() {
  8237. return Math.max(!isCSS1 ? doc.body.scrollHeight : doc.documentElement.scrollHeight, Ext.dom.Element.getViewportHeight());
  8238. },
  8239. getDocumentWidth: function() {
  8240. return Math.max(!isCSS1 ? doc.body.scrollWidth : doc.documentElement.scrollWidth, Ext.dom.Element.getViewportWidth());
  8241. },
  8242. getViewportHeight: function(){
  8243. return Ext.isIE ?
  8244. (Ext.isStrict ? doc.documentElement.clientHeight : doc.body.clientHeight) :
  8245. self.innerHeight;
  8246. },
  8247. getViewportWidth: function() {
  8248. return (!Ext.isStrict && !Ext.isOpera) ? doc.body.clientWidth :
  8249. Ext.isIE ? doc.documentElement.clientWidth : self.innerWidth;
  8250. },
  8251. getY: function(el) {
  8252. return Ext.dom.Element.getXY(el)[1];
  8253. },
  8254. getX: function(el) {
  8255. return Ext.dom.Element.getXY(el)[0];
  8256. },
  8257. getXY: function(el) {
  8258. var bd = doc.body,
  8259. docEl = doc.documentElement,
  8260. leftBorder = 0,
  8261. topBorder = 0,
  8262. ret = [0,0],
  8263. round = Math.round,
  8264. box,
  8265. scroll;
  8266. el = Ext.getDom(el);
  8267. if(el != doc && el != bd){
  8268. if (Ext.isIE) {
  8269. try {
  8270. box = el.getBoundingClientRect();
  8271. topBorder = docEl.clientTop || bd.clientTop;
  8272. leftBorder = docEl.clientLeft || bd.clientLeft;
  8273. } catch (ex) {
  8274. box = { left: 0, top: 0 };
  8275. }
  8276. } else {
  8277. box = el.getBoundingClientRect();
  8278. }
  8279. scroll = fly(document).getScroll();
  8280. ret = [round(box.left + scroll.left - leftBorder), round(box.top + scroll.top - topBorder)];
  8281. }
  8282. return ret;
  8283. },
  8284. setXY: function(el, xy) {
  8285. (el = Ext.fly(el, '_setXY')).position();
  8286. var pts = el.translatePoints(xy),
  8287. style = el.dom.style,
  8288. pos;
  8289. for (pos in pts) {
  8290. if (!isNaN(pts[pos])) {
  8291. style[pos] = pts[pos] + "px";
  8292. }
  8293. }
  8294. },
  8295. setX: function(el, x) {
  8296. Ext.dom.Element.setXY(el, [x, false]);
  8297. },
  8298. setY: function(el, y) {
  8299. Ext.dom.Element.setXY(el, [false, y]);
  8300. },
  8301. serializeForm: function(form) {
  8302. var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements,
  8303. hasSubmit = false,
  8304. encoder = encodeURIComponent,
  8305. data = '',
  8306. eLen = fElements.length,
  8307. element, name, type, options, hasValue, e,
  8308. o, oLen, opt;
  8309. for (e = 0; e < eLen; e++) {
  8310. element = fElements[e];
  8311. name = element.name;
  8312. type = element.type;
  8313. options = element.options;
  8314. if (!element.disabled && name) {
  8315. if (/select-(one|multiple)/i.test(type)) {
  8316. oLen = options.length;
  8317. for (o = 0; o < oLen; o++) {
  8318. opt = options[o];
  8319. if (opt.selected) {
  8320. hasValue = opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttributeNode('value').specified;
  8321. data += Ext.String.format("{0}={1}&", encoder(name), encoder(hasValue ? opt.value : opt.text));
  8322. }
  8323. }
  8324. } else if (!(/file|undefined|reset|button/i.test(type))) {
  8325. if (!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)) {
  8326. data += encoder(name) + '=' + encoder(element.value) + '&';
  8327. hasSubmit = /submit/i.test(type);
  8328. }
  8329. }
  8330. }
  8331. }
  8332. return data.substr(0, data.length - 1);
  8333. }
  8334. });
  8335. }());
  8336. //@tag dom,core
  8337. //@require Ext.dom.AbstractElement-static
  8338. //@define Ext.dom.AbstractElement-alignment
  8339. Ext.dom.AbstractElement.override({
  8340. getAnchorXY: function(anchor, local, size) {
  8341. anchor = (anchor || "tl").toLowerCase();
  8342. size = size || {};
  8343. var me = this,
  8344. vp = me.dom == document.body || me.dom == document,
  8345. width = size.width || vp ? window.innerWidth: me.getWidth(),
  8346. height = size.height || vp ? window.innerHeight: me.getHeight(),
  8347. xy,
  8348. rnd = Math.round,
  8349. myXY = me.getXY(),
  8350. extraX = vp ? 0: !local ? myXY[0] : 0,
  8351. extraY = vp ? 0: !local ? myXY[1] : 0,
  8352. hash = {
  8353. c: [rnd(width * 0.5), rnd(height * 0.5)],
  8354. t: [rnd(width * 0.5), 0],
  8355. l: [0, rnd(height * 0.5)],
  8356. r: [width, rnd(height * 0.5)],
  8357. b: [rnd(width * 0.5), height],
  8358. tl: [0, 0],
  8359. bl: [0, height],
  8360. br: [width, height],
  8361. tr: [width, 0]
  8362. };
  8363. xy = hash[anchor];
  8364. return [xy[0] + extraX, xy[1] + extraY];
  8365. },
  8366. alignToRe: /^([a-z]+)-([a-z]+)(\?)?$/,
  8367. getAlignToXY: function(el, position, offsets, local) {
  8368. local = !!local;
  8369. el = Ext.get(el);
  8370. offsets = offsets || [0, 0];
  8371. if (!position || position == '?') {
  8372. position = 'tl-bl?';
  8373. }
  8374. else if (! (/-/).test(position) && position !== "") {
  8375. position = 'tl-' + position;
  8376. }
  8377. position = position.toLowerCase();
  8378. var me = this,
  8379. matches = position.match(this.alignToRe),
  8380. dw = window.innerWidth,
  8381. dh = window.innerHeight,
  8382. p1 = "",
  8383. p2 = "",
  8384. a1,
  8385. a2,
  8386. x,
  8387. y,
  8388. swapX,
  8389. swapY,
  8390. p1x,
  8391. p1y,
  8392. p2x,
  8393. p2y,
  8394. width,
  8395. height,
  8396. region,
  8397. constrain;
  8398. if (!matches) {
  8399. throw "Element.alignTo with an invalid alignment " + position;
  8400. }
  8401. p1 = matches[1];
  8402. p2 = matches[2];
  8403. constrain = !!matches[3];
  8404. a1 = me.getAnchorXY(p1, true);
  8405. a2 = el.getAnchorXY(p2, local);
  8406. x = a2[0] - a1[0] + offsets[0];
  8407. y = a2[1] - a1[1] + offsets[1];
  8408. if (constrain) {
  8409. width = me.getWidth();
  8410. height = me.getHeight();
  8411. region = el.getPageBox();
  8412. p1y = p1.charAt(0);
  8413. p1x = p1.charAt(p1.length - 1);
  8414. p2y = p2.charAt(0);
  8415. p2x = p2.charAt(p2.length - 1);
  8416. swapY = ((p1y == "t" && p2y == "b") || (p1y == "b" && p2y == "t"));
  8417. swapX = ((p1x == "r" && p2x == "l") || (p1x == "l" && p2x == "r"));
  8418. if (x + width > dw) {
  8419. x = swapX ? region.left - width: dw - width;
  8420. }
  8421. if (x < 0) {
  8422. x = swapX ? region.right: 0;
  8423. }
  8424. if (y + height > dh) {
  8425. y = swapY ? region.top - height: dh - height;
  8426. }
  8427. if (y < 0) {
  8428. y = swapY ? region.bottom: 0;
  8429. }
  8430. }
  8431. return [x, y];
  8432. },
  8433. getAnchor: function(){
  8434. var data = (this.$cache || this.getCache()).data,
  8435. anchor;
  8436. if (!this.dom) {
  8437. return;
  8438. }
  8439. anchor = data._anchor;
  8440. if(!anchor){
  8441. anchor = data._anchor = {};
  8442. }
  8443. return anchor;
  8444. },
  8445. adjustForConstraints: function(xy, parent) {
  8446. var vector = this.getConstrainVector(parent, xy);
  8447. if (vector) {
  8448. xy[0] += vector[0];
  8449. xy[1] += vector[1];
  8450. }
  8451. return xy;
  8452. }
  8453. });
  8454. //@tag dom,core
  8455. //@require Ext.dom.AbstractElement-alignment
  8456. //@define Ext.dom.AbstractElement-insertion
  8457. //@define Ext.dom.AbstractElement
  8458. Ext.dom.AbstractElement.addMethods({
  8459. appendChild: function(el) {
  8460. return Ext.get(el).appendTo(this);
  8461. },
  8462. appendTo: function(el) {
  8463. Ext.getDom(el).appendChild(this.dom);
  8464. return this;
  8465. },
  8466. insertBefore: function(el) {
  8467. el = Ext.getDom(el);
  8468. el.parentNode.insertBefore(this.dom, el);
  8469. return this;
  8470. },
  8471. insertAfter: function(el) {
  8472. el = Ext.getDom(el);
  8473. el.parentNode.insertBefore(this.dom, el.nextSibling);
  8474. return this;
  8475. },
  8476. insertFirst: function(el, returnDom) {
  8477. el = el || {};
  8478. if (el.nodeType || el.dom || typeof el == 'string') {
  8479. el = Ext.getDom(el);
  8480. this.dom.insertBefore(el, this.dom.firstChild);
  8481. return !returnDom ? Ext.get(el) : el;
  8482. }
  8483. else {
  8484. return this.createChild(el, this.dom.firstChild, returnDom);
  8485. }
  8486. },
  8487. insertSibling: function(el, where, returnDom){
  8488. var me = this,
  8489. isAfter = (where || 'before').toLowerCase() == 'after',
  8490. rt, insertEl, eLen, e;
  8491. if (Ext.isArray(el)) {
  8492. insertEl = me;
  8493. eLen = el.length;
  8494. for (e = 0; e < eLen; e++) {
  8495. rt = Ext.fly(insertEl, '_internal').insertSibling(el[e], where, returnDom);
  8496. if (isAfter) {
  8497. insertEl = rt;
  8498. }
  8499. }
  8500. return rt;
  8501. }
  8502. el = el || {};
  8503. if(el.nodeType || el.dom){
  8504. rt = me.dom.parentNode.insertBefore(Ext.getDom(el), isAfter ? me.dom.nextSibling : me.dom);
  8505. if (!returnDom) {
  8506. rt = Ext.get(rt);
  8507. }
  8508. }else{
  8509. if (isAfter && !me.dom.nextSibling) {
  8510. rt = Ext.core.DomHelper.append(me.dom.parentNode, el, !returnDom);
  8511. } else {
  8512. rt = Ext.core.DomHelper[isAfter ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom);
  8513. }
  8514. }
  8515. return rt;
  8516. },
  8517. replace: function(el) {
  8518. el = Ext.get(el);
  8519. this.insertBefore(el);
  8520. el.remove();
  8521. return this;
  8522. },
  8523. replaceWith: function(el){
  8524. var me = this;
  8525. if(el.nodeType || el.dom || typeof el == 'string'){
  8526. el = Ext.get(el);
  8527. me.dom.parentNode.insertBefore(el, me.dom);
  8528. }else{
  8529. el = Ext.core.DomHelper.insertBefore(me.dom, el);
  8530. }
  8531. delete Ext.cache[me.id];
  8532. Ext.removeNode(me.dom);
  8533. me.id = Ext.id(me.dom = el);
  8534. Ext.dom.AbstractElement.addToCache(me.isFlyweight ? new Ext.dom.AbstractElement(me.dom) : me);
  8535. return me;
  8536. },
  8537. createChild: function(config, insertBefore, returnDom) {
  8538. config = config || {tag:'div'};
  8539. if (insertBefore) {
  8540. return Ext.core.DomHelper.insertBefore(insertBefore, config, returnDom !== true);
  8541. }
  8542. else {
  8543. return Ext.core.DomHelper[!this.dom.firstChild ? 'insertFirst' : 'append'](this.dom, config, returnDom !== true);
  8544. }
  8545. },
  8546. wrap: function(config, returnDom, selector) {
  8547. var newEl = Ext.core.DomHelper.insertBefore(this.dom, config || {tag: "div"}, true),
  8548. target = newEl;
  8549. if (selector) {
  8550. target = Ext.DomQuery.selectNode(selector, newEl.dom);
  8551. }
  8552. target.appendChild(this.dom);
  8553. return returnDom ? newEl.dom : newEl;
  8554. },
  8555. insertHtml: function(where, html, returnEl) {
  8556. var el = Ext.core.DomHelper.insertHtml(where, this.dom, html);
  8557. return returnEl ? Ext.get(el) : el;
  8558. }
  8559. });
  8560. //@tag dom,core
  8561. //@require Ext.dom.AbstractElement-insertion
  8562. //@define Ext.dom.AbstractElement-position
  8563. //@define Ext.dom.AbstractElement
  8564. (function(){
  8565. var Element = Ext.dom.AbstractElement;
  8566. Element.override({
  8567. getX: function(el) {
  8568. return this.getXY(el)[0];
  8569. },
  8570. getY: function(el) {
  8571. return this.getXY(el)[1];
  8572. },
  8573. getXY: function() {
  8574. var point = window.webkitConvertPointFromNodeToPage(this.dom, new WebKitPoint(0, 0));
  8575. return [point.x, point.y];
  8576. },
  8577. getOffsetsTo: function(el){
  8578. var o = this.getXY(),
  8579. e = Ext.fly(el, '_internal').getXY();
  8580. return [o[0]-e[0],o[1]-e[1]];
  8581. },
  8582. setX: function(x){
  8583. return this.setXY([x, this.getY()]);
  8584. },
  8585. setY: function(y) {
  8586. return this.setXY([this.getX(), y]);
  8587. },
  8588. setLeft: function(left) {
  8589. this.setStyle('left', Element.addUnits(left));
  8590. return this;
  8591. },
  8592. setTop: function(top) {
  8593. this.setStyle('top', Element.addUnits(top));
  8594. return this;
  8595. },
  8596. setRight: function(right) {
  8597. this.setStyle('right', Element.addUnits(right));
  8598. return this;
  8599. },
  8600. setBottom: function(bottom) {
  8601. this.setStyle('bottom', Element.addUnits(bottom));
  8602. return this;
  8603. },
  8604. setXY: function(pos) {
  8605. var me = this,
  8606. pts,
  8607. style,
  8608. pt;
  8609. if (arguments.length > 1) {
  8610. pos = [pos, arguments[1]];
  8611. }
  8612. pts = me.translatePoints(pos);
  8613. style = me.dom.style;
  8614. for (pt in pts) {
  8615. if (!pts.hasOwnProperty(pt)) {
  8616. continue;
  8617. }
  8618. if (!isNaN(pts[pt])) {
  8619. style[pt] = pts[pt] + "px";
  8620. }
  8621. }
  8622. return me;
  8623. },
  8624. getLeft: function(local) {
  8625. return parseInt(this.getStyle('left'), 10) || 0;
  8626. },
  8627. getRight: function(local) {
  8628. return parseInt(this.getStyle('right'), 10) || 0;
  8629. },
  8630. getTop: function(local) {
  8631. return parseInt(this.getStyle('top'), 10) || 0;
  8632. },
  8633. getBottom: function(local) {
  8634. return parseInt(this.getStyle('bottom'), 10) || 0;
  8635. },
  8636. translatePoints: function(x, y) {
  8637. y = isNaN(x[1]) ? y : x[1];
  8638. x = isNaN(x[0]) ? x : x[0];
  8639. var me = this,
  8640. relative = me.isStyle('position', 'relative'),
  8641. o = me.getXY(),
  8642. l = parseInt(me.getStyle('left'), 10),
  8643. t = parseInt(me.getStyle('top'), 10);
  8644. l = !isNaN(l) ? l : (relative ? 0 : me.dom.offsetLeft);
  8645. t = !isNaN(t) ? t : (relative ? 0 : me.dom.offsetTop);
  8646. return {left: (x - o[0] + l), top: (y - o[1] + t)};
  8647. },
  8648. setBox: function(box) {
  8649. var me = this,
  8650. width = box.width,
  8651. height = box.height,
  8652. top = box.top,
  8653. left = box.left;
  8654. if (left !== undefined) {
  8655. me.setLeft(left);
  8656. }
  8657. if (top !== undefined) {
  8658. me.setTop(top);
  8659. }
  8660. if (width !== undefined) {
  8661. me.setWidth(width);
  8662. }
  8663. if (height !== undefined) {
  8664. me.setHeight(height);
  8665. }
  8666. return this;
  8667. },
  8668. getBox: function(contentBox, local) {
  8669. var me = this,
  8670. dom = me.dom,
  8671. width = dom.offsetWidth,
  8672. height = dom.offsetHeight,
  8673. xy, box, l, r, t, b;
  8674. if (!local) {
  8675. xy = me.getXY();
  8676. }
  8677. else if (contentBox) {
  8678. xy = [0,0];
  8679. }
  8680. else {
  8681. xy = [parseInt(me.getStyle("left"), 10) || 0, parseInt(me.getStyle("top"), 10) || 0];
  8682. }
  8683. if (!contentBox) {
  8684. box = {
  8685. x: xy[0],
  8686. y: xy[1],
  8687. 0: xy[0],
  8688. 1: xy[1],
  8689. width: width,
  8690. height: height
  8691. };
  8692. }
  8693. else {
  8694. l = me.getBorderWidth.call(me, "l") + me.getPadding.call(me, "l");
  8695. r = me.getBorderWidth.call(me, "r") + me.getPadding.call(me, "r");
  8696. t = me.getBorderWidth.call(me, "t") + me.getPadding.call(me, "t");
  8697. b = me.getBorderWidth.call(me, "b") + me.getPadding.call(me, "b");
  8698. box = {
  8699. x: xy[0] + l,
  8700. y: xy[1] + t,
  8701. 0: xy[0] + l,
  8702. 1: xy[1] + t,
  8703. width: width - (l + r),
  8704. height: height - (t + b)
  8705. };
  8706. }
  8707. box.left = box.x;
  8708. box.top = box.y;
  8709. box.right = box.x + box.width;
  8710. box.bottom = box.y + box.height;
  8711. return box;
  8712. },
  8713. getPageBox: function(getRegion) {
  8714. var me = this,
  8715. el = me.dom,
  8716. w = el.offsetWidth,
  8717. h = el.offsetHeight,
  8718. xy = me.getXY(),
  8719. t = xy[1],
  8720. r = xy[0] + w,
  8721. b = xy[1] + h,
  8722. l = xy[0];
  8723. if (!el) {
  8724. return new Ext.util.Region();
  8725. }
  8726. if (getRegion) {
  8727. return new Ext.util.Region(t, r, b, l);
  8728. }
  8729. else {
  8730. return {
  8731. left: l,
  8732. top: t,
  8733. width: w,
  8734. height: h,
  8735. right: r,
  8736. bottom: b
  8737. };
  8738. }
  8739. }
  8740. });
  8741. }());
  8742. //@tag dom,core
  8743. //@require Ext.dom.AbstractElement-position
  8744. //@define Ext.dom.AbstractElement-style
  8745. //@define Ext.dom.AbstractElement
  8746. (function(){
  8747. var Element = Ext.dom.AbstractElement,
  8748. view = document.defaultView,
  8749. array = Ext.Array,
  8750. trimRe = /^\s+|\s+$/g,
  8751. wordsRe = /\w/g,
  8752. spacesRe = /\s+/,
  8753. transparentRe = /^(?:transparent|(?:rgba[(](?:\s*\d+\s*[,]){3}\s*0\s*[)]))$/i,
  8754. hasClassList = Ext.supports.ClassList,
  8755. PADDING = 'padding',
  8756. MARGIN = 'margin',
  8757. BORDER = 'border',
  8758. LEFT_SUFFIX = '-left',
  8759. RIGHT_SUFFIX = '-right',
  8760. TOP_SUFFIX = '-top',
  8761. BOTTOM_SUFFIX = '-bottom',
  8762. WIDTH = '-width',
  8763. borders = {l: BORDER + LEFT_SUFFIX + WIDTH, r: BORDER + RIGHT_SUFFIX + WIDTH, t: BORDER + TOP_SUFFIX + WIDTH, b: BORDER + BOTTOM_SUFFIX + WIDTH},
  8764. paddings = {l: PADDING + LEFT_SUFFIX, r: PADDING + RIGHT_SUFFIX, t: PADDING + TOP_SUFFIX, b: PADDING + BOTTOM_SUFFIX},
  8765. margins = {l: MARGIN + LEFT_SUFFIX, r: MARGIN + RIGHT_SUFFIX, t: MARGIN + TOP_SUFFIX, b: MARGIN + BOTTOM_SUFFIX};
  8766. Element.override({
  8767. styleHooks: {},
  8768. addStyles : function(sides, styles){
  8769. var totalSize = 0,
  8770. sidesArr = (sides || '').match(wordsRe),
  8771. i,
  8772. len = sidesArr.length,
  8773. side,
  8774. styleSides = [];
  8775. if (len == 1) {
  8776. totalSize = Math.abs(parseFloat(this.getStyle(styles[sidesArr[0]])) || 0);
  8777. } else if (len) {
  8778. for (i = 0; i < len; i++) {
  8779. side = sidesArr[i];
  8780. styleSides.push(styles[side]);
  8781. }
  8782. styleSides = this.getStyle(styleSides);
  8783. for (i=0; i < len; i++) {
  8784. side = sidesArr[i];
  8785. totalSize += Math.abs(parseFloat(styleSides[styles[side]]) || 0);
  8786. }
  8787. }
  8788. return totalSize;
  8789. },
  8790. addCls: hasClassList ?
  8791. function (className) {
  8792. var me = this,
  8793. dom = me.dom,
  8794. classList,
  8795. newCls,
  8796. i,
  8797. len,
  8798. cls;
  8799. if (typeof(className) == 'string') {
  8800. className = className.replace(trimRe, '').split(spacesRe);
  8801. }
  8802. if (dom && className && !!(len = className.length)) {
  8803. if (!dom.className) {
  8804. dom.className = className.join(' ');
  8805. } else {
  8806. classList = dom.classList;
  8807. for (i = 0; i < len; ++i) {
  8808. cls = className[i];
  8809. if (cls) {
  8810. if (!classList.contains(cls)) {
  8811. if (newCls) {
  8812. newCls.push(cls);
  8813. } else {
  8814. newCls = dom.className.replace(trimRe, '');
  8815. newCls = newCls ? [newCls, cls] : [cls];
  8816. }
  8817. }
  8818. }
  8819. }
  8820. if (newCls) {
  8821. dom.className = newCls.join(' ');
  8822. }
  8823. }
  8824. }
  8825. return me;
  8826. } :
  8827. function(className) {
  8828. var me = this,
  8829. dom = me.dom,
  8830. changed,
  8831. elClasses;
  8832. if (dom && className && className.length) {
  8833. elClasses = Ext.Element.mergeClsList(dom.className, className);
  8834. if (elClasses.changed) {
  8835. dom.className = elClasses.join(' ');
  8836. }
  8837. }
  8838. return me;
  8839. },
  8840. removeCls: function(className) {
  8841. var me = this,
  8842. dom = me.dom,
  8843. len,
  8844. elClasses;
  8845. if (typeof(className) == 'string') {
  8846. className = className.replace(trimRe, '').split(spacesRe);
  8847. }
  8848. if (dom && dom.className && className && !!(len = className.length)) {
  8849. if (len == 1 && hasClassList) {
  8850. if (className[0]) {
  8851. dom.classList.remove(className[0]);
  8852. }
  8853. } else {
  8854. elClasses = Ext.Element.removeCls(dom.className, className);
  8855. if (elClasses.changed) {
  8856. dom.className = elClasses.join(' ');
  8857. }
  8858. }
  8859. }
  8860. return me;
  8861. },
  8862. radioCls: function(className) {
  8863. var cn = this.dom.parentNode.childNodes,
  8864. v,
  8865. i, len;
  8866. className = Ext.isArray(className) ? className: [className];
  8867. for (i = 0, len = cn.length; i < len; i++) {
  8868. v = cn[i];
  8869. if (v && v.nodeType == 1) {
  8870. Ext.fly(v, '_internal').removeCls(className);
  8871. }
  8872. }
  8873. return this.addCls(className);
  8874. },
  8875. toggleCls: hasClassList ?
  8876. function (className) {
  8877. var me = this,
  8878. dom = me.dom;
  8879. if (dom) {
  8880. className = className.replace(trimRe, '');
  8881. if (className) {
  8882. dom.classList.toggle(className);
  8883. }
  8884. }
  8885. return me;
  8886. } :
  8887. function(className) {
  8888. var me = this;
  8889. return me.hasCls(className) ? me.removeCls(className) : me.addCls(className);
  8890. },
  8891. hasCls: hasClassList ?
  8892. function (className) {
  8893. var dom = this.dom;
  8894. return (dom && className) ? dom.classList.contains(className) : false;
  8895. } :
  8896. function(className) {
  8897. var dom = this.dom;
  8898. return dom ? className && (' '+dom.className+' ').indexOf(' '+className+' ') != -1 : false;
  8899. },
  8900. replaceCls: function(oldClassName, newClassName){
  8901. return this.removeCls(oldClassName).addCls(newClassName);
  8902. },
  8903. isStyle: function(style, val) {
  8904. return this.getStyle(style) == val;
  8905. },
  8906. getStyle: function (property, inline) {
  8907. var me = this,
  8908. dom = me.dom,
  8909. multiple = typeof property != 'string',
  8910. hooks = me.styleHooks,
  8911. prop = property,
  8912. props = prop,
  8913. len = 1,
  8914. domStyle, camel, values, hook, out, style, i;
  8915. if (multiple) {
  8916. values = {};
  8917. prop = props[0];
  8918. i = 0;
  8919. if (!(len = props.length)) {
  8920. return values;
  8921. }
  8922. }
  8923. if (!dom || dom.documentElement) {
  8924. return values || '';
  8925. }
  8926. domStyle = dom.style;
  8927. if (inline) {
  8928. style = domStyle;
  8929. } else {
  8930. style = dom.ownerDocument.defaultView.getComputedStyle(dom, null);
  8931. if (!style) {
  8932. inline = true;
  8933. style = domStyle;
  8934. }
  8935. }
  8936. do {
  8937. hook = hooks[prop];
  8938. if (!hook) {
  8939. hooks[prop] = hook = { name: Element.normalize(prop) };
  8940. }
  8941. if (hook.get) {
  8942. out = hook.get(dom, me, inline, style);
  8943. } else {
  8944. camel = hook.name;
  8945. out = style[camel];
  8946. }
  8947. if (!multiple) {
  8948. return out;
  8949. }
  8950. values[prop] = out;
  8951. prop = props[++i];
  8952. } while (i < len);
  8953. return values;
  8954. },
  8955. getStyles: function () {
  8956. var props = Ext.Array.slice(arguments),
  8957. len = props.length,
  8958. inline;
  8959. if (len && typeof props[len-1] == 'boolean') {
  8960. inline = props.pop();
  8961. }
  8962. return this.getStyle(props, inline);
  8963. },
  8964. isTransparent: function (prop) {
  8965. var value = this.getStyle(prop);
  8966. return value ? transparentRe.test(value) : false;
  8967. },
  8968. setStyle: function(prop, value) {
  8969. var me = this,
  8970. dom = me.dom,
  8971. hooks = me.styleHooks,
  8972. style = dom.style,
  8973. name = prop,
  8974. hook;
  8975. if (typeof name == 'string') {
  8976. hook = hooks[name];
  8977. if (!hook) {
  8978. hooks[name] = hook = { name: Element.normalize(name) };
  8979. }
  8980. value = (value == null) ? '' : value;
  8981. if (hook.set) {
  8982. hook.set(dom, value, me);
  8983. } else {
  8984. style[hook.name] = value;
  8985. }
  8986. if (hook.afterSet) {
  8987. hook.afterSet(dom, value, me);
  8988. }
  8989. } else {
  8990. for (name in prop) {
  8991. if (prop.hasOwnProperty(name)) {
  8992. hook = hooks[name];
  8993. if (!hook) {
  8994. hooks[name] = hook = { name: Element.normalize(name) };
  8995. }
  8996. value = prop[name];
  8997. value = (value == null) ? '' : value;
  8998. if (hook.set) {
  8999. hook.set(dom, value, me);
  9000. } else {
  9001. style[hook.name] = value;
  9002. }
  9003. if (hook.afterSet) {
  9004. hook.afterSet(dom, value, me);
  9005. }
  9006. }
  9007. }
  9008. }
  9009. return me;
  9010. },
  9011. getHeight: function(contentHeight) {
  9012. var dom = this.dom,
  9013. height = contentHeight ? (dom.clientHeight - this.getPadding("tb")) : dom.offsetHeight;
  9014. return height > 0 ? height: 0;
  9015. },
  9016. getWidth: function(contentWidth) {
  9017. var dom = this.dom,
  9018. width = contentWidth ? (dom.clientWidth - this.getPadding("lr")) : dom.offsetWidth;
  9019. return width > 0 ? width: 0;
  9020. },
  9021. setWidth: function(width) {
  9022. var me = this;
  9023. me.dom.style.width = Element.addUnits(width);
  9024. return me;
  9025. },
  9026. setHeight: function(height) {
  9027. var me = this;
  9028. me.dom.style.height = Element.addUnits(height);
  9029. return me;
  9030. },
  9031. getBorderWidth: function(side){
  9032. return this.addStyles(side, borders);
  9033. },
  9034. getPadding: function(side){
  9035. return this.addStyles(side, paddings);
  9036. },
  9037. margins : margins,
  9038. applyStyles: function(styles) {
  9039. if (styles) {
  9040. var i,
  9041. len,
  9042. dom = this.dom;
  9043. if (typeof styles == 'function') {
  9044. styles = styles.call();
  9045. }
  9046. if (typeof styles == 'string') {
  9047. styles = Ext.util.Format.trim(styles).split(/\s*(?::|;)\s*/);
  9048. for (i = 0, len = styles.length; i < len;) {
  9049. dom.style[Element.normalize(styles[i++])] = styles[i++];
  9050. }
  9051. }
  9052. else if (typeof styles == 'object') {
  9053. this.setStyle(styles);
  9054. }
  9055. }
  9056. },
  9057. setSize: function(width, height) {
  9058. var me = this,
  9059. style = me.dom.style;
  9060. if (Ext.isObject(width)) {
  9061. height = width.height;
  9062. width = width.width;
  9063. }
  9064. style.width = Element.addUnits(width);
  9065. style.height = Element.addUnits(height);
  9066. return me;
  9067. },
  9068. getViewSize: function() {
  9069. var doc = document,
  9070. dom = this.dom;
  9071. if (dom == doc || dom == doc.body) {
  9072. return {
  9073. width: Element.getViewportWidth(),
  9074. height: Element.getViewportHeight()
  9075. };
  9076. }
  9077. else {
  9078. return {
  9079. width: dom.clientWidth,
  9080. height: dom.clientHeight
  9081. };
  9082. }
  9083. },
  9084. getSize: function(contentSize) {
  9085. var dom = this.dom;
  9086. return {
  9087. width: Math.max(0, contentSize ? (dom.clientWidth - this.getPadding("lr")) : dom.offsetWidth),
  9088. height: Math.max(0, contentSize ? (dom.clientHeight - this.getPadding("tb")) : dom.offsetHeight)
  9089. };
  9090. },
  9091. repaint: function(){
  9092. var dom = this.dom;
  9093. this.addCls(Ext.baseCSSPrefix + 'repaint');
  9094. setTimeout(function(){
  9095. Ext.fly(dom).removeCls(Ext.baseCSSPrefix + 'repaint');
  9096. }, 1);
  9097. return this;
  9098. },
  9099. getMargin: function(side){
  9100. var me = this,
  9101. hash = {t:"top", l:"left", r:"right", b: "bottom"},
  9102. key,
  9103. o,
  9104. margins;
  9105. if (!side) {
  9106. margins = [];
  9107. for (key in me.margins) {
  9108. if(me.margins.hasOwnProperty(key)) {
  9109. margins.push(me.margins[key]);
  9110. }
  9111. }
  9112. o = me.getStyle(margins);
  9113. if(o && typeof o == 'object') {
  9114. for (key in me.margins) {
  9115. if(me.margins.hasOwnProperty(key)) {
  9116. o[hash[key]] = parseFloat(o[me.margins[key]]) || 0;
  9117. }
  9118. }
  9119. }
  9120. return o;
  9121. } else {
  9122. return me.addStyles.call(me, side, me.margins);
  9123. }
  9124. },
  9125. mask: function(msg, msgCls, transparent) {
  9126. var me = this,
  9127. dom = me.dom,
  9128. data = (me.$cache || me.getCache()).data,
  9129. el = data.mask,
  9130. mask,
  9131. size,
  9132. cls = '',
  9133. prefix = Ext.baseCSSPrefix;
  9134. me.addCls(prefix + 'masked');
  9135. if (me.getStyle("position") == "static") {
  9136. me.addCls(prefix + 'masked-relative');
  9137. }
  9138. if (el) {
  9139. el.remove();
  9140. }
  9141. if (msgCls && typeof msgCls == 'string' ) {
  9142. cls = ' ' + msgCls;
  9143. }
  9144. else {
  9145. cls = ' ' + prefix + 'mask-gray';
  9146. }
  9147. mask = me.createChild({
  9148. cls: prefix + 'mask' + ((transparent !== false) ? '' : (' ' + prefix + 'mask-gray')),
  9149. html: msg ? ('<div class="' + (msgCls || (prefix + 'mask-message')) + '">' + msg + '</div>') : ''
  9150. });
  9151. size = me.getSize();
  9152. data.mask = mask;
  9153. if (dom === document.body) {
  9154. size.height = window.innerHeight;
  9155. if (me.orientationHandler) {
  9156. Ext.EventManager.unOrientationChange(me.orientationHandler, me);
  9157. }
  9158. me.orientationHandler = function() {
  9159. size = me.getSize();
  9160. size.height = window.innerHeight;
  9161. mask.setSize(size);
  9162. };
  9163. Ext.EventManager.onOrientationChange(me.orientationHandler, me);
  9164. }
  9165. mask.setSize(size);
  9166. if (Ext.is.iPad) {
  9167. Ext.repaint();
  9168. }
  9169. },
  9170. unmask: function() {
  9171. var me = this,
  9172. data = (me.$cache || me.getCache()).data,
  9173. mask = data.mask,
  9174. prefix = Ext.baseCSSPrefix;
  9175. if (mask) {
  9176. mask.remove();
  9177. delete data.mask;
  9178. }
  9179. me.removeCls([prefix + 'masked', prefix + 'masked-relative']);
  9180. if (me.dom === document.body) {
  9181. Ext.EventManager.unOrientationChange(me.orientationHandler, me);
  9182. delete me.orientationHandler;
  9183. }
  9184. }
  9185. });
  9186. Element.populateStyleMap = function (map, order) {
  9187. var baseStyles = ['margin-', 'padding-', 'border-width-'],
  9188. beforeAfter = ['before', 'after'],
  9189. index, style, name, i;
  9190. for (index = baseStyles.length; index--; ) {
  9191. for (i = 2; i--; ) {
  9192. style = baseStyles[index] + beforeAfter[i];
  9193. map[Element.normalize(style)] = map[style] = {
  9194. name: Element.normalize(baseStyles[index] + order[i])
  9195. };
  9196. }
  9197. }
  9198. };
  9199. Ext.onReady(function () {
  9200. var supports = Ext.supports,
  9201. styleHooks,
  9202. colorStyles, i, name, camel;
  9203. function fixTransparent (dom, el, inline, style) {
  9204. var value = style[this.name] || '';
  9205. return transparentRe.test(value) ? 'transparent' : value;
  9206. }
  9207. function fixRightMargin (dom, el, inline, style) {
  9208. var result = style.marginRight,
  9209. domStyle, display;
  9210. if (result != '0px') {
  9211. domStyle = dom.style;
  9212. display = domStyle.display;
  9213. domStyle.display = 'inline-block';
  9214. result = (inline ? style : dom.ownerDocument.defaultView.getComputedStyle(dom, null)).marginRight;
  9215. domStyle.display = display;
  9216. }
  9217. return result;
  9218. }
  9219. function fixRightMarginAndInputFocus (dom, el, inline, style) {
  9220. var result = style.marginRight,
  9221. domStyle, cleaner, display;
  9222. if (result != '0px') {
  9223. domStyle = dom.style;
  9224. cleaner = Element.getRightMarginFixCleaner(dom);
  9225. display = domStyle.display;
  9226. domStyle.display = 'inline-block';
  9227. result = (inline ? style : dom.ownerDocument.defaultView.getComputedStyle(dom, '')).marginRight;
  9228. domStyle.display = display;
  9229. cleaner();
  9230. }
  9231. return result;
  9232. }
  9233. styleHooks = Element.prototype.styleHooks;
  9234. Element.populateStyleMap(styleHooks, ['left', 'right']);
  9235. if (supports.init) {
  9236. supports.init();
  9237. }
  9238. if (!supports.RightMargin) {
  9239. styleHooks.marginRight = styleHooks['margin-right'] = {
  9240. name: 'marginRight',
  9241. get: (supports.DisplayChangeInputSelectionBug || supports.DisplayChangeTextAreaSelectionBug) ?
  9242. fixRightMarginAndInputFocus : fixRightMargin
  9243. };
  9244. }
  9245. if (!supports.TransparentColor) {
  9246. colorStyles = ['background-color', 'border-color', 'color', 'outline-color'];
  9247. for (i = colorStyles.length; i--; ) {
  9248. name = colorStyles[i];
  9249. camel = Element.normalize(name);
  9250. styleHooks[name] = styleHooks[camel] = {
  9251. name: camel,
  9252. get: fixTransparent
  9253. };
  9254. }
  9255. }
  9256. });
  9257. }());
  9258. //@tag dom,core
  9259. //@require Ext.dom.AbstractElement-style
  9260. //@define Ext.dom.AbstractElement-traversal
  9261. //@define Ext.dom.AbstractElement
  9262. Ext.dom.AbstractElement.override({
  9263. findParent: function(simpleSelector, limit, returnEl) {
  9264. var target = this.dom,
  9265. topmost = document.documentElement,
  9266. depth = 0,
  9267. stopEl;
  9268. limit = limit || 50;
  9269. if (isNaN(limit)) {
  9270. stopEl = Ext.getDom(limit);
  9271. limit = Number.MAX_VALUE;
  9272. }
  9273. while (target && target.nodeType == 1 && depth < limit && target != topmost && target != stopEl) {
  9274. if (Ext.DomQuery.is(target, simpleSelector)) {
  9275. return returnEl ? Ext.get(target) : target;
  9276. }
  9277. depth++;
  9278. target = target.parentNode;
  9279. }
  9280. return null;
  9281. },
  9282. findParentNode: function(simpleSelector, limit, returnEl) {
  9283. var p = Ext.fly(this.dom.parentNode, '_internal');
  9284. return p ? p.findParent(simpleSelector, limit, returnEl) : null;
  9285. },
  9286. up: function(simpleSelector, limit) {
  9287. return this.findParentNode(simpleSelector, limit, true);
  9288. },
  9289. select: function(selector, composite) {
  9290. return Ext.dom.Element.select(selector, this.dom, composite);
  9291. },
  9292. query: function(selector) {
  9293. return Ext.DomQuery.select(selector, this.dom);
  9294. },
  9295. down: function(selector, returnDom) {
  9296. var n = Ext.DomQuery.selectNode(selector, this.dom);
  9297. return returnDom ? n : Ext.get(n);
  9298. },
  9299. child: function(selector, returnDom) {
  9300. var node,
  9301. me = this,
  9302. id;
  9303. id = Ext.id(me.dom);
  9304. id = Ext.escapeId(id);
  9305. node = Ext.DomQuery.selectNode('#' + id + " > " + selector, me.dom);
  9306. return returnDom ? node : Ext.get(node);
  9307. },
  9308. parent: function(selector, returnDom) {
  9309. return this.matchNode('parentNode', 'parentNode', selector, returnDom);
  9310. },
  9311. next: function(selector, returnDom) {
  9312. return this.matchNode('nextSibling', 'nextSibling', selector, returnDom);
  9313. },
  9314. prev: function(selector, returnDom) {
  9315. return this.matchNode('previousSibling', 'previousSibling', selector, returnDom);
  9316. },
  9317. first: function(selector, returnDom) {
  9318. return this.matchNode('nextSibling', 'firstChild', selector, returnDom);
  9319. },
  9320. last: function(selector, returnDom) {
  9321. return this.matchNode('previousSibling', 'lastChild', selector, returnDom);
  9322. },
  9323. matchNode: function(dir, start, selector, returnDom) {
  9324. if (!this.dom) {
  9325. return null;
  9326. }
  9327. var n = this.dom[start];
  9328. while (n) {
  9329. if (n.nodeType == 1 && (!selector || Ext.DomQuery.is(n, selector))) {
  9330. return !returnDom ? Ext.get(n) : n;
  9331. }
  9332. n = n[dir];
  9333. }
  9334. return null;
  9335. },
  9336. isAncestor: function(element) {
  9337. return this.self.isAncestor.call(this.self, this.dom, element);
  9338. }
  9339. });
  9340. //@tag dom,core
  9341. //@define Ext.DomHelper
  9342. //@define Ext.core.DomHelper
  9343. //@require Ext.dom.AbstractElement-traversal
  9344. (function() {
  9345. var afterbegin = 'afterbegin',
  9346. afterend = 'afterend',
  9347. beforebegin = 'beforebegin',
  9348. beforeend = 'beforeend',
  9349. ts = '<table>',
  9350. te = '</table>',
  9351. tbs = ts+'<tbody>',
  9352. tbe = '</tbody>'+te,
  9353. trs = tbs + '<tr>',
  9354. tre = '</tr>'+tbe,
  9355. detachedDiv = document.createElement('div'),
  9356. bbValues = ['BeforeBegin', 'previousSibling'],
  9357. aeValues = ['AfterEnd', 'nextSibling'],
  9358. bb_ae_PositionHash = {
  9359. beforebegin: bbValues,
  9360. afterend: aeValues
  9361. },
  9362. fullPositionHash = {
  9363. beforebegin: bbValues,
  9364. afterend: aeValues,
  9365. afterbegin: ['AfterBegin', 'firstChild'],
  9366. beforeend: ['BeforeEnd', 'lastChild']
  9367. };
  9368. Ext.define('Ext.dom.Helper', {
  9369. extend: 'Ext.dom.AbstractHelper',
  9370. requires:['Ext.dom.AbstractElement'],
  9371. tableRe: /^table|tbody|tr|td$/i,
  9372. tableElRe: /td|tr|tbody/i,
  9373. useDom : false,
  9374. createDom: function(o, parentNode){
  9375. var el,
  9376. doc = document,
  9377. useSet,
  9378. attr,
  9379. val,
  9380. cn,
  9381. i, l;
  9382. if (Ext.isArray(o)) {
  9383. el = doc.createDocumentFragment();
  9384. for (i = 0, l = o.length; i < l; i++) {
  9385. this.createDom(o[i], el);
  9386. }
  9387. } else if (typeof o == 'string') {
  9388. el = doc.createTextNode(o);
  9389. } else {
  9390. el = doc.createElement(o.tag || 'div');
  9391. useSet = !!el.setAttribute;
  9392. for (attr in o) {
  9393. if (!this.confRe.test(attr)) {
  9394. val = o[attr];
  9395. if (attr == 'cls') {
  9396. el.className = val;
  9397. } else {
  9398. if (useSet) {
  9399. el.setAttribute(attr, val);
  9400. } else {
  9401. el[attr] = val;
  9402. }
  9403. }
  9404. }
  9405. }
  9406. Ext.DomHelper.applyStyles(el, o.style);
  9407. if ((cn = o.children || o.cn)) {
  9408. this.createDom(cn, el);
  9409. } else if (o.html) {
  9410. el.innerHTML = o.html;
  9411. }
  9412. }
  9413. if (parentNode) {
  9414. parentNode.appendChild(el);
  9415. }
  9416. return el;
  9417. },
  9418. ieTable: function(depth, openingTags, htmlContent, closingTags){
  9419. detachedDiv.innerHTML = [openingTags, htmlContent, closingTags].join('');
  9420. var i = -1,
  9421. el = detachedDiv,
  9422. ns;
  9423. while (++i < depth) {
  9424. el = el.firstChild;
  9425. }
  9426. ns = el.nextSibling;
  9427. if (ns) {
  9428. el = document.createDocumentFragment();
  9429. while (ns) {
  9430. el.appendChild(ns);
  9431. ns = ns.nextSibling;
  9432. }
  9433. }
  9434. return el;
  9435. },
  9436. insertIntoTable: function(tag, where, destinationEl, html) {
  9437. var node,
  9438. before,
  9439. bb = where == beforebegin,
  9440. ab = where == afterbegin,
  9441. be = where == beforeend,
  9442. ae = where == afterend;
  9443. if (tag == 'td' && (ab || be) || !this.tableElRe.test(tag) && (bb || ae)) {
  9444. return null;
  9445. }
  9446. before = bb ? destinationEl :
  9447. ae ? destinationEl.nextSibling :
  9448. ab ? destinationEl.firstChild : null;
  9449. if (bb || ae) {
  9450. destinationEl = destinationEl.parentNode;
  9451. }
  9452. if (tag == 'td' || (tag == 'tr' && (be || ab))) {
  9453. node = this.ieTable(4, trs, html, tre);
  9454. } else if ((tag == 'tbody' && (be || ab)) ||
  9455. (tag == 'tr' && (bb || ae))) {
  9456. node = this.ieTable(3, tbs, html, tbe);
  9457. } else {
  9458. node = this.ieTable(2, ts, html, te);
  9459. }
  9460. destinationEl.insertBefore(node, before);
  9461. return node;
  9462. },
  9463. createContextualFragment: function(html) {
  9464. var fragment = document.createDocumentFragment(),
  9465. length, childNodes;
  9466. detachedDiv.innerHTML = html;
  9467. childNodes = detachedDiv.childNodes;
  9468. length = childNodes.length;
  9469. while (length--) {
  9470. fragment.appendChild(childNodes[0]);
  9471. }
  9472. return fragment;
  9473. },
  9474. applyStyles: function(el, styles) {
  9475. if (styles) {
  9476. el = Ext.fly(el);
  9477. if (typeof styles == "function") {
  9478. styles = styles.call();
  9479. }
  9480. if (typeof styles == "string") {
  9481. styles = Ext.dom.Element.parseStyles(styles);
  9482. }
  9483. if (typeof styles == "object") {
  9484. el.setStyle(styles);
  9485. }
  9486. }
  9487. },
  9488. createHtml: function(spec) {
  9489. return this.markup(spec);
  9490. },
  9491. doInsert: function(el, o, returnElement, pos, sibling, append) {
  9492. el = el.dom || Ext.getDom(el);
  9493. var newNode;
  9494. if (this.useDom) {
  9495. newNode = this.createDom(o, null);
  9496. if (append) {
  9497. el.appendChild(newNode);
  9498. }
  9499. else {
  9500. (sibling == 'firstChild' ? el : el.parentNode).insertBefore(newNode, el[sibling] || el);
  9501. }
  9502. } else {
  9503. newNode = this.insertHtml(pos, el, this.markup(o));
  9504. }
  9505. return returnElement ? Ext.get(newNode, true) : newNode;
  9506. },
  9507. overwrite: function(el, html, returnElement) {
  9508. var newNode;
  9509. el = Ext.getDom(el);
  9510. html = this.markup(html);
  9511. if (Ext.isIE && this.tableRe.test(el.tagName)) {
  9512. while (el.firstChild) {
  9513. el.removeChild(el.firstChild);
  9514. }
  9515. if (html) {
  9516. newNode = this.insertHtml('afterbegin', el, html);
  9517. return returnElement ? Ext.get(newNode) : newNode;
  9518. }
  9519. return null;
  9520. }
  9521. el.innerHTML = html;
  9522. return returnElement ? Ext.get(el.firstChild) : el.firstChild;
  9523. },
  9524. insertHtml: function(where, el, html) {
  9525. var hashVal,
  9526. range,
  9527. rangeEl,
  9528. setStart,
  9529. frag;
  9530. where = where.toLowerCase();
  9531. if (el.insertAdjacentHTML) {
  9532. if (Ext.isIE && this.tableRe.test(el.tagName) && (frag = this.insertIntoTable(el.tagName.toLowerCase(), where, el, html))) {
  9533. return frag;
  9534. }
  9535. if ((hashVal = fullPositionHash[where])) {
  9536. el.insertAdjacentHTML(hashVal[0], html);
  9537. return el[hashVal[1]];
  9538. }
  9539. } else {
  9540. if (el.nodeType === 3) {
  9541. where = where === 'afterbegin' ? 'beforebegin' : where;
  9542. where = where === 'beforeend' ? 'afterend' : where;
  9543. }
  9544. range = Ext.supports.CreateContextualFragment ? el.ownerDocument.createRange() : undefined;
  9545. setStart = 'setStart' + (this.endRe.test(where) ? 'After' : 'Before');
  9546. if (bb_ae_PositionHash[where]) {
  9547. if (range) {
  9548. range[setStart](el);
  9549. frag = range.createContextualFragment(html);
  9550. } else {
  9551. frag = this.createContextualFragment(html);
  9552. }
  9553. el.parentNode.insertBefore(frag, where == beforebegin ? el : el.nextSibling);
  9554. return el[(where == beforebegin ? 'previous' : 'next') + 'Sibling'];
  9555. } else {
  9556. rangeEl = (where == afterbegin ? 'first' : 'last') + 'Child';
  9557. if (el.firstChild) {
  9558. if (range) {
  9559. range[setStart](el[rangeEl]);
  9560. frag = range.createContextualFragment(html);
  9561. } else {
  9562. frag = this.createContextualFragment(html);
  9563. }
  9564. if (where == afterbegin) {
  9565. el.insertBefore(frag, el.firstChild);
  9566. } else {
  9567. el.appendChild(frag);
  9568. }
  9569. } else {
  9570. el.innerHTML = html;
  9571. }
  9572. return el[rangeEl];
  9573. }
  9574. }
  9575. },
  9576. createTemplate: function(o) {
  9577. var html = this.markup(o);
  9578. return new Ext.Template(html);
  9579. }
  9580. }, function() {
  9581. Ext.ns('Ext.core');
  9582. Ext.DomHelper = Ext.core.DomHelper = new this;
  9583. });
  9584. }());
  9585. //@tag dom,core
  9586. //@require Helper.js
  9587. //@define Ext.dom.Query
  9588. //@define Ext.core.Query
  9589. //@define Ext.DomQuery
  9590. Ext.ns('Ext.core');
  9591. Ext.dom.Query = Ext.core.DomQuery = Ext.DomQuery = (function(){
  9592. var cache = {},
  9593. simpleCache = {},
  9594. valueCache = {},
  9595. nonSpace = /\S/,
  9596. trimRe = /^\s+|\s+$/g,
  9597. tplRe = /\{(\d+)\}/g,
  9598. modeRe = /^(\s?[\/>+~]\s?|\s|$)/,
  9599. tagTokenRe = /^(#)?([\w\-\*\\]+)/,
  9600. nthRe = /(\d*)n\+?(\d*)/,
  9601. nthRe2 = /\D/,
  9602. startIdRe = /^\s*\#/,
  9603. isIE = window.ActiveXObject ? true : false,
  9604. key = 30803,
  9605. longHex = /\\([0-9a-fA-F]{6})/g,
  9606. shortHex = /\\([0-9a-fA-F]{1,6})\s{0,1}/g,
  9607. nonHex = /\\([^0-9a-fA-F]{1})/g,
  9608. escapes = /\\/g,
  9609. num, hasEscapes,
  9610. longHexToChar = function($0, $1) {
  9611. return String.fromCharCode(parseInt($1, 16));
  9612. },
  9613. shortToLongHex = function($0, $1) {
  9614. while ($1.length < 6) {
  9615. $1 = '0' + $1;
  9616. }
  9617. return '\\' + $1;
  9618. },
  9619. charToLongHex = function($0, $1) {
  9620. num = $1.charCodeAt(0).toString(16);
  9621. if (num.length === 1) {
  9622. num = '0' + num;
  9623. }
  9624. return '\\0000' + num;
  9625. },
  9626. unescapeCssSelector = function (selector) {
  9627. return (hasEscapes)
  9628. ? selector.replace(longHex, longHexToChar)
  9629. : selector;
  9630. },
  9631. setupEscapes = function(path){
  9632. hasEscapes = (path.indexOf('\\') > -1);
  9633. if (hasEscapes) {
  9634. path = path
  9635. .replace(shortHex, shortToLongHex)
  9636. .replace(nonHex, charToLongHex)
  9637. .replace(escapes, '\\\\');
  9638. }
  9639. return path;
  9640. };
  9641. eval("var batch = 30803;");
  9642. function child(parent, index){
  9643. var i = 0,
  9644. n = parent.firstChild;
  9645. while(n){
  9646. if(n.nodeType == 1){
  9647. if(++i == index){
  9648. return n;
  9649. }
  9650. }
  9651. n = n.nextSibling;
  9652. }
  9653. return null;
  9654. }
  9655. function next(n){
  9656. while((n = n.nextSibling) && n.nodeType != 1);
  9657. return n;
  9658. }
  9659. function prev(n){
  9660. while((n = n.previousSibling) && n.nodeType != 1);
  9661. return n;
  9662. }
  9663. function children(parent){
  9664. var n = parent.firstChild,
  9665. nodeIndex = -1,
  9666. nextNode;
  9667. while(n){
  9668. nextNode = n.nextSibling;
  9669. if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
  9670. parent.removeChild(n);
  9671. }else{
  9672. n.nodeIndex = ++nodeIndex;
  9673. }
  9674. n = nextNode;
  9675. }
  9676. return this;
  9677. }
  9678. function byClassName(nodeSet, cls){
  9679. cls = unescapeCssSelector(cls);
  9680. if(!cls){
  9681. return nodeSet;
  9682. }
  9683. var result = [], ri = -1,
  9684. i, ci;
  9685. for(i = 0, ci; ci = nodeSet[i]; i++){
  9686. if((' '+ci.className+' ').indexOf(cls) != -1){
  9687. result[++ri] = ci;
  9688. }
  9689. }
  9690. return result;
  9691. }
  9692. function attrValue(n, attr){
  9693. if(!n.tagName && typeof n.length != "undefined"){
  9694. n = n[0];
  9695. }
  9696. if(!n){
  9697. return null;
  9698. }
  9699. if(attr == "for"){
  9700. return n.htmlFor;
  9701. }
  9702. if(attr == "class" || attr == "className"){
  9703. return n.className;
  9704. }
  9705. return n.getAttribute(attr) || n[attr];
  9706. }
  9707. function getNodes(ns, mode, tagName){
  9708. var result = [], ri = -1, cs,
  9709. i, ni, j, ci, cn, utag, n, cj;
  9710. if(!ns){
  9711. return result;
  9712. }
  9713. tagName = tagName || "*";
  9714. if(typeof ns.getElementsByTagName != "undefined"){
  9715. ns = [ns];
  9716. }
  9717. if(!mode){
  9718. for(i = 0, ni; ni = ns[i]; i++){
  9719. cs = ni.getElementsByTagName(tagName);
  9720. for(j = 0, ci; ci = cs[j]; j++){
  9721. result[++ri] = ci;
  9722. }
  9723. }
  9724. } else if(mode == "/" || mode == ">"){
  9725. utag = tagName.toUpperCase();
  9726. for(i = 0, ni, cn; ni = ns[i]; i++){
  9727. cn = ni.childNodes;
  9728. for(j = 0, cj; cj = cn[j]; j++){
  9729. if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){
  9730. result[++ri] = cj;
  9731. }
  9732. }
  9733. }
  9734. }else if(mode == "+"){
  9735. utag = tagName.toUpperCase();
  9736. for(i = 0, n; n = ns[i]; i++){
  9737. while((n = n.nextSibling) && n.nodeType != 1);
  9738. if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
  9739. result[++ri] = n;
  9740. }
  9741. }
  9742. }else if(mode == "~"){
  9743. utag = tagName.toUpperCase();
  9744. for(i = 0, n; n = ns[i]; i++){
  9745. while((n = n.nextSibling)){
  9746. if (n.nodeName == utag || n.nodeName == tagName || tagName == '*'){
  9747. result[++ri] = n;
  9748. }
  9749. }
  9750. }
  9751. }
  9752. return result;
  9753. }
  9754. function concat(a, b){
  9755. if(b.slice){
  9756. return a.concat(b);
  9757. }
  9758. for(var i = 0, l = b.length; i < l; i++){
  9759. a[a.length] = b[i];
  9760. }
  9761. return a;
  9762. }
  9763. function byTag(cs, tagName){
  9764. if(cs.tagName || cs == document){
  9765. cs = [cs];
  9766. }
  9767. if(!tagName){
  9768. return cs;
  9769. }
  9770. var result = [], ri = -1,
  9771. i, ci;
  9772. tagName = tagName.toLowerCase();
  9773. for(i = 0, ci; ci = cs[i]; i++){
  9774. if(ci.nodeType == 1 && ci.tagName.toLowerCase() == tagName){
  9775. result[++ri] = ci;
  9776. }
  9777. }
  9778. return result;
  9779. }
  9780. function byId(cs, id){
  9781. id = unescapeCssSelector(id);
  9782. if(cs.tagName || cs == document){
  9783. cs = [cs];
  9784. }
  9785. if(!id){
  9786. return cs;
  9787. }
  9788. var result = [], ri = -1,
  9789. i, ci;
  9790. for(i = 0, ci; ci = cs[i]; i++){
  9791. if(ci && ci.id == id){
  9792. result[++ri] = ci;
  9793. return result;
  9794. }
  9795. }
  9796. return result;
  9797. }
  9798. function byAttribute(cs, attr, value, op, custom){
  9799. var result = [],
  9800. ri = -1,
  9801. useGetStyle = custom == "{",
  9802. fn = Ext.DomQuery.operators[op],
  9803. a,
  9804. xml,
  9805. hasXml,
  9806. i, ci;
  9807. value = unescapeCssSelector(value);
  9808. for(i = 0, ci; ci = cs[i]; i++){
  9809. if(ci.nodeType != 1){
  9810. continue;
  9811. }
  9812. if(!hasXml){
  9813. xml = Ext.DomQuery.isXml(ci);
  9814. hasXml = true;
  9815. }
  9816. if(!xml){
  9817. if(useGetStyle){
  9818. a = Ext.DomQuery.getStyle(ci, attr);
  9819. } else if (attr == "class" || attr == "className"){
  9820. a = ci.className;
  9821. } else if (attr == "for"){
  9822. a = ci.htmlFor;
  9823. } else if (attr == "href"){
  9824. a = ci.getAttribute("href", 2);
  9825. } else{
  9826. a = ci.getAttribute(attr);
  9827. }
  9828. }else{
  9829. a = ci.getAttribute(attr);
  9830. }
  9831. if((fn && fn(a, value)) || (!fn && a)){
  9832. result[++ri] = ci;
  9833. }
  9834. }
  9835. return result;
  9836. }
  9837. function byPseudo(cs, name, value){
  9838. value = unescapeCssSelector(value);
  9839. return Ext.DomQuery.pseudos[name](cs, value);
  9840. }
  9841. function nodupIEXml(cs){
  9842. var d = ++key,
  9843. r,
  9844. i, len, c;
  9845. cs[0].setAttribute("_nodup", d);
  9846. r = [cs[0]];
  9847. for(i = 1, len = cs.length; i < len; i++){
  9848. c = cs[i];
  9849. if(!c.getAttribute("_nodup") != d){
  9850. c.setAttribute("_nodup", d);
  9851. r[r.length] = c;
  9852. }
  9853. }
  9854. for(i = 0, len = cs.length; i < len; i++){
  9855. cs[i].removeAttribute("_nodup");
  9856. }
  9857. return r;
  9858. }
  9859. function nodup(cs){
  9860. if(!cs){
  9861. return [];
  9862. }
  9863. var len = cs.length, c, i, r = cs, cj, ri = -1, d, j;
  9864. if(!len || typeof cs.nodeType != "undefined" || len == 1){
  9865. return cs;
  9866. }
  9867. if(isIE && typeof cs[0].selectSingleNode != "undefined"){
  9868. return nodupIEXml(cs);
  9869. }
  9870. d = ++key;
  9871. cs[0]._nodup = d;
  9872. for(i = 1; c = cs[i]; i++){
  9873. if(c._nodup != d){
  9874. c._nodup = d;
  9875. }else{
  9876. r = [];
  9877. for(j = 0; j < i; j++){
  9878. r[++ri] = cs[j];
  9879. }
  9880. for(j = i+1; cj = cs[j]; j++){
  9881. if(cj._nodup != d){
  9882. cj._nodup = d;
  9883. r[++ri] = cj;
  9884. }
  9885. }
  9886. return r;
  9887. }
  9888. }
  9889. return r;
  9890. }
  9891. function quickDiffIEXml(c1, c2){
  9892. var d = ++key,
  9893. r = [],
  9894. i, len;
  9895. for(i = 0, len = c1.length; i < len; i++){
  9896. c1[i].setAttribute("_qdiff", d);
  9897. }
  9898. for(i = 0, len = c2.length; i < len; i++){
  9899. if(c2[i].getAttribute("_qdiff") != d){
  9900. r[r.length] = c2[i];
  9901. }
  9902. }
  9903. for(i = 0, len = c1.length; i < len; i++){
  9904. c1[i].removeAttribute("_qdiff");
  9905. }
  9906. return r;
  9907. }
  9908. function quickDiff(c1, c2){
  9909. var len1 = c1.length,
  9910. d = ++key,
  9911. r = [],
  9912. i, len;
  9913. if(!len1){
  9914. return c2;
  9915. }
  9916. if(isIE && typeof c1[0].selectSingleNode != "undefined"){
  9917. return quickDiffIEXml(c1, c2);
  9918. }
  9919. for(i = 0; i < len1; i++){
  9920. c1[i]._qdiff = d;
  9921. }
  9922. for(i = 0, len = c2.length; i < len; i++){
  9923. if(c2[i]._qdiff != d){
  9924. r[r.length] = c2[i];
  9925. }
  9926. }
  9927. return r;
  9928. }
  9929. function quickId(ns, mode, root, id){
  9930. if(ns == root){
  9931. id = unescapeCssSelector(id);
  9932. var d = root.ownerDocument || root;
  9933. return d.getElementById(id);
  9934. }
  9935. ns = getNodes(ns, mode, "*");
  9936. return byId(ns, id);
  9937. }
  9938. return {
  9939. getStyle : function(el, name){
  9940. return Ext.fly(el).getStyle(name);
  9941. },
  9942. compile : function(path, type){
  9943. type = type || "select";
  9944. var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"],
  9945. mode,
  9946. lastPath,
  9947. matchers = Ext.DomQuery.matchers,
  9948. matchersLn = matchers.length,
  9949. modeMatch,
  9950. lmode = path.match(modeRe),
  9951. tokenMatch, matched, j, t, m;
  9952. path = setupEscapes(path);
  9953. if(lmode && lmode[1]){
  9954. fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
  9955. path = path.replace(lmode[1], "");
  9956. }
  9957. while(path.substr(0, 1)=="/"){
  9958. path = path.substr(1);
  9959. }
  9960. while(path && lastPath != path){
  9961. lastPath = path;
  9962. tokenMatch = path.match(tagTokenRe);
  9963. if(type == "select"){
  9964. if(tokenMatch){
  9965. if(tokenMatch[1] == "#"){
  9966. fn[fn.length] = 'n = quickId(n, mode, root, "'+tokenMatch[2]+'");';
  9967. }else{
  9968. fn[fn.length] = 'n = getNodes(n, mode, "'+tokenMatch[2]+'");';
  9969. }
  9970. path = path.replace(tokenMatch[0], "");
  9971. }else if(path.substr(0, 1) != '@'){
  9972. fn[fn.length] = 'n = getNodes(n, mode, "*");';
  9973. }
  9974. }else{
  9975. if(tokenMatch){
  9976. if(tokenMatch[1] == "#"){
  9977. fn[fn.length] = 'n = byId(n, "'+tokenMatch[2]+'");';
  9978. }else{
  9979. fn[fn.length] = 'n = byTag(n, "'+tokenMatch[2]+'");';
  9980. }
  9981. path = path.replace(tokenMatch[0], "");
  9982. }
  9983. }
  9984. while(!(modeMatch = path.match(modeRe))){
  9985. matched = false;
  9986. for(j = 0; j < matchersLn; j++){
  9987. t = matchers[j];
  9988. m = path.match(t.re);
  9989. if(m){
  9990. fn[fn.length] = t.select.replace(tplRe, function(x, i){
  9991. return m[i];
  9992. });
  9993. path = path.replace(m[0], "");
  9994. matched = true;
  9995. break;
  9996. }
  9997. }
  9998. if(!matched){
  9999. Ext.Error.raise({
  10000. sourceClass: 'Ext.DomQuery',
  10001. sourceMethod: 'compile',
  10002. msg: 'Error parsing selector. Parsing failed at "' + path + '"'
  10003. });
  10004. }
  10005. }
  10006. if(modeMatch[1]){
  10007. fn[fn.length] = 'mode="'+modeMatch[1].replace(trimRe, "")+'";';
  10008. path = path.replace(modeMatch[1], "");
  10009. }
  10010. }
  10011. fn[fn.length] = "return nodup(n);\n}";
  10012. eval(fn.join(""));
  10013. return f;
  10014. },
  10015. jsSelect: function(path, root, type){
  10016. root = root || document;
  10017. if(typeof root == "string"){
  10018. root = document.getElementById(root);
  10019. }
  10020. var paths = path.split(","),
  10021. results = [],
  10022. i, len, subPath, result;
  10023. for(i = 0, len = paths.length; i < len; i++){
  10024. subPath = paths[i].replace(trimRe, "");
  10025. if(!cache[subPath]){
  10026. cache[subPath] = Ext.DomQuery.compile(subPath, type);
  10027. if(!cache[subPath]){
  10028. Ext.Error.raise({
  10029. sourceClass: 'Ext.DomQuery',
  10030. sourceMethod: 'jsSelect',
  10031. msg: subPath + ' is not a valid selector'
  10032. });
  10033. }
  10034. } else {
  10035. setupEscapes(subPath);
  10036. }
  10037. result = cache[subPath](root);
  10038. if(result && result != document){
  10039. results = results.concat(result);
  10040. }
  10041. }
  10042. if(paths.length > 1){
  10043. return nodup(results);
  10044. }
  10045. return results;
  10046. },
  10047. isXml: function(el) {
  10048. var docEl = (el ? el.ownerDocument || el : 0).documentElement;
  10049. return docEl ? docEl.nodeName !== "HTML" : false;
  10050. },
  10051. select : document.querySelectorAll ? function(path, root, type) {
  10052. root = root || document;
  10053. if (!Ext.DomQuery.isXml(root)) {
  10054. try {
  10055. if (root.parentNode && (root.nodeType !== 9) && path.indexOf(',') === -1 && !startIdRe.test(path)) {
  10056. path = '#' + Ext.escapeId(Ext.id(root)) + ' ' + path;
  10057. root = root.parentNode;
  10058. }
  10059. return Ext.Array.toArray(root.querySelectorAll(path));
  10060. }
  10061. catch (e) {
  10062. }
  10063. }
  10064. return Ext.DomQuery.jsSelect.call(this, path, root, type);
  10065. } : function(path, root, type) {
  10066. return Ext.DomQuery.jsSelect.call(this, path, root, type);
  10067. },
  10068. selectNode : function(path, root){
  10069. return Ext.DomQuery.select(path, root)[0];
  10070. },
  10071. selectValue : function(path, root, defaultValue){
  10072. path = path.replace(trimRe, "");
  10073. if (!valueCache[path]) {
  10074. valueCache[path] = Ext.DomQuery.compile(path, "select");
  10075. } else {
  10076. setupEscapes(path);
  10077. }
  10078. var n = valueCache[path](root),
  10079. v;
  10080. n = n[0] ? n[0] : n;
  10081. if (typeof n.normalize == 'function') {
  10082. n.normalize();
  10083. }
  10084. v = (n && n.firstChild ? n.firstChild.nodeValue : null);
  10085. return ((v === null||v === undefined||v==='') ? defaultValue : v);
  10086. },
  10087. selectNumber : function(path, root, defaultValue){
  10088. var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
  10089. return parseFloat(v);
  10090. },
  10091. is : function(el, ss){
  10092. if(typeof el == "string"){
  10093. el = document.getElementById(el);
  10094. }
  10095. var isArray = Ext.isArray(el),
  10096. result = Ext.DomQuery.filter(isArray ? el : [el], ss);
  10097. return isArray ? (result.length == el.length) : (result.length > 0);
  10098. },
  10099. filter : function(els, ss, nonMatches){
  10100. ss = ss.replace(trimRe, "");
  10101. if (!simpleCache[ss]) {
  10102. simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
  10103. } else {
  10104. setupEscapes(ss);
  10105. }
  10106. var result = simpleCache[ss](els);
  10107. return nonMatches ? quickDiff(result, els) : result;
  10108. },
  10109. matchers : [{
  10110. re: /^\.([\w\-\\]+)/,
  10111. select: 'n = byClassName(n, " {1} ");'
  10112. }, {
  10113. re: /^\:([\w\-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
  10114. select: 'n = byPseudo(n, "{1}", "{2}");'
  10115. },{
  10116. re: /^(?:([\[\{])(?:@)?([\w\-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
  10117. select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
  10118. }, {
  10119. re: /^#([\w\-\\]+)/,
  10120. select: 'n = byId(n, "{1}");'
  10121. },{
  10122. re: /^@([\w\-]+)/,
  10123. select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
  10124. }
  10125. ],
  10126. operators : {
  10127. "=" : function(a, v){
  10128. return a == v;
  10129. },
  10130. "!=" : function(a, v){
  10131. return a != v;
  10132. },
  10133. "^=" : function(a, v){
  10134. return a && a.substr(0, v.length) == v;
  10135. },
  10136. "$=" : function(a, v){
  10137. return a && a.substr(a.length-v.length) == v;
  10138. },
  10139. "*=" : function(a, v){
  10140. return a && a.indexOf(v) !== -1;
  10141. },
  10142. "%=" : function(a, v){
  10143. return (a % v) == 0;
  10144. },
  10145. "|=" : function(a, v){
  10146. return a && (a == v || a.substr(0, v.length+1) == v+'-');
  10147. },
  10148. "~=" : function(a, v){
  10149. return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
  10150. }
  10151. },
  10152. pseudos : {
  10153. "first-child" : function(c){
  10154. var r = [], ri = -1, n,
  10155. i, ci;
  10156. for(i = 0; (ci = n = c[i]); i++){
  10157. while((n = n.previousSibling) && n.nodeType != 1);
  10158. if(!n){
  10159. r[++ri] = ci;
  10160. }
  10161. }
  10162. return r;
  10163. },
  10164. "last-child" : function(c){
  10165. var r = [], ri = -1, n,
  10166. i, ci;
  10167. for(i = 0; (ci = n = c[i]); i++){
  10168. while((n = n.nextSibling) && n.nodeType != 1);
  10169. if(!n){
  10170. r[++ri] = ci;
  10171. }
  10172. }
  10173. return r;
  10174. },
  10175. "nth-child" : function(c, a) {
  10176. var r = [], ri = -1,
  10177. m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),
  10178. f = (m[1] || 1) - 0, l = m[2] - 0,
  10179. i, n, j, cn, pn;
  10180. for(i = 0; n = c[i]; i++){
  10181. pn = n.parentNode;
  10182. if (batch != pn._batch) {
  10183. j = 0;
  10184. for(cn = pn.firstChild; cn; cn = cn.nextSibling){
  10185. if(cn.nodeType == 1){
  10186. cn.nodeIndex = ++j;
  10187. }
  10188. }
  10189. pn._batch = batch;
  10190. }
  10191. if (f == 1) {
  10192. if (l == 0 || n.nodeIndex == l){
  10193. r[++ri] = n;
  10194. }
  10195. } else if ((n.nodeIndex + l) % f == 0){
  10196. r[++ri] = n;
  10197. }
  10198. }
  10199. return r;
  10200. },
  10201. "only-child" : function(c){
  10202. var r = [], ri = -1,
  10203. i, ci;
  10204. for(i = 0; ci = c[i]; i++){
  10205. if(!prev(ci) && !next(ci)){
  10206. r[++ri] = ci;
  10207. }
  10208. }
  10209. return r;
  10210. },
  10211. "empty" : function(c){
  10212. var r = [], ri = -1,
  10213. i, ci, cns, j, cn, empty;
  10214. for(i = 0, ci; ci = c[i]; i++){
  10215. cns = ci.childNodes;
  10216. j = 0;
  10217. empty = true;
  10218. while(cn = cns[j]){
  10219. ++j;
  10220. if(cn.nodeType == 1 || cn.nodeType == 3){
  10221. empty = false;
  10222. break;
  10223. }
  10224. }
  10225. if(empty){
  10226. r[++ri] = ci;
  10227. }
  10228. }
  10229. return r;
  10230. },
  10231. "contains" : function(c, v){
  10232. var r = [], ri = -1,
  10233. i, ci;
  10234. for(i = 0; ci = c[i]; i++){
  10235. if((ci.textContent||ci.innerText||ci.text||'').indexOf(v) != -1){
  10236. r[++ri] = ci;
  10237. }
  10238. }
  10239. return r;
  10240. },
  10241. "nodeValue" : function(c, v){
  10242. var r = [], ri = -1,
  10243. i, ci;
  10244. for(i = 0; ci = c[i]; i++){
  10245. if(ci.firstChild && ci.firstChild.nodeValue == v){
  10246. r[++ri] = ci;
  10247. }
  10248. }
  10249. return r;
  10250. },
  10251. "checked" : function(c){
  10252. var r = [], ri = -1,
  10253. i, ci;
  10254. for(i = 0; ci = c[i]; i++){
  10255. if(ci.checked == true){
  10256. r[++ri] = ci;
  10257. }
  10258. }
  10259. return r;
  10260. },
  10261. "not" : function(c, ss){
  10262. return Ext.DomQuery.filter(c, ss, true);
  10263. },
  10264. "any" : function(c, selectors){
  10265. var ss = selectors.split('|'),
  10266. r = [], ri = -1, s,
  10267. i, ci, j;
  10268. for(i = 0; ci = c[i]; i++){
  10269. for(j = 0; s = ss[j]; j++){
  10270. if(Ext.DomQuery.is(ci, s)){
  10271. r[++ri] = ci;
  10272. break;
  10273. }
  10274. }
  10275. }
  10276. return r;
  10277. },
  10278. "odd" : function(c){
  10279. return this["nth-child"](c, "odd");
  10280. },
  10281. "even" : function(c){
  10282. return this["nth-child"](c, "even");
  10283. },
  10284. "nth" : function(c, a){
  10285. return c[a-1] || [];
  10286. },
  10287. "first" : function(c){
  10288. return c[0] || [];
  10289. },
  10290. "last" : function(c){
  10291. return c[c.length-1] || [];
  10292. },
  10293. "has" : function(c, ss){
  10294. var s = Ext.DomQuery.select,
  10295. r = [], ri = -1,
  10296. i, ci;
  10297. for(i = 0; ci = c[i]; i++){
  10298. if(s(ss, ci).length > 0){
  10299. r[++ri] = ci;
  10300. }
  10301. }
  10302. return r;
  10303. },
  10304. "next" : function(c, ss){
  10305. var is = Ext.DomQuery.is,
  10306. r = [], ri = -1,
  10307. i, ci, n;
  10308. for(i = 0; ci = c[i]; i++){
  10309. n = next(ci);
  10310. if(n && is(n, ss)){
  10311. r[++ri] = ci;
  10312. }
  10313. }
  10314. return r;
  10315. },
  10316. "prev" : function(c, ss){
  10317. var is = Ext.DomQuery.is,
  10318. r = [], ri = -1,
  10319. i, ci, n;
  10320. for(i = 0; ci = c[i]; i++){
  10321. n = prev(ci);
  10322. if(n && is(n, ss)){
  10323. r[++ri] = ci;
  10324. }
  10325. }
  10326. return r;
  10327. }
  10328. }
  10329. };
  10330. }());
  10331. Ext.query = Ext.DomQuery.select;
  10332. //@tag dom,core
  10333. //@require Query.js
  10334. //@define Ext.dom.Element
  10335. //@require Ext.dom.AbstractElement
  10336. (function() {
  10337. var HIDDEN = 'hidden',
  10338. DOC = document,
  10339. VISIBILITY = "visibility",
  10340. DISPLAY = "display",
  10341. NONE = "none",
  10342. XMASKED = Ext.baseCSSPrefix + "masked",
  10343. XMASKEDRELATIVE = Ext.baseCSSPrefix + "masked-relative",
  10344. EXTELMASKMSG = Ext.baseCSSPrefix + "mask-msg",
  10345. bodyRe = /^body/i,
  10346. visFly,
  10347. noBoxAdjust = Ext.isStrict ? {
  10348. select: 1
  10349. }: {
  10350. input: 1,
  10351. select: 1,
  10352. textarea: 1
  10353. },
  10354. isScrolled = function(c) {
  10355. var r = [], ri = -1,
  10356. i, ci;
  10357. for (i = 0; ci = c[i]; i++) {
  10358. if (ci.scrollTop > 0 || ci.scrollLeft > 0) {
  10359. r[++ri] = ci;
  10360. }
  10361. }
  10362. return r;
  10363. },
  10364. Element = Ext.define('Ext.dom.Element', {
  10365. extend: 'Ext.dom.AbstractElement',
  10366. alternateClassName: ['Ext.Element', 'Ext.core.Element'],
  10367. addUnits: function() {
  10368. return this.self.addUnits.apply(this.self, arguments);
  10369. },
  10370. focus: function(defer, dom) {
  10371. var me = this,
  10372. scrollTop,
  10373. body;
  10374. dom = dom || me.dom;
  10375. body = (dom.ownerDocument || DOC).body || DOC.body;
  10376. try {
  10377. if (Number(defer)) {
  10378. Ext.defer(me.focus, defer, me, [null, dom]);
  10379. } else {
  10380. if (dom.offsetHeight > Element.getViewHeight()) {
  10381. scrollTop = body.scrollTop;
  10382. }
  10383. dom.focus();
  10384. if (scrollTop !== undefined) {
  10385. body.scrollTop = scrollTop;
  10386. }
  10387. }
  10388. } catch(e) {
  10389. }
  10390. return me;
  10391. },
  10392. blur: function() {
  10393. try {
  10394. this.dom.blur();
  10395. } catch(e) {
  10396. }
  10397. return this;
  10398. },
  10399. isBorderBox: function() {
  10400. var box = Ext.isBorderBox;
  10401. if (box) {
  10402. box = !((this.dom.tagName || "").toLowerCase() in noBoxAdjust);
  10403. }
  10404. return box;
  10405. },
  10406. hover: function(overFn, outFn, scope, options) {
  10407. var me = this;
  10408. me.on('mouseenter', overFn, scope || me.dom, options);
  10409. me.on('mouseleave', outFn, scope || me.dom, options);
  10410. return me;
  10411. },
  10412. getAttributeNS: function(ns, name) {
  10413. return this.getAttribute(name, ns);
  10414. },
  10415. getAttribute: (Ext.isIE && !(Ext.isIE9 && DOC.documentMode === 9)) ?
  10416. function(name, ns) {
  10417. var d = this.dom,
  10418. type;
  10419. if (ns) {
  10420. type = typeof d[ns + ":" + name];
  10421. if (type != 'undefined' && type != 'unknown') {
  10422. return d[ns + ":" + name] || null;
  10423. }
  10424. return null;
  10425. }
  10426. if (name === "for") {
  10427. name = "htmlFor";
  10428. }
  10429. return d[name] || null;
  10430. } : function(name, ns) {
  10431. var d = this.dom;
  10432. if (ns) {
  10433. return d.getAttributeNS(ns, name) || d.getAttribute(ns + ":" + name);
  10434. }
  10435. return d.getAttribute(name) || d[name] || null;
  10436. },
  10437. cacheScrollValues: function() {
  10438. var me = this,
  10439. scrolledDescendants,
  10440. el, i,
  10441. scrollValues = [],
  10442. result = function() {
  10443. for (i = 0; i < scrolledDescendants.length; i++) {
  10444. el = scrolledDescendants[i];
  10445. el.scrollLeft = scrollValues[i][0];
  10446. el.scrollTop = scrollValues[i][1];
  10447. }
  10448. };
  10449. if (!Ext.DomQuery.pseudos.isScrolled) {
  10450. Ext.DomQuery.pseudos.isScrolled = isScrolled;
  10451. }
  10452. scrolledDescendants = me.query(':isScrolled');
  10453. for (i = 0; i < scrolledDescendants.length; i++) {
  10454. el = scrolledDescendants[i];
  10455. scrollValues[i] = [el.scrollLeft, el.scrollTop];
  10456. }
  10457. return result;
  10458. },
  10459. autoBoxAdjust: true,
  10460. isVisible : function(deep) {
  10461. var me = this,
  10462. dom = me.dom,
  10463. stopNode = dom.ownerDocument.documentElement;
  10464. if (!visFly) {
  10465. visFly = new Element.Fly();
  10466. }
  10467. while (dom !== stopNode) {
  10468. if (!dom || dom.nodeType === 11 || (visFly.attach(dom)).isStyle(VISIBILITY, HIDDEN) || visFly.isStyle(DISPLAY, NONE)) {
  10469. return false;
  10470. }
  10471. if (!deep) {
  10472. break;
  10473. }
  10474. dom = dom.parentNode;
  10475. }
  10476. return true;
  10477. },
  10478. isDisplayed : function() {
  10479. return !this.isStyle(DISPLAY, NONE);
  10480. },
  10481. enableDisplayMode : function(display) {
  10482. var me = this;
  10483. me.setVisibilityMode(Element.DISPLAY);
  10484. if (!Ext.isEmpty(display)) {
  10485. (me.$cache || me.getCache()).data.originalDisplay = display;
  10486. }
  10487. return me;
  10488. },
  10489. mask : function(msg, msgCls , elHeight) {
  10490. var me = this,
  10491. dom = me.dom,
  10492. setExpression = dom.style.setExpression,
  10493. data = (me.$cache || me.getCache()).data,
  10494. maskEl = data.maskEl,
  10495. maskMsg = data.maskMsg;
  10496. if (!(bodyRe.test(dom.tagName) && me.getStyle('position') == 'static')) {
  10497. me.addCls(XMASKEDRELATIVE);
  10498. }
  10499. if (maskEl) {
  10500. maskEl.remove();
  10501. }
  10502. if (maskMsg) {
  10503. maskMsg.remove();
  10504. }
  10505. Ext.DomHelper.append(dom, [{
  10506. cls : Ext.baseCSSPrefix + "mask"
  10507. }, {
  10508. cls : msgCls ? EXTELMASKMSG + " " + msgCls : EXTELMASKMSG,
  10509. cn : {
  10510. tag: 'div',
  10511. html: msg || ''
  10512. }
  10513. }]);
  10514. maskMsg = Ext.get(dom.lastChild);
  10515. maskEl = Ext.get(maskMsg.dom.previousSibling);
  10516. data.maskMsg = maskMsg;
  10517. data.maskEl = maskEl;
  10518. me.addCls(XMASKED);
  10519. maskEl.setDisplayed(true);
  10520. if (typeof msg == 'string') {
  10521. maskMsg.setDisplayed(true);
  10522. maskMsg.center(me);
  10523. } else {
  10524. maskMsg.setDisplayed(false);
  10525. }
  10526. if (!Ext.supports.IncludePaddingInWidthCalculation && setExpression) {
  10527. try {
  10528. maskEl.dom.style.setExpression('width', 'this.parentNode.clientWidth + "px"');
  10529. } catch (e) {}
  10530. }
  10531. if (!Ext.supports.IncludePaddingInHeightCalculation && setExpression) {
  10532. try {
  10533. maskEl.dom.style.setExpression('height', 'this.parentNode.' + (dom == DOC.body ? 'scrollHeight' : 'offsetHeight') + ' + "px"');
  10534. } catch (e) {}
  10535. }
  10536. else if (Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && me.getStyle('height') == 'auto') {
  10537. maskEl.setSize(undefined, elHeight || me.getHeight());
  10538. }
  10539. return maskEl;
  10540. },
  10541. unmask : function() {
  10542. var me = this,
  10543. data = (me.$cache || me.getCache()).data,
  10544. maskEl = data.maskEl,
  10545. maskMsg = data.maskMsg,
  10546. style;
  10547. if (maskEl) {
  10548. style = maskEl.dom.style;
  10549. if (style.clearExpression) {
  10550. style.clearExpression('width');
  10551. style.clearExpression('height');
  10552. }
  10553. if (maskEl) {
  10554. maskEl.remove();
  10555. delete data.maskEl;
  10556. }
  10557. if (maskMsg) {
  10558. maskMsg.remove();
  10559. delete data.maskMsg;
  10560. }
  10561. me.removeCls([XMASKED, XMASKEDRELATIVE]);
  10562. }
  10563. },
  10564. isMasked : function() {
  10565. var me = this,
  10566. data = (me.$cache || me.getCache()).data,
  10567. maskEl = data.maskEl,
  10568. maskMsg = data.maskMsg,
  10569. hasMask = false;
  10570. if (maskEl && maskEl.isVisible()) {
  10571. if (maskMsg) {
  10572. maskMsg.center(me);
  10573. }
  10574. hasMask = true;
  10575. }
  10576. return hasMask;
  10577. },
  10578. createShim : function() {
  10579. var el = DOC.createElement('iframe'),
  10580. shim;
  10581. el.frameBorder = '0';
  10582. el.className = Ext.baseCSSPrefix + 'shim';
  10583. el.src = Ext.SSL_SECURE_URL;
  10584. shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
  10585. shim.autoBoxAdjust = false;
  10586. return shim;
  10587. },
  10588. addKeyListener : function(key, fn, scope){
  10589. var config;
  10590. if(typeof key != 'object' || Ext.isArray(key)){
  10591. config = {
  10592. target: this,
  10593. key: key,
  10594. fn: fn,
  10595. scope: scope
  10596. };
  10597. }else{
  10598. config = {
  10599. target: this,
  10600. key : key.key,
  10601. shift : key.shift,
  10602. ctrl : key.ctrl,
  10603. alt : key.alt,
  10604. fn: fn,
  10605. scope: scope
  10606. };
  10607. }
  10608. return new Ext.util.KeyMap(config);
  10609. },
  10610. addKeyMap : function(config) {
  10611. return new Ext.util.KeyMap(Ext.apply({
  10612. target: this
  10613. }, config));
  10614. },
  10615. on: function(eventName, fn, scope, options) {
  10616. Ext.EventManager.on(this, eventName, fn, scope || this, options);
  10617. return this;
  10618. },
  10619. un: function(eventName, fn, scope) {
  10620. Ext.EventManager.un(this, eventName, fn, scope || this);
  10621. return this;
  10622. },
  10623. removeAllListeners: function() {
  10624. Ext.EventManager.removeAll(this);
  10625. return this;
  10626. },
  10627. purgeAllListeners: function() {
  10628. Ext.EventManager.purgeElement(this);
  10629. return this;
  10630. }
  10631. }, function() {
  10632. var EC = Ext.cache,
  10633. El = this,
  10634. AbstractElement = Ext.dom.AbstractElement,
  10635. focusRe = /a|button|embed|iframe|img|input|object|select|textarea/i,
  10636. nonSpaceRe = /\S/,
  10637. scriptTagRe = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig,
  10638. replaceScriptTagRe = /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,
  10639. srcRe = /\ssrc=([\'\"])(.*?)\1/i,
  10640. typeRe = /\stype=([\'\"])(.*?)\1/i,
  10641. useDocForId = !(Ext.isIE6 || Ext.isIE7 || Ext.isIE8);
  10642. 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>';
  10643. function garbageCollect() {
  10644. if (!Ext.enableGarbageCollector) {
  10645. clearInterval(El.collectorThreadId);
  10646. } else {
  10647. var eid,
  10648. d,
  10649. o,
  10650. t;
  10651. for (eid in EC) {
  10652. if (!EC.hasOwnProperty(eid)) {
  10653. continue;
  10654. }
  10655. o = EC[eid];
  10656. if (o.skipGarbageCollection) {
  10657. continue;
  10658. }
  10659. d = o.dom;
  10660. if (!d.parentNode || (!d.offsetParent && !Ext.getElementById(eid))) {
  10661. if (d && Ext.enableListenerCollection) {
  10662. Ext.EventManager.removeAll(d);
  10663. }
  10664. delete EC[eid];
  10665. }
  10666. }
  10667. if (Ext.isIE) {
  10668. t = {};
  10669. for (eid in EC) {
  10670. if (!EC.hasOwnProperty(eid)) {
  10671. continue;
  10672. }
  10673. t[eid] = EC[eid];
  10674. }
  10675. EC = Ext.cache = t;
  10676. }
  10677. }
  10678. }
  10679. El.collectorThreadId = setInterval(garbageCollect, 30000);
  10680. El.addMethods({
  10681. monitorMouseLeave: function(delay, handler, scope) {
  10682. var me = this,
  10683. timer,
  10684. listeners = {
  10685. mouseleave: function(e) {
  10686. timer = setTimeout(Ext.Function.bind(handler, scope||me, [e]), delay);
  10687. },
  10688. mouseenter: function() {
  10689. clearTimeout(timer);
  10690. },
  10691. freezeEvent: true
  10692. };
  10693. me.on(listeners);
  10694. return listeners;
  10695. },
  10696. swallowEvent : function(eventName, preventDefault) {
  10697. var me = this,
  10698. e, eLen;
  10699. function fn(e) {
  10700. e.stopPropagation();
  10701. if (preventDefault) {
  10702. e.preventDefault();
  10703. }
  10704. }
  10705. if (Ext.isArray(eventName)) {
  10706. eLen = eventName.length;
  10707. for (e = 0; e < eLen; e++) {
  10708. me.on(eventName[e], fn);
  10709. }
  10710. return me;
  10711. }
  10712. me.on(eventName, fn);
  10713. return me;
  10714. },
  10715. relayEvent : function(eventName, observable) {
  10716. this.on(eventName, function(e) {
  10717. observable.fireEvent(eventName, e);
  10718. });
  10719. },
  10720. clean : function(forceReclean) {
  10721. var me = this,
  10722. dom = me.dom,
  10723. data = (me.$cache || me.getCache()).data,
  10724. n = dom.firstChild,
  10725. ni = -1,
  10726. nx;
  10727. if (data.isCleaned && forceReclean !== true) {
  10728. return me;
  10729. }
  10730. while (n) {
  10731. nx = n.nextSibling;
  10732. if (n.nodeType == 3) {
  10733. if (!(nonSpaceRe.test(n.nodeValue))) {
  10734. dom.removeChild(n);
  10735. } else if (nx && nx.nodeType == 3) {
  10736. n.appendData(Ext.String.trim(nx.data));
  10737. dom.removeChild(nx);
  10738. nx = n.nextSibling;
  10739. n.nodeIndex = ++ni;
  10740. }
  10741. } else {
  10742. Ext.fly(n).clean();
  10743. n.nodeIndex = ++ni;
  10744. }
  10745. n = nx;
  10746. }
  10747. data.isCleaned = true;
  10748. return me;
  10749. },
  10750. load : function(options) {
  10751. this.getLoader().load(options);
  10752. return this;
  10753. },
  10754. getLoader : function() {
  10755. var me = this,
  10756. data = (me.$cache || me.getCache()).data,
  10757. loader = data.loader;
  10758. if (!loader) {
  10759. data.loader = loader = new Ext.ElementLoader({
  10760. target: me
  10761. });
  10762. }
  10763. return loader;
  10764. },
  10765. syncContent: function(source) {
  10766. source = Ext.getDom(source);
  10767. var me = this,
  10768. sourceNodes = source.childNodes,
  10769. sourceLen = sourceNodes.length,
  10770. dest = me.dom,
  10771. destNodes = dest.childNodes,
  10772. destLen = destNodes.length,
  10773. i, destNode, sourceNode,
  10774. nodeType;
  10775. dest.style.cssText = source.style.cssText;
  10776. dest.className = source.className;
  10777. if (sourceLen !== destLen) {
  10778. source.innerHTML = dest.innerHTML;
  10779. return;
  10780. }
  10781. for (i = 0; i < sourceLen; i++) {
  10782. sourceNode = sourceNodes[i];
  10783. destNode = destNodes[i];
  10784. nodeType = sourceNode.nodeType;
  10785. if (nodeType !== destNode.nodeType || (nodeType === 1 && sourceNode.tagName !== destNode.tagName)) {
  10786. dest.innerHTML = source.innerHTML;
  10787. return;
  10788. }
  10789. if (nodeType === 3) {
  10790. destNode.data = sourceNode.data;
  10791. }
  10792. else {
  10793. if (sourceNode.id && destNode.id !== sourceNode.id) {
  10794. destNode.id = sourceNode.id;
  10795. }
  10796. destNode.style.cssText = sourceNode.style.cssText;
  10797. destNode.className = sourceNode.className;
  10798. Ext.fly(destNode).syncContent(sourceNode);
  10799. }
  10800. }
  10801. },
  10802. update : function(html, loadScripts, callback) {
  10803. var me = this,
  10804. id,
  10805. dom,
  10806. interval;
  10807. if (!me.dom) {
  10808. return me;
  10809. }
  10810. html = html || '';
  10811. dom = me.dom;
  10812. if (loadScripts !== true) {
  10813. dom.innerHTML = html;
  10814. Ext.callback(callback, me);
  10815. return me;
  10816. }
  10817. id = Ext.id();
  10818. html += '<span id="' + id + '"></span>';
  10819. interval = setInterval(function() {
  10820. var hd,
  10821. match,
  10822. attrs,
  10823. srcMatch,
  10824. typeMatch,
  10825. el,
  10826. s;
  10827. if (!(el = DOC.getElementById(id))) {
  10828. return false;
  10829. }
  10830. clearInterval(interval);
  10831. Ext.removeNode(el);
  10832. hd = Ext.getHead().dom;
  10833. while ((match = scriptTagRe.exec(html))) {
  10834. attrs = match[1];
  10835. srcMatch = attrs ? attrs.match(srcRe) : false;
  10836. if (srcMatch && srcMatch[2]) {
  10837. s = DOC.createElement("script");
  10838. s.src = srcMatch[2];
  10839. typeMatch = attrs.match(typeRe);
  10840. if (typeMatch && typeMatch[2]) {
  10841. s.type = typeMatch[2];
  10842. }
  10843. hd.appendChild(s);
  10844. } else if (match[2] && match[2].length > 0) {
  10845. if (window.execScript) {
  10846. window.execScript(match[2]);
  10847. } else {
  10848. window.eval(match[2]);
  10849. }
  10850. }
  10851. }
  10852. Ext.callback(callback, me);
  10853. }, 20);
  10854. dom.innerHTML = html.replace(replaceScriptTagRe, '');
  10855. return me;
  10856. },
  10857. removeAllListeners : function() {
  10858. this.removeAnchor();
  10859. Ext.EventManager.removeAll(this.dom);
  10860. return this;
  10861. },
  10862. createProxy : function(config, renderTo, matchBox) {
  10863. config = (typeof config == 'object') ? config : {tag : "div", cls: config};
  10864. var me = this,
  10865. proxy = renderTo ? Ext.DomHelper.append(renderTo, config, true) :
  10866. Ext.DomHelper.insertBefore(me.dom, config, true);
  10867. proxy.setVisibilityMode(Element.DISPLAY);
  10868. proxy.hide();
  10869. if (matchBox && me.setBox && me.getBox) {
  10870. proxy.setBox(me.getBox());
  10871. }
  10872. return proxy;
  10873. },
  10874. getScopeParent: function() {
  10875. var parent = this.dom.parentNode;
  10876. if (Ext.scopeResetCSS) {
  10877. parent = parent.parentNode;
  10878. if (!Ext.supports.CSS3LinearGradient || !Ext.supports.CSS3BorderRadius) {
  10879. parent = parent.parentNode;
  10880. }
  10881. }
  10882. return parent;
  10883. },
  10884. needsTabIndex: function() {
  10885. if (this.dom) {
  10886. if ((this.dom.nodeName === 'a') && (!this.dom.href)) {
  10887. return true;
  10888. }
  10889. return !focusRe.test(this.dom.nodeName);
  10890. }
  10891. },
  10892. focusable: function () {
  10893. var dom = this.dom,
  10894. nodeName = dom.nodeName,
  10895. canFocus = false;
  10896. if (!dom.disabled) {
  10897. if (focusRe.test(nodeName)) {
  10898. if ((nodeName !== 'a') || dom.href) {
  10899. canFocus = true;
  10900. }
  10901. } else {
  10902. canFocus = !isNaN(dom.tabIndex);
  10903. }
  10904. }
  10905. return canFocus && this.isVisible(true);
  10906. }
  10907. });
  10908. if (Ext.isIE) {
  10909. El.prototype.getById = function (id, asDom) {
  10910. var dom = this.dom,
  10911. cacheItem, el, ret;
  10912. if (dom) {
  10913. el = (useDocForId && DOC.getElementById(id)) || dom.all[id];
  10914. if (el) {
  10915. if (asDom) {
  10916. ret = el;
  10917. } else {
  10918. cacheItem = EC[id];
  10919. if (cacheItem && cacheItem.el) {
  10920. ret = Ext.updateCacheEntry(cacheItem, el).el;
  10921. } else {
  10922. ret = new Element(el);
  10923. }
  10924. }
  10925. return ret;
  10926. }
  10927. }
  10928. return asDom ? Ext.getDom(id) : El.get(id);
  10929. };
  10930. }
  10931. El.createAlias({
  10932. addListener: 'on',
  10933. removeListener: 'un',
  10934. clearListeners: 'removeAllListeners'
  10935. });
  10936. El.Fly = AbstractElement.Fly = new Ext.Class({
  10937. extend: El,
  10938. constructor: function(dom) {
  10939. this.dom = dom;
  10940. },
  10941. attach: AbstractElement.Fly.prototype.attach
  10942. });
  10943. if (Ext.isIE) {
  10944. Ext.getElementById = function (id) {
  10945. var el = DOC.getElementById(id),
  10946. detachedBodyEl;
  10947. if (!el && (detachedBodyEl = AbstractElement.detachedBodyEl)) {
  10948. el = detachedBodyEl.dom.all[id];
  10949. }
  10950. return el;
  10951. };
  10952. } else if (!DOC.querySelector) {
  10953. Ext.getDetachedBody = Ext.getBody;
  10954. Ext.getElementById = function (id) {
  10955. return DOC.getElementById(id);
  10956. };
  10957. }
  10958. });
  10959. }());
  10960. //@tag dom,core
  10961. //@require Element.js
  10962. //@define Ext.dom.Element-alignment
  10963. //@define Ext.dom.Element
  10964. Ext.dom.Element.override((function() {
  10965. var doc = document,
  10966. win = window,
  10967. alignRe = /^([a-z]+)-([a-z]+)(\?)?$/,
  10968. round = Math.round;
  10969. return {
  10970. getAnchorXY: function(anchor, local, mySize) {
  10971. anchor = (anchor || "tl").toLowerCase();
  10972. mySize = mySize || {};
  10973. var me = this,
  10974. isViewport = me.dom == doc.body || me.dom == doc,
  10975. myWidth = mySize.width || isViewport ? Ext.dom.Element.getViewWidth() : me.getWidth(),
  10976. myHeight = mySize.height || isViewport ? Ext.dom.Element.getViewHeight() : me.getHeight(),
  10977. xy,
  10978. myPos = me.getXY(),
  10979. scroll = me.getScroll(),
  10980. extraX = isViewport ? scroll.left : !local ? myPos[0] : 0,
  10981. extraY = isViewport ? scroll.top : !local ? myPos[1] : 0;
  10982. switch (anchor) {
  10983. case 'tl' : xy = [ 0, 0];
  10984. break;
  10985. case 'bl' : xy = [ 0, myHeight];
  10986. break;
  10987. case 'tr' : xy = [ myWidth, 0];
  10988. break;
  10989. case 'c' : xy = [ round(myWidth * 0.5), round(myHeight * 0.5)];
  10990. break;
  10991. case 't' : xy = [ round(myWidth * 0.5), 0];
  10992. break;
  10993. case 'l' : xy = [ 0, round(myHeight * 0.5)];
  10994. break;
  10995. case 'r' : xy = [ myWidth, round(myHeight * 0.5)];
  10996. break;
  10997. case 'b' : xy = [ round(myWidth * 0.5), myHeight];
  10998. break;
  10999. case 'br' : xy = [ myWidth, myHeight];
  11000. }
  11001. return [xy[0] + extraX, xy[1] + extraY];
  11002. },
  11003. getAlignToXY : function(alignToEl, posSpec, offset) {
  11004. alignToEl = Ext.get(alignToEl);
  11005. if (!alignToEl || !alignToEl.dom) {
  11006. }
  11007. offset = offset || [0,0];
  11008. posSpec = (!posSpec || posSpec == "?" ? "tl-bl?" : (!(/-/).test(posSpec) && posSpec !== "" ? "tl-" + posSpec : posSpec || "tl-bl")).toLowerCase();
  11009. var me = this,
  11010. myPosition,
  11011. alignToElPosition,
  11012. x,
  11013. y,
  11014. myWidth,
  11015. myHeight,
  11016. alignToElRegion,
  11017. viewportWidth = Ext.dom.Element.getViewWidth() - 10,
  11018. viewportHeight = Ext.dom.Element.getViewHeight() - 10,
  11019. p1y,
  11020. p1x,
  11021. p2y,
  11022. p2x,
  11023. swapY,
  11024. swapX,
  11025. docElement = doc.documentElement,
  11026. docBody = doc.body,
  11027. scrollX = (docElement.scrollLeft || docBody.scrollLeft || 0),
  11028. scrollY = (docElement.scrollTop || docBody.scrollTop || 0),
  11029. constrain,
  11030. align1,
  11031. align2,
  11032. alignMatch = posSpec.match(alignRe);
  11033. align1 = alignMatch[1];
  11034. align2 = alignMatch[2];
  11035. constrain = !!alignMatch[3];
  11036. myPosition = me.getAnchorXY(align1, true);
  11037. alignToElPosition = alignToEl.getAnchorXY(align2, false);
  11038. x = alignToElPosition[0] - myPosition[0] + offset[0];
  11039. y = alignToElPosition[1] - myPosition[1] + offset[1];
  11040. if (constrain) {
  11041. myWidth = me.getWidth();
  11042. myHeight = me.getHeight();
  11043. alignToElRegion = alignToEl.getRegion();
  11044. p1y = align1.charAt(0);
  11045. p1x = align1.charAt(align1.length - 1);
  11046. p2y = align2.charAt(0);
  11047. p2x = align2.charAt(align2.length - 1);
  11048. swapY = ((p1y == "t" && p2y == "b") || (p1y == "b" && p2y == "t"));
  11049. swapX = ((p1x == "r" && p2x == "l") || (p1x == "l" && p2x == "r"));
  11050. if (x + myWidth > viewportWidth + scrollX) {
  11051. x = swapX ? alignToElRegion.left - myWidth : viewportWidth + scrollX - myWidth;
  11052. }
  11053. if (x < scrollX) {
  11054. x = swapX ? alignToElRegion.right : scrollX;
  11055. }
  11056. if (y + myHeight > viewportHeight + scrollY) {
  11057. y = swapY ? alignToElRegion.top - myHeight : viewportHeight + scrollY - myHeight;
  11058. }
  11059. if (y < scrollY) {
  11060. y = swapY ? alignToElRegion.bottom : scrollY;
  11061. }
  11062. }
  11063. return [x,y];
  11064. },
  11065. anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback) {
  11066. var me = this,
  11067. dom = me.dom,
  11068. scroll = !Ext.isEmpty(monitorScroll),
  11069. action = function() {
  11070. Ext.fly(dom).alignTo(el, alignment, offsets, animate);
  11071. Ext.callback(callback, Ext.fly(dom));
  11072. },
  11073. anchor = this.getAnchor();
  11074. this.removeAnchor();
  11075. Ext.apply(anchor, {
  11076. fn: action,
  11077. scroll: scroll
  11078. });
  11079. Ext.EventManager.onWindowResize(action, null);
  11080. if (scroll) {
  11081. Ext.EventManager.on(win, 'scroll', action, null,
  11082. {buffer: !isNaN(monitorScroll) ? monitorScroll : 50});
  11083. }
  11084. action.call(me);
  11085. return me;
  11086. },
  11087. removeAnchor : function() {
  11088. var me = this,
  11089. anchor = this.getAnchor();
  11090. if (anchor && anchor.fn) {
  11091. Ext.EventManager.removeResizeListener(anchor.fn);
  11092. if (anchor.scroll) {
  11093. Ext.EventManager.un(win, 'scroll', anchor.fn);
  11094. }
  11095. delete anchor.fn;
  11096. }
  11097. return me;
  11098. },
  11099. getAlignVector: function(el, spec, offset) {
  11100. var me = this,
  11101. myPos = me.getXY(),
  11102. alignedPos = me.getAlignToXY(el, spec, offset);
  11103. el = Ext.get(el);
  11104. alignedPos[0] -= myPos[0];
  11105. alignedPos[1] -= myPos[1];
  11106. return alignedPos;
  11107. },
  11108. alignTo: function(element, position, offsets, animate) {
  11109. var me = this;
  11110. return me.setXY(me.getAlignToXY(element, position, offsets),
  11111. me.anim && !!animate ? me.anim(animate) : false);
  11112. },
  11113. getConstrainVector: function(constrainTo, proposedPosition) {
  11114. if (!(constrainTo instanceof Ext.util.Region)) {
  11115. constrainTo = Ext.get(constrainTo).getViewRegion();
  11116. }
  11117. var thisRegion = this.getRegion(),
  11118. vector = [0, 0],
  11119. shadowSize = (this.shadow && !this.shadowDisabled) ? this.shadow.getShadowSize() : undefined,
  11120. overflowed = false;
  11121. if (proposedPosition) {
  11122. thisRegion.translateBy(proposedPosition[0] - thisRegion.x, proposedPosition[1] - thisRegion.y);
  11123. }
  11124. if (shadowSize) {
  11125. constrainTo.adjust(shadowSize[0], -shadowSize[1], -shadowSize[2], shadowSize[3]);
  11126. }
  11127. if (thisRegion.right > constrainTo.right) {
  11128. overflowed = true;
  11129. vector[0] = (constrainTo.right - thisRegion.right);
  11130. }
  11131. if (thisRegion.left + vector[0] < constrainTo.left) {
  11132. overflowed = true;
  11133. vector[0] = (constrainTo.left - thisRegion.left);
  11134. }
  11135. if (thisRegion.bottom > constrainTo.bottom) {
  11136. overflowed = true;
  11137. vector[1] = (constrainTo.bottom - thisRegion.bottom);
  11138. }
  11139. if (thisRegion.top + vector[1] < constrainTo.top) {
  11140. overflowed = true;
  11141. vector[1] = (constrainTo.top - thisRegion.top);
  11142. }
  11143. return overflowed ? vector : false;
  11144. },
  11145. getCenterXY : function(){
  11146. return this.getAlignToXY(doc, 'c-c');
  11147. },
  11148. center : function(centerIn){
  11149. return this.alignTo(centerIn || doc, 'c-c');
  11150. }
  11151. };
  11152. }()));
  11153. //@tag dom,core
  11154. //@require Ext.dom.Element-alignment
  11155. //@define Ext.dom.Element-anim
  11156. //@define Ext.dom.Element
  11157. Ext.dom.Element.override({
  11158. animate: function(config) {
  11159. var me = this,
  11160. listeners,
  11161. anim,
  11162. animId = me.dom.id || Ext.id(me.dom);
  11163. if (!Ext.fx.Manager.hasFxBlock(animId)) {
  11164. if (config.listeners) {
  11165. listeners = config.listeners;
  11166. delete config.listeners;
  11167. }
  11168. if (config.internalListeners) {
  11169. config.listeners = config.internalListeners;
  11170. delete config.internalListeners;
  11171. }
  11172. anim = new Ext.fx.Anim(me.anim(config));
  11173. if (listeners) {
  11174. anim.on(listeners);
  11175. }
  11176. Ext.fx.Manager.queueFx(anim);
  11177. }
  11178. return me;
  11179. },
  11180. anim: function(config) {
  11181. if (!Ext.isObject(config)) {
  11182. return (config) ? {} : false;
  11183. }
  11184. var me = this,
  11185. duration = config.duration || Ext.fx.Anim.prototype.duration,
  11186. easing = config.easing || 'ease',
  11187. animConfig;
  11188. if (config.stopAnimation) {
  11189. me.stopAnimation();
  11190. }
  11191. Ext.applyIf(config, Ext.fx.Manager.getFxDefaults(me.id));
  11192. Ext.fx.Manager.setFxDefaults(me.id, {
  11193. delay: 0
  11194. });
  11195. animConfig = {
  11196. target: me.dom,
  11197. remove: config.remove,
  11198. alternate: config.alternate || false,
  11199. duration: duration,
  11200. easing: easing,
  11201. callback: config.callback,
  11202. listeners: config.listeners,
  11203. iterations: config.iterations || 1,
  11204. scope: config.scope,
  11205. block: config.block,
  11206. concurrent: config.concurrent,
  11207. delay: config.delay || 0,
  11208. paused: true,
  11209. keyframes: config.keyframes,
  11210. from: config.from || {},
  11211. to: Ext.apply({}, config)
  11212. };
  11213. Ext.apply(animConfig.to, config.to);
  11214. delete animConfig.to.to;
  11215. delete animConfig.to.from;
  11216. delete animConfig.to.remove;
  11217. delete animConfig.to.alternate;
  11218. delete animConfig.to.keyframes;
  11219. delete animConfig.to.iterations;
  11220. delete animConfig.to.listeners;
  11221. delete animConfig.to.target;
  11222. delete animConfig.to.paused;
  11223. delete animConfig.to.callback;
  11224. delete animConfig.to.scope;
  11225. delete animConfig.to.duration;
  11226. delete animConfig.to.easing;
  11227. delete animConfig.to.concurrent;
  11228. delete animConfig.to.block;
  11229. delete animConfig.to.stopAnimation;
  11230. delete animConfig.to.delay;
  11231. return animConfig;
  11232. },
  11233. slideIn: function(anchor, obj, slideOut) {
  11234. var me = this,
  11235. elStyle = me.dom.style,
  11236. beforeAnim,
  11237. wrapAnim,
  11238. restoreScroll,
  11239. wrapDomParentNode;
  11240. anchor = anchor || "t";
  11241. obj = obj || {};
  11242. beforeAnim = function() {
  11243. var animScope = this,
  11244. listeners = obj.listeners,
  11245. box, originalStyles, anim, wrap;
  11246. if (!slideOut) {
  11247. me.fixDisplay();
  11248. }
  11249. box = me.getBox();
  11250. if ((anchor == 't' || anchor == 'b') && box.height === 0) {
  11251. box.height = me.dom.scrollHeight;
  11252. }
  11253. else if ((anchor == 'l' || anchor == 'r') && box.width === 0) {
  11254. box.width = me.dom.scrollWidth;
  11255. }
  11256. originalStyles = me.getStyles('width', 'height', 'left', 'right', 'top', 'bottom', 'position', 'z-index', true);
  11257. me.setSize(box.width, box.height);
  11258. if (obj.preserveScroll) {
  11259. restoreScroll = me.cacheScrollValues();
  11260. }
  11261. wrap = me.wrap({
  11262. id: Ext.id() + '-anim-wrap-for-' + me.id,
  11263. style: {
  11264. visibility: slideOut ? 'visible' : 'hidden'
  11265. }
  11266. });
  11267. wrapDomParentNode = wrap.dom.parentNode;
  11268. wrap.setPositioning(me.getPositioning());
  11269. if (wrap.isStyle('position', 'static')) {
  11270. wrap.position('relative');
  11271. }
  11272. me.clearPositioning('auto');
  11273. wrap.clip();
  11274. if (restoreScroll) {
  11275. restoreScroll();
  11276. }
  11277. me.setStyle({
  11278. visibility: '',
  11279. position: 'absolute'
  11280. });
  11281. if (slideOut) {
  11282. wrap.setSize(box.width, box.height);
  11283. }
  11284. switch (anchor) {
  11285. case 't':
  11286. anim = {
  11287. from: {
  11288. width: box.width + 'px',
  11289. height: '0px'
  11290. },
  11291. to: {
  11292. width: box.width + 'px',
  11293. height: box.height + 'px'
  11294. }
  11295. };
  11296. elStyle.bottom = '0px';
  11297. break;
  11298. case 'l':
  11299. anim = {
  11300. from: {
  11301. width: '0px',
  11302. height: box.height + 'px'
  11303. },
  11304. to: {
  11305. width: box.width + 'px',
  11306. height: box.height + 'px'
  11307. }
  11308. };
  11309. elStyle.right = '0px';
  11310. break;
  11311. case 'r':
  11312. anim = {
  11313. from: {
  11314. x: box.x + box.width,
  11315. width: '0px',
  11316. height: box.height + 'px'
  11317. },
  11318. to: {
  11319. x: box.x,
  11320. width: box.width + 'px',
  11321. height: box.height + 'px'
  11322. }
  11323. };
  11324. break;
  11325. case 'b':
  11326. anim = {
  11327. from: {
  11328. y: box.y + box.height,
  11329. width: box.width + 'px',
  11330. height: '0px'
  11331. },
  11332. to: {
  11333. y: box.y,
  11334. width: box.width + 'px',
  11335. height: box.height + 'px'
  11336. }
  11337. };
  11338. break;
  11339. case 'tl':
  11340. anim = {
  11341. from: {
  11342. x: box.x,
  11343. y: box.y,
  11344. width: '0px',
  11345. height: '0px'
  11346. },
  11347. to: {
  11348. width: box.width + 'px',
  11349. height: box.height + 'px'
  11350. }
  11351. };
  11352. elStyle.bottom = '0px';
  11353. elStyle.right = '0px';
  11354. break;
  11355. case 'bl':
  11356. anim = {
  11357. from: {
  11358. y: box.y + box.height,
  11359. width: '0px',
  11360. height: '0px'
  11361. },
  11362. to: {
  11363. y: box.y,
  11364. width: box.width + 'px',
  11365. height: box.height + 'px'
  11366. }
  11367. };
  11368. elStyle.bottom = '0px';
  11369. break;
  11370. case 'br':
  11371. anim = {
  11372. from: {
  11373. x: box.x + box.width,
  11374. y: box.y + box.height,
  11375. width: '0px',
  11376. height: '0px'
  11377. },
  11378. to: {
  11379. x: box.x,
  11380. y: box.y,
  11381. width: box.width + 'px',
  11382. height: box.height + 'px'
  11383. }
  11384. };
  11385. break;
  11386. case 'tr':
  11387. anim = {
  11388. from: {
  11389. x: box.x + box.width,
  11390. width: '0px',
  11391. height: '0px'
  11392. },
  11393. to: {
  11394. x: box.x,
  11395. width: box.width + 'px',
  11396. height: box.height + 'px'
  11397. }
  11398. };
  11399. elStyle.right = '0px';
  11400. break;
  11401. }
  11402. wrap.show();
  11403. wrapAnim = Ext.apply({}, obj);
  11404. delete wrapAnim.listeners;
  11405. wrapAnim = new Ext.fx.Anim(Ext.applyIf(wrapAnim, {
  11406. target: wrap,
  11407. duration: 500,
  11408. easing: 'ease-out',
  11409. from: slideOut ? anim.to : anim.from,
  11410. to: slideOut ? anim.from : anim.to
  11411. }));
  11412. wrapAnim.on('afteranimate', function() {
  11413. me.setStyle(originalStyles);
  11414. if (slideOut) {
  11415. if (obj.useDisplay) {
  11416. me.setDisplayed(false);
  11417. } else {
  11418. me.hide();
  11419. }
  11420. }
  11421. if (wrap.dom) {
  11422. if (wrap.dom.parentNode) {
  11423. wrap.dom.parentNode.insertBefore(me.dom, wrap.dom);
  11424. } else {
  11425. wrapDomParentNode.appendChild(me.dom);
  11426. }
  11427. wrap.remove();
  11428. }
  11429. if (restoreScroll) {
  11430. restoreScroll();
  11431. }
  11432. animScope.end();
  11433. });
  11434. if (listeners) {
  11435. wrapAnim.on(listeners);
  11436. }
  11437. };
  11438. me.animate({
  11439. duration: obj.duration ? Math.max(obj.duration, 500) * 2 : 1000,
  11440. listeners: {
  11441. beforeanimate: beforeAnim
  11442. }
  11443. });
  11444. return me;
  11445. },
  11446. slideOut: function(anchor, o) {
  11447. return this.slideIn(anchor, o, true);
  11448. },
  11449. puff: function(obj) {
  11450. var me = this,
  11451. beforeAnim,
  11452. box = me.getBox(),
  11453. originalStyles = me.getStyles('width', 'height', 'left', 'right', 'top', 'bottom', 'position', 'z-index', 'font-size', 'opacity', true);
  11454. obj = Ext.applyIf(obj || {}, {
  11455. easing: 'ease-out',
  11456. duration: 500,
  11457. useDisplay: false
  11458. });
  11459. beforeAnim = function() {
  11460. me.clearOpacity();
  11461. me.show();
  11462. this.to = {
  11463. width: box.width * 2,
  11464. height: box.height * 2,
  11465. x: box.x - (box.width / 2),
  11466. y: box.y - (box.height /2),
  11467. opacity: 0,
  11468. fontSize: '200%'
  11469. };
  11470. this.on('afteranimate',function() {
  11471. if (me.dom) {
  11472. if (obj.useDisplay) {
  11473. me.setDisplayed(false);
  11474. } else {
  11475. me.hide();
  11476. }
  11477. me.setStyle(originalStyles);
  11478. obj.callback.call(obj.scope);
  11479. }
  11480. });
  11481. };
  11482. me.animate({
  11483. duration: obj.duration,
  11484. easing: obj.easing,
  11485. listeners: {
  11486. beforeanimate: {
  11487. fn: beforeAnim
  11488. }
  11489. }
  11490. });
  11491. return me;
  11492. },
  11493. switchOff: function(obj) {
  11494. var me = this,
  11495. beforeAnim;
  11496. obj = Ext.applyIf(obj || {}, {
  11497. easing: 'ease-in',
  11498. duration: 500,
  11499. remove: false,
  11500. useDisplay: false
  11501. });
  11502. beforeAnim = function() {
  11503. var animScope = this,
  11504. size = me.getSize(),
  11505. xy = me.getXY(),
  11506. keyframe, position;
  11507. me.clearOpacity();
  11508. me.clip();
  11509. position = me.getPositioning();
  11510. keyframe = new Ext.fx.Animator({
  11511. target: me,
  11512. duration: obj.duration,
  11513. easing: obj.easing,
  11514. keyframes: {
  11515. 33: {
  11516. opacity: 0.3
  11517. },
  11518. 66: {
  11519. height: 1,
  11520. y: xy[1] + size.height / 2
  11521. },
  11522. 100: {
  11523. width: 1,
  11524. x: xy[0] + size.width / 2
  11525. }
  11526. }
  11527. });
  11528. keyframe.on('afteranimate', function() {
  11529. if (obj.useDisplay) {
  11530. me.setDisplayed(false);
  11531. } else {
  11532. me.hide();
  11533. }
  11534. me.clearOpacity();
  11535. me.setPositioning(position);
  11536. me.setSize(size);
  11537. animScope.end();
  11538. });
  11539. };
  11540. me.animate({
  11541. duration: (Math.max(obj.duration, 500) * 2),
  11542. listeners: {
  11543. beforeanimate: {
  11544. fn: beforeAnim
  11545. }
  11546. }
  11547. });
  11548. return me;
  11549. },
  11550. frame : function(color, count, obj){
  11551. var me = this,
  11552. beforeAnim;
  11553. color = color || '#C3DAF9';
  11554. count = count || 1;
  11555. obj = obj || {};
  11556. beforeAnim = function() {
  11557. me.show();
  11558. var animScope = this,
  11559. box = me.getBox(),
  11560. proxy = Ext.getBody().createChild({
  11561. id: me.id + '-anim-proxy',
  11562. style: {
  11563. position : 'absolute',
  11564. 'pointer-events': 'none',
  11565. 'z-index': 35000,
  11566. border : '0px solid ' + color
  11567. }
  11568. }),
  11569. proxyAnim;
  11570. proxyAnim = new Ext.fx.Anim({
  11571. target: proxy,
  11572. duration: obj.duration || 1000,
  11573. iterations: count,
  11574. from: {
  11575. top: box.y,
  11576. left: box.x,
  11577. borderWidth: 0,
  11578. opacity: 1,
  11579. height: box.height,
  11580. width: box.width
  11581. },
  11582. to: {
  11583. top: box.y - 20,
  11584. left: box.x - 20,
  11585. borderWidth: 10,
  11586. opacity: 0,
  11587. height: box.height + 40,
  11588. width: box.width + 40
  11589. }
  11590. });
  11591. proxyAnim.on('afteranimate', function() {
  11592. proxy.remove();
  11593. animScope.end();
  11594. });
  11595. };
  11596. me.animate({
  11597. duration: (Math.max(obj.duration, 500) * 2) || 2000,
  11598. listeners: {
  11599. beforeanimate: {
  11600. fn: beforeAnim
  11601. }
  11602. }
  11603. });
  11604. return me;
  11605. },
  11606. ghost: function(anchor, obj) {
  11607. var me = this,
  11608. beforeAnim;
  11609. anchor = anchor || "b";
  11610. beforeAnim = function() {
  11611. var width = me.getWidth(),
  11612. height = me.getHeight(),
  11613. xy = me.getXY(),
  11614. position = me.getPositioning(),
  11615. to = {
  11616. opacity: 0
  11617. };
  11618. switch (anchor) {
  11619. case 't':
  11620. to.y = xy[1] - height;
  11621. break;
  11622. case 'l':
  11623. to.x = xy[0] - width;
  11624. break;
  11625. case 'r':
  11626. to.x = xy[0] + width;
  11627. break;
  11628. case 'b':
  11629. to.y = xy[1] + height;
  11630. break;
  11631. case 'tl':
  11632. to.x = xy[0] - width;
  11633. to.y = xy[1] - height;
  11634. break;
  11635. case 'bl':
  11636. to.x = xy[0] - width;
  11637. to.y = xy[1] + height;
  11638. break;
  11639. case 'br':
  11640. to.x = xy[0] + width;
  11641. to.y = xy[1] + height;
  11642. break;
  11643. case 'tr':
  11644. to.x = xy[0] + width;
  11645. to.y = xy[1] - height;
  11646. break;
  11647. }
  11648. this.to = to;
  11649. this.on('afteranimate', function () {
  11650. if (me.dom) {
  11651. me.hide();
  11652. me.clearOpacity();
  11653. me.setPositioning(position);
  11654. }
  11655. });
  11656. };
  11657. me.animate(Ext.applyIf(obj || {}, {
  11658. duration: 500,
  11659. easing: 'ease-out',
  11660. listeners: {
  11661. beforeanimate: {
  11662. fn: beforeAnim
  11663. }
  11664. }
  11665. }));
  11666. return me;
  11667. },
  11668. highlight: function(color, o) {
  11669. var me = this,
  11670. dom = me.dom,
  11671. from = {},
  11672. restore, to, attr, lns, event, fn;
  11673. o = o || {};
  11674. lns = o.listeners || {};
  11675. attr = o.attr || 'backgroundColor';
  11676. from[attr] = color || 'ffff9c';
  11677. if (!o.to) {
  11678. to = {};
  11679. to[attr] = o.endColor || me.getColor(attr, 'ffffff', '');
  11680. }
  11681. else {
  11682. to = o.to;
  11683. }
  11684. o.listeners = Ext.apply(Ext.apply({}, lns), {
  11685. beforeanimate: function() {
  11686. restore = dom.style[attr];
  11687. me.clearOpacity();
  11688. me.show();
  11689. event = lns.beforeanimate;
  11690. if (event) {
  11691. fn = event.fn || event;
  11692. return fn.apply(event.scope || lns.scope || window, arguments);
  11693. }
  11694. },
  11695. afteranimate: function() {
  11696. if (dom) {
  11697. dom.style[attr] = restore;
  11698. }
  11699. event = lns.afteranimate;
  11700. if (event) {
  11701. fn = event.fn || event;
  11702. fn.apply(event.scope || lns.scope || window, arguments);
  11703. }
  11704. }
  11705. });
  11706. me.animate(Ext.apply({}, o, {
  11707. duration: 1000,
  11708. easing: 'ease-in',
  11709. from: from,
  11710. to: to
  11711. }));
  11712. return me;
  11713. },
  11714. pause: function(ms) {
  11715. var me = this;
  11716. Ext.fx.Manager.setFxDefaults(me.id, {
  11717. delay: ms
  11718. });
  11719. return me;
  11720. },
  11721. fadeIn: function(o) {
  11722. var me = this;
  11723. me.animate(Ext.apply({}, o, {
  11724. opacity: 1,
  11725. internalListeners: {
  11726. beforeanimate: function(anim){
  11727. if (me.isStyle('display', 'none')) {
  11728. me.setDisplayed('');
  11729. } else {
  11730. me.show();
  11731. }
  11732. }
  11733. }
  11734. }));
  11735. return this;
  11736. },
  11737. fadeOut: function(o) {
  11738. var me = this;
  11739. o = Ext.apply({
  11740. opacity: 0,
  11741. internalListeners: {
  11742. afteranimate: function(anim){
  11743. var dom = me.dom;
  11744. if (dom && anim.to.opacity === 0) {
  11745. if (o.useDisplay) {
  11746. me.setDisplayed(false);
  11747. } else {
  11748. me.hide();
  11749. }
  11750. }
  11751. }
  11752. }
  11753. }, o);
  11754. me.animate(o);
  11755. return me;
  11756. },
  11757. scale: function(w, h, o) {
  11758. this.animate(Ext.apply({}, o, {
  11759. width: w,
  11760. height: h
  11761. }));
  11762. return this;
  11763. },
  11764. shift: function(config) {
  11765. this.animate(config);
  11766. return this;
  11767. }
  11768. });
  11769. //@tag dom,core
  11770. //@require Ext.dom.Element-anim
  11771. //@define Ext.dom.Element-dd
  11772. //@define Ext.dom.Element
  11773. Ext.dom.Element.override({
  11774. initDD : function(group, config, overrides){
  11775. var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);
  11776. return Ext.apply(dd, overrides);
  11777. },
  11778. initDDProxy : function(group, config, overrides){
  11779. var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);
  11780. return Ext.apply(dd, overrides);
  11781. },
  11782. initDDTarget : function(group, config, overrides){
  11783. var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);
  11784. return Ext.apply(dd, overrides);
  11785. }
  11786. });
  11787. //@tag dom,core
  11788. //@require Ext.dom.Element-dd
  11789. //@define Ext.dom.Element-fx
  11790. //@define Ext.dom.Element
  11791. (function() {
  11792. var Element = Ext.dom.Element,
  11793. VISIBILITY = "visibility",
  11794. DISPLAY = "display",
  11795. NONE = "none",
  11796. HIDDEN = 'hidden',
  11797. VISIBLE = 'visible',
  11798. OFFSETS = "offsets",
  11799. ASCLASS = "asclass",
  11800. NOSIZE = 'nosize',
  11801. ORIGINALDISPLAY = 'originalDisplay',
  11802. VISMODE = 'visibilityMode',
  11803. ISVISIBLE = 'isVisible',
  11804. OFFSETCLASS = Ext.baseCSSPrefix + 'hide-offsets',
  11805. getDisplay = function(el) {
  11806. var data = (el.$cache || el.getCache()).data,
  11807. display = data[ORIGINALDISPLAY];
  11808. if (display === undefined) {
  11809. data[ORIGINALDISPLAY] = display = '';
  11810. }
  11811. return display;
  11812. },
  11813. getVisMode = function(el){
  11814. var data = (el.$cache || el.getCache()).data,
  11815. visMode = data[VISMODE];
  11816. if (visMode === undefined) {
  11817. data[VISMODE] = visMode = Element.VISIBILITY;
  11818. }
  11819. return visMode;
  11820. };
  11821. Element.override({
  11822. originalDisplay : "",
  11823. visibilityMode : 1,
  11824. setVisible : function(visible, animate) {
  11825. var me = this,
  11826. dom = me.dom,
  11827. visMode = getVisMode(me);
  11828. if (typeof animate == 'string') {
  11829. switch (animate) {
  11830. case DISPLAY:
  11831. visMode = Element.DISPLAY;
  11832. break;
  11833. case VISIBILITY:
  11834. visMode = Element.VISIBILITY;
  11835. break;
  11836. case OFFSETS:
  11837. visMode = Element.OFFSETS;
  11838. break;
  11839. case NOSIZE:
  11840. case ASCLASS:
  11841. visMode = Element.ASCLASS;
  11842. break;
  11843. }
  11844. me.setVisibilityMode(visMode);
  11845. animate = false;
  11846. }
  11847. if (!animate || !me.anim) {
  11848. if (visMode == Element.DISPLAY) {
  11849. return me.setDisplayed(visible);
  11850. } else if (visMode == Element.OFFSETS) {
  11851. me[visible?'removeCls':'addCls'](OFFSETCLASS);
  11852. } else if (visMode == Element.VISIBILITY) {
  11853. me.fixDisplay();
  11854. dom.style.visibility = visible ? '' : HIDDEN;
  11855. } else if (visMode == Element.ASCLASS) {
  11856. me[visible?'removeCls':'addCls'](me.visibilityCls || Element.visibilityCls);
  11857. }
  11858. } else {
  11859. if (visible) {
  11860. me.setOpacity(0.01);
  11861. me.setVisible(true);
  11862. }
  11863. if (!Ext.isObject(animate)) {
  11864. animate = {
  11865. duration: 350,
  11866. easing: 'ease-in'
  11867. };
  11868. }
  11869. me.animate(Ext.applyIf({
  11870. callback: function() {
  11871. if (!visible) {
  11872. me.setVisible(false).setOpacity(1);
  11873. }
  11874. },
  11875. to: {
  11876. opacity: (visible) ? 1 : 0
  11877. }
  11878. }, animate));
  11879. }
  11880. (me.$cache || me.getCache()).data[ISVISIBLE] = visible;
  11881. return me;
  11882. },
  11883. hasMetrics : function(){
  11884. var visMode = getVisMode(this);
  11885. return this.isVisible() || (visMode == Element.OFFSETS) || (visMode == Element.VISIBILITY);
  11886. },
  11887. toggle : function(animate){
  11888. var me = this;
  11889. me.setVisible(!me.isVisible(), me.anim(animate));
  11890. return me;
  11891. },
  11892. setDisplayed : function(value) {
  11893. if(typeof value == "boolean"){
  11894. value = value ? getDisplay(this) : NONE;
  11895. }
  11896. this.setStyle(DISPLAY, value);
  11897. return this;
  11898. },
  11899. fixDisplay : function(){
  11900. var me = this;
  11901. if (me.isStyle(DISPLAY, NONE)) {
  11902. me.setStyle(VISIBILITY, HIDDEN);
  11903. me.setStyle(DISPLAY, getDisplay(me));
  11904. if (me.isStyle(DISPLAY, NONE)) {
  11905. me.setStyle(DISPLAY, "block");
  11906. }
  11907. }
  11908. },
  11909. hide : function(animate){
  11910. if (typeof animate == 'string'){
  11911. this.setVisible(false, animate);
  11912. return this;
  11913. }
  11914. this.setVisible(false, this.anim(animate));
  11915. return this;
  11916. },
  11917. show : function(animate){
  11918. if (typeof animate == 'string'){
  11919. this.setVisible(true, animate);
  11920. return this;
  11921. }
  11922. this.setVisible(true, this.anim(animate));
  11923. return this;
  11924. }
  11925. });
  11926. }());
  11927. //@tag dom,core
  11928. //@require Ext.dom.Element-fx
  11929. //@define Ext.dom.Element-position
  11930. //@define Ext.dom.Element
  11931. (function() {
  11932. var Element = Ext.dom.Element,
  11933. LEFT = "left",
  11934. RIGHT = "right",
  11935. TOP = "top",
  11936. BOTTOM = "bottom",
  11937. POSITION = "position",
  11938. STATIC = "static",
  11939. RELATIVE = "relative",
  11940. AUTO = "auto",
  11941. ZINDEX = "z-index",
  11942. BODY = 'BODY',
  11943. PADDING = 'padding',
  11944. BORDER = 'border',
  11945. SLEFT = '-left',
  11946. SRIGHT = '-right',
  11947. STOP = '-top',
  11948. SBOTTOM = '-bottom',
  11949. SWIDTH = '-width',
  11950. borders = {l: BORDER + SLEFT + SWIDTH, r: BORDER + SRIGHT + SWIDTH, t: BORDER + STOP + SWIDTH, b: BORDER + SBOTTOM + SWIDTH},
  11951. paddings = {l: PADDING + SLEFT, r: PADDING + SRIGHT, t: PADDING + STOP, b: PADDING + SBOTTOM},
  11952. paddingsTLRB = [paddings.l, paddings.r, paddings.t, paddings.b],
  11953. bordersTLRB = [borders.l, borders.r, borders.t, borders.b],
  11954. positionTopLeft = ['position', 'top', 'left'];
  11955. Element.override({
  11956. getX: function() {
  11957. return Element.getX(this.dom);
  11958. },
  11959. getY: function() {
  11960. return Element.getY(this.dom);
  11961. },
  11962. getXY: function() {
  11963. return Element.getXY(this.dom);
  11964. },
  11965. getOffsetsTo : function(el){
  11966. var o = this.getXY(),
  11967. e = Ext.fly(el, '_internal').getXY();
  11968. return [o[0] - e[0],o[1] - e[1]];
  11969. },
  11970. setX: function(x, animate) {
  11971. return this.setXY([x, this.getY()], animate);
  11972. },
  11973. setY: function(y, animate) {
  11974. return this.setXY([this.getX(), y], animate);
  11975. },
  11976. setLeft: function(left) {
  11977. this.setStyle(LEFT, this.addUnits(left));
  11978. return this;
  11979. },
  11980. setTop: function(top) {
  11981. this.setStyle(TOP, this.addUnits(top));
  11982. return this;
  11983. },
  11984. setRight: function(right) {
  11985. this.setStyle(RIGHT, this.addUnits(right));
  11986. return this;
  11987. },
  11988. setBottom: function(bottom) {
  11989. this.setStyle(BOTTOM, this.addUnits(bottom));
  11990. return this;
  11991. },
  11992. setXY: function(pos, animate) {
  11993. var me = this;
  11994. if (!animate || !me.anim) {
  11995. Element.setXY(me.dom, pos);
  11996. }
  11997. else {
  11998. if (!Ext.isObject(animate)) {
  11999. animate = {};
  12000. }
  12001. me.animate(Ext.applyIf({ to: { x: pos[0], y: pos[1] } }, animate));
  12002. }
  12003. return me;
  12004. },
  12005. pxRe: /^\d+(?:\.\d*)?px$/i,
  12006. getLocalX: function() {
  12007. var me = this,
  12008. offsetParent,
  12009. x = me.getStyle(LEFT);
  12010. if (!x || x === AUTO) {
  12011. return 0;
  12012. }
  12013. if (x && me.pxRe.test(x)) {
  12014. return parseFloat(x);
  12015. }
  12016. x = me.getX();
  12017. offsetParent = me.dom.offsetParent;
  12018. if (offsetParent) {
  12019. x -= Ext.fly(offsetParent).getX();
  12020. }
  12021. return x;
  12022. },
  12023. getLocalY: function() {
  12024. var me = this,
  12025. offsetParent,
  12026. y = me.getStyle(TOP);
  12027. if (!y || y === AUTO) {
  12028. return 0;
  12029. }
  12030. if (y && me.pxRe.test(y)) {
  12031. return parseFloat(y);
  12032. }
  12033. y = me.getY();
  12034. offsetParent = me.dom.offsetParent;
  12035. if (offsetParent) {
  12036. y -= Ext.fly(offsetParent).getY();
  12037. }
  12038. return y;
  12039. },
  12040. getLeft: function(local) {
  12041. return local ? this.getLocalX() : this.getX();
  12042. },
  12043. getRight: function(local) {
  12044. return (local ? this.getLocalX() : this.getX()) + this.getWidth();
  12045. },
  12046. getTop: function(local) {
  12047. return local ? this.getLocalY() : this.getY();
  12048. },
  12049. getBottom: function(local) {
  12050. return (local ? this.getLocalY() : this.getY()) + this.getHeight();
  12051. },
  12052. translatePoints: function(x, y) {
  12053. var me = this,
  12054. styles = me.getStyle(positionTopLeft),
  12055. relative = styles.position == 'relative',
  12056. left = parseFloat(styles.left),
  12057. top = parseFloat(styles.top),
  12058. xy = me.getXY();
  12059. if (Ext.isArray(x)) {
  12060. y = x[1];
  12061. x = x[0];
  12062. }
  12063. if (isNaN(left)) {
  12064. left = relative ? 0 : me.dom.offsetLeft;
  12065. }
  12066. if (isNaN(top)) {
  12067. top = relative ? 0 : me.dom.offsetTop;
  12068. }
  12069. left = (typeof x == 'number') ? x - xy[0] + left : undefined;
  12070. top = (typeof y == 'number') ? y - xy[1] + top : undefined;
  12071. return {
  12072. left: left,
  12073. top: top
  12074. };
  12075. },
  12076. setBox: function(box, adjust, animate) {
  12077. var me = this,
  12078. w = box.width,
  12079. h = box.height;
  12080. if ((adjust && !me.autoBoxAdjust) && !me.isBorderBox()) {
  12081. w -= (me.getBorderWidth("lr") + me.getPadding("lr"));
  12082. h -= (me.getBorderWidth("tb") + me.getPadding("tb"));
  12083. }
  12084. me.setBounds(box.x, box.y, w, h, animate);
  12085. return me;
  12086. },
  12087. getBox: function(contentBox, local) {
  12088. var me = this,
  12089. xy,
  12090. left,
  12091. top,
  12092. paddingWidth,
  12093. bordersWidth,
  12094. l, r, t, b, w, h, bx;
  12095. if (!local) {
  12096. xy = me.getXY();
  12097. } else {
  12098. xy = me.getStyle([LEFT, TOP]);
  12099. xy = [ parseFloat(xy.left) || 0, parseFloat(xy.top) || 0];
  12100. }
  12101. w = me.getWidth();
  12102. h = me.getHeight();
  12103. if (!contentBox) {
  12104. bx = {
  12105. x: xy[0],
  12106. y: xy[1],
  12107. 0: xy[0],
  12108. 1: xy[1],
  12109. width: w,
  12110. height: h
  12111. };
  12112. } else {
  12113. paddingWidth = me.getStyle(paddingsTLRB);
  12114. bordersWidth = me.getStyle(bordersTLRB);
  12115. l = (parseFloat(bordersWidth[borders.l]) || 0) + (parseFloat(paddingWidth[paddings.l]) || 0);
  12116. r = (parseFloat(bordersWidth[borders.r]) || 0) + (parseFloat(paddingWidth[paddings.r]) || 0);
  12117. t = (parseFloat(bordersWidth[borders.t]) || 0) + (parseFloat(paddingWidth[paddings.t]) || 0);
  12118. b = (parseFloat(bordersWidth[borders.b]) || 0) + (parseFloat(paddingWidth[paddings.b]) || 0);
  12119. bx = {
  12120. x: xy[0] + l,
  12121. y: xy[1] + t,
  12122. 0: xy[0] + l,
  12123. 1: xy[1] + t,
  12124. width: w - (l + r),
  12125. height: h - (t + b)
  12126. };
  12127. }
  12128. bx.right = bx.x + bx.width;
  12129. bx.bottom = bx.y + bx.height;
  12130. return bx;
  12131. },
  12132. getPageBox: function(getRegion) {
  12133. var me = this,
  12134. el = me.dom,
  12135. isDoc = el.nodeName == BODY,
  12136. w = isDoc ? Ext.dom.AbstractElement.getViewWidth() : el.offsetWidth,
  12137. h = isDoc ? Ext.dom.AbstractElement.getViewHeight() : el.offsetHeight,
  12138. xy = me.getXY(),
  12139. t = xy[1],
  12140. r = xy[0] + w,
  12141. b = xy[1] + h,
  12142. l = xy[0];
  12143. if (getRegion) {
  12144. return new Ext.util.Region(t, r, b, l);
  12145. }
  12146. else {
  12147. return {
  12148. left: l,
  12149. top: t,
  12150. width: w,
  12151. height: h,
  12152. right: r,
  12153. bottom: b
  12154. };
  12155. }
  12156. },
  12157. setLocation : function(x, y, animate) {
  12158. return this.setXY([x, y], animate);
  12159. },
  12160. moveTo : function(x, y, animate) {
  12161. return this.setXY([x, y], animate);
  12162. },
  12163. position : function(pos, zIndex, x, y) {
  12164. var me = this;
  12165. if (!pos && me.isStyle(POSITION, STATIC)) {
  12166. me.setStyle(POSITION, RELATIVE);
  12167. } else if (pos) {
  12168. me.setStyle(POSITION, pos);
  12169. }
  12170. if (zIndex) {
  12171. me.setStyle(ZINDEX, zIndex);
  12172. }
  12173. if (x || y) {
  12174. me.setXY([x || false, y || false]);
  12175. }
  12176. },
  12177. clearPositioning : function(value) {
  12178. value = value || '';
  12179. this.setStyle({
  12180. left : value,
  12181. right : value,
  12182. top : value,
  12183. bottom : value,
  12184. "z-index" : "",
  12185. position : STATIC
  12186. });
  12187. return this;
  12188. },
  12189. getPositioning : function(){
  12190. var styles = this.getStyle([LEFT, TOP, POSITION, RIGHT, BOTTOM, ZINDEX]);
  12191. styles[RIGHT] = styles[LEFT] ? '' : styles[RIGHT];
  12192. styles[BOTTOM] = styles[TOP] ? '' : styles[BOTTOM];
  12193. return styles;
  12194. },
  12195. setPositioning : function(pc) {
  12196. var me = this,
  12197. style = me.dom.style;
  12198. me.setStyle(pc);
  12199. if (pc.right == AUTO) {
  12200. style.right = "";
  12201. }
  12202. if (pc.bottom == AUTO) {
  12203. style.bottom = "";
  12204. }
  12205. return me;
  12206. },
  12207. move: function(direction, distance, animate) {
  12208. var me = this,
  12209. xy = me.getXY(),
  12210. x = xy[0],
  12211. y = xy[1],
  12212. left = [x - distance, y],
  12213. right = [x + distance, y],
  12214. top = [x, y - distance],
  12215. bottom = [x, y + distance],
  12216. hash = {
  12217. l: left,
  12218. left: left,
  12219. r: right,
  12220. right: right,
  12221. t: top,
  12222. top: top,
  12223. up: top,
  12224. b: bottom,
  12225. bottom: bottom,
  12226. down: bottom
  12227. };
  12228. direction = direction.toLowerCase();
  12229. me.moveTo(hash[direction][0], hash[direction][1], animate);
  12230. },
  12231. setLeftTop: function(left, top) {
  12232. var style = this.dom.style;
  12233. style.left = Element.addUnits(left);
  12234. style.top = Element.addUnits(top);
  12235. return this;
  12236. },
  12237. getRegion: function() {
  12238. return this.getPageBox(true);
  12239. },
  12240. getViewRegion: function() {
  12241. var me = this,
  12242. isBody = me.dom.nodeName == BODY,
  12243. scroll, pos, top, left, width, height;
  12244. if (isBody) {
  12245. scroll = me.getScroll();
  12246. left = scroll.left;
  12247. top = scroll.top;
  12248. width = Ext.dom.AbstractElement.getViewportWidth();
  12249. height = Ext.dom.AbstractElement.getViewportHeight();
  12250. }
  12251. else {
  12252. pos = me.getXY();
  12253. left = pos[0] + me.getBorderWidth('l') + me.getPadding('l');
  12254. top = pos[1] + me.getBorderWidth('t') + me.getPadding('t');
  12255. width = me.getWidth(true);
  12256. height = me.getHeight(true);
  12257. }
  12258. return new Ext.util.Region(top, left + width - 1, top + height - 1, left);
  12259. },
  12260. setBounds: function(x, y, width, height, animate) {
  12261. var me = this;
  12262. if (!animate || !me.anim) {
  12263. me.setSize(width, height);
  12264. me.setLocation(x, y);
  12265. } else {
  12266. if (!Ext.isObject(animate)) {
  12267. animate = {};
  12268. }
  12269. me.animate(Ext.applyIf({
  12270. to: {
  12271. x: x,
  12272. y: y,
  12273. width: me.adjustWidth(width),
  12274. height: me.adjustHeight(height)
  12275. }
  12276. }, animate));
  12277. }
  12278. return me;
  12279. },
  12280. setRegion: function(region, animate) {
  12281. return this.setBounds(region.left, region.top, region.right - region.left, region.bottom - region.top, animate);
  12282. }
  12283. });
  12284. }());
  12285. //@tag dom,core
  12286. //@require Ext.dom.Element-position
  12287. //@define Ext.dom.Element-scroll
  12288. //@define Ext.dom.Element
  12289. Ext.dom.Element.override({
  12290. isScrollable: function() {
  12291. var dom = this.dom;
  12292. return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;
  12293. },
  12294. getScroll: function() {
  12295. var d = this.dom,
  12296. doc = document,
  12297. body = doc.body,
  12298. docElement = doc.documentElement,
  12299. l,
  12300. t,
  12301. ret;
  12302. if (d == doc || d == body) {
  12303. if (Ext.isIE && Ext.isStrict) {
  12304. l = docElement.scrollLeft;
  12305. t = docElement.scrollTop;
  12306. } else {
  12307. l = window.pageXOffset;
  12308. t = window.pageYOffset;
  12309. }
  12310. ret = {
  12311. left: l || (body ? body.scrollLeft : 0),
  12312. top : t || (body ? body.scrollTop : 0)
  12313. };
  12314. } else {
  12315. ret = {
  12316. left: d.scrollLeft,
  12317. top : d.scrollTop
  12318. };
  12319. }
  12320. return ret;
  12321. },
  12322. scrollBy: function(deltaX, deltaY, animate) {
  12323. var me = this,
  12324. dom = me.dom;
  12325. if (deltaX.length) {
  12326. animate = deltaY;
  12327. deltaY = deltaX[1];
  12328. deltaX = deltaX[0];
  12329. } else if (typeof deltaX != 'number') {
  12330. animate = deltaY;
  12331. deltaY = deltaX.y;
  12332. deltaX = deltaX.x;
  12333. }
  12334. if (deltaX) {
  12335. me.scrollTo('left', Math.max(Math.min(dom.scrollLeft + deltaX, dom.scrollWidth - dom.clientWidth), 0), animate);
  12336. }
  12337. if (deltaY) {
  12338. me.scrollTo('top', Math.max(Math.min(dom.scrollTop + deltaY, dom.scrollHeight - dom.clientHeight), 0), animate);
  12339. }
  12340. return me;
  12341. },
  12342. scrollTo: function(side, value, animate) {
  12343. var top = /top/i.test(side),
  12344. me = this,
  12345. dom = me.dom,
  12346. animCfg,
  12347. prop;
  12348. if (!animate || !me.anim) {
  12349. prop = 'scroll' + (top ? 'Top' : 'Left');
  12350. dom[prop] = value;
  12351. dom[prop] = value;
  12352. }
  12353. else {
  12354. animCfg = {
  12355. to: {}
  12356. };
  12357. animCfg.to['scroll' + (top ? 'Top' : 'Left')] = value;
  12358. if (Ext.isObject(animate)) {
  12359. Ext.applyIf(animCfg, animate);
  12360. }
  12361. me.animate(animCfg);
  12362. }
  12363. return me;
  12364. },
  12365. scrollIntoView: function(container, hscroll, animate) {
  12366. container = Ext.getDom(container) || Ext.getBody().dom;
  12367. var el = this.dom,
  12368. offsets = this.getOffsetsTo(container),
  12369. left = offsets[0] + container.scrollLeft,
  12370. top = offsets[1] + container.scrollTop,
  12371. bottom = top + el.offsetHeight,
  12372. right = left + el.offsetWidth,
  12373. ctClientHeight = container.clientHeight,
  12374. ctScrollTop = parseInt(container.scrollTop, 10),
  12375. ctScrollLeft = parseInt(container.scrollLeft, 10),
  12376. ctBottom = ctScrollTop + ctClientHeight,
  12377. ctRight = ctScrollLeft + container.clientWidth,
  12378. newPos;
  12379. if (el.offsetHeight > ctClientHeight || top < ctScrollTop) {
  12380. newPos = top;
  12381. } else if (bottom > ctBottom) {
  12382. newPos = bottom - ctClientHeight;
  12383. }
  12384. if (newPos != null) {
  12385. Ext.get(container).scrollTo('top', newPos, animate);
  12386. }
  12387. if (hscroll !== false) {
  12388. newPos = null;
  12389. if (el.offsetWidth > container.clientWidth || left < ctScrollLeft) {
  12390. newPos = left;
  12391. } else if (right > ctRight) {
  12392. newPos = right - container.clientWidth;
  12393. }
  12394. if (newPos != null) {
  12395. Ext.get(container).scrollTo('left', newPos, animate);
  12396. }
  12397. }
  12398. return this;
  12399. },
  12400. scrollChildIntoView: function(child, hscroll) {
  12401. Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);
  12402. },
  12403. scroll: function(direction, distance, animate) {
  12404. if (!this.isScrollable()) {
  12405. return false;
  12406. }
  12407. var el = this.dom,
  12408. l = el.scrollLeft, t = el.scrollTop,
  12409. w = el.scrollWidth, h = el.scrollHeight,
  12410. cw = el.clientWidth, ch = el.clientHeight,
  12411. scrolled = false, v,
  12412. hash = {
  12413. l: Math.min(l + distance, w - cw),
  12414. r: v = Math.max(l - distance, 0),
  12415. t: Math.max(t - distance, 0),
  12416. b: Math.min(t + distance, h - ch)
  12417. };
  12418. hash.d = hash.b;
  12419. hash.u = hash.t;
  12420. direction = direction.substr(0, 1);
  12421. if ((v = hash[direction]) > -1) {
  12422. scrolled = true;
  12423. this.scrollTo(direction == 'l' || direction == 'r' ? 'left' : 'top', v, this.anim(animate));
  12424. }
  12425. return scrolled;
  12426. }
  12427. });
  12428. //@tag dom,core
  12429. //@require Ext.dom.Element-scroll
  12430. //@define Ext.dom.Element-style
  12431. //@define Ext.dom.Element
  12432. (function() {
  12433. var Element = Ext.dom.Element,
  12434. view = document.defaultView,
  12435. adjustDirect2DTableRe = /table-row|table-.*-group/,
  12436. INTERNAL = '_internal',
  12437. HIDDEN = 'hidden',
  12438. HEIGHT = 'height',
  12439. WIDTH = 'width',
  12440. ISCLIPPED = 'isClipped',
  12441. OVERFLOW = 'overflow',
  12442. OVERFLOWX = 'overflow-x',
  12443. OVERFLOWY = 'overflow-y',
  12444. ORIGINALCLIP = 'originalClip',
  12445. DOCORBODYRE = /#document|body/i,
  12446. styleHooks,
  12447. edges, k, edge, borderWidth;
  12448. if (!view || !view.getComputedStyle) {
  12449. Element.prototype.getStyle = function (property, inline) {
  12450. var me = this,
  12451. dom = me.dom,
  12452. multiple = typeof property != 'string',
  12453. hooks = me.styleHooks,
  12454. prop = property,
  12455. props = prop,
  12456. len = 1,
  12457. isInline = inline,
  12458. camel, domStyle, values, hook, out, style, i;
  12459. if (multiple) {
  12460. values = {};
  12461. prop = props[0];
  12462. i = 0;
  12463. if (!(len = props.length)) {
  12464. return values;
  12465. }
  12466. }
  12467. if (!dom || dom.documentElement) {
  12468. return values || '';
  12469. }
  12470. domStyle = dom.style;
  12471. if (inline) {
  12472. style = domStyle;
  12473. } else {
  12474. style = dom.currentStyle;
  12475. if (!style) {
  12476. isInline = true;
  12477. style = domStyle;
  12478. }
  12479. }
  12480. do {
  12481. hook = hooks[prop];
  12482. if (!hook) {
  12483. hooks[prop] = hook = { name: Element.normalize(prop) };
  12484. }
  12485. if (hook.get) {
  12486. out = hook.get(dom, me, isInline, style);
  12487. } else {
  12488. camel = hook.name;
  12489. if (hook.canThrow) {
  12490. try {
  12491. out = style[camel];
  12492. } catch (e) {
  12493. out = '';
  12494. }
  12495. } else {
  12496. out = style ? style[camel] : '';
  12497. }
  12498. }
  12499. if (!multiple) {
  12500. return out;
  12501. }
  12502. values[prop] = out;
  12503. prop = props[++i];
  12504. } while (i < len);
  12505. return values;
  12506. };
  12507. }
  12508. Element.override({
  12509. getHeight: function(contentHeight, preciseHeight) {
  12510. var me = this,
  12511. dom = me.dom,
  12512. hidden = me.isStyle('display', 'none'),
  12513. height,
  12514. floating;
  12515. if (hidden) {
  12516. return 0;
  12517. }
  12518. height = Math.max(dom.offsetHeight, dom.clientHeight) || 0;
  12519. if (Ext.supports.Direct2DBug) {
  12520. floating = me.adjustDirect2DDimension(HEIGHT);
  12521. if (preciseHeight) {
  12522. height += floating;
  12523. }
  12524. else if (floating > 0 && floating < 0.5) {
  12525. height++;
  12526. }
  12527. }
  12528. if (contentHeight) {
  12529. height -= me.getBorderWidth("tb") + me.getPadding("tb");
  12530. }
  12531. return (height < 0) ? 0 : height;
  12532. },
  12533. getWidth: function(contentWidth, preciseWidth) {
  12534. var me = this,
  12535. dom = me.dom,
  12536. hidden = me.isStyle('display', 'none'),
  12537. rect, width, floating;
  12538. if (hidden) {
  12539. return 0;
  12540. }
  12541. if (Ext.supports.BoundingClientRect) {
  12542. rect = dom.getBoundingClientRect();
  12543. width = rect.right - rect.left;
  12544. width = preciseWidth ? width : Math.ceil(width);
  12545. } else {
  12546. width = dom.offsetWidth;
  12547. }
  12548. width = Math.max(width, dom.clientWidth) || 0;
  12549. if (Ext.supports.Direct2DBug) {
  12550. floating = me.adjustDirect2DDimension(WIDTH);
  12551. if (preciseWidth) {
  12552. width += floating;
  12553. }
  12554. else if (floating > 0 && floating < 0.5) {
  12555. width++;
  12556. }
  12557. }
  12558. if (contentWidth) {
  12559. width -= me.getBorderWidth("lr") + me.getPadding("lr");
  12560. }
  12561. return (width < 0) ? 0 : width;
  12562. },
  12563. setWidth: function(width, animate) {
  12564. var me = this;
  12565. width = me.adjustWidth(width);
  12566. if (!animate || !me.anim) {
  12567. me.dom.style.width = me.addUnits(width);
  12568. }
  12569. else {
  12570. if (!Ext.isObject(animate)) {
  12571. animate = {};
  12572. }
  12573. me.animate(Ext.applyIf({
  12574. to: {
  12575. width: width
  12576. }
  12577. }, animate));
  12578. }
  12579. return me;
  12580. },
  12581. setHeight : function(height, animate) {
  12582. var me = this;
  12583. height = me.adjustHeight(height);
  12584. if (!animate || !me.anim) {
  12585. me.dom.style.height = me.addUnits(height);
  12586. }
  12587. else {
  12588. if (!Ext.isObject(animate)) {
  12589. animate = {};
  12590. }
  12591. me.animate(Ext.applyIf({
  12592. to: {
  12593. height: height
  12594. }
  12595. }, animate));
  12596. }
  12597. return me;
  12598. },
  12599. applyStyles: function(style) {
  12600. Ext.DomHelper.applyStyles(this.dom, style);
  12601. return this;
  12602. },
  12603. setSize: function(width, height, animate) {
  12604. var me = this;
  12605. if (Ext.isObject(width)) {
  12606. animate = height;
  12607. height = width.height;
  12608. width = width.width;
  12609. }
  12610. width = me.adjustWidth(width);
  12611. height = me.adjustHeight(height);
  12612. if (!animate || !me.anim) {
  12613. me.dom.style.width = me.addUnits(width);
  12614. me.dom.style.height = me.addUnits(height);
  12615. }
  12616. else {
  12617. if (animate === true) {
  12618. animate = {};
  12619. }
  12620. me.animate(Ext.applyIf({
  12621. to: {
  12622. width: width,
  12623. height: height
  12624. }
  12625. }, animate));
  12626. }
  12627. return me;
  12628. },
  12629. getViewSize : function() {
  12630. var me = this,
  12631. dom = me.dom,
  12632. isDoc = DOCORBODYRE.test(dom.nodeName),
  12633. ret;
  12634. if (isDoc) {
  12635. ret = {
  12636. width : Element.getViewWidth(),
  12637. height : Element.getViewHeight()
  12638. };
  12639. } else {
  12640. ret = {
  12641. width : dom.clientWidth,
  12642. height : dom.clientHeight
  12643. };
  12644. }
  12645. return ret;
  12646. },
  12647. getSize: function(contentSize) {
  12648. return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};
  12649. },
  12650. adjustWidth : function(width) {
  12651. var me = this,
  12652. isNum = (typeof width == 'number');
  12653. if (isNum && me.autoBoxAdjust && !me.isBorderBox()) {
  12654. width -= (me.getBorderWidth("lr") + me.getPadding("lr"));
  12655. }
  12656. return (isNum && width < 0) ? 0 : width;
  12657. },
  12658. adjustHeight : function(height) {
  12659. var me = this,
  12660. isNum = (typeof height == "number");
  12661. if (isNum && me.autoBoxAdjust && !me.isBorderBox()) {
  12662. height -= (me.getBorderWidth("tb") + me.getPadding("tb"));
  12663. }
  12664. return (isNum && height < 0) ? 0 : height;
  12665. },
  12666. getColor : function(attr, defaultValue, prefix) {
  12667. var v = this.getStyle(attr),
  12668. color = prefix || prefix === '' ? prefix : '#',
  12669. h, len, i=0;
  12670. if (!v || (/transparent|inherit/.test(v))) {
  12671. return defaultValue;
  12672. }
  12673. if (/^r/.test(v)) {
  12674. v = v.slice(4, v.length - 1).split(',');
  12675. len = v.length;
  12676. for (; i<len; i++) {
  12677. h = parseInt(v[i], 10);
  12678. color += (h < 16 ? '0' : '') + h.toString(16);
  12679. }
  12680. } else {
  12681. v = v.replace('#', '');
  12682. color += v.length == 3 ? v.replace(/^(\w)(\w)(\w)$/, '$1$1$2$2$3$3') : v;
  12683. }
  12684. return(color.length > 5 ? color.toLowerCase() : defaultValue);
  12685. },
  12686. setOpacity: function(opacity, animate) {
  12687. var me = this;
  12688. if (!me.dom) {
  12689. return me;
  12690. }
  12691. if (!animate || !me.anim) {
  12692. me.setStyle('opacity', opacity);
  12693. }
  12694. else {
  12695. if (typeof animate != 'object') {
  12696. animate = {
  12697. duration: 350,
  12698. easing: 'ease-in'
  12699. };
  12700. }
  12701. me.animate(Ext.applyIf({
  12702. to: {
  12703. opacity: opacity
  12704. }
  12705. }, animate));
  12706. }
  12707. return me;
  12708. },
  12709. clearOpacity : function() {
  12710. return this.setOpacity('');
  12711. },
  12712. adjustDirect2DDimension: function(dimension) {
  12713. var me = this,
  12714. dom = me.dom,
  12715. display = me.getStyle('display'),
  12716. inlineDisplay = dom.style.display,
  12717. inlinePosition = dom.style.position,
  12718. originIndex = dimension === WIDTH ? 0 : 1,
  12719. currentStyle = dom.currentStyle,
  12720. floating;
  12721. if (display === 'inline') {
  12722. dom.style.display = 'inline-block';
  12723. }
  12724. dom.style.position = display.match(adjustDirect2DTableRe) ? 'absolute' : 'static';
  12725. floating = (parseFloat(currentStyle[dimension]) || parseFloat(currentStyle.msTransformOrigin.split(' ')[originIndex]) * 2) % 1;
  12726. dom.style.position = inlinePosition;
  12727. if (display === 'inline') {
  12728. dom.style.display = inlineDisplay;
  12729. }
  12730. return floating;
  12731. },
  12732. clip : function() {
  12733. var me = this,
  12734. data = (me.$cache || me.getCache()).data,
  12735. style;
  12736. if (!data[ISCLIPPED]) {
  12737. data[ISCLIPPED] = true;
  12738. style = me.getStyle([OVERFLOW, OVERFLOWX, OVERFLOWY]);
  12739. data[ORIGINALCLIP] = {
  12740. o: style[OVERFLOW],
  12741. x: style[OVERFLOWX],
  12742. y: style[OVERFLOWY]
  12743. };
  12744. me.setStyle(OVERFLOW, HIDDEN);
  12745. me.setStyle(OVERFLOWX, HIDDEN);
  12746. me.setStyle(OVERFLOWY, HIDDEN);
  12747. }
  12748. return me;
  12749. },
  12750. unclip : function() {
  12751. var me = this,
  12752. data = (me.$cache || me.getCache()).data,
  12753. clip;
  12754. if (data[ISCLIPPED]) {
  12755. data[ISCLIPPED] = false;
  12756. clip = data[ORIGINALCLIP];
  12757. if (clip.o) {
  12758. me.setStyle(OVERFLOW, clip.o);
  12759. }
  12760. if (clip.x) {
  12761. me.setStyle(OVERFLOWX, clip.x);
  12762. }
  12763. if (clip.y) {
  12764. me.setStyle(OVERFLOWY, clip.y);
  12765. }
  12766. }
  12767. return me;
  12768. },
  12769. boxWrap : function(cls) {
  12770. cls = cls || Ext.baseCSSPrefix + 'box';
  12771. var el = Ext.get(this.insertHtml("beforeBegin", "<div class='" + cls + "'>" + Ext.String.format(Element.boxMarkup, cls) + "</div>"));
  12772. Ext.DomQuery.selectNode('.' + cls + '-mc', el.dom).appendChild(this.dom);
  12773. return el;
  12774. },
  12775. getComputedHeight : function() {
  12776. var me = this,
  12777. h = Math.max(me.dom.offsetHeight, me.dom.clientHeight);
  12778. if (!h) {
  12779. h = parseFloat(me.getStyle(HEIGHT)) || 0;
  12780. if (!me.isBorderBox()) {
  12781. h += me.getFrameWidth('tb');
  12782. }
  12783. }
  12784. return h;
  12785. },
  12786. getComputedWidth : function() {
  12787. var me = this,
  12788. w = Math.max(me.dom.offsetWidth, me.dom.clientWidth);
  12789. if (!w) {
  12790. w = parseFloat(me.getStyle(WIDTH)) || 0;
  12791. if (!me.isBorderBox()) {
  12792. w += me.getFrameWidth('lr');
  12793. }
  12794. }
  12795. return w;
  12796. },
  12797. getFrameWidth : function(sides, onlyContentBox) {
  12798. return (onlyContentBox && this.isBorderBox()) ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));
  12799. },
  12800. addClsOnOver : function(className, testFn, scope) {
  12801. var me = this,
  12802. dom = me.dom,
  12803. hasTest = Ext.isFunction(testFn);
  12804. me.hover(
  12805. function() {
  12806. if (hasTest && testFn.call(scope || me, me) === false) {
  12807. return;
  12808. }
  12809. Ext.fly(dom, INTERNAL).addCls(className);
  12810. },
  12811. function() {
  12812. Ext.fly(dom, INTERNAL).removeCls(className);
  12813. }
  12814. );
  12815. return me;
  12816. },
  12817. addClsOnFocus : function(className, testFn, scope) {
  12818. var me = this,
  12819. dom = me.dom,
  12820. hasTest = Ext.isFunction(testFn);
  12821. me.on("focus", function() {
  12822. if (hasTest && testFn.call(scope || me, me) === false) {
  12823. return false;
  12824. }
  12825. Ext.fly(dom, INTERNAL).addCls(className);
  12826. });
  12827. me.on("blur", function() {
  12828. Ext.fly(dom, INTERNAL).removeCls(className);
  12829. });
  12830. return me;
  12831. },
  12832. addClsOnClick : function(className, testFn, scope) {
  12833. var me = this,
  12834. dom = me.dom,
  12835. hasTest = Ext.isFunction(testFn);
  12836. me.on("mousedown", function() {
  12837. if (hasTest && testFn.call(scope || me, me) === false) {
  12838. return false;
  12839. }
  12840. Ext.fly(dom, INTERNAL).addCls(className);
  12841. var d = Ext.getDoc(),
  12842. fn = function() {
  12843. Ext.fly(dom, INTERNAL).removeCls(className);
  12844. d.removeListener("mouseup", fn);
  12845. };
  12846. d.on("mouseup", fn);
  12847. });
  12848. return me;
  12849. },
  12850. getStyleSize : function() {
  12851. var me = this,
  12852. d = this.dom,
  12853. isDoc = DOCORBODYRE.test(d.nodeName),
  12854. s ,
  12855. w, h;
  12856. if (isDoc) {
  12857. return {
  12858. width : Element.getViewWidth(),
  12859. height : Element.getViewHeight()
  12860. };
  12861. }
  12862. s = me.getStyle([HEIGHT, WIDTH], true);
  12863. if (s.width && s.width != 'auto') {
  12864. w = parseFloat(s.width);
  12865. if (me.isBorderBox()) {
  12866. w -= me.getFrameWidth('lr');
  12867. }
  12868. }
  12869. if (s.height && s.height != 'auto') {
  12870. h = parseFloat(s.height);
  12871. if (me.isBorderBox()) {
  12872. h -= me.getFrameWidth('tb');
  12873. }
  12874. }
  12875. return {width: w || me.getWidth(true), height: h || me.getHeight(true)};
  12876. },
  12877. selectable : function() {
  12878. var me = this;
  12879. me.dom.unselectable = "off";
  12880. me.on('selectstart', function (e) {
  12881. e.stopPropagation();
  12882. return true;
  12883. });
  12884. me.applyStyles("-moz-user-select: text; -khtml-user-select: text;");
  12885. me.removeCls(Ext.baseCSSPrefix + 'unselectable');
  12886. return me;
  12887. },
  12888. unselectable : function() {
  12889. var me = this;
  12890. me.dom.unselectable = "on";
  12891. me.swallowEvent("selectstart", true);
  12892. me.applyStyles("-moz-user-select:-moz-none;-khtml-user-select:none;");
  12893. me.addCls(Ext.baseCSSPrefix + 'unselectable');
  12894. return me;
  12895. }
  12896. });
  12897. Element.prototype.styleHooks = styleHooks = Ext.dom.AbstractElement.prototype.styleHooks;
  12898. if (Ext.isIE6 || Ext.isIE7) {
  12899. styleHooks.fontSize = styleHooks['font-size'] = {
  12900. name: 'fontSize',
  12901. canThrow: true
  12902. };
  12903. styleHooks.fontStyle = styleHooks['font-style'] = {
  12904. name: 'fontStyle',
  12905. canThrow: true
  12906. };
  12907. styleHooks.fontFamily = styleHooks['font-family'] = {
  12908. name: 'fontFamily',
  12909. canThrow: true
  12910. };
  12911. }
  12912. if (Ext.isIEQuirks || Ext.isIE && Ext.ieVersion <= 8) {
  12913. function getBorderWidth (dom, el, inline, style) {
  12914. if (style[this.styleName] == 'none') {
  12915. return '0px';
  12916. }
  12917. return style[this.name];
  12918. }
  12919. edges = ['Top','Right','Bottom','Left'];
  12920. k = edges.length;
  12921. while (k--) {
  12922. edge = edges[k];
  12923. borderWidth = 'border' + edge + 'Width';
  12924. styleHooks['border-'+edge.toLowerCase()+'-width'] = styleHooks[borderWidth] = {
  12925. name: borderWidth,
  12926. styleName: 'border' + edge + 'Style',
  12927. get: getBorderWidth
  12928. };
  12929. }
  12930. }
  12931. }());
  12932. Ext.onReady(function () {
  12933. var opacityRe = /alpha\(opacity=(.*)\)/i,
  12934. trimRe = /^\s+|\s+$/g,
  12935. hooks = Ext.dom.Element.prototype.styleHooks;
  12936. hooks.opacity = {
  12937. name: 'opacity',
  12938. afterSet: function(dom, value, el) {
  12939. if (el.isLayer) {
  12940. el.onOpacitySet(value);
  12941. }
  12942. }
  12943. };
  12944. if (!Ext.supports.Opacity && Ext.isIE) {
  12945. Ext.apply(hooks.opacity, {
  12946. get: function (dom) {
  12947. var filter = dom.style.filter,
  12948. match, opacity;
  12949. if (filter.match) {
  12950. match = filter.match(opacityRe);
  12951. if (match) {
  12952. opacity = parseFloat(match[1]);
  12953. if (!isNaN(opacity)) {
  12954. return opacity ? opacity / 100 : 0;
  12955. }
  12956. }
  12957. }
  12958. return 1;
  12959. },
  12960. set: function (dom, value) {
  12961. var style = dom.style,
  12962. val = style.filter.replace(opacityRe, '').replace(trimRe, '');
  12963. style.zoom = 1;
  12964. if (typeof(value) == 'number' && value >= 0 && value < 1) {
  12965. value *= 100;
  12966. style.filter = val + (val.length ? ' ' : '') + 'alpha(opacity='+value+')';
  12967. } else {
  12968. style.filter = val;
  12969. }
  12970. }
  12971. });
  12972. }
  12973. });
  12974. //@tag dom,core
  12975. //@require Ext.dom.Element-style
  12976. //@define Ext.dom.Element-traversal
  12977. //@define Ext.dom.Element
  12978. Ext.dom.Element.override({
  12979. select: function(selector) {
  12980. return Ext.dom.Element.select(selector, false, this.dom);
  12981. }
  12982. });
  12983. //@tag dom,core
  12984. //@require Ext.dom.Element-traversal
  12985. Ext.define('Ext.dom.CompositeElementLite', {
  12986. alternateClassName: 'Ext.CompositeElementLite',
  12987. requires: ['Ext.dom.Element', 'Ext.dom.Query'],
  12988. statics: {
  12989. importElementMethods: function() {
  12990. var name,
  12991. elementPrototype = Ext.dom.Element.prototype,
  12992. prototype = this.prototype;
  12993. for (name in elementPrototype) {
  12994. if (typeof elementPrototype[name] == 'function'){
  12995. (function(key) {
  12996. prototype[key] = prototype[key] || function() {
  12997. return this.invoke(key, arguments);
  12998. };
  12999. }).call(prototype, name);
  13000. }
  13001. }
  13002. }
  13003. },
  13004. constructor: function(elements, root) {
  13005. this.elements = [];
  13006. this.add(elements, root);
  13007. this.el = new Ext.dom.AbstractElement.Fly();
  13008. },
  13009. isComposite: true,
  13010. getElement: function(el) {
  13011. return this.el.attach(el);
  13012. },
  13013. transformElement: function(el) {
  13014. return Ext.getDom(el);
  13015. },
  13016. getCount: function() {
  13017. return this.elements.length;
  13018. },
  13019. add: function(els, root) {
  13020. var elements = this.elements,
  13021. i, ln;
  13022. if (!els) {
  13023. return this;
  13024. }
  13025. if (typeof els == "string") {
  13026. els = Ext.dom.Element.selectorFunction(els, root);
  13027. }
  13028. else if (els.isComposite) {
  13029. els = els.elements;
  13030. }
  13031. else if (!Ext.isIterable(els)) {
  13032. els = [els];
  13033. }
  13034. for (i = 0, ln = els.length; i < ln; ++i) {
  13035. elements.push(this.transformElement(els[i]));
  13036. }
  13037. return this;
  13038. },
  13039. invoke: function(fn, args) {
  13040. var elements = this.elements,
  13041. ln = elements.length,
  13042. element,
  13043. i;
  13044. fn = Ext.dom.Element.prototype[fn];
  13045. for (i = 0; i < ln; i++) {
  13046. element = elements[i];
  13047. if (element) {
  13048. fn.apply(this.getElement(element), args);
  13049. }
  13050. }
  13051. return this;
  13052. },
  13053. item: function(index) {
  13054. var el = this.elements[index],
  13055. out = null;
  13056. if (el) {
  13057. out = this.getElement(el);
  13058. }
  13059. return out;
  13060. },
  13061. addListener: function(eventName, handler, scope, opt) {
  13062. var els = this.elements,
  13063. len = els.length,
  13064. i, e;
  13065. for (i = 0; i < len; i++) {
  13066. e = els[i];
  13067. if (e) {
  13068. Ext.EventManager.on(e, eventName, handler, scope || e, opt);
  13069. }
  13070. }
  13071. return this;
  13072. },
  13073. each: function(fn, scope) {
  13074. var me = this,
  13075. els = me.elements,
  13076. len = els.length,
  13077. i, e;
  13078. for (i = 0; i < len; i++) {
  13079. e = els[i];
  13080. if (e) {
  13081. e = this.getElement(e);
  13082. if (fn.call(scope || e, e, me, i) === false) {
  13083. break;
  13084. }
  13085. }
  13086. }
  13087. return me;
  13088. },
  13089. fill: function(els) {
  13090. var me = this;
  13091. me.elements = [];
  13092. me.add(els);
  13093. return me;
  13094. },
  13095. filter: function(selector) {
  13096. var me = this,
  13097. els = me.elements,
  13098. len = els.length,
  13099. out = [],
  13100. i = 0,
  13101. isFunc = typeof selector == 'function',
  13102. add,
  13103. el;
  13104. for (; i < len; i++) {
  13105. el = els[i];
  13106. add = false;
  13107. if (el) {
  13108. el = me.getElement(el);
  13109. if (isFunc) {
  13110. add = selector.call(el, el, me, i) !== false;
  13111. } else {
  13112. add = el.is(selector);
  13113. }
  13114. if (add) {
  13115. out.push(me.transformElement(el));
  13116. }
  13117. }
  13118. }
  13119. me.elements = out;
  13120. return me;
  13121. },
  13122. indexOf: function(el) {
  13123. return Ext.Array.indexOf(this.elements, this.transformElement(el));
  13124. },
  13125. replaceElement: function(el, replacement, domReplace) {
  13126. var index = !isNaN(el) ? el : this.indexOf(el),
  13127. d;
  13128. if (index > -1) {
  13129. replacement = Ext.getDom(replacement);
  13130. if (domReplace) {
  13131. d = this.elements[index];
  13132. d.parentNode.insertBefore(replacement, d);
  13133. Ext.removeNode(d);
  13134. }
  13135. Ext.Array.splice(this.elements, index, 1, replacement);
  13136. }
  13137. return this;
  13138. },
  13139. clear: function() {
  13140. this.elements = [];
  13141. },
  13142. addElements: function(els, root) {
  13143. if (!els) {
  13144. return this;
  13145. }
  13146. if (typeof els == "string") {
  13147. els = Ext.dom.Element.selectorFunction(els, root);
  13148. }
  13149. var yels = this.elements,
  13150. eLen = els.length,
  13151. e;
  13152. for (e = 0; e < eLen; e++) {
  13153. yels.push(Ext.get(els[e]));
  13154. }
  13155. return this;
  13156. },
  13157. first: function() {
  13158. return this.item(0);
  13159. },
  13160. last: function() {
  13161. return this.item(this.getCount() - 1);
  13162. },
  13163. contains: function(el) {
  13164. return this.indexOf(el) != -1;
  13165. },
  13166. removeElement: function(keys, removeDom) {
  13167. keys = [].concat(keys);
  13168. var me = this,
  13169. elements = me.elements,
  13170. kLen = keys.length,
  13171. val, el, k;
  13172. for (k = 0; k < kLen; k++) {
  13173. val = keys[k];
  13174. if ((el = (elements[val] || elements[val = me.indexOf(val)]))) {
  13175. if (removeDom) {
  13176. if (el.dom) {
  13177. el.remove();
  13178. } else {
  13179. Ext.removeNode(el);
  13180. }
  13181. }
  13182. Ext.Array.erase(elements, val, 1);
  13183. }
  13184. }
  13185. return me;
  13186. }
  13187. }, function() {
  13188. this.importElementMethods();
  13189. this.prototype.on = this.prototype.addListener;
  13190. if (Ext.DomQuery){
  13191. Ext.dom.Element.selectorFunction = Ext.DomQuery.select;
  13192. }
  13193. Ext.dom.Element.select = function(selector, root) {
  13194. var elements;
  13195. if (typeof selector == "string") {
  13196. elements = Ext.dom.Element.selectorFunction(selector, root);
  13197. }
  13198. else if (selector.length !== undefined) {
  13199. elements = selector;
  13200. }
  13201. else {
  13202. }
  13203. return new Ext.CompositeElementLite(elements);
  13204. };
  13205. Ext.select = function() {
  13206. return Ext.dom.Element.select.apply(Ext.dom.Element, arguments);
  13207. };
  13208. });
  13209. //@tag dom,core
  13210. Ext.define('Ext.dom.CompositeElement', {
  13211. alternateClassName: 'Ext.CompositeElement',
  13212. extend: 'Ext.dom.CompositeElementLite',
  13213. getElement: function(el) {
  13214. return el;
  13215. },
  13216. transformElement: function(el) {
  13217. return Ext.get(el);
  13218. }
  13219. }, function() {
  13220. Ext.dom.Element.select = function(selector, unique, root) {
  13221. var elements;
  13222. if (typeof selector == "string") {
  13223. elements = Ext.dom.Element.selectorFunction(selector, root);
  13224. }
  13225. else if (selector.length !== undefined) {
  13226. elements = selector;
  13227. }
  13228. else {
  13229. }
  13230. return (unique === true) ? new Ext.CompositeElement(elements) : new Ext.CompositeElementLite(elements);
  13231. };
  13232. });
  13233. Ext.select = Ext.Element.select;