mootools-1.6.0_all.js 550 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707
  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. if (url.indexOf("v=4.0")!=-1){
  5127. debugger;
  5128. }
  5129. this.fireEvent('request');
  5130. xhr.send(data);
  5131. if (!this.options.async) this.onStateChange();
  5132. else if (this.options.timeout) this.timer = this.timeout.delay(this.options.timeout, this);
  5133. return this;
  5134. },
  5135. cancel: function(){
  5136. if (!this.running) return this;
  5137. this.running = false;
  5138. var xhr = this.xhr;
  5139. xhr.abort();
  5140. if (this.timer){
  5141. clearTimeout(this.timer);
  5142. delete this.timer;
  5143. }
  5144. xhr.onreadystatechange = empty;
  5145. if (progressSupport) xhr.onprogress = xhr.onloadstart = empty;
  5146. this.xhr = new Browser.Request();
  5147. this.fireEvent('cancel');
  5148. this.reject({reason: 'cancel', xhr: xhr});
  5149. return this;
  5150. }
  5151. });
  5152. var methods = {};
  5153. ['get', 'post', 'put', 'delete', 'patch', 'head', 'GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'].each(function(method){
  5154. methods[method] = function(data){
  5155. var object = {
  5156. method: method
  5157. };
  5158. if (data != null) object.data = data;
  5159. return this.send(object);
  5160. };
  5161. });
  5162. Request.implement(methods);
  5163. Element.Properties.send = {
  5164. set: function(options){
  5165. var send = this.get('send').cancel();
  5166. send.setOptions(options);
  5167. return this;
  5168. },
  5169. get: function(){
  5170. var send = this.retrieve('send');
  5171. if (!send){
  5172. send = new Request({
  5173. data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action')
  5174. });
  5175. this.store('send', send);
  5176. }
  5177. return send;
  5178. }
  5179. };
  5180. Element.implement({
  5181. send: function(url){
  5182. var sender = this.get('send');
  5183. sender.send({data: this, url: url || sender.options.url});
  5184. return this;
  5185. }
  5186. });
  5187. })();
  5188. /*
  5189. ---
  5190. name: Request.HTML
  5191. description: Extends the basic Request Class with additional methods for interacting with HTML responses.
  5192. license: MIT-style license.
  5193. requires: [Element, Request]
  5194. provides: Request.HTML
  5195. ...
  5196. */
  5197. Request.HTML = new Class({
  5198. Extends: Request,
  5199. options: {
  5200. update: false,
  5201. append: false,
  5202. evalScripts: true,
  5203. filter: false,
  5204. headers: {
  5205. Accept: 'text/html, application/xml, text/xml, */*'
  5206. }
  5207. },
  5208. success: function(text){
  5209. var options = this.options, response = this.response;
  5210. response.html = text.stripScripts(function(script){
  5211. response.javascript = script;
  5212. });
  5213. var match = response.html.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
  5214. if (match) response.html = match[1];
  5215. var temp = new Element('div').set('html', response.html);
  5216. response.tree = temp.childNodes;
  5217. response.elements = temp.getElements(options.filter || '*');
  5218. if (options.filter) response.tree = response.elements;
  5219. if (options.update){
  5220. var update = document.id(options.update).empty();
  5221. if (options.filter) update.adopt(response.elements);
  5222. else update.set('html', response.html);
  5223. } else if (options.append){
  5224. var append = document.id(options.append);
  5225. if (options.filter) response.elements.reverse().inject(append);
  5226. else append.adopt(temp.getChildren());
  5227. }
  5228. if (options.evalScripts) Browser.exec(response.javascript);
  5229. this.onSuccess(response.tree, response.elements, response.html, response.javascript);
  5230. this.resolve({tree: response.tree, elements: response.elements, html: response.html, javascript: response.javascript});
  5231. }
  5232. });
  5233. Element.Properties.load = {
  5234. set: function(options){
  5235. var load = this.get('load').cancel();
  5236. load.setOptions(options);
  5237. return this;
  5238. },
  5239. get: function(){
  5240. var load = this.retrieve('load');
  5241. if (!load){
  5242. load = new Request.HTML({data: this, link: 'cancel', update: this, method: 'get'});
  5243. this.store('load', load);
  5244. }
  5245. return load;
  5246. }
  5247. };
  5248. Element.implement({
  5249. load: function(){
  5250. this.get('load').send(Array.link(arguments, {data: Type.isObject, url: Type.isString}));
  5251. return this;
  5252. }
  5253. });
  5254. /*
  5255. ---
  5256. name: JSON
  5257. description: JSON encoder and decoder.
  5258. license: MIT-style license.
  5259. SeeAlso: <http://www.json.org/>
  5260. requires: [Array, String, Number, Function]
  5261. provides: JSON
  5262. ...
  5263. */
  5264. if (typeof JSON == 'undefined') this.JSON = {};
  5265. //<1.2compat>
  5266. JSON = new Hash({
  5267. stringify: JSON.stringify,
  5268. parse: JSON.parse
  5269. });
  5270. //</1.2compat>
  5271. (function(){
  5272. var special = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'};
  5273. var escape = function(chr){
  5274. return special[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16)).slice(-4);
  5275. };
  5276. JSON.validate = function(string){
  5277. string = string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
  5278. replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
  5279. replace(/(?:^|:|,)(?:\s*\[)+/g, '');
  5280. return (/^[\],:{}\s]*$/).test(string);
  5281. };
  5282. JSON.encode = JSON.stringify ? function(obj){
  5283. return JSON.stringify(obj);
  5284. } : function(obj){
  5285. if (obj && obj.toJSON) obj = obj.toJSON();
  5286. switch (typeOf(obj)){
  5287. case 'string':
  5288. return '"' + obj.replace(/[\x00-\x1f\\"]/g, escape) + '"';
  5289. case 'array':
  5290. return '[' + obj.map(JSON.encode).clean() + ']';
  5291. case 'object': case 'hash':
  5292. var string = [];
  5293. Object.each(obj, function(value, key){
  5294. var json = JSON.encode(value);
  5295. if (json) string.push(JSON.encode(key) + ':' + json);
  5296. });
  5297. return '{' + string + '}';
  5298. case 'number': case 'boolean': return '' + obj;
  5299. case 'null': return 'null';
  5300. }
  5301. return null;
  5302. };
  5303. JSON.secure = true;
  5304. //<1.4compat>
  5305. JSON.secure = false;
  5306. //</1.4compat>
  5307. JSON.decode = function(string, secure){
  5308. if (!string || typeOf(string) != 'string') return null;
  5309. if (secure == null) secure = JSON.secure;
  5310. if (secure){
  5311. if (JSON.parse) return JSON.parse(string);
  5312. if (!JSON.validate(string)) throw new Error('JSON could not decode the input; security is enabled and the value is not secure.');
  5313. }
  5314. return eval('(' + string + ')');
  5315. };
  5316. })();
  5317. /*
  5318. ---
  5319. name: Request.JSON
  5320. description: Extends the basic Request Class with additional methods for sending and receiving JSON data.
  5321. license: MIT-style license.
  5322. requires: [Request, JSON]
  5323. provides: Request.JSON
  5324. ...
  5325. */
  5326. Request.JSON = new Class({
  5327. Extends: Request,
  5328. options: {
  5329. /*onError: function(text, error){},*/
  5330. secure: true
  5331. },
  5332. initialize: function(options){
  5333. this.parent(options);
  5334. Object.append(this.headers, {
  5335. 'Accept': 'application/json',
  5336. // 'X-Request': 'JSON'
  5337. });
  5338. },
  5339. success: function(text){
  5340. var json;
  5341. try {
  5342. json = this.response.json = JSON.decode(text, this.options.secure);
  5343. } catch (error){
  5344. this.fireEvent('error', [text, error]);
  5345. return;
  5346. }
  5347. if (json == null){
  5348. this.failure();
  5349. } else {
  5350. this.onSuccess(json, text);
  5351. this.resolve({json: json, text: text});
  5352. }
  5353. }
  5354. });
  5355. /*
  5356. ---
  5357. name: Cookie
  5358. description: Class for creating, reading, and deleting browser Cookies.
  5359. license: MIT-style license.
  5360. credits:
  5361. - Based on the functions by Peter-Paul Koch (http://quirksmode.org).
  5362. requires: [Options, Browser]
  5363. provides: Cookie
  5364. ...
  5365. */
  5366. var Cookie = new Class({
  5367. Implements: Options,
  5368. options: {
  5369. path: '/',
  5370. domain: false,
  5371. duration: false,
  5372. secure: false,
  5373. document: document,
  5374. encode: true,
  5375. httpOnly: false
  5376. },
  5377. initialize: function(key, options){
  5378. this.key = key;
  5379. this.setOptions(options);
  5380. },
  5381. write: function(value){
  5382. if (this.options.encode) value = encodeURIComponent(value);
  5383. if (this.options.domain) value += '; domain=' + this.options.domain;
  5384. if (this.options.path) value += '; path=' + this.options.path;
  5385. if (this.options.duration){
  5386. var date = new Date();
  5387. date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000);
  5388. value += '; expires=' + date.toGMTString();
  5389. }
  5390. if (this.options.secure) value += '; secure';
  5391. if (this.options.httpOnly) value += '; HttpOnly';
  5392. this.options.document.cookie = this.key + '=' + value;
  5393. return this;
  5394. },
  5395. read: function(){
  5396. var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)');
  5397. return (value) ? decodeURIComponent(value[1]) : null;
  5398. },
  5399. dispose: function(){
  5400. new Cookie(this.key, Object.merge({}, this.options, {duration: -1})).write('');
  5401. return this;
  5402. }
  5403. });
  5404. Cookie.write = function(key, value, options){
  5405. return new Cookie(key, options).write(value);
  5406. };
  5407. Cookie.read = function(key){
  5408. return new Cookie(key).read();
  5409. };
  5410. Cookie.dispose = function(key, options){
  5411. return new Cookie(key, options).dispose();
  5412. };
  5413. /*
  5414. ---
  5415. name: DOMReady
  5416. description: Contains the custom event domready.
  5417. license: MIT-style license.
  5418. requires: [Browser, Element, Element.Event]
  5419. provides: [DOMReady, DomReady]
  5420. ...
  5421. */
  5422. (function(window, document){
  5423. var ready,
  5424. loaded,
  5425. checks = [],
  5426. shouldPoll,
  5427. timer,
  5428. testElement = document.createElement('div');
  5429. var domready = function(){
  5430. clearTimeout(timer);
  5431. if (!ready){
  5432. Browser.loaded = ready = true;
  5433. document.removeListener('DOMContentLoaded', domready).removeListener('readystatechange', check);
  5434. document.fireEvent('domready');
  5435. window.fireEvent('domready');
  5436. }
  5437. // cleanup scope vars
  5438. document = window = testElement = null;
  5439. };
  5440. var check = function(){
  5441. for (var i = checks.length; i--;) if (checks[i]()){
  5442. domready();
  5443. return true;
  5444. }
  5445. return false;
  5446. };
  5447. var poll = function(){
  5448. clearTimeout(timer);
  5449. if (!check()) timer = setTimeout(poll, 10);
  5450. };
  5451. document.addListener('DOMContentLoaded', domready);
  5452. /*<ltIE8>*/
  5453. // doScroll technique by Diego Perini http://javascript.nwbox.com/IEContentLoaded/
  5454. // testElement.doScroll() throws when the DOM is not ready, only in the top window
  5455. var doScrollWorks = function(){
  5456. try {
  5457. testElement.doScroll();
  5458. return true;
  5459. } catch (e){}
  5460. return false;
  5461. };
  5462. // If doScroll works already, it can't be used to determine domready
  5463. // e.g. in an iframe
  5464. if (testElement.doScroll && !doScrollWorks()){
  5465. checks.push(doScrollWorks);
  5466. shouldPoll = true;
  5467. }
  5468. /*</ltIE8>*/
  5469. if (document.readyState) checks.push(function(){
  5470. var state = document.readyState;
  5471. return (state == 'loaded' || state == 'complete');
  5472. });
  5473. if ('onreadystatechange' in document) document.addListener('readystatechange', check);
  5474. else shouldPoll = true;
  5475. if (shouldPoll) poll();
  5476. Element.Events.domready = {
  5477. onAdd: function(fn){
  5478. if (ready) fn.call(this);
  5479. }
  5480. };
  5481. // Make sure that domready fires before load
  5482. Element.Events.load = {
  5483. base: 'load',
  5484. onAdd: function(fn){
  5485. if (loaded && this == window) fn.call(this);
  5486. },
  5487. condition: function(){
  5488. if (this == window){
  5489. domready();
  5490. delete Element.Events.load;
  5491. }
  5492. return true;
  5493. }
  5494. };
  5495. // This is based on the custom load event
  5496. window.addEvent('load', function(){
  5497. loaded = true;
  5498. });
  5499. })(window, document);
  5500. /*
  5501. ---
  5502. script: More.js
  5503. name: More
  5504. description: MooTools More
  5505. license: MIT-style license
  5506. authors:
  5507. - Guillermo Rauch
  5508. - Thomas Aylott
  5509. - Scott Kyle
  5510. - Arian Stolwijk
  5511. - Tim Wienk
  5512. - Christoph Pojer
  5513. - Aaron Newton
  5514. - Jacob Thornton
  5515. requires:
  5516. - Core/MooTools
  5517. provides: [MooTools.More]
  5518. ...
  5519. */
  5520. MooTools.More = {
  5521. version: '1.6.0',
  5522. build: '45b71db70f879781a7e0b0d3fb3bb1307c2521eb'
  5523. };
  5524. /*
  5525. ---
  5526. script: Chain.Wait.js
  5527. name: Chain.Wait
  5528. description: value, Adds a method to inject pauses between chained events.
  5529. license: MIT-style license.
  5530. authors:
  5531. - Aaron Newton
  5532. requires:
  5533. - Core/Chain
  5534. - Core/Element
  5535. - Core/Fx
  5536. - MooTools.More
  5537. provides: [Chain.Wait]
  5538. ...
  5539. */
  5540. (function(){
  5541. var wait = {
  5542. wait: function(duration){
  5543. return this.chain(function(){
  5544. this.callChain.delay(duration == null ? 500 : duration, this);
  5545. return this;
  5546. }.bind(this));
  5547. }
  5548. };
  5549. Chain.implement(wait);
  5550. if (this.Fx) Fx.implement(wait);
  5551. if (this.Element && Element.implement && this.Fx){
  5552. Element.implement({
  5553. chains: function(effects){
  5554. Array.convert(effects || ['tween', 'morph', 'reveal']).each(function(effect){
  5555. effect = this.get(effect);
  5556. if (!effect) return;
  5557. effect.setOptions({
  5558. link:'chain'
  5559. });
  5560. }, this);
  5561. return this;
  5562. },
  5563. pauseFx: function(duration, effect){
  5564. this.chains(effect).get(effect || 'tween').wait(duration);
  5565. return this;
  5566. }
  5567. });
  5568. }
  5569. })();
  5570. /*
  5571. ---
  5572. script: Class.Binds.js
  5573. name: Class.Binds
  5574. description: Automagically binds specified methods in a class to the instance of the class.
  5575. license: MIT-style license
  5576. authors:
  5577. - Aaron Newton
  5578. requires:
  5579. - Core/Class
  5580. - MooTools.More
  5581. provides: [Class.Binds]
  5582. ...
  5583. */
  5584. Class.Mutators.Binds = function(binds){
  5585. if (!this.prototype.initialize) this.implement('initialize', function(){});
  5586. return Array.convert(binds).concat(this.prototype.Binds || []);
  5587. };
  5588. Class.Mutators.initialize = function(initialize){
  5589. return function(){
  5590. Array.convert(this.Binds).each(function(name){
  5591. var original = this[name];
  5592. if (original) this[name] = original.bind(this);
  5593. }, this);
  5594. return initialize.apply(this, arguments);
  5595. };
  5596. };
  5597. /*
  5598. ---
  5599. script: Class.Occlude.js
  5600. name: Class.Occlude
  5601. description: Prevents a class from being applied to a DOM element twice.
  5602. license: MIT-style license.
  5603. authors:
  5604. - Aaron Newton
  5605. requires:
  5606. - Core/Class
  5607. - Core/Element
  5608. - MooTools.More
  5609. provides: [Class.Occlude]
  5610. ...
  5611. */
  5612. Class.Occlude = new Class({
  5613. occlude: function(property, element){
  5614. element = document.id(element || this.element);
  5615. var instance = element.retrieve(property || this.property);
  5616. if (instance && !this.occluded)
  5617. return (this.occluded = instance);
  5618. this.occluded = false;
  5619. element.store(property || this.property, this);
  5620. return this.occluded;
  5621. }
  5622. });
  5623. /*
  5624. ---
  5625. script: Class.Refactor.js
  5626. name: Class.Refactor
  5627. description: Extends a class onto itself with new property, preserving any items attached to the class's namespace.
  5628. license: MIT-style license
  5629. authors:
  5630. - Aaron Newton
  5631. requires:
  5632. - Core/Class
  5633. - MooTools.More
  5634. # Some modules declare themselves dependent on Class.Refactor
  5635. provides: [Class.refactor, Class.Refactor]
  5636. ...
  5637. */
  5638. Class.refactor = function(original, refactors){
  5639. Object.each(refactors, function(item, name){
  5640. var origin = original.prototype[name];
  5641. origin = (origin && origin.$origin) || origin || function(){};
  5642. original.implement(name, (typeof item == 'function') ? function(){
  5643. var old = this.previous;
  5644. this.previous = origin;
  5645. var value = item.apply(this, arguments);
  5646. this.previous = old;
  5647. return value;
  5648. } : item);
  5649. });
  5650. return original;
  5651. };
  5652. /*
  5653. ---
  5654. script: Class.Singleton.js
  5655. name: Class.Singleton
  5656. description: Always provides a single instance of a class
  5657. license: MIT-style license.
  5658. authors:
  5659. - Hristo Chakarov
  5660. requires:
  5661. - Core/Class
  5662. provides: [Class.Singleton]
  5663. ...
  5664. */
  5665. Class.Singleton = new Class({
  5666. initialize : function(descriptor){
  5667. // here we keep reference of the single instance
  5668. var singleton;
  5669. // create a regular Class
  5670. var constructor = new Class(descriptor);
  5671. // We return another constructor, because we need to make sure that we
  5672. // always return the same one and only instance.
  5673. return function(){
  5674. if (singleton){
  5675. return singleton;
  5676. }
  5677. // Obviously we instantiate that class for the first time.
  5678. // Create brand new object & extend it with the prototype of the
  5679. // original `constructor`.
  5680. singleton = Object.append({}, constructor.prototype);
  5681. singleton.constructor = constructor;
  5682. // We also need to call the constructor as a function, passing the
  5683. // arguments object.
  5684. var returnValue = constructor.apply(singleton, arguments);
  5685. // In case the `constructor` returns something other than `this` -
  5686. // return that value; otherwise return the `singleton`.
  5687. singleton = typeof returnValue == 'object' ? returnValue : singleton;
  5688. return singleton;
  5689. };
  5690. }
  5691. });
  5692. /*
  5693. ---
  5694. name: Events.Pseudos
  5695. description: Adds the functionality to add pseudo events
  5696. license: MIT-style license
  5697. authors:
  5698. - Arian Stolwijk
  5699. requires: [Core/Class.Extras, Core/Slick.Parser, MooTools.More]
  5700. provides: [Events.Pseudos]
  5701. ...
  5702. */
  5703. (function(){
  5704. Events.Pseudos = function(pseudos, addEvent, removeEvent){
  5705. var storeKey = '_monitorEvents:';
  5706. var storageOf = function(object){
  5707. return {
  5708. store: object.store ? function(key, value){
  5709. object.store(storeKey + key, value);
  5710. } : function(key, value){
  5711. (object._monitorEvents || (object._monitorEvents = {}))[key] = value;
  5712. },
  5713. retrieve: object.retrieve ? function(key, dflt){
  5714. return object.retrieve(storeKey + key, dflt);
  5715. } : function(key, dflt){
  5716. if (!object._monitorEvents) return dflt;
  5717. return object._monitorEvents[key] || dflt;
  5718. }
  5719. };
  5720. };
  5721. var splitType = function(type){
  5722. if (type.indexOf(':') == -1 || !pseudos) return null;
  5723. var parsed = Slick.parse(type).expressions[0][0],
  5724. parsedPseudos = parsed.pseudos,
  5725. l = parsedPseudos.length,
  5726. splits = [];
  5727. while (l--){
  5728. var pseudo = parsedPseudos[l].key,
  5729. listener = pseudos[pseudo];
  5730. if (listener != null) splits.push({
  5731. event: parsed.tag,
  5732. value: parsedPseudos[l].value,
  5733. pseudo: pseudo,
  5734. original: type,
  5735. listener: listener
  5736. });
  5737. }
  5738. return splits.length ? splits : null;
  5739. };
  5740. return {
  5741. addEvent: function(type, fn, internal){
  5742. var split = splitType(type);
  5743. if (!split) return addEvent.call(this, type, fn, internal);
  5744. var storage = storageOf(this),
  5745. events = storage.retrieve(type, []),
  5746. eventType = split[0].event,
  5747. args = Array.slice(arguments, 2),
  5748. stack = fn,
  5749. self = this;
  5750. split.each(function(item){
  5751. var listener = item.listener,
  5752. stackFn = stack;
  5753. if (listener == false) eventType += ':' + item.pseudo + '(' + item.value + ')';
  5754. else stack = function(){
  5755. listener.call(self, item, stackFn, arguments, stack);
  5756. };
  5757. });
  5758. events.include({type: eventType, event: fn, monitor: stack});
  5759. storage.store(type, events);
  5760. if (type != eventType) addEvent.apply(this, [type, fn].concat(args));
  5761. return addEvent.apply(this, [eventType, stack].concat(args));
  5762. },
  5763. removeEvent: function(type, fn){
  5764. var split = splitType(type);
  5765. if (!split) return removeEvent.call(this, type, fn);
  5766. var storage = storageOf(this),
  5767. events = storage.retrieve(type);
  5768. if (!events) return this;
  5769. var args = Array.slice(arguments, 2);
  5770. removeEvent.apply(this, [type, fn].concat(args));
  5771. events.each(function(monitor, i){
  5772. if (!fn || monitor.event == fn) removeEvent.apply(this, [monitor.type, monitor.monitor].concat(args));
  5773. delete events[i];
  5774. }, this);
  5775. storage.store(type, events);
  5776. return this;
  5777. }
  5778. };
  5779. };
  5780. var pseudos = {
  5781. once: function(split, fn, args, monitor){
  5782. fn.apply(this, args);
  5783. this.removeEvent(split.event, monitor)
  5784. .removeEvent(split.original, fn);
  5785. },
  5786. throttle: function(split, fn, args){
  5787. if (!fn._throttled){
  5788. fn.apply(this, args);
  5789. fn._throttled = setTimeout(function(){
  5790. fn._throttled = false;
  5791. }, split.value || 250);
  5792. }
  5793. },
  5794. pause: function(split, fn, args){
  5795. clearTimeout(fn._pause);
  5796. fn._pause = fn.delay(split.value || 250, this, args);
  5797. }
  5798. };
  5799. Events.definePseudo = function(key, listener){
  5800. pseudos[key] = listener;
  5801. return this;
  5802. };
  5803. Events.lookupPseudo = function(key){
  5804. return pseudos[key];
  5805. };
  5806. var proto = Events.prototype;
  5807. Events.implement(Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
  5808. ['Request', 'Fx'].each(function(klass){
  5809. if (this[klass]) this[klass].implement(Events.prototype);
  5810. });
  5811. })();
  5812. /*
  5813. ---
  5814. script: Drag.js
  5815. name: Drag
  5816. description: The base Drag Class. Can be used to drag and resize Elements using mouse events.
  5817. license: MIT-style license
  5818. authors:
  5819. - Valerio Proietti
  5820. - Tom Occhinno
  5821. - Jan Kassens
  5822. requires:
  5823. - Core/Events
  5824. - Core/Options
  5825. - Core/Element.Event
  5826. - Core/Element.Style
  5827. - Core/Element.Dimensions
  5828. - MooTools.More
  5829. provides: [Drag]
  5830. ...
  5831. */
  5832. (function(){
  5833. var Drag = this.Drag = new Class({
  5834. Implements: [Events, Options],
  5835. options: {/*
  5836. onBeforeStart: function(thisElement){},
  5837. onStart: function(thisElement, event){},
  5838. onSnap: function(thisElement){},
  5839. onDrag: function(thisElement, event){},
  5840. onCancel: function(thisElement){},
  5841. onComplete: function(thisElement, event){},*/
  5842. snap: 6,
  5843. unit: 'px',
  5844. grid: false,
  5845. style: true,
  5846. limit: false,
  5847. handle: false,
  5848. invert: false,
  5849. unDraggableTags: ['button', 'input', 'a', 'textarea', 'select', 'option'],
  5850. preventDefault: false,
  5851. stopPropagation: false,
  5852. compensateScroll: false,
  5853. modifiers: {x: 'left', y: 'top'}
  5854. },
  5855. initialize: function(){
  5856. var params = Array.link(arguments, {
  5857. 'options': Type.isObject,
  5858. 'element': function(obj){
  5859. return obj != null;
  5860. }
  5861. });
  5862. this.element = document.id(params.element);
  5863. this.document = this.element.getDocument();
  5864. this.setOptions(params.options || {});
  5865. var htype = typeOf(this.options.handle);
  5866. this.handles = ((htype == 'array' || htype == 'collection') ? $$(this.options.handle) : document.id(this.options.handle)) || this.element;
  5867. this.mouse = {'now': {}, 'pos': {}};
  5868. this.value = {'start': {}, 'now': {}};
  5869. this.offsetParent = (function(el){
  5870. var offsetParent = el.getOffsetParent();
  5871. var isBody = !offsetParent || (/^(?:body|html)$/i).test(offsetParent.tagName);
  5872. return isBody ? window : document.id(offsetParent);
  5873. })(this.element);
  5874. this.selection = 'selectstart' in document ? 'selectstart' : 'mousedown';
  5875. this.compensateScroll = {start: {}, diff: {}, last: {}};
  5876. if ('ondragstart' in document && !('FileReader' in window) && !Drag.ondragstartFixed){
  5877. document.ondragstart = Function.convert(false);
  5878. Drag.ondragstartFixed = true;
  5879. }
  5880. this.bound = {
  5881. start: this.start.bind(this),
  5882. check: this.check.bind(this),
  5883. drag: this.drag.bind(this),
  5884. stop: this.stop.bind(this),
  5885. cancel: this.cancel.bind(this),
  5886. eventStop: Function.convert(false),
  5887. scrollListener: this.scrollListener.bind(this)
  5888. };
  5889. this.attach();
  5890. },
  5891. attach: function(){
  5892. this.handles.addEvent('mousedown', this.bound.start);
  5893. this.handles.addEvent('touchstart', this.bound.start);
  5894. if (this.options.compensateScroll) this.offsetParent.addEvent('scroll', this.bound.scrollListener);
  5895. return this;
  5896. },
  5897. detach: function(){
  5898. this.handles.removeEvent('mousedown', this.bound.start);
  5899. this.handles.removeEvent('touchstart', this.bound.start);
  5900. if (this.options.compensateScroll) this.offsetParent.removeEvent('scroll', this.bound.scrollListener);
  5901. return this;
  5902. },
  5903. scrollListener: function(){
  5904. if (!this.mouse.start) return;
  5905. var newScrollValue = this.offsetParent.getScroll();
  5906. if (this.element.getStyle('position') == 'absolute'){
  5907. var scrollDiff = this.sumValues(newScrollValue, this.compensateScroll.last, -1);
  5908. this.mouse.now = this.sumValues(this.mouse.now, scrollDiff, 1);
  5909. } else {
  5910. this.compensateScroll.diff = this.sumValues(newScrollValue, this.compensateScroll.start, -1);
  5911. }
  5912. if (this.offsetParent != window) this.compensateScroll.diff = this.sumValues(this.compensateScroll.start, newScrollValue, -1);
  5913. this.compensateScroll.last = newScrollValue;
  5914. this.render(this.options);
  5915. },
  5916. sumValues: function(alpha, beta, op){
  5917. var sum = {}, options = this.options;
  5918. for (var z in options.modifiers){
  5919. if (!options.modifiers[z]) continue;
  5920. sum[z] = alpha[z] + beta[z] * op;
  5921. }
  5922. return sum;
  5923. },
  5924. start: function(event){
  5925. if (this.options.unDraggableTags.contains(event.target.get('tag'))) return;
  5926. var options = this.options;
  5927. if (event.rightClick) return;
  5928. if (options.preventDefault) event.preventDefault();
  5929. if (options.stopPropagation) event.stopPropagation();
  5930. this.compensateScroll.start = this.compensateScroll.last = this.offsetParent.getScroll();
  5931. this.compensateScroll.diff = {x: 0, y: 0};
  5932. this.mouse.start = event.page;
  5933. this.fireEvent('beforeStart', this.element);
  5934. var limit = options.limit;
  5935. this.limit = {x: [], y: []};
  5936. var z, coordinates, offsetParent = this.offsetParent == window ? null : this.offsetParent;
  5937. for (z in options.modifiers){
  5938. if (!options.modifiers[z]) continue;
  5939. var style = this.element.getStyle(options.modifiers[z]);
  5940. // Some browsers (IE and Opera) don't always return pixels.
  5941. if (style && !style.match(/px$/)){
  5942. if (!coordinates) coordinates = this.element.getCoordinates(offsetParent);
  5943. style = coordinates[options.modifiers[z]];
  5944. }
  5945. if (options.style) this.value.now[z] = (style || 0).toInt();
  5946. else this.value.now[z] = this.element[options.modifiers[z]];
  5947. if (options.invert) this.value.now[z] *= -1;
  5948. this.mouse.pos[z] = event.page[z] - this.value.now[z];
  5949. if (limit && limit[z]){
  5950. var i = 2;
  5951. while (i--){
  5952. var limitZI = limit[z][i];
  5953. if (limitZI || limitZI === 0) this.limit[z][i] = (typeof limitZI == 'function') ? limitZI() : limitZI;
  5954. }
  5955. }
  5956. }
  5957. if (typeOf(this.options.grid) == 'number') this.options.grid = {
  5958. x: this.options.grid,
  5959. y: this.options.grid
  5960. };
  5961. var events = {
  5962. mousemove: this.bound.check,
  5963. mouseup: this.bound.cancel,
  5964. touchmove: this.bound.check,
  5965. touchend: this.bound.cancel
  5966. };
  5967. events[this.selection] = this.bound.eventStop;
  5968. this.document.addEvents(events);
  5969. },
  5970. check: function(event){
  5971. if (this.options.preventDefault) event.preventDefault();
  5972. 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)));
  5973. if (distance > this.options.snap){
  5974. this.cancel();
  5975. this.document.addEvents({
  5976. mousemove: this.bound.drag,
  5977. mouseup: this.bound.stop,
  5978. touchmove: this.bound.drag,
  5979. touchend: this.bound.stop
  5980. });
  5981. this.fireEvent('start', [this.element, event]).fireEvent('snap', this.element);
  5982. }
  5983. },
  5984. drag: function(event){
  5985. var options = this.options;
  5986. if (options.preventDefault) event.preventDefault();
  5987. this.mouse.now = this.sumValues(event.page, this.compensateScroll.diff, -1);
  5988. this.render(options);
  5989. this.fireEvent('drag', [this.element, event]);
  5990. },
  5991. render: function(options){
  5992. for (var z in options.modifiers){
  5993. if (!options.modifiers[z]) continue;
  5994. this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z];
  5995. if (options.invert) this.value.now[z] *= -1;
  5996. if (options.limit && this.limit[z]){
  5997. if ((this.limit[z][1] || this.limit[z][1] === 0) && (this.value.now[z] > this.limit[z][1])){
  5998. this.value.now[z] = this.limit[z][1];
  5999. } else if ((this.limit[z][0] || this.limit[z][0] === 0) && (this.value.now[z] < this.limit[z][0])){
  6000. this.value.now[z] = this.limit[z][0];
  6001. }
  6002. }
  6003. if (options.grid[z]) this.value.now[z] -= ((this.value.now[z] - (this.limit[z][0]||0)) % options.grid[z]);
  6004. if (options.style) this.element.setStyle(options.modifiers[z], this.value.now[z] + options.unit);
  6005. else this.element[options.modifiers[z]] = this.value.now[z];
  6006. }
  6007. },
  6008. cancel: function(event){
  6009. this.document.removeEvents({
  6010. mousemove: this.bound.check,
  6011. mouseup: this.bound.cancel,
  6012. touchmove: this.bound.check,
  6013. touchend: this.bound.cancel
  6014. });
  6015. if (event){
  6016. this.document.removeEvent(this.selection, this.bound.eventStop);
  6017. this.fireEvent('cancel', this.element);
  6018. }
  6019. },
  6020. stop: function(event){
  6021. var events = {
  6022. mousemove: this.bound.drag,
  6023. mouseup: this.bound.stop,
  6024. touchmove: this.bound.drag,
  6025. touchend: this.bound.stop
  6026. };
  6027. events[this.selection] = this.bound.eventStop;
  6028. this.document.removeEvents(events);
  6029. this.mouse.start = null;
  6030. if (event) this.fireEvent('complete', [this.element, event]);
  6031. }
  6032. });
  6033. })();
  6034. Element.implement({
  6035. makeResizable: function(options){
  6036. var drag = new Drag(this, Object.merge({
  6037. modifiers: {
  6038. x: 'width',
  6039. y: 'height'
  6040. }
  6041. }, options));
  6042. this.store('resizer', drag);
  6043. return drag.addEvent('drag', function(){
  6044. this.fireEvent('resize', drag);
  6045. }.bind(this));
  6046. }
  6047. });
  6048. /*
  6049. ---
  6050. script: Drag.Move.js
  6051. name: Drag.Move
  6052. description: A Drag extension that provides support for the constraining of draggables to containers and droppables.
  6053. license: MIT-style license
  6054. authors:
  6055. - Valerio Proietti
  6056. - Tom Occhinno
  6057. - Jan Kassens
  6058. - Aaron Newton
  6059. - Scott Kyle
  6060. requires:
  6061. - Core/Element.Dimensions
  6062. - Drag
  6063. provides: [Drag.Move]
  6064. ...
  6065. */
  6066. Drag.Move = new Class({
  6067. Extends: Drag,
  6068. options: {/*
  6069. onEnter: function(thisElement, overed){},
  6070. onLeave: function(thisElement, overed){},
  6071. onDrop: function(thisElement, overed, event){},*/
  6072. droppables: [],
  6073. container: false,
  6074. precalculate: false,
  6075. includeMargins: true,
  6076. checkDroppables: true
  6077. },
  6078. initialize: function(element, options){
  6079. this.parent(element, options);
  6080. element = this.element;
  6081. this.droppables = $$(this.options.droppables);
  6082. this.setContainer(this.options.container);
  6083. if (this.options.style){
  6084. if (this.options.modifiers.x == 'left' && this.options.modifiers.y == 'top'){
  6085. var parent = element.getOffsetParent(),
  6086. styles = element.getStyles('left', 'top');
  6087. if (parent && (styles.left == 'auto' || styles.top == 'auto')){
  6088. element.setPosition(element.getPosition(parent));
  6089. }
  6090. }
  6091. if (element.getStyle('position') == 'static') element.setStyle('position', 'absolute');
  6092. }
  6093. this.addEvent('start', this.checkDroppables, true);
  6094. this.overed = null;
  6095. },
  6096. setContainer: function(container){
  6097. this.container = document.id(container);
  6098. if (this.container && typeOf(this.container) != 'element'){
  6099. this.container = document.id(this.container.getDocument().body);
  6100. }
  6101. },
  6102. start: function(event){
  6103. if (this.container) this.options.limit = this.calculateLimit();
  6104. if (this.options.precalculate){
  6105. this.positions = this.droppables.map(function(el){
  6106. return el.getCoordinates();
  6107. });
  6108. }
  6109. this.parent(event);
  6110. },
  6111. calculateLimit: function(){
  6112. var element = this.element,
  6113. container = this.container,
  6114. offsetParent = document.id(element.getOffsetParent()) || document.body,
  6115. containerCoordinates = container.getCoordinates(offsetParent),
  6116. elementMargin = {},
  6117. elementBorder = {},
  6118. containerMargin = {},
  6119. containerBorder = {},
  6120. offsetParentPadding = {},
  6121. offsetScroll = offsetParent.getScroll();
  6122. ['top', 'right', 'bottom', 'left'].each(function(pad){
  6123. elementMargin[pad] = element.getStyle('margin-' + pad).toInt();
  6124. elementBorder[pad] = element.getStyle('border-' + pad).toInt();
  6125. containerMargin[pad] = container.getStyle('margin-' + pad).toInt();
  6126. containerBorder[pad] = container.getStyle('border-' + pad).toInt();
  6127. offsetParentPadding[pad] = offsetParent.getStyle('padding-' + pad).toInt();
  6128. }, this);
  6129. var width = element.offsetWidth + elementMargin.left + elementMargin.right,
  6130. height = element.offsetHeight + elementMargin.top + elementMargin.bottom,
  6131. left = 0 + offsetScroll.x,
  6132. top = 0 + offsetScroll.y,
  6133. right = containerCoordinates.right - containerBorder.right - width + offsetScroll.x,
  6134. bottom = containerCoordinates.bottom - containerBorder.bottom - height + offsetScroll.y;
  6135. if (this.options.includeMargins){
  6136. left += elementMargin.left;
  6137. top += elementMargin.top;
  6138. } else {
  6139. right += elementMargin.right;
  6140. bottom += elementMargin.bottom;
  6141. }
  6142. if (element.getStyle('position') == 'relative'){
  6143. var coords = element.getCoordinates(offsetParent);
  6144. coords.left -= element.getStyle('left').toInt();
  6145. coords.top -= element.getStyle('top').toInt();
  6146. left -= coords.left;
  6147. top -= coords.top;
  6148. if (container.getStyle('position') != 'relative'){
  6149. left += containerBorder.left;
  6150. top += containerBorder.top;
  6151. }
  6152. right += elementMargin.left - coords.left;
  6153. bottom += elementMargin.top - coords.top;
  6154. if (container != offsetParent){
  6155. left += containerMargin.left + offsetParentPadding.left;
  6156. if (!offsetParentPadding.left && left < 0) left = 0;
  6157. top += offsetParent == document.body ? 0 : containerMargin.top + offsetParentPadding.top;
  6158. if (!offsetParentPadding.top && top < 0) top = 0;
  6159. }
  6160. } else {
  6161. left -= elementMargin.left;
  6162. top -= elementMargin.top;
  6163. if (container != offsetParent){
  6164. left += containerCoordinates.left + containerBorder.left;
  6165. top += containerCoordinates.top + containerBorder.top;
  6166. }
  6167. }
  6168. return {
  6169. x: [left, right],
  6170. y: [top, bottom]
  6171. };
  6172. },
  6173. getDroppableCoordinates: function(element){
  6174. var position = element.getCoordinates();
  6175. if (element.getStyle('position') == 'fixed'){
  6176. var scroll = window.getScroll();
  6177. position.left += scroll.x;
  6178. position.right += scroll.x;
  6179. position.top += scroll.y;
  6180. position.bottom += scroll.y;
  6181. }
  6182. return position;
  6183. },
  6184. //modify by Tommy
  6185. checkDroppables:function(){
  6186. var overedList = this.droppables.filter(function(el, i){
  6187. el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el);
  6188. var now = this.mouse.now;
  6189. return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
  6190. }, this);
  6191. var overed = overedList.getLast();
  6192. if (overed) for (var x=0;x<overedList.length-1;x++) if(overed.contains(overedList[x])) overed=overedList[x];
  6193. if(this.overed!=overed){
  6194. if(this.overed) this.fireEvent("leave",[this.element,this.overed]);
  6195. if(overed) this.fireEvent("enter",[this.element,overed]);
  6196. this.overed=overed;
  6197. }
  6198. },
  6199. //mootools....
  6200. //checkDroppables: function(){
  6201. // var overed = this.droppables.filter(function(el, i){
  6202. // el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el);
  6203. // var now = this.mouse.now;
  6204. // return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
  6205. // }, this).getLast();
  6206. //
  6207. // if (this.overed != overed){
  6208. // if (this.overed) this.fireEvent('leave', [this.element, this.overed]);
  6209. // if (overed) this.fireEvent('enter', [this.element, overed]);
  6210. // this.overed = overed;
  6211. // }
  6212. //},
  6213. drag: function(event){
  6214. this.parent(event);
  6215. if (this.options.checkDroppables && this.droppables.length) this.checkDroppables();
  6216. },
  6217. stop: function(event){
  6218. this.checkDroppables();
  6219. this.fireEvent('drop', [this.element, this.overed, event]);
  6220. this.overed = null;
  6221. return this.parent(event);
  6222. }
  6223. });
  6224. Element.implement({
  6225. makeDraggable: function(options){
  6226. var drag = new Drag.Move(this, options);
  6227. this.store('dragger', drag);
  6228. return drag;
  6229. }
  6230. });
  6231. /*
  6232. ---
  6233. script: Element.Measure.js
  6234. name: Element.Measure
  6235. description: Extends the Element native object to include methods useful in measuring dimensions.
  6236. credits: "Element.measure / .expose methods by Daniel Steigerwald License: MIT-style license. Copyright: Copyright (c) 2008 Daniel Steigerwald, daniel.steigerwald.cz"
  6237. license: MIT-style license
  6238. authors:
  6239. - Aaron Newton
  6240. requires:
  6241. - Core/Element.Style
  6242. - Core/Element.Dimensions
  6243. - MooTools.More
  6244. provides: [Element.Measure]
  6245. ...
  6246. */
  6247. (function(){
  6248. var getStylesList = function(styles, planes){
  6249. var list = [];
  6250. Object.each(planes, function(directions){
  6251. Object.each(directions, function(edge){
  6252. styles.each(function(style){
  6253. list.push(style + '-' + edge + (style == 'border' ? '-width' : ''));
  6254. });
  6255. });
  6256. });
  6257. return list;
  6258. };
  6259. var calculateEdgeSize = function(edge, styles){
  6260. var total = 0;
  6261. Object.each(styles, function(value, style){
  6262. if (style.test(edge)) total = total + value.toInt();
  6263. });
  6264. return total;
  6265. };
  6266. var isVisible = function(el){
  6267. return !!(!el || el.offsetHeight || el.offsetWidth);
  6268. };
  6269. Element.implement({
  6270. measure: function(fn){
  6271. if (isVisible(this)) return fn.call(this);
  6272. var parent = this.getParent(),
  6273. toMeasure = [];
  6274. while (!isVisible(parent) && parent != document.body){
  6275. toMeasure.push(parent.expose());
  6276. parent = parent.getParent();
  6277. }
  6278. var restore = this.expose(),
  6279. result = fn.call(this);
  6280. restore();
  6281. toMeasure.each(function(restore){
  6282. restore();
  6283. });
  6284. return result;
  6285. },
  6286. expose: function(){
  6287. if (this.getStyle('display') != 'none') return function(){};
  6288. var before = this.style.cssText;
  6289. this.setStyles({
  6290. display: 'block',
  6291. position: 'absolute',
  6292. visibility: 'hidden'
  6293. });
  6294. return function(){
  6295. this.style.cssText = before;
  6296. }.bind(this);
  6297. },
  6298. getDimensions: function(options){
  6299. options = Object.merge({computeSize: false}, options);
  6300. var dim = {x: 0, y: 0};
  6301. var getSize = function(el, options){
  6302. return (options.computeSize) ? el.getComputedSize(options) : el.getSize();
  6303. };
  6304. var parent = this.getParent('body');
  6305. if (parent && this.getStyle('display') == 'none'){
  6306. dim = this.measure(function(){
  6307. return getSize(this, options);
  6308. });
  6309. } else if (parent){
  6310. try { //safari sometimes crashes here, so catch it
  6311. dim = getSize(this, options);
  6312. } catch (e){}
  6313. }
  6314. return Object.append(dim, (dim.x || dim.x === 0) ? {
  6315. width: dim.x,
  6316. height: dim.y
  6317. } : {
  6318. x: dim.width,
  6319. y: dim.height
  6320. });
  6321. },
  6322. getComputedSize: function(options){
  6323. //<1.2compat>
  6324. //legacy support for my stupid spelling error
  6325. if (options && options.plains) options.planes = options.plains;
  6326. //</1.2compat>
  6327. options = Object.merge({
  6328. styles: ['padding','border'],
  6329. planes: {
  6330. height: ['top','bottom'],
  6331. width: ['left','right']
  6332. },
  6333. mode: 'both'
  6334. }, options);
  6335. var styles = {},
  6336. size = {width: 0, height: 0},
  6337. dimensions;
  6338. if (options.mode == 'vertical'){
  6339. delete size.width;
  6340. delete options.planes.width;
  6341. } else if (options.mode == 'horizontal'){
  6342. delete size.height;
  6343. delete options.planes.height;
  6344. }
  6345. getStylesList(options.styles, options.planes).each(function(style){
  6346. styles[style] = this.getStyle(style).toInt();
  6347. }, this);
  6348. Object.each(options.planes, function(edges, plane){
  6349. var capitalized = plane.capitalize(),
  6350. style = this.getStyle(plane);
  6351. if (style == 'auto' && !dimensions) dimensions = this.getDimensions();
  6352. style = styles[plane] = (style == 'auto') ? dimensions[plane] : style.toInt();
  6353. size['total' + capitalized] = style;
  6354. edges.each(function(edge){
  6355. var edgesize = calculateEdgeSize(edge, styles);
  6356. size['computed' + edge.capitalize()] = edgesize;
  6357. size['total' + capitalized] += edgesize;
  6358. });
  6359. }, this);
  6360. return Object.append(size, styles);
  6361. }
  6362. });
  6363. })();
  6364. /*
  6365. ---
  6366. script: Slider.js
  6367. name: Slider
  6368. description: Class for creating horizontal and vertical slider controls.
  6369. license: MIT-style license
  6370. authors:
  6371. - Valerio Proietti
  6372. requires:
  6373. - Core/Element.Dimensions
  6374. - Core/Number
  6375. - Class.Binds
  6376. - Drag
  6377. - Element.Measure
  6378. provides: [Slider]
  6379. ...
  6380. */
  6381. (function(){
  6382. var Slider = this.Slider = new Class({
  6383. Implements: [Events, Options],
  6384. Binds: ['clickedElement', 'draggedKnob', 'scrolledElement'],
  6385. options: {/*
  6386. onTick: function(intPosition){},
  6387. onMove: function(){},
  6388. onChange: function(intStep){},
  6389. onComplete: function(strStep){},*/
  6390. onTick: function(position){
  6391. this.setKnobPosition(position);
  6392. },
  6393. initialStep: 0,
  6394. snap: false,
  6395. offset: 0,
  6396. range: false,
  6397. wheel: false,
  6398. steps: 100,
  6399. mode: 'horizontal'
  6400. },
  6401. initialize: function(element, knob, options){
  6402. this.setOptions(options);
  6403. options = this.options;
  6404. this.element = document.id(element);
  6405. knob = this.knob = document.id(knob);
  6406. this.previousChange = this.previousEnd = this.step = options.initialStep ? options.initialStep : options.range ? options.range[0] : 0;
  6407. var limit = {},
  6408. modifiers = {x: false, y: false};
  6409. switch (options.mode){
  6410. case 'vertical':
  6411. this.axis = 'y';
  6412. this.property = 'top';
  6413. this.offset = 'offsetHeight';
  6414. break;
  6415. case 'horizontal':
  6416. this.axis = 'x';
  6417. this.property = 'left';
  6418. this.offset = 'offsetWidth';
  6419. }
  6420. this.setSliderDimensions();
  6421. this.setRange(options.range, null, true);
  6422. if (knob.getStyle('position') == 'static') knob.setStyle('position', 'relative');
  6423. knob.setStyle(this.property, -options.offset);
  6424. modifiers[this.axis] = this.property;
  6425. limit[this.axis] = [-options.offset, this.full - options.offset];
  6426. var dragOptions = {
  6427. snap: 0,
  6428. limit: limit,
  6429. modifiers: modifiers,
  6430. onDrag: this.draggedKnob,
  6431. onStart: this.draggedKnob,
  6432. onBeforeStart: (function(){
  6433. this.isDragging = true;
  6434. }).bind(this),
  6435. onCancel: function(){
  6436. this.isDragging = false;
  6437. }.bind(this),
  6438. onComplete: function(){
  6439. this.isDragging = false;
  6440. this.draggedKnob();
  6441. this.end();
  6442. }.bind(this)
  6443. };
  6444. if (options.snap) this.setSnap(dragOptions);
  6445. this.drag = new Drag(knob, dragOptions);
  6446. if (options.initialStep != null) this.set(options.initialStep, true);
  6447. this.attach();
  6448. },
  6449. attach: function(){
  6450. this.element.addEvent('mousedown', this.clickedElement);
  6451. if (this.options.wheel) this.element.addEvent('mousewheel', this.scrolledElement);
  6452. this.drag.attach();
  6453. return this;
  6454. },
  6455. detach: function(){
  6456. this.element.removeEvent('mousedown', this.clickedElement)
  6457. .removeEvent('mousewheel', this.scrolledElement);
  6458. this.drag.detach();
  6459. return this;
  6460. },
  6461. autosize: function(){
  6462. this.setSliderDimensions()
  6463. .setKnobPosition(this.toPosition(this.step));
  6464. this.drag.options.limit[this.axis] = [-this.options.offset, this.full - this.options.offset];
  6465. if (this.options.snap) this.setSnap();
  6466. return this;
  6467. },
  6468. setSnap: function(options){
  6469. if (!options) options = this.drag.options;
  6470. options.grid = Math.ceil(this.stepWidth);
  6471. options.limit[this.axis][1] = this.element[this.offset];
  6472. return this;
  6473. },
  6474. setKnobPosition: function(position){
  6475. if (this.options.snap) position = this.toPosition(this.step);
  6476. this.knob.setStyle(this.property, position);
  6477. return this;
  6478. },
  6479. setSliderDimensions: function(){
  6480. this.full = this.element.measure(function(){
  6481. this.half = this.knob[this.offset] / 2;
  6482. return this.element[this.offset] - this.knob[this.offset] + (this.options.offset * 2);
  6483. }.bind(this));
  6484. return this;
  6485. },
  6486. set: function(step, silently){
  6487. if (!((this.range > 0) ^ (step < this.min))) step = this.min;
  6488. if (!((this.range > 0) ^ (step > this.max))) step = this.max;
  6489. this.step = (step).round(this.modulus.decimalLength);
  6490. if (silently) this.checkStep().setKnobPosition(this.toPosition(this.step));
  6491. else this.checkStep().fireEvent('tick', this.toPosition(this.step)).fireEvent('move').end();
  6492. return this;
  6493. },
  6494. setRange: function(range, pos, silently){
  6495. this.min = Array.pick([range[0], 0]);
  6496. this.max = Array.pick([range[1], this.options.steps]);
  6497. this.range = this.max - this.min;
  6498. this.steps = this.options.steps || this.full;
  6499. var stepSize = this.stepSize = Math.abs(this.range) / this.steps;
  6500. this.stepWidth = this.stepSize * this.full / Math.abs(this.range);
  6501. this.setModulus();
  6502. if (range) this.set(Array.pick([pos, this.step]).limit(this.min,this.max), silently);
  6503. return this;
  6504. },
  6505. setModulus: function(){
  6506. var decimals = ((this.stepSize + '').split('.')[1] || []).length,
  6507. modulus = 1 + '';
  6508. while (decimals--) modulus += '0';
  6509. this.modulus = {multiplier: (modulus).toInt(10), decimalLength: modulus.length - 1};
  6510. },
  6511. clickedElement: function(event){
  6512. if (this.isDragging || event.target == this.knob) return;
  6513. var dir = this.range < 0 ? -1 : 1,
  6514. position = event.page[this.axis] - this.element.getPosition()[this.axis] - this.half;
  6515. position = position.limit(-this.options.offset, this.full - this.options.offset);
  6516. this.step = (this.min + dir * this.toStep(position)).round(this.modulus.decimalLength);
  6517. this.checkStep()
  6518. .fireEvent('tick', position)
  6519. .fireEvent('move')
  6520. .end();
  6521. },
  6522. scrolledElement: function(event){
  6523. var mode = (this.options.mode == 'horizontal') ? (event.wheel < 0) : (event.wheel > 0);
  6524. this.set(this.step + (mode ? -1 : 1) * this.stepSize);
  6525. event.stop();
  6526. },
  6527. draggedKnob: function(){
  6528. var dir = this.range < 0 ? -1 : 1,
  6529. position = this.drag.value.now[this.axis];
  6530. position = position.limit(-this.options.offset, this.full -this.options.offset);
  6531. this.step = (this.min + dir * this.toStep(position)).round(this.modulus.decimalLength);
  6532. this.checkStep();
  6533. this.fireEvent('move');
  6534. },
  6535. checkStep: function(){
  6536. var step = this.step;
  6537. if (this.previousChange != step){
  6538. this.previousChange = step;
  6539. this.fireEvent('change', step);
  6540. }
  6541. return this;
  6542. },
  6543. end: function(){
  6544. var step = this.step;
  6545. if (this.previousEnd !== step){
  6546. this.previousEnd = step;
  6547. this.fireEvent('complete', step + '');
  6548. }
  6549. return this;
  6550. },
  6551. toStep: function(position){
  6552. var step = (position + this.options.offset) * this.stepSize / this.full * this.steps;
  6553. return this.options.steps ? (step - (step * this.modulus.multiplier) % (this.stepSize * this.modulus.multiplier) / this.modulus.multiplier).round(this.modulus.decimalLength) : step;
  6554. },
  6555. toPosition: function(step){
  6556. return (this.full * Math.abs(this.min - step)) / (this.steps * this.stepSize) - this.options.offset || 0;
  6557. }
  6558. });
  6559. })();
  6560. /*
  6561. ---
  6562. script: Sortables.js
  6563. name: Sortables
  6564. description: Class for creating a drag and drop sorting interface for lists of items.
  6565. license: MIT-style license
  6566. authors:
  6567. - Tom Occhino
  6568. requires:
  6569. - Core/Fx.Morph
  6570. - Drag.Move
  6571. provides: [Sortables]
  6572. ...
  6573. */
  6574. (function(){
  6575. var Sortables = this.Sortables = new Class({
  6576. Implements: [Events, Options],
  6577. options: {/*
  6578. onSort: function(element, clone){},
  6579. onStart: function(element, clone){},
  6580. onComplete: function(element){},*/
  6581. opacity: 1,
  6582. clone: false,
  6583. revert: false,
  6584. handle: false,
  6585. dragOptions: {},
  6586. unDraggableTags: ['button', 'input', 'a', 'textarea', 'select', 'option']/*<1.2compat>*/,
  6587. snap: 4,
  6588. constrain: false,
  6589. preventDefault: false
  6590. /*</1.2compat>*/
  6591. },
  6592. initialize: function(lists, options){
  6593. this.setOptions(options);
  6594. this.elements = [];
  6595. this.lists = [];
  6596. this.idle = true;
  6597. this.addLists($$(document.id(lists) || lists));
  6598. if (!this.options.clone) this.options.revert = false;
  6599. if (this.options.revert) this.effect = new Fx.Morph(null, Object.merge({
  6600. duration: 250,
  6601. link: 'cancel'
  6602. }, this.options.revert));
  6603. },
  6604. attach: function(){
  6605. this.addLists(this.lists);
  6606. return this;
  6607. },
  6608. detach: function(){
  6609. this.lists = this.removeLists(this.lists);
  6610. return this;
  6611. },
  6612. addItems: function(){
  6613. Array.flatten(arguments).each(function(element){
  6614. this.elements.push(element);
  6615. var start = element.retrieve('sortables:start', function(event){
  6616. this.start.call(this, event, element);
  6617. }.bind(this));
  6618. (this.options.handle ? element.getElement(this.options.handle) || element : element).addEvent('mousedown', start);
  6619. }, this);
  6620. return this;
  6621. },
  6622. addLists: function(){
  6623. Array.flatten(arguments).each(function(list){
  6624. this.lists.include(list);
  6625. this.addItems(list.getChildren());
  6626. }, this);
  6627. return this;
  6628. },
  6629. removeItems: function(){
  6630. return $$(Array.flatten(arguments).map(function(element){
  6631. this.elements.erase(element);
  6632. var start = element.retrieve('sortables:start');
  6633. (this.options.handle ? element.getElement(this.options.handle) || element : element).removeEvent('mousedown', start);
  6634. return element;
  6635. }, this));
  6636. },
  6637. removeLists: function(){
  6638. return $$(Array.flatten(arguments).map(function(list){
  6639. this.lists.erase(list);
  6640. this.removeItems(list.getChildren());
  6641. return list;
  6642. }, this));
  6643. },
  6644. getDroppableCoordinates: function(element){
  6645. var offsetParent = element.getOffsetParent();
  6646. var position = element.getPosition(offsetParent);
  6647. var scroll = {
  6648. w: window.getScroll(),
  6649. offsetParent: offsetParent.getScroll()
  6650. };
  6651. position.x += scroll.offsetParent.x;
  6652. position.y += scroll.offsetParent.y;
  6653. if (offsetParent.getStyle('position') == 'fixed'){
  6654. position.x -= scroll.w.x;
  6655. position.y -= scroll.w.y;
  6656. }
  6657. return position;
  6658. },
  6659. getClone: function(event, element){
  6660. if (!this.options.clone) return new Element(element.tagName).inject(document.body);
  6661. if (typeOf(this.options.clone) == 'function') return this.options.clone.call(this, event, element, this.list);
  6662. var clone = element.clone(true).setStyles({
  6663. margin: 0,
  6664. position: 'absolute',
  6665. visibility: 'hidden',
  6666. width: element.getStyle('width')
  6667. }).addEvent('mousedown', function(event){
  6668. element.fireEvent('mousedown', event);
  6669. });
  6670. //prevent the duplicated radio inputs from unchecking the real one
  6671. if (clone.get('html').test('radio')){
  6672. clone.getElements('input[type=radio]').each(function(input, i){
  6673. input.set('name', 'clone_' + i);
  6674. if (input.get('checked')) element.getElements('input[type=radio]')[i].set('checked', true);
  6675. });
  6676. }
  6677. return clone.inject(this.list).setPosition(this.getDroppableCoordinates(this.element));
  6678. },
  6679. getDroppables: function(){
  6680. var droppables = this.list.getChildren().erase(this.clone).erase(this.element);
  6681. if (!this.options.constrain) droppables.append(this.lists).erase(this.list);
  6682. return droppables;
  6683. },
  6684. insert: function(dragging, element){
  6685. var where = 'inside';
  6686. if (this.lists.contains(element)){
  6687. this.list = element;
  6688. this.drag.droppables = this.getDroppables();
  6689. } else {
  6690. where = this.element.getAllPrevious().contains(element) ? 'before' : 'after';
  6691. }
  6692. this.element.inject(element, where);
  6693. this.fireEvent('sort', [this.element, this.clone]);
  6694. },
  6695. start: function(event, element){
  6696. if (
  6697. !this.idle ||
  6698. event.rightClick ||
  6699. (!this.options.handle && this.options.unDraggableTags.contains(event.target.get('tag')))
  6700. ) return;
  6701. this.idle = false;
  6702. this.element = element;
  6703. this.opacity = element.getStyle('opacity');
  6704. this.list = element.getParent();
  6705. this.clone = this.getClone(event, element);
  6706. this.drag = new Drag.Move(this.clone, Object.merge({
  6707. /*<1.2compat>*/
  6708. preventDefault: this.options.preventDefault,
  6709. snap: this.options.snap,
  6710. container: this.options.constrain && this.element.getParent(),
  6711. /*</1.2compat>*/
  6712. droppables: this.getDroppables()
  6713. }, this.options.dragOptions)).addEvents({
  6714. onSnap: function(){
  6715. event.stop();
  6716. this.clone.setStyle('visibility', 'visible');
  6717. this.element.setStyle('opacity', this.options.opacity || 0);
  6718. this.fireEvent('start', [this.element, this.clone]);
  6719. }.bind(this),
  6720. onEnter: this.insert.bind(this),
  6721. onCancel: this.end.bind(this),
  6722. onComplete: this.end.bind(this)
  6723. });
  6724. this.clone.inject(this.element, 'before');
  6725. this.drag.start(event);
  6726. },
  6727. end: function(){
  6728. this.drag.detach();
  6729. this.element.setStyle('opacity', this.opacity);
  6730. var self = this;
  6731. if (this.effect){
  6732. var dim = this.element.getStyles('width', 'height'),
  6733. clone = this.clone,
  6734. pos = clone.computePosition(this.getDroppableCoordinates(clone));
  6735. var destroy = function(){
  6736. this.removeEvent('cancel', destroy);
  6737. clone.destroy();
  6738. self.reset();
  6739. };
  6740. this.effect.element = clone;
  6741. this.effect.start({
  6742. top: pos.top,
  6743. left: pos.left,
  6744. width: dim.width,
  6745. height: dim.height,
  6746. opacity: 0.25
  6747. }).addEvent('cancel', destroy).chain(destroy);
  6748. } else {
  6749. this.clone.destroy();
  6750. self.reset();
  6751. }
  6752. },
  6753. reset: function(){
  6754. this.idle = true;
  6755. this.fireEvent('complete', this.element);
  6756. },
  6757. serialize: function(){
  6758. var params = Array.link(arguments, {
  6759. modifier: Type.isFunction,
  6760. index: function(obj){
  6761. return obj != null;
  6762. }
  6763. });
  6764. var serial = this.lists.map(function(list){
  6765. return list.getChildren().map(params.modifier || function(element){
  6766. return element.get('id');
  6767. }, this);
  6768. }, this);
  6769. var index = params.index;
  6770. if (this.lists.length == 1) index = 0;
  6771. return (index || index === 0) && index >= 0 && index < this.lists.length ? serial[index] : serial;
  6772. }
  6773. });
  6774. })();
  6775. /*
  6776. ---
  6777. name: Element.Event.Pseudos
  6778. description: Adds the functionality to add pseudo events for Elements
  6779. license: MIT-style license
  6780. authors:
  6781. - Arian Stolwijk
  6782. requires: [Core/Element.Event, Core/Element.Delegation, Events.Pseudos]
  6783. provides: [Element.Event.Pseudos, Element.Delegation.Pseudo]
  6784. ...
  6785. */
  6786. (function(){
  6787. var pseudos = {relay: false},
  6788. copyFromEvents = ['once', 'throttle', 'pause'],
  6789. count = copyFromEvents.length;
  6790. while (count--) pseudos[copyFromEvents[count]] = Events.lookupPseudo(copyFromEvents[count]);
  6791. DOMEvent.definePseudo = function(key, listener){
  6792. pseudos[key] = listener;
  6793. return this;
  6794. };
  6795. var proto = Element.prototype;
  6796. [Element, Window, Document].invoke('implement', Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
  6797. })();
  6798. /*
  6799. ---
  6800. name: Element.Event.Pseudos.Keys
  6801. description: Adds functionality fire events if certain keycombinations are pressed
  6802. license: MIT-style license
  6803. authors:
  6804. - Arian Stolwijk
  6805. requires: [Element.Event.Pseudos]
  6806. provides: [Element.Event.Pseudos.Keys]
  6807. ...
  6808. */
  6809. (function(){
  6810. var keysStoreKey = '$moo:keys-pressed',
  6811. keysKeyupStoreKey = '$moo:keys-keyup';
  6812. DOMEvent.definePseudo('keys', function(split, fn, args){
  6813. var event = args[0],
  6814. keys = [],
  6815. pressed = this.retrieve(keysStoreKey, []),
  6816. value = split.value;
  6817. if (value != '+') keys.append(value.replace('++', function(){
  6818. keys.push('+'); // shift++ and shift+++a
  6819. return '';
  6820. }).split('+'));
  6821. else keys = ['+'];
  6822. pressed.include(event.key);
  6823. if (keys.every(function(key){
  6824. return pressed.contains(key);
  6825. })) fn.apply(this, args);
  6826. this.store(keysStoreKey, pressed);
  6827. if (!this.retrieve(keysKeyupStoreKey)){
  6828. var keyup = function(event){
  6829. (function(){
  6830. pressed = this.retrieve(keysStoreKey, []).erase(event.key);
  6831. this.store(keysStoreKey, pressed);
  6832. }).delay(0, this); // Fix for IE
  6833. };
  6834. this.store(keysKeyupStoreKey, keyup).addEvent('keyup', keyup);
  6835. }
  6836. });
  6837. DOMEvent.defineKeys({
  6838. '16': 'shift',
  6839. '17': 'control',
  6840. '18': 'alt',
  6841. '20': 'capslock',
  6842. '33': 'pageup',
  6843. '34': 'pagedown',
  6844. '35': 'end',
  6845. '36': 'home',
  6846. '144': 'numlock',
  6847. '145': 'scrolllock',
  6848. '186': ';',
  6849. '187': '=',
  6850. '188': ',',
  6851. '190': '.',
  6852. '191': '/',
  6853. '192': '`',
  6854. '219': '[',
  6855. '220': '\\',
  6856. '221': ']',
  6857. '222': "'",
  6858. '107': '+',
  6859. '109': '-', // subtract
  6860. '189': '-' // dash
  6861. });
  6862. })();
  6863. /*
  6864. ---
  6865. script: String.Extras.js
  6866. name: String.Extras
  6867. description: Extends the String native object to include methods useful in managing various kinds of strings (query strings, urls, html, etc).
  6868. license: MIT-style license
  6869. authors:
  6870. - Aaron Newton
  6871. - Guillermo Rauch
  6872. - Christopher Pitt
  6873. requires:
  6874. - Core/String
  6875. - Core/Array
  6876. - MooTools.More
  6877. provides: [String.Extras]
  6878. ...
  6879. */
  6880. (function(){
  6881. var special = {
  6882. 'a': /[àáâãäåăą]/g,
  6883. 'A': /[ÀÁÂÃÄÅĂĄ]/g,
  6884. 'c': /[ćčç]/g,
  6885. 'C': /[ĆČÇ]/g,
  6886. 'd': /[ďđ]/g,
  6887. 'D': /[ĎÐ]/g,
  6888. 'e': /[èéêëěę]/g,
  6889. 'E': /[ÈÉÊËĚĘ]/g,
  6890. 'g': /[ğ]/g,
  6891. 'G': /[Ğ]/g,
  6892. 'i': /[ìíîï]/g,
  6893. 'I': /[ÌÍÎÏ]/g,
  6894. 'l': /[ĺľł]/g,
  6895. 'L': /[ĹĽŁ]/g,
  6896. 'n': /[ñňń]/g,
  6897. 'N': /[ÑŇŃ]/g,
  6898. 'o': /[òóôõöøő]/g,
  6899. 'O': /[ÒÓÔÕÖØ]/g,
  6900. 'r': /[řŕ]/g,
  6901. 'R': /[ŘŔ]/g,
  6902. 's': /[ššş]/g,
  6903. 'S': /[ŠŞŚ]/g,
  6904. 't': /[ťţ]/g,
  6905. 'T': /[ŤŢ]/g,
  6906. 'u': /[ùúûůüµ]/g,
  6907. 'U': /[ÙÚÛŮÜ]/g,
  6908. 'y': /[ÿý]/g,
  6909. 'Y': /[ŸÝ]/g,
  6910. 'z': /[žźż]/g,
  6911. 'Z': /[ŽŹŻ]/g,
  6912. 'th': /[þ]/g,
  6913. 'TH': /[Þ]/g,
  6914. 'dh': /[ð]/g,
  6915. 'DH': /[Ð]/g,
  6916. 'ss': /[ß]/g,
  6917. 'oe': /[œ]/g,
  6918. 'OE': /[Œ]/g,
  6919. 'ae': /[æ]/g,
  6920. 'AE': /[Æ]/g
  6921. },
  6922. tidy = {
  6923. ' ': /[\xa0\u2002\u2003\u2009]/g,
  6924. '*': /[\xb7]/g,
  6925. '\'': /[\u2018\u2019]/g,
  6926. '"': /[\u201c\u201d]/g,
  6927. '...': /[\u2026]/g,
  6928. '-': /[\u2013]/g,
  6929. // '--': /[\u2014]/g,
  6930. '&raquo;': /[\uFFFD]/g
  6931. },
  6932. conversions = {
  6933. ms: 1,
  6934. s: 1000,
  6935. m: 6e4,
  6936. h: 36e5
  6937. },
  6938. findUnits = /(\d*.?\d+)([msh]+)/;
  6939. var walk = function(string, replacements){
  6940. var result = string, key;
  6941. for (key in replacements) result = result.replace(replacements[key], key);
  6942. return result;
  6943. };
  6944. var getRegexForTag = function(tag, contents){
  6945. tag = tag || (contents ? '' : '\\w+');
  6946. var regstr = contents ? '<' + tag + '(?!\\w)[^>]*>([\\s\\S]*?)<\/' + tag + '(?!\\w)>' : '<\/?' + tag + '\/?>|<' + tag + '[\\s|\/][^>]*>';
  6947. return new RegExp(regstr, 'gi');
  6948. };
  6949. String.implement({
  6950. standardize: function(){
  6951. return walk(this, special);
  6952. },
  6953. repeat: function(times){
  6954. return new Array(times + 1).join(this);
  6955. },
  6956. pad: function(length, str, direction){
  6957. if (this.length >= length) return this;
  6958. var pad = (str == null ? ' ' : '' + str)
  6959. .repeat(length - this.length)
  6960. .substr(0, length - this.length);
  6961. if (!direction || direction == 'right') return this + pad;
  6962. if (direction == 'left') return pad + this;
  6963. return pad.substr(0, (pad.length / 2).floor()) + this + pad.substr(0, (pad.length / 2).ceil());
  6964. },
  6965. getTags: function(tag, contents){
  6966. return this.match(getRegexForTag(tag, contents)) || [];
  6967. },
  6968. stripTags: function(tag, contents){
  6969. return this.replace(getRegexForTag(tag, contents), '');
  6970. },
  6971. tidy: function(){
  6972. return walk(this, tidy);
  6973. },
  6974. truncate: function(max, trail, atChar){
  6975. var string = this;
  6976. if (trail == null && arguments.length == 1) trail = '…';
  6977. if (string.length > max){
  6978. string = string.substring(0, max);
  6979. if (atChar){
  6980. var index = string.lastIndexOf(atChar);
  6981. if (index != -1) string = string.substr(0, index);
  6982. }
  6983. if (trail) string += trail;
  6984. }
  6985. return string;
  6986. },
  6987. ms: function(){
  6988. // "Borrowed" from https://gist.github.com/1503944
  6989. var units = findUnits.exec(this);
  6990. if (units == null) return Number(this);
  6991. return Number(units[1]) * conversions[units[2]];
  6992. }
  6993. });
  6994. })();
  6995. /*
  6996. ---
  6997. script: Element.Forms.js
  6998. name: Element.Forms
  6999. description: Extends the Element native object to include methods useful in managing inputs.
  7000. license: MIT-style license
  7001. authors:
  7002. - Aaron Newton
  7003. requires:
  7004. - Core/Element
  7005. - String.Extras
  7006. - MooTools.More
  7007. provides: [Element.Forms]
  7008. ...
  7009. */
  7010. Element.implement({
  7011. tidy: function(){
  7012. this.set('value', this.get('value').tidy());
  7013. },
  7014. getTextInRange: function(start, end){
  7015. return this.get('value').substring(start, end);
  7016. },
  7017. getSelectedText: function(){
  7018. if (this.setSelectionRange) return this.getTextInRange(this.getSelectionStart(), this.getSelectionEnd());
  7019. return document.selection.createRange().text;
  7020. },
  7021. getSelectedRange: function(){
  7022. if (this.selectionStart != null){
  7023. return {
  7024. start: this.selectionStart,
  7025. end: this.selectionEnd
  7026. };
  7027. }
  7028. var pos = {
  7029. start: 0,
  7030. end: 0
  7031. };
  7032. var range = this.getDocument().selection.createRange();
  7033. if (!range || range.parentElement() != this) return pos;
  7034. var duplicate = range.duplicate();
  7035. if (this.type == 'text'){
  7036. pos.start = 0 - duplicate.moveStart('character', -100000);
  7037. pos.end = pos.start + range.text.length;
  7038. } else {
  7039. var value = this.get('value');
  7040. var offset = value.length;
  7041. duplicate.moveToElementText(this);
  7042. duplicate.setEndPoint('StartToEnd', range);
  7043. if (duplicate.text.length) offset -= value.match(/[\n\r]*$/)[0].length;
  7044. pos.end = offset - duplicate.text.length;
  7045. duplicate.setEndPoint('StartToStart', range);
  7046. pos.start = offset - duplicate.text.length;
  7047. }
  7048. return pos;
  7049. },
  7050. getSelectionStart: function(){
  7051. return this.getSelectedRange().start;
  7052. },
  7053. getSelectionEnd: function(){
  7054. return this.getSelectedRange().end;
  7055. },
  7056. setCaretPosition: function(pos){
  7057. if (pos == 'end') pos = this.get('value').length;
  7058. this.selectRange(pos, pos);
  7059. return this;
  7060. },
  7061. getCaretPosition: function(){
  7062. return this.getSelectedRange().start;
  7063. },
  7064. selectRange: function(start, end){
  7065. if (this.setSelectionRange){
  7066. this.focus();
  7067. this.setSelectionRange(start, end);
  7068. } else {
  7069. var value = this.get('value');
  7070. var diff = value.substr(start, end - start).replace(/\r/g, '').length;
  7071. start = value.substr(0, start).replace(/\r/g, '').length;
  7072. var range = this.createTextRange();
  7073. range.collapse(true);
  7074. range.moveEnd('character', start + diff);
  7075. range.moveStart('character', start);
  7076. range.select();
  7077. }
  7078. return this;
  7079. },
  7080. insertAtCursor: function(value, select){
  7081. var pos = this.getSelectedRange();
  7082. var text = this.get('value');
  7083. this.set('value', text.substring(0, pos.start) + value + text.substring(pos.end, text.length));
  7084. if (select !== false) this.selectRange(pos.start, pos.start + value.length);
  7085. else this.setCaretPosition(pos.start + value.length);
  7086. return this;
  7087. },
  7088. insertAroundCursor: function(options, select){
  7089. options = Object.append({
  7090. before: '',
  7091. defaultMiddle: '',
  7092. after: ''
  7093. }, options);
  7094. var value = this.getSelectedText() || options.defaultMiddle;
  7095. var pos = this.getSelectedRange();
  7096. var text = this.get('value');
  7097. if (pos.start == pos.end){
  7098. this.set('value', text.substring(0, pos.start) + options.before + value + options.after + text.substring(pos.end, text.length));
  7099. this.selectRange(pos.start + options.before.length, pos.end + options.before.length + value.length);
  7100. } else {
  7101. var current = text.substring(pos.start, pos.end);
  7102. this.set('value', text.substring(0, pos.start) + options.before + current + options.after + text.substring(pos.end, text.length));
  7103. var selStart = pos.start + options.before.length;
  7104. if (select !== false) this.selectRange(selStart, selStart + current.length);
  7105. else this.setCaretPosition(selStart + text.length);
  7106. }
  7107. return this;
  7108. }
  7109. });
  7110. /*
  7111. ---
  7112. script: Element.Pin.js
  7113. name: Element.Pin
  7114. description: Extends the Element native object to include the pin method useful for fixed positioning for elements.
  7115. license: MIT-style license
  7116. authors:
  7117. - Aaron Newton
  7118. requires:
  7119. - Core/Element.Event
  7120. - Core/Element.Dimensions
  7121. - Core/Element.Style
  7122. - MooTools.More
  7123. provides: [Element.Pin]
  7124. ...
  7125. */
  7126. (function(){
  7127. var supportsPositionFixed = false,
  7128. supportTested = false;
  7129. var testPositionFixed = function(){
  7130. var test = new Element('div').setStyles({
  7131. position: 'fixed',
  7132. top: 0,
  7133. right: 0
  7134. }).inject(document.body);
  7135. supportsPositionFixed = (test.offsetTop === 0);
  7136. test.dispose();
  7137. supportTested = true;
  7138. };
  7139. Element.implement({
  7140. pin: function(enable, forceScroll){
  7141. if (!supportTested) testPositionFixed();
  7142. if (this.getStyle('display') == 'none') return this;
  7143. var pinnedPosition,
  7144. scroll = window.getScroll(),
  7145. parent,
  7146. scrollFixer;
  7147. if (enable !== false){
  7148. pinnedPosition = this.getPosition();
  7149. if (!this.retrieve('pin:_pinned')){
  7150. var currentPosition = {
  7151. top: pinnedPosition.y - scroll.y,
  7152. left: pinnedPosition.x - scroll.x,
  7153. margin: '0px',
  7154. padding: '0px'
  7155. };
  7156. if (supportsPositionFixed && !forceScroll){
  7157. this.setStyle('position', 'fixed').setStyles(currentPosition);
  7158. } else {
  7159. parent = this.getOffsetParent();
  7160. var position = this.getPosition(parent),
  7161. styles = this.getStyles('left', 'top');
  7162. if (parent && styles.left == 'auto' || styles.top == 'auto') this.setPosition(position);
  7163. if (this.getStyle('position') == 'static') this.setStyle('position', 'absolute');
  7164. position = {
  7165. x: styles.left.toInt() - scroll.x,
  7166. y: styles.top.toInt() - scroll.y
  7167. };
  7168. scrollFixer = function(){
  7169. if (!this.retrieve('pin:_pinned')) return;
  7170. var scroll = window.getScroll();
  7171. this.setStyles({
  7172. left: position.x + scroll.x,
  7173. top: position.y + scroll.y
  7174. });
  7175. }.bind(this);
  7176. this.store('pin:_scrollFixer', scrollFixer);
  7177. window.addEvent('scroll', scrollFixer);
  7178. }
  7179. this.store('pin:_pinned', true);
  7180. }
  7181. } else {
  7182. if (!this.retrieve('pin:_pinned')) return this;
  7183. parent = this.getParent();
  7184. var offsetParent = (parent.getComputedStyle('position') != 'static' ? parent : parent.getOffsetParent());
  7185. pinnedPosition = this.getPosition();
  7186. this.store('pin:_pinned', false);
  7187. scrollFixer = this.retrieve('pin:_scrollFixer');
  7188. if (!scrollFixer){
  7189. this.setStyles({
  7190. position: 'absolute',
  7191. top: pinnedPosition.y + scroll.y,
  7192. left: pinnedPosition.x + scroll.x
  7193. });
  7194. } else {
  7195. this.store('pin:_scrollFixer', null);
  7196. window.removeEvent('scroll', scrollFixer);
  7197. }
  7198. this.removeClass('isPinned');
  7199. }
  7200. return this;
  7201. },
  7202. unpin: function(){
  7203. return this.pin(false);
  7204. },
  7205. togglePin: function(){
  7206. return this.pin(!this.retrieve('pin:_pinned'));
  7207. }
  7208. });
  7209. //<1.2compat>
  7210. Element.alias('togglepin', 'togglePin');
  7211. //</1.2compat>
  7212. })();
  7213. /*
  7214. ---
  7215. script: Element.Position.js
  7216. name: Element.Position
  7217. description: Extends the Element native object to include methods useful positioning elements relative to others.
  7218. license: MIT-style license
  7219. authors:
  7220. - Aaron Newton
  7221. - Jacob Thornton
  7222. requires:
  7223. - Core/Options
  7224. - Core/Element.Dimensions
  7225. - Element.Measure
  7226. provides: [Element.Position]
  7227. ...
  7228. */
  7229. (function(original){
  7230. var local = Element.Position = {
  7231. options: {/*
  7232. edge: false,
  7233. returnPos: false,
  7234. minimum: {x: 0, y: 0},
  7235. maximum: {x: 0, y: 0},
  7236. relFixedPosition: false,
  7237. ignoreMargins: false,
  7238. ignoreScroll: false,
  7239. allowNegative: false,*/
  7240. relativeTo: document.body,
  7241. position: {
  7242. x: 'center', //left, center, right
  7243. y: 'center' //top, center, bottom
  7244. },
  7245. offset: {x: 0, y: 0}
  7246. },
  7247. getOptions: function(element, options){
  7248. options = Object.merge({}, local.options, options);
  7249. local.setPositionOption(options);
  7250. local.setEdgeOption(options);
  7251. local.setOffsetOption(element, options);
  7252. local.setDimensionsOption(element, options);
  7253. return options;
  7254. },
  7255. setPositionOption: function(options){
  7256. options.position = local.getCoordinateFromValue(options.position);
  7257. },
  7258. setEdgeOption: function(options){
  7259. var edgeOption = local.getCoordinateFromValue(options.edge);
  7260. options.edge = edgeOption ? edgeOption :
  7261. (options.position.x == 'center' && options.position.y == 'center') ? {x: 'center', y: 'center'} :
  7262. {x: 'left', y: 'top'};
  7263. },
  7264. setOffsetOption: function(element, options){
  7265. var parentOffset = {x: 0, y: 0};
  7266. var parentScroll = {x: 0, y: 0};
  7267. var offsetParent = element.measure(function(){
  7268. return document.id(this.getOffsetParent());
  7269. });
  7270. if (!offsetParent || offsetParent == element.getDocument().body) return;
  7271. parentScroll = offsetParent.getScroll();
  7272. parentOffset = offsetParent.measure(function(){
  7273. var position = this.getPosition();
  7274. if (this.getStyle('position') == 'fixed'){
  7275. var scroll = window.getScroll();
  7276. position.x += scroll.x;
  7277. position.y += scroll.y;
  7278. }
  7279. return position;
  7280. });
  7281. options.offset = {
  7282. parentPositioned: offsetParent != document.id(options.relativeTo),
  7283. x: options.offset.x - parentOffset.x + parentScroll.x,
  7284. y: options.offset.y - parentOffset.y + parentScroll.y
  7285. };
  7286. },
  7287. setDimensionsOption: function(element, options){
  7288. options.dimensions = element.getDimensions({
  7289. computeSize: true,
  7290. styles: ['padding', 'border', 'margin']
  7291. });
  7292. },
  7293. getPosition: function(element, options){
  7294. var position = {};
  7295. options = local.getOptions(element, options);
  7296. var relativeTo = document.id(options.relativeTo) || document.body;
  7297. local.setPositionCoordinates(options, position, relativeTo);
  7298. if (options.edge) local.toEdge(position, options);
  7299. var offset = options.offset;
  7300. position.left = ((position.x >= 0 || offset.parentPositioned || options.allowNegative) ? position.x : 0).toInt();
  7301. position.top = ((position.y >= 0 || offset.parentPositioned || options.allowNegative) ? position.y : 0).toInt();
  7302. local.toMinMax(position, options);
  7303. if (options.relFixedPosition || relativeTo.getStyle('position') == 'fixed') local.toRelFixedPosition(relativeTo, position);
  7304. if (options.ignoreScroll) local.toIgnoreScroll(relativeTo, position);
  7305. if (options.ignoreMargins) local.toIgnoreMargins(position, options);
  7306. position.left = Math.ceil(position.left);
  7307. position.top = Math.ceil(position.top);
  7308. delete position.x;
  7309. delete position.y;
  7310. return position;
  7311. },
  7312. setPositionCoordinates: function(options, position, relativeTo){
  7313. var offsetY = options.offset.y,
  7314. offsetX = options.offset.x,
  7315. calc = (relativeTo == document.body) ? window.getScroll() : relativeTo.getPosition(),
  7316. top = calc.y,
  7317. left = calc.x,
  7318. winSize = window.getSize();
  7319. switch (options.position.x){
  7320. case 'left': position.x = left + offsetX; break;
  7321. case 'right': position.x = left + offsetX + relativeTo.offsetWidth; break;
  7322. default: position.x = left + ((relativeTo == document.body ? winSize.x : relativeTo.offsetWidth) / 2) + offsetX; break;
  7323. }
  7324. switch (options.position.y){
  7325. case 'top': position.y = top + offsetY; break;
  7326. case 'bottom': position.y = top + offsetY + relativeTo.offsetHeight; break;
  7327. default: position.y = top + ((relativeTo == document.body ? winSize.y : relativeTo.offsetHeight) / 2) + offsetY; break;
  7328. }
  7329. },
  7330. toMinMax: function(position, options){
  7331. var xy = {left: 'x', top: 'y'}, value;
  7332. ['minimum', 'maximum'].each(function(minmax){
  7333. ['left', 'top'].each(function(lr){
  7334. value = options[minmax] ? options[minmax][xy[lr]] : null;
  7335. if (value != null && ((minmax == 'minimum') ? position[lr] < value : position[lr] > value)) position[lr] = value;
  7336. });
  7337. });
  7338. },
  7339. toRelFixedPosition: function(relativeTo, position){
  7340. var winScroll = window.getScroll();
  7341. position.top += winScroll.y;
  7342. position.left += winScroll.x;
  7343. },
  7344. toIgnoreScroll: function(relativeTo, position){
  7345. var relScroll = relativeTo.getScroll();
  7346. position.top -= relScroll.y;
  7347. position.left -= relScroll.x;
  7348. },
  7349. toIgnoreMargins: function(position, options){
  7350. position.left += options.edge.x == 'right'
  7351. ? options.dimensions['margin-right']
  7352. : (options.edge.x != 'center'
  7353. ? -options.dimensions['margin-left']
  7354. : -options.dimensions['margin-left'] + ((options.dimensions['margin-right'] + options.dimensions['margin-left']) / 2));
  7355. position.top += options.edge.y == 'bottom'
  7356. ? options.dimensions['margin-bottom']
  7357. : (options.edge.y != 'center'
  7358. ? -options.dimensions['margin-top']
  7359. : -options.dimensions['margin-top'] + ((options.dimensions['margin-bottom'] + options.dimensions['margin-top']) / 2));
  7360. },
  7361. toEdge: function(position, options){
  7362. var edgeOffset = {},
  7363. dimensions = options.dimensions,
  7364. edge = options.edge;
  7365. switch (edge.x){
  7366. case 'left': edgeOffset.x = 0; break;
  7367. case 'right': edgeOffset.x = -dimensions.x - dimensions.computedRight - dimensions.computedLeft; break;
  7368. // center
  7369. default: edgeOffset.x = -(Math.round(dimensions.totalWidth / 2)); break;
  7370. }
  7371. switch (edge.y){
  7372. case 'top': edgeOffset.y = 0; break;
  7373. case 'bottom': edgeOffset.y = -dimensions.y - dimensions.computedTop - dimensions.computedBottom; break;
  7374. // center
  7375. default: edgeOffset.y = -(Math.round(dimensions.totalHeight / 2)); break;
  7376. }
  7377. position.x += edgeOffset.x;
  7378. position.y += edgeOffset.y;
  7379. },
  7380. getCoordinateFromValue: function(option){
  7381. if (typeOf(option) != 'string') return option;
  7382. option = option.toLowerCase();
  7383. return {
  7384. x: option.test('left') ? 'left'
  7385. : (option.test('right') ? 'right' : 'center'),
  7386. y: option.test(/upper|top/) ? 'top'
  7387. : (option.test('bottom') ? 'bottom' : 'center')
  7388. };
  7389. }
  7390. };
  7391. Element.implement({
  7392. position: function(options){
  7393. if (options && (options.x != null || options.y != null)){
  7394. return (original ? original.apply(this, arguments) : this);
  7395. }
  7396. var position = this.setStyle('position', 'absolute').calculatePosition(options);
  7397. return (options && options.returnPos) ? position : this.setStyles(position);
  7398. },
  7399. calculatePosition: function(options){
  7400. return local.getPosition(this, options);
  7401. }
  7402. });
  7403. })(Element.prototype.position);
  7404. /*
  7405. ---
  7406. script: Element.Shortcuts.js
  7407. name: Element.Shortcuts
  7408. description: Extends the Element native object to include some shortcut methods.
  7409. license: MIT-style license
  7410. authors:
  7411. - Aaron Newton
  7412. requires:
  7413. - Core/Element.Style
  7414. - MooTools.More
  7415. provides: [Element.Shortcuts]
  7416. ...
  7417. */
  7418. Element.implement({
  7419. isDisplayed: function(){
  7420. return this.getStyle('display') != 'none';
  7421. },
  7422. isVisible: function(){
  7423. var w = this.offsetWidth,
  7424. h = this.offsetHeight;
  7425. return (w == 0 && h == 0) ? false : (w > 0 && h > 0) ? true : this.style.display != 'none';
  7426. },
  7427. toggle: function(){
  7428. return this[this.isDisplayed() ? 'hide' : 'show']();
  7429. },
  7430. hide: function(){
  7431. var d;
  7432. try {
  7433. //IE fails here if the element is not in the dom
  7434. d = this.getStyle('display');
  7435. } catch (e){}
  7436. if (d == 'none') return this;
  7437. return this.store('element:_originalDisplay', d || '').setStyle('display', 'none');
  7438. },
  7439. show: function(display){
  7440. if (!display && this.isDisplayed()) return this;
  7441. display = display || this.retrieve('element:_originalDisplay') || 'block';
  7442. return this.setStyle('display', (display == 'none') ? 'block' : display);
  7443. },
  7444. swapClass: function(remove, add){
  7445. return this.removeClass(remove).addClass(add);
  7446. }
  7447. });
  7448. Document.implement({
  7449. clearSelection: function(){
  7450. if (window.getSelection){
  7451. var selection = window.getSelection();
  7452. if (selection && selection.removeAllRanges) selection.removeAllRanges();
  7453. } else if (document.selection && document.selection.empty){
  7454. try {
  7455. //IE fails here if selected element is not in dom
  7456. document.selection.empty();
  7457. } catch (e){}
  7458. }
  7459. }
  7460. });
  7461. /*
  7462. ---
  7463. script: Elements.From.js
  7464. name: Elements.From
  7465. description: Returns a collection of elements from a string of html.
  7466. license: MIT-style license
  7467. authors:
  7468. - Aaron Newton
  7469. requires:
  7470. - Core/String
  7471. - Core/Element
  7472. - MooTools.More
  7473. provides: [Elements.from, Elements.From]
  7474. ...
  7475. */
  7476. Elements.from = function(text, excludeScripts){
  7477. if (excludeScripts || excludeScripts == null) text = text.stripScripts();
  7478. var container, match = text.match(/^\s*(?:<!--.*?-->\s*)*<(t[dhr]|tbody|tfoot|thead)/i);
  7479. if (match){
  7480. container = new Element('table');
  7481. var tag = match[1].toLowerCase();
  7482. if (['td', 'th', 'tr'].contains(tag)){
  7483. container = new Element('tbody').inject(container);
  7484. if (tag != 'tr') container = new Element('tr').inject(container);
  7485. }
  7486. }
  7487. return (container || new Element('div')).set('html', text).getChildren();
  7488. };
  7489. /*
  7490. ---
  7491. script: IframeShim.js
  7492. name: IframeShim
  7493. description: Defines IframeShim, a class for obscuring select lists and flash objects in IE.
  7494. license: MIT-style license
  7495. authors:
  7496. - Aaron Newton
  7497. requires:
  7498. - Core/Element.Event
  7499. - Core/Element.Style
  7500. - Core/Options
  7501. - Core/Events
  7502. - Element.Position
  7503. - Class.Occlude
  7504. provides: [IframeShim]
  7505. ...
  7506. */
  7507. (function(){
  7508. var browsers = false;
  7509. //<1.4compat>
  7510. browsers = Browser.ie6 || (Browser.firefox && Browser.version < 3 && Browser.Platform.mac);
  7511. //</1.4compat>
  7512. var IframeShim = this.IframeShim = new Class({
  7513. Implements: [Options, Events, Class.Occlude],
  7514. options: {
  7515. className: 'iframeShim',
  7516. src: 'javascript:false;document.write("");',
  7517. display: false,
  7518. zIndex: null,
  7519. margin: 0,
  7520. offset: {x: 0, y: 0},
  7521. browsers: browsers
  7522. },
  7523. property: 'IframeShim',
  7524. initialize: function(element, options){
  7525. this.element = document.id(element);
  7526. if (this.occlude()) return this.occluded;
  7527. this.setOptions(options);
  7528. this.makeShim();
  7529. return this;
  7530. },
  7531. makeShim: function(){
  7532. if (this.options.browsers){
  7533. var zIndex = this.element.getStyle('zIndex').toInt();
  7534. if (!zIndex){
  7535. zIndex = 1;
  7536. var pos = this.element.getStyle('position');
  7537. if (pos == 'static' || !pos) this.element.setStyle('position', 'relative');
  7538. this.element.setStyle('zIndex', zIndex);
  7539. }
  7540. zIndex = ((this.options.zIndex != null || this.options.zIndex === 0) && zIndex > this.options.zIndex) ? this.options.zIndex : zIndex - 1;
  7541. if (zIndex < 0) zIndex = 1;
  7542. this.shim = new Element('iframe', {
  7543. src: this.options.src,
  7544. scrolling: 'no',
  7545. frameborder: 0,
  7546. styles: {
  7547. zIndex: zIndex,
  7548. position: 'absolute',
  7549. border: 'none',
  7550. filter: 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'
  7551. },
  7552. 'class': this.options.className
  7553. }).store('IframeShim', this);
  7554. var inject = (function(){
  7555. this.shim.inject(this.element, 'after');
  7556. this[this.options.display ? 'show' : 'hide']();
  7557. this.fireEvent('inject');
  7558. }).bind(this);
  7559. if (!IframeShim.ready) window.addEvent('load', inject);
  7560. else inject();
  7561. } else {
  7562. this.position = this.hide = this.show = this.dispose = Function.convert(this);
  7563. }
  7564. },
  7565. position: function(){
  7566. if (!IframeShim.ready || !this.shim) return this;
  7567. var size = this.element.measure(function(){
  7568. return this.getSize();
  7569. });
  7570. if (this.options.margin != undefined){
  7571. size.x = size.x - (this.options.margin * 2);
  7572. size.y = size.y - (this.options.margin * 2);
  7573. this.options.offset.x += this.options.margin;
  7574. this.options.offset.y += this.options.margin;
  7575. }
  7576. this.shim.set({width: size.x, height: size.y}).position({
  7577. relativeTo: this.element,
  7578. offset: this.options.offset
  7579. });
  7580. return this;
  7581. },
  7582. hide: function(){
  7583. if (this.shim) this.shim.setStyle('display', 'none');
  7584. return this;
  7585. },
  7586. show: function(){
  7587. if (this.shim) this.shim.setStyle('display', 'block');
  7588. return this.position();
  7589. },
  7590. dispose: function(){
  7591. if (this.shim) this.shim.dispose();
  7592. return this;
  7593. },
  7594. destroy: function(){
  7595. if (this.shim) this.shim.destroy();
  7596. return this;
  7597. }
  7598. });
  7599. })();
  7600. window.addEvent('load', function(){
  7601. IframeShim.ready = true;
  7602. });
  7603. /*
  7604. ---
  7605. script: Mask.js
  7606. name: Mask
  7607. description: Creates a mask element to cover another.
  7608. license: MIT-style license
  7609. authors:
  7610. - Aaron Newton
  7611. requires:
  7612. - Core/Options
  7613. - Core/Events
  7614. - Core/Element.Event
  7615. - Class.Binds
  7616. - Element.Position
  7617. - IframeShim
  7618. provides: [Mask]
  7619. ...
  7620. */
  7621. (function(){
  7622. var Mask = this.Mask = new Class({
  7623. Implements: [Options, Events],
  7624. Binds: ['position'],
  7625. options: {/*
  7626. onShow: function(){},
  7627. onHide: function(){},
  7628. onDestroy: function(){},
  7629. onClick: function(event){},
  7630. inject: {
  7631. where: 'after',
  7632. target: null,
  7633. },
  7634. hideOnClick: false,
  7635. id: null,
  7636. destroyOnHide: false,*/
  7637. style: {},
  7638. 'class': 'mask',
  7639. maskMargins: false,
  7640. useIframeShim: true,
  7641. iframeShimOptions: {}
  7642. },
  7643. initialize: function(target, options){
  7644. this.target = document.id(target) || document.id(document.body);
  7645. this.target.store('mask', this);
  7646. this.setOptions(options);
  7647. this.render();
  7648. this.inject();
  7649. },
  7650. render: function(){
  7651. this.element = new Element('div', {
  7652. 'class': this.options['class'],
  7653. id: this.options.id || 'mask-' + String.uniqueID(),
  7654. styles: Object.merge({}, this.options.style, {
  7655. display: 'none'
  7656. }),
  7657. events: {
  7658. click: function(event){
  7659. this.fireEvent('click', event);
  7660. if (this.options.hideOnClick) this.hide();
  7661. }.bind(this)
  7662. }
  7663. });
  7664. this.hidden = true;
  7665. },
  7666. toElement: function(){
  7667. return this.element;
  7668. },
  7669. inject: function(target, where){
  7670. where = where || (this.options.inject ? this.options.inject.where : '') || (this.target == document.body ? 'inside' : 'after');
  7671. target = target || (this.options.inject && this.options.inject.target) || this.target;
  7672. this.element.inject(target, where);
  7673. if (this.options.useIframeShim){
  7674. this.shim = new IframeShim(this.element, this.options.iframeShimOptions);
  7675. this.addEvents({
  7676. show: this.shim.show.bind(this.shim),
  7677. hide: this.shim.hide.bind(this.shim),
  7678. destroy: this.shim.destroy.bind(this.shim)
  7679. });
  7680. }
  7681. },
  7682. position: function(){
  7683. this.resize(this.options.width, this.options.height);
  7684. this.element.position({
  7685. relativeTo: this.target,
  7686. position: 'topLeft',
  7687. ignoreMargins: !this.options.maskMargins,
  7688. ignoreScroll: this.target == document.body
  7689. });
  7690. return this;
  7691. },
  7692. resize: function(x, y){
  7693. var opt = {
  7694. styles: ['padding', 'border']
  7695. };
  7696. if (this.options.maskMargins) opt.styles.push('margin');
  7697. var dim = this.target.getComputedSize(opt);
  7698. var s = this.target.getSize();
  7699. if (dim.totalHeight<s.y) dim.totalHeight = s.y;
  7700. if (dim.totalWidth<s.x) dim.totalWidth = s.x;
  7701. if (this.target == document.body){
  7702. this.element.setStyles({width: 0, height: 0});
  7703. var win = window.getScrollSize();
  7704. if (dim.totalHeight < win.y) dim.totalHeight = win.y;
  7705. if (dim.totalWidth < win.x) dim.totalWidth = win.x;
  7706. }
  7707. this.element.setStyles({
  7708. width: Array.pick([x, dim.totalWidth, dim.x]),
  7709. height: Array.pick([y, dim.totalHeight, dim.y])
  7710. });
  7711. return this;
  7712. },
  7713. show: function(){
  7714. if (!this.hidden) return this;
  7715. window.addEvent('resize', this.position);
  7716. this.position();
  7717. this.showMask.apply(this, arguments);
  7718. return this;
  7719. },
  7720. showMask: function(){
  7721. this.element.setStyle('display', 'block');
  7722. this.hidden = false;
  7723. this.fireEvent('show');
  7724. },
  7725. hide: function(){
  7726. if (this.hidden) return this;
  7727. window.removeEvent('resize', this.position);
  7728. this.hideMask.apply(this, arguments);
  7729. if (this.options.destroyOnHide) return this.destroy();
  7730. return this;
  7731. },
  7732. hideMask: function(){
  7733. this.element.setStyle('display', 'none');
  7734. this.hidden = true;
  7735. this.fireEvent('hide');
  7736. },
  7737. toggle: function(){
  7738. this[this.hidden ? 'show' : 'hide']();
  7739. },
  7740. destroy: function(){
  7741. this.hide();
  7742. this.element.destroy();
  7743. this.fireEvent('destroy');
  7744. this.target.eliminate('mask');
  7745. }
  7746. });
  7747. })();
  7748. Element.Properties.mask = {
  7749. set: function(options){
  7750. var mask = this.retrieve('mask');
  7751. if (mask) mask.destroy();
  7752. return this.eliminate('mask').store('mask:options', options);
  7753. },
  7754. get: function(){
  7755. var mask = this.retrieve('mask');
  7756. if (!mask){
  7757. mask = new Mask(this, this.retrieve('mask:options'));
  7758. this.store('mask', mask);
  7759. }
  7760. return mask;
  7761. }
  7762. };
  7763. Element.implement({
  7764. mask: function(options){
  7765. if (options) this.set('mask', options);
  7766. this.get('mask').show();
  7767. return this;
  7768. },
  7769. unmask: function(){
  7770. this.get('mask').hide();
  7771. return this;
  7772. }
  7773. });
  7774. /*
  7775. ---
  7776. script: Spinner.js
  7777. name: Spinner
  7778. description: Adds a semi-transparent overlay over a dom element with a spinnin ajax icon.
  7779. license: MIT-style license
  7780. authors:
  7781. - Aaron Newton
  7782. requires:
  7783. - Core/Fx.Tween
  7784. - Core/Request
  7785. - Class.refactor
  7786. - Mask
  7787. provides: [Spinner]
  7788. ...
  7789. */
  7790. (function(){
  7791. var Spinner = this.Spinner = new Class({
  7792. Extends: this.Mask,
  7793. Implements: Chain,
  7794. options: {/*
  7795. message: false,*/
  7796. 'class': 'spinner',
  7797. containerPosition: {},
  7798. content: {
  7799. 'class': 'spinner-content'
  7800. },
  7801. messageContainer: {
  7802. 'class': 'spinner-msg'
  7803. },
  7804. img: {
  7805. 'class': 'spinner-img'
  7806. },
  7807. fxOptions: {
  7808. link: 'chain'
  7809. }
  7810. },
  7811. initialize: function(target, options){
  7812. this.target = document.id(target) || document.id(document.body);
  7813. this.target.store('spinner', this);
  7814. this.setOptions(options);
  7815. this.render();
  7816. this.inject();
  7817. // Add this to events for when noFx is true; parent methods handle hide/show.
  7818. var deactivate = function(){ this.active = false; }.bind(this);
  7819. this.addEvents({
  7820. hide: deactivate,
  7821. show: deactivate
  7822. });
  7823. },
  7824. render: function(){
  7825. this.parent();
  7826. this.element.set('id', this.options.id || 'spinner-' + String.uniqueID());
  7827. this.content = document.id(this.options.content) || new Element('div', this.options.content);
  7828. this.content.inject(this.element);
  7829. if (this.options.message){
  7830. this.msg = document.id(this.options.message) || new Element('p', this.options.messageContainer).appendText(this.options.message);
  7831. this.msg.inject(this.content);
  7832. }
  7833. if (this.options.img){
  7834. this.img = document.id(this.options.img) || new Element('div', this.options.img);
  7835. this.img.inject(this.content);
  7836. }
  7837. this.element.set('tween', this.options.fxOptions);
  7838. },
  7839. show: function(noFx){
  7840. if (this.active) return this.chain(this.show.bind(this));
  7841. if (!this.hidden){
  7842. this.callChain.delay(20, this);
  7843. return this;
  7844. }
  7845. this.target.set('aria-busy', 'true');
  7846. this.active = true;
  7847. return this.parent(noFx);
  7848. },
  7849. showMask: function(noFx){
  7850. var pos = function(){
  7851. this.content.position(Object.merge({
  7852. relativeTo: this.element
  7853. }, this.options.containerPosition));
  7854. }.bind(this);
  7855. if (noFx){
  7856. this.parent();
  7857. pos();
  7858. } else {
  7859. if (!this.options.style.opacity) this.options.style.opacity = this.element.getStyle('opacity').toFloat();
  7860. this.element.setStyles({
  7861. display: 'block',
  7862. opacity: 0
  7863. }).tween('opacity', this.options.style.opacity);
  7864. pos();
  7865. this.hidden = false;
  7866. this.fireEvent('show');
  7867. this.callChain();
  7868. }
  7869. },
  7870. hide: function(noFx){
  7871. if (this.active) return this.chain(this.hide.bind(this));
  7872. if (this.hidden){
  7873. this.callChain.delay(20, this);
  7874. return this;
  7875. }
  7876. this.target.set('aria-busy', 'false');
  7877. this.active = true;
  7878. return this.parent(noFx);
  7879. },
  7880. hideMask: function(noFx){
  7881. if (noFx) return this.parent();
  7882. this.element.tween('opacity', 0).get('tween').chain(function(){
  7883. this.element.setStyle('display', 'none');
  7884. this.hidden = true;
  7885. this.fireEvent('hide');
  7886. this.callChain();
  7887. }.bind(this));
  7888. },
  7889. destroy: function(){
  7890. this.content.destroy();
  7891. this.parent();
  7892. this.target.eliminate('spinner');
  7893. }
  7894. });
  7895. })();
  7896. Request = Class.refactor(Request, {
  7897. options: {
  7898. useSpinner: false,
  7899. spinnerOptions: {},
  7900. spinnerTarget: false
  7901. },
  7902. initialize: function(options){
  7903. this._send = this.send;
  7904. this.send = function(options){
  7905. var spinner = this.getSpinner();
  7906. if (spinner) spinner.chain(this._send.pass(options, this)).show();
  7907. else this._send(options);
  7908. return this;
  7909. };
  7910. this.previous(options);
  7911. },
  7912. getSpinner: function(){
  7913. if (!this.spinner){
  7914. var update = document.id(this.options.spinnerTarget) || document.id(this.options.update);
  7915. if (this.options.useSpinner && update){
  7916. update.set('spinner', this.options.spinnerOptions);
  7917. var spinner = this.spinner = update.get('spinner');
  7918. ['complete', 'exception', 'cancel'].each(function(event){
  7919. this.addEvent(event, spinner.hide.bind(spinner));
  7920. }, this);
  7921. }
  7922. }
  7923. return this.spinner;
  7924. }
  7925. });
  7926. Element.Properties.spinner = {
  7927. set: function(options){
  7928. var spinner = this.retrieve('spinner');
  7929. if (spinner) spinner.destroy();
  7930. return this.eliminate('spinner').store('spinner:options', options);
  7931. },
  7932. get: function(){
  7933. var spinner = this.retrieve('spinner');
  7934. if (!spinner){
  7935. spinner = new Spinner(this, this.retrieve('spinner:options'));
  7936. this.store('spinner', spinner);
  7937. }
  7938. return spinner;
  7939. }
  7940. };
  7941. Element.implement({
  7942. spin: function(options){
  7943. if (options) this.set('spinner', options);
  7944. this.get('spinner').show();
  7945. return this;
  7946. },
  7947. unspin: function(){
  7948. this.get('spinner').hide();
  7949. return this;
  7950. }
  7951. });
  7952. /*
  7953. ---
  7954. script: String.QueryString.js
  7955. name: String.QueryString
  7956. description: Methods for dealing with URI query strings.
  7957. license: MIT-style license
  7958. authors:
  7959. - Sebastian Markbåge
  7960. - Aaron Newton
  7961. - Lennart Pilon
  7962. - Valerio Proietti
  7963. requires:
  7964. - Core/Array
  7965. - Core/String
  7966. - MooTools.More
  7967. provides: [String.QueryString]
  7968. ...
  7969. */
  7970. (function(){
  7971. /**
  7972. * decodeURIComponent doesn't do the correct thing with query parameter keys or
  7973. * values. Specifically, it leaves '+' as '+' when it should be converting them
  7974. * to spaces as that's the specification. When browsers submit HTML forms via
  7975. * GET, the values are encoded using 'application/x-www-form-urlencoded'
  7976. * which converts spaces to '+'.
  7977. *
  7978. * See: http://unixpapa.com/js/querystring.html for a description of the
  7979. * problem.
  7980. */
  7981. var decodeComponent = function(str){
  7982. return decodeURIComponent(str.replace(/\+/g, ' '));
  7983. };
  7984. String.implement({
  7985. parseQueryString: function(decodeKeys, decodeValues){
  7986. if (decodeKeys == null) decodeKeys = true;
  7987. if (decodeValues == null) decodeValues = true;
  7988. var vars = this.split(/[&;]/),
  7989. object = {};
  7990. if (!vars.length) return object;
  7991. vars.each(function(val){
  7992. var index = val.indexOf('=') + 1,
  7993. value = index ? val.substr(index) : '',
  7994. keys = index ? val.substr(0, index - 1).match(/([^\]\[]+|(\B)(?=\]))/g) : [val],
  7995. obj = object;
  7996. if (!keys) return;
  7997. if (decodeValues) value = decodeComponent(value);
  7998. keys.each(function(key, i){
  7999. if (decodeKeys) key = decodeComponent(key);
  8000. var current = obj[key];
  8001. if (i < keys.length - 1) obj = obj[key] = current || {};
  8002. else if (typeOf(current) == 'array') current.push(value);
  8003. else obj[key] = current != null ? [current, value] : value;
  8004. });
  8005. });
  8006. return object;
  8007. },
  8008. cleanQueryString: function(method){
  8009. return this.split('&').filter(function(val){
  8010. var index = val.indexOf('='),
  8011. key = index < 0 ? '' : val.substr(0, index),
  8012. value = val.substr(index + 1);
  8013. return method ? method.call(null, key, value) : (value || value === 0);
  8014. }).join('&');
  8015. }
  8016. });
  8017. })();
  8018. /*
  8019. ---
  8020. script: Form.Request.js
  8021. name: Form.Request
  8022. description: Handles the basic functionality of submitting a form and updating a dom element with the result.
  8023. license: MIT-style license
  8024. authors:
  8025. - Aaron Newton
  8026. requires:
  8027. - Core/Request.HTML
  8028. - Class.Binds
  8029. - Class.Occlude
  8030. - Spinner
  8031. - String.QueryString
  8032. - Element.Delegation.Pseudo
  8033. provides: [Form.Request]
  8034. ...
  8035. */
  8036. if (!window.Form) window.Form = {};
  8037. (function(){
  8038. Form.Request = new Class({
  8039. Binds: ['onSubmit', 'onFormValidate'],
  8040. Implements: [Options, Events, Class.Occlude],
  8041. options: {/*
  8042. onFailure: function(){},
  8043. onSuccess: function(){}, // aliased to onComplete,
  8044. onSend: function(){}*/
  8045. requestOptions: {
  8046. evalScripts: true,
  8047. useSpinner: true,
  8048. emulation: false,
  8049. link: 'ignore'
  8050. },
  8051. sendButtonClicked: true,
  8052. extraData: {},
  8053. resetForm: true
  8054. },
  8055. property: 'form.request',
  8056. initialize: function(form, target, options){
  8057. this.element = document.id(form);
  8058. if (this.occlude()) return this.occluded;
  8059. this.setOptions(options)
  8060. .setTarget(target)
  8061. .attach();
  8062. },
  8063. setTarget: function(target){
  8064. this.target = document.id(target);
  8065. if (!this.request){
  8066. this.makeRequest();
  8067. } else {
  8068. this.request.setOptions({
  8069. update: this.target
  8070. });
  8071. }
  8072. return this;
  8073. },
  8074. toElement: function(){
  8075. return this.element;
  8076. },
  8077. makeRequest: function(){
  8078. var self = this;
  8079. this.request = new Request.HTML(Object.merge({
  8080. update: this.target,
  8081. emulation: false,
  8082. spinnerTarget: this.element,
  8083. method: this.element.get('method') || 'post'
  8084. }, this.options.requestOptions)).addEvents({
  8085. success: function(tree, elements, html, javascript){
  8086. ['complete', 'success'].each(function(evt){
  8087. self.fireEvent(evt, [self.target, tree, elements, html, javascript]);
  8088. });
  8089. },
  8090. failure: function(){
  8091. self.fireEvent('complete', arguments).fireEvent('failure', arguments);
  8092. },
  8093. exception: function(){
  8094. self.fireEvent('failure', arguments);
  8095. }
  8096. });
  8097. return this.attachReset();
  8098. },
  8099. attachReset: function(){
  8100. if (!this.options.resetForm) return this;
  8101. this.request.addEvent('success', function(){
  8102. Function.attempt(function(){
  8103. this.element.reset();
  8104. }.bind(this));
  8105. if (window.OverText) OverText.update();
  8106. }.bind(this));
  8107. return this;
  8108. },
  8109. attach: function(attach){
  8110. var method = (attach != false) ? 'addEvent' : 'removeEvent';
  8111. this.element[method]('click:relay(button, input[type=submit])', this.saveClickedButton.bind(this));
  8112. var fv = this.element.retrieve('validator');
  8113. if (fv) fv[method]('onFormValidate', this.onFormValidate);
  8114. else this.element[method]('submit', this.onSubmit);
  8115. return this;
  8116. },
  8117. detach: function(){
  8118. return this.attach(false);
  8119. },
  8120. //public method
  8121. enable: function(){
  8122. return this.attach();
  8123. },
  8124. //public method
  8125. disable: function(){
  8126. return this.detach();
  8127. },
  8128. onFormValidate: function(valid, form, event){
  8129. //if there's no event, then this wasn't a submit event
  8130. if (!event) return;
  8131. var fv = this.element.retrieve('validator');
  8132. if (valid || (fv && !fv.options.stopOnFailure)){
  8133. event.stop();
  8134. this.send();
  8135. }
  8136. },
  8137. onSubmit: function(event){
  8138. var fv = this.element.retrieve('validator');
  8139. if (fv){
  8140. //form validator was created after Form.Request
  8141. this.element.removeEvent('submit', this.onSubmit);
  8142. fv.addEvent('onFormValidate', this.onFormValidate);
  8143. fv.validate(event);
  8144. return;
  8145. }
  8146. if (event) event.stop();
  8147. this.send();
  8148. },
  8149. saveClickedButton: function(event, target){
  8150. var targetName = target.get('name');
  8151. if (!targetName || !this.options.sendButtonClicked) return;
  8152. this.options.extraData[targetName] = target.get('value') || true;
  8153. this.clickedCleaner = function(){
  8154. delete this.options.extraData[targetName];
  8155. this.clickedCleaner = function(){};
  8156. }.bind(this);
  8157. },
  8158. clickedCleaner: function(){},
  8159. send: function(){
  8160. var str = this.element.toQueryString().trim(),
  8161. data = Object.toQueryString(this.options.extraData);
  8162. if (str) str += '&' + data;
  8163. else str = data;
  8164. this.fireEvent('send', [this.element, str.parseQueryString()]);
  8165. this.request.send({
  8166. data: str,
  8167. url: this.options.requestOptions.url || this.element.get('action')
  8168. });
  8169. this.clickedCleaner();
  8170. return this;
  8171. }
  8172. });
  8173. Element.implement('formUpdate', function(update, options){
  8174. var fq = this.retrieve('form.request');
  8175. if (!fq){
  8176. fq = new Form.Request(this, update, options);
  8177. } else {
  8178. if (update) fq.setTarget(update);
  8179. if (options) fq.setOptions(options).makeRequest();
  8180. }
  8181. fq.send();
  8182. return this;
  8183. });
  8184. })();
  8185. /*
  8186. ---
  8187. script: Fx.Reveal.js
  8188. name: Fx.Reveal
  8189. description: Defines Fx.Reveal, a class that shows and hides elements with a transition.
  8190. license: MIT-style license
  8191. authors:
  8192. - Aaron Newton
  8193. requires:
  8194. - Core/Fx.Morph
  8195. - Element.Shortcuts
  8196. - Element.Measure
  8197. provides: [Fx.Reveal]
  8198. ...
  8199. */
  8200. (function(){
  8201. var hideTheseOf = function(object){
  8202. var hideThese = object.options.hideInputs;
  8203. if (window.OverText){
  8204. var otClasses = [null];
  8205. OverText.each(function(ot){
  8206. otClasses.include('.' + ot.options.labelClass);
  8207. });
  8208. if (otClasses) hideThese += otClasses.join(', ');
  8209. }
  8210. return (hideThese) ? object.element.getElements(hideThese) : null;
  8211. };
  8212. Fx.Reveal = new Class({
  8213. Extends: Fx.Morph,
  8214. options: {/*
  8215. onShow: function(thisElement){},
  8216. onHide: function(thisElement){},
  8217. onComplete: function(thisElement){},
  8218. heightOverride: null,
  8219. widthOverride: null,*/
  8220. link: 'cancel',
  8221. styles: ['padding', 'border', 'margin'],
  8222. transitionOpacity: 'opacity' in document.documentElement,
  8223. mode: 'vertical',
  8224. display: function(){
  8225. return this.element.get('tag') != 'tr' ? 'block' : 'table-row';
  8226. },
  8227. opacity: 1,
  8228. hideInputs: !('opacity' in document.documentElement) ? 'select, input, textarea, object, embed' : null
  8229. },
  8230. dissolve: function(){
  8231. if (!this.hiding && !this.showing){
  8232. if (this.element.getStyle('display') != 'none'){
  8233. this.hiding = true;
  8234. this.showing = false;
  8235. this.hidden = true;
  8236. this.cssText = this.element.style.cssText;
  8237. var startStyles = this.element.getComputedSize({
  8238. styles: this.options.styles,
  8239. mode: this.options.mode
  8240. });
  8241. if (this.options.transitionOpacity) startStyles.opacity = this.options.opacity;
  8242. var zero = {};
  8243. Object.each(startStyles, function(style, name){
  8244. zero[name] = [style, 0];
  8245. });
  8246. this.element.setStyles({
  8247. display: Function.convert(this.options.display).call(this),
  8248. overflow: 'hidden'
  8249. });
  8250. var hideThese = hideTheseOf(this);
  8251. if (hideThese) hideThese.setStyle('visibility', 'hidden');
  8252. this.$chain.unshift(function(){
  8253. if (this.hidden){
  8254. this.hiding = false;
  8255. this.element.style.cssText = this.cssText;
  8256. this.element.setStyle('display', 'none');
  8257. if (hideThese) hideThese.setStyle('visibility', 'visible');
  8258. }
  8259. this.fireEvent('hide', this.element);
  8260. this.callChain();
  8261. }.bind(this));
  8262. this.start(zero);
  8263. } else {
  8264. this.callChain.delay(10, this);
  8265. this.fireEvent('complete', this.element);
  8266. this.fireEvent('hide', this.element);
  8267. }
  8268. } else if (this.options.link == 'chain'){
  8269. this.chain(this.dissolve.bind(this));
  8270. } else if (this.options.link == 'cancel' && !this.hiding){
  8271. this.cancel();
  8272. this.dissolve();
  8273. }
  8274. return this;
  8275. },
  8276. reveal: function(){
  8277. if (!this.showing && !this.hiding){
  8278. if (this.element.getStyle('display') == 'none'){
  8279. this.hiding = false;
  8280. this.showing = true;
  8281. this.hidden = false;
  8282. this.cssText = this.element.style.cssText;
  8283. var startStyles;
  8284. this.element.measure(function(){
  8285. startStyles = this.element.getComputedSize({
  8286. styles: this.options.styles,
  8287. mode: this.options.mode
  8288. });
  8289. }.bind(this));
  8290. if (this.options.heightOverride != null) startStyles.height = this.options.heightOverride.toInt();
  8291. if (this.options.widthOverride != null) startStyles.width = this.options.widthOverride.toInt();
  8292. if (this.options.transitionOpacity){
  8293. this.element.setStyle('opacity', 0);
  8294. startStyles.opacity = this.options.opacity;
  8295. }
  8296. var zero = {
  8297. height: 0,
  8298. display: Function.convert(this.options.display).call(this)
  8299. };
  8300. Object.each(startStyles, function(style, name){
  8301. zero[name] = 0;
  8302. });
  8303. zero.overflow = 'hidden';
  8304. this.element.setStyles(zero);
  8305. var hideThese = hideTheseOf(this);
  8306. if (hideThese) hideThese.setStyle('visibility', 'hidden');
  8307. this.$chain.unshift(function(){
  8308. this.element.style.cssText = this.cssText;
  8309. this.element.setStyle('display', Function.convert(this.options.display).call(this));
  8310. if (!this.hidden) this.showing = false;
  8311. if (hideThese) hideThese.setStyle('visibility', 'visible');
  8312. this.callChain();
  8313. this.fireEvent('show', this.element);
  8314. }.bind(this));
  8315. this.start(startStyles);
  8316. } else {
  8317. this.callChain();
  8318. this.fireEvent('complete', this.element);
  8319. this.fireEvent('show', this.element);
  8320. }
  8321. } else if (this.options.link == 'chain'){
  8322. this.chain(this.reveal.bind(this));
  8323. } else if (this.options.link == 'cancel' && !this.showing){
  8324. this.cancel();
  8325. this.reveal();
  8326. }
  8327. return this;
  8328. },
  8329. toggle: function(){
  8330. if (this.element.getStyle('display') == 'none'){
  8331. this.reveal();
  8332. } else {
  8333. this.dissolve();
  8334. }
  8335. return this;
  8336. },
  8337. cancel: function(){
  8338. this.parent.apply(this, arguments);
  8339. if (this.cssText != null) this.element.style.cssText = this.cssText;
  8340. this.hiding = false;
  8341. this.showing = false;
  8342. return this;
  8343. }
  8344. });
  8345. Element.Properties.reveal = {
  8346. set: function(options){
  8347. this.get('reveal').cancel().setOptions(options);
  8348. return this;
  8349. },
  8350. get: function(){
  8351. var reveal = this.retrieve('reveal');
  8352. if (!reveal){
  8353. reveal = new Fx.Reveal(this);
  8354. this.store('reveal', reveal);
  8355. }
  8356. return reveal;
  8357. }
  8358. };
  8359. Element.Properties.dissolve = Element.Properties.reveal;
  8360. Element.implement({
  8361. reveal: function(options){
  8362. this.get('reveal').setOptions(options).reveal();
  8363. return this;
  8364. },
  8365. dissolve: function(options){
  8366. this.get('reveal').setOptions(options).dissolve();
  8367. return this;
  8368. },
  8369. nix: function(options){
  8370. var params = Array.link(arguments, {destroy: Type.isBoolean, options: Type.isObject});
  8371. this.get('reveal').setOptions(options).dissolve().chain(function(){
  8372. this[params.destroy ? 'destroy' : 'dispose']();
  8373. }.bind(this));
  8374. return this;
  8375. },
  8376. wink: function(){
  8377. var params = Array.link(arguments, {duration: Type.isNumber, options: Type.isObject});
  8378. var reveal = this.get('reveal').setOptions(params.options);
  8379. reveal.reveal().chain(function(){
  8380. (function(){
  8381. reveal.dissolve();
  8382. }).delay(params.duration || 2000);
  8383. });
  8384. }
  8385. });
  8386. })();
  8387. /*
  8388. ---
  8389. script: Form.Request.Append.js
  8390. name: Form.Request.Append
  8391. 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.
  8392. license: MIT-style license
  8393. authors:
  8394. - Aaron Newton
  8395. requires:
  8396. - Form.Request
  8397. - Fx.Reveal
  8398. - Elements.from
  8399. provides: [Form.Request.Append]
  8400. ...
  8401. */
  8402. Form.Request.Append = new Class({
  8403. Extends: Form.Request,
  8404. options: {
  8405. //onBeforeEffect: function(){},
  8406. useReveal: true,
  8407. revealOptions: {},
  8408. inject: 'bottom'
  8409. },
  8410. makeRequest: function(){
  8411. this.request = new Request.HTML(Object.merge({
  8412. url: this.element.get('action'),
  8413. method: this.element.get('method') || 'post',
  8414. spinnerTarget: this.element
  8415. }, this.options.requestOptions, {
  8416. evalScripts: false
  8417. })).addEvents({
  8418. success: function(tree, elements, html, javascript){
  8419. var container;
  8420. var kids = Elements.from(html);
  8421. if (kids.length == 1){
  8422. container = kids[0];
  8423. } else {
  8424. container = new Element('div', {
  8425. styles: {
  8426. display: 'none'
  8427. }
  8428. }).adopt(kids);
  8429. }
  8430. container.inject(this.target, this.options.inject);
  8431. if (this.options.requestOptions.evalScripts) Browser.exec(javascript);
  8432. this.fireEvent('beforeEffect', container);
  8433. var finish = function(){
  8434. this.fireEvent('success', [container, this.target, tree, elements, html, javascript]);
  8435. }.bind(this);
  8436. if (this.options.useReveal){
  8437. container.set('reveal', this.options.revealOptions).get('reveal').chain(finish);
  8438. container.reveal();
  8439. } else {
  8440. finish();
  8441. }
  8442. }.bind(this),
  8443. failure: function(xhr){
  8444. this.fireEvent('failure', xhr);
  8445. }.bind(this)
  8446. });
  8447. this.attachReset();
  8448. }
  8449. });
  8450. /*
  8451. ---
  8452. script: Object.Extras.js
  8453. name: Object.Extras
  8454. description: Extra Object generics, like getFromPath which allows a path notation to child elements.
  8455. license: MIT-style license
  8456. authors:
  8457. - Aaron Newton
  8458. requires:
  8459. - Core/Object
  8460. - MooTools.More
  8461. provides: [Object.Extras]
  8462. ...
  8463. */
  8464. (function(){
  8465. var defined = function(value){
  8466. return value != null;
  8467. };
  8468. var hasOwnProperty = Object.prototype.hasOwnProperty;
  8469. Object.extend({
  8470. getFromPath: function(source, parts){
  8471. if (typeof parts == 'string') parts = parts.split('.');
  8472. for (var i = 0, l = parts.length; i < l; i++){
  8473. if (hasOwnProperty.call(source, parts[i])) source = source[parts[i]];
  8474. else return null;
  8475. }
  8476. return source;
  8477. },
  8478. cleanValues: function(object, method){
  8479. method = method || defined;
  8480. for (var key in object) if (!method(object[key])){
  8481. delete object[key];
  8482. }
  8483. return object;
  8484. },
  8485. erase: function(object, key){
  8486. if (hasOwnProperty.call(object, key)) delete object[key];
  8487. return object;
  8488. },
  8489. run: function(object){
  8490. var args = Array.slice(arguments, 1);
  8491. for (var key in object) if (object[key].apply){
  8492. object[key].apply(object, args);
  8493. }
  8494. return object;
  8495. }
  8496. });
  8497. })();
  8498. /*
  8499. ---
  8500. script: Locale.js
  8501. name: Locale
  8502. description: Provides methods for localization.
  8503. license: MIT-style license
  8504. authors:
  8505. - Aaron Newton
  8506. - Arian Stolwijk
  8507. requires:
  8508. - Core/Events
  8509. - Object.Extras
  8510. - MooTools.More
  8511. provides: [Locale, Lang]
  8512. ...
  8513. */
  8514. (function(){
  8515. var current = null,
  8516. locales = {},
  8517. inherits = {};
  8518. var getSet = function(set){
  8519. if (instanceOf(set, Locale.Set)) return set;
  8520. else return locales[set];
  8521. };
  8522. var Locale = this.Locale = {
  8523. define: function(locale, set, key, value){
  8524. var name;
  8525. if (instanceOf(locale, Locale.Set)){
  8526. name = locale.name;
  8527. if (name) locales[name] = locale;
  8528. } else {
  8529. name = locale;
  8530. if (!locales[name]) locales[name] = new Locale.Set(name);
  8531. locale = locales[name];
  8532. }
  8533. if (set) locale.define(set, key, value);
  8534. /*<1.2compat>*/
  8535. if (set == 'cascade') return Locale.inherit(name, key);
  8536. /*</1.2compat>*/
  8537. if (!current) current = locale;
  8538. return locale;
  8539. },
  8540. use: function(locale){
  8541. locale = getSet(locale);
  8542. if (locale){
  8543. current = locale;
  8544. this.fireEvent('change', locale);
  8545. /*<1.2compat>*/
  8546. this.fireEvent('langChange', locale.name);
  8547. /*</1.2compat>*/
  8548. }
  8549. return this;
  8550. },
  8551. getCurrent: function(){
  8552. return current;
  8553. },
  8554. get: function(key, args){
  8555. return (current) ? current.get(key, args) : '';
  8556. },
  8557. inherit: function(locale, inherits, set){
  8558. locale = getSet(locale);
  8559. if (locale) locale.inherit(inherits, set);
  8560. return this;
  8561. },
  8562. list: function(){
  8563. return Object.keys(locales);
  8564. }
  8565. };
  8566. Object.append(Locale, new Events);
  8567. Locale.Set = new Class({
  8568. sets: {},
  8569. inherits: {
  8570. locales: [],
  8571. sets: {}
  8572. },
  8573. initialize: function(name){
  8574. this.name = name || '';
  8575. },
  8576. define: function(set, key, value){
  8577. var defineData = this.sets[set];
  8578. if (!defineData) defineData = {};
  8579. if (key){
  8580. if (typeOf(key) == 'object') defineData = Object.merge(defineData, key);
  8581. else defineData[key] = value;
  8582. }
  8583. this.sets[set] = defineData;
  8584. return this;
  8585. },
  8586. get: function(key, args, _base){
  8587. var value = Object.getFromPath(this.sets, key);
  8588. if (value != null){
  8589. var type = typeOf(value);
  8590. if (type == 'function') value = value.apply(null, Array.convert(args));
  8591. else if (type == 'object') value = Object.clone(value);
  8592. return value;
  8593. }
  8594. // get value of inherited locales
  8595. var index = key.indexOf('.'),
  8596. set = index < 0 ? key : key.substr(0, index),
  8597. names = (this.inherits.sets[set] || []).combine(this.inherits.locales).include('en-US');
  8598. if (!_base) _base = [];
  8599. for (var i = 0, l = names.length; i < l; i++){
  8600. if (_base.contains(names[i])) continue;
  8601. _base.include(names[i]);
  8602. var locale = locales[names[i]];
  8603. if (!locale) continue;
  8604. value = locale.get(key, args, _base);
  8605. if (value != null) return value;
  8606. }
  8607. return '';
  8608. },
  8609. inherit: function(names, set){
  8610. names = Array.convert(names);
  8611. if (set && !this.inherits.sets[set]) this.inherits.sets[set] = [];
  8612. var l = names.length;
  8613. while (l--) (set ? this.inherits.sets[set] : this.inherits.locales).unshift(names[l]);
  8614. return this;
  8615. }
  8616. });
  8617. /*<1.2compat>*/
  8618. var lang = MooTools.lang = {};
  8619. Object.append(lang, Locale, {
  8620. setLanguage: Locale.use,
  8621. getCurrentLanguage: function(){
  8622. var current = Locale.getCurrent();
  8623. return (current) ? current.name : null;
  8624. },
  8625. set: function(){
  8626. Locale.define.apply(this, arguments);
  8627. return this;
  8628. },
  8629. get: function(set, key, args){
  8630. if (key) set += '.' + key;
  8631. return Locale.get(set, args);
  8632. }
  8633. });
  8634. /*</1.2compat>*/
  8635. })();
  8636. /*
  8637. ---
  8638. name: Locale.en-US.Date
  8639. description: Date messages for US English.
  8640. license: MIT-style license
  8641. authors:
  8642. - Aaron Newton
  8643. requires:
  8644. - Locale
  8645. provides: [Locale.en-US.Date]
  8646. ...
  8647. */
  8648. Locale.define('en-US', 'Date', {
  8649. months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
  8650. months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  8651. days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  8652. days_abbr: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8653. // Culture's date order: MM/DD/YYYY
  8654. dateOrder: ['month', 'date', 'year'],
  8655. shortDate: '%m/%d/%Y',
  8656. shortTime: '%I:%M%p',
  8657. AM: 'AM',
  8658. PM: 'PM',
  8659. firstDayOfWeek: 0,
  8660. // Date.Extras
  8661. ordinal: function(dayOfMonth){
  8662. // 1st, 2nd, 3rd, etc.
  8663. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'th' : ['th', 'st', 'nd', 'rd', 'th'][Math.min(dayOfMonth % 10, 4)];
  8664. },
  8665. lessThanMinuteAgo: 'less than a minute ago',
  8666. minuteAgo: 'about a minute ago',
  8667. minutesAgo: '{delta} minutes ago',
  8668. hourAgo: 'about an hour ago',
  8669. hoursAgo: 'about {delta} hours ago',
  8670. dayAgo: '1 day ago',
  8671. daysAgo: '{delta} days ago',
  8672. weekAgo: '1 week ago',
  8673. weeksAgo: '{delta} weeks ago',
  8674. monthAgo: '1 month ago',
  8675. monthsAgo: '{delta} months ago',
  8676. yearAgo: '1 year ago',
  8677. yearsAgo: '{delta} years ago',
  8678. lessThanMinuteUntil: 'less than a minute from now',
  8679. minuteUntil: 'about a minute from now',
  8680. minutesUntil: '{delta} minutes from now',
  8681. hourUntil: 'about an hour from now',
  8682. hoursUntil: 'about {delta} hours from now',
  8683. dayUntil: '1 day from now',
  8684. daysUntil: '{delta} days from now',
  8685. weekUntil: '1 week from now',
  8686. weeksUntil: '{delta} weeks from now',
  8687. monthUntil: '1 month from now',
  8688. monthsUntil: '{delta} months from now',
  8689. yearUntil: '1 year from now',
  8690. yearsUntil: '{delta} years from now'
  8691. });
  8692. /*
  8693. ---
  8694. script: Date.js
  8695. name: Date
  8696. description: Extends the Date native object to include methods useful in managing dates.
  8697. license: MIT-style license
  8698. authors:
  8699. - Aaron Newton
  8700. - Nicholas Barthelemy - https://svn.nbarthelemy.com/date-js/
  8701. - Harald Kirshner - mail [at] digitarald.de; http://digitarald.de
  8702. - Scott Kyle - scott [at] appden.com; http://appden.com
  8703. requires:
  8704. - Core/Array
  8705. - Core/String
  8706. - Core/Number
  8707. - MooTools.More
  8708. - Locale
  8709. - Locale.en-US.Date
  8710. provides: [Date]
  8711. ...
  8712. */
  8713. (function(){
  8714. var Date = this.Date;
  8715. var DateMethods = Date.Methods = {
  8716. ms: 'Milliseconds',
  8717. year: 'FullYear',
  8718. min: 'Minutes',
  8719. mo: 'Month',
  8720. sec: 'Seconds',
  8721. hr: 'Hours'
  8722. };
  8723. [
  8724. 'Date', 'Day', 'FullYear', 'Hours', 'Milliseconds', 'Minutes', 'Month', 'Seconds', 'Time', 'TimezoneOffset',
  8725. 'Week', 'Timezone', 'GMTOffset', 'DayOfYear', 'LastMonth', 'LastDayOfMonth', 'UTCDate', 'UTCDay', 'UTCFullYear',
  8726. 'AMPM', 'Ordinal', 'UTCHours', 'UTCMilliseconds', 'UTCMinutes', 'UTCMonth', 'UTCSeconds', 'UTCMilliseconds'
  8727. ].each(function(method){
  8728. Date.Methods[method.toLowerCase()] = method;
  8729. });
  8730. var pad = function(n, digits, string){
  8731. if (digits == 1) return n;
  8732. return n < Math.pow(10, digits - 1) ? (string || '0') + pad(n, digits - 1, string) : n;
  8733. };
  8734. Date.implement({
  8735. set: function(prop, value){
  8736. prop = prop.toLowerCase();
  8737. var method = DateMethods[prop] && 'set' + DateMethods[prop];
  8738. if (method && this[method]) this[method](value);
  8739. return this;
  8740. }.overloadSetter(),
  8741. get: function(prop){
  8742. prop = prop.toLowerCase();
  8743. var method = DateMethods[prop] && 'get' + DateMethods[prop];
  8744. if (method && this[method]) return this[method]();
  8745. return null;
  8746. }.overloadGetter(),
  8747. clone: function(){
  8748. return new Date(this.get('time'));
  8749. },
  8750. increment: function(interval, times){
  8751. interval = interval || 'day';
  8752. times = times != null ? times : 1;
  8753. switch (interval){
  8754. case 'year':
  8755. return this.increment('month', times * 12);
  8756. case 'month':
  8757. var d = this.get('date');
  8758. this.set('date', 1).set('mo', this.get('mo') + times);
  8759. return this.set('date', d.min(this.get('lastdayofmonth')));
  8760. case 'week':
  8761. return this.increment('day', times * 7);
  8762. case 'day':
  8763. return this.set('date', this.get('date') + times);
  8764. }
  8765. if (!Date.units[interval]) throw new Error(interval + ' is not a supported interval');
  8766. return this.set('time', this.get('time') + times * Date.units[interval]());
  8767. },
  8768. decrement: function(interval, times){
  8769. return this.increment(interval, -1 * (times != null ? times : 1));
  8770. },
  8771. isLeapYear: function(){
  8772. return Date.isLeapYear(this.get('year'));
  8773. },
  8774. clearTime: function(){
  8775. return this.set({hr: 0, min: 0, sec: 0, ms: 0});
  8776. },
  8777. diff: function(date, resolution){
  8778. if (typeOf(date) == 'string') date = Date.parse(date);
  8779. return ((date - this) / Date.units[resolution || 'day'](3, 3)).round(); // non-leap year, 30-day month
  8780. },
  8781. getLastDayOfMonth: function(){
  8782. return Date.daysInMonth(this.get('mo'), this.get('year'));
  8783. },
  8784. getDayOfYear: function(){
  8785. return (Date.UTC(this.get('year'), this.get('mo'), this.get('date') + 1)
  8786. - Date.UTC(this.get('year'), 0, 1)) / Date.units.day();
  8787. },
  8788. setDay: function(day, firstDayOfWeek){
  8789. if (firstDayOfWeek == null){
  8790. firstDayOfWeek = Date.getMsg('firstDayOfWeek');
  8791. if (firstDayOfWeek === '') firstDayOfWeek = 1;
  8792. }
  8793. day = (7 + Date.parseDay(day, true) - firstDayOfWeek) % 7;
  8794. var currentDay = (7 + this.get('day') - firstDayOfWeek) % 7;
  8795. return this.increment('day', day - currentDay);
  8796. },
  8797. getWeek: function(firstDayOfWeek){
  8798. if (firstDayOfWeek == null){
  8799. firstDayOfWeek = Date.getMsg('firstDayOfWeek');
  8800. if (firstDayOfWeek === '') firstDayOfWeek = 1;
  8801. }
  8802. var date = this,
  8803. dayOfWeek = (7 + date.get('day') - firstDayOfWeek) % 7,
  8804. dividend = 0,
  8805. firstDayOfYear;
  8806. if (firstDayOfWeek == 1){
  8807. // ISO-8601, week belongs to year that has the most days of the week (i.e. has the thursday of the week)
  8808. var month = date.get('month'),
  8809. startOfWeek = date.get('date') - dayOfWeek;
  8810. if (month == 11 && startOfWeek > 28) return 1; // Week 1 of next year
  8811. if (month == 0 && startOfWeek < -2){
  8812. // Use a date from last year to determine the week
  8813. date = new Date(date).decrement('day', dayOfWeek);
  8814. dayOfWeek = 0;
  8815. }
  8816. firstDayOfYear = new Date(date.get('year'), 0, 1).get('day') || 7;
  8817. if (firstDayOfYear > 4) dividend = -7; // First week of the year is not week 1
  8818. } else {
  8819. // In other cultures the first week of the year is always week 1 and the last week always 53 or 54.
  8820. // Days in the same week can have a different weeknumber if the week spreads across two years.
  8821. firstDayOfYear = new Date(date.get('year'), 0, 1).get('day');
  8822. }
  8823. dividend += date.get('dayofyear');
  8824. dividend += 6 - dayOfWeek; // Add days so we calculate the current date's week as a full week
  8825. dividend += (7 + firstDayOfYear - firstDayOfWeek) % 7; // Make up for first week of the year not being a full week
  8826. return (dividend / 7);
  8827. },
  8828. getOrdinal: function(day){
  8829. return Date.getMsg('ordinal', day || this.get('date'));
  8830. },
  8831. getTimezone: function(){
  8832. return this.toString()
  8833. .replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/, '$1')
  8834. .replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, '$1$2$3');
  8835. },
  8836. getGMTOffset: function(){
  8837. var off = this.get('timezoneOffset');
  8838. return ((off > 0) ? '-' : '+') + pad((off.abs() / 60).floor(), 2) + pad(off % 60, 2);
  8839. },
  8840. setAMPM: function(ampm){
  8841. ampm = ampm.toUpperCase();
  8842. var hr = this.get('hr');
  8843. if (hr > 11 && ampm == 'AM') return this.decrement('hour', 12);
  8844. else if (hr < 12 && ampm == 'PM') return this.increment('hour', 12);
  8845. return this;
  8846. },
  8847. getAMPM: function(){
  8848. return (this.get('hr') < 12) ? 'AM' : 'PM';
  8849. },
  8850. parse: function(str){
  8851. this.set('time', Date.parse(str));
  8852. return this;
  8853. },
  8854. isValid: function(date){
  8855. if (!date) date = this;
  8856. return typeOf(date) == 'date' && !isNaN(date.valueOf());
  8857. },
  8858. format: function(format){
  8859. if (!this.isValid()) return 'invalid date';
  8860. if (!format) format = '%x %X';
  8861. if (typeof format == 'string') format = formats[format.toLowerCase()] || format;
  8862. if (typeof format == 'function') return format(this);
  8863. var d = this;
  8864. return format.replace(/%([a-z%])/gi,
  8865. function($0, $1){
  8866. switch ($1){
  8867. case 'a': return Date.getMsg('days_abbr')[d.get('day')];
  8868. case 'A': return Date.getMsg('days')[d.get('day')];
  8869. case 'b': return Date.getMsg('months_abbr')[d.get('month')];
  8870. case 'B': return Date.getMsg('months')[d.get('month')];
  8871. case 'c': return d.format('%a %b %d %H:%M:%S %Y');
  8872. case 'd': return pad(d.get('date'), 2);
  8873. case 'e': return pad(d.get('date'), 2, ' ');
  8874. case 'H': return pad(d.get('hr'), 2);
  8875. case 'I': return pad((d.get('hr') % 12) || 12, 2);
  8876. case 'j': return pad(d.get('dayofyear'), 3);
  8877. case 'k': return pad(d.get('hr'), 2, ' ');
  8878. case 'l': return pad((d.get('hr') % 12) || 12, 2, ' ');
  8879. case 'L': return pad(d.get('ms'), 3);
  8880. case 'm': return pad((d.get('mo') + 1), 2);
  8881. case 'M': return pad(d.get('min'), 2);
  8882. case 'o': return d.get('ordinal');
  8883. case 'p': return Date.getMsg(d.get('ampm'));
  8884. case 's': return Math.round(d / 1000);
  8885. case 'S': return pad(d.get('seconds'), 2);
  8886. case 'T': return d.format('%H:%M:%S');
  8887. case 'U': return pad(d.get('week'), 2);
  8888. case 'w': return d.get('day');
  8889. case 'x': return d.format(Date.getMsg('shortDate'));
  8890. case 'X': return d.format(Date.getMsg('shortTime'));
  8891. case 'y': return d.get('year').toString().substr(2);
  8892. case 'Y': return d.get('year');
  8893. case 'z': return d.get('GMTOffset');
  8894. case 'Z': return d.get('Timezone');
  8895. }
  8896. return $1;
  8897. }
  8898. );
  8899. },
  8900. toISOString: function(){
  8901. return this.format('iso8601');
  8902. }
  8903. }).alias({
  8904. toJSON: 'toISOString',
  8905. compare: 'diff',
  8906. strftime: 'format'
  8907. });
  8908. // The day and month abbreviations are standardized, so we cannot use simply %a and %b because they will get localized
  8909. var rfcDayAbbr = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8910. rfcMonthAbbr = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
  8911. var formats = {
  8912. db: '%Y-%m-%d %H:%M:%S',
  8913. compact: '%Y%m%dT%H%M%S',
  8914. 'short': '%d %b %H:%M',
  8915. 'long': '%B %d, %Y %H:%M',
  8916. rfc822: function(date){
  8917. return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %Z');
  8918. },
  8919. rfc2822: function(date){
  8920. return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %z');
  8921. },
  8922. iso8601: function(date){
  8923. return (
  8924. date.getUTCFullYear() + '-' +
  8925. pad(date.getUTCMonth() + 1, 2) + '-' +
  8926. pad(date.getUTCDate(), 2) + 'T' +
  8927. pad(date.getUTCHours(), 2) + ':' +
  8928. pad(date.getUTCMinutes(), 2) + ':' +
  8929. pad(date.getUTCSeconds(), 2) + '.' +
  8930. pad(date.getUTCMilliseconds(), 3) + 'Z'
  8931. );
  8932. }
  8933. };
  8934. var parsePatterns = [],
  8935. nativeParse = Date.parse;
  8936. var parseWord = function(type, word, num){
  8937. var ret = -1,
  8938. translated = Date.getMsg(type + 's');
  8939. switch (typeOf(word)){
  8940. case 'object':
  8941. ret = translated[word.get(type)];
  8942. break;
  8943. case 'number':
  8944. ret = translated[word];
  8945. if (!ret) throw new Error('Invalid ' + type + ' index: ' + word);
  8946. break;
  8947. case 'string':
  8948. var match = translated.filter(function(name){
  8949. return this.test(name);
  8950. }, new RegExp('^' + word, 'i'));
  8951. if (!match.length) throw new Error('Invalid ' + type + ' string');
  8952. if (match.length > 1) throw new Error('Ambiguous ' + type);
  8953. ret = match[0];
  8954. }
  8955. return (num) ? translated.indexOf(ret) : ret;
  8956. };
  8957. var startCentury = 1900,
  8958. startYear = 70;
  8959. Date.extend({
  8960. getMsg: function(key, args){
  8961. return Locale.get('Date.' + key, args);
  8962. },
  8963. units: {
  8964. ms: Function.convert(1),
  8965. second: Function.convert(1000),
  8966. minute: Function.convert(60000),
  8967. hour: Function.convert(3600000),
  8968. day: Function.convert(86400000),
  8969. week: Function.convert(608400000),
  8970. month: function(month, year){
  8971. var d = new Date;
  8972. return Date.daysInMonth(month != null ? month : d.get('mo'), year != null ? year : d.get('year')) * 86400000;
  8973. },
  8974. year: function(year){
  8975. year = year || new Date().get('year');
  8976. return Date.isLeapYear(year) ? 31622400000 : 31536000000;
  8977. }
  8978. },
  8979. daysInMonth: function(month, year){
  8980. return [31, Date.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
  8981. },
  8982. isLeapYear: function(year){
  8983. return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);
  8984. },
  8985. parse: function(from){
  8986. var t = typeOf(from);
  8987. if (t == 'number') return new Date(from);
  8988. if (t != 'string') return from;
  8989. from = from.clean();
  8990. if (!from.length) return null;
  8991. var parsed;
  8992. parsePatterns.some(function(pattern){
  8993. var bits = pattern.re.exec(from);
  8994. return (bits) ? (parsed = pattern.handler(bits)) : false;
  8995. });
  8996. if (!(parsed && parsed.isValid())){
  8997. parsed = new Date(nativeParse(from));
  8998. if (!(parsed && parsed.isValid())) parsed = new Date(from.toInt());
  8999. }
  9000. return parsed;
  9001. },
  9002. parseDay: function(day, num){
  9003. return parseWord('day', day, num);
  9004. },
  9005. parseMonth: function(month, num){
  9006. return parseWord('month', month, num);
  9007. },
  9008. parseUTC: function(value){
  9009. var localDate = new Date(value);
  9010. var utcSeconds = Date.UTC(
  9011. localDate.get('year'),
  9012. localDate.get('mo'),
  9013. localDate.get('date'),
  9014. localDate.get('hr'),
  9015. localDate.get('min'),
  9016. localDate.get('sec'),
  9017. localDate.get('ms')
  9018. );
  9019. return new Date(utcSeconds);
  9020. },
  9021. orderIndex: function(unit){
  9022. return Date.getMsg('dateOrder').indexOf(unit) + 1;
  9023. },
  9024. defineFormat: function(name, format){
  9025. formats[name] = format;
  9026. return this;
  9027. },
  9028. //<1.2compat>
  9029. parsePatterns: parsePatterns,
  9030. //</1.2compat>
  9031. defineParser: function(pattern){
  9032. parsePatterns.push((pattern.re && pattern.handler) ? pattern : build(pattern));
  9033. return this;
  9034. },
  9035. defineParsers: function(){
  9036. Array.flatten(arguments).each(Date.defineParser);
  9037. return this;
  9038. },
  9039. define2DigitYearStart: function(year){
  9040. startYear = year % 100;
  9041. startCentury = year - startYear;
  9042. return this;
  9043. }
  9044. }).extend({
  9045. defineFormats: Date.defineFormat.overloadSetter()
  9046. });
  9047. var regexOf = function(type){
  9048. return new RegExp('(?:' + Date.getMsg(type).map(function(name){
  9049. return name.substr(0, 3);
  9050. }).join('|') + ')[a-z]*');
  9051. };
  9052. var replacers = function(key){
  9053. switch (key){
  9054. case 'T':
  9055. return '%H:%M:%S';
  9056. case 'x': // iso8601 covers yyyy-mm-dd, so just check if month is first
  9057. return ((Date.orderIndex('month') == 1) ? '%m[-./]%d' : '%d[-./]%m') + '([-./]%y)?';
  9058. case 'X':
  9059. return '%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%z?';
  9060. }
  9061. return null;
  9062. };
  9063. var keys = {
  9064. d: /[0-2]?[0-9]|3[01]/,
  9065. H: /[01]?[0-9]|2[0-3]/,
  9066. I: /0?[1-9]|1[0-2]/,
  9067. M: /[0-5]?\d/,
  9068. s: /\d+/,
  9069. o: /[a-z]*/,
  9070. p: /[ap]\.?m\.?/,
  9071. y: /\d{2}|\d{4}/,
  9072. Y: /\d{4}/,
  9073. z: /Z|[+-]\d{2}(?::?\d{2})?/
  9074. };
  9075. keys.m = keys.I;
  9076. keys.S = keys.M;
  9077. var currentLanguage;
  9078. var recompile = function(language){
  9079. currentLanguage = language;
  9080. keys.a = keys.A = regexOf('days');
  9081. keys.b = keys.B = regexOf('months');
  9082. parsePatterns.each(function(pattern, i){
  9083. if (pattern.format) parsePatterns[i] = build(pattern.format);
  9084. });
  9085. };
  9086. var build = function(format){
  9087. if (!currentLanguage) return {format: format};
  9088. var parsed = [];
  9089. var re = (format.source || format) // allow format to be regex
  9090. .replace(/%([a-z])/gi,
  9091. function($0, $1){
  9092. return replacers($1) || $0;
  9093. }
  9094. ).replace(/\((?!\?)/g, '(?:') // make all groups non-capturing
  9095. .replace(/ (?!\?|\*)/g, ',? ') // be forgiving with spaces and commas
  9096. .replace(/%([a-z%])/gi,
  9097. function($0, $1){
  9098. var p = keys[$1];
  9099. if (!p) return $1;
  9100. parsed.push($1);
  9101. return '(' + p.source + ')';
  9102. }
  9103. ).replace(/\[a-z\]/gi, '[a-z\\u00c0-\\uffff;\&]'); // handle unicode words
  9104. return {
  9105. format: format,
  9106. re: new RegExp('^' + re + '$', 'i'),
  9107. handler: function(bits){
  9108. bits = bits.slice(1).associate(parsed);
  9109. var date = new Date().clearTime(),
  9110. year = bits.y || bits.Y;
  9111. if (year != null) handle.call(date, 'y', year); // need to start in the right year
  9112. if ('d' in bits) handle.call(date, 'd', 1);
  9113. if ('m' in bits || bits.b || bits.B) handle.call(date, 'm', 1);
  9114. for (var key in bits) handle.call(date, key, bits[key]);
  9115. return date;
  9116. }
  9117. };
  9118. };
  9119. var handle = function(key, value){
  9120. if (!value) return this;
  9121. switch (key){
  9122. case 'a': case 'A': return this.set('day', Date.parseDay(value, true));
  9123. case 'b': case 'B': return this.set('mo', Date.parseMonth(value, true));
  9124. case 'd': return this.set('date', value);
  9125. case 'H': case 'I': return this.set('hr', value);
  9126. case 'm': return this.set('mo', value - 1);
  9127. case 'M': return this.set('min', value);
  9128. case 'p': return this.set('ampm', value.replace(/\./g, ''));
  9129. case 'S': return this.set('sec', value);
  9130. case 's': return this.set('ms', ('0.' + value) * 1000);
  9131. case 'w': return this.set('day', value);
  9132. case 'Y': return this.set('year', value);
  9133. case 'y':
  9134. value = +value;
  9135. if (value < 100) value += startCentury + (value < startYear ? 100 : 0);
  9136. return this.set('year', value);
  9137. case 'z':
  9138. if (value == 'Z') value = '+00';
  9139. var offset = value.match(/([+-])(\d{2}):?(\d{2})?/);
  9140. offset = (offset[1] + '1') * (offset[2] * 60 + (+offset[3] || 0)) + this.getTimezoneOffset();
  9141. return this.set('time', this - offset * 60000);
  9142. }
  9143. return this;
  9144. };
  9145. Date.defineParsers(
  9146. '%Y([-./]%m([-./]%d((T| )%X)?)?)?', // "1999-12-31", "1999-12-31 11:59pm", "1999-12-31 23:59:59", ISO8601
  9147. '%Y%m%d(T%H(%M%S?)?)?', // "19991231", "19991231T1159", compact
  9148. '%x( %X)?', // "12/31", "12.31.99", "12-31-1999", "12/31/2008 11:59 PM"
  9149. '%d%o( %b( %Y)?)?( %X)?', // "31st", "31st December", "31 Dec 1999", "31 Dec 1999 11:59pm"
  9150. '%b( %d%o)?( %Y)?( %X)?', // Same as above with month and day switched
  9151. '%Y %b( %d%o( %X)?)?', // Same as above with year coming first
  9152. '%o %b %d %X %z %Y', // "Thu Oct 22 08:11:23 +0000 2009"
  9153. '%T', // %H:%M:%S
  9154. '%H:%M( ?%p)?' // "11:05pm", "11:05 am" and "11:05"
  9155. );
  9156. Locale.addEvent('change', function(language){
  9157. if (Locale.get('Date')) recompile(language);
  9158. }).fireEvent('change', Locale.getCurrent());
  9159. })();
  9160. /*
  9161. ---
  9162. name: Locale.en-US.Form.Validator
  9163. description: Form Validator messages for English.
  9164. license: MIT-style license
  9165. authors:
  9166. - Aaron Newton
  9167. requires:
  9168. - Locale
  9169. provides: [Locale.en-US.Form.Validator]
  9170. ...
  9171. */
  9172. Locale.define('en-US', 'FormValidator', {
  9173. required: 'This field is required.',
  9174. length: 'Please enter {length} characters (you entered {elLength} characters)',
  9175. minLength: 'Please enter at least {minLength} characters (you entered {length} characters).',
  9176. maxLength: 'Please enter no more than {maxLength} characters (you entered {length} characters).',
  9177. integer: 'Please enter an integer in this field. Numbers with decimals (e.g. 1.25) are not permitted.',
  9178. numeric: 'Please enter only numeric values in this field (i.e. "1" or "1.1" or "-1" or "-1.1").',
  9179. digits: 'Please use numbers and punctuation only in this field (for example, a phone number with dashes or dots is permitted).',
  9180. alpha: 'Please use only letters (a-z) within this field. No spaces or other characters are allowed.',
  9181. alphanum: 'Please use only letters (a-z) or numbers (0-9) in this field. No spaces or other characters are allowed.',
  9182. dateSuchAs: 'Please enter a valid date such as {date}',
  9183. dateInFormatMDY: 'Please enter a valid date such as MM/DD/YYYY (i.e. "12/31/1999")',
  9184. email: 'Please enter a valid email address. For example "fred@domain.com".',
  9185. url: 'Please enter a valid URL such as http://www.example.com.',
  9186. currencyDollar: 'Please enter a valid $ amount. For example $100.00 .',
  9187. oneRequired: 'Please enter something for at least one of these inputs.',
  9188. errorPrefix: 'Error: ',
  9189. warningPrefix: 'Warning: ',
  9190. // Form.Validator.Extras
  9191. noSpace: 'There can be no spaces in this input.',
  9192. reqChkByNode: 'No items are selected.',
  9193. requiredChk: 'This field is required.',
  9194. reqChkByName: 'Please select a {label}.',
  9195. match: 'This field needs to match the {matchName} field',
  9196. startDate: 'the start date',
  9197. endDate: 'the end date',
  9198. currentDate: 'the current date',
  9199. afterDate: 'The date should be the same or after {label}.',
  9200. beforeDate: 'The date should be the same or before {label}.',
  9201. startMonth: 'Please select a start month',
  9202. sameMonth: 'These two dates must be in the same month - you must change one or the other.',
  9203. creditcard: 'The credit card number entered is invalid. Please check the number and try again. {length} digits entered.'
  9204. });
  9205. /*
  9206. ---
  9207. script: Form.Validator.js
  9208. name: Form.Validator
  9209. description: A css-class based form validation system.
  9210. license: MIT-style license
  9211. authors:
  9212. - Aaron Newton
  9213. requires:
  9214. - Core/Options
  9215. - Core/Events
  9216. - Core/Element.Delegation
  9217. - Core/Slick.Finder
  9218. - Core/Element.Event
  9219. - Core/Element.Style
  9220. - Core/JSON
  9221. - Locale
  9222. - Class.Binds
  9223. - Date
  9224. - Element.Forms
  9225. - Locale.en-US.Form.Validator
  9226. - Element.Shortcuts
  9227. provides: [Form.Validator, InputValidator, FormValidator.BaseValidators]
  9228. ...
  9229. */
  9230. if (!window.Form) window.Form = {};
  9231. var InputValidator = this.InputValidator = new Class({
  9232. Implements: [Options],
  9233. options: {
  9234. errorMsg: 'Validation failed.',
  9235. test: Function.convert(true)
  9236. },
  9237. initialize: function(className, options){
  9238. this.setOptions(options);
  9239. this.className = className;
  9240. },
  9241. test: function(field, props){
  9242. field = document.id(field);
  9243. return (field) ? this.options.test(field, props || this.getProps(field)) : false;
  9244. },
  9245. getError: function(field, props){
  9246. field = document.id(field);
  9247. var err = this.options.errorMsg;
  9248. if (typeOf(err) == 'function') err = err(field, props || this.getProps(field));
  9249. return err;
  9250. },
  9251. getProps: function(field){
  9252. field = document.id(field);
  9253. return (field) ? field.get('validatorProps') : {};
  9254. }
  9255. });
  9256. Element.Properties.validators = {
  9257. get: function(){
  9258. return (this.get('data-validators') || this.className).clean().replace(/'(\\.|[^'])*'|"(\\.|[^"])*"/g, function(match){
  9259. return match.replace(' ', '\\x20');
  9260. }).split(' ');
  9261. }
  9262. };
  9263. Element.Properties.validatorProps = {
  9264. set: function(props){
  9265. return this.eliminate('$moo:validatorProps').store('$moo:validatorProps', props);
  9266. },
  9267. get: function(props){
  9268. if (props) this.set(props);
  9269. if (this.retrieve('$moo:validatorProps')) return this.retrieve('$moo:validatorProps');
  9270. if (this.getProperty('data-validator-properties') || this.getProperty('validatorProps')){
  9271. try {
  9272. this.store('$moo:validatorProps', JSON.decode(this.getProperty('validatorProps') || this.getProperty('data-validator-properties'), false));
  9273. } catch (e){
  9274. return {};
  9275. }
  9276. } else {
  9277. var vals = this.get('validators').filter(function(cls){
  9278. return cls.test(':');
  9279. });
  9280. if (!vals.length){
  9281. this.store('$moo:validatorProps', {});
  9282. } else {
  9283. props = {};
  9284. vals.each(function(cls){
  9285. var split = cls.split(':');
  9286. if (split[1]){
  9287. try {
  9288. props[split[0]] = JSON.decode(split[1], false);
  9289. } catch (e){}
  9290. }
  9291. });
  9292. this.store('$moo:validatorProps', props);
  9293. }
  9294. }
  9295. return this.retrieve('$moo:validatorProps');
  9296. }
  9297. };
  9298. Form.Validator = new Class({
  9299. Implements: [Options, Events],
  9300. options: {/*
  9301. onFormValidate: function(isValid, form, event){},
  9302. onElementValidate: function(isValid, field, className, warn){},
  9303. onElementPass: function(field){},
  9304. onElementFail: function(field, validatorsFailed){}, */
  9305. fieldSelectors: 'input, select, textarea',
  9306. ignoreHidden: true,
  9307. ignoreDisabled: true,
  9308. useTitles: false,
  9309. evaluateOnSubmit: true,
  9310. evaluateFieldsOnBlur: true,
  9311. evaluateFieldsOnChange: true,
  9312. serial: true,
  9313. stopOnFailure: true,
  9314. warningPrefix: function(){
  9315. return Form.Validator.getMsg('warningPrefix') || 'Warning: ';
  9316. },
  9317. errorPrefix: function(){
  9318. return Form.Validator.getMsg('errorPrefix') || 'Error: ';
  9319. }
  9320. },
  9321. initialize: function(form, options){
  9322. this.setOptions(options);
  9323. this.element = document.id(form);
  9324. this.warningPrefix = Function.convert(this.options.warningPrefix)();
  9325. this.errorPrefix = Function.convert(this.options.errorPrefix)();
  9326. this._bound = {
  9327. onSubmit: this.onSubmit.bind(this),
  9328. blurOrChange: function(event, field){
  9329. this.validationMonitor(field, true);
  9330. }.bind(this)
  9331. };
  9332. this.enable();
  9333. },
  9334. toElement: function(){
  9335. return this.element;
  9336. },
  9337. getFields: function(){
  9338. return (this.fields = this.element.getElements(this.options.fieldSelectors));
  9339. },
  9340. enable: function(){
  9341. this.element.store('validator', this);
  9342. if (this.options.evaluateOnSubmit) this.element.addEvent('submit', this._bound.onSubmit);
  9343. if (this.options.evaluateFieldsOnBlur){
  9344. this.element.addEvent('blur:relay(input,select,textarea)', this._bound.blurOrChange);
  9345. }
  9346. if (this.options.evaluateFieldsOnChange){
  9347. this.element.addEvent('change:relay(input,select,textarea)', this._bound.blurOrChange);
  9348. }
  9349. },
  9350. disable: function(){
  9351. this.element.eliminate('validator');
  9352. this.element.removeEvents({
  9353. submit: this._bound.onSubmit,
  9354. 'blur:relay(input,select,textarea)': this._bound.blurOrChange,
  9355. 'change:relay(input,select,textarea)': this._bound.blurOrChange
  9356. });
  9357. },
  9358. validationMonitor: function(){
  9359. clearTimeout(this.timer);
  9360. this.timer = this.validateField.delay(50, this, arguments);
  9361. },
  9362. onSubmit: function(event){
  9363. if (this.validate(event)) this.reset();
  9364. },
  9365. reset: function(){
  9366. this.getFields().each(this.resetField, this);
  9367. return this;
  9368. },
  9369. validate: function(event){
  9370. var result = this.getFields().map(function(field){
  9371. return this.validateField(field, true);
  9372. }, this).every(function(v){
  9373. return v;
  9374. });
  9375. this.fireEvent('formValidate', [result, this.element, event]);
  9376. if (this.options.stopOnFailure && !result && event) event.preventDefault();
  9377. return result;
  9378. },
  9379. validateField: function(field, force){
  9380. if (this.paused) return true;
  9381. field = document.id(field);
  9382. var passed = !field.hasClass('validation-failed');
  9383. var failed, warned;
  9384. if (this.options.serial && !force){
  9385. failed = this.element.getElement('.validation-failed');
  9386. warned = this.element.getElement('.warning');
  9387. }
  9388. if (field && (!failed || force || field.hasClass('validation-failed') || (failed && !this.options.serial))){
  9389. var validationTypes = field.get('validators');
  9390. var validators = validationTypes.some(function(cn){
  9391. return this.getValidator(cn);
  9392. }, this);
  9393. var validatorsFailed = [];
  9394. validationTypes.each(function(className){
  9395. if (className && !this.test(className, field)) validatorsFailed.include(className);
  9396. }, this);
  9397. passed = validatorsFailed.length === 0;
  9398. if (validators && !this.hasValidator(field, 'warnOnly')){
  9399. if (passed){
  9400. field.addClass('validation-passed').removeClass('validation-failed');
  9401. this.fireEvent('elementPass', [field]);
  9402. } else {
  9403. field.addClass('validation-failed').removeClass('validation-passed');
  9404. this.fireEvent('elementFail', [field, validatorsFailed]);
  9405. }
  9406. }
  9407. if (!warned){
  9408. var warnings = validationTypes.some(function(cn){
  9409. if (cn.test('^warn'))
  9410. return this.getValidator(cn.replace(/^warn-/,''));
  9411. else return null;
  9412. }, this);
  9413. field.removeClass('warning');
  9414. var warnResult = validationTypes.map(function(cn){
  9415. if (cn.test('^warn'))
  9416. return this.test(cn.replace(/^warn-/,''), field, true);
  9417. else return null;
  9418. }, this);
  9419. }
  9420. }
  9421. return passed;
  9422. },
  9423. test: function(className, field, warn){
  9424. field = document.id(field);
  9425. if ((this.options.ignoreHidden && !field.isVisible()) || (this.options.ignoreDisabled && field.get('disabled'))) return true;
  9426. var validator = this.getValidator(className);
  9427. if (warn != null) warn = false;
  9428. if (this.hasValidator(field, 'warnOnly')) warn = true;
  9429. var isValid = field.hasClass('ignoreValidation') || (validator ? validator.test(field) : true);
  9430. if (validator) this.fireEvent('elementValidate', [isValid, field, className, warn]);
  9431. if (warn) return true;
  9432. return isValid;
  9433. },
  9434. hasValidator: function(field, value){
  9435. return field.get('validators').contains(value);
  9436. },
  9437. resetField: function(field){
  9438. field = document.id(field);
  9439. if (field){
  9440. field.get('validators').each(function(className){
  9441. if (className.test('^warn-')) className = className.replace(/^warn-/, '');
  9442. field.removeClass('validation-failed');
  9443. field.removeClass('warning');
  9444. field.removeClass('validation-passed');
  9445. }, this);
  9446. }
  9447. return this;
  9448. },
  9449. stop: function(){
  9450. this.paused = true;
  9451. return this;
  9452. },
  9453. start: function(){
  9454. this.paused = false;
  9455. return this;
  9456. },
  9457. ignoreField: function(field, warn){
  9458. field = document.id(field);
  9459. if (field){
  9460. this.enforceField(field);
  9461. if (warn) field.addClass('warnOnly');
  9462. else field.addClass('ignoreValidation');
  9463. }
  9464. return this;
  9465. },
  9466. enforceField: function(field){
  9467. field = document.id(field);
  9468. if (field) field.removeClass('warnOnly').removeClass('ignoreValidation');
  9469. return this;
  9470. }
  9471. });
  9472. Form.Validator.getMsg = function(key){
  9473. return Locale.get('FormValidator.' + key);
  9474. };
  9475. Form.Validator.adders = {
  9476. validators:{},
  9477. add : function(className, options){
  9478. this.validators[className] = new InputValidator(className, options);
  9479. //if this is a class (this method is used by instances of Form.Validator and the Form.Validator namespace)
  9480. //extend these validators into it
  9481. //this allows validators to be global and/or per instance
  9482. if (!this.initialize){
  9483. this.implement({
  9484. validators: this.validators
  9485. });
  9486. }
  9487. },
  9488. addAllThese : function(validators){
  9489. Array.convert(validators).each(function(validator){
  9490. this.add(validator[0], validator[1]);
  9491. }, this);
  9492. },
  9493. getValidator: function(className){
  9494. return this.validators[className.split(':')[0]];
  9495. }
  9496. };
  9497. Object.append(Form.Validator, Form.Validator.adders);
  9498. Form.Validator.implement(Form.Validator.adders);
  9499. Form.Validator.add('IsEmpty', {
  9500. errorMsg: false,
  9501. test: function(element){
  9502. if (element.type == 'select-one' || element.type == 'select')
  9503. return !(element.selectedIndex >= 0 && element.options[element.selectedIndex].value != '');
  9504. else
  9505. return ((element.get('value') == null) || (element.get('value').length == 0));
  9506. }
  9507. });
  9508. Form.Validator.addAllThese([
  9509. ['required', {
  9510. errorMsg: function(){
  9511. return Form.Validator.getMsg('required');
  9512. },
  9513. test: function(element){
  9514. return !Form.Validator.getValidator('IsEmpty').test(element);
  9515. }
  9516. }],
  9517. ['length', {
  9518. errorMsg: function(element, props){
  9519. if (typeOf(props.length) != 'null')
  9520. return Form.Validator.getMsg('length').substitute({length: props.length, elLength: element.get('value').length});
  9521. else return '';
  9522. },
  9523. test: function(element, props){
  9524. if (typeOf(props.length) != 'null') return (element.get('value').length == props.length || element.get('value').length == 0);
  9525. else return true;
  9526. }
  9527. }],
  9528. ['minLength', {
  9529. errorMsg: function(element, props){
  9530. if (typeOf(props.minLength) != 'null')
  9531. return Form.Validator.getMsg('minLength').substitute({minLength: props.minLength, length: element.get('value').length});
  9532. else return '';
  9533. },
  9534. test: function(element, props){
  9535. if (typeOf(props.minLength) != 'null') return (element.get('value').length >= (props.minLength || 0));
  9536. else return true;
  9537. }
  9538. }],
  9539. ['maxLength', {
  9540. errorMsg: function(element, props){
  9541. //props is {maxLength:10}
  9542. if (typeOf(props.maxLength) != 'null')
  9543. return Form.Validator.getMsg('maxLength').substitute({maxLength: props.maxLength, length: element.get('value').length});
  9544. else return '';
  9545. },
  9546. test: function(element, props){
  9547. return element.get('value').length <= (props.maxLength || 10000);
  9548. }
  9549. }],
  9550. ['validate-integer', {
  9551. errorMsg: Form.Validator.getMsg.pass('integer'),
  9552. test: function(element){
  9553. return Form.Validator.getValidator('IsEmpty').test(element) || (/^(-?[1-9]\d*|0)$/).test(element.get('value'));
  9554. }
  9555. }],
  9556. ['validate-numeric', {
  9557. errorMsg: Form.Validator.getMsg.pass('numeric'),
  9558. test: function(element){
  9559. return Form.Validator.getValidator('IsEmpty').test(element) ||
  9560. (/^-?(?:0$0(?=\d*\.)|[1-9]|0)\d*(\.\d+)?$/).test(element.get('value'));
  9561. }
  9562. }],
  9563. ['validate-digits', {
  9564. errorMsg: Form.Validator.getMsg.pass('digits'),
  9565. test: function(element){
  9566. return Form.Validator.getValidator('IsEmpty').test(element) || (/^[\d() .:\-\+#]+$/.test(element.get('value')));
  9567. }
  9568. }],
  9569. ['validate-alpha', {
  9570. errorMsg: Form.Validator.getMsg.pass('alpha'),
  9571. test: function(element){
  9572. return Form.Validator.getValidator('IsEmpty').test(element) || (/^[a-zA-Z]+$/).test(element.get('value'));
  9573. }
  9574. }],
  9575. ['validate-alphanum', {
  9576. errorMsg: Form.Validator.getMsg.pass('alphanum'),
  9577. test: function(element){
  9578. return Form.Validator.getValidator('IsEmpty').test(element) || !(/\W/).test(element.get('value'));
  9579. }
  9580. }],
  9581. ['validate-date', {
  9582. errorMsg: function(element, props){
  9583. if (Date.parse){
  9584. var format = props.dateFormat || '%x';
  9585. return Form.Validator.getMsg('dateSuchAs').substitute({date: new Date().format(format)});
  9586. } else {
  9587. return Form.Validator.getMsg('dateInFormatMDY');
  9588. }
  9589. },
  9590. test: function(element, props){
  9591. if (Form.Validator.getValidator('IsEmpty').test(element)) return true;
  9592. var dateLocale = Locale.get('Date'),
  9593. dateNouns = new RegExp([dateLocale.days, dateLocale.days_abbr, dateLocale.months, dateLocale.months_abbr, dateLocale.AM, dateLocale.PM].flatten().join('|'), 'i'),
  9594. value = element.get('value'),
  9595. wordsInValue = value.match(/[a-z]+/gi);
  9596. if (wordsInValue && !wordsInValue.every(dateNouns.exec, dateNouns)) return false;
  9597. var date = Date.parse(value);
  9598. if (!date) return false;
  9599. var format = props.dateFormat || '%x',
  9600. formatted = date.format(format);
  9601. if (formatted != 'invalid date') element.set('value', formatted);
  9602. return date.isValid();
  9603. }
  9604. }],
  9605. ['validate-email', {
  9606. errorMsg: Form.Validator.getMsg.pass('email'),
  9607. test: function(element){
  9608. /*
  9609. var chars = "[a-z0-9!#$%&'*+/=?^_`{|}~-]",
  9610. local = '(?:' + chars + '\\.?){0,63}' + chars,
  9611. label = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?',
  9612. hostname = '(?:' + label + '\\.)*' + label;
  9613. octet = '(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',
  9614. ipv4 = '\\[(?:' + octet + '\\.){3}' + octet + '\\]',
  9615. domain = '(?:' + hostname + '|' + ipv4 + ')';
  9616. var regex = new RegExp('^' + local + '@' + domain + '$', 'i');
  9617. */
  9618. 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'));
  9619. }
  9620. }],
  9621. ['validate-url', {
  9622. errorMsg: Form.Validator.getMsg.pass('url'),
  9623. test: function(element){
  9624. 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'));
  9625. }
  9626. }],
  9627. ['validate-currency-dollar', {
  9628. errorMsg: Form.Validator.getMsg.pass('currencyDollar'),
  9629. test: function(element){
  9630. 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'));
  9631. }
  9632. }],
  9633. ['validate-one-required', {
  9634. errorMsg: Form.Validator.getMsg.pass('oneRequired'),
  9635. test: function(element, props){
  9636. var p = document.id(props['validate-one-required']) || element.getParent(props['validate-one-required']);
  9637. return p.getElements('input').some(function(el){
  9638. if (['checkbox', 'radio'].contains(el.get('type'))) return el.get('checked');
  9639. return el.get('value');
  9640. });
  9641. }
  9642. }]
  9643. ]);
  9644. Element.Properties.validator = {
  9645. set: function(options){
  9646. this.get('validator').setOptions(options);
  9647. },
  9648. get: function(){
  9649. var validator = this.retrieve('validator');
  9650. if (!validator){
  9651. validator = new Form.Validator(this);
  9652. this.store('validator', validator);
  9653. }
  9654. return validator;
  9655. }
  9656. };
  9657. Element.implement({
  9658. validate: function(options){
  9659. if (options) this.set('validator', options);
  9660. return this.get('validator').validate();
  9661. }
  9662. });
  9663. //<1.2compat>
  9664. //legacy
  9665. var FormValidator = Form.Validator;
  9666. //</1.2compat>
  9667. /*
  9668. ---
  9669. script: Form.Validator.Extras.js
  9670. name: Form.Validator.Extras
  9671. description: Additional validators for the Form.Validator class.
  9672. license: MIT-style license
  9673. authors:
  9674. - Aaron Newton
  9675. requires:
  9676. - Form.Validator
  9677. provides: [Form.Validator.Extras]
  9678. ...
  9679. */
  9680. (function(){
  9681. function getItems(props, preference, children, cssSelector){
  9682. if (preference && props[preference]) return props[preference];
  9683. var el = document.id(props[children]);
  9684. if (!el) return [];
  9685. return el.getElements(cssSelector);
  9686. }
  9687. Form.Validator.addAllThese([
  9688. ['validate-enforce-oncheck', {
  9689. test: function(element, props){
  9690. var fv = element.getParent('form').retrieve('validator');
  9691. if (!fv) return true;
  9692. getItems(props, 'toEnforce', 'enforceChildrenOf', 'input, select, textarea').each(function(item){
  9693. if (element.checked){
  9694. fv.enforceField(item);
  9695. } else {
  9696. fv.ignoreField(item);
  9697. fv.resetField(item);
  9698. }
  9699. });
  9700. return true;
  9701. }
  9702. }],
  9703. ['validate-ignore-oncheck', {
  9704. test: function(element, props){
  9705. var fv = element.getParent('form').retrieve('validator');
  9706. if (!fv) return true;
  9707. getItems(props, 'toIgnore', 'ignoreChildrenOf', 'input, select, textarea').each(function(item){
  9708. if (element.checked){
  9709. fv.ignoreField(item);
  9710. fv.resetField(item);
  9711. } else {
  9712. fv.enforceField(item);
  9713. }
  9714. });
  9715. return true;
  9716. }
  9717. }],
  9718. ['validate-enforce-onselect-value', {
  9719. test: function(element, props){
  9720. if (!props.value) return true;
  9721. var fv = element.getParent('form').retrieve('validator');
  9722. if (!fv) return true;
  9723. getItems(props, 'toEnforce', 'enforceChildrenOf', 'input, select, textarea').each(function(item){
  9724. if (props.value == element.value){
  9725. fv.enforceField(item);
  9726. } else {
  9727. fv.ignoreField(item);
  9728. fv.resetField(item);
  9729. }
  9730. });
  9731. return true;
  9732. }
  9733. }],
  9734. ['validate-nospace', {
  9735. errorMsg: function(){
  9736. return Form.Validator.getMsg('noSpace');
  9737. },
  9738. test: function(element, props){
  9739. return !element.get('value').test(/\s/);
  9740. }
  9741. }],
  9742. ['validate-toggle-oncheck', {
  9743. test: function(element, props){
  9744. var fv = element.getParent('form').retrieve('validator');
  9745. if (!fv) return true;
  9746. var eleArr = getItems(props, 'toToggle', 'toToggleChildrenOf', 'input, select, textarea');
  9747. if (!element.checked){
  9748. eleArr.each(function(item){
  9749. fv.ignoreField(item);
  9750. fv.resetField(item);
  9751. });
  9752. } else {
  9753. eleArr.each(function(item){
  9754. fv.enforceField(item);
  9755. });
  9756. }
  9757. return true;
  9758. }
  9759. }],
  9760. ['validate-reqchk-bynode', {
  9761. errorMsg: function(){
  9762. return Form.Validator.getMsg('reqChkByNode');
  9763. },
  9764. test: function(element, props){
  9765. return getItems(props, false, 'nodeId', props.selector || 'input[type=checkbox], input[type=radio]').some(function(item){
  9766. return item.checked;
  9767. });
  9768. }
  9769. }],
  9770. ['validate-required-check', {
  9771. errorMsg: function(element, props){
  9772. return props.useTitle ? element.get('title') : Form.Validator.getMsg('requiredChk');
  9773. },
  9774. test: function(element, props){
  9775. return !!element.checked;
  9776. }
  9777. }],
  9778. ['validate-reqchk-byname', {
  9779. errorMsg: function(element, props){
  9780. return Form.Validator.getMsg('reqChkByName').substitute({label: props.label || element.get('type')});
  9781. },
  9782. test: function(element, props){
  9783. var grpName = props.groupName || element.get('name');
  9784. var grpNameEls = $$('[name=' + grpName +']');
  9785. var oneCheckedItem = grpNameEls.some(function(item, index){
  9786. return item.checked;
  9787. });
  9788. var fv = element.getParent('form').retrieve('validator');
  9789. if (oneCheckedItem && fv){
  9790. grpNameEls.each(function(item, index){ fv.resetField(item); });
  9791. }
  9792. return oneCheckedItem;
  9793. }
  9794. }],
  9795. ['validate-match', {
  9796. errorMsg: function(element, props){
  9797. return Form.Validator.getMsg('match').substitute({matchName: decodeURIComponent((props.matchName+'').replace(/\+/g, '%20')) || document.id(props.matchInput).get('name')});
  9798. },
  9799. test: function(element, props){
  9800. var eleVal = element.get('value');
  9801. var matchVal = document.id(props.matchInput) && document.id(props.matchInput).get('value');
  9802. return eleVal && matchVal ? eleVal == matchVal : true;
  9803. }
  9804. }],
  9805. ['validate-after-date', {
  9806. errorMsg: function(element, props){
  9807. return Form.Validator.getMsg('afterDate').substitute({
  9808. label: props.afterLabel || (props.afterElement ? Form.Validator.getMsg('startDate') : Form.Validator.getMsg('currentDate'))
  9809. });
  9810. },
  9811. test: function(element, props){
  9812. var start = document.id(props.afterElement) ? Date.parse(document.id(props.afterElement).get('value')) : new Date();
  9813. var end = Date.parse(element.get('value'));
  9814. return end && start ? end >= start : true;
  9815. }
  9816. }],
  9817. ['validate-before-date', {
  9818. errorMsg: function(element, props){
  9819. return Form.Validator.getMsg('beforeDate').substitute({
  9820. label: props.beforeLabel || (props.beforeElement ? Form.Validator.getMsg('endDate') : Form.Validator.getMsg('currentDate'))
  9821. });
  9822. },
  9823. test: function(element, props){
  9824. var start = Date.parse(element.get('value'));
  9825. var end = document.id(props.beforeElement) ? Date.parse(document.id(props.beforeElement).get('value')) : new Date();
  9826. return end && start ? end >= start : true;
  9827. }
  9828. }],
  9829. ['validate-custom-required', {
  9830. errorMsg: function(){
  9831. return Form.Validator.getMsg('required');
  9832. },
  9833. test: function(element, props){
  9834. return element.get('value') != props.emptyValue;
  9835. }
  9836. }],
  9837. ['validate-same-month', {
  9838. errorMsg: function(element, props){
  9839. var startMo = document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value');
  9840. var eleVal = element.get('value');
  9841. if (eleVal != '') return Form.Validator.getMsg(startMo ? 'sameMonth' : 'startMonth');
  9842. },
  9843. test: function(element, props){
  9844. var d1 = Date.parse(element.get('value'));
  9845. var d2 = Date.parse(document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value'));
  9846. return d1 && d2 ? d1.format('%B') == d2.format('%B') : true;
  9847. }
  9848. }],
  9849. ['validate-cc-num', {
  9850. errorMsg: function(element){
  9851. var ccNum = element.get('value').replace(/[^0-9]/g, '');
  9852. return Form.Validator.getMsg('creditcard').substitute({length: ccNum.length});
  9853. },
  9854. test: function(element){
  9855. // required is a different test
  9856. if (Form.Validator.getValidator('IsEmpty').test(element)) return true;
  9857. // Clean number value
  9858. var ccNum = element.get('value');
  9859. ccNum = ccNum.replace(/[^0-9]/g, '');
  9860. var validType = false;
  9861. if (ccNum.test(/^4[0-9]{12}([0-9]{3})?$/)) validType = 'Visa';
  9862. else if (ccNum.test(/^5[1-5]([0-9]{14})$/)) validType = 'Master Card';
  9863. else if (ccNum.test(/^3[47][0-9]{13}$/)) validType = 'American Express';
  9864. else if (ccNum.test(/^6(?:011|5[0-9]{2})[0-9]{12}$/)) validType = 'Discover';
  9865. else if (ccNum.test(/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/)) validType = 'Diners Club';
  9866. if (validType){
  9867. var sum = 0;
  9868. var cur = 0;
  9869. for (var i=ccNum.length-1; i>=0; --i){
  9870. cur = ccNum.charAt(i).toInt();
  9871. if (cur == 0) continue;
  9872. if ((ccNum.length-i) % 2 == 0) cur += cur;
  9873. if (cur > 9){
  9874. cur = cur.toString().charAt(0).toInt() + cur.toString().charAt(1).toInt();
  9875. }
  9876. sum += cur;
  9877. }
  9878. if ((sum % 10) == 0) return true;
  9879. }
  9880. var chunks = '';
  9881. while (ccNum != ''){
  9882. chunks += ' ' + ccNum.substr(0,4);
  9883. ccNum = ccNum.substr(4);
  9884. }
  9885. element.getParent('form').retrieve('validator').ignoreField(element);
  9886. element.set('value', chunks.clean());
  9887. element.getParent('form').retrieve('validator').enforceField(element);
  9888. return false;
  9889. }
  9890. }]
  9891. ]);
  9892. })();
  9893. /*
  9894. ---
  9895. script: Form.Validator.Inline.js
  9896. name: Form.Validator.Inline
  9897. description: Extends Form.Validator to add inline messages.
  9898. license: MIT-style license
  9899. authors:
  9900. - Aaron Newton
  9901. requires:
  9902. - Form.Validator
  9903. provides: [Form.Validator.Inline]
  9904. ...
  9905. */
  9906. Form.Validator.Inline = new Class({
  9907. Extends: Form.Validator,
  9908. options: {
  9909. showError: function(errorElement){
  9910. if (errorElement.reveal) errorElement.reveal();
  9911. else errorElement.setStyle('display', 'block');
  9912. },
  9913. hideError: function(errorElement){
  9914. if (errorElement.dissolve) errorElement.dissolve();
  9915. else errorElement.setStyle('display', 'none');
  9916. },
  9917. scrollToErrorsOnSubmit: true,
  9918. scrollToErrorsOnBlur: false,
  9919. scrollToErrorsOnChange: false,
  9920. scrollFxOptions: {
  9921. transition: 'quad:out',
  9922. offset: {
  9923. y: -20
  9924. }
  9925. }
  9926. },
  9927. initialize: function(form, options){
  9928. this.parent(form, options);
  9929. this.addEvent('onElementValidate', function(isValid, field, className, warn){
  9930. var validator = this.getValidator(className);
  9931. if (!isValid && validator.getError(field)){
  9932. if (warn) field.addClass('warning');
  9933. var advice = this.makeAdvice(className, field, validator.getError(field), warn);
  9934. this.insertAdvice(advice, field);
  9935. this.showAdvice(className, field);
  9936. } else {
  9937. this.hideAdvice(className, field);
  9938. }
  9939. });
  9940. },
  9941. makeAdvice: function(className, field, error, warn){
  9942. var errorMsg = (warn) ? this.warningPrefix : this.errorPrefix;
  9943. errorMsg += (this.options.useTitles) ? field.title || error:error;
  9944. var cssClass = (warn) ? 'warning-advice' : 'validation-advice';
  9945. var advice = this.getAdvice(className, field);
  9946. if (advice){
  9947. advice = advice.set('html', errorMsg);
  9948. } else {
  9949. advice = new Element('div', {
  9950. html: errorMsg,
  9951. styles: { display: 'none' },
  9952. id: 'advice-' + className.split(':')[0] + '-' + this.getFieldId(field)
  9953. }).addClass(cssClass);
  9954. }
  9955. field.store('$moo:advice-' + className, advice);
  9956. return advice;
  9957. },
  9958. getFieldId : function(field){
  9959. return field.id ? field.id : field.id = 'input_' + field.name;
  9960. },
  9961. showAdvice: function(className, field){
  9962. var advice = this.getAdvice(className, field);
  9963. if (
  9964. advice &&
  9965. !field.retrieve('$moo:' + this.getPropName(className)) &&
  9966. (
  9967. advice.getStyle('display') == 'none' ||
  9968. advice.getStyle('visibility') == 'hidden' ||
  9969. advice.getStyle('opacity') == 0
  9970. )
  9971. ){
  9972. field.store('$moo:' + this.getPropName(className), true);
  9973. this.options.showError(advice);
  9974. this.fireEvent('showAdvice', [field, advice, className]);
  9975. }
  9976. },
  9977. hideAdvice: function(className, field){
  9978. var advice = this.getAdvice(className, field);
  9979. if (advice && field.retrieve('$moo:' + this.getPropName(className))){
  9980. field.store('$moo:' + this.getPropName(className), false);
  9981. this.options.hideError(advice);
  9982. this.fireEvent('hideAdvice', [field, advice, className]);
  9983. }
  9984. },
  9985. getPropName: function(className){
  9986. return 'advice' + className;
  9987. },
  9988. resetField: function(field){
  9989. field = document.id(field);
  9990. if (!field) return this;
  9991. this.parent(field);
  9992. field.get('validators').each(function(className){
  9993. this.hideAdvice(className, field);
  9994. }, this);
  9995. return this;
  9996. },
  9997. getAllAdviceMessages: function(field, force){
  9998. var advice = [];
  9999. if (field.hasClass('ignoreValidation') && !force) return advice;
  10000. var validators = field.get('validators').some(function(cn){
  10001. var warner = cn.test('^warn-') || field.hasClass('warnOnly');
  10002. if (warner) cn = cn.replace(/^warn-/, '');
  10003. var validator = this.getValidator(cn);
  10004. if (!validator) return;
  10005. advice.push({
  10006. message: validator.getError(field),
  10007. warnOnly: warner,
  10008. passed: validator.test(),
  10009. validator: validator
  10010. });
  10011. }, this);
  10012. return advice;
  10013. },
  10014. getAdvice: function(className, field){
  10015. return field.retrieve('$moo:advice-' + className);
  10016. },
  10017. insertAdvice: function(advice, field){
  10018. //Check for error position prop
  10019. var props = field.get('validatorProps');
  10020. //Build advice
  10021. if (!props.msgPos || !document.id(props.msgPos)){
  10022. if (field.type && field.type.toLowerCase() == 'radio') field.getParent().adopt(advice);
  10023. else advice.inject(document.id(field), 'after');
  10024. } else {
  10025. document.id(props.msgPos).grab(advice);
  10026. }
  10027. },
  10028. validateField: function(field, force, scroll){
  10029. var result = this.parent(field, force);
  10030. if (((this.options.scrollToErrorsOnSubmit && scroll == null) || scroll) && !result){
  10031. var failed = document.id(this).getElement('.validation-failed');
  10032. var par = document.id(this).getParent();
  10033. while (par != document.body && par.getScrollSize().y == par.getSize().y){
  10034. par = par.getParent();
  10035. }
  10036. var fx = par.retrieve('$moo:fvScroller');
  10037. if (!fx && window.Fx && Fx.Scroll){
  10038. fx = new Fx.Scroll(par, this.options.scrollFxOptions);
  10039. par.store('$moo:fvScroller', fx);
  10040. }
  10041. if (failed){
  10042. if (fx) fx.toElement(failed);
  10043. else par.scrollTo(par.getScroll().x, failed.getPosition(par).y - 20);
  10044. }
  10045. }
  10046. return result;
  10047. },
  10048. watchFields: function(fields){
  10049. fields.each(function(el){
  10050. if (this.options.evaluateFieldsOnBlur){
  10051. el.addEvent('blur', this.validationMonitor.pass([el, false, this.options.scrollToErrorsOnBlur], this));
  10052. }
  10053. if (this.options.evaluateFieldsOnChange){
  10054. el.addEvent('change', this.validationMonitor.pass([el, true, this.options.scrollToErrorsOnChange], this));
  10055. }
  10056. }, this);
  10057. }
  10058. });
  10059. /*
  10060. ---
  10061. script: OverText.js
  10062. name: OverText
  10063. description: Shows text over an input that disappears when the user clicks into it. The text remains hidden if the user adds a value.
  10064. license: MIT-style license
  10065. authors:
  10066. - Aaron Newton
  10067. requires:
  10068. - Core/Options
  10069. - Core/Events
  10070. - Core/Element.Event
  10071. - Class.Binds
  10072. - Class.Occlude
  10073. - Element.Position
  10074. - Element.Shortcuts
  10075. provides: [OverText]
  10076. ...
  10077. */
  10078. (function(){
  10079. var OverText = this.OverText = new Class({
  10080. Implements: [Options, Events, Class.Occlude],
  10081. Binds: ['reposition', 'assert', 'focus', 'hide'],
  10082. options: {/*
  10083. textOverride: null,
  10084. onFocus: function(){},
  10085. onTextHide: function(textEl, inputEl){},
  10086. onTextShow: function(textEl, inputEl){}, */
  10087. element: 'label',
  10088. labelClass: 'overTxtLabel',
  10089. positionOptions: {
  10090. position: 'upperLeft',
  10091. edge: 'upperLeft',
  10092. offset: {
  10093. x: 4,
  10094. y: 2
  10095. }
  10096. },
  10097. poll: false,
  10098. pollInterval: 250,
  10099. wrap: false
  10100. },
  10101. property: 'OverText',
  10102. initialize: function(element, options){
  10103. element = this.element = document.id(element);
  10104. if (this.occlude()) return this.occluded;
  10105. this.setOptions(options);
  10106. this.attach(element);
  10107. OverText.instances.push(this);
  10108. if (this.options.poll) this.poll();
  10109. },
  10110. toElement: function(){
  10111. return this.element;
  10112. },
  10113. attach: function(){
  10114. var element = this.element,
  10115. options = this.options,
  10116. value = options.textOverride || element.get('alt') || element.get('title');
  10117. if (!value) return this;
  10118. var text = this.text = new Element(options.element, {
  10119. 'class': options.labelClass,
  10120. styles: {
  10121. lineHeight: 'normal',
  10122. position: 'absolute',
  10123. cursor: 'text'
  10124. },
  10125. html: value,
  10126. events: {
  10127. click: this.hide.pass(options.element == 'label', this)
  10128. }
  10129. }).inject(element, 'after');
  10130. if (options.element == 'label'){
  10131. if (!element.get('id')) element.set('id', 'input_' + String.uniqueID());
  10132. text.set('for', element.get('id'));
  10133. }
  10134. if (options.wrap){
  10135. this.textHolder = new Element('div.overTxtWrapper', {
  10136. styles: {
  10137. lineHeight: 'normal',
  10138. position: 'relative'
  10139. }
  10140. }).grab(text).inject(element, 'before');
  10141. }
  10142. return this.enable();
  10143. },
  10144. destroy: function(){
  10145. this.element.eliminate(this.property); // Class.Occlude storage
  10146. this.disable();
  10147. if (this.text) this.text.destroy();
  10148. if (this.textHolder) this.textHolder.destroy();
  10149. return this;
  10150. },
  10151. disable: function(){
  10152. this.element.removeEvents({
  10153. focus: this.focus,
  10154. blur: this.assert,
  10155. change: this.assert
  10156. });
  10157. window.removeEvent('resize', this.reposition);
  10158. this.hide(true, true);
  10159. return this;
  10160. },
  10161. enable: function(){
  10162. this.element.addEvents({
  10163. focus: this.focus,
  10164. blur: this.assert,
  10165. change: this.assert
  10166. });
  10167. window.addEvent('resize', this.reposition);
  10168. this.reposition();
  10169. return this;
  10170. },
  10171. wrap: function(){
  10172. if (this.options.element == 'label'){
  10173. if (!this.element.get('id')) this.element.set('id', 'input_' + String.uniqueID());
  10174. this.text.set('for', this.element.get('id'));
  10175. }
  10176. },
  10177. startPolling: function(){
  10178. this.pollingPaused = false;
  10179. return this.poll();
  10180. },
  10181. poll: function(stop){
  10182. //start immediately
  10183. //pause on focus
  10184. //resumeon blur
  10185. if (this.poller && !stop) return this;
  10186. if (stop){
  10187. clearInterval(this.poller);
  10188. } else {
  10189. this.poller = (function(){
  10190. if (!this.pollingPaused) this.assert(true);
  10191. }).periodical(this.options.pollInterval, this);
  10192. }
  10193. return this;
  10194. },
  10195. stopPolling: function(){
  10196. this.pollingPaused = true;
  10197. return this.poll(true);
  10198. },
  10199. focus: function(){
  10200. if (this.text && (!this.text.isDisplayed() || this.element.get('disabled'))) return this;
  10201. return this.hide();
  10202. },
  10203. hide: function(suppressFocus, force){
  10204. if (this.text && (this.text.isDisplayed() && (!this.element.get('disabled') || force))){
  10205. this.text.hide();
  10206. this.fireEvent('textHide', [this.text, this.element]);
  10207. this.pollingPaused = true;
  10208. if (!suppressFocus){
  10209. try {
  10210. this.element.fireEvent('focus');
  10211. this.element.focus();
  10212. } catch (e){} //IE barfs if you call focus on hidden elements
  10213. }
  10214. }
  10215. return this;
  10216. },
  10217. show: function(){
  10218. if (document.id(this.text) && !this.text.isDisplayed()){
  10219. this.text.show();
  10220. this.reposition();
  10221. this.fireEvent('textShow', [this.text, this.element]);
  10222. this.pollingPaused = false;
  10223. }
  10224. return this;
  10225. },
  10226. test: function(){
  10227. return !this.element.get('value');
  10228. },
  10229. assert: function(suppressFocus){
  10230. return this[this.test() ? 'show' : 'hide'](suppressFocus);
  10231. },
  10232. reposition: function(){
  10233. this.assert(true);
  10234. if (!this.element.isVisible()) return this.stopPolling().hide();
  10235. if (this.text && this.test()){
  10236. this.text.position(Object.merge(this.options.positionOptions, {
  10237. relativeTo: this.element
  10238. }));
  10239. }
  10240. return this;
  10241. }
  10242. });
  10243. })();
  10244. OverText.instances = [];
  10245. Object.append(OverText, {
  10246. each: function(fn){
  10247. return OverText.instances.each(function(ot, i){
  10248. if (ot.element && ot.text) fn.call(OverText, ot, i);
  10249. });
  10250. },
  10251. update: function(){
  10252. return OverText.each(function(ot){
  10253. return ot.reposition();
  10254. });
  10255. },
  10256. hideAll: function(){
  10257. return OverText.each(function(ot){
  10258. return ot.hide(true, true);
  10259. });
  10260. },
  10261. showAll: function(){
  10262. return OverText.each(function(ot){
  10263. return ot.show();
  10264. });
  10265. }
  10266. });
  10267. /*
  10268. ---
  10269. script: Fx.Elements.js
  10270. name: Fx.Elements
  10271. description: Effect to change any number of CSS properties of any number of Elements.
  10272. license: MIT-style license
  10273. authors:
  10274. - Valerio Proietti
  10275. requires:
  10276. - Core/Fx.CSS
  10277. - MooTools.More
  10278. provides: [Fx.Elements]
  10279. ...
  10280. */
  10281. Fx.Elements = new Class({
  10282. Extends: Fx.CSS,
  10283. initialize: function(elements, options){
  10284. this.elements = this.subject = $$(elements);
  10285. this.parent(options);
  10286. },
  10287. compute: function(from, to, delta){
  10288. var now = {};
  10289. for (var i in from){
  10290. var iFrom = from[i], iTo = to[i], iNow = now[i] = {};
  10291. for (var p in iFrom) iNow[p] = this.parent(iFrom[p], iTo[p], delta);
  10292. }
  10293. return now;
  10294. },
  10295. set: function(now){
  10296. for (var i in now){
  10297. if (!this.elements[i]) continue;
  10298. var iNow = now[i];
  10299. for (var p in iNow) this.render(this.elements[i], p, iNow[p], this.options.unit);
  10300. }
  10301. return this;
  10302. },
  10303. start: function(obj){
  10304. if (!this.check(obj)) return this;
  10305. var from = {}, to = {};
  10306. for (var i in obj){
  10307. if (!this.elements[i]) continue;
  10308. var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {};
  10309. for (var p in iProps){
  10310. var parsed = this.prepare(this.elements[i], p, iProps[p]);
  10311. iFrom[p] = parsed.from;
  10312. iTo[p] = parsed.to;
  10313. }
  10314. }
  10315. return this.parent(from, to);
  10316. }
  10317. });
  10318. /*
  10319. ---
  10320. script: Fx.Accordion.js
  10321. name: Fx.Accordion
  10322. description: An Fx.Elements extension which allows you to easily create accordion type controls.
  10323. license: MIT-style license
  10324. authors:
  10325. - Valerio Proietti
  10326. requires:
  10327. - Core/Element.Event
  10328. - Fx.Elements
  10329. provides: [Fx.Accordion]
  10330. ...
  10331. */
  10332. Fx.Accordion = new Class({
  10333. Extends: Fx.Elements,
  10334. options: {/*
  10335. onActive: function(toggler, section){},
  10336. onBackground: function(toggler, section){},*/
  10337. fixedHeight: false,
  10338. fixedWidth: false,
  10339. display: 0,
  10340. show: false,
  10341. height: true,
  10342. width: false,
  10343. opacity: true,
  10344. alwaysHide: false,
  10345. trigger: 'click',
  10346. initialDisplayFx: true,
  10347. resetHeight: true,
  10348. keepOpen: false
  10349. },
  10350. initialize: function(){
  10351. var defined = function(obj){
  10352. return obj != null;
  10353. };
  10354. var params = Array.link(arguments, {
  10355. 'container': Type.isElement, //deprecated
  10356. 'options': Type.isObject,
  10357. 'togglers': defined,
  10358. 'elements': defined
  10359. });
  10360. this.parent(params.elements, params.options);
  10361. var options = this.options,
  10362. togglers = this.togglers = $$(params.togglers);
  10363. this.previous = -1;
  10364. this.internalChain = new Chain();
  10365. if (options.alwaysHide) this.options.link = 'chain';
  10366. if (options.show || this.options.show === 0){
  10367. options.display = false;
  10368. this.previous = options.show;
  10369. }
  10370. if (options.start){
  10371. options.display = false;
  10372. options.show = false;
  10373. }
  10374. var effects = this.effects = {};
  10375. if (options.opacity) effects.opacity = 'fullOpacity';
  10376. if (options.width) effects.width = options.fixedWidth ? 'fullWidth' : 'offsetWidth';
  10377. if (options.height) effects.height = options.fixedHeight ? 'fullHeight' : 'scrollHeight';
  10378. for (var i = 0, l = togglers.length; i < l; i++) this.addSection(togglers[i], this.elements[i]);
  10379. this.elements.each(function(el, i){
  10380. if (options.show === i){
  10381. this.fireEvent('active', [togglers[i], el]);
  10382. } else {
  10383. for (var fx in effects) el.setStyle(fx, 0);
  10384. }
  10385. }, this);
  10386. if (options.display || options.display === 0 || options.initialDisplayFx === false){
  10387. this.display(options.display, options.initialDisplayFx);
  10388. }
  10389. if (options.fixedHeight !== false) options.resetHeight = false;
  10390. this.addEvent('complete', this.internalChain.callChain.bind(this.internalChain));
  10391. },
  10392. addSection: function(toggler, element){
  10393. toggler = document.id(toggler);
  10394. element = document.id(element);
  10395. this.togglers.include(toggler);
  10396. this.elements.include(element);
  10397. var togglers = this.togglers,
  10398. options = this.options,
  10399. test = togglers.contains(toggler),
  10400. idx = togglers.indexOf(toggler),
  10401. displayer = this.display.pass(idx, this);
  10402. toggler.store('accordion:display', displayer)
  10403. .addEvent(options.trigger, displayer);
  10404. if (options.height) element.setStyles({'padding-top': 0, 'border-top': 'none', 'padding-bottom': 0, 'border-bottom': 'none'});
  10405. if (options.width) element.setStyles({'padding-left': 0, 'border-left': 'none', 'padding-right': 0, 'border-right': 'none'});
  10406. element.fullOpacity = 1;
  10407. if (options.fixedWidth) element.fullWidth = options.fixedWidth;
  10408. if (options.fixedHeight) element.fullHeight = options.fixedHeight;
  10409. element.setStyle('overflow', 'hidden');
  10410. if (!test) for (var fx in this.effects){
  10411. element.setStyle(fx, 0);
  10412. }
  10413. return this;
  10414. },
  10415. removeSection: function(toggler, displayIndex){
  10416. var togglers = this.togglers,
  10417. idx = togglers.indexOf(toggler),
  10418. element = this.elements[idx];
  10419. var remover = function(){
  10420. togglers.erase(toggler);
  10421. this.elements.erase(element);
  10422. this.detach(toggler);
  10423. }.bind(this);
  10424. if (this.now == idx || displayIndex != null){
  10425. this.display(displayIndex != null ? displayIndex : (idx - 1 >= 0 ? idx - 1 : 0)).chain(remover);
  10426. } else {
  10427. remover();
  10428. }
  10429. return this;
  10430. },
  10431. detach: function(toggler){
  10432. var remove = function(toggler){
  10433. toggler.removeEvent(this.options.trigger, toggler.retrieve('accordion:display'));
  10434. }.bind(this);
  10435. if (!toggler) this.togglers.each(remove);
  10436. else remove(toggler);
  10437. return this;
  10438. },
  10439. display: function(index, useFx){
  10440. if (!this.check(index, useFx)) return this;
  10441. var obj = {},
  10442. elements = this.elements,
  10443. options = this.options,
  10444. effects = this.effects,
  10445. keepOpen = options.keepOpen,
  10446. alwaysHide = options.alwaysHide;
  10447. if (useFx == null) useFx = true;
  10448. if (typeOf(index) == 'element') index = elements.indexOf(index);
  10449. if (index == this.current && !alwaysHide && !keepOpen) return this;
  10450. if (options.resetHeight){
  10451. var prev = elements[this.current];
  10452. if (prev && !this.selfHidden){
  10453. for (var fx in effects) prev.setStyle(fx, prev[effects[fx]]);
  10454. }
  10455. }
  10456. if (this.timer && options.link == 'chain') return this;
  10457. if (this.current != null) this.previous = this.current;
  10458. this.current = index;
  10459. this.selfHidden = false;
  10460. elements.each(function(el, i){
  10461. obj[i] = {};
  10462. var hide, isOpen;
  10463. if (!keepOpen || i == index){
  10464. if (i == index) isOpen = (el.offsetHeight > 0 && options.height) || (el.offsetWidth > 0 && options.width);
  10465. if (i != index){
  10466. hide = true;
  10467. } else if ((alwaysHide || keepOpen) && isOpen){
  10468. hide = true;
  10469. this.selfHidden = true;
  10470. }
  10471. this.fireEvent(hide ? 'background' : 'active', [this.togglers[i], el]);
  10472. for (var fx in effects) obj[i][fx] = hide ? 0 : el[effects[fx]];
  10473. if (!useFx && !hide && options.resetHeight) obj[i].height = 'auto';
  10474. }
  10475. }, this);
  10476. this.internalChain.clearChain();
  10477. this.internalChain.chain(function(){
  10478. if (options.resetHeight && !this.selfHidden){
  10479. var el = elements[index];
  10480. if (el) el.setStyle('height', 'auto');
  10481. }
  10482. }.bind(this));
  10483. return useFx ? this.start(obj) : this.set(obj).internalChain.callChain();
  10484. }
  10485. });
  10486. /*<1.2compat>*/
  10487. /*
  10488. Compatibility with 1.2.0
  10489. */
  10490. var Accordion = new Class({
  10491. Extends: Fx.Accordion,
  10492. initialize: function(){
  10493. this.parent.apply(this, arguments);
  10494. var params = Array.link(arguments, {'container': Type.isElement});
  10495. this.container = params.container;
  10496. },
  10497. addSection: function(toggler, element, pos){
  10498. toggler = document.id(toggler);
  10499. element = document.id(element);
  10500. var test = this.togglers.contains(toggler);
  10501. var len = this.togglers.length;
  10502. if (len && (!test || pos)){
  10503. pos = pos != null ? pos : len - 1;
  10504. toggler.inject(this.togglers[pos], 'before');
  10505. element.inject(toggler, 'after');
  10506. } else if (this.container && !test){
  10507. toggler.inject(this.container);
  10508. element.inject(this.container);
  10509. }
  10510. return this.parent.apply(this, arguments);
  10511. }
  10512. });
  10513. /*</1.2compat>*/
  10514. /*
  10515. ---
  10516. script: Fx.Move.js
  10517. name: Fx.Move
  10518. description: Defines Fx.Move, a class that works with Element.Position.js to transition an element from one location to another.
  10519. license: MIT-style license
  10520. authors:
  10521. - Aaron Newton
  10522. requires:
  10523. - Core/Fx.Morph
  10524. - Element.Position
  10525. provides: [Fx.Move]
  10526. ...
  10527. */
  10528. Fx.Move = new Class({
  10529. Extends: Fx.Morph,
  10530. options: {
  10531. relativeTo: document.body,
  10532. position: 'center',
  10533. edge: false,
  10534. offset: {x: 0, y: 0}
  10535. },
  10536. start: function(destination){
  10537. var element = this.element,
  10538. topLeft = element.getStyles('top', 'left');
  10539. if (topLeft.top == 'auto' || topLeft.left == 'auto'){
  10540. element.setPosition(element.getPosition(element.getOffsetParent()));
  10541. }
  10542. return this.parent(element.position(Object.merge({}, this.options, destination, {returnPos: true})));
  10543. }
  10544. });
  10545. Element.Properties.move = {
  10546. set: function(options){
  10547. this.get('move').cancel().setOptions(options);
  10548. return this;
  10549. },
  10550. get: function(){
  10551. var move = this.retrieve('move');
  10552. if (!move){
  10553. move = new Fx.Move(this, {link: 'cancel'});
  10554. this.store('move', move);
  10555. }
  10556. return move;
  10557. }
  10558. };
  10559. Element.implement({
  10560. move: function(options){
  10561. this.get('move').start(options);
  10562. return this;
  10563. }
  10564. });
  10565. /*
  10566. ---
  10567. script: Fx.Scroll.js
  10568. name: Fx.Scroll
  10569. description: Effect to smoothly scroll any element, including the window.
  10570. license: MIT-style license
  10571. authors:
  10572. - Valerio Proietti
  10573. requires:
  10574. - Core/Fx
  10575. - Core/Element.Event
  10576. - Core/Element.Dimensions
  10577. - MooTools.More
  10578. provides: [Fx.Scroll]
  10579. ...
  10580. */
  10581. (function(){
  10582. Fx.Scroll = new Class({
  10583. Extends: Fx,
  10584. options: {
  10585. offset: {x: 0, y: 0},
  10586. wheelStops: true
  10587. },
  10588. initialize: function(element, options){
  10589. this.element = this.subject = document.id(element);
  10590. this.parent(options);
  10591. if (typeOf(this.element) != 'element') this.element = document.id(this.element.getDocument().body);
  10592. if (this.options.wheelStops){
  10593. var stopper = this.element,
  10594. cancel = this.cancel.pass(false, this);
  10595. this.addEvent('start', function(){
  10596. stopper.addEvent('mousewheel', cancel);
  10597. }, true);
  10598. this.addEvent('complete', function(){
  10599. stopper.removeEvent('mousewheel', cancel);
  10600. }, true);
  10601. }
  10602. },
  10603. set: function(){
  10604. var now = Array.flatten(arguments);
  10605. this.element.scrollTo(now[0], now[1]);
  10606. return this;
  10607. },
  10608. compute: function(from, to, delta){
  10609. return [0, 1].map(function(i){
  10610. return Fx.compute(from[i], to[i], delta);
  10611. });
  10612. },
  10613. start: function(x, y){
  10614. if (!this.check(x, y)) return this;
  10615. var scroll = this.element.getScroll();
  10616. return this.parent([scroll.x, scroll.y], [x, y]);
  10617. },
  10618. calculateScroll: function(x, y){
  10619. var element = this.element,
  10620. scrollSize = element.getScrollSize(),
  10621. scroll = element.getScroll(),
  10622. size = element.getSize(),
  10623. offset = this.options.offset,
  10624. values = {x: x, y: y};
  10625. for (var z in values){
  10626. if (!values[z] && values[z] !== 0) values[z] = scroll[z];
  10627. if (typeOf(values[z]) != 'number') values[z] = scrollSize[z] - size[z];
  10628. values[z] += offset[z];
  10629. }
  10630. return [values.x, values.y];
  10631. },
  10632. toTop: function(){
  10633. return this.start.apply(this, this.calculateScroll(false, 0));
  10634. },
  10635. toLeft: function(){
  10636. return this.start.apply(this, this.calculateScroll(0, false));
  10637. },
  10638. toRight: function(){
  10639. return this.start.apply(this, this.calculateScroll('right', false));
  10640. },
  10641. toBottom: function(){
  10642. return this.start.apply(this, this.calculateScroll(false, 'bottom'));
  10643. },
  10644. toElement: function(el, axes){
  10645. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10646. var scroll = isBody(this.element) ? {x: 0, y: 0} : this.element.getScroll();
  10647. var position = Object.map(document.id(el).getPosition(this.element), function(value, axis){
  10648. return axes.contains(axis) ? value + scroll[axis] : false;
  10649. });
  10650. return this.start.apply(this, this.calculateScroll(position.x, position.y));
  10651. },
  10652. toElementEdge: function(el, axes, offset){
  10653. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10654. el = document.id(el);
  10655. var to = {},
  10656. position = el.getPosition(this.element),
  10657. size = el.getSize(),
  10658. scroll = this.element.getScroll(),
  10659. containerSize = this.element.getSize(),
  10660. edge = {
  10661. x: position.x + size.x,
  10662. y: position.y + size.y
  10663. };
  10664. ['x', 'y'].each(function(axis){
  10665. if (axes.contains(axis)){
  10666. if (edge[axis] > scroll[axis] + containerSize[axis]) to[axis] = edge[axis] - containerSize[axis];
  10667. if (position[axis] < scroll[axis]) to[axis] = position[axis];
  10668. }
  10669. if (to[axis] == null) to[axis] = scroll[axis];
  10670. if (offset && offset[axis]) to[axis] = to[axis] + offset[axis];
  10671. }, this);
  10672. if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y);
  10673. return this;
  10674. },
  10675. toElementCenter: function(el, axes, offset){
  10676. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10677. el = document.id(el);
  10678. var to = {},
  10679. position = el.getPosition(this.element),
  10680. size = el.getSize(),
  10681. scroll = this.element.getScroll(),
  10682. containerSize = this.element.getSize();
  10683. ['x', 'y'].each(function(axis){
  10684. if (axes.contains(axis)){
  10685. to[axis] = position[axis] - (containerSize[axis] - size[axis]) / 2;
  10686. }
  10687. if (to[axis] == null) to[axis] = scroll[axis];
  10688. if (offset && offset[axis]) to[axis] = to[axis] + offset[axis];
  10689. }, this);
  10690. if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y);
  10691. return this;
  10692. }
  10693. });
  10694. //<1.2compat>
  10695. Fx.Scroll.implement({
  10696. scrollToCenter: function(){
  10697. return this.toElementCenter.apply(this, arguments);
  10698. },
  10699. scrollIntoView: function(){
  10700. return this.toElementEdge.apply(this, arguments);
  10701. }
  10702. });
  10703. //</1.2compat>
  10704. function isBody(element){
  10705. return (/^(?:body|html)$/i).test(element.tagName);
  10706. }
  10707. })();
  10708. /*
  10709. ---
  10710. script: Fx.Slide.js
  10711. name: Fx.Slide
  10712. description: Effect to slide an element in and out of view.
  10713. license: MIT-style license
  10714. authors:
  10715. - Valerio Proietti
  10716. requires:
  10717. - Core/Fx
  10718. - Core/Element.Style
  10719. - MooTools.More
  10720. provides: [Fx.Slide]
  10721. ...
  10722. */
  10723. Fx.Slide = new Class({
  10724. Extends: Fx,
  10725. options: {
  10726. mode: 'vertical',
  10727. wrapper: false,
  10728. hideOverflow: true,
  10729. resetHeight: false
  10730. },
  10731. initialize: function(element, options){
  10732. element = this.element = this.subject = document.id(element);
  10733. this.parent(options);
  10734. options = this.options;
  10735. var wrapper = element.retrieve('wrapper'),
  10736. styles = element.getStyles('margin', 'position', 'overflow');
  10737. if (options.hideOverflow) styles = Object.append(styles, {overflow: 'hidden'});
  10738. if (options.wrapper) wrapper = document.id(options.wrapper).setStyles(styles);
  10739. if (!wrapper) wrapper = new Element('div', {
  10740. styles: styles
  10741. }).wraps(element);
  10742. element.store('wrapper', wrapper).setStyle('margin', 0);
  10743. if (element.getStyle('overflow') == 'visible') element.setStyle('overflow', 'hidden');
  10744. this.now = [];
  10745. this.open = true;
  10746. this.wrapper = wrapper;
  10747. this.addEvent('complete', function(){
  10748. this.open = (wrapper['offset' + this.layout.capitalize()] != 0);
  10749. if (this.open && this.options.resetHeight) wrapper.setStyle('height', '');
  10750. }, true);
  10751. },
  10752. vertical: function(){
  10753. this.margin = 'margin-top';
  10754. this.layout = 'height';
  10755. this.offset = this.element.offsetHeight;
  10756. },
  10757. horizontal: function(){
  10758. this.margin = 'margin-left';
  10759. this.layout = 'width';
  10760. this.offset = this.element.offsetWidth;
  10761. },
  10762. set: function(now){
  10763. this.element.setStyle(this.margin, now[0]);
  10764. this.wrapper.setStyle(this.layout, now[1]);
  10765. return this;
  10766. },
  10767. compute: function(from, to, delta){
  10768. return [0, 1].map(function(i){
  10769. return Fx.compute(from[i], to[i], delta);
  10770. });
  10771. },
  10772. start: function(how, mode){
  10773. if (!this.check(how, mode)) return this;
  10774. this[mode || this.options.mode]();
  10775. var margin = this.element.getStyle(this.margin).toInt(),
  10776. layout = this.wrapper.getStyle(this.layout).toInt(),
  10777. caseIn = [[margin, layout], [0, this.offset]],
  10778. caseOut = [[margin, layout], [-this.offset, 0]],
  10779. start;
  10780. switch (how){
  10781. case 'in': start = caseIn; break;
  10782. case 'out': start = caseOut; break;
  10783. case 'toggle': start = (layout == 0) ? caseIn : caseOut;
  10784. }
  10785. return this.parent(start[0], start[1]);
  10786. },
  10787. slideIn: function(mode){
  10788. return this.start('in', mode);
  10789. },
  10790. slideOut: function(mode){
  10791. return this.start('out', mode);
  10792. },
  10793. hide: function(mode){
  10794. this[mode || this.options.mode]();
  10795. this.open = false;
  10796. return this.set([-this.offset, 0]);
  10797. },
  10798. show: function(mode){
  10799. this[mode || this.options.mode]();
  10800. this.open = true;
  10801. return this.set([0, this.offset]);
  10802. },
  10803. toggle: function(mode){
  10804. return this.start('toggle', mode);
  10805. }
  10806. });
  10807. Element.Properties.slide = {
  10808. set: function(options){
  10809. this.get('slide').cancel().setOptions(options);
  10810. return this;
  10811. },
  10812. get: function(){
  10813. var slide = this.retrieve('slide');
  10814. if (!slide){
  10815. slide = new Fx.Slide(this, {link: 'cancel'});
  10816. this.store('slide', slide);
  10817. }
  10818. return slide;
  10819. }
  10820. };
  10821. Element.implement({
  10822. slide: function(how, mode){
  10823. how = how || 'toggle';
  10824. var slide = this.get('slide'), toggle;
  10825. switch (how){
  10826. case 'hide': slide.hide(mode); break;
  10827. case 'show': slide.show(mode); break;
  10828. case 'toggle':
  10829. var flag = this.retrieve('slide:flag', slide.open);
  10830. slide[flag ? 'slideOut' : 'slideIn'](mode);
  10831. this.store('slide:flag', !flag);
  10832. toggle = true;
  10833. break;
  10834. default: slide.start(how, mode);
  10835. }
  10836. if (!toggle) this.eliminate('slide:flag');
  10837. return this;
  10838. }
  10839. });
  10840. /*
  10841. ---
  10842. script: Fx.SmoothScroll.js
  10843. name: Fx.SmoothScroll
  10844. description: Class for creating a smooth scrolling effect to all internal links on the page.
  10845. license: MIT-style license
  10846. authors:
  10847. - Valerio Proietti
  10848. requires:
  10849. - Core/Slick.Finder
  10850. - Fx.Scroll
  10851. provides: [Fx.SmoothScroll]
  10852. ...
  10853. */
  10854. /*<1.2compat>*/var SmoothScroll = /*</1.2compat>*/Fx.SmoothScroll = new Class({
  10855. Extends: Fx.Scroll,
  10856. options: {
  10857. axes: ['x', 'y']
  10858. },
  10859. initialize: function(options, context){
  10860. context = context || document;
  10861. this.doc = context.getDocument();
  10862. this.parent(this.doc, options);
  10863. var win = context.getWindow(),
  10864. location = win.location.href.match(/^[^#]*/)[0] + '#',
  10865. links = $$(this.options.links || this.doc.links);
  10866. links.each(function(link){
  10867. if (link.href.indexOf(location) != 0) return;
  10868. var anchor = link.href.substr(location.length);
  10869. if (anchor) this.useLink(link, anchor);
  10870. }, this);
  10871. this.addEvent('complete', function(){
  10872. win.location.hash = this.anchor;
  10873. this.element.scrollTo(this.to[0], this.to[1]);
  10874. }, true);
  10875. },
  10876. useLink: function(link, anchor){
  10877. link.addEvent('click', function(event){
  10878. var el = document.id(anchor) || this.doc.getElement('a[name=' + anchor + ']');
  10879. if (!el) return;
  10880. event.preventDefault();
  10881. this.toElement(el, this.options.axes).chain(function(){
  10882. this.fireEvent('scrolledTo', [link, el]);
  10883. }.bind(this));
  10884. this.anchor = anchor;
  10885. }.bind(this));
  10886. return this;
  10887. }
  10888. });
  10889. /*
  10890. ---
  10891. script: Fx.Sort.js
  10892. name: Fx.Sort
  10893. description: Defines Fx.Sort, a class that reorders lists with a transition.
  10894. license: MIT-style license
  10895. authors:
  10896. - Aaron Newton
  10897. requires:
  10898. - Core/Element.Dimensions
  10899. - Fx.Elements
  10900. - Element.Measure
  10901. provides: [Fx.Sort]
  10902. ...
  10903. */
  10904. Fx.Sort = new Class({
  10905. Extends: Fx.Elements,
  10906. options: {
  10907. mode: 'vertical'
  10908. },
  10909. initialize: function(elements, options){
  10910. this.parent(elements, options);
  10911. this.elements.each(function(el){
  10912. if (el.getStyle('position') == 'static') el.setStyle('position', 'relative');
  10913. });
  10914. this.setDefaultOrder();
  10915. },
  10916. setDefaultOrder: function(){
  10917. this.currentOrder = this.elements.map(function(el, index){
  10918. return index;
  10919. });
  10920. },
  10921. sort: function(){
  10922. if (!this.check(arguments)) return this;
  10923. var newOrder = Array.flatten(arguments);
  10924. var top = 0,
  10925. left = 0,
  10926. next = {},
  10927. zero = {},
  10928. vert = this.options.mode == 'vertical';
  10929. var current = this.elements.map(function(el, index){
  10930. var size = el.getComputedSize({styles: ['border', 'padding', 'margin']});
  10931. var val;
  10932. if (vert){
  10933. val = {
  10934. top: top,
  10935. margin: size['margin-top'],
  10936. height: size.totalHeight
  10937. };
  10938. top += val.height - size['margin-top'];
  10939. } else {
  10940. val = {
  10941. left: left,
  10942. margin: size['margin-left'],
  10943. width: size.totalWidth
  10944. };
  10945. left += val.width;
  10946. }
  10947. var plane = vert ? 'top' : 'left';
  10948. zero[index] = {};
  10949. var start = el.getStyle(plane).toInt();
  10950. zero[index][plane] = start || 0;
  10951. return val;
  10952. }, this);
  10953. this.set(zero);
  10954. newOrder = newOrder.map(function(i){ return i.toInt(); });
  10955. if (newOrder.length != this.elements.length){
  10956. this.currentOrder.each(function(index){
  10957. if (!newOrder.contains(index)) newOrder.push(index);
  10958. });
  10959. if (newOrder.length > this.elements.length)
  10960. newOrder.splice(this.elements.length-1, newOrder.length - this.elements.length);
  10961. }
  10962. var margin = 0;
  10963. top = left = 0;
  10964. newOrder.each(function(item){
  10965. var newPos = {};
  10966. if (vert){
  10967. newPos.top = top - current[item].top - margin;
  10968. top += current[item].height;
  10969. } else {
  10970. newPos.left = left - current[item].left;
  10971. left += current[item].width;
  10972. }
  10973. margin = margin + current[item].margin;
  10974. next[item]=newPos;
  10975. }, this);
  10976. var mapped = {};
  10977. Array.clone(newOrder).sort().each(function(index){
  10978. mapped[index] = next[index];
  10979. });
  10980. this.start(mapped);
  10981. this.currentOrder = newOrder;
  10982. return this;
  10983. },
  10984. rearrangeDOM: function(newOrder){
  10985. newOrder = newOrder || this.currentOrder;
  10986. var parent = this.elements[0].getParent();
  10987. var rearranged = [];
  10988. this.elements.setStyle('opacity', 0);
  10989. //move each element and store the new default order
  10990. newOrder.each(function(index){
  10991. rearranged.push(this.elements[index].inject(parent).setStyles({
  10992. top: 0,
  10993. left: 0
  10994. }));
  10995. }, this);
  10996. this.elements.setStyle('opacity', 1);
  10997. this.elements = $$(rearranged);
  10998. this.setDefaultOrder();
  10999. return this;
  11000. },
  11001. getDefaultOrder: function(){
  11002. return this.elements.map(function(el, index){
  11003. return index;
  11004. });
  11005. },
  11006. getCurrentOrder: function(){
  11007. return this.currentOrder;
  11008. },
  11009. forward: function(){
  11010. return this.sort(this.getDefaultOrder());
  11011. },
  11012. backward: function(){
  11013. return this.sort(this.getDefaultOrder().reverse());
  11014. },
  11015. reverse: function(){
  11016. return this.sort(this.currentOrder.reverse());
  11017. },
  11018. sortByElements: function(elements){
  11019. return this.sort(elements.map(function(el){
  11020. return this.elements.indexOf(el);
  11021. }, this));
  11022. },
  11023. swap: function(one, two){
  11024. if (typeOf(one) == 'element') one = this.elements.indexOf(one);
  11025. if (typeOf(two) == 'element') two = this.elements.indexOf(two);
  11026. var newOrder = Array.clone(this.currentOrder);
  11027. newOrder[this.currentOrder.indexOf(one)] = two;
  11028. newOrder[this.currentOrder.indexOf(two)] = one;
  11029. return this.sort(newOrder);
  11030. }
  11031. });
  11032. /*
  11033. ---
  11034. script: Keyboard.js
  11035. name: Keyboard
  11036. 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.
  11037. license: MIT-style license
  11038. authors:
  11039. - Perrin Westrich
  11040. - Aaron Newton
  11041. - Scott Kyle
  11042. requires:
  11043. - Core/Events
  11044. - Core/Options
  11045. - Core/Element.Event
  11046. - Element.Event.Pseudos.Keys
  11047. provides: [Keyboard]
  11048. ...
  11049. */
  11050. (function(){
  11051. var Keyboard = this.Keyboard = new Class({
  11052. Extends: Events,
  11053. Implements: [Options],
  11054. options: {/*
  11055. onActivate: function(){},
  11056. onDeactivate: function(){},*/
  11057. defaultEventType: 'keydown',
  11058. active: false,
  11059. manager: null,
  11060. events: {},
  11061. nonParsedEvents: ['activate', 'deactivate', 'onactivate', 'ondeactivate', 'changed', 'onchanged']
  11062. },
  11063. initialize: function(options){
  11064. if (options && options.manager){
  11065. this._manager = options.manager;
  11066. delete options.manager;
  11067. }
  11068. this.setOptions(options);
  11069. this._setup();
  11070. },
  11071. addEvent: function(type, fn, internal){
  11072. return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn, internal);
  11073. },
  11074. removeEvent: function(type, fn){
  11075. return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn);
  11076. },
  11077. toggleActive: function(){
  11078. return this[this.isActive() ? 'deactivate' : 'activate']();
  11079. },
  11080. activate: function(instance){
  11081. if (instance){
  11082. if (instance.isActive()) return this;
  11083. //if we're stealing focus, store the last keyboard to have it so the relinquish command works
  11084. if (this._activeKB && instance != this._activeKB){
  11085. this.previous = this._activeKB;
  11086. this.previous.fireEvent('deactivate');
  11087. }
  11088. //if we're enabling a child, assign it so that events are now passed to it
  11089. this._activeKB = instance.fireEvent('activate');
  11090. Keyboard.manager.fireEvent('changed');
  11091. } else if (this._manager){
  11092. //else we're enabling ourselves, we must ask our parent to do it for us
  11093. this._manager.activate(this);
  11094. }
  11095. return this;
  11096. },
  11097. isActive: function(){
  11098. return this._manager ? (this._manager._activeKB == this) : (Keyboard.manager == this);
  11099. },
  11100. deactivate: function(instance){
  11101. if (instance){
  11102. if (instance === this._activeKB){
  11103. this._activeKB = null;
  11104. instance.fireEvent('deactivate');
  11105. Keyboard.manager.fireEvent('changed');
  11106. }
  11107. } else if (this._manager){
  11108. this._manager.deactivate(this);
  11109. }
  11110. return this;
  11111. },
  11112. relinquish: function(){
  11113. if (this.isActive() && this._manager && this._manager.previous) this._manager.activate(this._manager.previous);
  11114. else this.deactivate();
  11115. return this;
  11116. },
  11117. //management logic
  11118. manage: function(instance){
  11119. if (instance._manager) instance._manager.drop(instance);
  11120. this._instances.push(instance);
  11121. instance._manager = this;
  11122. if (!this._activeKB) this.activate(instance);
  11123. return this;
  11124. },
  11125. drop: function(instance){
  11126. instance.relinquish();
  11127. this._instances.erase(instance);
  11128. if (this._activeKB == instance){
  11129. if (this.previous && this._instances.contains(this.previous)) this.activate(this.previous);
  11130. else this._activeKB = this._instances[0];
  11131. }
  11132. return this;
  11133. },
  11134. trace: function(){
  11135. Keyboard.trace(this);
  11136. },
  11137. each: function(fn){
  11138. Keyboard.each(this, fn);
  11139. },
  11140. /*
  11141. PRIVATE METHODS
  11142. */
  11143. _instances: [],
  11144. _disable: function(instance){
  11145. if (this._activeKB == instance) this._activeKB = null;
  11146. },
  11147. _setup: function(){
  11148. this.addEvents(this.options.events);
  11149. //if this is the root manager, nothing manages it
  11150. if (Keyboard.manager && !this._manager) Keyboard.manager.manage(this);
  11151. if (this.options.active) this.activate();
  11152. else this.relinquish();
  11153. },
  11154. _handle: function(event, type){
  11155. //Keyboard.stop(event) prevents key propagation
  11156. if (event.preventKeyboardPropagation) return;
  11157. var bubbles = !!this._manager;
  11158. if (bubbles && this._activeKB){
  11159. this._activeKB._handle(event, type);
  11160. if (event.preventKeyboardPropagation) return;
  11161. }
  11162. this.fireEvent(type, event);
  11163. if (!bubbles && this._activeKB) this._activeKB._handle(event, type);
  11164. }
  11165. });
  11166. var parsed = {};
  11167. var modifiers = ['shift', 'control', 'alt', 'meta'];
  11168. var regex = /^(?:shift|control|ctrl|alt|meta)$/;
  11169. Keyboard.parse = function(type, eventType, ignore){
  11170. if (ignore && ignore.contains(type.toLowerCase())) return type;
  11171. type = type.toLowerCase().replace(/^(keyup|keydown):/, function($0, $1){
  11172. eventType = $1;
  11173. return '';
  11174. });
  11175. if (!parsed[type]){
  11176. if (type != '+'){
  11177. var key, mods = {};
  11178. type.split('+').each(function(part){
  11179. if (regex.test(part)) mods[part] = true;
  11180. else key = part;
  11181. });
  11182. mods.control = mods.control || mods.ctrl; // allow both control and ctrl
  11183. var keys = [];
  11184. modifiers.each(function(mod){
  11185. if (mods[mod]) keys.push(mod);
  11186. });
  11187. if (key) keys.push(key);
  11188. parsed[type] = keys.join('+');
  11189. } else {
  11190. parsed[type] = type;
  11191. }
  11192. }
  11193. return eventType + ':keys(' + parsed[type] + ')';
  11194. };
  11195. Keyboard.each = function(keyboard, fn){
  11196. var current = keyboard || Keyboard.manager;
  11197. while (current){
  11198. fn(current);
  11199. current = current._activeKB;
  11200. }
  11201. };
  11202. Keyboard.stop = function(event){
  11203. event.preventKeyboardPropagation = true;
  11204. };
  11205. Keyboard.manager = new Keyboard({
  11206. active: true
  11207. });
  11208. Keyboard.trace = function(keyboard){
  11209. keyboard = keyboard || Keyboard.manager;
  11210. var hasConsole = window.console && console.log;
  11211. if (hasConsole) console.log('the following items have focus: ');
  11212. Keyboard.each(keyboard, function(current){
  11213. if (hasConsole) console.log(document.id(current.widget) || current.wiget || current);
  11214. });
  11215. };
  11216. var handler = function(event){
  11217. var keys = [];
  11218. modifiers.each(function(mod){
  11219. if (event[mod]) keys.push(mod);
  11220. });
  11221. if (!regex.test(event.key)) keys.push(event.key);
  11222. Keyboard.manager._handle(event, event.type + ':keys(' + keys.join('+') + ')');
  11223. };
  11224. document.addEvents({
  11225. 'keyup': handler,
  11226. 'keydown': handler
  11227. });
  11228. })();
  11229. /*
  11230. ---
  11231. script: Keyboard.Extras.js
  11232. name: Keyboard.Extras
  11233. 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.
  11234. license: MIT-style license
  11235. authors:
  11236. - Perrin Westrich
  11237. requires:
  11238. - Keyboard
  11239. - MooTools.More
  11240. provides: [Keyboard.Extras]
  11241. ...
  11242. */
  11243. Keyboard.prototype.options.nonParsedEvents.combine(['rebound', 'onrebound']);
  11244. Keyboard.implement({
  11245. /*
  11246. shortcut should be in the format of:
  11247. {
  11248. 'keys': 'shift+s', // the default to add as an event.
  11249. 'description': 'blah blah blah', // a brief description of the functionality.
  11250. 'handler': function(){} // the event handler to run when keys are pressed.
  11251. }
  11252. */
  11253. addShortcut: function(name, shortcut){
  11254. this._shortcuts = this._shortcuts || [];
  11255. this._shortcutIndex = this._shortcutIndex || {};
  11256. shortcut.getKeyboard = Function.convert(this);
  11257. shortcut.name = name;
  11258. this._shortcutIndex[name] = shortcut;
  11259. this._shortcuts.push(shortcut);
  11260. if (shortcut.keys) this.addEvent(shortcut.keys, shortcut.handler);
  11261. return this;
  11262. },
  11263. addShortcuts: function(obj){
  11264. for (var name in obj) this.addShortcut(name, obj[name]);
  11265. return this;
  11266. },
  11267. removeShortcut: function(name){
  11268. var shortcut = this.getShortcut(name);
  11269. if (shortcut && shortcut.keys){
  11270. this.removeEvent(shortcut.keys, shortcut.handler);
  11271. delete this._shortcutIndex[name];
  11272. this._shortcuts.erase(shortcut);
  11273. }
  11274. return this;
  11275. },
  11276. removeShortcuts: function(names){
  11277. names.each(this.removeShortcut, this);
  11278. return this;
  11279. },
  11280. getShortcuts: function(){
  11281. return this._shortcuts || [];
  11282. },
  11283. getShortcut: function(name){
  11284. return (this._shortcutIndex || {})[name];
  11285. }
  11286. });
  11287. Keyboard.rebind = function(newKeys, shortcuts){
  11288. Array.convert(shortcuts).each(function(shortcut){
  11289. shortcut.getKeyboard().removeEvent(shortcut.keys, shortcut.handler);
  11290. shortcut.getKeyboard().addEvent(newKeys, shortcut.handler);
  11291. shortcut.keys = newKeys;
  11292. shortcut.getKeyboard().fireEvent('rebound');
  11293. });
  11294. };
  11295. Keyboard.getActiveShortcuts = function(keyboard){
  11296. var activeKBS = [], activeSCS = [];
  11297. Keyboard.each(keyboard, [].push.bind(activeKBS));
  11298. activeKBS.each(function(kb){ activeSCS.extend(kb.getShortcuts()); });
  11299. return activeSCS;
  11300. };
  11301. Keyboard.getShortcut = function(name, keyboard, opts){
  11302. opts = opts || {};
  11303. var shortcuts = opts.many ? [] : null,
  11304. set = opts.many ? function(kb){
  11305. var shortcut = kb.getShortcut(name);
  11306. if (shortcut) shortcuts.push(shortcut);
  11307. } : function(kb){
  11308. if (!shortcuts) shortcuts = kb.getShortcut(name);
  11309. };
  11310. Keyboard.each(keyboard, set);
  11311. return shortcuts;
  11312. };
  11313. Keyboard.getShortcuts = function(name, keyboard){
  11314. return Keyboard.getShortcut(name, keyboard, { many: true });
  11315. };
  11316. /*
  11317. ---
  11318. script: HtmlTable.js
  11319. name: HtmlTable
  11320. description: Builds table elements with methods to add rows.
  11321. license: MIT-style license
  11322. authors:
  11323. - Aaron Newton
  11324. requires:
  11325. - Core/Options
  11326. - Core/Events
  11327. - Class.Occlude
  11328. provides: [HtmlTable]
  11329. ...
  11330. */
  11331. (function(){
  11332. var HtmlTable = this.HtmlTable = new Class({
  11333. Implements: [Options, Events, Class.Occlude],
  11334. options: {
  11335. properties: {
  11336. cellpadding: 0,
  11337. cellspacing: 0,
  11338. border: 0
  11339. },
  11340. rows: [],
  11341. headers: [],
  11342. footers: []
  11343. },
  11344. property: 'HtmlTable',
  11345. initialize: function(){
  11346. var params = Array.link(arguments, {options: Type.isObject, table: Type.isElement, id: Type.isString});
  11347. this.setOptions(params.options);
  11348. if (!params.table && params.id) params.table = document.id(params.id);
  11349. this.element = params.table || new Element('table', this.options.properties);
  11350. if (this.occlude()) return this.occluded;
  11351. this.build();
  11352. },
  11353. build: function(){
  11354. this.element.store('HtmlTable', this);
  11355. this.body = document.id(this.element.tBodies[0]) || new Element('tbody').inject(this.element);
  11356. $$(this.body.rows);
  11357. if (this.options.headers.length) this.setHeaders(this.options.headers);
  11358. else this.thead = document.id(this.element.tHead);
  11359. if (this.thead) this.head = this.getHead();
  11360. if (this.options.footers.length) this.setFooters(this.options.footers);
  11361. this.tfoot = document.id(this.element.tFoot);
  11362. if (this.tfoot) this.foot = document.id(this.tfoot.rows[0]);
  11363. this.options.rows.each(function(row){
  11364. this.push(row);
  11365. }, this);
  11366. },
  11367. toElement: function(){
  11368. return this.element;
  11369. },
  11370. empty: function(){
  11371. this.body.empty();
  11372. return this;
  11373. },
  11374. set: function(what, items){
  11375. var target = (what == 'headers') ? 'tHead' : 'tFoot',
  11376. lower = target.toLowerCase();
  11377. this[lower] = (document.id(this.element[target]) || new Element(lower).inject(this.element, 'top')).empty();
  11378. var data = this.push(items, {}, this[lower], what == 'headers' ? 'th' : 'td');
  11379. if (what == 'headers') this.head = this.getHead();
  11380. else this.foot = this.getHead();
  11381. return data;
  11382. },
  11383. getHead: function(){
  11384. var rows = this.thead.rows;
  11385. return rows.length > 1 ? $$(rows) : rows.length ? document.id(rows[0]) : false;
  11386. },
  11387. setHeaders: function(headers){
  11388. this.set('headers', headers);
  11389. return this;
  11390. },
  11391. setFooters: function(footers){
  11392. this.set('footers', footers);
  11393. return this;
  11394. },
  11395. update: function(tr, row, tag){
  11396. var tds = tr.getChildren(tag || 'td'), last = tds.length - 1;
  11397. row.each(function(data, index){
  11398. var td = tds[index] || new Element(tag || 'td').inject(tr),
  11399. content = ((data && Object.prototype.hasOwnProperty.call(data, 'content')) ? data.content : '') || data,
  11400. type = typeOf(content);
  11401. if (data && Object.prototype.hasOwnProperty.call(data, 'properties')) td.set(data.properties);
  11402. if (/(element(s?)|array|collection)/.test(type)) td.empty().adopt(content);
  11403. else td.set('html', content);
  11404. if (index > last) tds.push(td);
  11405. else tds[index] = td;
  11406. });
  11407. return {
  11408. tr: tr,
  11409. tds: tds
  11410. };
  11411. },
  11412. push: function(row, rowProperties, target, tag, where){
  11413. if (typeOf(row) == 'element' && row.get('tag') == 'tr'){
  11414. row.inject(target || this.body, where);
  11415. return {
  11416. tr: row,
  11417. tds: row.getChildren('td')
  11418. };
  11419. }
  11420. return this.update(new Element('tr', rowProperties).inject(target || this.body, where), row, tag);
  11421. },
  11422. pushMany: function(rows, rowProperties, target, tag, where){
  11423. return rows.map(function(row){
  11424. return this.push(row, rowProperties, target, tag, where);
  11425. }, this);
  11426. }
  11427. });
  11428. })();
  11429. ['adopt', 'inject', 'wraps', 'grab', 'replaces', 'dispose'].each(function(method){
  11430. HtmlTable.implement(method, function(){
  11431. this.element[method].apply(this.element, arguments);
  11432. return this;
  11433. });
  11434. });
  11435. /*
  11436. ---
  11437. script: HtmlTable.Select.js
  11438. name: HtmlTable.Select
  11439. description: Builds a stripy, sortable table with methods to add rows. Rows can be selected with the mouse or keyboard navigation.
  11440. license: MIT-style license
  11441. authors:
  11442. - Harald Kirschner
  11443. - Aaron Newton
  11444. requires:
  11445. - Keyboard
  11446. - Keyboard.Extras
  11447. - HtmlTable
  11448. - Class.refactor
  11449. - Element.Delegation.Pseudo
  11450. - Element.Shortcuts
  11451. provides: [HtmlTable.Select]
  11452. ...
  11453. */
  11454. HtmlTable = Class.refactor(HtmlTable, {
  11455. options: {
  11456. /*onRowFocus: function(){},
  11457. onRowUnfocus: function(){},*/
  11458. useKeyboard: true,
  11459. classRowSelected: 'table-tr-selected',
  11460. classRowHovered: 'table-tr-hovered',
  11461. classSelectable: 'table-selectable',
  11462. shiftForMultiSelect: true,
  11463. allowMultiSelect: true,
  11464. selectable: false,
  11465. selectHiddenRows: false
  11466. },
  11467. initialize: function(){
  11468. this.previous.apply(this, arguments);
  11469. if (this.occluded) return this.occluded;
  11470. this.selectedRows = new Elements();
  11471. if (!this.bound) this.bound = {};
  11472. this.bound.mouseleave = this.mouseleave.bind(this);
  11473. this.bound.clickRow = this.clickRow.bind(this);
  11474. this.bound.activateKeyboard = function(){
  11475. if (this.keyboard && this.selectEnabled) this.keyboard.activate();
  11476. }.bind(this);
  11477. if (this.options.selectable) this.enableSelect();
  11478. },
  11479. empty: function(){
  11480. if (this.body.rows.length) this.selectNone();
  11481. return this.previous();
  11482. },
  11483. enableSelect: function(){
  11484. this.selectEnabled = true;
  11485. this.attachSelects();
  11486. this.element.addClass(this.options.classSelectable);
  11487. return this;
  11488. },
  11489. disableSelect: function(){
  11490. this.selectEnabled = false;
  11491. this.attachSelects(false);
  11492. this.element.removeClass(this.options.classSelectable);
  11493. return this;
  11494. },
  11495. push: function(){
  11496. var ret = this.previous.apply(this, arguments);
  11497. this.updateSelects();
  11498. return ret;
  11499. },
  11500. toggleRow: function(row){
  11501. return this[(this.isSelected(row) ? 'de' : '') + 'selectRow'](row);
  11502. },
  11503. selectRow: function(row, _nocheck){
  11504. //private variable _nocheck: boolean whether or not to confirm the row is in the table body
  11505. //added here for optimization when selecting ranges
  11506. if (this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
  11507. if (!this.options.allowMultiSelect) this.selectNone();
  11508. if (!this.isSelected(row)){
  11509. this.selectedRows.push(row);
  11510. row.addClass(this.options.classRowSelected);
  11511. this.fireEvent('rowFocus', [row, this.selectedRows]);
  11512. this.fireEvent('stateChanged');
  11513. }
  11514. this.focused = row;
  11515. document.clearSelection();
  11516. return this;
  11517. },
  11518. isSelected: function(row){
  11519. return this.selectedRows.contains(row);
  11520. },
  11521. getSelected: function(){
  11522. return this.selectedRows;
  11523. },
  11524. serialize: function(){
  11525. var previousSerialization = this.previous.apply(this, arguments) || {};
  11526. if (this.options.selectable){
  11527. previousSerialization.selectedRows = this.selectedRows.map(function(row){
  11528. return Array.indexOf(this.body.rows, row);
  11529. }.bind(this));
  11530. }
  11531. return previousSerialization;
  11532. },
  11533. restore: function(tableState){
  11534. if (this.options.selectable && tableState.selectedRows){
  11535. tableState.selectedRows.each(function(index){
  11536. this.selectRow(this.body.rows[index]);
  11537. }.bind(this));
  11538. }
  11539. this.previous.apply(this, arguments);
  11540. },
  11541. deselectRow: function(row, _nocheck){
  11542. if (!this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
  11543. this.selectedRows = new Elements(Array.convert(this.selectedRows).erase(row));
  11544. row.removeClass(this.options.classRowSelected);
  11545. this.fireEvent('rowUnfocus', [row, this.selectedRows]);
  11546. this.fireEvent('stateChanged');
  11547. return this;
  11548. },
  11549. selectAll: function(selectNone){
  11550. if (!selectNone && !this.options.allowMultiSelect) return;
  11551. this.selectRange(0, this.body.rows.length, selectNone);
  11552. return this;
  11553. },
  11554. selectNone: function(){
  11555. return this.selectAll(true);
  11556. },
  11557. selectRange: function(startRow, endRow, _deselect){
  11558. if (!this.options.allowMultiSelect && !_deselect) return;
  11559. var method = _deselect ? 'deselectRow' : 'selectRow',
  11560. rows = Array.clone(this.body.rows);
  11561. if (typeOf(startRow) == 'element') startRow = rows.indexOf(startRow);
  11562. if (typeOf(endRow) == 'element') endRow = rows.indexOf(endRow);
  11563. endRow = endRow < rows.length - 1 ? endRow : rows.length - 1;
  11564. if (endRow < startRow){
  11565. var tmp = startRow;
  11566. startRow = endRow;
  11567. endRow = tmp;
  11568. }
  11569. for (var i = startRow; i <= endRow; i++){
  11570. if (this.options.selectHiddenRows || rows[i].isDisplayed()) this[method](rows[i], true);
  11571. }
  11572. return this;
  11573. },
  11574. deselectRange: function(startRow, endRow){
  11575. this.selectRange(startRow, endRow, true);
  11576. },
  11577. /*
  11578. Private methods:
  11579. */
  11580. enterRow: function(row){
  11581. if (this.hovered) this.hovered = this.leaveRow(this.hovered);
  11582. this.hovered = row.addClass(this.options.classRowHovered);
  11583. },
  11584. leaveRow: function(row){
  11585. row.removeClass(this.options.classRowHovered);
  11586. },
  11587. updateSelects: function(){
  11588. Array.each(this.body.rows, function(row){
  11589. var binders = row.retrieve('binders');
  11590. if (!binders && !this.selectEnabled) return;
  11591. if (!binders){
  11592. binders = {
  11593. mouseenter: this.enterRow.pass([row], this),
  11594. mouseleave: this.leaveRow.pass([row], this)
  11595. };
  11596. row.store('binders', binders);
  11597. }
  11598. if (this.selectEnabled) row.addEvents(binders);
  11599. else row.removeEvents(binders);
  11600. }, this);
  11601. },
  11602. shiftFocus: function(offset, event){
  11603. if (!this.focused) return this.selectRow(this.body.rows[0], event);
  11604. var to = this.getRowByOffset(offset, this.options.selectHiddenRows);
  11605. if (to === null || this.focused == this.body.rows[to]) return this;
  11606. this.toggleRow(this.body.rows[to], event);
  11607. },
  11608. clickRow: function(event, row){
  11609. var selecting = (event.shift || event.meta || event.control) && this.options.shiftForMultiSelect;
  11610. if (!selecting && !(event.rightClick && this.isSelected(row) && this.options.allowMultiSelect)) this.selectNone();
  11611. if (event.rightClick) this.selectRow(row);
  11612. else this.toggleRow(row);
  11613. if (event.shift){
  11614. this.selectRange(this.rangeStart || this.body.rows[0], row, this.rangeStart ? !this.isSelected(row) : true);
  11615. this.focused = row;
  11616. }
  11617. this.rangeStart = row;
  11618. },
  11619. getRowByOffset: function(offset, includeHiddenRows){
  11620. if (!this.focused) return 0;
  11621. var index = Array.indexOf(this.body.rows, this.focused);
  11622. if ((index == 0 && offset < 0) || (index == this.body.rows.length -1 && offset > 0)) return null;
  11623. if (includeHiddenRows){
  11624. index += offset;
  11625. } else {
  11626. var limit = 0,
  11627. count = 0;
  11628. if (offset > 0){
  11629. while (count < offset && index < this.body.rows.length -1){
  11630. if (this.body.rows[++index].isDisplayed()) count++;
  11631. }
  11632. } else {
  11633. while (count > offset && index > 0){
  11634. if (this.body.rows[--index].isDisplayed()) count--;
  11635. }
  11636. }
  11637. }
  11638. return index;
  11639. },
  11640. attachSelects: function(attach){
  11641. attach = attach != null ? attach : true;
  11642. var method = attach ? 'addEvents' : 'removeEvents';
  11643. this.element[method]({
  11644. mouseleave: this.bound.mouseleave,
  11645. click: this.bound.activateKeyboard
  11646. });
  11647. this.body[method]({
  11648. 'click:relay(tr)': this.bound.clickRow,
  11649. 'contextmenu:relay(tr)': this.bound.clickRow
  11650. });
  11651. if (this.options.useKeyboard || this.keyboard){
  11652. if (!this.keyboard) this.keyboard = new Keyboard();
  11653. if (!this.selectKeysDefined){
  11654. this.selectKeysDefined = true;
  11655. var timer, held;
  11656. var move = function(offset){
  11657. var mover = function(e){
  11658. clearTimeout(timer);
  11659. e.preventDefault();
  11660. var to = this.body.rows[this.getRowByOffset(offset, this.options.selectHiddenRows)];
  11661. if (e.shift && to && this.isSelected(to)){
  11662. this.deselectRow(this.focused);
  11663. this.focused = to;
  11664. } else {
  11665. if (to && (!this.options.allowMultiSelect || !e.shift)){
  11666. this.selectNone();
  11667. }
  11668. this.shiftFocus(offset, e);
  11669. }
  11670. if (held){
  11671. timer = mover.delay(100, this, e);
  11672. } else {
  11673. timer = (function(){
  11674. held = true;
  11675. mover(e);
  11676. }).delay(400);
  11677. }
  11678. }.bind(this);
  11679. return mover;
  11680. }.bind(this);
  11681. var clear = function(){
  11682. clearTimeout(timer);
  11683. held = false;
  11684. };
  11685. this.keyboard.addEvents({
  11686. 'keydown:shift+up': move(-1),
  11687. 'keydown:shift+down': move(1),
  11688. 'keyup:shift+up': clear,
  11689. 'keyup:shift+down': clear,
  11690. 'keyup:up': clear,
  11691. 'keyup:down': clear
  11692. });
  11693. var shiftHint = '';
  11694. if (this.options.allowMultiSelect && this.options.shiftForMultiSelect && this.options.useKeyboard){
  11695. shiftHint = ' (Shift multi-selects).';
  11696. }
  11697. this.keyboard.addShortcuts({
  11698. 'Select Previous Row': {
  11699. keys: 'up',
  11700. shortcut: 'up arrow',
  11701. handler: move(-1),
  11702. description: 'Select the previous row in the table.' + shiftHint
  11703. },
  11704. 'Select Next Row': {
  11705. keys: 'down',
  11706. shortcut: 'down arrow',
  11707. handler: move(1),
  11708. description: 'Select the next row in the table.' + shiftHint
  11709. }
  11710. });
  11711. }
  11712. this.keyboard[attach ? 'activate' : 'deactivate']();
  11713. }
  11714. this.updateSelects();
  11715. },
  11716. mouseleave: function(){
  11717. if (this.hovered) this.leaveRow(this.hovered);
  11718. }
  11719. });
  11720. /*
  11721. ---
  11722. script: HtmlTable.Sort.js
  11723. name: HtmlTable.Sort
  11724. description: Builds a stripy, sortable table with methods to add rows.
  11725. license: MIT-style license
  11726. authors:
  11727. - Harald Kirschner
  11728. - Aaron Newton
  11729. - Jacob Thornton
  11730. requires:
  11731. - Core/Hash
  11732. - HtmlTable
  11733. - Class.refactor
  11734. - Element.Delegation.Pseudo
  11735. - String.Extras
  11736. - Date
  11737. provides: [HtmlTable.Sort]
  11738. ...
  11739. */
  11740. (function(){
  11741. var readOnlyNess = document.createElement('table');
  11742. try {
  11743. readOnlyNess.innerHTML = '<tr><td></td></tr>';
  11744. readOnlyNess = readOnlyNess.childNodes.length === 0;
  11745. } catch (e){
  11746. readOnlyNess = true;
  11747. }
  11748. HtmlTable = Class.refactor(HtmlTable, {
  11749. options: {/*
  11750. onSort: function(){}, */
  11751. sortIndex: 0,
  11752. sortReverse: false,
  11753. parsers: [],
  11754. defaultParser: 'string',
  11755. classSortable: 'table-sortable',
  11756. classHeadSort: 'table-th-sort',
  11757. classHeadSortRev: 'table-th-sort-rev',
  11758. classNoSort: 'table-th-nosort',
  11759. classGroupHead: 'table-tr-group-head',
  11760. classGroup: 'table-tr-group',
  11761. classCellSort: 'table-td-sort',
  11762. classSortSpan: 'table-th-sort-span',
  11763. sortable: false,
  11764. thSelector: 'th'
  11765. },
  11766. initialize: function(){
  11767. this.previous.apply(this, arguments);
  11768. if (this.occluded) return this.occluded;
  11769. this.sorted = {index: null, dir: 1};
  11770. if (!this.bound) this.bound = {};
  11771. this.bound.headClick = this.headClick.bind(this);
  11772. this.sortSpans = new Elements();
  11773. if (this.options.sortable){
  11774. this.enableSort();
  11775. if (this.options.sortIndex != null) this.sort(this.options.sortIndex, this.options.sortReverse);
  11776. }
  11777. },
  11778. attachSorts: function(attach){
  11779. this.detachSorts();
  11780. if (attach !== false) this.element.addEvent('click:relay(' + this.options.thSelector + ')', this.bound.headClick);
  11781. },
  11782. detachSorts: function(){
  11783. this.element.removeEvents('click:relay(' + this.options.thSelector + ')');
  11784. },
  11785. setHeaders: function(){
  11786. this.previous.apply(this, arguments);
  11787. if (this.sortable) this.setParsers();
  11788. },
  11789. setParsers: function(){
  11790. this.parsers = this.detectParsers();
  11791. },
  11792. detectParsers: function(){
  11793. return this.head && this.head.getElements(this.options.thSelector).flatten().map(this.detectParser, this);
  11794. },
  11795. detectParser: function(cell, index){
  11796. if (cell.hasClass(this.options.classNoSort) || cell.retrieve('htmltable-parser')) return cell.retrieve('htmltable-parser');
  11797. var thDiv = new Element('div');
  11798. thDiv.adopt(cell.childNodes).inject(cell);
  11799. var sortSpan = new Element('span', {'class': this.options.classSortSpan}).inject(thDiv, 'top');
  11800. this.sortSpans.push(sortSpan);
  11801. var parser = this.options.parsers[index],
  11802. rows = this.body.rows,
  11803. cancel;
  11804. switch (typeOf(parser)){
  11805. case 'function': parser = {convert: parser}; cancel = true; break;
  11806. case 'string': parser = parser; cancel = true; break;
  11807. }
  11808. if (!cancel){
  11809. HtmlTable.ParserPriority.some(function(parserName){
  11810. var current = HtmlTable.Parsers[parserName],
  11811. match = current.match;
  11812. if (!match) return false;
  11813. for (var i = 0, j = rows.length; i < j; i++){
  11814. var cell = document.id(rows[i].cells[index]),
  11815. text = cell ? cell.get('html').clean() : '';
  11816. if (text && match.test(text)){
  11817. parser = current;
  11818. return true;
  11819. }
  11820. }
  11821. });
  11822. }
  11823. if (!parser) parser = this.options.defaultParser;
  11824. cell.store('htmltable-parser', parser);
  11825. return parser;
  11826. },
  11827. headClick: function(event, el){
  11828. if (!this.head || el.hasClass(this.options.classNoSort)) return;
  11829. return this.sort(Array.indexOf(this.head.getElements(this.options.thSelector).flatten(), el) % this.body.rows[0].cells.length);
  11830. },
  11831. serialize: function(){
  11832. var previousSerialization = this.previous.apply(this, arguments) || {};
  11833. if (this.options.sortable){
  11834. previousSerialization.sortIndex = this.sorted.index;
  11835. previousSerialization.sortReverse = this.sorted.reverse;
  11836. }
  11837. return previousSerialization;
  11838. },
  11839. restore: function(tableState){
  11840. if (this.options.sortable && tableState.sortIndex){
  11841. this.sort(tableState.sortIndex, tableState.sortReverse);
  11842. }
  11843. this.previous.apply(this, arguments);
  11844. },
  11845. setSortedState: function(index, reverse){
  11846. if (reverse != null) this.sorted.reverse = reverse;
  11847. else if (this.sorted.index == index) this.sorted.reverse = !this.sorted.reverse;
  11848. else this.sorted.reverse = this.sorted.index == null;
  11849. if (index != null) this.sorted.index = index;
  11850. },
  11851. setHeadSort: function(sorted){
  11852. var head = $$(!this.head.length ? this.head.cells[this.sorted.index] : this.head.map(function(row){
  11853. return row.getElements(this.options.thSelector)[this.sorted.index];
  11854. }, this).clean());
  11855. if (!head.length) return;
  11856. if (sorted){
  11857. head.addClass(this.options.classHeadSort);
  11858. if (this.sorted.reverse) head.addClass(this.options.classHeadSortRev);
  11859. else head.removeClass(this.options.classHeadSortRev);
  11860. } else {
  11861. head.removeClass(this.options.classHeadSort).removeClass(this.options.classHeadSortRev);
  11862. }
  11863. },
  11864. setRowSort: function(data, pre){
  11865. var count = data.length,
  11866. body = this.body,
  11867. group,
  11868. rowIndex;
  11869. while (count){
  11870. var item = data[--count],
  11871. position = item.position,
  11872. row = body.rows[position];
  11873. if (row.disabled) continue;
  11874. if (!pre){
  11875. group = this.setGroupSort(group, row, item);
  11876. this.setRowStyle(row, count);
  11877. }
  11878. body.appendChild(row);
  11879. for (rowIndex = 0; rowIndex < count; rowIndex++){
  11880. if (data[rowIndex].position > position) data[rowIndex].position--;
  11881. }
  11882. }
  11883. },
  11884. setRowStyle: function(row, i){
  11885. this.previous(row, i);
  11886. row.cells[this.sorted.index].addClass(this.options.classCellSort);
  11887. },
  11888. setGroupSort: function(group, row, item){
  11889. if (group == item.value) row.removeClass(this.options.classGroupHead).addClass(this.options.classGroup);
  11890. else row.removeClass(this.options.classGroup).addClass(this.options.classGroupHead);
  11891. return item.value;
  11892. },
  11893. getParser: function(){
  11894. var parser = this.parsers[this.sorted.index];
  11895. return typeOf(parser) == 'string' ? HtmlTable.Parsers[parser] : parser;
  11896. },
  11897. sort: function(index, reverse, pre, sortFunction){
  11898. if (!this.head) return;
  11899. if (!pre){
  11900. this.clearSort();
  11901. this.setSortedState(index, reverse);
  11902. this.setHeadSort(true);
  11903. }
  11904. var parser = this.getParser();
  11905. if (!parser) return;
  11906. var rel;
  11907. if (!readOnlyNess){
  11908. rel = this.body.getParent();
  11909. this.body.dispose();
  11910. }
  11911. var data = this.parseData(parser).sort(sortFunction ? sortFunction : function(a, b){
  11912. if (a.value === b.value) return 0;
  11913. return a.value > b.value ? 1 : -1;
  11914. });
  11915. var reversed = this.sorted.reverse == (parser == HtmlTable.Parsers['input-checked']);
  11916. if (reversed) data.reverse(true);
  11917. this.setRowSort(data, pre);
  11918. if (rel) rel.grab(this.body);
  11919. this.fireEvent('stateChanged');
  11920. return this.fireEvent('sort', [this.body, this.sorted.index, reversed ? 'asc' : 'desc']);
  11921. },
  11922. parseData: function(parser){
  11923. return Array.map(this.body.rows, function(row, i){
  11924. var value = parser.convert.call(document.id(row.cells[this.sorted.index]));
  11925. return {
  11926. position: i,
  11927. value: value
  11928. };
  11929. }, this);
  11930. },
  11931. clearSort: function(){
  11932. this.setHeadSort(false);
  11933. this.body.getElements('td').removeClass(this.options.classCellSort);
  11934. },
  11935. reSort: function(){
  11936. if (this.sortable) this.sort.call(this, this.sorted.index, this.sorted.reverse);
  11937. return this;
  11938. },
  11939. enableSort: function(){
  11940. this.element.addClass(this.options.classSortable);
  11941. this.attachSorts(true);
  11942. this.setParsers();
  11943. this.sortable = true;
  11944. return this;
  11945. },
  11946. disableSort: function(){
  11947. this.element.removeClass(this.options.classSortable);
  11948. this.attachSorts(false);
  11949. this.sortSpans.each(function(span){
  11950. span.destroy();
  11951. });
  11952. this.sortSpans.empty();
  11953. this.sortable = false;
  11954. return this;
  11955. }
  11956. });
  11957. HtmlTable.ParserPriority = ['date', 'input-checked', 'input-value', 'float', 'number'];
  11958. HtmlTable.Parsers = {
  11959. 'date': {
  11960. match: /^\d{2}[-\/ ]\d{2}[-\/ ]\d{2,4}$/,
  11961. convert: function(){
  11962. var d = Date.parse(this.get('text').stripTags());
  11963. return (typeOf(d) == 'date') ? d.format('db') : '';
  11964. },
  11965. type: 'date'
  11966. },
  11967. 'input-checked': {
  11968. match: / type="(radio|checkbox)"/,
  11969. convert: function(){
  11970. return this.getElement('input').checked;
  11971. }
  11972. },
  11973. 'input-value': {
  11974. match: /<input/,
  11975. convert: function(){
  11976. return this.getElement('input').value;
  11977. }
  11978. },
  11979. 'number': {
  11980. match: /^\d+[^\d.,]*$/,
  11981. convert: function(){
  11982. return this.get('text').stripTags().toInt();
  11983. },
  11984. number: true
  11985. },
  11986. 'numberLax': {
  11987. match: /^[^\d]+\d+$/,
  11988. convert: function(){
  11989. return this.get('text').replace(/[^-?^0-9]/, '').stripTags().toInt();
  11990. },
  11991. number: true
  11992. },
  11993. 'float': {
  11994. match: /^[\d]+\.[\d]+/,
  11995. convert: function(){
  11996. return this.get('text').replace(/[^-?^\d.e]/, '').stripTags().toFloat();
  11997. },
  11998. number: true
  11999. },
  12000. 'floatLax': {
  12001. match: /^[^\d]+[\d]+\.[\d]+$/,
  12002. convert: function(){
  12003. return this.get('text').replace(/[^-?^\d.]/, '').stripTags().toFloat();
  12004. },
  12005. number: true
  12006. },
  12007. 'string': {
  12008. match: null,
  12009. convert: function(){
  12010. return this.get('text').stripTags().toLowerCase();
  12011. }
  12012. },
  12013. 'title': {
  12014. match: null,
  12015. convert: function(){
  12016. return this.title;
  12017. }
  12018. }
  12019. };
  12020. //<1.2compat>
  12021. HtmlTable.Parsers = new Hash(HtmlTable.Parsers);
  12022. //</1.2compat>
  12023. HtmlTable.defineParsers = function(parsers){
  12024. HtmlTable.Parsers = Object.append(HtmlTable.Parsers, parsers);
  12025. for (var parser in parsers){
  12026. HtmlTable.ParserPriority.unshift(parser);
  12027. }
  12028. };
  12029. })();
  12030. /*
  12031. ---
  12032. script: HtmlTable.Zebra.js
  12033. name: HtmlTable.Zebra
  12034. description: Builds a stripy table with methods to add rows.
  12035. license: MIT-style license
  12036. authors:
  12037. - Harald Kirschner
  12038. - Aaron Newton
  12039. requires:
  12040. - HtmlTable
  12041. - Element.Shortcuts
  12042. - Class.refactor
  12043. provides: [HtmlTable.Zebra]
  12044. ...
  12045. */
  12046. HtmlTable = Class.refactor(HtmlTable, {
  12047. options: {
  12048. classZebra: 'table-tr-odd',
  12049. zebra: true,
  12050. zebraOnlyVisibleRows: true
  12051. },
  12052. initialize: function(){
  12053. this.previous.apply(this, arguments);
  12054. if (this.occluded) return this.occluded;
  12055. if (this.options.zebra) this.updateZebras();
  12056. },
  12057. updateZebras: function(){
  12058. var index = 0;
  12059. Array.each(this.body.rows, function(row){
  12060. if (!this.options.zebraOnlyVisibleRows || row.isDisplayed()){
  12061. this.zebra(row, index++);
  12062. }
  12063. }, this);
  12064. },
  12065. setRowStyle: function(row, i){
  12066. if (this.previous) this.previous(row, i);
  12067. this.zebra(row, i);
  12068. },
  12069. zebra: function(row, i){
  12070. return row[((i % 2) ? 'remove' : 'add')+'Class'](this.options.classZebra);
  12071. },
  12072. push: function(){
  12073. var pushed = this.previous.apply(this, arguments);
  12074. if (this.options.zebra) this.updateZebras();
  12075. return pushed;
  12076. }
  12077. });
  12078. /*
  12079. ---
  12080. script: Scroller.js
  12081. name: Scroller
  12082. description: Class which scrolls the contents of any Element (including the window) when the mouse reaches the Element's boundaries.
  12083. license: MIT-style license
  12084. authors:
  12085. - Valerio Proietti
  12086. requires:
  12087. - Core/Events
  12088. - Core/Options
  12089. - Core/Element.Event
  12090. - Core/Element.Dimensions
  12091. - MooTools.More
  12092. provides: [Scroller]
  12093. ...
  12094. */
  12095. (function(){
  12096. var Scroller = this.Scroller = new Class({
  12097. Implements: [Events, Options],
  12098. options: {
  12099. area: 20,
  12100. velocity: 1,
  12101. onChange: function(x, y){
  12102. this.element.scrollTo(x, y);
  12103. },
  12104. fps: 50
  12105. },
  12106. initialize: function(element, options){
  12107. this.setOptions(options);
  12108. this.element = document.id(element);
  12109. this.docBody = document.id(this.element.getDocument().body);
  12110. this.listener = (typeOf(this.element) != 'element') ? this.docBody : this.element;
  12111. this.timer = null;
  12112. this.bound = {
  12113. attach: this.attach.bind(this),
  12114. detach: this.detach.bind(this),
  12115. getCoords: this.getCoords.bind(this)
  12116. };
  12117. },
  12118. start: function(){
  12119. this.listener.addEvents({
  12120. mouseover: this.bound.attach,
  12121. mouseleave: this.bound.detach
  12122. });
  12123. return this;
  12124. },
  12125. stop: function(){
  12126. this.listener.removeEvents({
  12127. mouseover: this.bound.attach,
  12128. mouseleave: this.bound.detach
  12129. });
  12130. this.detach();
  12131. this.timer = clearInterval(this.timer);
  12132. return this;
  12133. },
  12134. attach: function(){
  12135. this.listener.addEvent('mousemove', this.bound.getCoords);
  12136. },
  12137. detach: function(){
  12138. this.listener.removeEvent('mousemove', this.bound.getCoords);
  12139. this.timer = clearInterval(this.timer);
  12140. },
  12141. getCoords: function(event){
  12142. this.page = (this.listener.get('tag') == 'body') ? event.client : event.page;
  12143. if (!this.timer) this.timer = this.scroll.periodical(Math.round(1000 / this.options.fps), this);
  12144. },
  12145. scroll: function(){
  12146. var size = this.element.getSize(),
  12147. scroll = this.element.getScroll(),
  12148. pos = ((this.element != this.docBody) && (this.element != window)) ? this.element.getOffsets() : {x: 0, y: 0},
  12149. scrollSize = this.element.getScrollSize(),
  12150. change = {x: 0, y: 0},
  12151. top = this.options.area.top || this.options.area,
  12152. bottom = this.options.area.bottom || this.options.area;
  12153. for (var z in this.page){
  12154. if (this.page[z] < (top + pos[z]) && scroll[z] != 0){
  12155. change[z] = (this.page[z] - top - pos[z]) * this.options.velocity;
  12156. } else if (this.page[z] + bottom > (size[z] + pos[z]) && scroll[z] + size[z] != scrollSize[z]){
  12157. change[z] = (this.page[z] - size[z] + bottom - pos[z]) * this.options.velocity;
  12158. }
  12159. change[z] = change[z].round();
  12160. }
  12161. if (change.y || change.x) this.fireEvent('change', [scroll.x + change.x, scroll.y + change.y]);
  12162. }
  12163. });
  12164. })();
  12165. /*
  12166. ---
  12167. script: Tips.js
  12168. name: Tips
  12169. description: Class for creating nice tips that follow the mouse cursor when hovering an element.
  12170. license: MIT-style license
  12171. authors:
  12172. - Valerio Proietti
  12173. - Christoph Pojer
  12174. - Luis Merino
  12175. requires:
  12176. - Core/Options
  12177. - Core/Events
  12178. - Core/Element.Event
  12179. - Core/Element.Style
  12180. - Core/Element.Dimensions
  12181. - MooTools.More
  12182. provides: [Tips]
  12183. ...
  12184. */
  12185. (function(){
  12186. var read = function(option, element){
  12187. return (option) ? (typeOf(option) == 'function' ? option(element) : element.get(option)) : '';
  12188. };
  12189. var Tips = this.Tips = new Class({
  12190. Implements: [Events, Options],
  12191. options: {/*
  12192. id: null,
  12193. onAttach: function(element){},
  12194. onDetach: function(element){},
  12195. onBound: function(coords){},*/
  12196. onShow: function(){
  12197. this.tip.setStyle('display', 'block');
  12198. },
  12199. onHide: function(){
  12200. this.tip.setStyle('display', 'none');
  12201. },
  12202. title: 'title',
  12203. text: function(element){
  12204. return element.get('rel') || element.get('href');
  12205. },
  12206. showDelay: 100,
  12207. hideDelay: 100,
  12208. className: 'tip-wrap',
  12209. offset: {x: 16, y: 16},
  12210. windowPadding: {x:0, y:0},
  12211. fixed: false,
  12212. waiAria: true,
  12213. hideEmpty: false
  12214. },
  12215. initialize: function(){
  12216. var params = Array.link(arguments, {
  12217. options: Type.isObject,
  12218. elements: function(obj){
  12219. return obj != null;
  12220. }
  12221. });
  12222. this.setOptions(params.options);
  12223. if (params.elements) this.attach(params.elements);
  12224. this.container = new Element('div', {'class': 'tip'});
  12225. if (this.options.id){
  12226. this.container.set('id', this.options.id);
  12227. if (this.options.waiAria) this.attachWaiAria();
  12228. }
  12229. },
  12230. toElement: function(){
  12231. if (this.tip) return this.tip;
  12232. this.tip = new Element('div', {
  12233. 'class': this.options.className,
  12234. styles: {
  12235. position: 'absolute',
  12236. top: 0,
  12237. left: 0,
  12238. display: 'none'
  12239. }
  12240. }).adopt(
  12241. new Element('div', {'class': 'tip-top'}),
  12242. this.container,
  12243. new Element('div', {'class': 'tip-bottom'})
  12244. );
  12245. return this.tip;
  12246. },
  12247. attachWaiAria: function(){
  12248. var id = this.options.id;
  12249. this.container.set('role', 'tooltip');
  12250. if (!this.waiAria){
  12251. this.waiAria = {
  12252. show: function(element){
  12253. if (id) element.set('aria-describedby', id);
  12254. this.container.set('aria-hidden', 'false');
  12255. },
  12256. hide: function(element){
  12257. if (id) element.erase('aria-describedby');
  12258. this.container.set('aria-hidden', 'true');
  12259. }
  12260. };
  12261. }
  12262. this.addEvents(this.waiAria);
  12263. },
  12264. detachWaiAria: function(){
  12265. if (this.waiAria){
  12266. this.container.erase('role');
  12267. this.container.erase('aria-hidden');
  12268. this.removeEvents(this.waiAria);
  12269. }
  12270. },
  12271. attach: function(elements){
  12272. $$(elements).each(function(element){
  12273. var title = read(this.options.title, element),
  12274. text = read(this.options.text, element);
  12275. element.set('title', '').store('tip:native', title).retrieve('tip:title', title);
  12276. element.retrieve('tip:text', text);
  12277. this.fireEvent('attach', [element]);
  12278. var events = ['enter', 'leave'];
  12279. if (!this.options.fixed) events.push('move');
  12280. events.each(function(value){
  12281. var event = element.retrieve('tip:' + value);
  12282. if (!event) event = function(event){
  12283. this['element' + value.capitalize()].apply(this, [event, element]);
  12284. }.bind(this);
  12285. element.store('tip:' + value, event).addEvent('mouse' + value, event);
  12286. }, this);
  12287. }, this);
  12288. return this;
  12289. },
  12290. detach: function(elements){
  12291. $$(elements).each(function(element){
  12292. ['enter', 'leave', 'move'].each(function(value){
  12293. element.removeEvent('mouse' + value, element.retrieve('tip:' + value)).eliminate('tip:' + value);
  12294. });
  12295. this.fireEvent('detach', [element]);
  12296. if (this.options.title == 'title'){ // This is necessary to check if we can revert the title
  12297. var original = element.retrieve('tip:native');
  12298. if (original) element.set('title', original);
  12299. }
  12300. }, this);
  12301. return this;
  12302. },
  12303. elementEnter: function(event, element){
  12304. clearTimeout(this.timer);
  12305. this.timer = (function(){
  12306. this.container.empty();
  12307. var showTip = !this.options.hideEmpty;
  12308. ['title', 'text'].each(function(value){
  12309. var content = element.retrieve('tip:' + value);
  12310. var div = this['_' + value + 'Element'] = new Element('div', {
  12311. 'class': 'tip-' + value
  12312. }).inject(this.container);
  12313. if (content){
  12314. this.fill(div, content);
  12315. showTip = true;
  12316. }
  12317. }, this);
  12318. if (showTip){
  12319. this.show(element);
  12320. } else {
  12321. this.hide(element);
  12322. }
  12323. this.position((this.options.fixed) ? {page: element.getPosition()} : event);
  12324. }).delay(this.options.showDelay, this);
  12325. },
  12326. elementLeave: function(event, element){
  12327. clearTimeout(this.timer);
  12328. this.timer = this.hide.delay(this.options.hideDelay, this, element);
  12329. this.fireForParent(event, element);
  12330. },
  12331. setTitle: function(title){
  12332. if (this._titleElement){
  12333. this._titleElement.empty();
  12334. this.fill(this._titleElement, title);
  12335. }
  12336. return this;
  12337. },
  12338. setText: function(text){
  12339. if (this._textElement){
  12340. this._textElement.empty();
  12341. this.fill(this._textElement, text);
  12342. }
  12343. return this;
  12344. },
  12345. fireForParent: function(event, element){
  12346. element = element.getParent();
  12347. if (!element || element == document.body) return;
  12348. if (element.retrieve('tip:enter')) element.fireEvent('mouseenter', event);
  12349. else this.fireForParent(event, element);
  12350. },
  12351. elementMove: function(event, element){
  12352. this.position(event);
  12353. },
  12354. position: function(event){
  12355. if (!this.tip) document.id(this);
  12356. var size = window.getSize(), scroll = window.getScroll(),
  12357. tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight},
  12358. props = {x: 'left', y: 'top'},
  12359. bounds = {y: false, x2: false, y2: false, x: false},
  12360. obj = {};
  12361. for (var z in props){
  12362. obj[props[z]] = event.page[z] + this.options.offset[z];
  12363. if (obj[props[z]] < 0) bounds[z] = true;
  12364. if ((obj[props[z]] + tip[z] - scroll[z]) > size[z] - this.options.windowPadding[z]){
  12365. obj[props[z]] = event.page[z] - this.options.offset[z] - tip[z];
  12366. bounds[z+'2'] = true;
  12367. }
  12368. }
  12369. this.fireEvent('bound', bounds);
  12370. this.tip.setStyles(obj);
  12371. },
  12372. fill: function(element, contents){
  12373. if (typeof contents == 'string') element.set('html', contents);
  12374. else element.adopt(contents);
  12375. },
  12376. show: function(element){
  12377. if (!this.tip) document.id(this);
  12378. if (!this.tip.getParent()) this.tip.inject(document.body);
  12379. this.fireEvent('show', [this.tip, element]);
  12380. },
  12381. hide: function(element){
  12382. if (!this.tip) document.id(this);
  12383. this.fireEvent('hide', [this.tip, element]);
  12384. }
  12385. });
  12386. })();
  12387. /*
  12388. ---
  12389. name: Locale.CH.Number
  12390. description: Number messages for Switzerland.
  12391. license: MIT-style license
  12392. authors:
  12393. - Kim D. Jeker
  12394. requires:
  12395. - Locale
  12396. provides: [Locale.CH.Number]
  12397. ...
  12398. */
  12399. Locale.define('CH', 'Number', {
  12400. decimal: ',',
  12401. group: '\'',
  12402. currency: {
  12403. decimal: '.',
  12404. suffix: ' CHF'
  12405. }
  12406. });
  12407. /*
  12408. ---
  12409. name: Locale.EU.Number
  12410. description: Number messages for Europe.
  12411. license: MIT-style license
  12412. authors:
  12413. - Arian Stolwijk
  12414. requires:
  12415. - Locale
  12416. provides: [Locale.EU.Number]
  12417. ...
  12418. */
  12419. Locale.define('EU', 'Number', {
  12420. decimal: ',',
  12421. group: '.',
  12422. currency: {
  12423. prefix: '€ '
  12424. }
  12425. });
  12426. /*
  12427. ---
  12428. script: Locale.Set.From.js
  12429. name: Locale.Set.From
  12430. description: Provides an alternative way to create Locale.Set objects.
  12431. license: MIT-style license
  12432. authors:
  12433. - Tim Wienk
  12434. requires:
  12435. - Core/JSON
  12436. - Locale
  12437. provides: Locale.Set.From
  12438. ...
  12439. */
  12440. (function(){
  12441. var parsers = {
  12442. 'json': JSON.decode
  12443. };
  12444. Locale.Set.defineParser = function(name, fn){
  12445. parsers[name] = fn;
  12446. };
  12447. Locale.Set.from = function(set, type){
  12448. if (instanceOf(set, Locale.Set)) return set;
  12449. if (!type && typeOf(set) == 'string') type = 'json';
  12450. if (parsers[type]) set = parsers[type](set);
  12451. var locale = new Locale.Set;
  12452. locale.sets = set.sets || {};
  12453. if (set.inherits){
  12454. locale.inherits.locales = Array.convert(set.inherits.locales);
  12455. locale.inherits.sets = set.inherits.sets || {};
  12456. }
  12457. return locale;
  12458. };
  12459. })();
  12460. /*
  12461. ---
  12462. name: Locale.ZA.Number
  12463. description: Number messages for ZA.
  12464. license: MIT-style license
  12465. authors:
  12466. - Werner Mollentze
  12467. requires:
  12468. - Locale
  12469. provides: [Locale.ZA.Number]
  12470. ...
  12471. */
  12472. Locale.define('ZA', 'Number', {
  12473. decimal: '.',
  12474. group: ',',
  12475. currency: {
  12476. prefix: 'R '
  12477. }
  12478. });
  12479. /*
  12480. ---
  12481. name: Locale.af-ZA.Date
  12482. description: Date messages for ZA Afrikaans.
  12483. license: MIT-style license
  12484. authors:
  12485. - Werner Mollentze
  12486. requires:
  12487. - Locale
  12488. provides: [Locale.af-ZA.Date]
  12489. ...
  12490. */
  12491. Locale.define('af-ZA', 'Date', {
  12492. months: ['Januarie', 'Februarie', 'Maart', 'April', 'Mei', 'Junie', 'Julie', 'Augustus', 'September', 'Oktober', 'November', 'Desember'],
  12493. months_abbr: ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
  12494. days: ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'],
  12495. days_abbr: ['Son', 'Maa', 'Din', 'Woe', 'Don', 'Vry', 'Sat'],
  12496. // Culture's date order: MM/DD/YYYY
  12497. dateOrder: ['date', 'month', 'year'],
  12498. shortDate: '%d-%m-%Y',
  12499. shortTime: '%H:%M',
  12500. AM: 'VM',
  12501. PM: 'NM',
  12502. firstDayOfWeek: 1,
  12503. // Date.Extras
  12504. ordinal: function(dayOfMonth){
  12505. return ((dayOfMonth > 1 && dayOfMonth < 20 && dayOfMonth != 8) || (dayOfMonth > 100 && dayOfMonth.toString().substr(-2, 1) == '1')) ? 'de' : 'ste';
  12506. },
  12507. lessThanMinuteAgo: 'minder as \'n minuut gelede',
  12508. minuteAgo: 'ongeveer \'n minuut gelede',
  12509. minutesAgo: '{delta} minute gelede',
  12510. hourAgo: 'omtret \'n uur gelede',
  12511. hoursAgo: 'ongeveer {delta} ure gelede',
  12512. dayAgo: '1 dag gelede',
  12513. daysAgo: '{delta} dae gelede',
  12514. weekAgo: '1 week gelede',
  12515. weeksAgo: '{delta} weke gelede',
  12516. monthAgo: '1 maand gelede',
  12517. monthsAgo: '{delta} maande gelede',
  12518. yearAgo: '1 jaar gelede',
  12519. yearsAgo: '{delta} jare gelede',
  12520. lessThanMinuteUntil: 'oor minder as \'n minuut',
  12521. minuteUntil: 'oor ongeveer \'n minuut',
  12522. minutesUntil: 'oor {delta} minute',
  12523. hourUntil: 'oor ongeveer \'n uur',
  12524. hoursUntil: 'oor {delta} uur',
  12525. dayUntil: 'oor ongeveer \'n dag',
  12526. daysUntil: 'oor {delta} dae',
  12527. weekUntil: 'oor \'n week',
  12528. weeksUntil: 'oor {delta} weke',
  12529. monthUntil: 'oor \'n maand',
  12530. monthsUntil: 'oor {delta} maande',
  12531. yearUntil: 'oor \'n jaar',
  12532. yearsUntil: 'oor {delta} jaar'
  12533. });
  12534. /*
  12535. ---
  12536. name: Locale.af-ZA.Form.Validator
  12537. description: Form Validator messages for Afrikaans.
  12538. license: MIT-style license
  12539. authors:
  12540. - Werner Mollentze
  12541. requires:
  12542. - Locale
  12543. provides: [Locale.af-ZA.Form.Validator]
  12544. ...
  12545. */
  12546. Locale.define('af-ZA', 'FormValidator', {
  12547. required: 'Hierdie veld word vereis.',
  12548. length: 'Voer asseblief {length} karakters in (u het {elLength} karakters ingevoer)',
  12549. minLength: 'Voer asseblief ten minste {minLength} karakters in (u het {length} karakters ingevoer).',
  12550. maxLength: 'Moet asseblief nie meer as {maxLength} karakters invoer nie (u het {length} karakters ingevoer).',
  12551. integer: 'Voer asseblief \'n heelgetal in hierdie veld in. Getalle met desimale (bv. 1.25) word nie toegelaat nie.',
  12552. numeric: 'Voer asseblief slegs numeriese waardes in hierdie veld in (bv. "1" of "1.1" of "-1" of "-1.1").',
  12553. digits: 'Gebruik asseblief slegs nommers en punktuasie in hierdie veld. (by voorbeeld, \'n telefoon nommer wat koppeltekens en punte bevat is toelaatbaar).',
  12554. alpha: 'Gebruik asseblief slegs letters (a-z) binne-in hierdie veld. Geen spasies of ander karakters word toegelaat nie.',
  12555. alphanum: 'Gebruik asseblief slegs letters (a-z) en nommers (0-9) binne-in hierdie veld. Geen spasies of ander karakters word toegelaat nie.',
  12556. dateSuchAs: 'Voer asseblief \'n geldige datum soos {date} in',
  12557. dateInFormatMDY: 'Voer asseblief \'n geldige datum soos MM/DD/YYYY in (bv. "12/31/1999")',
  12558. email: 'Voer asseblief \'n geldige e-pos adres in. Byvoorbeeld "fred@domain.com".',
  12559. url: 'Voer asseblief \'n geldige bronadres (URL) soos http://www.example.com in.',
  12560. currencyDollar: 'Voer asseblief \'n geldige $ bedrag in. Byvoorbeeld $100.00 .',
  12561. oneRequired: 'Voer asseblief iets in vir ten minste een van hierdie velde.',
  12562. errorPrefix: 'Fout: ',
  12563. warningPrefix: 'Waarskuwing: ',
  12564. // Form.Validator.Extras
  12565. noSpace: 'Daar mag geen spasies in hierdie toevoer wees nie.',
  12566. reqChkByNode: 'Geen items is gekies nie.',
  12567. requiredChk: 'Hierdie veld word vereis.',
  12568. reqChkByName: 'Kies asseblief \'n {label}.',
  12569. match: 'Hierdie veld moet by die {matchName} veld pas',
  12570. startDate: 'die begin datum',
  12571. endDate: 'die eind datum',
  12572. currentDate: 'die huidige datum',
  12573. afterDate: 'Die datum moet dieselfde of na {label} wees.',
  12574. beforeDate: 'Die datum moet dieselfde of voor {label} wees.',
  12575. startMonth: 'Kies asseblief \'n begin maand',
  12576. sameMonth: 'Hierdie twee datums moet in dieselfde maand wees - u moet een of beide verander.',
  12577. creditcard: 'Die ingevoerde kredietkaart nommer is ongeldig. Bevestig asseblief die nommer en probeer weer. {length} syfers is ingevoer.'
  12578. });
  12579. /*
  12580. ---
  12581. name: Locale.af-ZA.Number
  12582. description: Number messages for ZA Afrikaans.
  12583. license: MIT-style license
  12584. authors:
  12585. - Werner Mollentze
  12586. requires:
  12587. - Locale
  12588. - Locale.ZA.Number
  12589. provides: [Locale.af-ZA.Number]
  12590. ...
  12591. */
  12592. Locale.define('af-ZA').inherit('ZA', 'Number');
  12593. /*
  12594. ---
  12595. name: Locale.ar.Date
  12596. description: Date messages for Arabic.
  12597. license: MIT-style license
  12598. authors:
  12599. - Chafik Barbar
  12600. requires:
  12601. - Locale
  12602. provides: [Locale.ar.Date]
  12603. ...
  12604. */
  12605. Locale.define('ar', 'Date', {
  12606. // Culture's date order: DD/MM/YYYY
  12607. dateOrder: ['date', 'month', 'year'],
  12608. shortDate: '%d/%m/%Y',
  12609. shortTime: '%H:%M'
  12610. });
  12611. /*
  12612. ---
  12613. name: Locale.ar.Form.Validator
  12614. description: Form Validator messages for Arabic.
  12615. license: MIT-style license
  12616. authors:
  12617. - Chafik Barbar
  12618. requires:
  12619. - Locale
  12620. provides: [Locale.ar.Form.Validator]
  12621. ...
  12622. */
  12623. Locale.define('ar', 'FormValidator', {
  12624. required: 'هذا الحقل مطلوب.',
  12625. minLength: 'رجاءً إدخال {minLength} أحرف على الأقل (تم إدخال {length} أحرف).',
  12626. maxLength: 'الرجاء عدم إدخال أكثر من {maxLength} أحرف (تم إدخال {length} أحرف).',
  12627. integer: 'الرجاء إدخال عدد صحيح في هذا الحقل. أي رقم ذو كسر عشري أو مئوي (مثال 1.25 ) غير مسموح.',
  12628. numeric: 'الرجاء إدخال قيم رقمية في هذا الحقل (مثال "1" أو "1.1" أو "-1" أو "-1.1").',
  12629. digits: 'الرجاء أستخدام قيم رقمية وعلامات ترقيمية فقط في هذا الحقل (مثال, رقم هاتف مع نقطة أو شحطة)',
  12630. alpha: 'الرجاء أستخدام أحرف فقط (ا-ي) في هذا الحقل. أي فراغات أو علامات غير مسموحة.',
  12631. alphanum: 'الرجاء أستخدام أحرف فقط (ا-ي) أو أرقام (0-9) فقط في هذا الحقل. أي فراغات أو علامات غير مسموحة.',
  12632. dateSuchAs: 'الرجاء إدخال تاريخ صحيح كالتالي {date}',
  12633. dateInFormatMDY: 'الرجاء إدخال تاريخ صحيح (مثال, 31-12-1999)',
  12634. email: 'الرجاء إدخال بريد إلكتروني صحيح.',
  12635. url: 'الرجاء إدخال عنوان إلكتروني صحيح مثل http://www.example.com',
  12636. currencyDollar: 'الرجاء إدخال قيمة $ صحيحة. مثال, 100.00$',
  12637. oneRequired: 'الرجاء إدخال قيمة في أحد هذه الحقول على الأقل.',
  12638. errorPrefix: 'خطأ: ',
  12639. warningPrefix: 'تحذير: '
  12640. });
  12641. /*
  12642. ---
  12643. name: Locale.ca-CA.Date
  12644. description: Date messages for Catalan.
  12645. license: MIT-style license
  12646. authors:
  12647. - Ãlfons Sanchez
  12648. requires:
  12649. - Locale
  12650. provides: [Locale.ca-CA.Date]
  12651. ...
  12652. */
  12653. Locale.define('ca-CA', 'Date', {
  12654. months: ['Gener', 'Febrer', 'Març', 'Abril', 'Maig', 'Juny', 'Juli', 'Agost', 'Setembre', 'Octubre', 'Novembre', 'Desembre'],
  12655. months_abbr: ['gen.', 'febr.', 'març', 'abr.', 'maig', 'juny', 'jul.', 'ag.', 'set.', 'oct.', 'nov.', 'des.'],
  12656. days: ['Diumenge', 'Dilluns', 'Dimarts', 'Dimecres', 'Dijous', 'Divendres', 'Dissabte'],
  12657. days_abbr: ['dg', 'dl', 'dt', 'dc', 'dj', 'dv', 'ds'],
  12658. // Culture's date order: DD/MM/YYYY
  12659. dateOrder: ['date', 'month', 'year'],
  12660. shortDate: '%d/%m/%Y',
  12661. shortTime: '%H:%M',
  12662. AM: 'AM',
  12663. PM: 'PM',
  12664. firstDayOfWeek: 0,
  12665. // Date.Extras
  12666. ordinal: '',
  12667. lessThanMinuteAgo: 'fa menys d`un minut',
  12668. minuteAgo: 'fa un minut',
  12669. minutesAgo: 'fa {delta} minuts',
  12670. hourAgo: 'fa un hora',
  12671. hoursAgo: 'fa unes {delta} hores',
  12672. dayAgo: 'fa un dia',
  12673. daysAgo: 'fa {delta} dies',
  12674. lessThanMinuteUntil: 'menys d`un minut des d`ara',
  12675. minuteUntil: 'un minut des d`ara',
  12676. minutesUntil: '{delta} minuts des d`ara',
  12677. hourUntil: 'un hora des d`ara',
  12678. hoursUntil: 'unes {delta} hores des d`ara',
  12679. dayUntil: '1 dia des d`ara',
  12680. daysUntil: '{delta} dies des d`ara'
  12681. });
  12682. /*
  12683. ---
  12684. name: Locale.ca-CA.Form.Validator
  12685. description: Form Validator messages for Catalan.
  12686. license: MIT-style license
  12687. authors:
  12688. - Miquel Hudin
  12689. - Ãlfons Sanchez
  12690. requires:
  12691. - Locale
  12692. provides: [Locale.ca-CA.Form.Validator]
  12693. ...
  12694. */
  12695. Locale.define('ca-CA', 'FormValidator', {
  12696. required: 'Aquest camp es obligatori.',
  12697. minLength: 'Per favor introdueix al menys {minLength} caracters (has introduit {length} caracters).',
  12698. maxLength: 'Per favor introdueix no mes de {maxLength} caracters (has introduit {length} caracters).',
  12699. integer: 'Per favor introdueix un nombre enter en aquest camp. Nombres amb decimals (p.e. 1,25) no estan permesos.',
  12700. numeric: 'Per favor introdueix sols valors numerics en aquest camp (p.e. "1" o "1,1" o "-1" o "-1,1").',
  12701. digits: 'Per favor usa sols numeros i puntuacio en aquest camp (per exemple, un nombre de telefon amb guions i punts no esta permes).',
  12702. alpha: 'Per favor utilitza lletres nomes (a-z) en aquest camp. No s´admiteixen espais ni altres caracters.',
  12703. alphanum: 'Per favor, utilitza nomes lletres (a-z) o numeros (0-9) en aquest camp. No s´admiteixen espais ni altres caracters.',
  12704. dateSuchAs: 'Per favor introdueix una data valida com {date}',
  12705. dateInFormatMDY: 'Per favor introdueix una data valida com DD/MM/YYYY (p.e. "31/12/1999")',
  12706. email: 'Per favor, introdueix una adreça de correu electronic valida. Per exemple, "fred@domain.com".',
  12707. url: 'Per favor introdueix una URL valida com http://www.example.com.',
  12708. currencyDollar: 'Per favor introdueix una quantitat valida de €. Per exemple €100,00 .',
  12709. oneRequired: 'Per favor introdueix alguna cosa per al menys una d´aquestes entrades.',
  12710. errorPrefix: 'Error: ',
  12711. warningPrefix: 'Avis: ',
  12712. // Form.Validator.Extras
  12713. noSpace: 'No poden haver espais en aquesta entrada.',
  12714. reqChkByNode: 'No hi han elements seleccionats.',
  12715. requiredChk: 'Aquest camp es obligatori.',
  12716. reqChkByName: 'Per favor selecciona una {label}.',
  12717. match: 'Aquest camp necessita coincidir amb el camp {matchName}',
  12718. startDate: 'la data de inici',
  12719. endDate: 'la data de fi',
  12720. currentDate: 'la data actual',
  12721. afterDate: 'La data deu ser igual o posterior a {label}.',
  12722. beforeDate: 'La data deu ser igual o anterior a {label}.',
  12723. startMonth: 'Per favor selecciona un mes d´orige',
  12724. sameMonth: 'Aquestes dos dates deuen estar dins del mateix mes - deus canviar una o altra.'
  12725. });
  12726. /*
  12727. ---
  12728. name: Locale.cs-CZ.Date
  12729. description: Date messages for Czech.
  12730. license: MIT-style license
  12731. authors:
  12732. - Jan Černý chemiX
  12733. - Christopher Zukowski
  12734. requires:
  12735. - Locale
  12736. provides: [Locale.cs-CZ.Date]
  12737. ...
  12738. */
  12739. (function(){
  12740. // Czech language pluralization rules, see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  12741. // one -> n is 1; 1
  12742. // few -> n in 2..4; 2-4
  12743. // other -> everything else 0, 5-999, 1.31, 2.31, 5.31...
  12744. var pluralize = function(n, one, few, other){
  12745. if (n == 1) return one;
  12746. else if (n == 2 || n == 3 || n == 4) return few;
  12747. else return other;
  12748. };
  12749. Locale.define('cs-CZ', 'Date', {
  12750. months: ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'],
  12751. months_abbr: ['ledna', 'února', 'března', 'dubna', 'května', 'června', 'července', 'srpna', 'září', 'října', 'listopadu', 'prosince'],
  12752. days: ['Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'],
  12753. days_abbr: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
  12754. // Culture's date order: DD.MM.YYYY
  12755. dateOrder: ['date', 'month', 'year'],
  12756. shortDate: '%d.%m.%Y',
  12757. shortTime: '%H:%M',
  12758. AM: 'dop.',
  12759. PM: 'odp.',
  12760. firstDayOfWeek: 1,
  12761. // Date.Extras
  12762. ordinal: '.',
  12763. lessThanMinuteAgo: 'před chvílí',
  12764. minuteAgo: 'přibližně před minutou',
  12765. minutesAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'minutou', 'minutami', 'minutami'); },
  12766. hourAgo: 'přibližně před hodinou',
  12767. hoursAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'hodinou', 'hodinami', 'hodinami'); },
  12768. dayAgo: 'před dnem',
  12769. daysAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'dnem', 'dny', 'dny'); },
  12770. weekAgo: 'před týdnem',
  12771. weeksAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'týdnem', 'týdny', 'týdny'); },
  12772. monthAgo: 'před měsícem',
  12773. monthsAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'měsícem', 'měsíci', 'měsíci'); },
  12774. yearAgo: 'před rokem',
  12775. yearsAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'rokem', 'lety', 'lety'); },
  12776. lessThanMinuteUntil: 'za chvíli',
  12777. minuteUntil: 'přibližně za minutu',
  12778. minutesUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'minutu', 'minuty', 'minut'); },
  12779. hourUntil: 'přibližně za hodinu',
  12780. hoursUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'hodinu', 'hodiny', 'hodin'); },
  12781. dayUntil: 'za den',
  12782. daysUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'den', 'dny', 'dnů'); },
  12783. weekUntil: 'za týden',
  12784. weeksUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'týden', 'týdny', 'týdnů'); },
  12785. monthUntil: 'za měsíc',
  12786. monthsUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'měsíc', 'měsíce', 'měsíců'); },
  12787. yearUntil: 'za rok',
  12788. yearsUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'rok', 'roky', 'let'); }
  12789. });
  12790. })();
  12791. /*
  12792. ---
  12793. name: Locale.cs-CZ.Form.Validator
  12794. description: Form Validator messages for Czech.
  12795. license: MIT-style license
  12796. authors:
  12797. - Jan Černý chemiX
  12798. requires:
  12799. - Locale
  12800. provides: [Locale.cs-CZ.Form.Validator]
  12801. ...
  12802. */
  12803. Locale.define('cs-CZ', 'FormValidator', {
  12804. required: 'Tato položka je povinná.',
  12805. minLength: 'Zadejte prosím alespoň {minLength} znaků (napsáno {length} znaků).',
  12806. maxLength: 'Zadejte prosím méně než {maxLength} znaků (nápsáno {length} znaků).',
  12807. integer: 'Zadejte prosím celé číslo. Desetinná čísla (např. 1.25) nejsou povolena.',
  12808. numeric: 'Zadejte jen číselné hodnoty (tj. "1" nebo "1.1" nebo "-1" nebo "-1.1").',
  12809. digits: 'Zadejte prosím pouze čísla a interpunkční znaménka(například telefonní číslo s pomlčkami nebo tečkami je povoleno).',
  12810. alpha: 'Zadejte prosím pouze písmena (a-z). Mezery nebo jiné znaky nejsou povoleny.',
  12811. alphanum: 'Zadejte prosím pouze písmena (a-z) nebo číslice (0-9). Mezery nebo jiné znaky nejsou povoleny.',
  12812. dateSuchAs: 'Zadejte prosím platné datum jako {date}',
  12813. dateInFormatMDY: 'Zadejte prosím platné datum jako MM / DD / RRRR (tj. "12/31/1999")',
  12814. email: 'Zadejte prosím platnou e-mailovou adresu. Například "fred@domain.com".',
  12815. url: 'Zadejte prosím platnou URL adresu jako http://www.example.com.',
  12816. currencyDollar: 'Zadejte prosím platnou částku. Například $100.00.',
  12817. oneRequired: 'Zadejte prosím alespoň jednu hodnotu pro tyto položky.',
  12818. errorPrefix: 'Chyba: ',
  12819. warningPrefix: 'Upozornění: ',
  12820. // Form.Validator.Extras
  12821. noSpace: 'V této položce nejsou povoleny mezery',
  12822. reqChkByNode: 'Nejsou vybrány žádné položky.',
  12823. requiredChk: 'Tato položka je vyžadována.',
  12824. reqChkByName: 'Prosím vyberte {label}.',
  12825. match: 'Tato položka se musí shodovat s položkou {matchName}',
  12826. startDate: 'datum zahájení',
  12827. endDate: 'datum ukončení',
  12828. currentDate: 'aktuální datum',
  12829. afterDate: 'Datum by mělo být stejné nebo větší než {label}.',
  12830. beforeDate: 'Datum by mělo být stejné nebo menší než {label}.',
  12831. startMonth: 'Vyberte počáteční měsíc.',
  12832. sameMonth: 'Tyto dva datumy musí být ve stejném měsíci - změňte jeden z nich.',
  12833. creditcard: 'Zadané číslo kreditní karty je neplatné. Prosím opravte ho. Bylo zadáno {length} čísel.'
  12834. });
  12835. /*
  12836. ---
  12837. name: Locale.da-DK.Date
  12838. description: Date messages for Danish.
  12839. license: MIT-style license
  12840. authors:
  12841. - Martin Overgaard
  12842. - Henrik Hansen
  12843. requires:
  12844. - Locale
  12845. provides: [Locale.da-DK.Date]
  12846. ...
  12847. */
  12848. Locale.define('da-DK', 'Date', {
  12849. months: ['Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December'],
  12850. months_abbr: ['jan.', 'feb.', 'mar.', 'apr.', 'maj.', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
  12851. days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
  12852. days_abbr: ['søn', 'man', 'tir', 'ons', 'tor', 'fre', 'lør'],
  12853. // Culture's date order: DD-MM-YYYY
  12854. dateOrder: ['date', 'month', 'year'],
  12855. shortDate: '%d-%m-%Y',
  12856. shortTime: '%H:%M',
  12857. AM: 'AM',
  12858. PM: 'PM',
  12859. firstDayOfWeek: 1,
  12860. // Date.Extras
  12861. ordinal: '.',
  12862. lessThanMinuteAgo: 'mindre end et minut siden',
  12863. minuteAgo: 'omkring et minut siden',
  12864. minutesAgo: '{delta} minutter siden',
  12865. hourAgo: 'omkring en time siden',
  12866. hoursAgo: 'omkring {delta} timer siden',
  12867. dayAgo: '1 dag siden',
  12868. daysAgo: '{delta} dage siden',
  12869. weekAgo: '1 uge siden',
  12870. weeksAgo: '{delta} uger siden',
  12871. monthAgo: '1 måned siden',
  12872. monthsAgo: '{delta} måneder siden',
  12873. yearAgo: '1 år siden',
  12874. yearsAgo: '{delta} år siden',
  12875. lessThanMinuteUntil: 'mindre end et minut fra nu',
  12876. minuteUntil: 'omkring et minut fra nu',
  12877. minutesUntil: '{delta} minutter fra nu',
  12878. hourUntil: 'omkring en time fra nu',
  12879. hoursUntil: 'omkring {delta} timer fra nu',
  12880. dayUntil: '1 dag fra nu',
  12881. daysUntil: '{delta} dage fra nu',
  12882. weekUntil: '1 uge fra nu',
  12883. weeksUntil: '{delta} uger fra nu',
  12884. monthUntil: '1 måned fra nu',
  12885. monthsUntil: '{delta} måneder fra nu',
  12886. yearUntil: '1 år fra nu',
  12887. yearsUntil: '{delta} år fra nu'
  12888. });
  12889. /*
  12890. ---
  12891. name: Locale.da-DK.Form.Validator
  12892. description: Form Validator messages for Danish.
  12893. license: MIT-style license
  12894. authors:
  12895. - Martin Overgaard
  12896. requires:
  12897. - Locale
  12898. provides: [Locale.da-DK.Form.Validator]
  12899. ...
  12900. */
  12901. Locale.define('da-DK', 'FormValidator', {
  12902. required: 'Feltet skal udfyldes.',
  12903. minLength: 'Skriv mindst {minLength} tegn (du skrev {length} tegn).',
  12904. maxLength: 'Skriv maksimalt {maxLength} tegn (du skrev {length} tegn).',
  12905. integer: 'Skriv et tal i dette felt. Decimal tal (f.eks. 1.25) er ikke tilladt.',
  12906. numeric: 'Skriv kun tal i dette felt (i.e. "1" eller "1.1" eller "-1" eller "-1.1").',
  12907. digits: 'Skriv kun tal og tegnsætning i dette felt (eksempel, et telefon nummer med bindestreg eller punktum er tilladt).',
  12908. alpha: 'Skriv kun bogstaver (a-z) i dette felt. Mellemrum og andre tegn er ikke tilladt.',
  12909. alphanum: 'Skriv kun bogstaver (a-z) eller tal (0-9) i dette felt. Mellemrum og andre tegn er ikke tilladt.',
  12910. dateSuchAs: 'Skriv en gyldig dato som {date}',
  12911. dateInFormatMDY: 'Skriv dato i formatet DD-MM-YYYY (f.eks. "31-12-1999")',
  12912. email: 'Skriv en gyldig e-mail adresse. F.eks "fred@domain.com".',
  12913. url: 'Skriv en gyldig URL adresse. F.eks "http://www.example.com".',
  12914. currencyDollar: 'Skriv et gldigt beløb. F.eks Kr.100.00 .',
  12915. oneRequired: 'Et eller flere af felterne i denne formular skal udfyldes.',
  12916. errorPrefix: 'Fejl: ',
  12917. warningPrefix: 'Advarsel: ',
  12918. // Form.Validator.Extras
  12919. noSpace: 'Der må ikke benyttes mellemrum i dette felt.',
  12920. reqChkByNode: 'Foretag et valg.',
  12921. requiredChk: 'Dette felt skal udfyldes.',
  12922. reqChkByName: 'Vælg en {label}.',
  12923. match: 'Dette felt skal matche {matchName} feltet',
  12924. startDate: 'start dato',
  12925. endDate: 'slut dato',
  12926. currentDate: 'dags dato',
  12927. afterDate: 'Datoen skal være større end eller lig med {label}.',
  12928. beforeDate: 'Datoen skal være mindre end eller lig med {label}.',
  12929. startMonth: 'Vælg en start måned',
  12930. sameMonth: 'De valgte datoer skal være i samme måned - skift en af dem.'
  12931. });
  12932. /*
  12933. ---
  12934. name: Locale.de-DE.Date
  12935. description: Date messages for German.
  12936. license: MIT-style license
  12937. authors:
  12938. - Christoph Pojer
  12939. - Frank Rossi
  12940. - Ulrich Petri
  12941. - Fabian Beiner
  12942. requires:
  12943. - Locale
  12944. provides: [Locale.de-DE.Date]
  12945. ...
  12946. */
  12947. Locale.define('de-DE', 'Date', {
  12948. months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
  12949. months_abbr: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
  12950. days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
  12951. days_abbr: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
  12952. // Culture's date order: DD.MM.YYYY
  12953. dateOrder: ['date', 'month', 'year'],
  12954. shortDate: '%d.%m.%Y',
  12955. shortTime: '%H:%M',
  12956. AM: 'vormittags',
  12957. PM: 'nachmittags',
  12958. firstDayOfWeek: 1,
  12959. // Date.Extras
  12960. ordinal: '.',
  12961. lessThanMinuteAgo: 'vor weniger als einer Minute',
  12962. minuteAgo: 'vor einer Minute',
  12963. minutesAgo: 'vor {delta} Minuten',
  12964. hourAgo: 'vor einer Stunde',
  12965. hoursAgo: 'vor {delta} Stunden',
  12966. dayAgo: 'vor einem Tag',
  12967. daysAgo: 'vor {delta} Tagen',
  12968. weekAgo: 'vor einer Woche',
  12969. weeksAgo: 'vor {delta} Wochen',
  12970. monthAgo: 'vor einem Monat',
  12971. monthsAgo: 'vor {delta} Monaten',
  12972. yearAgo: 'vor einem Jahr',
  12973. yearsAgo: 'vor {delta} Jahren',
  12974. lessThanMinuteUntil: 'in weniger als einer Minute',
  12975. minuteUntil: 'in einer Minute',
  12976. minutesUntil: 'in {delta} Minuten',
  12977. hourUntil: 'in ca. einer Stunde',
  12978. hoursUntil: 'in ca. {delta} Stunden',
  12979. dayUntil: 'in einem Tag',
  12980. daysUntil: 'in {delta} Tagen',
  12981. weekUntil: 'in einer Woche',
  12982. weeksUntil: 'in {delta} Wochen',
  12983. monthUntil: 'in einem Monat',
  12984. monthsUntil: 'in {delta} Monaten',
  12985. yearUntil: 'in einem Jahr',
  12986. yearsUntil: 'in {delta} Jahren'
  12987. });
  12988. /*
  12989. ---
  12990. name: Locale.de-CH.Date
  12991. description: Date messages for German (Switzerland).
  12992. license: MIT-style license
  12993. authors:
  12994. - Michael van der Weg
  12995. requires:
  12996. - Locale
  12997. - Locale.de-DE.Date
  12998. provides: [Locale.de-CH.Date]
  12999. ...
  13000. */
  13001. Locale.define('de-CH').inherit('de-DE', 'Date');
  13002. /*
  13003. ---
  13004. name: Locale.de-CH.Form.Validator
  13005. description: Form Validator messages for German (Switzerland).
  13006. license: MIT-style license
  13007. authors:
  13008. - Michael van der Weg
  13009. requires:
  13010. - Locale
  13011. provides: [Locale.de-CH.Form.Validator]
  13012. ...
  13013. */
  13014. Locale.define('de-CH', 'FormValidator', {
  13015. required: 'Dieses Feld ist obligatorisch.',
  13016. minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13017. maxLength: 'Bitte geben Sie nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13018. integer: 'Geben Sie bitte eine ganze Zahl ein. Dezimalzahlen (z.B. 1.25) sind nicht erlaubt.',
  13019. 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;).',
  13020. digits: 'Benutzen Sie bitte nur Zahlen und Satzzeichen in diesem Eingabefeld (erlaubt ist z.B. eine Telefonnummer mit Bindestrichen und Punkten).',
  13021. alpha: 'Benutzen Sie bitte nur Buchstaben (a-z) in diesem Feld. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13022. alphanum: 'Benutzen Sie bitte nur Buchstaben (a-z) und Zahlen (0-9) in diesem Eingabefeld. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13023. dateSuchAs: 'Geben Sie bitte ein g&uuml;ltiges Datum ein. Wie zum Beispiel {date}',
  13024. dateInFormatMDY: 'Geben Sie bitte ein g&uuml;ltiges Datum ein. Wie zum Beispiel TT.MM.JJJJ (z.B. &quot;31.12.1999&quot;)',
  13025. email: 'Geben Sie bitte eine g&uuml;ltige E-Mail Adresse ein. Wie zum Beispiel &quot;maria@bernasconi.ch&quot;.',
  13026. url: 'Geben Sie bitte eine g&uuml;ltige URL ein. Wie zum Beispiel http://www.example.com.',
  13027. currencyDollar: 'Geben Sie bitte einen g&uuml;ltigen Betrag in Schweizer Franken ein. Wie zum Beispiel 100.00 CHF .',
  13028. oneRequired: 'Machen Sie f&uuml;r mindestens eines der Eingabefelder einen Eintrag.',
  13029. errorPrefix: 'Fehler: ',
  13030. warningPrefix: 'Warnung: ',
  13031. // Form.Validator.Extras
  13032. noSpace: 'In diesem Eingabefeld darf kein Leerzeichen sein.',
  13033. reqChkByNode: 'Es wurden keine Elemente gew&auml;hlt.',
  13034. requiredChk: 'Dieses Feld ist obligatorisch.',
  13035. reqChkByName: 'Bitte w&auml;hlen Sie ein {label}.',
  13036. match: 'Dieses Eingabefeld muss mit dem Feld {matchName} &uuml;bereinstimmen.',
  13037. startDate: 'Das Anfangsdatum',
  13038. endDate: 'Das Enddatum',
  13039. currentDate: 'Das aktuelle Datum',
  13040. afterDate: 'Das Datum sollte zur gleichen Zeit oder sp&auml;ter sein {label}.',
  13041. beforeDate: 'Das Datum sollte zur gleichen Zeit oder fr&uuml;her sein {label}.',
  13042. startMonth: 'W&auml;hlen Sie bitte einen Anfangsmonat',
  13043. sameMonth: 'Diese zwei Datumsangaben m&uuml;ssen im selben Monat sein - Sie m&uuml;ssen eine von beiden ver&auml;ndern.',
  13044. creditcard: 'Die eingegebene Kreditkartennummer ist ung&uuml;ltig. Bitte &uuml;berpr&uuml;fen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.'
  13045. });
  13046. /*
  13047. ---
  13048. name: Locale.de-CH.Number
  13049. description: Number messages for Switzerland.
  13050. license: MIT-style license
  13051. authors:
  13052. - Kim D. Jeker
  13053. requires:
  13054. - Locale
  13055. - Locale.CH.Number
  13056. provides: [Locale.de-CH.Number]
  13057. ...
  13058. */
  13059. Locale.define('de-CH').inherit('CH', 'Number');
  13060. /*
  13061. ---
  13062. name: Locale.de-DE.Form.Validator
  13063. description: Form Validator messages for German.
  13064. license: MIT-style license
  13065. authors:
  13066. - Frank Rossi
  13067. - Ulrich Petri
  13068. - Fabian Beiner
  13069. requires:
  13070. - Locale
  13071. provides: [Locale.de-DE.Form.Validator]
  13072. ...
  13073. */
  13074. Locale.define('de-DE', 'FormValidator', {
  13075. required: 'Dieses Eingabefeld muss ausgefüllt werden.',
  13076. minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben nur {length} Zeichen eingegeben).',
  13077. maxLength: 'Geben Sie bitte nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13078. integer: 'Geben Sie in diesem Eingabefeld bitte eine ganze Zahl ein. Dezimalzahlen (z.B. "1.25") sind nicht erlaubt.',
  13079. numeric: 'Geben Sie in diesem Eingabefeld bitte nur Zahlenwerte (z.B. "1", "1.1", "-1" oder "-1.1") ein.',
  13080. digits: 'Geben Sie in diesem Eingabefeld bitte nur Zahlen und Satzzeichen ein (z.B. eine Telefonnummer mit Bindestrichen und Punkten ist erlaubt).',
  13081. alpha: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) ein. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13082. alphanum: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) und Zahlen (0-9) ein. Leerzeichen oder andere Zeichen sind nicht erlaubt.',
  13083. dateSuchAs: 'Geben Sie bitte ein gültiges Datum ein (z.B. "{date}").',
  13084. dateInFormatMDY: 'Geben Sie bitte ein gültiges Datum im Format TT.MM.JJJJ ein (z.B. "31.12.1999").',
  13085. email: 'Geben Sie bitte eine gültige E-Mail-Adresse ein (z.B. "max@mustermann.de").',
  13086. url: 'Geben Sie bitte eine gültige URL ein (z.B. "http://www.example.com").',
  13087. currencyDollar: 'Geben Sie bitte einen gültigen Betrag in EURO ein (z.B. 100.00€).',
  13088. oneRequired: 'Bitte füllen Sie mindestens ein Eingabefeld aus.',
  13089. errorPrefix: 'Fehler: ',
  13090. warningPrefix: 'Warnung: ',
  13091. // Form.Validator.Extras
  13092. noSpace: 'Es darf kein Leerzeichen in diesem Eingabefeld sein.',
  13093. reqChkByNode: 'Es wurden keine Elemente gewählt.',
  13094. requiredChk: 'Dieses Feld muss ausgefüllt werden.',
  13095. reqChkByName: 'Bitte wählen Sie ein {label}.',
  13096. match: 'Dieses Eingabefeld muss mit dem {matchName} Eingabefeld übereinstimmen.',
  13097. startDate: 'Das Anfangsdatum',
  13098. endDate: 'Das Enddatum',
  13099. currentDate: 'Das aktuelle Datum',
  13100. afterDate: 'Das Datum sollte zur gleichen Zeit oder später sein als {label}.',
  13101. beforeDate: 'Das Datum sollte zur gleichen Zeit oder früher sein als {label}.',
  13102. startMonth: 'Wählen Sie bitte einen Anfangsmonat',
  13103. sameMonth: 'Diese zwei Datumsangaben müssen im selben Monat sein - Sie müssen eines von beiden verändern.',
  13104. creditcard: 'Die eingegebene Kreditkartennummer ist ungültig. Bitte überprüfen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.'
  13105. });
  13106. /*
  13107. ---
  13108. name: Locale.de-DE.Number
  13109. description: Number messages for German.
  13110. license: MIT-style license
  13111. authors:
  13112. - Christoph Pojer
  13113. requires:
  13114. - Locale
  13115. - Locale.EU.Number
  13116. provides: [Locale.de-DE.Number]
  13117. ...
  13118. */
  13119. Locale.define('de-DE').inherit('EU', 'Number');
  13120. /*
  13121. ---
  13122. name: Locale.el-GR.Date
  13123. description: Date messages for Greek language.
  13124. license: MIT-style license
  13125. authors:
  13126. - Periklis Argiriadis
  13127. requires:
  13128. - Locale
  13129. provides: [Locale.el-GR.Date]
  13130. ...
  13131. */
  13132. Locale.define('el-GR', 'Date', {
  13133. months: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
  13134. months_abbr: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μάι', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
  13135. days: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
  13136. days_abbr: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'],
  13137. // Culture's date order: DD/MM/YYYY
  13138. dateOrder: ['date', 'month', 'year'],
  13139. shortDate: '%d/%m/%Y',
  13140. shortTime: '%I:%M%p',
  13141. AM: 'πμ',
  13142. PM: 'μμ',
  13143. firstDayOfWeek: 1,
  13144. // Date.Extras
  13145. ordinal: function(dayOfMonth){
  13146. // 1st, 2nd, 3rd, etc.
  13147. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ος' : ['ος'][Math.min(dayOfMonth % 10, 4)];
  13148. },
  13149. lessThanMinuteAgo: 'λιγότερο από ένα λεπτό πριν',
  13150. minuteAgo: 'περίπου ένα λεπτό πριν',
  13151. minutesAgo: '{delta} λεπτά πριν',
  13152. hourAgo: 'περίπου μια ώρα πριν',
  13153. hoursAgo: 'περίπου {delta} ώρες πριν',
  13154. dayAgo: '1 ημέρα πριν',
  13155. daysAgo: '{delta} ημέρες πριν',
  13156. weekAgo: '1 εβδομάδα πριν',
  13157. weeksAgo: '{delta} εβδομάδες πριν',
  13158. monthAgo: '1 μήνα πριν',
  13159. monthsAgo: '{delta} μήνες πριν',
  13160. yearAgo: '1 χρόνο πριν',
  13161. yearsAgo: '{delta} χρόνια πριν',
  13162. lessThanMinuteUntil: 'λιγότερο από λεπτό από τώρα',
  13163. minuteUntil: 'περίπου ένα λεπτό από τώρα',
  13164. minutesUntil: '{delta} λεπτά από τώρα',
  13165. hourUntil: 'περίπου μια ώρα από τώρα',
  13166. hoursUntil: 'περίπου {delta} ώρες από τώρα',
  13167. dayUntil: '1 ημέρα από τώρα',
  13168. daysUntil: '{delta} ημέρες από τώρα',
  13169. weekUntil: '1 εβδομάδα από τώρα',
  13170. weeksUntil: '{delta} εβδομάδες από τώρα',
  13171. monthUntil: '1 μήνας από τώρα',
  13172. monthsUntil: '{delta} μήνες από τώρα',
  13173. yearUntil: '1 χρόνος από τώρα',
  13174. yearsUntil: '{delta} χρόνια από τώρα'
  13175. });
  13176. /*
  13177. ---
  13178. name: Locale.el-GR.Form.Validator
  13179. description: Form Validator messages for Greek language.
  13180. license: MIT-style license
  13181. authors:
  13182. - Dimitris Tsironis
  13183. requires:
  13184. - Locale
  13185. provides: [Locale.el-GR.Form.Validator]
  13186. ...
  13187. */
  13188. Locale.define('el-GR', 'FormValidator', {
  13189. required: 'Αυτό το πεδίο είναι απαραίτητο.',
  13190. length: 'Παρακαλούμε, εισάγετε {length} χαρακτήρες (έχετε ήδη εισάγει {elLength} χαρακτήρες).',
  13191. minLength: 'Παρακαλούμε, εισάγετε τουλάχιστον {minLength} χαρακτήρες (έχετε ήδη εισάγε {length} χαρακτήρες).',
  13192. maxlength: 'Παρακαλούμε, εισάγετε εώς {maxlength} χαρακτήρες (έχετε ήδη εισάγε {length} χαρακτήρες).',
  13193. integer: 'Παρακαλούμε, εισάγετε έναν ακέραιο αριθμό σε αυτό το πεδίο. Οι αριθμοί με δεκαδικά ψηφία (π.χ. 1.25) δεν επιτρέπονται.',
  13194. numeric: 'Παρακαλούμε, εισάγετε μόνο αριθμητικές τιμές σε αυτό το πεδίο (π.χ." 1 " ή " 1.1 " ή " -1 " ή " -1.1 " ).',
  13195. digits: 'Παρακαλούμε, χρησιμοποιήστε μόνο αριθμούς και σημεία στίξης σε αυτόν τον τομέα (π.χ. επιτρέπεται αριθμός τηλεφώνου με παύλες ή τελείες).',
  13196. alpha: 'Παρακαλούμε, χρησιμοποιήστε μόνο γράμματα (a-z) σε αυτό το πεδίο. Δεν επιτρέπονται κενά ή άλλοι χαρακτήρες.',
  13197. alphanum: 'Παρακαλούμε, χρησιμοποιήστε μόνο γράμματα (a-z) ή αριθμούς (0-9) σε αυτόν τον τομέα. Δεν επιτρέπονται κενά ή άλλοι χαρακτήρες.',
  13198. dateSuchAs: 'Παρακαλούμε, εισάγετε μια έγκυρη ημερομηνία, όπως {date}',
  13199. dateInFormatMDY: 'Παρακαλώ εισάγετε μια έγκυρη ημερομηνία, όπως ΜΜ/ΗΗ/ΕΕΕΕ (π.χ. "12/31/1999").',
  13200. email: 'Παρακαλούμε, εισάγετε μια έγκυρη διεύθυνση ηλεκτρονικού ταχυδρομείου (π.χ. "fred@domain.com").',
  13201. url: 'Παρακαλούμε, εισάγετε μια έγκυρη URL διεύθυνση, όπως http://www.example.com',
  13202. currencyDollar: 'Παρακαλούμε, εισάγετε ένα έγκυρο ποσό σε δολλάρια (π.χ. $100.00).',
  13203. oneRequired: 'Παρακαλούμε, εισάγετε κάτι για τουλάχιστον ένα από αυτά τα πεδία.',
  13204. errorPrefix: 'Σφάλμα: ',
  13205. warningPrefix: 'Προσοχή: ',
  13206. // Form.Validator.Extras
  13207. noSpace: 'Δεν επιτρέπονται τα κενά σε αυτό το πεδίο.',
  13208. reqChkByNode: 'Δεν έχει επιλεγεί κάποιο αντικείμενο',
  13209. requiredChk: 'Αυτό το πεδίο είναι απαραίτητο.',
  13210. reqChkByName: 'Παρακαλούμε, επιλέξτε μια ετικέτα {label}.',
  13211. match: 'Αυτό το πεδίο πρέπει να ταιριάζει με το πεδίο {matchName}.',
  13212. startDate: 'η ημερομηνία έναρξης',
  13213. endDate: 'η ημερομηνία λήξης',
  13214. currentDate: 'η τρέχουσα ημερομηνία',
  13215. afterDate: 'Η ημερομηνία πρέπει να είναι η ίδια ή μετά από την {label}.',
  13216. beforeDate: 'Η ημερομηνία πρέπει να είναι η ίδια ή πριν από την {label}.',
  13217. startMonth: 'Παρακαλώ επιλέξτε ένα μήνα αρχής.',
  13218. sameMonth: 'Αυτές οι δύο ημερομηνίες πρέπει να έχουν τον ίδιο μήνα - θα πρέπει να αλλάξετε ή το ένα ή το άλλο',
  13219. creditcard: 'Ο αριθμός της πιστωτικής κάρτας δεν είναι έγκυρος. Παρακαλούμε ελέγξτε τον αριθμό και δοκιμάστε ξανά. {length} μήκος ψηφίων.'
  13220. });
  13221. /*
  13222. ---
  13223. name: Locale.en-GB.Date
  13224. description: Date messages for British English.
  13225. license: MIT-style license
  13226. authors:
  13227. - Aaron Newton
  13228. requires:
  13229. - Locale
  13230. - Locale.en-US.Date
  13231. provides: [Locale.en-GB.Date]
  13232. ...
  13233. */
  13234. Locale.define('en-GB', 'Date', {
  13235. // Culture's date order: DD/MM/YYYY
  13236. dateOrder: ['date', 'month', 'year'],
  13237. shortDate: '%d/%m/%Y',
  13238. shortTime: '%H:%M'
  13239. }).inherit('en-US', 'Date');
  13240. /*
  13241. ---
  13242. name: Locale.en-US.Number
  13243. description: Number messages for US English.
  13244. license: MIT-style license
  13245. authors:
  13246. - Arian Stolwijk
  13247. requires:
  13248. - Locale
  13249. provides: [Locale.en-US.Number]
  13250. ...
  13251. */
  13252. Locale.define('en-US', 'Number', {
  13253. decimal: '.',
  13254. group: ',',
  13255. /* Commented properties are the defaults for Number.format
  13256. decimals: 0,
  13257. precision: 0,
  13258. scientific: null,
  13259. prefix: null,
  13260. suffic: null,
  13261. // Negative/Currency/percentage will mixin Number
  13262. negative: {
  13263. prefix: '-'
  13264. },*/
  13265. currency: {
  13266. // decimals: 2,
  13267. prefix: '$ '
  13268. }/*,
  13269. percentage: {
  13270. decimals: 2,
  13271. suffix: '%'
  13272. }*/
  13273. });
  13274. /*
  13275. ---
  13276. name: Locale.es-ES.Date
  13277. description: Date messages for Spanish.
  13278. license: MIT-style license
  13279. authors:
  13280. - Ãlfons Sanchez
  13281. requires:
  13282. - Locale
  13283. provides: [Locale.es-ES.Date]
  13284. ...
  13285. */
  13286. Locale.define('es-ES', 'Date', {
  13287. months: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
  13288. months_abbr: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'],
  13289. days: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
  13290. days_abbr: ['dom', 'lun', 'mar', 'mié', 'juv', 'vie', 'sáb'],
  13291. // Culture's date order: DD/MM/YYYY
  13292. dateOrder: ['date', 'month', 'year'],
  13293. shortDate: '%d/%m/%Y',
  13294. shortTime: '%H:%M',
  13295. AM: 'AM',
  13296. PM: 'PM',
  13297. firstDayOfWeek: 1,
  13298. // Date.Extras
  13299. ordinal: '',
  13300. lessThanMinuteAgo: 'hace menos de un minuto',
  13301. minuteAgo: 'hace un minuto',
  13302. minutesAgo: 'hace {delta} minutos',
  13303. hourAgo: 'hace una hora',
  13304. hoursAgo: 'hace unas {delta} horas',
  13305. dayAgo: 'hace un día',
  13306. daysAgo: 'hace {delta} días',
  13307. weekAgo: 'hace una semana',
  13308. weeksAgo: 'hace unas {delta} semanas',
  13309. monthAgo: 'hace un mes',
  13310. monthsAgo: 'hace {delta} meses',
  13311. yearAgo: 'hace un año',
  13312. yearsAgo: 'hace {delta} años',
  13313. lessThanMinuteUntil: 'menos de un minuto desde ahora',
  13314. minuteUntil: 'un minuto desde ahora',
  13315. minutesUntil: '{delta} minutos desde ahora',
  13316. hourUntil: 'una hora desde ahora',
  13317. hoursUntil: 'unas {delta} horas desde ahora',
  13318. dayUntil: 'un día desde ahora',
  13319. daysUntil: '{delta} días desde ahora',
  13320. weekUntil: 'una semana desde ahora',
  13321. weeksUntil: 'unas {delta} semanas desde ahora',
  13322. monthUntil: 'un mes desde ahora',
  13323. monthsUntil: '{delta} meses desde ahora',
  13324. yearUntil: 'un año desde ahora',
  13325. yearsUntil: '{delta} años desde ahora'
  13326. });
  13327. /*
  13328. ---
  13329. name: Locale.es-AR.Date
  13330. description: Date messages for Spanish (Argentina).
  13331. license: MIT-style license
  13332. authors:
  13333. - Ãlfons Sanchez
  13334. - Diego Massanti
  13335. requires:
  13336. - Locale
  13337. - Locale.es-ES.Date
  13338. provides: [Locale.es-AR.Date]
  13339. ...
  13340. */
  13341. Locale.define('es-AR').inherit('es-ES', 'Date');
  13342. /*
  13343. ---
  13344. name: Locale.es-AR.Form.Validator
  13345. description: Form Validator messages for Spanish (Argentina).
  13346. license: MIT-style license
  13347. authors:
  13348. - Diego Massanti
  13349. requires:
  13350. - Locale
  13351. provides: [Locale.es-AR.Form.Validator]
  13352. ...
  13353. */
  13354. Locale.define('es-AR', 'FormValidator', {
  13355. required: 'Este campo es obligatorio.',
  13356. minLength: 'Por favor ingrese al menos {minLength} caracteres (ha ingresado {length} caracteres).',
  13357. maxLength: 'Por favor no ingrese más de {maxLength} caracteres (ha ingresado {length} caracteres).',
  13358. integer: 'Por favor ingrese un número entero en este campo. Números con decimales (p.e. 1,25) no se permiten.',
  13359. numeric: 'Por favor ingrese solo valores numéricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',
  13360. 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).',
  13361. alpha: 'Por favor use sólo letras (a-z) en este campo. No se permiten espacios ni otros caracteres.',
  13362. alphanum: 'Por favor, usa sólo letras (a-z) o números (0-9) en este campo. No se permiten espacios u otros caracteres.',
  13363. dateSuchAs: 'Por favor ingrese una fecha válida como {date}',
  13364. dateInFormatMDY: 'Por favor ingrese una fecha válida, utulizando el formato DD/MM/YYYY (p.e. "31/12/1999")',
  13365. email: 'Por favor, ingrese una dirección de e-mail válida. Por ejemplo, "fred@dominio.com".',
  13366. url: 'Por favor ingrese una URL válida como http://www.example.com.',
  13367. currencyDollar: 'Por favor ingrese una cantidad válida de pesos. Por ejemplo $100,00 .',
  13368. oneRequired: 'Por favor ingrese algo para por lo menos una de estas entradas.',
  13369. errorPrefix: 'Error: ',
  13370. warningPrefix: 'Advertencia: ',
  13371. // Form.Validator.Extras
  13372. noSpace: 'No se permiten espacios en este campo.',
  13373. reqChkByNode: 'No hay elementos seleccionados.',
  13374. requiredChk: 'Este campo es obligatorio.',
  13375. reqChkByName: 'Por favor selecciona una {label}.',
  13376. match: 'Este campo necesita coincidir con el campo {matchName}',
  13377. startDate: 'la fecha de inicio',
  13378. endDate: 'la fecha de fin',
  13379. currentDate: 'la fecha actual',
  13380. afterDate: 'La fecha debe ser igual o posterior a {label}.',
  13381. beforeDate: 'La fecha debe ser igual o anterior a {label}.',
  13382. startMonth: 'Por favor selecciona un mes de origen',
  13383. sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.'
  13384. });
  13385. /*
  13386. ---
  13387. name: Locale.es-AR.Number
  13388. description: Number messages for es Argentina.
  13389. license: MIT-style license
  13390. authors:
  13391. - Oscar Kuchuk
  13392. requires:
  13393. - Locale
  13394. provides: [Locale.es-AR.Number]
  13395. ...
  13396. */
  13397. Locale.define('es-AR', 'Number', {
  13398. decimal: ',',
  13399. group: '.',
  13400. /* Commented properties are the defaults for Number.format
  13401. decimals: 0,
  13402. precision: 0,
  13403. scientific: null,
  13404. prefix: null,
  13405. suffic: null,
  13406. // Negative/Currency/percentage will mixin Number
  13407. negative: {
  13408. prefix: '-'
  13409. },*/
  13410. currency: {
  13411. decimals: 2,
  13412. prefix: '$ '
  13413. }/*,
  13414. percentage: {
  13415. decimals: 2,
  13416. suffix: '%'
  13417. }*/
  13418. });
  13419. /*
  13420. ---
  13421. name: Locale.es-ES.Form.Validator
  13422. description: Form Validator messages for Spanish.
  13423. license: MIT-style license
  13424. authors:
  13425. - Ãlfons Sanchez
  13426. requires:
  13427. - Locale
  13428. provides: [Locale.es-ES.Form.Validator]
  13429. ...
  13430. */
  13431. Locale.define('es-ES', 'FormValidator', {
  13432. required: 'Este campo es obligatorio.',
  13433. minLength: 'Por favor introduce al menos {minLength} caracteres (has introducido {length} caracteres).',
  13434. maxLength: 'Por favor introduce no m&aacute;s de {maxLength} caracteres (has introducido {length} caracteres).',
  13435. integer: 'Por favor introduce un n&uacute;mero entero en este campo. N&uacute;meros con decimales (p.e. 1,25) no se permiten.',
  13436. numeric: 'Por favor introduce solo valores num&eacute;ricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',
  13437. 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).',
  13438. alpha: 'Por favor usa letras solo (a-z) en este campo. No se admiten espacios ni otros caracteres.',
  13439. alphanum: 'Por favor, usa solo letras (a-z) o n&uacute;meros (0-9) en este campo. No se admiten espacios ni otros caracteres.',
  13440. dateSuchAs: 'Por favor introduce una fecha v&aacute;lida como {date}',
  13441. dateInFormatMDY: 'Por favor introduce una fecha v&aacute;lida como DD/MM/YYYY (p.e. "31/12/1999")',
  13442. email: 'Por favor, introduce una direcci&oacute;n de email v&aacute;lida. Por ejemplo, "fred@domain.com".',
  13443. url: 'Por favor introduce una URL v&aacute;lida como http://www.example.com.',
  13444. currencyDollar: 'Por favor introduce una cantidad v&aacute;lida de €. Por ejemplo €100,00 .',
  13445. oneRequired: 'Por favor introduce algo para por lo menos una de estas entradas.',
  13446. errorPrefix: 'Error: ',
  13447. warningPrefix: 'Aviso: ',
  13448. // Form.Validator.Extras
  13449. noSpace: 'No pueden haber espacios en esta entrada.',
  13450. reqChkByNode: 'No hay elementos seleccionados.',
  13451. requiredChk: 'Este campo es obligatorio.',
  13452. reqChkByName: 'Por favor selecciona una {label}.',
  13453. match: 'Este campo necesita coincidir con el campo {matchName}',
  13454. startDate: 'la fecha de inicio',
  13455. endDate: 'la fecha de fin',
  13456. currentDate: 'la fecha actual',
  13457. afterDate: 'La fecha debe ser igual o posterior a {label}.',
  13458. beforeDate: 'La fecha debe ser igual o anterior a {label}.',
  13459. startMonth: 'Por favor selecciona un mes de origen',
  13460. sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.'
  13461. });
  13462. /*
  13463. ---
  13464. name: Locale.es-VE.Date
  13465. description: Date messages for Spanish (Venezuela).
  13466. license: MIT-style license
  13467. authors:
  13468. - Daniel Barreto
  13469. requires:
  13470. - Locale
  13471. - Locale.es-ES.Date
  13472. provides: [Locale.es-VE.Date]
  13473. ...
  13474. */
  13475. Locale.define('es-VE').inherit('es-ES', 'Date');
  13476. /*
  13477. ---
  13478. name: Locale.es-VE.Form.Validator
  13479. description: Form Validator messages for Spanish (Venezuela).
  13480. license: MIT-style license
  13481. authors:
  13482. - Daniel Barreto
  13483. requires:
  13484. - Locale
  13485. - Locale.es-ES.Form.Validator
  13486. provides: [Locale.es-VE.Form.Validator]
  13487. ...
  13488. */
  13489. Locale.define('es-VE', 'FormValidator', {
  13490. 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.',
  13491. alpha: 'Por favor usa solo letras (a-z) en este campo. No se admiten espacios ni otros caracteres.',
  13492. currencyDollar: 'Por favor introduce una cantidad v&aacute;lida de Bs. Por ejemplo Bs. 100,00 .',
  13493. oneRequired: 'Por favor introduce un valor para por lo menos una de estas entradas.',
  13494. // Form.Validator.Extras
  13495. startDate: 'La fecha de inicio',
  13496. endDate: 'La fecha de fin',
  13497. currentDate: 'La fecha actual'
  13498. }).inherit('es-ES', 'FormValidator');
  13499. /*
  13500. ---
  13501. name: Locale.es-VE.Number
  13502. description: Number messages for Spanish (Venezuela).
  13503. license: MIT-style license
  13504. authors:
  13505. - Daniel Barreto
  13506. requires:
  13507. - Locale
  13508. provides: [Locale.es-VE.Number]
  13509. ...
  13510. */
  13511. Locale.define('es-VE', 'Number', {
  13512. decimal: ',',
  13513. group: '.',
  13514. /*
  13515. decimals: 0,
  13516. precision: 0,
  13517. */
  13518. // Negative/Currency/percentage will mixin Number
  13519. negative: {
  13520. prefix: '-'
  13521. },
  13522. currency: {
  13523. decimals: 2,
  13524. prefix: 'Bs. '
  13525. },
  13526. percentage: {
  13527. decimals: 2,
  13528. suffix: '%'
  13529. }
  13530. });
  13531. /*
  13532. ---
  13533. name: Locale.et-EE.Date
  13534. description: Date messages for Estonian.
  13535. license: MIT-style license
  13536. authors:
  13537. - Kevin Valdek
  13538. requires:
  13539. - Locale
  13540. provides: [Locale.et-EE.Date]
  13541. ...
  13542. */
  13543. Locale.define('et-EE', 'Date', {
  13544. months: ['jaanuar', 'veebruar', 'märts', 'aprill', 'mai', 'juuni', 'juuli', 'august', 'september', 'oktoober', 'november', 'detsember'],
  13545. months_abbr: ['jaan', 'veebr', 'märts', 'apr', 'mai', 'juuni', 'juuli', 'aug', 'sept', 'okt', 'nov', 'dets'],
  13546. days: ['pühapäev', 'esmaspäev', 'teisipäev', 'kolmapäev', 'neljapäev', 'reede', 'laupäev'],
  13547. days_abbr: ['pühap', 'esmasp', 'teisip', 'kolmap', 'neljap', 'reede', 'laup'],
  13548. // Culture's date order: MM.DD.YYYY
  13549. dateOrder: ['month', 'date', 'year'],
  13550. shortDate: '%m.%d.%Y',
  13551. shortTime: '%H:%M',
  13552. AM: 'AM',
  13553. PM: 'PM',
  13554. firstDayOfWeek: 1,
  13555. // Date.Extras
  13556. ordinal: '',
  13557. lessThanMinuteAgo: 'vähem kui minut aega tagasi',
  13558. minuteAgo: 'umbes minut aega tagasi',
  13559. minutesAgo: '{delta} minutit tagasi',
  13560. hourAgo: 'umbes tund aega tagasi',
  13561. hoursAgo: 'umbes {delta} tundi tagasi',
  13562. dayAgo: '1 päev tagasi',
  13563. daysAgo: '{delta} päeva tagasi',
  13564. weekAgo: '1 nädal tagasi',
  13565. weeksAgo: '{delta} nädalat tagasi',
  13566. monthAgo: '1 kuu tagasi',
  13567. monthsAgo: '{delta} kuud tagasi',
  13568. yearAgo: '1 aasta tagasi',
  13569. yearsAgo: '{delta} aastat tagasi',
  13570. lessThanMinuteUntil: 'vähem kui minuti aja pärast',
  13571. minuteUntil: 'umbes minuti aja pärast',
  13572. minutesUntil: '{delta} minuti pärast',
  13573. hourUntil: 'umbes tunni aja pärast',
  13574. hoursUntil: 'umbes {delta} tunni pärast',
  13575. dayUntil: '1 päeva pärast',
  13576. daysUntil: '{delta} päeva pärast',
  13577. weekUntil: '1 nädala pärast',
  13578. weeksUntil: '{delta} nädala pärast',
  13579. monthUntil: '1 kuu pärast',
  13580. monthsUntil: '{delta} kuu pärast',
  13581. yearUntil: '1 aasta pärast',
  13582. yearsUntil: '{delta} aasta pärast'
  13583. });
  13584. /*
  13585. ---
  13586. name: Locale.et-EE.Form.Validator
  13587. description: Form Validator messages for Estonian.
  13588. license: MIT-style license
  13589. authors:
  13590. - Kevin Valdek
  13591. requires:
  13592. - Locale
  13593. provides: [Locale.et-EE.Form.Validator]
  13594. ...
  13595. */
  13596. Locale.define('et-EE', 'FormValidator', {
  13597. required: 'Väli peab olema täidetud.',
  13598. minLength: 'Palun sisestage vähemalt {minLength} tähte (te sisestasite {length} tähte).',
  13599. maxLength: 'Palun ärge sisestage rohkem kui {maxLength} tähte (te sisestasite {length} tähte).',
  13600. integer: 'Palun sisestage väljale täisarv. Kümnendarvud (näiteks 1.25) ei ole lubatud.',
  13601. numeric: 'Palun sisestage ainult numbreid väljale (näiteks "1", "1.1", "-1" või "-1.1").',
  13602. digits: 'Palun kasutage ainult numbreid ja kirjavahemärke (telefoninumbri sisestamisel on lubatud kasutada kriipse ja punkte).',
  13603. alpha: 'Palun kasutage ainult tähti (a-z). Tühikud ja teised sümbolid on keelatud.',
  13604. alphanum: 'Palun kasutage ainult tähti (a-z) või numbreid (0-9). Tühikud ja teised sümbolid on keelatud.',
  13605. dateSuchAs: 'Palun sisestage kehtiv kuupäev kujul {date}',
  13606. dateInFormatMDY: 'Palun sisestage kehtiv kuupäev kujul MM.DD.YYYY (näiteks: "12.31.1999").',
  13607. email: 'Palun sisestage kehtiv e-maili aadress (näiteks: "fred@domain.com").',
  13608. url: 'Palun sisestage kehtiv URL (näiteks: http://www.example.com).',
  13609. currencyDollar: 'Palun sisestage kehtiv $ summa (näiteks: $100.00).',
  13610. oneRequired: 'Palun sisestage midagi vähemalt ühele antud väljadest.',
  13611. errorPrefix: 'Viga: ',
  13612. warningPrefix: 'Hoiatus: ',
  13613. // Form.Validator.Extras
  13614. noSpace: 'Väli ei tohi sisaldada tühikuid.',
  13615. reqChkByNode: 'Ükski väljadest pole valitud.',
  13616. requiredChk: 'Välja täitmine on vajalik.',
  13617. reqChkByName: 'Palun valige üks {label}.',
  13618. match: 'Väli peab sobima {matchName} väljaga',
  13619. startDate: 'algkuupäev',
  13620. endDate: 'lõppkuupäev',
  13621. currentDate: 'praegune kuupäev',
  13622. afterDate: 'Kuupäev peab olema võrdne või pärast {label}.',
  13623. beforeDate: 'Kuupäev peab olema võrdne või enne {label}.',
  13624. startMonth: 'Palun valige algkuupäev.',
  13625. sameMonth: 'Antud kaks kuupäeva peavad olema samas kuus - peate muutma ühte kuupäeva.'
  13626. });
  13627. /*
  13628. ---
  13629. name: Locale.fa.Date
  13630. description: Date messages for Persian.
  13631. license: MIT-style license
  13632. authors:
  13633. - Amir Hossein Hodjaty Pour
  13634. requires:
  13635. - Locale
  13636. provides: [Locale.fa.Date]
  13637. ...
  13638. */
  13639. Locale.define('fa', 'Date', {
  13640. months: ['ژانویه', 'فوریه', 'مارس', 'آپریل', 'مه', 'ژوئن', 'ژوئیه', 'آگوست', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
  13641. months_abbr: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
  13642. days: ['یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
  13643. days_abbr: ['ي', 'د', 'س', 'چ', 'پ', 'ج', 'ش'],
  13644. // Culture's date order: MM/DD/YYYY
  13645. dateOrder: ['month', 'date', 'year'],
  13646. shortDate: '%m/%d/%Y',
  13647. shortTime: '%I:%M%p',
  13648. AM: 'ق.ظ',
  13649. PM: 'ب.ظ',
  13650. // Date.Extras
  13651. ordinal: 'ام',
  13652. lessThanMinuteAgo: 'کمتر از یک دقیقه پیش',
  13653. minuteAgo: 'حدود یک دقیقه پیش',
  13654. minutesAgo: '{delta} دقیقه پیش',
  13655. hourAgo: 'حدود یک ساعت پیش',
  13656. hoursAgo: 'حدود {delta} ساعت پیش',
  13657. dayAgo: '1 روز پیش',
  13658. daysAgo: '{delta} روز پیش',
  13659. weekAgo: '1 هفته پیش',
  13660. weeksAgo: '{delta} هفته پیش',
  13661. monthAgo: '1 ماه پیش',
  13662. monthsAgo: '{delta} ماه پیش',
  13663. yearAgo: '1 سال پیش',
  13664. yearsAgo: '{delta} سال پیش',
  13665. lessThanMinuteUntil: 'کمتر از یک دقیقه از حالا',
  13666. minuteUntil: 'حدود یک دقیقه از حالا',
  13667. minutesUntil: '{delta} دقیقه از حالا',
  13668. hourUntil: 'حدود یک ساعت از حالا',
  13669. hoursUntil: 'حدود {delta} ساعت از حالا',
  13670. dayUntil: '1 روز از حالا',
  13671. daysUntil: '{delta} روز از حالا',
  13672. weekUntil: '1 هفته از حالا',
  13673. weeksUntil: '{delta} هفته از حالا',
  13674. monthUntil: '1 ماه از حالا',
  13675. monthsUntil: '{delta} ماه از حالا',
  13676. yearUntil: '1 سال از حالا',
  13677. yearsUntil: '{delta} سال از حالا'
  13678. });
  13679. /*
  13680. ---
  13681. name: Locale.fa.Form.Validator
  13682. description: Form Validator messages for Persian.
  13683. license: MIT-style license
  13684. authors:
  13685. - Amir Hossein Hodjaty Pour
  13686. requires:
  13687. - Locale
  13688. provides: [Locale.fa.Form.Validator]
  13689. ...
  13690. */
  13691. Locale.define('fa', 'FormValidator', {
  13692. required: 'این فیلد الزامی است.',
  13693. minLength: 'شما باید حداقل {minLength} حرف وارد کنید ({length} حرف وارد کرده اید).',
  13694. maxLength: 'لطفا حداکثر {maxLength} حرف وارد کنید (شما {length} حرف وارد کرده اید).',
  13695. integer: 'لطفا از عدد صحیح استفاده کنید. اعداد اعشاری (مانند 1.25) مجاز نیستند.',
  13696. numeric: 'لطفا فقط داده عددی وارد کنید (مانند "1" یا "1.1" یا "1-" یا "1.1-").',
  13697. digits: 'لطفا فقط از اعداد و علامتها در این فیلد استفاده کنید (برای مثال شماره تلفن با خط تیره و نقطه قابل قبول است).',
  13698. alpha: 'لطفا فقط از حروف الفباء برای این بخش استفاده کنید. کاراکترهای دیگر و فاصله مجاز نیستند.',
  13699. alphanum: 'لطفا فقط از حروف الفباء و اعداد در این بخش استفاده کنید. کاراکترهای دیگر و فاصله مجاز نیستند.',
  13700. dateSuchAs: 'لطفا یک تاریخ معتبر مانند {date} وارد کنید.',
  13701. dateInFormatMDY: 'لطفا یک تاریخ معتبر به شکل MM/DD/YYYY وارد کنید (مانند "12/31/1999").',
  13702. email: 'لطفا یک آدرس ایمیل معتبر وارد کنید. برای مثال "fred@domain.com".',
  13703. url: 'لطفا یک URL معتبر مانند http://www.example.com وارد کنید.',
  13704. currencyDollar: 'لطفا یک محدوده معتبر برای این بخش وارد کنید مانند 100.00$ .',
  13705. oneRequired: 'لطفا حداقل یکی از فیلدها را پر کنید.',
  13706. errorPrefix: 'خطا: ',
  13707. warningPrefix: 'هشدار: ',
  13708. // Form.Validator.Extras
  13709. noSpace: 'استفاده از فاصله در این بخش مجاز نیست.',
  13710. reqChkByNode: 'موردی انتخاب نشده است.',
  13711. requiredChk: 'این فیلد الزامی است.',
  13712. reqChkByName: 'لطفا یک {label} را انتخاب کنید.',
  13713. match: 'این فیلد باید با فیلد {matchName} مطابقت داشته باشد.',
  13714. startDate: 'تاریخ شروع',
  13715. endDate: 'تاریخ پایان',
  13716. currentDate: 'تاریخ کنونی',
  13717. afterDate: 'تاریخ میبایست برابر یا بعد از {label} باشد',
  13718. beforeDate: 'تاریخ میبایست برابر یا قبل از {label} باشد',
  13719. startMonth: 'لطفا ماه شروع را انتخاب کنید',
  13720. sameMonth: 'این دو تاریخ باید در یک ماه باشند - شما باید یکی یا هر دو را تغییر دهید.',
  13721. creditcard: 'شماره کارت اعتباری که وارد کرده اید معتبر نیست. لطفا شماره را بررسی کنید و مجددا تلاش کنید. {length} رقم وارد شده است.'
  13722. });
  13723. /*
  13724. ---
  13725. name: Locale.fi-FI.Date
  13726. description: Date messages for Finnish.
  13727. license: MIT-style license
  13728. authors:
  13729. - ksel
  13730. requires:
  13731. - Locale
  13732. provides: [Locale.fi-FI.Date]
  13733. ...
  13734. */
  13735. Locale.define('fi-FI', 'Date', {
  13736. // NOTE: months and days are not capitalized in finnish
  13737. months: ['tammikuu', 'helmikuu', 'maaliskuu', 'huhtikuu', 'toukokuu', 'kesäkuu', 'heinäkuu', 'elokuu', 'syyskuu', 'lokakuu', 'marraskuu', 'joulukuu'],
  13738. // these abbreviations are really not much used in finnish because they obviously won't abbreviate very much. ;)
  13739. // NOTE: sometimes one can see forms such as "tammi", "helmi", etc. but that is not proper finnish.
  13740. months_abbr: ['tammik.', 'helmik.', 'maalisk.', 'huhtik.', 'toukok.', 'kesäk.', 'heinäk.', 'elok.', 'syysk.', 'lokak.', 'marrask.', 'jouluk.'],
  13741. days: ['sunnuntai', 'maanantai', 'tiistai', 'keskiviikko', 'torstai', 'perjantai', 'lauantai'],
  13742. days_abbr: ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'],
  13743. // Culture's date order: DD/MM/YYYY
  13744. dateOrder: ['date', 'month', 'year'],
  13745. shortDate: '%d.%m.%Y',
  13746. shortTime: '%H:%M',
  13747. AM: 'AM',
  13748. PM: 'PM',
  13749. firstDayOfWeek: 1,
  13750. // Date.Extras
  13751. ordinal: '.',
  13752. lessThanMinuteAgo: 'vajaa minuutti sitten',
  13753. minuteAgo: 'noin minuutti sitten',
  13754. minutesAgo: '{delta} minuuttia sitten',
  13755. hourAgo: 'noin tunti sitten',
  13756. hoursAgo: 'noin {delta} tuntia sitten',
  13757. dayAgo: 'päivä sitten',
  13758. daysAgo: '{delta} päivää sitten',
  13759. weekAgo: 'viikko sitten',
  13760. weeksAgo: '{delta} viikkoa sitten',
  13761. monthAgo: 'kuukausi sitten',
  13762. monthsAgo: '{delta} kuukautta sitten',
  13763. yearAgo: 'vuosi sitten',
  13764. yearsAgo: '{delta} vuotta sitten',
  13765. lessThanMinuteUntil: 'vajaan minuutin kuluttua',
  13766. minuteUntil: 'noin minuutin kuluttua',
  13767. minutesUntil: '{delta} minuutin kuluttua',
  13768. hourUntil: 'noin tunnin kuluttua',
  13769. hoursUntil: 'noin {delta} tunnin kuluttua',
  13770. dayUntil: 'päivän kuluttua',
  13771. daysUntil: '{delta} päivän kuluttua',
  13772. weekUntil: 'viikon kuluttua',
  13773. weeksUntil: '{delta} viikon kuluttua',
  13774. monthUntil: 'kuukauden kuluttua',
  13775. monthsUntil: '{delta} kuukauden kuluttua',
  13776. yearUntil: 'vuoden kuluttua',
  13777. yearsUntil: '{delta} vuoden kuluttua'
  13778. });
  13779. /*
  13780. ---
  13781. name: Locale.fi-FI.Form.Validator
  13782. description: Form Validator messages for Finnish.
  13783. license: MIT-style license
  13784. authors:
  13785. - ksel
  13786. requires:
  13787. - Locale
  13788. provides: [Locale.fi-FI.Form.Validator]
  13789. ...
  13790. */
  13791. Locale.define('fi-FI', 'FormValidator', {
  13792. required: 'Tämä kenttä on pakollinen.',
  13793. minLength: 'Ole hyvä ja anna vähintään {minLength} merkkiä (annoit {length} merkkiä).',
  13794. maxLength: 'Älä anna enempää kuin {maxLength} merkkiä (annoit {length} merkkiä).',
  13795. integer: 'Ole hyvä ja anna kokonaisluku. Luvut, joissa on desimaaleja (esim. 1.25) eivät ole sallittuja.',
  13796. numeric: 'Anna tähän kenttään lukuarvo (kuten "1" tai "1.1" tai "-1" tai "-1.1").',
  13797. 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).',
  13798. alpha: 'Anna tähän kenttään vain kirjaimia (a-z). Välilyönnit tai muut merkit eivät ole sallittuja.',
  13799. 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.',
  13800. dateSuchAs: 'Ole hyvä ja anna kelvollinen päivmäärä, kuten esimerkiksi {date}',
  13801. dateInFormatMDY: 'Ole hyvä ja anna kelvollinen päivämäärä muodossa pp/kk/vvvv (kuten "12/31/1999")',
  13802. email: 'Ole hyvä ja anna kelvollinen sähköpostiosoite (kuten esimerkiksi "matti@meikalainen.com").',
  13803. url: 'Ole hyvä ja anna kelvollinen URL, kuten esimerkiksi http://www.example.com.',
  13804. currencyDollar: 'Ole hyvä ja anna kelvollinen eurosumma (kuten esimerkiksi 100,00 EUR) .',
  13805. oneRequired: 'Ole hyvä ja syötä jotakin ainakin johonkin näistä kentistä.',
  13806. errorPrefix: 'Virhe: ',
  13807. warningPrefix: 'Varoitus: ',
  13808. // Form.Validator.Extras
  13809. noSpace: 'Tässä syötteessä ei voi olla välilyöntejä',
  13810. reqChkByNode: 'Ei valintoja.',
  13811. requiredChk: 'Tämä kenttä on pakollinen.',
  13812. reqChkByName: 'Ole hyvä ja valitse {label}.',
  13813. match: 'Tämän kentän tulee vastata kenttää {matchName}',
  13814. startDate: 'alkupäivämäärä',
  13815. endDate: 'loppupäivämäärä',
  13816. currentDate: 'nykyinen päivämäärä',
  13817. afterDate: 'Päivämäärän tulisi olla sama tai myöhäisempi ajankohta kuin {label}.',
  13818. beforeDate: 'Päivämäärän tulisi olla sama tai aikaisempi ajankohta kuin {label}.',
  13819. startMonth: 'Ole hyvä ja valitse aloituskuukausi',
  13820. sameMonth: 'Näiden kahden päivämäärän tulee olla saman kuun sisällä -- sinun pitää muuttaa jompaa kumpaa.',
  13821. creditcard: 'Annettu luottokortin numero ei kelpaa. Ole hyvä ja tarkista numero sekä yritä uudelleen. {length} numeroa syötetty.'
  13822. });
  13823. /*
  13824. ---
  13825. name: Locale.fi-FI.Number
  13826. description: Finnish number messages
  13827. license: MIT-style license
  13828. authors:
  13829. - ksel
  13830. requires:
  13831. - Locale
  13832. - Locale.EU.Number
  13833. provides: [Locale.fi-FI.Number]
  13834. ...
  13835. */
  13836. Locale.define('fi-FI', 'Number', {
  13837. group: ' ' // grouped by space
  13838. }).inherit('EU', 'Number');
  13839. /*
  13840. ---
  13841. name: Locale.fr-FR.Date
  13842. description: Date messages for French.
  13843. license: MIT-style license
  13844. authors:
  13845. - Nicolas Sorosac
  13846. - Antoine Abt
  13847. requires:
  13848. - Locale
  13849. provides: [Locale.fr-FR.Date]
  13850. ...
  13851. */
  13852. Locale.define('fr-FR', 'Date', {
  13853. months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
  13854. months_abbr: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
  13855. days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
  13856. days_abbr: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
  13857. // Culture's date order: DD/MM/YYYY
  13858. dateOrder: ['date', 'month', 'year'],
  13859. shortDate: '%d/%m/%Y',
  13860. shortTime: '%H:%M',
  13861. AM: 'AM',
  13862. PM: 'PM',
  13863. firstDayOfWeek: 1,
  13864. // Date.Extras
  13865. ordinal: function(dayOfMonth){
  13866. return (dayOfMonth > 1) ? '' : 'er';
  13867. },
  13868. lessThanMinuteAgo: "il y a moins d'une minute",
  13869. minuteAgo: 'il y a une minute',
  13870. minutesAgo: 'il y a {delta} minutes',
  13871. hourAgo: 'il y a une heure',
  13872. hoursAgo: 'il y a {delta} heures',
  13873. dayAgo: 'il y a un jour',
  13874. daysAgo: 'il y a {delta} jours',
  13875. weekAgo: 'il y a une semaine',
  13876. weeksAgo: 'il y a {delta} semaines',
  13877. monthAgo: 'il y a 1 mois',
  13878. monthsAgo: 'il y a {delta} mois',
  13879. yearthAgo: 'il y a 1 an',
  13880. yearsAgo: 'il y a {delta} ans',
  13881. lessThanMinuteUntil: "dans moins d'une minute",
  13882. minuteUntil: 'dans une minute',
  13883. minutesUntil: 'dans {delta} minutes',
  13884. hourUntil: 'dans une heure',
  13885. hoursUntil: 'dans {delta} heures',
  13886. dayUntil: 'dans un jour',
  13887. daysUntil: 'dans {delta} jours',
  13888. weekUntil: 'dans 1 semaine',
  13889. weeksUntil: 'dans {delta} semaines',
  13890. monthUntil: 'dans 1 mois',
  13891. monthsUntil: 'dans {delta} mois',
  13892. yearUntil: 'dans 1 an',
  13893. yearsUntil: 'dans {delta} ans'
  13894. });
  13895. /*
  13896. ---
  13897. name: Locale.fr-FR.Form.Validator
  13898. description: Form Validator messages for French.
  13899. license: MIT-style license
  13900. authors:
  13901. - Miquel Hudin
  13902. - Nicolas Sorosac
  13903. requires:
  13904. - Locale
  13905. provides: [Locale.fr-FR.Form.Validator]
  13906. ...
  13907. */
  13908. /*eslint mootools-whitespace:0*/
  13909. Locale.define('fr-FR', 'FormValidator', {
  13910. required: 'Ce champ est obligatoire.',
  13911. length: 'Veuillez saisir {length} caract&egrave;re(s) (vous avez saisi {elLength} caract&egrave;re(s)',
  13912. minLength: 'Veuillez saisir un minimum de {minLength} caract&egrave;re(s) (vous avez saisi {length} caract&egrave;re(s)).',
  13913. maxLength: 'Veuillez saisir un maximum de {maxLength} caract&egrave;re(s) (vous avez saisi {length} caract&egrave;re(s)).',
  13914. integer: 'Veuillez saisir un nombre entier dans ce champ. Les nombres d&eacute;cimaux (ex : "1,25") ne sont pas autoris&eacute;s.',
  13915. numeric: 'Veuillez saisir uniquement des chiffres dans ce champ (ex : "1" ou "1,1" ou "-1" ou "-1,1").',
  13916. 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;).",
  13917. alpha: 'Veuillez saisir uniquement des lettres (a-z) dans ce champ. Les espaces ou autres caract&egrave;res ne sont pas autoris&eacute;s.',
  13918. 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.',
  13919. dateSuchAs: 'Veuillez saisir une date correcte comme {date}',
  13920. dateInFormatMDY: 'Veuillez saisir une date correcte, au format JJ/MM/AAAA (ex : "31/11/1999").',
  13921. email: 'Veuillez saisir une adresse de courrier &eacute;lectronique. Par exemple "fred@domaine.com".',
  13922. url: 'Veuillez saisir une URL, comme http://www.exemple.com.',
  13923. currencyDollar: 'Veuillez saisir une quantit&eacute; correcte. Par exemple 100,00&euro;.',
  13924. oneRequired: 'Veuillez s&eacute;lectionner au moins une de ces options.',
  13925. errorPrefix: 'Erreur : ',
  13926. warningPrefix: 'Attention : ',
  13927. // Form.Validator.Extras
  13928. noSpace: "Ce champ n'accepte pas les espaces.",
  13929. reqChkByNode: "Aucun &eacute;l&eacute;ment n'est s&eacute;lectionn&eacute;.",
  13930. requiredChk: 'Ce champ est obligatoire.',
  13931. reqChkByName: 'Veuillez s&eacute;lectionner un(e) {label}.',
  13932. match: 'Ce champ doit correspondre avec le champ {matchName}.',
  13933. startDate: 'date de d&eacute;but',
  13934. endDate: 'date de fin',
  13935. currentDate: 'date actuelle',
  13936. afterDate: 'La date doit &ecirc;tre identique ou post&eacute;rieure &agrave; {label}.',
  13937. beforeDate: 'La date doit &ecirc;tre identique ou ant&eacute;rieure &agrave; {label}.',
  13938. startMonth: 'Veuillez s&eacute;lectionner un mois de d&eacute;but.',
  13939. sameMonth: 'Ces deux dates doivent &ecirc;tre dans le m&ecirc;me mois - vous devez en modifier une.',
  13940. 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).'
  13941. });
  13942. /*
  13943. ---
  13944. name: Locale.fr-FR.Number
  13945. description: Number messages for French.
  13946. license: MIT-style license
  13947. authors:
  13948. - Arian Stolwijk
  13949. - sv1l
  13950. requires:
  13951. - Locale
  13952. - Locale.EU.Number
  13953. provides: [Locale.fr-FR.Number]
  13954. ...
  13955. */
  13956. Locale.define('fr-FR', 'Number', {
  13957. group: ' ' // In fr-FR localization, group character is a blank space
  13958. }).inherit('EU', 'Number');
  13959. /*
  13960. ---
  13961. name: Locale.he-IL.Date
  13962. description: Date messages for Hebrew.
  13963. license: MIT-style license
  13964. authors:
  13965. - Elad Ossadon
  13966. requires:
  13967. - Locale
  13968. provides: [Locale.he-IL.Date]
  13969. ...
  13970. */
  13971. Locale.define('he-IL', 'Date', {
  13972. months: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
  13973. months_abbr: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
  13974. days: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'],
  13975. days_abbr: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'],
  13976. // Culture's date order: MM/DD/YYYY
  13977. dateOrder: ['date', 'month', 'year'],
  13978. shortDate: '%d/%m/%Y',
  13979. shortTime: '%H:%M',
  13980. AM: 'AM',
  13981. PM: 'PM',
  13982. firstDayOfWeek: 0,
  13983. // Date.Extras
  13984. ordinal: '',
  13985. lessThanMinuteAgo: 'לפני פחות מדקה',
  13986. minuteAgo: 'לפני כדקה',
  13987. minutesAgo: 'לפני {delta} דקות',
  13988. hourAgo: 'לפני כשעה',
  13989. hoursAgo: 'לפני {delta} שעות',
  13990. dayAgo: 'לפני יום',
  13991. daysAgo: 'לפני {delta} ימים',
  13992. weekAgo: 'לפני שבוע',
  13993. weeksAgo: 'לפני {delta} שבועות',
  13994. monthAgo: 'לפני חודש',
  13995. monthsAgo: 'לפני {delta} חודשים',
  13996. yearAgo: 'לפני שנה',
  13997. yearsAgo: 'לפני {delta} שנים',
  13998. lessThanMinuteUntil: 'בעוד פחות מדקה',
  13999. minuteUntil: 'בעוד כדקה',
  14000. minutesUntil: 'בעוד {delta} דקות',
  14001. hourUntil: 'בעוד כשעה',
  14002. hoursUntil: 'בעוד {delta} שעות',
  14003. dayUntil: 'בעוד יום',
  14004. daysUntil: 'בעוד {delta} ימים',
  14005. weekUntil: 'בעוד שבוע',
  14006. weeksUntil: 'בעוד {delta} שבועות',
  14007. monthUntil: 'בעוד חודש',
  14008. monthsUntil: 'בעוד {delta} חודשים',
  14009. yearUntil: 'בעוד שנה',
  14010. yearsUntil: 'בעוד {delta} שנים'
  14011. });
  14012. /*
  14013. ---
  14014. name: Locale.he-IL.Form.Validator
  14015. description: Form Validator messages for Hebrew.
  14016. license: MIT-style license
  14017. authors:
  14018. - Elad Ossadon
  14019. requires:
  14020. - Locale
  14021. provides: [Locale.he-IL.Form.Validator]
  14022. ...
  14023. */
  14024. Locale.define('he-IL', 'FormValidator', {
  14025. required: 'נא למלא שדה זה.',
  14026. minLength: 'נא להזין לפחות {minLength} תווים (הזנת {length} תווים).',
  14027. maxLength: 'נא להזין עד {maxLength} תווים (הזנת {length} תווים).',
  14028. integer: 'נא להזין מספר שלם לשדה זה. מספרים עשרוניים (כמו 1.25) אינם חוקיים.',
  14029. numeric: 'נא להזין ערך מספרי בלבד בשדה זה (כמו "1", "1.1", "-1" או "-1.1").',
  14030. digits: 'נא להזין רק ספרות וסימני הפרדה בשדה זה (למשל, מספר טלפון עם מקפים או נקודות הוא חוקי).',
  14031. alpha: 'נא להזין רק אותיות באנגלית (a-z) בשדה זה. רווחים או תווים אחרים אינם חוקיים.',
  14032. alphanum: 'נא להזין רק אותריות באנגלית (a-z) או ספרות (0-9) בשדה זה. אווחרים או תווים אחרים אינם חוקיים.',
  14033. dateSuchAs: 'נא להזין תאריך חוקי, כמו {date}',
  14034. dateInFormatMDY: 'נא להזין תאריך חוקי בפורמט MM/DD/YYYY (כמו "12/31/1999")',
  14035. email: 'נא להזין כתובת אימייל חוקית. לדוגמה: "fred@domain.com".',
  14036. url: 'נא להזין כתובת אתר חוקית, כמו http://www.example.com.',
  14037. currencyDollar: 'נא להזין סכום דולרי חוקי. לדוגמה $100.00.',
  14038. oneRequired: 'נא לבחור לפחות בשדה אחד.',
  14039. errorPrefix: 'שגיאה: ',
  14040. warningPrefix: 'אזהרה: ',
  14041. // Form.Validator.Extras
  14042. noSpace: 'אין להזין רווחים בשדה זה.',
  14043. reqChkByNode: 'נא לבחור אחת מהאפשרויות.',
  14044. requiredChk: 'שדה זה נדרש.',
  14045. reqChkByName: 'נא לבחור {label}.',
  14046. match: 'שדה זה צריך להתאים לשדה {matchName}',
  14047. startDate: 'תאריך ההתחלה',
  14048. endDate: 'תאריך הסיום',
  14049. currentDate: 'התאריך הנוכחי',
  14050. afterDate: 'התאריך צריך להיות זהה או אחרי {label}.',
  14051. beforeDate: 'התאריך צריך להיות זהה או לפני {label}.',
  14052. startMonth: 'נא לבחור חודש התחלה',
  14053. sameMonth: 'שני תאריכים אלה צריכים להיות באותו חודש - נא לשנות אחד התאריכים.',
  14054. creditcard: 'מספר כרטיס האשראי שהוזן אינו חוקי. נא לבדוק שנית. הוזנו {length} ספרות.'
  14055. });
  14056. /*
  14057. ---
  14058. name: Locale.he-IL.Number
  14059. description: Number messages for Hebrew.
  14060. license: MIT-style license
  14061. authors:
  14062. - Elad Ossadon
  14063. requires:
  14064. - Locale
  14065. provides: [Locale.he-IL.Number]
  14066. ...
  14067. */
  14068. Locale.define('he-IL', 'Number', {
  14069. decimal: '.',
  14070. group: ',',
  14071. currency: {
  14072. suffix: ' ₪'
  14073. }
  14074. });
  14075. /*
  14076. ---
  14077. name: Locale.hu-HU.Date
  14078. description: Date messages for Hungarian.
  14079. license: MIT-style license
  14080. authors:
  14081. - Zsolt Szegheő
  14082. requires:
  14083. - Locale
  14084. provides: [Locale.hu-HU.Date]
  14085. ...
  14086. */
  14087. Locale.define('hu-HU', 'Date', {
  14088. months: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június', 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],
  14089. months_abbr: ['jan.', 'febr.', 'márc.', 'ápr.', 'máj.', 'jún.', 'júl.', 'aug.', 'szept.', 'okt.', 'nov.', 'dec.'],
  14090. days: ['Vasárnap', 'Hétfő', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
  14091. days_abbr: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
  14092. // Culture's date order: YYYY.MM.DD.
  14093. dateOrder: ['year', 'month', 'date'],
  14094. shortDate: '%Y.%m.%d.',
  14095. shortTime: '%I:%M',
  14096. AM: 'de.',
  14097. PM: 'du.',
  14098. firstDayOfWeek: 1,
  14099. // Date.Extras
  14100. ordinal: '.',
  14101. lessThanMinuteAgo: 'alig egy perce',
  14102. minuteAgo: 'egy perce',
  14103. minutesAgo: '{delta} perce',
  14104. hourAgo: 'egy órája',
  14105. hoursAgo: '{delta} órája',
  14106. dayAgo: '1 napja',
  14107. daysAgo: '{delta} napja',
  14108. weekAgo: '1 hete',
  14109. weeksAgo: '{delta} hete',
  14110. monthAgo: '1 hónapja',
  14111. monthsAgo: '{delta} hónapja',
  14112. yearAgo: '1 éve',
  14113. yearsAgo: '{delta} éve',
  14114. lessThanMinuteUntil: 'alig egy perc múlva',
  14115. minuteUntil: 'egy perc múlva',
  14116. minutesUntil: '{delta} perc múlva',
  14117. hourUntil: 'egy óra múlva',
  14118. hoursUntil: '{delta} óra múlva',
  14119. dayUntil: '1 nap múlva',
  14120. daysUntil: '{delta} nap múlva',
  14121. weekUntil: '1 hét múlva',
  14122. weeksUntil: '{delta} hét múlva',
  14123. monthUntil: '1 hónap múlva',
  14124. monthsUntil: '{delta} hónap múlva',
  14125. yearUntil: '1 év múlva',
  14126. yearsUntil: '{delta} év múlva'
  14127. });
  14128. /*
  14129. ---
  14130. name: Locale.hu-HU.Form.Validator
  14131. description: Form Validator messages for Hungarian.
  14132. license: MIT-style license
  14133. authors:
  14134. - Zsolt Szegheő
  14135. requires:
  14136. - Locale
  14137. provides: [Locale.hu-HU.Form.Validator]
  14138. ...
  14139. */
  14140. /*eslint mootools-whitespace:0*/
  14141. Locale.define('hu-HU', 'FormValidator', {
  14142. required: 'A mező kitöltése kötelező.',
  14143. minLength: 'Legalább {minLength} karakter megadása szükséges (megadva {length} karakter).',
  14144. maxLength: 'Legfeljebb {maxLength} karakter megadása lehetséges (megadva {length} karakter).',
  14145. integer: 'Egész szám megadása szükséges. A tizedesjegyek (pl. 1.25) nem engedélyezettek.',
  14146. numeric: 'Szám megadása szükséges (pl. "1" vagy "1.1" vagy "-1" vagy "-1.1").',
  14147. digits: 'Csak számok és írásjelek megadása lehetséges (pl. telefonszám kötőjelek és/vagy perjelekkel).',
  14148. alpha: 'Csak betűk (a-z) megadása lehetséges. Szóköz és egyéb karakterek nem engedélyezettek.',
  14149. 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.',
  14150. dateSuchAs: 'Valós dátum megadása szükséges (pl. {date}).',
  14151. dateInFormatMDY: 'Valós dátum megadása szükséges ÉÉÉÉ.HH.NN. formában. (pl. "1999.12.31.")',
  14152. email: 'Valós e-mail cím megadása szükséges (pl. "fred@domain.hu").',
  14153. url: 'Valós URL megadása szükséges (pl. http://www.example.com).',
  14154. currencyDollar: 'Valós pénzösszeg megadása szükséges (pl. 100.00 Ft.).',
  14155. oneRequired: 'Az alábbi mezők legalább egyikének kitöltése kötelező.',
  14156. errorPrefix: 'Hiba: ',
  14157. warningPrefix: 'Figyelem: ',
  14158. // Form.Validator.Extras
  14159. noSpace: 'A mező nem tartalmazhat szóközöket.',
  14160. reqChkByNode: 'Nincs egyetlen kijelölt elem sem.',
  14161. requiredChk: 'A mező kitöltése kötelező.',
  14162. reqChkByName: 'Egy {label} kiválasztása szükséges.',
  14163. match: 'A mezőnek egyeznie kell a(z) {matchName} mezővel.',
  14164. startDate: 'a kezdet dátuma',
  14165. endDate: 'a vég dátuma',
  14166. currentDate: 'jelenlegi dátum',
  14167. afterDate: 'A dátum nem lehet kisebb, mint {label}.',
  14168. beforeDate: 'A dátum nem lehet nagyobb, mint {label}.',
  14169. startMonth: 'Kezdeti hónap megadása szükséges.',
  14170. sameMonth: 'A két dátumnak ugyanazon hónapban kell lennie.',
  14171. creditcard: 'A megadott bankkártyaszám nem valódi (megadva {length} számjegy).'
  14172. });
  14173. /*
  14174. ---
  14175. name: Locale.it-IT.Date
  14176. description: Date messages for Italian.
  14177. license: MIT-style license.
  14178. authors:
  14179. - Andrea Novero
  14180. - Valerio Proietti
  14181. requires:
  14182. - Locale
  14183. provides: [Locale.it-IT.Date]
  14184. ...
  14185. */
  14186. Locale.define('it-IT', 'Date', {
  14187. months: ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'],
  14188. months_abbr: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
  14189. days: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
  14190. days_abbr: ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'],
  14191. // Culture's date order: DD/MM/YYYY
  14192. dateOrder: ['date', 'month', 'year'],
  14193. shortDate: '%d/%m/%Y',
  14194. shortTime: '%H.%M',
  14195. AM: 'AM',
  14196. PM: 'PM',
  14197. firstDayOfWeek: 1,
  14198. // Date.Extras
  14199. ordinal: 'º',
  14200. lessThanMinuteAgo: 'meno di un minuto fa',
  14201. minuteAgo: 'circa un minuto fa',
  14202. minutesAgo: 'circa {delta} minuti fa',
  14203. hourAgo: "circa un'ora fa",
  14204. hoursAgo: 'circa {delta} ore fa',
  14205. dayAgo: 'circa 1 giorno fa',
  14206. daysAgo: 'circa {delta} giorni fa',
  14207. weekAgo: 'una settimana fa',
  14208. weeksAgo: '{delta} settimane fa',
  14209. monthAgo: 'un mese fa',
  14210. monthsAgo: '{delta} mesi fa',
  14211. yearAgo: 'un anno fa',
  14212. yearsAgo: '{delta} anni fa',
  14213. lessThanMinuteUntil: 'tra meno di un minuto',
  14214. minuteUntil: 'tra circa un minuto',
  14215. minutesUntil: 'tra circa {delta} minuti',
  14216. hourUntil: "tra circa un'ora",
  14217. hoursUntil: 'tra circa {delta} ore',
  14218. dayUntil: 'tra circa un giorno',
  14219. daysUntil: 'tra circa {delta} giorni',
  14220. weekUntil: 'tra una settimana',
  14221. weeksUntil: 'tra {delta} settimane',
  14222. monthUntil: 'tra un mese',
  14223. monthsUntil: 'tra {delta} mesi',
  14224. yearUntil: 'tra un anno',
  14225. yearsUntil: 'tra {delta} anni'
  14226. });
  14227. /*
  14228. ---
  14229. name: Locale.it-IT.Form.Validator
  14230. description: Form Validator messages for Italian.
  14231. license: MIT-style license
  14232. authors:
  14233. - Leonardo Laureti
  14234. - Andrea Novero
  14235. requires:
  14236. - Locale
  14237. provides: [Locale.it-IT.Form.Validator]
  14238. ...
  14239. */
  14240. /*eslint mootools-whitespace:0*/
  14241. Locale.define('it-IT', 'FormValidator', {
  14242. required: 'Il campo &egrave; obbligatorio.',
  14243. minLength: 'Inserire almeno {minLength} caratteri (ne sono stati inseriti {length}).',
  14244. maxLength: 'Inserire al massimo {maxLength} caratteri (ne sono stati inseriti {length}).',
  14245. integer: 'Inserire un numero intero. Non sono consentiti decimali (es.: 1.25).',
  14246. numeric: 'Inserire solo valori numerici (es.: "1" oppure "1.1" oppure "-1" oppure "-1.1").',
  14247. digits: 'Inserire solo numeri e caratteri di punteggiatura. Per esempio &egrave; consentito un numero telefonico con trattini o punti.',
  14248. alpha: 'Inserire solo lettere (a-z). Non sono consentiti spazi o altri caratteri.',
  14249. alphanum: 'Inserire solo lettere (a-z) o numeri (0-9). Non sono consentiti spazi o altri caratteri.',
  14250. dateSuchAs: 'Inserire una data valida del tipo {date}',
  14251. dateInFormatMDY: 'Inserire una data valida nel formato MM/GG/AAAA (es.: "12/31/1999")',
  14252. email: 'Inserire un indirizzo email valido. Per esempio "nome@dominio.com".',
  14253. url: 'Inserire un indirizzo valido. Per esempio "http://www.example.com".',
  14254. currencyDollar: 'Inserire un importo valido. Per esempio "$100.00".',
  14255. oneRequired: 'Completare almeno uno dei campi richiesti.',
  14256. errorPrefix: 'Errore: ',
  14257. warningPrefix: 'Attenzione: ',
  14258. // Form.Validator.Extras
  14259. noSpace: 'Non sono consentiti spazi.',
  14260. reqChkByNode: 'Nessuna voce selezionata.',
  14261. requiredChk: 'Il campo &egrave; obbligatorio.',
  14262. reqChkByName: 'Selezionare un(a) {label}.',
  14263. match: 'Il valore deve corrispondere al campo {matchName}',
  14264. startDate: "data d'inizio",
  14265. endDate: 'data di fine',
  14266. currentDate: 'data attuale',
  14267. afterDate: 'La data deve corrispondere o essere successiva al {label}.',
  14268. beforeDate: 'La data deve corrispondere o essere precedente al {label}.',
  14269. startMonth: "Selezionare un mese d'inizio",
  14270. sameMonth: 'Le due date devono essere dello stesso mese - occorre modificarne una.'
  14271. });
  14272. /*
  14273. ---
  14274. name: Locale.ja-JP.Date
  14275. description: Date messages for Japanese.
  14276. license: MIT-style license
  14277. authors:
  14278. - Noritaka Horio
  14279. requires:
  14280. - Locale
  14281. provides: [Locale.ja-JP.Date]
  14282. ...
  14283. */
  14284. Locale.define('ja-JP', 'Date', {
  14285. months: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  14286. months_abbr: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  14287. days: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
  14288. days_abbr: ['日', '月', '火', '水', '木', '金', '土'],
  14289. // Culture's date order: YYYY/MM/DD
  14290. dateOrder: ['year', 'month', 'date'],
  14291. shortDate: '%Y/%m/%d',
  14292. shortTime: '%H:%M',
  14293. AM: '午前',
  14294. PM: '午後',
  14295. firstDayOfWeek: 0,
  14296. // Date.Extras
  14297. ordinal: '',
  14298. lessThanMinuteAgo: '1分以内前',
  14299. minuteAgo: '約1分前',
  14300. minutesAgo: '約{delta}分前',
  14301. hourAgo: '約1時間前',
  14302. hoursAgo: '約{delta}時間前',
  14303. dayAgo: '1日前',
  14304. daysAgo: '{delta}日前',
  14305. weekAgo: '1週間前',
  14306. weeksAgo: '{delta}週間前',
  14307. monthAgo: '1ヶ月前',
  14308. monthsAgo: '{delta}ヶ月前',
  14309. yearAgo: '1年前',
  14310. yearsAgo: '{delta}年前',
  14311. lessThanMinuteUntil: '今から約1分以内',
  14312. minuteUntil: '今から約1分',
  14313. minutesUntil: '今から約{delta}分',
  14314. hourUntil: '今から約1時間',
  14315. hoursUntil: '今から約{delta}時間',
  14316. dayUntil: '今から1日間',
  14317. daysUntil: '今から{delta}日間',
  14318. weekUntil: '今から1週間',
  14319. weeksUntil: '今から{delta}週間',
  14320. monthUntil: '今から1ヶ月',
  14321. monthsUntil: '今から{delta}ヶ月',
  14322. yearUntil: '今から1年',
  14323. yearsUntil: '今から{delta}年'
  14324. });
  14325. /*
  14326. ---
  14327. name: Locale.ja-JP.Form.Validator
  14328. description: Form Validator messages for Japanese.
  14329. license: MIT-style license
  14330. authors:
  14331. - Noritaka Horio
  14332. requires:
  14333. - Locale
  14334. provides: [Locale.ja-JP.Form.Validator]
  14335. ...
  14336. */
  14337. Locale.define('ja-JP', 'FormValidator', {
  14338. required: '入力は必須です。',
  14339. minLength: '入力文字数は{minLength}以上にしてください。({length}文字)',
  14340. maxLength: '入力文字数は{maxLength}以下にしてください。({length}文字)',
  14341. integer: '整数を入力してください。',
  14342. numeric: '入力できるのは数値だけです。(例: "1", "1.1", "-1", "-1.1"....)',
  14343. digits: '入力できるのは数値と句読記号です。 (例: -や+を含む電話番号など).',
  14344. alpha: '入力できるのは半角英字だけです。それ以外の文字は入力できません。',
  14345. alphanum: '入力できるのは半角英数字だけです。それ以外の文字は入力できません。',
  14346. dateSuchAs: '有効な日付を入力してください。{date}',
  14347. dateInFormatMDY: '日付の書式に誤りがあります。YYYY/MM/DD (i.e. "1999/12/31")',
  14348. email: 'メールアドレスに誤りがあります。',
  14349. url: 'URLアドレスに誤りがあります。',
  14350. currencyDollar: '金額に誤りがあります。',
  14351. oneRequired: 'ひとつ以上入力してください。',
  14352. errorPrefix: 'エラー: ',
  14353. warningPrefix: '警告: ',
  14354. // FormValidator.Extras
  14355. noSpace: 'スペースは入力できません。',
  14356. reqChkByNode: '選択されていません。',
  14357. requiredChk: 'この項目は必須です。',
  14358. reqChkByName: '{label}を選択してください。',
  14359. match: '{matchName}が入力されている場合必須です。',
  14360. startDate: '開始日',
  14361. endDate: '終了日',
  14362. currentDate: '今日',
  14363. afterDate: '{label}以降の日付にしてください。',
  14364. beforeDate: '{label}以前の日付にしてください。',
  14365. startMonth: '開始月を選択してください。',
  14366. sameMonth: '日付が同一です。どちらかを変更してください。'
  14367. });
  14368. /*
  14369. ---
  14370. name: Locale.ja-JP.Number
  14371. description: Number messages for Japanese.
  14372. license: MIT-style license
  14373. authors:
  14374. - Noritaka Horio
  14375. requires:
  14376. - Locale
  14377. provides: [Locale.ja-JP.Number]
  14378. ...
  14379. */
  14380. Locale.define('ja-JP', 'Number', {
  14381. decimal: '.',
  14382. group: ',',
  14383. currency: {
  14384. decimals: 0,
  14385. prefix: '\\'
  14386. }
  14387. });
  14388. /*
  14389. ---
  14390. name: Locale.nl-NL.Date
  14391. description: Date messages for Dutch.
  14392. license: MIT-style license
  14393. authors:
  14394. - Lennart Pilon
  14395. - Tim Wienk
  14396. requires:
  14397. - Locale
  14398. provides: [Locale.nl-NL.Date]
  14399. ...
  14400. */
  14401. Locale.define('nl-NL', 'Date', {
  14402. months: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
  14403. months_abbr: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
  14404. days: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
  14405. days_abbr: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
  14406. // Culture's date order: DD-MM-YYYY
  14407. dateOrder: ['date', 'month', 'year'],
  14408. shortDate: '%d-%m-%Y',
  14409. shortTime: '%H:%M',
  14410. AM: 'AM',
  14411. PM: 'PM',
  14412. firstDayOfWeek: 1,
  14413. // Date.Extras
  14414. ordinal: 'e',
  14415. lessThanMinuteAgo: 'minder dan een minuut geleden',
  14416. minuteAgo: 'ongeveer een minuut geleden',
  14417. minutesAgo: '{delta} minuten geleden',
  14418. hourAgo: 'ongeveer een uur geleden',
  14419. hoursAgo: 'ongeveer {delta} uur geleden',
  14420. dayAgo: 'een dag geleden',
  14421. daysAgo: '{delta} dagen geleden',
  14422. weekAgo: 'een week geleden',
  14423. weeksAgo: '{delta} weken geleden',
  14424. monthAgo: 'een maand geleden',
  14425. monthsAgo: '{delta} maanden geleden',
  14426. yearAgo: 'een jaar geleden',
  14427. yearsAgo: '{delta} jaar geleden',
  14428. lessThanMinuteUntil: 'over minder dan een minuut',
  14429. minuteUntil: 'over ongeveer een minuut',
  14430. minutesUntil: 'over {delta} minuten',
  14431. hourUntil: 'over ongeveer een uur',
  14432. hoursUntil: 'over {delta} uur',
  14433. dayUntil: 'over ongeveer een dag',
  14434. daysUntil: 'over {delta} dagen',
  14435. weekUntil: 'over een week',
  14436. weeksUntil: 'over {delta} weken',
  14437. monthUntil: 'over een maand',
  14438. monthsUntil: 'over {delta} maanden',
  14439. yearUntil: 'over een jaar',
  14440. yearsUntil: 'over {delta} jaar'
  14441. });
  14442. /*
  14443. ---
  14444. name: Locale.nl-NL.Form.Validator
  14445. description: Form Validator messages for Dutch.
  14446. license: MIT-style license
  14447. authors:
  14448. - Lennart Pilon
  14449. - Arian Stolwijk
  14450. - Tim Wienk
  14451. requires:
  14452. - Locale
  14453. provides: [Locale.nl-NL.Form.Validator]
  14454. ...
  14455. */
  14456. Locale.define('nl-NL', 'FormValidator', {
  14457. required: 'Dit veld is verplicht.',
  14458. length: 'Vul precies {length} karakters in (je hebt {elLength} karakters ingevoerd).',
  14459. minLength: 'Vul minimaal {minLength} karakters in (je hebt {length} karakters ingevoerd).',
  14460. maxLength: 'Vul niet meer dan {maxLength} karakters in (je hebt {length} karakters ingevoerd).',
  14461. integer: 'Vul een getal in. Getallen met decimalen (bijvoorbeeld 1.25) zijn niet toegestaan.',
  14462. numeric: 'Vul alleen numerieke waarden in (bijvoorbeeld "1" of "1.1" of "-1" of "-1.1").',
  14463. digits: 'Vul alleen nummers en leestekens in (bijvoorbeeld een telefoonnummer met streepjes is toegestaan).',
  14464. alpha: 'Vul alleen letters in (a-z). Spaties en andere karakters zijn niet toegestaan.',
  14465. alphanum: 'Vul alleen letters (a-z) of nummers (0-9) in. Spaties en andere karakters zijn niet toegestaan.',
  14466. dateSuchAs: 'Vul een geldige datum in, zoals {date}',
  14467. dateInFormatMDY: 'Vul een geldige datum, in het formaat MM/DD/YYYY (bijvoorbeeld "12/31/1999")',
  14468. email: 'Vul een geldig e-mailadres in. Bijvoorbeeld "fred@domein.nl".',
  14469. url: 'Vul een geldige URL in, zoals http://www.example.com.',
  14470. currencyDollar: 'Vul een geldig $ bedrag in. Bijvoorbeeld $100.00 .',
  14471. oneRequired: 'Vul iets in bij in ieder geval een van deze velden.',
  14472. warningPrefix: 'Waarschuwing: ',
  14473. errorPrefix: 'Fout: ',
  14474. // Form.Validator.Extras
  14475. noSpace: 'Spaties zijn niet toegestaan in dit veld.',
  14476. reqChkByNode: 'Er zijn geen items geselecteerd.',
  14477. requiredChk: 'Dit veld is verplicht.',
  14478. reqChkByName: 'Selecteer een {label}.',
  14479. match: 'Dit veld moet overeen komen met het {matchName} veld',
  14480. startDate: 'de begin datum',
  14481. endDate: 'de eind datum',
  14482. currentDate: 'de huidige datum',
  14483. afterDate: 'De datum moet hetzelfde of na {label} zijn.',
  14484. beforeDate: 'De datum moet hetzelfde of voor {label} zijn.',
  14485. startMonth: 'Selecteer een begin maand',
  14486. sameMonth: 'Deze twee data moeten in dezelfde maand zijn - u moet een van beide aanpassen.',
  14487. creditcard: 'Het ingevulde creditcardnummer is niet geldig. Controleer het nummer en probeer opnieuw. {length} getallen ingevuld.'
  14488. });
  14489. /*
  14490. ---
  14491. name: Locale.nl-NL.Number
  14492. description: Number messages for Dutch.
  14493. license: MIT-style license
  14494. authors:
  14495. - Arian Stolwijk
  14496. requires:
  14497. - Locale
  14498. - Locale.EU.Number
  14499. provides: [Locale.nl-NL.Number]
  14500. ...
  14501. */
  14502. Locale.define('nl-NL').inherit('EU', 'Number');
  14503. /*
  14504. ---
  14505. name: Locale.no-NO.Date
  14506. description: Date messages for Norwegian.
  14507. license: MIT-style license
  14508. authors:
  14509. - Espen 'Rexxars' Hovlandsdal
  14510. - Ole Tøsse Kolvik
  14511. requires:
  14512. - Locale
  14513. provides: [Locale.no-NO.Date]
  14514. ...
  14515. */
  14516. Locale.define('no-NO', 'Date', {
  14517. months: ['Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'],
  14518. months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
  14519. days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
  14520. days_abbr: ['Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'],
  14521. // Culture's date order: DD.MM.YYYY
  14522. dateOrder: ['date', 'month', 'year'],
  14523. shortDate: '%d.%m.%Y',
  14524. shortTime: '%H:%M',
  14525. AM: 'AM',
  14526. PM: 'PM',
  14527. firstDayOfWeek: 1,
  14528. lessThanMinuteAgo: 'mindre enn et minutt siden',
  14529. minuteAgo: 'omtrent et minutt siden',
  14530. minutesAgo: '{delta} minutter siden',
  14531. hourAgo: 'omtrent en time siden',
  14532. hoursAgo: 'omtrent {delta} timer siden',
  14533. dayAgo: '{delta} dag siden',
  14534. daysAgo: '{delta} dager siden',
  14535. weekAgo: 'en uke siden',
  14536. weeksAgo: '{delta} uker siden',
  14537. monthAgo: 'en måned siden',
  14538. monthsAgo: '{delta} måneder siden',
  14539. yearAgo: 'ett år siden',
  14540. yearsAgo: '{delta} år siden',
  14541. lessThanMinuteUntil: 'mindre enn et minutt til',
  14542. minuteUntil: 'omtrent et minutt til',
  14543. minutesUntil: '{delta} minutter til',
  14544. hourUntil: 'omtrent en time til',
  14545. hoursUntil: 'omtrent {delta} timer til',
  14546. dayUntil: 'en dag til',
  14547. daysUntil: '{delta} dager til',
  14548. weekUntil: 'en uke til',
  14549. weeksUntil: '{delta} uker til',
  14550. monthUntil: 'en måned til',
  14551. monthsUntil: '{delta} måneder til',
  14552. yearUntil: 'et år til',
  14553. yearsUntil: '{delta} år til'
  14554. });
  14555. /*
  14556. ---
  14557. name: Locale.no-NO.Form.Validator
  14558. description: Form Validator messages for Norwegian.
  14559. license: MIT-style license
  14560. authors:
  14561. - Aaron Newton
  14562. - Espen 'Rexxars' Hovlandsdal
  14563. - Ole Tøsse Kolvik
  14564. requires:
  14565. - Locale
  14566. provides: [Locale.no-NO.Form.Validator]
  14567. ...
  14568. */
  14569. Locale.define('no-NO', 'FormValidator', {
  14570. required: 'Dette feltet er påkrevd.',
  14571. length: 'Skriv inn {length} tegn (du skrev {elLength} tegn)',
  14572. minLength: 'Skriv inn minst {minLength} tegn (du skrev {length} tegn).',
  14573. maxLength: 'Ikke skriv mer enn {maxLength} tegn (du skrev {length} tegn).',
  14574. integer: 'Skriv inn et tall i dette feltet. Tall med desimaler (f.eks. 1,25) er ikke tillat.',
  14575. numeric: 'Skriv kun inn numeriske verdier i dette feltet (f.eks. "1", "1.1", "-1" eller "-1.1").',
  14576. digits: 'Skriv kun nummer og skilletegn i dette feltet.',
  14577. alpha: 'Skriv kun bokstaver (a-å) i dette feltet. Ingen mellomrom eller andre tegn er tillat.',
  14578. alphanum: 'Skriv kun bokstaver (a-å) eller nummer (0-9) i dette feltet. Ingen mellomrom eller andre tegn er tillat.',
  14579. dateSuchAs: 'Skriv inn en gyldig dato, som f.eks. {date}',
  14580. dateInFormatMDY: 'Skriv inn en gyldig dato, f.eks. DD/MM/YYYY ("31/12/1999")',
  14581. email: 'Skriv inn en gyldig epost-adresse. F.eks. "ola.nordmann@example.com".',
  14582. url: 'Skriv inn en gyldig URL, f.eks. http://www.example.com.',
  14583. currencyDollar: 'Skriv inn et gyldig beløp. F.eks. 100,00.',
  14584. oneRequired: 'Minst ett av disse feltene må fylles ut.',
  14585. errorPrefix: 'Feil: ',
  14586. warningPrefix: 'Advarsel: ',
  14587. // Form.Validator.Extras
  14588. noSpace: 'Mellomrom er ikke tillatt i dette feltet.',
  14589. reqChkByNode: 'Ingen objekter er valgt.',
  14590. requiredChk: 'Dette feltet er påkrevd.',
  14591. reqChkByName: 'Velg en {label}.',
  14592. match: 'Dette feltet må være lik {matchName}',
  14593. startDate: 'startdato',
  14594. endDate: 'sluttdato',
  14595. currentDate: 'dagens dato',
  14596. afterDate: 'Datoen må være den samme som eller etter {label}.',
  14597. beforeDate: 'Datoen må være den samme som eller før {label}.',
  14598. startMonth: 'Velg en startmåned',
  14599. sameMonth: 'Datoene må være i den samme måneden - velg den ene eller den andre.',
  14600. creditcard: 'Kortnummeret du skrev inn er ikke gyldig. Prøv igjen. Du skrev {length} siffer.'
  14601. });
  14602. /*
  14603. ---
  14604. name: Locale.no-NO.Number
  14605. description: Number messages for Norwegian.
  14606. license: MIT-style license
  14607. authors:
  14608. - Arian Stolwijk
  14609. - Martin Lundgren
  14610. - Ole T�sse Kolvik
  14611. requires:
  14612. - Locale
  14613. - Locale.EU.Number
  14614. provides: [Locale.no-NO.Number]
  14615. ...
  14616. */
  14617. Locale.define('no-NO', 'Number', {
  14618. currency: {
  14619. prefix: 'NOK '
  14620. }
  14621. }).inherit('EU', 'Number');
  14622. /*
  14623. ---
  14624. name: Locale.pl-PL.Date
  14625. description: Date messages for Polish.
  14626. license: MIT-style license
  14627. authors:
  14628. - Oskar Krawczyk
  14629. requires:
  14630. - Locale
  14631. provides: [Locale.pl-PL.Date]
  14632. ...
  14633. */
  14634. Locale.define('pl-PL', 'Date', {
  14635. months: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'],
  14636. months_abbr: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
  14637. days: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],
  14638. days_abbr: ['niedz.', 'pon.', 'wt.', 'śr.', 'czw.', 'pt.', 'sob.'],
  14639. // Culture's date order: YYYY-MM-DD
  14640. dateOrder: ['year', 'month', 'date'],
  14641. shortDate: '%Y-%m-%d',
  14642. shortTime: '%H:%M',
  14643. AM: 'nad ranem',
  14644. PM: 'po południu',
  14645. firstDayOfWeek: 1,
  14646. // Date.Extras
  14647. ordinal: function(dayOfMonth){
  14648. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ty' : ['ty', 'szy', 'gi', 'ci', 'ty'][Math.min(dayOfMonth % 10, 4)];
  14649. },
  14650. lessThanMinuteAgo: 'mniej niż minute temu',
  14651. minuteAgo: 'około minutę temu',
  14652. minutesAgo: '{delta} minut temu',
  14653. hourAgo: 'około godzinę temu',
  14654. hoursAgo: 'około {delta} godzin temu',
  14655. dayAgo: 'Wczoraj',
  14656. daysAgo: '{delta} dni temu',
  14657. lessThanMinuteUntil: 'za niecałą minutę',
  14658. minuteUntil: 'za około minutę',
  14659. minutesUntil: 'za {delta} minut',
  14660. hourUntil: 'za około godzinę',
  14661. hoursUntil: 'za około {delta} godzin',
  14662. dayUntil: 'za 1 dzień',
  14663. daysUntil: 'za {delta} dni'
  14664. });
  14665. /*
  14666. ---
  14667. name: Locale.pl-PL.Form.Validator
  14668. description: Form Validator messages for Polish.
  14669. license: MIT-style license
  14670. authors:
  14671. - Oskar Krawczyk
  14672. requires:
  14673. - Locale
  14674. provides: [Locale.pl-PL.Form.Validator]
  14675. ...
  14676. */
  14677. Locale.define('pl-PL', 'FormValidator', {
  14678. required: 'To pole jest wymagane.',
  14679. minLength: 'Wymagane jest przynajmniej {minLength} znaków (wpisanych zostało tylko {length}).',
  14680. maxLength: 'Dozwolone jest nie więcej niż {maxLength} znaków (wpisanych zostało {length})',
  14681. integer: 'To pole wymaga liczb całych. Liczby dziesiętne (np. 1.25) są niedozwolone.',
  14682. numeric: 'Prosimy używać tylko numerycznych wartości w tym polu (np. "1", "1.1", "-1" lub "-1.1").',
  14683. digits: 'Prosimy używać liczb oraz zankow punktuacyjnych w typ polu (dla przykładu, przy numerze telefonu myślniki i kropki są dozwolone).',
  14684. alpha: 'Prosimy używać tylko liter (a-z) w tym polu. Spacje oraz inne znaki są niedozwolone.',
  14685. alphanum: 'Prosimy używać tylko liter (a-z) lub liczb (0-9) w tym polu. Spacje oraz inne znaki są niedozwolone.',
  14686. dateSuchAs: 'Prosimy podać prawidłową datę w formacie: {date}',
  14687. dateInFormatMDY: 'Prosimy podać poprawną date w formacie DD.MM.RRRR (i.e. "12.01.2009")',
  14688. email: 'Prosimy podać prawidłowy adres e-mail, np. "jan@domena.pl".',
  14689. url: 'Prosimy podać prawidłowy adres URL, np. http://www.example.com.',
  14690. currencyDollar: 'Prosimy podać prawidłową sumę w PLN. Dla przykładu: 100.00 PLN.',
  14691. oneRequired: 'Prosimy wypełnić chociaż jedno z pól.',
  14692. errorPrefix: 'Błąd: ',
  14693. warningPrefix: 'Uwaga: ',
  14694. // Form.Validator.Extras
  14695. noSpace: 'W tym polu nie mogą znajdować się spacje.',
  14696. reqChkByNode: 'Brak zaznaczonych elementów.',
  14697. requiredChk: 'To pole jest wymagane.',
  14698. reqChkByName: 'Prosimy wybrać z {label}.',
  14699. match: 'To pole musi być takie samo jak {matchName}',
  14700. startDate: 'data początkowa',
  14701. endDate: 'data końcowa',
  14702. currentDate: 'aktualna data',
  14703. afterDate: 'Podana data poinna być taka sama lub po {label}.',
  14704. beforeDate: 'Podana data poinna być taka sama lub przed {label}.',
  14705. startMonth: 'Prosimy wybrać początkowy miesiąc.',
  14706. sameMonth: 'Te dwie daty muszą być w zakresie tego samego miesiąca - wymagana jest zmiana któregoś z pól.'
  14707. });
  14708. /*
  14709. ---
  14710. name: Locale.pt-PT.Date
  14711. description: Date messages for Portuguese.
  14712. license: MIT-style license
  14713. authors:
  14714. - Fabio Miranda Costa
  14715. requires:
  14716. - Locale
  14717. provides: [Locale.pt-PT.Date]
  14718. ...
  14719. */
  14720. Locale.define('pt-PT', 'Date', {
  14721. months: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
  14722. months_abbr: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
  14723. days: ['Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'],
  14724. days_abbr: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
  14725. // Culture's date order: DD-MM-YYYY
  14726. dateOrder: ['date', 'month', 'year'],
  14727. shortDate: '%d-%m-%Y',
  14728. shortTime: '%H:%M',
  14729. AM: 'AM',
  14730. PM: 'PM',
  14731. firstDayOfWeek: 1,
  14732. // Date.Extras
  14733. ordinal: 'º',
  14734. lessThanMinuteAgo: 'há menos de um minuto',
  14735. minuteAgo: 'há cerca de um minuto',
  14736. minutesAgo: 'há {delta} minutos',
  14737. hourAgo: 'há cerca de uma hora',
  14738. hoursAgo: 'há cerca de {delta} horas',
  14739. dayAgo: 'há um dia',
  14740. daysAgo: 'há {delta} dias',
  14741. weekAgo: 'há uma semana',
  14742. weeksAgo: 'há {delta} semanas',
  14743. monthAgo: 'há um mês',
  14744. monthsAgo: 'há {delta} meses',
  14745. yearAgo: 'há um ano',
  14746. yearsAgo: 'há {delta} anos',
  14747. lessThanMinuteUntil: 'em menos de um minuto',
  14748. minuteUntil: 'em um minuto',
  14749. minutesUntil: 'em {delta} minutos',
  14750. hourUntil: 'em uma hora',
  14751. hoursUntil: 'em {delta} horas',
  14752. dayUntil: 'em um dia',
  14753. daysUntil: 'em {delta} dias',
  14754. weekUntil: 'em uma semana',
  14755. weeksUntil: 'em {delta} semanas',
  14756. monthUntil: 'em um mês',
  14757. monthsUntil: 'em {delta} meses',
  14758. yearUntil: 'em um ano',
  14759. yearsUntil: 'em {delta} anos'
  14760. });
  14761. /*
  14762. ---
  14763. name: Locale.pt-BR.Date
  14764. description: Date messages for Portuguese (Brazil).
  14765. license: MIT-style license
  14766. authors:
  14767. - Fabio Miranda Costa
  14768. requires:
  14769. - Locale
  14770. - Locale.pt-PT.Date
  14771. provides: [Locale.pt-BR.Date]
  14772. ...
  14773. */
  14774. Locale.define('pt-BR', 'Date', {
  14775. // Culture's date order: DD/MM/YYYY
  14776. shortDate: '%d/%m/%Y'
  14777. }).inherit('pt-PT', 'Date');
  14778. /*
  14779. ---
  14780. name: Locale.pt-BR.Form.Validator
  14781. description: Form Validator messages for Portuguese (Brazil).
  14782. license: MIT-style license
  14783. authors:
  14784. - Fábio Miranda Costa
  14785. requires:
  14786. - Locale
  14787. provides: [Locale.pt-BR.Form.Validator]
  14788. ...
  14789. */
  14790. Locale.define('pt-BR', 'FormValidator', {
  14791. required: 'Este campo é obrigatório.',
  14792. minLength: 'Digite pelo menos {minLength} caracteres (tamanho atual: {length}).',
  14793. maxLength: 'Não digite mais de {maxLength} caracteres (tamanho atual: {length}).',
  14794. integer: 'Por favor digite apenas um número inteiro neste campo. Não são permitidos números decimais (por exemplo, 1,25).',
  14795. numeric: 'Por favor digite apenas valores numéricos neste campo (por exemplo, "1" ou "1.1" ou "-1" ou "-1,1").',
  14796. 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).',
  14797. alpha: 'Por favor use somente letras (a-z). Espaço e outros caracteres não são permitidos.',
  14798. alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Espaço e outros caracteres não são permitidos.',
  14799. dateSuchAs: 'Digite uma data válida, como {date}',
  14800. dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (por exemplo, "31/12/1999")',
  14801. email: 'Digite um endereço de email válido. Por exemplo "nome@dominio.com".',
  14802. url: 'Digite uma URL válida. Exemplo: http://www.example.com.',
  14803. currencyDollar: 'Digite um valor em dinheiro válido. Exemplo: R$100,00 .',
  14804. oneRequired: 'Digite algo para pelo menos um desses campos.',
  14805. errorPrefix: 'Erro: ',
  14806. warningPrefix: 'Aviso: ',
  14807. // Form.Validator.Extras
  14808. noSpace: 'Não é possível digitar espaços neste campo.',
  14809. reqChkByNode: 'Não foi selecionado nenhum item.',
  14810. requiredChk: 'Este campo é obrigatório.',
  14811. reqChkByName: 'Por favor digite um {label}.',
  14812. match: 'Este campo deve ser igual ao campo {matchName}.',
  14813. startDate: 'a data inicial',
  14814. endDate: 'a data final',
  14815. currentDate: 'a data atual',
  14816. afterDate: 'A data deve ser igual ou posterior a {label}.',
  14817. beforeDate: 'A data deve ser igual ou anterior a {label}.',
  14818. startMonth: 'Por favor selecione uma data inicial.',
  14819. sameMonth: 'Estas duas datas devem ter o mesmo mês - você deve modificar uma das duas.',
  14820. 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.'
  14821. });
  14822. /*
  14823. ---
  14824. name: Locale.pt-BR.Number
  14825. description: Number messages for PT Brazilian.
  14826. license: MIT-style license
  14827. authors:
  14828. - Arian Stolwijk
  14829. - Danillo César
  14830. requires:
  14831. - Locale
  14832. provides: [Locale.pt-BR.Number]
  14833. ...
  14834. */
  14835. Locale.define('pt-BR', 'Number', {
  14836. decimal: ',',
  14837. group: '.',
  14838. currency: {
  14839. prefix: 'R$ '
  14840. }
  14841. });
  14842. /*
  14843. ---
  14844. name: Locale.pt-PT.Form.Validator
  14845. description: Form Validator messages for Portuguese.
  14846. license: MIT-style license
  14847. authors:
  14848. - Miquel Hudin
  14849. requires:
  14850. - Locale
  14851. provides: [Locale.pt-PT.Form.Validator]
  14852. ...
  14853. */
  14854. Locale.define('pt-PT', 'FormValidator', {
  14855. required: 'Este campo é necessário.',
  14856. minLength: 'Digite pelo menos{minLength} caracteres (comprimento {length} caracteres).',
  14857. maxLength: 'Não insira mais de {maxLength} caracteres (comprimento {length} caracteres).',
  14858. integer: 'Digite um número inteiro neste domínio. Com números decimais (por exemplo, 1,25), não são permitidas.',
  14859. numeric: 'Digite apenas valores numéricos neste domínio (p.ex., "1" ou "1.1" ou "-1" ou "-1,1").',
  14860. 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).',
  14861. alpha: 'Por favor use somente letras (a-z), com nesta área. Não utilize espaços nem outros caracteres são permitidos.',
  14862. alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Não utilize espaços nem outros caracteres são permitidos.',
  14863. dateSuchAs: 'Digite uma data válida, como {date}',
  14864. dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (p.ex. "31/12/1999")',
  14865. email: 'Digite um endereço de email válido. Por exemplo "fred@domain.com".',
  14866. url: 'Digite uma URL válida, como http://www.example.com.',
  14867. currencyDollar: 'Digite um valor válido $. Por exemplo $ 100,00. ',
  14868. oneRequired: 'Digite algo para pelo menos um desses insumos.',
  14869. errorPrefix: 'Erro: ',
  14870. warningPrefix: 'Aviso: '
  14871. });
  14872. /*
  14873. ---
  14874. name: Locale.ru-RU-unicode.Date
  14875. description: Date messages for Russian (utf-8).
  14876. license: MIT-style license
  14877. authors:
  14878. - Evstigneev Pavel
  14879. - Kuryanovich Egor
  14880. requires:
  14881. - Locale
  14882. provides: [Locale.ru-RU.Date]
  14883. ...
  14884. */
  14885. (function(){
  14886. // Russian language pluralization rules, taken from CLDR project, http://unicode.org/cldr/
  14887. // one -> n mod 10 is 1 and n mod 100 is not 11;
  14888. // few -> n mod 10 in 2..4 and n mod 100 not in 12..14;
  14889. // many -> n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14;
  14890. // other -> everything else (example 3.14)
  14891. var pluralize = function(n, one, few, many, other){
  14892. var modulo10 = n % 10,
  14893. modulo100 = n % 100;
  14894. if (modulo10 == 1 && modulo100 != 11){
  14895. return one;
  14896. } else if ((modulo10 == 2 || modulo10 == 3 || modulo10 == 4) && !(modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){
  14897. return few;
  14898. } else if (modulo10 == 0 || (modulo10 == 5 || modulo10 == 6 || modulo10 == 7 || modulo10 == 8 || modulo10 == 9) || (modulo100 == 11 || modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){
  14899. return many;
  14900. } else {
  14901. return other;
  14902. }
  14903. };
  14904. Locale.define('ru-RU', 'Date', {
  14905. months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],
  14906. months_abbr: ['янв', 'февр', 'март', 'апр', 'май','июнь','июль','авг','сент','окт','нояб','дек'],
  14907. days: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
  14908. days_abbr: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
  14909. // Culture's date order: DD.MM.YYYY
  14910. dateOrder: ['date', 'month', 'year'],
  14911. shortDate: '%d.%m.%Y',
  14912. shortTime: '%H:%M',
  14913. AM: 'AM',
  14914. PM: 'PM',
  14915. firstDayOfWeek: 1,
  14916. // Date.Extras
  14917. ordinal: '',
  14918. lessThanMinuteAgo: 'меньше минуты назад',
  14919. minuteAgo: 'минуту назад',
  14920. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'минуту', 'минуты', 'минут') + ' назад'; },
  14921. hourAgo: 'час назад',
  14922. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'час', 'часа', 'часов') + ' назад'; },
  14923. dayAgo: 'вчера',
  14924. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'день', 'дня', 'дней') + ' назад'; },
  14925. weekAgo: 'неделю назад',
  14926. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'неделя', 'недели', 'недель') + ' назад'; },
  14927. monthAgo: 'месяц назад',
  14928. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'месяц', 'месяца', 'месяцев') + ' назад'; },
  14929. yearAgo: 'год назад',
  14930. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'год', 'года', 'лет') + ' назад'; },
  14931. lessThanMinuteUntil: 'меньше чем через минуту',
  14932. minuteUntil: 'через минуту',
  14933. minutesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'минуту', 'минуты', 'минут') + ''; },
  14934. hourUntil: 'через час',
  14935. hoursUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'час', 'часа', 'часов') + ''; },
  14936. dayUntil: 'завтра',
  14937. daysUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'день', 'дня', 'дней') + ''; },
  14938. weekUntil: 'через неделю',
  14939. weeksUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'неделю', 'недели', 'недель') + ''; },
  14940. monthUntil: 'через месяц',
  14941. monthsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'месяц', 'месяца', 'месяцев') + ''; },
  14942. yearUntil: 'через',
  14943. yearsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'год', 'года', 'лет') + ''; }
  14944. });
  14945. //<1.2compat>
  14946. Locale.define('ru-RU-unicode').inherit('ru-RU', 'Date');
  14947. //</1.2compat>
  14948. })();
  14949. /*
  14950. ---
  14951. name: Locale.ru-RU-unicode.Form.Validator
  14952. description: Form Validator messages for Russian (utf-8).
  14953. license: MIT-style license
  14954. authors:
  14955. - Chernodarov Egor
  14956. requires:
  14957. - Locale
  14958. provides: [Locale.ru-RU.Form.Validator]
  14959. ...
  14960. */
  14961. Locale.define('ru-RU', 'FormValidator', {
  14962. required: 'Это поле обязательно к заполнению.',
  14963. minLength: 'Пожалуйста, введите хотя бы {minLength} символов (Вы ввели {length}).',
  14964. maxLength: 'Пожалуйста, введите не больше {maxLength} символов (Вы ввели {length}).',
  14965. integer: 'Пожалуйста, введите в это поле число. Дробные числа (например 1.25) тут не разрешены.',
  14966. numeric: 'Пожалуйста, введите в это поле число (например "1" или "1.1", или "-1", или "-1.1").',
  14967. digits: 'В этом поле Вы можете использовать только цифры и знаки пунктуации (например, телефонный номер со знаками дефиса или с точками).',
  14968. alpha: 'В этом поле можно использовать только латинские буквы (a-z). Пробелы и другие символы запрещены.',
  14969. alphanum: 'В этом поле можно использовать только латинские буквы (a-z) и цифры (0-9). Пробелы и другие символы запрещены.',
  14970. dateSuchAs: 'Пожалуйста, введите корректную дату {date}',
  14971. dateInFormatMDY: 'Пожалуйста, введите дату в формате ММ/ДД/ГГГГ (например "12/31/1999")',
  14972. email: 'Пожалуйста, введите корректный емейл-адрес. Для примера "fred@domain.com".',
  14973. url: 'Пожалуйста, введите правильную ссылку вида http://www.example.com.',
  14974. currencyDollar: 'Пожалуйста, введите сумму в долларах. Например: $100.00 .',
  14975. oneRequired: 'Пожалуйста, выберите хоть что-нибудь в одном из этих полей.',
  14976. errorPrefix: 'Ошибка: ',
  14977. warningPrefix: 'Внимание: '
  14978. });
  14979. //<1.2compat>
  14980. Locale.define('ru-RU-unicode').inherit('ru-RU', 'FormValidator');
  14981. //</1.2compat>
  14982. /*
  14983. ---
  14984. name: Locale.sk-SK.Date
  14985. description: Date messages for Slovak.
  14986. license: MIT-style license
  14987. authors:
  14988. - Ivan Masár
  14989. requires:
  14990. - Locale
  14991. provides: [Locale.sk-SK.Date]
  14992. ...
  14993. */
  14994. (function(){
  14995. // Slovak language pluralization rules, see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  14996. // one -> n is 1; 1
  14997. // few -> n in 2..4; 2-4
  14998. // other -> everything else 0, 5-999, 1.31, 2.31, 5.31...
  14999. var pluralize = function(n, one, few, other){
  15000. if (n == 1) return one;
  15001. else if (n == 2 || n == 3 || n == 4) return few;
  15002. else return other;
  15003. };
  15004. Locale.define('sk-SK', 'Date', {
  15005. months: ['Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'December'],
  15006. months_abbr: ['januára', 'februára', 'marca', 'apríla', 'mája', 'júna', 'júla', 'augusta', 'septembra', 'októbra', 'novembra', 'decembra'],
  15007. days: ['Nedele', 'Pondelí', 'Úterý', 'Streda', 'Čtvrtek', 'Pátek', 'Sobota'],
  15008. days_abbr: ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so'],
  15009. // Culture's date order: DD.MM.YYYY
  15010. dateOrder: ['date', 'month', 'year'],
  15011. shortDate: '%d.%m.%Y',
  15012. shortTime: '%H:%M',
  15013. AM: 'dop.',
  15014. PM: 'pop.',
  15015. firstDayOfWeek: 1,
  15016. // Date.Extras
  15017. ordinal: '.',
  15018. lessThanMinuteAgo: 'pred chvíľou',
  15019. minuteAgo: 'približne pred minútou',
  15020. minutesAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'minútou', 'minútami', 'minútami'); },
  15021. hourAgo: 'približne pred hodinou',
  15022. hoursAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'hodinou', 'hodinami', 'hodinami'); },
  15023. dayAgo: 'pred dňom',
  15024. daysAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'dňom', 'dňami', 'dňami'); },
  15025. weekAgo: 'pred týždňom',
  15026. weeksAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'týždňom', 'týždňami', 'týždňami'); },
  15027. monthAgo: 'pred mesiacom',
  15028. monthsAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'mesiacom', 'mesiacmi', 'mesiacmi'); },
  15029. yearAgo: 'pred rokom',
  15030. yearsAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'rokom', 'rokmi', 'rokmi'); },
  15031. lessThanMinuteUntil: 'o chvíľu',
  15032. minuteUntil: 'približne o minútu',
  15033. minutesUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'minútu', 'minúty', 'minúty'); },
  15034. hourUntil: 'približne o hodinu',
  15035. hoursUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'hodinu', 'hodiny', 'hodín'); },
  15036. dayUntil: 'o deň',
  15037. daysUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'deň', 'dni', 'dní'); },
  15038. weekUntil: 'o týždeň',
  15039. weeksUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'týždeň', 'týždne', 'týždňov'); },
  15040. monthUntil: 'o mesiac',
  15041. monthsUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'mesiac', 'mesiace', 'mesiacov'); },
  15042. yearUntil: 'o rok',
  15043. yearsUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'rok', 'roky', 'rokov'); }
  15044. });
  15045. })();
  15046. /*
  15047. ---
  15048. name: Locale.sk-SK.Form.Validator
  15049. description: Form Validator messages for Czech.
  15050. license: MIT-style license
  15051. authors:
  15052. - Ivan Masár
  15053. requires:
  15054. - Locale
  15055. provides: [Locale.sk-SK.Form.Validator]
  15056. ...
  15057. */
  15058. Locale.define('sk-SK', 'FormValidator', {
  15059. required: 'Táto položka je povinná.',
  15060. minLength: 'Zadajte prosím aspoň {minLength} znakov (momentálne {length} znakov).',
  15061. maxLength: 'Zadajte prosím menej ako {maxLength} znakov (momentálne {length} znakov).',
  15062. integer: 'Zadajte prosím celé číslo. Desetinné čísla (napr. 1.25) nie sú povolené.',
  15063. numeric: 'Zadajte len číselné hodnoty (t.j. „1“ alebo „1.1“ alebo „-1“ alebo „-1.1“).',
  15064. digits: 'Zadajte prosím len čísla a interpunkčné znamienka (napríklad telefónne číslo s pomlčkami albo bodkami je povolené).',
  15065. alpha: 'Zadajte prosím len písmená (a-z). Medzery alebo iné znaky nie sú povolené.',
  15066. alphanum: 'Zadajte prosím len písmená (a-z) alebo číslice (0-9). Medzery alebo iné znaky nie sú povolené.',
  15067. dateSuchAs: 'Zadajte prosím platný dátum v tvare {date}',
  15068. dateInFormatMDY: 'Zadajte prosím platný datum v tvare MM / DD / RRRR (t.j. „12/31/1999“)',
  15069. email: 'Zadajte prosím platnú emailovú adresu. Napríklad „fred@domain.com“.',
  15070. url: 'Zadajte prosím platnoú adresu URL v tvare http://www.example.com.',
  15071. currencyDollar: 'Zadajte prosím platnú čiastku. Napríklad $100.00.',
  15072. oneRequired: 'Zadajte prosím aspoň jednu hodnotu z týchto položiek.',
  15073. errorPrefix: 'Chyba: ',
  15074. warningPrefix: 'Upozornenie: ',
  15075. // Form.Validator.Extras
  15076. noSpace: 'V tejto položle nie sú povolené medzery',
  15077. reqChkByNode: 'Nie sú vybrané žiadne položky.',
  15078. requiredChk: 'Táto položka je povinná.',
  15079. reqChkByName: 'Prosím vyberte {label}.',
  15080. match: 'Táto položka sa musí zhodovať s položkou {matchName}',
  15081. startDate: 'dátum začiatku',
  15082. endDate: 'dátum ukončenia',
  15083. currendDate: 'aktuálny dátum',
  15084. afterDate: 'Dátum by mal býť rovnaký alebo väčší ako {label}.',
  15085. beforeDate: 'Dátum by mal byť rovnaký alebo menší ako {label}.',
  15086. startMonth: 'Vyberte počiatočný mesiac.',
  15087. sameMonth: 'Tieto dva dátumy musia býť v rovnakom mesiaci - zmeňte jeden z nich.',
  15088. creditcard: 'Zadané číslo kreditnej karty je neplatné. Prosím, opravte ho. Bolo zadaných {length} číslic.'
  15089. });
  15090. /*
  15091. ---
  15092. name: Locale.si-SI.Date
  15093. description: Date messages for Slovenian.
  15094. license: MIT-style license
  15095. authors:
  15096. - Radovan Lozej
  15097. requires:
  15098. - Locale
  15099. provides: [Locale.si-SI.Date]
  15100. ...
  15101. */
  15102. (function(){
  15103. var pluralize = function(n, one, two, three, other){
  15104. return (n >= 1 && n <= 3) ? arguments[n] : other;
  15105. };
  15106. Locale.define('sl-SI', 'Date', {
  15107. months: ['januar', 'februar', 'marec', 'april', 'maj', 'junij', 'julij', 'avgust', 'september', 'oktober', 'november', 'december'],
  15108. months_abbr: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'avg', 'sep', 'okt', 'nov', 'dec'],
  15109. days: ['nedelja', 'ponedeljek', 'torek', 'sreda', 'četrtek', 'petek', 'sobota'],
  15110. days_abbr: ['ned', 'pon', 'tor', 'sre', 'čet', 'pet', 'sob'],
  15111. // Culture's date order: DD.MM.YYYY
  15112. dateOrder: ['date', 'month', 'year'],
  15113. shortDate: '%d.%m.%Y',
  15114. shortTime: '%H.%M',
  15115. AM: 'AM',
  15116. PM: 'PM',
  15117. firstDayOfWeek: 1,
  15118. // Date.Extras
  15119. ordinal: '.',
  15120. lessThanMinuteAgo: 'manj kot minuto nazaj',
  15121. minuteAgo: 'minuto nazaj',
  15122. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'minuto', 'minuti', 'minute', 'minut') + ' nazaj'; },
  15123. hourAgo: 'uro nazaj',
  15124. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'uro', 'uri', 'ure', 'ur') + ' nazaj'; },
  15125. dayAgo: 'dan nazaj',
  15126. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'dan', 'dneva', 'dni', 'dni') + ' nazaj'; },
  15127. weekAgo: 'teden nazaj',
  15128. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'teden', 'tedna', 'tedne', 'tednov') + ' nazaj'; },
  15129. monthAgo: 'mesec nazaj',
  15130. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'mesec', 'meseca', 'mesece', 'mesecov') + ' nazaj'; },
  15131. yearthAgo: 'leto nazaj',
  15132. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'leto', 'leti', 'leta', 'let') + ' nazaj'; },
  15133. lessThanMinuteUntil: 'še manj kot minuto',
  15134. minuteUntil: 'še minuta',
  15135. minutesUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'minuta', 'minuti', 'minute', 'minut'); },
  15136. hourUntil: 'še ura',
  15137. hoursUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'ura', 'uri', 'ure', 'ur'); },
  15138. dayUntil: 'še dan',
  15139. daysUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'dan', 'dneva', 'dnevi', 'dni'); },
  15140. weekUntil: 'še tedn',
  15141. weeksUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'teden', 'tedna', 'tedni', 'tednov'); },
  15142. monthUntil: 'še mesec',
  15143. monthsUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'mesec', 'meseca', 'meseci', 'mesecov'); },
  15144. yearUntil: 'še leto',
  15145. yearsUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'leto', 'leti', 'leta', 'let'); }
  15146. });
  15147. })();
  15148. /*
  15149. ---
  15150. name: Locale.si-SI.Form.Validator
  15151. description: Form Validator messages for Slovenian.
  15152. license: MIT-style license
  15153. authors:
  15154. - Radovan Lozej
  15155. requires:
  15156. - Locale
  15157. provides: [Locale.si-SI.Form.Validator]
  15158. ...
  15159. */
  15160. Locale.define('sl-SI', 'FormValidator', {
  15161. required: 'To polje je obvezno',
  15162. minLength: 'Prosim, vnesite vsaj {minLength} znakov (vnesli ste {length} znakov).',
  15163. maxLength: 'Prosim, ne vnesite več kot {maxLength} znakov (vnesli ste {length} znakov).',
  15164. integer: 'Prosim, vnesite celo število. Decimalna števila (kot 1,25) niso dovoljena.',
  15165. numeric: 'Prosim, vnesite samo numerične vrednosti (kot "1" ali "1.1" ali "-1" ali "-1.1").',
  15166. digits: 'Prosim, uporabite številke in ločila le na tem polju (na primer, dovoljena je telefonska številka z pomišlaji ali pikami).',
  15167. alpha: 'Prosim, uporabite le črke v tem plju. Presledki in drugi znaki niso dovoljeni.',
  15168. alphanum: 'Prosim, uporabite samo črke ali številke v tem polju. Presledki in drugi znaki niso dovoljeni.',
  15169. dateSuchAs: 'Prosim, vnesite pravilen datum kot {date}',
  15170. dateInFormatMDY: 'Prosim, vnesite pravilen datum kot MM.DD.YYYY (primer "12.31.1999")',
  15171. email: 'Prosim, vnesite pravilen email naslov. Na primer "fred@domain.com".',
  15172. url: 'Prosim, vnesite pravilen URL kot http://www.example.com.',
  15173. currencyDollar: 'Prosim, vnesit epravilno vrednost €. Primer 100,00€ .',
  15174. oneRequired: 'Prosimo, vnesite nekaj za vsaj eno izmed teh polj.',
  15175. errorPrefix: 'Napaka: ',
  15176. warningPrefix: 'Opozorilo: ',
  15177. // Form.Validator.Extras
  15178. noSpace: 'To vnosno polje ne dopušča presledkov.',
  15179. reqChkByNode: 'Nič niste izbrali.',
  15180. requiredChk: 'To polje je obvezno',
  15181. reqChkByName: 'Prosim, izberite {label}.',
  15182. match: 'To polje se mora ujemati z poljem {matchName}',
  15183. startDate: 'datum začetka',
  15184. endDate: 'datum konca',
  15185. currentDate: 'trenuten datum',
  15186. afterDate: 'Datum bi moral biti isti ali po {label}.',
  15187. beforeDate: 'Datum bi moral biti isti ali pred {label}.',
  15188. startMonth: 'Prosim, vnesite začetni datum',
  15189. sameMonth: 'Ta dva datuma morata biti v istem mesecu - premeniti morate eno ali drugo.',
  15190. creditcard: 'Številka kreditne kartice ni pravilna. Preverite številko ali poskusite še enkrat. Vnešenih {length} znakov.'
  15191. });
  15192. /*
  15193. ---
  15194. name: Locale.sv-SE.Date
  15195. description: Date messages for Swedish.
  15196. license: MIT-style license
  15197. authors:
  15198. - Martin Lundgren
  15199. requires:
  15200. - Locale
  15201. provides: [Locale.sv-SE.Date]
  15202. ...
  15203. */
  15204. Locale.define('sv-SE', 'Date', {
  15205. months: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'],
  15206. months_abbr: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
  15207. days: ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'],
  15208. days_abbr: ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör'],
  15209. // Culture's date order: YYYY-MM-DD
  15210. dateOrder: ['year', 'month', 'date'],
  15211. shortDate: '%Y-%m-%d',
  15212. shortTime: '%H:%M',
  15213. AM: '',
  15214. PM: '',
  15215. firstDayOfWeek: 1,
  15216. // Date.Extras
  15217. ordinal: '',
  15218. lessThanMinuteAgo: 'mindre än en minut sedan',
  15219. minuteAgo: 'ungefär en minut sedan',
  15220. minutesAgo: '{delta} minuter sedan',
  15221. hourAgo: 'ungefär en timme sedan',
  15222. hoursAgo: 'ungefär {delta} timmar sedan',
  15223. dayAgo: '1 dag sedan',
  15224. daysAgo: '{delta} dagar sedan',
  15225. lessThanMinuteUntil: 'mindre än en minut sedan',
  15226. minuteUntil: 'ungefär en minut sedan',
  15227. minutesUntil: '{delta} minuter sedan',
  15228. hourUntil: 'ungefär en timme sedan',
  15229. hoursUntil: 'ungefär {delta} timmar sedan',
  15230. dayUntil: '1 dag sedan',
  15231. daysUntil: '{delta} dagar sedan'
  15232. });
  15233. /*
  15234. ---
  15235. name: Locale.sv-SE.Form.Validator
  15236. description: Form Validator messages for Swedish.
  15237. license: MIT-style license
  15238. authors:
  15239. - Martin Lundgren
  15240. requires:
  15241. - Locale
  15242. provides: [Locale.sv-SE.Form.Validator]
  15243. ...
  15244. */
  15245. Locale.define('sv-SE', 'FormValidator', {
  15246. required: 'Fältet är obligatoriskt.',
  15247. minLength: 'Ange minst {minLength} tecken (du angav {length} tecken).',
  15248. maxLength: 'Ange högst {maxLength} tecken (du angav {length} tecken). ',
  15249. integer: 'Ange ett heltal i fältet. Tal med decimaler (t.ex. 1,25) är inte tillåtna.',
  15250. numeric: 'Ange endast numeriska värden i detta fält (t.ex. "1" eller "1.1" eller "-1" eller "-1,1").',
  15251. digits: 'Använd endast siffror och skiljetecken i detta fält (till exempel ett telefonnummer med bindestreck tillåtet).',
  15252. alpha: 'Använd endast bokstäver (a-ö) i detta fält. Inga mellanslag eller andra tecken är tillåtna.',
  15253. alphanum: 'Använd endast bokstäver (a-ö) och siffror (0-9) i detta fält. Inga mellanslag eller andra tecken är tillåtna.',
  15254. dateSuchAs: 'Ange ett giltigt datum som t.ex. {date}',
  15255. dateInFormatMDY: 'Ange ett giltigt datum som t.ex. YYYY-MM-DD (i.e. "1999-12-31")',
  15256. email: 'Ange en giltig e-postadress. Till exempel "erik@domain.com".',
  15257. url: 'Ange en giltig webbadress som http://www.example.com.',
  15258. currencyDollar: 'Ange en giltig belopp. Exempelvis 100,00.',
  15259. oneRequired: 'Vänligen ange minst ett av dessa alternativ.',
  15260. errorPrefix: 'Fel: ',
  15261. warningPrefix: 'Varning: ',
  15262. // Form.Validator.Extras
  15263. noSpace: 'Det får inte finnas några mellanslag i detta fält.',
  15264. reqChkByNode: 'Inga objekt är valda.',
  15265. requiredChk: 'Detta är ett obligatoriskt fält.',
  15266. reqChkByName: 'Välj en {label}.',
  15267. match: 'Detta fält måste matcha {matchName}',
  15268. startDate: 'startdatumet',
  15269. endDate: 'slutdatum',
  15270. currentDate: 'dagens datum',
  15271. afterDate: 'Datumet bör vara samma eller senare än {label}.',
  15272. beforeDate: 'Datumet bör vara samma eller tidigare än {label}.',
  15273. startMonth: 'Välj en start månad',
  15274. sameMonth: 'Dessa två datum måste vara i samma månad - du måste ändra det ena eller det andra.'
  15275. });
  15276. /*
  15277. ---
  15278. name: Locale.sv-SE.Number
  15279. description: Number messages for Swedish.
  15280. license: MIT-style license
  15281. authors:
  15282. - Arian Stolwijk
  15283. - Martin Lundgren
  15284. requires:
  15285. - Locale
  15286. - Locale.EU.Number
  15287. provides: [Locale.sv-SE.Number]
  15288. ...
  15289. */
  15290. Locale.define('sv-SE', 'Number', {
  15291. currency: {
  15292. prefix: 'SEK '
  15293. }
  15294. }).inherit('EU', 'Number');
  15295. /*
  15296. ---
  15297. name: Locale.tr-TR.Date
  15298. description: Date messages for Turkish.
  15299. license: MIT-style license
  15300. authors:
  15301. - Faruk Can Bilir
  15302. requires:
  15303. - Locale
  15304. provides: [Locale.tr-TR.Date]
  15305. ...
  15306. */
  15307. Locale.define('tr-TR', 'Date', {
  15308. months: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
  15309. months_abbr: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
  15310. days: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],
  15311. days_abbr: ['Pa', 'Pzt', 'Sa', 'Ça', 'Pe', 'Cu', 'Cmt'],
  15312. // Culture's date order: MM/DD/YYYY
  15313. dateOrder: ['date', 'month', 'year'],
  15314. shortDate: '%d/%m/%Y',
  15315. shortTime: '%H.%M',
  15316. AM: 'AM',
  15317. PM: 'PM',
  15318. firstDayOfWeek: 1,
  15319. // Date.Extras
  15320. ordinal: '',
  15321. lessThanMinuteAgo: 'bir dakikadan önce',
  15322. minuteAgo: 'yaklaşık bir dakika önce',
  15323. minutesAgo: '{delta} dakika önce',
  15324. hourAgo: 'bir saat kadar önce',
  15325. hoursAgo: '{delta} saat kadar önce',
  15326. dayAgo: 'bir gün önce',
  15327. daysAgo: '{delta} gün önce',
  15328. weekAgo: 'bir hafta önce',
  15329. weeksAgo: '{delta} hafta önce',
  15330. monthAgo: 'bir ay önce',
  15331. monthsAgo: '{delta} ay önce',
  15332. yearAgo: 'bir yıl önce',
  15333. yearsAgo: '{delta} yıl önce',
  15334. lessThanMinuteUntil: 'bir dakikadan az sonra',
  15335. minuteUntil: 'bir dakika kadar sonra',
  15336. minutesUntil: '{delta} dakika sonra',
  15337. hourUntil: 'bir saat kadar sonra',
  15338. hoursUntil: '{delta} saat kadar sonra',
  15339. dayUntil: 'bir gün sonra',
  15340. daysUntil: '{delta} gün sonra',
  15341. weekUntil: 'bir hafta sonra',
  15342. weeksUntil: '{delta} hafta sonra',
  15343. monthUntil: 'bir ay sonra',
  15344. monthsUntil: '{delta} ay sonra',
  15345. yearUntil: 'bir yıl sonra',
  15346. yearsUntil: '{delta} yıl sonra'
  15347. });
  15348. /*
  15349. ---
  15350. name: Locale.tr-TR.Form.Validator
  15351. description: Form Validator messages for Turkish.
  15352. license: MIT-style license
  15353. authors:
  15354. - Faruk Can Bilir
  15355. requires:
  15356. - Locale
  15357. provides: [Locale.tr-TR.Form.Validator]
  15358. ...
  15359. */
  15360. Locale.define('tr-TR', 'FormValidator', {
  15361. required: 'Bu alan zorunlu.',
  15362. minLength: 'Lütfen en az {minLength} karakter girin (siz {length} karakter girdiniz).',
  15363. maxLength: 'Lütfen en fazla {maxLength} karakter girin (siz {length} karakter girdiniz).',
  15364. integer: 'Lütfen bu alana sadece tamsayı girin. Ondalıklı sayılar (ör: 1.25) kullanılamaz.',
  15365. numeric: 'Lütfen bu alana sadece sayısal değer girin (ör: "1", "1.1", "-1" ya da "-1.1").',
  15366. 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).',
  15367. alpha: 'Lütfen bu alanda yalnızca harf kullanın. Boşluk ve diğer karakterler kullanılamaz.',
  15368. alphanum: 'Lütfen bu alanda sadece harf ve rakam kullanın. Boşluk ve diğer karakterler kullanılamaz.',
  15369. dateSuchAs: 'Lütfen geçerli bir tarih girin (Ör: {date})',
  15370. dateInFormatMDY: 'Lütfen geçerli bir tarih girin (GG/AA/YYYY, ör: "31/12/1999")',
  15371. email: 'Lütfen geçerli bir email adresi girin. Ör: "kemal@etikan.com".',
  15372. url: 'Lütfen geçerli bir URL girin. Ör: http://www.example.com.',
  15373. currencyDollar: 'Lütfen geçerli bir TL miktarı girin. Ör: 100,00 TL .',
  15374. oneRequired: 'Lütfen en az bir tanesini doldurun.',
  15375. errorPrefix: 'Hata: ',
  15376. warningPrefix: 'Uyarı: ',
  15377. // Form.Validator.Extras
  15378. noSpace: 'Bu alanda boşluk kullanılamaz.',
  15379. reqChkByNode: 'Hiçbir öğe seçilmemiş.',
  15380. requiredChk: 'Bu alan zorunlu.',
  15381. reqChkByName: 'Lütfen bir {label} girin.',
  15382. match: 'Bu alan, {matchName} alanıyla uyuşmalı',
  15383. startDate: 'başlangıç tarihi',
  15384. endDate: 'bitiş tarihi',
  15385. currentDate: 'bugünün tarihi',
  15386. afterDate: 'Tarih, {label} tarihiyle aynı gün ya da ondan sonra olmalıdır.',
  15387. beforeDate: 'Tarih, {label} tarihiyle aynı gün ya da ondan önce olmalıdır.',
  15388. startMonth: 'Lütfen bir başlangıç ayı seçin',
  15389. sameMonth: 'Bu iki tarih aynı ayda olmalı - bir tanesini değiştirmeniz gerekiyor.',
  15390. creditcard: 'Girdiğiniz kredi kartı numarası geçersiz. Lütfen kontrol edip tekrar deneyin. {length} hane girildi.'
  15391. });
  15392. /*
  15393. ---
  15394. name: Locale.tr-TR.Number
  15395. description: Number messages for Turkish.
  15396. license: MIT-style license
  15397. authors:
  15398. - Faruk Can Bilir
  15399. requires:
  15400. - Locale
  15401. - Locale.EU.Number
  15402. provides: [Locale.tr-TR.Number]
  15403. ...
  15404. */
  15405. Locale.define('tr-TR', 'Number', {
  15406. currency: {
  15407. decimals: 0,
  15408. suffix: ' TL'
  15409. }
  15410. }).inherit('EU', 'Number');
  15411. /*
  15412. ---
  15413. name: Locale.uk-UA.Date
  15414. description: Date messages for Ukrainian (utf-8).
  15415. license: MIT-style license
  15416. authors:
  15417. - Slik
  15418. requires:
  15419. - Locale
  15420. provides: [Locale.uk-UA.Date]
  15421. ...
  15422. */
  15423. (function(){
  15424. var pluralize = function(n, one, few, many, other){
  15425. var d = (n / 10).toInt(),
  15426. z = n % 10,
  15427. s = (n / 100).toInt();
  15428. if (d == 1 && n > 10) return many;
  15429. if (z == 1) return one;
  15430. if (z > 0 && z < 5) return few;
  15431. return many;
  15432. };
  15433. Locale.define('uk-UA', 'Date', {
  15434. months: ['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'],
  15435. months_abbr: ['Січ', 'Лют', 'Бер', 'Квіт', 'Трав', 'Черв', 'Лип', 'Серп', 'Вер', 'Жовт', 'Лист', 'Груд' ],
  15436. days: ['Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', "П'ятниця", 'Субота'],
  15437. days_abbr: ['Нд', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
  15438. // Culture's date order: DD/MM/YYYY
  15439. dateOrder: ['date', 'month', 'year'],
  15440. shortDate: '%d/%m/%Y',
  15441. shortTime: '%H:%M',
  15442. AM: 'до полудня',
  15443. PM: 'по полудню',
  15444. firstDayOfWeek: 1,
  15445. // Date.Extras
  15446. ordinal: '',
  15447. lessThanMinuteAgo: 'меньше хвилини тому',
  15448. minuteAgo: 'хвилину тому',
  15449. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'хвилину', 'хвилини', 'хвилин') + ' тому'; },
  15450. hourAgo: 'годину тому',
  15451. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'годину', 'години', 'годин') + ' тому'; },
  15452. dayAgo: 'вчора',
  15453. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'день', 'дня', 'днів') + ' тому'; },
  15454. weekAgo: 'тиждень тому',
  15455. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'тиждень', 'тижні', 'тижнів') + ' тому'; },
  15456. monthAgo: 'місяць тому',
  15457. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'місяць', 'місяці', 'місяців') + ' тому'; },
  15458. yearAgo: 'рік тому',
  15459. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'рік', 'роки', 'років') + ' тому'; },
  15460. lessThanMinuteUntil: 'за мить',
  15461. minuteUntil: 'через хвилину',
  15462. minutesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'хвилину', 'хвилини', 'хвилин'); },
  15463. hourUntil: 'через годину',
  15464. hoursUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'годину', 'години', 'годин'); },
  15465. dayUntil: 'завтра',
  15466. daysUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'день', 'дня', 'днів'); },
  15467. weekUntil: 'через тиждень',
  15468. weeksUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'тиждень', 'тижні', 'тижнів'); },
  15469. monthUntil: 'через місяць',
  15470. monthesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'місяць', 'місяці', 'місяців'); },
  15471. yearUntil: 'через рік',
  15472. yearsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'рік', 'роки', 'років'); }
  15473. });
  15474. })();
  15475. /*
  15476. ---
  15477. name: Locale.uk-UA.Form.Validator
  15478. description: Form Validator messages for Ukrainian (utf-8).
  15479. license: MIT-style license
  15480. authors:
  15481. - Slik
  15482. requires:
  15483. - Locale
  15484. provides: [Locale.uk-UA.Form.Validator]
  15485. ...
  15486. */
  15487. Locale.define('uk-UA', 'FormValidator', {
  15488. required: 'Це поле повинне бути заповненим.',
  15489. minLength: 'Введіть хоча б {minLength} символів (Ви ввели {length}).',
  15490. maxLength: 'Кількість символів не може бути більше {maxLength} (Ви ввели {length}).',
  15491. integer: 'Введіть в це поле число. Дробові числа (наприклад 1.25) не дозволені.',
  15492. numeric: 'Введіть в це поле число (наприклад "1" або "1.1", або "-1", або "-1.1").',
  15493. digits: 'В цьому полі ви можете використовувати лише цифри і знаки пунктіації (наприклад, телефонний номер з знаками дефізу або з крапками).',
  15494. alpha: 'В цьому полі можна використовувати лише латинські літери (a-z). Пробіли і інші символи заборонені.',
  15495. alphanum: 'В цьому полі можна використовувати лише латинські літери (a-z) і цифри (0-9). Пробіли і інші символи заборонені.',
  15496. dateSuchAs: 'Введіть коректну дату {date}.',
  15497. dateInFormatMDY: 'Введіть дату в форматі ММ/ДД/РРРР (наприклад "12/31/2009").',
  15498. email: 'Введіть коректну адресу електронної пошти (наприклад "name@domain.com").',
  15499. url: 'Введіть коректне інтернет-посилання (наприклад http://www.example.com).',
  15500. currencyDollar: 'Введіть суму в доларах (наприклад "$100.00").',
  15501. oneRequired: 'Заповніть одне з полів.',
  15502. errorPrefix: 'Помилка: ',
  15503. warningPrefix: 'Увага: ',
  15504. noSpace: 'Пробіли заборонені.',
  15505. reqChkByNode: 'Не відмічено жодного варіанту.',
  15506. requiredChk: 'Це поле повинне бути віміченим.',
  15507. reqChkByName: 'Будь ласка, відмітьте {label}.',
  15508. match: 'Це поле повинно відповідати {matchName}',
  15509. startDate: 'початкова дата',
  15510. endDate: 'кінцева дата',
  15511. currentDate: 'сьогоднішня дата',
  15512. afterDate: 'Ця дата повинна бути такою ж, або пізнішою за {label}.',
  15513. beforeDate: 'Ця дата повинна бути такою ж, або ранішою за {label}.',
  15514. startMonth: 'Будь ласка, виберіть початковий місяць',
  15515. sameMonth: 'Ці дати повинні відноситись одного і того ж місяця. Будь ласка, змініть одну з них.',
  15516. creditcard: 'Номер кредитної карти введений неправильно. Будь ласка, перевірте його. Введено {length} символів.'
  15517. });
  15518. /*
  15519. ---
  15520. name: Locale.zh-CH.Date
  15521. description: Date messages for Chinese (simplified and traditional).
  15522. license: MIT-style license
  15523. authors:
  15524. - YMind Chan
  15525. requires:
  15526. - Locale
  15527. provides: [Locale.zh-CH.Date]
  15528. ...
  15529. */
  15530. // Simplified Chinese
  15531. Locale.define('zh-CHS', 'Date', {
  15532. months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  15533. months_abbr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  15534. days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  15535. days_abbr: ['日', '一', '二', '三', '四', '五', '六'],
  15536. // Culture's date order: YYYY-MM-DD
  15537. dateOrder: ['year', 'month', 'date'],
  15538. shortDate: '%Y-%m-%d',
  15539. shortTime: '%I:%M%p',
  15540. AM: 'AM',
  15541. PM: 'PM',
  15542. firstDayOfWeek: 1,
  15543. // Date.Extras
  15544. ordinal: '',
  15545. lessThanMinuteAgo: '不到1分钟前',
  15546. minuteAgo: '大约1分钟前',
  15547. minutesAgo: '{delta}分钟之前',
  15548. hourAgo: '大约1小时前',
  15549. hoursAgo: '大约{delta}小时前',
  15550. dayAgo: '1天前',
  15551. daysAgo: '{delta}天前',
  15552. weekAgo: '1星期前',
  15553. weeksAgo: '{delta}星期前',
  15554. monthAgo: '1个月前',
  15555. monthsAgo: '{delta}个月前',
  15556. yearAgo: '1年前',
  15557. yearsAgo: '{delta}年前',
  15558. lessThanMinuteUntil: '从现在开始不到1分钟',
  15559. minuteUntil: '从现在开始約1分钟',
  15560. minutesUntil: '从现在开始约{delta}分钟',
  15561. hourUntil: '从现在开始1小时',
  15562. hoursUntil: '从现在开始约{delta}小时',
  15563. dayUntil: '从现在开始1天',
  15564. daysUntil: '从现在开始{delta}天',
  15565. weekUntil: '从现在开始1星期',
  15566. weeksUntil: '从现在开始{delta}星期',
  15567. monthUntil: '从现在开始一个月',
  15568. monthsUntil: '从现在开始{delta}个月',
  15569. yearUntil: '从现在开始1年',
  15570. yearsUntil: '从现在开始{delta}年'
  15571. });
  15572. // Traditional Chinese
  15573. Locale.define('zh-CHT', 'Date', {
  15574. months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  15575. months_abbr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  15576. days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  15577. days_abbr: ['日', '一', '二', '三', '四', '五', '六'],
  15578. // Culture's date order: YYYY-MM-DD
  15579. dateOrder: ['year', 'month', 'date'],
  15580. shortDate: '%Y-%m-%d',
  15581. shortTime: '%I:%M%p',
  15582. AM: 'AM',
  15583. PM: 'PM',
  15584. firstDayOfWeek: 1,
  15585. // Date.Extras
  15586. ordinal: '',
  15587. lessThanMinuteAgo: '不到1分鐘前',
  15588. minuteAgo: '大約1分鐘前',
  15589. minutesAgo: '{delta}分鐘之前',
  15590. hourAgo: '大約1小時前',
  15591. hoursAgo: '大約{delta}小時前',
  15592. dayAgo: '1天前',
  15593. daysAgo: '{delta}天前',
  15594. weekAgo: '1星期前',
  15595. weeksAgo: '{delta}星期前',
  15596. monthAgo: '1个月前',
  15597. monthsAgo: '{delta}个月前',
  15598. yearAgo: '1年前',
  15599. yearsAgo: '{delta}年前',
  15600. lessThanMinuteUntil: '從現在開始不到1分鐘',
  15601. minuteUntil: '從現在開始約1分鐘',
  15602. minutesUntil: '從現在開始約{delta}分鐘',
  15603. hourUntil: '從現在開始1小時',
  15604. hoursUntil: '從現在開始約{delta}小時',
  15605. dayUntil: '從現在開始1天',
  15606. daysUntil: '從現在開始{delta}天',
  15607. weekUntil: '從現在開始1星期',
  15608. weeksUntil: '從現在開始{delta}星期',
  15609. monthUntil: '從現在開始一個月',
  15610. monthsUntil: '從現在開始{delta}個月',
  15611. yearUntil: '從現在開始1年',
  15612. yearsUntil: '從現在開始{delta}年'
  15613. });
  15614. /*
  15615. ---
  15616. name: Locale.zh-CH.Form.Validator
  15617. description: Form Validator messages for Chinese (simplified and traditional).
  15618. license: MIT-style license
  15619. authors:
  15620. - YMind Chan
  15621. requires:
  15622. - Locale
  15623. - Form.Validator
  15624. provides: [Form.zh-CH.Form.Validator, Form.Validator.CurrencyYuanValidator]
  15625. ...
  15626. */
  15627. // Simplified Chinese
  15628. Locale.define('zh-CHS', 'FormValidator', {
  15629. required: '此项必填。',
  15630. minLength: '请至少输入 {minLength} 个字符 (已输入 {length} 个)。',
  15631. maxLength: '最多只能输入 {maxLength} 个字符 (已输入 {length} 个)。',
  15632. integer: '请输入一个整数,不能包含小数点。例如:"1", "200"。',
  15633. numeric: '请输入一个数字,例如:"1", "1.1", "-1", "-1.1"。',
  15634. digits: '请输入由数字和标点符号组成的内容。例如电话号码。',
  15635. alpha: '请输入 A-Z 的 26 个字母,不能包含空格或任何其他字符。',
  15636. alphanum: '请输入 A-Z 的 26 个字母或 0-9 的 10 个数字,不能包含空格或任何其他字符。',
  15637. dateSuchAs: '请输入合法的日期格式,如:{date}。',
  15638. dateInFormatMDY: '请输入合法的日期格式,例如:YYYY-MM-DD ("2010-12-31")。',
  15639. email: '请输入合法的电子信箱地址,例如:"fred@domain.com"。',
  15640. url: '请输入合法的 Url 地址,例如:http://www.example.com。',
  15641. currencyDollar: '请输入合法的货币符号,例如:¥100.0',
  15642. oneRequired: '请至少选择一项。',
  15643. errorPrefix: '错误:',
  15644. warningPrefix: '警告:',
  15645. // Form.Validator.Extras
  15646. noSpace: '不能包含空格。',
  15647. reqChkByNode: '未选择任何内容。',
  15648. requiredChk: '此项必填。',
  15649. reqChkByName: '请选择 {label}.',
  15650. match: '必须与{matchName}相匹配',
  15651. startDate: '起始日期',
  15652. endDate: '结束日期',
  15653. currentDate: '当前日期',
  15654. afterDate: '日期必须等于或晚于 {label}.',
  15655. beforeDate: '日期必须早于或等于 {label}.',
  15656. startMonth: '请选择起始月份',
  15657. sameMonth: '您必须修改两个日期中的一个,以确保它们在同一月份。',
  15658. creditcard: '您输入的信用卡号码不正确。当前已输入{length}个字符。'
  15659. });
  15660. // Traditional Chinese
  15661. Locale.define('zh-CHT', 'FormValidator', {
  15662. required: '此項必填。 ',
  15663. minLength: '請至少輸入{minLength} 個字符(已輸入{length} 個)。 ',
  15664. maxLength: '最多只能輸入{maxLength} 個字符(已輸入{length} 個)。 ',
  15665. integer: '請輸入一個整數,不能包含小數點。例如:"1", "200"。 ',
  15666. numeric: '請輸入一個數字,例如:"1", "1.1", "-1", "-1.1"。 ',
  15667. digits: '請輸入由數字和標點符號組成的內容。例如電話號碼。 ',
  15668. alpha: '請輸入AZ 的26 個字母,不能包含空格或任何其他字符。 ',
  15669. alphanum: '請輸入AZ 的26 個字母或0-9 的10 個數字,不能包含空格或任何其他字符。 ',
  15670. dateSuchAs: '請輸入合法的日期格式,如:{date}。 ',
  15671. dateInFormatMDY: '請輸入合法的日期格式,例如:YYYY-MM-DD ("2010-12-31")。 ',
  15672. email: '請輸入合法的電子信箱地址,例如:"fred@domain.com"。 ',
  15673. url: '請輸入合法的Url 地址,例如:http://www.example.com。 ',
  15674. currencyDollar: '請輸入合法的貨幣符號,例如:¥100.0',
  15675. oneRequired: '請至少選擇一項。 ',
  15676. errorPrefix: '錯誤:',
  15677. warningPrefix: '警告:',
  15678. // Form.Validator.Extras
  15679. noSpace: '不能包含空格。 ',
  15680. reqChkByNode: '未選擇任何內容。 ',
  15681. requiredChk: '此項必填。 ',
  15682. reqChkByName: '請選擇 {label}.',
  15683. match: '必須與{matchName}相匹配',
  15684. startDate: '起始日期',
  15685. endDate: '結束日期',
  15686. currentDate: '當前日期',
  15687. afterDate: '日期必須等於或晚於{label}.',
  15688. beforeDate: '日期必須早於或等於{label}.',
  15689. startMonth: '請選擇起始月份',
  15690. sameMonth: '您必須修改兩個日期中的一個,以確保它們在同一月份。 ',
  15691. creditcard: '您輸入的信用卡號碼不正確。當前已輸入{length}個字符。 '
  15692. });
  15693. Form.Validator.add('validate-currency-yuan', {
  15694. errorMsg: function(){
  15695. return Form.Validator.getMsg('currencyYuan');
  15696. },
  15697. test: function(element){
  15698. // [¥]1[##][,###]+[.##]
  15699. // [¥]1###+[.##]
  15700. // [¥]0.##
  15701. // [¥].##
  15702. 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'));
  15703. }
  15704. });
  15705. /*
  15706. ---
  15707. name: Locale.zh-CH.Number
  15708. description: Number messages for for Chinese (simplified and traditional).
  15709. license: MIT-style license
  15710. authors:
  15711. - YMind Chan
  15712. requires:
  15713. - Locale
  15714. - Locale.en-US.Number
  15715. provides: [Locale.zh-CH.Number]
  15716. ...
  15717. */
  15718. // Simplified Chinese
  15719. Locale.define('zh-CHS', 'Number', {
  15720. currency: {
  15721. prefix: '¥ '
  15722. }
  15723. }).inherit('en-US', 'Number');
  15724. // Traditional Chinese
  15725. Locale.define('zh-CHT').inherit('zh-CHS', 'Number');
  15726. /*
  15727. ---
  15728. script: Request.JSONP.js
  15729. name: Request.JSONP
  15730. description: Defines Request.JSONP, a class for cross domain javascript via script injection.
  15731. license: MIT-style license
  15732. authors:
  15733. - Aaron Newton
  15734. - Guillermo Rauch
  15735. - Arian Stolwijk
  15736. requires:
  15737. - Core/Element
  15738. - Core/Request
  15739. - MooTools.More
  15740. provides: [Request.JSONP]
  15741. ...
  15742. */
  15743. Request.JSONP = new Class({
  15744. Implements: [Chain, Events, Options],
  15745. options: {/*
  15746. onRequest: function(src, scriptElement){},
  15747. onComplete: function(data){},
  15748. onSuccess: function(data){},
  15749. onCancel: function(){},
  15750. onTimeout: function(){},
  15751. onError: function(){}, */
  15752. onRequest: function(src){
  15753. if (this.options.log && window.console && console.log){
  15754. console.log('JSONP retrieving script with url:' + src);
  15755. }
  15756. },
  15757. onError: function(src){
  15758. if (this.options.log && window.console && console.warn){
  15759. console.warn('JSONP '+ src +' will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs');
  15760. }
  15761. },
  15762. url: '',
  15763. callbackKey: 'callback',
  15764. injectScript: document.head,
  15765. data: '',
  15766. link: 'ignore',
  15767. timeout: 0,
  15768. log: false
  15769. },
  15770. initialize: function(options){
  15771. this.setOptions(options);
  15772. },
  15773. send: function(options){
  15774. if (!Request.prototype.check.call(this, options)) return this;
  15775. this.running = true;
  15776. var type = typeOf(options);
  15777. if (type == 'string' || type == 'element') options = {data: options};
  15778. options = Object.merge(this.options, options || {});
  15779. var data = options.data;
  15780. switch (typeOf(data)){
  15781. case 'element': data = document.id(data).toQueryString(); break;
  15782. case 'object': case 'hash': data = Object.toQueryString(data);
  15783. }
  15784. var index = this.index = Request.JSONP.counter++,
  15785. key = 'request_' + index;
  15786. var src = options.url +
  15787. (options.url.test('\\?') ? '&' :'?') +
  15788. (options.callbackKey) +
  15789. '=Request.JSONP.request_map.request_'+ index +
  15790. (data ? '&' + data : '');
  15791. if (src.length > 2083) this.fireEvent('error', src);
  15792. Request.JSONP.request_map[key] = function(){
  15793. delete Request.JSONP.request_map[key];
  15794. this.success(arguments, index);
  15795. }.bind(this);
  15796. var script = this.getScript(src).inject(options.injectScript);
  15797. this.fireEvent('request', [src, script]);
  15798. if (options.timeout) this.timeout.delay(options.timeout, this);
  15799. return this;
  15800. },
  15801. getScript: function(src){
  15802. if (!this.script) this.script = new Element('script', {
  15803. type: 'text/javascript',
  15804. async: true,
  15805. src: src
  15806. });
  15807. return this.script;
  15808. },
  15809. success: function(args){
  15810. if (!this.running) return;
  15811. this.clear()
  15812. .fireEvent('complete', args).fireEvent('success', args)
  15813. .callChain();
  15814. },
  15815. cancel: function(){
  15816. if (this.running) this.clear().fireEvent('cancel');
  15817. return this;
  15818. },
  15819. isRunning: function(){
  15820. return !!this.running;
  15821. },
  15822. clear: function(){
  15823. this.running = false;
  15824. if (this.script){
  15825. this.script.destroy();
  15826. this.script = null;
  15827. }
  15828. return this;
  15829. },
  15830. timeout: function(){
  15831. if (this.running){
  15832. this.running = false;
  15833. this.fireEvent('timeout', [this.script.get('src'), this.script]).fireEvent('failure').cancel();
  15834. }
  15835. return this;
  15836. }
  15837. });
  15838. Request.JSONP.counter = 0;
  15839. Request.JSONP.request_map = {};
  15840. /*
  15841. ---
  15842. script: Request.Periodical.js
  15843. name: Request.Periodical
  15844. description: Requests the same URL to pull data from a server but increases the intervals if no data is returned to reduce the load
  15845. license: MIT-style license
  15846. authors:
  15847. - Christoph Pojer
  15848. requires:
  15849. - Core/Request
  15850. - MooTools.More
  15851. provides: [Request.Periodical]
  15852. ...
  15853. */
  15854. Request.implement({
  15855. options: {
  15856. initialDelay: 5000,
  15857. delay: 5000,
  15858. limit: 60000
  15859. },
  15860. startTimer: function(data){
  15861. var fn = function(){
  15862. if (!this.running) this.send({data: data});
  15863. };
  15864. this.lastDelay = this.options.initialDelay;
  15865. this.timer = fn.delay(this.lastDelay, this);
  15866. this.completeCheck = function(response){
  15867. clearTimeout(this.timer);
  15868. this.lastDelay = (response) ? this.options.delay : (this.lastDelay + this.options.delay).min(this.options.limit);
  15869. this.timer = fn.delay(this.lastDelay, this);
  15870. };
  15871. return this.addEvent('complete', this.completeCheck);
  15872. },
  15873. stopTimer: function(){
  15874. clearTimeout(this.timer);
  15875. return this.removeEvent('complete', this.completeCheck);
  15876. }
  15877. });
  15878. /*
  15879. ---
  15880. script: Request.Queue.js
  15881. name: Request.Queue
  15882. description: Controls several instances of Request and its variants to run only one request at a time.
  15883. license: MIT-style license
  15884. authors:
  15885. - Aaron Newton
  15886. requires:
  15887. - Core/Element
  15888. - Core/Request
  15889. - Class.Binds
  15890. provides: [Request.Queue]
  15891. ...
  15892. */
  15893. Request.Queue = new Class({
  15894. Implements: [Options, Events],
  15895. Binds: ['attach', 'request', 'complete', 'cancel', 'success', 'failure', 'exception'],
  15896. options: {/*
  15897. onRequest: function(argsPassedToOnRequest){},
  15898. onSuccess: function(argsPassedToOnSuccess){},
  15899. onComplete: function(argsPassedToOnComplete){},
  15900. onCancel: function(argsPassedToOnCancel){},
  15901. onException: function(argsPassedToOnException){},
  15902. onFailure: function(argsPassedToOnFailure){},
  15903. onEnd: function(){},
  15904. */
  15905. stopOnFailure: true,
  15906. autoAdvance: true,
  15907. concurrent: 1,
  15908. requests: {}
  15909. },
  15910. initialize: function(options){
  15911. var requests;
  15912. if (options){
  15913. requests = options.requests;
  15914. delete options.requests;
  15915. }
  15916. this.setOptions(options);
  15917. this.requests = {};
  15918. this.queue = [];
  15919. this.reqBinders = {};
  15920. if (requests) this.addRequests(requests);
  15921. },
  15922. addRequest: function(name, request){
  15923. this.requests[name] = request;
  15924. this.attach(name, request);
  15925. return this;
  15926. },
  15927. addRequests: function(obj){
  15928. Object.each(obj, function(req, name){
  15929. this.addRequest(name, req);
  15930. }, this);
  15931. return this;
  15932. },
  15933. getName: function(req){
  15934. return Object.keyOf(this.requests, req);
  15935. },
  15936. attach: function(name, req){
  15937. if (req._groupSend) return this;
  15938. ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){
  15939. if (!this.reqBinders[name]) this.reqBinders[name] = {};
  15940. this.reqBinders[name][evt] = function(){
  15941. this['on' + evt.capitalize()].apply(this, [name, req].append(arguments));
  15942. }.bind(this);
  15943. req.addEvent(evt, this.reqBinders[name][evt]);
  15944. }, this);
  15945. req._groupSend = req.send;
  15946. req.send = function(options){
  15947. this.send(name, options);
  15948. return req;
  15949. }.bind(this);
  15950. return this;
  15951. },
  15952. removeRequest: function(req){
  15953. var name = typeOf(req) == 'object' ? this.getName(req) : req;
  15954. if (!name && typeOf(name) != 'string') return this;
  15955. req = this.requests[name];
  15956. if (!req) return this;
  15957. ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){
  15958. req.removeEvent(evt, this.reqBinders[name][evt]);
  15959. }, this);
  15960. req.send = req._groupSend;
  15961. delete req._groupSend;
  15962. return this;
  15963. },
  15964. getRunning: function(){
  15965. return Object.filter(this.requests, function(r){
  15966. return r.running;
  15967. });
  15968. },
  15969. isRunning: function(){
  15970. return !!(Object.keys(this.getRunning()).length);
  15971. },
  15972. send: function(name, options){
  15973. var q = function(){
  15974. this.requests[name]._groupSend(options);
  15975. this.queue.erase(q);
  15976. }.bind(this);
  15977. q.name = name;
  15978. if (Object.keys(this.getRunning()).length >= this.options.concurrent || (this.error && this.options.stopOnFailure)) this.queue.push(q);
  15979. else q();
  15980. return this;
  15981. },
  15982. hasNext: function(name){
  15983. return (!name) ? !!this.queue.length : !!this.queue.filter(function(q){ return q.name == name; }).length;
  15984. },
  15985. resume: function(){
  15986. this.error = false;
  15987. (this.options.concurrent - Object.keys(this.getRunning()).length).times(this.runNext, this);
  15988. return this;
  15989. },
  15990. runNext: function(name){
  15991. if (!this.queue.length) return this;
  15992. if (!name){
  15993. this.queue[0]();
  15994. } else {
  15995. var found;
  15996. this.queue.each(function(q){
  15997. if (!found && q.name == name){
  15998. found = true;
  15999. q();
  16000. }
  16001. });
  16002. }
  16003. return this;
  16004. },
  16005. runAll: function(){
  16006. this.queue.each(function(q){
  16007. q();
  16008. });
  16009. return this;
  16010. },
  16011. clear: function(name){
  16012. if (!name){
  16013. this.queue.empty();
  16014. } else {
  16015. this.queue = this.queue.map(function(q){
  16016. if (q.name != name) return q;
  16017. else return false;
  16018. }).filter(function(q){
  16019. return q;
  16020. });
  16021. }
  16022. return this;
  16023. },
  16024. cancel: function(name){
  16025. this.requests[name].cancel();
  16026. return this;
  16027. },
  16028. onRequest: function(){
  16029. this.fireEvent('request', arguments);
  16030. },
  16031. onComplete: function(){
  16032. this.fireEvent('complete', arguments);
  16033. if (!this.queue.length) this.fireEvent('end');
  16034. },
  16035. onCancel: function(){
  16036. if (this.options.autoAdvance && !this.error) this.runNext();
  16037. this.fireEvent('cancel', arguments);
  16038. },
  16039. onSuccess: function(){
  16040. if (this.options.autoAdvance && !this.error) this.runNext();
  16041. this.fireEvent('success', arguments);
  16042. },
  16043. onFailure: function(){
  16044. this.error = true;
  16045. if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext();
  16046. this.fireEvent('failure', arguments);
  16047. },
  16048. onException: function(){
  16049. this.error = true;
  16050. if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext();
  16051. this.fireEvent('exception', arguments);
  16052. }
  16053. });
  16054. /*
  16055. ---
  16056. script: Array.Extras.js
  16057. name: Array.Extras
  16058. description: Extends the Array native object to include useful methods to work with arrays.
  16059. license: MIT-style license
  16060. authors:
  16061. - Christoph Pojer
  16062. - Sebastian Markbåge
  16063. requires:
  16064. - Core/Array
  16065. - MooTools.More
  16066. provides: [Array.Extras]
  16067. ...
  16068. */
  16069. (function(nil){
  16070. Array.implement({
  16071. min: function(){
  16072. return Math.min.apply(null, this);
  16073. },
  16074. max: function(){
  16075. return Math.max.apply(null, this);
  16076. },
  16077. average: function(){
  16078. return this.length ? this.sum() / this.length : 0;
  16079. },
  16080. sum: function(){
  16081. var result = 0, l = this.length;
  16082. if (l){
  16083. while (l--){
  16084. if (this[l] != null) result += parseFloat(this[l]);
  16085. }
  16086. }
  16087. return result;
  16088. },
  16089. unique: function(){
  16090. return [].combine(this);
  16091. },
  16092. shuffle: function(){
  16093. for (var i = this.length; i && --i;){
  16094. var temp = this[i], r = Math.floor(Math.random() * ( i + 1 ));
  16095. this[i] = this[r];
  16096. this[r] = temp;
  16097. }
  16098. return this;
  16099. },
  16100. reduce: function(fn, value){
  16101. for (var i = 0, l = this.length; i < l; i++){
  16102. if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this);
  16103. }
  16104. return value;
  16105. },
  16106. reduceRight: function(fn, value){
  16107. var i = this.length;
  16108. while (i--){
  16109. if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this);
  16110. }
  16111. return value;
  16112. },
  16113. pluck: function(prop){
  16114. return this.map(function(item){
  16115. return item[prop];
  16116. });
  16117. }
  16118. });
  16119. })();
  16120. /*
  16121. ---
  16122. script: Date.Extras.js
  16123. name: Date.Extras
  16124. description: Extends the Date native object to include extra methods (on top of those in Date.js).
  16125. license: MIT-style license
  16126. authors:
  16127. - Aaron Newton
  16128. - Scott Kyle
  16129. requires:
  16130. - Date
  16131. provides: [Date.Extras]
  16132. ...
  16133. */
  16134. Date.implement({
  16135. timeDiffInWords: function(to){
  16136. return Date.distanceOfTimeInWords(this, to || new Date);
  16137. },
  16138. timeDiff: function(to, separator){
  16139. if (to == null) to = new Date;
  16140. var delta = ((to - this) / 1000).floor().abs();
  16141. var vals = [],
  16142. durations = [60, 60, 24, 365, 0],
  16143. names = ['s', 'm', 'h', 'd', 'y'],
  16144. value, duration;
  16145. for (var item = 0; item < durations.length; item++){
  16146. if (item && !delta) break;
  16147. value = delta;
  16148. if ((duration = durations[item])){
  16149. value = (delta % duration);
  16150. delta = (delta / duration).floor();
  16151. }
  16152. vals.unshift(value + (names[item] || ''));
  16153. }
  16154. return vals.join(separator || ':');
  16155. }
  16156. }).extend({
  16157. distanceOfTimeInWords: function(from, to){
  16158. return Date.getTimePhrase(((to - from) / 1000).toInt());
  16159. },
  16160. getTimePhrase: function(delta){
  16161. var suffix = (delta < 0) ? 'Until' : 'Ago';
  16162. if (delta < 0) delta *= -1;
  16163. var units = {
  16164. minute: 60,
  16165. hour: 60,
  16166. day: 24,
  16167. week: 7,
  16168. month: 52 / 12,
  16169. year: 12,
  16170. eon: Infinity
  16171. };
  16172. var msg = 'lessThanMinute';
  16173. for (var unit in units){
  16174. var interval = units[unit];
  16175. if (delta < 1.5 * interval){
  16176. if (delta > 0.75 * interval) msg = unit;
  16177. break;
  16178. }
  16179. delta /= interval;
  16180. msg = unit + 's';
  16181. }
  16182. delta = delta.round();
  16183. return Date.getMsg(msg + suffix, delta).substitute({delta: delta});
  16184. }
  16185. }).defineParsers(
  16186. {
  16187. // "today", "tomorrow", "yesterday"
  16188. re: /^(?:tod|tom|yes)/i,
  16189. handler: function(bits){
  16190. var d = new Date().clearTime();
  16191. switch (bits[0]){
  16192. case 'tom': return d.increment();
  16193. case 'yes': return d.decrement();
  16194. default: return d;
  16195. }
  16196. }
  16197. },
  16198. {
  16199. // "next Wednesday", "last Thursday"
  16200. re: /^(next|last) ([a-z]+)$/i,
  16201. handler: function(bits){
  16202. var d = new Date().clearTime();
  16203. var day = d.getDay();
  16204. var newDay = Date.parseDay(bits[2], true);
  16205. var addDays = newDay - day;
  16206. if (newDay <= day) addDays += 7;
  16207. if (bits[1] == 'last') addDays -= 7;
  16208. return d.set('date', d.getDate() + addDays);
  16209. }
  16210. }
  16211. ).alias('timeAgoInWords', 'timeDiffInWords');
  16212. /*
  16213. ---
  16214. name: Hash
  16215. description: Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects.
  16216. license: MIT-style license.
  16217. requires:
  16218. - Core/Object
  16219. - MooTools.More
  16220. provides: [Hash]
  16221. ...
  16222. */
  16223. (function(){
  16224. if (this.Hash) return;
  16225. var Hash = this.Hash = new Type('Hash', function(object){
  16226. if (typeOf(object) == 'hash') object = Object.clone(object.getClean());
  16227. for (var key in object) this[key] = object[key];
  16228. return this;
  16229. });
  16230. this.$H = function(object){
  16231. return new Hash(object);
  16232. };
  16233. Hash.implement({
  16234. forEach: function(fn, bind){
  16235. Object.forEach(this, fn, bind);
  16236. },
  16237. getClean: function(){
  16238. var clean = {};
  16239. for (var key in this){
  16240. if (this.hasOwnProperty(key)) clean[key] = this[key];
  16241. }
  16242. return clean;
  16243. },
  16244. getLength: function(){
  16245. var length = 0;
  16246. for (var key in this){
  16247. if (this.hasOwnProperty(key)) length++;
  16248. }
  16249. return length;
  16250. }
  16251. });
  16252. Hash.alias('each', 'forEach');
  16253. Hash.implement({
  16254. has: Object.prototype.hasOwnProperty,
  16255. keyOf: function(value){
  16256. return Object.keyOf(this, value);
  16257. },
  16258. hasValue: function(value){
  16259. return Object.contains(this, value);
  16260. },
  16261. extend: function(properties){
  16262. Hash.each(properties || {}, function(value, key){
  16263. Hash.set(this, key, value);
  16264. }, this);
  16265. return this;
  16266. },
  16267. combine: function(properties){
  16268. Hash.each(properties || {}, function(value, key){
  16269. Hash.include(this, key, value);
  16270. }, this);
  16271. return this;
  16272. },
  16273. erase: function(key){
  16274. if (this.hasOwnProperty(key)) delete this[key];
  16275. return this;
  16276. },
  16277. get: function(key){
  16278. return (this.hasOwnProperty(key)) ? this[key] : null;
  16279. },
  16280. set: function(key, value){
  16281. if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
  16282. return this;
  16283. },
  16284. empty: function(){
  16285. Hash.each(this, function(value, key){
  16286. delete this[key];
  16287. }, this);
  16288. return this;
  16289. },
  16290. include: function(key, value){
  16291. if (this[key] == undefined) this[key] = value;
  16292. return this;
  16293. },
  16294. map: function(fn, bind){
  16295. return new Hash(Object.map(this, fn, bind));
  16296. },
  16297. filter: function(fn, bind){
  16298. return new Hash(Object.filter(this, fn, bind));
  16299. },
  16300. every: function(fn, bind){
  16301. return Object.every(this, fn, bind);
  16302. },
  16303. some: function(fn, bind){
  16304. return Object.some(this, fn, bind);
  16305. },
  16306. getKeys: function(){
  16307. return Object.keys(this);
  16308. },
  16309. getValues: function(){
  16310. return Object.values(this);
  16311. },
  16312. toQueryString: function(base){
  16313. return Object.toQueryString(this, base);
  16314. }
  16315. });
  16316. Hash.alias({indexOf: 'keyOf', contains: 'hasValue'});
  16317. })();
  16318. /*
  16319. ---
  16320. script: Hash.Extras.js
  16321. name: Hash.Extras
  16322. description: Extends the Hash Type to include getFromPath which allows a path notation to child elements.
  16323. license: MIT-style license
  16324. authors:
  16325. - Aaron Newton
  16326. requires:
  16327. - Hash
  16328. - Object.Extras
  16329. provides: [Hash.Extras]
  16330. ...
  16331. */
  16332. Hash.implement({
  16333. getFromPath: function(notation){
  16334. return Object.getFromPath(this, notation);
  16335. },
  16336. cleanValues: function(method){
  16337. return new Hash(Object.cleanValues(this, method));
  16338. },
  16339. run: function(){
  16340. Object.run(arguments);
  16341. }
  16342. });
  16343. /*
  16344. ---
  16345. name: Number.Format
  16346. description: Extends the Number Type object to include a number formatting method.
  16347. license: MIT-style license
  16348. authors: [Arian Stolwijk]
  16349. requires: [Core/Number, Locale.en-US.Number]
  16350. # Number.Extras is for compatibility
  16351. provides: [Number.Format, Number.Extras]
  16352. ...
  16353. */
  16354. Number.implement({
  16355. format: function(options){
  16356. // Thanks dojo and YUI for some inspiration
  16357. var value = this;
  16358. options = options ? Object.clone(options) : {};
  16359. var getOption = function(key){
  16360. if (options[key] != null) return options[key];
  16361. return Locale.get('Number.' + key);
  16362. };
  16363. var negative = value < 0,
  16364. decimal = getOption('decimal'),
  16365. precision = getOption('precision'),
  16366. group = getOption('group'),
  16367. decimals = getOption('decimals');
  16368. if (negative){
  16369. var negativeLocale = getOption('negative') || {};
  16370. if (negativeLocale.prefix == null && negativeLocale.suffix == null) negativeLocale.prefix = '-';
  16371. ['prefix', 'suffix'].each(function(key){
  16372. if (negativeLocale[key]) options[key] = getOption(key) + negativeLocale[key];
  16373. });
  16374. value = -value;
  16375. }
  16376. var prefix = getOption('prefix'),
  16377. suffix = getOption('suffix');
  16378. if (decimals !== '' && decimals >= 0 && decimals <= 20) value = value.toFixed(decimals);
  16379. if (precision >= 1 && precision <= 21) value = (+value).toPrecision(precision);
  16380. value += '';
  16381. var index;
  16382. if (getOption('scientific') === false && value.indexOf('e') > -1){
  16383. var match = value.split('e'),
  16384. zeros = +match[1];
  16385. value = match[0].replace('.', '');
  16386. if (zeros < 0){
  16387. zeros = -zeros - 1;
  16388. index = match[0].indexOf('.');
  16389. if (index > -1) zeros -= index - 1;
  16390. while (zeros--) value = '0' + value;
  16391. value = '0.' + value;
  16392. } else {
  16393. index = match[0].lastIndexOf('.');
  16394. if (index > -1) zeros -= match[0].length - index - 1;
  16395. while (zeros--) value += '0';
  16396. }
  16397. }
  16398. if (decimal != '.') value = value.replace('.', decimal);
  16399. if (group){
  16400. index = value.lastIndexOf(decimal);
  16401. index = (index > -1) ? index : value.length;
  16402. var newOutput = value.substring(index),
  16403. i = index;
  16404. while (i--){
  16405. if ((index - i - 1) % 3 == 0 && i != (index - 1)) newOutput = group + newOutput;
  16406. newOutput = value.charAt(i) + newOutput;
  16407. }
  16408. value = newOutput;
  16409. }
  16410. if (prefix) value = prefix + value;
  16411. if (suffix) value += suffix;
  16412. return value;
  16413. },
  16414. formatCurrency: function(decimals){
  16415. var locale = Locale.get('Number.currency') || {};
  16416. if (locale.scientific == null) locale.scientific = false;
  16417. locale.decimals = decimals != null ? decimals
  16418. : (locale.decimals == null ? 2 : locale.decimals);
  16419. return this.format(locale);
  16420. },
  16421. formatPercentage: function(decimals){
  16422. var locale = Locale.get('Number.percentage') || {};
  16423. if (locale.suffix == null) locale.suffix = '%';
  16424. locale.decimals = decimals != null ? decimals
  16425. : (locale.decimals == null ? 2 : locale.decimals);
  16426. return this.format(locale);
  16427. }
  16428. });
  16429. /*
  16430. ---
  16431. script: URI.js
  16432. name: URI
  16433. description: Provides methods useful in managing the window location and uris.
  16434. license: MIT-style license
  16435. authors:
  16436. - Sebastian Markbåge
  16437. - Aaron Newton
  16438. requires:
  16439. - Core/Object
  16440. - Core/Class
  16441. - Core/Class.Extras
  16442. - Core/Element
  16443. - String.QueryString
  16444. provides: [URI]
  16445. ...
  16446. */
  16447. (function(){
  16448. var toString = function(){
  16449. return this.get('value');
  16450. };
  16451. var URI = this.URI = new Class({
  16452. Implements: Options,
  16453. options: {
  16454. /*base: false*/
  16455. },
  16456. regex: /^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[A-Fa-f0-9:]+\]|[^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,
  16457. parts: ['scheme', 'user', 'password', 'host', 'port', 'directory', 'file', 'query', 'fragment'],
  16458. schemes: {http: 80, https: 443, ftp: 21, rtsp: 554, mms: 1755, file: 0},
  16459. initialize: function(uri, options){
  16460. this.setOptions(options);
  16461. var base = this.options.base || URI.base;
  16462. if (!uri) uri = base;
  16463. if (uri && uri.parsed) this.parsed = Object.clone(uri.parsed);
  16464. else this.set('value', uri.href || uri.toString(), base ? new URI(base) : false);
  16465. },
  16466. parse: function(value, base){
  16467. var bits = value.match(this.regex);
  16468. if (!bits) return false;
  16469. bits.shift();
  16470. return this.merge(bits.associate(this.parts), base);
  16471. },
  16472. merge: function(bits, base){
  16473. if ((!bits || !bits.scheme) && (!base || !base.scheme)) return false;
  16474. if (base){
  16475. this.parts.every(function(part){
  16476. if (bits[part]) return false;
  16477. bits[part] = base[part] || '';
  16478. return true;
  16479. });
  16480. }
  16481. bits.port = bits.port || this.schemes[bits.scheme.toLowerCase()];
  16482. bits.directory = bits.directory ? this.parseDirectory(bits.directory, base ? base.directory : '') : '/';
  16483. return bits;
  16484. },
  16485. parseDirectory: function(directory, baseDirectory){
  16486. directory = (directory.substr(0, 1) == '/' ? '' : (baseDirectory || '/')) + directory;
  16487. if (!directory.test(URI.regs.directoryDot)) return directory;
  16488. var result = [];
  16489. directory.replace(URI.regs.endSlash, '').split('/').each(function(dir){
  16490. if (dir == '..' && result.length > 0) result.pop();
  16491. else if (dir != '.') result.push(dir);
  16492. });
  16493. return result.join('/') + '/';
  16494. },
  16495. combine: function(bits){
  16496. return bits.value || bits.scheme + '://' +
  16497. (bits.user ? bits.user + (bits.password ? ':' + bits.password : '') + '@' : '') +
  16498. (bits.host || '') + (bits.port && bits.port != this.schemes[bits.scheme] ? ':' + bits.port : '') +
  16499. (bits.directory || '/') + (bits.file || '') +
  16500. (bits.query ? '?' + bits.query : '') +
  16501. (bits.fragment ? '#' + bits.fragment : '');
  16502. },
  16503. set: function(part, value, base){
  16504. if (part == 'value'){
  16505. var scheme = value.match(URI.regs.scheme);
  16506. if (scheme) scheme = scheme[1];
  16507. if (scheme && this.schemes[scheme.toLowerCase()] == null) this.parsed = { scheme: scheme, value: value };
  16508. else this.parsed = this.parse(value, (base || this).parsed) || (scheme ? { scheme: scheme, value: value } : { value: value });
  16509. } else if (part == 'data'){
  16510. this.setData(value);
  16511. } else {
  16512. this.parsed[part] = value;
  16513. }
  16514. return this;
  16515. },
  16516. get: function(part, base){
  16517. switch (part){
  16518. case 'value': return this.combine(this.parsed, base ? base.parsed : false);
  16519. case 'data' : return this.getData();
  16520. }
  16521. return this.parsed[part] || '';
  16522. },
  16523. go: function(){
  16524. document.location.href = this.toString();
  16525. },
  16526. toURI: function(){
  16527. return this;
  16528. },
  16529. getData: function(key, part){
  16530. var qs = this.get(part || 'query');
  16531. if (!(qs || qs === 0)) return key ? null : {};
  16532. var obj = qs.parseQueryString();
  16533. return key ? obj[key] : obj;
  16534. },
  16535. setData: function(values, merge, part){
  16536. if (typeof values == 'string'){
  16537. var data = this.getData();
  16538. data[arguments[0]] = arguments[1];
  16539. values = data;
  16540. } else if (merge){
  16541. values = Object.merge(this.getData(null, part), values);
  16542. }
  16543. return this.set(part || 'query', Object.toQueryString(values));
  16544. },
  16545. clearData: function(part){
  16546. return this.set(part || 'query', '');
  16547. },
  16548. toString: toString,
  16549. valueOf: toString
  16550. });
  16551. URI.regs = {
  16552. endSlash: /\/$/,
  16553. scheme: /^(\w+):/,
  16554. directoryDot: /\.\/|\.$/
  16555. };
  16556. URI.base = new URI(Array.convert(document.getElements('base[href]', true)).getLast(), {base: document.location});
  16557. String.implement({
  16558. toURI: function(options){
  16559. return new URI(this, options);
  16560. }
  16561. });
  16562. })();
  16563. /*
  16564. ---
  16565. script: URI.Relative.js
  16566. name: URI.Relative
  16567. description: Extends the URI class to add methods for computing relative and absolute urls.
  16568. license: MIT-style license
  16569. authors:
  16570. - Sebastian Markbåge
  16571. requires:
  16572. - Class.refactor
  16573. - URI
  16574. provides: [URI.Relative]
  16575. ...
  16576. */
  16577. URI = Class.refactor(URI, {
  16578. combine: function(bits, base){
  16579. if (!base || bits.scheme != base.scheme || bits.host != base.host || bits.port != base.port)
  16580. return this.previous.apply(this, arguments);
  16581. var end = bits.file + (bits.query ? '?' + bits.query : '') + (bits.fragment ? '#' + bits.fragment : '');
  16582. if (!base.directory) return (bits.directory || (bits.file ? '' : './')) + end;
  16583. var baseDir = base.directory.split('/'),
  16584. relDir = bits.directory.split('/'),
  16585. path = '',
  16586. offset;
  16587. var i = 0;
  16588. for (offset = 0; offset < baseDir.length && offset < relDir.length && baseDir[offset] == relDir[offset]; offset++);
  16589. for (i = 0; i < baseDir.length - offset - 1; i++) path += '../';
  16590. for (i = offset; i < relDir.length - 1; i++) path += relDir[i] + '/';
  16591. return (path || (bits.file ? '' : './')) + end;
  16592. },
  16593. toAbsolute: function(base){
  16594. base = new URI(base);
  16595. if (base) base.set('directory', '').set('file', '');
  16596. return this.toRelative(base);
  16597. },
  16598. toRelative: function(base){
  16599. return this.get('value', new URI(base));
  16600. }
  16601. });
  16602. /*
  16603. ---
  16604. script: Assets.js
  16605. name: Assets
  16606. description: Provides methods to dynamically load JavaScript, CSS, and Image files into the document.
  16607. license: MIT-style license
  16608. authors:
  16609. - Valerio Proietti
  16610. requires:
  16611. - Core/Element.Event
  16612. - MooTools.More
  16613. provides: [Assets, Asset.javascript, Asset.css, Asset.image, Asset.images]
  16614. ...
  16615. */
  16616. ;(function(){
  16617. var Asset = this.Asset = {
  16618. javascript: function(source, properties){
  16619. if (!properties) properties = {};
  16620. var script = new Element('script', {src: source, type: 'text/javascript'}),
  16621. doc = properties.document || document,
  16622. load = properties.onload || properties.onLoad;
  16623. delete properties.onload;
  16624. delete properties.onLoad;
  16625. delete properties.document;
  16626. if (load){
  16627. if (!script.addEventListener){
  16628. script.addEvent('readystatechange', function(){
  16629. if (['loaded', 'complete'].contains(this.readyState)) load.call(this);
  16630. });
  16631. } else {
  16632. script.addEvent('load', load);
  16633. }
  16634. }
  16635. return script.set(properties).inject(doc.head);
  16636. },
  16637. css: function(source, properties){
  16638. if (!properties) properties = {};
  16639. var load = properties.onload || properties.onLoad,
  16640. doc = properties.document || document,
  16641. timeout = properties.timeout || 3000;
  16642. ['onload', 'onLoad', 'document'].each(function(prop){
  16643. delete properties[prop];
  16644. });
  16645. var link = new Element('link', {
  16646. type: 'text/css',
  16647. rel: 'stylesheet',
  16648. media: 'screen',
  16649. href: source
  16650. }).setProperties(properties).inject(doc.head);
  16651. if (load){
  16652. // based on article at http://www.yearofmoo.com/2011/03/cross-browser-stylesheet-preloading.html
  16653. var loaded = false, retries = 0;
  16654. var check = function(){
  16655. var stylesheets = document.styleSheets;
  16656. for (var i = 0; i < stylesheets.length; i++){
  16657. var file = stylesheets[i];
  16658. var owner = file.ownerNode ? file.ownerNode : file.owningElement;
  16659. if (owner && owner == link){
  16660. loaded = true;
  16661. return load.call(link);
  16662. }
  16663. }
  16664. retries++;
  16665. if (!loaded && retries < timeout / 50) return setTimeout(check, 50);
  16666. };
  16667. setTimeout(check, 0);
  16668. }
  16669. return link;
  16670. },
  16671. image: function(source, properties){
  16672. if (!properties) properties = {};
  16673. var image = new Image(),
  16674. element = document.id(image) || new Element('img');
  16675. ['load', 'abort', 'error'].each(function(name){
  16676. var type = 'on' + name,
  16677. cap = 'on' + name.capitalize(),
  16678. event = properties[type] || properties[cap] || function(){};
  16679. delete properties[cap];
  16680. delete properties[type];
  16681. image[type] = function(){
  16682. if (!image) return;
  16683. if (!element.parentNode){
  16684. element.width = image.width;
  16685. element.height = image.height;
  16686. }
  16687. image = image.onload = image.onabort = image.onerror = null;
  16688. event.delay(1, element, element);
  16689. element.fireEvent(name, element, 1);
  16690. };
  16691. });
  16692. image.src = element.src = source;
  16693. if (image && image.complete) image.onload.delay(1);
  16694. return element.set(properties);
  16695. },
  16696. images: function(sources, options){
  16697. sources = Array.convert(sources);
  16698. var fn = function(){},
  16699. counter = 0;
  16700. options = Object.merge({
  16701. onComplete: fn,
  16702. onProgress: fn,
  16703. onError: fn,
  16704. properties: {}
  16705. }, options);
  16706. return new Elements(sources.map(function(source, index){
  16707. return Asset.image(source, Object.append(options.properties, {
  16708. onload: function(){
  16709. counter++;
  16710. options.onProgress.call(this, counter, index, source);
  16711. if (counter == sources.length) options.onComplete();
  16712. },
  16713. onerror: function(){
  16714. counter++;
  16715. options.onError.call(this, counter, index, source);
  16716. if (counter == sources.length) options.onComplete();
  16717. }
  16718. }));
  16719. }));
  16720. }
  16721. };
  16722. })();
  16723. /*
  16724. ---
  16725. script: Color.js
  16726. name: Color
  16727. description: Class for creating and manipulating colors in JavaScript. Supports HSB -> RGB Conversions and vice versa.
  16728. license: MIT-style license
  16729. authors:
  16730. - Valerio Proietti
  16731. requires:
  16732. - Core/Array
  16733. - Core/String
  16734. - Core/Number
  16735. - Core/Hash
  16736. - Core/Function
  16737. - MooTools.More
  16738. provides: [Color]
  16739. ...
  16740. */
  16741. (function(){
  16742. var Color = this.Color = new Type('Color', function(color, type){
  16743. if (arguments.length >= 3){
  16744. type = 'rgb'; color = Array.slice(arguments, 0, 3);
  16745. } else if (typeof color == 'string'){
  16746. if (color.match(/rgb/)) color = color.rgbToHex().hexToRgb(true);
  16747. else if (color.match(/hsb/)) color = color.hsbToRgb();
  16748. else color = color.hexToRgb(true);
  16749. }
  16750. type = type || 'rgb';
  16751. switch (type){
  16752. case 'hsb':
  16753. var old = color;
  16754. color = color.hsbToRgb();
  16755. color.hsb = old;
  16756. break;
  16757. case 'hex': color = color.hexToRgb(true); break;
  16758. }
  16759. color.rgb = color.slice(0, 3);
  16760. color.hsb = color.hsb || color.rgbToHsb();
  16761. color.hex = color.rgbToHex();
  16762. return Object.append(color, this);
  16763. });
  16764. Color.implement({
  16765. mix: function(){
  16766. var colors = Array.slice(arguments);
  16767. var alpha = (typeOf(colors.getLast()) == 'number') ? colors.pop() : 50;
  16768. var rgb = this.slice();
  16769. colors.each(function(color){
  16770. color = new Color(color);
  16771. for (var i = 0; i < 3; i++) rgb[i] = Math.round((rgb[i] / 100 * (100 - alpha)) + (color[i] / 100 * alpha));
  16772. });
  16773. return new Color(rgb, 'rgb');
  16774. },
  16775. invert: function(){
  16776. return new Color(this.map(function(value){
  16777. return 255 - value;
  16778. }));
  16779. },
  16780. setHue: function(value){
  16781. return new Color([value, this.hsb[1], this.hsb[2]], 'hsb');
  16782. },
  16783. setSaturation: function(percent){
  16784. return new Color([this.hsb[0], percent, this.hsb[2]], 'hsb');
  16785. },
  16786. setBrightness: function(percent){
  16787. return new Color([this.hsb[0], this.hsb[1], percent], 'hsb');
  16788. }
  16789. });
  16790. this.$RGB = function(r, g, b){
  16791. return new Color([r, g, b], 'rgb');
  16792. };
  16793. this.$HSB = function(h, s, b){
  16794. return new Color([h, s, b], 'hsb');
  16795. };
  16796. this.$HEX = function(hex){
  16797. return new Color(hex, 'hex');
  16798. };
  16799. Array.implement({
  16800. rgbToHsb: function(){
  16801. var red = this[0],
  16802. green = this[1],
  16803. blue = this[2],
  16804. hue = 0,
  16805. max = Math.max(red, green, blue),
  16806. min = Math.min(red, green, blue),
  16807. delta = max - min,
  16808. brightness = max / 255,
  16809. saturation = (max != 0) ? delta / max : 0;
  16810. if (saturation != 0){
  16811. var rr = (max - red) / delta;
  16812. var gr = (max - green) / delta;
  16813. var br = (max - blue) / delta;
  16814. if (red == max) hue = br - gr;
  16815. else if (green == max) hue = 2 + rr - br;
  16816. else hue = 4 + gr - rr;
  16817. hue /= 6;
  16818. if (hue < 0) hue++;
  16819. }
  16820. return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)];
  16821. },
  16822. hsbToRgb: function(){
  16823. var br = Math.round(this[2] / 100 * 255);
  16824. if (this[1] == 0){
  16825. return [br, br, br];
  16826. } else {
  16827. var hue = this[0] % 360;
  16828. var f = hue % 60;
  16829. var p = Math.round((this[2] * (100 - this[1])) / 10000 * 255);
  16830. var q = Math.round((this[2] * (6000 - this[1] * f)) / 600000 * 255);
  16831. var t = Math.round((this[2] * (6000 - this[1] * (60 - f))) / 600000 * 255);
  16832. switch (Math.floor(hue / 60)){
  16833. case 0: return [br, t, p];
  16834. case 1: return [q, br, p];
  16835. case 2: return [p, br, t];
  16836. case 3: return [p, q, br];
  16837. case 4: return [t, p, br];
  16838. case 5: return [br, p, q];
  16839. }
  16840. }
  16841. return false;
  16842. }
  16843. });
  16844. String.implement({
  16845. rgbToHsb: function(){
  16846. var rgb = this.match(/\d{1,3}/g);
  16847. return (rgb) ? rgb.rgbToHsb() : null;
  16848. },
  16849. hsbToRgb: function(){
  16850. var hsb = this.match(/\d{1,3}/g);
  16851. return (hsb) ? hsb.hsbToRgb() : null;
  16852. }
  16853. });
  16854. })();
  16855. /*
  16856. ---
  16857. script: Group.js
  16858. name: Group
  16859. description: Class for monitoring collections of events
  16860. license: MIT-style license
  16861. authors:
  16862. - Valerio Proietti
  16863. requires:
  16864. - Core/Events
  16865. - MooTools.More
  16866. provides: [Group]
  16867. ...
  16868. */
  16869. (function(){
  16870. var Group = this.Group = new Class({
  16871. initialize: function(){
  16872. this.instances = Array.flatten(arguments);
  16873. },
  16874. addEvent: function(type, fn){
  16875. var instances = this.instances,
  16876. len = instances.length,
  16877. togo = len,
  16878. args = new Array(len),
  16879. self = this;
  16880. instances.each(function(instance, i){
  16881. instance.addEvent(type, function(){
  16882. if (!args[i]) togo--;
  16883. args[i] = arguments;
  16884. if (!togo){
  16885. fn.call(self, instances, instance, args);
  16886. togo = len;
  16887. args = new Array(len);
  16888. }
  16889. });
  16890. });
  16891. }
  16892. });
  16893. })();
  16894. /*
  16895. ---
  16896. script: Hash.Cookie.js
  16897. name: Hash.Cookie
  16898. description: Class for creating, reading, and deleting Cookies in JSON format.
  16899. license: MIT-style license
  16900. authors:
  16901. - Valerio Proietti
  16902. - Aaron Newton
  16903. requires:
  16904. - Core/Cookie
  16905. - Core/JSON
  16906. - MooTools.More
  16907. - Hash
  16908. provides: [Hash.Cookie]
  16909. ...
  16910. */
  16911. Hash.Cookie = new Class({
  16912. Extends: Cookie,
  16913. options: {
  16914. autoSave: true
  16915. },
  16916. initialize: function(name, options){
  16917. this.parent(name, options);
  16918. this.load();
  16919. },
  16920. save: function(){
  16921. var value = JSON.encode(this.hash);
  16922. if (!value || value.length > 4096) return false; //cookie would be truncated!
  16923. if (value == '{}') this.dispose();
  16924. else this.write(value);
  16925. return true;
  16926. },
  16927. load: function(){
  16928. this.hash = new Hash(JSON.decode(this.read(), true));
  16929. return this;
  16930. }
  16931. });
  16932. Hash.each(Hash.prototype, function(method, name){
  16933. if (typeof method == 'function') Hash.Cookie.implement(name, function(){
  16934. var value = method.apply(this.hash, arguments);
  16935. if (this.options.autoSave) this.save();
  16936. return value;
  16937. });
  16938. });
  16939. /*
  16940. ---
  16941. name: Swiff
  16942. description: Wrapper for embedding SWF movies. Supports External Interface Communication.
  16943. license: MIT-style license.
  16944. credits:
  16945. - Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject.
  16946. requires: [Core/Options, Core/Object, Core/Element]
  16947. provides: Swiff
  16948. ...
  16949. */
  16950. (function(){
  16951. var Swiff = this.Swiff = new Class({
  16952. Implements: Options,
  16953. options: {
  16954. id: null,
  16955. height: 1,
  16956. width: 1,
  16957. container: null,
  16958. properties: {},
  16959. params: {
  16960. quality: 'high',
  16961. allowScriptAccess: 'always',
  16962. wMode: 'window',
  16963. swLiveConnect: true
  16964. },
  16965. callBacks: {},
  16966. vars: {}
  16967. },
  16968. toElement: function(){
  16969. return this.object;
  16970. },
  16971. initialize: function(path, options){
  16972. this.instance = 'Swiff_' + String.uniqueID();
  16973. this.setOptions(options);
  16974. options = this.options;
  16975. var id = this.id = options.id || this.instance;
  16976. var container = document.id(options.container);
  16977. Swiff.CallBacks[this.instance] = {};
  16978. var params = options.params, vars = options.vars, callBacks = options.callBacks;
  16979. var properties = Object.append({height: options.height, width: options.width}, options.properties);
  16980. var self = this;
  16981. for (var callBack in callBacks){
  16982. Swiff.CallBacks[this.instance][callBack] = (function(option){
  16983. return function(){
  16984. return option.apply(self.object, arguments);
  16985. };
  16986. })(callBacks[callBack]);
  16987. vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack;
  16988. }
  16989. params.flashVars = Object.toQueryString(vars);
  16990. if ('ActiveXObject' in window){
  16991. properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
  16992. params.movie = path;
  16993. } else {
  16994. properties.type = 'application/x-shockwave-flash';
  16995. }
  16996. properties.data = path;
  16997. var build = '<object id="' + id + '"';
  16998. for (var property in properties) build += ' ' + property + '="' + properties[property] + '"';
  16999. build += '>';
  17000. for (var param in params){
  17001. if (params[param]) build += '<param name="' + param + '" value="' + params[param] + '" />';
  17002. }
  17003. build += '</object>';
  17004. this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild;
  17005. },
  17006. replaces: function(element){
  17007. element = document.id(element, true);
  17008. element.parentNode.replaceChild(this.toElement(), element);
  17009. return this;
  17010. },
  17011. inject: function(element){
  17012. document.id(element, true).appendChild(this.toElement());
  17013. return this;
  17014. },
  17015. remote: function(){
  17016. return Swiff.remote.apply(Swiff, [this.toElement()].append(arguments));
  17017. }
  17018. });
  17019. Swiff.CallBacks = {};
  17020. Swiff.remote = function(obj, fn){
  17021. var rs = obj.CallFunction('<invoke name="' + fn + '" returntype="javascript">' + __flash__argumentsToXML(arguments, 2) + '</invoke>');
  17022. return eval(rs);
  17023. };
  17024. })();
  17025. /*
  17026. ---
  17027. name: Table
  17028. description: LUA-Style table implementation.
  17029. license: MIT-style license
  17030. authors:
  17031. - Valerio Proietti
  17032. requires: [Core/Array]
  17033. provides: [Table]
  17034. ...
  17035. */
  17036. (function(){
  17037. var Table = this.Table = function(){
  17038. this.length = 0;
  17039. var keys = [],
  17040. values = [];
  17041. this.set = function(key, value){
  17042. var index = keys.indexOf(key);
  17043. if (index == -1){
  17044. var length = keys.length;
  17045. keys[length] = key;
  17046. values[length] = value;
  17047. this.length++;
  17048. } else {
  17049. values[index] = value;
  17050. }
  17051. return this;
  17052. };
  17053. this.get = function(key){
  17054. var index = keys.indexOf(key);
  17055. return (index == -1) ? null : values[index];
  17056. };
  17057. this.erase = function(key){
  17058. var index = keys.indexOf(key);
  17059. if (index != -1){
  17060. this.length--;
  17061. keys.splice(index, 1);
  17062. return values.splice(index, 1)[0];
  17063. }
  17064. return null;
  17065. };
  17066. this.each = this.forEach = function(fn, bind){
  17067. for (var i = 0, l = this.length; i < l; i++) fn.call(bind, keys[i], values[i], this);
  17068. };
  17069. };
  17070. if (this.Type) new Type('Table', Table);
  17071. })();