mootools-1.6.0.js 550 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700
  1. /* MooTools: the javascript framework. license: MIT-style license. copyright: Copyright (c) 2006-2016 [Valerio Proietti](http://mad4milk.net/).*/
  2. /*!
  3. Web Build: http://mootools.net/more/builder/444dd8f9b276db91102332672b694443
  4. */
  5. /*
  6. ---
  7. name: Core
  8. description: The heart of MooTools.
  9. license: MIT-style license.
  10. copyright: Copyright (c) 2006-2015 [Valerio Proietti](http://mad4milk.net/).
  11. authors: The MooTools production team (http://mootools.net/developers/)
  12. inspiration:
  13. - Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php)
  14. - Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php)
  15. provides: [Core, MooTools, Type, typeOf, instanceOf, Native]
  16. ...
  17. */
  18. /*! MooTools: the javascript framework. license: MIT-style license. copyright: Copyright (c) 2006-2015 [Valerio Proietti](http://mad4milk.net/).*/
  19. (function(){
  20. this.MooTools = {
  21. version: '1.6.0',
  22. build: '529422872adfff401b901b8b6c7ca5114ee95e2b'
  23. };
  24. // typeOf, instanceOf
  25. var typeOf = this.typeOf = function(item){
  26. if (item == null) return 'null';
  27. if (item.$family != null) return item.$family();
  28. if (item.nodeName){
  29. if (item.nodeType == 1) return 'element';
  30. if (item.nodeType == 3) return (/\S/).test(item.nodeValue) ? 'textnode' : 'whitespace';
  31. } else if (typeof item.length == 'number'){
  32. if ('callee' in item) return 'arguments';
  33. if ('item' in item) return 'collection';
  34. }
  35. return typeof item;
  36. };
  37. var instanceOf = this.instanceOf = function(item, object){
  38. if (item == null) return false;
  39. var constructor = item.$constructor || item.constructor;
  40. while (constructor){
  41. if (constructor === object) return true;
  42. constructor = constructor.parent;
  43. }
  44. /*<ltIE8>*/
  45. if (!item.hasOwnProperty) return false;
  46. /*</ltIE8>*/
  47. return item instanceof object;
  48. };
  49. var hasOwnProperty = Object.prototype.hasOwnProperty;
  50. /*<ltIE8>*/
  51. var enumerables = true;
  52. for (var i in {toString: 1}) enumerables = null;
  53. if (enumerables) enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor'];
  54. function forEachObjectEnumberableKey(object, fn, bind){
  55. if (enumerables) for (var i = enumerables.length; i--;){
  56. var k = enumerables[i];
  57. // signature has key-value, so overloadSetter can directly pass the
  58. // method function, without swapping arguments.
  59. if (hasOwnProperty.call(object, k)) fn.call(bind, k, object[k]);
  60. }
  61. }
  62. /*</ltIE8>*/
  63. // Function overloading
  64. var Function = this.Function;
  65. Function.prototype.overloadSetter = function(usePlural){
  66. var self = this;
  67. return function(a, b){
  68. if (a == null) return this;
  69. if (usePlural || typeof a != 'string'){
  70. for (var k in a) self.call(this, k, a[k]);
  71. /*<ltIE8>*/
  72. forEachObjectEnumberableKey(a, self, this);
  73. /*</ltIE8>*/
  74. } else {
  75. self.call(this, a, b);
  76. }
  77. return this;
  78. };
  79. };
  80. Function.prototype.overloadGetter = function(usePlural){
  81. var self = this;
  82. return function(a){
  83. var args, result;
  84. if (typeof a != 'string') args = a;
  85. else if (arguments.length > 1) args = arguments;
  86. else if (usePlural) args = [a];
  87. if (args){
  88. result = {};
  89. for (var i = 0; i < args.length; i++) result[args[i]] = self.call(this, args[i]);
  90. } else {
  91. result = self.call(this, a);
  92. }
  93. return result;
  94. };
  95. };
  96. Function.prototype.extend = function(key, value){
  97. this[key] = value;
  98. }.overloadSetter();
  99. Function.prototype.implement = function(key, value){
  100. this.prototype[key] = value;
  101. }.overloadSetter();
  102. // From
  103. var slice = Array.prototype.slice;
  104. Array.convert = function(item){
  105. if (item == null) return [];
  106. return (Type.isEnumerable(item) && typeof item != 'string') ? (typeOf(item) == 'array') ? item : slice.call(item) : [item];
  107. };
  108. Function.convert = function(item){
  109. return (typeOf(item) == 'function') ? item : function(){
  110. return item;
  111. };
  112. };
  113. Number.convert = function(item){
  114. var number = parseFloat(item);
  115. return isFinite(number) ? number : null;
  116. };
  117. String.convert = function(item){
  118. return item + '';
  119. };
  120. /*<1.5compat>*/
  121. Array.from = Array.convert;
  122. /*</1.5compat>*/
  123. Function.from = Function.convert;
  124. Number.from = Number.convert;
  125. String.from = String.convert;
  126. // hide, protect
  127. Function.implement({
  128. hide: function(){
  129. this.$hidden = true;
  130. return this;
  131. },
  132. protect: function(){
  133. this.$protected = true;
  134. return this;
  135. }
  136. });
  137. // Type
  138. var Type = this.Type = function(name, object){
  139. if (name){
  140. var lower = name.toLowerCase();
  141. var typeCheck = function(item){
  142. return (typeOf(item) == lower);
  143. };
  144. Type['is' + name] = typeCheck;
  145. if (object != null){
  146. object.prototype.$family = (function(){
  147. return lower;
  148. }).hide();
  149. //<1.2compat>
  150. object.type = typeCheck;
  151. //</1.2compat>
  152. }
  153. }
  154. if (object == null) return null;
  155. object.extend(this);
  156. object.$constructor = Type;
  157. object.prototype.$constructor = object;
  158. return object;
  159. };
  160. var toString = Object.prototype.toString;
  161. Type.isEnumerable = function(item){
  162. return (item != null && typeof item.length == 'number' && toString.call(item) != '[object Function]' );
  163. };
  164. var hooks = {};
  165. var hooksOf = function(object){
  166. var type = typeOf(object.prototype);
  167. return hooks[type] || (hooks[type] = []);
  168. };
  169. var implement = function(name, method){
  170. if (method && method.$hidden) return;
  171. var hooks = hooksOf(this);
  172. for (var i = 0; i < hooks.length; i++){
  173. var hook = hooks[i];
  174. if (typeOf(hook) == 'type') implement.call(hook, name, method);
  175. else hook.call(this, name, method);
  176. }
  177. var previous = this.prototype[name];
  178. if (previous == null || !previous.$protected) this.prototype[name] = method;
  179. if (this[name] == null && typeOf(method) == 'function') extend.call(this, name, function(item){
  180. return method.apply(item, slice.call(arguments, 1));
  181. });
  182. };
  183. var extend = function(name, method){
  184. if (method && method.$hidden) return;
  185. var previous = this[name];
  186. if (previous == null || !previous.$protected) this[name] = method;
  187. };
  188. Type.implement({
  189. implement: implement.overloadSetter(),
  190. extend: extend.overloadSetter(),
  191. alias: function(name, existing){
  192. implement.call(this, name, this.prototype[existing]);
  193. }.overloadSetter(),
  194. mirror: function(hook){
  195. hooksOf(this).push(hook);
  196. return this;
  197. }
  198. });
  199. new Type('Type', Type);
  200. // Default Types
  201. var force = function(name, object, methods){
  202. var isType = (object != Object),
  203. prototype = object.prototype;
  204. if (isType) object = new Type(name, object);
  205. for (var i = 0, l = methods.length; i < l; i++){
  206. var key = methods[i],
  207. generic = object[key],
  208. proto = prototype[key];
  209. if (generic) generic.protect();
  210. if (isType && proto) object.implement(key, proto.protect());
  211. }
  212. if (isType){
  213. var methodsEnumerable = prototype.propertyIsEnumerable(methods[0]);
  214. object.forEachMethod = function(fn){
  215. if (!methodsEnumerable) for (var i = 0, l = methods.length; i < l; i++){
  216. fn.call(prototype, prototype[methods[i]], methods[i]);
  217. }
  218. for (var key in prototype) fn.call(prototype, prototype[key], key);
  219. };
  220. }
  221. return force;
  222. };
  223. force('String', String, [
  224. 'charAt', 'charCodeAt', 'concat', 'contains', 'indexOf', 'lastIndexOf', 'match', 'quote', 'replace', 'search',
  225. 'slice', 'split', 'substr', 'substring', 'trim', 'toLowerCase', 'toUpperCase'
  226. ])('Array', Array, [
  227. 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice',
  228. 'indexOf', 'lastIndexOf', 'filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight', 'contains'
  229. ])('Number', Number, [
  230. 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision'
  231. ])('Function', Function, [
  232. 'apply', 'call', 'bind'
  233. ])('RegExp', RegExp, [
  234. 'exec', 'test'
  235. ])('Object', Object, [
  236. 'create', 'defineProperty', 'defineProperties', 'keys',
  237. 'getPrototypeOf', 'getOwnPropertyDescriptor', 'getOwnPropertyNames',
  238. 'preventExtensions', 'isExtensible', 'seal', 'isSealed', 'freeze', 'isFrozen'
  239. ])('Date', Date, ['now']);
  240. Object.extend = extend.overloadSetter();
  241. Date.extend('now', function(){
  242. return +(new Date);
  243. });
  244. new Type('Boolean', Boolean);
  245. // fixes NaN returning as Number
  246. Number.prototype.$family = function(){
  247. return isFinite(this) ? 'number' : 'null';
  248. }.hide();
  249. // Number.random
  250. Number.extend('random', function(min, max){
  251. return Math.floor(Math.random() * (max - min + 1) + min);
  252. });
  253. // forEach, each, keys
  254. Array.implement({
  255. /*<!ES5>*/
  256. forEach: function(fn, bind){
  257. for (var i = 0, l = this.length; i < l; i++){
  258. if (i in this) fn.call(bind, this[i], i, this);
  259. }
  260. },
  261. /*</!ES5>*/
  262. each: function(fn, bind){
  263. Array.forEach(this, fn, bind);
  264. return this;
  265. }
  266. });
  267. Object.extend({
  268. keys: function(object){
  269. var keys = [];
  270. for (var k in object){
  271. if (hasOwnProperty.call(object, k)) keys.push(k);
  272. }
  273. /*<ltIE8>*/
  274. forEachObjectEnumberableKey(object, function(k){
  275. keys.push(k);
  276. });
  277. /*</ltIE8>*/
  278. return keys;
  279. },
  280. forEach: function(object, fn, bind){
  281. if (object) Object.keys(object).forEach(function(key){
  282. fn.call(bind, object[key], key, object);
  283. });
  284. }
  285. });
  286. Object.each = Object.forEach;
  287. // Array & Object cloning, Object merging and appending
  288. var cloneOf = function(item){
  289. switch (typeOf(item)){
  290. case 'array': return item.clone();
  291. case 'object': return Object.clone(item);
  292. default: return item;
  293. }
  294. };
  295. Array.implement('clone', function(){
  296. var i = this.length, clone = new Array(i);
  297. while (i--) clone[i] = cloneOf(this[i]);
  298. return clone;
  299. });
  300. var mergeOne = function(source, key, current){
  301. switch (typeOf(current)){
  302. case 'object':
  303. if (typeOf(source[key]) == 'object') Object.merge(source[key], current);
  304. else source[key] = Object.clone(current);
  305. break;
  306. case 'array': source[key] = current.clone(); break;
  307. default: source[key] = current;
  308. }
  309. return source;
  310. };
  311. Object.extend({
  312. merge: function(source, k, v){
  313. if (typeOf(k) == 'string') return mergeOne(source, k, v);
  314. for (var i = 1, l = arguments.length; i < l; i++){
  315. var object = arguments[i];
  316. for (var key in object) mergeOne(source, key, object[key]);
  317. }
  318. return source;
  319. },
  320. clone: function(object){
  321. var clone = {};
  322. for (var key in object) clone[key] = cloneOf(object[key]);
  323. return clone;
  324. },
  325. append: function(original){
  326. for (var i = 1, l = arguments.length; i < l; i++){
  327. var extended = arguments[i] || {};
  328. for (var key in extended) original[key] = extended[key];
  329. }
  330. return original;
  331. }
  332. });
  333. // Object-less types
  334. ['Object', 'WhiteSpace', 'TextNode', 'Collection', 'Arguments'].each(function(name){
  335. new Type(name);
  336. });
  337. // Unique ID
  338. var UID = Date.now();
  339. String.extend('uniqueID', function(){
  340. return (UID++).toString(36);
  341. });
  342. //<1.2compat>
  343. var Hash = this.Hash = new Type('Hash', function(object){
  344. if (typeOf(object) == 'hash') object = Object.clone(object.getClean());
  345. for (var key in object) this[key] = object[key];
  346. return this;
  347. });
  348. Hash.implement({
  349. forEach: function(fn, bind){
  350. Object.forEach(this, fn, bind);
  351. },
  352. getClean: function(){
  353. var clean = {};
  354. for (var key in this){
  355. if (this.hasOwnProperty(key)) clean[key] = this[key];
  356. }
  357. return clean;
  358. },
  359. getLength: function(){
  360. var length = 0;
  361. for (var key in this){
  362. if (this.hasOwnProperty(key)) length++;
  363. }
  364. return length;
  365. }
  366. });
  367. Hash.alias('each', 'forEach');
  368. Object.type = Type.isObject;
  369. var Native = this.Native = function(properties){
  370. return new Type(properties.name, properties.initialize);
  371. };
  372. Native.type = Type.type;
  373. Native.implement = function(objects, methods){
  374. for (var i = 0; i < objects.length; i++) objects[i].implement(methods);
  375. return Native;
  376. };
  377. var arrayType = Array.type;
  378. Array.type = function(item){
  379. return instanceOf(item, Array) || arrayType(item);
  380. };
  381. this.$A = function(item){
  382. return Array.convert(item).slice();
  383. };
  384. this.$arguments = function(i){
  385. return function(){
  386. return arguments[i];
  387. };
  388. };
  389. this.$chk = function(obj){
  390. return !!(obj || obj === 0);
  391. };
  392. this.$clear = function(timer){
  393. clearTimeout(timer);
  394. clearInterval(timer);
  395. return null;
  396. };
  397. this.$defined = function(obj){
  398. return (obj != null);
  399. };
  400. this.$each = function(iterable, fn, bind){
  401. var type = typeOf(iterable);
  402. ((type == 'arguments' || type == 'collection' || type == 'array' || type == 'elements') ? Array : Object).each(iterable, fn, bind);
  403. };
  404. this.$empty = function(){};
  405. this.$extend = function(original, extended){
  406. return Object.append(original, extended);
  407. };
  408. this.$H = function(object){
  409. return new Hash(object);
  410. };
  411. this.$merge = function(){
  412. var args = Array.slice(arguments);
  413. args.unshift({});
  414. return Object.merge.apply(null, args);
  415. };
  416. this.$lambda = Function.convert;
  417. this.$mixin = Object.merge;
  418. this.$random = Number.random;
  419. this.$splat = Array.convert;
  420. this.$time = Date.now;
  421. this.$type = function(object){
  422. var type = typeOf(object);
  423. if (type == 'elements') return 'array';
  424. return (type == 'null') ? false : type;
  425. };
  426. this.$unlink = function(object){
  427. switch (typeOf(object)){
  428. case 'object': return Object.clone(object);
  429. case 'array': return Array.clone(object);
  430. case 'hash': return new Hash(object);
  431. default: return object;
  432. }
  433. };
  434. //</1.2compat>
  435. })();
  436. /*
  437. ---
  438. name: Array
  439. description: Contains Array Prototypes like each, contains, and erase.
  440. license: MIT-style license.
  441. requires: [Type]
  442. provides: Array
  443. ...
  444. */
  445. Array.implement({
  446. /*<!ES5>*/
  447. every: function(fn, bind){
  448. for (var i = 0, l = this.length >>> 0; i < l; i++){
  449. if ((i in this) && !fn.call(bind, this[i], i, this)) return false;
  450. }
  451. return true;
  452. },
  453. filter: function(fn, bind){
  454. var results = [];
  455. for (var value, i = 0, l = this.length >>> 0; i < l; i++) if (i in this){
  456. value = this[i];
  457. if (fn.call(bind, value, i, this)) results.push(value);
  458. }
  459. return results;
  460. },
  461. indexOf: function(item, from){
  462. var length = this.length >>> 0;
  463. for (var i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++){
  464. if (this[i] === item) return i;
  465. }
  466. return -1;
  467. },
  468. map: function(fn, bind){
  469. var length = this.length >>> 0, results = Array(length);
  470. for (var i = 0; i < length; i++){
  471. if (i in this) results[i] = fn.call(bind, this[i], i, this);
  472. }
  473. return results;
  474. },
  475. some: function(fn, bind){
  476. for (var i = 0, l = this.length >>> 0; i < l; i++){
  477. if ((i in this) && fn.call(bind, this[i], i, this)) return true;
  478. }
  479. return false;
  480. },
  481. /*</!ES5>*/
  482. clean: function(){
  483. return this.filter(function(item){
  484. return item != null;
  485. });
  486. },
  487. invoke: function(methodName){
  488. var args = Array.slice(arguments, 1);
  489. return this.map(function(item){
  490. return item[methodName].apply(item, args);
  491. });
  492. },
  493. associate: function(keys){
  494. var obj = {}, length = Math.min(this.length, keys.length);
  495. for (var i = 0; i < length; i++) obj[keys[i]] = this[i];
  496. return obj;
  497. },
  498. link: function(object){
  499. var result = {};
  500. for (var i = 0, l = this.length; i < l; i++){
  501. for (var key in object){
  502. if (object[key](this[i])){
  503. result[key] = this[i];
  504. delete object[key];
  505. break;
  506. }
  507. }
  508. }
  509. return result;
  510. },
  511. contains: function(item, from){
  512. return this.indexOf(item, from) != -1;
  513. },
  514. append: function(array){
  515. this.push.apply(this, array);
  516. return this;
  517. },
  518. getLast: function(){
  519. return (this.length) ? this[this.length - 1] : null;
  520. },
  521. getRandom: function(){
  522. return (this.length) ? this[Number.random(0, this.length - 1)] : null;
  523. },
  524. include: function(item){
  525. if (!this.contains(item)) this.push(item);
  526. return this;
  527. },
  528. combine: function(array){
  529. for (var i = 0, l = array.length; i < l; i++) this.include(array[i]);
  530. return this;
  531. },
  532. erase: function(item){
  533. for (var i = this.length; i--;){
  534. if (this[i] === item) this.splice(i, 1);
  535. }
  536. return this;
  537. },
  538. empty: function(){
  539. this.length = 0;
  540. return this;
  541. },
  542. flatten: function(){
  543. var array = [];
  544. for (var i = 0, l = this.length; i < l; i++){
  545. var type = typeOf(this[i]);
  546. if (type == 'null') continue;
  547. array = array.concat((type == 'array' || type == 'collection' || type == 'arguments' || instanceOf(this[i], Array)) ? Array.flatten(this[i]) : this[i]);
  548. }
  549. return array;
  550. },
  551. pick: function(){
  552. for (var i = 0, l = this.length; i < l; i++){
  553. if (this[i] != null) return this[i];
  554. }
  555. return null;
  556. },
  557. hexToRgb: function(array){
  558. if (this.length != 3) return null;
  559. var rgb = this.map(function(value){
  560. if (value.length == 1) value += value;
  561. return parseInt(value, 16);
  562. });
  563. return (array) ? rgb : 'rgb(' + rgb + ')';
  564. },
  565. rgbToHex: function(array){
  566. if (this.length < 3) return null;
  567. if (this.length == 4 && this[3] == 0 && !array) return 'transparent';
  568. var hex = [];
  569. for (var i = 0; i < 3; i++){
  570. var bit = (this[i] - 0).toString(16);
  571. hex.push((bit.length == 1) ? '0' + bit : bit);
  572. }
  573. return (array) ? hex : '#' + hex.join('');
  574. }
  575. });
  576. //<1.2compat>
  577. Array.alias('extend', 'append');
  578. var $pick = this.$pick = function(){
  579. return Array.convert(arguments).pick();
  580. };
  581. //</1.2compat>
  582. /*
  583. ---
  584. name: Function
  585. description: Contains Function Prototypes like create, bind, pass, and delay.
  586. license: MIT-style license.
  587. requires: Type
  588. provides: Function
  589. ...
  590. */
  591. Function.extend({
  592. attempt: function(){
  593. for (var i = 0, l = arguments.length; i < l; i++){
  594. try {
  595. return arguments[i]();
  596. } catch (e){}
  597. }
  598. return null;
  599. }
  600. });
  601. Function.implement({
  602. attempt: function(args, bind){
  603. try {
  604. return this.apply(bind, Array.convert(args));
  605. } catch (e){}
  606. return null;
  607. },
  608. /*<!ES5-bind>*/
  609. bind: function(that){
  610. var self = this,
  611. args = arguments.length > 1 ? Array.slice(arguments, 1) : null,
  612. F = function(){};
  613. var bound = function(){
  614. var context = that, length = arguments.length;
  615. if (this instanceof bound){
  616. F.prototype = self.prototype;
  617. context = new F;
  618. }
  619. var result = (!args && !length)
  620. ? self.call(context)
  621. : self.apply(context, args && length ? args.concat(Array.slice(arguments)) : args || arguments);
  622. return context == that ? result : context;
  623. };
  624. return bound;
  625. },
  626. /*</!ES5-bind>*/
  627. pass: function(args, bind){
  628. var self = this;
  629. if (args != null) args = Array.convert(args);
  630. return function(){
  631. return self.apply(bind, args || arguments);
  632. };
  633. },
  634. delay: function(delay, bind, args){
  635. return setTimeout(this.pass((args == null ? [] : args), bind), delay);
  636. },
  637. periodical: function(periodical, bind, args){
  638. return setInterval(this.pass((args == null ? [] : args), bind), periodical);
  639. }
  640. });
  641. //<1.2compat>
  642. delete Function.prototype.bind;
  643. Function.implement({
  644. create: function(options){
  645. var self = this;
  646. options = options || {};
  647. return function(event){
  648. var args = options.arguments;
  649. args = (args != null) ? Array.convert(args) : Array.slice(arguments, (options.event) ? 1 : 0);
  650. if (options.event) args.unshift(event || window.event);
  651. var returns = function(){
  652. return self.apply(options.bind || null, args);
  653. };
  654. if (options.delay) return setTimeout(returns, options.delay);
  655. if (options.periodical) return setInterval(returns, options.periodical);
  656. if (options.attempt) return Function.attempt(returns);
  657. return returns();
  658. };
  659. },
  660. bind: function(bind, args){
  661. var self = this;
  662. if (args != null) args = Array.convert(args);
  663. return function(){
  664. return self.apply(bind, args || arguments);
  665. };
  666. },
  667. bindWithEvent: function(bind, args){
  668. var self = this;
  669. if (args != null) args = Array.convert(args);
  670. return function(event){
  671. return self.apply(bind, (args == null) ? arguments : [event].concat(args));
  672. };
  673. },
  674. run: function(args, bind){
  675. return this.apply(bind, Array.convert(args));
  676. }
  677. });
  678. if (Object.create == Function.prototype.create) Object.create = null;
  679. var $try = Function.attempt;
  680. //</1.2compat>
  681. /*
  682. ---
  683. name: Number
  684. description: Contains Number Prototypes like limit, round, times, and ceil.
  685. license: MIT-style license.
  686. requires: Type
  687. provides: Number
  688. ...
  689. */
  690. Number.implement({
  691. limit: function(min, max){
  692. return Math.min(max, Math.max(min, this));
  693. },
  694. round: function(precision){
  695. precision = Math.pow(10, precision || 0).toFixed(precision < 0 ? -precision : 0);
  696. return Math.round(this * precision) / precision;
  697. },
  698. times: function(fn, bind){
  699. for (var i = 0; i < this; i++) fn.call(bind, i, this);
  700. },
  701. toFloat: function(){
  702. return parseFloat(this);
  703. },
  704. toInt: function(base){
  705. return parseInt(this, base || 10);
  706. }
  707. });
  708. Number.alias('each', 'times');
  709. (function(math){
  710. var methods = {};
  711. math.each(function(name){
  712. if (!Number[name]) methods[name] = function(){
  713. return Math[name].apply(null, [this].concat(Array.convert(arguments)));
  714. };
  715. });
  716. Number.implement(methods);
  717. })(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']);
  718. /*
  719. ---
  720. name: String
  721. description: Contains String Prototypes like camelCase, capitalize, test, and toInt.
  722. license: MIT-style license.
  723. requires: [Type, Array]
  724. provides: String
  725. ...
  726. */
  727. String.implement({
  728. //<!ES6>
  729. contains: function(string, index){
  730. return (index ? String(this).slice(index) : String(this)).indexOf(string) > -1;
  731. },
  732. //</!ES6>
  733. test: function(regex, params){
  734. return ((typeOf(regex) == 'regexp') ? regex : new RegExp('' + regex, params)).test(this);
  735. },
  736. trim: function(){
  737. return String(this).replace(/^\s+|\s+$/g, '');
  738. },
  739. clean: function(){
  740. return String(this).replace(/\s+/g, ' ').trim();
  741. },
  742. camelCase: function(){
  743. return String(this).replace(/-\D/g, function(match){
  744. return match.charAt(1).toUpperCase();
  745. });
  746. },
  747. hyphenate: function(){
  748. return String(this).replace(/[A-Z]/g, function(match){
  749. return ('-' + match.charAt(0).toLowerCase());
  750. });
  751. },
  752. capitalize: function(){
  753. return String(this).replace(/\b[a-z]/g, function(match){
  754. return match.toUpperCase();
  755. });
  756. },
  757. escapeRegExp: function(){
  758. return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1');
  759. },
  760. toInt: function(base){
  761. return parseInt(this, base || 10);
  762. },
  763. toFloat: function(){
  764. return parseFloat(this);
  765. },
  766. hexToRgb: function(array){
  767. var hex = String(this).match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
  768. return (hex) ? hex.slice(1).hexToRgb(array) : null;
  769. },
  770. rgbToHex: function(array){
  771. var rgb = String(this).match(/\d{1,3}/g);
  772. return (rgb) ? rgb.rgbToHex(array) : null;
  773. },
  774. substitute: function(object, regexp){
  775. return String(this).replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){
  776. if (match.charAt(0) == '\\') return match.slice(1);
  777. return (object[name] != null) ? object[name] : '';
  778. });
  779. }
  780. });
  781. //<1.4compat>
  782. String.prototype.contains = function(string, separator){
  783. return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : String(this).indexOf(string) > -1;
  784. };
  785. //</1.4compat>
  786. /*
  787. ---
  788. name: Browser
  789. description: The Browser Object. Contains Browser initialization, Window and Document, and the Browser Hash.
  790. license: MIT-style license.
  791. requires: [Array, Function, Number, String]
  792. provides: [Browser, Window, Document]
  793. ...
  794. */
  795. (function(){
  796. var document = this.document;
  797. var window = document.window = this;
  798. var parse = function(ua, platform){
  799. ua = ua.toLowerCase();
  800. platform = (platform ? platform.toLowerCase() : '');
  801. // chrome is included in the edge UA, so need to check for edge first,
  802. // before checking if it's chrome.
  803. var UA = ua.match(/(edge)[\s\/:]([\w\d\.]+)/);
  804. if (!UA){
  805. UA = ua.match(/(opera|ie|firefox|chrome|trident|crios|version)[\s\/:]([\w\d\.]+)?.*?(safari|(?:rv[\s\/:]|version[\s\/:])([\w\d\.]+)|$)/) || [null, 'unknown', 0];
  806. }
  807. if (UA[1] == 'trident'){
  808. UA[1] = 'ie';
  809. if (UA[4]) UA[2] = UA[4];
  810. } else if (UA[1] == 'crios'){
  811. UA[1] = 'chrome';
  812. }
  813. platform = ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android)/) || ua.match(/mac|win|linux/) || ['other'])[0];
  814. if (platform == 'win') platform = 'windows';
  815. return {
  816. extend: Function.prototype.extend,
  817. name: (UA[1] == 'version') ? UA[3] : UA[1],
  818. version: parseFloat((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]),
  819. platform: platform
  820. };
  821. };
  822. var Browser = this.Browser = parse(navigator.userAgent, navigator.platform);
  823. if (Browser.name == 'ie' && document.documentMode){
  824. Browser.version = document.documentMode;
  825. }
  826. Browser.extend({
  827. Features: {
  828. xpath: !!(document.evaluate),
  829. air: !!(window.runtime),
  830. query: !!(document.querySelector),
  831. json: !!(window.JSON)
  832. },
  833. parseUA: parse
  834. });
  835. //<1.4compat>
  836. Browser[Browser.name] = true;
  837. Browser[Browser.name + parseInt(Browser.version, 10)] = true;
  838. if (Browser.name == 'ie' && Browser.version >= '11'){
  839. delete Browser.ie;
  840. }
  841. var platform = Browser.platform;
  842. if (platform == 'windows'){
  843. platform = 'win';
  844. }
  845. Browser.Platform = {
  846. name: platform
  847. };
  848. Browser.Platform[platform] = true;
  849. //</1.4compat>
  850. // Request
  851. Browser.Request = (function(){
  852. var XMLHTTP = function(){
  853. return new XMLHttpRequest();
  854. };
  855. var MSXML2 = function(){
  856. return new ActiveXObject('MSXML2.XMLHTTP');
  857. };
  858. var MSXML = function(){
  859. return new ActiveXObject('Microsoft.XMLHTTP');
  860. };
  861. return Function.attempt(function(){
  862. XMLHTTP();
  863. return XMLHTTP;
  864. }, function(){
  865. MSXML2();
  866. return MSXML2;
  867. }, function(){
  868. MSXML();
  869. return MSXML;
  870. });
  871. })();
  872. Browser.Features.xhr = !!(Browser.Request);
  873. //<1.4compat>
  874. // Flash detection
  875. var version = (Function.attempt(function(){
  876. return navigator.plugins['Shockwave Flash'].description;
  877. }, function(){
  878. return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
  879. }) || '0 r0').match(/\d+/g);
  880. Browser.Plugins = {
  881. Flash: {
  882. version: Number(version[0] || '0.' + version[1]) || 0,
  883. build: Number(version[2]) || 0
  884. }
  885. };
  886. //</1.4compat>
  887. // String scripts
  888. Browser.exec = function(text){
  889. if (!text) return text;
  890. if (window.execScript){
  891. window.execScript(text);
  892. } else {
  893. var script = document.createElement('script');
  894. script.setAttribute('type', 'text/javascript');
  895. script.text = text;
  896. document.head.appendChild(script);
  897. document.head.removeChild(script);
  898. }
  899. return text;
  900. };
  901. String.implement('stripScripts', function(exec){
  902. var scripts = '';
  903. var text = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(all, code){
  904. scripts += code + '\n';
  905. return '';
  906. });
  907. if (exec === true) Browser.exec(scripts);
  908. else if (typeOf(exec) == 'function') exec(scripts, text);
  909. return text;
  910. });
  911. // Window, Document
  912. Browser.extend({
  913. Document: this.Document,
  914. Window: this.Window,
  915. Element: this.Element,
  916. Event: this.Event
  917. });
  918. this.Window = this.$constructor = new Type('Window', function(){});
  919. this.$family = Function.convert('window').hide();
  920. Window.mirror(function(name, method){
  921. window[name] = method;
  922. });
  923. this.Document = document.$constructor = new Type('Document', function(){});
  924. document.$family = Function.convert('document').hide();
  925. Document.mirror(function(name, method){
  926. document[name] = method;
  927. });
  928. document.html = document.documentElement;
  929. if (!document.head) document.head = document.getElementsByTagName('head')[0];
  930. if (document.execCommand) try {
  931. document.execCommand('BackgroundImageCache', false, true);
  932. } catch (e){}
  933. /*<ltIE9>*/
  934. if (this.attachEvent && !this.addEventListener){
  935. var unloadEvent = function(){
  936. this.detachEvent('onunload', unloadEvent);
  937. document.head = document.html = document.window = null;
  938. window = this.Window = document = null;
  939. };
  940. this.attachEvent('onunload', unloadEvent);
  941. }
  942. // IE fails on collections and <select>.options (refers to <select>)
  943. var arrayFrom = Array.convert;
  944. try {
  945. arrayFrom(document.html.childNodes);
  946. } catch (e){
  947. Array.convert = function(item){
  948. if (typeof item != 'string' && Type.isEnumerable(item) && typeOf(item) != 'array'){
  949. var i = item.length, array = new Array(i);
  950. while (i--) array[i] = item[i];
  951. return array;
  952. }
  953. return arrayFrom(item);
  954. };
  955. var prototype = Array.prototype,
  956. slice = prototype.slice;
  957. ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice'].each(function(name){
  958. var method = prototype[name];
  959. Array[name] = function(item){
  960. return method.apply(Array.convert(item), slice.call(arguments, 1));
  961. };
  962. });
  963. }
  964. /*</ltIE9>*/
  965. //<1.2compat>
  966. if (Browser.Platform.ios) Browser.Platform.ipod = true;
  967. Browser.Engine = {};
  968. var setEngine = function(name, version){
  969. Browser.Engine.name = name;
  970. Browser.Engine[name + version] = true;
  971. Browser.Engine.version = version;
  972. };
  973. if (Browser.ie){
  974. Browser.Engine.trident = true;
  975. switch (Browser.version){
  976. case 6: setEngine('trident', 4); break;
  977. case 7: setEngine('trident', 5); break;
  978. case 8: setEngine('trident', 6);
  979. }
  980. }
  981. if (Browser.firefox){
  982. Browser.Engine.gecko = true;
  983. if (Browser.version >= 3) setEngine('gecko', 19);
  984. else setEngine('gecko', 18);
  985. }
  986. if (Browser.safari || Browser.chrome){
  987. Browser.Engine.webkit = true;
  988. switch (Browser.version){
  989. case 2: setEngine('webkit', 419); break;
  990. case 3: setEngine('webkit', 420); break;
  991. case 4: setEngine('webkit', 525);
  992. }
  993. }
  994. if (Browser.opera){
  995. Browser.Engine.presto = true;
  996. if (Browser.version >= 9.6) setEngine('presto', 960);
  997. else if (Browser.version >= 9.5) setEngine('presto', 950);
  998. else setEngine('presto', 925);
  999. }
  1000. if (Browser.name == 'unknown'){
  1001. switch ((navigator.userAgent.toLowerCase().match(/(?:webkit|khtml|gecko)/) || [])[0]){
  1002. case 'webkit':
  1003. case 'khtml':
  1004. Browser.Engine.webkit = true;
  1005. break;
  1006. case 'gecko':
  1007. Browser.Engine.gecko = true;
  1008. }
  1009. }
  1010. this.$exec = Browser.exec;
  1011. //</1.2compat>
  1012. })();
  1013. /*
  1014. ---
  1015. name: Class
  1016. description: Contains the Class Function for easily creating, extending, and implementing reusable Classes.
  1017. license: MIT-style license.
  1018. requires: [Array, String, Function, Number]
  1019. provides: Class
  1020. ...
  1021. */
  1022. (function(){
  1023. var Class = this.Class = new Type('Class', function(params){
  1024. if (instanceOf(params, Function)) params = {initialize: params};
  1025. var newClass = function(){
  1026. reset(this);
  1027. if (newClass.$prototyping) return this;
  1028. this.$caller = null;
  1029. this.$family = null;
  1030. var value = (this.initialize) ? this.initialize.apply(this, arguments) : this;
  1031. this.$caller = this.caller = null;
  1032. return value;
  1033. }.extend(this).implement(params);
  1034. newClass.$constructor = Class;
  1035. newClass.prototype.$constructor = newClass;
  1036. newClass.prototype.parent = parent;
  1037. return newClass;
  1038. });
  1039. var parent = function(){
  1040. if (!this.$caller) throw new Error('The method "parent" cannot be called.');
  1041. var name = this.$caller.$name,
  1042. parent = this.$caller.$owner.parent,
  1043. previous = (parent) ? parent.prototype[name] : null;
  1044. if (!previous) throw new Error('The method "' + name + '" has no parent.');
  1045. return previous.apply(this, arguments);
  1046. };
  1047. var reset = function(object){
  1048. for (var key in object){
  1049. var value = object[key];
  1050. switch (typeOf(value)){
  1051. case 'object':
  1052. var F = function(){};
  1053. F.prototype = value;
  1054. object[key] = reset(new F);
  1055. break;
  1056. case 'array': object[key] = value.clone(); break;
  1057. }
  1058. }
  1059. return object;
  1060. };
  1061. var wrap = function(self, key, method){
  1062. if (method.$origin) method = method.$origin;
  1063. var wrapper = function(){
  1064. if (method.$protected && this.$caller == null) throw new Error('The method "' + key + '" cannot be called.');
  1065. var caller = this.caller, current = this.$caller;
  1066. this.caller = current; this.$caller = wrapper;
  1067. var result = method.apply(this, arguments);
  1068. this.$caller = current; this.caller = caller;
  1069. return result;
  1070. }.extend({$owner: self, $origin: method, $name: key});
  1071. return wrapper;
  1072. };
  1073. var implement = function(key, value, retain){
  1074. if (Class.Mutators.hasOwnProperty(key)){
  1075. value = Class.Mutators[key].call(this, value);
  1076. if (value == null) return this;
  1077. }
  1078. if (typeOf(value) == 'function'){
  1079. if (value.$hidden) return this;
  1080. this.prototype[key] = (retain) ? value : wrap(this, key, value);
  1081. } else {
  1082. Object.merge(this.prototype, key, value);
  1083. }
  1084. return this;
  1085. };
  1086. var getInstance = function(klass){
  1087. klass.$prototyping = true;
  1088. var proto = new klass;
  1089. delete klass.$prototyping;
  1090. return proto;
  1091. };
  1092. Class.implement('implement', implement.overloadSetter());
  1093. Class.Mutators = {
  1094. Extends: function(parent){
  1095. this.parent = parent;
  1096. this.prototype = getInstance(parent);
  1097. },
  1098. Implements: function(items){
  1099. Array.convert(items).each(function(item){
  1100. var instance = new item;
  1101. for (var key in instance) implement.call(this, key, instance[key], true);
  1102. }, this);
  1103. }
  1104. };
  1105. })();
  1106. /*
  1107. ---
  1108. name: Class.Extras
  1109. description: Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks.
  1110. license: MIT-style license.
  1111. requires: Class
  1112. provides: [Class.Extras, Chain, Events, Options]
  1113. ...
  1114. */
  1115. (function(){
  1116. this.Chain = new Class({
  1117. $chain: [],
  1118. chain: function(){
  1119. this.$chain.append(Array.flatten(arguments));
  1120. return this;
  1121. },
  1122. callChain: function(){
  1123. return (this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false;
  1124. },
  1125. clearChain: function(){
  1126. this.$chain.empty();
  1127. return this;
  1128. }
  1129. });
  1130. var removeOn = function(string){
  1131. return string.replace(/^on([A-Z])/, function(full, first){
  1132. return first.toLowerCase();
  1133. });
  1134. };
  1135. this.Events = new Class({
  1136. $events: {},
  1137. addEvent: function(type, fn, internal){
  1138. type = removeOn(type);
  1139. /*<1.2compat>*/
  1140. if (fn == $empty) return this;
  1141. /*</1.2compat>*/
  1142. this.$events[type] = (this.$events[type] || []).include(fn);
  1143. if (internal) fn.internal = true;
  1144. return this;
  1145. },
  1146. addEvents: function(events){
  1147. for (var type in events) this.addEvent(type, events[type]);
  1148. return this;
  1149. },
  1150. fireEvent: function(type, args, delay){
  1151. type = removeOn(type);
  1152. var events = this.$events[type];
  1153. if (!events) return this;
  1154. args = Array.convert(args);
  1155. events.each(function(fn){
  1156. if (delay) fn.delay(delay, this, args);
  1157. else fn.apply(this, args);
  1158. }, this);
  1159. return this;
  1160. },
  1161. removeEvent: function(type, fn){
  1162. type = removeOn(type);
  1163. var events = this.$events[type];
  1164. if (events && !fn.internal){
  1165. var index = events.indexOf(fn);
  1166. if (index != -1) delete events[index];
  1167. }
  1168. return this;
  1169. },
  1170. removeEvents: function(events){
  1171. var type;
  1172. if (typeOf(events) == 'object'){
  1173. for (type in events) this.removeEvent(type, events[type]);
  1174. return this;
  1175. }
  1176. if (events) events = removeOn(events);
  1177. for (type in this.$events){
  1178. if (events && events != type) continue;
  1179. var fns = this.$events[type];
  1180. for (var i = fns.length; i--;) if (i in fns){
  1181. this.removeEvent(type, fns[i]);
  1182. }
  1183. }
  1184. return this;
  1185. }
  1186. });
  1187. this.Options = new Class({
  1188. setOptions: function(){
  1189. var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments));
  1190. if (this.addEvent) for (var option in options){
  1191. if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue;
  1192. this.addEvent(option, options[option]);
  1193. delete options[option];
  1194. }
  1195. return this;
  1196. }
  1197. });
  1198. })();
  1199. /*
  1200. ---
  1201. name: Class.Thenable
  1202. description: Contains a Utility Class that can be implemented into your own Classes to make them "thenable".
  1203. license: MIT-style license.
  1204. requires: Class
  1205. provides: [Class.Thenable]
  1206. ...
  1207. */
  1208. (function(){
  1209. var STATE_PENDING = 0,
  1210. STATE_FULFILLED = 1,
  1211. STATE_REJECTED = 2;
  1212. var Thenable = Class.Thenable = new Class({
  1213. $thenableState: STATE_PENDING,
  1214. $thenableResult: null,
  1215. $thenableReactions: [],
  1216. resolve: function(value){
  1217. resolve(this, value);
  1218. return this;
  1219. },
  1220. reject: function(reason){
  1221. reject(this, reason);
  1222. return this;
  1223. },
  1224. getThenableState: function(){
  1225. switch (this.$thenableState){
  1226. case STATE_PENDING:
  1227. return 'pending';
  1228. case STATE_FULFILLED:
  1229. return 'fulfilled';
  1230. case STATE_REJECTED:
  1231. return 'rejected';
  1232. }
  1233. },
  1234. resetThenable: function(reason){
  1235. reject(this, reason);
  1236. reset(this);
  1237. return this;
  1238. },
  1239. then: function(onFulfilled, onRejected){
  1240. if (typeof onFulfilled !== 'function') onFulfilled = 'Identity';
  1241. if (typeof onRejected !== 'function') onRejected = 'Thrower';
  1242. var thenable = new Thenable();
  1243. this.$thenableReactions.push({
  1244. thenable: thenable,
  1245. fulfillHandler: onFulfilled,
  1246. rejectHandler: onRejected
  1247. });
  1248. if (this.$thenableState !== STATE_PENDING){
  1249. react(this);
  1250. }
  1251. return thenable;
  1252. },
  1253. 'catch': function(onRejected){
  1254. return this.then(null, onRejected);
  1255. }
  1256. });
  1257. Thenable.extend({
  1258. resolve: function(value){
  1259. var thenable;
  1260. if (value instanceof Thenable){
  1261. thenable = value;
  1262. } else {
  1263. thenable = new Thenable();
  1264. resolve(thenable, value);
  1265. }
  1266. return thenable;
  1267. },
  1268. reject: function(reason){
  1269. var thenable = new Thenable();
  1270. reject(thenable, reason);
  1271. return thenable;
  1272. }
  1273. });
  1274. // Private functions
  1275. function resolve(thenable, value){
  1276. if (thenable.$thenableState === STATE_PENDING){
  1277. if (thenable === value){
  1278. reject(thenable, new TypeError('Tried to resolve a thenable with itself.'));
  1279. } else if (value && (typeof value === 'object' || typeof value === 'function')){
  1280. var then;
  1281. try {
  1282. then = value.then;
  1283. } catch (exception){
  1284. reject(thenable, exception);
  1285. }
  1286. if (typeof then === 'function'){
  1287. var resolved = false;
  1288. defer(function(){
  1289. try {
  1290. then.call(
  1291. value,
  1292. function(nextValue){
  1293. if (!resolved){
  1294. resolved = true;
  1295. resolve(thenable, nextValue);
  1296. }
  1297. },
  1298. function(reason){
  1299. if (!resolved){
  1300. resolved = true;
  1301. reject(thenable, reason);
  1302. }
  1303. }
  1304. );
  1305. } catch (exception){
  1306. if (!resolved){
  1307. resolved = true;
  1308. reject(thenable, exception);
  1309. }
  1310. }
  1311. });
  1312. } else {
  1313. fulfill(thenable, value);
  1314. }
  1315. } else {
  1316. fulfill(thenable, value);
  1317. }
  1318. }
  1319. }
  1320. function fulfill(thenable, value){
  1321. if (thenable.$thenableState === STATE_PENDING){
  1322. thenable.$thenableResult = value;
  1323. thenable.$thenableState = STATE_FULFILLED;
  1324. react(thenable);
  1325. }
  1326. }
  1327. function reject(thenable, reason){
  1328. if (thenable.$thenableState === STATE_PENDING){
  1329. thenable.$thenableResult = reason;
  1330. thenable.$thenableState = STATE_REJECTED;
  1331. react(thenable);
  1332. }
  1333. }
  1334. function reset(thenable){
  1335. if (thenable.$thenableState !== STATE_PENDING){
  1336. thenable.$thenableResult = null;
  1337. thenable.$thenableState = STATE_PENDING;
  1338. }
  1339. }
  1340. function react(thenable){
  1341. var state = thenable.$thenableState,
  1342. result = thenable.$thenableResult,
  1343. reactions = thenable.$thenableReactions,
  1344. type;
  1345. if (state === STATE_FULFILLED){
  1346. thenable.$thenableReactions = [];
  1347. type = 'fulfillHandler';
  1348. } else if (state == STATE_REJECTED){
  1349. thenable.$thenableReactions = [];
  1350. type = 'rejectHandler';
  1351. }
  1352. if (type){
  1353. defer(handle.pass([result, reactions, type]));
  1354. }
  1355. }
  1356. function handle(result, reactions, type){
  1357. for (var i = 0, l = reactions.length; i < l; ++i){
  1358. var reaction = reactions[i],
  1359. handler = reaction[type];
  1360. if (handler === 'Identity'){
  1361. resolve(reaction.thenable, result);
  1362. } else if (handler === 'Thrower'){
  1363. reject(reaction.thenable, result);
  1364. } else {
  1365. try {
  1366. resolve(reaction.thenable, handler(result));
  1367. } catch (exception){
  1368. reject(reaction.thenable, exception);
  1369. }
  1370. }
  1371. }
  1372. }
  1373. var defer;
  1374. if (typeof process !== 'undefined' && typeof process.nextTick === 'function'){
  1375. defer = process.nextTick;
  1376. } else if (typeof setImmediate !== 'undefined'){
  1377. defer = setImmediate;
  1378. } else {
  1379. defer = function(fn){
  1380. setTimeout(fn, 0);
  1381. };
  1382. }
  1383. })();
  1384. /*
  1385. ---
  1386. name: Object
  1387. description: Object generic methods
  1388. license: MIT-style license.
  1389. requires: Type
  1390. provides: [Object, Hash]
  1391. ...
  1392. */
  1393. (function(){
  1394. Object.extend({
  1395. subset: function(object, keys){
  1396. var results = {};
  1397. for (var i = 0, l = keys.length; i < l; i++){
  1398. var k = keys[i];
  1399. if (k in object) results[k] = object[k];
  1400. }
  1401. return results;
  1402. },
  1403. map: function(object, fn, bind){
  1404. var results = {};
  1405. var keys = Object.keys(object);
  1406. for (var i = 0; i < keys.length; i++){
  1407. var key = keys[i];
  1408. results[key] = fn.call(bind, object[key], key, object);
  1409. }
  1410. return results;
  1411. },
  1412. filter: function(object, fn, bind){
  1413. var results = {};
  1414. var keys = Object.keys(object);
  1415. for (var i = 0; i < keys.length; i++){
  1416. var key = keys[i], value = object[key];
  1417. if (fn.call(bind, value, key, object)) results[key] = value;
  1418. }
  1419. return results;
  1420. },
  1421. every: function(object, fn, bind){
  1422. var keys = Object.keys(object);
  1423. for (var i = 0; i < keys.length; i++){
  1424. var key = keys[i];
  1425. if (!fn.call(bind, object[key], key)) return false;
  1426. }
  1427. return true;
  1428. },
  1429. some: function(object, fn, bind){
  1430. var keys = Object.keys(object);
  1431. for (var i = 0; i < keys.length; i++){
  1432. var key = keys[i];
  1433. if (fn.call(bind, object[key], key)) return true;
  1434. }
  1435. return false;
  1436. },
  1437. values: function(object){
  1438. var values = [];
  1439. var keys = Object.keys(object);
  1440. for (var i = 0; i < keys.length; i++){
  1441. var k = keys[i];
  1442. values.push(object[k]);
  1443. }
  1444. return values;
  1445. },
  1446. getLength: function(object){
  1447. return Object.keys(object).length;
  1448. },
  1449. keyOf: function(object, value){
  1450. var keys = Object.keys(object);
  1451. for (var i = 0; i < keys.length; i++){
  1452. var key = keys[i];
  1453. if (object[key] === value) return key;
  1454. }
  1455. return null;
  1456. },
  1457. contains: function(object, value){
  1458. return Object.keyOf(object, value) != null;
  1459. },
  1460. toQueryString: function(object, base){
  1461. var queryString = [];
  1462. Object.each(object, function(value, key){
  1463. if (base) key = base + '[' + key + ']';
  1464. var result;
  1465. switch (typeOf(value)){
  1466. case 'object': result = Object.toQueryString(value, key); break;
  1467. case 'array':
  1468. var qs = {};
  1469. value.each(function(val, i){
  1470. qs[i] = val;
  1471. });
  1472. result = Object.toQueryString(qs, key);
  1473. break;
  1474. default: result = key + '=' + encodeURIComponent(value);
  1475. }
  1476. if (value != null) queryString.push(result);
  1477. });
  1478. return queryString.join('&');
  1479. }
  1480. });
  1481. })();
  1482. //<1.2compat>
  1483. Hash.implement({
  1484. has: Object.prototype.hasOwnProperty,
  1485. keyOf: function(value){
  1486. return Object.keyOf(this, value);
  1487. },
  1488. hasValue: function(value){
  1489. return Object.contains(this, value);
  1490. },
  1491. extend: function(properties){
  1492. Hash.each(properties || {}, function(value, key){
  1493. Hash.set(this, key, value);
  1494. }, this);
  1495. return this;
  1496. },
  1497. combine: function(properties){
  1498. Hash.each(properties || {}, function(value, key){
  1499. Hash.include(this, key, value);
  1500. }, this);
  1501. return this;
  1502. },
  1503. erase: function(key){
  1504. if (this.hasOwnProperty(key)) delete this[key];
  1505. return this;
  1506. },
  1507. get: function(key){
  1508. return (this.hasOwnProperty(key)) ? this[key] : null;
  1509. },
  1510. set: function(key, value){
  1511. if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
  1512. return this;
  1513. },
  1514. empty: function(){
  1515. Hash.each(this, function(value, key){
  1516. delete this[key];
  1517. }, this);
  1518. return this;
  1519. },
  1520. include: function(key, value){
  1521. if (this[key] == null) this[key] = value;
  1522. return this;
  1523. },
  1524. map: function(fn, bind){
  1525. return new Hash(Object.map(this, fn, bind));
  1526. },
  1527. filter: function(fn, bind){
  1528. return new Hash(Object.filter(this, fn, bind));
  1529. },
  1530. every: function(fn, bind){
  1531. return Object.every(this, fn, bind);
  1532. },
  1533. some: function(fn, bind){
  1534. return Object.some(this, fn, bind);
  1535. },
  1536. getKeys: function(){
  1537. return Object.keys(this);
  1538. },
  1539. getValues: function(){
  1540. return Object.values(this);
  1541. },
  1542. toQueryString: function(base){
  1543. return Object.toQueryString(this, base);
  1544. }
  1545. });
  1546. Hash.extend = Object.append;
  1547. Hash.alias({indexOf: 'keyOf', contains: 'hasValue'});
  1548. //</1.2compat>
  1549. /*
  1550. ---
  1551. name: Slick.Parser
  1552. description: Standalone CSS3 Selector parser
  1553. provides: Slick.Parser
  1554. ...
  1555. */
  1556. ;(function(){
  1557. var parsed,
  1558. separatorIndex,
  1559. combinatorIndex,
  1560. reversed,
  1561. cache = {},
  1562. reverseCache = {},
  1563. reUnescape = /\\/g;
  1564. var parse = function(expression, isReversed){
  1565. if (expression == null) return null;
  1566. if (expression.Slick === true) return expression;
  1567. expression = ('' + expression).replace(/^\s+|\s+$/g, '');
  1568. reversed = !!isReversed;
  1569. var currentCache = (reversed) ? reverseCache : cache;
  1570. if (currentCache[expression]) return currentCache[expression];
  1571. parsed = {
  1572. Slick: true,
  1573. expressions: [],
  1574. raw: expression,
  1575. reverse: function(){
  1576. return parse(this.raw, true);
  1577. }
  1578. };
  1579. separatorIndex = -1;
  1580. while (expression != (expression = expression.replace(regexp, parser)));
  1581. parsed.length = parsed.expressions.length;
  1582. return currentCache[parsed.raw] = (reversed) ? reverse(parsed) : parsed;
  1583. };
  1584. var reverseCombinator = function(combinator){
  1585. if (combinator === '!') return ' ';
  1586. else if (combinator === ' ') return '!';
  1587. else if ((/^!/).test(combinator)) return combinator.replace(/^!/, '');
  1588. else return '!' + combinator;
  1589. };
  1590. var reverse = function(expression){
  1591. var expressions = expression.expressions;
  1592. for (var i = 0; i < expressions.length; i++){
  1593. var exp = expressions[i];
  1594. var last = {parts: [], tag: '*', combinator: reverseCombinator(exp[0].combinator)};
  1595. for (var j = 0; j < exp.length; j++){
  1596. var cexp = exp[j];
  1597. if (!cexp.reverseCombinator) cexp.reverseCombinator = ' ';
  1598. cexp.combinator = cexp.reverseCombinator;
  1599. delete cexp.reverseCombinator;
  1600. }
  1601. exp.reverse().push(last);
  1602. }
  1603. return expression;
  1604. };
  1605. var escapeRegExp = function(string){// Credit: XRegExp 0.6.1 (c) 2007-2008 Steven Levithan <http://stevenlevithan.com/regex/xregexp/> MIT License
  1606. return string.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, function(match){
  1607. return '\\' + match;
  1608. });
  1609. };
  1610. var regexp = new RegExp(
  1611. /*
  1612. #!/usr/bin/env ruby
  1613. puts "\t\t" + DATA.read.gsub(/\(\?x\)|\s+#.*$|\s+|\\$|\\n/,'')
  1614. __END__
  1615. "(?x)^(?:\
  1616. \\s* ( , ) \\s* # Separator \n\
  1617. | \\s* ( <combinator>+ ) \\s* # Combinator \n\
  1618. | ( \\s+ ) # CombinatorChildren \n\
  1619. | ( <unicode>+ | \\* ) # Tag \n\
  1620. | \\# ( <unicode>+ ) # ID \n\
  1621. | \\. ( <unicode>+ ) # ClassName \n\
  1622. | # Attribute \n\
  1623. \\[ \
  1624. \\s* (<unicode1>+) (?: \
  1625. \\s* ([*^$!~|]?=) (?: \
  1626. \\s* (?:\
  1627. ([\"']?)(.*?)\\9 \
  1628. )\
  1629. ) \
  1630. )? \\s* \
  1631. \\](?!\\]) \n\
  1632. | :+ ( <unicode>+ )(?:\
  1633. \\( (?:\
  1634. (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\
  1635. ) \\)\
  1636. )?\
  1637. )"
  1638. */
  1639. "^(?:\\s*(,)\\s*|\\s*(<combinator>+)\\s*|(\\s+)|(<unicode>+|\\*)|\\#(<unicode>+)|\\.(<unicode>+)|\\[\\s*(<unicode1>+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(<unicode>+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)"
  1640. .replace(/<combinator>/, '[' + escapeRegExp('>+~`!@$%^&={}\\;</') + ']')
  1641. .replace(/<unicode>/g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])')
  1642. .replace(/<unicode1>/g, '(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])')
  1643. );
  1644. function parser(
  1645. rawMatch,
  1646. separator,
  1647. combinator,
  1648. combinatorChildren,
  1649. tagName,
  1650. id,
  1651. className,
  1652. attributeKey,
  1653. attributeOperator,
  1654. attributeQuote,
  1655. attributeValue,
  1656. pseudoMarker,
  1657. pseudoClass,
  1658. pseudoQuote,
  1659. pseudoClassQuotedValue,
  1660. pseudoClassValue
  1661. ){
  1662. if (separator || separatorIndex === -1){
  1663. parsed.expressions[++separatorIndex] = [];
  1664. combinatorIndex = -1;
  1665. if (separator) return '';
  1666. }
  1667. if (combinator || combinatorChildren || combinatorIndex === -1){
  1668. combinator = combinator || ' ';
  1669. var currentSeparator = parsed.expressions[separatorIndex];
  1670. if (reversed && currentSeparator[combinatorIndex])
  1671. currentSeparator[combinatorIndex].reverseCombinator = reverseCombinator(combinator);
  1672. currentSeparator[++combinatorIndex] = {combinator: combinator, tag: '*'};
  1673. }
  1674. var currentParsed = parsed.expressions[separatorIndex][combinatorIndex];
  1675. if (tagName){
  1676. currentParsed.tag = tagName.replace(reUnescape, '');
  1677. } else if (id){
  1678. currentParsed.id = id.replace(reUnescape, '');
  1679. } else if (className){
  1680. className = className.replace(reUnescape, '');
  1681. if (!currentParsed.classList) currentParsed.classList = [];
  1682. if (!currentParsed.classes) currentParsed.classes = [];
  1683. currentParsed.classList.push(className);
  1684. currentParsed.classes.push({
  1685. value: className,
  1686. regexp: new RegExp('(^|\\s)' + escapeRegExp(className) + '(\\s|$)')
  1687. });
  1688. } else if (pseudoClass){
  1689. pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue;
  1690. pseudoClassValue = pseudoClassValue ? pseudoClassValue.replace(reUnescape, '') : null;
  1691. if (!currentParsed.pseudos) currentParsed.pseudos = [];
  1692. currentParsed.pseudos.push({
  1693. key: pseudoClass.replace(reUnescape, ''),
  1694. value: pseudoClassValue,
  1695. type: pseudoMarker.length == 1 ? 'class' : 'element'
  1696. });
  1697. } else if (attributeKey){
  1698. attributeKey = attributeKey.replace(reUnescape, '');
  1699. attributeValue = (attributeValue || '').replace(reUnescape, '');
  1700. var test, regexp;
  1701. switch (attributeOperator){
  1702. case '^=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) ); break;
  1703. case '$=' : regexp = new RegExp( escapeRegExp(attributeValue) +'$' ); break;
  1704. case '~=' : regexp = new RegExp( '(^|\\s)'+ escapeRegExp(attributeValue) +'(\\s|$)' ); break;
  1705. case '|=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) +'(-|$)' ); break;
  1706. case '=' : test = function(value){
  1707. return attributeValue == value;
  1708. }; break;
  1709. case '*=' : test = function(value){
  1710. return value && value.indexOf(attributeValue) > -1;
  1711. }; break;
  1712. case '!=' : test = function(value){
  1713. return attributeValue != value;
  1714. }; break;
  1715. default : test = function(value){
  1716. return !!value;
  1717. };
  1718. }
  1719. if (attributeValue == '' && (/^[*$^]=$/).test(attributeOperator)) test = function(){
  1720. return false;
  1721. };
  1722. if (!test) test = function(value){
  1723. return value && regexp.test(value);
  1724. };
  1725. if (!currentParsed.attributes) currentParsed.attributes = [];
  1726. currentParsed.attributes.push({
  1727. key: attributeKey,
  1728. operator: attributeOperator,
  1729. value: attributeValue,
  1730. test: test
  1731. });
  1732. }
  1733. return '';
  1734. };
  1735. // Slick NS
  1736. var Slick = (this.Slick || {});
  1737. Slick.parse = function(expression){
  1738. return parse(expression);
  1739. };
  1740. Slick.escapeRegExp = escapeRegExp;
  1741. if (!this.Slick) this.Slick = Slick;
  1742. }).apply(/*<CommonJS>*/(typeof exports != 'undefined') ? exports : /*</CommonJS>*/this);
  1743. /*
  1744. ---
  1745. name: Slick.Finder
  1746. description: The new, superfast css selector engine.
  1747. provides: Slick.Finder
  1748. requires: Slick.Parser
  1749. ...
  1750. */
  1751. ;(function(){
  1752. var local = {},
  1753. featuresCache = {},
  1754. toString = Object.prototype.toString;
  1755. // Feature / Bug detection
  1756. local.isNativeCode = function(fn){
  1757. return (/\{\s*\[native code\]\s*\}/).test('' + fn);
  1758. };
  1759. local.isXML = function(document){
  1760. return (!!document.xmlVersion) || (!!document.xml) || (toString.call(document) == '[object XMLDocument]') ||
  1761. (document.nodeType == 9 && document.documentElement.nodeName != 'HTML');
  1762. };
  1763. local.setDocument = function(document){
  1764. // convert elements / window arguments to document. if document cannot be extrapolated, the function returns.
  1765. var nodeType = document.nodeType;
  1766. if (nodeType == 9); // document
  1767. else if (nodeType) document = document.ownerDocument; // node
  1768. else if (document.navigator) document = document.document; // window
  1769. else return;
  1770. // check if it's the old document
  1771. if (this.document === document) return;
  1772. this.document = document;
  1773. // check if we have done feature detection on this document before
  1774. var root = document.documentElement,
  1775. rootUid = this.getUIDXML(root),
  1776. features = featuresCache[rootUid],
  1777. feature;
  1778. if (features){
  1779. for (feature in features){
  1780. this[feature] = features[feature];
  1781. }
  1782. return;
  1783. }
  1784. features = featuresCache[rootUid] = {};
  1785. features.root = root;
  1786. features.isXMLDocument = this.isXML(document);
  1787. features.brokenStarGEBTN
  1788. = features.starSelectsClosedQSA
  1789. = features.idGetsName
  1790. = features.brokenMixedCaseQSA
  1791. = features.brokenGEBCN
  1792. = features.brokenCheckedQSA
  1793. = features.brokenEmptyAttributeQSA
  1794. = features.isHTMLDocument
  1795. = features.nativeMatchesSelector
  1796. = false;
  1797. var starSelectsClosed, starSelectsComments,
  1798. brokenSecondClassNameGEBCN, cachedGetElementsByClassName,
  1799. brokenFormAttributeGetter;
  1800. var selected, id = 'slick_uniqueid';
  1801. var testNode = document.createElement('div');
  1802. var testRoot = document.body || document.getElementsByTagName('body')[0] || root;
  1803. testRoot.appendChild(testNode);
  1804. // on non-HTML documents innerHTML and getElementsById doesnt work properly
  1805. try {
  1806. testNode.innerHTML = '<a id="'+id+'"></a>';
  1807. features.isHTMLDocument = !!document.getElementById(id);
  1808. } catch (e){}
  1809. if (features.isHTMLDocument){
  1810. testNode.style.display = 'none';
  1811. // IE returns comment nodes for getElementsByTagName('*') for some documents
  1812. testNode.appendChild(document.createComment(''));
  1813. starSelectsComments = (testNode.getElementsByTagName('*').length > 1);
  1814. // IE returns closed nodes (EG:"</foo>") for getElementsByTagName('*') for some documents
  1815. try {
  1816. testNode.innerHTML = 'foo</foo>';
  1817. selected = testNode.getElementsByTagName('*');
  1818. starSelectsClosed = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/');
  1819. } catch (e){};
  1820. features.brokenStarGEBTN = starSelectsComments || starSelectsClosed;
  1821. // IE returns elements with the name instead of just id for getElementsById for some documents
  1822. try {
  1823. testNode.innerHTML = '<a name="'+ id +'"></a><b id="'+ id +'"></b>';
  1824. features.idGetsName = document.getElementById(id) === testNode.firstChild;
  1825. } catch (e){}
  1826. if (testNode.getElementsByClassName){
  1827. // Safari 3.2 getElementsByClassName caches results
  1828. try {
  1829. testNode.innerHTML = '<a class="f"></a><a class="b"></a>';
  1830. testNode.getElementsByClassName('b').length;
  1831. testNode.firstChild.className = 'b';
  1832. cachedGetElementsByClassName = (testNode.getElementsByClassName('b').length != 2);
  1833. } catch (e){};
  1834. // Opera 9.6 getElementsByClassName doesnt detects the class if its not the first one
  1835. try {
  1836. testNode.innerHTML = '<a class="a"></a><a class="f b a"></a>';
  1837. brokenSecondClassNameGEBCN = (testNode.getElementsByClassName('a').length != 2);
  1838. } catch (e){}
  1839. features.brokenGEBCN = cachedGetElementsByClassName || brokenSecondClassNameGEBCN;
  1840. }
  1841. if (testNode.querySelectorAll){
  1842. // IE 8 returns closed nodes (EG:"</foo>") for querySelectorAll('*') for some documents
  1843. try {
  1844. testNode.innerHTML = 'foo</foo>';
  1845. selected = testNode.querySelectorAll('*');
  1846. features.starSelectsClosedQSA = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/');
  1847. } catch (e){}
  1848. // Safari 3.2 querySelectorAll doesnt work with mixedcase on quirksmode
  1849. try {
  1850. testNode.innerHTML = '<a class="MiX"></a>';
  1851. features.brokenMixedCaseQSA = !testNode.querySelectorAll('.MiX').length;
  1852. } catch (e){}
  1853. // Webkit and Opera dont return selected options on querySelectorAll
  1854. try {
  1855. testNode.innerHTML = '<select><option selected="selected">a</option></select>';
  1856. features.brokenCheckedQSA = (testNode.querySelectorAll(':checked').length == 0);
  1857. } catch (e){};
  1858. // IE returns incorrect results for attr[*^$]="" selectors on querySelectorAll
  1859. try {
  1860. testNode.innerHTML = '<a class=""></a>';
  1861. features.brokenEmptyAttributeQSA = (testNode.querySelectorAll('[class*=""]').length != 0);
  1862. } catch (e){}
  1863. }
  1864. // IE6-7, if a form has an input of id x, form.getAttribute(x) returns a reference to the input
  1865. try {
  1866. testNode.innerHTML = '<form action="s"><input id="action"/></form>';
  1867. brokenFormAttributeGetter = (testNode.firstChild.getAttribute('action') != 's');
  1868. } catch (e){}
  1869. // native matchesSelector function
  1870. features.nativeMatchesSelector = root.matches || /*root.msMatchesSelector ||*/ root.mozMatchesSelector || root.webkitMatchesSelector;
  1871. if (features.nativeMatchesSelector) try {
  1872. // if matchesSelector trows errors on incorrect sintaxes we can use it
  1873. features.nativeMatchesSelector.call(root, ':slick');
  1874. features.nativeMatchesSelector = null;
  1875. } catch (e){}
  1876. }
  1877. try {
  1878. root.slick_expando = 1;
  1879. delete root.slick_expando;
  1880. features.getUID = this.getUIDHTML;
  1881. } catch (e){
  1882. features.getUID = this.getUIDXML;
  1883. }
  1884. testRoot.removeChild(testNode);
  1885. testNode = selected = testRoot = null;
  1886. // getAttribute
  1887. features.getAttribute = (features.isHTMLDocument && brokenFormAttributeGetter) ? function(node, name){
  1888. var method = this.attributeGetters[name];
  1889. if (method) return method.call(node);
  1890. var attributeNode = node.getAttributeNode(name);
  1891. return (attributeNode) ? attributeNode.nodeValue : null;
  1892. } : function(node, name){
  1893. var method = this.attributeGetters[name];
  1894. return (method) ? method.call(node) : node.getAttribute(name);
  1895. };
  1896. // hasAttribute
  1897. features.hasAttribute = (root && this.isNativeCode(root.hasAttribute)) ? function(node, attribute){
  1898. return node.hasAttribute(attribute);
  1899. } : function(node, attribute){
  1900. node = node.getAttributeNode(attribute);
  1901. return !!(node && (node.specified || node.nodeValue));
  1902. };
  1903. // contains
  1904. // FIXME: Add specs: local.contains should be different for xml and html documents?
  1905. var nativeRootContains = root && this.isNativeCode(root.contains),
  1906. nativeDocumentContains = document && this.isNativeCode(document.contains);
  1907. features.contains = (nativeRootContains && nativeDocumentContains) ? function(context, node){
  1908. return context.contains(node);
  1909. } : (nativeRootContains && !nativeDocumentContains) ? function(context, node){
  1910. // IE8 does not have .contains on document.
  1911. return context === node || ((context === document) ? document.documentElement : context).contains(node);
  1912. } : (root && root.compareDocumentPosition) ? function(context, node){
  1913. return context === node || !!(context.compareDocumentPosition(node) & 16);
  1914. } : function(context, node){
  1915. if (node) do {
  1916. if (node === context) return true;
  1917. } while ((node = node.parentNode));
  1918. return false;
  1919. };
  1920. // document order sorting
  1921. // credits to Sizzle (http://sizzlejs.com/)
  1922. features.documentSorter = (root.compareDocumentPosition) ? function(a, b){
  1923. if (!a.compareDocumentPosition || !b.compareDocumentPosition) return 0;
  1924. return a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
  1925. } : ('sourceIndex' in root) ? function(a, b){
  1926. if (!a.sourceIndex || !b.sourceIndex) return 0;
  1927. return a.sourceIndex - b.sourceIndex;
  1928. } : (document.createRange) ? function(a, b){
  1929. if (!a.ownerDocument || !b.ownerDocument) return 0;
  1930. var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
  1931. aRange.setStart(a, 0);
  1932. aRange.setEnd(a, 0);
  1933. bRange.setStart(b, 0);
  1934. bRange.setEnd(b, 0);
  1935. return aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
  1936. } : null;
  1937. root = null;
  1938. for (feature in features){
  1939. this[feature] = features[feature];
  1940. }
  1941. };
  1942. // Main Method
  1943. var reSimpleSelector = /^([#.]?)((?:[\w-]+|\*))$/,
  1944. reEmptyAttribute = /\[.+[*$^]=(?:""|'')?\]/,
  1945. qsaFailExpCache = {};
  1946. local.search = function(context, expression, append, first){
  1947. var found = this.found = (first) ? null : (append || []);
  1948. if (!context) return found;
  1949. else if (context.navigator) context = context.document; // Convert the node from a window to a document
  1950. else if (!context.nodeType) return found;
  1951. // setup
  1952. var parsed, i, node, nodes,
  1953. uniques = this.uniques = {},
  1954. hasOthers = !!(append && append.length),
  1955. contextIsDocument = (context.nodeType == 9);
  1956. if (this.document !== (contextIsDocument ? context : context.ownerDocument)) this.setDocument(context);
  1957. // avoid duplicating items already in the append array
  1958. if (hasOthers) for (i = found.length; i--;) uniques[this.getUID(found[i])] = true;
  1959. // expression checks
  1960. if (typeof expression == 'string'){ // expression is a string
  1961. /*<simple-selectors-override>*/
  1962. var simpleSelector = expression.match(reSimpleSelector);
  1963. simpleSelectors: if (simpleSelector){
  1964. var symbol = simpleSelector[1],
  1965. name = simpleSelector[2];
  1966. if (!symbol){
  1967. if (name == '*' && this.brokenStarGEBTN) break simpleSelectors;
  1968. nodes = context.getElementsByTagName(name);
  1969. if (first) return nodes[0] || null;
  1970. for (i = 0; node = nodes[i++];){
  1971. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1972. }
  1973. } else if (symbol == '#'){
  1974. if (!this.isHTMLDocument || !contextIsDocument) break simpleSelectors;
  1975. node = context.getElementById(name);
  1976. if (!node) return found;
  1977. if (this.idGetsName && node.getAttributeNode('id').nodeValue != name) break simpleSelectors;
  1978. if (first) return node || null;
  1979. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1980. } else if (symbol == '.'){
  1981. if (!this.isHTMLDocument || ((!context.getElementsByClassName || this.brokenGEBCN) && context.querySelectorAll)) break simpleSelectors;
  1982. if (context.getElementsByClassName && !this.brokenGEBCN){
  1983. nodes = context.getElementsByClassName(name);
  1984. if (first) return nodes[0] || null;
  1985. for (i = 0; node = nodes[i++];){
  1986. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1987. }
  1988. } else {
  1989. var matchClass = new RegExp('(^|\\s)'+ Slick.escapeRegExp(name) +'(\\s|$)');
  1990. nodes = context.getElementsByTagName('*');
  1991. for (i = 0; node = nodes[i++];){
  1992. className = node.className;
  1993. if (!(className && matchClass.test(className))) continue;
  1994. if (first) return node;
  1995. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1996. }
  1997. }
  1998. }
  1999. if (hasOthers) this.sort(found);
  2000. return (first) ? null : found;
  2001. }
  2002. /*</simple-selectors-override>*/
  2003. /*<query-selector-override>*/
  2004. querySelector: if (context.querySelectorAll){
  2005. if (!this.isHTMLDocument
  2006. || qsaFailExpCache[expression]
  2007. //TODO: only skip when expression is actually mixed case
  2008. || this.brokenMixedCaseQSA
  2009. || (this.brokenCheckedQSA && expression.indexOf(':checked') > -1)
  2010. || (this.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression))
  2011. || (!contextIsDocument //Abort when !contextIsDocument and...
  2012. // there are multiple expressions in the selector
  2013. // since we currently only fix non-document rooted QSA for single expression selectors
  2014. && expression.indexOf(',') > -1
  2015. )
  2016. || Slick.disableQSA
  2017. ) break querySelector;
  2018. var _expression = expression, _context = context, currentId;
  2019. if (!contextIsDocument){
  2020. // non-document rooted QSA
  2021. // credits to Andrew Dupont
  2022. currentId = _context.getAttribute('id'), slickid = 'slickid__';
  2023. _context.setAttribute('id', slickid);
  2024. _expression = '#' + slickid + ' ' + _expression;
  2025. context = _context.parentNode;
  2026. }
  2027. try {
  2028. if (first) return context.querySelector(_expression) || null;
  2029. else nodes = context.querySelectorAll(_expression);
  2030. } catch (e){
  2031. qsaFailExpCache[expression] = 1;
  2032. break querySelector;
  2033. } finally {
  2034. if (!contextIsDocument){
  2035. if (currentId) _context.setAttribute('id', currentId);
  2036. else _context.removeAttribute('id');
  2037. context = _context;
  2038. }
  2039. }
  2040. if (this.starSelectsClosedQSA) for (i = 0; node = nodes[i++];){
  2041. if (node.nodeName > '@' && !(hasOthers && uniques[this.getUID(node)])) found.push(node);
  2042. } else for (i = 0; node = nodes[i++];){
  2043. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  2044. }
  2045. if (hasOthers) this.sort(found);
  2046. return found;
  2047. }
  2048. /*</query-selector-override>*/
  2049. parsed = this.Slick.parse(expression);
  2050. if (!parsed.length) return found;
  2051. } else if (expression == null){ // there is no expression
  2052. return found;
  2053. } else if (expression.Slick){ // expression is a parsed Slick object
  2054. parsed = expression;
  2055. } else if (this.contains(context.documentElement || context, expression)){ // expression is a node
  2056. (found) ? found.push(expression) : found = expression;
  2057. return found;
  2058. } else { // other junk
  2059. return found;
  2060. }
  2061. /*<pseudo-selectors>*//*<nth-pseudo-selectors>*/
  2062. // cache elements for the nth selectors
  2063. this.posNTH = {};
  2064. this.posNTHLast = {};
  2065. this.posNTHType = {};
  2066. this.posNTHTypeLast = {};
  2067. /*</nth-pseudo-selectors>*//*</pseudo-selectors>*/
  2068. // if append is null and there is only a single selector with one expression use pushArray, else use pushUID
  2069. this.push = (!hasOthers && (first || (parsed.length == 1 && parsed.expressions[0].length == 1))) ? this.pushArray : this.pushUID;
  2070. if (found == null) found = [];
  2071. // default engine
  2072. var j, m, n;
  2073. var combinator, tag, id, classList, classes, attributes, pseudos;
  2074. var currentItems, currentExpression, currentBit, lastBit, expressions = parsed.expressions;
  2075. search: for (i = 0; (currentExpression = expressions[i]); i++) for (j = 0; (currentBit = currentExpression[j]); j++){
  2076. combinator = 'combinator:' + currentBit.combinator;
  2077. if (!this[combinator]) continue search;
  2078. tag = (this.isXMLDocument) ? currentBit.tag : currentBit.tag.toUpperCase();
  2079. id = currentBit.id;
  2080. classList = currentBit.classList;
  2081. classes = currentBit.classes;
  2082. attributes = currentBit.attributes;
  2083. pseudos = currentBit.pseudos;
  2084. lastBit = (j === (currentExpression.length - 1));
  2085. this.bitUniques = {};
  2086. if (lastBit){
  2087. this.uniques = uniques;
  2088. this.found = found;
  2089. } else {
  2090. this.uniques = {};
  2091. this.found = [];
  2092. }
  2093. if (j === 0){
  2094. this[combinator](context, tag, id, classes, attributes, pseudos, classList);
  2095. if (first && lastBit && found.length) break search;
  2096. } else {
  2097. if (first && lastBit) for (m = 0, n = currentItems.length; m < n; m++){
  2098. this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList);
  2099. if (found.length) break search;
  2100. } else for (m = 0, n = currentItems.length; m < n; m++) this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList);
  2101. }
  2102. currentItems = this.found;
  2103. }
  2104. // should sort if there are nodes in append and if you pass multiple expressions.
  2105. if (hasOthers || (parsed.expressions.length > 1)) this.sort(found);
  2106. return (first) ? (found[0] || null) : found;
  2107. };
  2108. // Utils
  2109. local.uidx = 1;
  2110. local.uidk = 'slick-uniqueid';
  2111. local.getUIDXML = function(node){
  2112. var uid = node.getAttribute(this.uidk);
  2113. if (!uid){
  2114. uid = this.uidx++;
  2115. node.setAttribute(this.uidk, uid);
  2116. }
  2117. return uid;
  2118. };
  2119. local.getUIDHTML = function(node){
  2120. return node.uniqueNumber || (node.uniqueNumber = this.uidx++);
  2121. };
  2122. // sort based on the setDocument documentSorter method.
  2123. local.sort = function(results){
  2124. if (!this.documentSorter) return results;
  2125. results.sort(this.documentSorter);
  2126. return results;
  2127. };
  2128. /*<pseudo-selectors>*//*<nth-pseudo-selectors>*/
  2129. local.cacheNTH = {};
  2130. local.matchNTH = /^([+-]?\d*)?([a-z]+)?([+-]\d+)?$/;
  2131. local.parseNTHArgument = function(argument){
  2132. var parsed = argument.match(this.matchNTH);
  2133. if (!parsed) return false;
  2134. var special = parsed[2] || false;
  2135. var a = parsed[1] || 1;
  2136. if (a == '-') a = -1;
  2137. var b = +parsed[3] || 0;
  2138. parsed =
  2139. (special == 'n') ? {a: a, b: b} :
  2140. (special == 'odd') ? {a: 2, b: 1} :
  2141. (special == 'even') ? {a: 2, b: 0} : {a: 0, b: a};
  2142. return (this.cacheNTH[argument] = parsed);
  2143. };
  2144. local.createNTHPseudo = function(child, sibling, positions, ofType){
  2145. return function(node, argument){
  2146. var uid = this.getUID(node);
  2147. if (!this[positions][uid]){
  2148. var parent = node.parentNode;
  2149. if (!parent) return false;
  2150. var el = parent[child], count = 1;
  2151. if (ofType){
  2152. var nodeName = node.nodeName;
  2153. do {
  2154. if (el.nodeName != nodeName) continue;
  2155. this[positions][this.getUID(el)] = count++;
  2156. } while ((el = el[sibling]));
  2157. } else {
  2158. do {
  2159. if (el.nodeType != 1) continue;
  2160. this[positions][this.getUID(el)] = count++;
  2161. } while ((el = el[sibling]));
  2162. }
  2163. }
  2164. argument = argument || 'n';
  2165. var parsed = this.cacheNTH[argument] || this.parseNTHArgument(argument);
  2166. if (!parsed) return false;
  2167. var a = parsed.a, b = parsed.b, pos = this[positions][uid];
  2168. if (a == 0) return b == pos;
  2169. if (a > 0){
  2170. if (pos < b) return false;
  2171. } else {
  2172. if (b < pos) return false;
  2173. }
  2174. return ((pos - b) % a) == 0;
  2175. };
  2176. };
  2177. /*</nth-pseudo-selectors>*//*</pseudo-selectors>*/
  2178. local.pushArray = function(node, tag, id, classes, attributes, pseudos){
  2179. if (this.matchSelector(node, tag, id, classes, attributes, pseudos)) this.found.push(node);
  2180. };
  2181. local.pushUID = function(node, tag, id, classes, attributes, pseudos){
  2182. var uid = this.getUID(node);
  2183. if (!this.uniques[uid] && this.matchSelector(node, tag, id, classes, attributes, pseudos)){
  2184. this.uniques[uid] = true;
  2185. this.found.push(node);
  2186. }
  2187. };
  2188. local.matchNode = function(node, selector){
  2189. if (this.isHTMLDocument && this.nativeMatchesSelector){
  2190. try {
  2191. return this.nativeMatchesSelector.call(node, selector.replace(/\[([^=]+)=\s*([^'"\]]+?)\s*\]/g, '[$1="$2"]'));
  2192. } catch (matchError){}
  2193. }
  2194. var parsed = this.Slick.parse(selector);
  2195. if (!parsed) return true;
  2196. // simple (single) selectors
  2197. var expressions = parsed.expressions, simpleExpCounter = 0, i, currentExpression;
  2198. for (i = 0; (currentExpression = expressions[i]); i++){
  2199. if (currentExpression.length == 1){
  2200. var exp = currentExpression[0];
  2201. if (this.matchSelector(node, (this.isXMLDocument) ? exp.tag : exp.tag.toUpperCase(), exp.id, exp.classes, exp.attributes, exp.pseudos)) return true;
  2202. simpleExpCounter++;
  2203. }
  2204. }
  2205. if (simpleExpCounter == parsed.length) return false;
  2206. var nodes = this.search(this.document, parsed), item;
  2207. for (i = 0; item = nodes[i++];){
  2208. if (item === node) return true;
  2209. }
  2210. return false;
  2211. };
  2212. local.matchPseudo = function(node, name, argument){
  2213. var pseudoName = 'pseudo:' + name;
  2214. if (this[pseudoName]) return this[pseudoName](node, argument);
  2215. var attribute = this.getAttribute(node, name);
  2216. return (argument) ? argument == attribute : !!attribute;
  2217. };
  2218. local.matchSelector = function(node, tag, id, classes, attributes, pseudos){
  2219. if (tag){
  2220. var nodeName = (this.isXMLDocument) ? node.nodeName : node.nodeName.toUpperCase();
  2221. if (tag == '*'){
  2222. if (nodeName < '@') return false; // Fix for comment nodes and closed nodes
  2223. } else {
  2224. if (nodeName != tag) return false;
  2225. }
  2226. }
  2227. if (id && node.getAttribute('id') != id) return false;
  2228. var i, part, cls;
  2229. if (classes) for (i = classes.length; i--;){
  2230. cls = this.getAttribute(node, 'class');
  2231. if (!(cls && classes[i].regexp.test(cls))) return false;
  2232. }
  2233. if (attributes) for (i = attributes.length; i--;){
  2234. part = attributes[i];
  2235. if (part.operator ? !part.test(this.getAttribute(node, part.key)) : !this.hasAttribute(node, part.key)) return false;
  2236. }
  2237. if (pseudos) for (i = pseudos.length; i--;){
  2238. part = pseudos[i];
  2239. if (!this.matchPseudo(node, part.key, part.value)) return false;
  2240. }
  2241. return true;
  2242. };
  2243. var combinators = {
  2244. ' ': function(node, tag, id, classes, attributes, pseudos, classList){ // all child nodes, any level
  2245. var i, item, children;
  2246. if (this.isHTMLDocument){
  2247. getById: if (id){
  2248. item = this.document.getElementById(id);
  2249. if ((!item && node.all) || (this.idGetsName && item && item.getAttributeNode('id').nodeValue != id)){
  2250. // all[id] returns all the elements with that name or id inside node
  2251. // if theres just one it will return the element, else it will be a collection
  2252. children = node.all[id];
  2253. if (!children) return;
  2254. if (!children[0]) children = [children];
  2255. for (i = 0; item = children[i++];){
  2256. var idNode = item.getAttributeNode('id');
  2257. if (idNode && idNode.nodeValue == id){
  2258. this.push(item, tag, null, classes, attributes, pseudos);
  2259. break;
  2260. }
  2261. }
  2262. return;
  2263. }
  2264. if (!item){
  2265. // if the context is in the dom we return, else we will try GEBTN, breaking the getById label
  2266. if (this.contains(this.root, node)) return;
  2267. else break getById;
  2268. } else if (this.document !== node && !this.contains(node, item)) return;
  2269. this.push(item, tag, null, classes, attributes, pseudos);
  2270. return;
  2271. }
  2272. getByClass: if (classes && node.getElementsByClassName && !this.brokenGEBCN){
  2273. children = node.getElementsByClassName(classList.join(' '));
  2274. if (!(children && children.length)) break getByClass;
  2275. for (i = 0; item = children[i++];) this.push(item, tag, id, null, attributes, pseudos);
  2276. return;
  2277. }
  2278. }
  2279. getByTag: {
  2280. children = node.getElementsByTagName(tag);
  2281. if (!(children && children.length)) break getByTag;
  2282. if (!this.brokenStarGEBTN) tag = null;
  2283. for (i = 0; item = children[i++];) this.push(item, tag, id, classes, attributes, pseudos);
  2284. }
  2285. },
  2286. '>': function(node, tag, id, classes, attributes, pseudos){ // direct children
  2287. if ((node = node.firstChild)) do {
  2288. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2289. } while ((node = node.nextSibling));
  2290. },
  2291. '+': function(node, tag, id, classes, attributes, pseudos){ // next sibling
  2292. while ((node = node.nextSibling)) if (node.nodeType == 1){
  2293. this.push(node, tag, id, classes, attributes, pseudos);
  2294. break;
  2295. }
  2296. },
  2297. '^': function(node, tag, id, classes, attributes, pseudos){ // first child
  2298. node = node.firstChild;
  2299. if (node){
  2300. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2301. else this['combinator:+'](node, tag, id, classes, attributes, pseudos);
  2302. }
  2303. },
  2304. '~': function(node, tag, id, classes, attributes, pseudos){ // next siblings
  2305. while ((node = node.nextSibling)){
  2306. if (node.nodeType != 1) continue;
  2307. var uid = this.getUID(node);
  2308. if (this.bitUniques[uid]) break;
  2309. this.bitUniques[uid] = true;
  2310. this.push(node, tag, id, classes, attributes, pseudos);
  2311. }
  2312. },
  2313. '++': function(node, tag, id, classes, attributes, pseudos){ // next sibling and previous sibling
  2314. this['combinator:+'](node, tag, id, classes, attributes, pseudos);
  2315. this['combinator:!+'](node, tag, id, classes, attributes, pseudos);
  2316. },
  2317. '~~': function(node, tag, id, classes, attributes, pseudos){ // next siblings and previous siblings
  2318. this['combinator:~'](node, tag, id, classes, attributes, pseudos);
  2319. this['combinator:!~'](node, tag, id, classes, attributes, pseudos);
  2320. },
  2321. '!': function(node, tag, id, classes, attributes, pseudos){ // all parent nodes up to document
  2322. while ((node = node.parentNode)) if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos);
  2323. },
  2324. '!>': function(node, tag, id, classes, attributes, pseudos){ // direct parent (one level)
  2325. node = node.parentNode;
  2326. if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos);
  2327. },
  2328. '!+': function(node, tag, id, classes, attributes, pseudos){ // previous sibling
  2329. while ((node = node.previousSibling)) if (node.nodeType == 1){
  2330. this.push(node, tag, id, classes, attributes, pseudos);
  2331. break;
  2332. }
  2333. },
  2334. '!^': function(node, tag, id, classes, attributes, pseudos){ // last child
  2335. node = node.lastChild;
  2336. if (node){
  2337. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2338. else this['combinator:!+'](node, tag, id, classes, attributes, pseudos);
  2339. }
  2340. },
  2341. '!~': function(node, tag, id, classes, attributes, pseudos){ // previous siblings
  2342. while ((node = node.previousSibling)){
  2343. if (node.nodeType != 1) continue;
  2344. var uid = this.getUID(node);
  2345. if (this.bitUniques[uid]) break;
  2346. this.bitUniques[uid] = true;
  2347. this.push(node, tag, id, classes, attributes, pseudos);
  2348. }
  2349. }
  2350. };
  2351. for (var c in combinators) local['combinator:' + c] = combinators[c];
  2352. var pseudos = {
  2353. /*<pseudo-selectors>*/
  2354. 'empty': function(node){
  2355. var child = node.firstChild;
  2356. return !(child && child.nodeType == 1) && !(node.innerText || node.textContent || '').length;
  2357. },
  2358. 'not': function(node, expression){
  2359. return !this.matchNode(node, expression);
  2360. },
  2361. 'contains': function(node, text){
  2362. return (node.innerText || node.textContent || '').indexOf(text) > -1;
  2363. },
  2364. 'first-child': function(node){
  2365. while ((node = node.previousSibling)) if (node.nodeType == 1) return false;
  2366. return true;
  2367. },
  2368. 'last-child': function(node){
  2369. while ((node = node.nextSibling)) if (node.nodeType == 1) return false;
  2370. return true;
  2371. },
  2372. 'only-child': function(node){
  2373. var prev = node;
  2374. while ((prev = prev.previousSibling)) if (prev.nodeType == 1) return false;
  2375. var next = node;
  2376. while ((next = next.nextSibling)) if (next.nodeType == 1) return false;
  2377. return true;
  2378. },
  2379. /*<nth-pseudo-selectors>*/
  2380. 'nth-child': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTH'),
  2381. 'nth-last-child': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHLast'),
  2382. 'nth-of-type': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTHType', true),
  2383. 'nth-last-of-type': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHTypeLast', true),
  2384. 'index': function(node, index){
  2385. return this['pseudo:nth-child'](node, '' + (index + 1));
  2386. },
  2387. 'even': function(node){
  2388. return this['pseudo:nth-child'](node, '2n');
  2389. },
  2390. 'odd': function(node){
  2391. return this['pseudo:nth-child'](node, '2n+1');
  2392. },
  2393. /*</nth-pseudo-selectors>*/
  2394. /*<of-type-pseudo-selectors>*/
  2395. 'first-of-type': function(node){
  2396. var nodeName = node.nodeName;
  2397. while ((node = node.previousSibling)) if (node.nodeName == nodeName) return false;
  2398. return true;
  2399. },
  2400. 'last-of-type': function(node){
  2401. var nodeName = node.nodeName;
  2402. while ((node = node.nextSibling)) if (node.nodeName == nodeName) return false;
  2403. return true;
  2404. },
  2405. 'only-of-type': function(node){
  2406. var prev = node, nodeName = node.nodeName;
  2407. while ((prev = prev.previousSibling)) if (prev.nodeName == nodeName) return false;
  2408. var next = node;
  2409. while ((next = next.nextSibling)) if (next.nodeName == nodeName) return false;
  2410. return true;
  2411. },
  2412. /*</of-type-pseudo-selectors>*/
  2413. // custom pseudos
  2414. 'enabled': function(node){
  2415. return !node.disabled;
  2416. },
  2417. 'disabled': function(node){
  2418. return node.disabled;
  2419. },
  2420. 'checked': function(node){
  2421. return node.checked || node.selected;
  2422. },
  2423. 'focus': function(node){
  2424. return this.isHTMLDocument && this.document.activeElement === node && (node.href || node.type || this.hasAttribute(node, 'tabindex'));
  2425. },
  2426. 'root': function(node){
  2427. return (node === this.root);
  2428. },
  2429. 'selected': function(node){
  2430. return node.selected;
  2431. }
  2432. /*</pseudo-selectors>*/
  2433. };
  2434. for (var p in pseudos) local['pseudo:' + p] = pseudos[p];
  2435. // attributes methods
  2436. var attributeGetters = local.attributeGetters = {
  2437. 'for': function(){
  2438. return ('htmlFor' in this) ? this.htmlFor : this.getAttribute('for');
  2439. },
  2440. 'href': function(){
  2441. return ('href' in this) ? this.getAttribute('href', 2) : this.getAttribute('href');
  2442. },
  2443. 'style': function(){
  2444. return (this.style) ? this.style.cssText : this.getAttribute('style');
  2445. },
  2446. 'tabindex': function(){
  2447. var attributeNode = this.getAttributeNode('tabindex');
  2448. return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null;
  2449. },
  2450. 'type': function(){
  2451. return this.getAttribute('type');
  2452. },
  2453. 'maxlength': function(){
  2454. var attributeNode = this.getAttributeNode('maxLength');
  2455. return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null;
  2456. }
  2457. };
  2458. attributeGetters.MAXLENGTH = attributeGetters.maxLength = attributeGetters.maxlength;
  2459. // Slick
  2460. var Slick = local.Slick = (this.Slick || {});
  2461. Slick.version = '1.1.7';
  2462. // Slick finder
  2463. Slick.search = function(context, expression, append){
  2464. return local.search(context, expression, append);
  2465. };
  2466. Slick.find = function(context, expression){
  2467. return local.search(context, expression, null, true);
  2468. };
  2469. // Slick containment checker
  2470. Slick.contains = function(container, node){
  2471. local.setDocument(container);
  2472. return local.contains(container, node);
  2473. };
  2474. // Slick attribute getter
  2475. Slick.getAttribute = function(node, name){
  2476. local.setDocument(node);
  2477. return local.getAttribute(node, name);
  2478. };
  2479. Slick.hasAttribute = function(node, name){
  2480. local.setDocument(node);
  2481. return local.hasAttribute(node, name);
  2482. };
  2483. // Slick matcher
  2484. Slick.match = function(node, selector){
  2485. if (!(node && selector)) return false;
  2486. if (!selector || selector === node) return true;
  2487. local.setDocument(node);
  2488. return local.matchNode(node, selector);
  2489. };
  2490. // Slick attribute accessor
  2491. Slick.defineAttributeGetter = function(name, fn){
  2492. local.attributeGetters[name] = fn;
  2493. return this;
  2494. };
  2495. Slick.lookupAttributeGetter = function(name){
  2496. return local.attributeGetters[name];
  2497. };
  2498. // Slick pseudo accessor
  2499. Slick.definePseudo = function(name, fn){
  2500. local['pseudo:' + name] = function(node, argument){
  2501. return fn.call(node, argument);
  2502. };
  2503. return this;
  2504. };
  2505. Slick.lookupPseudo = function(name){
  2506. var pseudo = local['pseudo:' + name];
  2507. if (pseudo) return function(argument){
  2508. return pseudo.call(this, argument);
  2509. };
  2510. return null;
  2511. };
  2512. // Slick overrides accessor
  2513. Slick.override = function(regexp, fn){
  2514. local.override(regexp, fn);
  2515. return this;
  2516. };
  2517. Slick.isXML = local.isXML;
  2518. Slick.uidOf = function(node){
  2519. return local.getUIDHTML(node);
  2520. };
  2521. if (!this.Slick) this.Slick = Slick;
  2522. }).apply(/*<CommonJS>*/(typeof exports != 'undefined') ? exports : /*</CommonJS>*/this);
  2523. /*
  2524. ---
  2525. name: Element
  2526. description: One of the most important items in MooTools. Contains the dollar function, the dollars function, and an handful of cross-browser, time-saver methods to let you easily work with HTML Elements.
  2527. license: MIT-style license.
  2528. requires: [Window, Document, Array, String, Function, Object, Number, Slick.Parser, Slick.Finder]
  2529. provides: [Element, Elements, $, $$, IFrame, Selectors]
  2530. ...
  2531. */
  2532. var Element = this.Element = function(tag, props){
  2533. var konstructor = Element.Constructors[tag];
  2534. if (konstructor) return konstructor(props);
  2535. if (typeof tag != 'string') return document.id(tag).set(props);
  2536. if (!props) props = {};
  2537. if (!(/^[\w-]+$/).test(tag)){
  2538. var parsed = Slick.parse(tag).expressions[0][0];
  2539. tag = (parsed.tag == '*') ? 'div' : parsed.tag;
  2540. if (parsed.id && props.id == null) props.id = parsed.id;
  2541. var attributes = parsed.attributes;
  2542. if (attributes) for (var attr, i = 0, l = attributes.length; i < l; i++){
  2543. attr = attributes[i];
  2544. if (props[attr.key] != null) continue;
  2545. if (attr.value != null && attr.operator == '=') props[attr.key] = attr.value;
  2546. else if (!attr.value && !attr.operator) props[attr.key] = true;
  2547. }
  2548. if (parsed.classList && props['class'] == null) props['class'] = parsed.classList.join(' ');
  2549. }
  2550. return document.newElement(tag, props);
  2551. };
  2552. if (Browser.Element){
  2553. Element.prototype = Browser.Element.prototype;
  2554. // IE8 and IE9 require the wrapping.
  2555. Element.prototype._fireEvent = (function(fireEvent){
  2556. return function(type, event){
  2557. return fireEvent.call(this, type, event);
  2558. };
  2559. })(Element.prototype.fireEvent);
  2560. }
  2561. new Type('Element', Element).mirror(function(name){
  2562. if (Array.prototype[name]) return;
  2563. var obj = {};
  2564. obj[name] = function(){
  2565. var results = [], args = arguments, elements = true;
  2566. for (var i = 0, l = this.length; i < l; i++){
  2567. var element = this[i], result = results[i] = element[name].apply(element, args);
  2568. elements = (elements && typeOf(result) == 'element');
  2569. }
  2570. return (elements) ? new Elements(results) : results;
  2571. };
  2572. Elements.implement(obj);
  2573. });
  2574. if (!Browser.Element){
  2575. Element.parent = Object;
  2576. Element.Prototype = {
  2577. '$constructor': Element,
  2578. '$family': Function.convert('element').hide()
  2579. };
  2580. Element.mirror(function(name, method){
  2581. Element.Prototype[name] = method;
  2582. });
  2583. }
  2584. Element.Constructors = {};
  2585. //<1.2compat>
  2586. Element.Constructors = new Hash;
  2587. //</1.2compat>
  2588. var IFrame = new Type('IFrame', function(){
  2589. var params = Array.link(arguments, {
  2590. properties: Type.isObject,
  2591. iframe: function(obj){
  2592. return (obj != null);
  2593. }
  2594. });
  2595. var props = params.properties || {}, iframe;
  2596. if (params.iframe) iframe = document.id(params.iframe);
  2597. var onload = props.onload || function(){};
  2598. delete props.onload;
  2599. props.id = props.name = [props.id, props.name, iframe ? (iframe.id || iframe.name) : 'IFrame_' + String.uniqueID()].pick();
  2600. iframe = new Element(iframe || 'iframe', props);
  2601. var onLoad = function(){
  2602. onload.call(iframe.contentWindow);
  2603. };
  2604. if (window.frames[props.id]) onLoad();
  2605. else iframe.addListener('load', onLoad);
  2606. return iframe;
  2607. });
  2608. var Elements = this.Elements = function(nodes){
  2609. if (nodes && nodes.length){
  2610. var uniques = {}, node;
  2611. for (var i = 0; node = nodes[i++];){
  2612. var uid = Slick.uidOf(node);
  2613. if (!uniques[uid]){
  2614. uniques[uid] = true;
  2615. this.push(node);
  2616. }
  2617. }
  2618. }
  2619. };
  2620. Elements.prototype = {length: 0};
  2621. Elements.parent = Array;
  2622. new Type('Elements', Elements).implement({
  2623. filter: function(filter, bind){
  2624. if (!filter) return this;
  2625. return new Elements(Array.filter(this, (typeOf(filter) == 'string') ? function(item){
  2626. return item.match(filter);
  2627. } : filter, bind));
  2628. }.protect(),
  2629. push: function(){
  2630. var length = this.length;
  2631. for (var i = 0, l = arguments.length; i < l; i++){
  2632. var item = document.id(arguments[i]);
  2633. if (item) this[length++] = item;
  2634. }
  2635. return (this.length = length);
  2636. }.protect(),
  2637. unshift: function(){
  2638. var items = [];
  2639. for (var i = 0, l = arguments.length; i < l; i++){
  2640. var item = document.id(arguments[i]);
  2641. if (item) items.push(item);
  2642. }
  2643. return Array.prototype.unshift.apply(this, items);
  2644. }.protect(),
  2645. concat: function(){
  2646. var newElements = new Elements(this);
  2647. for (var i = 0, l = arguments.length; i < l; i++){
  2648. var item = arguments[i];
  2649. if (Type.isEnumerable(item)) newElements.append(item);
  2650. else newElements.push(item);
  2651. }
  2652. return newElements;
  2653. }.protect(),
  2654. append: function(collection){
  2655. for (var i = 0, l = collection.length; i < l; i++) this.push(collection[i]);
  2656. return this;
  2657. }.protect(),
  2658. empty: function(){
  2659. while (this.length) delete this[--this.length];
  2660. return this;
  2661. }.protect()
  2662. });
  2663. //<1.2compat>
  2664. Elements.alias('extend', 'append');
  2665. //</1.2compat>
  2666. (function(){
  2667. // FF, IE
  2668. var splice = Array.prototype.splice, object = {'0': 0, '1': 1, length: 2};
  2669. splice.call(object, 1, 1);
  2670. if (object[1] == 1) Elements.implement('splice', function(){
  2671. var length = this.length;
  2672. var result = splice.apply(this, arguments);
  2673. while (length >= this.length) delete this[length--];
  2674. return result;
  2675. }.protect());
  2676. Array.forEachMethod(function(method, name){
  2677. Elements.implement(name, method);
  2678. });
  2679. Array.mirror(Elements);
  2680. /*<ltIE8>*/
  2681. var createElementAcceptsHTML;
  2682. try {
  2683. createElementAcceptsHTML = (document.createElement('<input name=x>').name == 'x');
  2684. } catch (e){}
  2685. var escapeQuotes = function(html){
  2686. return ('' + html).replace(/&/g, '&amp;').replace(/"/g, '&quot;');
  2687. };
  2688. /*</ltIE8>*/
  2689. /*<ltIE9>*/
  2690. // #2479 - IE8 Cannot set HTML of style element
  2691. var canChangeStyleHTML = (function(){
  2692. var div = document.createElement('style'),
  2693. flag = false;
  2694. try {
  2695. div.innerHTML = '#justTesing{margin: 0px;}';
  2696. flag = !!div.innerHTML;
  2697. } catch (e){}
  2698. return flag;
  2699. })();
  2700. /*</ltIE9>*/
  2701. Document.implement({
  2702. newElement: function(tag, props){
  2703. if (props){
  2704. if (props.checked != null) props.defaultChecked = props.checked;
  2705. if ((props.type == 'checkbox' || props.type == 'radio') && props.value == null) props.value = 'on';
  2706. /*<ltIE9>*/ // IE needs the type to be set before changing content of style element
  2707. if (!canChangeStyleHTML && tag == 'style'){
  2708. var styleElement = document.createElement('style');
  2709. styleElement.setAttribute('type', 'text/css');
  2710. if (props.type) delete props.type;
  2711. return this.id(styleElement).set(props);
  2712. }
  2713. /*</ltIE9>*/
  2714. /*<ltIE8>*/// Fix for readonly name and type properties in IE < 8
  2715. if (createElementAcceptsHTML){
  2716. tag = '<' + tag;
  2717. if (props.name) tag += ' name="' + escapeQuotes(props.name) + '"';
  2718. if (props.type) tag += ' type="' + escapeQuotes(props.type) + '"';
  2719. tag += '>';
  2720. delete props.name;
  2721. delete props.type;
  2722. }
  2723. /*</ltIE8>*/
  2724. }
  2725. return this.id(this.createElement(tag)).set(props);
  2726. }
  2727. });
  2728. })();
  2729. (function(){
  2730. Slick.uidOf(window);
  2731. Slick.uidOf(document);
  2732. Document.implement({
  2733. newTextNode: function(text){
  2734. return this.createTextNode(text);
  2735. },
  2736. getDocument: function(){
  2737. return this;
  2738. },
  2739. getWindow: function(){
  2740. return this.window;
  2741. },
  2742. id: (function(){
  2743. var types = {
  2744. string: function(id, nocash, doc){
  2745. id = Slick.find(doc, '#' + id.replace(/(\W)/g, '\\$1'));
  2746. return (id) ? types.element(id, nocash) : null;
  2747. },
  2748. element: function(el, nocash){
  2749. Slick.uidOf(el);
  2750. if (!nocash && !el.$family && !(/^(?:object|embed)$/i).test(el.tagName)){
  2751. var fireEvent = el.fireEvent;
  2752. // wrapping needed in IE7, or else crash
  2753. el._fireEvent = function(type, event){
  2754. return fireEvent(type, event);
  2755. };
  2756. Object.append(el, Element.Prototype);
  2757. }
  2758. return el;
  2759. },
  2760. object: function(obj, nocash, doc){
  2761. if (obj.toElement) return types.element(obj.toElement(doc), nocash);
  2762. return null;
  2763. }
  2764. };
  2765. types.textnode = types.whitespace = types.window = types.document = function(zero){
  2766. return zero;
  2767. };
  2768. return function(el, nocash, doc){
  2769. if (el && el.$family && el.uniqueNumber) return el;
  2770. var type = typeOf(el);
  2771. return (types[type]) ? types[type](el, nocash, doc || document) : null;
  2772. };
  2773. })()
  2774. });
  2775. if (window.$ == null) Window.implement('$', function(el, nc){
  2776. return document.id(el, nc, this.document);
  2777. });
  2778. Window.implement({
  2779. getDocument: function(){
  2780. return this.document;
  2781. },
  2782. getWindow: function(){
  2783. return this;
  2784. }
  2785. });
  2786. [Document, Element].invoke('implement', {
  2787. getElements: function(expression){
  2788. return Slick.search(this, expression, new Elements);
  2789. },
  2790. getElement: function(expression){
  2791. return document.id(Slick.find(this, expression));
  2792. }
  2793. });
  2794. var contains = {contains: function(element){
  2795. return Slick.contains(this, element);
  2796. }};
  2797. if (!document.contains) Document.implement(contains);
  2798. if (!document.createElement('div').contains) Element.implement(contains);
  2799. //<1.2compat>
  2800. Element.implement('hasChild', function(element){
  2801. return this !== element && this.contains(element);
  2802. });
  2803. (function(search, find, match){
  2804. this.Selectors = {};
  2805. var pseudos = this.Selectors.Pseudo = new Hash();
  2806. var addSlickPseudos = function(){
  2807. for (var name in pseudos) if (pseudos.hasOwnProperty(name)){
  2808. Slick.definePseudo(name, pseudos[name]);
  2809. delete pseudos[name];
  2810. }
  2811. };
  2812. Slick.search = function(context, expression, append){
  2813. addSlickPseudos();
  2814. return search.call(this, context, expression, append);
  2815. };
  2816. Slick.find = function(context, expression){
  2817. addSlickPseudos();
  2818. return find.call(this, context, expression);
  2819. };
  2820. Slick.match = function(node, selector){
  2821. addSlickPseudos();
  2822. return match.call(this, node, selector);
  2823. };
  2824. })(Slick.search, Slick.find, Slick.match);
  2825. //</1.2compat>
  2826. // tree walking
  2827. var injectCombinator = function(expression, combinator){
  2828. if (!expression) return combinator;
  2829. expression = Object.clone(Slick.parse(expression));
  2830. var expressions = expression.expressions;
  2831. for (var i = expressions.length; i--;)
  2832. expressions[i][0].combinator = combinator;
  2833. return expression;
  2834. };
  2835. Object.forEach({
  2836. getNext: '~',
  2837. getPrevious: '!~',
  2838. getParent: '!'
  2839. }, function(combinator, method){
  2840. Element.implement(method, function(expression){
  2841. return this.getElement(injectCombinator(expression, combinator));
  2842. });
  2843. });
  2844. Object.forEach({
  2845. getAllNext: '~',
  2846. getAllPrevious: '!~',
  2847. getSiblings: '~~',
  2848. getChildren: '>',
  2849. getParents: '!'
  2850. }, function(combinator, method){
  2851. Element.implement(method, function(expression){
  2852. return this.getElements(injectCombinator(expression, combinator));
  2853. });
  2854. });
  2855. Element.implement({
  2856. getFirst: function(expression){
  2857. return document.id(Slick.search(this, injectCombinator(expression, '>'))[0]);
  2858. },
  2859. getLast: function(expression){
  2860. return document.id(Slick.search(this, injectCombinator(expression, '>')).getLast());
  2861. },
  2862. getWindow: function(){
  2863. return this.ownerDocument.window;
  2864. },
  2865. getDocument: function(){
  2866. return this.ownerDocument;
  2867. },
  2868. getElementById: function(id){
  2869. return document.id(Slick.find(this, '#' + ('' + id).replace(/(\W)/g, '\\$1')));
  2870. },
  2871. match: function(expression){
  2872. return !expression || Slick.match(this, expression);
  2873. }
  2874. });
  2875. //<1.2compat>
  2876. if (window.$$ == null) Window.implement('$$', function(selector){
  2877. var elements = new Elements;
  2878. if (arguments.length == 1 && typeof selector == 'string') return Slick.search(this.document, selector, elements);
  2879. var args = Array.flatten(arguments);
  2880. for (var i = 0, l = args.length; i < l; i++){
  2881. var item = args[i];
  2882. switch (typeOf(item)){
  2883. case 'element': elements.push(item); break;
  2884. case 'string': Slick.search(this.document, item, elements);
  2885. }
  2886. }
  2887. return elements;
  2888. });
  2889. //</1.2compat>
  2890. if (window.$$ == null) Window.implement('$$', function(selector){
  2891. if (arguments.length == 1){
  2892. if (typeof selector == 'string') return Slick.search(this.document, selector, new Elements);
  2893. else if (Type.isEnumerable(selector)) return new Elements(selector);
  2894. }
  2895. return new Elements(arguments);
  2896. });
  2897. // Inserters
  2898. var inserters = {
  2899. before: function(context, element){
  2900. var parent = element.parentNode;
  2901. if (parent) parent.insertBefore(context, element);
  2902. },
  2903. after: function(context, element){
  2904. var parent = element.parentNode;
  2905. if (parent) parent.insertBefore(context, element.nextSibling);
  2906. },
  2907. bottom: function(context, element){
  2908. element.appendChild(context);
  2909. },
  2910. top: function(context, element){
  2911. element.insertBefore(context, element.firstChild);
  2912. }
  2913. };
  2914. inserters.inside = inserters.bottom;
  2915. //<1.2compat>
  2916. Object.each(inserters, function(inserter, where){
  2917. where = where.capitalize();
  2918. var methods = {};
  2919. methods['inject' + where] = function(el){
  2920. inserter(this, document.id(el, true));
  2921. return this;
  2922. };
  2923. methods['grab' + where] = function(el){
  2924. inserter(document.id(el, true), this);
  2925. return this;
  2926. };
  2927. Element.implement(methods);
  2928. });
  2929. //</1.2compat>
  2930. // getProperty / setProperty
  2931. var propertyGetters = {}, propertySetters = {};
  2932. // properties
  2933. var properties = {};
  2934. Array.forEach([
  2935. 'type', 'value', 'defaultValue', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan',
  2936. 'frameBorder', 'rowSpan', 'tabIndex', 'useMap'
  2937. ], function(property){
  2938. properties[property.toLowerCase()] = property;
  2939. });
  2940. properties.html = 'innerHTML';
  2941. properties.text = (document.createElement('div').textContent == null) ? 'innerText': 'textContent';
  2942. Object.forEach(properties, function(real, key){
  2943. propertySetters[key] = function(node, value){
  2944. node[real] = value;
  2945. };
  2946. propertyGetters[key] = function(node){
  2947. return node[real];
  2948. };
  2949. });
  2950. /*<ltIE9>*/
  2951. propertySetters.text = (function(){
  2952. return function(node, value){
  2953. if (node.get('tag') == 'style') node.set('html', value);
  2954. else node[properties.text] = value;
  2955. };
  2956. })(propertySetters.text);
  2957. propertyGetters.text = (function(getter){
  2958. return function(node){
  2959. return (node.get('tag') == 'style') ? node.innerHTML : getter(node);
  2960. };
  2961. })(propertyGetters.text);
  2962. /*</ltIE9>*/
  2963. // Booleans
  2964. var bools = [
  2965. 'compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked',
  2966. 'disabled', 'readOnly', 'multiple', 'selected', 'noresize',
  2967. 'defer', 'defaultChecked', 'autofocus', 'controls', 'autoplay',
  2968. 'loop'
  2969. ];
  2970. var booleans = {};
  2971. Array.forEach(bools, function(bool){
  2972. var lower = bool.toLowerCase();
  2973. booleans[lower] = bool;
  2974. propertySetters[lower] = function(node, value){
  2975. node[bool] = !!value;
  2976. };
  2977. propertyGetters[lower] = function(node){
  2978. return !!node[bool];
  2979. };
  2980. });
  2981. // Special cases
  2982. Object.append(propertySetters, {
  2983. 'class': function(node, value){
  2984. ('className' in node) ? node.className = (value || '') : node.setAttribute('class', value);
  2985. },
  2986. 'for': function(node, value){
  2987. ('htmlFor' in node) ? node.htmlFor = value : node.setAttribute('for', value);
  2988. },
  2989. 'style': function(node, value){
  2990. (node.style) ? node.style.cssText = value : node.setAttribute('style', value);
  2991. },
  2992. 'value': function(node, value){
  2993. node.value = (value != null) ? value : '';
  2994. }
  2995. });
  2996. propertyGetters['class'] = function(node){
  2997. return ('className' in node) ? node.className || null : node.getAttribute('class');
  2998. };
  2999. /* <webkit> */
  3000. var el = document.createElement('button');
  3001. // IE sets type as readonly and throws
  3002. try { el.type = 'button'; } catch (e){}
  3003. if (el.type != 'button') propertySetters.type = function(node, value){
  3004. node.setAttribute('type', value);
  3005. };
  3006. el = null;
  3007. /* </webkit> */
  3008. /*<IE>*/
  3009. /*<ltIE9>*/
  3010. // #2479 - IE8 Cannot set HTML of style element
  3011. var canChangeStyleHTML = (function(){
  3012. var div = document.createElement('style'),
  3013. flag = false;
  3014. try {
  3015. div.innerHTML = '#justTesing{margin: 0px;}';
  3016. flag = !!div.innerHTML;
  3017. } catch (e){}
  3018. return flag;
  3019. })();
  3020. /*</ltIE9>*/
  3021. var input = document.createElement('input'), volatileInputValue, html5InputSupport;
  3022. // #2178
  3023. input.value = 't';
  3024. input.type = 'submit';
  3025. volatileInputValue = input.value != 't';
  3026. // #2443 - IE throws "Invalid Argument" when trying to use html5 input types
  3027. try {
  3028. input.value = '';
  3029. input.type = 'email';
  3030. html5InputSupport = input.type == 'email';
  3031. } catch (e){}
  3032. input = null;
  3033. if (volatileInputValue || !html5InputSupport) propertySetters.type = function(node, type){
  3034. try {
  3035. var value = node.value;
  3036. node.type = type;
  3037. node.value = value;
  3038. } catch (e){}
  3039. };
  3040. /*</IE>*/
  3041. /* getProperty, setProperty */
  3042. /* <ltIE9> */
  3043. var pollutesGetAttribute = (function(div){
  3044. div.random = 'attribute';
  3045. return (div.getAttribute('random') == 'attribute');
  3046. })(document.createElement('div'));
  3047. var hasCloneBug = (function(test){
  3048. test.innerHTML = '<object><param name="should_fix" value="the unknown" /></object>';
  3049. return test.cloneNode(true).firstChild.childNodes.length != 1;
  3050. })(document.createElement('div'));
  3051. /* </ltIE9> */
  3052. var hasClassList = !!document.createElement('div').classList;
  3053. var classes = function(className){
  3054. var classNames = (className || '').clean().split(' '), uniques = {};
  3055. return classNames.filter(function(className){
  3056. if (className !== '' && !uniques[className]) return uniques[className] = className;
  3057. });
  3058. };
  3059. var addToClassList = function(name){
  3060. this.classList.add(name);
  3061. };
  3062. var removeFromClassList = function(name){
  3063. this.classList.remove(name);
  3064. };
  3065. Element.implement({
  3066. setProperty: function(name, value){
  3067. var setter = propertySetters[name.toLowerCase()];
  3068. if (setter){
  3069. setter(this, value);
  3070. } else {
  3071. /* <ltIE9> */
  3072. var attributeWhiteList;
  3073. if (pollutesGetAttribute) attributeWhiteList = this.retrieve('$attributeWhiteList', {});
  3074. /* </ltIE9> */
  3075. if (value == null){
  3076. this.removeAttribute(name);
  3077. /* <ltIE9> */
  3078. if (pollutesGetAttribute) delete attributeWhiteList[name];
  3079. /* </ltIE9> */
  3080. } else {
  3081. this.setAttribute(name, '' + value);
  3082. /* <ltIE9> */
  3083. if (pollutesGetAttribute) attributeWhiteList[name] = true;
  3084. /* </ltIE9> */
  3085. }
  3086. }
  3087. return this;
  3088. },
  3089. setProperties: function(attributes){
  3090. for (var attribute in attributes) this.setProperty(attribute, attributes[attribute]);
  3091. return this;
  3092. },
  3093. getProperty: function(name){
  3094. var getter = propertyGetters[name.toLowerCase()];
  3095. if (getter) return getter(this);
  3096. /* <ltIE9> */
  3097. if (pollutesGetAttribute){
  3098. var attr = this.getAttributeNode(name), attributeWhiteList = this.retrieve('$attributeWhiteList', {});
  3099. if (!attr) return null;
  3100. if (attr.expando && !attributeWhiteList[name]){
  3101. var outer = this.outerHTML;
  3102. // segment by the opening tag and find mention of attribute name
  3103. if (outer.substr(0, outer.search(/\/?['"]?>(?![^<]*<['"])/)).indexOf(name) < 0) return null;
  3104. attributeWhiteList[name] = true;
  3105. }
  3106. }
  3107. /* </ltIE9> */
  3108. var result = Slick.getAttribute(this, name);
  3109. return (!result && !Slick.hasAttribute(this, name)) ? null : result;
  3110. },
  3111. getProperties: function(){
  3112. var args = Array.convert(arguments);
  3113. return args.map(this.getProperty, this).associate(args);
  3114. },
  3115. removeProperty: function(name){
  3116. return this.setProperty(name, null);
  3117. },
  3118. removeProperties: function(){
  3119. Array.each(arguments, this.removeProperty, this);
  3120. return this;
  3121. },
  3122. set: function(prop, value){
  3123. var property = Element.Properties[prop];
  3124. (property && property.set) ? property.set.call(this, value) : this.setProperty(prop, value);
  3125. }.overloadSetter(),
  3126. get: function(prop){
  3127. var property = Element.Properties[prop];
  3128. return (property && property.get) ? property.get.apply(this) : this.getProperty(prop);
  3129. }.overloadGetter(),
  3130. erase: function(prop){
  3131. var property = Element.Properties[prop];
  3132. (property && property.erase) ? property.erase.apply(this) : this.removeProperty(prop);
  3133. return this;
  3134. },
  3135. hasClass: hasClassList ? function(className){
  3136. return this.classList.contains(className);
  3137. } : function(className){
  3138. return classes(this.className).contains(className);
  3139. },
  3140. addClass: hasClassList ? function(className){
  3141. classes(className).forEach(addToClassList, this);
  3142. return this;
  3143. } : function(className){
  3144. this.className = classes(className + ' ' + this.className).join(' ');
  3145. return this;
  3146. },
  3147. removeClass: hasClassList ? function(className){
  3148. classes(className).forEach(removeFromClassList, this);
  3149. return this;
  3150. } : function(className){
  3151. var classNames = classes(this.className);
  3152. classes(className).forEach(classNames.erase, classNames);
  3153. this.className = classNames.join(' ');
  3154. return this;
  3155. },
  3156. toggleClass: function(className, force){
  3157. if (force == null) force = !this.hasClass(className);
  3158. return (force) ? this.addClass(className) : this.removeClass(className);
  3159. },
  3160. adopt: function(){
  3161. var parent = this, fragment, elements = Array.flatten(arguments), length = elements.length;
  3162. if (length > 1) parent = fragment = document.createDocumentFragment();
  3163. for (var i = 0; i < length; i++){
  3164. var element = document.id(elements[i], true);
  3165. if (element) parent.appendChild(element);
  3166. }
  3167. if (fragment) this.appendChild(fragment);
  3168. return this;
  3169. },
  3170. appendText: function(text, where){
  3171. return this.grab(this.getDocument().newTextNode(text), where);
  3172. },
  3173. grab: function(el, where){
  3174. inserters[where || 'bottom'](document.id(el, true), this);
  3175. return this;
  3176. },
  3177. inject: function(el, where){
  3178. inserters[where || 'bottom'](this, document.id(el, true));
  3179. return this;
  3180. },
  3181. replaces: function(el){
  3182. el = document.id(el, true);
  3183. el.parentNode.replaceChild(this, el);
  3184. return this;
  3185. },
  3186. wraps: function(el, where){
  3187. el = document.id(el, true);
  3188. return this.replaces(el).grab(el, where);
  3189. },
  3190. getSelected: function(){
  3191. this.selectedIndex; // Safari 3.2.1
  3192. return new Elements(Array.convert(this.options).filter(function(option){
  3193. return option.selected;
  3194. }));
  3195. },
  3196. toQueryString: function(){
  3197. var queryString = [];
  3198. this.getElements('input, select, textarea').each(function(el){
  3199. var type = el.type;
  3200. if (!el.name || el.disabled || type == 'submit' || type == 'reset' || type == 'file' || type == 'image') return;
  3201. var value = (el.get('tag') == 'select') ? el.getSelected().map(function(opt){
  3202. // IE
  3203. return document.id(opt).get('value');
  3204. }) : ((type == 'radio' || type == 'checkbox') && !el.checked) ? null : el.get('value');
  3205. Array.convert(value).each(function(val){
  3206. if (typeof val != 'undefined') queryString.push(encodeURIComponent(el.name) + '=' + encodeURIComponent(val));
  3207. });
  3208. });
  3209. return queryString.join('&');
  3210. }
  3211. });
  3212. // appendHTML
  3213. var appendInserters = {
  3214. before: 'beforeBegin',
  3215. after: 'afterEnd',
  3216. bottom: 'beforeEnd',
  3217. top: 'afterBegin',
  3218. inside: 'beforeEnd'
  3219. };
  3220. Element.implement('appendHTML', ('insertAdjacentHTML' in document.createElement('div')) ? function(html, where){
  3221. this.insertAdjacentHTML(appendInserters[where || 'bottom'], html);
  3222. return this;
  3223. } : function(html, where){
  3224. var temp = new Element('div', {html: html}),
  3225. children = temp.childNodes,
  3226. fragment = temp.firstChild;
  3227. if (!fragment) return this;
  3228. if (children.length > 1){
  3229. fragment = document.createDocumentFragment();
  3230. for (var i = 0, l = children.length; i < l; i++){
  3231. fragment.appendChild(children[i]);
  3232. }
  3233. }
  3234. inserters[where || 'bottom'](fragment, this);
  3235. return this;
  3236. });
  3237. var collected = {}, storage = {};
  3238. var get = function(uid){
  3239. return (storage[uid] || (storage[uid] = {}));
  3240. };
  3241. var clean = function(item){
  3242. var uid = item.uniqueNumber;
  3243. if (item.removeEvents) item.removeEvents();
  3244. if (item.clearAttributes) item.clearAttributes();
  3245. if (uid != null){
  3246. delete collected[uid];
  3247. delete storage[uid];
  3248. }
  3249. return item;
  3250. };
  3251. var formProps = {input: 'checked', option: 'selected', textarea: 'value'};
  3252. Element.implement({
  3253. destroy: function(){
  3254. var children = clean(this).getElementsByTagName('*');
  3255. Array.each(children, clean);
  3256. Element.dispose(this);
  3257. return null;
  3258. },
  3259. empty: function(){
  3260. Array.convert(this.childNodes).each(Element.dispose);
  3261. return this;
  3262. },
  3263. dispose: function(){
  3264. return (this.parentNode) ? this.parentNode.removeChild(this) : this;
  3265. },
  3266. clone: function(contents, keepid){
  3267. contents = contents !== false;
  3268. var clone = this.cloneNode(contents), ce = [clone], te = [this], i;
  3269. if (contents){
  3270. ce.append(Array.convert(clone.getElementsByTagName('*')));
  3271. te.append(Array.convert(this.getElementsByTagName('*')));
  3272. }
  3273. for (i = ce.length; i--;){
  3274. var node = ce[i], element = te[i];
  3275. if (!keepid) node.removeAttribute('id');
  3276. /*<ltIE9>*/
  3277. if (node.clearAttributes){
  3278. node.clearAttributes();
  3279. node.mergeAttributes(element);
  3280. node.removeAttribute('uniqueNumber');
  3281. if (node.options){
  3282. var no = node.options, eo = element.options;
  3283. for (var j = no.length; j--;) no[j].selected = eo[j].selected;
  3284. }
  3285. }
  3286. /*</ltIE9>*/
  3287. var prop = formProps[element.tagName.toLowerCase()];
  3288. if (prop && element[prop]) node[prop] = element[prop];
  3289. }
  3290. /*<ltIE9>*/
  3291. if (hasCloneBug){
  3292. var co = clone.getElementsByTagName('object'), to = this.getElementsByTagName('object');
  3293. for (i = co.length; i--;) co[i].outerHTML = to[i].outerHTML;
  3294. }
  3295. /*</ltIE9>*/
  3296. return document.id(clone);
  3297. }
  3298. });
  3299. [Element, Window, Document].invoke('implement', {
  3300. addListener: function(type, fn){
  3301. if (window.attachEvent && !window.addEventListener){
  3302. collected[Slick.uidOf(this)] = this;
  3303. }
  3304. if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]);
  3305. else this.attachEvent('on' + type, fn);
  3306. return this;
  3307. },
  3308. removeListener: function(type, fn){
  3309. if (this.removeEventListener) this.removeEventListener(type, fn, !!arguments[2]);
  3310. else this.detachEvent('on' + type, fn);
  3311. return this;
  3312. },
  3313. retrieve: function(property, dflt){
  3314. var storage = get(Slick.uidOf(this)), prop = storage[property];
  3315. if (dflt != null && prop == null) prop = storage[property] = dflt;
  3316. return prop != null ? prop : null;
  3317. },
  3318. store: function(property, value){
  3319. var storage = get(Slick.uidOf(this));
  3320. storage[property] = value;
  3321. return this;
  3322. },
  3323. eliminate: function(property){
  3324. var storage = get(Slick.uidOf(this));
  3325. delete storage[property];
  3326. return this;
  3327. }
  3328. });
  3329. /*<ltIE9>*/
  3330. if (window.attachEvent && !window.addEventListener){
  3331. var gc = function(){
  3332. Object.each(collected, clean);
  3333. if (window.CollectGarbage) CollectGarbage();
  3334. window.removeListener('unload', gc);
  3335. };
  3336. window.addListener('unload', gc);
  3337. }
  3338. /*</ltIE9>*/
  3339. Element.Properties = {};
  3340. //<1.2compat>
  3341. Element.Properties = new Hash;
  3342. //</1.2compat>
  3343. Element.Properties.style = {
  3344. set: function(style){
  3345. this.style.cssText = style;
  3346. },
  3347. get: function(){
  3348. return this.style.cssText;
  3349. },
  3350. erase: function(){
  3351. this.style.cssText = '';
  3352. }
  3353. };
  3354. Element.Properties.tag = {
  3355. get: function(){
  3356. return this.tagName.toLowerCase();
  3357. }
  3358. };
  3359. Element.Properties.html = {
  3360. set: function(html){
  3361. if (html == null) html = '';
  3362. else if (typeOf(html) == 'array') html = html.join('');
  3363. /*<ltIE9>*/
  3364. if (this.styleSheet && !canChangeStyleHTML) this.styleSheet.cssText = html;
  3365. else /*</ltIE9>*/this.innerHTML = html;
  3366. },
  3367. erase: function(){
  3368. this.set('html', '');
  3369. }
  3370. };
  3371. var supportsHTML5Elements = true, supportsTableInnerHTML = true, supportsTRInnerHTML = true;
  3372. /*<ltIE9>*/
  3373. // technique by jdbarlett - http://jdbartlett.com/innershiv/
  3374. var div = document.createElement('div');
  3375. var fragment;
  3376. div.innerHTML = '<nav></nav>';
  3377. supportsHTML5Elements = (div.childNodes.length == 1);
  3378. if (!supportsHTML5Elements){
  3379. var tags = 'abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' ');
  3380. fragment = document.createDocumentFragment(), l = tags.length;
  3381. while (l--) fragment.createElement(tags[l]);
  3382. }
  3383. div = null;
  3384. /*</ltIE9>*/
  3385. /*<IE>*/
  3386. supportsTableInnerHTML = Function.attempt(function(){
  3387. var table = document.createElement('table');
  3388. table.innerHTML = '<tr><td></td></tr>';
  3389. return true;
  3390. });
  3391. /*<ltFF4>*/
  3392. var tr = document.createElement('tr'), html = '<td></td>';
  3393. tr.innerHTML = html;
  3394. supportsTRInnerHTML = (tr.innerHTML == html);
  3395. tr = null;
  3396. /*</ltFF4>*/
  3397. if (!supportsTableInnerHTML || !supportsTRInnerHTML || !supportsHTML5Elements){
  3398. Element.Properties.html.set = (function(set){
  3399. var translations = {
  3400. table: [1, '<table>', '</table>'],
  3401. select: [1, '<select>', '</select>'],
  3402. tbody: [2, '<table><tbody>', '</tbody></table>'],
  3403. tr: [3, '<table><tbody><tr>', '</tr></tbody></table>']
  3404. };
  3405. translations.thead = translations.tfoot = translations.tbody;
  3406. return function(html){
  3407. /*<ltIE9>*/
  3408. if (this.styleSheet) return set.call(this, html);
  3409. /*</ltIE9>*/
  3410. var wrap = translations[this.get('tag')];
  3411. if (!wrap && !supportsHTML5Elements) wrap = [0, '', ''];
  3412. if (!wrap) return set.call(this, html);
  3413. var level = wrap[0], wrapper = document.createElement('div'), target = wrapper;
  3414. if (!supportsHTML5Elements) fragment.appendChild(wrapper);
  3415. wrapper.innerHTML = [wrap[1], html, wrap[2]].flatten().join('');
  3416. while (level--) target = target.firstChild;
  3417. this.empty().adopt(target.childNodes);
  3418. if (!supportsHTML5Elements) fragment.removeChild(wrapper);
  3419. wrapper = null;
  3420. };
  3421. })(Element.Properties.html.set);
  3422. }
  3423. /*</IE>*/
  3424. /*<ltIE9>*/
  3425. var testForm = document.createElement('form');
  3426. testForm.innerHTML = '<select><option>s</option></select>';
  3427. if (testForm.firstChild.value != 's') Element.Properties.value = {
  3428. set: function(value){
  3429. var tag = this.get('tag');
  3430. if (tag != 'select') return this.setProperty('value', value);
  3431. var options = this.getElements('option');
  3432. value = String(value);
  3433. for (var i = 0; i < options.length; i++){
  3434. var option = options[i],
  3435. attr = option.getAttributeNode('value'),
  3436. optionValue = (attr && attr.specified) ? option.value : option.get('text');
  3437. if (optionValue === value) return option.selected = true;
  3438. }
  3439. },
  3440. get: function(){
  3441. var option = this, tag = option.get('tag');
  3442. if (tag != 'select' && tag != 'option') return this.getProperty('value');
  3443. if (tag == 'select' && !(option = option.getSelected()[0])) return '';
  3444. var attr = option.getAttributeNode('value');
  3445. return (attr && attr.specified) ? option.value : option.get('text');
  3446. }
  3447. };
  3448. testForm = null;
  3449. /*</ltIE9>*/
  3450. /*<IE>*/
  3451. if (document.createElement('div').getAttributeNode('id')) Element.Properties.id = {
  3452. set: function(id){
  3453. this.id = this.getAttributeNode('id').value = id;
  3454. },
  3455. get: function(){
  3456. return this.id || null;
  3457. },
  3458. erase: function(){
  3459. this.id = this.getAttributeNode('id').value = '';
  3460. }
  3461. };
  3462. /*</IE>*/
  3463. })();
  3464. /*
  3465. ---
  3466. name: Event
  3467. description: Contains the Event Type, to make the event object cross-browser.
  3468. license: MIT-style license.
  3469. requires: [Window, Document, Array, Function, String, Object]
  3470. provides: Event
  3471. ...
  3472. */
  3473. (function(){
  3474. var _keys = {};
  3475. var normalizeWheelSpeed = function(event){
  3476. var normalized;
  3477. if (event.wheelDelta){
  3478. normalized = event.wheelDelta % 120 == 0 ? event.wheelDelta / 120 : event.wheelDelta / 12;
  3479. } else {
  3480. var rawAmount = event.deltaY || event.detail || 0;
  3481. normalized = -(rawAmount % 3 == 0 ? rawAmount / 3 : rawAmount * 10);
  3482. }
  3483. return normalized;
  3484. };
  3485. var DOMEvent = this.DOMEvent = new Type('DOMEvent', function(event, win){
  3486. if (!win) win = window;
  3487. event = event || win.event;
  3488. if (event.$extended) return event;
  3489. this.event = event;
  3490. this.$extended = true;
  3491. this.shift = event.shiftKey;
  3492. this.control = event.ctrlKey;
  3493. this.alt = event.altKey;
  3494. this.meta = event.metaKey;
  3495. var type = this.type = event.type;
  3496. var target = event.target || event.srcElement;
  3497. while (target && target.nodeType == 3) target = target.parentNode;
  3498. this.target = document.id(target);
  3499. if (type.indexOf('key') == 0){
  3500. var code = this.code = (event.which || event.keyCode);
  3501. if (!this.shift || type != 'keypress') this.key = _keys[code]/*<1.3compat>*/ || Object.keyOf(Event.Keys, code)/*</1.3compat>*/;
  3502. if (type == 'keydown' || type == 'keyup'){
  3503. if (code > 111 && code < 124) this.key = 'f' + (code - 111);
  3504. else if (code > 95 && code < 106) this.key = code - 96;
  3505. }
  3506. if (this.key == null) this.key = String.fromCharCode(code).toLowerCase();
  3507. } else if (type == 'click' || type == 'dblclick' || type == 'contextmenu' || type == 'wheel' || type == 'DOMMouseScroll' || type.indexOf('mouse') == 0){
  3508. var doc = win.document;
  3509. doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
  3510. this.page = {
  3511. x: (event.pageX != null) ? event.pageX : event.clientX + doc.scrollLeft,
  3512. y: (event.pageY != null) ? event.pageY : event.clientY + doc.scrollTop
  3513. };
  3514. this.client = {
  3515. x: (event.pageX != null) ? event.pageX - win.pageXOffset : event.clientX,
  3516. y: (event.pageY != null) ? event.pageY - win.pageYOffset : event.clientY
  3517. };
  3518. if (type == 'DOMMouseScroll' || type == 'wheel' || type == 'mousewheel') this.wheel = normalizeWheelSpeed(event);
  3519. this.rightClick = (event.which == 3 || event.button == 2);
  3520. if (type == 'mouseover' || type == 'mouseout' || type == 'mouseenter' || type == 'mouseleave'){
  3521. var overTarget = type == 'mouseover' || type == 'mouseenter';
  3522. var related = event.relatedTarget || event[(overTarget ? 'from' : 'to') + 'Element'];
  3523. while (related && related.nodeType == 3) related = related.parentNode;
  3524. this.relatedTarget = document.id(related);
  3525. }
  3526. } else if (type.indexOf('touch') == 0 || type.indexOf('gesture') == 0){
  3527. this.rotation = event.rotation;
  3528. this.scale = event.scale;
  3529. this.targetTouches = event.targetTouches;
  3530. this.changedTouches = event.changedTouches;
  3531. var touches = this.touches = event.touches;
  3532. if (touches && touches[0]){
  3533. var touch = touches[0];
  3534. this.page = {x: touch.pageX, y: touch.pageY};
  3535. this.client = {x: touch.clientX, y: touch.clientY};
  3536. }
  3537. }
  3538. if (!this.client) this.client = {};
  3539. if (!this.page) this.page = {};
  3540. });
  3541. DOMEvent.implement({
  3542. stop: function(){
  3543. return this.preventDefault().stopPropagation();
  3544. },
  3545. stopPropagation: function(){
  3546. if (this.event.stopPropagation) this.event.stopPropagation();
  3547. else this.event.cancelBubble = true;
  3548. return this;
  3549. },
  3550. preventDefault: function(){
  3551. if (this.event.preventDefault) this.event.preventDefault();
  3552. else this.event.returnValue = false;
  3553. return this;
  3554. }
  3555. });
  3556. DOMEvent.defineKey = function(code, key){
  3557. _keys[code] = key;
  3558. return this;
  3559. };
  3560. DOMEvent.defineKeys = DOMEvent.defineKey.overloadSetter(true);
  3561. DOMEvent.defineKeys({
  3562. '38': 'up', '40': 'down', '37': 'left', '39': 'right',
  3563. '27': 'esc', '32': 'space', '8': 'backspace', '9': 'tab',
  3564. '46': 'delete', '13': 'enter'
  3565. });
  3566. })();
  3567. /*<1.3compat>*/
  3568. var Event = this.Event = DOMEvent;
  3569. Event.Keys = {};
  3570. /*</1.3compat>*/
  3571. /*<1.2compat>*/
  3572. Event.Keys = new Hash(Event.Keys);
  3573. /*</1.2compat>*/
  3574. /*
  3575. ---
  3576. name: Element.Event
  3577. description: Contains Element methods for dealing with events. This file also includes mouseenter and mouseleave custom Element Events, if necessary.
  3578. license: MIT-style license.
  3579. requires: [Element, Event]
  3580. provides: Element.Event
  3581. ...
  3582. */
  3583. (function(){
  3584. Element.Properties.events = {set: function(events){
  3585. this.addEvents(events);
  3586. }};
  3587. [Element, Window, Document].invoke('implement', {
  3588. addEvent: function(type, fn){
  3589. var events = this.retrieve('events', {});
  3590. if (!events[type]) events[type] = {keys: [], values: []};
  3591. if (events[type].keys.contains(fn)) return this;
  3592. events[type].keys.push(fn);
  3593. var realType = type,
  3594. custom = Element.Events[type],
  3595. condition = fn,
  3596. self = this;
  3597. if (custom){
  3598. if (custom.onAdd) custom.onAdd.call(this, fn, type);
  3599. if (custom.condition){
  3600. condition = function(event){
  3601. if (custom.condition.call(this, event, type)) return fn.call(this, event);
  3602. return true;
  3603. };
  3604. }
  3605. if (custom.base) realType = Function.convert(custom.base).call(this, type);
  3606. }
  3607. var defn = function(){
  3608. return fn.call(self);
  3609. };
  3610. var nativeEvent = Element.NativeEvents[realType];
  3611. if (nativeEvent){
  3612. if (nativeEvent == 2){
  3613. defn = function(event){
  3614. event = new DOMEvent(event, self.getWindow());
  3615. if (condition.call(self, event) === false) event.stop();
  3616. };
  3617. }
  3618. this.addListener(realType, defn, arguments[2]);
  3619. }
  3620. events[type].values.push(defn);
  3621. return this;
  3622. },
  3623. removeEvent: function(type, fn){
  3624. var events = this.retrieve('events');
  3625. if (!events || !events[type]) return this;
  3626. var list = events[type];
  3627. var index = list.keys.indexOf(fn);
  3628. if (index == -1) return this;
  3629. var value = list.values[index];
  3630. delete list.keys[index];
  3631. delete list.values[index];
  3632. var custom = Element.Events[type];
  3633. if (custom){
  3634. if (custom.onRemove) custom.onRemove.call(this, fn, type);
  3635. if (custom.base) type = Function.convert(custom.base).call(this, type);
  3636. }
  3637. return (Element.NativeEvents[type]) ? this.removeListener(type, value, arguments[2]) : this;
  3638. },
  3639. addEvents: function(events){
  3640. for (var event in events) this.addEvent(event, events[event]);
  3641. return this;
  3642. },
  3643. removeEvents: function(events){
  3644. var type;
  3645. if (typeOf(events) == 'object'){
  3646. for (type in events) this.removeEvent(type, events[type]);
  3647. return this;
  3648. }
  3649. var attached = this.retrieve('events');
  3650. if (!attached) return this;
  3651. if (!events){
  3652. for (type in attached) this.removeEvents(type);
  3653. this.eliminate('events');
  3654. } else if (attached[events]){
  3655. attached[events].keys.each(function(fn){
  3656. this.removeEvent(events, fn);
  3657. }, this);
  3658. delete attached[events];
  3659. }
  3660. return this;
  3661. },
  3662. fireEvent: function(type, args, delay){
  3663. var events = this.retrieve('events');
  3664. if (!events || !events[type]) return this;
  3665. args = Array.convert(args);
  3666. events[type].keys.each(function(fn){
  3667. if (delay) fn.delay(delay, this, args);
  3668. else fn.apply(this, args);
  3669. }, this);
  3670. return this;
  3671. },
  3672. cloneEvents: function(from, type){
  3673. from = document.id(from);
  3674. var events = from.retrieve('events');
  3675. if (!events) return this;
  3676. if (!type){
  3677. for (var eventType in events) this.cloneEvents(from, eventType);
  3678. } else if (events[type]){
  3679. events[type].keys.each(function(fn){
  3680. this.addEvent(type, fn);
  3681. }, this);
  3682. }
  3683. return this;
  3684. }
  3685. });
  3686. Element.NativeEvents = {
  3687. click: 2, dblclick: 2, mouseup: 2, mousedown: 2, contextmenu: 2, //mouse buttons
  3688. wheel: 2, mousewheel: 2, DOMMouseScroll: 2, //mouse wheel
  3689. mouseover: 2, mouseout: 2, mousemove: 2, selectstart: 2, selectend: 2, //mouse movement
  3690. keydown: 2, keypress: 2, keyup: 2, //keyboard
  3691. orientationchange: 2, // mobile
  3692. touchstart: 2, touchmove: 2, touchend: 2, touchcancel: 2, // touch
  3693. gesturestart: 2, gesturechange: 2, gestureend: 2, // gesture
  3694. focus: 2, blur: 2, change: 2, reset: 2, select: 2, submit: 2, paste: 2, input: 2, //form elements
  3695. load: 2, unload: 1, beforeunload: 2, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window
  3696. hashchange: 1, popstate: 2, pageshow: 2, pagehide: 2, // history
  3697. error: 1, abort: 1, scroll: 1, message: 2 //misc
  3698. };
  3699. Element.Events = {
  3700. mousewheel: {
  3701. base: 'onwheel' in document ? 'wheel' : 'onmousewheel' in document ? 'mousewheel' : 'DOMMouseScroll'
  3702. }
  3703. };
  3704. var check = function(event){
  3705. var related = event.relatedTarget;
  3706. if (related == null) return true;
  3707. if (!related) return false;
  3708. return (related != this && related.prefix != 'xul' && typeOf(this) != 'document' && !this.contains(related));
  3709. };
  3710. if ('onmouseenter' in document.documentElement){
  3711. Element.NativeEvents.mouseenter = Element.NativeEvents.mouseleave = 2;
  3712. Element.MouseenterCheck = check;
  3713. } else {
  3714. Element.Events.mouseenter = {
  3715. base: 'mouseover',
  3716. condition: check
  3717. };
  3718. Element.Events.mouseleave = {
  3719. base: 'mouseout',
  3720. condition: check
  3721. };
  3722. }
  3723. /*<ltIE9>*/
  3724. if (!window.addEventListener){
  3725. Element.NativeEvents.propertychange = 2;
  3726. Element.Events.change = {
  3727. base: function(){
  3728. var type = this.type;
  3729. return (this.get('tag') == 'input' && (type == 'radio' || type == 'checkbox')) ? 'propertychange' : 'change';
  3730. },
  3731. condition: function(event){
  3732. return event.type != 'propertychange' || event.event.propertyName == 'checked';
  3733. }
  3734. };
  3735. }
  3736. /*</ltIE9>*/
  3737. //<1.2compat>
  3738. Element.Events = new Hash(Element.Events);
  3739. //</1.2compat>
  3740. })();
  3741. /*
  3742. ---
  3743. name: Element.Delegation
  3744. description: Extends the Element native object to include the delegate method for more efficient event management.
  3745. license: MIT-style license.
  3746. requires: [Element.Event]
  3747. provides: [Element.Delegation]
  3748. ...
  3749. */
  3750. (function(){
  3751. var eventListenerSupport = !!window.addEventListener;
  3752. Element.NativeEvents.focusin = Element.NativeEvents.focusout = 2;
  3753. var bubbleUp = function(self, match, fn, event, target){
  3754. while (target && target != self){
  3755. if (match(target, event)) return fn.call(target, event, target);
  3756. target = document.id(target.parentNode);
  3757. }
  3758. };
  3759. var map = {
  3760. mouseenter: {
  3761. base: 'mouseover',
  3762. condition: Element.MouseenterCheck
  3763. },
  3764. mouseleave: {
  3765. base: 'mouseout',
  3766. condition: Element.MouseenterCheck
  3767. },
  3768. focus: {
  3769. base: 'focus' + (eventListenerSupport ? '' : 'in'),
  3770. capture: true
  3771. },
  3772. blur: {
  3773. base: eventListenerSupport ? 'blur' : 'focusout',
  3774. capture: true
  3775. }
  3776. };
  3777. /*<ltIE9>*/
  3778. var _key = '$delegation:';
  3779. var formObserver = function(type){
  3780. return {
  3781. base: 'focusin',
  3782. remove: function(self, uid){
  3783. var list = self.retrieve(_key + type + 'listeners', {})[uid];
  3784. if (list && list.forms) for (var i = list.forms.length; i--;){
  3785. // the form may have been destroyed, so it won't have the
  3786. // removeEvent method anymore. In that case the event was
  3787. // removed as well.
  3788. if (list.forms[i].removeEvent) list.forms[i].removeEvent(type, list.fns[i]);
  3789. }
  3790. },
  3791. listen: function(self, match, fn, event, target, uid){
  3792. var form = (target.get('tag') == 'form') ? target : event.target.getParent('form');
  3793. if (!form) return;
  3794. var listeners = self.retrieve(_key + type + 'listeners', {}),
  3795. listener = listeners[uid] || {forms: [], fns: []},
  3796. forms = listener.forms, fns = listener.fns;
  3797. if (forms.indexOf(form) != -1) return;
  3798. forms.push(form);
  3799. var _fn = function(event){
  3800. bubbleUp(self, match, fn, event, target);
  3801. };
  3802. form.addEvent(type, _fn);
  3803. fns.push(_fn);
  3804. listeners[uid] = listener;
  3805. self.store(_key + type + 'listeners', listeners);
  3806. }
  3807. };
  3808. };
  3809. var inputObserver = function(type){
  3810. return {
  3811. base: 'focusin',
  3812. listen: function(self, match, fn, event, target){
  3813. var events = {blur: function(){
  3814. this.removeEvents(events);
  3815. }};
  3816. events[type] = function(event){
  3817. bubbleUp(self, match, fn, event, target);
  3818. };
  3819. event.target.addEvents(events);
  3820. }
  3821. };
  3822. };
  3823. if (!eventListenerSupport) Object.append(map, {
  3824. submit: formObserver('submit'),
  3825. reset: formObserver('reset'),
  3826. change: inputObserver('change'),
  3827. select: inputObserver('select')
  3828. });
  3829. /*</ltIE9>*/
  3830. var proto = Element.prototype,
  3831. addEvent = proto.addEvent,
  3832. removeEvent = proto.removeEvent;
  3833. var relay = function(old, method){
  3834. return function(type, fn, useCapture){
  3835. if (type.indexOf(':relay') == -1) return old.call(this, type, fn, useCapture);
  3836. var parsed = Slick.parse(type).expressions[0][0];
  3837. if (parsed.pseudos[0].key != 'relay') return old.call(this, type, fn, useCapture);
  3838. var newType = parsed.tag;
  3839. parsed.pseudos.slice(1).each(function(pseudo){
  3840. newType += ':' + pseudo.key + (pseudo.value ? '(' + pseudo.value + ')' : '');
  3841. });
  3842. old.call(this, type, fn);
  3843. return method.call(this, newType, parsed.pseudos[0].value, fn);
  3844. };
  3845. };
  3846. var delegation = {
  3847. addEvent: function(type, match, fn){
  3848. var storage = this.retrieve('$delegates', {}), stored = storage[type];
  3849. if (stored) for (var _uid in stored){
  3850. if (stored[_uid].fn == fn && stored[_uid].match == match) return this;
  3851. }
  3852. var _type = type, _match = match, _fn = fn, _map = map[type] || {};
  3853. type = _map.base || _type;
  3854. match = function(target){
  3855. return Slick.match(target, _match);
  3856. };
  3857. var elementEvent = Element.Events[_type];
  3858. if (_map.condition || elementEvent && elementEvent.condition){
  3859. var __match = match, condition = _map.condition || elementEvent.condition;
  3860. match = function(target, event){
  3861. return __match(target, event) && condition.call(target, event, type);
  3862. };
  3863. }
  3864. var self = this, uid = String.uniqueID();
  3865. var delegator = _map.listen ? function(event, target){
  3866. if (!target && event && event.target) target = event.target;
  3867. if (target) _map.listen(self, match, fn, event, target, uid);
  3868. } : function(event, target){
  3869. if (!target && event && event.target) target = event.target;
  3870. if (target) bubbleUp(self, match, fn, event, target);
  3871. };
  3872. if (!stored) stored = {};
  3873. stored[uid] = {
  3874. match: _match,
  3875. fn: _fn,
  3876. delegator: delegator
  3877. };
  3878. storage[_type] = stored;
  3879. return addEvent.call(this, type, delegator, _map.capture);
  3880. },
  3881. removeEvent: function(type, match, fn, _uid){
  3882. var storage = this.retrieve('$delegates', {}), stored = storage[type];
  3883. if (!stored) return this;
  3884. if (_uid){
  3885. var _type = type, delegator = stored[_uid].delegator, _map = map[type] || {};
  3886. type = _map.base || _type;
  3887. if (_map.remove) _map.remove(this, _uid);
  3888. delete stored[_uid];
  3889. storage[_type] = stored;
  3890. return removeEvent.call(this, type, delegator, _map.capture);
  3891. }
  3892. var __uid, s;
  3893. if (fn) for (__uid in stored){
  3894. s = stored[__uid];
  3895. if (s.match == match && s.fn == fn) return delegation.removeEvent.call(this, type, match, fn, __uid);
  3896. } else for (__uid in stored){
  3897. s = stored[__uid];
  3898. if (s.match == match) delegation.removeEvent.call(this, type, match, s.fn, __uid);
  3899. }
  3900. return this;
  3901. }
  3902. };
  3903. [Element, Window, Document].invoke('implement', {
  3904. addEvent: relay(addEvent, delegation.addEvent),
  3905. removeEvent: relay(removeEvent, delegation.removeEvent)
  3906. });
  3907. })();
  3908. /*
  3909. ---
  3910. name: Element.Style
  3911. description: Contains methods for interacting with the styles of Elements in a fashionable way.
  3912. license: MIT-style license.
  3913. requires: Element
  3914. provides: Element.Style
  3915. ...
  3916. */
  3917. (function(){
  3918. var html = document.html, el;
  3919. //<ltIE9>
  3920. // Check for oldIE, which does not remove styles when they're set to null
  3921. el = document.createElement('div');
  3922. el.style.color = 'red';
  3923. el.style.color = null;
  3924. var doesNotRemoveStyles = el.style.color == 'red';
  3925. // check for oldIE, which returns border* shorthand styles in the wrong order (color-width-style instead of width-style-color)
  3926. var border = '1px solid #123abc';
  3927. el.style.border = border;
  3928. var returnsBordersInWrongOrder = el.style.border != border;
  3929. el = null;
  3930. //</ltIE9>
  3931. var hasGetComputedStyle = !!window.getComputedStyle,
  3932. supportBorderRadius = document.createElement('div').style.borderRadius != null;
  3933. Element.Properties.styles = {set: function(styles){
  3934. this.setStyles(styles);
  3935. }};
  3936. var hasOpacity = (html.style.opacity != null),
  3937. hasFilter = (html.style.filter != null),
  3938. reAlpha = /alpha\(opacity=([\d.]+)\)/i;
  3939. var setVisibility = function(element, opacity){
  3940. element.store('$opacity', opacity);
  3941. element.style.visibility = opacity > 0 || opacity == null ? 'visible' : 'hidden';
  3942. };
  3943. //<ltIE9>
  3944. var setFilter = function(element, regexp, value){
  3945. var style = element.style,
  3946. filter = style.filter || element.getComputedStyle('filter') || '';
  3947. style.filter = (regexp.test(filter) ? filter.replace(regexp, value) : filter + ' ' + value).trim();
  3948. if (!style.filter) style.removeAttribute('filter');
  3949. };
  3950. //</ltIE9>
  3951. var setOpacity = (hasOpacity ? function(element, opacity){
  3952. element.style.opacity = opacity;
  3953. } : (hasFilter ? function(element, opacity){
  3954. if (!element.currentStyle || !element.currentStyle.hasLayout) element.style.zoom = 1;
  3955. if (opacity == null || opacity == 1){
  3956. setFilter(element, reAlpha, '');
  3957. if (opacity == 1 && getOpacity(element) != 1) setFilter(element, reAlpha, 'alpha(opacity=100)');
  3958. } else {
  3959. setFilter(element, reAlpha, 'alpha(opacity=' + (opacity * 100).limit(0, 100).round() + ')');
  3960. }
  3961. } : setVisibility));
  3962. var getOpacity = (hasOpacity ? function(element){
  3963. var opacity = element.style.opacity || element.getComputedStyle('opacity');
  3964. return (opacity == '') ? 1 : opacity.toFloat();
  3965. } : (hasFilter ? function(element){
  3966. var filter = (element.style.filter || element.getComputedStyle('filter')),
  3967. opacity;
  3968. if (filter) opacity = filter.match(reAlpha);
  3969. return (opacity == null || filter == null) ? 1 : (opacity[1] / 100);
  3970. } : function(element){
  3971. var opacity = element.retrieve('$opacity');
  3972. if (opacity == null) opacity = (element.style.visibility == 'hidden' ? 0 : 1);
  3973. return opacity;
  3974. }));
  3975. var floatName = (html.style.cssFloat == null) ? 'styleFloat' : 'cssFloat',
  3976. namedPositions = {left: '0%', top: '0%', center: '50%', right: '100%', bottom: '100%'},
  3977. hasBackgroundPositionXY = (html.style.backgroundPositionX != null),
  3978. prefixPattern = /^-(ms)-/;
  3979. var camelCase = function(property){
  3980. return property.replace(prefixPattern, '$1-').camelCase();
  3981. };
  3982. //<ltIE9>
  3983. var removeStyle = function(style, property){
  3984. if (property == 'backgroundPosition'){
  3985. style.removeAttribute(property + 'X');
  3986. property += 'Y';
  3987. }
  3988. style.removeAttribute(property);
  3989. };
  3990. //</ltIE9>
  3991. Element.implement({
  3992. getComputedStyle: function(property){
  3993. if (!hasGetComputedStyle && this.currentStyle) return this.currentStyle[camelCase(property)];
  3994. var defaultView = Element.getDocument(this).defaultView,
  3995. computed = defaultView ? defaultView.getComputedStyle(this, null) : null;
  3996. return (computed) ? computed.getPropertyValue((property == floatName) ? 'float' : property.hyphenate()) : '';
  3997. },
  3998. setStyle: function(property, value){
  3999. if (property == 'opacity'){
  4000. if (value != null) value = parseFloat(value);
  4001. setOpacity(this, value);
  4002. return this;
  4003. }
  4004. property = camelCase(property == 'float' ? floatName : property);
  4005. if (typeOf(value) != 'string'){
  4006. var map = (Element.Styles[property] || '@').split(' ');
  4007. value = Array.convert(value).map(function(val, i){
  4008. if (!map[i]) return '';
  4009. return (typeOf(val) == 'number') ? map[i].replace('@', Math.round(val)) : val;
  4010. }).join(' ');
  4011. } else if (value == String(Number(value))){
  4012. value = Math.round(value);
  4013. }
  4014. this.style[property] = value;
  4015. //<ltIE9>
  4016. if ((value == '' || value == null) && doesNotRemoveStyles && this.style.removeAttribute){
  4017. removeStyle(this.style, property);
  4018. }
  4019. //</ltIE9>
  4020. return this;
  4021. },
  4022. getStyle: function(property){
  4023. if (property == 'opacity') return getOpacity(this);
  4024. property = camelCase(property == 'float' ? floatName : property);
  4025. if (supportBorderRadius && property.indexOf('borderRadius') != -1){
  4026. return ['borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomRightRadius', 'borderBottomLeftRadius'].map(function(corner){
  4027. return this.style[corner] || '0px';
  4028. }, this).join(' ');
  4029. }
  4030. var result = this.style[property];
  4031. if (!result || property == 'zIndex'){
  4032. if (Element.ShortStyles.hasOwnProperty(property)){
  4033. result = [];
  4034. for (var s in Element.ShortStyles[property]) result.push(this.getStyle(s));
  4035. return result.join(' ');
  4036. }
  4037. result = this.getComputedStyle(property);
  4038. }
  4039. if (hasBackgroundPositionXY && /^backgroundPosition[XY]?$/.test(property)){
  4040. return result.replace(/(top|right|bottom|left)/g, function(position){
  4041. return namedPositions[position];
  4042. }) || '0px';
  4043. }
  4044. if (!result && property == 'backgroundPosition') return '0px 0px';
  4045. if (result){
  4046. result = String(result);
  4047. var color = result.match(/rgba?\([\d\s,]+\)/);
  4048. if (color) result = result.replace(color[0], color[0].rgbToHex());
  4049. }
  4050. if (!hasGetComputedStyle && !this.style[property]){
  4051. if ((/^(height|width)$/).test(property) && !(/px$/.test(result))){
  4052. var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0;
  4053. values.each(function(value){
  4054. size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt();
  4055. }, this);
  4056. return this['offset' + property.capitalize()] - size + 'px';
  4057. }
  4058. if ((/^border(.+)Width|margin|padding/).test(property) && isNaN(parseFloat(result))){
  4059. return '0px';
  4060. }
  4061. }
  4062. //<ltIE9>
  4063. if (returnsBordersInWrongOrder && /^border(Top|Right|Bottom|Left)?$/.test(property) && /^#/.test(result)){
  4064. return result.replace(/^(.+)\s(.+)\s(.+)$/, '$2 $3 $1');
  4065. }
  4066. //</ltIE9>
  4067. return result;
  4068. },
  4069. setStyles: function(styles){
  4070. for (var style in styles) this.setStyle(style, styles[style]);
  4071. return this;
  4072. },
  4073. getStyles: function(){
  4074. var result = {};
  4075. Array.flatten(arguments).each(function(key){
  4076. result[key] = this.getStyle(key);
  4077. }, this);
  4078. return result;
  4079. }
  4080. });
  4081. Element.Styles = {
  4082. left: '@px', top: '@px', bottom: '@px', right: '@px',
  4083. width: '@px', height: '@px', maxWidth: '@px', maxHeight: '@px', minWidth: '@px', minHeight: '@px',
  4084. backgroundColor: 'rgb(@, @, @)', backgroundSize: '@px', backgroundPosition: '@px @px', color: 'rgb(@, @, @)',
  4085. fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)',
  4086. margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)',
  4087. borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)',
  4088. zIndex: '@', 'zoom': '@', fontWeight: '@', textIndent: '@px', opacity: '@', borderRadius: '@px @px @px @px'
  4089. };
  4090. //<1.3compat>
  4091. Element.implement({
  4092. setOpacity: function(value){
  4093. setOpacity(this, value);
  4094. return this;
  4095. },
  4096. getOpacity: function(){
  4097. return getOpacity(this);
  4098. }
  4099. });
  4100. Element.Properties.opacity = {
  4101. set: function(opacity){
  4102. setOpacity(this, opacity);
  4103. setVisibility(this, opacity);
  4104. },
  4105. get: function(){
  4106. return getOpacity(this);
  4107. }
  4108. };
  4109. //</1.3compat>
  4110. //<1.2compat>
  4111. Element.Styles = new Hash(Element.Styles);
  4112. //</1.2compat>
  4113. Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, borderStyle: {}, borderColor: {}};
  4114. ['Top', 'Right', 'Bottom', 'Left'].each(function(direction){
  4115. var Short = Element.ShortStyles;
  4116. var All = Element.Styles;
  4117. ['margin', 'padding'].each(function(style){
  4118. var sd = style + direction;
  4119. Short[style][sd] = All[sd] = '@px';
  4120. });
  4121. var bd = 'border' + direction;
  4122. Short.border[bd] = All[bd] = '@px @ rgb(@, @, @)';
  4123. var bdw = bd + 'Width', bds = bd + 'Style', bdc = bd + 'Color';
  4124. Short[bd] = {};
  4125. Short.borderWidth[bdw] = Short[bd][bdw] = All[bdw] = '@px';
  4126. Short.borderStyle[bds] = Short[bd][bds] = All[bds] = '@';
  4127. Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)';
  4128. });
  4129. if (hasBackgroundPositionXY) Element.ShortStyles.backgroundPosition = {backgroundPositionX: '@', backgroundPositionY: '@'};
  4130. })();
  4131. /*
  4132. ---
  4133. name: Element.Dimensions
  4134. description: Contains methods to work with size, scroll, or positioning of Elements and the window object.
  4135. license: MIT-style license.
  4136. credits:
  4137. - Element positioning based on the [qooxdoo](http://qooxdoo.org/) code and smart browser fixes, [LGPL License](http://www.gnu.org/licenses/lgpl.html).
  4138. - Viewport dimensions based on [YUI](http://developer.yahoo.com/yui/) code, [BSD License](http://developer.yahoo.com/yui/license.html).
  4139. requires: [Element, Element.Style]
  4140. provides: [Element.Dimensions]
  4141. ...
  4142. */
  4143. (function(){
  4144. var element = document.createElement('div'),
  4145. child = document.createElement('div');
  4146. element.style.height = '0';
  4147. element.appendChild(child);
  4148. var brokenOffsetParent = (child.offsetParent === element);
  4149. element = child = null;
  4150. var heightComponents = ['height', 'paddingTop', 'paddingBottom', 'borderTopWidth', 'borderBottomWidth'],
  4151. widthComponents = ['width', 'paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'];
  4152. var svgCalculateSize = function(el){
  4153. var gCS = window.getComputedStyle(el),
  4154. bounds = {x: 0, y: 0};
  4155. heightComponents.each(function(css){
  4156. bounds.y += parseFloat(gCS[css]);
  4157. });
  4158. widthComponents.each(function(css){
  4159. bounds.x += parseFloat(gCS[css]);
  4160. });
  4161. return bounds;
  4162. };
  4163. var isOffset = function(el){
  4164. return styleString(el, 'position') != 'static' || isBody(el);
  4165. };
  4166. var isOffsetStatic = function(el){
  4167. return isOffset(el) || (/^(?:table|td|th)$/i).test(el.tagName);
  4168. };
  4169. Element.implement({
  4170. scrollTo: function(x, y){
  4171. if (isBody(this)){
  4172. this.getWindow().scrollTo(x, y);
  4173. } else {
  4174. this.scrollLeft = x;
  4175. this.scrollTop = y;
  4176. }
  4177. return this;
  4178. },
  4179. getSize: function(){
  4180. if (isBody(this)) return this.getWindow().getSize();
  4181. //<ltIE9>
  4182. // This if clause is because IE8- cannot calculate getBoundingClientRect of elements with visibility hidden.
  4183. if (!window.getComputedStyle) return {x: this.offsetWidth, y: this.offsetHeight};
  4184. //</ltIE9>
  4185. // This svg section under, calling `svgCalculateSize()`, can be removed when FF fixed the svg size bug.
  4186. // Bug info: https://bugzilla.mozilla.org/show_bug.cgi?id=530985
  4187. if (this.get('tag') == 'svg') return svgCalculateSize(this);
  4188. try {
  4189. var bounds = this.getBoundingClientRect();
  4190. return {x: bounds.width, y: bounds.height};
  4191. } catch (e){
  4192. return {x: 0, y: 0};
  4193. }
  4194. },
  4195. getScrollSize: function(){
  4196. if (isBody(this)) return this.getWindow().getScrollSize();
  4197. return {x: this.scrollWidth, y: this.scrollHeight};
  4198. },
  4199. getScroll: function(){
  4200. if (isBody(this)) return this.getWindow().getScroll();
  4201. return {x: this.scrollLeft, y: this.scrollTop};
  4202. },
  4203. getScrolls: function(){
  4204. var element = this.parentNode, position = {x: 0, y: 0};
  4205. while (element && !isBody(element)){
  4206. position.x += element.scrollLeft;
  4207. position.y += element.scrollTop;
  4208. element = element.parentNode;
  4209. }
  4210. return position;
  4211. },
  4212. getOffsetParent: brokenOffsetParent ? function(){
  4213. var element = this;
  4214. if (isBody(element) || styleString(element, 'position') == 'fixed') return null;
  4215. var isOffsetCheck = (styleString(element, 'position') == 'static') ? isOffsetStatic : isOffset;
  4216. while ((element = element.parentNode)){
  4217. if (isOffsetCheck(element)) return element;
  4218. }
  4219. return null;
  4220. } : function(){
  4221. var element = this;
  4222. if (isBody(element) || styleString(element, 'position') == 'fixed') return null;
  4223. try {
  4224. return element.offsetParent;
  4225. } catch (e){}
  4226. return null;
  4227. },
  4228. getOffsets: function(){
  4229. var hasGetBoundingClientRect = this.getBoundingClientRect;
  4230. //<1.4compat>
  4231. hasGetBoundingClientRect = hasGetBoundingClientRect && !Browser.Platform.ios;
  4232. //</1.4compat>
  4233. if (hasGetBoundingClientRect){
  4234. var bound = this.getBoundingClientRect(),
  4235. html = document.id(this.getDocument().documentElement),
  4236. htmlScroll = html.getScroll(),
  4237. elemScrolls = this.getScrolls(),
  4238. isFixed = (styleString(this, 'position') == 'fixed');
  4239. return {
  4240. x: bound.left.toFloat() + elemScrolls.x + ((isFixed) ? 0 : htmlScroll.x) - html.clientLeft,
  4241. y: bound.top.toFloat() + elemScrolls.y + ((isFixed) ? 0 : htmlScroll.y) - html.clientTop
  4242. };
  4243. }
  4244. var element = this, position = {x: 0, y: 0};
  4245. if (isBody(this)) return position;
  4246. while (element && !isBody(element)){
  4247. position.x += element.offsetLeft;
  4248. position.y += element.offsetTop;
  4249. //<1.4compat>
  4250. if (Browser.firefox){
  4251. if (!borderBox(element)){
  4252. position.x += leftBorder(element);
  4253. position.y += topBorder(element);
  4254. }
  4255. var parent = element.parentNode;
  4256. if (parent && styleString(parent, 'overflow') != 'visible'){
  4257. position.x += leftBorder(parent);
  4258. position.y += topBorder(parent);
  4259. }
  4260. } else if (element != this && Browser.safari){
  4261. position.x += leftBorder(element);
  4262. position.y += topBorder(element);
  4263. }
  4264. //</1.4compat>
  4265. element = element.offsetParent;
  4266. }
  4267. //<1.4compat>
  4268. if (Browser.firefox && !borderBox(this)){
  4269. position.x -= leftBorder(this);
  4270. position.y -= topBorder(this);
  4271. }
  4272. //</1.4compat>
  4273. return position;
  4274. },
  4275. getPosition: function(relative){
  4276. var offset = this.getOffsets(),
  4277. scroll = this.getScrolls();
  4278. var position = {
  4279. x: offset.x - scroll.x,
  4280. y: offset.y - scroll.y
  4281. };
  4282. if (relative && (relative = document.id(relative))){
  4283. var relativePosition = relative.getPosition();
  4284. return {x: position.x - relativePosition.x - leftBorder(relative), y: position.y - relativePosition.y - topBorder(relative)};
  4285. }
  4286. return position;
  4287. },
  4288. getCoordinates: function(element){
  4289. if (isBody(this)) return this.getWindow().getCoordinates();
  4290. var position = this.getPosition(element),
  4291. size = this.getSize();
  4292. var obj = {
  4293. left: position.x,
  4294. top: position.y,
  4295. width: size.x,
  4296. height: size.y
  4297. };
  4298. obj.right = obj.left + obj.width;
  4299. obj.bottom = obj.top + obj.height;
  4300. return obj;
  4301. },
  4302. computePosition: function(obj){
  4303. return {
  4304. left: obj.x - styleNumber(this, 'margin-left'),
  4305. top: obj.y - styleNumber(this, 'margin-top')
  4306. };
  4307. },
  4308. setPosition: function(obj){
  4309. return this.setStyles(this.computePosition(obj));
  4310. }
  4311. });
  4312. [Document, Window].invoke('implement', {
  4313. getSize: function(){
  4314. var doc = getCompatElement(this);
  4315. return {x: doc.clientWidth, y: doc.clientHeight};
  4316. },
  4317. getScroll: function(){
  4318. var win = this.getWindow(), doc = getCompatElement(this);
  4319. return {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop};
  4320. },
  4321. getScrollSize: function(){
  4322. var doc = getCompatElement(this),
  4323. min = this.getSize(),
  4324. body = this.getDocument().body;
  4325. return {x: Math.max(doc.scrollWidth, body.scrollWidth, min.x), y: Math.max(doc.scrollHeight, body.scrollHeight, min.y)};
  4326. },
  4327. getPosition: function(){
  4328. return {x: 0, y: 0};
  4329. },
  4330. getCoordinates: function(){
  4331. var size = this.getSize();
  4332. return {top: 0, left: 0, bottom: size.y, right: size.x, height: size.y, width: size.x};
  4333. }
  4334. });
  4335. // private methods
  4336. var styleString = Element.getComputedStyle;
  4337. function styleNumber(element, style){
  4338. return styleString(element, style).toInt() || 0;
  4339. }
  4340. //<1.4compat>
  4341. function borderBox(element){
  4342. return styleString(element, '-moz-box-sizing') == 'border-box';
  4343. }
  4344. //</1.4compat>
  4345. function topBorder(element){
  4346. return styleNumber(element, 'border-top-width');
  4347. }
  4348. function leftBorder(element){
  4349. return styleNumber(element, 'border-left-width');
  4350. }
  4351. function isBody(element){
  4352. return (/^(?:body|html)$/i).test(element.tagName);
  4353. }
  4354. function getCompatElement(element){
  4355. var doc = element.getDocument();
  4356. return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
  4357. }
  4358. })();
  4359. //aliases
  4360. Element.alias({position: 'setPosition'}); //compatability
  4361. [Window, Document, Element].invoke('implement', {
  4362. getHeight: function(){
  4363. return this.getSize().y;
  4364. },
  4365. getWidth: function(){
  4366. return this.getSize().x;
  4367. },
  4368. getScrollTop: function(){
  4369. return this.getScroll().y;
  4370. },
  4371. getScrollLeft: function(){
  4372. return this.getScroll().x;
  4373. },
  4374. getScrollHeight: function(){
  4375. return this.getScrollSize().y;
  4376. },
  4377. getScrollWidth: function(){
  4378. return this.getScrollSize().x;
  4379. },
  4380. getTop: function(){
  4381. return this.getPosition().y;
  4382. },
  4383. getLeft: function(){
  4384. return this.getPosition().x;
  4385. }
  4386. });
  4387. /*
  4388. ---
  4389. name: Fx
  4390. description: Contains the basic animation logic to be extended by all other Fx Classes.
  4391. license: MIT-style license.
  4392. requires: [Chain, Events, Options, Class.Thenable]
  4393. provides: Fx
  4394. ...
  4395. */
  4396. (function(){
  4397. var Fx = this.Fx = new Class({
  4398. Implements: [Chain, Events, Options, Class.Thenable],
  4399. options: {
  4400. /*
  4401. onStart: nil,
  4402. onCancel: nil,
  4403. onComplete: nil,
  4404. */
  4405. fps: 60,
  4406. unit: false,
  4407. duration: 500,
  4408. frames: null,
  4409. frameSkip: true,
  4410. link: 'ignore'
  4411. },
  4412. initialize: function(options){
  4413. this.subject = this.subject || this;
  4414. this.setOptions(options);
  4415. },
  4416. getTransition: function(){
  4417. return function(p){
  4418. return -(Math.cos(Math.PI * p) - 1) / 2;
  4419. };
  4420. },
  4421. step: function(now){
  4422. if (this.options.frameSkip){
  4423. var diff = (this.time != null) ? (now - this.time) : 0, frames = diff / this.frameInterval;
  4424. this.time = now;
  4425. this.frame += frames;
  4426. } else {
  4427. this.frame++;
  4428. }
  4429. if (this.frame < this.frames){
  4430. var delta = this.transition(this.frame / this.frames);
  4431. this.set(this.compute(this.from, this.to, delta));
  4432. } else {
  4433. this.frame = this.frames;
  4434. this.set(this.compute(this.from, this.to, 1));
  4435. this.stop();
  4436. }
  4437. },
  4438. set: function(now){
  4439. return now;
  4440. },
  4441. compute: function(from, to, delta){
  4442. return Fx.compute(from, to, delta);
  4443. },
  4444. check: function(){
  4445. if (!this.isRunning()) return true;
  4446. switch (this.options.link){
  4447. case 'cancel': this.cancel(); return true;
  4448. case 'chain': this.chain(this.caller.pass(arguments, this)); return false;
  4449. }
  4450. return false;
  4451. },
  4452. start: function(from, to){
  4453. if (!this.check(from, to)) return this;
  4454. this.from = from;
  4455. this.to = to;
  4456. this.frame = (this.options.frameSkip) ? 0 : -1;
  4457. this.time = null;
  4458. this.transition = this.getTransition();
  4459. var frames = this.options.frames, fps = this.options.fps, duration = this.options.duration;
  4460. this.duration = Fx.Durations[duration] || duration.toInt();
  4461. this.frameInterval = 1000 / fps;
  4462. this.frames = frames || Math.round(this.duration / this.frameInterval);
  4463. if (this.getThenableState() !== 'pending'){
  4464. this.resetThenable(this.subject);
  4465. }
  4466. this.fireEvent('start', this.subject);
  4467. pushInstance.call(this, fps);
  4468. return this;
  4469. },
  4470. stop: function(){
  4471. if (this.isRunning()){
  4472. this.time = null;
  4473. pullInstance.call(this, this.options.fps);
  4474. if (this.frames == this.frame){
  4475. this.fireEvent('complete', this.subject);
  4476. if (!this.callChain()) this.fireEvent('chainComplete', this.subject);
  4477. } else {
  4478. this.fireEvent('stop', this.subject);
  4479. }
  4480. this.resolve(this.subject === this ? null : this.subject);
  4481. }
  4482. return this;
  4483. },
  4484. cancel: function(){
  4485. if (this.isRunning()){
  4486. this.time = null;
  4487. pullInstance.call(this, this.options.fps);
  4488. this.frame = this.frames;
  4489. this.fireEvent('cancel', this.subject).clearChain();
  4490. this.reject(this.subject);
  4491. }
  4492. return this;
  4493. },
  4494. pause: function(){
  4495. if (this.isRunning()){
  4496. this.time = null;
  4497. pullInstance.call(this, this.options.fps);
  4498. }
  4499. return this;
  4500. },
  4501. resume: function(){
  4502. if (this.isPaused()) pushInstance.call(this, this.options.fps);
  4503. return this;
  4504. },
  4505. isRunning: function(){
  4506. var list = instances[this.options.fps];
  4507. return list && list.contains(this);
  4508. },
  4509. isPaused: function(){
  4510. return (this.frame < this.frames) && !this.isRunning();
  4511. }
  4512. });
  4513. Fx.compute = function(from, to, delta){
  4514. return (to - from) * delta + from;
  4515. };
  4516. Fx.Durations = {'short': 250, 'normal': 500, 'long': 1000};
  4517. // global timers
  4518. var instances = {}, timers = {};
  4519. var loop = function(){
  4520. var now = Date.now();
  4521. for (var i = this.length; i--;){
  4522. var instance = this[i];
  4523. if (instance) instance.step(now);
  4524. }
  4525. };
  4526. var pushInstance = function(fps){
  4527. var list = instances[fps] || (instances[fps] = []);
  4528. list.push(this);
  4529. if (!timers[fps]) timers[fps] = loop.periodical(Math.round(1000 / fps), list);
  4530. };
  4531. var pullInstance = function(fps){
  4532. var list = instances[fps];
  4533. if (list){
  4534. list.erase(this);
  4535. if (!list.length && timers[fps]){
  4536. delete instances[fps];
  4537. timers[fps] = clearInterval(timers[fps]);
  4538. }
  4539. }
  4540. };
  4541. })();
  4542. /*
  4543. ---
  4544. name: Fx.CSS
  4545. description: Contains the CSS animation logic. Used by Fx.Tween, Fx.Morph, Fx.Elements.
  4546. license: MIT-style license.
  4547. requires: [Fx, Element.Style]
  4548. provides: Fx.CSS
  4549. ...
  4550. */
  4551. Fx.CSS = new Class({
  4552. Extends: Fx,
  4553. //prepares the base from/to object
  4554. prepare: function(element, property, values){
  4555. values = Array.convert(values);
  4556. var from = values[0], to = values[1];
  4557. if (to == null){
  4558. to = from;
  4559. from = element.getStyle(property);
  4560. var unit = this.options.unit;
  4561. // adapted from: https://github.com/ryanmorr/fx/blob/master/fx.js#L299
  4562. if (unit && from && typeof from == 'string' && from.slice(-unit.length) != unit && parseFloat(from) != 0){
  4563. element.setStyle(property, to + unit);
  4564. var value = element.getComputedStyle(property);
  4565. // IE and Opera support pixelLeft or pixelWidth
  4566. if (!(/px$/.test(value))){
  4567. value = element.style[('pixel-' + property).camelCase()];
  4568. if (value == null){
  4569. // adapted from Dean Edwards' http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  4570. var left = element.style.left;
  4571. element.style.left = to + unit;
  4572. value = element.style.pixelLeft;
  4573. element.style.left = left;
  4574. }
  4575. }
  4576. from = (to || 1) / (parseFloat(value) || 1) * (parseFloat(from) || 0);
  4577. element.setStyle(property, from + unit);
  4578. }
  4579. }
  4580. return {from: this.parse(from), to: this.parse(to)};
  4581. },
  4582. //parses a value into an array
  4583. parse: function(value){
  4584. value = Function.convert(value)();
  4585. value = (typeof value == 'string') ? value.split(' ') : Array.convert(value);
  4586. return value.map(function(val){
  4587. val = String(val);
  4588. var found = false;
  4589. Object.each(Fx.CSS.Parsers, function(parser){
  4590. if (found) return;
  4591. var parsed = parser.parse(val);
  4592. if (parsed || parsed === 0) found = {value: parsed, parser: parser};
  4593. });
  4594. found = found || {value: val, parser: Fx.CSS.Parsers.String};
  4595. return found;
  4596. });
  4597. },
  4598. //computes by a from and to prepared objects, using their parsers.
  4599. compute: function(from, to, delta){
  4600. var computed = [];
  4601. (Math.min(from.length, to.length)).times(function(i){
  4602. computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser});
  4603. });
  4604. computed.$family = Function.convert('fx:css:value');
  4605. return computed;
  4606. },
  4607. //serves the value as settable
  4608. serve: function(value, unit){
  4609. if (typeOf(value) != 'fx:css:value') value = this.parse(value);
  4610. var returned = [];
  4611. value.each(function(bit){
  4612. returned = returned.concat(bit.parser.serve(bit.value, unit));
  4613. });
  4614. return returned;
  4615. },
  4616. //renders the change to an element
  4617. render: function(element, property, value, unit){
  4618. element.setStyle(property, this.serve(value, unit));
  4619. },
  4620. //searches inside the page css to find the values for a selector
  4621. search: function(selector){
  4622. if (Fx.CSS.Cache[selector]) return Fx.CSS.Cache[selector];
  4623. var to = {}, selectorTest = new RegExp('^' + selector.escapeRegExp() + '$');
  4624. var searchStyles = function(rules){
  4625. Array.each(rules, function(rule){
  4626. if (rule.media){
  4627. searchStyles(rule.rules || rule.cssRules);
  4628. return;
  4629. }
  4630. if (!rule.style) return;
  4631. var selectorText = (rule.selectorText) ? rule.selectorText.replace(/^\w+/, function(m){
  4632. return m.toLowerCase();
  4633. }) : null;
  4634. if (!selectorText || !selectorTest.test(selectorText)) return;
  4635. Object.each(Element.Styles, function(value, style){
  4636. if (!rule.style[style] || Element.ShortStyles[style]) return;
  4637. value = String(rule.style[style]);
  4638. to[style] = ((/^rgb/).test(value)) ? value.rgbToHex() : value;
  4639. });
  4640. });
  4641. };
  4642. Array.each(document.styleSheets, function(sheet){
  4643. var href = sheet.href;
  4644. if (href && href.indexOf('://') > -1 && href.indexOf(document.domain) == -1) return;
  4645. var rules = sheet.rules || sheet.cssRules;
  4646. searchStyles(rules);
  4647. });
  4648. return Fx.CSS.Cache[selector] = to;
  4649. }
  4650. });
  4651. Fx.CSS.Cache = {};
  4652. Fx.CSS.Parsers = {
  4653. Color: {
  4654. parse: function(value){
  4655. if (value.match(/^#[0-9a-f]{3,6}$/i)) return value.hexToRgb(true);
  4656. return ((value = value.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [value[1], value[2], value[3]] : false;
  4657. },
  4658. compute: function(from, to, delta){
  4659. return from.map(function(value, i){
  4660. return Math.round(Fx.compute(from[i], to[i], delta));
  4661. });
  4662. },
  4663. serve: function(value){
  4664. return value.map(Number);
  4665. }
  4666. },
  4667. Number: {
  4668. parse: parseFloat,
  4669. compute: Fx.compute,
  4670. serve: function(value, unit){
  4671. return (unit) ? value + unit : value;
  4672. }
  4673. },
  4674. String: {
  4675. parse: Function.convert(false),
  4676. compute: function(zero, one){
  4677. return one;
  4678. },
  4679. serve: function(zero){
  4680. return zero;
  4681. }
  4682. }
  4683. };
  4684. //<1.2compat>
  4685. Fx.CSS.Parsers = new Hash(Fx.CSS.Parsers);
  4686. //</1.2compat>
  4687. /*
  4688. ---
  4689. name: Fx.Morph
  4690. description: Formerly Fx.Styles, effect to transition any number of CSS properties for an element using an object of rules, or CSS based selector rules.
  4691. license: MIT-style license.
  4692. requires: Fx.CSS
  4693. provides: Fx.Morph
  4694. ...
  4695. */
  4696. Fx.Morph = new Class({
  4697. Extends: Fx.CSS,
  4698. initialize: function(element, options){
  4699. this.element = this.subject = document.id(element);
  4700. this.parent(options);
  4701. },
  4702. set: function(now){
  4703. if (typeof now == 'string') now = this.search(now);
  4704. for (var p in now) this.render(this.element, p, now[p], this.options.unit);
  4705. return this;
  4706. },
  4707. compute: function(from, to, delta){
  4708. var now = {};
  4709. for (var p in from) now[p] = this.parent(from[p], to[p], delta);
  4710. return now;
  4711. },
  4712. start: function(properties){
  4713. if (!this.check(properties)) return this;
  4714. if (typeof properties == 'string') properties = this.search(properties);
  4715. var from = {}, to = {};
  4716. for (var p in properties){
  4717. var parsed = this.prepare(this.element, p, properties[p]);
  4718. from[p] = parsed.from;
  4719. to[p] = parsed.to;
  4720. }
  4721. return this.parent(from, to);
  4722. }
  4723. });
  4724. Element.Properties.morph = {
  4725. set: function(options){
  4726. this.get('morph').cancel().setOptions(options);
  4727. return this;
  4728. },
  4729. get: function(){
  4730. var morph = this.retrieve('morph');
  4731. if (!morph){
  4732. morph = new Fx.Morph(this, {link: 'cancel'});
  4733. this.store('morph', morph);
  4734. }
  4735. return morph;
  4736. }
  4737. };
  4738. Element.implement({
  4739. morph: function(props){
  4740. this.get('morph').start(props);
  4741. return this;
  4742. }
  4743. });
  4744. /*
  4745. ---
  4746. name: Fx.Transitions
  4747. description: Contains a set of advanced transitions to be used with any of the Fx Classes.
  4748. license: MIT-style license.
  4749. credits:
  4750. - Easing Equations by Robert Penner, <http://www.robertpenner.com/easing/>, modified and optimized to be used with MooTools.
  4751. requires: Fx
  4752. provides: Fx.Transitions
  4753. ...
  4754. */
  4755. Fx.implement({
  4756. getTransition: function(){
  4757. var trans = this.options.transition || Fx.Transitions.Sine.easeInOut;
  4758. if (typeof trans == 'string'){
  4759. var data = trans.split(':');
  4760. trans = Fx.Transitions;
  4761. trans = trans[data[0]] || trans[data[0].capitalize()];
  4762. if (data[1]) trans = trans['ease' + data[1].capitalize() + (data[2] ? data[2].capitalize() : '')];
  4763. }
  4764. return trans;
  4765. }
  4766. });
  4767. Fx.Transition = function(transition, params){
  4768. params = Array.convert(params);
  4769. var easeIn = function(pos){
  4770. return transition(pos, params);
  4771. };
  4772. return Object.append(easeIn, {
  4773. easeIn: easeIn,
  4774. easeOut: function(pos){
  4775. return 1 - transition(1 - pos, params);
  4776. },
  4777. easeInOut: function(pos){
  4778. return (pos <= 0.5 ? transition(2 * pos, params) : (2 - transition(2 * (1 - pos), params))) / 2;
  4779. }
  4780. });
  4781. };
  4782. Fx.Transitions = {
  4783. linear: function(zero){
  4784. return zero;
  4785. }
  4786. };
  4787. //<1.2compat>
  4788. Fx.Transitions = new Hash(Fx.Transitions);
  4789. //</1.2compat>
  4790. Fx.Transitions.extend = function(transitions){
  4791. for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]);
  4792. };
  4793. Fx.Transitions.extend({
  4794. Pow: function(p, x){
  4795. return Math.pow(p, x && x[0] || 6);
  4796. },
  4797. Expo: function(p){
  4798. return Math.pow(2, 8 * (p - 1));
  4799. },
  4800. Circ: function(p){
  4801. return 1 - Math.sin(Math.acos(p));
  4802. },
  4803. Sine: function(p){
  4804. return 1 - Math.cos(p * Math.PI / 2);
  4805. },
  4806. Back: function(p, x){
  4807. x = x && x[0] || 1.618;
  4808. return Math.pow(p, 2) * ((x + 1) * p - x);
  4809. },
  4810. Bounce: function(p){
  4811. var value;
  4812. for (var a = 0, b = 1; 1; a += b, b /= 2){
  4813. if (p >= (7 - 4 * a) / 11){
  4814. value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2);
  4815. break;
  4816. }
  4817. }
  4818. return value;
  4819. },
  4820. Elastic: function(p, x){
  4821. return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x && x[0] || 1) / 3);
  4822. }
  4823. });
  4824. ['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){
  4825. Fx.Transitions[transition] = new Fx.Transition(function(p){
  4826. return Math.pow(p, i + 2);
  4827. });
  4828. });
  4829. /*
  4830. ---
  4831. name: Fx.Tween
  4832. description: Formerly Fx.Style, effect to transition any CSS property for an element.
  4833. license: MIT-style license.
  4834. requires: Fx.CSS
  4835. provides: [Fx.Tween, Element.fade, Element.highlight]
  4836. ...
  4837. */
  4838. Fx.Tween = new Class({
  4839. Extends: Fx.CSS,
  4840. initialize: function(element, options){
  4841. this.element = this.subject = document.id(element);
  4842. this.parent(options);
  4843. },
  4844. set: function(property, now){
  4845. if (arguments.length == 1){
  4846. now = property;
  4847. property = this.property || this.options.property;
  4848. }
  4849. this.render(this.element, property, now, this.options.unit);
  4850. return this;
  4851. },
  4852. start: function(property, from, to){
  4853. if (!this.check(property, from, to)) return this;
  4854. var args = Array.flatten(arguments);
  4855. this.property = this.options.property || args.shift();
  4856. var parsed = this.prepare(this.element, this.property, args);
  4857. return this.parent(parsed.from, parsed.to);
  4858. }
  4859. });
  4860. Element.Properties.tween = {
  4861. set: function(options){
  4862. this.get('tween').cancel().setOptions(options);
  4863. return this;
  4864. },
  4865. get: function(){
  4866. var tween = this.retrieve('tween');
  4867. if (!tween){
  4868. tween = new Fx.Tween(this, {link: 'cancel'});
  4869. this.store('tween', tween);
  4870. }
  4871. return tween;
  4872. }
  4873. };
  4874. Element.implement({
  4875. tween: function(property, from, to){
  4876. this.get('tween').start(property, from, to);
  4877. return this;
  4878. },
  4879. fade: function(){
  4880. var fade = this.get('tween'), method, args = ['opacity'].append(arguments), toggle;
  4881. if (args[1] == null) args[1] = 'toggle';
  4882. switch (args[1]){
  4883. case 'in': method = 'start'; args[1] = 1; break;
  4884. case 'out': method = 'start'; args[1] = 0; break;
  4885. case 'show': method = 'set'; args[1] = 1; break;
  4886. case 'hide': method = 'set'; args[1] = 0; break;
  4887. case 'toggle':
  4888. var flag = this.retrieve('fade:flag', this.getStyle('opacity') == 1);
  4889. method = 'start';
  4890. args[1] = flag ? 0 : 1;
  4891. this.store('fade:flag', !flag);
  4892. toggle = true;
  4893. break;
  4894. default: method = 'start';
  4895. }
  4896. if (!toggle) this.eliminate('fade:flag');
  4897. fade[method].apply(fade, args);
  4898. var to = args[args.length - 1];
  4899. if (method == 'set'){
  4900. this.setStyle('visibility', to == 0 ? 'hidden' : 'visible');
  4901. } else if (to != 0){
  4902. if (fade.$chain.length){
  4903. fade.chain(function(){
  4904. this.element.setStyle('visibility', 'visible');
  4905. this.callChain();
  4906. });
  4907. } else {
  4908. this.setStyle('visibility', 'visible');
  4909. }
  4910. } else {
  4911. fade.chain(function(){
  4912. if (this.element.getStyle('opacity')) return;
  4913. this.element.setStyle('visibility', 'hidden');
  4914. this.callChain();
  4915. });
  4916. }
  4917. return this;
  4918. },
  4919. highlight: function(start, end){
  4920. if (!end){
  4921. end = this.retrieve('highlight:original', this.getStyle('background-color'));
  4922. end = (end == 'transparent') ? '#fff' : end;
  4923. }
  4924. var tween = this.get('tween');
  4925. tween.start('background-color', start || '#ffff88', end).chain(function(){
  4926. this.setStyle('background-color', this.retrieve('highlight:original'));
  4927. tween.callChain();
  4928. }.bind(this));
  4929. return this;
  4930. }
  4931. });
  4932. /*
  4933. ---
  4934. name: Request
  4935. description: Powerful all purpose Request Class. Uses XMLHTTPRequest.
  4936. license: MIT-style license.
  4937. requires: [Object, Element, Chain, Events, Options, Class.Thenable, Browser]
  4938. provides: Request
  4939. ...
  4940. */
  4941. (function(){
  4942. var empty = function(){},
  4943. progressSupport = ('onprogress' in new Browser.Request);
  4944. var Request = this.Request = new Class({
  4945. Implements: [Chain, Events, Options, Class.Thenable],
  4946. options: {/*
  4947. onRequest: function(){},
  4948. onLoadstart: function(event, xhr){},
  4949. onProgress: function(event, xhr){},
  4950. onComplete: function(){},
  4951. onCancel: function(){},
  4952. onSuccess: function(responseText, responseXML){},
  4953. onFailure: function(xhr){},
  4954. onException: function(headerName, value){},
  4955. onTimeout: function(){},
  4956. user: '',
  4957. password: '',
  4958. withCredentials: false,*/
  4959. url: '',
  4960. data: '',
  4961. headers: {
  4962. 'X-Requested-With': 'XMLHttpRequest',
  4963. 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
  4964. },
  4965. async: true,
  4966. format: false,
  4967. method: 'post',
  4968. link: 'ignore',
  4969. isSuccess: null,
  4970. emulation: true,
  4971. urlEncoded: true,
  4972. encoding: 'utf-8',
  4973. evalScripts: false,
  4974. evalResponse: false,
  4975. timeout: 0,
  4976. noCache: false
  4977. },
  4978. initialize: function(options){
  4979. this.xhr = new Browser.Request();
  4980. this.setOptions(options);
  4981. this.headers = this.options.headers;
  4982. },
  4983. onStateChange: function(){
  4984. var xhr = this.xhr;
  4985. if (xhr.readyState != 4 || !this.running) return;
  4986. this.running = false;
  4987. this.status = 0;
  4988. Function.attempt(function(){
  4989. var status = xhr.status;
  4990. this.status = (status == 1223) ? 204 : status;
  4991. }.bind(this));
  4992. xhr.onreadystatechange = empty;
  4993. if (progressSupport) xhr.onprogress = xhr.onloadstart = empty;
  4994. if (this.timer){
  4995. clearTimeout(this.timer);
  4996. delete this.timer;
  4997. }
  4998. this.response = {text: this.xhr.responseText || '', xml: this.xhr.responseXML};
  4999. if (this.options.isSuccess.call(this, this.status))
  5000. this.success(this.response.text, this.response.xml);
  5001. else
  5002. this.failure();
  5003. },
  5004. isSuccess: function(){
  5005. var status = this.status;
  5006. return (status >= 200 && status < 300);
  5007. },
  5008. isRunning: function(){
  5009. return !!this.running;
  5010. },
  5011. processScripts: function(text){
  5012. if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return Browser.exec(text);
  5013. return text.stripScripts(this.options.evalScripts);
  5014. },
  5015. success: function(text, xml){
  5016. this.onSuccess(this.processScripts(text), xml);
  5017. this.resolve({text: text, xml: xml});
  5018. },
  5019. onSuccess: function(){
  5020. this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain();
  5021. },
  5022. failure: function(){
  5023. this.onFailure();
  5024. this.reject({reason: 'failure', xhr: this.xhr});
  5025. },
  5026. onFailure: function(){
  5027. this.fireEvent('complete').fireEvent('failure', this.xhr);
  5028. },
  5029. loadstart: function(event){
  5030. this.fireEvent('loadstart', [event, this.xhr]);
  5031. },
  5032. progress: function(event){
  5033. this.fireEvent('progress', [event, this.xhr]);
  5034. },
  5035. timeout: function(){
  5036. this.fireEvent('timeout', this.xhr);
  5037. this.reject({reason: 'timeout', xhr: this.xhr});
  5038. },
  5039. setHeader: function(name, value){
  5040. this.headers[name] = value;
  5041. return this;
  5042. },
  5043. getHeader: function(name){
  5044. return Function.attempt(function(){
  5045. return this.xhr.getResponseHeader(name);
  5046. }.bind(this));
  5047. },
  5048. check: function(){
  5049. if (!this.running) return true;
  5050. switch (this.options.link){
  5051. case 'cancel': this.cancel(); return true;
  5052. case 'chain': this.chain(this.caller.pass(arguments, this)); return false;
  5053. }
  5054. return false;
  5055. },
  5056. send: function(options){
  5057. if (!this.check(options)) return this;
  5058. this.options.isSuccess = this.options.isSuccess || this.isSuccess;
  5059. this.running = true;
  5060. var type = typeOf(options);
  5061. if (type == 'string' || type == 'element') options = {data: options};
  5062. var old = this.options;
  5063. options = Object.append({data: old.data, url: old.url, method: old.method}, options);
  5064. var data = options.data, url = String(options.url), method = options.method.toLowerCase();
  5065. switch (typeOf(data)){
  5066. case 'element': data = document.id(data).toQueryString(); break;
  5067. case 'object': case 'hash': data = Object.toQueryString(data);
  5068. }
  5069. if (this.options.format){
  5070. var format = 'format=' + this.options.format;
  5071. data = (data) ? format + '&' + data : format;
  5072. }
  5073. if (this.options.emulation && !['get', 'post'].contains(method)){
  5074. var _method = '_method=' + method;
  5075. data = (data) ? _method + '&' + data : _method;
  5076. method = 'post';
  5077. }
  5078. if (this.options.urlEncoded && ['post', 'put'].contains(method)){
  5079. var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : '';
  5080. //this.headers['Content-type'] = 'application/x-www-form-urlencoded' + encoding; //mootools1.6.0
  5081. if (!this.headers['Content-Type']) this.headers['Content-type'] = 'application/x-www-form-urlencoded' + encoding; //modify by tommy
  5082. }
  5083. if (!url) url = document.location.pathname;
  5084. var trimPosition = url.lastIndexOf('/');
  5085. if (trimPosition > -1 && (trimPosition = url.indexOf('#')) > -1) url = url.substr(0, trimPosition);
  5086. if (this.options.noCache)
  5087. url += (url.indexOf('?') > -1 ? '&' : '?') + String.uniqueID();
  5088. if (data && (method == 'get' || method == 'delete')){
  5089. url += (url.indexOf('?') > -1 ? '&' : '?') + data;
  5090. data = null;
  5091. }
  5092. var xhr = this.xhr;
  5093. if (progressSupport){
  5094. xhr.onloadstart = this.loadstart.bind(this);
  5095. xhr.onprogress = this.progress.bind(this);
  5096. }
  5097. //modify by Tommy--
  5098. var isWithCredentials = ((this.options.withCredentials && 'withCredentials' in xhr) || (this.options.user && 'withCredentials' in xhr) && (method.toUpperCase()=="POST" || method.toUpperCase()=="PUT"));
  5099. var isWithCredentialsSync = isWithCredentials && !this.options.async;
  5100. //-----------------
  5101. xhr.open(method.toUpperCase(), url, this.options.async, this.options.user, this.options.password);
  5102. if ((/*<1.4compat>*/this.options.user || /*</1.4compat>*/this.options.withCredentials) && 'withCredentials' in xhr) xhr.withCredentials = true;
  5103. //modify by Tommy--
  5104. if (Browser.name=="firefox"){
  5105. if (this.options.async){
  5106. if (isWithCredentials) xhr.withCredentials = true;
  5107. }else{
  5108. xhr.setRequestHeader("x-token", Cookie.read("x-token"));
  5109. }
  5110. }else{
  5111. if (isWithCredentials) xhr.withCredentials = true;
  5112. }
  5113. //-----------------
  5114. xhr.onreadystatechange = this.onStateChange.bind(this);
  5115. Object.each(this.headers, function(value, key){
  5116. try {
  5117. xhr.setRequestHeader(key, value);
  5118. } catch (e){
  5119. this.fireEvent('exception', [key, value]);
  5120. this.reject({reason: 'exception', xhr: xhr, exception: e});
  5121. }
  5122. }, this);
  5123. if (this.getThenableState() !== 'pending'){
  5124. this.resetThenable({reason: 'send'});
  5125. }
  5126. this.fireEvent('request');
  5127. xhr.send(data);
  5128. if (!this.options.async) this.onStateChange();
  5129. else if (this.options.timeout) this.timer = this.timeout.delay(this.options.timeout, this);
  5130. return this;
  5131. },
  5132. cancel: function(){
  5133. if (!this.running) return this;
  5134. this.running = false;
  5135. var xhr = this.xhr;
  5136. xhr.abort();
  5137. if (this.timer){
  5138. clearTimeout(this.timer);
  5139. delete this.timer;
  5140. }
  5141. xhr.onreadystatechange = empty;
  5142. if (progressSupport) xhr.onprogress = xhr.onloadstart = empty;
  5143. this.xhr = new Browser.Request();
  5144. this.fireEvent('cancel');
  5145. this.reject({reason: 'cancel', xhr: xhr});
  5146. return this;
  5147. }
  5148. });
  5149. var methods = {};
  5150. ['get', 'post', 'put', 'delete', 'patch', 'head', 'GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'].each(function(method){
  5151. methods[method] = function(data){
  5152. var object = {
  5153. method: method
  5154. };
  5155. if (data != null) object.data = data;
  5156. return this.send(object);
  5157. };
  5158. });
  5159. Request.implement(methods);
  5160. Element.Properties.send = {
  5161. set: function(options){
  5162. var send = this.get('send').cancel();
  5163. send.setOptions(options);
  5164. return this;
  5165. },
  5166. get: function(){
  5167. var send = this.retrieve('send');
  5168. if (!send){
  5169. send = new Request({
  5170. data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action')
  5171. });
  5172. this.store('send', send);
  5173. }
  5174. return send;
  5175. }
  5176. };
  5177. Element.implement({
  5178. send: function(url){
  5179. var sender = this.get('send');
  5180. sender.send({data: this, url: url || sender.options.url});
  5181. return this;
  5182. }
  5183. });
  5184. })();
  5185. /*
  5186. ---
  5187. name: Request.HTML
  5188. description: Extends the basic Request Class with additional methods for interacting with HTML responses.
  5189. license: MIT-style license.
  5190. requires: [Element, Request]
  5191. provides: Request.HTML
  5192. ...
  5193. */
  5194. Request.HTML = new Class({
  5195. Extends: Request,
  5196. options: {
  5197. update: false,
  5198. append: false,
  5199. evalScripts: true,
  5200. filter: false,
  5201. headers: {
  5202. Accept: 'text/html, application/xml, text/xml, */*'
  5203. }
  5204. },
  5205. success: function(text){
  5206. var options = this.options, response = this.response;
  5207. response.html = text.stripScripts(function(script){
  5208. response.javascript = script;
  5209. });
  5210. var match = response.html.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
  5211. if (match) response.html = match[1];
  5212. var temp = new Element('div').set('html', response.html);
  5213. response.tree = temp.childNodes;
  5214. response.elements = temp.getElements(options.filter || '*');
  5215. if (options.filter) response.tree = response.elements;
  5216. if (options.update){
  5217. var update = document.id(options.update).empty();
  5218. if (options.filter) update.adopt(response.elements);
  5219. else update.set('html', response.html);
  5220. } else if (options.append){
  5221. var append = document.id(options.append);
  5222. if (options.filter) response.elements.reverse().inject(append);
  5223. else append.adopt(temp.getChildren());
  5224. }
  5225. if (options.evalScripts) Browser.exec(response.javascript);
  5226. this.onSuccess(response.tree, response.elements, response.html, response.javascript);
  5227. this.resolve({tree: response.tree, elements: response.elements, html: response.html, javascript: response.javascript});
  5228. }
  5229. });
  5230. Element.Properties.load = {
  5231. set: function(options){
  5232. var load = this.get('load').cancel();
  5233. load.setOptions(options);
  5234. return this;
  5235. },
  5236. get: function(){
  5237. var load = this.retrieve('load');
  5238. if (!load){
  5239. load = new Request.HTML({data: this, link: 'cancel', update: this, method: 'get'});
  5240. this.store('load', load);
  5241. }
  5242. return load;
  5243. }
  5244. };
  5245. Element.implement({
  5246. load: function(){
  5247. this.get('load').send(Array.link(arguments, {data: Type.isObject, url: Type.isString}));
  5248. return this;
  5249. }
  5250. });
  5251. /*
  5252. ---
  5253. name: JSON
  5254. description: JSON encoder and decoder.
  5255. license: MIT-style license.
  5256. SeeAlso: <http://www.json.org/>
  5257. requires: [Array, String, Number, Function]
  5258. provides: JSON
  5259. ...
  5260. */
  5261. if (typeof JSON == 'undefined') this.JSON = {};
  5262. //<1.2compat>
  5263. JSON = new Hash({
  5264. stringify: JSON.stringify,
  5265. parse: JSON.parse
  5266. });
  5267. //</1.2compat>
  5268. (function(){
  5269. var special = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'};
  5270. var escape = function(chr){
  5271. return special[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16)).slice(-4);
  5272. };
  5273. JSON.validate = function(string){
  5274. string = string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
  5275. replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
  5276. replace(/(?:^|:|,)(?:\s*\[)+/g, '');
  5277. return (/^[\],:{}\s]*$/).test(string);
  5278. };
  5279. JSON.encode = JSON.stringify ? function(obj){
  5280. return JSON.stringify(obj);
  5281. } : function(obj){
  5282. if (obj && obj.toJSON) obj = obj.toJSON();
  5283. switch (typeOf(obj)){
  5284. case 'string':
  5285. return '"' + obj.replace(/[\x00-\x1f\\"]/g, escape) + '"';
  5286. case 'array':
  5287. return '[' + obj.map(JSON.encode).clean() + ']';
  5288. case 'object': case 'hash':
  5289. var string = [];
  5290. Object.each(obj, function(value, key){
  5291. var json = JSON.encode(value);
  5292. if (json) string.push(JSON.encode(key) + ':' + json);
  5293. });
  5294. return '{' + string + '}';
  5295. case 'number': case 'boolean': return '' + obj;
  5296. case 'null': return 'null';
  5297. }
  5298. return null;
  5299. };
  5300. JSON.secure = true;
  5301. //<1.4compat>
  5302. JSON.secure = false;
  5303. //</1.4compat>
  5304. JSON.decode = function(string, secure){
  5305. if (!string || typeOf(string) != 'string') return null;
  5306. if (secure == null) secure = JSON.secure;
  5307. if (secure){
  5308. if (JSON.parse) return JSON.parse(string);
  5309. if (!JSON.validate(string)) throw new Error('JSON could not decode the input; security is enabled and the value is not secure.');
  5310. }
  5311. return eval('(' + string + ')');
  5312. };
  5313. })();
  5314. /*
  5315. ---
  5316. name: Request.JSON
  5317. description: Extends the basic Request Class with additional methods for sending and receiving JSON data.
  5318. license: MIT-style license.
  5319. requires: [Request, JSON]
  5320. provides: Request.JSON
  5321. ...
  5322. */
  5323. Request.JSON = new Class({
  5324. Extends: Request,
  5325. options: {
  5326. /*onError: function(text, error){},*/
  5327. secure: true
  5328. },
  5329. initialize: function(options){
  5330. this.parent(options);
  5331. Object.append(this.headers, {
  5332. 'Accept': 'application/json',
  5333. 'X-Request': 'JSON'
  5334. });
  5335. },
  5336. success: function(text){
  5337. var json;
  5338. try {
  5339. json = this.response.json = JSON.decode(text, this.options.secure);
  5340. } catch (error){
  5341. this.fireEvent('error', [text, error]);
  5342. return;
  5343. }
  5344. if (json == null){
  5345. this.failure();
  5346. } else {
  5347. this.onSuccess(json, text);
  5348. this.resolve({json: json, text: text});
  5349. }
  5350. }
  5351. });
  5352. /*
  5353. ---
  5354. name: Cookie
  5355. description: Class for creating, reading, and deleting browser Cookies.
  5356. license: MIT-style license.
  5357. credits:
  5358. - Based on the functions by Peter-Paul Koch (http://quirksmode.org).
  5359. requires: [Options, Browser]
  5360. provides: Cookie
  5361. ...
  5362. */
  5363. var Cookie = new Class({
  5364. Implements: Options,
  5365. options: {
  5366. path: '/',
  5367. domain: false,
  5368. duration: false,
  5369. secure: false,
  5370. document: document,
  5371. encode: true,
  5372. httpOnly: false
  5373. },
  5374. initialize: function(key, options){
  5375. this.key = key;
  5376. this.setOptions(options);
  5377. },
  5378. write: function(value){
  5379. if (this.options.encode) value = encodeURIComponent(value);
  5380. if (this.options.domain) value += '; domain=' + this.options.domain;
  5381. if (this.options.path) value += '; path=' + this.options.path;
  5382. if (this.options.duration){
  5383. var date = new Date();
  5384. date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000);
  5385. value += '; expires=' + date.toGMTString();
  5386. }
  5387. if (this.options.secure) value += '; secure';
  5388. if (this.options.httpOnly) value += '; HttpOnly';
  5389. this.options.document.cookie = this.key + '=' + value;
  5390. return this;
  5391. },
  5392. read: function(){
  5393. var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)');
  5394. return (value) ? decodeURIComponent(value[1]) : null;
  5395. },
  5396. dispose: function(){
  5397. new Cookie(this.key, Object.merge({}, this.options, {duration: -1})).write('');
  5398. return this;
  5399. }
  5400. });
  5401. Cookie.write = function(key, value, options){
  5402. return new Cookie(key, options).write(value);
  5403. };
  5404. Cookie.read = function(key){
  5405. return new Cookie(key).read();
  5406. };
  5407. Cookie.dispose = function(key, options){
  5408. return new Cookie(key, options).dispose();
  5409. };
  5410. /*
  5411. ---
  5412. name: DOMReady
  5413. description: Contains the custom event domready.
  5414. license: MIT-style license.
  5415. requires: [Browser, Element, Element.Event]
  5416. provides: [DOMReady, DomReady]
  5417. ...
  5418. */
  5419. (function(window, document){
  5420. var ready,
  5421. loaded,
  5422. checks = [],
  5423. shouldPoll,
  5424. timer,
  5425. testElement = document.createElement('div');
  5426. var domready = function(){
  5427. clearTimeout(timer);
  5428. if (!ready){
  5429. Browser.loaded = ready = true;
  5430. document.removeListener('DOMContentLoaded', domready).removeListener('readystatechange', check);
  5431. document.fireEvent('domready');
  5432. window.fireEvent('domready');
  5433. }
  5434. // cleanup scope vars
  5435. document = window = testElement = null;
  5436. };
  5437. var check = function(){
  5438. for (var i = checks.length; i--;) if (checks[i]()){
  5439. domready();
  5440. return true;
  5441. }
  5442. return false;
  5443. };
  5444. var poll = function(){
  5445. clearTimeout(timer);
  5446. if (!check()) timer = setTimeout(poll, 10);
  5447. };
  5448. document.addListener('DOMContentLoaded', domready);
  5449. /*<ltIE8>*/
  5450. // doScroll technique by Diego Perini http://javascript.nwbox.com/IEContentLoaded/
  5451. // testElement.doScroll() throws when the DOM is not ready, only in the top window
  5452. var doScrollWorks = function(){
  5453. try {
  5454. testElement.doScroll();
  5455. return true;
  5456. } catch (e){}
  5457. return false;
  5458. };
  5459. // If doScroll works already, it can't be used to determine domready
  5460. // e.g. in an iframe
  5461. if (testElement.doScroll && !doScrollWorks()){
  5462. checks.push(doScrollWorks);
  5463. shouldPoll = true;
  5464. }
  5465. /*</ltIE8>*/
  5466. if (document.readyState) checks.push(function(){
  5467. var state = document.readyState;
  5468. return (state == 'loaded' || state == 'complete');
  5469. });
  5470. if ('onreadystatechange' in document) document.addListener('readystatechange', check);
  5471. else shouldPoll = true;
  5472. if (shouldPoll) poll();
  5473. Element.Events.domready = {
  5474. onAdd: function(fn){
  5475. if (ready) fn.call(this);
  5476. }
  5477. };
  5478. // Make sure that domready fires before load
  5479. Element.Events.load = {
  5480. base: 'load',
  5481. onAdd: function(fn){
  5482. if (loaded && this == window) fn.call(this);
  5483. },
  5484. condition: function(){
  5485. if (this == window){
  5486. domready();
  5487. delete Element.Events.load;
  5488. }
  5489. return true;
  5490. }
  5491. };
  5492. // This is based on the custom load event
  5493. window.addEvent('load', function(){
  5494. loaded = true;
  5495. });
  5496. })(window, document);
  5497. /*
  5498. ---
  5499. script: More.js
  5500. name: More
  5501. description: MooTools More
  5502. license: MIT-style license
  5503. authors:
  5504. - Guillermo Rauch
  5505. - Thomas Aylott
  5506. - Scott Kyle
  5507. - Arian Stolwijk
  5508. - Tim Wienk
  5509. - Christoph Pojer
  5510. - Aaron Newton
  5511. - Jacob Thornton
  5512. requires:
  5513. - Core/MooTools
  5514. provides: [MooTools.More]
  5515. ...
  5516. */
  5517. MooTools.More = {
  5518. version: '1.6.0',
  5519. build: '45b71db70f879781a7e0b0d3fb3bb1307c2521eb'
  5520. };
  5521. /*
  5522. ---
  5523. script: Chain.Wait.js
  5524. name: Chain.Wait
  5525. description: value, Adds a method to inject pauses between chained events.
  5526. license: MIT-style license.
  5527. authors:
  5528. - Aaron Newton
  5529. requires:
  5530. - Core/Chain
  5531. - Core/Element
  5532. - Core/Fx
  5533. - MooTools.More
  5534. provides: [Chain.Wait]
  5535. ...
  5536. */
  5537. (function(){
  5538. var wait = {
  5539. wait: function(duration){
  5540. return this.chain(function(){
  5541. this.callChain.delay(duration == null ? 500 : duration, this);
  5542. return this;
  5543. }.bind(this));
  5544. }
  5545. };
  5546. Chain.implement(wait);
  5547. if (this.Fx) Fx.implement(wait);
  5548. if (this.Element && Element.implement && this.Fx){
  5549. Element.implement({
  5550. chains: function(effects){
  5551. Array.convert(effects || ['tween', 'morph', 'reveal']).each(function(effect){
  5552. effect = this.get(effect);
  5553. if (!effect) return;
  5554. effect.setOptions({
  5555. link:'chain'
  5556. });
  5557. }, this);
  5558. return this;
  5559. },
  5560. pauseFx: function(duration, effect){
  5561. this.chains(effect).get(effect || 'tween').wait(duration);
  5562. return this;
  5563. }
  5564. });
  5565. }
  5566. })();
  5567. /*
  5568. ---
  5569. script: Class.Binds.js
  5570. name: Class.Binds
  5571. description: Automagically binds specified methods in a class to the instance of the class.
  5572. license: MIT-style license
  5573. authors:
  5574. - Aaron Newton
  5575. requires:
  5576. - Core/Class
  5577. - MooTools.More
  5578. provides: [Class.Binds]
  5579. ...
  5580. */
  5581. Class.Mutators.Binds = function(binds){
  5582. if (!this.prototype.initialize) this.implement('initialize', function(){});
  5583. return Array.convert(binds).concat(this.prototype.Binds || []);
  5584. };
  5585. Class.Mutators.initialize = function(initialize){
  5586. return function(){
  5587. Array.convert(this.Binds).each(function(name){
  5588. var original = this[name];
  5589. if (original) this[name] = original.bind(this);
  5590. }, this);
  5591. return initialize.apply(this, arguments);
  5592. };
  5593. };
  5594. /*
  5595. ---
  5596. script: Class.Occlude.js
  5597. name: Class.Occlude
  5598. description: Prevents a class from being applied to a DOM element twice.
  5599. license: MIT-style license.
  5600. authors:
  5601. - Aaron Newton
  5602. requires:
  5603. - Core/Class
  5604. - Core/Element
  5605. - MooTools.More
  5606. provides: [Class.Occlude]
  5607. ...
  5608. */
  5609. Class.Occlude = new Class({
  5610. occlude: function(property, element){
  5611. element = document.id(element || this.element);
  5612. var instance = element.retrieve(property || this.property);
  5613. if (instance && !this.occluded)
  5614. return (this.occluded = instance);
  5615. this.occluded = false;
  5616. element.store(property || this.property, this);
  5617. return this.occluded;
  5618. }
  5619. });
  5620. /*
  5621. ---
  5622. script: Class.Refactor.js
  5623. name: Class.Refactor
  5624. description: Extends a class onto itself with new property, preserving any items attached to the class's namespace.
  5625. license: MIT-style license
  5626. authors:
  5627. - Aaron Newton
  5628. requires:
  5629. - Core/Class
  5630. - MooTools.More
  5631. # Some modules declare themselves dependent on Class.Refactor
  5632. provides: [Class.refactor, Class.Refactor]
  5633. ...
  5634. */
  5635. Class.refactor = function(original, refactors){
  5636. Object.each(refactors, function(item, name){
  5637. var origin = original.prototype[name];
  5638. origin = (origin && origin.$origin) || origin || function(){};
  5639. original.implement(name, (typeof item == 'function') ? function(){
  5640. var old = this.previous;
  5641. this.previous = origin;
  5642. var value = item.apply(this, arguments);
  5643. this.previous = old;
  5644. return value;
  5645. } : item);
  5646. });
  5647. return original;
  5648. };
  5649. /*
  5650. ---
  5651. script: Class.Singleton.js
  5652. name: Class.Singleton
  5653. description: Always provides a single instance of a class
  5654. license: MIT-style license.
  5655. authors:
  5656. - Hristo Chakarov
  5657. requires:
  5658. - Core/Class
  5659. provides: [Class.Singleton]
  5660. ...
  5661. */
  5662. Class.Singleton = new Class({
  5663. initialize : function(descriptor){
  5664. // here we keep reference of the single instance
  5665. var singleton;
  5666. // create a regular Class
  5667. var constructor = new Class(descriptor);
  5668. // We return another constructor, because we need to make sure that we
  5669. // always return the same one and only instance.
  5670. return function(){
  5671. if (singleton){
  5672. return singleton;
  5673. }
  5674. // Obviously we instantiate that class for the first time.
  5675. // Create brand new object & extend it with the prototype of the
  5676. // original `constructor`.
  5677. singleton = Object.append({}, constructor.prototype);
  5678. singleton.constructor = constructor;
  5679. // We also need to call the constructor as a function, passing the
  5680. // arguments object.
  5681. var returnValue = constructor.apply(singleton, arguments);
  5682. // In case the `constructor` returns something other than `this` -
  5683. // return that value; otherwise return the `singleton`.
  5684. singleton = typeof returnValue == 'object' ? returnValue : singleton;
  5685. return singleton;
  5686. };
  5687. }
  5688. });
  5689. /*
  5690. ---
  5691. name: Events.Pseudos
  5692. description: Adds the functionality to add pseudo events
  5693. license: MIT-style license
  5694. authors:
  5695. - Arian Stolwijk
  5696. requires: [Core/Class.Extras, Core/Slick.Parser, MooTools.More]
  5697. provides: [Events.Pseudos]
  5698. ...
  5699. */
  5700. (function(){
  5701. Events.Pseudos = function(pseudos, addEvent, removeEvent){
  5702. var storeKey = '_monitorEvents:';
  5703. var storageOf = function(object){
  5704. return {
  5705. store: object.store ? function(key, value){
  5706. object.store(storeKey + key, value);
  5707. } : function(key, value){
  5708. (object._monitorEvents || (object._monitorEvents = {}))[key] = value;
  5709. },
  5710. retrieve: object.retrieve ? function(key, dflt){
  5711. return object.retrieve(storeKey + key, dflt);
  5712. } : function(key, dflt){
  5713. if (!object._monitorEvents) return dflt;
  5714. return object._monitorEvents[key] || dflt;
  5715. }
  5716. };
  5717. };
  5718. var splitType = function(type){
  5719. if (type.indexOf(':') == -1 || !pseudos) return null;
  5720. var parsed = Slick.parse(type).expressions[0][0],
  5721. parsedPseudos = parsed.pseudos,
  5722. l = parsedPseudos.length,
  5723. splits = [];
  5724. while (l--){
  5725. var pseudo = parsedPseudos[l].key,
  5726. listener = pseudos[pseudo];
  5727. if (listener != null) splits.push({
  5728. event: parsed.tag,
  5729. value: parsedPseudos[l].value,
  5730. pseudo: pseudo,
  5731. original: type,
  5732. listener: listener
  5733. });
  5734. }
  5735. return splits.length ? splits : null;
  5736. };
  5737. return {
  5738. addEvent: function(type, fn, internal){
  5739. var split = splitType(type);
  5740. if (!split) return addEvent.call(this, type, fn, internal);
  5741. var storage = storageOf(this),
  5742. events = storage.retrieve(type, []),
  5743. eventType = split[0].event,
  5744. args = Array.slice(arguments, 2),
  5745. stack = fn,
  5746. self = this;
  5747. split.each(function(item){
  5748. var listener = item.listener,
  5749. stackFn = stack;
  5750. if (listener == false) eventType += ':' + item.pseudo + '(' + item.value + ')';
  5751. else stack = function(){
  5752. listener.call(self, item, stackFn, arguments, stack);
  5753. };
  5754. });
  5755. events.include({type: eventType, event: fn, monitor: stack});
  5756. storage.store(type, events);
  5757. if (type != eventType) addEvent.apply(this, [type, fn].concat(args));
  5758. return addEvent.apply(this, [eventType, stack].concat(args));
  5759. },
  5760. removeEvent: function(type, fn){
  5761. var split = splitType(type);
  5762. if (!split) return removeEvent.call(this, type, fn);
  5763. var storage = storageOf(this),
  5764. events = storage.retrieve(type);
  5765. if (!events) return this;
  5766. var args = Array.slice(arguments, 2);
  5767. removeEvent.apply(this, [type, fn].concat(args));
  5768. events.each(function(monitor, i){
  5769. if (!fn || monitor.event == fn) removeEvent.apply(this, [monitor.type, monitor.monitor].concat(args));
  5770. delete events[i];
  5771. }, this);
  5772. storage.store(type, events);
  5773. return this;
  5774. }
  5775. };
  5776. };
  5777. var pseudos = {
  5778. once: function(split, fn, args, monitor){
  5779. fn.apply(this, args);
  5780. this.removeEvent(split.event, monitor)
  5781. .removeEvent(split.original, fn);
  5782. },
  5783. throttle: function(split, fn, args){
  5784. if (!fn._throttled){
  5785. fn.apply(this, args);
  5786. fn._throttled = setTimeout(function(){
  5787. fn._throttled = false;
  5788. }, split.value || 250);
  5789. }
  5790. },
  5791. pause: function(split, fn, args){
  5792. clearTimeout(fn._pause);
  5793. fn._pause = fn.delay(split.value || 250, this, args);
  5794. }
  5795. };
  5796. Events.definePseudo = function(key, listener){
  5797. pseudos[key] = listener;
  5798. return this;
  5799. };
  5800. Events.lookupPseudo = function(key){
  5801. return pseudos[key];
  5802. };
  5803. var proto = Events.prototype;
  5804. Events.implement(Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
  5805. ['Request', 'Fx'].each(function(klass){
  5806. if (this[klass]) this[klass].implement(Events.prototype);
  5807. });
  5808. })();
  5809. /*
  5810. ---
  5811. script: Drag.js
  5812. name: Drag
  5813. description: The base Drag Class. Can be used to drag and resize Elements using mouse events.
  5814. license: MIT-style license
  5815. authors:
  5816. - Valerio Proietti
  5817. - Tom Occhinno
  5818. - Jan Kassens
  5819. requires:
  5820. - Core/Events
  5821. - Core/Options
  5822. - Core/Element.Event
  5823. - Core/Element.Style
  5824. - Core/Element.Dimensions
  5825. - MooTools.More
  5826. provides: [Drag]
  5827. ...
  5828. */
  5829. (function(){
  5830. var Drag = this.Drag = new Class({
  5831. Implements: [Events, Options],
  5832. options: {/*
  5833. onBeforeStart: function(thisElement){},
  5834. onStart: function(thisElement, event){},
  5835. onSnap: function(thisElement){},
  5836. onDrag: function(thisElement, event){},
  5837. onCancel: function(thisElement){},
  5838. onComplete: function(thisElement, event){},*/
  5839. snap: 6,
  5840. unit: 'px',
  5841. grid: false,
  5842. style: true,
  5843. limit: false,
  5844. handle: false,
  5845. invert: false,
  5846. unDraggableTags: ['button', 'input', 'a', 'textarea', 'select', 'option'],
  5847. preventDefault: false,
  5848. stopPropagation: false,
  5849. compensateScroll: false,
  5850. modifiers: {x: 'left', y: 'top'}
  5851. },
  5852. initialize: function(){
  5853. var params = Array.link(arguments, {
  5854. 'options': Type.isObject,
  5855. 'element': function(obj){
  5856. return obj != null;
  5857. }
  5858. });
  5859. this.element = document.id(params.element);
  5860. this.document = this.element.getDocument();
  5861. this.setOptions(params.options || {});
  5862. var htype = typeOf(this.options.handle);
  5863. this.handles = ((htype == 'array' || htype == 'collection') ? $$(this.options.handle) : document.id(this.options.handle)) || this.element;
  5864. this.mouse = {'now': {}, 'pos': {}};
  5865. this.value = {'start': {}, 'now': {}};
  5866. this.offsetParent = (function(el){
  5867. var offsetParent = el.getOffsetParent();
  5868. var isBody = !offsetParent || (/^(?:body|html)$/i).test(offsetParent.tagName);
  5869. return isBody ? window : document.id(offsetParent);
  5870. })(this.element);
  5871. this.selection = 'selectstart' in document ? 'selectstart' : 'mousedown';
  5872. this.compensateScroll = {start: {}, diff: {}, last: {}};
  5873. if ('ondragstart' in document && !('FileReader' in window) && !Drag.ondragstartFixed){
  5874. document.ondragstart = Function.convert(false);
  5875. Drag.ondragstartFixed = true;
  5876. }
  5877. this.bound = {
  5878. start: this.start.bind(this),
  5879. check: this.check.bind(this),
  5880. drag: this.drag.bind(this),
  5881. stop: this.stop.bind(this),
  5882. cancel: this.cancel.bind(this),
  5883. eventStop: Function.convert(false),
  5884. scrollListener: this.scrollListener.bind(this)
  5885. };
  5886. this.attach();
  5887. },
  5888. attach: function(){
  5889. this.handles.addEvent('mousedown', this.bound.start);
  5890. this.handles.addEvent('touchstart', this.bound.start);
  5891. if (this.options.compensateScroll) this.offsetParent.addEvent('scroll', this.bound.scrollListener);
  5892. return this;
  5893. },
  5894. detach: function(){
  5895. this.handles.removeEvent('mousedown', this.bound.start);
  5896. this.handles.removeEvent('touchstart', this.bound.start);
  5897. if (this.options.compensateScroll) this.offsetParent.removeEvent('scroll', this.bound.scrollListener);
  5898. return this;
  5899. },
  5900. scrollListener: function(){
  5901. if (!this.mouse.start) return;
  5902. var newScrollValue = this.offsetParent.getScroll();
  5903. if (this.element.getStyle('position') == 'absolute'){
  5904. var scrollDiff = this.sumValues(newScrollValue, this.compensateScroll.last, -1);
  5905. this.mouse.now = this.sumValues(this.mouse.now, scrollDiff, 1);
  5906. } else {
  5907. this.compensateScroll.diff = this.sumValues(newScrollValue, this.compensateScroll.start, -1);
  5908. }
  5909. if (this.offsetParent != window) this.compensateScroll.diff = this.sumValues(this.compensateScroll.start, newScrollValue, -1);
  5910. this.compensateScroll.last = newScrollValue;
  5911. this.render(this.options);
  5912. },
  5913. sumValues: function(alpha, beta, op){
  5914. var sum = {}, options = this.options;
  5915. for (var z in options.modifiers){
  5916. if (!options.modifiers[z]) continue;
  5917. sum[z] = alpha[z] + beta[z] * op;
  5918. }
  5919. return sum;
  5920. },
  5921. start: function(event){
  5922. if (this.options.unDraggableTags.contains(event.target.get('tag'))) return;
  5923. var options = this.options;
  5924. if (event.rightClick) return;
  5925. if (options.preventDefault) event.preventDefault();
  5926. if (options.stopPropagation) event.stopPropagation();
  5927. this.compensateScroll.start = this.compensateScroll.last = this.offsetParent.getScroll();
  5928. this.compensateScroll.diff = {x: 0, y: 0};
  5929. this.mouse.start = event.page;
  5930. this.fireEvent('beforeStart', this.element);
  5931. var limit = options.limit;
  5932. this.limit = {x: [], y: []};
  5933. var z, coordinates, offsetParent = this.offsetParent == window ? null : this.offsetParent;
  5934. for (z in options.modifiers){
  5935. if (!options.modifiers[z]) continue;
  5936. var style = this.element.getStyle(options.modifiers[z]);
  5937. // Some browsers (IE and Opera) don't always return pixels.
  5938. if (style && !style.match(/px$/)){
  5939. if (!coordinates) coordinates = this.element.getCoordinates(offsetParent);
  5940. style = coordinates[options.modifiers[z]];
  5941. }
  5942. if (options.style) this.value.now[z] = (style || 0).toInt();
  5943. else this.value.now[z] = this.element[options.modifiers[z]];
  5944. if (options.invert) this.value.now[z] *= -1;
  5945. this.mouse.pos[z] = event.page[z] - this.value.now[z];
  5946. if (limit && limit[z]){
  5947. var i = 2;
  5948. while (i--){
  5949. var limitZI = limit[z][i];
  5950. if (limitZI || limitZI === 0) this.limit[z][i] = (typeof limitZI == 'function') ? limitZI() : limitZI;
  5951. }
  5952. }
  5953. }
  5954. if (typeOf(this.options.grid) == 'number') this.options.grid = {
  5955. x: this.options.grid,
  5956. y: this.options.grid
  5957. };
  5958. var events = {
  5959. mousemove: this.bound.check,
  5960. mouseup: this.bound.cancel,
  5961. touchmove: this.bound.check,
  5962. touchend: this.bound.cancel
  5963. };
  5964. events[this.selection] = this.bound.eventStop;
  5965. this.document.addEvents(events);
  5966. },
  5967. check: function(event){
  5968. if (this.options.preventDefault) event.preventDefault();
  5969. var distance = Math.round(Math.sqrt(Math.pow(event.page.x - this.mouse.start.x, 2) + Math.pow(event.page.y - this.mouse.start.y, 2)));
  5970. if (distance > this.options.snap){
  5971. this.cancel();
  5972. this.document.addEvents({
  5973. mousemove: this.bound.drag,
  5974. mouseup: this.bound.stop,
  5975. touchmove: this.bound.drag,
  5976. touchend: this.bound.stop
  5977. });
  5978. this.fireEvent('start', [this.element, event]).fireEvent('snap', this.element);
  5979. }
  5980. },
  5981. drag: function(event){
  5982. var options = this.options;
  5983. if (options.preventDefault) event.preventDefault();
  5984. this.mouse.now = this.sumValues(event.page, this.compensateScroll.diff, -1);
  5985. this.render(options);
  5986. this.fireEvent('drag', [this.element, event]);
  5987. },
  5988. render: function(options){
  5989. for (var z in options.modifiers){
  5990. if (!options.modifiers[z]) continue;
  5991. this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z];
  5992. if (options.invert) this.value.now[z] *= -1;
  5993. if (options.limit && this.limit[z]){
  5994. if ((this.limit[z][1] || this.limit[z][1] === 0) && (this.value.now[z] > this.limit[z][1])){
  5995. this.value.now[z] = this.limit[z][1];
  5996. } else if ((this.limit[z][0] || this.limit[z][0] === 0) && (this.value.now[z] < this.limit[z][0])){
  5997. this.value.now[z] = this.limit[z][0];
  5998. }
  5999. }
  6000. if (options.grid[z]) this.value.now[z] -= ((this.value.now[z] - (this.limit[z][0]||0)) % options.grid[z]);
  6001. if (options.style) this.element.setStyle(options.modifiers[z], this.value.now[z] + options.unit);
  6002. else this.element[options.modifiers[z]] = this.value.now[z];
  6003. }
  6004. },
  6005. cancel: function(event){
  6006. this.document.removeEvents({
  6007. mousemove: this.bound.check,
  6008. mouseup: this.bound.cancel,
  6009. touchmove: this.bound.check,
  6010. touchend: this.bound.cancel
  6011. });
  6012. if (event){
  6013. this.document.removeEvent(this.selection, this.bound.eventStop);
  6014. this.fireEvent('cancel', this.element);
  6015. }
  6016. },
  6017. stop: function(event){
  6018. var events = {
  6019. mousemove: this.bound.drag,
  6020. mouseup: this.bound.stop,
  6021. touchmove: this.bound.drag,
  6022. touchend: this.bound.stop
  6023. };
  6024. events[this.selection] = this.bound.eventStop;
  6025. this.document.removeEvents(events);
  6026. this.mouse.start = null;
  6027. if (event) this.fireEvent('complete', [this.element, event]);
  6028. }
  6029. });
  6030. })();
  6031. Element.implement({
  6032. makeResizable: function(options){
  6033. var drag = new Drag(this, Object.merge({
  6034. modifiers: {
  6035. x: 'width',
  6036. y: 'height'
  6037. }
  6038. }, options));
  6039. this.store('resizer', drag);
  6040. return drag.addEvent('drag', function(){
  6041. this.fireEvent('resize', drag);
  6042. }.bind(this));
  6043. }
  6044. });
  6045. /*
  6046. ---
  6047. script: Drag.Move.js
  6048. name: Drag.Move
  6049. description: A Drag extension that provides support for the constraining of draggables to containers and droppables.
  6050. license: MIT-style license
  6051. authors:
  6052. - Valerio Proietti
  6053. - Tom Occhinno
  6054. - Jan Kassens
  6055. - Aaron Newton
  6056. - Scott Kyle
  6057. requires:
  6058. - Core/Element.Dimensions
  6059. - Drag
  6060. provides: [Drag.Move]
  6061. ...
  6062. */
  6063. Drag.Move = new Class({
  6064. Extends: Drag,
  6065. options: {/*
  6066. onEnter: function(thisElement, overed){},
  6067. onLeave: function(thisElement, overed){},
  6068. onDrop: function(thisElement, overed, event){},*/
  6069. droppables: [],
  6070. container: false,
  6071. precalculate: false,
  6072. includeMargins: true,
  6073. checkDroppables: true
  6074. },
  6075. initialize: function(element, options){
  6076. this.parent(element, options);
  6077. element = this.element;
  6078. this.droppables = $$(this.options.droppables);
  6079. this.setContainer(this.options.container);
  6080. if (this.options.style){
  6081. if (this.options.modifiers.x == 'left' && this.options.modifiers.y == 'top'){
  6082. var parent = element.getOffsetParent(),
  6083. styles = element.getStyles('left', 'top');
  6084. if (parent && (styles.left == 'auto' || styles.top == 'auto')){
  6085. element.setPosition(element.getPosition(parent));
  6086. }
  6087. }
  6088. if (element.getStyle('position') == 'static') element.setStyle('position', 'absolute');
  6089. }
  6090. this.addEvent('start', this.checkDroppables, true);
  6091. this.overed = null;
  6092. },
  6093. setContainer: function(container){
  6094. this.container = document.id(container);
  6095. if (this.container && typeOf(this.container) != 'element'){
  6096. this.container = document.id(this.container.getDocument().body);
  6097. }
  6098. },
  6099. start: function(event){
  6100. if (this.container) this.options.limit = this.calculateLimit();
  6101. if (this.options.precalculate){
  6102. this.positions = this.droppables.map(function(el){
  6103. return el.getCoordinates();
  6104. });
  6105. }
  6106. this.parent(event);
  6107. },
  6108. calculateLimit: function(){
  6109. var element = this.element,
  6110. container = this.container,
  6111. offsetParent = document.id(element.getOffsetParent()) || document.body,
  6112. containerCoordinates = container.getCoordinates(offsetParent),
  6113. elementMargin = {},
  6114. elementBorder = {},
  6115. containerMargin = {},
  6116. containerBorder = {},
  6117. offsetParentPadding = {},
  6118. offsetScroll = offsetParent.getScroll();
  6119. ['top', 'right', 'bottom', 'left'].each(function(pad){
  6120. elementMargin[pad] = element.getStyle('margin-' + pad).toInt();
  6121. elementBorder[pad] = element.getStyle('border-' + pad).toInt();
  6122. containerMargin[pad] = container.getStyle('margin-' + pad).toInt();
  6123. containerBorder[pad] = container.getStyle('border-' + pad).toInt();
  6124. offsetParentPadding[pad] = offsetParent.getStyle('padding-' + pad).toInt();
  6125. }, this);
  6126. var width = element.offsetWidth + elementMargin.left + elementMargin.right,
  6127. height = element.offsetHeight + elementMargin.top + elementMargin.bottom,
  6128. left = 0 + offsetScroll.x,
  6129. top = 0 + offsetScroll.y,
  6130. right = containerCoordinates.right - containerBorder.right - width + offsetScroll.x,
  6131. bottom = containerCoordinates.bottom - containerBorder.bottom - height + offsetScroll.y;
  6132. if (this.options.includeMargins){
  6133. left += elementMargin.left;
  6134. top += elementMargin.top;
  6135. } else {
  6136. right += elementMargin.right;
  6137. bottom += elementMargin.bottom;
  6138. }
  6139. if (element.getStyle('position') == 'relative'){
  6140. var coords = element.getCoordinates(offsetParent);
  6141. coords.left -= element.getStyle('left').toInt();
  6142. coords.top -= element.getStyle('top').toInt();
  6143. left -= coords.left;
  6144. top -= coords.top;
  6145. if (container.getStyle('position') != 'relative'){
  6146. left += containerBorder.left;
  6147. top += containerBorder.top;
  6148. }
  6149. right += elementMargin.left - coords.left;
  6150. bottom += elementMargin.top - coords.top;
  6151. if (container != offsetParent){
  6152. left += containerMargin.left + offsetParentPadding.left;
  6153. if (!offsetParentPadding.left && left < 0) left = 0;
  6154. top += offsetParent == document.body ? 0 : containerMargin.top + offsetParentPadding.top;
  6155. if (!offsetParentPadding.top && top < 0) top = 0;
  6156. }
  6157. } else {
  6158. left -= elementMargin.left;
  6159. top -= elementMargin.top;
  6160. if (container != offsetParent){
  6161. left += containerCoordinates.left + containerBorder.left;
  6162. top += containerCoordinates.top + containerBorder.top;
  6163. }
  6164. }
  6165. return {
  6166. x: [left, right],
  6167. y: [top, bottom]
  6168. };
  6169. },
  6170. getDroppableCoordinates: function(element){
  6171. var position = element.getCoordinates();
  6172. if (element.getStyle('position') == 'fixed'){
  6173. var scroll = window.getScroll();
  6174. position.left += scroll.x;
  6175. position.right += scroll.x;
  6176. position.top += scroll.y;
  6177. position.bottom += scroll.y;
  6178. }
  6179. return position;
  6180. },
  6181. //modify by Tommy
  6182. checkDroppables:function(){
  6183. var overedList = this.droppables.filter(function(el, i){
  6184. el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el);
  6185. var now = this.mouse.now;
  6186. return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
  6187. }, this);
  6188. var overed = overedList.getLast();
  6189. if (overed) for (var x=0;x<overedList.length-1;x++) if(overed.contains(overedList[x])) overed=overedList[x];
  6190. if(this.overed!=overed){
  6191. if(this.overed) this.fireEvent("leave",[this.element,this.overed]);
  6192. if(overed) this.fireEvent("enter",[this.element,overed]);
  6193. this.overed=overed;
  6194. }
  6195. },
  6196. //mootools....
  6197. //checkDroppables: function(){
  6198. // var overed = this.droppables.filter(function(el, i){
  6199. // el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el);
  6200. // var now = this.mouse.now;
  6201. // return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
  6202. // }, this).getLast();
  6203. //
  6204. // if (this.overed != overed){
  6205. // if (this.overed) this.fireEvent('leave', [this.element, this.overed]);
  6206. // if (overed) this.fireEvent('enter', [this.element, overed]);
  6207. // this.overed = overed;
  6208. // }
  6209. //},
  6210. drag: function(event){
  6211. this.parent(event);
  6212. if (this.options.checkDroppables && this.droppables.length) this.checkDroppables();
  6213. },
  6214. stop: function(event){
  6215. this.checkDroppables();
  6216. this.fireEvent('drop', [this.element, this.overed, event]);
  6217. this.overed = null;
  6218. return this.parent(event);
  6219. }
  6220. });
  6221. Element.implement({
  6222. makeDraggable: function(options){
  6223. var drag = new Drag.Move(this, options);
  6224. this.store('dragger', drag);
  6225. return drag;
  6226. }
  6227. });
  6228. /*
  6229. ---
  6230. script: Element.Measure.js
  6231. name: Element.Measure
  6232. description: Extends the Element native object to include methods useful in measuring dimensions.
  6233. credits: "Element.measure / .expose methods by Daniel Steigerwald License: MIT-style license. Copyright: Copyright (c) 2008 Daniel Steigerwald, daniel.steigerwald.cz"
  6234. license: MIT-style license
  6235. authors:
  6236. - Aaron Newton
  6237. requires:
  6238. - Core/Element.Style
  6239. - Core/Element.Dimensions
  6240. - MooTools.More
  6241. provides: [Element.Measure]
  6242. ...
  6243. */
  6244. (function(){
  6245. var getStylesList = function(styles, planes){
  6246. var list = [];
  6247. Object.each(planes, function(directions){
  6248. Object.each(directions, function(edge){
  6249. styles.each(function(style){
  6250. list.push(style + '-' + edge + (style == 'border' ? '-width' : ''));
  6251. });
  6252. });
  6253. });
  6254. return list;
  6255. };
  6256. var calculateEdgeSize = function(edge, styles){
  6257. var total = 0;
  6258. Object.each(styles, function(value, style){
  6259. if (style.test(edge)) total = total + value.toInt();
  6260. });
  6261. return total;
  6262. };
  6263. var isVisible = function(el){
  6264. return !!(!el || el.offsetHeight || el.offsetWidth);
  6265. };
  6266. Element.implement({
  6267. measure: function(fn){
  6268. if (isVisible(this)) return fn.call(this);
  6269. var parent = this.getParent(),
  6270. toMeasure = [];
  6271. while (!isVisible(parent) && parent != document.body){
  6272. toMeasure.push(parent.expose());
  6273. parent = parent.getParent();
  6274. }
  6275. var restore = this.expose(),
  6276. result = fn.call(this);
  6277. restore();
  6278. toMeasure.each(function(restore){
  6279. restore();
  6280. });
  6281. return result;
  6282. },
  6283. expose: function(){
  6284. if (this.getStyle('display') != 'none') return function(){};
  6285. var before = this.style.cssText;
  6286. this.setStyles({
  6287. display: 'block',
  6288. position: 'absolute',
  6289. visibility: 'hidden'
  6290. });
  6291. return function(){
  6292. this.style.cssText = before;
  6293. }.bind(this);
  6294. },
  6295. getDimensions: function(options){
  6296. options = Object.merge({computeSize: false}, options);
  6297. var dim = {x: 0, y: 0};
  6298. var getSize = function(el, options){
  6299. return (options.computeSize) ? el.getComputedSize(options) : el.getSize();
  6300. };
  6301. var parent = this.getParent('body');
  6302. if (parent && this.getStyle('display') == 'none'){
  6303. dim = this.measure(function(){
  6304. return getSize(this, options);
  6305. });
  6306. } else if (parent){
  6307. try { //safari sometimes crashes here, so catch it
  6308. dim = getSize(this, options);
  6309. } catch (e){}
  6310. }
  6311. return Object.append(dim, (dim.x || dim.x === 0) ? {
  6312. width: dim.x,
  6313. height: dim.y
  6314. } : {
  6315. x: dim.width,
  6316. y: dim.height
  6317. });
  6318. },
  6319. getComputedSize: function(options){
  6320. //<1.2compat>
  6321. //legacy support for my stupid spelling error
  6322. if (options && options.plains) options.planes = options.plains;
  6323. //</1.2compat>
  6324. options = Object.merge({
  6325. styles: ['padding','border'],
  6326. planes: {
  6327. height: ['top','bottom'],
  6328. width: ['left','right']
  6329. },
  6330. mode: 'both'
  6331. }, options);
  6332. var styles = {},
  6333. size = {width: 0, height: 0},
  6334. dimensions;
  6335. if (options.mode == 'vertical'){
  6336. delete size.width;
  6337. delete options.planes.width;
  6338. } else if (options.mode == 'horizontal'){
  6339. delete size.height;
  6340. delete options.planes.height;
  6341. }
  6342. getStylesList(options.styles, options.planes).each(function(style){
  6343. styles[style] = this.getStyle(style).toInt();
  6344. }, this);
  6345. Object.each(options.planes, function(edges, plane){
  6346. var capitalized = plane.capitalize(),
  6347. style = this.getStyle(plane);
  6348. if (style == 'auto' && !dimensions) dimensions = this.getDimensions();
  6349. style = styles[plane] = (style == 'auto') ? dimensions[plane] : style.toInt();
  6350. size['total' + capitalized] = style;
  6351. edges.each(function(edge){
  6352. var edgesize = calculateEdgeSize(edge, styles);
  6353. size['computed' + edge.capitalize()] = edgesize;
  6354. size['total' + capitalized] += edgesize;
  6355. });
  6356. }, this);
  6357. return Object.append(size, styles);
  6358. }
  6359. });
  6360. })();
  6361. /*
  6362. ---
  6363. script: Slider.js
  6364. name: Slider
  6365. description: Class for creating horizontal and vertical slider controls.
  6366. license: MIT-style license
  6367. authors:
  6368. - Valerio Proietti
  6369. requires:
  6370. - Core/Element.Dimensions
  6371. - Core/Number
  6372. - Class.Binds
  6373. - Drag
  6374. - Element.Measure
  6375. provides: [Slider]
  6376. ...
  6377. */
  6378. (function(){
  6379. var Slider = this.Slider = new Class({
  6380. Implements: [Events, Options],
  6381. Binds: ['clickedElement', 'draggedKnob', 'scrolledElement'],
  6382. options: {/*
  6383. onTick: function(intPosition){},
  6384. onMove: function(){},
  6385. onChange: function(intStep){},
  6386. onComplete: function(strStep){},*/
  6387. onTick: function(position){
  6388. this.setKnobPosition(position);
  6389. },
  6390. initialStep: 0,
  6391. snap: false,
  6392. offset: 0,
  6393. range: false,
  6394. wheel: false,
  6395. steps: 100,
  6396. mode: 'horizontal'
  6397. },
  6398. initialize: function(element, knob, options){
  6399. this.setOptions(options);
  6400. options = this.options;
  6401. this.element = document.id(element);
  6402. knob = this.knob = document.id(knob);
  6403. this.previousChange = this.previousEnd = this.step = options.initialStep ? options.initialStep : options.range ? options.range[0] : 0;
  6404. var limit = {},
  6405. modifiers = {x: false, y: false};
  6406. switch (options.mode){
  6407. case 'vertical':
  6408. this.axis = 'y';
  6409. this.property = 'top';
  6410. this.offset = 'offsetHeight';
  6411. break;
  6412. case 'horizontal':
  6413. this.axis = 'x';
  6414. this.property = 'left';
  6415. this.offset = 'offsetWidth';
  6416. }
  6417. this.setSliderDimensions();
  6418. this.setRange(options.range, null, true);
  6419. if (knob.getStyle('position') == 'static') knob.setStyle('position', 'relative');
  6420. knob.setStyle(this.property, -options.offset);
  6421. modifiers[this.axis] = this.property;
  6422. limit[this.axis] = [-options.offset, this.full - options.offset];
  6423. var dragOptions = {
  6424. snap: 0,
  6425. limit: limit,
  6426. modifiers: modifiers,
  6427. onDrag: this.draggedKnob,
  6428. onStart: this.draggedKnob,
  6429. onBeforeStart: (function(){
  6430. this.isDragging = true;
  6431. }).bind(this),
  6432. onCancel: function(){
  6433. this.isDragging = false;
  6434. }.bind(this),
  6435. onComplete: function(){
  6436. this.isDragging = false;
  6437. this.draggedKnob();
  6438. this.end();
  6439. }.bind(this)
  6440. };
  6441. if (options.snap) this.setSnap(dragOptions);
  6442. this.drag = new Drag(knob, dragOptions);
  6443. if (options.initialStep != null) this.set(options.initialStep, true);
  6444. this.attach();
  6445. },
  6446. attach: function(){
  6447. this.element.addEvent('mousedown', this.clickedElement);
  6448. if (this.options.wheel) this.element.addEvent('mousewheel', this.scrolledElement);
  6449. this.drag.attach();
  6450. return this;
  6451. },
  6452. detach: function(){
  6453. this.element.removeEvent('mousedown', this.clickedElement)
  6454. .removeEvent('mousewheel', this.scrolledElement);
  6455. this.drag.detach();
  6456. return this;
  6457. },
  6458. autosize: function(){
  6459. this.setSliderDimensions()
  6460. .setKnobPosition(this.toPosition(this.step));
  6461. this.drag.options.limit[this.axis] = [-this.options.offset, this.full - this.options.offset];
  6462. if (this.options.snap) this.setSnap();
  6463. return this;
  6464. },
  6465. setSnap: function(options){
  6466. if (!options) options = this.drag.options;
  6467. options.grid = Math.ceil(this.stepWidth);
  6468. options.limit[this.axis][1] = this.element[this.offset];
  6469. return this;
  6470. },
  6471. setKnobPosition: function(position){
  6472. if (this.options.snap) position = this.toPosition(this.step);
  6473. this.knob.setStyle(this.property, position);
  6474. return this;
  6475. },
  6476. setSliderDimensions: function(){
  6477. this.full = this.element.measure(function(){
  6478. this.half = this.knob[this.offset] / 2;
  6479. return this.element[this.offset] - this.knob[this.offset] + (this.options.offset * 2);
  6480. }.bind(this));
  6481. return this;
  6482. },
  6483. set: function(step, silently){
  6484. if (!((this.range > 0) ^ (step < this.min))) step = this.min;
  6485. if (!((this.range > 0) ^ (step > this.max))) step = this.max;
  6486. this.step = (step).round(this.modulus.decimalLength);
  6487. if (silently) this.checkStep().setKnobPosition(this.toPosition(this.step));
  6488. else this.checkStep().fireEvent('tick', this.toPosition(this.step)).fireEvent('move').end();
  6489. return this;
  6490. },
  6491. setRange: function(range, pos, silently){
  6492. this.min = Array.pick([range[0], 0]);
  6493. this.max = Array.pick([range[1], this.options.steps]);
  6494. this.range = this.max - this.min;
  6495. this.steps = this.options.steps || this.full;
  6496. var stepSize = this.stepSize = Math.abs(this.range) / this.steps;
  6497. this.stepWidth = this.stepSize * this.full / Math.abs(this.range);
  6498. this.setModulus();
  6499. if (range) this.set(Array.pick([pos, this.step]).limit(this.min,this.max), silently);
  6500. return this;
  6501. },
  6502. setModulus: function(){
  6503. var decimals = ((this.stepSize + '').split('.')[1] || []).length,
  6504. modulus = 1 + '';
  6505. while (decimals--) modulus += '0';
  6506. this.modulus = {multiplier: (modulus).toInt(10), decimalLength: modulus.length - 1};
  6507. },
  6508. clickedElement: function(event){
  6509. if (this.isDragging || event.target == this.knob) return;
  6510. var dir = this.range < 0 ? -1 : 1,
  6511. position = event.page[this.axis] - this.element.getPosition()[this.axis] - this.half;
  6512. position = position.limit(-this.options.offset, this.full - this.options.offset);
  6513. this.step = (this.min + dir * this.toStep(position)).round(this.modulus.decimalLength);
  6514. this.checkStep()
  6515. .fireEvent('tick', position)
  6516. .fireEvent('move')
  6517. .end();
  6518. },
  6519. scrolledElement: function(event){
  6520. var mode = (this.options.mode == 'horizontal') ? (event.wheel < 0) : (event.wheel > 0);
  6521. this.set(this.step + (mode ? -1 : 1) * this.stepSize);
  6522. event.stop();
  6523. },
  6524. draggedKnob: function(){
  6525. var dir = this.range < 0 ? -1 : 1,
  6526. position = this.drag.value.now[this.axis];
  6527. position = position.limit(-this.options.offset, this.full -this.options.offset);
  6528. this.step = (this.min + dir * this.toStep(position)).round(this.modulus.decimalLength);
  6529. this.checkStep();
  6530. this.fireEvent('move');
  6531. },
  6532. checkStep: function(){
  6533. var step = this.step;
  6534. if (this.previousChange != step){
  6535. this.previousChange = step;
  6536. this.fireEvent('change', step);
  6537. }
  6538. return this;
  6539. },
  6540. end: function(){
  6541. var step = this.step;
  6542. if (this.previousEnd !== step){
  6543. this.previousEnd = step;
  6544. this.fireEvent('complete', step + '');
  6545. }
  6546. return this;
  6547. },
  6548. toStep: function(position){
  6549. var step = (position + this.options.offset) * this.stepSize / this.full * this.steps;
  6550. return this.options.steps ? (step - (step * this.modulus.multiplier) % (this.stepSize * this.modulus.multiplier) / this.modulus.multiplier).round(this.modulus.decimalLength) : step;
  6551. },
  6552. toPosition: function(step){
  6553. return (this.full * Math.abs(this.min - step)) / (this.steps * this.stepSize) - this.options.offset || 0;
  6554. }
  6555. });
  6556. })();
  6557. /*
  6558. ---
  6559. script: Sortables.js
  6560. name: Sortables
  6561. description: Class for creating a drag and drop sorting interface for lists of items.
  6562. license: MIT-style license
  6563. authors:
  6564. - Tom Occhino
  6565. requires:
  6566. - Core/Fx.Morph
  6567. - Drag.Move
  6568. provides: [Sortables]
  6569. ...
  6570. */
  6571. (function(){
  6572. var Sortables = this.Sortables = new Class({
  6573. Implements: [Events, Options],
  6574. options: {/*
  6575. onSort: function(element, clone){},
  6576. onStart: function(element, clone){},
  6577. onComplete: function(element){},*/
  6578. opacity: 1,
  6579. clone: false,
  6580. revert: false,
  6581. handle: false,
  6582. dragOptions: {},
  6583. unDraggableTags: ['button', 'input', 'a', 'textarea', 'select', 'option']/*<1.2compat>*/,
  6584. snap: 4,
  6585. constrain: false,
  6586. preventDefault: false
  6587. /*</1.2compat>*/
  6588. },
  6589. initialize: function(lists, options){
  6590. this.setOptions(options);
  6591. this.elements = [];
  6592. this.lists = [];
  6593. this.idle = true;
  6594. this.addLists($$(document.id(lists) || lists));
  6595. if (!this.options.clone) this.options.revert = false;
  6596. if (this.options.revert) this.effect = new Fx.Morph(null, Object.merge({
  6597. duration: 250,
  6598. link: 'cancel'
  6599. }, this.options.revert));
  6600. },
  6601. attach: function(){
  6602. this.addLists(this.lists);
  6603. return this;
  6604. },
  6605. detach: function(){
  6606. this.lists = this.removeLists(this.lists);
  6607. return this;
  6608. },
  6609. addItems: function(){
  6610. Array.flatten(arguments).each(function(element){
  6611. this.elements.push(element);
  6612. var start = element.retrieve('sortables:start', function(event){
  6613. this.start.call(this, event, element);
  6614. }.bind(this));
  6615. (this.options.handle ? element.getElement(this.options.handle) || element : element).addEvent('mousedown', start);
  6616. }, this);
  6617. return this;
  6618. },
  6619. addLists: function(){
  6620. Array.flatten(arguments).each(function(list){
  6621. this.lists.include(list);
  6622. this.addItems(list.getChildren());
  6623. }, this);
  6624. return this;
  6625. },
  6626. removeItems: function(){
  6627. return $$(Array.flatten(arguments).map(function(element){
  6628. this.elements.erase(element);
  6629. var start = element.retrieve('sortables:start');
  6630. (this.options.handle ? element.getElement(this.options.handle) || element : element).removeEvent('mousedown', start);
  6631. return element;
  6632. }, this));
  6633. },
  6634. removeLists: function(){
  6635. return $$(Array.flatten(arguments).map(function(list){
  6636. this.lists.erase(list);
  6637. this.removeItems(list.getChildren());
  6638. return list;
  6639. }, this));
  6640. },
  6641. getDroppableCoordinates: function(element){
  6642. var offsetParent = element.getOffsetParent();
  6643. var position = element.getPosition(offsetParent);
  6644. var scroll = {
  6645. w: window.getScroll(),
  6646. offsetParent: offsetParent.getScroll()
  6647. };
  6648. position.x += scroll.offsetParent.x;
  6649. position.y += scroll.offsetParent.y;
  6650. if (offsetParent.getStyle('position') == 'fixed'){
  6651. position.x -= scroll.w.x;
  6652. position.y -= scroll.w.y;
  6653. }
  6654. return position;
  6655. },
  6656. getClone: function(event, element){
  6657. if (!this.options.clone) return new Element(element.tagName).inject(document.body);
  6658. if (typeOf(this.options.clone) == 'function') return this.options.clone.call(this, event, element, this.list);
  6659. var clone = element.clone(true).setStyles({
  6660. margin: 0,
  6661. position: 'absolute',
  6662. visibility: 'hidden',
  6663. width: element.getStyle('width')
  6664. }).addEvent('mousedown', function(event){
  6665. element.fireEvent('mousedown', event);
  6666. });
  6667. //prevent the duplicated radio inputs from unchecking the real one
  6668. if (clone.get('html').test('radio')){
  6669. clone.getElements('input[type=radio]').each(function(input, i){
  6670. input.set('name', 'clone_' + i);
  6671. if (input.get('checked')) element.getElements('input[type=radio]')[i].set('checked', true);
  6672. });
  6673. }
  6674. return clone.inject(this.list).setPosition(this.getDroppableCoordinates(this.element));
  6675. },
  6676. getDroppables: function(){
  6677. var droppables = this.list.getChildren().erase(this.clone).erase(this.element);
  6678. if (!this.options.constrain) droppables.append(this.lists).erase(this.list);
  6679. return droppables;
  6680. },
  6681. insert: function(dragging, element){
  6682. var where = 'inside';
  6683. if (this.lists.contains(element)){
  6684. this.list = element;
  6685. this.drag.droppables = this.getDroppables();
  6686. } else {
  6687. where = this.element.getAllPrevious().contains(element) ? 'before' : 'after';
  6688. }
  6689. this.element.inject(element, where);
  6690. this.fireEvent('sort', [this.element, this.clone]);
  6691. },
  6692. start: function(event, element){
  6693. if (
  6694. !this.idle ||
  6695. event.rightClick ||
  6696. (!this.options.handle && this.options.unDraggableTags.contains(event.target.get('tag')))
  6697. ) return;
  6698. this.idle = false;
  6699. this.element = element;
  6700. this.opacity = element.getStyle('opacity');
  6701. this.list = element.getParent();
  6702. this.clone = this.getClone(event, element);
  6703. this.drag = new Drag.Move(this.clone, Object.merge({
  6704. /*<1.2compat>*/
  6705. preventDefault: this.options.preventDefault,
  6706. snap: this.options.snap,
  6707. container: this.options.constrain && this.element.getParent(),
  6708. /*</1.2compat>*/
  6709. droppables: this.getDroppables()
  6710. }, this.options.dragOptions)).addEvents({
  6711. onSnap: function(){
  6712. event.stop();
  6713. this.clone.setStyle('visibility', 'visible');
  6714. this.element.setStyle('opacity', this.options.opacity || 0);
  6715. this.fireEvent('start', [this.element, this.clone]);
  6716. }.bind(this),
  6717. onEnter: this.insert.bind(this),
  6718. onCancel: this.end.bind(this),
  6719. onComplete: this.end.bind(this)
  6720. });
  6721. this.clone.inject(this.element, 'before');
  6722. this.drag.start(event);
  6723. },
  6724. end: function(){
  6725. this.drag.detach();
  6726. this.element.setStyle('opacity', this.opacity);
  6727. var self = this;
  6728. if (this.effect){
  6729. var dim = this.element.getStyles('width', 'height'),
  6730. clone = this.clone,
  6731. pos = clone.computePosition(this.getDroppableCoordinates(clone));
  6732. var destroy = function(){
  6733. this.removeEvent('cancel', destroy);
  6734. clone.destroy();
  6735. self.reset();
  6736. };
  6737. this.effect.element = clone;
  6738. this.effect.start({
  6739. top: pos.top,
  6740. left: pos.left,
  6741. width: dim.width,
  6742. height: dim.height,
  6743. opacity: 0.25
  6744. }).addEvent('cancel', destroy).chain(destroy);
  6745. } else {
  6746. this.clone.destroy();
  6747. self.reset();
  6748. }
  6749. },
  6750. reset: function(){
  6751. this.idle = true;
  6752. this.fireEvent('complete', this.element);
  6753. },
  6754. serialize: function(){
  6755. var params = Array.link(arguments, {
  6756. modifier: Type.isFunction,
  6757. index: function(obj){
  6758. return obj != null;
  6759. }
  6760. });
  6761. var serial = this.lists.map(function(list){
  6762. return list.getChildren().map(params.modifier || function(element){
  6763. return element.get('id');
  6764. }, this);
  6765. }, this);
  6766. var index = params.index;
  6767. if (this.lists.length == 1) index = 0;
  6768. return (index || index === 0) && index >= 0 && index < this.lists.length ? serial[index] : serial;
  6769. }
  6770. });
  6771. })();
  6772. /*
  6773. ---
  6774. name: Element.Event.Pseudos
  6775. description: Adds the functionality to add pseudo events for Elements
  6776. license: MIT-style license
  6777. authors:
  6778. - Arian Stolwijk
  6779. requires: [Core/Element.Event, Core/Element.Delegation, Events.Pseudos]
  6780. provides: [Element.Event.Pseudos, Element.Delegation.Pseudo]
  6781. ...
  6782. */
  6783. (function(){
  6784. var pseudos = {relay: false},
  6785. copyFromEvents = ['once', 'throttle', 'pause'],
  6786. count = copyFromEvents.length;
  6787. while (count--) pseudos[copyFromEvents[count]] = Events.lookupPseudo(copyFromEvents[count]);
  6788. DOMEvent.definePseudo = function(key, listener){
  6789. pseudos[key] = listener;
  6790. return this;
  6791. };
  6792. var proto = Element.prototype;
  6793. [Element, Window, Document].invoke('implement', Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
  6794. })();
  6795. /*
  6796. ---
  6797. name: Element.Event.Pseudos.Keys
  6798. description: Adds functionality fire events if certain keycombinations are pressed
  6799. license: MIT-style license
  6800. authors:
  6801. - Arian Stolwijk
  6802. requires: [Element.Event.Pseudos]
  6803. provides: [Element.Event.Pseudos.Keys]
  6804. ...
  6805. */
  6806. (function(){
  6807. var keysStoreKey = '$moo:keys-pressed',
  6808. keysKeyupStoreKey = '$moo:keys-keyup';
  6809. DOMEvent.definePseudo('keys', function(split, fn, args){
  6810. var event = args[0],
  6811. keys = [],
  6812. pressed = this.retrieve(keysStoreKey, []),
  6813. value = split.value;
  6814. if (value != '+') keys.append(value.replace('++', function(){
  6815. keys.push('+'); // shift++ and shift+++a
  6816. return '';
  6817. }).split('+'));
  6818. else keys = ['+'];
  6819. pressed.include(event.key);
  6820. if (keys.every(function(key){
  6821. return pressed.contains(key);
  6822. })) fn.apply(this, args);
  6823. this.store(keysStoreKey, pressed);
  6824. if (!this.retrieve(keysKeyupStoreKey)){
  6825. var keyup = function(event){
  6826. (function(){
  6827. pressed = this.retrieve(keysStoreKey, []).erase(event.key);
  6828. this.store(keysStoreKey, pressed);
  6829. }).delay(0, this); // Fix for IE
  6830. };
  6831. this.store(keysKeyupStoreKey, keyup).addEvent('keyup', keyup);
  6832. }
  6833. });
  6834. DOMEvent.defineKeys({
  6835. '16': 'shift',
  6836. '17': 'control',
  6837. '18': 'alt',
  6838. '20': 'capslock',
  6839. '33': 'pageup',
  6840. '34': 'pagedown',
  6841. '35': 'end',
  6842. '36': 'home',
  6843. '144': 'numlock',
  6844. '145': 'scrolllock',
  6845. '186': ';',
  6846. '187': '=',
  6847. '188': ',',
  6848. '190': '.',
  6849. '191': '/',
  6850. '192': '`',
  6851. '219': '[',
  6852. '220': '\\',
  6853. '221': ']',
  6854. '222': "'",
  6855. '107': '+',
  6856. '109': '-', // subtract
  6857. '189': '-' // dash
  6858. });
  6859. })();
  6860. /*
  6861. ---
  6862. script: String.Extras.js
  6863. name: String.Extras
  6864. description: Extends the String native object to include methods useful in managing various kinds of strings (query strings, urls, html, etc).
  6865. license: MIT-style license
  6866. authors:
  6867. - Aaron Newton
  6868. - Guillermo Rauch
  6869. - Christopher Pitt
  6870. requires:
  6871. - Core/String
  6872. - Core/Array
  6873. - MooTools.More
  6874. provides: [String.Extras]
  6875. ...
  6876. */
  6877. (function(){
  6878. var special = {
  6879. 'a': /[àáâãäåăą]/g,
  6880. 'A': /[ÀÁÂÃÄÅĂĄ]/g,
  6881. 'c': /[ćčç]/g,
  6882. 'C': /[ĆČÇ]/g,
  6883. 'd': /[ďđ]/g,
  6884. 'D': /[ĎÐ]/g,
  6885. 'e': /[èéêëěę]/g,
  6886. 'E': /[ÈÉÊËĚĘ]/g,
  6887. 'g': /[ğ]/g,
  6888. 'G': /[Ğ]/g,
  6889. 'i': /[ìíîï]/g,
  6890. 'I': /[ÌÍÎÏ]/g,
  6891. 'l': /[ĺľł]/g,
  6892. 'L': /[ĹĽŁ]/g,
  6893. 'n': /[ñňń]/g,
  6894. 'N': /[ÑŇŃ]/g,
  6895. 'o': /[òóôõöøő]/g,
  6896. 'O': /[ÒÓÔÕÖØ]/g,
  6897. 'r': /[řŕ]/g,
  6898. 'R': /[ŘŔ]/g,
  6899. 's': /[ššş]/g,
  6900. 'S': /[ŠŞŚ]/g,
  6901. 't': /[ťţ]/g,
  6902. 'T': /[ŤŢ]/g,
  6903. 'u': /[ùúûůüµ]/g,
  6904. 'U': /[ÙÚÛŮÜ]/g,
  6905. 'y': /[ÿý]/g,
  6906. 'Y': /[ŸÝ]/g,
  6907. 'z': /[žźż]/g,
  6908. 'Z': /[ŽŹŻ]/g,
  6909. 'th': /[þ]/g,
  6910. 'TH': /[Þ]/g,
  6911. 'dh': /[ð]/g,
  6912. 'DH': /[Ð]/g,
  6913. 'ss': /[ß]/g,
  6914. 'oe': /[œ]/g,
  6915. 'OE': /[Œ]/g,
  6916. 'ae': /[æ]/g,
  6917. 'AE': /[Æ]/g
  6918. },
  6919. tidy = {
  6920. ' ': /[\xa0\u2002\u2003\u2009]/g,
  6921. '*': /[\xb7]/g,
  6922. '\'': /[\u2018\u2019]/g,
  6923. '"': /[\u201c\u201d]/g,
  6924. '...': /[\u2026]/g,
  6925. '-': /[\u2013]/g,
  6926. // '--': /[\u2014]/g,
  6927. '&raquo;': /[\uFFFD]/g
  6928. },
  6929. conversions = {
  6930. ms: 1,
  6931. s: 1000,
  6932. m: 6e4,
  6933. h: 36e5
  6934. },
  6935. findUnits = /(\d*.?\d+)([msh]+)/;
  6936. var walk = function(string, replacements){
  6937. var result = string, key;
  6938. for (key in replacements) result = result.replace(replacements[key], key);
  6939. return result;
  6940. };
  6941. var getRegexForTag = function(tag, contents){
  6942. tag = tag || (contents ? '' : '\\w+');
  6943. var regstr = contents ? '<' + tag + '(?!\\w)[^>]*>([\\s\\S]*?)<\/' + tag + '(?!\\w)>' : '<\/?' + tag + '\/?>|<' + tag + '[\\s|\/][^>]*>';
  6944. return new RegExp(regstr, 'gi');
  6945. };
  6946. String.implement({
  6947. standardize: function(){
  6948. return walk(this, special);
  6949. },
  6950. repeat: function(times){
  6951. return new Array(times + 1).join(this);
  6952. },
  6953. pad: function(length, str, direction){
  6954. if (this.length >= length) return this;
  6955. var pad = (str == null ? ' ' : '' + str)
  6956. .repeat(length - this.length)
  6957. .substr(0, length - this.length);
  6958. if (!direction || direction == 'right') return this + pad;
  6959. if (direction == 'left') return pad + this;
  6960. return pad.substr(0, (pad.length / 2).floor()) + this + pad.substr(0, (pad.length / 2).ceil());
  6961. },
  6962. getTags: function(tag, contents){
  6963. return this.match(getRegexForTag(tag, contents)) || [];
  6964. },
  6965. stripTags: function(tag, contents){
  6966. return this.replace(getRegexForTag(tag, contents), '');
  6967. },
  6968. tidy: function(){
  6969. return walk(this, tidy);
  6970. },
  6971. truncate: function(max, trail, atChar){
  6972. var string = this;
  6973. if (trail == null && arguments.length == 1) trail = '…';
  6974. if (string.length > max){
  6975. string = string.substring(0, max);
  6976. if (atChar){
  6977. var index = string.lastIndexOf(atChar);
  6978. if (index != -1) string = string.substr(0, index);
  6979. }
  6980. if (trail) string += trail;
  6981. }
  6982. return string;
  6983. },
  6984. ms: function(){
  6985. // "Borrowed" from https://gist.github.com/1503944
  6986. var units = findUnits.exec(this);
  6987. if (units == null) return Number(this);
  6988. return Number(units[1]) * conversions[units[2]];
  6989. }
  6990. });
  6991. })();
  6992. /*
  6993. ---
  6994. script: Element.Forms.js
  6995. name: Element.Forms
  6996. description: Extends the Element native object to include methods useful in managing inputs.
  6997. license: MIT-style license
  6998. authors:
  6999. - Aaron Newton
  7000. requires:
  7001. - Core/Element
  7002. - String.Extras
  7003. - MooTools.More
  7004. provides: [Element.Forms]
  7005. ...
  7006. */
  7007. Element.implement({
  7008. tidy: function(){
  7009. this.set('value', this.get('value').tidy());
  7010. },
  7011. getTextInRange: function(start, end){
  7012. return this.get('value').substring(start, end);
  7013. },
  7014. getSelectedText: function(){
  7015. if (this.setSelectionRange) return this.getTextInRange(this.getSelectionStart(), this.getSelectionEnd());
  7016. return document.selection.createRange().text;
  7017. },
  7018. getSelectedRange: function(){
  7019. if (this.selectionStart != null){
  7020. return {
  7021. start: this.selectionStart,
  7022. end: this.selectionEnd
  7023. };
  7024. }
  7025. var pos = {
  7026. start: 0,
  7027. end: 0
  7028. };
  7029. var range = this.getDocument().selection.createRange();
  7030. if (!range || range.parentElement() != this) return pos;
  7031. var duplicate = range.duplicate();
  7032. if (this.type == 'text'){
  7033. pos.start = 0 - duplicate.moveStart('character', -100000);
  7034. pos.end = pos.start + range.text.length;
  7035. } else {
  7036. var value = this.get('value');
  7037. var offset = value.length;
  7038. duplicate.moveToElementText(this);
  7039. duplicate.setEndPoint('StartToEnd', range);
  7040. if (duplicate.text.length) offset -= value.match(/[\n\r]*$/)[0].length;
  7041. pos.end = offset - duplicate.text.length;
  7042. duplicate.setEndPoint('StartToStart', range);
  7043. pos.start = offset - duplicate.text.length;
  7044. }
  7045. return pos;
  7046. },
  7047. getSelectionStart: function(){
  7048. return this.getSelectedRange().start;
  7049. },
  7050. getSelectionEnd: function(){
  7051. return this.getSelectedRange().end;
  7052. },
  7053. setCaretPosition: function(pos){
  7054. if (pos == 'end') pos = this.get('value').length;
  7055. this.selectRange(pos, pos);
  7056. return this;
  7057. },
  7058. getCaretPosition: function(){
  7059. return this.getSelectedRange().start;
  7060. },
  7061. selectRange: function(start, end){
  7062. if (this.setSelectionRange){
  7063. this.focus();
  7064. this.setSelectionRange(start, end);
  7065. } else {
  7066. var value = this.get('value');
  7067. var diff = value.substr(start, end - start).replace(/\r/g, '').length;
  7068. start = value.substr(0, start).replace(/\r/g, '').length;
  7069. var range = this.createTextRange();
  7070. range.collapse(true);
  7071. range.moveEnd('character', start + diff);
  7072. range.moveStart('character', start);
  7073. range.select();
  7074. }
  7075. return this;
  7076. },
  7077. insertAtCursor: function(value, select){
  7078. var pos = this.getSelectedRange();
  7079. var text = this.get('value');
  7080. this.set('value', text.substring(0, pos.start) + value + text.substring(pos.end, text.length));
  7081. if (select !== false) this.selectRange(pos.start, pos.start + value.length);
  7082. else this.setCaretPosition(pos.start + value.length);
  7083. return this;
  7084. },
  7085. insertAroundCursor: function(options, select){
  7086. options = Object.append({
  7087. before: '',
  7088. defaultMiddle: '',
  7089. after: ''
  7090. }, options);
  7091. var value = this.getSelectedText() || options.defaultMiddle;
  7092. var pos = this.getSelectedRange();
  7093. var text = this.get('value');
  7094. if (pos.start == pos.end){
  7095. this.set('value', text.substring(0, pos.start) + options.before + value + options.after + text.substring(pos.end, text.length));
  7096. this.selectRange(pos.start + options.before.length, pos.end + options.before.length + value.length);
  7097. } else {
  7098. var current = text.substring(pos.start, pos.end);
  7099. this.set('value', text.substring(0, pos.start) + options.before + current + options.after + text.substring(pos.end, text.length));
  7100. var selStart = pos.start + options.before.length;
  7101. if (select !== false) this.selectRange(selStart, selStart + current.length);
  7102. else this.setCaretPosition(selStart + text.length);
  7103. }
  7104. return this;
  7105. }
  7106. });
  7107. /*
  7108. ---
  7109. script: Element.Pin.js
  7110. name: Element.Pin
  7111. description: Extends the Element native object to include the pin method useful for fixed positioning for elements.
  7112. license: MIT-style license
  7113. authors:
  7114. - Aaron Newton
  7115. requires:
  7116. - Core/Element.Event
  7117. - Core/Element.Dimensions
  7118. - Core/Element.Style
  7119. - MooTools.More
  7120. provides: [Element.Pin]
  7121. ...
  7122. */
  7123. (function(){
  7124. var supportsPositionFixed = false,
  7125. supportTested = false;
  7126. var testPositionFixed = function(){
  7127. var test = new Element('div').setStyles({
  7128. position: 'fixed',
  7129. top: 0,
  7130. right: 0
  7131. }).inject(document.body);
  7132. supportsPositionFixed = (test.offsetTop === 0);
  7133. test.dispose();
  7134. supportTested = true;
  7135. };
  7136. Element.implement({
  7137. pin: function(enable, forceScroll){
  7138. if (!supportTested) testPositionFixed();
  7139. if (this.getStyle('display') == 'none') return this;
  7140. var pinnedPosition,
  7141. scroll = window.getScroll(),
  7142. parent,
  7143. scrollFixer;
  7144. if (enable !== false){
  7145. pinnedPosition = this.getPosition();
  7146. if (!this.retrieve('pin:_pinned')){
  7147. var currentPosition = {
  7148. top: pinnedPosition.y - scroll.y,
  7149. left: pinnedPosition.x - scroll.x,
  7150. margin: '0px',
  7151. padding: '0px'
  7152. };
  7153. if (supportsPositionFixed && !forceScroll){
  7154. this.setStyle('position', 'fixed').setStyles(currentPosition);
  7155. } else {
  7156. parent = this.getOffsetParent();
  7157. var position = this.getPosition(parent),
  7158. styles = this.getStyles('left', 'top');
  7159. if (parent && styles.left == 'auto' || styles.top == 'auto') this.setPosition(position);
  7160. if (this.getStyle('position') == 'static') this.setStyle('position', 'absolute');
  7161. position = {
  7162. x: styles.left.toInt() - scroll.x,
  7163. y: styles.top.toInt() - scroll.y
  7164. };
  7165. scrollFixer = function(){
  7166. if (!this.retrieve('pin:_pinned')) return;
  7167. var scroll = window.getScroll();
  7168. this.setStyles({
  7169. left: position.x + scroll.x,
  7170. top: position.y + scroll.y
  7171. });
  7172. }.bind(this);
  7173. this.store('pin:_scrollFixer', scrollFixer);
  7174. window.addEvent('scroll', scrollFixer);
  7175. }
  7176. this.store('pin:_pinned', true);
  7177. }
  7178. } else {
  7179. if (!this.retrieve('pin:_pinned')) return this;
  7180. parent = this.getParent();
  7181. var offsetParent = (parent.getComputedStyle('position') != 'static' ? parent : parent.getOffsetParent());
  7182. pinnedPosition = this.getPosition();
  7183. this.store('pin:_pinned', false);
  7184. scrollFixer = this.retrieve('pin:_scrollFixer');
  7185. if (!scrollFixer){
  7186. this.setStyles({
  7187. position: 'absolute',
  7188. top: pinnedPosition.y + scroll.y,
  7189. left: pinnedPosition.x + scroll.x
  7190. });
  7191. } else {
  7192. this.store('pin:_scrollFixer', null);
  7193. window.removeEvent('scroll', scrollFixer);
  7194. }
  7195. this.removeClass('isPinned');
  7196. }
  7197. return this;
  7198. },
  7199. unpin: function(){
  7200. return this.pin(false);
  7201. },
  7202. togglePin: function(){
  7203. return this.pin(!this.retrieve('pin:_pinned'));
  7204. }
  7205. });
  7206. //<1.2compat>
  7207. Element.alias('togglepin', 'togglePin');
  7208. //</1.2compat>
  7209. })();
  7210. /*
  7211. ---
  7212. script: Element.Position.js
  7213. name: Element.Position
  7214. description: Extends the Element native object to include methods useful positioning elements relative to others.
  7215. license: MIT-style license
  7216. authors:
  7217. - Aaron Newton
  7218. - Jacob Thornton
  7219. requires:
  7220. - Core/Options
  7221. - Core/Element.Dimensions
  7222. - Element.Measure
  7223. provides: [Element.Position]
  7224. ...
  7225. */
  7226. (function(original){
  7227. var local = Element.Position = {
  7228. options: {/*
  7229. edge: false,
  7230. returnPos: false,
  7231. minimum: {x: 0, y: 0},
  7232. maximum: {x: 0, y: 0},
  7233. relFixedPosition: false,
  7234. ignoreMargins: false,
  7235. ignoreScroll: false,
  7236. allowNegative: false,*/
  7237. relativeTo: document.body,
  7238. position: {
  7239. x: 'center', //left, center, right
  7240. y: 'center' //top, center, bottom
  7241. },
  7242. offset: {x: 0, y: 0}
  7243. },
  7244. getOptions: function(element, options){
  7245. options = Object.merge({}, local.options, options);
  7246. local.setPositionOption(options);
  7247. local.setEdgeOption(options);
  7248. local.setOffsetOption(element, options);
  7249. local.setDimensionsOption(element, options);
  7250. return options;
  7251. },
  7252. setPositionOption: function(options){
  7253. options.position = local.getCoordinateFromValue(options.position);
  7254. },
  7255. setEdgeOption: function(options){
  7256. var edgeOption = local.getCoordinateFromValue(options.edge);
  7257. options.edge = edgeOption ? edgeOption :
  7258. (options.position.x == 'center' && options.position.y == 'center') ? {x: 'center', y: 'center'} :
  7259. {x: 'left', y: 'top'};
  7260. },
  7261. setOffsetOption: function(element, options){
  7262. var parentOffset = {x: 0, y: 0};
  7263. var parentScroll = {x: 0, y: 0};
  7264. var offsetParent = element.measure(function(){
  7265. return document.id(this.getOffsetParent());
  7266. });
  7267. if (!offsetParent || offsetParent == element.getDocument().body) return;
  7268. parentScroll = offsetParent.getScroll();
  7269. parentOffset = offsetParent.measure(function(){
  7270. var position = this.getPosition();
  7271. if (this.getStyle('position') == 'fixed'){
  7272. var scroll = window.getScroll();
  7273. position.x += scroll.x;
  7274. position.y += scroll.y;
  7275. }
  7276. return position;
  7277. });
  7278. options.offset = {
  7279. parentPositioned: offsetParent != document.id(options.relativeTo),
  7280. x: options.offset.x - parentOffset.x + parentScroll.x,
  7281. y: options.offset.y - parentOffset.y + parentScroll.y
  7282. };
  7283. },
  7284. setDimensionsOption: function(element, options){
  7285. options.dimensions = element.getDimensions({
  7286. computeSize: true,
  7287. styles: ['padding', 'border', 'margin']
  7288. });
  7289. },
  7290. getPosition: function(element, options){
  7291. var position = {};
  7292. options = local.getOptions(element, options);
  7293. var relativeTo = document.id(options.relativeTo) || document.body;
  7294. local.setPositionCoordinates(options, position, relativeTo);
  7295. if (options.edge) local.toEdge(position, options);
  7296. var offset = options.offset;
  7297. position.left = ((position.x >= 0 || offset.parentPositioned || options.allowNegative) ? position.x : 0).toInt();
  7298. position.top = ((position.y >= 0 || offset.parentPositioned || options.allowNegative) ? position.y : 0).toInt();
  7299. local.toMinMax(position, options);
  7300. if (options.relFixedPosition || relativeTo.getStyle('position') == 'fixed') local.toRelFixedPosition(relativeTo, position);
  7301. if (options.ignoreScroll) local.toIgnoreScroll(relativeTo, position);
  7302. if (options.ignoreMargins) local.toIgnoreMargins(position, options);
  7303. position.left = Math.ceil(position.left);
  7304. position.top = Math.ceil(position.top);
  7305. delete position.x;
  7306. delete position.y;
  7307. return position;
  7308. },
  7309. setPositionCoordinates: function(options, position, relativeTo){
  7310. var offsetY = options.offset.y,
  7311. offsetX = options.offset.x,
  7312. calc = (relativeTo == document.body) ? window.getScroll() : relativeTo.getPosition(),
  7313. top = calc.y,
  7314. left = calc.x,
  7315. winSize = window.getSize();
  7316. switch (options.position.x){
  7317. case 'left': position.x = left + offsetX; break;
  7318. case 'right': position.x = left + offsetX + relativeTo.offsetWidth; break;
  7319. default: position.x = left + ((relativeTo == document.body ? winSize.x : relativeTo.offsetWidth) / 2) + offsetX; break;
  7320. }
  7321. switch (options.position.y){
  7322. case 'top': position.y = top + offsetY; break;
  7323. case 'bottom': position.y = top + offsetY + relativeTo.offsetHeight; break;
  7324. default: position.y = top + ((relativeTo == document.body ? winSize.y : relativeTo.offsetHeight) / 2) + offsetY; break;
  7325. }
  7326. },
  7327. toMinMax: function(position, options){
  7328. var xy = {left: 'x', top: 'y'}, value;
  7329. ['minimum', 'maximum'].each(function(minmax){
  7330. ['left', 'top'].each(function(lr){
  7331. value = options[minmax] ? options[minmax][xy[lr]] : null;
  7332. if (value != null && ((minmax == 'minimum') ? position[lr] < value : position[lr] > value)) position[lr] = value;
  7333. });
  7334. });
  7335. },
  7336. toRelFixedPosition: function(relativeTo, position){
  7337. var winScroll = window.getScroll();
  7338. position.top += winScroll.y;
  7339. position.left += winScroll.x;
  7340. },
  7341. toIgnoreScroll: function(relativeTo, position){
  7342. var relScroll = relativeTo.getScroll();
  7343. position.top -= relScroll.y;
  7344. position.left -= relScroll.x;
  7345. },
  7346. toIgnoreMargins: function(position, options){
  7347. position.left += options.edge.x == 'right'
  7348. ? options.dimensions['margin-right']
  7349. : (options.edge.x != 'center'
  7350. ? -options.dimensions['margin-left']
  7351. : -options.dimensions['margin-left'] + ((options.dimensions['margin-right'] + options.dimensions['margin-left']) / 2));
  7352. position.top += options.edge.y == 'bottom'
  7353. ? options.dimensions['margin-bottom']
  7354. : (options.edge.y != 'center'
  7355. ? -options.dimensions['margin-top']
  7356. : -options.dimensions['margin-top'] + ((options.dimensions['margin-bottom'] + options.dimensions['margin-top']) / 2));
  7357. },
  7358. toEdge: function(position, options){
  7359. var edgeOffset = {},
  7360. dimensions = options.dimensions,
  7361. edge = options.edge;
  7362. switch (edge.x){
  7363. case 'left': edgeOffset.x = 0; break;
  7364. case 'right': edgeOffset.x = -dimensions.x - dimensions.computedRight - dimensions.computedLeft; break;
  7365. // center
  7366. default: edgeOffset.x = -(Math.round(dimensions.totalWidth / 2)); break;
  7367. }
  7368. switch (edge.y){
  7369. case 'top': edgeOffset.y = 0; break;
  7370. case 'bottom': edgeOffset.y = -dimensions.y - dimensions.computedTop - dimensions.computedBottom; break;
  7371. // center
  7372. default: edgeOffset.y = -(Math.round(dimensions.totalHeight / 2)); break;
  7373. }
  7374. position.x += edgeOffset.x;
  7375. position.y += edgeOffset.y;
  7376. },
  7377. getCoordinateFromValue: function(option){
  7378. if (typeOf(option) != 'string') return option;
  7379. option = option.toLowerCase();
  7380. return {
  7381. x: option.test('left') ? 'left'
  7382. : (option.test('right') ? 'right' : 'center'),
  7383. y: option.test(/upper|top/) ? 'top'
  7384. : (option.test('bottom') ? 'bottom' : 'center')
  7385. };
  7386. }
  7387. };
  7388. Element.implement({
  7389. position: function(options){
  7390. if (options && (options.x != null || options.y != null)){
  7391. return (original ? original.apply(this, arguments) : this);
  7392. }
  7393. var position = this.setStyle('position', 'absolute').calculatePosition(options);
  7394. return (options && options.returnPos) ? position : this.setStyles(position);
  7395. },
  7396. calculatePosition: function(options){
  7397. return local.getPosition(this, options);
  7398. }
  7399. });
  7400. })(Element.prototype.position);
  7401. /*
  7402. ---
  7403. script: Element.Shortcuts.js
  7404. name: Element.Shortcuts
  7405. description: Extends the Element native object to include some shortcut methods.
  7406. license: MIT-style license
  7407. authors:
  7408. - Aaron Newton
  7409. requires:
  7410. - Core/Element.Style
  7411. - MooTools.More
  7412. provides: [Element.Shortcuts]
  7413. ...
  7414. */
  7415. Element.implement({
  7416. isDisplayed: function(){
  7417. return this.getStyle('display') != 'none';
  7418. },
  7419. isVisible: function(){
  7420. var w = this.offsetWidth,
  7421. h = this.offsetHeight;
  7422. return (w == 0 && h == 0) ? false : (w > 0 && h > 0) ? true : this.style.display != 'none';
  7423. },
  7424. toggle: function(){
  7425. return this[this.isDisplayed() ? 'hide' : 'show']();
  7426. },
  7427. hide: function(){
  7428. var d;
  7429. try {
  7430. //IE fails here if the element is not in the dom
  7431. d = this.getStyle('display');
  7432. } catch (e){}
  7433. if (d == 'none') return this;
  7434. return this.store('element:_originalDisplay', d || '').setStyle('display', 'none');
  7435. },
  7436. show: function(display){
  7437. if (!display && this.isDisplayed()) return this;
  7438. display = display || this.retrieve('element:_originalDisplay') || 'block';
  7439. return this.setStyle('display', (display == 'none') ? 'block' : display);
  7440. },
  7441. swapClass: function(remove, add){
  7442. return this.removeClass(remove).addClass(add);
  7443. }
  7444. });
  7445. Document.implement({
  7446. clearSelection: function(){
  7447. if (window.getSelection){
  7448. var selection = window.getSelection();
  7449. if (selection && selection.removeAllRanges) selection.removeAllRanges();
  7450. } else if (document.selection && document.selection.empty){
  7451. try {
  7452. //IE fails here if selected element is not in dom
  7453. document.selection.empty();
  7454. } catch (e){}
  7455. }
  7456. }
  7457. });
  7458. /*
  7459. ---
  7460. script: Elements.From.js
  7461. name: Elements.From
  7462. description: Returns a collection of elements from a string of html.
  7463. license: MIT-style license
  7464. authors:
  7465. - Aaron Newton
  7466. requires:
  7467. - Core/String
  7468. - Core/Element
  7469. - MooTools.More
  7470. provides: [Elements.from, Elements.From]
  7471. ...
  7472. */
  7473. Elements.from = function(text, excludeScripts){
  7474. if (excludeScripts || excludeScripts == null) text = text.stripScripts();
  7475. var container, match = text.match(/^\s*(?:<!--.*?-->\s*)*<(t[dhr]|tbody|tfoot|thead)/i);
  7476. if (match){
  7477. container = new Element('table');
  7478. var tag = match[1].toLowerCase();
  7479. if (['td', 'th', 'tr'].contains(tag)){
  7480. container = new Element('tbody').inject(container);
  7481. if (tag != 'tr') container = new Element('tr').inject(container);
  7482. }
  7483. }
  7484. return (container || new Element('div')).set('html', text).getChildren();
  7485. };
  7486. /*
  7487. ---
  7488. script: IframeShim.js
  7489. name: IframeShim
  7490. description: Defines IframeShim, a class for obscuring select lists and flash objects in IE.
  7491. license: MIT-style license
  7492. authors:
  7493. - Aaron Newton
  7494. requires:
  7495. - Core/Element.Event
  7496. - Core/Element.Style
  7497. - Core/Options
  7498. - Core/Events
  7499. - Element.Position
  7500. - Class.Occlude
  7501. provides: [IframeShim]
  7502. ...
  7503. */
  7504. (function(){
  7505. var browsers = false;
  7506. //<1.4compat>
  7507. browsers = Browser.ie6 || (Browser.firefox && Browser.version < 3 && Browser.Platform.mac);
  7508. //</1.4compat>
  7509. var IframeShim = this.IframeShim = new Class({
  7510. Implements: [Options, Events, Class.Occlude],
  7511. options: {
  7512. className: 'iframeShim',
  7513. src: 'javascript:false;document.write("");',
  7514. display: false,
  7515. zIndex: null,
  7516. margin: 0,
  7517. offset: {x: 0, y: 0},
  7518. browsers: browsers
  7519. },
  7520. property: 'IframeShim',
  7521. initialize: function(element, options){
  7522. this.element = document.id(element);
  7523. if (this.occlude()) return this.occluded;
  7524. this.setOptions(options);
  7525. this.makeShim();
  7526. return this;
  7527. },
  7528. makeShim: function(){
  7529. if (this.options.browsers){
  7530. var zIndex = this.element.getStyle('zIndex').toInt();
  7531. if (!zIndex){
  7532. zIndex = 1;
  7533. var pos = this.element.getStyle('position');
  7534. if (pos == 'static' || !pos) this.element.setStyle('position', 'relative');
  7535. this.element.setStyle('zIndex', zIndex);
  7536. }
  7537. zIndex = ((this.options.zIndex != null || this.options.zIndex === 0) && zIndex > this.options.zIndex) ? this.options.zIndex : zIndex - 1;
  7538. if (zIndex < 0) zIndex = 1;
  7539. this.shim = new Element('iframe', {
  7540. src: this.options.src,
  7541. scrolling: 'no',
  7542. frameborder: 0,
  7543. styles: {
  7544. zIndex: zIndex,
  7545. position: 'absolute',
  7546. border: 'none',
  7547. filter: 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'
  7548. },
  7549. 'class': this.options.className
  7550. }).store('IframeShim', this);
  7551. var inject = (function(){
  7552. this.shim.inject(this.element, 'after');
  7553. this[this.options.display ? 'show' : 'hide']();
  7554. this.fireEvent('inject');
  7555. }).bind(this);
  7556. if (!IframeShim.ready) window.addEvent('load', inject);
  7557. else inject();
  7558. } else {
  7559. this.position = this.hide = this.show = this.dispose = Function.convert(this);
  7560. }
  7561. },
  7562. position: function(){
  7563. if (!IframeShim.ready || !this.shim) return this;
  7564. var size = this.element.measure(function(){
  7565. return this.getSize();
  7566. });
  7567. if (this.options.margin != undefined){
  7568. size.x = size.x - (this.options.margin * 2);
  7569. size.y = size.y - (this.options.margin * 2);
  7570. this.options.offset.x += this.options.margin;
  7571. this.options.offset.y += this.options.margin;
  7572. }
  7573. this.shim.set({width: size.x, height: size.y}).position({
  7574. relativeTo: this.element,
  7575. offset: this.options.offset
  7576. });
  7577. return this;
  7578. },
  7579. hide: function(){
  7580. if (this.shim) this.shim.setStyle('display', 'none');
  7581. return this;
  7582. },
  7583. show: function(){
  7584. if (this.shim) this.shim.setStyle('display', 'block');
  7585. return this.position();
  7586. },
  7587. dispose: function(){
  7588. if (this.shim) this.shim.dispose();
  7589. return this;
  7590. },
  7591. destroy: function(){
  7592. if (this.shim) this.shim.destroy();
  7593. return this;
  7594. }
  7595. });
  7596. })();
  7597. window.addEvent('load', function(){
  7598. IframeShim.ready = true;
  7599. });
  7600. /*
  7601. ---
  7602. script: Mask.js
  7603. name: Mask
  7604. description: Creates a mask element to cover another.
  7605. license: MIT-style license
  7606. authors:
  7607. - Aaron Newton
  7608. requires:
  7609. - Core/Options
  7610. - Core/Events
  7611. - Core/Element.Event
  7612. - Class.Binds
  7613. - Element.Position
  7614. - IframeShim
  7615. provides: [Mask]
  7616. ...
  7617. */
  7618. (function(){
  7619. var Mask = this.Mask = new Class({
  7620. Implements: [Options, Events],
  7621. Binds: ['position'],
  7622. options: {/*
  7623. onShow: function(){},
  7624. onHide: function(){},
  7625. onDestroy: function(){},
  7626. onClick: function(event){},
  7627. inject: {
  7628. where: 'after',
  7629. target: null,
  7630. },
  7631. hideOnClick: false,
  7632. id: null,
  7633. destroyOnHide: false,*/
  7634. style: {},
  7635. 'class': 'mask',
  7636. maskMargins: false,
  7637. useIframeShim: true,
  7638. iframeShimOptions: {}
  7639. },
  7640. initialize: function(target, options){
  7641. this.target = document.id(target) || document.id(document.body);
  7642. this.target.store('mask', this);
  7643. this.setOptions(options);
  7644. this.render();
  7645. this.inject();
  7646. },
  7647. render: function(){
  7648. this.element = new Element('div', {
  7649. 'class': this.options['class'],
  7650. id: this.options.id || 'mask-' + String.uniqueID(),
  7651. styles: Object.merge({}, this.options.style, {
  7652. display: 'none'
  7653. }),
  7654. events: {
  7655. click: function(event){
  7656. this.fireEvent('click', event);
  7657. if (this.options.hideOnClick) this.hide();
  7658. }.bind(this)
  7659. }
  7660. });
  7661. this.hidden = true;
  7662. },
  7663. toElement: function(){
  7664. return this.element;
  7665. },
  7666. inject: function(target, where){
  7667. where = where || (this.options.inject ? this.options.inject.where : '') || (this.target == document.body ? 'inside' : 'after');
  7668. target = target || (this.options.inject && this.options.inject.target) || this.target;
  7669. this.element.inject(target, where);
  7670. if (this.options.useIframeShim){
  7671. this.shim = new IframeShim(this.element, this.options.iframeShimOptions);
  7672. this.addEvents({
  7673. show: this.shim.show.bind(this.shim),
  7674. hide: this.shim.hide.bind(this.shim),
  7675. destroy: this.shim.destroy.bind(this.shim)
  7676. });
  7677. }
  7678. },
  7679. position: function(){
  7680. this.resize(this.options.width, this.options.height);
  7681. this.element.position({
  7682. relativeTo: this.target,
  7683. position: 'topLeft',
  7684. ignoreMargins: !this.options.maskMargins,
  7685. ignoreScroll: this.target == document.body
  7686. });
  7687. return this;
  7688. },
  7689. resize: function(x, y){
  7690. var opt = {
  7691. styles: ['padding', 'border']
  7692. };
  7693. if (this.options.maskMargins) opt.styles.push('margin');
  7694. var dim = this.target.getComputedSize(opt);
  7695. if (this.target == document.body){
  7696. this.element.setStyles({width: 0, height: 0});
  7697. var win = window.getScrollSize();
  7698. if (dim.totalHeight < win.y) dim.totalHeight = win.y;
  7699. if (dim.totalWidth < win.x) dim.totalWidth = win.x;
  7700. }
  7701. this.element.setStyles({
  7702. width: Array.pick([x, dim.totalWidth, dim.x]),
  7703. height: Array.pick([y, dim.totalHeight, dim.y])
  7704. });
  7705. return this;
  7706. },
  7707. show: function(){
  7708. if (!this.hidden) return this;
  7709. window.addEvent('resize', this.position);
  7710. this.position();
  7711. this.showMask.apply(this, arguments);
  7712. return this;
  7713. },
  7714. showMask: function(){
  7715. this.element.setStyle('display', 'block');
  7716. this.hidden = false;
  7717. this.fireEvent('show');
  7718. },
  7719. hide: function(){
  7720. if (this.hidden) return this;
  7721. window.removeEvent('resize', this.position);
  7722. this.hideMask.apply(this, arguments);
  7723. if (this.options.destroyOnHide) return this.destroy();
  7724. return this;
  7725. },
  7726. hideMask: function(){
  7727. this.element.setStyle('display', 'none');
  7728. this.hidden = true;
  7729. this.fireEvent('hide');
  7730. },
  7731. toggle: function(){
  7732. this[this.hidden ? 'show' : 'hide']();
  7733. },
  7734. destroy: function(){
  7735. this.hide();
  7736. this.element.destroy();
  7737. this.fireEvent('destroy');
  7738. this.target.eliminate('mask');
  7739. }
  7740. });
  7741. })();
  7742. Element.Properties.mask = {
  7743. set: function(options){
  7744. var mask = this.retrieve('mask');
  7745. if (mask) mask.destroy();
  7746. return this.eliminate('mask').store('mask:options', options);
  7747. },
  7748. get: function(){
  7749. var mask = this.retrieve('mask');
  7750. if (!mask){
  7751. mask = new Mask(this, this.retrieve('mask:options'));
  7752. this.store('mask', mask);
  7753. }
  7754. return mask;
  7755. }
  7756. };
  7757. Element.implement({
  7758. mask: function(options){
  7759. if (options) this.set('mask', options);
  7760. this.get('mask').show();
  7761. return this;
  7762. },
  7763. unmask: function(){
  7764. this.get('mask').hide();
  7765. return this;
  7766. }
  7767. });
  7768. /*
  7769. ---
  7770. script: Spinner.js
  7771. name: Spinner
  7772. description: Adds a semi-transparent overlay over a dom element with a spinnin ajax icon.
  7773. license: MIT-style license
  7774. authors:
  7775. - Aaron Newton
  7776. requires:
  7777. - Core/Fx.Tween
  7778. - Core/Request
  7779. - Class.refactor
  7780. - Mask
  7781. provides: [Spinner]
  7782. ...
  7783. */
  7784. (function(){
  7785. var Spinner = this.Spinner = new Class({
  7786. Extends: this.Mask,
  7787. Implements: Chain,
  7788. options: {/*
  7789. message: false,*/
  7790. 'class': 'spinner',
  7791. containerPosition: {},
  7792. content: {
  7793. 'class': 'spinner-content'
  7794. },
  7795. messageContainer: {
  7796. 'class': 'spinner-msg'
  7797. },
  7798. img: {
  7799. 'class': 'spinner-img'
  7800. },
  7801. fxOptions: {
  7802. link: 'chain'
  7803. }
  7804. },
  7805. initialize: function(target, options){
  7806. this.target = document.id(target) || document.id(document.body);
  7807. this.target.store('spinner', this);
  7808. this.setOptions(options);
  7809. this.render();
  7810. this.inject();
  7811. // Add this to events for when noFx is true; parent methods handle hide/show.
  7812. var deactivate = function(){ this.active = false; }.bind(this);
  7813. this.addEvents({
  7814. hide: deactivate,
  7815. show: deactivate
  7816. });
  7817. },
  7818. render: function(){
  7819. this.parent();
  7820. this.element.set('id', this.options.id || 'spinner-' + String.uniqueID());
  7821. this.content = document.id(this.options.content) || new Element('div', this.options.content);
  7822. this.content.inject(this.element);
  7823. if (this.options.message){
  7824. this.msg = document.id(this.options.message) || new Element('p', this.options.messageContainer).appendText(this.options.message);
  7825. this.msg.inject(this.content);
  7826. }
  7827. if (this.options.img){
  7828. this.img = document.id(this.options.img) || new Element('div', this.options.img);
  7829. this.img.inject(this.content);
  7830. }
  7831. this.element.set('tween', this.options.fxOptions);
  7832. },
  7833. show: function(noFx){
  7834. if (this.active) return this.chain(this.show.bind(this));
  7835. if (!this.hidden){
  7836. this.callChain.delay(20, this);
  7837. return this;
  7838. }
  7839. this.target.set('aria-busy', 'true');
  7840. this.active = true;
  7841. return this.parent(noFx);
  7842. },
  7843. showMask: function(noFx){
  7844. var pos = function(){
  7845. this.content.position(Object.merge({
  7846. relativeTo: this.element
  7847. }, this.options.containerPosition));
  7848. }.bind(this);
  7849. if (noFx){
  7850. this.parent();
  7851. pos();
  7852. } else {
  7853. if (!this.options.style.opacity) this.options.style.opacity = this.element.getStyle('opacity').toFloat();
  7854. this.element.setStyles({
  7855. display: 'block',
  7856. opacity: 0
  7857. }).tween('opacity', this.options.style.opacity);
  7858. pos();
  7859. this.hidden = false;
  7860. this.fireEvent('show');
  7861. this.callChain();
  7862. }
  7863. },
  7864. hide: function(noFx){
  7865. if (this.active) return this.chain(this.hide.bind(this));
  7866. if (this.hidden){
  7867. this.callChain.delay(20, this);
  7868. return this;
  7869. }
  7870. this.target.set('aria-busy', 'false');
  7871. this.active = true;
  7872. return this.parent(noFx);
  7873. },
  7874. hideMask: function(noFx){
  7875. if (noFx) return this.parent();
  7876. this.element.tween('opacity', 0).get('tween').chain(function(){
  7877. this.element.setStyle('display', 'none');
  7878. this.hidden = true;
  7879. this.fireEvent('hide');
  7880. this.callChain();
  7881. }.bind(this));
  7882. },
  7883. destroy: function(){
  7884. this.content.destroy();
  7885. this.parent();
  7886. this.target.eliminate('spinner');
  7887. }
  7888. });
  7889. })();
  7890. Request = Class.refactor(Request, {
  7891. options: {
  7892. useSpinner: false,
  7893. spinnerOptions: {},
  7894. spinnerTarget: false
  7895. },
  7896. initialize: function(options){
  7897. this._send = this.send;
  7898. this.send = function(options){
  7899. var spinner = this.getSpinner();
  7900. if (spinner) spinner.chain(this._send.pass(options, this)).show();
  7901. else this._send(options);
  7902. return this;
  7903. };
  7904. this.previous(options);
  7905. },
  7906. getSpinner: function(){
  7907. if (!this.spinner){
  7908. var update = document.id(this.options.spinnerTarget) || document.id(this.options.update);
  7909. if (this.options.useSpinner && update){
  7910. update.set('spinner', this.options.spinnerOptions);
  7911. var spinner = this.spinner = update.get('spinner');
  7912. ['complete', 'exception', 'cancel'].each(function(event){
  7913. this.addEvent(event, spinner.hide.bind(spinner));
  7914. }, this);
  7915. }
  7916. }
  7917. return this.spinner;
  7918. }
  7919. });
  7920. Element.Properties.spinner = {
  7921. set: function(options){
  7922. var spinner = this.retrieve('spinner');
  7923. if (spinner) spinner.destroy();
  7924. return this.eliminate('spinner').store('spinner:options', options);
  7925. },
  7926. get: function(){
  7927. var spinner = this.retrieve('spinner');
  7928. if (!spinner){
  7929. spinner = new Spinner(this, this.retrieve('spinner:options'));
  7930. this.store('spinner', spinner);
  7931. }
  7932. return spinner;
  7933. }
  7934. };
  7935. Element.implement({
  7936. spin: function(options){
  7937. if (options) this.set('spinner', options);
  7938. this.get('spinner').show();
  7939. return this;
  7940. },
  7941. unspin: function(){
  7942. this.get('spinner').hide();
  7943. return this;
  7944. }
  7945. });
  7946. /*
  7947. ---
  7948. script: String.QueryString.js
  7949. name: String.QueryString
  7950. description: Methods for dealing with URI query strings.
  7951. license: MIT-style license
  7952. authors:
  7953. - Sebastian Markbåge
  7954. - Aaron Newton
  7955. - Lennart Pilon
  7956. - Valerio Proietti
  7957. requires:
  7958. - Core/Array
  7959. - Core/String
  7960. - MooTools.More
  7961. provides: [String.QueryString]
  7962. ...
  7963. */
  7964. (function(){
  7965. /**
  7966. * decodeURIComponent doesn't do the correct thing with query parameter keys or
  7967. * values. Specifically, it leaves '+' as '+' when it should be converting them
  7968. * to spaces as that's the specification. When browsers submit HTML forms via
  7969. * GET, the values are encoded using 'application/x-www-form-urlencoded'
  7970. * which converts spaces to '+'.
  7971. *
  7972. * See: http://unixpapa.com/js/querystring.html for a description of the
  7973. * problem.
  7974. */
  7975. var decodeComponent = function(str){
  7976. return decodeURIComponent(str.replace(/\+/g, ' '));
  7977. };
  7978. String.implement({
  7979. parseQueryString: function(decodeKeys, decodeValues){
  7980. if (decodeKeys == null) decodeKeys = true;
  7981. if (decodeValues == null) decodeValues = true;
  7982. var vars = this.split(/[&;]/),
  7983. object = {};
  7984. if (!vars.length) return object;
  7985. vars.each(function(val){
  7986. var index = val.indexOf('=') + 1,
  7987. value = index ? val.substr(index) : '',
  7988. keys = index ? val.substr(0, index - 1).match(/([^\]\[]+|(\B)(?=\]))/g) : [val],
  7989. obj = object;
  7990. if (!keys) return;
  7991. if (decodeValues) value = decodeComponent(value);
  7992. keys.each(function(key, i){
  7993. if (decodeKeys) key = decodeComponent(key);
  7994. var current = obj[key];
  7995. if (i < keys.length - 1) obj = obj[key] = current || {};
  7996. else if (typeOf(current) == 'array') current.push(value);
  7997. else obj[key] = current != null ? [current, value] : value;
  7998. });
  7999. });
  8000. return object;
  8001. },
  8002. cleanQueryString: function(method){
  8003. return this.split('&').filter(function(val){
  8004. var index = val.indexOf('='),
  8005. key = index < 0 ? '' : val.substr(0, index),
  8006. value = val.substr(index + 1);
  8007. return method ? method.call(null, key, value) : (value || value === 0);
  8008. }).join('&');
  8009. }
  8010. });
  8011. })();
  8012. /*
  8013. ---
  8014. script: Form.Request.js
  8015. name: Form.Request
  8016. description: Handles the basic functionality of submitting a form and updating a dom element with the result.
  8017. license: MIT-style license
  8018. authors:
  8019. - Aaron Newton
  8020. requires:
  8021. - Core/Request.HTML
  8022. - Class.Binds
  8023. - Class.Occlude
  8024. - Spinner
  8025. - String.QueryString
  8026. - Element.Delegation.Pseudo
  8027. provides: [Form.Request]
  8028. ...
  8029. */
  8030. if (!window.Form) window.Form = {};
  8031. (function(){
  8032. Form.Request = new Class({
  8033. Binds: ['onSubmit', 'onFormValidate'],
  8034. Implements: [Options, Events, Class.Occlude],
  8035. options: {/*
  8036. onFailure: function(){},
  8037. onSuccess: function(){}, // aliased to onComplete,
  8038. onSend: function(){}*/
  8039. requestOptions: {
  8040. evalScripts: true,
  8041. useSpinner: true,
  8042. emulation: false,
  8043. link: 'ignore'
  8044. },
  8045. sendButtonClicked: true,
  8046. extraData: {},
  8047. resetForm: true
  8048. },
  8049. property: 'form.request',
  8050. initialize: function(form, target, options){
  8051. this.element = document.id(form);
  8052. if (this.occlude()) return this.occluded;
  8053. this.setOptions(options)
  8054. .setTarget(target)
  8055. .attach();
  8056. },
  8057. setTarget: function(target){
  8058. this.target = document.id(target);
  8059. if (!this.request){
  8060. this.makeRequest();
  8061. } else {
  8062. this.request.setOptions({
  8063. update: this.target
  8064. });
  8065. }
  8066. return this;
  8067. },
  8068. toElement: function(){
  8069. return this.element;
  8070. },
  8071. makeRequest: function(){
  8072. var self = this;
  8073. this.request = new Request.HTML(Object.merge({
  8074. update: this.target,
  8075. emulation: false,
  8076. spinnerTarget: this.element,
  8077. method: this.element.get('method') || 'post'
  8078. }, this.options.requestOptions)).addEvents({
  8079. success: function(tree, elements, html, javascript){
  8080. ['complete', 'success'].each(function(evt){
  8081. self.fireEvent(evt, [self.target, tree, elements, html, javascript]);
  8082. });
  8083. },
  8084. failure: function(){
  8085. self.fireEvent('complete', arguments).fireEvent('failure', arguments);
  8086. },
  8087. exception: function(){
  8088. self.fireEvent('failure', arguments);
  8089. }
  8090. });
  8091. return this.attachReset();
  8092. },
  8093. attachReset: function(){
  8094. if (!this.options.resetForm) return this;
  8095. this.request.addEvent('success', function(){
  8096. Function.attempt(function(){
  8097. this.element.reset();
  8098. }.bind(this));
  8099. if (window.OverText) OverText.update();
  8100. }.bind(this));
  8101. return this;
  8102. },
  8103. attach: function(attach){
  8104. var method = (attach != false) ? 'addEvent' : 'removeEvent';
  8105. this.element[method]('click:relay(button, input[type=submit])', this.saveClickedButton.bind(this));
  8106. var fv = this.element.retrieve('validator');
  8107. if (fv) fv[method]('onFormValidate', this.onFormValidate);
  8108. else this.element[method]('submit', this.onSubmit);
  8109. return this;
  8110. },
  8111. detach: function(){
  8112. return this.attach(false);
  8113. },
  8114. //public method
  8115. enable: function(){
  8116. return this.attach();
  8117. },
  8118. //public method
  8119. disable: function(){
  8120. return this.detach();
  8121. },
  8122. onFormValidate: function(valid, form, event){
  8123. //if there's no event, then this wasn't a submit event
  8124. if (!event) return;
  8125. var fv = this.element.retrieve('validator');
  8126. if (valid || (fv && !fv.options.stopOnFailure)){
  8127. event.stop();
  8128. this.send();
  8129. }
  8130. },
  8131. onSubmit: function(event){
  8132. var fv = this.element.retrieve('validator');
  8133. if (fv){
  8134. //form validator was created after Form.Request
  8135. this.element.removeEvent('submit', this.onSubmit);
  8136. fv.addEvent('onFormValidate', this.onFormValidate);
  8137. fv.validate(event);
  8138. return;
  8139. }
  8140. if (event) event.stop();
  8141. this.send();
  8142. },
  8143. saveClickedButton: function(event, target){
  8144. var targetName = target.get('name');
  8145. if (!targetName || !this.options.sendButtonClicked) return;
  8146. this.options.extraData[targetName] = target.get('value') || true;
  8147. this.clickedCleaner = function(){
  8148. delete this.options.extraData[targetName];
  8149. this.clickedCleaner = function(){};
  8150. }.bind(this);
  8151. },
  8152. clickedCleaner: function(){},
  8153. send: function(){
  8154. var str = this.element.toQueryString().trim(),
  8155. data = Object.toQueryString(this.options.extraData);
  8156. if (str) str += '&' + data;
  8157. else str = data;
  8158. this.fireEvent('send', [this.element, str.parseQueryString()]);
  8159. this.request.send({
  8160. data: str,
  8161. url: this.options.requestOptions.url || this.element.get('action')
  8162. });
  8163. this.clickedCleaner();
  8164. return this;
  8165. }
  8166. });
  8167. Element.implement('formUpdate', function(update, options){
  8168. var fq = this.retrieve('form.request');
  8169. if (!fq){
  8170. fq = new Form.Request(this, update, options);
  8171. } else {
  8172. if (update) fq.setTarget(update);
  8173. if (options) fq.setOptions(options).makeRequest();
  8174. }
  8175. fq.send();
  8176. return this;
  8177. });
  8178. })();
  8179. /*
  8180. ---
  8181. script: Fx.Reveal.js
  8182. name: Fx.Reveal
  8183. description: Defines Fx.Reveal, a class that shows and hides elements with a transition.
  8184. license: MIT-style license
  8185. authors:
  8186. - Aaron Newton
  8187. requires:
  8188. - Core/Fx.Morph
  8189. - Element.Shortcuts
  8190. - Element.Measure
  8191. provides: [Fx.Reveal]
  8192. ...
  8193. */
  8194. (function(){
  8195. var hideTheseOf = function(object){
  8196. var hideThese = object.options.hideInputs;
  8197. if (window.OverText){
  8198. var otClasses = [null];
  8199. OverText.each(function(ot){
  8200. otClasses.include('.' + ot.options.labelClass);
  8201. });
  8202. if (otClasses) hideThese += otClasses.join(', ');
  8203. }
  8204. return (hideThese) ? object.element.getElements(hideThese) : null;
  8205. };
  8206. Fx.Reveal = new Class({
  8207. Extends: Fx.Morph,
  8208. options: {/*
  8209. onShow: function(thisElement){},
  8210. onHide: function(thisElement){},
  8211. onComplete: function(thisElement){},
  8212. heightOverride: null,
  8213. widthOverride: null,*/
  8214. link: 'cancel',
  8215. styles: ['padding', 'border', 'margin'],
  8216. transitionOpacity: 'opacity' in document.documentElement,
  8217. mode: 'vertical',
  8218. display: function(){
  8219. return this.element.get('tag') != 'tr' ? 'block' : 'table-row';
  8220. },
  8221. opacity: 1,
  8222. hideInputs: !('opacity' in document.documentElement) ? 'select, input, textarea, object, embed' : null
  8223. },
  8224. dissolve: function(){
  8225. if (!this.hiding && !this.showing){
  8226. if (this.element.getStyle('display') != 'none'){
  8227. this.hiding = true;
  8228. this.showing = false;
  8229. this.hidden = true;
  8230. this.cssText = this.element.style.cssText;
  8231. var startStyles = this.element.getComputedSize({
  8232. styles: this.options.styles,
  8233. mode: this.options.mode
  8234. });
  8235. if (this.options.transitionOpacity) startStyles.opacity = this.options.opacity;
  8236. var zero = {};
  8237. Object.each(startStyles, function(style, name){
  8238. zero[name] = [style, 0];
  8239. });
  8240. this.element.setStyles({
  8241. display: Function.convert(this.options.display).call(this),
  8242. overflow: 'hidden'
  8243. });
  8244. var hideThese = hideTheseOf(this);
  8245. if (hideThese) hideThese.setStyle('visibility', 'hidden');
  8246. this.$chain.unshift(function(){
  8247. if (this.hidden){
  8248. this.hiding = false;
  8249. this.element.style.cssText = this.cssText;
  8250. this.element.setStyle('display', 'none');
  8251. if (hideThese) hideThese.setStyle('visibility', 'visible');
  8252. }
  8253. this.fireEvent('hide', this.element);
  8254. this.callChain();
  8255. }.bind(this));
  8256. this.start(zero);
  8257. } else {
  8258. this.callChain.delay(10, this);
  8259. this.fireEvent('complete', this.element);
  8260. this.fireEvent('hide', this.element);
  8261. }
  8262. } else if (this.options.link == 'chain'){
  8263. this.chain(this.dissolve.bind(this));
  8264. } else if (this.options.link == 'cancel' && !this.hiding){
  8265. this.cancel();
  8266. this.dissolve();
  8267. }
  8268. return this;
  8269. },
  8270. reveal: function(){
  8271. if (!this.showing && !this.hiding){
  8272. if (this.element.getStyle('display') == 'none'){
  8273. this.hiding = false;
  8274. this.showing = true;
  8275. this.hidden = false;
  8276. this.cssText = this.element.style.cssText;
  8277. var startStyles;
  8278. this.element.measure(function(){
  8279. startStyles = this.element.getComputedSize({
  8280. styles: this.options.styles,
  8281. mode: this.options.mode
  8282. });
  8283. }.bind(this));
  8284. if (this.options.heightOverride != null) startStyles.height = this.options.heightOverride.toInt();
  8285. if (this.options.widthOverride != null) startStyles.width = this.options.widthOverride.toInt();
  8286. if (this.options.transitionOpacity){
  8287. this.element.setStyle('opacity', 0);
  8288. startStyles.opacity = this.options.opacity;
  8289. }
  8290. var zero = {
  8291. height: 0,
  8292. display: Function.convert(this.options.display).call(this)
  8293. };
  8294. Object.each(startStyles, function(style, name){
  8295. zero[name] = 0;
  8296. });
  8297. zero.overflow = 'hidden';
  8298. this.element.setStyles(zero);
  8299. var hideThese = hideTheseOf(this);
  8300. if (hideThese) hideThese.setStyle('visibility', 'hidden');
  8301. this.$chain.unshift(function(){
  8302. this.element.style.cssText = this.cssText;
  8303. this.element.setStyle('display', Function.convert(this.options.display).call(this));
  8304. if (!this.hidden) this.showing = false;
  8305. if (hideThese) hideThese.setStyle('visibility', 'visible');
  8306. this.callChain();
  8307. this.fireEvent('show', this.element);
  8308. }.bind(this));
  8309. this.start(startStyles);
  8310. } else {
  8311. this.callChain();
  8312. this.fireEvent('complete', this.element);
  8313. this.fireEvent('show', this.element);
  8314. }
  8315. } else if (this.options.link == 'chain'){
  8316. this.chain(this.reveal.bind(this));
  8317. } else if (this.options.link == 'cancel' && !this.showing){
  8318. this.cancel();
  8319. this.reveal();
  8320. }
  8321. return this;
  8322. },
  8323. toggle: function(){
  8324. if (this.element.getStyle('display') == 'none'){
  8325. this.reveal();
  8326. } else {
  8327. this.dissolve();
  8328. }
  8329. return this;
  8330. },
  8331. cancel: function(){
  8332. this.parent.apply(this, arguments);
  8333. if (this.cssText != null) this.element.style.cssText = this.cssText;
  8334. this.hiding = false;
  8335. this.showing = false;
  8336. return this;
  8337. }
  8338. });
  8339. Element.Properties.reveal = {
  8340. set: function(options){
  8341. this.get('reveal').cancel().setOptions(options);
  8342. return this;
  8343. },
  8344. get: function(){
  8345. var reveal = this.retrieve('reveal');
  8346. if (!reveal){
  8347. reveal = new Fx.Reveal(this);
  8348. this.store('reveal', reveal);
  8349. }
  8350. return reveal;
  8351. }
  8352. };
  8353. Element.Properties.dissolve = Element.Properties.reveal;
  8354. Element.implement({
  8355. reveal: function(options){
  8356. this.get('reveal').setOptions(options).reveal();
  8357. return this;
  8358. },
  8359. dissolve: function(options){
  8360. this.get('reveal').setOptions(options).dissolve();
  8361. return this;
  8362. },
  8363. nix: function(options){
  8364. var params = Array.link(arguments, {destroy: Type.isBoolean, options: Type.isObject});
  8365. this.get('reveal').setOptions(options).dissolve().chain(function(){
  8366. this[params.destroy ? 'destroy' : 'dispose']();
  8367. }.bind(this));
  8368. return this;
  8369. },
  8370. wink: function(){
  8371. var params = Array.link(arguments, {duration: Type.isNumber, options: Type.isObject});
  8372. var reveal = this.get('reveal').setOptions(params.options);
  8373. reveal.reveal().chain(function(){
  8374. (function(){
  8375. reveal.dissolve();
  8376. }).delay(params.duration || 2000);
  8377. });
  8378. }
  8379. });
  8380. })();
  8381. /*
  8382. ---
  8383. script: Form.Request.Append.js
  8384. name: Form.Request.Append
  8385. description: Handles the basic functionality of submitting a form and updating a dom element with the result. The result is appended to the DOM element instead of replacing its contents.
  8386. license: MIT-style license
  8387. authors:
  8388. - Aaron Newton
  8389. requires:
  8390. - Form.Request
  8391. - Fx.Reveal
  8392. - Elements.from
  8393. provides: [Form.Request.Append]
  8394. ...
  8395. */
  8396. Form.Request.Append = new Class({
  8397. Extends: Form.Request,
  8398. options: {
  8399. //onBeforeEffect: function(){},
  8400. useReveal: true,
  8401. revealOptions: {},
  8402. inject: 'bottom'
  8403. },
  8404. makeRequest: function(){
  8405. this.request = new Request.HTML(Object.merge({
  8406. url: this.element.get('action'),
  8407. method: this.element.get('method') || 'post',
  8408. spinnerTarget: this.element
  8409. }, this.options.requestOptions, {
  8410. evalScripts: false
  8411. })).addEvents({
  8412. success: function(tree, elements, html, javascript){
  8413. var container;
  8414. var kids = Elements.from(html);
  8415. if (kids.length == 1){
  8416. container = kids[0];
  8417. } else {
  8418. container = new Element('div', {
  8419. styles: {
  8420. display: 'none'
  8421. }
  8422. }).adopt(kids);
  8423. }
  8424. container.inject(this.target, this.options.inject);
  8425. if (this.options.requestOptions.evalScripts) Browser.exec(javascript);
  8426. this.fireEvent('beforeEffect', container);
  8427. var finish = function(){
  8428. this.fireEvent('success', [container, this.target, tree, elements, html, javascript]);
  8429. }.bind(this);
  8430. if (this.options.useReveal){
  8431. container.set('reveal', this.options.revealOptions).get('reveal').chain(finish);
  8432. container.reveal();
  8433. } else {
  8434. finish();
  8435. }
  8436. }.bind(this),
  8437. failure: function(xhr){
  8438. this.fireEvent('failure', xhr);
  8439. }.bind(this)
  8440. });
  8441. this.attachReset();
  8442. }
  8443. });
  8444. /*
  8445. ---
  8446. script: Object.Extras.js
  8447. name: Object.Extras
  8448. description: Extra Object generics, like getFromPath which allows a path notation to child elements.
  8449. license: MIT-style license
  8450. authors:
  8451. - Aaron Newton
  8452. requires:
  8453. - Core/Object
  8454. - MooTools.More
  8455. provides: [Object.Extras]
  8456. ...
  8457. */
  8458. (function(){
  8459. var defined = function(value){
  8460. return value != null;
  8461. };
  8462. var hasOwnProperty = Object.prototype.hasOwnProperty;
  8463. Object.extend({
  8464. getFromPath: function(source, parts){
  8465. if (typeof parts == 'string') parts = parts.split('.');
  8466. for (var i = 0, l = parts.length; i < l; i++){
  8467. if (hasOwnProperty.call(source, parts[i])) source = source[parts[i]];
  8468. else return null;
  8469. }
  8470. return source;
  8471. },
  8472. cleanValues: function(object, method){
  8473. method = method || defined;
  8474. for (var key in object) if (!method(object[key])){
  8475. delete object[key];
  8476. }
  8477. return object;
  8478. },
  8479. erase: function(object, key){
  8480. if (hasOwnProperty.call(object, key)) delete object[key];
  8481. return object;
  8482. },
  8483. run: function(object){
  8484. var args = Array.slice(arguments, 1);
  8485. for (var key in object) if (object[key].apply){
  8486. object[key].apply(object, args);
  8487. }
  8488. return object;
  8489. }
  8490. });
  8491. })();
  8492. /*
  8493. ---
  8494. script: Locale.js
  8495. name: Locale
  8496. description: Provides methods for localization.
  8497. license: MIT-style license
  8498. authors:
  8499. - Aaron Newton
  8500. - Arian Stolwijk
  8501. requires:
  8502. - Core/Events
  8503. - Object.Extras
  8504. - MooTools.More
  8505. provides: [Locale, Lang]
  8506. ...
  8507. */
  8508. (function(){
  8509. var current = null,
  8510. locales = {},
  8511. inherits = {};
  8512. var getSet = function(set){
  8513. if (instanceOf(set, Locale.Set)) return set;
  8514. else return locales[set];
  8515. };
  8516. var Locale = this.Locale = {
  8517. define: function(locale, set, key, value){
  8518. var name;
  8519. if (instanceOf(locale, Locale.Set)){
  8520. name = locale.name;
  8521. if (name) locales[name] = locale;
  8522. } else {
  8523. name = locale;
  8524. if (!locales[name]) locales[name] = new Locale.Set(name);
  8525. locale = locales[name];
  8526. }
  8527. if (set) locale.define(set, key, value);
  8528. /*<1.2compat>*/
  8529. if (set == 'cascade') return Locale.inherit(name, key);
  8530. /*</1.2compat>*/
  8531. if (!current) current = locale;
  8532. return locale;
  8533. },
  8534. use: function(locale){
  8535. locale = getSet(locale);
  8536. if (locale){
  8537. current = locale;
  8538. this.fireEvent('change', locale);
  8539. /*<1.2compat>*/
  8540. this.fireEvent('langChange', locale.name);
  8541. /*</1.2compat>*/
  8542. }
  8543. return this;
  8544. },
  8545. getCurrent: function(){
  8546. return current;
  8547. },
  8548. get: function(key, args){
  8549. return (current) ? current.get(key, args) : '';
  8550. },
  8551. inherit: function(locale, inherits, set){
  8552. locale = getSet(locale);
  8553. if (locale) locale.inherit(inherits, set);
  8554. return this;
  8555. },
  8556. list: function(){
  8557. return Object.keys(locales);
  8558. }
  8559. };
  8560. Object.append(Locale, new Events);
  8561. Locale.Set = new Class({
  8562. sets: {},
  8563. inherits: {
  8564. locales: [],
  8565. sets: {}
  8566. },
  8567. initialize: function(name){
  8568. this.name = name || '';
  8569. },
  8570. define: function(set, key, value){
  8571. var defineData = this.sets[set];
  8572. if (!defineData) defineData = {};
  8573. if (key){
  8574. if (typeOf(key) == 'object') defineData = Object.merge(defineData, key);
  8575. else defineData[key] = value;
  8576. }
  8577. this.sets[set] = defineData;
  8578. return this;
  8579. },
  8580. get: function(key, args, _base){
  8581. var value = Object.getFromPath(this.sets, key);
  8582. if (value != null){
  8583. var type = typeOf(value);
  8584. if (type == 'function') value = value.apply(null, Array.convert(args));
  8585. else if (type == 'object') value = Object.clone(value);
  8586. return value;
  8587. }
  8588. // get value of inherited locales
  8589. var index = key.indexOf('.'),
  8590. set = index < 0 ? key : key.substr(0, index),
  8591. names = (this.inherits.sets[set] || []).combine(this.inherits.locales).include('en-US');
  8592. if (!_base) _base = [];
  8593. for (var i = 0, l = names.length; i < l; i++){
  8594. if (_base.contains(names[i])) continue;
  8595. _base.include(names[i]);
  8596. var locale = locales[names[i]];
  8597. if (!locale) continue;
  8598. value = locale.get(key, args, _base);
  8599. if (value != null) return value;
  8600. }
  8601. return '';
  8602. },
  8603. inherit: function(names, set){
  8604. names = Array.convert(names);
  8605. if (set && !this.inherits.sets[set]) this.inherits.sets[set] = [];
  8606. var l = names.length;
  8607. while (l--) (set ? this.inherits.sets[set] : this.inherits.locales).unshift(names[l]);
  8608. return this;
  8609. }
  8610. });
  8611. /*<1.2compat>*/
  8612. var lang = MooTools.lang = {};
  8613. Object.append(lang, Locale, {
  8614. setLanguage: Locale.use,
  8615. getCurrentLanguage: function(){
  8616. var current = Locale.getCurrent();
  8617. return (current) ? current.name : null;
  8618. },
  8619. set: function(){
  8620. Locale.define.apply(this, arguments);
  8621. return this;
  8622. },
  8623. get: function(set, key, args){
  8624. if (key) set += '.' + key;
  8625. return Locale.get(set, args);
  8626. }
  8627. });
  8628. /*</1.2compat>*/
  8629. })();
  8630. /*
  8631. ---
  8632. name: Locale.en-US.Date
  8633. description: Date messages for US English.
  8634. license: MIT-style license
  8635. authors:
  8636. - Aaron Newton
  8637. requires:
  8638. - Locale
  8639. provides: [Locale.en-US.Date]
  8640. ...
  8641. */
  8642. Locale.define('en-US', 'Date', {
  8643. months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
  8644. months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  8645. days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  8646. days_abbr: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8647. // Culture's date order: MM/DD/YYYY
  8648. dateOrder: ['month', 'date', 'year'],
  8649. shortDate: '%m/%d/%Y',
  8650. shortTime: '%I:%M%p',
  8651. AM: 'AM',
  8652. PM: 'PM',
  8653. firstDayOfWeek: 0,
  8654. // Date.Extras
  8655. ordinal: function(dayOfMonth){
  8656. // 1st, 2nd, 3rd, etc.
  8657. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'th' : ['th', 'st', 'nd', 'rd', 'th'][Math.min(dayOfMonth % 10, 4)];
  8658. },
  8659. lessThanMinuteAgo: 'less than a minute ago',
  8660. minuteAgo: 'about a minute ago',
  8661. minutesAgo: '{delta} minutes ago',
  8662. hourAgo: 'about an hour ago',
  8663. hoursAgo: 'about {delta} hours ago',
  8664. dayAgo: '1 day ago',
  8665. daysAgo: '{delta} days ago',
  8666. weekAgo: '1 week ago',
  8667. weeksAgo: '{delta} weeks ago',
  8668. monthAgo: '1 month ago',
  8669. monthsAgo: '{delta} months ago',
  8670. yearAgo: '1 year ago',
  8671. yearsAgo: '{delta} years ago',
  8672. lessThanMinuteUntil: 'less than a minute from now',
  8673. minuteUntil: 'about a minute from now',
  8674. minutesUntil: '{delta} minutes from now',
  8675. hourUntil: 'about an hour from now',
  8676. hoursUntil: 'about {delta} hours from now',
  8677. dayUntil: '1 day from now',
  8678. daysUntil: '{delta} days from now',
  8679. weekUntil: '1 week from now',
  8680. weeksUntil: '{delta} weeks from now',
  8681. monthUntil: '1 month from now',
  8682. monthsUntil: '{delta} months from now',
  8683. yearUntil: '1 year from now',
  8684. yearsUntil: '{delta} years from now'
  8685. });
  8686. /*
  8687. ---
  8688. script: Date.js
  8689. name: Date
  8690. description: Extends the Date native object to include methods useful in managing dates.
  8691. license: MIT-style license
  8692. authors:
  8693. - Aaron Newton
  8694. - Nicholas Barthelemy - https://svn.nbarthelemy.com/date-js/
  8695. - Harald Kirshner - mail [at] digitarald.de; http://digitarald.de
  8696. - Scott Kyle - scott [at] appden.com; http://appden.com
  8697. requires:
  8698. - Core/Array
  8699. - Core/String
  8700. - Core/Number
  8701. - MooTools.More
  8702. - Locale
  8703. - Locale.en-US.Date
  8704. provides: [Date]
  8705. ...
  8706. */
  8707. (function(){
  8708. var Date = this.Date;
  8709. var DateMethods = Date.Methods = {
  8710. ms: 'Milliseconds',
  8711. year: 'FullYear',
  8712. min: 'Minutes',
  8713. mo: 'Month',
  8714. sec: 'Seconds',
  8715. hr: 'Hours'
  8716. };
  8717. [
  8718. 'Date', 'Day', 'FullYear', 'Hours', 'Milliseconds', 'Minutes', 'Month', 'Seconds', 'Time', 'TimezoneOffset',
  8719. 'Week', 'Timezone', 'GMTOffset', 'DayOfYear', 'LastMonth', 'LastDayOfMonth', 'UTCDate', 'UTCDay', 'UTCFullYear',
  8720. 'AMPM', 'Ordinal', 'UTCHours', 'UTCMilliseconds', 'UTCMinutes', 'UTCMonth', 'UTCSeconds', 'UTCMilliseconds'
  8721. ].each(function(method){
  8722. Date.Methods[method.toLowerCase()] = method;
  8723. });
  8724. var pad = function(n, digits, string){
  8725. if (digits == 1) return n;
  8726. return n < Math.pow(10, digits - 1) ? (string || '0') + pad(n, digits - 1, string) : n;
  8727. };
  8728. Date.implement({
  8729. set: function(prop, value){
  8730. prop = prop.toLowerCase();
  8731. var method = DateMethods[prop] && 'set' + DateMethods[prop];
  8732. if (method && this[method]) this[method](value);
  8733. return this;
  8734. }.overloadSetter(),
  8735. get: function(prop){
  8736. prop = prop.toLowerCase();
  8737. var method = DateMethods[prop] && 'get' + DateMethods[prop];
  8738. if (method && this[method]) return this[method]();
  8739. return null;
  8740. }.overloadGetter(),
  8741. clone: function(){
  8742. return new Date(this.get('time'));
  8743. },
  8744. increment: function(interval, times){
  8745. interval = interval || 'day';
  8746. times = times != null ? times : 1;
  8747. switch (interval){
  8748. case 'year':
  8749. return this.increment('month', times * 12);
  8750. case 'month':
  8751. var d = this.get('date');
  8752. this.set('date', 1).set('mo', this.get('mo') + times);
  8753. return this.set('date', d.min(this.get('lastdayofmonth')));
  8754. case 'week':
  8755. return this.increment('day', times * 7);
  8756. case 'day':
  8757. return this.set('date', this.get('date') + times);
  8758. }
  8759. if (!Date.units[interval]) throw new Error(interval + ' is not a supported interval');
  8760. return this.set('time', this.get('time') + times * Date.units[interval]());
  8761. },
  8762. decrement: function(interval, times){
  8763. return this.increment(interval, -1 * (times != null ? times : 1));
  8764. },
  8765. isLeapYear: function(){
  8766. return Date.isLeapYear(this.get('year'));
  8767. },
  8768. clearTime: function(){
  8769. return this.set({hr: 0, min: 0, sec: 0, ms: 0});
  8770. },
  8771. diff: function(date, resolution){
  8772. if (typeOf(date) == 'string') date = Date.parse(date);
  8773. return ((date - this) / Date.units[resolution || 'day'](3, 3)).round(); // non-leap year, 30-day month
  8774. },
  8775. getLastDayOfMonth: function(){
  8776. return Date.daysInMonth(this.get('mo'), this.get('year'));
  8777. },
  8778. getDayOfYear: function(){
  8779. return (Date.UTC(this.get('year'), this.get('mo'), this.get('date') + 1)
  8780. - Date.UTC(this.get('year'), 0, 1)) / Date.units.day();
  8781. },
  8782. setDay: function(day, firstDayOfWeek){
  8783. if (firstDayOfWeek == null){
  8784. firstDayOfWeek = Date.getMsg('firstDayOfWeek');
  8785. if (firstDayOfWeek === '') firstDayOfWeek = 1;
  8786. }
  8787. day = (7 + Date.parseDay(day, true) - firstDayOfWeek) % 7;
  8788. var currentDay = (7 + this.get('day') - firstDayOfWeek) % 7;
  8789. return this.increment('day', day - currentDay);
  8790. },
  8791. getWeek: function(firstDayOfWeek){
  8792. if (firstDayOfWeek == null){
  8793. firstDayOfWeek = Date.getMsg('firstDayOfWeek');
  8794. if (firstDayOfWeek === '') firstDayOfWeek = 1;
  8795. }
  8796. var date = this,
  8797. dayOfWeek = (7 + date.get('day') - firstDayOfWeek) % 7,
  8798. dividend = 0,
  8799. firstDayOfYear;
  8800. if (firstDayOfWeek == 1){
  8801. // ISO-8601, week belongs to year that has the most days of the week (i.e. has the thursday of the week)
  8802. var month = date.get('month'),
  8803. startOfWeek = date.get('date') - dayOfWeek;
  8804. if (month == 11 && startOfWeek > 28) return 1; // Week 1 of next year
  8805. if (month == 0 && startOfWeek < -2){
  8806. // Use a date from last year to determine the week
  8807. date = new Date(date).decrement('day', dayOfWeek);
  8808. dayOfWeek = 0;
  8809. }
  8810. firstDayOfYear = new Date(date.get('year'), 0, 1).get('day') || 7;
  8811. if (firstDayOfYear > 4) dividend = -7; // First week of the year is not week 1
  8812. } else {
  8813. // In other cultures the first week of the year is always week 1 and the last week always 53 or 54.
  8814. // Days in the same week can have a different weeknumber if the week spreads across two years.
  8815. firstDayOfYear = new Date(date.get('year'), 0, 1).get('day');
  8816. }
  8817. dividend += date.get('dayofyear');
  8818. dividend += 6 - dayOfWeek; // Add days so we calculate the current date's week as a full week
  8819. dividend += (7 + firstDayOfYear - firstDayOfWeek) % 7; // Make up for first week of the year not being a full week
  8820. return (dividend / 7);
  8821. },
  8822. getOrdinal: function(day){
  8823. return Date.getMsg('ordinal', day || this.get('date'));
  8824. },
  8825. getTimezone: function(){
  8826. return this.toString()
  8827. .replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/, '$1')
  8828. .replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, '$1$2$3');
  8829. },
  8830. getGMTOffset: function(){
  8831. var off = this.get('timezoneOffset');
  8832. return ((off > 0) ? '-' : '+') + pad((off.abs() / 60).floor(), 2) + pad(off % 60, 2);
  8833. },
  8834. setAMPM: function(ampm){
  8835. ampm = ampm.toUpperCase();
  8836. var hr = this.get('hr');
  8837. if (hr > 11 && ampm == 'AM') return this.decrement('hour', 12);
  8838. else if (hr < 12 && ampm == 'PM') return this.increment('hour', 12);
  8839. return this;
  8840. },
  8841. getAMPM: function(){
  8842. return (this.get('hr') < 12) ? 'AM' : 'PM';
  8843. },
  8844. parse: function(str){
  8845. this.set('time', Date.parse(str));
  8846. return this;
  8847. },
  8848. isValid: function(date){
  8849. if (!date) date = this;
  8850. return typeOf(date) == 'date' && !isNaN(date.valueOf());
  8851. },
  8852. format: function(format){
  8853. if (!this.isValid()) return 'invalid date';
  8854. if (!format) format = '%x %X';
  8855. if (typeof format == 'string') format = formats[format.toLowerCase()] || format;
  8856. if (typeof format == 'function') return format(this);
  8857. var d = this;
  8858. return format.replace(/%([a-z%])/gi,
  8859. function($0, $1){
  8860. switch ($1){
  8861. case 'a': return Date.getMsg('days_abbr')[d.get('day')];
  8862. case 'A': return Date.getMsg('days')[d.get('day')];
  8863. case 'b': return Date.getMsg('months_abbr')[d.get('month')];
  8864. case 'B': return Date.getMsg('months')[d.get('month')];
  8865. case 'c': return d.format('%a %b %d %H:%M:%S %Y');
  8866. case 'd': return pad(d.get('date'), 2);
  8867. case 'e': return pad(d.get('date'), 2, ' ');
  8868. case 'H': return pad(d.get('hr'), 2);
  8869. case 'I': return pad((d.get('hr') % 12) || 12, 2);
  8870. case 'j': return pad(d.get('dayofyear'), 3);
  8871. case 'k': return pad(d.get('hr'), 2, ' ');
  8872. case 'l': return pad((d.get('hr') % 12) || 12, 2, ' ');
  8873. case 'L': return pad(d.get('ms'), 3);
  8874. case 'm': return pad((d.get('mo') + 1), 2);
  8875. case 'M': return pad(d.get('min'), 2);
  8876. case 'o': return d.get('ordinal');
  8877. case 'p': return Date.getMsg(d.get('ampm'));
  8878. case 's': return Math.round(d / 1000);
  8879. case 'S': return pad(d.get('seconds'), 2);
  8880. case 'T': return d.format('%H:%M:%S');
  8881. case 'U': return pad(d.get('week'), 2);
  8882. case 'w': return d.get('day');
  8883. case 'x': return d.format(Date.getMsg('shortDate'));
  8884. case 'X': return d.format(Date.getMsg('shortTime'));
  8885. case 'y': return d.get('year').toString().substr(2);
  8886. case 'Y': return d.get('year');
  8887. case 'z': return d.get('GMTOffset');
  8888. case 'Z': return d.get('Timezone');
  8889. }
  8890. return $1;
  8891. }
  8892. );
  8893. },
  8894. toISOString: function(){
  8895. return this.format('iso8601');
  8896. }
  8897. }).alias({
  8898. toJSON: 'toISOString',
  8899. compare: 'diff',
  8900. strftime: 'format'
  8901. });
  8902. // The day and month abbreviations are standardized, so we cannot use simply %a and %b because they will get localized
  8903. var rfcDayAbbr = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8904. rfcMonthAbbr = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
  8905. var formats = {
  8906. db: '%Y-%m-%d %H:%M:%S',
  8907. compact: '%Y%m%dT%H%M%S',
  8908. 'short': '%d %b %H:%M',
  8909. 'long': '%B %d, %Y %H:%M',
  8910. rfc822: function(date){
  8911. return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %Z');
  8912. },
  8913. rfc2822: function(date){
  8914. return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %z');
  8915. },
  8916. iso8601: function(date){
  8917. return (
  8918. date.getUTCFullYear() + '-' +
  8919. pad(date.getUTCMonth() + 1, 2) + '-' +
  8920. pad(date.getUTCDate(), 2) + 'T' +
  8921. pad(date.getUTCHours(), 2) + ':' +
  8922. pad(date.getUTCMinutes(), 2) + ':' +
  8923. pad(date.getUTCSeconds(), 2) + '.' +
  8924. pad(date.getUTCMilliseconds(), 3) + 'Z'
  8925. );
  8926. }
  8927. };
  8928. var parsePatterns = [],
  8929. nativeParse = Date.parse;
  8930. var parseWord = function(type, word, num){
  8931. var ret = -1,
  8932. translated = Date.getMsg(type + 's');
  8933. switch (typeOf(word)){
  8934. case 'object':
  8935. ret = translated[word.get(type)];
  8936. break;
  8937. case 'number':
  8938. ret = translated[word];
  8939. if (!ret) throw new Error('Invalid ' + type + ' index: ' + word);
  8940. break;
  8941. case 'string':
  8942. var match = translated.filter(function(name){
  8943. return this.test(name);
  8944. }, new RegExp('^' + word, 'i'));
  8945. if (!match.length) throw new Error('Invalid ' + type + ' string');
  8946. if (match.length > 1) throw new Error('Ambiguous ' + type);
  8947. ret = match[0];
  8948. }
  8949. return (num) ? translated.indexOf(ret) : ret;
  8950. };
  8951. var startCentury = 1900,
  8952. startYear = 70;
  8953. Date.extend({
  8954. getMsg: function(key, args){
  8955. return Locale.get('Date.' + key, args);
  8956. },
  8957. units: {
  8958. ms: Function.convert(1),
  8959. second: Function.convert(1000),
  8960. minute: Function.convert(60000),
  8961. hour: Function.convert(3600000),
  8962. day: Function.convert(86400000),
  8963. week: Function.convert(608400000),
  8964. month: function(month, year){
  8965. var d = new Date;
  8966. return Date.daysInMonth(month != null ? month : d.get('mo'), year != null ? year : d.get('year')) * 86400000;
  8967. },
  8968. year: function(year){
  8969. year = year || new Date().get('year');
  8970. return Date.isLeapYear(year) ? 31622400000 : 31536000000;
  8971. }
  8972. },
  8973. daysInMonth: function(month, year){
  8974. return [31, Date.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
  8975. },
  8976. isLeapYear: function(year){
  8977. return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);
  8978. },
  8979. parse: function(from){
  8980. var t = typeOf(from);
  8981. if (t == 'number') return new Date(from);
  8982. if (t != 'string') return from;
  8983. from = from.clean();
  8984. if (!from.length) return null;
  8985. var parsed;
  8986. parsePatterns.some(function(pattern){
  8987. var bits = pattern.re.exec(from);
  8988. return (bits) ? (parsed = pattern.handler(bits)) : false;
  8989. });
  8990. if (!(parsed && parsed.isValid())){
  8991. parsed = new Date(nativeParse(from));
  8992. if (!(parsed && parsed.isValid())) parsed = new Date(from.toInt());
  8993. }
  8994. return parsed;
  8995. },
  8996. parseDay: function(day, num){
  8997. return parseWord('day', day, num);
  8998. },
  8999. parseMonth: function(month, num){
  9000. return parseWord('month', month, num);
  9001. },
  9002. parseUTC: function(value){
  9003. var localDate = new Date(value);
  9004. var utcSeconds = Date.UTC(
  9005. localDate.get('year'),
  9006. localDate.get('mo'),
  9007. localDate.get('date'),
  9008. localDate.get('hr'),
  9009. localDate.get('min'),
  9010. localDate.get('sec'),
  9011. localDate.get('ms')
  9012. );
  9013. return new Date(utcSeconds);
  9014. },
  9015. orderIndex: function(unit){
  9016. return Date.getMsg('dateOrder').indexOf(unit) + 1;
  9017. },
  9018. defineFormat: function(name, format){
  9019. formats[name] = format;
  9020. return this;
  9021. },
  9022. //<1.2compat>
  9023. parsePatterns: parsePatterns,
  9024. //</1.2compat>
  9025. defineParser: function(pattern){
  9026. parsePatterns.push((pattern.re && pattern.handler) ? pattern : build(pattern));
  9027. return this;
  9028. },
  9029. defineParsers: function(){
  9030. Array.flatten(arguments).each(Date.defineParser);
  9031. return this;
  9032. },
  9033. define2DigitYearStart: function(year){
  9034. startYear = year % 100;
  9035. startCentury = year - startYear;
  9036. return this;
  9037. }
  9038. }).extend({
  9039. defineFormats: Date.defineFormat.overloadSetter()
  9040. });
  9041. var regexOf = function(type){
  9042. return new RegExp('(?:' + Date.getMsg(type).map(function(name){
  9043. return name.substr(0, 3);
  9044. }).join('|') + ')[a-z]*');
  9045. };
  9046. var replacers = function(key){
  9047. switch (key){
  9048. case 'T':
  9049. return '%H:%M:%S';
  9050. case 'x': // iso8601 covers yyyy-mm-dd, so just check if month is first
  9051. return ((Date.orderIndex('month') == 1) ? '%m[-./]%d' : '%d[-./]%m') + '([-./]%y)?';
  9052. case 'X':
  9053. return '%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%z?';
  9054. }
  9055. return null;
  9056. };
  9057. var keys = {
  9058. d: /[0-2]?[0-9]|3[01]/,
  9059. H: /[01]?[0-9]|2[0-3]/,
  9060. I: /0?[1-9]|1[0-2]/,
  9061. M: /[0-5]?\d/,
  9062. s: /\d+/,
  9063. o: /[a-z]*/,
  9064. p: /[ap]\.?m\.?/,
  9065. y: /\d{2}|\d{4}/,
  9066. Y: /\d{4}/,
  9067. z: /Z|[+-]\d{2}(?::?\d{2})?/
  9068. };
  9069. keys.m = keys.I;
  9070. keys.S = keys.M;
  9071. var currentLanguage;
  9072. var recompile = function(language){
  9073. currentLanguage = language;
  9074. keys.a = keys.A = regexOf('days');
  9075. keys.b = keys.B = regexOf('months');
  9076. parsePatterns.each(function(pattern, i){
  9077. if (pattern.format) parsePatterns[i] = build(pattern.format);
  9078. });
  9079. };
  9080. var build = function(format){
  9081. if (!currentLanguage) return {format: format};
  9082. var parsed = [];
  9083. var re = (format.source || format) // allow format to be regex
  9084. .replace(/%([a-z])/gi,
  9085. function($0, $1){
  9086. return replacers($1) || $0;
  9087. }
  9088. ).replace(/\((?!\?)/g, '(?:') // make all groups non-capturing
  9089. .replace(/ (?!\?|\*)/g, ',? ') // be forgiving with spaces and commas
  9090. .replace(/%([a-z%])/gi,
  9091. function($0, $1){
  9092. var p = keys[$1];
  9093. if (!p) return $1;
  9094. parsed.push($1);
  9095. return '(' + p.source + ')';
  9096. }
  9097. ).replace(/\[a-z\]/gi, '[a-z\\u00c0-\\uffff;\&]'); // handle unicode words
  9098. return {
  9099. format: format,
  9100. re: new RegExp('^' + re + '$', 'i'),
  9101. handler: function(bits){
  9102. bits = bits.slice(1).associate(parsed);
  9103. var date = new Date().clearTime(),
  9104. year = bits.y || bits.Y;
  9105. if (year != null) handle.call(date, 'y', year); // need to start in the right year
  9106. if ('d' in bits) handle.call(date, 'd', 1);
  9107. if ('m' in bits || bits.b || bits.B) handle.call(date, 'm', 1);
  9108. for (var key in bits) handle.call(date, key, bits[key]);
  9109. return date;
  9110. }
  9111. };
  9112. };
  9113. var handle = function(key, value){
  9114. if (!value) return this;
  9115. switch (key){
  9116. case 'a': case 'A': return this.set('day', Date.parseDay(value, true));
  9117. case 'b': case 'B': return this.set('mo', Date.parseMonth(value, true));
  9118. case 'd': return this.set('date', value);
  9119. case 'H': case 'I': return this.set('hr', value);
  9120. case 'm': return this.set('mo', value - 1);
  9121. case 'M': return this.set('min', value);
  9122. case 'p': return this.set('ampm', value.replace(/\./g, ''));
  9123. case 'S': return this.set('sec', value);
  9124. case 's': return this.set('ms', ('0.' + value) * 1000);
  9125. case 'w': return this.set('day', value);
  9126. case 'Y': return this.set('year', value);
  9127. case 'y':
  9128. value = +value;
  9129. if (value < 100) value += startCentury + (value < startYear ? 100 : 0);
  9130. return this.set('year', value);
  9131. case 'z':
  9132. if (value == 'Z') value = '+00';
  9133. var offset = value.match(/([+-])(\d{2}):?(\d{2})?/);
  9134. offset = (offset[1] + '1') * (offset[2] * 60 + (+offset[3] || 0)) + this.getTimezoneOffset();
  9135. return this.set('time', this - offset * 60000);
  9136. }
  9137. return this;
  9138. };
  9139. Date.defineParsers(
  9140. '%Y([-./]%m([-./]%d((T| )%X)?)?)?', // "1999-12-31", "1999-12-31 11:59pm", "1999-12-31 23:59:59", ISO8601
  9141. '%Y%m%d(T%H(%M%S?)?)?', // "19991231", "19991231T1159", compact
  9142. '%x( %X)?', // "12/31", "12.31.99", "12-31-1999", "12/31/2008 11:59 PM"
  9143. '%d%o( %b( %Y)?)?( %X)?', // "31st", "31st December", "31 Dec 1999", "31 Dec 1999 11:59pm"
  9144. '%b( %d%o)?( %Y)?( %X)?', // Same as above with month and day switched
  9145. '%Y %b( %d%o( %X)?)?', // Same as above with year coming first
  9146. '%o %b %d %X %z %Y', // "Thu Oct 22 08:11:23 +0000 2009"
  9147. '%T', // %H:%M:%S
  9148. '%H:%M( ?%p)?' // "11:05pm", "11:05 am" and "11:05"
  9149. );
  9150. Locale.addEvent('change', function(language){
  9151. if (Locale.get('Date')) recompile(language);
  9152. }).fireEvent('change', Locale.getCurrent());
  9153. })();
  9154. /*
  9155. ---
  9156. name: Locale.en-US.Form.Validator
  9157. description: Form Validator messages for English.
  9158. license: MIT-style license
  9159. authors:
  9160. - Aaron Newton
  9161. requires:
  9162. - Locale
  9163. provides: [Locale.en-US.Form.Validator]
  9164. ...
  9165. */
  9166. Locale.define('en-US', 'FormValidator', {
  9167. required: 'This field is required.',
  9168. length: 'Please enter {length} characters (you entered {elLength} characters)',
  9169. minLength: 'Please enter at least {minLength} characters (you entered {length} characters).',
  9170. maxLength: 'Please enter no more than {maxLength} characters (you entered {length} characters).',
  9171. integer: 'Please enter an integer in this field. Numbers with decimals (e.g. 1.25) are not permitted.',
  9172. numeric: 'Please enter only numeric values in this field (i.e. "1" or "1.1" or "-1" or "-1.1").',
  9173. digits: 'Please use numbers and punctuation only in this field (for example, a phone number with dashes or dots is permitted).',
  9174. alpha: 'Please use only letters (a-z) within this field. No spaces or other characters are allowed.',
  9175. alphanum: 'Please use only letters (a-z) or numbers (0-9) in this field. No spaces or other characters are allowed.',
  9176. dateSuchAs: 'Please enter a valid date such as {date}',
  9177. dateInFormatMDY: 'Please enter a valid date such as MM/DD/YYYY (i.e. "12/31/1999")',
  9178. email: 'Please enter a valid email address. For example "fred@domain.com".',
  9179. url: 'Please enter a valid URL such as http://www.example.com.',
  9180. currencyDollar: 'Please enter a valid $ amount. For example $100.00 .',
  9181. oneRequired: 'Please enter something for at least one of these inputs.',
  9182. errorPrefix: 'Error: ',
  9183. warningPrefix: 'Warning: ',
  9184. // Form.Validator.Extras
  9185. noSpace: 'There can be no spaces in this input.',
  9186. reqChkByNode: 'No items are selected.',
  9187. requiredChk: 'This field is required.',
  9188. reqChkByName: 'Please select a {label}.',
  9189. match: 'This field needs to match the {matchName} field',
  9190. startDate: 'the start date',
  9191. endDate: 'the end date',
  9192. currentDate: 'the current date',
  9193. afterDate: 'The date should be the same or after {label}.',
  9194. beforeDate: 'The date should be the same or before {label}.',
  9195. startMonth: 'Please select a start month',
  9196. sameMonth: 'These two dates must be in the same month - you must change one or the other.',
  9197. creditcard: 'The credit card number entered is invalid. Please check the number and try again. {length} digits entered.'
  9198. });
  9199. /*
  9200. ---
  9201. script: Form.Validator.js
  9202. name: Form.Validator
  9203. description: A css-class based form validation system.
  9204. license: MIT-style license
  9205. authors:
  9206. - Aaron Newton
  9207. requires:
  9208. - Core/Options
  9209. - Core/Events
  9210. - Core/Element.Delegation
  9211. - Core/Slick.Finder
  9212. - Core/Element.Event
  9213. - Core/Element.Style
  9214. - Core/JSON
  9215. - Locale
  9216. - Class.Binds
  9217. - Date
  9218. - Element.Forms
  9219. - Locale.en-US.Form.Validator
  9220. - Element.Shortcuts
  9221. provides: [Form.Validator, InputValidator, FormValidator.BaseValidators]
  9222. ...
  9223. */
  9224. if (!window.Form) window.Form = {};
  9225. var InputValidator = this.InputValidator = new Class({
  9226. Implements: [Options],
  9227. options: {
  9228. errorMsg: 'Validation failed.',
  9229. test: Function.convert(true)
  9230. },
  9231. initialize: function(className, options){
  9232. this.setOptions(options);
  9233. this.className = className;
  9234. },
  9235. test: function(field, props){
  9236. field = document.id(field);
  9237. return (field) ? this.options.test(field, props || this.getProps(field)) : false;
  9238. },
  9239. getError: function(field, props){
  9240. field = document.id(field);
  9241. var err = this.options.errorMsg;
  9242. if (typeOf(err) == 'function') err = err(field, props || this.getProps(field));
  9243. return err;
  9244. },
  9245. getProps: function(field){
  9246. field = document.id(field);
  9247. return (field) ? field.get('validatorProps') : {};
  9248. }
  9249. });
  9250. Element.Properties.validators = {
  9251. get: function(){
  9252. return (this.get('data-validators') || this.className).clean().replace(/'(\\.|[^'])*'|"(\\.|[^"])*"/g, function(match){
  9253. return match.replace(' ', '\\x20');
  9254. }).split(' ');
  9255. }
  9256. };
  9257. Element.Properties.validatorProps = {
  9258. set: function(props){
  9259. return this.eliminate('$moo:validatorProps').store('$moo:validatorProps', props);
  9260. },
  9261. get: function(props){
  9262. if (props) this.set(props);
  9263. if (this.retrieve('$moo:validatorProps')) return this.retrieve('$moo:validatorProps');
  9264. if (this.getProperty('data-validator-properties') || this.getProperty('validatorProps')){
  9265. try {
  9266. this.store('$moo:validatorProps', JSON.decode(this.getProperty('validatorProps') || this.getProperty('data-validator-properties'), false));
  9267. } catch (e){
  9268. return {};
  9269. }
  9270. } else {
  9271. var vals = this.get('validators').filter(function(cls){
  9272. return cls.test(':');
  9273. });
  9274. if (!vals.length){
  9275. this.store('$moo:validatorProps', {});
  9276. } else {
  9277. props = {};
  9278. vals.each(function(cls){
  9279. var split = cls.split(':');
  9280. if (split[1]){
  9281. try {
  9282. props[split[0]] = JSON.decode(split[1], false);
  9283. } catch (e){}
  9284. }
  9285. });
  9286. this.store('$moo:validatorProps', props);
  9287. }
  9288. }
  9289. return this.retrieve('$moo:validatorProps');
  9290. }
  9291. };
  9292. Form.Validator = new Class({
  9293. Implements: [Options, Events],
  9294. options: {/*
  9295. onFormValidate: function(isValid, form, event){},
  9296. onElementValidate: function(isValid, field, className, warn){},
  9297. onElementPass: function(field){},
  9298. onElementFail: function(field, validatorsFailed){}, */
  9299. fieldSelectors: 'input, select, textarea',
  9300. ignoreHidden: true,
  9301. ignoreDisabled: true,
  9302. useTitles: false,
  9303. evaluateOnSubmit: true,
  9304. evaluateFieldsOnBlur: true,
  9305. evaluateFieldsOnChange: true,
  9306. serial: true,
  9307. stopOnFailure: true,
  9308. warningPrefix: function(){
  9309. return Form.Validator.getMsg('warningPrefix') || 'Warning: ';
  9310. },
  9311. errorPrefix: function(){
  9312. return Form.Validator.getMsg('errorPrefix') || 'Error: ';
  9313. }
  9314. },
  9315. initialize: function(form, options){
  9316. this.setOptions(options);
  9317. this.element = document.id(form);
  9318. this.warningPrefix = Function.convert(this.options.warningPrefix)();
  9319. this.errorPrefix = Function.convert(this.options.errorPrefix)();
  9320. this._bound = {
  9321. onSubmit: this.onSubmit.bind(this),
  9322. blurOrChange: function(event, field){
  9323. this.validationMonitor(field, true);
  9324. }.bind(this)
  9325. };
  9326. this.enable();
  9327. },
  9328. toElement: function(){
  9329. return this.element;
  9330. },
  9331. getFields: function(){
  9332. return (this.fields = this.element.getElements(this.options.fieldSelectors));
  9333. },
  9334. enable: function(){
  9335. this.element.store('validator', this);
  9336. if (this.options.evaluateOnSubmit) this.element.addEvent('submit', this._bound.onSubmit);
  9337. if (this.options.evaluateFieldsOnBlur){
  9338. this.element.addEvent('blur:relay(input,select,textarea)', this._bound.blurOrChange);
  9339. }
  9340. if (this.options.evaluateFieldsOnChange){
  9341. this.element.addEvent('change:relay(input,select,textarea)', this._bound.blurOrChange);
  9342. }
  9343. },
  9344. disable: function(){
  9345. this.element.eliminate('validator');
  9346. this.element.removeEvents({
  9347. submit: this._bound.onSubmit,
  9348. 'blur:relay(input,select,textarea)': this._bound.blurOrChange,
  9349. 'change:relay(input,select,textarea)': this._bound.blurOrChange
  9350. });
  9351. },
  9352. validationMonitor: function(){
  9353. clearTimeout(this.timer);
  9354. this.timer = this.validateField.delay(50, this, arguments);
  9355. },
  9356. onSubmit: function(event){
  9357. if (this.validate(event)) this.reset();
  9358. },
  9359. reset: function(){
  9360. this.getFields().each(this.resetField, this);
  9361. return this;
  9362. },
  9363. validate: function(event){
  9364. var result = this.getFields().map(function(field){
  9365. return this.validateField(field, true);
  9366. }, this).every(function(v){
  9367. return v;
  9368. });
  9369. this.fireEvent('formValidate', [result, this.element, event]);
  9370. if (this.options.stopOnFailure && !result && event) event.preventDefault();
  9371. return result;
  9372. },
  9373. validateField: function(field, force){
  9374. if (this.paused) return true;
  9375. field = document.id(field);
  9376. var passed = !field.hasClass('validation-failed');
  9377. var failed, warned;
  9378. if (this.options.serial && !force){
  9379. failed = this.element.getElement('.validation-failed');
  9380. warned = this.element.getElement('.warning');
  9381. }
  9382. if (field && (!failed || force || field.hasClass('validation-failed') || (failed && !this.options.serial))){
  9383. var validationTypes = field.get('validators');
  9384. var validators = validationTypes.some(function(cn){
  9385. return this.getValidator(cn);
  9386. }, this);
  9387. var validatorsFailed = [];
  9388. validationTypes.each(function(className){
  9389. if (className && !this.test(className, field)) validatorsFailed.include(className);
  9390. }, this);
  9391. passed = validatorsFailed.length === 0;
  9392. if (validators && !this.hasValidator(field, 'warnOnly')){
  9393. if (passed){
  9394. field.addClass('validation-passed').removeClass('validation-failed');
  9395. this.fireEvent('elementPass', [field]);
  9396. } else {
  9397. field.addClass('validation-failed').removeClass('validation-passed');
  9398. this.fireEvent('elementFail', [field, validatorsFailed]);
  9399. }
  9400. }
  9401. if (!warned){
  9402. var warnings = validationTypes.some(function(cn){
  9403. if (cn.test('^warn'))
  9404. return this.getValidator(cn.replace(/^warn-/,''));
  9405. else return null;
  9406. }, this);
  9407. field.removeClass('warning');
  9408. var warnResult = validationTypes.map(function(cn){
  9409. if (cn.test('^warn'))
  9410. return this.test(cn.replace(/^warn-/,''), field, true);
  9411. else return null;
  9412. }, this);
  9413. }
  9414. }
  9415. return passed;
  9416. },
  9417. test: function(className, field, warn){
  9418. field = document.id(field);
  9419. if ((this.options.ignoreHidden && !field.isVisible()) || (this.options.ignoreDisabled && field.get('disabled'))) return true;
  9420. var validator = this.getValidator(className);
  9421. if (warn != null) warn = false;
  9422. if (this.hasValidator(field, 'warnOnly')) warn = true;
  9423. var isValid = field.hasClass('ignoreValidation') || (validator ? validator.test(field) : true);
  9424. if (validator) this.fireEvent('elementValidate', [isValid, field, className, warn]);
  9425. if (warn) return true;
  9426. return isValid;
  9427. },
  9428. hasValidator: function(field, value){
  9429. return field.get('validators').contains(value);
  9430. },
  9431. resetField: function(field){
  9432. field = document.id(field);
  9433. if (field){
  9434. field.get('validators').each(function(className){
  9435. if (className.test('^warn-')) className = className.replace(/^warn-/, '');
  9436. field.removeClass('validation-failed');
  9437. field.removeClass('warning');
  9438. field.removeClass('validation-passed');
  9439. }, this);
  9440. }
  9441. return this;
  9442. },
  9443. stop: function(){
  9444. this.paused = true;
  9445. return this;
  9446. },
  9447. start: function(){
  9448. this.paused = false;
  9449. return this;
  9450. },
  9451. ignoreField: function(field, warn){
  9452. field = document.id(field);
  9453. if (field){
  9454. this.enforceField(field);
  9455. if (warn) field.addClass('warnOnly');
  9456. else field.addClass('ignoreValidation');
  9457. }
  9458. return this;
  9459. },
  9460. enforceField: function(field){
  9461. field = document.id(field);
  9462. if (field) field.removeClass('warnOnly').removeClass('ignoreValidation');
  9463. return this;
  9464. }
  9465. });
  9466. Form.Validator.getMsg = function(key){
  9467. return Locale.get('FormValidator.' + key);
  9468. };
  9469. Form.Validator.adders = {
  9470. validators:{},
  9471. add : function(className, options){
  9472. this.validators[className] = new InputValidator(className, options);
  9473. //if this is a class (this method is used by instances of Form.Validator and the Form.Validator namespace)
  9474. //extend these validators into it
  9475. //this allows validators to be global and/or per instance
  9476. if (!this.initialize){
  9477. this.implement({
  9478. validators: this.validators
  9479. });
  9480. }
  9481. },
  9482. addAllThese : function(validators){
  9483. Array.convert(validators).each(function(validator){
  9484. this.add(validator[0], validator[1]);
  9485. }, this);
  9486. },
  9487. getValidator: function(className){
  9488. return this.validators[className.split(':')[0]];
  9489. }
  9490. };
  9491. Object.append(Form.Validator, Form.Validator.adders);
  9492. Form.Validator.implement(Form.Validator.adders);
  9493. Form.Validator.add('IsEmpty', {
  9494. errorMsg: false,
  9495. test: function(element){
  9496. if (element.type == 'select-one' || element.type == 'select')
  9497. return !(element.selectedIndex >= 0 && element.options[element.selectedIndex].value != '');
  9498. else
  9499. return ((element.get('value') == null) || (element.get('value').length == 0));
  9500. }
  9501. });
  9502. Form.Validator.addAllThese([
  9503. ['required', {
  9504. errorMsg: function(){
  9505. return Form.Validator.getMsg('required');
  9506. },
  9507. test: function(element){
  9508. return !Form.Validator.getValidator('IsEmpty').test(element);
  9509. }
  9510. }],
  9511. ['length', {
  9512. errorMsg: function(element, props){
  9513. if (typeOf(props.length) != 'null')
  9514. return Form.Validator.getMsg('length').substitute({length: props.length, elLength: element.get('value').length});
  9515. else return '';
  9516. },
  9517. test: function(element, props){
  9518. if (typeOf(props.length) != 'null') return (element.get('value').length == props.length || element.get('value').length == 0);
  9519. else return true;
  9520. }
  9521. }],
  9522. ['minLength', {
  9523. errorMsg: function(element, props){
  9524. if (typeOf(props.minLength) != 'null')
  9525. return Form.Validator.getMsg('minLength').substitute({minLength: props.minLength, length: element.get('value').length});
  9526. else return '';
  9527. },
  9528. test: function(element, props){
  9529. if (typeOf(props.minLength) != 'null') return (element.get('value').length >= (props.minLength || 0));
  9530. else return true;
  9531. }
  9532. }],
  9533. ['maxLength', {
  9534. errorMsg: function(element, props){
  9535. //props is {maxLength:10}
  9536. if (typeOf(props.maxLength) != 'null')
  9537. return Form.Validator.getMsg('maxLength').substitute({maxLength: props.maxLength, length: element.get('value').length});
  9538. else return '';
  9539. },
  9540. test: function(element, props){
  9541. return element.get('value').length <= (props.maxLength || 10000);
  9542. }
  9543. }],
  9544. ['validate-integer', {
  9545. errorMsg: Form.Validator.getMsg.pass('integer'),
  9546. test: function(element){
  9547. return Form.Validator.getValidator('IsEmpty').test(element) || (/^(-?[1-9]\d*|0)$/).test(element.get('value'));
  9548. }
  9549. }],
  9550. ['validate-numeric', {
  9551. errorMsg: Form.Validator.getMsg.pass('numeric'),
  9552. test: function(element){
  9553. return Form.Validator.getValidator('IsEmpty').test(element) ||
  9554. (/^-?(?:0$0(?=\d*\.)|[1-9]|0)\d*(\.\d+)?$/).test(element.get('value'));
  9555. }
  9556. }],
  9557. ['validate-digits', {
  9558. errorMsg: Form.Validator.getMsg.pass('digits'),
  9559. test: function(element){
  9560. return Form.Validator.getValidator('IsEmpty').test(element) || (/^[\d() .:\-\+#]+$/.test(element.get('value')));
  9561. }
  9562. }],
  9563. ['validate-alpha', {
  9564. errorMsg: Form.Validator.getMsg.pass('alpha'),
  9565. test: function(element){
  9566. return Form.Validator.getValidator('IsEmpty').test(element) || (/^[a-zA-Z]+$/).test(element.get('value'));
  9567. }
  9568. }],
  9569. ['validate-alphanum', {
  9570. errorMsg: Form.Validator.getMsg.pass('alphanum'),
  9571. test: function(element){
  9572. return Form.Validator.getValidator('IsEmpty').test(element) || !(/\W/).test(element.get('value'));
  9573. }
  9574. }],
  9575. ['validate-date', {
  9576. errorMsg: function(element, props){
  9577. if (Date.parse){
  9578. var format = props.dateFormat || '%x';
  9579. return Form.Validator.getMsg('dateSuchAs').substitute({date: new Date().format(format)});
  9580. } else {
  9581. return Form.Validator.getMsg('dateInFormatMDY');
  9582. }
  9583. },
  9584. test: function(element, props){
  9585. if (Form.Validator.getValidator('IsEmpty').test(element)) return true;
  9586. var dateLocale = Locale.get('Date'),
  9587. dateNouns = new RegExp([dateLocale.days, dateLocale.days_abbr, dateLocale.months, dateLocale.months_abbr, dateLocale.AM, dateLocale.PM].flatten().join('|'), 'i'),
  9588. value = element.get('value'),
  9589. wordsInValue = value.match(/[a-z]+/gi);
  9590. if (wordsInValue && !wordsInValue.every(dateNouns.exec, dateNouns)) return false;
  9591. var date = Date.parse(value);
  9592. if (!date) return false;
  9593. var format = props.dateFormat || '%x',
  9594. formatted = date.format(format);
  9595. if (formatted != 'invalid date') element.set('value', formatted);
  9596. return date.isValid();
  9597. }
  9598. }],
  9599. ['validate-email', {
  9600. errorMsg: Form.Validator.getMsg.pass('email'),
  9601. test: function(element){
  9602. /*
  9603. var chars = "[a-z0-9!#$%&'*+/=?^_`{|}~-]",
  9604. local = '(?:' + chars + '\\.?){0,63}' + chars,
  9605. label = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?',
  9606. hostname = '(?:' + label + '\\.)*' + label;
  9607. octet = '(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',
  9608. ipv4 = '\\[(?:' + octet + '\\.){3}' + octet + '\\]',
  9609. domain = '(?:' + hostname + '|' + ipv4 + ')';
  9610. var regex = new RegExp('^' + local + '@' + domain + '$', 'i');
  9611. */
  9612. return Form.Validator.getValidator('IsEmpty').test(element) || (/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]\.?){0,63}[a-z0-9!#$%&'*+\/=?^_`{|}~-]@(?:(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])$/i).test(element.get('value'));
  9613. }
  9614. }],
  9615. ['validate-url', {
  9616. errorMsg: Form.Validator.getMsg.pass('url'),
  9617. test: function(element){
  9618. return Form.Validator.getValidator('IsEmpty').test(element) || (/^(https?|ftp|rmtp|mms):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i).test(element.get('value'));
  9619. }
  9620. }],
  9621. ['validate-currency-dollar', {
  9622. errorMsg: Form.Validator.getMsg.pass('currencyDollar'),
  9623. test: function(element){
  9624. return Form.Validator.getValidator('IsEmpty').test(element) || (/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/).test(element.get('value'));
  9625. }
  9626. }],
  9627. ['validate-one-required', {
  9628. errorMsg: Form.Validator.getMsg.pass('oneRequired'),
  9629. test: function(element, props){
  9630. var p = document.id(props['validate-one-required']) || element.getParent(props['validate-one-required']);
  9631. return p.getElements('input').some(function(el){
  9632. if (['checkbox', 'radio'].contains(el.get('type'))) return el.get('checked');
  9633. return el.get('value');
  9634. });
  9635. }
  9636. }]
  9637. ]);
  9638. Element.Properties.validator = {
  9639. set: function(options){
  9640. this.get('validator').setOptions(options);
  9641. },
  9642. get: function(){
  9643. var validator = this.retrieve('validator');
  9644. if (!validator){
  9645. validator = new Form.Validator(this);
  9646. this.store('validator', validator);
  9647. }
  9648. return validator;
  9649. }
  9650. };
  9651. Element.implement({
  9652. validate: function(options){
  9653. if (options) this.set('validator', options);
  9654. return this.get('validator').validate();
  9655. }
  9656. });
  9657. //<1.2compat>
  9658. //legacy
  9659. var FormValidator = Form.Validator;
  9660. //</1.2compat>
  9661. /*
  9662. ---
  9663. script: Form.Validator.Extras.js
  9664. name: Form.Validator.Extras
  9665. description: Additional validators for the Form.Validator class.
  9666. license: MIT-style license
  9667. authors:
  9668. - Aaron Newton
  9669. requires:
  9670. - Form.Validator
  9671. provides: [Form.Validator.Extras]
  9672. ...
  9673. */
  9674. (function(){
  9675. function getItems(props, preference, children, cssSelector){
  9676. if (preference && props[preference]) return props[preference];
  9677. var el = document.id(props[children]);
  9678. if (!el) return [];
  9679. return el.getElements(cssSelector);
  9680. }
  9681. Form.Validator.addAllThese([
  9682. ['validate-enforce-oncheck', {
  9683. test: function(element, props){
  9684. var fv = element.getParent('form').retrieve('validator');
  9685. if (!fv) return true;
  9686. getItems(props, 'toEnforce', 'enforceChildrenOf', 'input, select, textarea').each(function(item){
  9687. if (element.checked){
  9688. fv.enforceField(item);
  9689. } else {
  9690. fv.ignoreField(item);
  9691. fv.resetField(item);
  9692. }
  9693. });
  9694. return true;
  9695. }
  9696. }],
  9697. ['validate-ignore-oncheck', {
  9698. test: function(element, props){
  9699. var fv = element.getParent('form').retrieve('validator');
  9700. if (!fv) return true;
  9701. getItems(props, 'toIgnore', 'ignoreChildrenOf', 'input, select, textarea').each(function(item){
  9702. if (element.checked){
  9703. fv.ignoreField(item);
  9704. fv.resetField(item);
  9705. } else {
  9706. fv.enforceField(item);
  9707. }
  9708. });
  9709. return true;
  9710. }
  9711. }],
  9712. ['validate-enforce-onselect-value', {
  9713. test: function(element, props){
  9714. if (!props.value) return true;
  9715. var fv = element.getParent('form').retrieve('validator');
  9716. if (!fv) return true;
  9717. getItems(props, 'toEnforce', 'enforceChildrenOf', 'input, select, textarea').each(function(item){
  9718. if (props.value == element.value){
  9719. fv.enforceField(item);
  9720. } else {
  9721. fv.ignoreField(item);
  9722. fv.resetField(item);
  9723. }
  9724. });
  9725. return true;
  9726. }
  9727. }],
  9728. ['validate-nospace', {
  9729. errorMsg: function(){
  9730. return Form.Validator.getMsg('noSpace');
  9731. },
  9732. test: function(element, props){
  9733. return !element.get('value').test(/\s/);
  9734. }
  9735. }],
  9736. ['validate-toggle-oncheck', {
  9737. test: function(element, props){
  9738. var fv = element.getParent('form').retrieve('validator');
  9739. if (!fv) return true;
  9740. var eleArr = getItems(props, 'toToggle', 'toToggleChildrenOf', 'input, select, textarea');
  9741. if (!element.checked){
  9742. eleArr.each(function(item){
  9743. fv.ignoreField(item);
  9744. fv.resetField(item);
  9745. });
  9746. } else {
  9747. eleArr.each(function(item){
  9748. fv.enforceField(item);
  9749. });
  9750. }
  9751. return true;
  9752. }
  9753. }],
  9754. ['validate-reqchk-bynode', {
  9755. errorMsg: function(){
  9756. return Form.Validator.getMsg('reqChkByNode');
  9757. },
  9758. test: function(element, props){
  9759. return getItems(props, false, 'nodeId', props.selector || 'input[type=checkbox], input[type=radio]').some(function(item){
  9760. return item.checked;
  9761. });
  9762. }
  9763. }],
  9764. ['validate-required-check', {
  9765. errorMsg: function(element, props){
  9766. return props.useTitle ? element.get('title') : Form.Validator.getMsg('requiredChk');
  9767. },
  9768. test: function(element, props){
  9769. return !!element.checked;
  9770. }
  9771. }],
  9772. ['validate-reqchk-byname', {
  9773. errorMsg: function(element, props){
  9774. return Form.Validator.getMsg('reqChkByName').substitute({label: props.label || element.get('type')});
  9775. },
  9776. test: function(element, props){
  9777. var grpName = props.groupName || element.get('name');
  9778. var grpNameEls = $$('[name=' + grpName +']');
  9779. var oneCheckedItem = grpNameEls.some(function(item, index){
  9780. return item.checked;
  9781. });
  9782. var fv = element.getParent('form').retrieve('validator');
  9783. if (oneCheckedItem && fv){
  9784. grpNameEls.each(function(item, index){ fv.resetField(item); });
  9785. }
  9786. return oneCheckedItem;
  9787. }
  9788. }],
  9789. ['validate-match', {
  9790. errorMsg: function(element, props){
  9791. return Form.Validator.getMsg('match').substitute({matchName: decodeURIComponent((props.matchName+'').replace(/\+/g, '%20')) || document.id(props.matchInput).get('name')});
  9792. },
  9793. test: function(element, props){
  9794. var eleVal = element.get('value');
  9795. var matchVal = document.id(props.matchInput) && document.id(props.matchInput).get('value');
  9796. return eleVal && matchVal ? eleVal == matchVal : true;
  9797. }
  9798. }],
  9799. ['validate-after-date', {
  9800. errorMsg: function(element, props){
  9801. return Form.Validator.getMsg('afterDate').substitute({
  9802. label: props.afterLabel || (props.afterElement ? Form.Validator.getMsg('startDate') : Form.Validator.getMsg('currentDate'))
  9803. });
  9804. },
  9805. test: function(element, props){
  9806. var start = document.id(props.afterElement) ? Date.parse(document.id(props.afterElement).get('value')) : new Date();
  9807. var end = Date.parse(element.get('value'));
  9808. return end && start ? end >= start : true;
  9809. }
  9810. }],
  9811. ['validate-before-date', {
  9812. errorMsg: function(element, props){
  9813. return Form.Validator.getMsg('beforeDate').substitute({
  9814. label: props.beforeLabel || (props.beforeElement ? Form.Validator.getMsg('endDate') : Form.Validator.getMsg('currentDate'))
  9815. });
  9816. },
  9817. test: function(element, props){
  9818. var start = Date.parse(element.get('value'));
  9819. var end = document.id(props.beforeElement) ? Date.parse(document.id(props.beforeElement).get('value')) : new Date();
  9820. return end && start ? end >= start : true;
  9821. }
  9822. }],
  9823. ['validate-custom-required', {
  9824. errorMsg: function(){
  9825. return Form.Validator.getMsg('required');
  9826. },
  9827. test: function(element, props){
  9828. return element.get('value') != props.emptyValue;
  9829. }
  9830. }],
  9831. ['validate-same-month', {
  9832. errorMsg: function(element, props){
  9833. var startMo = document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value');
  9834. var eleVal = element.get('value');
  9835. if (eleVal != '') return Form.Validator.getMsg(startMo ? 'sameMonth' : 'startMonth');
  9836. },
  9837. test: function(element, props){
  9838. var d1 = Date.parse(element.get('value'));
  9839. var d2 = Date.parse(document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value'));
  9840. return d1 && d2 ? d1.format('%B') == d2.format('%B') : true;
  9841. }
  9842. }],
  9843. ['validate-cc-num', {
  9844. errorMsg: function(element){
  9845. var ccNum = element.get('value').replace(/[^0-9]/g, '');
  9846. return Form.Validator.getMsg('creditcard').substitute({length: ccNum.length});
  9847. },
  9848. test: function(element){
  9849. // required is a different test
  9850. if (Form.Validator.getValidator('IsEmpty').test(element)) return true;
  9851. // Clean number value
  9852. var ccNum = element.get('value');
  9853. ccNum = ccNum.replace(/[^0-9]/g, '');
  9854. var validType = false;
  9855. if (ccNum.test(/^4[0-9]{12}([0-9]{3})?$/)) validType = 'Visa';
  9856. else if (ccNum.test(/^5[1-5]([0-9]{14})$/)) validType = 'Master Card';
  9857. else if (ccNum.test(/^3[47][0-9]{13}$/)) validType = 'American Express';
  9858. else if (ccNum.test(/^6(?:011|5[0-9]{2})[0-9]{12}$/)) validType = 'Discover';
  9859. else if (ccNum.test(/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/)) validType = 'Diners Club';
  9860. if (validType){
  9861. var sum = 0;
  9862. var cur = 0;
  9863. for (var i=ccNum.length-1; i>=0; --i){
  9864. cur = ccNum.charAt(i).toInt();
  9865. if (cur == 0) continue;
  9866. if ((ccNum.length-i) % 2 == 0) cur += cur;
  9867. if (cur > 9){
  9868. cur = cur.toString().charAt(0).toInt() + cur.toString().charAt(1).toInt();
  9869. }
  9870. sum += cur;
  9871. }
  9872. if ((sum % 10) == 0) return true;
  9873. }
  9874. var chunks = '';
  9875. while (ccNum != ''){
  9876. chunks += ' ' + ccNum.substr(0,4);
  9877. ccNum = ccNum.substr(4);
  9878. }
  9879. element.getParent('form').retrieve('validator').ignoreField(element);
  9880. element.set('value', chunks.clean());
  9881. element.getParent('form').retrieve('validator').enforceField(element);
  9882. return false;
  9883. }
  9884. }]
  9885. ]);
  9886. })();
  9887. /*
  9888. ---
  9889. script: Form.Validator.Inline.js
  9890. name: Form.Validator.Inline
  9891. description: Extends Form.Validator to add inline messages.
  9892. license: MIT-style license
  9893. authors:
  9894. - Aaron Newton
  9895. requires:
  9896. - Form.Validator
  9897. provides: [Form.Validator.Inline]
  9898. ...
  9899. */
  9900. Form.Validator.Inline = new Class({
  9901. Extends: Form.Validator,
  9902. options: {
  9903. showError: function(errorElement){
  9904. if (errorElement.reveal) errorElement.reveal();
  9905. else errorElement.setStyle('display', 'block');
  9906. },
  9907. hideError: function(errorElement){
  9908. if (errorElement.dissolve) errorElement.dissolve();
  9909. else errorElement.setStyle('display', 'none');
  9910. },
  9911. scrollToErrorsOnSubmit: true,
  9912. scrollToErrorsOnBlur: false,
  9913. scrollToErrorsOnChange: false,
  9914. scrollFxOptions: {
  9915. transition: 'quad:out',
  9916. offset: {
  9917. y: -20
  9918. }
  9919. }
  9920. },
  9921. initialize: function(form, options){
  9922. this.parent(form, options);
  9923. this.addEvent('onElementValidate', function(isValid, field, className, warn){
  9924. var validator = this.getValidator(className);
  9925. if (!isValid && validator.getError(field)){
  9926. if (warn) field.addClass('warning');
  9927. var advice = this.makeAdvice(className, field, validator.getError(field), warn);
  9928. this.insertAdvice(advice, field);
  9929. this.showAdvice(className, field);
  9930. } else {
  9931. this.hideAdvice(className, field);
  9932. }
  9933. });
  9934. },
  9935. makeAdvice: function(className, field, error, warn){
  9936. var errorMsg = (warn) ? this.warningPrefix : this.errorPrefix;
  9937. errorMsg += (this.options.useTitles) ? field.title || error:error;
  9938. var cssClass = (warn) ? 'warning-advice' : 'validation-advice';
  9939. var advice = this.getAdvice(className, field);
  9940. if (advice){
  9941. advice = advice.set('html', errorMsg);
  9942. } else {
  9943. advice = new Element('div', {
  9944. html: errorMsg,
  9945. styles: { display: 'none' },
  9946. id: 'advice-' + className.split(':')[0] + '-' + this.getFieldId(field)
  9947. }).addClass(cssClass);
  9948. }
  9949. field.store('$moo:advice-' + className, advice);
  9950. return advice;
  9951. },
  9952. getFieldId : function(field){
  9953. return field.id ? field.id : field.id = 'input_' + field.name;
  9954. },
  9955. showAdvice: function(className, field){
  9956. var advice = this.getAdvice(className, field);
  9957. if (
  9958. advice &&
  9959. !field.retrieve('$moo:' + this.getPropName(className)) &&
  9960. (
  9961. advice.getStyle('display') == 'none' ||
  9962. advice.getStyle('visibility') == 'hidden' ||
  9963. advice.getStyle('opacity') == 0
  9964. )
  9965. ){
  9966. field.store('$moo:' + this.getPropName(className), true);
  9967. this.options.showError(advice);
  9968. this.fireEvent('showAdvice', [field, advice, className]);
  9969. }
  9970. },
  9971. hideAdvice: function(className, field){
  9972. var advice = this.getAdvice(className, field);
  9973. if (advice && field.retrieve('$moo:' + this.getPropName(className))){
  9974. field.store('$moo:' + this.getPropName(className), false);
  9975. this.options.hideError(advice);
  9976. this.fireEvent('hideAdvice', [field, advice, className]);
  9977. }
  9978. },
  9979. getPropName: function(className){
  9980. return 'advice' + className;
  9981. },
  9982. resetField: function(field){
  9983. field = document.id(field);
  9984. if (!field) return this;
  9985. this.parent(field);
  9986. field.get('validators').each(function(className){
  9987. this.hideAdvice(className, field);
  9988. }, this);
  9989. return this;
  9990. },
  9991. getAllAdviceMessages: function(field, force){
  9992. var advice = [];
  9993. if (field.hasClass('ignoreValidation') && !force) return advice;
  9994. var validators = field.get('validators').some(function(cn){
  9995. var warner = cn.test('^warn-') || field.hasClass('warnOnly');
  9996. if (warner) cn = cn.replace(/^warn-/, '');
  9997. var validator = this.getValidator(cn);
  9998. if (!validator) return;
  9999. advice.push({
  10000. message: validator.getError(field),
  10001. warnOnly: warner,
  10002. passed: validator.test(),
  10003. validator: validator
  10004. });
  10005. }, this);
  10006. return advice;
  10007. },
  10008. getAdvice: function(className, field){
  10009. return field.retrieve('$moo:advice-' + className);
  10010. },
  10011. insertAdvice: function(advice, field){
  10012. //Check for error position prop
  10013. var props = field.get('validatorProps');
  10014. //Build advice
  10015. if (!props.msgPos || !document.id(props.msgPos)){
  10016. if (field.type && field.type.toLowerCase() == 'radio') field.getParent().adopt(advice);
  10017. else advice.inject(document.id(field), 'after');
  10018. } else {
  10019. document.id(props.msgPos).grab(advice);
  10020. }
  10021. },
  10022. validateField: function(field, force, scroll){
  10023. var result = this.parent(field, force);
  10024. if (((this.options.scrollToErrorsOnSubmit && scroll == null) || scroll) && !result){
  10025. var failed = document.id(this).getElement('.validation-failed');
  10026. var par = document.id(this).getParent();
  10027. while (par != document.body && par.getScrollSize().y == par.getSize().y){
  10028. par = par.getParent();
  10029. }
  10030. var fx = par.retrieve('$moo:fvScroller');
  10031. if (!fx && window.Fx && Fx.Scroll){
  10032. fx = new Fx.Scroll(par, this.options.scrollFxOptions);
  10033. par.store('$moo:fvScroller', fx);
  10034. }
  10035. if (failed){
  10036. if (fx) fx.toElement(failed);
  10037. else par.scrollTo(par.getScroll().x, failed.getPosition(par).y - 20);
  10038. }
  10039. }
  10040. return result;
  10041. },
  10042. watchFields: function(fields){
  10043. fields.each(function(el){
  10044. if (this.options.evaluateFieldsOnBlur){
  10045. el.addEvent('blur', this.validationMonitor.pass([el, false, this.options.scrollToErrorsOnBlur], this));
  10046. }
  10047. if (this.options.evaluateFieldsOnChange){
  10048. el.addEvent('change', this.validationMonitor.pass([el, true, this.options.scrollToErrorsOnChange], this));
  10049. }
  10050. }, this);
  10051. }
  10052. });
  10053. /*
  10054. ---
  10055. script: OverText.js
  10056. name: OverText
  10057. description: Shows text over an input that disappears when the user clicks into it. The text remains hidden if the user adds a value.
  10058. license: MIT-style license
  10059. authors:
  10060. - Aaron Newton
  10061. requires:
  10062. - Core/Options
  10063. - Core/Events
  10064. - Core/Element.Event
  10065. - Class.Binds
  10066. - Class.Occlude
  10067. - Element.Position
  10068. - Element.Shortcuts
  10069. provides: [OverText]
  10070. ...
  10071. */
  10072. (function(){
  10073. var OverText = this.OverText = new Class({
  10074. Implements: [Options, Events, Class.Occlude],
  10075. Binds: ['reposition', 'assert', 'focus', 'hide'],
  10076. options: {/*
  10077. textOverride: null,
  10078. onFocus: function(){},
  10079. onTextHide: function(textEl, inputEl){},
  10080. onTextShow: function(textEl, inputEl){}, */
  10081. element: 'label',
  10082. labelClass: 'overTxtLabel',
  10083. positionOptions: {
  10084. position: 'upperLeft',
  10085. edge: 'upperLeft',
  10086. offset: {
  10087. x: 4,
  10088. y: 2
  10089. }
  10090. },
  10091. poll: false,
  10092. pollInterval: 250,
  10093. wrap: false
  10094. },
  10095. property: 'OverText',
  10096. initialize: function(element, options){
  10097. element = this.element = document.id(element);
  10098. if (this.occlude()) return this.occluded;
  10099. this.setOptions(options);
  10100. this.attach(element);
  10101. OverText.instances.push(this);
  10102. if (this.options.poll) this.poll();
  10103. },
  10104. toElement: function(){
  10105. return this.element;
  10106. },
  10107. attach: function(){
  10108. var element = this.element,
  10109. options = this.options,
  10110. value = options.textOverride || element.get('alt') || element.get('title');
  10111. if (!value) return this;
  10112. var text = this.text = new Element(options.element, {
  10113. 'class': options.labelClass,
  10114. styles: {
  10115. lineHeight: 'normal',
  10116. position: 'absolute',
  10117. cursor: 'text'
  10118. },
  10119. html: value,
  10120. events: {
  10121. click: this.hide.pass(options.element == 'label', this)
  10122. }
  10123. }).inject(element, 'after');
  10124. if (options.element == 'label'){
  10125. if (!element.get('id')) element.set('id', 'input_' + String.uniqueID());
  10126. text.set('for', element.get('id'));
  10127. }
  10128. if (options.wrap){
  10129. this.textHolder = new Element('div.overTxtWrapper', {
  10130. styles: {
  10131. lineHeight: 'normal',
  10132. position: 'relative'
  10133. }
  10134. }).grab(text).inject(element, 'before');
  10135. }
  10136. return this.enable();
  10137. },
  10138. destroy: function(){
  10139. this.element.eliminate(this.property); // Class.Occlude storage
  10140. this.disable();
  10141. if (this.text) this.text.destroy();
  10142. if (this.textHolder) this.textHolder.destroy();
  10143. return this;
  10144. },
  10145. disable: function(){
  10146. this.element.removeEvents({
  10147. focus: this.focus,
  10148. blur: this.assert,
  10149. change: this.assert
  10150. });
  10151. window.removeEvent('resize', this.reposition);
  10152. this.hide(true, true);
  10153. return this;
  10154. },
  10155. enable: function(){
  10156. this.element.addEvents({
  10157. focus: this.focus,
  10158. blur: this.assert,
  10159. change: this.assert
  10160. });
  10161. window.addEvent('resize', this.reposition);
  10162. this.reposition();
  10163. return this;
  10164. },
  10165. wrap: function(){
  10166. if (this.options.element == 'label'){
  10167. if (!this.element.get('id')) this.element.set('id', 'input_' + String.uniqueID());
  10168. this.text.set('for', this.element.get('id'));
  10169. }
  10170. },
  10171. startPolling: function(){
  10172. this.pollingPaused = false;
  10173. return this.poll();
  10174. },
  10175. poll: function(stop){
  10176. //start immediately
  10177. //pause on focus
  10178. //resumeon blur
  10179. if (this.poller && !stop) return this;
  10180. if (stop){
  10181. clearInterval(this.poller);
  10182. } else {
  10183. this.poller = (function(){
  10184. if (!this.pollingPaused) this.assert(true);
  10185. }).periodical(this.options.pollInterval, this);
  10186. }
  10187. return this;
  10188. },
  10189. stopPolling: function(){
  10190. this.pollingPaused = true;
  10191. return this.poll(true);
  10192. },
  10193. focus: function(){
  10194. if (this.text && (!this.text.isDisplayed() || this.element.get('disabled'))) return this;
  10195. return this.hide();
  10196. },
  10197. hide: function(suppressFocus, force){
  10198. if (this.text && (this.text.isDisplayed() && (!this.element.get('disabled') || force))){
  10199. this.text.hide();
  10200. this.fireEvent('textHide', [this.text, this.element]);
  10201. this.pollingPaused = true;
  10202. if (!suppressFocus){
  10203. try {
  10204. this.element.fireEvent('focus');
  10205. this.element.focus();
  10206. } catch (e){} //IE barfs if you call focus on hidden elements
  10207. }
  10208. }
  10209. return this;
  10210. },
  10211. show: function(){
  10212. if (document.id(this.text) && !this.text.isDisplayed()){
  10213. this.text.show();
  10214. this.reposition();
  10215. this.fireEvent('textShow', [this.text, this.element]);
  10216. this.pollingPaused = false;
  10217. }
  10218. return this;
  10219. },
  10220. test: function(){
  10221. return !this.element.get('value');
  10222. },
  10223. assert: function(suppressFocus){
  10224. return this[this.test() ? 'show' : 'hide'](suppressFocus);
  10225. },
  10226. reposition: function(){
  10227. this.assert(true);
  10228. if (!this.element.isVisible()) return this.stopPolling().hide();
  10229. if (this.text && this.test()){
  10230. this.text.position(Object.merge(this.options.positionOptions, {
  10231. relativeTo: this.element
  10232. }));
  10233. }
  10234. return this;
  10235. }
  10236. });
  10237. })();
  10238. OverText.instances = [];
  10239. Object.append(OverText, {
  10240. each: function(fn){
  10241. return OverText.instances.each(function(ot, i){
  10242. if (ot.element && ot.text) fn.call(OverText, ot, i);
  10243. });
  10244. },
  10245. update: function(){
  10246. return OverText.each(function(ot){
  10247. return ot.reposition();
  10248. });
  10249. },
  10250. hideAll: function(){
  10251. return OverText.each(function(ot){
  10252. return ot.hide(true, true);
  10253. });
  10254. },
  10255. showAll: function(){
  10256. return OverText.each(function(ot){
  10257. return ot.show();
  10258. });
  10259. }
  10260. });
  10261. /*
  10262. ---
  10263. script: Fx.Elements.js
  10264. name: Fx.Elements
  10265. description: Effect to change any number of CSS properties of any number of Elements.
  10266. license: MIT-style license
  10267. authors:
  10268. - Valerio Proietti
  10269. requires:
  10270. - Core/Fx.CSS
  10271. - MooTools.More
  10272. provides: [Fx.Elements]
  10273. ...
  10274. */
  10275. Fx.Elements = new Class({
  10276. Extends: Fx.CSS,
  10277. initialize: function(elements, options){
  10278. this.elements = this.subject = $$(elements);
  10279. this.parent(options);
  10280. },
  10281. compute: function(from, to, delta){
  10282. var now = {};
  10283. for (var i in from){
  10284. var iFrom = from[i], iTo = to[i], iNow = now[i] = {};
  10285. for (var p in iFrom) iNow[p] = this.parent(iFrom[p], iTo[p], delta);
  10286. }
  10287. return now;
  10288. },
  10289. set: function(now){
  10290. for (var i in now){
  10291. if (!this.elements[i]) continue;
  10292. var iNow = now[i];
  10293. for (var p in iNow) this.render(this.elements[i], p, iNow[p], this.options.unit);
  10294. }
  10295. return this;
  10296. },
  10297. start: function(obj){
  10298. if (!this.check(obj)) return this;
  10299. var from = {}, to = {};
  10300. for (var i in obj){
  10301. if (!this.elements[i]) continue;
  10302. var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {};
  10303. for (var p in iProps){
  10304. var parsed = this.prepare(this.elements[i], p, iProps[p]);
  10305. iFrom[p] = parsed.from;
  10306. iTo[p] = parsed.to;
  10307. }
  10308. }
  10309. return this.parent(from, to);
  10310. }
  10311. });
  10312. /*
  10313. ---
  10314. script: Fx.Accordion.js
  10315. name: Fx.Accordion
  10316. description: An Fx.Elements extension which allows you to easily create accordion type controls.
  10317. license: MIT-style license
  10318. authors:
  10319. - Valerio Proietti
  10320. requires:
  10321. - Core/Element.Event
  10322. - Fx.Elements
  10323. provides: [Fx.Accordion]
  10324. ...
  10325. */
  10326. Fx.Accordion = new Class({
  10327. Extends: Fx.Elements,
  10328. options: {/*
  10329. onActive: function(toggler, section){},
  10330. onBackground: function(toggler, section){},*/
  10331. fixedHeight: false,
  10332. fixedWidth: false,
  10333. display: 0,
  10334. show: false,
  10335. height: true,
  10336. width: false,
  10337. opacity: true,
  10338. alwaysHide: false,
  10339. trigger: 'click',
  10340. initialDisplayFx: true,
  10341. resetHeight: true,
  10342. keepOpen: false
  10343. },
  10344. initialize: function(){
  10345. var defined = function(obj){
  10346. return obj != null;
  10347. };
  10348. var params = Array.link(arguments, {
  10349. 'container': Type.isElement, //deprecated
  10350. 'options': Type.isObject,
  10351. 'togglers': defined,
  10352. 'elements': defined
  10353. });
  10354. this.parent(params.elements, params.options);
  10355. var options = this.options,
  10356. togglers = this.togglers = $$(params.togglers);
  10357. this.previous = -1;
  10358. this.internalChain = new Chain();
  10359. if (options.alwaysHide) this.options.link = 'chain';
  10360. if (options.show || this.options.show === 0){
  10361. options.display = false;
  10362. this.previous = options.show;
  10363. }
  10364. if (options.start){
  10365. options.display = false;
  10366. options.show = false;
  10367. }
  10368. var effects = this.effects = {};
  10369. if (options.opacity) effects.opacity = 'fullOpacity';
  10370. if (options.width) effects.width = options.fixedWidth ? 'fullWidth' : 'offsetWidth';
  10371. if (options.height) effects.height = options.fixedHeight ? 'fullHeight' : 'scrollHeight';
  10372. for (var i = 0, l = togglers.length; i < l; i++) this.addSection(togglers[i], this.elements[i]);
  10373. this.elements.each(function(el, i){
  10374. if (options.show === i){
  10375. this.fireEvent('active', [togglers[i], el]);
  10376. } else {
  10377. for (var fx in effects) el.setStyle(fx, 0);
  10378. }
  10379. }, this);
  10380. if (options.display || options.display === 0 || options.initialDisplayFx === false){
  10381. this.display(options.display, options.initialDisplayFx);
  10382. }
  10383. if (options.fixedHeight !== false) options.resetHeight = false;
  10384. this.addEvent('complete', this.internalChain.callChain.bind(this.internalChain));
  10385. },
  10386. addSection: function(toggler, element){
  10387. toggler = document.id(toggler);
  10388. element = document.id(element);
  10389. this.togglers.include(toggler);
  10390. this.elements.include(element);
  10391. var togglers = this.togglers,
  10392. options = this.options,
  10393. test = togglers.contains(toggler),
  10394. idx = togglers.indexOf(toggler),
  10395. displayer = this.display.pass(idx, this);
  10396. toggler.store('accordion:display', displayer)
  10397. .addEvent(options.trigger, displayer);
  10398. if (options.height) element.setStyles({'padding-top': 0, 'border-top': 'none', 'padding-bottom': 0, 'border-bottom': 'none'});
  10399. if (options.width) element.setStyles({'padding-left': 0, 'border-left': 'none', 'padding-right': 0, 'border-right': 'none'});
  10400. element.fullOpacity = 1;
  10401. if (options.fixedWidth) element.fullWidth = options.fixedWidth;
  10402. if (options.fixedHeight) element.fullHeight = options.fixedHeight;
  10403. element.setStyle('overflow', 'hidden');
  10404. if (!test) for (var fx in this.effects){
  10405. element.setStyle(fx, 0);
  10406. }
  10407. return this;
  10408. },
  10409. removeSection: function(toggler, displayIndex){
  10410. var togglers = this.togglers,
  10411. idx = togglers.indexOf(toggler),
  10412. element = this.elements[idx];
  10413. var remover = function(){
  10414. togglers.erase(toggler);
  10415. this.elements.erase(element);
  10416. this.detach(toggler);
  10417. }.bind(this);
  10418. if (this.now == idx || displayIndex != null){
  10419. this.display(displayIndex != null ? displayIndex : (idx - 1 >= 0 ? idx - 1 : 0)).chain(remover);
  10420. } else {
  10421. remover();
  10422. }
  10423. return this;
  10424. },
  10425. detach: function(toggler){
  10426. var remove = function(toggler){
  10427. toggler.removeEvent(this.options.trigger, toggler.retrieve('accordion:display'));
  10428. }.bind(this);
  10429. if (!toggler) this.togglers.each(remove);
  10430. else remove(toggler);
  10431. return this;
  10432. },
  10433. display: function(index, useFx){
  10434. if (!this.check(index, useFx)) return this;
  10435. var obj = {},
  10436. elements = this.elements,
  10437. options = this.options,
  10438. effects = this.effects,
  10439. keepOpen = options.keepOpen,
  10440. alwaysHide = options.alwaysHide;
  10441. if (useFx == null) useFx = true;
  10442. if (typeOf(index) == 'element') index = elements.indexOf(index);
  10443. if (index == this.current && !alwaysHide && !keepOpen) return this;
  10444. if (options.resetHeight){
  10445. var prev = elements[this.current];
  10446. if (prev && !this.selfHidden){
  10447. for (var fx in effects) prev.setStyle(fx, prev[effects[fx]]);
  10448. }
  10449. }
  10450. if (this.timer && options.link == 'chain') return this;
  10451. if (this.current != null) this.previous = this.current;
  10452. this.current = index;
  10453. this.selfHidden = false;
  10454. elements.each(function(el, i){
  10455. obj[i] = {};
  10456. var hide, isOpen;
  10457. if (!keepOpen || i == index){
  10458. if (i == index) isOpen = (el.offsetHeight > 0 && options.height) || (el.offsetWidth > 0 && options.width);
  10459. if (i != index){
  10460. hide = true;
  10461. } else if ((alwaysHide || keepOpen) && isOpen){
  10462. hide = true;
  10463. this.selfHidden = true;
  10464. }
  10465. this.fireEvent(hide ? 'background' : 'active', [this.togglers[i], el]);
  10466. for (var fx in effects) obj[i][fx] = hide ? 0 : el[effects[fx]];
  10467. if (!useFx && !hide && options.resetHeight) obj[i].height = 'auto';
  10468. }
  10469. }, this);
  10470. this.internalChain.clearChain();
  10471. this.internalChain.chain(function(){
  10472. if (options.resetHeight && !this.selfHidden){
  10473. var el = elements[index];
  10474. if (el) el.setStyle('height', 'auto');
  10475. }
  10476. }.bind(this));
  10477. return useFx ? this.start(obj) : this.set(obj).internalChain.callChain();
  10478. }
  10479. });
  10480. /*<1.2compat>*/
  10481. /*
  10482. Compatibility with 1.2.0
  10483. */
  10484. var Accordion = new Class({
  10485. Extends: Fx.Accordion,
  10486. initialize: function(){
  10487. this.parent.apply(this, arguments);
  10488. var params = Array.link(arguments, {'container': Type.isElement});
  10489. this.container = params.container;
  10490. },
  10491. addSection: function(toggler, element, pos){
  10492. toggler = document.id(toggler);
  10493. element = document.id(element);
  10494. var test = this.togglers.contains(toggler);
  10495. var len = this.togglers.length;
  10496. if (len && (!test || pos)){
  10497. pos = pos != null ? pos : len - 1;
  10498. toggler.inject(this.togglers[pos], 'before');
  10499. element.inject(toggler, 'after');
  10500. } else if (this.container && !test){
  10501. toggler.inject(this.container);
  10502. element.inject(this.container);
  10503. }
  10504. return this.parent.apply(this, arguments);
  10505. }
  10506. });
  10507. /*</1.2compat>*/
  10508. /*
  10509. ---
  10510. script: Fx.Move.js
  10511. name: Fx.Move
  10512. description: Defines Fx.Move, a class that works with Element.Position.js to transition an element from one location to another.
  10513. license: MIT-style license
  10514. authors:
  10515. - Aaron Newton
  10516. requires:
  10517. - Core/Fx.Morph
  10518. - Element.Position
  10519. provides: [Fx.Move]
  10520. ...
  10521. */
  10522. Fx.Move = new Class({
  10523. Extends: Fx.Morph,
  10524. options: {
  10525. relativeTo: document.body,
  10526. position: 'center',
  10527. edge: false,
  10528. offset: {x: 0, y: 0}
  10529. },
  10530. start: function(destination){
  10531. var element = this.element,
  10532. topLeft = element.getStyles('top', 'left');
  10533. if (topLeft.top == 'auto' || topLeft.left == 'auto'){
  10534. element.setPosition(element.getPosition(element.getOffsetParent()));
  10535. }
  10536. return this.parent(element.position(Object.merge({}, this.options, destination, {returnPos: true})));
  10537. }
  10538. });
  10539. Element.Properties.move = {
  10540. set: function(options){
  10541. this.get('move').cancel().setOptions(options);
  10542. return this;
  10543. },
  10544. get: function(){
  10545. var move = this.retrieve('move');
  10546. if (!move){
  10547. move = new Fx.Move(this, {link: 'cancel'});
  10548. this.store('move', move);
  10549. }
  10550. return move;
  10551. }
  10552. };
  10553. Element.implement({
  10554. move: function(options){
  10555. this.get('move').start(options);
  10556. return this;
  10557. }
  10558. });
  10559. /*
  10560. ---
  10561. script: Fx.Scroll.js
  10562. name: Fx.Scroll
  10563. description: Effect to smoothly scroll any element, including the window.
  10564. license: MIT-style license
  10565. authors:
  10566. - Valerio Proietti
  10567. requires:
  10568. - Core/Fx
  10569. - Core/Element.Event
  10570. - Core/Element.Dimensions
  10571. - MooTools.More
  10572. provides: [Fx.Scroll]
  10573. ...
  10574. */
  10575. (function(){
  10576. Fx.Scroll = new Class({
  10577. Extends: Fx,
  10578. options: {
  10579. offset: {x: 0, y: 0},
  10580. wheelStops: true
  10581. },
  10582. initialize: function(element, options){
  10583. this.element = this.subject = document.id(element);
  10584. this.parent(options);
  10585. if (typeOf(this.element) != 'element') this.element = document.id(this.element.getDocument().body);
  10586. if (this.options.wheelStops){
  10587. var stopper = this.element,
  10588. cancel = this.cancel.pass(false, this);
  10589. this.addEvent('start', function(){
  10590. stopper.addEvent('mousewheel', cancel);
  10591. }, true);
  10592. this.addEvent('complete', function(){
  10593. stopper.removeEvent('mousewheel', cancel);
  10594. }, true);
  10595. }
  10596. },
  10597. set: function(){
  10598. var now = Array.flatten(arguments);
  10599. this.element.scrollTo(now[0], now[1]);
  10600. return this;
  10601. },
  10602. compute: function(from, to, delta){
  10603. return [0, 1].map(function(i){
  10604. return Fx.compute(from[i], to[i], delta);
  10605. });
  10606. },
  10607. start: function(x, y){
  10608. if (!this.check(x, y)) return this;
  10609. var scroll = this.element.getScroll();
  10610. return this.parent([scroll.x, scroll.y], [x, y]);
  10611. },
  10612. calculateScroll: function(x, y){
  10613. var element = this.element,
  10614. scrollSize = element.getScrollSize(),
  10615. scroll = element.getScroll(),
  10616. size = element.getSize(),
  10617. offset = this.options.offset,
  10618. values = {x: x, y: y};
  10619. for (var z in values){
  10620. if (!values[z] && values[z] !== 0) values[z] = scroll[z];
  10621. if (typeOf(values[z]) != 'number') values[z] = scrollSize[z] - size[z];
  10622. values[z] += offset[z];
  10623. }
  10624. return [values.x, values.y];
  10625. },
  10626. toTop: function(){
  10627. return this.start.apply(this, this.calculateScroll(false, 0));
  10628. },
  10629. toLeft: function(){
  10630. return this.start.apply(this, this.calculateScroll(0, false));
  10631. },
  10632. toRight: function(){
  10633. return this.start.apply(this, this.calculateScroll('right', false));
  10634. },
  10635. toBottom: function(){
  10636. return this.start.apply(this, this.calculateScroll(false, 'bottom'));
  10637. },
  10638. toElement: function(el, axes){
  10639. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10640. var scroll = isBody(this.element) ? {x: 0, y: 0} : this.element.getScroll();
  10641. var position = Object.map(document.id(el).getPosition(this.element), function(value, axis){
  10642. return axes.contains(axis) ? value + scroll[axis] : false;
  10643. });
  10644. return this.start.apply(this, this.calculateScroll(position.x, position.y));
  10645. },
  10646. toElementEdge: function(el, axes, offset){
  10647. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10648. el = document.id(el);
  10649. var to = {},
  10650. position = el.getPosition(this.element),
  10651. size = el.getSize(),
  10652. scroll = this.element.getScroll(),
  10653. containerSize = this.element.getSize(),
  10654. edge = {
  10655. x: position.x + size.x,
  10656. y: position.y + size.y
  10657. };
  10658. ['x', 'y'].each(function(axis){
  10659. if (axes.contains(axis)){
  10660. if (edge[axis] > scroll[axis] + containerSize[axis]) to[axis] = edge[axis] - containerSize[axis];
  10661. if (position[axis] < scroll[axis]) to[axis] = position[axis];
  10662. }
  10663. if (to[axis] == null) to[axis] = scroll[axis];
  10664. if (offset && offset[axis]) to[axis] = to[axis] + offset[axis];
  10665. }, this);
  10666. if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y);
  10667. return this;
  10668. },
  10669. toElementCenter: function(el, axes, offset){
  10670. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10671. el = document.id(el);
  10672. var to = {},
  10673. position = el.getPosition(this.element),
  10674. size = el.getSize(),
  10675. scroll = this.element.getScroll(),
  10676. containerSize = this.element.getSize();
  10677. ['x', 'y'].each(function(axis){
  10678. if (axes.contains(axis)){
  10679. to[axis] = position[axis] - (containerSize[axis] - size[axis]) / 2;
  10680. }
  10681. if (to[axis] == null) to[axis] = scroll[axis];
  10682. if (offset && offset[axis]) to[axis] = to[axis] + offset[axis];
  10683. }, this);
  10684. if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y);
  10685. return this;
  10686. }
  10687. });
  10688. //<1.2compat>
  10689. Fx.Scroll.implement({
  10690. scrollToCenter: function(){
  10691. return this.toElementCenter.apply(this, arguments);
  10692. },
  10693. scrollIntoView: function(){
  10694. return this.toElementEdge.apply(this, arguments);
  10695. }
  10696. });
  10697. //</1.2compat>
  10698. function isBody(element){
  10699. return (/^(?:body|html)$/i).test(element.tagName);
  10700. }
  10701. })();
  10702. /*
  10703. ---
  10704. script: Fx.Slide.js
  10705. name: Fx.Slide
  10706. description: Effect to slide an element in and out of view.
  10707. license: MIT-style license
  10708. authors:
  10709. - Valerio Proietti
  10710. requires:
  10711. - Core/Fx
  10712. - Core/Element.Style
  10713. - MooTools.More
  10714. provides: [Fx.Slide]
  10715. ...
  10716. */
  10717. Fx.Slide = new Class({
  10718. Extends: Fx,
  10719. options: {
  10720. mode: 'vertical',
  10721. wrapper: false,
  10722. hideOverflow: true,
  10723. resetHeight: false
  10724. },
  10725. initialize: function(element, options){
  10726. element = this.element = this.subject = document.id(element);
  10727. this.parent(options);
  10728. options = this.options;
  10729. var wrapper = element.retrieve('wrapper'),
  10730. styles = element.getStyles('margin', 'position', 'overflow');
  10731. if (options.hideOverflow) styles = Object.append(styles, {overflow: 'hidden'});
  10732. if (options.wrapper) wrapper = document.id(options.wrapper).setStyles(styles);
  10733. if (!wrapper) wrapper = new Element('div', {
  10734. styles: styles
  10735. }).wraps(element);
  10736. element.store('wrapper', wrapper).setStyle('margin', 0);
  10737. if (element.getStyle('overflow') == 'visible') element.setStyle('overflow', 'hidden');
  10738. this.now = [];
  10739. this.open = true;
  10740. this.wrapper = wrapper;
  10741. this.addEvent('complete', function(){
  10742. this.open = (wrapper['offset' + this.layout.capitalize()] != 0);
  10743. if (this.open && this.options.resetHeight) wrapper.setStyle('height', '');
  10744. }, true);
  10745. },
  10746. vertical: function(){
  10747. this.margin = 'margin-top';
  10748. this.layout = 'height';
  10749. this.offset = this.element.offsetHeight;
  10750. },
  10751. horizontal: function(){
  10752. this.margin = 'margin-left';
  10753. this.layout = 'width';
  10754. this.offset = this.element.offsetWidth;
  10755. },
  10756. set: function(now){
  10757. this.element.setStyle(this.margin, now[0]);
  10758. this.wrapper.setStyle(this.layout, now[1]);
  10759. return this;
  10760. },
  10761. compute: function(from, to, delta){
  10762. return [0, 1].map(function(i){
  10763. return Fx.compute(from[i], to[i], delta);
  10764. });
  10765. },
  10766. start: function(how, mode){
  10767. if (!this.check(how, mode)) return this;
  10768. this[mode || this.options.mode]();
  10769. var margin = this.element.getStyle(this.margin).toInt(),
  10770. layout = this.wrapper.getStyle(this.layout).toInt(),
  10771. caseIn = [[margin, layout], [0, this.offset]],
  10772. caseOut = [[margin, layout], [-this.offset, 0]],
  10773. start;
  10774. switch (how){
  10775. case 'in': start = caseIn; break;
  10776. case 'out': start = caseOut; break;
  10777. case 'toggle': start = (layout == 0) ? caseIn : caseOut;
  10778. }
  10779. return this.parent(start[0], start[1]);
  10780. },
  10781. slideIn: function(mode){
  10782. return this.start('in', mode);
  10783. },
  10784. slideOut: function(mode){
  10785. return this.start('out', mode);
  10786. },
  10787. hide: function(mode){
  10788. this[mode || this.options.mode]();
  10789. this.open = false;
  10790. return this.set([-this.offset, 0]);
  10791. },
  10792. show: function(mode){
  10793. this[mode || this.options.mode]();
  10794. this.open = true;
  10795. return this.set([0, this.offset]);
  10796. },
  10797. toggle: function(mode){
  10798. return this.start('toggle', mode);
  10799. }
  10800. });
  10801. Element.Properties.slide = {
  10802. set: function(options){
  10803. this.get('slide').cancel().setOptions(options);
  10804. return this;
  10805. },
  10806. get: function(){
  10807. var slide = this.retrieve('slide');
  10808. if (!slide){
  10809. slide = new Fx.Slide(this, {link: 'cancel'});
  10810. this.store('slide', slide);
  10811. }
  10812. return slide;
  10813. }
  10814. };
  10815. Element.implement({
  10816. slide: function(how, mode){
  10817. how = how || 'toggle';
  10818. var slide = this.get('slide'), toggle;
  10819. switch (how){
  10820. case 'hide': slide.hide(mode); break;
  10821. case 'show': slide.show(mode); break;
  10822. case 'toggle':
  10823. var flag = this.retrieve('slide:flag', slide.open);
  10824. slide[flag ? 'slideOut' : 'slideIn'](mode);
  10825. this.store('slide:flag', !flag);
  10826. toggle = true;
  10827. break;
  10828. default: slide.start(how, mode);
  10829. }
  10830. if (!toggle) this.eliminate('slide:flag');
  10831. return this;
  10832. }
  10833. });
  10834. /*
  10835. ---
  10836. script: Fx.SmoothScroll.js
  10837. name: Fx.SmoothScroll
  10838. description: Class for creating a smooth scrolling effect to all internal links on the page.
  10839. license: MIT-style license
  10840. authors:
  10841. - Valerio Proietti
  10842. requires:
  10843. - Core/Slick.Finder
  10844. - Fx.Scroll
  10845. provides: [Fx.SmoothScroll]
  10846. ...
  10847. */
  10848. /*<1.2compat>*/var SmoothScroll = /*</1.2compat>*/Fx.SmoothScroll = new Class({
  10849. Extends: Fx.Scroll,
  10850. options: {
  10851. axes: ['x', 'y']
  10852. },
  10853. initialize: function(options, context){
  10854. context = context || document;
  10855. this.doc = context.getDocument();
  10856. this.parent(this.doc, options);
  10857. var win = context.getWindow(),
  10858. location = win.location.href.match(/^[^#]*/)[0] + '#',
  10859. links = $$(this.options.links || this.doc.links);
  10860. links.each(function(link){
  10861. if (link.href.indexOf(location) != 0) return;
  10862. var anchor = link.href.substr(location.length);
  10863. if (anchor) this.useLink(link, anchor);
  10864. }, this);
  10865. this.addEvent('complete', function(){
  10866. win.location.hash = this.anchor;
  10867. this.element.scrollTo(this.to[0], this.to[1]);
  10868. }, true);
  10869. },
  10870. useLink: function(link, anchor){
  10871. link.addEvent('click', function(event){
  10872. var el = document.id(anchor) || this.doc.getElement('a[name=' + anchor + ']');
  10873. if (!el) return;
  10874. event.preventDefault();
  10875. this.toElement(el, this.options.axes).chain(function(){
  10876. this.fireEvent('scrolledTo', [link, el]);
  10877. }.bind(this));
  10878. this.anchor = anchor;
  10879. }.bind(this));
  10880. return this;
  10881. }
  10882. });
  10883. /*
  10884. ---
  10885. script: Fx.Sort.js
  10886. name: Fx.Sort
  10887. description: Defines Fx.Sort, a class that reorders lists with a transition.
  10888. license: MIT-style license
  10889. authors:
  10890. - Aaron Newton
  10891. requires:
  10892. - Core/Element.Dimensions
  10893. - Fx.Elements
  10894. - Element.Measure
  10895. provides: [Fx.Sort]
  10896. ...
  10897. */
  10898. Fx.Sort = new Class({
  10899. Extends: Fx.Elements,
  10900. options: {
  10901. mode: 'vertical'
  10902. },
  10903. initialize: function(elements, options){
  10904. this.parent(elements, options);
  10905. this.elements.each(function(el){
  10906. if (el.getStyle('position') == 'static') el.setStyle('position', 'relative');
  10907. });
  10908. this.setDefaultOrder();
  10909. },
  10910. setDefaultOrder: function(){
  10911. this.currentOrder = this.elements.map(function(el, index){
  10912. return index;
  10913. });
  10914. },
  10915. sort: function(){
  10916. if (!this.check(arguments)) return this;
  10917. var newOrder = Array.flatten(arguments);
  10918. var top = 0,
  10919. left = 0,
  10920. next = {},
  10921. zero = {},
  10922. vert = this.options.mode == 'vertical';
  10923. var current = this.elements.map(function(el, index){
  10924. var size = el.getComputedSize({styles: ['border', 'padding', 'margin']});
  10925. var val;
  10926. if (vert){
  10927. val = {
  10928. top: top,
  10929. margin: size['margin-top'],
  10930. height: size.totalHeight
  10931. };
  10932. top += val.height - size['margin-top'];
  10933. } else {
  10934. val = {
  10935. left: left,
  10936. margin: size['margin-left'],
  10937. width: size.totalWidth
  10938. };
  10939. left += val.width;
  10940. }
  10941. var plane = vert ? 'top' : 'left';
  10942. zero[index] = {};
  10943. var start = el.getStyle(plane).toInt();
  10944. zero[index][plane] = start || 0;
  10945. return val;
  10946. }, this);
  10947. this.set(zero);
  10948. newOrder = newOrder.map(function(i){ return i.toInt(); });
  10949. if (newOrder.length != this.elements.length){
  10950. this.currentOrder.each(function(index){
  10951. if (!newOrder.contains(index)) newOrder.push(index);
  10952. });
  10953. if (newOrder.length > this.elements.length)
  10954. newOrder.splice(this.elements.length-1, newOrder.length - this.elements.length);
  10955. }
  10956. var margin = 0;
  10957. top = left = 0;
  10958. newOrder.each(function(item){
  10959. var newPos = {};
  10960. if (vert){
  10961. newPos.top = top - current[item].top - margin;
  10962. top += current[item].height;
  10963. } else {
  10964. newPos.left = left - current[item].left;
  10965. left += current[item].width;
  10966. }
  10967. margin = margin + current[item].margin;
  10968. next[item]=newPos;
  10969. }, this);
  10970. var mapped = {};
  10971. Array.clone(newOrder).sort().each(function(index){
  10972. mapped[index] = next[index];
  10973. });
  10974. this.start(mapped);
  10975. this.currentOrder = newOrder;
  10976. return this;
  10977. },
  10978. rearrangeDOM: function(newOrder){
  10979. newOrder = newOrder || this.currentOrder;
  10980. var parent = this.elements[0].getParent();
  10981. var rearranged = [];
  10982. this.elements.setStyle('opacity', 0);
  10983. //move each element and store the new default order
  10984. newOrder.each(function(index){
  10985. rearranged.push(this.elements[index].inject(parent).setStyles({
  10986. top: 0,
  10987. left: 0
  10988. }));
  10989. }, this);
  10990. this.elements.setStyle('opacity', 1);
  10991. this.elements = $$(rearranged);
  10992. this.setDefaultOrder();
  10993. return this;
  10994. },
  10995. getDefaultOrder: function(){
  10996. return this.elements.map(function(el, index){
  10997. return index;
  10998. });
  10999. },
  11000. getCurrentOrder: function(){
  11001. return this.currentOrder;
  11002. },
  11003. forward: function(){
  11004. return this.sort(this.getDefaultOrder());
  11005. },
  11006. backward: function(){
  11007. return this.sort(this.getDefaultOrder().reverse());
  11008. },
  11009. reverse: function(){
  11010. return this.sort(this.currentOrder.reverse());
  11011. },
  11012. sortByElements: function(elements){
  11013. return this.sort(elements.map(function(el){
  11014. return this.elements.indexOf(el);
  11015. }, this));
  11016. },
  11017. swap: function(one, two){
  11018. if (typeOf(one) == 'element') one = this.elements.indexOf(one);
  11019. if (typeOf(two) == 'element') two = this.elements.indexOf(two);
  11020. var newOrder = Array.clone(this.currentOrder);
  11021. newOrder[this.currentOrder.indexOf(one)] = two;
  11022. newOrder[this.currentOrder.indexOf(two)] = one;
  11023. return this.sort(newOrder);
  11024. }
  11025. });
  11026. /*
  11027. ---
  11028. script: Keyboard.js
  11029. name: Keyboard
  11030. description: KeyboardEvents used to intercept events on a class for keyboard and format modifiers in a specific order so as to make alt+shift+c the same as shift+alt+c.
  11031. license: MIT-style license
  11032. authors:
  11033. - Perrin Westrich
  11034. - Aaron Newton
  11035. - Scott Kyle
  11036. requires:
  11037. - Core/Events
  11038. - Core/Options
  11039. - Core/Element.Event
  11040. - Element.Event.Pseudos.Keys
  11041. provides: [Keyboard]
  11042. ...
  11043. */
  11044. (function(){
  11045. var Keyboard = this.Keyboard = new Class({
  11046. Extends: Events,
  11047. Implements: [Options],
  11048. options: {/*
  11049. onActivate: function(){},
  11050. onDeactivate: function(){},*/
  11051. defaultEventType: 'keydown',
  11052. active: false,
  11053. manager: null,
  11054. events: {},
  11055. nonParsedEvents: ['activate', 'deactivate', 'onactivate', 'ondeactivate', 'changed', 'onchanged']
  11056. },
  11057. initialize: function(options){
  11058. if (options && options.manager){
  11059. this._manager = options.manager;
  11060. delete options.manager;
  11061. }
  11062. this.setOptions(options);
  11063. this._setup();
  11064. },
  11065. addEvent: function(type, fn, internal){
  11066. return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn, internal);
  11067. },
  11068. removeEvent: function(type, fn){
  11069. return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn);
  11070. },
  11071. toggleActive: function(){
  11072. return this[this.isActive() ? 'deactivate' : 'activate']();
  11073. },
  11074. activate: function(instance){
  11075. if (instance){
  11076. if (instance.isActive()) return this;
  11077. //if we're stealing focus, store the last keyboard to have it so the relinquish command works
  11078. if (this._activeKB && instance != this._activeKB){
  11079. this.previous = this._activeKB;
  11080. this.previous.fireEvent('deactivate');
  11081. }
  11082. //if we're enabling a child, assign it so that events are now passed to it
  11083. this._activeKB = instance.fireEvent('activate');
  11084. Keyboard.manager.fireEvent('changed');
  11085. } else if (this._manager){
  11086. //else we're enabling ourselves, we must ask our parent to do it for us
  11087. this._manager.activate(this);
  11088. }
  11089. return this;
  11090. },
  11091. isActive: function(){
  11092. return this._manager ? (this._manager._activeKB == this) : (Keyboard.manager == this);
  11093. },
  11094. deactivate: function(instance){
  11095. if (instance){
  11096. if (instance === this._activeKB){
  11097. this._activeKB = null;
  11098. instance.fireEvent('deactivate');
  11099. Keyboard.manager.fireEvent('changed');
  11100. }
  11101. } else if (this._manager){
  11102. this._manager.deactivate(this);
  11103. }
  11104. return this;
  11105. },
  11106. relinquish: function(){
  11107. if (this.isActive() && this._manager && this._manager.previous) this._manager.activate(this._manager.previous);
  11108. else this.deactivate();
  11109. return this;
  11110. },
  11111. //management logic
  11112. manage: function(instance){
  11113. if (instance._manager) instance._manager.drop(instance);
  11114. this._instances.push(instance);
  11115. instance._manager = this;
  11116. if (!this._activeKB) this.activate(instance);
  11117. return this;
  11118. },
  11119. drop: function(instance){
  11120. instance.relinquish();
  11121. this._instances.erase(instance);
  11122. if (this._activeKB == instance){
  11123. if (this.previous && this._instances.contains(this.previous)) this.activate(this.previous);
  11124. else this._activeKB = this._instances[0];
  11125. }
  11126. return this;
  11127. },
  11128. trace: function(){
  11129. Keyboard.trace(this);
  11130. },
  11131. each: function(fn){
  11132. Keyboard.each(this, fn);
  11133. },
  11134. /*
  11135. PRIVATE METHODS
  11136. */
  11137. _instances: [],
  11138. _disable: function(instance){
  11139. if (this._activeKB == instance) this._activeKB = null;
  11140. },
  11141. _setup: function(){
  11142. this.addEvents(this.options.events);
  11143. //if this is the root manager, nothing manages it
  11144. if (Keyboard.manager && !this._manager) Keyboard.manager.manage(this);
  11145. if (this.options.active) this.activate();
  11146. else this.relinquish();
  11147. },
  11148. _handle: function(event, type){
  11149. //Keyboard.stop(event) prevents key propagation
  11150. if (event.preventKeyboardPropagation) return;
  11151. var bubbles = !!this._manager;
  11152. if (bubbles && this._activeKB){
  11153. this._activeKB._handle(event, type);
  11154. if (event.preventKeyboardPropagation) return;
  11155. }
  11156. this.fireEvent(type, event);
  11157. if (!bubbles && this._activeKB) this._activeKB._handle(event, type);
  11158. }
  11159. });
  11160. var parsed = {};
  11161. var modifiers = ['shift', 'control', 'alt', 'meta'];
  11162. var regex = /^(?:shift|control|ctrl|alt|meta)$/;
  11163. Keyboard.parse = function(type, eventType, ignore){
  11164. if (ignore && ignore.contains(type.toLowerCase())) return type;
  11165. type = type.toLowerCase().replace(/^(keyup|keydown):/, function($0, $1){
  11166. eventType = $1;
  11167. return '';
  11168. });
  11169. if (!parsed[type]){
  11170. if (type != '+'){
  11171. var key, mods = {};
  11172. type.split('+').each(function(part){
  11173. if (regex.test(part)) mods[part] = true;
  11174. else key = part;
  11175. });
  11176. mods.control = mods.control || mods.ctrl; // allow both control and ctrl
  11177. var keys = [];
  11178. modifiers.each(function(mod){
  11179. if (mods[mod]) keys.push(mod);
  11180. });
  11181. if (key) keys.push(key);
  11182. parsed[type] = keys.join('+');
  11183. } else {
  11184. parsed[type] = type;
  11185. }
  11186. }
  11187. return eventType + ':keys(' + parsed[type] + ')';
  11188. };
  11189. Keyboard.each = function(keyboard, fn){
  11190. var current = keyboard || Keyboard.manager;
  11191. while (current){
  11192. fn(current);
  11193. current = current._activeKB;
  11194. }
  11195. };
  11196. Keyboard.stop = function(event){
  11197. event.preventKeyboardPropagation = true;
  11198. };
  11199. Keyboard.manager = new Keyboard({
  11200. active: true
  11201. });
  11202. Keyboard.trace = function(keyboard){
  11203. keyboard = keyboard || Keyboard.manager;
  11204. var hasConsole = window.console && console.log;
  11205. if (hasConsole) console.log('the following items have focus: ');
  11206. Keyboard.each(keyboard, function(current){
  11207. if (hasConsole) console.log(document.id(current.widget) || current.wiget || current);
  11208. });
  11209. };
  11210. var handler = function(event){
  11211. var keys = [];
  11212. modifiers.each(function(mod){
  11213. if (event[mod]) keys.push(mod);
  11214. });
  11215. if (!regex.test(event.key)) keys.push(event.key);
  11216. Keyboard.manager._handle(event, event.type + ':keys(' + keys.join('+') + ')');
  11217. };
  11218. document.addEvents({
  11219. 'keyup': handler,
  11220. 'keydown': handler
  11221. });
  11222. })();
  11223. /*
  11224. ---
  11225. script: Keyboard.Extras.js
  11226. name: Keyboard.Extras
  11227. description: Enhances Keyboard by adding the ability to name and describe keyboard shortcuts, and the ability to grab shortcuts by name and bind the shortcut to different keys.
  11228. license: MIT-style license
  11229. authors:
  11230. - Perrin Westrich
  11231. requires:
  11232. - Keyboard
  11233. - MooTools.More
  11234. provides: [Keyboard.Extras]
  11235. ...
  11236. */
  11237. Keyboard.prototype.options.nonParsedEvents.combine(['rebound', 'onrebound']);
  11238. Keyboard.implement({
  11239. /*
  11240. shortcut should be in the format of:
  11241. {
  11242. 'keys': 'shift+s', // the default to add as an event.
  11243. 'description': 'blah blah blah', // a brief description of the functionality.
  11244. 'handler': function(){} // the event handler to run when keys are pressed.
  11245. }
  11246. */
  11247. addShortcut: function(name, shortcut){
  11248. this._shortcuts = this._shortcuts || [];
  11249. this._shortcutIndex = this._shortcutIndex || {};
  11250. shortcut.getKeyboard = Function.convert(this);
  11251. shortcut.name = name;
  11252. this._shortcutIndex[name] = shortcut;
  11253. this._shortcuts.push(shortcut);
  11254. if (shortcut.keys) this.addEvent(shortcut.keys, shortcut.handler);
  11255. return this;
  11256. },
  11257. addShortcuts: function(obj){
  11258. for (var name in obj) this.addShortcut(name, obj[name]);
  11259. return this;
  11260. },
  11261. removeShortcut: function(name){
  11262. var shortcut = this.getShortcut(name);
  11263. if (shortcut && shortcut.keys){
  11264. this.removeEvent(shortcut.keys, shortcut.handler);
  11265. delete this._shortcutIndex[name];
  11266. this._shortcuts.erase(shortcut);
  11267. }
  11268. return this;
  11269. },
  11270. removeShortcuts: function(names){
  11271. names.each(this.removeShortcut, this);
  11272. return this;
  11273. },
  11274. getShortcuts: function(){
  11275. return this._shortcuts || [];
  11276. },
  11277. getShortcut: function(name){
  11278. return (this._shortcutIndex || {})[name];
  11279. }
  11280. });
  11281. Keyboard.rebind = function(newKeys, shortcuts){
  11282. Array.convert(shortcuts).each(function(shortcut){
  11283. shortcut.getKeyboard().removeEvent(shortcut.keys, shortcut.handler);
  11284. shortcut.getKeyboard().addEvent(newKeys, shortcut.handler);
  11285. shortcut.keys = newKeys;
  11286. shortcut.getKeyboard().fireEvent('rebound');
  11287. });
  11288. };
  11289. Keyboard.getActiveShortcuts = function(keyboard){
  11290. var activeKBS = [], activeSCS = [];
  11291. Keyboard.each(keyboard, [].push.bind(activeKBS));
  11292. activeKBS.each(function(kb){ activeSCS.extend(kb.getShortcuts()); });
  11293. return activeSCS;
  11294. };
  11295. Keyboard.getShortcut = function(name, keyboard, opts){
  11296. opts = opts || {};
  11297. var shortcuts = opts.many ? [] : null,
  11298. set = opts.many ? function(kb){
  11299. var shortcut = kb.getShortcut(name);
  11300. if (shortcut) shortcuts.push(shortcut);
  11301. } : function(kb){
  11302. if (!shortcuts) shortcuts = kb.getShortcut(name);
  11303. };
  11304. Keyboard.each(keyboard, set);
  11305. return shortcuts;
  11306. };
  11307. Keyboard.getShortcuts = function(name, keyboard){
  11308. return Keyboard.getShortcut(name, keyboard, { many: true });
  11309. };
  11310. /*
  11311. ---
  11312. script: HtmlTable.js
  11313. name: HtmlTable
  11314. description: Builds table elements with methods to add rows.
  11315. license: MIT-style license
  11316. authors:
  11317. - Aaron Newton
  11318. requires:
  11319. - Core/Options
  11320. - Core/Events
  11321. - Class.Occlude
  11322. provides: [HtmlTable]
  11323. ...
  11324. */
  11325. (function(){
  11326. var HtmlTable = this.HtmlTable = new Class({
  11327. Implements: [Options, Events, Class.Occlude],
  11328. options: {
  11329. properties: {
  11330. cellpadding: 0,
  11331. cellspacing: 0,
  11332. border: 0
  11333. },
  11334. rows: [],
  11335. headers: [],
  11336. footers: []
  11337. },
  11338. property: 'HtmlTable',
  11339. initialize: function(){
  11340. var params = Array.link(arguments, {options: Type.isObject, table: Type.isElement, id: Type.isString});
  11341. this.setOptions(params.options);
  11342. if (!params.table && params.id) params.table = document.id(params.id);
  11343. this.element = params.table || new Element('table', this.options.properties);
  11344. if (this.occlude()) return this.occluded;
  11345. this.build();
  11346. },
  11347. build: function(){
  11348. this.element.store('HtmlTable', this);
  11349. this.body = document.id(this.element.tBodies[0]) || new Element('tbody').inject(this.element);
  11350. $$(this.body.rows);
  11351. if (this.options.headers.length) this.setHeaders(this.options.headers);
  11352. else this.thead = document.id(this.element.tHead);
  11353. if (this.thead) this.head = this.getHead();
  11354. if (this.options.footers.length) this.setFooters(this.options.footers);
  11355. this.tfoot = document.id(this.element.tFoot);
  11356. if (this.tfoot) this.foot = document.id(this.tfoot.rows[0]);
  11357. this.options.rows.each(function(row){
  11358. this.push(row);
  11359. }, this);
  11360. },
  11361. toElement: function(){
  11362. return this.element;
  11363. },
  11364. empty: function(){
  11365. this.body.empty();
  11366. return this;
  11367. },
  11368. set: function(what, items){
  11369. var target = (what == 'headers') ? 'tHead' : 'tFoot',
  11370. lower = target.toLowerCase();
  11371. this[lower] = (document.id(this.element[target]) || new Element(lower).inject(this.element, 'top')).empty();
  11372. var data = this.push(items, {}, this[lower], what == 'headers' ? 'th' : 'td');
  11373. if (what == 'headers') this.head = this.getHead();
  11374. else this.foot = this.getHead();
  11375. return data;
  11376. },
  11377. getHead: function(){
  11378. var rows = this.thead.rows;
  11379. return rows.length > 1 ? $$(rows) : rows.length ? document.id(rows[0]) : false;
  11380. },
  11381. setHeaders: function(headers){
  11382. this.set('headers', headers);
  11383. return this;
  11384. },
  11385. setFooters: function(footers){
  11386. this.set('footers', footers);
  11387. return this;
  11388. },
  11389. update: function(tr, row, tag){
  11390. var tds = tr.getChildren(tag || 'td'), last = tds.length - 1;
  11391. row.each(function(data, index){
  11392. var td = tds[index] || new Element(tag || 'td').inject(tr),
  11393. content = ((data && Object.prototype.hasOwnProperty.call(data, 'content')) ? data.content : '') || data,
  11394. type = typeOf(content);
  11395. if (data && Object.prototype.hasOwnProperty.call(data, 'properties')) td.set(data.properties);
  11396. if (/(element(s?)|array|collection)/.test(type)) td.empty().adopt(content);
  11397. else td.set('html', content);
  11398. if (index > last) tds.push(td);
  11399. else tds[index] = td;
  11400. });
  11401. return {
  11402. tr: tr,
  11403. tds: tds
  11404. };
  11405. },
  11406. push: function(row, rowProperties, target, tag, where){
  11407. if (typeOf(row) == 'element' && row.get('tag') == 'tr'){
  11408. row.inject(target || this.body, where);
  11409. return {
  11410. tr: row,
  11411. tds: row.getChildren('td')
  11412. };
  11413. }
  11414. return this.update(new Element('tr', rowProperties).inject(target || this.body, where), row, tag);
  11415. },
  11416. pushMany: function(rows, rowProperties, target, tag, where){
  11417. return rows.map(function(row){
  11418. return this.push(row, rowProperties, target, tag, where);
  11419. }, this);
  11420. }
  11421. });
  11422. })();
  11423. ['adopt', 'inject', 'wraps', 'grab', 'replaces', 'dispose'].each(function(method){
  11424. HtmlTable.implement(method, function(){
  11425. this.element[method].apply(this.element, arguments);
  11426. return this;
  11427. });
  11428. });
  11429. /*
  11430. ---
  11431. script: HtmlTable.Select.js
  11432. name: HtmlTable.Select
  11433. description: Builds a stripy, sortable table with methods to add rows. Rows can be selected with the mouse or keyboard navigation.
  11434. license: MIT-style license
  11435. authors:
  11436. - Harald Kirschner
  11437. - Aaron Newton
  11438. requires:
  11439. - Keyboard
  11440. - Keyboard.Extras
  11441. - HtmlTable
  11442. - Class.refactor
  11443. - Element.Delegation.Pseudo
  11444. - Element.Shortcuts
  11445. provides: [HtmlTable.Select]
  11446. ...
  11447. */
  11448. HtmlTable = Class.refactor(HtmlTable, {
  11449. options: {
  11450. /*onRowFocus: function(){},
  11451. onRowUnfocus: function(){},*/
  11452. useKeyboard: true,
  11453. classRowSelected: 'table-tr-selected',
  11454. classRowHovered: 'table-tr-hovered',
  11455. classSelectable: 'table-selectable',
  11456. shiftForMultiSelect: true,
  11457. allowMultiSelect: true,
  11458. selectable: false,
  11459. selectHiddenRows: false
  11460. },
  11461. initialize: function(){
  11462. this.previous.apply(this, arguments);
  11463. if (this.occluded) return this.occluded;
  11464. this.selectedRows = new Elements();
  11465. if (!this.bound) this.bound = {};
  11466. this.bound.mouseleave = this.mouseleave.bind(this);
  11467. this.bound.clickRow = this.clickRow.bind(this);
  11468. this.bound.activateKeyboard = function(){
  11469. if (this.keyboard && this.selectEnabled) this.keyboard.activate();
  11470. }.bind(this);
  11471. if (this.options.selectable) this.enableSelect();
  11472. },
  11473. empty: function(){
  11474. if (this.body.rows.length) this.selectNone();
  11475. return this.previous();
  11476. },
  11477. enableSelect: function(){
  11478. this.selectEnabled = true;
  11479. this.attachSelects();
  11480. this.element.addClass(this.options.classSelectable);
  11481. return this;
  11482. },
  11483. disableSelect: function(){
  11484. this.selectEnabled = false;
  11485. this.attachSelects(false);
  11486. this.element.removeClass(this.options.classSelectable);
  11487. return this;
  11488. },
  11489. push: function(){
  11490. var ret = this.previous.apply(this, arguments);
  11491. this.updateSelects();
  11492. return ret;
  11493. },
  11494. toggleRow: function(row){
  11495. return this[(this.isSelected(row) ? 'de' : '') + 'selectRow'](row);
  11496. },
  11497. selectRow: function(row, _nocheck){
  11498. //private variable _nocheck: boolean whether or not to confirm the row is in the table body
  11499. //added here for optimization when selecting ranges
  11500. if (this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
  11501. if (!this.options.allowMultiSelect) this.selectNone();
  11502. if (!this.isSelected(row)){
  11503. this.selectedRows.push(row);
  11504. row.addClass(this.options.classRowSelected);
  11505. this.fireEvent('rowFocus', [row, this.selectedRows]);
  11506. this.fireEvent('stateChanged');
  11507. }
  11508. this.focused = row;
  11509. document.clearSelection();
  11510. return this;
  11511. },
  11512. isSelected: function(row){
  11513. return this.selectedRows.contains(row);
  11514. },
  11515. getSelected: function(){
  11516. return this.selectedRows;
  11517. },
  11518. serialize: function(){
  11519. var previousSerialization = this.previous.apply(this, arguments) || {};
  11520. if (this.options.selectable){
  11521. previousSerialization.selectedRows = this.selectedRows.map(function(row){
  11522. return Array.indexOf(this.body.rows, row);
  11523. }.bind(this));
  11524. }
  11525. return previousSerialization;
  11526. },
  11527. restore: function(tableState){
  11528. if (this.options.selectable && tableState.selectedRows){
  11529. tableState.selectedRows.each(function(index){
  11530. this.selectRow(this.body.rows[index]);
  11531. }.bind(this));
  11532. }
  11533. this.previous.apply(this, arguments);
  11534. },
  11535. deselectRow: function(row, _nocheck){
  11536. if (!this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
  11537. this.selectedRows = new Elements(Array.convert(this.selectedRows).erase(row));
  11538. row.removeClass(this.options.classRowSelected);
  11539. this.fireEvent('rowUnfocus', [row, this.selectedRows]);
  11540. this.fireEvent('stateChanged');
  11541. return this;
  11542. },
  11543. selectAll: function(selectNone){
  11544. if (!selectNone && !this.options.allowMultiSelect) return;
  11545. this.selectRange(0, this.body.rows.length, selectNone);
  11546. return this;
  11547. },
  11548. selectNone: function(){
  11549. return this.selectAll(true);
  11550. },
  11551. selectRange: function(startRow, endRow, _deselect){
  11552. if (!this.options.allowMultiSelect && !_deselect) return;
  11553. var method = _deselect ? 'deselectRow' : 'selectRow',
  11554. rows = Array.clone(this.body.rows);
  11555. if (typeOf(startRow) == 'element') startRow = rows.indexOf(startRow);
  11556. if (typeOf(endRow) == 'element') endRow = rows.indexOf(endRow);
  11557. endRow = endRow < rows.length - 1 ? endRow : rows.length - 1;
  11558. if (endRow < startRow){
  11559. var tmp = startRow;
  11560. startRow = endRow;
  11561. endRow = tmp;
  11562. }
  11563. for (var i = startRow; i <= endRow; i++){
  11564. if (this.options.selectHiddenRows || rows[i].isDisplayed()) this[method](rows[i], true);
  11565. }
  11566. return this;
  11567. },
  11568. deselectRange: function(startRow, endRow){
  11569. this.selectRange(startRow, endRow, true);
  11570. },
  11571. /*
  11572. Private methods:
  11573. */
  11574. enterRow: function(row){
  11575. if (this.hovered) this.hovered = this.leaveRow(this.hovered);
  11576. this.hovered = row.addClass(this.options.classRowHovered);
  11577. },
  11578. leaveRow: function(row){
  11579. row.removeClass(this.options.classRowHovered);
  11580. },
  11581. updateSelects: function(){
  11582. Array.each(this.body.rows, function(row){
  11583. var binders = row.retrieve('binders');
  11584. if (!binders && !this.selectEnabled) return;
  11585. if (!binders){
  11586. binders = {
  11587. mouseenter: this.enterRow.pass([row], this),
  11588. mouseleave: this.leaveRow.pass([row], this)
  11589. };
  11590. row.store('binders', binders);
  11591. }
  11592. if (this.selectEnabled) row.addEvents(binders);
  11593. else row.removeEvents(binders);
  11594. }, this);
  11595. },
  11596. shiftFocus: function(offset, event){
  11597. if (!this.focused) return this.selectRow(this.body.rows[0], event);
  11598. var to = this.getRowByOffset(offset, this.options.selectHiddenRows);
  11599. if (to === null || this.focused == this.body.rows[to]) return this;
  11600. this.toggleRow(this.body.rows[to], event);
  11601. },
  11602. clickRow: function(event, row){
  11603. var selecting = (event.shift || event.meta || event.control) && this.options.shiftForMultiSelect;
  11604. if (!selecting && !(event.rightClick && this.isSelected(row) && this.options.allowMultiSelect)) this.selectNone();
  11605. if (event.rightClick) this.selectRow(row);
  11606. else this.toggleRow(row);
  11607. if (event.shift){
  11608. this.selectRange(this.rangeStart || this.body.rows[0], row, this.rangeStart ? !this.isSelected(row) : true);
  11609. this.focused = row;
  11610. }
  11611. this.rangeStart = row;
  11612. },
  11613. getRowByOffset: function(offset, includeHiddenRows){
  11614. if (!this.focused) return 0;
  11615. var index = Array.indexOf(this.body.rows, this.focused);
  11616. if ((index == 0 && offset < 0) || (index == this.body.rows.length -1 && offset > 0)) return null;
  11617. if (includeHiddenRows){
  11618. index += offset;
  11619. } else {
  11620. var limit = 0,
  11621. count = 0;
  11622. if (offset > 0){
  11623. while (count < offset && index < this.body.rows.length -1){
  11624. if (this.body.rows[++index].isDisplayed()) count++;
  11625. }
  11626. } else {
  11627. while (count > offset && index > 0){
  11628. if (this.body.rows[--index].isDisplayed()) count--;
  11629. }
  11630. }
  11631. }
  11632. return index;
  11633. },
  11634. attachSelects: function(attach){
  11635. attach = attach != null ? attach : true;
  11636. var method = attach ? 'addEvents' : 'removeEvents';
  11637. this.element[method]({
  11638. mouseleave: this.bound.mouseleave,
  11639. click: this.bound.activateKeyboard
  11640. });
  11641. this.body[method]({
  11642. 'click:relay(tr)': this.bound.clickRow,
  11643. 'contextmenu:relay(tr)': this.bound.clickRow
  11644. });
  11645. if (this.options.useKeyboard || this.keyboard){
  11646. if (!this.keyboard) this.keyboard = new Keyboard();
  11647. if (!this.selectKeysDefined){
  11648. this.selectKeysDefined = true;
  11649. var timer, held;
  11650. var move = function(offset){
  11651. var mover = function(e){
  11652. clearTimeout(timer);
  11653. e.preventDefault();
  11654. var to = this.body.rows[this.getRowByOffset(offset, this.options.selectHiddenRows)];
  11655. if (e.shift && to && this.isSelected(to)){
  11656. this.deselectRow(this.focused);
  11657. this.focused = to;
  11658. } else {
  11659. if (to && (!this.options.allowMultiSelect || !e.shift)){
  11660. this.selectNone();
  11661. }
  11662. this.shiftFocus(offset, e);
  11663. }
  11664. if (held){
  11665. timer = mover.delay(100, this, e);
  11666. } else {
  11667. timer = (function(){
  11668. held = true;
  11669. mover(e);
  11670. }).delay(400);
  11671. }
  11672. }.bind(this);
  11673. return mover;
  11674. }.bind(this);
  11675. var clear = function(){
  11676. clearTimeout(timer);
  11677. held = false;
  11678. };
  11679. this.keyboard.addEvents({
  11680. 'keydown:shift+up': move(-1),
  11681. 'keydown:shift+down': move(1),
  11682. 'keyup:shift+up': clear,
  11683. 'keyup:shift+down': clear,
  11684. 'keyup:up': clear,
  11685. 'keyup:down': clear
  11686. });
  11687. var shiftHint = '';
  11688. if (this.options.allowMultiSelect && this.options.shiftForMultiSelect && this.options.useKeyboard){
  11689. shiftHint = ' (Shift multi-selects).';
  11690. }
  11691. this.keyboard.addShortcuts({
  11692. 'Select Previous Row': {
  11693. keys: 'up',
  11694. shortcut: 'up arrow',
  11695. handler: move(-1),
  11696. description: 'Select the previous row in the table.' + shiftHint
  11697. },
  11698. 'Select Next Row': {
  11699. keys: 'down',
  11700. shortcut: 'down arrow',
  11701. handler: move(1),
  11702. description: 'Select the next row in the table.' + shiftHint
  11703. }
  11704. });
  11705. }
  11706. this.keyboard[attach ? 'activate' : 'deactivate']();
  11707. }
  11708. this.updateSelects();
  11709. },
  11710. mouseleave: function(){
  11711. if (this.hovered) this.leaveRow(this.hovered);
  11712. }
  11713. });
  11714. /*
  11715. ---
  11716. script: HtmlTable.Sort.js
  11717. name: HtmlTable.Sort
  11718. description: Builds a stripy, sortable table with methods to add rows.
  11719. license: MIT-style license
  11720. authors:
  11721. - Harald Kirschner
  11722. - Aaron Newton
  11723. - Jacob Thornton
  11724. requires:
  11725. - Core/Hash
  11726. - HtmlTable
  11727. - Class.refactor
  11728. - Element.Delegation.Pseudo
  11729. - String.Extras
  11730. - Date
  11731. provides: [HtmlTable.Sort]
  11732. ...
  11733. */
  11734. (function(){
  11735. var readOnlyNess = document.createElement('table');
  11736. try {
  11737. readOnlyNess.innerHTML = '<tr><td></td></tr>';
  11738. readOnlyNess = readOnlyNess.childNodes.length === 0;
  11739. } catch (e){
  11740. readOnlyNess = true;
  11741. }
  11742. HtmlTable = Class.refactor(HtmlTable, {
  11743. options: {/*
  11744. onSort: function(){}, */
  11745. sortIndex: 0,
  11746. sortReverse: false,
  11747. parsers: [],
  11748. defaultParser: 'string',
  11749. classSortable: 'table-sortable',
  11750. classHeadSort: 'table-th-sort',
  11751. classHeadSortRev: 'table-th-sort-rev',
  11752. classNoSort: 'table-th-nosort',
  11753. classGroupHead: 'table-tr-group-head',
  11754. classGroup: 'table-tr-group',
  11755. classCellSort: 'table-td-sort',
  11756. classSortSpan: 'table-th-sort-span',
  11757. sortable: false,
  11758. thSelector: 'th'
  11759. },
  11760. initialize: function(){
  11761. this.previous.apply(this, arguments);
  11762. if (this.occluded) return this.occluded;
  11763. this.sorted = {index: null, dir: 1};
  11764. if (!this.bound) this.bound = {};
  11765. this.bound.headClick = this.headClick.bind(this);
  11766. this.sortSpans = new Elements();
  11767. if (this.options.sortable){
  11768. this.enableSort();
  11769. if (this.options.sortIndex != null) this.sort(this.options.sortIndex, this.options.sortReverse);
  11770. }
  11771. },
  11772. attachSorts: function(attach){
  11773. this.detachSorts();
  11774. if (attach !== false) this.element.addEvent('click:relay(' + this.options.thSelector + ')', this.bound.headClick);
  11775. },
  11776. detachSorts: function(){
  11777. this.element.removeEvents('click:relay(' + this.options.thSelector + ')');
  11778. },
  11779. setHeaders: function(){
  11780. this.previous.apply(this, arguments);
  11781. if (this.sortable) this.setParsers();
  11782. },
  11783. setParsers: function(){
  11784. this.parsers = this.detectParsers();
  11785. },
  11786. detectParsers: function(){
  11787. return this.head && this.head.getElements(this.options.thSelector).flatten().map(this.detectParser, this);
  11788. },
  11789. detectParser: function(cell, index){
  11790. if (cell.hasClass(this.options.classNoSort) || cell.retrieve('htmltable-parser')) return cell.retrieve('htmltable-parser');
  11791. var thDiv = new Element('div');
  11792. thDiv.adopt(cell.childNodes).inject(cell);
  11793. var sortSpan = new Element('span', {'class': this.options.classSortSpan}).inject(thDiv, 'top');
  11794. this.sortSpans.push(sortSpan);
  11795. var parser = this.options.parsers[index],
  11796. rows = this.body.rows,
  11797. cancel;
  11798. switch (typeOf(parser)){
  11799. case 'function': parser = {convert: parser}; cancel = true; break;
  11800. case 'string': parser = parser; cancel = true; break;
  11801. }
  11802. if (!cancel){
  11803. HtmlTable.ParserPriority.some(function(parserName){
  11804. var current = HtmlTable.Parsers[parserName],
  11805. match = current.match;
  11806. if (!match) return false;
  11807. for (var i = 0, j = rows.length; i < j; i++){
  11808. var cell = document.id(rows[i].cells[index]),
  11809. text = cell ? cell.get('html').clean() : '';
  11810. if (text && match.test(text)){
  11811. parser = current;
  11812. return true;
  11813. }
  11814. }
  11815. });
  11816. }
  11817. if (!parser) parser = this.options.defaultParser;
  11818. cell.store('htmltable-parser', parser);
  11819. return parser;
  11820. },
  11821. headClick: function(event, el){
  11822. if (!this.head || el.hasClass(this.options.classNoSort)) return;
  11823. return this.sort(Array.indexOf(this.head.getElements(this.options.thSelector).flatten(), el) % this.body.rows[0].cells.length);
  11824. },
  11825. serialize: function(){
  11826. var previousSerialization = this.previous.apply(this, arguments) || {};
  11827. if (this.options.sortable){
  11828. previousSerialization.sortIndex = this.sorted.index;
  11829. previousSerialization.sortReverse = this.sorted.reverse;
  11830. }
  11831. return previousSerialization;
  11832. },
  11833. restore: function(tableState){
  11834. if (this.options.sortable && tableState.sortIndex){
  11835. this.sort(tableState.sortIndex, tableState.sortReverse);
  11836. }
  11837. this.previous.apply(this, arguments);
  11838. },
  11839. setSortedState: function(index, reverse){
  11840. if (reverse != null) this.sorted.reverse = reverse;
  11841. else if (this.sorted.index == index) this.sorted.reverse = !this.sorted.reverse;
  11842. else this.sorted.reverse = this.sorted.index == null;
  11843. if (index != null) this.sorted.index = index;
  11844. },
  11845. setHeadSort: function(sorted){
  11846. var head = $$(!this.head.length ? this.head.cells[this.sorted.index] : this.head.map(function(row){
  11847. return row.getElements(this.options.thSelector)[this.sorted.index];
  11848. }, this).clean());
  11849. if (!head.length) return;
  11850. if (sorted){
  11851. head.addClass(this.options.classHeadSort);
  11852. if (this.sorted.reverse) head.addClass(this.options.classHeadSortRev);
  11853. else head.removeClass(this.options.classHeadSortRev);
  11854. } else {
  11855. head.removeClass(this.options.classHeadSort).removeClass(this.options.classHeadSortRev);
  11856. }
  11857. },
  11858. setRowSort: function(data, pre){
  11859. var count = data.length,
  11860. body = this.body,
  11861. group,
  11862. rowIndex;
  11863. while (count){
  11864. var item = data[--count],
  11865. position = item.position,
  11866. row = body.rows[position];
  11867. if (row.disabled) continue;
  11868. if (!pre){
  11869. group = this.setGroupSort(group, row, item);
  11870. this.setRowStyle(row, count);
  11871. }
  11872. body.appendChild(row);
  11873. for (rowIndex = 0; rowIndex < count; rowIndex++){
  11874. if (data[rowIndex].position > position) data[rowIndex].position--;
  11875. }
  11876. }
  11877. },
  11878. setRowStyle: function(row, i){
  11879. this.previous(row, i);
  11880. row.cells[this.sorted.index].addClass(this.options.classCellSort);
  11881. },
  11882. setGroupSort: function(group, row, item){
  11883. if (group == item.value) row.removeClass(this.options.classGroupHead).addClass(this.options.classGroup);
  11884. else row.removeClass(this.options.classGroup).addClass(this.options.classGroupHead);
  11885. return item.value;
  11886. },
  11887. getParser: function(){
  11888. var parser = this.parsers[this.sorted.index];
  11889. return typeOf(parser) == 'string' ? HtmlTable.Parsers[parser] : parser;
  11890. },
  11891. sort: function(index, reverse, pre, sortFunction){
  11892. if (!this.head) return;
  11893. if (!pre){
  11894. this.clearSort();
  11895. this.setSortedState(index, reverse);
  11896. this.setHeadSort(true);
  11897. }
  11898. var parser = this.getParser();
  11899. if (!parser) return;
  11900. var rel;
  11901. if (!readOnlyNess){
  11902. rel = this.body.getParent();
  11903. this.body.dispose();
  11904. }
  11905. var data = this.parseData(parser).sort(sortFunction ? sortFunction : function(a, b){
  11906. if (a.value === b.value) return 0;
  11907. return a.value > b.value ? 1 : -1;
  11908. });
  11909. var reversed = this.sorted.reverse == (parser == HtmlTable.Parsers['input-checked']);
  11910. if (reversed) data.reverse(true);
  11911. this.setRowSort(data, pre);
  11912. if (rel) rel.grab(this.body);
  11913. this.fireEvent('stateChanged');
  11914. return this.fireEvent('sort', [this.body, this.sorted.index, reversed ? 'asc' : 'desc']);
  11915. },
  11916. parseData: function(parser){
  11917. return Array.map(this.body.rows, function(row, i){
  11918. var value = parser.convert.call(document.id(row.cells[this.sorted.index]));
  11919. return {
  11920. position: i,
  11921. value: value
  11922. };
  11923. }, this);
  11924. },
  11925. clearSort: function(){
  11926. this.setHeadSort(false);
  11927. this.body.getElements('td').removeClass(this.options.classCellSort);
  11928. },
  11929. reSort: function(){
  11930. if (this.sortable) this.sort.call(this, this.sorted.index, this.sorted.reverse);
  11931. return this;
  11932. },
  11933. enableSort: function(){
  11934. this.element.addClass(this.options.classSortable);
  11935. this.attachSorts(true);
  11936. this.setParsers();
  11937. this.sortable = true;
  11938. return this;
  11939. },
  11940. disableSort: function(){
  11941. this.element.removeClass(this.options.classSortable);
  11942. this.attachSorts(false);
  11943. this.sortSpans.each(function(span){
  11944. span.destroy();
  11945. });
  11946. this.sortSpans.empty();
  11947. this.sortable = false;
  11948. return this;
  11949. }
  11950. });
  11951. HtmlTable.ParserPriority = ['date', 'input-checked', 'input-value', 'float', 'number'];
  11952. HtmlTable.Parsers = {
  11953. 'date': {
  11954. match: /^\d{2}[-\/ ]\d{2}[-\/ ]\d{2,4}$/,
  11955. convert: function(){
  11956. var d = Date.parse(this.get('text').stripTags());
  11957. return (typeOf(d) == 'date') ? d.format('db') : '';
  11958. },
  11959. type: 'date'
  11960. },
  11961. 'input-checked': {
  11962. match: / type="(radio|checkbox)"/,
  11963. convert: function(){
  11964. return this.getElement('input').checked;
  11965. }
  11966. },
  11967. 'input-value': {
  11968. match: /<input/,
  11969. convert: function(){
  11970. return this.getElement('input').value;
  11971. }
  11972. },
  11973. 'number': {
  11974. match: /^\d+[^\d.,]*$/,
  11975. convert: function(){
  11976. return this.get('text').stripTags().toInt();
  11977. },
  11978. number: true
  11979. },
  11980. 'numberLax': {
  11981. match: /^[^\d]+\d+$/,
  11982. convert: function(){
  11983. return this.get('text').replace(/[^-?^0-9]/, '').stripTags().toInt();
  11984. },
  11985. number: true
  11986. },
  11987. 'float': {
  11988. match: /^[\d]+\.[\d]+/,
  11989. convert: function(){
  11990. return this.get('text').replace(/[^-?^\d.e]/, '').stripTags().toFloat();
  11991. },
  11992. number: true
  11993. },
  11994. 'floatLax': {
  11995. match: /^[^\d]+[\d]+\.[\d]+$/,
  11996. convert: function(){
  11997. return this.get('text').replace(/[^-?^\d.]/, '').stripTags().toFloat();
  11998. },
  11999. number: true
  12000. },
  12001. 'string': {
  12002. match: null,
  12003. convert: function(){
  12004. return this.get('text').stripTags().toLowerCase();
  12005. }
  12006. },
  12007. 'title': {
  12008. match: null,
  12009. convert: function(){
  12010. return this.title;
  12011. }
  12012. }
  12013. };
  12014. //<1.2compat>
  12015. HtmlTable.Parsers = new Hash(HtmlTable.Parsers);
  12016. //</1.2compat>
  12017. HtmlTable.defineParsers = function(parsers){
  12018. HtmlTable.Parsers = Object.append(HtmlTable.Parsers, parsers);
  12019. for (var parser in parsers){
  12020. HtmlTable.ParserPriority.unshift(parser);
  12021. }
  12022. };
  12023. })();
  12024. /*
  12025. ---
  12026. script: HtmlTable.Zebra.js
  12027. name: HtmlTable.Zebra
  12028. description: Builds a stripy table with methods to add rows.
  12029. license: MIT-style license
  12030. authors:
  12031. - Harald Kirschner
  12032. - Aaron Newton
  12033. requires:
  12034. - HtmlTable
  12035. - Element.Shortcuts
  12036. - Class.refactor
  12037. provides: [HtmlTable.Zebra]
  12038. ...
  12039. */
  12040. HtmlTable = Class.refactor(HtmlTable, {
  12041. options: {
  12042. classZebra: 'table-tr-odd',
  12043. zebra: true,
  12044. zebraOnlyVisibleRows: true
  12045. },
  12046. initialize: function(){
  12047. this.previous.apply(this, arguments);
  12048. if (this.occluded) return this.occluded;
  12049. if (this.options.zebra) this.updateZebras();
  12050. },
  12051. updateZebras: function(){
  12052. var index = 0;
  12053. Array.each(this.body.rows, function(row){
  12054. if (!this.options.zebraOnlyVisibleRows || row.isDisplayed()){
  12055. this.zebra(row, index++);
  12056. }
  12057. }, this);
  12058. },
  12059. setRowStyle: function(row, i){
  12060. if (this.previous) this.previous(row, i);
  12061. this.zebra(row, i);
  12062. },
  12063. zebra: function(row, i){
  12064. return row[((i % 2) ? 'remove' : 'add')+'Class'](this.options.classZebra);
  12065. },
  12066. push: function(){
  12067. var pushed = this.previous.apply(this, arguments);
  12068. if (this.options.zebra) this.updateZebras();
  12069. return pushed;
  12070. }
  12071. });
  12072. /*
  12073. ---
  12074. script: Scroller.js
  12075. name: Scroller
  12076. description: Class which scrolls the contents of any Element (including the window) when the mouse reaches the Element's boundaries.
  12077. license: MIT-style license
  12078. authors:
  12079. - Valerio Proietti
  12080. requires:
  12081. - Core/Events
  12082. - Core/Options
  12083. - Core/Element.Event
  12084. - Core/Element.Dimensions
  12085. - MooTools.More
  12086. provides: [Scroller]
  12087. ...
  12088. */
  12089. (function(){
  12090. var Scroller = this.Scroller = new Class({
  12091. Implements: [Events, Options],
  12092. options: {
  12093. area: 20,
  12094. velocity: 1,
  12095. onChange: function(x, y){
  12096. this.element.scrollTo(x, y);
  12097. },
  12098. fps: 50
  12099. },
  12100. initialize: function(element, options){
  12101. this.setOptions(options);
  12102. this.element = document.id(element);
  12103. this.docBody = document.id(this.element.getDocument().body);
  12104. this.listener = (typeOf(this.element) != 'element') ? this.docBody : this.element;
  12105. this.timer = null;
  12106. this.bound = {
  12107. attach: this.attach.bind(this),
  12108. detach: this.detach.bind(this),
  12109. getCoords: this.getCoords.bind(this)
  12110. };
  12111. },
  12112. start: function(){
  12113. this.listener.addEvents({
  12114. mouseover: this.bound.attach,
  12115. mouseleave: this.bound.detach
  12116. });
  12117. return this;
  12118. },
  12119. stop: function(){
  12120. this.listener.removeEvents({
  12121. mouseover: this.bound.attach,
  12122. mouseleave: this.bound.detach
  12123. });
  12124. this.detach();
  12125. this.timer = clearInterval(this.timer);
  12126. return this;
  12127. },
  12128. attach: function(){
  12129. this.listener.addEvent('mousemove', this.bound.getCoords);
  12130. },
  12131. detach: function(){
  12132. this.listener.removeEvent('mousemove', this.bound.getCoords);
  12133. this.timer = clearInterval(this.timer);
  12134. },
  12135. getCoords: function(event){
  12136. this.page = (this.listener.get('tag') == 'body') ? event.client : event.page;
  12137. if (!this.timer) this.timer = this.scroll.periodical(Math.round(1000 / this.options.fps), this);
  12138. },
  12139. scroll: function(){
  12140. var size = this.element.getSize(),
  12141. scroll = this.element.getScroll(),
  12142. pos = ((this.element != this.docBody) && (this.element != window)) ? this.element.getOffsets() : {x: 0, y: 0},
  12143. scrollSize = this.element.getScrollSize(),
  12144. change = {x: 0, y: 0},
  12145. top = this.options.area.top || this.options.area,
  12146. bottom = this.options.area.bottom || this.options.area;
  12147. for (var z in this.page){
  12148. if (this.page[z] < (top + pos[z]) && scroll[z] != 0){
  12149. change[z] = (this.page[z] - top - pos[z]) * this.options.velocity;
  12150. } else if (this.page[z] + bottom > (size[z] + pos[z]) && scroll[z] + size[z] != scrollSize[z]){
  12151. change[z] = (this.page[z] - size[z] + bottom - pos[z]) * this.options.velocity;
  12152. }
  12153. change[z] = change[z].round();
  12154. }
  12155. if (change.y || change.x) this.fireEvent('change', [scroll.x + change.x, scroll.y + change.y]);
  12156. }
  12157. });
  12158. })();
  12159. /*
  12160. ---
  12161. script: Tips.js
  12162. name: Tips
  12163. description: Class for creating nice tips that follow the mouse cursor when hovering an element.
  12164. license: MIT-style license
  12165. authors:
  12166. - Valerio Proietti
  12167. - Christoph Pojer
  12168. - Luis Merino
  12169. requires:
  12170. - Core/Options
  12171. - Core/Events
  12172. - Core/Element.Event
  12173. - Core/Element.Style
  12174. - Core/Element.Dimensions
  12175. - MooTools.More
  12176. provides: [Tips]
  12177. ...
  12178. */
  12179. (function(){
  12180. var read = function(option, element){
  12181. return (option) ? (typeOf(option) == 'function' ? option(element) : element.get(option)) : '';
  12182. };
  12183. var Tips = this.Tips = new Class({
  12184. Implements: [Events, Options],
  12185. options: {/*
  12186. id: null,
  12187. onAttach: function(element){},
  12188. onDetach: function(element){},
  12189. onBound: function(coords){},*/
  12190. onShow: function(){
  12191. this.tip.setStyle('display', 'block');
  12192. },
  12193. onHide: function(){
  12194. this.tip.setStyle('display', 'none');
  12195. },
  12196. title: 'title',
  12197. text: function(element){
  12198. return element.get('rel') || element.get('href');
  12199. },
  12200. showDelay: 100,
  12201. hideDelay: 100,
  12202. className: 'tip-wrap',
  12203. offset: {x: 16, y: 16},
  12204. windowPadding: {x:0, y:0},
  12205. fixed: false,
  12206. waiAria: true,
  12207. hideEmpty: false
  12208. },
  12209. initialize: function(){
  12210. var params = Array.link(arguments, {
  12211. options: Type.isObject,
  12212. elements: function(obj){
  12213. return obj != null;
  12214. }
  12215. });
  12216. this.setOptions(params.options);
  12217. if (params.elements) this.attach(params.elements);
  12218. this.container = new Element('div', {'class': 'tip'});
  12219. if (this.options.id){
  12220. this.container.set('id', this.options.id);
  12221. if (this.options.waiAria) this.attachWaiAria();
  12222. }
  12223. },
  12224. toElement: function(){
  12225. if (this.tip) return this.tip;
  12226. this.tip = new Element('div', {
  12227. 'class': this.options.className,
  12228. styles: {
  12229. position: 'absolute',
  12230. top: 0,
  12231. left: 0,
  12232. display: 'none'
  12233. }
  12234. }).adopt(
  12235. new Element('div', {'class': 'tip-top'}),
  12236. this.container,
  12237. new Element('div', {'class': 'tip-bottom'})
  12238. );
  12239. return this.tip;
  12240. },
  12241. attachWaiAria: function(){
  12242. var id = this.options.id;
  12243. this.container.set('role', 'tooltip');
  12244. if (!this.waiAria){
  12245. this.waiAria = {
  12246. show: function(element){
  12247. if (id) element.set('aria-describedby', id);
  12248. this.container.set('aria-hidden', 'false');
  12249. },
  12250. hide: function(element){
  12251. if (id) element.erase('aria-describedby');
  12252. this.container.set('aria-hidden', 'true');
  12253. }
  12254. };
  12255. }
  12256. this.addEvents(this.waiAria);
  12257. },
  12258. detachWaiAria: function(){
  12259. if (this.waiAria){
  12260. this.container.erase('role');
  12261. this.container.erase('aria-hidden');
  12262. this.removeEvents(this.waiAria);
  12263. }
  12264. },
  12265. attach: function(elements){
  12266. $$(elements).each(function(element){
  12267. var title = read(this.options.title, element),
  12268. text = read(this.options.text, element);
  12269. element.set('title', '').store('tip:native', title).retrieve('tip:title', title);
  12270. element.retrieve('tip:text', text);
  12271. this.fireEvent('attach', [element]);
  12272. var events = ['enter', 'leave'];
  12273. if (!this.options.fixed) events.push('move');
  12274. events.each(function(value){
  12275. var event = element.retrieve('tip:' + value);
  12276. if (!event) event = function(event){
  12277. this['element' + value.capitalize()].apply(this, [event, element]);
  12278. }.bind(this);
  12279. element.store('tip:' + value, event).addEvent('mouse' + value, event);
  12280. }, this);
  12281. }, this);
  12282. return this;
  12283. },
  12284. detach: function(elements){
  12285. $$(elements).each(function(element){
  12286. ['enter', 'leave', 'move'].each(function(value){
  12287. element.removeEvent('mouse' + value, element.retrieve('tip:' + value)).eliminate('tip:' + value);
  12288. });
  12289. this.fireEvent('detach', [element]);
  12290. if (this.options.title == 'title'){ // This is necessary to check if we can revert the title
  12291. var original = element.retrieve('tip:native');
  12292. if (original) element.set('title', original);
  12293. }
  12294. }, this);
  12295. return this;
  12296. },
  12297. elementEnter: function(event, element){
  12298. clearTimeout(this.timer);
  12299. this.timer = (function(){
  12300. this.container.empty();
  12301. var showTip = !this.options.hideEmpty;
  12302. ['title', 'text'].each(function(value){
  12303. var content = element.retrieve('tip:' + value);
  12304. var div = this['_' + value + 'Element'] = new Element('div', {
  12305. 'class': 'tip-' + value
  12306. }).inject(this.container);
  12307. if (content){
  12308. this.fill(div, content);
  12309. showTip = true;
  12310. }
  12311. }, this);
  12312. if (showTip){
  12313. this.show(element);
  12314. } else {
  12315. this.hide(element);
  12316. }
  12317. this.position((this.options.fixed) ? {page: element.getPosition()} : event);
  12318. }).delay(this.options.showDelay, this);
  12319. },
  12320. elementLeave: function(event, element){
  12321. clearTimeout(this.timer);
  12322. this.timer = this.hide.delay(this.options.hideDelay, this, element);
  12323. this.fireForParent(event, element);
  12324. },
  12325. setTitle: function(title){
  12326. if (this._titleElement){
  12327. this._titleElement.empty();
  12328. this.fill(this._titleElement, title);
  12329. }
  12330. return this;
  12331. },
  12332. setText: function(text){
  12333. if (this._textElement){
  12334. this._textElement.empty();
  12335. this.fill(this._textElement, text);
  12336. }
  12337. return this;
  12338. },
  12339. fireForParent: function(event, element){
  12340. element = element.getParent();
  12341. if (!element || element == document.body) return;
  12342. if (element.retrieve('tip:enter')) element.fireEvent('mouseenter', event);
  12343. else this.fireForParent(event, element);
  12344. },
  12345. elementMove: function(event, element){
  12346. this.position(event);
  12347. },
  12348. position: function(event){
  12349. if (!this.tip) document.id(this);
  12350. var size = window.getSize(), scroll = window.getScroll(),
  12351. tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight},
  12352. props = {x: 'left', y: 'top'},
  12353. bounds = {y: false, x2: false, y2: false, x: false},
  12354. obj = {};
  12355. for (var z in props){
  12356. obj[props[z]] = event.page[z] + this.options.offset[z];
  12357. if (obj[props[z]] < 0) bounds[z] = true;
  12358. if ((obj[props[z]] + tip[z] - scroll[z]) > size[z] - this.options.windowPadding[z]){
  12359. obj[props[z]] = event.page[z] - this.options.offset[z] - tip[z];
  12360. bounds[z+'2'] = true;
  12361. }
  12362. }
  12363. this.fireEvent('bound', bounds);
  12364. this.tip.setStyles(obj);
  12365. },
  12366. fill: function(element, contents){
  12367. if (typeof contents == 'string') element.set('html', contents);
  12368. else element.adopt(contents);
  12369. },
  12370. show: function(element){
  12371. if (!this.tip) document.id(this);
  12372. if (!this.tip.getParent()) this.tip.inject(document.body);
  12373. this.fireEvent('show', [this.tip, element]);
  12374. },
  12375. hide: function(element){
  12376. if (!this.tip) document.id(this);
  12377. this.fireEvent('hide', [this.tip, element]);
  12378. }
  12379. });
  12380. })();
  12381. /*
  12382. ---
  12383. name: Locale.CH.Number
  12384. description: Number messages for Switzerland.
  12385. license: MIT-style license
  12386. authors:
  12387. - Kim D. Jeker
  12388. requires:
  12389. - Locale
  12390. provides: [Locale.CH.Number]
  12391. ...
  12392. */
  12393. Locale.define('CH', 'Number', {
  12394. decimal: ',',
  12395. group: '\'',
  12396. currency: {
  12397. decimal: '.',
  12398. suffix: ' CHF'
  12399. }
  12400. });
  12401. /*
  12402. ---
  12403. name: Locale.EU.Number
  12404. description: Number messages for Europe.
  12405. license: MIT-style license
  12406. authors:
  12407. - Arian Stolwijk
  12408. requires:
  12409. - Locale
  12410. provides: [Locale.EU.Number]
  12411. ...
  12412. */
  12413. Locale.define('EU', 'Number', {
  12414. decimal: ',',
  12415. group: '.',
  12416. currency: {
  12417. prefix: '€ '
  12418. }
  12419. });
  12420. /*
  12421. ---
  12422. script: Locale.Set.From.js
  12423. name: Locale.Set.From
  12424. description: Provides an alternative way to create Locale.Set objects.
  12425. license: MIT-style license
  12426. authors:
  12427. - Tim Wienk
  12428. requires:
  12429. - Core/JSON
  12430. - Locale
  12431. provides: Locale.Set.From
  12432. ...
  12433. */
  12434. (function(){
  12435. var parsers = {
  12436. 'json': JSON.decode
  12437. };
  12438. Locale.Set.defineParser = function(name, fn){
  12439. parsers[name] = fn;
  12440. };
  12441. Locale.Set.from = function(set, type){
  12442. if (instanceOf(set, Locale.Set)) return set;
  12443. if (!type && typeOf(set) == 'string') type = 'json';
  12444. if (parsers[type]) set = parsers[type](set);
  12445. var locale = new Locale.Set;
  12446. locale.sets = set.sets || {};
  12447. if (set.inherits){
  12448. locale.inherits.locales = Array.convert(set.inherits.locales);
  12449. locale.inherits.sets = set.inherits.sets || {};
  12450. }
  12451. return locale;
  12452. };
  12453. })();
  12454. /*
  12455. ---
  12456. name: Locale.ZA.Number
  12457. description: Number messages for ZA.
  12458. license: MIT-style license
  12459. authors:
  12460. - Werner Mollentze
  12461. requires:
  12462. - Locale
  12463. provides: [Locale.ZA.Number]
  12464. ...
  12465. */
  12466. Locale.define('ZA', 'Number', {
  12467. decimal: '.',
  12468. group: ',',
  12469. currency: {
  12470. prefix: 'R '
  12471. }
  12472. });
  12473. /*
  12474. ---
  12475. name: Locale.af-ZA.Date
  12476. description: Date messages for ZA Afrikaans.
  12477. license: MIT-style license
  12478. authors:
  12479. - Werner Mollentze
  12480. requires:
  12481. - Locale
  12482. provides: [Locale.af-ZA.Date]
  12483. ...
  12484. */
  12485. Locale.define('af-ZA', 'Date', {
  12486. months: ['Januarie', 'Februarie', 'Maart', 'April', 'Mei', 'Junie', 'Julie', 'Augustus', 'September', 'Oktober', 'November', 'Desember'],
  12487. months_abbr: ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
  12488. days: ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'],
  12489. days_abbr: ['Son', 'Maa', 'Din', 'Woe', 'Don', 'Vry', 'Sat'],
  12490. // Culture's date order: MM/DD/YYYY
  12491. dateOrder: ['date', 'month', 'year'],
  12492. shortDate: '%d-%m-%Y',
  12493. shortTime: '%H:%M',
  12494. AM: 'VM',
  12495. PM: 'NM',
  12496. firstDayOfWeek: 1,
  12497. // Date.Extras
  12498. ordinal: function(dayOfMonth){
  12499. return ((dayOfMonth > 1 && dayOfMonth < 20 && dayOfMonth != 8) || (dayOfMonth > 100 && dayOfMonth.toString().substr(-2, 1) == '1')) ? 'de' : 'ste';
  12500. },
  12501. lessThanMinuteAgo: 'minder as \'n minuut gelede',
  12502. minuteAgo: 'ongeveer \'n minuut gelede',
  12503. minutesAgo: '{delta} minute gelede',
  12504. hourAgo: 'omtret \'n uur gelede',
  12505. hoursAgo: 'ongeveer {delta} ure gelede',
  12506. dayAgo: '1 dag gelede',
  12507. daysAgo: '{delta} dae gelede',
  12508. weekAgo: '1 week gelede',
  12509. weeksAgo: '{delta} weke gelede',
  12510. monthAgo: '1 maand gelede',
  12511. monthsAgo: '{delta} maande gelede',
  12512. yearAgo: '1 jaar gelede',
  12513. yearsAgo: '{delta} jare gelede',
  12514. lessThanMinuteUntil: 'oor minder as \'n minuut',
  12515. minuteUntil: 'oor ongeveer \'n minuut',
  12516. minutesUntil: 'oor {delta} minute',
  12517. hourUntil: 'oor ongeveer \'n uur',
  12518. hoursUntil: 'oor {delta} uur',
  12519. dayUntil: 'oor ongeveer \'n dag',
  12520. daysUntil: 'oor {delta} dae',
  12521. weekUntil: 'oor \'n week',
  12522. weeksUntil: 'oor {delta} weke',
  12523. monthUntil: 'oor \'n maand',
  12524. monthsUntil: 'oor {delta} maande',
  12525. yearUntil: 'oor \'n jaar',
  12526. yearsUntil: 'oor {delta} jaar'
  12527. });
  12528. /*
  12529. ---
  12530. name: Locale.af-ZA.Form.Validator
  12531. description: Form Validator messages for Afrikaans.
  12532. license: MIT-style license
  12533. authors:
  12534. - Werner Mollentze
  12535. requires:
  12536. - Locale
  12537. provides: [Locale.af-ZA.Form.Validator]
  12538. ...
  12539. */
  12540. Locale.define('af-ZA', 'FormValidator', {
  12541. required: 'Hierdie veld word vereis.',
  12542. length: 'Voer asseblief {length} karakters in (u het {elLength} karakters ingevoer)',
  12543. minLength: 'Voer asseblief ten minste {minLength} karakters in (u het {length} karakters ingevoer).',
  12544. maxLength: 'Moet asseblief nie meer as {maxLength} karakters invoer nie (u het {length} karakters ingevoer).',
  12545. integer: 'Voer asseblief \'n heelgetal in hierdie veld in. Getalle met desimale (bv. 1.25) word nie toegelaat nie.',
  12546. numeric: 'Voer asseblief slegs numeriese waardes in hierdie veld in (bv. "1" of "1.1" of "-1" of "-1.1").',
  12547. digits: 'Gebruik asseblief slegs nommers en punktuasie in hierdie veld. (by voorbeeld, \'n telefoon nommer wat koppeltekens en punte bevat is toelaatbaar).',
  12548. alpha: 'Gebruik asseblief slegs letters (a-z) binne-in hierdie veld. Geen spasies of ander karakters word toegelaat nie.',
  12549. alphanum: 'Gebruik asseblief slegs letters (a-z) en nommers (0-9) binne-in hierdie veld. Geen spasies of ander karakters word toegelaat nie.',
  12550. dateSuchAs: 'Voer asseblief \'n geldige datum soos {date} in',
  12551. dateInFormatMDY: 'Voer asseblief \'n geldige datum soos MM/DD/YYYY in (bv. "12/31/1999")',
  12552. email: 'Voer asseblief \'n geldige e-pos adres in. Byvoorbeeld "fred@domain.com".',
  12553. url: 'Voer asseblief \'n geldige bronadres (URL) soos http://www.example.com in.',
  12554. currencyDollar: 'Voer asseblief \'n geldige $ bedrag in. Byvoorbeeld $100.00 .',
  12555. oneRequired: 'Voer asseblief iets in vir ten minste een van hierdie velde.',
  12556. errorPrefix: 'Fout: ',
  12557. warningPrefix: 'Waarskuwing: ',
  12558. // Form.Validator.Extras
  12559. noSpace: 'Daar mag geen spasies in hierdie toevoer wees nie.',
  12560. reqChkByNode: 'Geen items is gekies nie.',
  12561. requiredChk: 'Hierdie veld word vereis.',
  12562. reqChkByName: 'Kies asseblief \'n {label}.',
  12563. match: 'Hierdie veld moet by die {matchName} veld pas',
  12564. startDate: 'die begin datum',
  12565. endDate: 'die eind datum',
  12566. currentDate: 'die huidige datum',
  12567. afterDate: 'Die datum moet dieselfde of na {label} wees.',
  12568. beforeDate: 'Die datum moet dieselfde of voor {label} wees.',
  12569. startMonth: 'Kies asseblief \'n begin maand',
  12570. sameMonth: 'Hierdie twee datums moet in dieselfde maand wees - u moet een of beide verander.',
  12571. creditcard: 'Die ingevoerde kredietkaart nommer is ongeldig. Bevestig asseblief die nommer en probeer weer. {length} syfers is ingevoer.'
  12572. });
  12573. /*
  12574. ---
  12575. name: Locale.af-ZA.Number
  12576. description: Number messages for ZA Afrikaans.
  12577. license: MIT-style license
  12578. authors:
  12579. - Werner Mollentze
  12580. requires:
  12581. - Locale
  12582. - Locale.ZA.Number
  12583. provides: [Locale.af-ZA.Number]
  12584. ...
  12585. */
  12586. Locale.define('af-ZA').inherit('ZA', 'Number');
  12587. /*
  12588. ---
  12589. name: Locale.ar.Date
  12590. description: Date messages for Arabic.
  12591. license: MIT-style license
  12592. authors:
  12593. - Chafik Barbar
  12594. requires:
  12595. - Locale
  12596. provides: [Locale.ar.Date]
  12597. ...
  12598. */
  12599. Locale.define('ar', 'Date', {
  12600. // Culture's date order: DD/MM/YYYY
  12601. dateOrder: ['date', 'month', 'year'],
  12602. shortDate: '%d/%m/%Y',
  12603. shortTime: '%H:%M'
  12604. });
  12605. /*
  12606. ---
  12607. name: Locale.ar.Form.Validator
  12608. description: Form Validator messages for Arabic.
  12609. license: MIT-style license
  12610. authors:
  12611. - Chafik Barbar
  12612. requires:
  12613. - Locale
  12614. provides: [Locale.ar.Form.Validator]
  12615. ...
  12616. */
  12617. Locale.define('ar', 'FormValidator', {
  12618. required: 'هذا الحقل مطلوب.',
  12619. minLength: 'رجاءً إدخال {minLength} أحرف على الأقل (تم إدخال {length} أحرف).',
  12620. maxLength: 'الرجاء عدم إدخال أكثر من {maxLength} أحرف (تم إدخال {length} أحرف).',
  12621. integer: 'الرجاء إدخال عدد صحيح في هذا الحقل. أي رقم ذو كسر عشري أو مئوي (مثال 1.25 ) غير مسموح.',
  12622. numeric: 'الرجاء إدخال قيم رقمية في هذا الحقل (مثال "1" أو "1.1" أو "-1" أو "-1.1").',
  12623. digits: 'الرجاء أستخدام قيم رقمية وعلامات ترقيمية فقط في هذا الحقل (مثال, رقم هاتف مع نقطة أو شحطة)',
  12624. alpha: 'الرجاء أستخدام أحرف فقط (ا-ي) في هذا الحقل. أي فراغات أو علامات غير مسموحة.',
  12625. alphanum: 'الرجاء أستخدام أحرف فقط (ا-ي) أو أرقام (0-9) فقط في هذا الحقل. أي فراغات أو علامات غير مسموحة.',
  12626. dateSuchAs: 'الرجاء إدخال تاريخ صحيح كالتالي {date}',
  12627. dateInFormatMDY: 'الرجاء إدخال تاريخ صحيح (مثال, 31-12-1999)',
  12628. email: 'الرجاء إدخال بريد إلكتروني صحيح.',
  12629. url: 'الرجاء إدخال عنوان إلكتروني صحيح مثل http://www.example.com',
  12630. currencyDollar: 'الرجاء إدخال قيمة $ صحيحة. مثال, 100.00$',
  12631. oneRequired: 'الرجاء إدخال قيمة في أحد هذه الحقول على الأقل.',
  12632. errorPrefix: 'خطأ: ',
  12633. warningPrefix: 'تحذير: '
  12634. });
  12635. /*
  12636. ---
  12637. name: Locale.ca-CA.Date
  12638. description: Date messages for Catalan.
  12639. license: MIT-style license
  12640. authors:
  12641. - Ãlfons Sanchez
  12642. requires:
  12643. - Locale
  12644. provides: [Locale.ca-CA.Date]
  12645. ...
  12646. */
  12647. Locale.define('ca-CA', 'Date', {
  12648. months: ['Gener', 'Febrer', 'Març', 'Abril', 'Maig', 'Juny', 'Juli', 'Agost', 'Setembre', 'Octubre', 'Novembre', 'Desembre'],
  12649. months_abbr: ['gen.', 'febr.', 'març', 'abr.', 'maig', 'juny', 'jul.', 'ag.', 'set.', 'oct.', 'nov.', 'des.'],
  12650. days: ['Diumenge', 'Dilluns', 'Dimarts', 'Dimecres', 'Dijous', 'Divendres', 'Dissabte'],
  12651. days_abbr: ['dg', 'dl', 'dt', 'dc', 'dj', 'dv', 'ds'],
  12652. // Culture's date order: DD/MM/YYYY
  12653. dateOrder: ['date', 'month', 'year'],
  12654. shortDate: '%d/%m/%Y',
  12655. shortTime: '%H:%M',
  12656. AM: 'AM',
  12657. PM: 'PM',
  12658. firstDayOfWeek: 0,
  12659. // Date.Extras
  12660. ordinal: '',
  12661. lessThanMinuteAgo: 'fa menys d`un minut',
  12662. minuteAgo: 'fa un minut',
  12663. minutesAgo: 'fa {delta} minuts',
  12664. hourAgo: 'fa un hora',
  12665. hoursAgo: 'fa unes {delta} hores',
  12666. dayAgo: 'fa un dia',
  12667. daysAgo: 'fa {delta} dies',
  12668. lessThanMinuteUntil: 'menys d`un minut des d`ara',
  12669. minuteUntil: 'un minut des d`ara',
  12670. minutesUntil: '{delta} minuts des d`ara',
  12671. hourUntil: 'un hora des d`ara',
  12672. hoursUntil: 'unes {delta} hores des d`ara',
  12673. dayUntil: '1 dia des d`ara',
  12674. daysUntil: '{delta} dies des d`ara'
  12675. });
  12676. /*
  12677. ---
  12678. name: Locale.ca-CA.Form.Validator
  12679. description: Form Validator messages for Catalan.
  12680. license: MIT-style license
  12681. authors:
  12682. - Miquel Hudin
  12683. - Ãlfons Sanchez
  12684. requires:
  12685. - Locale
  12686. provides: [Locale.ca-CA.Form.Validator]
  12687. ...
  12688. */
  12689. Locale.define('ca-CA', 'FormValidator', {
  12690. required: 'Aquest camp es obligatori.',
  12691. minLength: 'Per favor introdueix al menys {minLength} caracters (has introduit {length} caracters).',
  12692. maxLength: 'Per favor introdueix no mes de {maxLength} caracters (has introduit {length} caracters).',
  12693. integer: 'Per favor introdueix un nombre enter en aquest camp. Nombres amb decimals (p.e. 1,25) no estan permesos.',
  12694. numeric: 'Per favor introdueix sols valors numerics en aquest camp (p.e. "1" o "1,1" o "-1" o "-1,1").',
  12695. digits: 'Per favor usa sols numeros i puntuacio en aquest camp (per exemple, un nombre de telefon amb guions i punts no esta permes).',
  12696. alpha: 'Per favor utilitza lletres nomes (a-z) en aquest camp. No s´admiteixen espais ni altres caracters.',
  12697. alphanum: 'Per favor, utilitza nomes lletres (a-z) o numeros (0-9) en aquest camp. No s´admiteixen espais ni altres caracters.',
  12698. dateSuchAs: 'Per favor introdueix una data valida com {date}',
  12699. dateInFormatMDY: 'Per favor introdueix una data valida com DD/MM/YYYY (p.e. "31/12/1999")',
  12700. email: 'Per favor, introdueix una adreça de correu electronic valida. Per exemple, "fred@domain.com".',
  12701. url: 'Per favor introdueix una URL valida com http://www.example.com.',
  12702. currencyDollar: 'Per favor introdueix una quantitat valida de €. Per exemple €100,00 .',
  12703. oneRequired: 'Per favor introdueix alguna cosa per al menys una d´aquestes entrades.',
  12704. errorPrefix: 'Error: ',
  12705. warningPrefix: 'Avis: ',
  12706. // Form.Validator.Extras
  12707. noSpace: 'No poden haver espais en aquesta entrada.',
  12708. reqChkByNode: 'No hi han elements seleccionats.',
  12709. requiredChk: 'Aquest camp es obligatori.',
  12710. reqChkByName: 'Per favor selecciona una {label}.',
  12711. match: 'Aquest camp necessita coincidir amb el camp {matchName}',
  12712. startDate: 'la data de inici',
  12713. endDate: 'la data de fi',
  12714. currentDate: 'la data actual',
  12715. afterDate: 'La data deu ser igual o posterior a {label}.',
  12716. beforeDate: 'La data deu ser igual o anterior a {label}.',
  12717. startMonth: 'Per favor selecciona un mes d´orige',
  12718. sameMonth: 'Aquestes dos dates deuen estar dins del mateix mes - deus canviar una o altra.'
  12719. });
  12720. /*
  12721. ---
  12722. name: Locale.cs-CZ.Date
  12723. description: Date messages for Czech.
  12724. license: MIT-style license
  12725. authors:
  12726. - Jan Černý chemiX
  12727. - Christopher Zukowski
  12728. requires:
  12729. - Locale
  12730. provides: [Locale.cs-CZ.Date]
  12731. ...
  12732. */
  12733. (function(){
  12734. // Czech language pluralization rules, see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  12735. // one -> n is 1; 1
  12736. // few -> n in 2..4; 2-4
  12737. // other -> everything else 0, 5-999, 1.31, 2.31, 5.31...
  12738. var pluralize = function(n, one, few, other){
  12739. if (n == 1) return one;
  12740. else if (n == 2 || n == 3 || n == 4) return few;
  12741. else return other;
  12742. };
  12743. Locale.define('cs-CZ', 'Date', {
  12744. months: ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'],
  12745. months_abbr: ['ledna', 'února', 'března', 'dubna', 'května', 'června', 'července', 'srpna', 'září', 'října', 'listopadu', 'prosince'],
  12746. days: ['Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'],
  12747. days_abbr: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
  12748. // Culture's date order: DD.MM.YYYY
  12749. dateOrder: ['date', 'month', 'year'],
  12750. shortDate: '%d.%m.%Y',
  12751. shortTime: '%H:%M',
  12752. AM: 'dop.',
  12753. PM: 'odp.',
  12754. firstDayOfWeek: 1,
  12755. // Date.Extras
  12756. ordinal: '.',
  12757. lessThanMinuteAgo: 'před chvílí',
  12758. minuteAgo: 'přibližně před minutou',
  12759. minutesAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'minutou', 'minutami', 'minutami'); },
  12760. hourAgo: 'přibližně před hodinou',
  12761. hoursAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'hodinou', 'hodinami', 'hodinami'); },
  12762. dayAgo: 'před dnem',
  12763. daysAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'dnem', 'dny', 'dny'); },
  12764. weekAgo: 'před týdnem',
  12765. weeksAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'týdnem', 'týdny', 'týdny'); },
  12766. monthAgo: 'před měsícem',
  12767. monthsAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'měsícem', 'měsíci', 'měsíci'); },
  12768. yearAgo: 'před rokem',
  12769. yearsAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'rokem', 'lety', 'lety'); },
  12770. lessThanMinuteUntil: 'za chvíli',
  12771. minuteUntil: 'přibližně za minutu',
  12772. minutesUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'minutu', 'minuty', 'minut'); },
  12773. hourUntil: 'přibližně za hodinu',
  12774. hoursUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'hodinu', 'hodiny', 'hodin'); },
  12775. dayUntil: 'za den',
  12776. daysUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'den', 'dny', 'dnů'); },
  12777. weekUntil: 'za týden',
  12778. weeksUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'týden', 'týdny', 'týdnů'); },
  12779. monthUntil: 'za měsíc',
  12780. monthsUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'měsíc', 'měsíce', 'měsíců'); },
  12781. yearUntil: 'za rok',
  12782. yearsUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'rok', 'roky', 'let'); }
  12783. });
  12784. })();
  12785. /*
  12786. ---
  12787. name: Locale.cs-CZ.Form.Validator
  12788. description: Form Validator messages for Czech.
  12789. license: MIT-style license
  12790. authors:
  12791. - Jan Černý chemiX
  12792. requires:
  12793. - Locale
  12794. provides: [Locale.cs-CZ.Form.Validator]
  12795. ...
  12796. */
  12797. Locale.define('cs-CZ', 'FormValidator', {
  12798. required: 'Tato položka je povinná.',
  12799. minLength: 'Zadejte prosím alespoň {minLength} znaků (napsáno {length} znaků).',
  12800. maxLength: 'Zadejte prosím méně než {maxLength} znaků (nápsáno {length} znaků).',
  12801. integer: 'Zadejte prosím celé číslo. Desetinná čísla (např. 1.25) nejsou povolena.',
  12802. numeric: 'Zadejte jen číselné hodnoty (tj. "1" nebo "1.1" nebo "-1" nebo "-1.1").',
  12803. digits: 'Zadejte prosím pouze čísla a interpunkční znaménka(například telefonní číslo s pomlčkami nebo tečkami je povoleno).',
  12804. alpha: 'Zadejte prosím pouze písmena (a-z). Mezery nebo jiné znaky nejsou povoleny.',
  12805. alphanum: 'Zadejte prosím pouze písmena (a-z) nebo číslice (0-9). Mezery nebo jiné znaky nejsou povoleny.',
  12806. dateSuchAs: 'Zadejte prosím platné datum jako {date}',
  12807. dateInFormatMDY: 'Zadejte prosím platné datum jako MM / DD / RRRR (tj. "12/31/1999")',
  12808. email: 'Zadejte prosím platnou e-mailovou adresu. Například "fred@domain.com".',
  12809. url: 'Zadejte prosím platnou URL adresu jako http://www.example.com.',
  12810. currencyDollar: 'Zadejte prosím platnou částku. Například $100.00.',
  12811. oneRequired: 'Zadejte prosím alespoň jednu hodnotu pro tyto položky.',
  12812. errorPrefix: 'Chyba: ',
  12813. warningPrefix: 'Upozornění: ',
  12814. // Form.Validator.Extras
  12815. noSpace: 'V této položce nejsou povoleny mezery',
  12816. reqChkByNode: 'Nejsou vybrány žádné položky.',
  12817. requiredChk: 'Tato položka je vyžadována.',
  12818. reqChkByName: 'Prosím vyberte {label}.',
  12819. match: 'Tato položka se musí shodovat s položkou {matchName}',
  12820. startDate: 'datum zahájení',
  12821. endDate: 'datum ukončení',
  12822. currentDate: 'aktuální datum',
  12823. afterDate: 'Datum by mělo být stejné nebo větší než {label}.',
  12824. beforeDate: 'Datum by mělo být stejné nebo menší než {label}.',
  12825. startMonth: 'Vyberte počáteční měsíc.',
  12826. sameMonth: 'Tyto dva datumy musí být ve stejném měsíci - změňte jeden z nich.',
  12827. creditcard: 'Zadané číslo kreditní karty je neplatné. Prosím opravte ho. Bylo zadáno {length} čísel.'
  12828. });
  12829. /*
  12830. ---
  12831. name: Locale.da-DK.Date
  12832. description: Date messages for Danish.
  12833. license: MIT-style license
  12834. authors:
  12835. - Martin Overgaard
  12836. - Henrik Hansen
  12837. requires:
  12838. - Locale
  12839. provides: [Locale.da-DK.Date]
  12840. ...
  12841. */
  12842. Locale.define('da-DK', 'Date', {
  12843. months: ['Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December'],
  12844. months_abbr: ['jan.', 'feb.', 'mar.', 'apr.', 'maj.', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
  12845. days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
  12846. days_abbr: ['søn', 'man', 'tir', 'ons', 'tor', 'fre', 'lør'],
  12847. // Culture's date order: DD-MM-YYYY
  12848. dateOrder: ['date', 'month', 'year'],
  12849. shortDate: '%d-%m-%Y',
  12850. shortTime: '%H:%M',
  12851. AM: 'AM',
  12852. PM: 'PM',
  12853. firstDayOfWeek: 1,
  12854. // Date.Extras
  12855. ordinal: '.',
  12856. lessThanMinuteAgo: 'mindre end et minut siden',
  12857. minuteAgo: 'omkring et minut siden',
  12858. minutesAgo: '{delta} minutter siden',
  12859. hourAgo: 'omkring en time siden',
  12860. hoursAgo: 'omkring {delta} timer siden',
  12861. dayAgo: '1 dag siden',
  12862. daysAgo: '{delta} dage siden',
  12863. weekAgo: '1 uge siden',
  12864. weeksAgo: '{delta} uger siden',
  12865. monthAgo: '1 måned siden',
  12866. monthsAgo: '{delta} måneder siden',
  12867. yearAgo: '1 år siden',
  12868. yearsAgo: '{delta} år siden',
  12869. lessThanMinuteUntil: 'mindre end et minut fra nu',
  12870. minuteUntil: 'omkring et minut fra nu',
  12871. minutesUntil: '{delta} minutter fra nu',
  12872. hourUntil: 'omkring en time fra nu',
  12873. hoursUntil: 'omkring {delta} timer fra nu',
  12874. dayUntil: '1 dag fra nu',
  12875. daysUntil: '{delta} dage fra nu',
  12876. weekUntil: '1 uge fra nu',
  12877. weeksUntil: '{delta} uger fra nu',
  12878. monthUntil: '1 måned fra nu',
  12879. monthsUntil: '{delta} måneder fra nu',
  12880. yearUntil: '1 år fra nu',
  12881. yearsUntil: '{delta} år fra nu'
  12882. });
  12883. /*
  12884. ---
  12885. name: Locale.da-DK.Form.Validator
  12886. description: Form Validator messages for Danish.
  12887. license: MIT-style license
  12888. authors:
  12889. - Martin Overgaard
  12890. requires:
  12891. - Locale
  12892. provides: [Locale.da-DK.Form.Validator]
  12893. ...
  12894. */
  12895. Locale.define('da-DK', 'FormValidator', {
  12896. required: 'Feltet skal udfyldes.',
  12897. minLength: 'Skriv mindst {minLength} tegn (du skrev {length} tegn).',
  12898. maxLength: 'Skriv maksimalt {maxLength} tegn (du skrev {length} tegn).',
  12899. integer: 'Skriv et tal i dette felt. Decimal tal (f.eks. 1.25) er ikke tilladt.',
  12900. numeric: 'Skriv kun tal i dette felt (i.e. "1" eller "1.1" eller "-1" eller "-1.1").',
  12901. digits: 'Skriv kun tal og tegnsætning i dette felt (eksempel, et telefon nummer med bindestreg eller punktum er tilladt).',
  12902. alpha: 'Skriv kun bogstaver (a-z) i dette felt. Mellemrum og andre tegn er ikke tilladt.',
  12903. alphanum: 'Skriv kun bogstaver (a-z) eller tal (0-9) i dette felt. Mellemrum og andre tegn er ikke tilladt.',
  12904. dateSuchAs: 'Skriv en gyldig dato som {date}',
  12905. dateInFormatMDY: 'Skriv dato i formatet DD-MM-YYYY (f.eks. "31-12-1999")',
  12906. email: 'Skriv en gyldig e-mail adresse. F.eks "fred@domain.com".',
  12907. url: 'Skriv en gyldig URL adresse. F.eks "http://www.example.com".',
  12908. currencyDollar: 'Skriv et gldigt beløb. F.eks Kr.100.00 .',
  12909. oneRequired: 'Et eller flere af felterne i denne formular skal udfyldes.',
  12910. errorPrefix: 'Fejl: ',
  12911. warningPrefix: 'Advarsel: ',
  12912. // Form.Validator.Extras
  12913. noSpace: 'Der må ikke benyttes mellemrum i dette felt.',
  12914. reqChkByNode: 'Foretag et valg.',
  12915. requiredChk: 'Dette felt skal udfyldes.',
  12916. reqChkByName: 'Vælg en {label}.',
  12917. match: 'Dette felt skal matche {matchName} feltet',
  12918. startDate: 'start dato',
  12919. endDate: 'slut dato',
  12920. currentDate: 'dags dato',
  12921. afterDate: 'Datoen skal være større end eller lig med {label}.',
  12922. beforeDate: 'Datoen skal være mindre end eller lig med {label}.',
  12923. startMonth: 'Vælg en start måned',
  12924. sameMonth: 'De valgte datoer skal være i samme måned - skift en af dem.'
  12925. });
  12926. /*
  12927. ---
  12928. name: Locale.de-DE.Date
  12929. description: Date messages for German.
  12930. license: MIT-style license
  12931. authors:
  12932. - Christoph Pojer
  12933. - Frank Rossi
  12934. - Ulrich Petri
  12935. - Fabian Beiner
  12936. requires:
  12937. - Locale
  12938. provides: [Locale.de-DE.Date]
  12939. ...
  12940. */
  12941. Locale.define('de-DE', 'Date', {
  12942. months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
  12943. months_abbr: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
  12944. days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
  12945. days_abbr: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
  12946. // Culture's date order: DD.MM.YYYY
  12947. dateOrder: ['date', 'month', 'year'],
  12948. shortDate: '%d.%m.%Y',
  12949. shortTime: '%H:%M',
  12950. AM: 'vormittags',
  12951. PM: 'nachmittags',
  12952. firstDayOfWeek: 1,
  12953. // Date.Extras
  12954. ordinal: '.',
  12955. lessThanMinuteAgo: 'vor weniger als einer Minute',
  12956. minuteAgo: 'vor einer Minute',
  12957. minutesAgo: 'vor {delta} Minuten',
  12958. hourAgo: 'vor einer Stunde',
  12959. hoursAgo: 'vor {delta} Stunden',
  12960. dayAgo: 'vor einem Tag',
  12961. daysAgo: 'vor {delta} Tagen',
  12962. weekAgo: 'vor einer Woche',
  12963. weeksAgo: 'vor {delta} Wochen',
  12964. monthAgo: 'vor einem Monat',
  12965. monthsAgo: 'vor {delta} Monaten',
  12966. yearAgo: 'vor einem Jahr',
  12967. yearsAgo: 'vor {delta} Jahren',
  12968. lessThanMinuteUntil: 'in weniger als einer Minute',
  12969. minuteUntil: 'in einer Minute',
  12970. minutesUntil: 'in {delta} Minuten',
  12971. hourUntil: 'in ca. einer Stunde',
  12972. hoursUntil: 'in ca. {delta} Stunden',
  12973. dayUntil: 'in einem Tag',
  12974. daysUntil: 'in {delta} Tagen',
  12975. weekUntil: 'in einer Woche',
  12976. weeksUntil: 'in {delta} Wochen',
  12977. monthUntil: 'in einem Monat',
  12978. monthsUntil: 'in {delta} Monaten',
  12979. yearUntil: 'in einem Jahr',
  12980. yearsUntil: 'in {delta} Jahren'
  12981. });
  12982. /*
  12983. ---
  12984. name: Locale.de-CH.Date
  12985. description: Date messages for German (Switzerland).
  12986. license: MIT-style license
  12987. authors:
  12988. - Michael van der Weg
  12989. requires:
  12990. - Locale
  12991. - Locale.de-DE.Date
  12992. provides: [Locale.de-CH.Date]
  12993. ...
  12994. */
  12995. Locale.define('de-CH').inherit('de-DE', 'Date');
  12996. /*
  12997. ---
  12998. name: Locale.de-CH.Form.Validator
  12999. description: Form Validator messages for German (Switzerland).
  13000. license: MIT-style license
  13001. authors:
  13002. - Michael van der Weg
  13003. requires:
  13004. - Locale
  13005. provides: [Locale.de-CH.Form.Validator]
  13006. ...
  13007. */
  13008. Locale.define('de-CH', 'FormValidator', {
  13009. required: 'Dieses Feld ist obligatorisch.',
  13010. minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13011. maxLength: 'Bitte geben Sie nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13012. integer: 'Geben Sie bitte eine ganze Zahl ein. Dezimalzahlen (z.B. 1.25) sind nicht erlaubt.',
  13013. numeric: 'Geben Sie bitte nur Zahlenwerte in dieses Eingabefeld ein (z.B. &quot;1&quot;, &quot;1.1&quot;, &quot;-1&quot; oder &quot;-1.1&quot;).',
  13014. digits: 'Benutzen Sie bitte nur Zahlen und Satzzeichen in diesem Eingabefeld (erlaubt ist z.B. eine Telefonnummer mit Bindestrichen und Punkten).',
  13015. alpha: 'Benutzen Sie bitte nur Buchstaben (a-z) in diesem Feld. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13016. alphanum: 'Benutzen Sie bitte nur Buchstaben (a-z) und Zahlen (0-9) in diesem Eingabefeld. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13017. dateSuchAs: 'Geben Sie bitte ein g&uuml;ltiges Datum ein. Wie zum Beispiel {date}',
  13018. dateInFormatMDY: 'Geben Sie bitte ein g&uuml;ltiges Datum ein. Wie zum Beispiel TT.MM.JJJJ (z.B. &quot;31.12.1999&quot;)',
  13019. email: 'Geben Sie bitte eine g&uuml;ltige E-Mail Adresse ein. Wie zum Beispiel &quot;maria@bernasconi.ch&quot;.',
  13020. url: 'Geben Sie bitte eine g&uuml;ltige URL ein. Wie zum Beispiel http://www.example.com.',
  13021. currencyDollar: 'Geben Sie bitte einen g&uuml;ltigen Betrag in Schweizer Franken ein. Wie zum Beispiel 100.00 CHF .',
  13022. oneRequired: 'Machen Sie f&uuml;r mindestens eines der Eingabefelder einen Eintrag.',
  13023. errorPrefix: 'Fehler: ',
  13024. warningPrefix: 'Warnung: ',
  13025. // Form.Validator.Extras
  13026. noSpace: 'In diesem Eingabefeld darf kein Leerzeichen sein.',
  13027. reqChkByNode: 'Es wurden keine Elemente gew&auml;hlt.',
  13028. requiredChk: 'Dieses Feld ist obligatorisch.',
  13029. reqChkByName: 'Bitte w&auml;hlen Sie ein {label}.',
  13030. match: 'Dieses Eingabefeld muss mit dem Feld {matchName} &uuml;bereinstimmen.',
  13031. startDate: 'Das Anfangsdatum',
  13032. endDate: 'Das Enddatum',
  13033. currentDate: 'Das aktuelle Datum',
  13034. afterDate: 'Das Datum sollte zur gleichen Zeit oder sp&auml;ter sein {label}.',
  13035. beforeDate: 'Das Datum sollte zur gleichen Zeit oder fr&uuml;her sein {label}.',
  13036. startMonth: 'W&auml;hlen Sie bitte einen Anfangsmonat',
  13037. sameMonth: 'Diese zwei Datumsangaben m&uuml;ssen im selben Monat sein - Sie m&uuml;ssen eine von beiden ver&auml;ndern.',
  13038. creditcard: 'Die eingegebene Kreditkartennummer ist ung&uuml;ltig. Bitte &uuml;berpr&uuml;fen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.'
  13039. });
  13040. /*
  13041. ---
  13042. name: Locale.de-CH.Number
  13043. description: Number messages for Switzerland.
  13044. license: MIT-style license
  13045. authors:
  13046. - Kim D. Jeker
  13047. requires:
  13048. - Locale
  13049. - Locale.CH.Number
  13050. provides: [Locale.de-CH.Number]
  13051. ...
  13052. */
  13053. Locale.define('de-CH').inherit('CH', 'Number');
  13054. /*
  13055. ---
  13056. name: Locale.de-DE.Form.Validator
  13057. description: Form Validator messages for German.
  13058. license: MIT-style license
  13059. authors:
  13060. - Frank Rossi
  13061. - Ulrich Petri
  13062. - Fabian Beiner
  13063. requires:
  13064. - Locale
  13065. provides: [Locale.de-DE.Form.Validator]
  13066. ...
  13067. */
  13068. Locale.define('de-DE', 'FormValidator', {
  13069. required: 'Dieses Eingabefeld muss ausgefüllt werden.',
  13070. minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben nur {length} Zeichen eingegeben).',
  13071. maxLength: 'Geben Sie bitte nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13072. integer: 'Geben Sie in diesem Eingabefeld bitte eine ganze Zahl ein. Dezimalzahlen (z.B. "1.25") sind nicht erlaubt.',
  13073. numeric: 'Geben Sie in diesem Eingabefeld bitte nur Zahlenwerte (z.B. "1", "1.1", "-1" oder "-1.1") ein.',
  13074. digits: 'Geben Sie in diesem Eingabefeld bitte nur Zahlen und Satzzeichen ein (z.B. eine Telefonnummer mit Bindestrichen und Punkten ist erlaubt).',
  13075. alpha: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) ein. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13076. alphanum: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) und Zahlen (0-9) ein. Leerzeichen oder andere Zeichen sind nicht erlaubt.',
  13077. dateSuchAs: 'Geben Sie bitte ein gültiges Datum ein (z.B. "{date}").',
  13078. dateInFormatMDY: 'Geben Sie bitte ein gültiges Datum im Format TT.MM.JJJJ ein (z.B. "31.12.1999").',
  13079. email: 'Geben Sie bitte eine gültige E-Mail-Adresse ein (z.B. "max@mustermann.de").',
  13080. url: 'Geben Sie bitte eine gültige URL ein (z.B. "http://www.example.com").',
  13081. currencyDollar: 'Geben Sie bitte einen gültigen Betrag in EURO ein (z.B. 100.00€).',
  13082. oneRequired: 'Bitte füllen Sie mindestens ein Eingabefeld aus.',
  13083. errorPrefix: 'Fehler: ',
  13084. warningPrefix: 'Warnung: ',
  13085. // Form.Validator.Extras
  13086. noSpace: 'Es darf kein Leerzeichen in diesem Eingabefeld sein.',
  13087. reqChkByNode: 'Es wurden keine Elemente gewählt.',
  13088. requiredChk: 'Dieses Feld muss ausgefüllt werden.',
  13089. reqChkByName: 'Bitte wählen Sie ein {label}.',
  13090. match: 'Dieses Eingabefeld muss mit dem {matchName} Eingabefeld übereinstimmen.',
  13091. startDate: 'Das Anfangsdatum',
  13092. endDate: 'Das Enddatum',
  13093. currentDate: 'Das aktuelle Datum',
  13094. afterDate: 'Das Datum sollte zur gleichen Zeit oder später sein als {label}.',
  13095. beforeDate: 'Das Datum sollte zur gleichen Zeit oder früher sein als {label}.',
  13096. startMonth: 'Wählen Sie bitte einen Anfangsmonat',
  13097. sameMonth: 'Diese zwei Datumsangaben müssen im selben Monat sein - Sie müssen eines von beiden verändern.',
  13098. creditcard: 'Die eingegebene Kreditkartennummer ist ungültig. Bitte überprüfen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.'
  13099. });
  13100. /*
  13101. ---
  13102. name: Locale.de-DE.Number
  13103. description: Number messages for German.
  13104. license: MIT-style license
  13105. authors:
  13106. - Christoph Pojer
  13107. requires:
  13108. - Locale
  13109. - Locale.EU.Number
  13110. provides: [Locale.de-DE.Number]
  13111. ...
  13112. */
  13113. Locale.define('de-DE').inherit('EU', 'Number');
  13114. /*
  13115. ---
  13116. name: Locale.el-GR.Date
  13117. description: Date messages for Greek language.
  13118. license: MIT-style license
  13119. authors:
  13120. - Periklis Argiriadis
  13121. requires:
  13122. - Locale
  13123. provides: [Locale.el-GR.Date]
  13124. ...
  13125. */
  13126. Locale.define('el-GR', 'Date', {
  13127. months: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
  13128. months_abbr: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μάι', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
  13129. days: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
  13130. days_abbr: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'],
  13131. // Culture's date order: DD/MM/YYYY
  13132. dateOrder: ['date', 'month', 'year'],
  13133. shortDate: '%d/%m/%Y',
  13134. shortTime: '%I:%M%p',
  13135. AM: 'πμ',
  13136. PM: 'μμ',
  13137. firstDayOfWeek: 1,
  13138. // Date.Extras
  13139. ordinal: function(dayOfMonth){
  13140. // 1st, 2nd, 3rd, etc.
  13141. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ος' : ['ος'][Math.min(dayOfMonth % 10, 4)];
  13142. },
  13143. lessThanMinuteAgo: 'λιγότερο από ένα λεπτό πριν',
  13144. minuteAgo: 'περίπου ένα λεπτό πριν',
  13145. minutesAgo: '{delta} λεπτά πριν',
  13146. hourAgo: 'περίπου μια ώρα πριν',
  13147. hoursAgo: 'περίπου {delta} ώρες πριν',
  13148. dayAgo: '1 ημέρα πριν',
  13149. daysAgo: '{delta} ημέρες πριν',
  13150. weekAgo: '1 εβδομάδα πριν',
  13151. weeksAgo: '{delta} εβδομάδες πριν',
  13152. monthAgo: '1 μήνα πριν',
  13153. monthsAgo: '{delta} μήνες πριν',
  13154. yearAgo: '1 χρόνο πριν',
  13155. yearsAgo: '{delta} χρόνια πριν',
  13156. lessThanMinuteUntil: 'λιγότερο από λεπτό από τώρα',
  13157. minuteUntil: 'περίπου ένα λεπτό από τώρα',
  13158. minutesUntil: '{delta} λεπτά από τώρα',
  13159. hourUntil: 'περίπου μια ώρα από τώρα',
  13160. hoursUntil: 'περίπου {delta} ώρες από τώρα',
  13161. dayUntil: '1 ημέρα από τώρα',
  13162. daysUntil: '{delta} ημέρες από τώρα',
  13163. weekUntil: '1 εβδομάδα από τώρα',
  13164. weeksUntil: '{delta} εβδομάδες από τώρα',
  13165. monthUntil: '1 μήνας από τώρα',
  13166. monthsUntil: '{delta} μήνες από τώρα',
  13167. yearUntil: '1 χρόνος από τώρα',
  13168. yearsUntil: '{delta} χρόνια από τώρα'
  13169. });
  13170. /*
  13171. ---
  13172. name: Locale.el-GR.Form.Validator
  13173. description: Form Validator messages for Greek language.
  13174. license: MIT-style license
  13175. authors:
  13176. - Dimitris Tsironis
  13177. requires:
  13178. - Locale
  13179. provides: [Locale.el-GR.Form.Validator]
  13180. ...
  13181. */
  13182. Locale.define('el-GR', 'FormValidator', {
  13183. required: 'Αυτό το πεδίο είναι απαραίτητο.',
  13184. length: 'Παρακαλούμε, εισάγετε {length} χαρακτήρες (έχετε ήδη εισάγει {elLength} χαρακτήρες).',
  13185. minLength: 'Παρακαλούμε, εισάγετε τουλάχιστον {minLength} χαρακτήρες (έχετε ήδη εισάγε {length} χαρακτήρες).',
  13186. maxlength: 'Παρακαλούμε, εισάγετε εώς {maxlength} χαρακτήρες (έχετε ήδη εισάγε {length} χαρακτήρες).',
  13187. integer: 'Παρακαλούμε, εισάγετε έναν ακέραιο αριθμό σε αυτό το πεδίο. Οι αριθμοί με δεκαδικά ψηφία (π.χ. 1.25) δεν επιτρέπονται.',
  13188. numeric: 'Παρακαλούμε, εισάγετε μόνο αριθμητικές τιμές σε αυτό το πεδίο (π.χ." 1 " ή " 1.1 " ή " -1 " ή " -1.1 " ).',
  13189. digits: 'Παρακαλούμε, χρησιμοποιήστε μόνο αριθμούς και σημεία στίξης σε αυτόν τον τομέα (π.χ. επιτρέπεται αριθμός τηλεφώνου με παύλες ή τελείες).',
  13190. alpha: 'Παρακαλούμε, χρησιμοποιήστε μόνο γράμματα (a-z) σε αυτό το πεδίο. Δεν επιτρέπονται κενά ή άλλοι χαρακτήρες.',
  13191. alphanum: 'Παρακαλούμε, χρησιμοποιήστε μόνο γράμματα (a-z) ή αριθμούς (0-9) σε αυτόν τον τομέα. Δεν επιτρέπονται κενά ή άλλοι χαρακτήρες.',
  13192. dateSuchAs: 'Παρακαλούμε, εισάγετε μια έγκυρη ημερομηνία, όπως {date}',
  13193. dateInFormatMDY: 'Παρακαλώ εισάγετε μια έγκυρη ημερομηνία, όπως ΜΜ/ΗΗ/ΕΕΕΕ (π.χ. "12/31/1999").',
  13194. email: 'Παρακαλούμε, εισάγετε μια έγκυρη διεύθυνση ηλεκτρονικού ταχυδρομείου (π.χ. "fred@domain.com").',
  13195. url: 'Παρακαλούμε, εισάγετε μια έγκυρη URL διεύθυνση, όπως http://www.example.com',
  13196. currencyDollar: 'Παρακαλούμε, εισάγετε ένα έγκυρο ποσό σε δολλάρια (π.χ. $100.00).',
  13197. oneRequired: 'Παρακαλούμε, εισάγετε κάτι για τουλάχιστον ένα από αυτά τα πεδία.',
  13198. errorPrefix: 'Σφάλμα: ',
  13199. warningPrefix: 'Προσοχή: ',
  13200. // Form.Validator.Extras
  13201. noSpace: 'Δεν επιτρέπονται τα κενά σε αυτό το πεδίο.',
  13202. reqChkByNode: 'Δεν έχει επιλεγεί κάποιο αντικείμενο',
  13203. requiredChk: 'Αυτό το πεδίο είναι απαραίτητο.',
  13204. reqChkByName: 'Παρακαλούμε, επιλέξτε μια ετικέτα {label}.',
  13205. match: 'Αυτό το πεδίο πρέπει να ταιριάζει με το πεδίο {matchName}.',
  13206. startDate: 'η ημερομηνία έναρξης',
  13207. endDate: 'η ημερομηνία λήξης',
  13208. currentDate: 'η τρέχουσα ημερομηνία',
  13209. afterDate: 'Η ημερομηνία πρέπει να είναι η ίδια ή μετά από την {label}.',
  13210. beforeDate: 'Η ημερομηνία πρέπει να είναι η ίδια ή πριν από την {label}.',
  13211. startMonth: 'Παρακαλώ επιλέξτε ένα μήνα αρχής.',
  13212. sameMonth: 'Αυτές οι δύο ημερομηνίες πρέπει να έχουν τον ίδιο μήνα - θα πρέπει να αλλάξετε ή το ένα ή το άλλο',
  13213. creditcard: 'Ο αριθμός της πιστωτικής κάρτας δεν είναι έγκυρος. Παρακαλούμε ελέγξτε τον αριθμό και δοκιμάστε ξανά. {length} μήκος ψηφίων.'
  13214. });
  13215. /*
  13216. ---
  13217. name: Locale.en-GB.Date
  13218. description: Date messages for British English.
  13219. license: MIT-style license
  13220. authors:
  13221. - Aaron Newton
  13222. requires:
  13223. - Locale
  13224. - Locale.en-US.Date
  13225. provides: [Locale.en-GB.Date]
  13226. ...
  13227. */
  13228. Locale.define('en-GB', 'Date', {
  13229. // Culture's date order: DD/MM/YYYY
  13230. dateOrder: ['date', 'month', 'year'],
  13231. shortDate: '%d/%m/%Y',
  13232. shortTime: '%H:%M'
  13233. }).inherit('en-US', 'Date');
  13234. /*
  13235. ---
  13236. name: Locale.en-US.Number
  13237. description: Number messages for US English.
  13238. license: MIT-style license
  13239. authors:
  13240. - Arian Stolwijk
  13241. requires:
  13242. - Locale
  13243. provides: [Locale.en-US.Number]
  13244. ...
  13245. */
  13246. Locale.define('en-US', 'Number', {
  13247. decimal: '.',
  13248. group: ',',
  13249. /* Commented properties are the defaults for Number.format
  13250. decimals: 0,
  13251. precision: 0,
  13252. scientific: null,
  13253. prefix: null,
  13254. suffic: null,
  13255. // Negative/Currency/percentage will mixin Number
  13256. negative: {
  13257. prefix: '-'
  13258. },*/
  13259. currency: {
  13260. // decimals: 2,
  13261. prefix: '$ '
  13262. }/*,
  13263. percentage: {
  13264. decimals: 2,
  13265. suffix: '%'
  13266. }*/
  13267. });
  13268. /*
  13269. ---
  13270. name: Locale.es-ES.Date
  13271. description: Date messages for Spanish.
  13272. license: MIT-style license
  13273. authors:
  13274. - Ãlfons Sanchez
  13275. requires:
  13276. - Locale
  13277. provides: [Locale.es-ES.Date]
  13278. ...
  13279. */
  13280. Locale.define('es-ES', 'Date', {
  13281. months: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
  13282. months_abbr: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'],
  13283. days: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
  13284. days_abbr: ['dom', 'lun', 'mar', 'mié', 'juv', 'vie', 'sáb'],
  13285. // Culture's date order: DD/MM/YYYY
  13286. dateOrder: ['date', 'month', 'year'],
  13287. shortDate: '%d/%m/%Y',
  13288. shortTime: '%H:%M',
  13289. AM: 'AM',
  13290. PM: 'PM',
  13291. firstDayOfWeek: 1,
  13292. // Date.Extras
  13293. ordinal: '',
  13294. lessThanMinuteAgo: 'hace menos de un minuto',
  13295. minuteAgo: 'hace un minuto',
  13296. minutesAgo: 'hace {delta} minutos',
  13297. hourAgo: 'hace una hora',
  13298. hoursAgo: 'hace unas {delta} horas',
  13299. dayAgo: 'hace un día',
  13300. daysAgo: 'hace {delta} días',
  13301. weekAgo: 'hace una semana',
  13302. weeksAgo: 'hace unas {delta} semanas',
  13303. monthAgo: 'hace un mes',
  13304. monthsAgo: 'hace {delta} meses',
  13305. yearAgo: 'hace un año',
  13306. yearsAgo: 'hace {delta} años',
  13307. lessThanMinuteUntil: 'menos de un minuto desde ahora',
  13308. minuteUntil: 'un minuto desde ahora',
  13309. minutesUntil: '{delta} minutos desde ahora',
  13310. hourUntil: 'una hora desde ahora',
  13311. hoursUntil: 'unas {delta} horas desde ahora',
  13312. dayUntil: 'un día desde ahora',
  13313. daysUntil: '{delta} días desde ahora',
  13314. weekUntil: 'una semana desde ahora',
  13315. weeksUntil: 'unas {delta} semanas desde ahora',
  13316. monthUntil: 'un mes desde ahora',
  13317. monthsUntil: '{delta} meses desde ahora',
  13318. yearUntil: 'un año desde ahora',
  13319. yearsUntil: '{delta} años desde ahora'
  13320. });
  13321. /*
  13322. ---
  13323. name: Locale.es-AR.Date
  13324. description: Date messages for Spanish (Argentina).
  13325. license: MIT-style license
  13326. authors:
  13327. - Ãlfons Sanchez
  13328. - Diego Massanti
  13329. requires:
  13330. - Locale
  13331. - Locale.es-ES.Date
  13332. provides: [Locale.es-AR.Date]
  13333. ...
  13334. */
  13335. Locale.define('es-AR').inherit('es-ES', 'Date');
  13336. /*
  13337. ---
  13338. name: Locale.es-AR.Form.Validator
  13339. description: Form Validator messages for Spanish (Argentina).
  13340. license: MIT-style license
  13341. authors:
  13342. - Diego Massanti
  13343. requires:
  13344. - Locale
  13345. provides: [Locale.es-AR.Form.Validator]
  13346. ...
  13347. */
  13348. Locale.define('es-AR', 'FormValidator', {
  13349. required: 'Este campo es obligatorio.',
  13350. minLength: 'Por favor ingrese al menos {minLength} caracteres (ha ingresado {length} caracteres).',
  13351. maxLength: 'Por favor no ingrese más de {maxLength} caracteres (ha ingresado {length} caracteres).',
  13352. integer: 'Por favor ingrese un número entero en este campo. Números con decimales (p.e. 1,25) no se permiten.',
  13353. numeric: 'Por favor ingrese solo valores numéricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',
  13354. digits: 'Por favor use sólo números y puntuación en este campo (por ejemplo, un número de teléfono con guiones y/o puntos no está permitido).',
  13355. alpha: 'Por favor use sólo letras (a-z) en este campo. No se permiten espacios ni otros caracteres.',
  13356. alphanum: 'Por favor, usa sólo letras (a-z) o números (0-9) en este campo. No se permiten espacios u otros caracteres.',
  13357. dateSuchAs: 'Por favor ingrese una fecha válida como {date}',
  13358. dateInFormatMDY: 'Por favor ingrese una fecha válida, utulizando el formato DD/MM/YYYY (p.e. "31/12/1999")',
  13359. email: 'Por favor, ingrese una dirección de e-mail válida. Por ejemplo, "fred@dominio.com".',
  13360. url: 'Por favor ingrese una URL válida como http://www.example.com.',
  13361. currencyDollar: 'Por favor ingrese una cantidad válida de pesos. Por ejemplo $100,00 .',
  13362. oneRequired: 'Por favor ingrese algo para por lo menos una de estas entradas.',
  13363. errorPrefix: 'Error: ',
  13364. warningPrefix: 'Advertencia: ',
  13365. // Form.Validator.Extras
  13366. noSpace: 'No se permiten espacios en este campo.',
  13367. reqChkByNode: 'No hay elementos seleccionados.',
  13368. requiredChk: 'Este campo es obligatorio.',
  13369. reqChkByName: 'Por favor selecciona una {label}.',
  13370. match: 'Este campo necesita coincidir con el campo {matchName}',
  13371. startDate: 'la fecha de inicio',
  13372. endDate: 'la fecha de fin',
  13373. currentDate: 'la fecha actual',
  13374. afterDate: 'La fecha debe ser igual o posterior a {label}.',
  13375. beforeDate: 'La fecha debe ser igual o anterior a {label}.',
  13376. startMonth: 'Por favor selecciona un mes de origen',
  13377. sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.'
  13378. });
  13379. /*
  13380. ---
  13381. name: Locale.es-AR.Number
  13382. description: Number messages for es Argentina.
  13383. license: MIT-style license
  13384. authors:
  13385. - Oscar Kuchuk
  13386. requires:
  13387. - Locale
  13388. provides: [Locale.es-AR.Number]
  13389. ...
  13390. */
  13391. Locale.define('es-AR', 'Number', {
  13392. decimal: ',',
  13393. group: '.',
  13394. /* Commented properties are the defaults for Number.format
  13395. decimals: 0,
  13396. precision: 0,
  13397. scientific: null,
  13398. prefix: null,
  13399. suffic: null,
  13400. // Negative/Currency/percentage will mixin Number
  13401. negative: {
  13402. prefix: '-'
  13403. },*/
  13404. currency: {
  13405. decimals: 2,
  13406. prefix: '$ '
  13407. }/*,
  13408. percentage: {
  13409. decimals: 2,
  13410. suffix: '%'
  13411. }*/
  13412. });
  13413. /*
  13414. ---
  13415. name: Locale.es-ES.Form.Validator
  13416. description: Form Validator messages for Spanish.
  13417. license: MIT-style license
  13418. authors:
  13419. - Ãlfons Sanchez
  13420. requires:
  13421. - Locale
  13422. provides: [Locale.es-ES.Form.Validator]
  13423. ...
  13424. */
  13425. Locale.define('es-ES', 'FormValidator', {
  13426. required: 'Este campo es obligatorio.',
  13427. minLength: 'Por favor introduce al menos {minLength} caracteres (has introducido {length} caracteres).',
  13428. maxLength: 'Por favor introduce no m&aacute;s de {maxLength} caracteres (has introducido {length} caracteres).',
  13429. integer: 'Por favor introduce un n&uacute;mero entero en este campo. N&uacute;meros con decimales (p.e. 1,25) no se permiten.',
  13430. numeric: 'Por favor introduce solo valores num&eacute;ricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',
  13431. digits: 'Por favor usa solo n&uacute;meros y puntuaci&oacute;n en este campo (por ejemplo, un n&uacute;mero de tel&eacute;fono con guiones y puntos no esta permitido).',
  13432. alpha: 'Por favor usa letras solo (a-z) en este campo. No se admiten espacios ni otros caracteres.',
  13433. alphanum: 'Por favor, usa solo letras (a-z) o n&uacute;meros (0-9) en este campo. No se admiten espacios ni otros caracteres.',
  13434. dateSuchAs: 'Por favor introduce una fecha v&aacute;lida como {date}',
  13435. dateInFormatMDY: 'Por favor introduce una fecha v&aacute;lida como DD/MM/YYYY (p.e. "31/12/1999")',
  13436. email: 'Por favor, introduce una direcci&oacute;n de email v&aacute;lida. Por ejemplo, "fred@domain.com".',
  13437. url: 'Por favor introduce una URL v&aacute;lida como http://www.example.com.',
  13438. currencyDollar: 'Por favor introduce una cantidad v&aacute;lida de €. Por ejemplo €100,00 .',
  13439. oneRequired: 'Por favor introduce algo para por lo menos una de estas entradas.',
  13440. errorPrefix: 'Error: ',
  13441. warningPrefix: 'Aviso: ',
  13442. // Form.Validator.Extras
  13443. noSpace: 'No pueden haber espacios en esta entrada.',
  13444. reqChkByNode: 'No hay elementos seleccionados.',
  13445. requiredChk: 'Este campo es obligatorio.',
  13446. reqChkByName: 'Por favor selecciona una {label}.',
  13447. match: 'Este campo necesita coincidir con el campo {matchName}',
  13448. startDate: 'la fecha de inicio',
  13449. endDate: 'la fecha de fin',
  13450. currentDate: 'la fecha actual',
  13451. afterDate: 'La fecha debe ser igual o posterior a {label}.',
  13452. beforeDate: 'La fecha debe ser igual o anterior a {label}.',
  13453. startMonth: 'Por favor selecciona un mes de origen',
  13454. sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.'
  13455. });
  13456. /*
  13457. ---
  13458. name: Locale.es-VE.Date
  13459. description: Date messages for Spanish (Venezuela).
  13460. license: MIT-style license
  13461. authors:
  13462. - Daniel Barreto
  13463. requires:
  13464. - Locale
  13465. - Locale.es-ES.Date
  13466. provides: [Locale.es-VE.Date]
  13467. ...
  13468. */
  13469. Locale.define('es-VE').inherit('es-ES', 'Date');
  13470. /*
  13471. ---
  13472. name: Locale.es-VE.Form.Validator
  13473. description: Form Validator messages for Spanish (Venezuela).
  13474. license: MIT-style license
  13475. authors:
  13476. - Daniel Barreto
  13477. requires:
  13478. - Locale
  13479. - Locale.es-ES.Form.Validator
  13480. provides: [Locale.es-VE.Form.Validator]
  13481. ...
  13482. */
  13483. Locale.define('es-VE', 'FormValidator', {
  13484. digits: 'Por favor usa solo n&uacute;meros y puntuaci&oacute;n en este campo. Por ejemplo, un n&uacute;mero de tel&eacute;fono con guiones y puntos no esta permitido.',
  13485. alpha: 'Por favor usa solo letras (a-z) en este campo. No se admiten espacios ni otros caracteres.',
  13486. currencyDollar: 'Por favor introduce una cantidad v&aacute;lida de Bs. Por ejemplo Bs. 100,00 .',
  13487. oneRequired: 'Por favor introduce un valor para por lo menos una de estas entradas.',
  13488. // Form.Validator.Extras
  13489. startDate: 'La fecha de inicio',
  13490. endDate: 'La fecha de fin',
  13491. currentDate: 'La fecha actual'
  13492. }).inherit('es-ES', 'FormValidator');
  13493. /*
  13494. ---
  13495. name: Locale.es-VE.Number
  13496. description: Number messages for Spanish (Venezuela).
  13497. license: MIT-style license
  13498. authors:
  13499. - Daniel Barreto
  13500. requires:
  13501. - Locale
  13502. provides: [Locale.es-VE.Number]
  13503. ...
  13504. */
  13505. Locale.define('es-VE', 'Number', {
  13506. decimal: ',',
  13507. group: '.',
  13508. /*
  13509. decimals: 0,
  13510. precision: 0,
  13511. */
  13512. // Negative/Currency/percentage will mixin Number
  13513. negative: {
  13514. prefix: '-'
  13515. },
  13516. currency: {
  13517. decimals: 2,
  13518. prefix: 'Bs. '
  13519. },
  13520. percentage: {
  13521. decimals: 2,
  13522. suffix: '%'
  13523. }
  13524. });
  13525. /*
  13526. ---
  13527. name: Locale.et-EE.Date
  13528. description: Date messages for Estonian.
  13529. license: MIT-style license
  13530. authors:
  13531. - Kevin Valdek
  13532. requires:
  13533. - Locale
  13534. provides: [Locale.et-EE.Date]
  13535. ...
  13536. */
  13537. Locale.define('et-EE', 'Date', {
  13538. months: ['jaanuar', 'veebruar', 'märts', 'aprill', 'mai', 'juuni', 'juuli', 'august', 'september', 'oktoober', 'november', 'detsember'],
  13539. months_abbr: ['jaan', 'veebr', 'märts', 'apr', 'mai', 'juuni', 'juuli', 'aug', 'sept', 'okt', 'nov', 'dets'],
  13540. days: ['pühapäev', 'esmaspäev', 'teisipäev', 'kolmapäev', 'neljapäev', 'reede', 'laupäev'],
  13541. days_abbr: ['pühap', 'esmasp', 'teisip', 'kolmap', 'neljap', 'reede', 'laup'],
  13542. // Culture's date order: MM.DD.YYYY
  13543. dateOrder: ['month', 'date', 'year'],
  13544. shortDate: '%m.%d.%Y',
  13545. shortTime: '%H:%M',
  13546. AM: 'AM',
  13547. PM: 'PM',
  13548. firstDayOfWeek: 1,
  13549. // Date.Extras
  13550. ordinal: '',
  13551. lessThanMinuteAgo: 'vähem kui minut aega tagasi',
  13552. minuteAgo: 'umbes minut aega tagasi',
  13553. minutesAgo: '{delta} minutit tagasi',
  13554. hourAgo: 'umbes tund aega tagasi',
  13555. hoursAgo: 'umbes {delta} tundi tagasi',
  13556. dayAgo: '1 päev tagasi',
  13557. daysAgo: '{delta} päeva tagasi',
  13558. weekAgo: '1 nädal tagasi',
  13559. weeksAgo: '{delta} nädalat tagasi',
  13560. monthAgo: '1 kuu tagasi',
  13561. monthsAgo: '{delta} kuud tagasi',
  13562. yearAgo: '1 aasta tagasi',
  13563. yearsAgo: '{delta} aastat tagasi',
  13564. lessThanMinuteUntil: 'vähem kui minuti aja pärast',
  13565. minuteUntil: 'umbes minuti aja pärast',
  13566. minutesUntil: '{delta} minuti pärast',
  13567. hourUntil: 'umbes tunni aja pärast',
  13568. hoursUntil: 'umbes {delta} tunni pärast',
  13569. dayUntil: '1 päeva pärast',
  13570. daysUntil: '{delta} päeva pärast',
  13571. weekUntil: '1 nädala pärast',
  13572. weeksUntil: '{delta} nädala pärast',
  13573. monthUntil: '1 kuu pärast',
  13574. monthsUntil: '{delta} kuu pärast',
  13575. yearUntil: '1 aasta pärast',
  13576. yearsUntil: '{delta} aasta pärast'
  13577. });
  13578. /*
  13579. ---
  13580. name: Locale.et-EE.Form.Validator
  13581. description: Form Validator messages for Estonian.
  13582. license: MIT-style license
  13583. authors:
  13584. - Kevin Valdek
  13585. requires:
  13586. - Locale
  13587. provides: [Locale.et-EE.Form.Validator]
  13588. ...
  13589. */
  13590. Locale.define('et-EE', 'FormValidator', {
  13591. required: 'Väli peab olema täidetud.',
  13592. minLength: 'Palun sisestage vähemalt {minLength} tähte (te sisestasite {length} tähte).',
  13593. maxLength: 'Palun ärge sisestage rohkem kui {maxLength} tähte (te sisestasite {length} tähte).',
  13594. integer: 'Palun sisestage väljale täisarv. Kümnendarvud (näiteks 1.25) ei ole lubatud.',
  13595. numeric: 'Palun sisestage ainult numbreid väljale (näiteks "1", "1.1", "-1" või "-1.1").',
  13596. digits: 'Palun kasutage ainult numbreid ja kirjavahemärke (telefoninumbri sisestamisel on lubatud kasutada kriipse ja punkte).',
  13597. alpha: 'Palun kasutage ainult tähti (a-z). Tühikud ja teised sümbolid on keelatud.',
  13598. alphanum: 'Palun kasutage ainult tähti (a-z) või numbreid (0-9). Tühikud ja teised sümbolid on keelatud.',
  13599. dateSuchAs: 'Palun sisestage kehtiv kuupäev kujul {date}',
  13600. dateInFormatMDY: 'Palun sisestage kehtiv kuupäev kujul MM.DD.YYYY (näiteks: "12.31.1999").',
  13601. email: 'Palun sisestage kehtiv e-maili aadress (näiteks: "fred@domain.com").',
  13602. url: 'Palun sisestage kehtiv URL (näiteks: http://www.example.com).',
  13603. currencyDollar: 'Palun sisestage kehtiv $ summa (näiteks: $100.00).',
  13604. oneRequired: 'Palun sisestage midagi vähemalt ühele antud väljadest.',
  13605. errorPrefix: 'Viga: ',
  13606. warningPrefix: 'Hoiatus: ',
  13607. // Form.Validator.Extras
  13608. noSpace: 'Väli ei tohi sisaldada tühikuid.',
  13609. reqChkByNode: 'Ükski väljadest pole valitud.',
  13610. requiredChk: 'Välja täitmine on vajalik.',
  13611. reqChkByName: 'Palun valige üks {label}.',
  13612. match: 'Väli peab sobima {matchName} väljaga',
  13613. startDate: 'algkuupäev',
  13614. endDate: 'lõppkuupäev',
  13615. currentDate: 'praegune kuupäev',
  13616. afterDate: 'Kuupäev peab olema võrdne või pärast {label}.',
  13617. beforeDate: 'Kuupäev peab olema võrdne või enne {label}.',
  13618. startMonth: 'Palun valige algkuupäev.',
  13619. sameMonth: 'Antud kaks kuupäeva peavad olema samas kuus - peate muutma ühte kuupäeva.'
  13620. });
  13621. /*
  13622. ---
  13623. name: Locale.fa.Date
  13624. description: Date messages for Persian.
  13625. license: MIT-style license
  13626. authors:
  13627. - Amir Hossein Hodjaty Pour
  13628. requires:
  13629. - Locale
  13630. provides: [Locale.fa.Date]
  13631. ...
  13632. */
  13633. Locale.define('fa', 'Date', {
  13634. months: ['ژانویه', 'فوریه', 'مارس', 'آپریل', 'مه', 'ژوئن', 'ژوئیه', 'آگوست', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
  13635. months_abbr: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
  13636. days: ['یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
  13637. days_abbr: ['ي', 'د', 'س', 'چ', 'پ', 'ج', 'ش'],
  13638. // Culture's date order: MM/DD/YYYY
  13639. dateOrder: ['month', 'date', 'year'],
  13640. shortDate: '%m/%d/%Y',
  13641. shortTime: '%I:%M%p',
  13642. AM: 'ق.ظ',
  13643. PM: 'ب.ظ',
  13644. // Date.Extras
  13645. ordinal: 'ام',
  13646. lessThanMinuteAgo: 'کمتر از یک دقیقه پیش',
  13647. minuteAgo: 'حدود یک دقیقه پیش',
  13648. minutesAgo: '{delta} دقیقه پیش',
  13649. hourAgo: 'حدود یک ساعت پیش',
  13650. hoursAgo: 'حدود {delta} ساعت پیش',
  13651. dayAgo: '1 روز پیش',
  13652. daysAgo: '{delta} روز پیش',
  13653. weekAgo: '1 هفته پیش',
  13654. weeksAgo: '{delta} هفته پیش',
  13655. monthAgo: '1 ماه پیش',
  13656. monthsAgo: '{delta} ماه پیش',
  13657. yearAgo: '1 سال پیش',
  13658. yearsAgo: '{delta} سال پیش',
  13659. lessThanMinuteUntil: 'کمتر از یک دقیقه از حالا',
  13660. minuteUntil: 'حدود یک دقیقه از حالا',
  13661. minutesUntil: '{delta} دقیقه از حالا',
  13662. hourUntil: 'حدود یک ساعت از حالا',
  13663. hoursUntil: 'حدود {delta} ساعت از حالا',
  13664. dayUntil: '1 روز از حالا',
  13665. daysUntil: '{delta} روز از حالا',
  13666. weekUntil: '1 هفته از حالا',
  13667. weeksUntil: '{delta} هفته از حالا',
  13668. monthUntil: '1 ماه از حالا',
  13669. monthsUntil: '{delta} ماه از حالا',
  13670. yearUntil: '1 سال از حالا',
  13671. yearsUntil: '{delta} سال از حالا'
  13672. });
  13673. /*
  13674. ---
  13675. name: Locale.fa.Form.Validator
  13676. description: Form Validator messages for Persian.
  13677. license: MIT-style license
  13678. authors:
  13679. - Amir Hossein Hodjaty Pour
  13680. requires:
  13681. - Locale
  13682. provides: [Locale.fa.Form.Validator]
  13683. ...
  13684. */
  13685. Locale.define('fa', 'FormValidator', {
  13686. required: 'این فیلد الزامی است.',
  13687. minLength: 'شما باید حداقل {minLength} حرف وارد کنید ({length} حرف وارد کرده اید).',
  13688. maxLength: 'لطفا حداکثر {maxLength} حرف وارد کنید (شما {length} حرف وارد کرده اید).',
  13689. integer: 'لطفا از عدد صحیح استفاده کنید. اعداد اعشاری (مانند 1.25) مجاز نیستند.',
  13690. numeric: 'لطفا فقط داده عددی وارد کنید (مانند "1" یا "1.1" یا "1-" یا "1.1-").',
  13691. digits: 'لطفا فقط از اعداد و علامتها در این فیلد استفاده کنید (برای مثال شماره تلفن با خط تیره و نقطه قابل قبول است).',
  13692. alpha: 'لطفا فقط از حروف الفباء برای این بخش استفاده کنید. کاراکترهای دیگر و فاصله مجاز نیستند.',
  13693. alphanum: 'لطفا فقط از حروف الفباء و اعداد در این بخش استفاده کنید. کاراکترهای دیگر و فاصله مجاز نیستند.',
  13694. dateSuchAs: 'لطفا یک تاریخ معتبر مانند {date} وارد کنید.',
  13695. dateInFormatMDY: 'لطفا یک تاریخ معتبر به شکل MM/DD/YYYY وارد کنید (مانند "12/31/1999").',
  13696. email: 'لطفا یک آدرس ایمیل معتبر وارد کنید. برای مثال "fred@domain.com".',
  13697. url: 'لطفا یک URL معتبر مانند http://www.example.com وارد کنید.',
  13698. currencyDollar: 'لطفا یک محدوده معتبر برای این بخش وارد کنید مانند 100.00$ .',
  13699. oneRequired: 'لطفا حداقل یکی از فیلدها را پر کنید.',
  13700. errorPrefix: 'خطا: ',
  13701. warningPrefix: 'هشدار: ',
  13702. // Form.Validator.Extras
  13703. noSpace: 'استفاده از فاصله در این بخش مجاز نیست.',
  13704. reqChkByNode: 'موردی انتخاب نشده است.',
  13705. requiredChk: 'این فیلد الزامی است.',
  13706. reqChkByName: 'لطفا یک {label} را انتخاب کنید.',
  13707. match: 'این فیلد باید با فیلد {matchName} مطابقت داشته باشد.',
  13708. startDate: 'تاریخ شروع',
  13709. endDate: 'تاریخ پایان',
  13710. currentDate: 'تاریخ کنونی',
  13711. afterDate: 'تاریخ میبایست برابر یا بعد از {label} باشد',
  13712. beforeDate: 'تاریخ میبایست برابر یا قبل از {label} باشد',
  13713. startMonth: 'لطفا ماه شروع را انتخاب کنید',
  13714. sameMonth: 'این دو تاریخ باید در یک ماه باشند - شما باید یکی یا هر دو را تغییر دهید.',
  13715. creditcard: 'شماره کارت اعتباری که وارد کرده اید معتبر نیست. لطفا شماره را بررسی کنید و مجددا تلاش کنید. {length} رقم وارد شده است.'
  13716. });
  13717. /*
  13718. ---
  13719. name: Locale.fi-FI.Date
  13720. description: Date messages for Finnish.
  13721. license: MIT-style license
  13722. authors:
  13723. - ksel
  13724. requires:
  13725. - Locale
  13726. provides: [Locale.fi-FI.Date]
  13727. ...
  13728. */
  13729. Locale.define('fi-FI', 'Date', {
  13730. // NOTE: months and days are not capitalized in finnish
  13731. months: ['tammikuu', 'helmikuu', 'maaliskuu', 'huhtikuu', 'toukokuu', 'kesäkuu', 'heinäkuu', 'elokuu', 'syyskuu', 'lokakuu', 'marraskuu', 'joulukuu'],
  13732. // these abbreviations are really not much used in finnish because they obviously won't abbreviate very much. ;)
  13733. // NOTE: sometimes one can see forms such as "tammi", "helmi", etc. but that is not proper finnish.
  13734. months_abbr: ['tammik.', 'helmik.', 'maalisk.', 'huhtik.', 'toukok.', 'kesäk.', 'heinäk.', 'elok.', 'syysk.', 'lokak.', 'marrask.', 'jouluk.'],
  13735. days: ['sunnuntai', 'maanantai', 'tiistai', 'keskiviikko', 'torstai', 'perjantai', 'lauantai'],
  13736. days_abbr: ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'],
  13737. // Culture's date order: DD/MM/YYYY
  13738. dateOrder: ['date', 'month', 'year'],
  13739. shortDate: '%d.%m.%Y',
  13740. shortTime: '%H:%M',
  13741. AM: 'AM',
  13742. PM: 'PM',
  13743. firstDayOfWeek: 1,
  13744. // Date.Extras
  13745. ordinal: '.',
  13746. lessThanMinuteAgo: 'vajaa minuutti sitten',
  13747. minuteAgo: 'noin minuutti sitten',
  13748. minutesAgo: '{delta} minuuttia sitten',
  13749. hourAgo: 'noin tunti sitten',
  13750. hoursAgo: 'noin {delta} tuntia sitten',
  13751. dayAgo: 'päivä sitten',
  13752. daysAgo: '{delta} päivää sitten',
  13753. weekAgo: 'viikko sitten',
  13754. weeksAgo: '{delta} viikkoa sitten',
  13755. monthAgo: 'kuukausi sitten',
  13756. monthsAgo: '{delta} kuukautta sitten',
  13757. yearAgo: 'vuosi sitten',
  13758. yearsAgo: '{delta} vuotta sitten',
  13759. lessThanMinuteUntil: 'vajaan minuutin kuluttua',
  13760. minuteUntil: 'noin minuutin kuluttua',
  13761. minutesUntil: '{delta} minuutin kuluttua',
  13762. hourUntil: 'noin tunnin kuluttua',
  13763. hoursUntil: 'noin {delta} tunnin kuluttua',
  13764. dayUntil: 'päivän kuluttua',
  13765. daysUntil: '{delta} päivän kuluttua',
  13766. weekUntil: 'viikon kuluttua',
  13767. weeksUntil: '{delta} viikon kuluttua',
  13768. monthUntil: 'kuukauden kuluttua',
  13769. monthsUntil: '{delta} kuukauden kuluttua',
  13770. yearUntil: 'vuoden kuluttua',
  13771. yearsUntil: '{delta} vuoden kuluttua'
  13772. });
  13773. /*
  13774. ---
  13775. name: Locale.fi-FI.Form.Validator
  13776. description: Form Validator messages for Finnish.
  13777. license: MIT-style license
  13778. authors:
  13779. - ksel
  13780. requires:
  13781. - Locale
  13782. provides: [Locale.fi-FI.Form.Validator]
  13783. ...
  13784. */
  13785. Locale.define('fi-FI', 'FormValidator', {
  13786. required: 'Tämä kenttä on pakollinen.',
  13787. minLength: 'Ole hyvä ja anna vähintään {minLength} merkkiä (annoit {length} merkkiä).',
  13788. maxLength: 'Älä anna enempää kuin {maxLength} merkkiä (annoit {length} merkkiä).',
  13789. integer: 'Ole hyvä ja anna kokonaisluku. Luvut, joissa on desimaaleja (esim. 1.25) eivät ole sallittuja.',
  13790. numeric: 'Anna tähän kenttään lukuarvo (kuten "1" tai "1.1" tai "-1" tai "-1.1").',
  13791. digits: 'Käytä pelkästään numeroita ja välimerkkejä tässä kentässä (syötteet, kuten esim. puhelinnumero, jossa on väliviivoja, pilkkuja tai pisteitä, kelpaa).',
  13792. alpha: 'Anna tähän kenttään vain kirjaimia (a-z). Välilyönnit tai muut merkit eivät ole sallittuja.',
  13793. alphanum: 'Anna tähän kenttään vain kirjaimia (a-z) tai numeroita (0-9). Välilyönnit tai muut merkit eivät ole sallittuja.',
  13794. dateSuchAs: 'Ole hyvä ja anna kelvollinen päivmäärä, kuten esimerkiksi {date}',
  13795. dateInFormatMDY: 'Ole hyvä ja anna kelvollinen päivämäärä muodossa pp/kk/vvvv (kuten "12/31/1999")',
  13796. email: 'Ole hyvä ja anna kelvollinen sähköpostiosoite (kuten esimerkiksi "matti@meikalainen.com").',
  13797. url: 'Ole hyvä ja anna kelvollinen URL, kuten esimerkiksi http://www.example.com.',
  13798. currencyDollar: 'Ole hyvä ja anna kelvollinen eurosumma (kuten esimerkiksi 100,00 EUR) .',
  13799. oneRequired: 'Ole hyvä ja syötä jotakin ainakin johonkin näistä kentistä.',
  13800. errorPrefix: 'Virhe: ',
  13801. warningPrefix: 'Varoitus: ',
  13802. // Form.Validator.Extras
  13803. noSpace: 'Tässä syötteessä ei voi olla välilyöntejä',
  13804. reqChkByNode: 'Ei valintoja.',
  13805. requiredChk: 'Tämä kenttä on pakollinen.',
  13806. reqChkByName: 'Ole hyvä ja valitse {label}.',
  13807. match: 'Tämän kentän tulee vastata kenttää {matchName}',
  13808. startDate: 'alkupäivämäärä',
  13809. endDate: 'loppupäivämäärä',
  13810. currentDate: 'nykyinen päivämäärä',
  13811. afterDate: 'Päivämäärän tulisi olla sama tai myöhäisempi ajankohta kuin {label}.',
  13812. beforeDate: 'Päivämäärän tulisi olla sama tai aikaisempi ajankohta kuin {label}.',
  13813. startMonth: 'Ole hyvä ja valitse aloituskuukausi',
  13814. sameMonth: 'Näiden kahden päivämäärän tulee olla saman kuun sisällä -- sinun pitää muuttaa jompaa kumpaa.',
  13815. creditcard: 'Annettu luottokortin numero ei kelpaa. Ole hyvä ja tarkista numero sekä yritä uudelleen. {length} numeroa syötetty.'
  13816. });
  13817. /*
  13818. ---
  13819. name: Locale.fi-FI.Number
  13820. description: Finnish number messages
  13821. license: MIT-style license
  13822. authors:
  13823. - ksel
  13824. requires:
  13825. - Locale
  13826. - Locale.EU.Number
  13827. provides: [Locale.fi-FI.Number]
  13828. ...
  13829. */
  13830. Locale.define('fi-FI', 'Number', {
  13831. group: ' ' // grouped by space
  13832. }).inherit('EU', 'Number');
  13833. /*
  13834. ---
  13835. name: Locale.fr-FR.Date
  13836. description: Date messages for French.
  13837. license: MIT-style license
  13838. authors:
  13839. - Nicolas Sorosac
  13840. - Antoine Abt
  13841. requires:
  13842. - Locale
  13843. provides: [Locale.fr-FR.Date]
  13844. ...
  13845. */
  13846. Locale.define('fr-FR', 'Date', {
  13847. months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
  13848. months_abbr: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
  13849. days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
  13850. days_abbr: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
  13851. // Culture's date order: DD/MM/YYYY
  13852. dateOrder: ['date', 'month', 'year'],
  13853. shortDate: '%d/%m/%Y',
  13854. shortTime: '%H:%M',
  13855. AM: 'AM',
  13856. PM: 'PM',
  13857. firstDayOfWeek: 1,
  13858. // Date.Extras
  13859. ordinal: function(dayOfMonth){
  13860. return (dayOfMonth > 1) ? '' : 'er';
  13861. },
  13862. lessThanMinuteAgo: "il y a moins d'une minute",
  13863. minuteAgo: 'il y a une minute',
  13864. minutesAgo: 'il y a {delta} minutes',
  13865. hourAgo: 'il y a une heure',
  13866. hoursAgo: 'il y a {delta} heures',
  13867. dayAgo: 'il y a un jour',
  13868. daysAgo: 'il y a {delta} jours',
  13869. weekAgo: 'il y a une semaine',
  13870. weeksAgo: 'il y a {delta} semaines',
  13871. monthAgo: 'il y a 1 mois',
  13872. monthsAgo: 'il y a {delta} mois',
  13873. yearthAgo: 'il y a 1 an',
  13874. yearsAgo: 'il y a {delta} ans',
  13875. lessThanMinuteUntil: "dans moins d'une minute",
  13876. minuteUntil: 'dans une minute',
  13877. minutesUntil: 'dans {delta} minutes',
  13878. hourUntil: 'dans une heure',
  13879. hoursUntil: 'dans {delta} heures',
  13880. dayUntil: 'dans un jour',
  13881. daysUntil: 'dans {delta} jours',
  13882. weekUntil: 'dans 1 semaine',
  13883. weeksUntil: 'dans {delta} semaines',
  13884. monthUntil: 'dans 1 mois',
  13885. monthsUntil: 'dans {delta} mois',
  13886. yearUntil: 'dans 1 an',
  13887. yearsUntil: 'dans {delta} ans'
  13888. });
  13889. /*
  13890. ---
  13891. name: Locale.fr-FR.Form.Validator
  13892. description: Form Validator messages for French.
  13893. license: MIT-style license
  13894. authors:
  13895. - Miquel Hudin
  13896. - Nicolas Sorosac
  13897. requires:
  13898. - Locale
  13899. provides: [Locale.fr-FR.Form.Validator]
  13900. ...
  13901. */
  13902. /*eslint mootools-whitespace:0*/
  13903. Locale.define('fr-FR', 'FormValidator', {
  13904. required: 'Ce champ est obligatoire.',
  13905. length: 'Veuillez saisir {length} caract&egrave;re(s) (vous avez saisi {elLength} caract&egrave;re(s)',
  13906. minLength: 'Veuillez saisir un minimum de {minLength} caract&egrave;re(s) (vous avez saisi {length} caract&egrave;re(s)).',
  13907. maxLength: 'Veuillez saisir un maximum de {maxLength} caract&egrave;re(s) (vous avez saisi {length} caract&egrave;re(s)).',
  13908. integer: 'Veuillez saisir un nombre entier dans ce champ. Les nombres d&eacute;cimaux (ex : "1,25") ne sont pas autoris&eacute;s.',
  13909. numeric: 'Veuillez saisir uniquement des chiffres dans ce champ (ex : "1" ou "1,1" ou "-1" ou "-1,1").',
  13910. digits: "Veuillez saisir uniquement des chiffres et des signes de ponctuation dans ce champ (ex : un num&eacute;ro de t&eacute;l&eacute;phone avec des traits d'union est autoris&eacute;).",
  13911. alpha: 'Veuillez saisir uniquement des lettres (a-z) dans ce champ. Les espaces ou autres caract&egrave;res ne sont pas autoris&eacute;s.',
  13912. alphanum: 'Veuillez saisir uniquement des lettres (a-z) ou des chiffres (0-9) dans ce champ. Les espaces ou autres caract&egrave;res ne sont pas autoris&eacute;s.',
  13913. dateSuchAs: 'Veuillez saisir une date correcte comme {date}',
  13914. dateInFormatMDY: 'Veuillez saisir une date correcte, au format JJ/MM/AAAA (ex : "31/11/1999").',
  13915. email: 'Veuillez saisir une adresse de courrier &eacute;lectronique. Par exemple "fred@domaine.com".',
  13916. url: 'Veuillez saisir une URL, comme http://www.exemple.com.',
  13917. currencyDollar: 'Veuillez saisir une quantit&eacute; correcte. Par exemple 100,00&euro;.',
  13918. oneRequired: 'Veuillez s&eacute;lectionner au moins une de ces options.',
  13919. errorPrefix: 'Erreur : ',
  13920. warningPrefix: 'Attention : ',
  13921. // Form.Validator.Extras
  13922. noSpace: "Ce champ n'accepte pas les espaces.",
  13923. reqChkByNode: "Aucun &eacute;l&eacute;ment n'est s&eacute;lectionn&eacute;.",
  13924. requiredChk: 'Ce champ est obligatoire.',
  13925. reqChkByName: 'Veuillez s&eacute;lectionner un(e) {label}.',
  13926. match: 'Ce champ doit correspondre avec le champ {matchName}.',
  13927. startDate: 'date de d&eacute;but',
  13928. endDate: 'date de fin',
  13929. currentDate: 'date actuelle',
  13930. afterDate: 'La date doit &ecirc;tre identique ou post&eacute;rieure &agrave; {label}.',
  13931. beforeDate: 'La date doit &ecirc;tre identique ou ant&eacute;rieure &agrave; {label}.',
  13932. startMonth: 'Veuillez s&eacute;lectionner un mois de d&eacute;but.',
  13933. sameMonth: 'Ces deux dates doivent &ecirc;tre dans le m&ecirc;me mois - vous devez en modifier une.',
  13934. creditcard: 'Le num&eacute;ro de carte de cr&eacute;dit est invalide. Merci de v&eacute;rifier le num&eacute;ro et de r&eacute;essayer. Vous avez entr&eacute; {length} chiffre(s).'
  13935. });
  13936. /*
  13937. ---
  13938. name: Locale.fr-FR.Number
  13939. description: Number messages for French.
  13940. license: MIT-style license
  13941. authors:
  13942. - Arian Stolwijk
  13943. - sv1l
  13944. requires:
  13945. - Locale
  13946. - Locale.EU.Number
  13947. provides: [Locale.fr-FR.Number]
  13948. ...
  13949. */
  13950. Locale.define('fr-FR', 'Number', {
  13951. group: ' ' // In fr-FR localization, group character is a blank space
  13952. }).inherit('EU', 'Number');
  13953. /*
  13954. ---
  13955. name: Locale.he-IL.Date
  13956. description: Date messages for Hebrew.
  13957. license: MIT-style license
  13958. authors:
  13959. - Elad Ossadon
  13960. requires:
  13961. - Locale
  13962. provides: [Locale.he-IL.Date]
  13963. ...
  13964. */
  13965. Locale.define('he-IL', 'Date', {
  13966. months: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
  13967. months_abbr: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
  13968. days: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'],
  13969. days_abbr: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'],
  13970. // Culture's date order: MM/DD/YYYY
  13971. dateOrder: ['date', 'month', 'year'],
  13972. shortDate: '%d/%m/%Y',
  13973. shortTime: '%H:%M',
  13974. AM: 'AM',
  13975. PM: 'PM',
  13976. firstDayOfWeek: 0,
  13977. // Date.Extras
  13978. ordinal: '',
  13979. lessThanMinuteAgo: 'לפני פחות מדקה',
  13980. minuteAgo: 'לפני כדקה',
  13981. minutesAgo: 'לפני {delta} דקות',
  13982. hourAgo: 'לפני כשעה',
  13983. hoursAgo: 'לפני {delta} שעות',
  13984. dayAgo: 'לפני יום',
  13985. daysAgo: 'לפני {delta} ימים',
  13986. weekAgo: 'לפני שבוע',
  13987. weeksAgo: 'לפני {delta} שבועות',
  13988. monthAgo: 'לפני חודש',
  13989. monthsAgo: 'לפני {delta} חודשים',
  13990. yearAgo: 'לפני שנה',
  13991. yearsAgo: 'לפני {delta} שנים',
  13992. lessThanMinuteUntil: 'בעוד פחות מדקה',
  13993. minuteUntil: 'בעוד כדקה',
  13994. minutesUntil: 'בעוד {delta} דקות',
  13995. hourUntil: 'בעוד כשעה',
  13996. hoursUntil: 'בעוד {delta} שעות',
  13997. dayUntil: 'בעוד יום',
  13998. daysUntil: 'בעוד {delta} ימים',
  13999. weekUntil: 'בעוד שבוע',
  14000. weeksUntil: 'בעוד {delta} שבועות',
  14001. monthUntil: 'בעוד חודש',
  14002. monthsUntil: 'בעוד {delta} חודשים',
  14003. yearUntil: 'בעוד שנה',
  14004. yearsUntil: 'בעוד {delta} שנים'
  14005. });
  14006. /*
  14007. ---
  14008. name: Locale.he-IL.Form.Validator
  14009. description: Form Validator messages for Hebrew.
  14010. license: MIT-style license
  14011. authors:
  14012. - Elad Ossadon
  14013. requires:
  14014. - Locale
  14015. provides: [Locale.he-IL.Form.Validator]
  14016. ...
  14017. */
  14018. Locale.define('he-IL', 'FormValidator', {
  14019. required: 'נא למלא שדה זה.',
  14020. minLength: 'נא להזין לפחות {minLength} תווים (הזנת {length} תווים).',
  14021. maxLength: 'נא להזין עד {maxLength} תווים (הזנת {length} תווים).',
  14022. integer: 'נא להזין מספר שלם לשדה זה. מספרים עשרוניים (כמו 1.25) אינם חוקיים.',
  14023. numeric: 'נא להזין ערך מספרי בלבד בשדה זה (כמו "1", "1.1", "-1" או "-1.1").',
  14024. digits: 'נא להזין רק ספרות וסימני הפרדה בשדה זה (למשל, מספר טלפון עם מקפים או נקודות הוא חוקי).',
  14025. alpha: 'נא להזין רק אותיות באנגלית (a-z) בשדה זה. רווחים או תווים אחרים אינם חוקיים.',
  14026. alphanum: 'נא להזין רק אותריות באנגלית (a-z) או ספרות (0-9) בשדה זה. אווחרים או תווים אחרים אינם חוקיים.',
  14027. dateSuchAs: 'נא להזין תאריך חוקי, כמו {date}',
  14028. dateInFormatMDY: 'נא להזין תאריך חוקי בפורמט MM/DD/YYYY (כמו "12/31/1999")',
  14029. email: 'נא להזין כתובת אימייל חוקית. לדוגמה: "fred@domain.com".',
  14030. url: 'נא להזין כתובת אתר חוקית, כמו http://www.example.com.',
  14031. currencyDollar: 'נא להזין סכום דולרי חוקי. לדוגמה $100.00.',
  14032. oneRequired: 'נא לבחור לפחות בשדה אחד.',
  14033. errorPrefix: 'שגיאה: ',
  14034. warningPrefix: 'אזהרה: ',
  14035. // Form.Validator.Extras
  14036. noSpace: 'אין להזין רווחים בשדה זה.',
  14037. reqChkByNode: 'נא לבחור אחת מהאפשרויות.',
  14038. requiredChk: 'שדה זה נדרש.',
  14039. reqChkByName: 'נא לבחור {label}.',
  14040. match: 'שדה זה צריך להתאים לשדה {matchName}',
  14041. startDate: 'תאריך ההתחלה',
  14042. endDate: 'תאריך הסיום',
  14043. currentDate: 'התאריך הנוכחי',
  14044. afterDate: 'התאריך צריך להיות זהה או אחרי {label}.',
  14045. beforeDate: 'התאריך צריך להיות זהה או לפני {label}.',
  14046. startMonth: 'נא לבחור חודש התחלה',
  14047. sameMonth: 'שני תאריכים אלה צריכים להיות באותו חודש - נא לשנות אחד התאריכים.',
  14048. creditcard: 'מספר כרטיס האשראי שהוזן אינו חוקי. נא לבדוק שנית. הוזנו {length} ספרות.'
  14049. });
  14050. /*
  14051. ---
  14052. name: Locale.he-IL.Number
  14053. description: Number messages for Hebrew.
  14054. license: MIT-style license
  14055. authors:
  14056. - Elad Ossadon
  14057. requires:
  14058. - Locale
  14059. provides: [Locale.he-IL.Number]
  14060. ...
  14061. */
  14062. Locale.define('he-IL', 'Number', {
  14063. decimal: '.',
  14064. group: ',',
  14065. currency: {
  14066. suffix: ' ₪'
  14067. }
  14068. });
  14069. /*
  14070. ---
  14071. name: Locale.hu-HU.Date
  14072. description: Date messages for Hungarian.
  14073. license: MIT-style license
  14074. authors:
  14075. - Zsolt Szegheő
  14076. requires:
  14077. - Locale
  14078. provides: [Locale.hu-HU.Date]
  14079. ...
  14080. */
  14081. Locale.define('hu-HU', 'Date', {
  14082. months: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június', 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],
  14083. months_abbr: ['jan.', 'febr.', 'márc.', 'ápr.', 'máj.', 'jún.', 'júl.', 'aug.', 'szept.', 'okt.', 'nov.', 'dec.'],
  14084. days: ['Vasárnap', 'Hétfő', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
  14085. days_abbr: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
  14086. // Culture's date order: YYYY.MM.DD.
  14087. dateOrder: ['year', 'month', 'date'],
  14088. shortDate: '%Y.%m.%d.',
  14089. shortTime: '%I:%M',
  14090. AM: 'de.',
  14091. PM: 'du.',
  14092. firstDayOfWeek: 1,
  14093. // Date.Extras
  14094. ordinal: '.',
  14095. lessThanMinuteAgo: 'alig egy perce',
  14096. minuteAgo: 'egy perce',
  14097. minutesAgo: '{delta} perce',
  14098. hourAgo: 'egy órája',
  14099. hoursAgo: '{delta} órája',
  14100. dayAgo: '1 napja',
  14101. daysAgo: '{delta} napja',
  14102. weekAgo: '1 hete',
  14103. weeksAgo: '{delta} hete',
  14104. monthAgo: '1 hónapja',
  14105. monthsAgo: '{delta} hónapja',
  14106. yearAgo: '1 éve',
  14107. yearsAgo: '{delta} éve',
  14108. lessThanMinuteUntil: 'alig egy perc múlva',
  14109. minuteUntil: 'egy perc múlva',
  14110. minutesUntil: '{delta} perc múlva',
  14111. hourUntil: 'egy óra múlva',
  14112. hoursUntil: '{delta} óra múlva',
  14113. dayUntil: '1 nap múlva',
  14114. daysUntil: '{delta} nap múlva',
  14115. weekUntil: '1 hét múlva',
  14116. weeksUntil: '{delta} hét múlva',
  14117. monthUntil: '1 hónap múlva',
  14118. monthsUntil: '{delta} hónap múlva',
  14119. yearUntil: '1 év múlva',
  14120. yearsUntil: '{delta} év múlva'
  14121. });
  14122. /*
  14123. ---
  14124. name: Locale.hu-HU.Form.Validator
  14125. description: Form Validator messages for Hungarian.
  14126. license: MIT-style license
  14127. authors:
  14128. - Zsolt Szegheő
  14129. requires:
  14130. - Locale
  14131. provides: [Locale.hu-HU.Form.Validator]
  14132. ...
  14133. */
  14134. /*eslint mootools-whitespace:0*/
  14135. Locale.define('hu-HU', 'FormValidator', {
  14136. required: 'A mező kitöltése kötelező.',
  14137. minLength: 'Legalább {minLength} karakter megadása szükséges (megadva {length} karakter).',
  14138. maxLength: 'Legfeljebb {maxLength} karakter megadása lehetséges (megadva {length} karakter).',
  14139. integer: 'Egész szám megadása szükséges. A tizedesjegyek (pl. 1.25) nem engedélyezettek.',
  14140. numeric: 'Szám megadása szükséges (pl. "1" vagy "1.1" vagy "-1" vagy "-1.1").',
  14141. digits: 'Csak számok és írásjelek megadása lehetséges (pl. telefonszám kötőjelek és/vagy perjelekkel).',
  14142. alpha: 'Csak betűk (a-z) megadása lehetséges. Szóköz és egyéb karakterek nem engedélyezettek.',
  14143. alphanum: 'Csak betűk (a-z) vagy számok (0-9) megadása lehetséges. Szóköz és egyéb karakterek nem engedélyezettek.',
  14144. dateSuchAs: 'Valós dátum megadása szükséges (pl. {date}).',
  14145. dateInFormatMDY: 'Valós dátum megadása szükséges ÉÉÉÉ.HH.NN. formában. (pl. "1999.12.31.")',
  14146. email: 'Valós e-mail cím megadása szükséges (pl. "fred@domain.hu").',
  14147. url: 'Valós URL megadása szükséges (pl. http://www.example.com).',
  14148. currencyDollar: 'Valós pénzösszeg megadása szükséges (pl. 100.00 Ft.).',
  14149. oneRequired: 'Az alábbi mezők legalább egyikének kitöltése kötelező.',
  14150. errorPrefix: 'Hiba: ',
  14151. warningPrefix: 'Figyelem: ',
  14152. // Form.Validator.Extras
  14153. noSpace: 'A mező nem tartalmazhat szóközöket.',
  14154. reqChkByNode: 'Nincs egyetlen kijelölt elem sem.',
  14155. requiredChk: 'A mező kitöltése kötelező.',
  14156. reqChkByName: 'Egy {label} kiválasztása szükséges.',
  14157. match: 'A mezőnek egyeznie kell a(z) {matchName} mezővel.',
  14158. startDate: 'a kezdet dátuma',
  14159. endDate: 'a vég dátuma',
  14160. currentDate: 'jelenlegi dátum',
  14161. afterDate: 'A dátum nem lehet kisebb, mint {label}.',
  14162. beforeDate: 'A dátum nem lehet nagyobb, mint {label}.',
  14163. startMonth: 'Kezdeti hónap megadása szükséges.',
  14164. sameMonth: 'A két dátumnak ugyanazon hónapban kell lennie.',
  14165. creditcard: 'A megadott bankkártyaszám nem valódi (megadva {length} számjegy).'
  14166. });
  14167. /*
  14168. ---
  14169. name: Locale.it-IT.Date
  14170. description: Date messages for Italian.
  14171. license: MIT-style license.
  14172. authors:
  14173. - Andrea Novero
  14174. - Valerio Proietti
  14175. requires:
  14176. - Locale
  14177. provides: [Locale.it-IT.Date]
  14178. ...
  14179. */
  14180. Locale.define('it-IT', 'Date', {
  14181. months: ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'],
  14182. months_abbr: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
  14183. days: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
  14184. days_abbr: ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'],
  14185. // Culture's date order: DD/MM/YYYY
  14186. dateOrder: ['date', 'month', 'year'],
  14187. shortDate: '%d/%m/%Y',
  14188. shortTime: '%H.%M',
  14189. AM: 'AM',
  14190. PM: 'PM',
  14191. firstDayOfWeek: 1,
  14192. // Date.Extras
  14193. ordinal: 'º',
  14194. lessThanMinuteAgo: 'meno di un minuto fa',
  14195. minuteAgo: 'circa un minuto fa',
  14196. minutesAgo: 'circa {delta} minuti fa',
  14197. hourAgo: "circa un'ora fa",
  14198. hoursAgo: 'circa {delta} ore fa',
  14199. dayAgo: 'circa 1 giorno fa',
  14200. daysAgo: 'circa {delta} giorni fa',
  14201. weekAgo: 'una settimana fa',
  14202. weeksAgo: '{delta} settimane fa',
  14203. monthAgo: 'un mese fa',
  14204. monthsAgo: '{delta} mesi fa',
  14205. yearAgo: 'un anno fa',
  14206. yearsAgo: '{delta} anni fa',
  14207. lessThanMinuteUntil: 'tra meno di un minuto',
  14208. minuteUntil: 'tra circa un minuto',
  14209. minutesUntil: 'tra circa {delta} minuti',
  14210. hourUntil: "tra circa un'ora",
  14211. hoursUntil: 'tra circa {delta} ore',
  14212. dayUntil: 'tra circa un giorno',
  14213. daysUntil: 'tra circa {delta} giorni',
  14214. weekUntil: 'tra una settimana',
  14215. weeksUntil: 'tra {delta} settimane',
  14216. monthUntil: 'tra un mese',
  14217. monthsUntil: 'tra {delta} mesi',
  14218. yearUntil: 'tra un anno',
  14219. yearsUntil: 'tra {delta} anni'
  14220. });
  14221. /*
  14222. ---
  14223. name: Locale.it-IT.Form.Validator
  14224. description: Form Validator messages for Italian.
  14225. license: MIT-style license
  14226. authors:
  14227. - Leonardo Laureti
  14228. - Andrea Novero
  14229. requires:
  14230. - Locale
  14231. provides: [Locale.it-IT.Form.Validator]
  14232. ...
  14233. */
  14234. /*eslint mootools-whitespace:0*/
  14235. Locale.define('it-IT', 'FormValidator', {
  14236. required: 'Il campo &egrave; obbligatorio.',
  14237. minLength: 'Inserire almeno {minLength} caratteri (ne sono stati inseriti {length}).',
  14238. maxLength: 'Inserire al massimo {maxLength} caratteri (ne sono stati inseriti {length}).',
  14239. integer: 'Inserire un numero intero. Non sono consentiti decimali (es.: 1.25).',
  14240. numeric: 'Inserire solo valori numerici (es.: "1" oppure "1.1" oppure "-1" oppure "-1.1").',
  14241. digits: 'Inserire solo numeri e caratteri di punteggiatura. Per esempio &egrave; consentito un numero telefonico con trattini o punti.',
  14242. alpha: 'Inserire solo lettere (a-z). Non sono consentiti spazi o altri caratteri.',
  14243. alphanum: 'Inserire solo lettere (a-z) o numeri (0-9). Non sono consentiti spazi o altri caratteri.',
  14244. dateSuchAs: 'Inserire una data valida del tipo {date}',
  14245. dateInFormatMDY: 'Inserire una data valida nel formato MM/GG/AAAA (es.: "12/31/1999")',
  14246. email: 'Inserire un indirizzo email valido. Per esempio "nome@dominio.com".',
  14247. url: 'Inserire un indirizzo valido. Per esempio "http://www.example.com".',
  14248. currencyDollar: 'Inserire un importo valido. Per esempio "$100.00".',
  14249. oneRequired: 'Completare almeno uno dei campi richiesti.',
  14250. errorPrefix: 'Errore: ',
  14251. warningPrefix: 'Attenzione: ',
  14252. // Form.Validator.Extras
  14253. noSpace: 'Non sono consentiti spazi.',
  14254. reqChkByNode: 'Nessuna voce selezionata.',
  14255. requiredChk: 'Il campo &egrave; obbligatorio.',
  14256. reqChkByName: 'Selezionare un(a) {label}.',
  14257. match: 'Il valore deve corrispondere al campo {matchName}',
  14258. startDate: "data d'inizio",
  14259. endDate: 'data di fine',
  14260. currentDate: 'data attuale',
  14261. afterDate: 'La data deve corrispondere o essere successiva al {label}.',
  14262. beforeDate: 'La data deve corrispondere o essere precedente al {label}.',
  14263. startMonth: "Selezionare un mese d'inizio",
  14264. sameMonth: 'Le due date devono essere dello stesso mese - occorre modificarne una.'
  14265. });
  14266. /*
  14267. ---
  14268. name: Locale.ja-JP.Date
  14269. description: Date messages for Japanese.
  14270. license: MIT-style license
  14271. authors:
  14272. - Noritaka Horio
  14273. requires:
  14274. - Locale
  14275. provides: [Locale.ja-JP.Date]
  14276. ...
  14277. */
  14278. Locale.define('ja-JP', 'Date', {
  14279. months: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  14280. months_abbr: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  14281. days: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
  14282. days_abbr: ['日', '月', '火', '水', '木', '金', '土'],
  14283. // Culture's date order: YYYY/MM/DD
  14284. dateOrder: ['year', 'month', 'date'],
  14285. shortDate: '%Y/%m/%d',
  14286. shortTime: '%H:%M',
  14287. AM: '午前',
  14288. PM: '午後',
  14289. firstDayOfWeek: 0,
  14290. // Date.Extras
  14291. ordinal: '',
  14292. lessThanMinuteAgo: '1分以内前',
  14293. minuteAgo: '約1分前',
  14294. minutesAgo: '約{delta}分前',
  14295. hourAgo: '約1時間前',
  14296. hoursAgo: '約{delta}時間前',
  14297. dayAgo: '1日前',
  14298. daysAgo: '{delta}日前',
  14299. weekAgo: '1週間前',
  14300. weeksAgo: '{delta}週間前',
  14301. monthAgo: '1ヶ月前',
  14302. monthsAgo: '{delta}ヶ月前',
  14303. yearAgo: '1年前',
  14304. yearsAgo: '{delta}年前',
  14305. lessThanMinuteUntil: '今から約1分以内',
  14306. minuteUntil: '今から約1分',
  14307. minutesUntil: '今から約{delta}分',
  14308. hourUntil: '今から約1時間',
  14309. hoursUntil: '今から約{delta}時間',
  14310. dayUntil: '今から1日間',
  14311. daysUntil: '今から{delta}日間',
  14312. weekUntil: '今から1週間',
  14313. weeksUntil: '今から{delta}週間',
  14314. monthUntil: '今から1ヶ月',
  14315. monthsUntil: '今から{delta}ヶ月',
  14316. yearUntil: '今から1年',
  14317. yearsUntil: '今から{delta}年'
  14318. });
  14319. /*
  14320. ---
  14321. name: Locale.ja-JP.Form.Validator
  14322. description: Form Validator messages for Japanese.
  14323. license: MIT-style license
  14324. authors:
  14325. - Noritaka Horio
  14326. requires:
  14327. - Locale
  14328. provides: [Locale.ja-JP.Form.Validator]
  14329. ...
  14330. */
  14331. Locale.define('ja-JP', 'FormValidator', {
  14332. required: '入力は必須です。',
  14333. minLength: '入力文字数は{minLength}以上にしてください。({length}文字)',
  14334. maxLength: '入力文字数は{maxLength}以下にしてください。({length}文字)',
  14335. integer: '整数を入力してください。',
  14336. numeric: '入力できるのは数値だけです。(例: "1", "1.1", "-1", "-1.1"....)',
  14337. digits: '入力できるのは数値と句読記号です。 (例: -や+を含む電話番号など).',
  14338. alpha: '入力できるのは半角英字だけです。それ以外の文字は入力できません。',
  14339. alphanum: '入力できるのは半角英数字だけです。それ以外の文字は入力できません。',
  14340. dateSuchAs: '有効な日付を入力してください。{date}',
  14341. dateInFormatMDY: '日付の書式に誤りがあります。YYYY/MM/DD (i.e. "1999/12/31")',
  14342. email: 'メールアドレスに誤りがあります。',
  14343. url: 'URLアドレスに誤りがあります。',
  14344. currencyDollar: '金額に誤りがあります。',
  14345. oneRequired: 'ひとつ以上入力してください。',
  14346. errorPrefix: 'エラー: ',
  14347. warningPrefix: '警告: ',
  14348. // FormValidator.Extras
  14349. noSpace: 'スペースは入力できません。',
  14350. reqChkByNode: '選択されていません。',
  14351. requiredChk: 'この項目は必須です。',
  14352. reqChkByName: '{label}を選択してください。',
  14353. match: '{matchName}が入力されている場合必須です。',
  14354. startDate: '開始日',
  14355. endDate: '終了日',
  14356. currentDate: '今日',
  14357. afterDate: '{label}以降の日付にしてください。',
  14358. beforeDate: '{label}以前の日付にしてください。',
  14359. startMonth: '開始月を選択してください。',
  14360. sameMonth: '日付が同一です。どちらかを変更してください。'
  14361. });
  14362. /*
  14363. ---
  14364. name: Locale.ja-JP.Number
  14365. description: Number messages for Japanese.
  14366. license: MIT-style license
  14367. authors:
  14368. - Noritaka Horio
  14369. requires:
  14370. - Locale
  14371. provides: [Locale.ja-JP.Number]
  14372. ...
  14373. */
  14374. Locale.define('ja-JP', 'Number', {
  14375. decimal: '.',
  14376. group: ',',
  14377. currency: {
  14378. decimals: 0,
  14379. prefix: '\\'
  14380. }
  14381. });
  14382. /*
  14383. ---
  14384. name: Locale.nl-NL.Date
  14385. description: Date messages for Dutch.
  14386. license: MIT-style license
  14387. authors:
  14388. - Lennart Pilon
  14389. - Tim Wienk
  14390. requires:
  14391. - Locale
  14392. provides: [Locale.nl-NL.Date]
  14393. ...
  14394. */
  14395. Locale.define('nl-NL', 'Date', {
  14396. months: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
  14397. months_abbr: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
  14398. days: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
  14399. days_abbr: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
  14400. // Culture's date order: DD-MM-YYYY
  14401. dateOrder: ['date', 'month', 'year'],
  14402. shortDate: '%d-%m-%Y',
  14403. shortTime: '%H:%M',
  14404. AM: 'AM',
  14405. PM: 'PM',
  14406. firstDayOfWeek: 1,
  14407. // Date.Extras
  14408. ordinal: 'e',
  14409. lessThanMinuteAgo: 'minder dan een minuut geleden',
  14410. minuteAgo: 'ongeveer een minuut geleden',
  14411. minutesAgo: '{delta} minuten geleden',
  14412. hourAgo: 'ongeveer een uur geleden',
  14413. hoursAgo: 'ongeveer {delta} uur geleden',
  14414. dayAgo: 'een dag geleden',
  14415. daysAgo: '{delta} dagen geleden',
  14416. weekAgo: 'een week geleden',
  14417. weeksAgo: '{delta} weken geleden',
  14418. monthAgo: 'een maand geleden',
  14419. monthsAgo: '{delta} maanden geleden',
  14420. yearAgo: 'een jaar geleden',
  14421. yearsAgo: '{delta} jaar geleden',
  14422. lessThanMinuteUntil: 'over minder dan een minuut',
  14423. minuteUntil: 'over ongeveer een minuut',
  14424. minutesUntil: 'over {delta} minuten',
  14425. hourUntil: 'over ongeveer een uur',
  14426. hoursUntil: 'over {delta} uur',
  14427. dayUntil: 'over ongeveer een dag',
  14428. daysUntil: 'over {delta} dagen',
  14429. weekUntil: 'over een week',
  14430. weeksUntil: 'over {delta} weken',
  14431. monthUntil: 'over een maand',
  14432. monthsUntil: 'over {delta} maanden',
  14433. yearUntil: 'over een jaar',
  14434. yearsUntil: 'over {delta} jaar'
  14435. });
  14436. /*
  14437. ---
  14438. name: Locale.nl-NL.Form.Validator
  14439. description: Form Validator messages for Dutch.
  14440. license: MIT-style license
  14441. authors:
  14442. - Lennart Pilon
  14443. - Arian Stolwijk
  14444. - Tim Wienk
  14445. requires:
  14446. - Locale
  14447. provides: [Locale.nl-NL.Form.Validator]
  14448. ...
  14449. */
  14450. Locale.define('nl-NL', 'FormValidator', {
  14451. required: 'Dit veld is verplicht.',
  14452. length: 'Vul precies {length} karakters in (je hebt {elLength} karakters ingevoerd).',
  14453. minLength: 'Vul minimaal {minLength} karakters in (je hebt {length} karakters ingevoerd).',
  14454. maxLength: 'Vul niet meer dan {maxLength} karakters in (je hebt {length} karakters ingevoerd).',
  14455. integer: 'Vul een getal in. Getallen met decimalen (bijvoorbeeld 1.25) zijn niet toegestaan.',
  14456. numeric: 'Vul alleen numerieke waarden in (bijvoorbeeld "1" of "1.1" of "-1" of "-1.1").',
  14457. digits: 'Vul alleen nummers en leestekens in (bijvoorbeeld een telefoonnummer met streepjes is toegestaan).',
  14458. alpha: 'Vul alleen letters in (a-z). Spaties en andere karakters zijn niet toegestaan.',
  14459. alphanum: 'Vul alleen letters (a-z) of nummers (0-9) in. Spaties en andere karakters zijn niet toegestaan.',
  14460. dateSuchAs: 'Vul een geldige datum in, zoals {date}',
  14461. dateInFormatMDY: 'Vul een geldige datum, in het formaat MM/DD/YYYY (bijvoorbeeld "12/31/1999")',
  14462. email: 'Vul een geldig e-mailadres in. Bijvoorbeeld "fred@domein.nl".',
  14463. url: 'Vul een geldige URL in, zoals http://www.example.com.',
  14464. currencyDollar: 'Vul een geldig $ bedrag in. Bijvoorbeeld $100.00 .',
  14465. oneRequired: 'Vul iets in bij in ieder geval een van deze velden.',
  14466. warningPrefix: 'Waarschuwing: ',
  14467. errorPrefix: 'Fout: ',
  14468. // Form.Validator.Extras
  14469. noSpace: 'Spaties zijn niet toegestaan in dit veld.',
  14470. reqChkByNode: 'Er zijn geen items geselecteerd.',
  14471. requiredChk: 'Dit veld is verplicht.',
  14472. reqChkByName: 'Selecteer een {label}.',
  14473. match: 'Dit veld moet overeen komen met het {matchName} veld',
  14474. startDate: 'de begin datum',
  14475. endDate: 'de eind datum',
  14476. currentDate: 'de huidige datum',
  14477. afterDate: 'De datum moet hetzelfde of na {label} zijn.',
  14478. beforeDate: 'De datum moet hetzelfde of voor {label} zijn.',
  14479. startMonth: 'Selecteer een begin maand',
  14480. sameMonth: 'Deze twee data moeten in dezelfde maand zijn - u moet een van beide aanpassen.',
  14481. creditcard: 'Het ingevulde creditcardnummer is niet geldig. Controleer het nummer en probeer opnieuw. {length} getallen ingevuld.'
  14482. });
  14483. /*
  14484. ---
  14485. name: Locale.nl-NL.Number
  14486. description: Number messages for Dutch.
  14487. license: MIT-style license
  14488. authors:
  14489. - Arian Stolwijk
  14490. requires:
  14491. - Locale
  14492. - Locale.EU.Number
  14493. provides: [Locale.nl-NL.Number]
  14494. ...
  14495. */
  14496. Locale.define('nl-NL').inherit('EU', 'Number');
  14497. /*
  14498. ---
  14499. name: Locale.no-NO.Date
  14500. description: Date messages for Norwegian.
  14501. license: MIT-style license
  14502. authors:
  14503. - Espen 'Rexxars' Hovlandsdal
  14504. - Ole Tøsse Kolvik
  14505. requires:
  14506. - Locale
  14507. provides: [Locale.no-NO.Date]
  14508. ...
  14509. */
  14510. Locale.define('no-NO', 'Date', {
  14511. months: ['Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'],
  14512. months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
  14513. days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
  14514. days_abbr: ['Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'],
  14515. // Culture's date order: DD.MM.YYYY
  14516. dateOrder: ['date', 'month', 'year'],
  14517. shortDate: '%d.%m.%Y',
  14518. shortTime: '%H:%M',
  14519. AM: 'AM',
  14520. PM: 'PM',
  14521. firstDayOfWeek: 1,
  14522. lessThanMinuteAgo: 'mindre enn et minutt siden',
  14523. minuteAgo: 'omtrent et minutt siden',
  14524. minutesAgo: '{delta} minutter siden',
  14525. hourAgo: 'omtrent en time siden',
  14526. hoursAgo: 'omtrent {delta} timer siden',
  14527. dayAgo: '{delta} dag siden',
  14528. daysAgo: '{delta} dager siden',
  14529. weekAgo: 'en uke siden',
  14530. weeksAgo: '{delta} uker siden',
  14531. monthAgo: 'en måned siden',
  14532. monthsAgo: '{delta} måneder siden',
  14533. yearAgo: 'ett år siden',
  14534. yearsAgo: '{delta} år siden',
  14535. lessThanMinuteUntil: 'mindre enn et minutt til',
  14536. minuteUntil: 'omtrent et minutt til',
  14537. minutesUntil: '{delta} minutter til',
  14538. hourUntil: 'omtrent en time til',
  14539. hoursUntil: 'omtrent {delta} timer til',
  14540. dayUntil: 'en dag til',
  14541. daysUntil: '{delta} dager til',
  14542. weekUntil: 'en uke til',
  14543. weeksUntil: '{delta} uker til',
  14544. monthUntil: 'en måned til',
  14545. monthsUntil: '{delta} måneder til',
  14546. yearUntil: 'et år til',
  14547. yearsUntil: '{delta} år til'
  14548. });
  14549. /*
  14550. ---
  14551. name: Locale.no-NO.Form.Validator
  14552. description: Form Validator messages for Norwegian.
  14553. license: MIT-style license
  14554. authors:
  14555. - Aaron Newton
  14556. - Espen 'Rexxars' Hovlandsdal
  14557. - Ole Tøsse Kolvik
  14558. requires:
  14559. - Locale
  14560. provides: [Locale.no-NO.Form.Validator]
  14561. ...
  14562. */
  14563. Locale.define('no-NO', 'FormValidator', {
  14564. required: 'Dette feltet er påkrevd.',
  14565. length: 'Skriv inn {length} tegn (du skrev {elLength} tegn)',
  14566. minLength: 'Skriv inn minst {minLength} tegn (du skrev {length} tegn).',
  14567. maxLength: 'Ikke skriv mer enn {maxLength} tegn (du skrev {length} tegn).',
  14568. integer: 'Skriv inn et tall i dette feltet. Tall med desimaler (f.eks. 1,25) er ikke tillat.',
  14569. numeric: 'Skriv kun inn numeriske verdier i dette feltet (f.eks. "1", "1.1", "-1" eller "-1.1").',
  14570. digits: 'Skriv kun nummer og skilletegn i dette feltet.',
  14571. alpha: 'Skriv kun bokstaver (a-å) i dette feltet. Ingen mellomrom eller andre tegn er tillat.',
  14572. alphanum: 'Skriv kun bokstaver (a-å) eller nummer (0-9) i dette feltet. Ingen mellomrom eller andre tegn er tillat.',
  14573. dateSuchAs: 'Skriv inn en gyldig dato, som f.eks. {date}',
  14574. dateInFormatMDY: 'Skriv inn en gyldig dato, f.eks. DD/MM/YYYY ("31/12/1999")',
  14575. email: 'Skriv inn en gyldig epost-adresse. F.eks. "ola.nordmann@example.com".',
  14576. url: 'Skriv inn en gyldig URL, f.eks. http://www.example.com.',
  14577. currencyDollar: 'Skriv inn et gyldig beløp. F.eks. 100,00.',
  14578. oneRequired: 'Minst ett av disse feltene må fylles ut.',
  14579. errorPrefix: 'Feil: ',
  14580. warningPrefix: 'Advarsel: ',
  14581. // Form.Validator.Extras
  14582. noSpace: 'Mellomrom er ikke tillatt i dette feltet.',
  14583. reqChkByNode: 'Ingen objekter er valgt.',
  14584. requiredChk: 'Dette feltet er påkrevd.',
  14585. reqChkByName: 'Velg en {label}.',
  14586. match: 'Dette feltet må være lik {matchName}',
  14587. startDate: 'startdato',
  14588. endDate: 'sluttdato',
  14589. currentDate: 'dagens dato',
  14590. afterDate: 'Datoen må være den samme som eller etter {label}.',
  14591. beforeDate: 'Datoen må være den samme som eller før {label}.',
  14592. startMonth: 'Velg en startmåned',
  14593. sameMonth: 'Datoene må være i den samme måneden - velg den ene eller den andre.',
  14594. creditcard: 'Kortnummeret du skrev inn er ikke gyldig. Prøv igjen. Du skrev {length} siffer.'
  14595. });
  14596. /*
  14597. ---
  14598. name: Locale.no-NO.Number
  14599. description: Number messages for Norwegian.
  14600. license: MIT-style license
  14601. authors:
  14602. - Arian Stolwijk
  14603. - Martin Lundgren
  14604. - Ole T�sse Kolvik
  14605. requires:
  14606. - Locale
  14607. - Locale.EU.Number
  14608. provides: [Locale.no-NO.Number]
  14609. ...
  14610. */
  14611. Locale.define('no-NO', 'Number', {
  14612. currency: {
  14613. prefix: 'NOK '
  14614. }
  14615. }).inherit('EU', 'Number');
  14616. /*
  14617. ---
  14618. name: Locale.pl-PL.Date
  14619. description: Date messages for Polish.
  14620. license: MIT-style license
  14621. authors:
  14622. - Oskar Krawczyk
  14623. requires:
  14624. - Locale
  14625. provides: [Locale.pl-PL.Date]
  14626. ...
  14627. */
  14628. Locale.define('pl-PL', 'Date', {
  14629. months: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'],
  14630. months_abbr: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
  14631. days: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],
  14632. days_abbr: ['niedz.', 'pon.', 'wt.', 'śr.', 'czw.', 'pt.', 'sob.'],
  14633. // Culture's date order: YYYY-MM-DD
  14634. dateOrder: ['year', 'month', 'date'],
  14635. shortDate: '%Y-%m-%d',
  14636. shortTime: '%H:%M',
  14637. AM: 'nad ranem',
  14638. PM: 'po południu',
  14639. firstDayOfWeek: 1,
  14640. // Date.Extras
  14641. ordinal: function(dayOfMonth){
  14642. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ty' : ['ty', 'szy', 'gi', 'ci', 'ty'][Math.min(dayOfMonth % 10, 4)];
  14643. },
  14644. lessThanMinuteAgo: 'mniej niż minute temu',
  14645. minuteAgo: 'około minutę temu',
  14646. minutesAgo: '{delta} minut temu',
  14647. hourAgo: 'około godzinę temu',
  14648. hoursAgo: 'około {delta} godzin temu',
  14649. dayAgo: 'Wczoraj',
  14650. daysAgo: '{delta} dni temu',
  14651. lessThanMinuteUntil: 'za niecałą minutę',
  14652. minuteUntil: 'za około minutę',
  14653. minutesUntil: 'za {delta} minut',
  14654. hourUntil: 'za około godzinę',
  14655. hoursUntil: 'za około {delta} godzin',
  14656. dayUntil: 'za 1 dzień',
  14657. daysUntil: 'za {delta} dni'
  14658. });
  14659. /*
  14660. ---
  14661. name: Locale.pl-PL.Form.Validator
  14662. description: Form Validator messages for Polish.
  14663. license: MIT-style license
  14664. authors:
  14665. - Oskar Krawczyk
  14666. requires:
  14667. - Locale
  14668. provides: [Locale.pl-PL.Form.Validator]
  14669. ...
  14670. */
  14671. Locale.define('pl-PL', 'FormValidator', {
  14672. required: 'To pole jest wymagane.',
  14673. minLength: 'Wymagane jest przynajmniej {minLength} znaków (wpisanych zostało tylko {length}).',
  14674. maxLength: 'Dozwolone jest nie więcej niż {maxLength} znaków (wpisanych zostało {length})',
  14675. integer: 'To pole wymaga liczb całych. Liczby dziesiętne (np. 1.25) są niedozwolone.',
  14676. numeric: 'Prosimy używać tylko numerycznych wartości w tym polu (np. "1", "1.1", "-1" lub "-1.1").',
  14677. digits: 'Prosimy używać liczb oraz zankow punktuacyjnych w typ polu (dla przykładu, przy numerze telefonu myślniki i kropki są dozwolone).',
  14678. alpha: 'Prosimy używać tylko liter (a-z) w tym polu. Spacje oraz inne znaki są niedozwolone.',
  14679. alphanum: 'Prosimy używać tylko liter (a-z) lub liczb (0-9) w tym polu. Spacje oraz inne znaki są niedozwolone.',
  14680. dateSuchAs: 'Prosimy podać prawidłową datę w formacie: {date}',
  14681. dateInFormatMDY: 'Prosimy podać poprawną date w formacie DD.MM.RRRR (i.e. "12.01.2009")',
  14682. email: 'Prosimy podać prawidłowy adres e-mail, np. "jan@domena.pl".',
  14683. url: 'Prosimy podać prawidłowy adres URL, np. http://www.example.com.',
  14684. currencyDollar: 'Prosimy podać prawidłową sumę w PLN. Dla przykładu: 100.00 PLN.',
  14685. oneRequired: 'Prosimy wypełnić chociaż jedno z pól.',
  14686. errorPrefix: 'Błąd: ',
  14687. warningPrefix: 'Uwaga: ',
  14688. // Form.Validator.Extras
  14689. noSpace: 'W tym polu nie mogą znajdować się spacje.',
  14690. reqChkByNode: 'Brak zaznaczonych elementów.',
  14691. requiredChk: 'To pole jest wymagane.',
  14692. reqChkByName: 'Prosimy wybrać z {label}.',
  14693. match: 'To pole musi być takie samo jak {matchName}',
  14694. startDate: 'data początkowa',
  14695. endDate: 'data końcowa',
  14696. currentDate: 'aktualna data',
  14697. afterDate: 'Podana data poinna być taka sama lub po {label}.',
  14698. beforeDate: 'Podana data poinna być taka sama lub przed {label}.',
  14699. startMonth: 'Prosimy wybrać początkowy miesiąc.',
  14700. sameMonth: 'Te dwie daty muszą być w zakresie tego samego miesiąca - wymagana jest zmiana któregoś z pól.'
  14701. });
  14702. /*
  14703. ---
  14704. name: Locale.pt-PT.Date
  14705. description: Date messages for Portuguese.
  14706. license: MIT-style license
  14707. authors:
  14708. - Fabio Miranda Costa
  14709. requires:
  14710. - Locale
  14711. provides: [Locale.pt-PT.Date]
  14712. ...
  14713. */
  14714. Locale.define('pt-PT', 'Date', {
  14715. months: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
  14716. months_abbr: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
  14717. days: ['Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'],
  14718. days_abbr: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
  14719. // Culture's date order: DD-MM-YYYY
  14720. dateOrder: ['date', 'month', 'year'],
  14721. shortDate: '%d-%m-%Y',
  14722. shortTime: '%H:%M',
  14723. AM: 'AM',
  14724. PM: 'PM',
  14725. firstDayOfWeek: 1,
  14726. // Date.Extras
  14727. ordinal: 'º',
  14728. lessThanMinuteAgo: 'há menos de um minuto',
  14729. minuteAgo: 'há cerca de um minuto',
  14730. minutesAgo: 'há {delta} minutos',
  14731. hourAgo: 'há cerca de uma hora',
  14732. hoursAgo: 'há cerca de {delta} horas',
  14733. dayAgo: 'há um dia',
  14734. daysAgo: 'há {delta} dias',
  14735. weekAgo: 'há uma semana',
  14736. weeksAgo: 'há {delta} semanas',
  14737. monthAgo: 'há um mês',
  14738. monthsAgo: 'há {delta} meses',
  14739. yearAgo: 'há um ano',
  14740. yearsAgo: 'há {delta} anos',
  14741. lessThanMinuteUntil: 'em menos de um minuto',
  14742. minuteUntil: 'em um minuto',
  14743. minutesUntil: 'em {delta} minutos',
  14744. hourUntil: 'em uma hora',
  14745. hoursUntil: 'em {delta} horas',
  14746. dayUntil: 'em um dia',
  14747. daysUntil: 'em {delta} dias',
  14748. weekUntil: 'em uma semana',
  14749. weeksUntil: 'em {delta} semanas',
  14750. monthUntil: 'em um mês',
  14751. monthsUntil: 'em {delta} meses',
  14752. yearUntil: 'em um ano',
  14753. yearsUntil: 'em {delta} anos'
  14754. });
  14755. /*
  14756. ---
  14757. name: Locale.pt-BR.Date
  14758. description: Date messages for Portuguese (Brazil).
  14759. license: MIT-style license
  14760. authors:
  14761. - Fabio Miranda Costa
  14762. requires:
  14763. - Locale
  14764. - Locale.pt-PT.Date
  14765. provides: [Locale.pt-BR.Date]
  14766. ...
  14767. */
  14768. Locale.define('pt-BR', 'Date', {
  14769. // Culture's date order: DD/MM/YYYY
  14770. shortDate: '%d/%m/%Y'
  14771. }).inherit('pt-PT', 'Date');
  14772. /*
  14773. ---
  14774. name: Locale.pt-BR.Form.Validator
  14775. description: Form Validator messages for Portuguese (Brazil).
  14776. license: MIT-style license
  14777. authors:
  14778. - Fábio Miranda Costa
  14779. requires:
  14780. - Locale
  14781. provides: [Locale.pt-BR.Form.Validator]
  14782. ...
  14783. */
  14784. Locale.define('pt-BR', 'FormValidator', {
  14785. required: 'Este campo é obrigatório.',
  14786. minLength: 'Digite pelo menos {minLength} caracteres (tamanho atual: {length}).',
  14787. maxLength: 'Não digite mais de {maxLength} caracteres (tamanho atual: {length}).',
  14788. integer: 'Por favor digite apenas um número inteiro neste campo. Não são permitidos números decimais (por exemplo, 1,25).',
  14789. numeric: 'Por favor digite apenas valores numéricos neste campo (por exemplo, "1" ou "1.1" ou "-1" ou "-1,1").',
  14790. digits: 'Por favor use apenas números e pontuação neste campo (por exemplo, um número de telefone com traços ou pontos é permitido).',
  14791. alpha: 'Por favor use somente letras (a-z). Espaço e outros caracteres não são permitidos.',
  14792. alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Espaço e outros caracteres não são permitidos.',
  14793. dateSuchAs: 'Digite uma data válida, como {date}',
  14794. dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (por exemplo, "31/12/1999")',
  14795. email: 'Digite um endereço de email válido. Por exemplo "nome@dominio.com".',
  14796. url: 'Digite uma URL válida. Exemplo: http://www.example.com.',
  14797. currencyDollar: 'Digite um valor em dinheiro válido. Exemplo: R$100,00 .',
  14798. oneRequired: 'Digite algo para pelo menos um desses campos.',
  14799. errorPrefix: 'Erro: ',
  14800. warningPrefix: 'Aviso: ',
  14801. // Form.Validator.Extras
  14802. noSpace: 'Não é possível digitar espaços neste campo.',
  14803. reqChkByNode: 'Não foi selecionado nenhum item.',
  14804. requiredChk: 'Este campo é obrigatório.',
  14805. reqChkByName: 'Por favor digite um {label}.',
  14806. match: 'Este campo deve ser igual ao campo {matchName}.',
  14807. startDate: 'a data inicial',
  14808. endDate: 'a data final',
  14809. currentDate: 'a data atual',
  14810. afterDate: 'A data deve ser igual ou posterior a {label}.',
  14811. beforeDate: 'A data deve ser igual ou anterior a {label}.',
  14812. startMonth: 'Por favor selecione uma data inicial.',
  14813. sameMonth: 'Estas duas datas devem ter o mesmo mês - você deve modificar uma das duas.',
  14814. creditcard: 'O número do cartão de crédito informado é inválido. Por favor verifique o valor e tente novamente. {length} números informados.'
  14815. });
  14816. /*
  14817. ---
  14818. name: Locale.pt-BR.Number
  14819. description: Number messages for PT Brazilian.
  14820. license: MIT-style license
  14821. authors:
  14822. - Arian Stolwijk
  14823. - Danillo César
  14824. requires:
  14825. - Locale
  14826. provides: [Locale.pt-BR.Number]
  14827. ...
  14828. */
  14829. Locale.define('pt-BR', 'Number', {
  14830. decimal: ',',
  14831. group: '.',
  14832. currency: {
  14833. prefix: 'R$ '
  14834. }
  14835. });
  14836. /*
  14837. ---
  14838. name: Locale.pt-PT.Form.Validator
  14839. description: Form Validator messages for Portuguese.
  14840. license: MIT-style license
  14841. authors:
  14842. - Miquel Hudin
  14843. requires:
  14844. - Locale
  14845. provides: [Locale.pt-PT.Form.Validator]
  14846. ...
  14847. */
  14848. Locale.define('pt-PT', 'FormValidator', {
  14849. required: 'Este campo é necessário.',
  14850. minLength: 'Digite pelo menos{minLength} caracteres (comprimento {length} caracteres).',
  14851. maxLength: 'Não insira mais de {maxLength} caracteres (comprimento {length} caracteres).',
  14852. integer: 'Digite um número inteiro neste domínio. Com números decimais (por exemplo, 1,25), não são permitidas.',
  14853. numeric: 'Digite apenas valores numéricos neste domínio (p.ex., "1" ou "1.1" ou "-1" ou "-1,1").',
  14854. digits: 'Por favor, use números e pontuação apenas neste campo (p.ex., um número de telefone com traços ou pontos é permitida).',
  14855. alpha: 'Por favor use somente letras (a-z), com nesta área. Não utilize espaços nem outros caracteres são permitidos.',
  14856. alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Não utilize espaços nem outros caracteres são permitidos.',
  14857. dateSuchAs: 'Digite uma data válida, como {date}',
  14858. dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (p.ex. "31/12/1999")',
  14859. email: 'Digite um endereço de email válido. Por exemplo "fred@domain.com".',
  14860. url: 'Digite uma URL válida, como http://www.example.com.',
  14861. currencyDollar: 'Digite um valor válido $. Por exemplo $ 100,00. ',
  14862. oneRequired: 'Digite algo para pelo menos um desses insumos.',
  14863. errorPrefix: 'Erro: ',
  14864. warningPrefix: 'Aviso: '
  14865. });
  14866. /*
  14867. ---
  14868. name: Locale.ru-RU-unicode.Date
  14869. description: Date messages for Russian (utf-8).
  14870. license: MIT-style license
  14871. authors:
  14872. - Evstigneev Pavel
  14873. - Kuryanovich Egor
  14874. requires:
  14875. - Locale
  14876. provides: [Locale.ru-RU.Date]
  14877. ...
  14878. */
  14879. (function(){
  14880. // Russian language pluralization rules, taken from CLDR project, http://unicode.org/cldr/
  14881. // one -> n mod 10 is 1 and n mod 100 is not 11;
  14882. // few -> n mod 10 in 2..4 and n mod 100 not in 12..14;
  14883. // many -> n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14;
  14884. // other -> everything else (example 3.14)
  14885. var pluralize = function(n, one, few, many, other){
  14886. var modulo10 = n % 10,
  14887. modulo100 = n % 100;
  14888. if (modulo10 == 1 && modulo100 != 11){
  14889. return one;
  14890. } else if ((modulo10 == 2 || modulo10 == 3 || modulo10 == 4) && !(modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){
  14891. return few;
  14892. } else if (modulo10 == 0 || (modulo10 == 5 || modulo10 == 6 || modulo10 == 7 || modulo10 == 8 || modulo10 == 9) || (modulo100 == 11 || modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){
  14893. return many;
  14894. } else {
  14895. return other;
  14896. }
  14897. };
  14898. Locale.define('ru-RU', 'Date', {
  14899. months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],
  14900. months_abbr: ['янв', 'февр', 'март', 'апр', 'май','июнь','июль','авг','сент','окт','нояб','дек'],
  14901. days: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
  14902. days_abbr: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
  14903. // Culture's date order: DD.MM.YYYY
  14904. dateOrder: ['date', 'month', 'year'],
  14905. shortDate: '%d.%m.%Y',
  14906. shortTime: '%H:%M',
  14907. AM: 'AM',
  14908. PM: 'PM',
  14909. firstDayOfWeek: 1,
  14910. // Date.Extras
  14911. ordinal: '',
  14912. lessThanMinuteAgo: 'меньше минуты назад',
  14913. minuteAgo: 'минуту назад',
  14914. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'минуту', 'минуты', 'минут') + ' назад'; },
  14915. hourAgo: 'час назад',
  14916. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'час', 'часа', 'часов') + ' назад'; },
  14917. dayAgo: 'вчера',
  14918. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'день', 'дня', 'дней') + ' назад'; },
  14919. weekAgo: 'неделю назад',
  14920. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'неделя', 'недели', 'недель') + ' назад'; },
  14921. monthAgo: 'месяц назад',
  14922. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'месяц', 'месяца', 'месяцев') + ' назад'; },
  14923. yearAgo: 'год назад',
  14924. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'год', 'года', 'лет') + ' назад'; },
  14925. lessThanMinuteUntil: 'меньше чем через минуту',
  14926. minuteUntil: 'через минуту',
  14927. minutesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'минуту', 'минуты', 'минут') + ''; },
  14928. hourUntil: 'через час',
  14929. hoursUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'час', 'часа', 'часов') + ''; },
  14930. dayUntil: 'завтра',
  14931. daysUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'день', 'дня', 'дней') + ''; },
  14932. weekUntil: 'через неделю',
  14933. weeksUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'неделю', 'недели', 'недель') + ''; },
  14934. monthUntil: 'через месяц',
  14935. monthsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'месяц', 'месяца', 'месяцев') + ''; },
  14936. yearUntil: 'через',
  14937. yearsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'год', 'года', 'лет') + ''; }
  14938. });
  14939. //<1.2compat>
  14940. Locale.define('ru-RU-unicode').inherit('ru-RU', 'Date');
  14941. //</1.2compat>
  14942. })();
  14943. /*
  14944. ---
  14945. name: Locale.ru-RU-unicode.Form.Validator
  14946. description: Form Validator messages for Russian (utf-8).
  14947. license: MIT-style license
  14948. authors:
  14949. - Chernodarov Egor
  14950. requires:
  14951. - Locale
  14952. provides: [Locale.ru-RU.Form.Validator]
  14953. ...
  14954. */
  14955. Locale.define('ru-RU', 'FormValidator', {
  14956. required: 'Это поле обязательно к заполнению.',
  14957. minLength: 'Пожалуйста, введите хотя бы {minLength} символов (Вы ввели {length}).',
  14958. maxLength: 'Пожалуйста, введите не больше {maxLength} символов (Вы ввели {length}).',
  14959. integer: 'Пожалуйста, введите в это поле число. Дробные числа (например 1.25) тут не разрешены.',
  14960. numeric: 'Пожалуйста, введите в это поле число (например "1" или "1.1", или "-1", или "-1.1").',
  14961. digits: 'В этом поле Вы можете использовать только цифры и знаки пунктуации (например, телефонный номер со знаками дефиса или с точками).',
  14962. alpha: 'В этом поле можно использовать только латинские буквы (a-z). Пробелы и другие символы запрещены.',
  14963. alphanum: 'В этом поле можно использовать только латинские буквы (a-z) и цифры (0-9). Пробелы и другие символы запрещены.',
  14964. dateSuchAs: 'Пожалуйста, введите корректную дату {date}',
  14965. dateInFormatMDY: 'Пожалуйста, введите дату в формате ММ/ДД/ГГГГ (например "12/31/1999")',
  14966. email: 'Пожалуйста, введите корректный емейл-адрес. Для примера "fred@domain.com".',
  14967. url: 'Пожалуйста, введите правильную ссылку вида http://www.example.com.',
  14968. currencyDollar: 'Пожалуйста, введите сумму в долларах. Например: $100.00 .',
  14969. oneRequired: 'Пожалуйста, выберите хоть что-нибудь в одном из этих полей.',
  14970. errorPrefix: 'Ошибка: ',
  14971. warningPrefix: 'Внимание: '
  14972. });
  14973. //<1.2compat>
  14974. Locale.define('ru-RU-unicode').inherit('ru-RU', 'FormValidator');
  14975. //</1.2compat>
  14976. /*
  14977. ---
  14978. name: Locale.sk-SK.Date
  14979. description: Date messages for Slovak.
  14980. license: MIT-style license
  14981. authors:
  14982. - Ivan Masár
  14983. requires:
  14984. - Locale
  14985. provides: [Locale.sk-SK.Date]
  14986. ...
  14987. */
  14988. (function(){
  14989. // Slovak language pluralization rules, see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  14990. // one -> n is 1; 1
  14991. // few -> n in 2..4; 2-4
  14992. // other -> everything else 0, 5-999, 1.31, 2.31, 5.31...
  14993. var pluralize = function(n, one, few, other){
  14994. if (n == 1) return one;
  14995. else if (n == 2 || n == 3 || n == 4) return few;
  14996. else return other;
  14997. };
  14998. Locale.define('sk-SK', 'Date', {
  14999. months: ['Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'December'],
  15000. months_abbr: ['januára', 'februára', 'marca', 'apríla', 'mája', 'júna', 'júla', 'augusta', 'septembra', 'októbra', 'novembra', 'decembra'],
  15001. days: ['Nedele', 'Pondelí', 'Úterý', 'Streda', 'Čtvrtek', 'Pátek', 'Sobota'],
  15002. days_abbr: ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so'],
  15003. // Culture's date order: DD.MM.YYYY
  15004. dateOrder: ['date', 'month', 'year'],
  15005. shortDate: '%d.%m.%Y',
  15006. shortTime: '%H:%M',
  15007. AM: 'dop.',
  15008. PM: 'pop.',
  15009. firstDayOfWeek: 1,
  15010. // Date.Extras
  15011. ordinal: '.',
  15012. lessThanMinuteAgo: 'pred chvíľou',
  15013. minuteAgo: 'približne pred minútou',
  15014. minutesAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'minútou', 'minútami', 'minútami'); },
  15015. hourAgo: 'približne pred hodinou',
  15016. hoursAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'hodinou', 'hodinami', 'hodinami'); },
  15017. dayAgo: 'pred dňom',
  15018. daysAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'dňom', 'dňami', 'dňami'); },
  15019. weekAgo: 'pred týždňom',
  15020. weeksAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'týždňom', 'týždňami', 'týždňami'); },
  15021. monthAgo: 'pred mesiacom',
  15022. monthsAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'mesiacom', 'mesiacmi', 'mesiacmi'); },
  15023. yearAgo: 'pred rokom',
  15024. yearsAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'rokom', 'rokmi', 'rokmi'); },
  15025. lessThanMinuteUntil: 'o chvíľu',
  15026. minuteUntil: 'približne o minútu',
  15027. minutesUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'minútu', 'minúty', 'minúty'); },
  15028. hourUntil: 'približne o hodinu',
  15029. hoursUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'hodinu', 'hodiny', 'hodín'); },
  15030. dayUntil: 'o deň',
  15031. daysUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'deň', 'dni', 'dní'); },
  15032. weekUntil: 'o týždeň',
  15033. weeksUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'týždeň', 'týždne', 'týždňov'); },
  15034. monthUntil: 'o mesiac',
  15035. monthsUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'mesiac', 'mesiace', 'mesiacov'); },
  15036. yearUntil: 'o rok',
  15037. yearsUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'rok', 'roky', 'rokov'); }
  15038. });
  15039. })();
  15040. /*
  15041. ---
  15042. name: Locale.sk-SK.Form.Validator
  15043. description: Form Validator messages for Czech.
  15044. license: MIT-style license
  15045. authors:
  15046. - Ivan Masár
  15047. requires:
  15048. - Locale
  15049. provides: [Locale.sk-SK.Form.Validator]
  15050. ...
  15051. */
  15052. Locale.define('sk-SK', 'FormValidator', {
  15053. required: 'Táto položka je povinná.',
  15054. minLength: 'Zadajte prosím aspoň {minLength} znakov (momentálne {length} znakov).',
  15055. maxLength: 'Zadajte prosím menej ako {maxLength} znakov (momentálne {length} znakov).',
  15056. integer: 'Zadajte prosím celé číslo. Desetinné čísla (napr. 1.25) nie sú povolené.',
  15057. numeric: 'Zadajte len číselné hodnoty (t.j. „1“ alebo „1.1“ alebo „-1“ alebo „-1.1“).',
  15058. digits: 'Zadajte prosím len čísla a interpunkčné znamienka (napríklad telefónne číslo s pomlčkami albo bodkami je povolené).',
  15059. alpha: 'Zadajte prosím len písmená (a-z). Medzery alebo iné znaky nie sú povolené.',
  15060. alphanum: 'Zadajte prosím len písmená (a-z) alebo číslice (0-9). Medzery alebo iné znaky nie sú povolené.',
  15061. dateSuchAs: 'Zadajte prosím platný dátum v tvare {date}',
  15062. dateInFormatMDY: 'Zadajte prosím platný datum v tvare MM / DD / RRRR (t.j. „12/31/1999“)',
  15063. email: 'Zadajte prosím platnú emailovú adresu. Napríklad „fred@domain.com“.',
  15064. url: 'Zadajte prosím platnoú adresu URL v tvare http://www.example.com.',
  15065. currencyDollar: 'Zadajte prosím platnú čiastku. Napríklad $100.00.',
  15066. oneRequired: 'Zadajte prosím aspoň jednu hodnotu z týchto položiek.',
  15067. errorPrefix: 'Chyba: ',
  15068. warningPrefix: 'Upozornenie: ',
  15069. // Form.Validator.Extras
  15070. noSpace: 'V tejto položle nie sú povolené medzery',
  15071. reqChkByNode: 'Nie sú vybrané žiadne položky.',
  15072. requiredChk: 'Táto položka je povinná.',
  15073. reqChkByName: 'Prosím vyberte {label}.',
  15074. match: 'Táto položka sa musí zhodovať s položkou {matchName}',
  15075. startDate: 'dátum začiatku',
  15076. endDate: 'dátum ukončenia',
  15077. currendDate: 'aktuálny dátum',
  15078. afterDate: 'Dátum by mal býť rovnaký alebo väčší ako {label}.',
  15079. beforeDate: 'Dátum by mal byť rovnaký alebo menší ako {label}.',
  15080. startMonth: 'Vyberte počiatočný mesiac.',
  15081. sameMonth: 'Tieto dva dátumy musia býť v rovnakom mesiaci - zmeňte jeden z nich.',
  15082. creditcard: 'Zadané číslo kreditnej karty je neplatné. Prosím, opravte ho. Bolo zadaných {length} číslic.'
  15083. });
  15084. /*
  15085. ---
  15086. name: Locale.si-SI.Date
  15087. description: Date messages for Slovenian.
  15088. license: MIT-style license
  15089. authors:
  15090. - Radovan Lozej
  15091. requires:
  15092. - Locale
  15093. provides: [Locale.si-SI.Date]
  15094. ...
  15095. */
  15096. (function(){
  15097. var pluralize = function(n, one, two, three, other){
  15098. return (n >= 1 && n <= 3) ? arguments[n] : other;
  15099. };
  15100. Locale.define('sl-SI', 'Date', {
  15101. months: ['januar', 'februar', 'marec', 'april', 'maj', 'junij', 'julij', 'avgust', 'september', 'oktober', 'november', 'december'],
  15102. months_abbr: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'avg', 'sep', 'okt', 'nov', 'dec'],
  15103. days: ['nedelja', 'ponedeljek', 'torek', 'sreda', 'četrtek', 'petek', 'sobota'],
  15104. days_abbr: ['ned', 'pon', 'tor', 'sre', 'čet', 'pet', 'sob'],
  15105. // Culture's date order: DD.MM.YYYY
  15106. dateOrder: ['date', 'month', 'year'],
  15107. shortDate: '%d.%m.%Y',
  15108. shortTime: '%H.%M',
  15109. AM: 'AM',
  15110. PM: 'PM',
  15111. firstDayOfWeek: 1,
  15112. // Date.Extras
  15113. ordinal: '.',
  15114. lessThanMinuteAgo: 'manj kot minuto nazaj',
  15115. minuteAgo: 'minuto nazaj',
  15116. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'minuto', 'minuti', 'minute', 'minut') + ' nazaj'; },
  15117. hourAgo: 'uro nazaj',
  15118. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'uro', 'uri', 'ure', 'ur') + ' nazaj'; },
  15119. dayAgo: 'dan nazaj',
  15120. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'dan', 'dneva', 'dni', 'dni') + ' nazaj'; },
  15121. weekAgo: 'teden nazaj',
  15122. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'teden', 'tedna', 'tedne', 'tednov') + ' nazaj'; },
  15123. monthAgo: 'mesec nazaj',
  15124. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'mesec', 'meseca', 'mesece', 'mesecov') + ' nazaj'; },
  15125. yearthAgo: 'leto nazaj',
  15126. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'leto', 'leti', 'leta', 'let') + ' nazaj'; },
  15127. lessThanMinuteUntil: 'še manj kot minuto',
  15128. minuteUntil: 'še minuta',
  15129. minutesUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'minuta', 'minuti', 'minute', 'minut'); },
  15130. hourUntil: 'še ura',
  15131. hoursUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'ura', 'uri', 'ure', 'ur'); },
  15132. dayUntil: 'še dan',
  15133. daysUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'dan', 'dneva', 'dnevi', 'dni'); },
  15134. weekUntil: 'še tedn',
  15135. weeksUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'teden', 'tedna', 'tedni', 'tednov'); },
  15136. monthUntil: 'še mesec',
  15137. monthsUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'mesec', 'meseca', 'meseci', 'mesecov'); },
  15138. yearUntil: 'še leto',
  15139. yearsUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'leto', 'leti', 'leta', 'let'); }
  15140. });
  15141. })();
  15142. /*
  15143. ---
  15144. name: Locale.si-SI.Form.Validator
  15145. description: Form Validator messages for Slovenian.
  15146. license: MIT-style license
  15147. authors:
  15148. - Radovan Lozej
  15149. requires:
  15150. - Locale
  15151. provides: [Locale.si-SI.Form.Validator]
  15152. ...
  15153. */
  15154. Locale.define('sl-SI', 'FormValidator', {
  15155. required: 'To polje je obvezno',
  15156. minLength: 'Prosim, vnesite vsaj {minLength} znakov (vnesli ste {length} znakov).',
  15157. maxLength: 'Prosim, ne vnesite več kot {maxLength} znakov (vnesli ste {length} znakov).',
  15158. integer: 'Prosim, vnesite celo število. Decimalna števila (kot 1,25) niso dovoljena.',
  15159. numeric: 'Prosim, vnesite samo numerične vrednosti (kot "1" ali "1.1" ali "-1" ali "-1.1").',
  15160. digits: 'Prosim, uporabite številke in ločila le na tem polju (na primer, dovoljena je telefonska številka z pomišlaji ali pikami).',
  15161. alpha: 'Prosim, uporabite le črke v tem plju. Presledki in drugi znaki niso dovoljeni.',
  15162. alphanum: 'Prosim, uporabite samo črke ali številke v tem polju. Presledki in drugi znaki niso dovoljeni.',
  15163. dateSuchAs: 'Prosim, vnesite pravilen datum kot {date}',
  15164. dateInFormatMDY: 'Prosim, vnesite pravilen datum kot MM.DD.YYYY (primer "12.31.1999")',
  15165. email: 'Prosim, vnesite pravilen email naslov. Na primer "fred@domain.com".',
  15166. url: 'Prosim, vnesite pravilen URL kot http://www.example.com.',
  15167. currencyDollar: 'Prosim, vnesit epravilno vrednost €. Primer 100,00€ .',
  15168. oneRequired: 'Prosimo, vnesite nekaj za vsaj eno izmed teh polj.',
  15169. errorPrefix: 'Napaka: ',
  15170. warningPrefix: 'Opozorilo: ',
  15171. // Form.Validator.Extras
  15172. noSpace: 'To vnosno polje ne dopušča presledkov.',
  15173. reqChkByNode: 'Nič niste izbrali.',
  15174. requiredChk: 'To polje je obvezno',
  15175. reqChkByName: 'Prosim, izberite {label}.',
  15176. match: 'To polje se mora ujemati z poljem {matchName}',
  15177. startDate: 'datum začetka',
  15178. endDate: 'datum konca',
  15179. currentDate: 'trenuten datum',
  15180. afterDate: 'Datum bi moral biti isti ali po {label}.',
  15181. beforeDate: 'Datum bi moral biti isti ali pred {label}.',
  15182. startMonth: 'Prosim, vnesite začetni datum',
  15183. sameMonth: 'Ta dva datuma morata biti v istem mesecu - premeniti morate eno ali drugo.',
  15184. creditcard: 'Številka kreditne kartice ni pravilna. Preverite številko ali poskusite še enkrat. Vnešenih {length} znakov.'
  15185. });
  15186. /*
  15187. ---
  15188. name: Locale.sv-SE.Date
  15189. description: Date messages for Swedish.
  15190. license: MIT-style license
  15191. authors:
  15192. - Martin Lundgren
  15193. requires:
  15194. - Locale
  15195. provides: [Locale.sv-SE.Date]
  15196. ...
  15197. */
  15198. Locale.define('sv-SE', 'Date', {
  15199. months: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'],
  15200. months_abbr: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
  15201. days: ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'],
  15202. days_abbr: ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör'],
  15203. // Culture's date order: YYYY-MM-DD
  15204. dateOrder: ['year', 'month', 'date'],
  15205. shortDate: '%Y-%m-%d',
  15206. shortTime: '%H:%M',
  15207. AM: '',
  15208. PM: '',
  15209. firstDayOfWeek: 1,
  15210. // Date.Extras
  15211. ordinal: '',
  15212. lessThanMinuteAgo: 'mindre än en minut sedan',
  15213. minuteAgo: 'ungefär en minut sedan',
  15214. minutesAgo: '{delta} minuter sedan',
  15215. hourAgo: 'ungefär en timme sedan',
  15216. hoursAgo: 'ungefär {delta} timmar sedan',
  15217. dayAgo: '1 dag sedan',
  15218. daysAgo: '{delta} dagar sedan',
  15219. lessThanMinuteUntil: 'mindre än en minut sedan',
  15220. minuteUntil: 'ungefär en minut sedan',
  15221. minutesUntil: '{delta} minuter sedan',
  15222. hourUntil: 'ungefär en timme sedan',
  15223. hoursUntil: 'ungefär {delta} timmar sedan',
  15224. dayUntil: '1 dag sedan',
  15225. daysUntil: '{delta} dagar sedan'
  15226. });
  15227. /*
  15228. ---
  15229. name: Locale.sv-SE.Form.Validator
  15230. description: Form Validator messages for Swedish.
  15231. license: MIT-style license
  15232. authors:
  15233. - Martin Lundgren
  15234. requires:
  15235. - Locale
  15236. provides: [Locale.sv-SE.Form.Validator]
  15237. ...
  15238. */
  15239. Locale.define('sv-SE', 'FormValidator', {
  15240. required: 'Fältet är obligatoriskt.',
  15241. minLength: 'Ange minst {minLength} tecken (du angav {length} tecken).',
  15242. maxLength: 'Ange högst {maxLength} tecken (du angav {length} tecken). ',
  15243. integer: 'Ange ett heltal i fältet. Tal med decimaler (t.ex. 1,25) är inte tillåtna.',
  15244. numeric: 'Ange endast numeriska värden i detta fält (t.ex. "1" eller "1.1" eller "-1" eller "-1,1").',
  15245. digits: 'Använd endast siffror och skiljetecken i detta fält (till exempel ett telefonnummer med bindestreck tillåtet).',
  15246. alpha: 'Använd endast bokstäver (a-ö) i detta fält. Inga mellanslag eller andra tecken är tillåtna.',
  15247. alphanum: 'Använd endast bokstäver (a-ö) och siffror (0-9) i detta fält. Inga mellanslag eller andra tecken är tillåtna.',
  15248. dateSuchAs: 'Ange ett giltigt datum som t.ex. {date}',
  15249. dateInFormatMDY: 'Ange ett giltigt datum som t.ex. YYYY-MM-DD (i.e. "1999-12-31")',
  15250. email: 'Ange en giltig e-postadress. Till exempel "erik@domain.com".',
  15251. url: 'Ange en giltig webbadress som http://www.example.com.',
  15252. currencyDollar: 'Ange en giltig belopp. Exempelvis 100,00.',
  15253. oneRequired: 'Vänligen ange minst ett av dessa alternativ.',
  15254. errorPrefix: 'Fel: ',
  15255. warningPrefix: 'Varning: ',
  15256. // Form.Validator.Extras
  15257. noSpace: 'Det får inte finnas några mellanslag i detta fält.',
  15258. reqChkByNode: 'Inga objekt är valda.',
  15259. requiredChk: 'Detta är ett obligatoriskt fält.',
  15260. reqChkByName: 'Välj en {label}.',
  15261. match: 'Detta fält måste matcha {matchName}',
  15262. startDate: 'startdatumet',
  15263. endDate: 'slutdatum',
  15264. currentDate: 'dagens datum',
  15265. afterDate: 'Datumet bör vara samma eller senare än {label}.',
  15266. beforeDate: 'Datumet bör vara samma eller tidigare än {label}.',
  15267. startMonth: 'Välj en start månad',
  15268. sameMonth: 'Dessa två datum måste vara i samma månad - du måste ändra det ena eller det andra.'
  15269. });
  15270. /*
  15271. ---
  15272. name: Locale.sv-SE.Number
  15273. description: Number messages for Swedish.
  15274. license: MIT-style license
  15275. authors:
  15276. - Arian Stolwijk
  15277. - Martin Lundgren
  15278. requires:
  15279. - Locale
  15280. - Locale.EU.Number
  15281. provides: [Locale.sv-SE.Number]
  15282. ...
  15283. */
  15284. Locale.define('sv-SE', 'Number', {
  15285. currency: {
  15286. prefix: 'SEK '
  15287. }
  15288. }).inherit('EU', 'Number');
  15289. /*
  15290. ---
  15291. name: Locale.tr-TR.Date
  15292. description: Date messages for Turkish.
  15293. license: MIT-style license
  15294. authors:
  15295. - Faruk Can Bilir
  15296. requires:
  15297. - Locale
  15298. provides: [Locale.tr-TR.Date]
  15299. ...
  15300. */
  15301. Locale.define('tr-TR', 'Date', {
  15302. months: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
  15303. months_abbr: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
  15304. days: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],
  15305. days_abbr: ['Pa', 'Pzt', 'Sa', 'Ça', 'Pe', 'Cu', 'Cmt'],
  15306. // Culture's date order: MM/DD/YYYY
  15307. dateOrder: ['date', 'month', 'year'],
  15308. shortDate: '%d/%m/%Y',
  15309. shortTime: '%H.%M',
  15310. AM: 'AM',
  15311. PM: 'PM',
  15312. firstDayOfWeek: 1,
  15313. // Date.Extras
  15314. ordinal: '',
  15315. lessThanMinuteAgo: 'bir dakikadan önce',
  15316. minuteAgo: 'yaklaşık bir dakika önce',
  15317. minutesAgo: '{delta} dakika önce',
  15318. hourAgo: 'bir saat kadar önce',
  15319. hoursAgo: '{delta} saat kadar önce',
  15320. dayAgo: 'bir gün önce',
  15321. daysAgo: '{delta} gün önce',
  15322. weekAgo: 'bir hafta önce',
  15323. weeksAgo: '{delta} hafta önce',
  15324. monthAgo: 'bir ay önce',
  15325. monthsAgo: '{delta} ay önce',
  15326. yearAgo: 'bir yıl önce',
  15327. yearsAgo: '{delta} yıl önce',
  15328. lessThanMinuteUntil: 'bir dakikadan az sonra',
  15329. minuteUntil: 'bir dakika kadar sonra',
  15330. minutesUntil: '{delta} dakika sonra',
  15331. hourUntil: 'bir saat kadar sonra',
  15332. hoursUntil: '{delta} saat kadar sonra',
  15333. dayUntil: 'bir gün sonra',
  15334. daysUntil: '{delta} gün sonra',
  15335. weekUntil: 'bir hafta sonra',
  15336. weeksUntil: '{delta} hafta sonra',
  15337. monthUntil: 'bir ay sonra',
  15338. monthsUntil: '{delta} ay sonra',
  15339. yearUntil: 'bir yıl sonra',
  15340. yearsUntil: '{delta} yıl sonra'
  15341. });
  15342. /*
  15343. ---
  15344. name: Locale.tr-TR.Form.Validator
  15345. description: Form Validator messages for Turkish.
  15346. license: MIT-style license
  15347. authors:
  15348. - Faruk Can Bilir
  15349. requires:
  15350. - Locale
  15351. provides: [Locale.tr-TR.Form.Validator]
  15352. ...
  15353. */
  15354. Locale.define('tr-TR', 'FormValidator', {
  15355. required: 'Bu alan zorunlu.',
  15356. minLength: 'Lütfen en az {minLength} karakter girin (siz {length} karakter girdiniz).',
  15357. maxLength: 'Lütfen en fazla {maxLength} karakter girin (siz {length} karakter girdiniz).',
  15358. integer: 'Lütfen bu alana sadece tamsayı girin. Ondalıklı sayılar (ör: 1.25) kullanılamaz.',
  15359. numeric: 'Lütfen bu alana sadece sayısal değer girin (ör: "1", "1.1", "-1" ya da "-1.1").',
  15360. digits: 'Lütfen bu alana sadece sayısal değer ve noktalama işareti girin (örneğin, nokta ve tire içeren bir telefon numarası kullanılabilir).',
  15361. alpha: 'Lütfen bu alanda yalnızca harf kullanın. Boşluk ve diğer karakterler kullanılamaz.',
  15362. alphanum: 'Lütfen bu alanda sadece harf ve rakam kullanın. Boşluk ve diğer karakterler kullanılamaz.',
  15363. dateSuchAs: 'Lütfen geçerli bir tarih girin (Ör: {date})',
  15364. dateInFormatMDY: 'Lütfen geçerli bir tarih girin (GG/AA/YYYY, ör: "31/12/1999")',
  15365. email: 'Lütfen geçerli bir email adresi girin. Ör: "kemal@etikan.com".',
  15366. url: 'Lütfen geçerli bir URL girin. Ör: http://www.example.com.',
  15367. currencyDollar: 'Lütfen geçerli bir TL miktarı girin. Ör: 100,00 TL .',
  15368. oneRequired: 'Lütfen en az bir tanesini doldurun.',
  15369. errorPrefix: 'Hata: ',
  15370. warningPrefix: 'Uyarı: ',
  15371. // Form.Validator.Extras
  15372. noSpace: 'Bu alanda boşluk kullanılamaz.',
  15373. reqChkByNode: 'Hiçbir öğe seçilmemiş.',
  15374. requiredChk: 'Bu alan zorunlu.',
  15375. reqChkByName: 'Lütfen bir {label} girin.',
  15376. match: 'Bu alan, {matchName} alanıyla uyuşmalı',
  15377. startDate: 'başlangıç tarihi',
  15378. endDate: 'bitiş tarihi',
  15379. currentDate: 'bugünün tarihi',
  15380. afterDate: 'Tarih, {label} tarihiyle aynı gün ya da ondan sonra olmalıdır.',
  15381. beforeDate: 'Tarih, {label} tarihiyle aynı gün ya da ondan önce olmalıdır.',
  15382. startMonth: 'Lütfen bir başlangıç ayı seçin',
  15383. sameMonth: 'Bu iki tarih aynı ayda olmalı - bir tanesini değiştirmeniz gerekiyor.',
  15384. creditcard: 'Girdiğiniz kredi kartı numarası geçersiz. Lütfen kontrol edip tekrar deneyin. {length} hane girildi.'
  15385. });
  15386. /*
  15387. ---
  15388. name: Locale.tr-TR.Number
  15389. description: Number messages for Turkish.
  15390. license: MIT-style license
  15391. authors:
  15392. - Faruk Can Bilir
  15393. requires:
  15394. - Locale
  15395. - Locale.EU.Number
  15396. provides: [Locale.tr-TR.Number]
  15397. ...
  15398. */
  15399. Locale.define('tr-TR', 'Number', {
  15400. currency: {
  15401. decimals: 0,
  15402. suffix: ' TL'
  15403. }
  15404. }).inherit('EU', 'Number');
  15405. /*
  15406. ---
  15407. name: Locale.uk-UA.Date
  15408. description: Date messages for Ukrainian (utf-8).
  15409. license: MIT-style license
  15410. authors:
  15411. - Slik
  15412. requires:
  15413. - Locale
  15414. provides: [Locale.uk-UA.Date]
  15415. ...
  15416. */
  15417. (function(){
  15418. var pluralize = function(n, one, few, many, other){
  15419. var d = (n / 10).toInt(),
  15420. z = n % 10,
  15421. s = (n / 100).toInt();
  15422. if (d == 1 && n > 10) return many;
  15423. if (z == 1) return one;
  15424. if (z > 0 && z < 5) return few;
  15425. return many;
  15426. };
  15427. Locale.define('uk-UA', 'Date', {
  15428. months: ['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'],
  15429. months_abbr: ['Січ', 'Лют', 'Бер', 'Квіт', 'Трав', 'Черв', 'Лип', 'Серп', 'Вер', 'Жовт', 'Лист', 'Груд' ],
  15430. days: ['Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', "П'ятниця", 'Субота'],
  15431. days_abbr: ['Нд', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
  15432. // Culture's date order: DD/MM/YYYY
  15433. dateOrder: ['date', 'month', 'year'],
  15434. shortDate: '%d/%m/%Y',
  15435. shortTime: '%H:%M',
  15436. AM: 'до полудня',
  15437. PM: 'по полудню',
  15438. firstDayOfWeek: 1,
  15439. // Date.Extras
  15440. ordinal: '',
  15441. lessThanMinuteAgo: 'меньше хвилини тому',
  15442. minuteAgo: 'хвилину тому',
  15443. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'хвилину', 'хвилини', 'хвилин') + ' тому'; },
  15444. hourAgo: 'годину тому',
  15445. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'годину', 'години', 'годин') + ' тому'; },
  15446. dayAgo: 'вчора',
  15447. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'день', 'дня', 'днів') + ' тому'; },
  15448. weekAgo: 'тиждень тому',
  15449. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'тиждень', 'тижні', 'тижнів') + ' тому'; },
  15450. monthAgo: 'місяць тому',
  15451. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'місяць', 'місяці', 'місяців') + ' тому'; },
  15452. yearAgo: 'рік тому',
  15453. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'рік', 'роки', 'років') + ' тому'; },
  15454. lessThanMinuteUntil: 'за мить',
  15455. minuteUntil: 'через хвилину',
  15456. minutesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'хвилину', 'хвилини', 'хвилин'); },
  15457. hourUntil: 'через годину',
  15458. hoursUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'годину', 'години', 'годин'); },
  15459. dayUntil: 'завтра',
  15460. daysUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'день', 'дня', 'днів'); },
  15461. weekUntil: 'через тиждень',
  15462. weeksUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'тиждень', 'тижні', 'тижнів'); },
  15463. monthUntil: 'через місяць',
  15464. monthesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'місяць', 'місяці', 'місяців'); },
  15465. yearUntil: 'через рік',
  15466. yearsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'рік', 'роки', 'років'); }
  15467. });
  15468. })();
  15469. /*
  15470. ---
  15471. name: Locale.uk-UA.Form.Validator
  15472. description: Form Validator messages for Ukrainian (utf-8).
  15473. license: MIT-style license
  15474. authors:
  15475. - Slik
  15476. requires:
  15477. - Locale
  15478. provides: [Locale.uk-UA.Form.Validator]
  15479. ...
  15480. */
  15481. Locale.define('uk-UA', 'FormValidator', {
  15482. required: 'Це поле повинне бути заповненим.',
  15483. minLength: 'Введіть хоча б {minLength} символів (Ви ввели {length}).',
  15484. maxLength: 'Кількість символів не може бути більше {maxLength} (Ви ввели {length}).',
  15485. integer: 'Введіть в це поле число. Дробові числа (наприклад 1.25) не дозволені.',
  15486. numeric: 'Введіть в це поле число (наприклад "1" або "1.1", або "-1", або "-1.1").',
  15487. digits: 'В цьому полі ви можете використовувати лише цифри і знаки пунктіації (наприклад, телефонний номер з знаками дефізу або з крапками).',
  15488. alpha: 'В цьому полі можна використовувати лише латинські літери (a-z). Пробіли і інші символи заборонені.',
  15489. alphanum: 'В цьому полі можна використовувати лише латинські літери (a-z) і цифри (0-9). Пробіли і інші символи заборонені.',
  15490. dateSuchAs: 'Введіть коректну дату {date}.',
  15491. dateInFormatMDY: 'Введіть дату в форматі ММ/ДД/РРРР (наприклад "12/31/2009").',
  15492. email: 'Введіть коректну адресу електронної пошти (наприклад "name@domain.com").',
  15493. url: 'Введіть коректне інтернет-посилання (наприклад http://www.example.com).',
  15494. currencyDollar: 'Введіть суму в доларах (наприклад "$100.00").',
  15495. oneRequired: 'Заповніть одне з полів.',
  15496. errorPrefix: 'Помилка: ',
  15497. warningPrefix: 'Увага: ',
  15498. noSpace: 'Пробіли заборонені.',
  15499. reqChkByNode: 'Не відмічено жодного варіанту.',
  15500. requiredChk: 'Це поле повинне бути віміченим.',
  15501. reqChkByName: 'Будь ласка, відмітьте {label}.',
  15502. match: 'Це поле повинно відповідати {matchName}',
  15503. startDate: 'початкова дата',
  15504. endDate: 'кінцева дата',
  15505. currentDate: 'сьогоднішня дата',
  15506. afterDate: 'Ця дата повинна бути такою ж, або пізнішою за {label}.',
  15507. beforeDate: 'Ця дата повинна бути такою ж, або ранішою за {label}.',
  15508. startMonth: 'Будь ласка, виберіть початковий місяць',
  15509. sameMonth: 'Ці дати повинні відноситись одного і того ж місяця. Будь ласка, змініть одну з них.',
  15510. creditcard: 'Номер кредитної карти введений неправильно. Будь ласка, перевірте його. Введено {length} символів.'
  15511. });
  15512. /*
  15513. ---
  15514. name: Locale.zh-CH.Date
  15515. description: Date messages for Chinese (simplified and traditional).
  15516. license: MIT-style license
  15517. authors:
  15518. - YMind Chan
  15519. requires:
  15520. - Locale
  15521. provides: [Locale.zh-CH.Date]
  15522. ...
  15523. */
  15524. // Simplified Chinese
  15525. Locale.define('zh-CHS', 'Date', {
  15526. months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  15527. months_abbr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  15528. days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  15529. days_abbr: ['日', '一', '二', '三', '四', '五', '六'],
  15530. // Culture's date order: YYYY-MM-DD
  15531. dateOrder: ['year', 'month', 'date'],
  15532. shortDate: '%Y-%m-%d',
  15533. shortTime: '%I:%M%p',
  15534. AM: 'AM',
  15535. PM: 'PM',
  15536. firstDayOfWeek: 1,
  15537. // Date.Extras
  15538. ordinal: '',
  15539. lessThanMinuteAgo: '不到1分钟前',
  15540. minuteAgo: '大约1分钟前',
  15541. minutesAgo: '{delta}分钟之前',
  15542. hourAgo: '大约1小时前',
  15543. hoursAgo: '大约{delta}小时前',
  15544. dayAgo: '1天前',
  15545. daysAgo: '{delta}天前',
  15546. weekAgo: '1星期前',
  15547. weeksAgo: '{delta}星期前',
  15548. monthAgo: '1个月前',
  15549. monthsAgo: '{delta}个月前',
  15550. yearAgo: '1年前',
  15551. yearsAgo: '{delta}年前',
  15552. lessThanMinuteUntil: '从现在开始不到1分钟',
  15553. minuteUntil: '从现在开始約1分钟',
  15554. minutesUntil: '从现在开始约{delta}分钟',
  15555. hourUntil: '从现在开始1小时',
  15556. hoursUntil: '从现在开始约{delta}小时',
  15557. dayUntil: '从现在开始1天',
  15558. daysUntil: '从现在开始{delta}天',
  15559. weekUntil: '从现在开始1星期',
  15560. weeksUntil: '从现在开始{delta}星期',
  15561. monthUntil: '从现在开始一个月',
  15562. monthsUntil: '从现在开始{delta}个月',
  15563. yearUntil: '从现在开始1年',
  15564. yearsUntil: '从现在开始{delta}年'
  15565. });
  15566. // Traditional Chinese
  15567. Locale.define('zh-CHT', 'Date', {
  15568. months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  15569. months_abbr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  15570. days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  15571. days_abbr: ['日', '一', '二', '三', '四', '五', '六'],
  15572. // Culture's date order: YYYY-MM-DD
  15573. dateOrder: ['year', 'month', 'date'],
  15574. shortDate: '%Y-%m-%d',
  15575. shortTime: '%I:%M%p',
  15576. AM: 'AM',
  15577. PM: 'PM',
  15578. firstDayOfWeek: 1,
  15579. // Date.Extras
  15580. ordinal: '',
  15581. lessThanMinuteAgo: '不到1分鐘前',
  15582. minuteAgo: '大約1分鐘前',
  15583. minutesAgo: '{delta}分鐘之前',
  15584. hourAgo: '大約1小時前',
  15585. hoursAgo: '大約{delta}小時前',
  15586. dayAgo: '1天前',
  15587. daysAgo: '{delta}天前',
  15588. weekAgo: '1星期前',
  15589. weeksAgo: '{delta}星期前',
  15590. monthAgo: '1个月前',
  15591. monthsAgo: '{delta}个月前',
  15592. yearAgo: '1年前',
  15593. yearsAgo: '{delta}年前',
  15594. lessThanMinuteUntil: '從現在開始不到1分鐘',
  15595. minuteUntil: '從現在開始約1分鐘',
  15596. minutesUntil: '從現在開始約{delta}分鐘',
  15597. hourUntil: '從現在開始1小時',
  15598. hoursUntil: '從現在開始約{delta}小時',
  15599. dayUntil: '從現在開始1天',
  15600. daysUntil: '從現在開始{delta}天',
  15601. weekUntil: '從現在開始1星期',
  15602. weeksUntil: '從現在開始{delta}星期',
  15603. monthUntil: '從現在開始一個月',
  15604. monthsUntil: '從現在開始{delta}個月',
  15605. yearUntil: '從現在開始1年',
  15606. yearsUntil: '從現在開始{delta}年'
  15607. });
  15608. /*
  15609. ---
  15610. name: Locale.zh-CH.Form.Validator
  15611. description: Form Validator messages for Chinese (simplified and traditional).
  15612. license: MIT-style license
  15613. authors:
  15614. - YMind Chan
  15615. requires:
  15616. - Locale
  15617. - Form.Validator
  15618. provides: [Form.zh-CH.Form.Validator, Form.Validator.CurrencyYuanValidator]
  15619. ...
  15620. */
  15621. // Simplified Chinese
  15622. Locale.define('zh-CHS', 'FormValidator', {
  15623. required: '此项必填。',
  15624. minLength: '请至少输入 {minLength} 个字符 (已输入 {length} 个)。',
  15625. maxLength: '最多只能输入 {maxLength} 个字符 (已输入 {length} 个)。',
  15626. integer: '请输入一个整数,不能包含小数点。例如:"1", "200"。',
  15627. numeric: '请输入一个数字,例如:"1", "1.1", "-1", "-1.1"。',
  15628. digits: '请输入由数字和标点符号组成的内容。例如电话号码。',
  15629. alpha: '请输入 A-Z 的 26 个字母,不能包含空格或任何其他字符。',
  15630. alphanum: '请输入 A-Z 的 26 个字母或 0-9 的 10 个数字,不能包含空格或任何其他字符。',
  15631. dateSuchAs: '请输入合法的日期格式,如:{date}。',
  15632. dateInFormatMDY: '请输入合法的日期格式,例如:YYYY-MM-DD ("2010-12-31")。',
  15633. email: '请输入合法的电子信箱地址,例如:"fred@domain.com"。',
  15634. url: '请输入合法的 Url 地址,例如:http://www.example.com。',
  15635. currencyDollar: '请输入合法的货币符号,例如:¥100.0',
  15636. oneRequired: '请至少选择一项。',
  15637. errorPrefix: '错误:',
  15638. warningPrefix: '警告:',
  15639. // Form.Validator.Extras
  15640. noSpace: '不能包含空格。',
  15641. reqChkByNode: '未选择任何内容。',
  15642. requiredChk: '此项必填。',
  15643. reqChkByName: '请选择 {label}.',
  15644. match: '必须与{matchName}相匹配',
  15645. startDate: '起始日期',
  15646. endDate: '结束日期',
  15647. currentDate: '当前日期',
  15648. afterDate: '日期必须等于或晚于 {label}.',
  15649. beforeDate: '日期必须早于或等于 {label}.',
  15650. startMonth: '请选择起始月份',
  15651. sameMonth: '您必须修改两个日期中的一个,以确保它们在同一月份。',
  15652. creditcard: '您输入的信用卡号码不正确。当前已输入{length}个字符。'
  15653. });
  15654. // Traditional Chinese
  15655. Locale.define('zh-CHT', 'FormValidator', {
  15656. required: '此項必填。 ',
  15657. minLength: '請至少輸入{minLength} 個字符(已輸入{length} 個)。 ',
  15658. maxLength: '最多只能輸入{maxLength} 個字符(已輸入{length} 個)。 ',
  15659. integer: '請輸入一個整數,不能包含小數點。例如:"1", "200"。 ',
  15660. numeric: '請輸入一個數字,例如:"1", "1.1", "-1", "-1.1"。 ',
  15661. digits: '請輸入由數字和標點符號組成的內容。例如電話號碼。 ',
  15662. alpha: '請輸入AZ 的26 個字母,不能包含空格或任何其他字符。 ',
  15663. alphanum: '請輸入AZ 的26 個字母或0-9 的10 個數字,不能包含空格或任何其他字符。 ',
  15664. dateSuchAs: '請輸入合法的日期格式,如:{date}。 ',
  15665. dateInFormatMDY: '請輸入合法的日期格式,例如:YYYY-MM-DD ("2010-12-31")。 ',
  15666. email: '請輸入合法的電子信箱地址,例如:"fred@domain.com"。 ',
  15667. url: '請輸入合法的Url 地址,例如:http://www.example.com。 ',
  15668. currencyDollar: '請輸入合法的貨幣符號,例如:¥100.0',
  15669. oneRequired: '請至少選擇一項。 ',
  15670. errorPrefix: '錯誤:',
  15671. warningPrefix: '警告:',
  15672. // Form.Validator.Extras
  15673. noSpace: '不能包含空格。 ',
  15674. reqChkByNode: '未選擇任何內容。 ',
  15675. requiredChk: '此項必填。 ',
  15676. reqChkByName: '請選擇 {label}.',
  15677. match: '必須與{matchName}相匹配',
  15678. startDate: '起始日期',
  15679. endDate: '結束日期',
  15680. currentDate: '當前日期',
  15681. afterDate: '日期必須等於或晚於{label}.',
  15682. beforeDate: '日期必須早於或等於{label}.',
  15683. startMonth: '請選擇起始月份',
  15684. sameMonth: '您必須修改兩個日期中的一個,以確保它們在同一月份。 ',
  15685. creditcard: '您輸入的信用卡號碼不正確。當前已輸入{length}個字符。 '
  15686. });
  15687. Form.Validator.add('validate-currency-yuan', {
  15688. errorMsg: function(){
  15689. return Form.Validator.getMsg('currencyYuan');
  15690. },
  15691. test: function(element){
  15692. // [¥]1[##][,###]+[.##]
  15693. // [¥]1###+[.##]
  15694. // [¥]0.##
  15695. // [¥].##
  15696. return Form.Validator.getValidator('IsEmpty').test(element) || (/^¥?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/).test(element.get('value'));
  15697. }
  15698. });
  15699. /*
  15700. ---
  15701. name: Locale.zh-CH.Number
  15702. description: Number messages for for Chinese (simplified and traditional).
  15703. license: MIT-style license
  15704. authors:
  15705. - YMind Chan
  15706. requires:
  15707. - Locale
  15708. - Locale.en-US.Number
  15709. provides: [Locale.zh-CH.Number]
  15710. ...
  15711. */
  15712. // Simplified Chinese
  15713. Locale.define('zh-CHS', 'Number', {
  15714. currency: {
  15715. prefix: '¥ '
  15716. }
  15717. }).inherit('en-US', 'Number');
  15718. // Traditional Chinese
  15719. Locale.define('zh-CHT').inherit('zh-CHS', 'Number');
  15720. /*
  15721. ---
  15722. script: Request.JSONP.js
  15723. name: Request.JSONP
  15724. description: Defines Request.JSONP, a class for cross domain javascript via script injection.
  15725. license: MIT-style license
  15726. authors:
  15727. - Aaron Newton
  15728. - Guillermo Rauch
  15729. - Arian Stolwijk
  15730. requires:
  15731. - Core/Element
  15732. - Core/Request
  15733. - MooTools.More
  15734. provides: [Request.JSONP]
  15735. ...
  15736. */
  15737. Request.JSONP = new Class({
  15738. Implements: [Chain, Events, Options],
  15739. options: {/*
  15740. onRequest: function(src, scriptElement){},
  15741. onComplete: function(data){},
  15742. onSuccess: function(data){},
  15743. onCancel: function(){},
  15744. onTimeout: function(){},
  15745. onError: function(){}, */
  15746. onRequest: function(src){
  15747. if (this.options.log && window.console && console.log){
  15748. console.log('JSONP retrieving script with url:' + src);
  15749. }
  15750. },
  15751. onError: function(src){
  15752. if (this.options.log && window.console && console.warn){
  15753. console.warn('JSONP '+ src +' will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs');
  15754. }
  15755. },
  15756. url: '',
  15757. callbackKey: 'callback',
  15758. injectScript: document.head,
  15759. data: '',
  15760. link: 'ignore',
  15761. timeout: 0,
  15762. log: false
  15763. },
  15764. initialize: function(options){
  15765. this.setOptions(options);
  15766. },
  15767. send: function(options){
  15768. if (!Request.prototype.check.call(this, options)) return this;
  15769. this.running = true;
  15770. var type = typeOf(options);
  15771. if (type == 'string' || type == 'element') options = {data: options};
  15772. options = Object.merge(this.options, options || {});
  15773. var data = options.data;
  15774. switch (typeOf(data)){
  15775. case 'element': data = document.id(data).toQueryString(); break;
  15776. case 'object': case 'hash': data = Object.toQueryString(data);
  15777. }
  15778. var index = this.index = Request.JSONP.counter++,
  15779. key = 'request_' + index;
  15780. var src = options.url +
  15781. (options.url.test('\\?') ? '&' :'?') +
  15782. (options.callbackKey) +
  15783. '=Request.JSONP.request_map.request_'+ index +
  15784. (data ? '&' + data : '');
  15785. if (src.length > 2083) this.fireEvent('error', src);
  15786. Request.JSONP.request_map[key] = function(){
  15787. delete Request.JSONP.request_map[key];
  15788. this.success(arguments, index);
  15789. }.bind(this);
  15790. var script = this.getScript(src).inject(options.injectScript);
  15791. this.fireEvent('request', [src, script]);
  15792. if (options.timeout) this.timeout.delay(options.timeout, this);
  15793. return this;
  15794. },
  15795. getScript: function(src){
  15796. if (!this.script) this.script = new Element('script', {
  15797. type: 'text/javascript',
  15798. async: true,
  15799. src: src
  15800. });
  15801. return this.script;
  15802. },
  15803. success: function(args){
  15804. if (!this.running) return;
  15805. this.clear()
  15806. .fireEvent('complete', args).fireEvent('success', args)
  15807. .callChain();
  15808. },
  15809. cancel: function(){
  15810. if (this.running) this.clear().fireEvent('cancel');
  15811. return this;
  15812. },
  15813. isRunning: function(){
  15814. return !!this.running;
  15815. },
  15816. clear: function(){
  15817. this.running = false;
  15818. if (this.script){
  15819. this.script.destroy();
  15820. this.script = null;
  15821. }
  15822. return this;
  15823. },
  15824. timeout: function(){
  15825. if (this.running){
  15826. this.running = false;
  15827. this.fireEvent('timeout', [this.script.get('src'), this.script]).fireEvent('failure').cancel();
  15828. }
  15829. return this;
  15830. }
  15831. });
  15832. Request.JSONP.counter = 0;
  15833. Request.JSONP.request_map = {};
  15834. /*
  15835. ---
  15836. script: Request.Periodical.js
  15837. name: Request.Periodical
  15838. description: Requests the same URL to pull data from a server but increases the intervals if no data is returned to reduce the load
  15839. license: MIT-style license
  15840. authors:
  15841. - Christoph Pojer
  15842. requires:
  15843. - Core/Request
  15844. - MooTools.More
  15845. provides: [Request.Periodical]
  15846. ...
  15847. */
  15848. Request.implement({
  15849. options: {
  15850. initialDelay: 5000,
  15851. delay: 5000,
  15852. limit: 60000
  15853. },
  15854. startTimer: function(data){
  15855. var fn = function(){
  15856. if (!this.running) this.send({data: data});
  15857. };
  15858. this.lastDelay = this.options.initialDelay;
  15859. this.timer = fn.delay(this.lastDelay, this);
  15860. this.completeCheck = function(response){
  15861. clearTimeout(this.timer);
  15862. this.lastDelay = (response) ? this.options.delay : (this.lastDelay + this.options.delay).min(this.options.limit);
  15863. this.timer = fn.delay(this.lastDelay, this);
  15864. };
  15865. return this.addEvent('complete', this.completeCheck);
  15866. },
  15867. stopTimer: function(){
  15868. clearTimeout(this.timer);
  15869. return this.removeEvent('complete', this.completeCheck);
  15870. }
  15871. });
  15872. /*
  15873. ---
  15874. script: Request.Queue.js
  15875. name: Request.Queue
  15876. description: Controls several instances of Request and its variants to run only one request at a time.
  15877. license: MIT-style license
  15878. authors:
  15879. - Aaron Newton
  15880. requires:
  15881. - Core/Element
  15882. - Core/Request
  15883. - Class.Binds
  15884. provides: [Request.Queue]
  15885. ...
  15886. */
  15887. Request.Queue = new Class({
  15888. Implements: [Options, Events],
  15889. Binds: ['attach', 'request', 'complete', 'cancel', 'success', 'failure', 'exception'],
  15890. options: {/*
  15891. onRequest: function(argsPassedToOnRequest){},
  15892. onSuccess: function(argsPassedToOnSuccess){},
  15893. onComplete: function(argsPassedToOnComplete){},
  15894. onCancel: function(argsPassedToOnCancel){},
  15895. onException: function(argsPassedToOnException){},
  15896. onFailure: function(argsPassedToOnFailure){},
  15897. onEnd: function(){},
  15898. */
  15899. stopOnFailure: true,
  15900. autoAdvance: true,
  15901. concurrent: 1,
  15902. requests: {}
  15903. },
  15904. initialize: function(options){
  15905. var requests;
  15906. if (options){
  15907. requests = options.requests;
  15908. delete options.requests;
  15909. }
  15910. this.setOptions(options);
  15911. this.requests = {};
  15912. this.queue = [];
  15913. this.reqBinders = {};
  15914. if (requests) this.addRequests(requests);
  15915. },
  15916. addRequest: function(name, request){
  15917. this.requests[name] = request;
  15918. this.attach(name, request);
  15919. return this;
  15920. },
  15921. addRequests: function(obj){
  15922. Object.each(obj, function(req, name){
  15923. this.addRequest(name, req);
  15924. }, this);
  15925. return this;
  15926. },
  15927. getName: function(req){
  15928. return Object.keyOf(this.requests, req);
  15929. },
  15930. attach: function(name, req){
  15931. if (req._groupSend) return this;
  15932. ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){
  15933. if (!this.reqBinders[name]) this.reqBinders[name] = {};
  15934. this.reqBinders[name][evt] = function(){
  15935. this['on' + evt.capitalize()].apply(this, [name, req].append(arguments));
  15936. }.bind(this);
  15937. req.addEvent(evt, this.reqBinders[name][evt]);
  15938. }, this);
  15939. req._groupSend = req.send;
  15940. req.send = function(options){
  15941. this.send(name, options);
  15942. return req;
  15943. }.bind(this);
  15944. return this;
  15945. },
  15946. removeRequest: function(req){
  15947. var name = typeOf(req) == 'object' ? this.getName(req) : req;
  15948. if (!name && typeOf(name) != 'string') return this;
  15949. req = this.requests[name];
  15950. if (!req) return this;
  15951. ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){
  15952. req.removeEvent(evt, this.reqBinders[name][evt]);
  15953. }, this);
  15954. req.send = req._groupSend;
  15955. delete req._groupSend;
  15956. return this;
  15957. },
  15958. getRunning: function(){
  15959. return Object.filter(this.requests, function(r){
  15960. return r.running;
  15961. });
  15962. },
  15963. isRunning: function(){
  15964. return !!(Object.keys(this.getRunning()).length);
  15965. },
  15966. send: function(name, options){
  15967. var q = function(){
  15968. this.requests[name]._groupSend(options);
  15969. this.queue.erase(q);
  15970. }.bind(this);
  15971. q.name = name;
  15972. if (Object.keys(this.getRunning()).length >= this.options.concurrent || (this.error && this.options.stopOnFailure)) this.queue.push(q);
  15973. else q();
  15974. return this;
  15975. },
  15976. hasNext: function(name){
  15977. return (!name) ? !!this.queue.length : !!this.queue.filter(function(q){ return q.name == name; }).length;
  15978. },
  15979. resume: function(){
  15980. this.error = false;
  15981. (this.options.concurrent - Object.keys(this.getRunning()).length).times(this.runNext, this);
  15982. return this;
  15983. },
  15984. runNext: function(name){
  15985. if (!this.queue.length) return this;
  15986. if (!name){
  15987. this.queue[0]();
  15988. } else {
  15989. var found;
  15990. this.queue.each(function(q){
  15991. if (!found && q.name == name){
  15992. found = true;
  15993. q();
  15994. }
  15995. });
  15996. }
  15997. return this;
  15998. },
  15999. runAll: function(){
  16000. this.queue.each(function(q){
  16001. q();
  16002. });
  16003. return this;
  16004. },
  16005. clear: function(name){
  16006. if (!name){
  16007. this.queue.empty();
  16008. } else {
  16009. this.queue = this.queue.map(function(q){
  16010. if (q.name != name) return q;
  16011. else return false;
  16012. }).filter(function(q){
  16013. return q;
  16014. });
  16015. }
  16016. return this;
  16017. },
  16018. cancel: function(name){
  16019. this.requests[name].cancel();
  16020. return this;
  16021. },
  16022. onRequest: function(){
  16023. this.fireEvent('request', arguments);
  16024. },
  16025. onComplete: function(){
  16026. this.fireEvent('complete', arguments);
  16027. if (!this.queue.length) this.fireEvent('end');
  16028. },
  16029. onCancel: function(){
  16030. if (this.options.autoAdvance && !this.error) this.runNext();
  16031. this.fireEvent('cancel', arguments);
  16032. },
  16033. onSuccess: function(){
  16034. if (this.options.autoAdvance && !this.error) this.runNext();
  16035. this.fireEvent('success', arguments);
  16036. },
  16037. onFailure: function(){
  16038. this.error = true;
  16039. if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext();
  16040. this.fireEvent('failure', arguments);
  16041. },
  16042. onException: function(){
  16043. this.error = true;
  16044. if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext();
  16045. this.fireEvent('exception', arguments);
  16046. }
  16047. });
  16048. /*
  16049. ---
  16050. script: Array.Extras.js
  16051. name: Array.Extras
  16052. description: Extends the Array native object to include useful methods to work with arrays.
  16053. license: MIT-style license
  16054. authors:
  16055. - Christoph Pojer
  16056. - Sebastian Markbåge
  16057. requires:
  16058. - Core/Array
  16059. - MooTools.More
  16060. provides: [Array.Extras]
  16061. ...
  16062. */
  16063. (function(nil){
  16064. Array.implement({
  16065. min: function(){
  16066. return Math.min.apply(null, this);
  16067. },
  16068. max: function(){
  16069. return Math.max.apply(null, this);
  16070. },
  16071. average: function(){
  16072. return this.length ? this.sum() / this.length : 0;
  16073. },
  16074. sum: function(){
  16075. var result = 0, l = this.length;
  16076. if (l){
  16077. while (l--){
  16078. if (this[l] != null) result += parseFloat(this[l]);
  16079. }
  16080. }
  16081. return result;
  16082. },
  16083. unique: function(){
  16084. return [].combine(this);
  16085. },
  16086. shuffle: function(){
  16087. for (var i = this.length; i && --i;){
  16088. var temp = this[i], r = Math.floor(Math.random() * ( i + 1 ));
  16089. this[i] = this[r];
  16090. this[r] = temp;
  16091. }
  16092. return this;
  16093. },
  16094. reduce: function(fn, value){
  16095. for (var i = 0, l = this.length; i < l; i++){
  16096. if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this);
  16097. }
  16098. return value;
  16099. },
  16100. reduceRight: function(fn, value){
  16101. var i = this.length;
  16102. while (i--){
  16103. if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this);
  16104. }
  16105. return value;
  16106. },
  16107. pluck: function(prop){
  16108. return this.map(function(item){
  16109. return item[prop];
  16110. });
  16111. }
  16112. });
  16113. })();
  16114. /*
  16115. ---
  16116. script: Date.Extras.js
  16117. name: Date.Extras
  16118. description: Extends the Date native object to include extra methods (on top of those in Date.js).
  16119. license: MIT-style license
  16120. authors:
  16121. - Aaron Newton
  16122. - Scott Kyle
  16123. requires:
  16124. - Date
  16125. provides: [Date.Extras]
  16126. ...
  16127. */
  16128. Date.implement({
  16129. timeDiffInWords: function(to){
  16130. return Date.distanceOfTimeInWords(this, to || new Date);
  16131. },
  16132. timeDiff: function(to, separator){
  16133. if (to == null) to = new Date;
  16134. var delta = ((to - this) / 1000).floor().abs();
  16135. var vals = [],
  16136. durations = [60, 60, 24, 365, 0],
  16137. names = ['s', 'm', 'h', 'd', 'y'],
  16138. value, duration;
  16139. for (var item = 0; item < durations.length; item++){
  16140. if (item && !delta) break;
  16141. value = delta;
  16142. if ((duration = durations[item])){
  16143. value = (delta % duration);
  16144. delta = (delta / duration).floor();
  16145. }
  16146. vals.unshift(value + (names[item] || ''));
  16147. }
  16148. return vals.join(separator || ':');
  16149. }
  16150. }).extend({
  16151. distanceOfTimeInWords: function(from, to){
  16152. return Date.getTimePhrase(((to - from) / 1000).toInt());
  16153. },
  16154. getTimePhrase: function(delta){
  16155. var suffix = (delta < 0) ? 'Until' : 'Ago';
  16156. if (delta < 0) delta *= -1;
  16157. var units = {
  16158. minute: 60,
  16159. hour: 60,
  16160. day: 24,
  16161. week: 7,
  16162. month: 52 / 12,
  16163. year: 12,
  16164. eon: Infinity
  16165. };
  16166. var msg = 'lessThanMinute';
  16167. for (var unit in units){
  16168. var interval = units[unit];
  16169. if (delta < 1.5 * interval){
  16170. if (delta > 0.75 * interval) msg = unit;
  16171. break;
  16172. }
  16173. delta /= interval;
  16174. msg = unit + 's';
  16175. }
  16176. delta = delta.round();
  16177. return Date.getMsg(msg + suffix, delta).substitute({delta: delta});
  16178. }
  16179. }).defineParsers(
  16180. {
  16181. // "today", "tomorrow", "yesterday"
  16182. re: /^(?:tod|tom|yes)/i,
  16183. handler: function(bits){
  16184. var d = new Date().clearTime();
  16185. switch (bits[0]){
  16186. case 'tom': return d.increment();
  16187. case 'yes': return d.decrement();
  16188. default: return d;
  16189. }
  16190. }
  16191. },
  16192. {
  16193. // "next Wednesday", "last Thursday"
  16194. re: /^(next|last) ([a-z]+)$/i,
  16195. handler: function(bits){
  16196. var d = new Date().clearTime();
  16197. var day = d.getDay();
  16198. var newDay = Date.parseDay(bits[2], true);
  16199. var addDays = newDay - day;
  16200. if (newDay <= day) addDays += 7;
  16201. if (bits[1] == 'last') addDays -= 7;
  16202. return d.set('date', d.getDate() + addDays);
  16203. }
  16204. }
  16205. ).alias('timeAgoInWords', 'timeDiffInWords');
  16206. /*
  16207. ---
  16208. name: Hash
  16209. description: Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects.
  16210. license: MIT-style license.
  16211. requires:
  16212. - Core/Object
  16213. - MooTools.More
  16214. provides: [Hash]
  16215. ...
  16216. */
  16217. (function(){
  16218. if (this.Hash) return;
  16219. var Hash = this.Hash = new Type('Hash', function(object){
  16220. if (typeOf(object) == 'hash') object = Object.clone(object.getClean());
  16221. for (var key in object) this[key] = object[key];
  16222. return this;
  16223. });
  16224. this.$H = function(object){
  16225. return new Hash(object);
  16226. };
  16227. Hash.implement({
  16228. forEach: function(fn, bind){
  16229. Object.forEach(this, fn, bind);
  16230. },
  16231. getClean: function(){
  16232. var clean = {};
  16233. for (var key in this){
  16234. if (this.hasOwnProperty(key)) clean[key] = this[key];
  16235. }
  16236. return clean;
  16237. },
  16238. getLength: function(){
  16239. var length = 0;
  16240. for (var key in this){
  16241. if (this.hasOwnProperty(key)) length++;
  16242. }
  16243. return length;
  16244. }
  16245. });
  16246. Hash.alias('each', 'forEach');
  16247. Hash.implement({
  16248. has: Object.prototype.hasOwnProperty,
  16249. keyOf: function(value){
  16250. return Object.keyOf(this, value);
  16251. },
  16252. hasValue: function(value){
  16253. return Object.contains(this, value);
  16254. },
  16255. extend: function(properties){
  16256. Hash.each(properties || {}, function(value, key){
  16257. Hash.set(this, key, value);
  16258. }, this);
  16259. return this;
  16260. },
  16261. combine: function(properties){
  16262. Hash.each(properties || {}, function(value, key){
  16263. Hash.include(this, key, value);
  16264. }, this);
  16265. return this;
  16266. },
  16267. erase: function(key){
  16268. if (this.hasOwnProperty(key)) delete this[key];
  16269. return this;
  16270. },
  16271. get: function(key){
  16272. return (this.hasOwnProperty(key)) ? this[key] : null;
  16273. },
  16274. set: function(key, value){
  16275. if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
  16276. return this;
  16277. },
  16278. empty: function(){
  16279. Hash.each(this, function(value, key){
  16280. delete this[key];
  16281. }, this);
  16282. return this;
  16283. },
  16284. include: function(key, value){
  16285. if (this[key] == undefined) this[key] = value;
  16286. return this;
  16287. },
  16288. map: function(fn, bind){
  16289. return new Hash(Object.map(this, fn, bind));
  16290. },
  16291. filter: function(fn, bind){
  16292. return new Hash(Object.filter(this, fn, bind));
  16293. },
  16294. every: function(fn, bind){
  16295. return Object.every(this, fn, bind);
  16296. },
  16297. some: function(fn, bind){
  16298. return Object.some(this, fn, bind);
  16299. },
  16300. getKeys: function(){
  16301. return Object.keys(this);
  16302. },
  16303. getValues: function(){
  16304. return Object.values(this);
  16305. },
  16306. toQueryString: function(base){
  16307. return Object.toQueryString(this, base);
  16308. }
  16309. });
  16310. Hash.alias({indexOf: 'keyOf', contains: 'hasValue'});
  16311. })();
  16312. /*
  16313. ---
  16314. script: Hash.Extras.js
  16315. name: Hash.Extras
  16316. description: Extends the Hash Type to include getFromPath which allows a path notation to child elements.
  16317. license: MIT-style license
  16318. authors:
  16319. - Aaron Newton
  16320. requires:
  16321. - Hash
  16322. - Object.Extras
  16323. provides: [Hash.Extras]
  16324. ...
  16325. */
  16326. Hash.implement({
  16327. getFromPath: function(notation){
  16328. return Object.getFromPath(this, notation);
  16329. },
  16330. cleanValues: function(method){
  16331. return new Hash(Object.cleanValues(this, method));
  16332. },
  16333. run: function(){
  16334. Object.run(arguments);
  16335. }
  16336. });
  16337. /*
  16338. ---
  16339. name: Number.Format
  16340. description: Extends the Number Type object to include a number formatting method.
  16341. license: MIT-style license
  16342. authors: [Arian Stolwijk]
  16343. requires: [Core/Number, Locale.en-US.Number]
  16344. # Number.Extras is for compatibility
  16345. provides: [Number.Format, Number.Extras]
  16346. ...
  16347. */
  16348. Number.implement({
  16349. format: function(options){
  16350. // Thanks dojo and YUI for some inspiration
  16351. var value = this;
  16352. options = options ? Object.clone(options) : {};
  16353. var getOption = function(key){
  16354. if (options[key] != null) return options[key];
  16355. return Locale.get('Number.' + key);
  16356. };
  16357. var negative = value < 0,
  16358. decimal = getOption('decimal'),
  16359. precision = getOption('precision'),
  16360. group = getOption('group'),
  16361. decimals = getOption('decimals');
  16362. if (negative){
  16363. var negativeLocale = getOption('negative') || {};
  16364. if (negativeLocale.prefix == null && negativeLocale.suffix == null) negativeLocale.prefix = '-';
  16365. ['prefix', 'suffix'].each(function(key){
  16366. if (negativeLocale[key]) options[key] = getOption(key) + negativeLocale[key];
  16367. });
  16368. value = -value;
  16369. }
  16370. var prefix = getOption('prefix'),
  16371. suffix = getOption('suffix');
  16372. if (decimals !== '' && decimals >= 0 && decimals <= 20) value = value.toFixed(decimals);
  16373. if (precision >= 1 && precision <= 21) value = (+value).toPrecision(precision);
  16374. value += '';
  16375. var index;
  16376. if (getOption('scientific') === false && value.indexOf('e') > -1){
  16377. var match = value.split('e'),
  16378. zeros = +match[1];
  16379. value = match[0].replace('.', '');
  16380. if (zeros < 0){
  16381. zeros = -zeros - 1;
  16382. index = match[0].indexOf('.');
  16383. if (index > -1) zeros -= index - 1;
  16384. while (zeros--) value = '0' + value;
  16385. value = '0.' + value;
  16386. } else {
  16387. index = match[0].lastIndexOf('.');
  16388. if (index > -1) zeros -= match[0].length - index - 1;
  16389. while (zeros--) value += '0';
  16390. }
  16391. }
  16392. if (decimal != '.') value = value.replace('.', decimal);
  16393. if (group){
  16394. index = value.lastIndexOf(decimal);
  16395. index = (index > -1) ? index : value.length;
  16396. var newOutput = value.substring(index),
  16397. i = index;
  16398. while (i--){
  16399. if ((index - i - 1) % 3 == 0 && i != (index - 1)) newOutput = group + newOutput;
  16400. newOutput = value.charAt(i) + newOutput;
  16401. }
  16402. value = newOutput;
  16403. }
  16404. if (prefix) value = prefix + value;
  16405. if (suffix) value += suffix;
  16406. return value;
  16407. },
  16408. formatCurrency: function(decimals){
  16409. var locale = Locale.get('Number.currency') || {};
  16410. if (locale.scientific == null) locale.scientific = false;
  16411. locale.decimals = decimals != null ? decimals
  16412. : (locale.decimals == null ? 2 : locale.decimals);
  16413. return this.format(locale);
  16414. },
  16415. formatPercentage: function(decimals){
  16416. var locale = Locale.get('Number.percentage') || {};
  16417. if (locale.suffix == null) locale.suffix = '%';
  16418. locale.decimals = decimals != null ? decimals
  16419. : (locale.decimals == null ? 2 : locale.decimals);
  16420. return this.format(locale);
  16421. }
  16422. });
  16423. /*
  16424. ---
  16425. script: URI.js
  16426. name: URI
  16427. description: Provides methods useful in managing the window location and uris.
  16428. license: MIT-style license
  16429. authors:
  16430. - Sebastian Markbåge
  16431. - Aaron Newton
  16432. requires:
  16433. - Core/Object
  16434. - Core/Class
  16435. - Core/Class.Extras
  16436. - Core/Element
  16437. - String.QueryString
  16438. provides: [URI]
  16439. ...
  16440. */
  16441. (function(){
  16442. var toString = function(){
  16443. return this.get('value');
  16444. };
  16445. var URI = this.URI = new Class({
  16446. Implements: Options,
  16447. options: {
  16448. /*base: false*/
  16449. },
  16450. regex: /^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[A-Fa-f0-9:]+\]|[^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,
  16451. parts: ['scheme', 'user', 'password', 'host', 'port', 'directory', 'file', 'query', 'fragment'],
  16452. schemes: {http: 80, https: 443, ftp: 21, rtsp: 554, mms: 1755, file: 0},
  16453. initialize: function(uri, options){
  16454. this.setOptions(options);
  16455. var base = this.options.base || URI.base;
  16456. if (!uri) uri = base;
  16457. if (uri && uri.parsed) this.parsed = Object.clone(uri.parsed);
  16458. else this.set('value', uri.href || uri.toString(), base ? new URI(base) : false);
  16459. },
  16460. parse: function(value, base){
  16461. var bits = value.match(this.regex);
  16462. if (!bits) return false;
  16463. bits.shift();
  16464. return this.merge(bits.associate(this.parts), base);
  16465. },
  16466. merge: function(bits, base){
  16467. if ((!bits || !bits.scheme) && (!base || !base.scheme)) return false;
  16468. if (base){
  16469. this.parts.every(function(part){
  16470. if (bits[part]) return false;
  16471. bits[part] = base[part] || '';
  16472. return true;
  16473. });
  16474. }
  16475. bits.port = bits.port || this.schemes[bits.scheme.toLowerCase()];
  16476. bits.directory = bits.directory ? this.parseDirectory(bits.directory, base ? base.directory : '') : '/';
  16477. return bits;
  16478. },
  16479. parseDirectory: function(directory, baseDirectory){
  16480. directory = (directory.substr(0, 1) == '/' ? '' : (baseDirectory || '/')) + directory;
  16481. if (!directory.test(URI.regs.directoryDot)) return directory;
  16482. var result = [];
  16483. directory.replace(URI.regs.endSlash, '').split('/').each(function(dir){
  16484. if (dir == '..' && result.length > 0) result.pop();
  16485. else if (dir != '.') result.push(dir);
  16486. });
  16487. return result.join('/') + '/';
  16488. },
  16489. combine: function(bits){
  16490. return bits.value || bits.scheme + '://' +
  16491. (bits.user ? bits.user + (bits.password ? ':' + bits.password : '') + '@' : '') +
  16492. (bits.host || '') + (bits.port && bits.port != this.schemes[bits.scheme] ? ':' + bits.port : '') +
  16493. (bits.directory || '/') + (bits.file || '') +
  16494. (bits.query ? '?' + bits.query : '') +
  16495. (bits.fragment ? '#' + bits.fragment : '');
  16496. },
  16497. set: function(part, value, base){
  16498. if (part == 'value'){
  16499. var scheme = value.match(URI.regs.scheme);
  16500. if (scheme) scheme = scheme[1];
  16501. if (scheme && this.schemes[scheme.toLowerCase()] == null) this.parsed = { scheme: scheme, value: value };
  16502. else this.parsed = this.parse(value, (base || this).parsed) || (scheme ? { scheme: scheme, value: value } : { value: value });
  16503. } else if (part == 'data'){
  16504. this.setData(value);
  16505. } else {
  16506. this.parsed[part] = value;
  16507. }
  16508. return this;
  16509. },
  16510. get: function(part, base){
  16511. switch (part){
  16512. case 'value': return this.combine(this.parsed, base ? base.parsed : false);
  16513. case 'data' : return this.getData();
  16514. }
  16515. return this.parsed[part] || '';
  16516. },
  16517. go: function(){
  16518. document.location.href = this.toString();
  16519. },
  16520. toURI: function(){
  16521. return this;
  16522. },
  16523. getData: function(key, part){
  16524. var qs = this.get(part || 'query');
  16525. if (!(qs || qs === 0)) return key ? null : {};
  16526. var obj = qs.parseQueryString();
  16527. return key ? obj[key] : obj;
  16528. },
  16529. setData: function(values, merge, part){
  16530. if (typeof values == 'string'){
  16531. var data = this.getData();
  16532. data[arguments[0]] = arguments[1];
  16533. values = data;
  16534. } else if (merge){
  16535. values = Object.merge(this.getData(null, part), values);
  16536. }
  16537. return this.set(part || 'query', Object.toQueryString(values));
  16538. },
  16539. clearData: function(part){
  16540. return this.set(part || 'query', '');
  16541. },
  16542. toString: toString,
  16543. valueOf: toString
  16544. });
  16545. URI.regs = {
  16546. endSlash: /\/$/,
  16547. scheme: /^(\w+):/,
  16548. directoryDot: /\.\/|\.$/
  16549. };
  16550. URI.base = new URI(Array.convert(document.getElements('base[href]', true)).getLast(), {base: document.location});
  16551. String.implement({
  16552. toURI: function(options){
  16553. return new URI(this, options);
  16554. }
  16555. });
  16556. })();
  16557. /*
  16558. ---
  16559. script: URI.Relative.js
  16560. name: URI.Relative
  16561. description: Extends the URI class to add methods for computing relative and absolute urls.
  16562. license: MIT-style license
  16563. authors:
  16564. - Sebastian Markbåge
  16565. requires:
  16566. - Class.refactor
  16567. - URI
  16568. provides: [URI.Relative]
  16569. ...
  16570. */
  16571. URI = Class.refactor(URI, {
  16572. combine: function(bits, base){
  16573. if (!base || bits.scheme != base.scheme || bits.host != base.host || bits.port != base.port)
  16574. return this.previous.apply(this, arguments);
  16575. var end = bits.file + (bits.query ? '?' + bits.query : '') + (bits.fragment ? '#' + bits.fragment : '');
  16576. if (!base.directory) return (bits.directory || (bits.file ? '' : './')) + end;
  16577. var baseDir = base.directory.split('/'),
  16578. relDir = bits.directory.split('/'),
  16579. path = '',
  16580. offset;
  16581. var i = 0;
  16582. for (offset = 0; offset < baseDir.length && offset < relDir.length && baseDir[offset] == relDir[offset]; offset++);
  16583. for (i = 0; i < baseDir.length - offset - 1; i++) path += '../';
  16584. for (i = offset; i < relDir.length - 1; i++) path += relDir[i] + '/';
  16585. return (path || (bits.file ? '' : './')) + end;
  16586. },
  16587. toAbsolute: function(base){
  16588. base = new URI(base);
  16589. if (base) base.set('directory', '').set('file', '');
  16590. return this.toRelative(base);
  16591. },
  16592. toRelative: function(base){
  16593. return this.get('value', new URI(base));
  16594. }
  16595. });
  16596. /*
  16597. ---
  16598. script: Assets.js
  16599. name: Assets
  16600. description: Provides methods to dynamically load JavaScript, CSS, and Image files into the document.
  16601. license: MIT-style license
  16602. authors:
  16603. - Valerio Proietti
  16604. requires:
  16605. - Core/Element.Event
  16606. - MooTools.More
  16607. provides: [Assets, Asset.javascript, Asset.css, Asset.image, Asset.images]
  16608. ...
  16609. */
  16610. ;(function(){
  16611. var Asset = this.Asset = {
  16612. javascript: function(source, properties){
  16613. if (!properties) properties = {};
  16614. var script = new Element('script', {src: source, type: 'text/javascript'}),
  16615. doc = properties.document || document,
  16616. load = properties.onload || properties.onLoad;
  16617. delete properties.onload;
  16618. delete properties.onLoad;
  16619. delete properties.document;
  16620. if (load){
  16621. if (!script.addEventListener){
  16622. script.addEvent('readystatechange', function(){
  16623. if (['loaded', 'complete'].contains(this.readyState)) load.call(this);
  16624. });
  16625. } else {
  16626. script.addEvent('load', load);
  16627. }
  16628. }
  16629. return script.set(properties).inject(doc.head);
  16630. },
  16631. css: function(source, properties){
  16632. if (!properties) properties = {};
  16633. var load = properties.onload || properties.onLoad,
  16634. doc = properties.document || document,
  16635. timeout = properties.timeout || 3000;
  16636. ['onload', 'onLoad', 'document'].each(function(prop){
  16637. delete properties[prop];
  16638. });
  16639. var link = new Element('link', {
  16640. type: 'text/css',
  16641. rel: 'stylesheet',
  16642. media: 'screen',
  16643. href: source
  16644. }).setProperties(properties).inject(doc.head);
  16645. if (load){
  16646. // based on article at http://www.yearofmoo.com/2011/03/cross-browser-stylesheet-preloading.html
  16647. var loaded = false, retries = 0;
  16648. var check = function(){
  16649. var stylesheets = document.styleSheets;
  16650. for (var i = 0; i < stylesheets.length; i++){
  16651. var file = stylesheets[i];
  16652. var owner = file.ownerNode ? file.ownerNode : file.owningElement;
  16653. if (owner && owner == link){
  16654. loaded = true;
  16655. return load.call(link);
  16656. }
  16657. }
  16658. retries++;
  16659. if (!loaded && retries < timeout / 50) return setTimeout(check, 50);
  16660. };
  16661. setTimeout(check, 0);
  16662. }
  16663. return link;
  16664. },
  16665. image: function(source, properties){
  16666. if (!properties) properties = {};
  16667. var image = new Image(),
  16668. element = document.id(image) || new Element('img');
  16669. ['load', 'abort', 'error'].each(function(name){
  16670. var type = 'on' + name,
  16671. cap = 'on' + name.capitalize(),
  16672. event = properties[type] || properties[cap] || function(){};
  16673. delete properties[cap];
  16674. delete properties[type];
  16675. image[type] = function(){
  16676. if (!image) return;
  16677. if (!element.parentNode){
  16678. element.width = image.width;
  16679. element.height = image.height;
  16680. }
  16681. image = image.onload = image.onabort = image.onerror = null;
  16682. event.delay(1, element, element);
  16683. element.fireEvent(name, element, 1);
  16684. };
  16685. });
  16686. image.src = element.src = source;
  16687. if (image && image.complete) image.onload.delay(1);
  16688. return element.set(properties);
  16689. },
  16690. images: function(sources, options){
  16691. sources = Array.convert(sources);
  16692. var fn = function(){},
  16693. counter = 0;
  16694. options = Object.merge({
  16695. onComplete: fn,
  16696. onProgress: fn,
  16697. onError: fn,
  16698. properties: {}
  16699. }, options);
  16700. return new Elements(sources.map(function(source, index){
  16701. return Asset.image(source, Object.append(options.properties, {
  16702. onload: function(){
  16703. counter++;
  16704. options.onProgress.call(this, counter, index, source);
  16705. if (counter == sources.length) options.onComplete();
  16706. },
  16707. onerror: function(){
  16708. counter++;
  16709. options.onError.call(this, counter, index, source);
  16710. if (counter == sources.length) options.onComplete();
  16711. }
  16712. }));
  16713. }));
  16714. }
  16715. };
  16716. })();
  16717. /*
  16718. ---
  16719. script: Color.js
  16720. name: Color
  16721. description: Class for creating and manipulating colors in JavaScript. Supports HSB -> RGB Conversions and vice versa.
  16722. license: MIT-style license
  16723. authors:
  16724. - Valerio Proietti
  16725. requires:
  16726. - Core/Array
  16727. - Core/String
  16728. - Core/Number
  16729. - Core/Hash
  16730. - Core/Function
  16731. - MooTools.More
  16732. provides: [Color]
  16733. ...
  16734. */
  16735. (function(){
  16736. var Color = this.Color = new Type('Color', function(color, type){
  16737. if (arguments.length >= 3){
  16738. type = 'rgb'; color = Array.slice(arguments, 0, 3);
  16739. } else if (typeof color == 'string'){
  16740. if (color.match(/rgb/)) color = color.rgbToHex().hexToRgb(true);
  16741. else if (color.match(/hsb/)) color = color.hsbToRgb();
  16742. else color = color.hexToRgb(true);
  16743. }
  16744. type = type || 'rgb';
  16745. switch (type){
  16746. case 'hsb':
  16747. var old = color;
  16748. color = color.hsbToRgb();
  16749. color.hsb = old;
  16750. break;
  16751. case 'hex': color = color.hexToRgb(true); break;
  16752. }
  16753. color.rgb = color.slice(0, 3);
  16754. color.hsb = color.hsb || color.rgbToHsb();
  16755. color.hex = color.rgbToHex();
  16756. return Object.append(color, this);
  16757. });
  16758. Color.implement({
  16759. mix: function(){
  16760. var colors = Array.slice(arguments);
  16761. var alpha = (typeOf(colors.getLast()) == 'number') ? colors.pop() : 50;
  16762. var rgb = this.slice();
  16763. colors.each(function(color){
  16764. color = new Color(color);
  16765. for (var i = 0; i < 3; i++) rgb[i] = Math.round((rgb[i] / 100 * (100 - alpha)) + (color[i] / 100 * alpha));
  16766. });
  16767. return new Color(rgb, 'rgb');
  16768. },
  16769. invert: function(){
  16770. return new Color(this.map(function(value){
  16771. return 255 - value;
  16772. }));
  16773. },
  16774. setHue: function(value){
  16775. return new Color([value, this.hsb[1], this.hsb[2]], 'hsb');
  16776. },
  16777. setSaturation: function(percent){
  16778. return new Color([this.hsb[0], percent, this.hsb[2]], 'hsb');
  16779. },
  16780. setBrightness: function(percent){
  16781. return new Color([this.hsb[0], this.hsb[1], percent], 'hsb');
  16782. }
  16783. });
  16784. this.$RGB = function(r, g, b){
  16785. return new Color([r, g, b], 'rgb');
  16786. };
  16787. this.$HSB = function(h, s, b){
  16788. return new Color([h, s, b], 'hsb');
  16789. };
  16790. this.$HEX = function(hex){
  16791. return new Color(hex, 'hex');
  16792. };
  16793. Array.implement({
  16794. rgbToHsb: function(){
  16795. var red = this[0],
  16796. green = this[1],
  16797. blue = this[2],
  16798. hue = 0,
  16799. max = Math.max(red, green, blue),
  16800. min = Math.min(red, green, blue),
  16801. delta = max - min,
  16802. brightness = max / 255,
  16803. saturation = (max != 0) ? delta / max : 0;
  16804. if (saturation != 0){
  16805. var rr = (max - red) / delta;
  16806. var gr = (max - green) / delta;
  16807. var br = (max - blue) / delta;
  16808. if (red == max) hue = br - gr;
  16809. else if (green == max) hue = 2 + rr - br;
  16810. else hue = 4 + gr - rr;
  16811. hue /= 6;
  16812. if (hue < 0) hue++;
  16813. }
  16814. return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)];
  16815. },
  16816. hsbToRgb: function(){
  16817. var br = Math.round(this[2] / 100 * 255);
  16818. if (this[1] == 0){
  16819. return [br, br, br];
  16820. } else {
  16821. var hue = this[0] % 360;
  16822. var f = hue % 60;
  16823. var p = Math.round((this[2] * (100 - this[1])) / 10000 * 255);
  16824. var q = Math.round((this[2] * (6000 - this[1] * f)) / 600000 * 255);
  16825. var t = Math.round((this[2] * (6000 - this[1] * (60 - f))) / 600000 * 255);
  16826. switch (Math.floor(hue / 60)){
  16827. case 0: return [br, t, p];
  16828. case 1: return [q, br, p];
  16829. case 2: return [p, br, t];
  16830. case 3: return [p, q, br];
  16831. case 4: return [t, p, br];
  16832. case 5: return [br, p, q];
  16833. }
  16834. }
  16835. return false;
  16836. }
  16837. });
  16838. String.implement({
  16839. rgbToHsb: function(){
  16840. var rgb = this.match(/\d{1,3}/g);
  16841. return (rgb) ? rgb.rgbToHsb() : null;
  16842. },
  16843. hsbToRgb: function(){
  16844. var hsb = this.match(/\d{1,3}/g);
  16845. return (hsb) ? hsb.hsbToRgb() : null;
  16846. }
  16847. });
  16848. })();
  16849. /*
  16850. ---
  16851. script: Group.js
  16852. name: Group
  16853. description: Class for monitoring collections of events
  16854. license: MIT-style license
  16855. authors:
  16856. - Valerio Proietti
  16857. requires:
  16858. - Core/Events
  16859. - MooTools.More
  16860. provides: [Group]
  16861. ...
  16862. */
  16863. (function(){
  16864. var Group = this.Group = new Class({
  16865. initialize: function(){
  16866. this.instances = Array.flatten(arguments);
  16867. },
  16868. addEvent: function(type, fn){
  16869. var instances = this.instances,
  16870. len = instances.length,
  16871. togo = len,
  16872. args = new Array(len),
  16873. self = this;
  16874. instances.each(function(instance, i){
  16875. instance.addEvent(type, function(){
  16876. if (!args[i]) togo--;
  16877. args[i] = arguments;
  16878. if (!togo){
  16879. fn.call(self, instances, instance, args);
  16880. togo = len;
  16881. args = new Array(len);
  16882. }
  16883. });
  16884. });
  16885. }
  16886. });
  16887. })();
  16888. /*
  16889. ---
  16890. script: Hash.Cookie.js
  16891. name: Hash.Cookie
  16892. description: Class for creating, reading, and deleting Cookies in JSON format.
  16893. license: MIT-style license
  16894. authors:
  16895. - Valerio Proietti
  16896. - Aaron Newton
  16897. requires:
  16898. - Core/Cookie
  16899. - Core/JSON
  16900. - MooTools.More
  16901. - Hash
  16902. provides: [Hash.Cookie]
  16903. ...
  16904. */
  16905. Hash.Cookie = new Class({
  16906. Extends: Cookie,
  16907. options: {
  16908. autoSave: true
  16909. },
  16910. initialize: function(name, options){
  16911. this.parent(name, options);
  16912. this.load();
  16913. },
  16914. save: function(){
  16915. var value = JSON.encode(this.hash);
  16916. if (!value || value.length > 4096) return false; //cookie would be truncated!
  16917. if (value == '{}') this.dispose();
  16918. else this.write(value);
  16919. return true;
  16920. },
  16921. load: function(){
  16922. this.hash = new Hash(JSON.decode(this.read(), true));
  16923. return this;
  16924. }
  16925. });
  16926. Hash.each(Hash.prototype, function(method, name){
  16927. if (typeof method == 'function') Hash.Cookie.implement(name, function(){
  16928. var value = method.apply(this.hash, arguments);
  16929. if (this.options.autoSave) this.save();
  16930. return value;
  16931. });
  16932. });
  16933. /*
  16934. ---
  16935. name: Swiff
  16936. description: Wrapper for embedding SWF movies. Supports External Interface Communication.
  16937. license: MIT-style license.
  16938. credits:
  16939. - Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject.
  16940. requires: [Core/Options, Core/Object, Core/Element]
  16941. provides: Swiff
  16942. ...
  16943. */
  16944. (function(){
  16945. var Swiff = this.Swiff = new Class({
  16946. Implements: Options,
  16947. options: {
  16948. id: null,
  16949. height: 1,
  16950. width: 1,
  16951. container: null,
  16952. properties: {},
  16953. params: {
  16954. quality: 'high',
  16955. allowScriptAccess: 'always',
  16956. wMode: 'window',
  16957. swLiveConnect: true
  16958. },
  16959. callBacks: {},
  16960. vars: {}
  16961. },
  16962. toElement: function(){
  16963. return this.object;
  16964. },
  16965. initialize: function(path, options){
  16966. this.instance = 'Swiff_' + String.uniqueID();
  16967. this.setOptions(options);
  16968. options = this.options;
  16969. var id = this.id = options.id || this.instance;
  16970. var container = document.id(options.container);
  16971. Swiff.CallBacks[this.instance] = {};
  16972. var params = options.params, vars = options.vars, callBacks = options.callBacks;
  16973. var properties = Object.append({height: options.height, width: options.width}, options.properties);
  16974. var self = this;
  16975. for (var callBack in callBacks){
  16976. Swiff.CallBacks[this.instance][callBack] = (function(option){
  16977. return function(){
  16978. return option.apply(self.object, arguments);
  16979. };
  16980. })(callBacks[callBack]);
  16981. vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack;
  16982. }
  16983. params.flashVars = Object.toQueryString(vars);
  16984. if ('ActiveXObject' in window){
  16985. properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
  16986. params.movie = path;
  16987. } else {
  16988. properties.type = 'application/x-shockwave-flash';
  16989. }
  16990. properties.data = path;
  16991. var build = '<object id="' + id + '"';
  16992. for (var property in properties) build += ' ' + property + '="' + properties[property] + '"';
  16993. build += '>';
  16994. for (var param in params){
  16995. if (params[param]) build += '<param name="' + param + '" value="' + params[param] + '" />';
  16996. }
  16997. build += '</object>';
  16998. this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild;
  16999. },
  17000. replaces: function(element){
  17001. element = document.id(element, true);
  17002. element.parentNode.replaceChild(this.toElement(), element);
  17003. return this;
  17004. },
  17005. inject: function(element){
  17006. document.id(element, true).appendChild(this.toElement());
  17007. return this;
  17008. },
  17009. remote: function(){
  17010. return Swiff.remote.apply(Swiff, [this.toElement()].append(arguments));
  17011. }
  17012. });
  17013. Swiff.CallBacks = {};
  17014. Swiff.remote = function(obj, fn){
  17015. var rs = obj.CallFunction('<invoke name="' + fn + '" returntype="javascript">' + __flash__argumentsToXML(arguments, 2) + '</invoke>');
  17016. return eval(rs);
  17017. };
  17018. })();
  17019. /*
  17020. ---
  17021. name: Table
  17022. description: LUA-Style table implementation.
  17023. license: MIT-style license
  17024. authors:
  17025. - Valerio Proietti
  17026. requires: [Core/Array]
  17027. provides: [Table]
  17028. ...
  17029. */
  17030. (function(){
  17031. var Table = this.Table = function(){
  17032. this.length = 0;
  17033. var keys = [],
  17034. values = [];
  17035. this.set = function(key, value){
  17036. var index = keys.indexOf(key);
  17037. if (index == -1){
  17038. var length = keys.length;
  17039. keys[length] = key;
  17040. values[length] = value;
  17041. this.length++;
  17042. } else {
  17043. values[index] = value;
  17044. }
  17045. return this;
  17046. };
  17047. this.get = function(key){
  17048. var index = keys.indexOf(key);
  17049. return (index == -1) ? null : values[index];
  17050. };
  17051. this.erase = function(key){
  17052. var index = keys.indexOf(key);
  17053. if (index != -1){
  17054. this.length--;
  17055. keys.splice(index, 1);
  17056. return values.splice(index, 1)[0];
  17057. }
  17058. return null;
  17059. };
  17060. this.each = this.forEach = function(fn, bind){
  17061. for (var i = 0, l = this.length; i < l; i++) fn.call(bind, keys[i], values[i], this);
  17062. };
  17063. };
  17064. if (this.Type) new Type('Table', Table);
  17065. })();