mootools-1.6.0_all.js 550 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704
  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. if (this.target == document.body){
  7699. this.element.setStyles({width: 0, height: 0});
  7700. var win = window.getScrollSize();
  7701. if (dim.totalHeight < win.y) dim.totalHeight = win.y;
  7702. if (dim.totalWidth < win.x) dim.totalWidth = win.x;
  7703. }
  7704. this.element.setStyles({
  7705. width: Array.pick([x, dim.totalWidth, dim.x]),
  7706. height: Array.pick([y, dim.totalHeight, dim.y])
  7707. });
  7708. return this;
  7709. },
  7710. show: function(){
  7711. if (!this.hidden) return this;
  7712. window.addEvent('resize', this.position);
  7713. this.position();
  7714. this.showMask.apply(this, arguments);
  7715. return this;
  7716. },
  7717. showMask: function(){
  7718. this.element.setStyle('display', 'block');
  7719. this.hidden = false;
  7720. this.fireEvent('show');
  7721. },
  7722. hide: function(){
  7723. if (this.hidden) return this;
  7724. window.removeEvent('resize', this.position);
  7725. this.hideMask.apply(this, arguments);
  7726. if (this.options.destroyOnHide) return this.destroy();
  7727. return this;
  7728. },
  7729. hideMask: function(){
  7730. this.element.setStyle('display', 'none');
  7731. this.hidden = true;
  7732. this.fireEvent('hide');
  7733. },
  7734. toggle: function(){
  7735. this[this.hidden ? 'show' : 'hide']();
  7736. },
  7737. destroy: function(){
  7738. this.hide();
  7739. this.element.destroy();
  7740. this.fireEvent('destroy');
  7741. this.target.eliminate('mask');
  7742. }
  7743. });
  7744. })();
  7745. Element.Properties.mask = {
  7746. set: function(options){
  7747. var mask = this.retrieve('mask');
  7748. if (mask) mask.destroy();
  7749. return this.eliminate('mask').store('mask:options', options);
  7750. },
  7751. get: function(){
  7752. var mask = this.retrieve('mask');
  7753. if (!mask){
  7754. mask = new Mask(this, this.retrieve('mask:options'));
  7755. this.store('mask', mask);
  7756. }
  7757. return mask;
  7758. }
  7759. };
  7760. Element.implement({
  7761. mask: function(options){
  7762. if (options) this.set('mask', options);
  7763. this.get('mask').show();
  7764. return this;
  7765. },
  7766. unmask: function(){
  7767. this.get('mask').hide();
  7768. return this;
  7769. }
  7770. });
  7771. /*
  7772. ---
  7773. script: Spinner.js
  7774. name: Spinner
  7775. description: Adds a semi-transparent overlay over a dom element with a spinnin ajax icon.
  7776. license: MIT-style license
  7777. authors:
  7778. - Aaron Newton
  7779. requires:
  7780. - Core/Fx.Tween
  7781. - Core/Request
  7782. - Class.refactor
  7783. - Mask
  7784. provides: [Spinner]
  7785. ...
  7786. */
  7787. (function(){
  7788. var Spinner = this.Spinner = new Class({
  7789. Extends: this.Mask,
  7790. Implements: Chain,
  7791. options: {/*
  7792. message: false,*/
  7793. 'class': 'spinner',
  7794. containerPosition: {},
  7795. content: {
  7796. 'class': 'spinner-content'
  7797. },
  7798. messageContainer: {
  7799. 'class': 'spinner-msg'
  7800. },
  7801. img: {
  7802. 'class': 'spinner-img'
  7803. },
  7804. fxOptions: {
  7805. link: 'chain'
  7806. }
  7807. },
  7808. initialize: function(target, options){
  7809. this.target = document.id(target) || document.id(document.body);
  7810. this.target.store('spinner', this);
  7811. this.setOptions(options);
  7812. this.render();
  7813. this.inject();
  7814. // Add this to events for when noFx is true; parent methods handle hide/show.
  7815. var deactivate = function(){ this.active = false; }.bind(this);
  7816. this.addEvents({
  7817. hide: deactivate,
  7818. show: deactivate
  7819. });
  7820. },
  7821. render: function(){
  7822. this.parent();
  7823. this.element.set('id', this.options.id || 'spinner-' + String.uniqueID());
  7824. this.content = document.id(this.options.content) || new Element('div', this.options.content);
  7825. this.content.inject(this.element);
  7826. if (this.options.message){
  7827. this.msg = document.id(this.options.message) || new Element('p', this.options.messageContainer).appendText(this.options.message);
  7828. this.msg.inject(this.content);
  7829. }
  7830. if (this.options.img){
  7831. this.img = document.id(this.options.img) || new Element('div', this.options.img);
  7832. this.img.inject(this.content);
  7833. }
  7834. this.element.set('tween', this.options.fxOptions);
  7835. },
  7836. show: function(noFx){
  7837. if (this.active) return this.chain(this.show.bind(this));
  7838. if (!this.hidden){
  7839. this.callChain.delay(20, this);
  7840. return this;
  7841. }
  7842. this.target.set('aria-busy', 'true');
  7843. this.active = true;
  7844. return this.parent(noFx);
  7845. },
  7846. showMask: function(noFx){
  7847. var pos = function(){
  7848. this.content.position(Object.merge({
  7849. relativeTo: this.element
  7850. }, this.options.containerPosition));
  7851. }.bind(this);
  7852. if (noFx){
  7853. this.parent();
  7854. pos();
  7855. } else {
  7856. if (!this.options.style.opacity) this.options.style.opacity = this.element.getStyle('opacity').toFloat();
  7857. this.element.setStyles({
  7858. display: 'block',
  7859. opacity: 0
  7860. }).tween('opacity', this.options.style.opacity);
  7861. pos();
  7862. this.hidden = false;
  7863. this.fireEvent('show');
  7864. this.callChain();
  7865. }
  7866. },
  7867. hide: function(noFx){
  7868. if (this.active) return this.chain(this.hide.bind(this));
  7869. if (this.hidden){
  7870. this.callChain.delay(20, this);
  7871. return this;
  7872. }
  7873. this.target.set('aria-busy', 'false');
  7874. this.active = true;
  7875. return this.parent(noFx);
  7876. },
  7877. hideMask: function(noFx){
  7878. if (noFx) return this.parent();
  7879. this.element.tween('opacity', 0).get('tween').chain(function(){
  7880. this.element.setStyle('display', 'none');
  7881. this.hidden = true;
  7882. this.fireEvent('hide');
  7883. this.callChain();
  7884. }.bind(this));
  7885. },
  7886. destroy: function(){
  7887. this.content.destroy();
  7888. this.parent();
  7889. this.target.eliminate('spinner');
  7890. }
  7891. });
  7892. })();
  7893. Request = Class.refactor(Request, {
  7894. options: {
  7895. useSpinner: false,
  7896. spinnerOptions: {},
  7897. spinnerTarget: false
  7898. },
  7899. initialize: function(options){
  7900. this._send = this.send;
  7901. this.send = function(options){
  7902. var spinner = this.getSpinner();
  7903. if (spinner) spinner.chain(this._send.pass(options, this)).show();
  7904. else this._send(options);
  7905. return this;
  7906. };
  7907. this.previous(options);
  7908. },
  7909. getSpinner: function(){
  7910. if (!this.spinner){
  7911. var update = document.id(this.options.spinnerTarget) || document.id(this.options.update);
  7912. if (this.options.useSpinner && update){
  7913. update.set('spinner', this.options.spinnerOptions);
  7914. var spinner = this.spinner = update.get('spinner');
  7915. ['complete', 'exception', 'cancel'].each(function(event){
  7916. this.addEvent(event, spinner.hide.bind(spinner));
  7917. }, this);
  7918. }
  7919. }
  7920. return this.spinner;
  7921. }
  7922. });
  7923. Element.Properties.spinner = {
  7924. set: function(options){
  7925. var spinner = this.retrieve('spinner');
  7926. if (spinner) spinner.destroy();
  7927. return this.eliminate('spinner').store('spinner:options', options);
  7928. },
  7929. get: function(){
  7930. var spinner = this.retrieve('spinner');
  7931. if (!spinner){
  7932. spinner = new Spinner(this, this.retrieve('spinner:options'));
  7933. this.store('spinner', spinner);
  7934. }
  7935. return spinner;
  7936. }
  7937. };
  7938. Element.implement({
  7939. spin: function(options){
  7940. if (options) this.set('spinner', options);
  7941. this.get('spinner').show();
  7942. return this;
  7943. },
  7944. unspin: function(){
  7945. this.get('spinner').hide();
  7946. return this;
  7947. }
  7948. });
  7949. /*
  7950. ---
  7951. script: String.QueryString.js
  7952. name: String.QueryString
  7953. description: Methods for dealing with URI query strings.
  7954. license: MIT-style license
  7955. authors:
  7956. - Sebastian Markbåge
  7957. - Aaron Newton
  7958. - Lennart Pilon
  7959. - Valerio Proietti
  7960. requires:
  7961. - Core/Array
  7962. - Core/String
  7963. - MooTools.More
  7964. provides: [String.QueryString]
  7965. ...
  7966. */
  7967. (function(){
  7968. /**
  7969. * decodeURIComponent doesn't do the correct thing with query parameter keys or
  7970. * values. Specifically, it leaves '+' as '+' when it should be converting them
  7971. * to spaces as that's the specification. When browsers submit HTML forms via
  7972. * GET, the values are encoded using 'application/x-www-form-urlencoded'
  7973. * which converts spaces to '+'.
  7974. *
  7975. * See: http://unixpapa.com/js/querystring.html for a description of the
  7976. * problem.
  7977. */
  7978. var decodeComponent = function(str){
  7979. return decodeURIComponent(str.replace(/\+/g, ' '));
  7980. };
  7981. String.implement({
  7982. parseQueryString: function(decodeKeys, decodeValues){
  7983. if (decodeKeys == null) decodeKeys = true;
  7984. if (decodeValues == null) decodeValues = true;
  7985. var vars = this.split(/[&;]/),
  7986. object = {};
  7987. if (!vars.length) return object;
  7988. vars.each(function(val){
  7989. var index = val.indexOf('=') + 1,
  7990. value = index ? val.substr(index) : '',
  7991. keys = index ? val.substr(0, index - 1).match(/([^\]\[]+|(\B)(?=\]))/g) : [val],
  7992. obj = object;
  7993. if (!keys) return;
  7994. if (decodeValues) value = decodeComponent(value);
  7995. keys.each(function(key, i){
  7996. if (decodeKeys) key = decodeComponent(key);
  7997. var current = obj[key];
  7998. if (i < keys.length - 1) obj = obj[key] = current || {};
  7999. else if (typeOf(current) == 'array') current.push(value);
  8000. else obj[key] = current != null ? [current, value] : value;
  8001. });
  8002. });
  8003. return object;
  8004. },
  8005. cleanQueryString: function(method){
  8006. return this.split('&').filter(function(val){
  8007. var index = val.indexOf('='),
  8008. key = index < 0 ? '' : val.substr(0, index),
  8009. value = val.substr(index + 1);
  8010. return method ? method.call(null, key, value) : (value || value === 0);
  8011. }).join('&');
  8012. }
  8013. });
  8014. })();
  8015. /*
  8016. ---
  8017. script: Form.Request.js
  8018. name: Form.Request
  8019. description: Handles the basic functionality of submitting a form and updating a dom element with the result.
  8020. license: MIT-style license
  8021. authors:
  8022. - Aaron Newton
  8023. requires:
  8024. - Core/Request.HTML
  8025. - Class.Binds
  8026. - Class.Occlude
  8027. - Spinner
  8028. - String.QueryString
  8029. - Element.Delegation.Pseudo
  8030. provides: [Form.Request]
  8031. ...
  8032. */
  8033. if (!window.Form) window.Form = {};
  8034. (function(){
  8035. Form.Request = new Class({
  8036. Binds: ['onSubmit', 'onFormValidate'],
  8037. Implements: [Options, Events, Class.Occlude],
  8038. options: {/*
  8039. onFailure: function(){},
  8040. onSuccess: function(){}, // aliased to onComplete,
  8041. onSend: function(){}*/
  8042. requestOptions: {
  8043. evalScripts: true,
  8044. useSpinner: true,
  8045. emulation: false,
  8046. link: 'ignore'
  8047. },
  8048. sendButtonClicked: true,
  8049. extraData: {},
  8050. resetForm: true
  8051. },
  8052. property: 'form.request',
  8053. initialize: function(form, target, options){
  8054. this.element = document.id(form);
  8055. if (this.occlude()) return this.occluded;
  8056. this.setOptions(options)
  8057. .setTarget(target)
  8058. .attach();
  8059. },
  8060. setTarget: function(target){
  8061. this.target = document.id(target);
  8062. if (!this.request){
  8063. this.makeRequest();
  8064. } else {
  8065. this.request.setOptions({
  8066. update: this.target
  8067. });
  8068. }
  8069. return this;
  8070. },
  8071. toElement: function(){
  8072. return this.element;
  8073. },
  8074. makeRequest: function(){
  8075. var self = this;
  8076. this.request = new Request.HTML(Object.merge({
  8077. update: this.target,
  8078. emulation: false,
  8079. spinnerTarget: this.element,
  8080. method: this.element.get('method') || 'post'
  8081. }, this.options.requestOptions)).addEvents({
  8082. success: function(tree, elements, html, javascript){
  8083. ['complete', 'success'].each(function(evt){
  8084. self.fireEvent(evt, [self.target, tree, elements, html, javascript]);
  8085. });
  8086. },
  8087. failure: function(){
  8088. self.fireEvent('complete', arguments).fireEvent('failure', arguments);
  8089. },
  8090. exception: function(){
  8091. self.fireEvent('failure', arguments);
  8092. }
  8093. });
  8094. return this.attachReset();
  8095. },
  8096. attachReset: function(){
  8097. if (!this.options.resetForm) return this;
  8098. this.request.addEvent('success', function(){
  8099. Function.attempt(function(){
  8100. this.element.reset();
  8101. }.bind(this));
  8102. if (window.OverText) OverText.update();
  8103. }.bind(this));
  8104. return this;
  8105. },
  8106. attach: function(attach){
  8107. var method = (attach != false) ? 'addEvent' : 'removeEvent';
  8108. this.element[method]('click:relay(button, input[type=submit])', this.saveClickedButton.bind(this));
  8109. var fv = this.element.retrieve('validator');
  8110. if (fv) fv[method]('onFormValidate', this.onFormValidate);
  8111. else this.element[method]('submit', this.onSubmit);
  8112. return this;
  8113. },
  8114. detach: function(){
  8115. return this.attach(false);
  8116. },
  8117. //public method
  8118. enable: function(){
  8119. return this.attach();
  8120. },
  8121. //public method
  8122. disable: function(){
  8123. return this.detach();
  8124. },
  8125. onFormValidate: function(valid, form, event){
  8126. //if there's no event, then this wasn't a submit event
  8127. if (!event) return;
  8128. var fv = this.element.retrieve('validator');
  8129. if (valid || (fv && !fv.options.stopOnFailure)){
  8130. event.stop();
  8131. this.send();
  8132. }
  8133. },
  8134. onSubmit: function(event){
  8135. var fv = this.element.retrieve('validator');
  8136. if (fv){
  8137. //form validator was created after Form.Request
  8138. this.element.removeEvent('submit', this.onSubmit);
  8139. fv.addEvent('onFormValidate', this.onFormValidate);
  8140. fv.validate(event);
  8141. return;
  8142. }
  8143. if (event) event.stop();
  8144. this.send();
  8145. },
  8146. saveClickedButton: function(event, target){
  8147. var targetName = target.get('name');
  8148. if (!targetName || !this.options.sendButtonClicked) return;
  8149. this.options.extraData[targetName] = target.get('value') || true;
  8150. this.clickedCleaner = function(){
  8151. delete this.options.extraData[targetName];
  8152. this.clickedCleaner = function(){};
  8153. }.bind(this);
  8154. },
  8155. clickedCleaner: function(){},
  8156. send: function(){
  8157. var str = this.element.toQueryString().trim(),
  8158. data = Object.toQueryString(this.options.extraData);
  8159. if (str) str += '&' + data;
  8160. else str = data;
  8161. this.fireEvent('send', [this.element, str.parseQueryString()]);
  8162. this.request.send({
  8163. data: str,
  8164. url: this.options.requestOptions.url || this.element.get('action')
  8165. });
  8166. this.clickedCleaner();
  8167. return this;
  8168. }
  8169. });
  8170. Element.implement('formUpdate', function(update, options){
  8171. var fq = this.retrieve('form.request');
  8172. if (!fq){
  8173. fq = new Form.Request(this, update, options);
  8174. } else {
  8175. if (update) fq.setTarget(update);
  8176. if (options) fq.setOptions(options).makeRequest();
  8177. }
  8178. fq.send();
  8179. return this;
  8180. });
  8181. })();
  8182. /*
  8183. ---
  8184. script: Fx.Reveal.js
  8185. name: Fx.Reveal
  8186. description: Defines Fx.Reveal, a class that shows and hides elements with a transition.
  8187. license: MIT-style license
  8188. authors:
  8189. - Aaron Newton
  8190. requires:
  8191. - Core/Fx.Morph
  8192. - Element.Shortcuts
  8193. - Element.Measure
  8194. provides: [Fx.Reveal]
  8195. ...
  8196. */
  8197. (function(){
  8198. var hideTheseOf = function(object){
  8199. var hideThese = object.options.hideInputs;
  8200. if (window.OverText){
  8201. var otClasses = [null];
  8202. OverText.each(function(ot){
  8203. otClasses.include('.' + ot.options.labelClass);
  8204. });
  8205. if (otClasses) hideThese += otClasses.join(', ');
  8206. }
  8207. return (hideThese) ? object.element.getElements(hideThese) : null;
  8208. };
  8209. Fx.Reveal = new Class({
  8210. Extends: Fx.Morph,
  8211. options: {/*
  8212. onShow: function(thisElement){},
  8213. onHide: function(thisElement){},
  8214. onComplete: function(thisElement){},
  8215. heightOverride: null,
  8216. widthOverride: null,*/
  8217. link: 'cancel',
  8218. styles: ['padding', 'border', 'margin'],
  8219. transitionOpacity: 'opacity' in document.documentElement,
  8220. mode: 'vertical',
  8221. display: function(){
  8222. return this.element.get('tag') != 'tr' ? 'block' : 'table-row';
  8223. },
  8224. opacity: 1,
  8225. hideInputs: !('opacity' in document.documentElement) ? 'select, input, textarea, object, embed' : null
  8226. },
  8227. dissolve: function(){
  8228. if (!this.hiding && !this.showing){
  8229. if (this.element.getStyle('display') != 'none'){
  8230. this.hiding = true;
  8231. this.showing = false;
  8232. this.hidden = true;
  8233. this.cssText = this.element.style.cssText;
  8234. var startStyles = this.element.getComputedSize({
  8235. styles: this.options.styles,
  8236. mode: this.options.mode
  8237. });
  8238. if (this.options.transitionOpacity) startStyles.opacity = this.options.opacity;
  8239. var zero = {};
  8240. Object.each(startStyles, function(style, name){
  8241. zero[name] = [style, 0];
  8242. });
  8243. this.element.setStyles({
  8244. display: Function.convert(this.options.display).call(this),
  8245. overflow: 'hidden'
  8246. });
  8247. var hideThese = hideTheseOf(this);
  8248. if (hideThese) hideThese.setStyle('visibility', 'hidden');
  8249. this.$chain.unshift(function(){
  8250. if (this.hidden){
  8251. this.hiding = false;
  8252. this.element.style.cssText = this.cssText;
  8253. this.element.setStyle('display', 'none');
  8254. if (hideThese) hideThese.setStyle('visibility', 'visible');
  8255. }
  8256. this.fireEvent('hide', this.element);
  8257. this.callChain();
  8258. }.bind(this));
  8259. this.start(zero);
  8260. } else {
  8261. this.callChain.delay(10, this);
  8262. this.fireEvent('complete', this.element);
  8263. this.fireEvent('hide', this.element);
  8264. }
  8265. } else if (this.options.link == 'chain'){
  8266. this.chain(this.dissolve.bind(this));
  8267. } else if (this.options.link == 'cancel' && !this.hiding){
  8268. this.cancel();
  8269. this.dissolve();
  8270. }
  8271. return this;
  8272. },
  8273. reveal: function(){
  8274. if (!this.showing && !this.hiding){
  8275. if (this.element.getStyle('display') == 'none'){
  8276. this.hiding = false;
  8277. this.showing = true;
  8278. this.hidden = false;
  8279. this.cssText = this.element.style.cssText;
  8280. var startStyles;
  8281. this.element.measure(function(){
  8282. startStyles = this.element.getComputedSize({
  8283. styles: this.options.styles,
  8284. mode: this.options.mode
  8285. });
  8286. }.bind(this));
  8287. if (this.options.heightOverride != null) startStyles.height = this.options.heightOverride.toInt();
  8288. if (this.options.widthOverride != null) startStyles.width = this.options.widthOverride.toInt();
  8289. if (this.options.transitionOpacity){
  8290. this.element.setStyle('opacity', 0);
  8291. startStyles.opacity = this.options.opacity;
  8292. }
  8293. var zero = {
  8294. height: 0,
  8295. display: Function.convert(this.options.display).call(this)
  8296. };
  8297. Object.each(startStyles, function(style, name){
  8298. zero[name] = 0;
  8299. });
  8300. zero.overflow = 'hidden';
  8301. this.element.setStyles(zero);
  8302. var hideThese = hideTheseOf(this);
  8303. if (hideThese) hideThese.setStyle('visibility', 'hidden');
  8304. this.$chain.unshift(function(){
  8305. this.element.style.cssText = this.cssText;
  8306. this.element.setStyle('display', Function.convert(this.options.display).call(this));
  8307. if (!this.hidden) this.showing = false;
  8308. if (hideThese) hideThese.setStyle('visibility', 'visible');
  8309. this.callChain();
  8310. this.fireEvent('show', this.element);
  8311. }.bind(this));
  8312. this.start(startStyles);
  8313. } else {
  8314. this.callChain();
  8315. this.fireEvent('complete', this.element);
  8316. this.fireEvent('show', this.element);
  8317. }
  8318. } else if (this.options.link == 'chain'){
  8319. this.chain(this.reveal.bind(this));
  8320. } else if (this.options.link == 'cancel' && !this.showing){
  8321. this.cancel();
  8322. this.reveal();
  8323. }
  8324. return this;
  8325. },
  8326. toggle: function(){
  8327. if (this.element.getStyle('display') == 'none'){
  8328. this.reveal();
  8329. } else {
  8330. this.dissolve();
  8331. }
  8332. return this;
  8333. },
  8334. cancel: function(){
  8335. this.parent.apply(this, arguments);
  8336. if (this.cssText != null) this.element.style.cssText = this.cssText;
  8337. this.hiding = false;
  8338. this.showing = false;
  8339. return this;
  8340. }
  8341. });
  8342. Element.Properties.reveal = {
  8343. set: function(options){
  8344. this.get('reveal').cancel().setOptions(options);
  8345. return this;
  8346. },
  8347. get: function(){
  8348. var reveal = this.retrieve('reveal');
  8349. if (!reveal){
  8350. reveal = new Fx.Reveal(this);
  8351. this.store('reveal', reveal);
  8352. }
  8353. return reveal;
  8354. }
  8355. };
  8356. Element.Properties.dissolve = Element.Properties.reveal;
  8357. Element.implement({
  8358. reveal: function(options){
  8359. this.get('reveal').setOptions(options).reveal();
  8360. return this;
  8361. },
  8362. dissolve: function(options){
  8363. this.get('reveal').setOptions(options).dissolve();
  8364. return this;
  8365. },
  8366. nix: function(options){
  8367. var params = Array.link(arguments, {destroy: Type.isBoolean, options: Type.isObject});
  8368. this.get('reveal').setOptions(options).dissolve().chain(function(){
  8369. this[params.destroy ? 'destroy' : 'dispose']();
  8370. }.bind(this));
  8371. return this;
  8372. },
  8373. wink: function(){
  8374. var params = Array.link(arguments, {duration: Type.isNumber, options: Type.isObject});
  8375. var reveal = this.get('reveal').setOptions(params.options);
  8376. reveal.reveal().chain(function(){
  8377. (function(){
  8378. reveal.dissolve();
  8379. }).delay(params.duration || 2000);
  8380. });
  8381. }
  8382. });
  8383. })();
  8384. /*
  8385. ---
  8386. script: Form.Request.Append.js
  8387. name: Form.Request.Append
  8388. 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.
  8389. license: MIT-style license
  8390. authors:
  8391. - Aaron Newton
  8392. requires:
  8393. - Form.Request
  8394. - Fx.Reveal
  8395. - Elements.from
  8396. provides: [Form.Request.Append]
  8397. ...
  8398. */
  8399. Form.Request.Append = new Class({
  8400. Extends: Form.Request,
  8401. options: {
  8402. //onBeforeEffect: function(){},
  8403. useReveal: true,
  8404. revealOptions: {},
  8405. inject: 'bottom'
  8406. },
  8407. makeRequest: function(){
  8408. this.request = new Request.HTML(Object.merge({
  8409. url: this.element.get('action'),
  8410. method: this.element.get('method') || 'post',
  8411. spinnerTarget: this.element
  8412. }, this.options.requestOptions, {
  8413. evalScripts: false
  8414. })).addEvents({
  8415. success: function(tree, elements, html, javascript){
  8416. var container;
  8417. var kids = Elements.from(html);
  8418. if (kids.length == 1){
  8419. container = kids[0];
  8420. } else {
  8421. container = new Element('div', {
  8422. styles: {
  8423. display: 'none'
  8424. }
  8425. }).adopt(kids);
  8426. }
  8427. container.inject(this.target, this.options.inject);
  8428. if (this.options.requestOptions.evalScripts) Browser.exec(javascript);
  8429. this.fireEvent('beforeEffect', container);
  8430. var finish = function(){
  8431. this.fireEvent('success', [container, this.target, tree, elements, html, javascript]);
  8432. }.bind(this);
  8433. if (this.options.useReveal){
  8434. container.set('reveal', this.options.revealOptions).get('reveal').chain(finish);
  8435. container.reveal();
  8436. } else {
  8437. finish();
  8438. }
  8439. }.bind(this),
  8440. failure: function(xhr){
  8441. this.fireEvent('failure', xhr);
  8442. }.bind(this)
  8443. });
  8444. this.attachReset();
  8445. }
  8446. });
  8447. /*
  8448. ---
  8449. script: Object.Extras.js
  8450. name: Object.Extras
  8451. description: Extra Object generics, like getFromPath which allows a path notation to child elements.
  8452. license: MIT-style license
  8453. authors:
  8454. - Aaron Newton
  8455. requires:
  8456. - Core/Object
  8457. - MooTools.More
  8458. provides: [Object.Extras]
  8459. ...
  8460. */
  8461. (function(){
  8462. var defined = function(value){
  8463. return value != null;
  8464. };
  8465. var hasOwnProperty = Object.prototype.hasOwnProperty;
  8466. Object.extend({
  8467. getFromPath: function(source, parts){
  8468. if (typeof parts == 'string') parts = parts.split('.');
  8469. for (var i = 0, l = parts.length; i < l; i++){
  8470. if (hasOwnProperty.call(source, parts[i])) source = source[parts[i]];
  8471. else return null;
  8472. }
  8473. return source;
  8474. },
  8475. cleanValues: function(object, method){
  8476. method = method || defined;
  8477. for (var key in object) if (!method(object[key])){
  8478. delete object[key];
  8479. }
  8480. return object;
  8481. },
  8482. erase: function(object, key){
  8483. if (hasOwnProperty.call(object, key)) delete object[key];
  8484. return object;
  8485. },
  8486. run: function(object){
  8487. var args = Array.slice(arguments, 1);
  8488. for (var key in object) if (object[key].apply){
  8489. object[key].apply(object, args);
  8490. }
  8491. return object;
  8492. }
  8493. });
  8494. })();
  8495. /*
  8496. ---
  8497. script: Locale.js
  8498. name: Locale
  8499. description: Provides methods for localization.
  8500. license: MIT-style license
  8501. authors:
  8502. - Aaron Newton
  8503. - Arian Stolwijk
  8504. requires:
  8505. - Core/Events
  8506. - Object.Extras
  8507. - MooTools.More
  8508. provides: [Locale, Lang]
  8509. ...
  8510. */
  8511. (function(){
  8512. var current = null,
  8513. locales = {},
  8514. inherits = {};
  8515. var getSet = function(set){
  8516. if (instanceOf(set, Locale.Set)) return set;
  8517. else return locales[set];
  8518. };
  8519. var Locale = this.Locale = {
  8520. define: function(locale, set, key, value){
  8521. var name;
  8522. if (instanceOf(locale, Locale.Set)){
  8523. name = locale.name;
  8524. if (name) locales[name] = locale;
  8525. } else {
  8526. name = locale;
  8527. if (!locales[name]) locales[name] = new Locale.Set(name);
  8528. locale = locales[name];
  8529. }
  8530. if (set) locale.define(set, key, value);
  8531. /*<1.2compat>*/
  8532. if (set == 'cascade') return Locale.inherit(name, key);
  8533. /*</1.2compat>*/
  8534. if (!current) current = locale;
  8535. return locale;
  8536. },
  8537. use: function(locale){
  8538. locale = getSet(locale);
  8539. if (locale){
  8540. current = locale;
  8541. this.fireEvent('change', locale);
  8542. /*<1.2compat>*/
  8543. this.fireEvent('langChange', locale.name);
  8544. /*</1.2compat>*/
  8545. }
  8546. return this;
  8547. },
  8548. getCurrent: function(){
  8549. return current;
  8550. },
  8551. get: function(key, args){
  8552. return (current) ? current.get(key, args) : '';
  8553. },
  8554. inherit: function(locale, inherits, set){
  8555. locale = getSet(locale);
  8556. if (locale) locale.inherit(inherits, set);
  8557. return this;
  8558. },
  8559. list: function(){
  8560. return Object.keys(locales);
  8561. }
  8562. };
  8563. Object.append(Locale, new Events);
  8564. Locale.Set = new Class({
  8565. sets: {},
  8566. inherits: {
  8567. locales: [],
  8568. sets: {}
  8569. },
  8570. initialize: function(name){
  8571. this.name = name || '';
  8572. },
  8573. define: function(set, key, value){
  8574. var defineData = this.sets[set];
  8575. if (!defineData) defineData = {};
  8576. if (key){
  8577. if (typeOf(key) == 'object') defineData = Object.merge(defineData, key);
  8578. else defineData[key] = value;
  8579. }
  8580. this.sets[set] = defineData;
  8581. return this;
  8582. },
  8583. get: function(key, args, _base){
  8584. var value = Object.getFromPath(this.sets, key);
  8585. if (value != null){
  8586. var type = typeOf(value);
  8587. if (type == 'function') value = value.apply(null, Array.convert(args));
  8588. else if (type == 'object') value = Object.clone(value);
  8589. return value;
  8590. }
  8591. // get value of inherited locales
  8592. var index = key.indexOf('.'),
  8593. set = index < 0 ? key : key.substr(0, index),
  8594. names = (this.inherits.sets[set] || []).combine(this.inherits.locales).include('en-US');
  8595. if (!_base) _base = [];
  8596. for (var i = 0, l = names.length; i < l; i++){
  8597. if (_base.contains(names[i])) continue;
  8598. _base.include(names[i]);
  8599. var locale = locales[names[i]];
  8600. if (!locale) continue;
  8601. value = locale.get(key, args, _base);
  8602. if (value != null) return value;
  8603. }
  8604. return '';
  8605. },
  8606. inherit: function(names, set){
  8607. names = Array.convert(names);
  8608. if (set && !this.inherits.sets[set]) this.inherits.sets[set] = [];
  8609. var l = names.length;
  8610. while (l--) (set ? this.inherits.sets[set] : this.inherits.locales).unshift(names[l]);
  8611. return this;
  8612. }
  8613. });
  8614. /*<1.2compat>*/
  8615. var lang = MooTools.lang = {};
  8616. Object.append(lang, Locale, {
  8617. setLanguage: Locale.use,
  8618. getCurrentLanguage: function(){
  8619. var current = Locale.getCurrent();
  8620. return (current) ? current.name : null;
  8621. },
  8622. set: function(){
  8623. Locale.define.apply(this, arguments);
  8624. return this;
  8625. },
  8626. get: function(set, key, args){
  8627. if (key) set += '.' + key;
  8628. return Locale.get(set, args);
  8629. }
  8630. });
  8631. /*</1.2compat>*/
  8632. })();
  8633. /*
  8634. ---
  8635. name: Locale.en-US.Date
  8636. description: Date messages for US English.
  8637. license: MIT-style license
  8638. authors:
  8639. - Aaron Newton
  8640. requires:
  8641. - Locale
  8642. provides: [Locale.en-US.Date]
  8643. ...
  8644. */
  8645. Locale.define('en-US', 'Date', {
  8646. months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
  8647. months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  8648. days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  8649. days_abbr: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8650. // Culture's date order: MM/DD/YYYY
  8651. dateOrder: ['month', 'date', 'year'],
  8652. shortDate: '%m/%d/%Y',
  8653. shortTime: '%I:%M%p',
  8654. AM: 'AM',
  8655. PM: 'PM',
  8656. firstDayOfWeek: 0,
  8657. // Date.Extras
  8658. ordinal: function(dayOfMonth){
  8659. // 1st, 2nd, 3rd, etc.
  8660. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'th' : ['th', 'st', 'nd', 'rd', 'th'][Math.min(dayOfMonth % 10, 4)];
  8661. },
  8662. lessThanMinuteAgo: 'less than a minute ago',
  8663. minuteAgo: 'about a minute ago',
  8664. minutesAgo: '{delta} minutes ago',
  8665. hourAgo: 'about an hour ago',
  8666. hoursAgo: 'about {delta} hours ago',
  8667. dayAgo: '1 day ago',
  8668. daysAgo: '{delta} days ago',
  8669. weekAgo: '1 week ago',
  8670. weeksAgo: '{delta} weeks ago',
  8671. monthAgo: '1 month ago',
  8672. monthsAgo: '{delta} months ago',
  8673. yearAgo: '1 year ago',
  8674. yearsAgo: '{delta} years ago',
  8675. lessThanMinuteUntil: 'less than a minute from now',
  8676. minuteUntil: 'about a minute from now',
  8677. minutesUntil: '{delta} minutes from now',
  8678. hourUntil: 'about an hour from now',
  8679. hoursUntil: 'about {delta} hours from now',
  8680. dayUntil: '1 day from now',
  8681. daysUntil: '{delta} days from now',
  8682. weekUntil: '1 week from now',
  8683. weeksUntil: '{delta} weeks from now',
  8684. monthUntil: '1 month from now',
  8685. monthsUntil: '{delta} months from now',
  8686. yearUntil: '1 year from now',
  8687. yearsUntil: '{delta} years from now'
  8688. });
  8689. /*
  8690. ---
  8691. script: Date.js
  8692. name: Date
  8693. description: Extends the Date native object to include methods useful in managing dates.
  8694. license: MIT-style license
  8695. authors:
  8696. - Aaron Newton
  8697. - Nicholas Barthelemy - https://svn.nbarthelemy.com/date-js/
  8698. - Harald Kirshner - mail [at] digitarald.de; http://digitarald.de
  8699. - Scott Kyle - scott [at] appden.com; http://appden.com
  8700. requires:
  8701. - Core/Array
  8702. - Core/String
  8703. - Core/Number
  8704. - MooTools.More
  8705. - Locale
  8706. - Locale.en-US.Date
  8707. provides: [Date]
  8708. ...
  8709. */
  8710. (function(){
  8711. var Date = this.Date;
  8712. var DateMethods = Date.Methods = {
  8713. ms: 'Milliseconds',
  8714. year: 'FullYear',
  8715. min: 'Minutes',
  8716. mo: 'Month',
  8717. sec: 'Seconds',
  8718. hr: 'Hours'
  8719. };
  8720. [
  8721. 'Date', 'Day', 'FullYear', 'Hours', 'Milliseconds', 'Minutes', 'Month', 'Seconds', 'Time', 'TimezoneOffset',
  8722. 'Week', 'Timezone', 'GMTOffset', 'DayOfYear', 'LastMonth', 'LastDayOfMonth', 'UTCDate', 'UTCDay', 'UTCFullYear',
  8723. 'AMPM', 'Ordinal', 'UTCHours', 'UTCMilliseconds', 'UTCMinutes', 'UTCMonth', 'UTCSeconds', 'UTCMilliseconds'
  8724. ].each(function(method){
  8725. Date.Methods[method.toLowerCase()] = method;
  8726. });
  8727. var pad = function(n, digits, string){
  8728. if (digits == 1) return n;
  8729. return n < Math.pow(10, digits - 1) ? (string || '0') + pad(n, digits - 1, string) : n;
  8730. };
  8731. Date.implement({
  8732. set: function(prop, value){
  8733. prop = prop.toLowerCase();
  8734. var method = DateMethods[prop] && 'set' + DateMethods[prop];
  8735. if (method && this[method]) this[method](value);
  8736. return this;
  8737. }.overloadSetter(),
  8738. get: function(prop){
  8739. prop = prop.toLowerCase();
  8740. var method = DateMethods[prop] && 'get' + DateMethods[prop];
  8741. if (method && this[method]) return this[method]();
  8742. return null;
  8743. }.overloadGetter(),
  8744. clone: function(){
  8745. return new Date(this.get('time'));
  8746. },
  8747. increment: function(interval, times){
  8748. interval = interval || 'day';
  8749. times = times != null ? times : 1;
  8750. switch (interval){
  8751. case 'year':
  8752. return this.increment('month', times * 12);
  8753. case 'month':
  8754. var d = this.get('date');
  8755. this.set('date', 1).set('mo', this.get('mo') + times);
  8756. return this.set('date', d.min(this.get('lastdayofmonth')));
  8757. case 'week':
  8758. return this.increment('day', times * 7);
  8759. case 'day':
  8760. return this.set('date', this.get('date') + times);
  8761. }
  8762. if (!Date.units[interval]) throw new Error(interval + ' is not a supported interval');
  8763. return this.set('time', this.get('time') + times * Date.units[interval]());
  8764. },
  8765. decrement: function(interval, times){
  8766. return this.increment(interval, -1 * (times != null ? times : 1));
  8767. },
  8768. isLeapYear: function(){
  8769. return Date.isLeapYear(this.get('year'));
  8770. },
  8771. clearTime: function(){
  8772. return this.set({hr: 0, min: 0, sec: 0, ms: 0});
  8773. },
  8774. diff: function(date, resolution){
  8775. if (typeOf(date) == 'string') date = Date.parse(date);
  8776. return ((date - this) / Date.units[resolution || 'day'](3, 3)).round(); // non-leap year, 30-day month
  8777. },
  8778. getLastDayOfMonth: function(){
  8779. return Date.daysInMonth(this.get('mo'), this.get('year'));
  8780. },
  8781. getDayOfYear: function(){
  8782. return (Date.UTC(this.get('year'), this.get('mo'), this.get('date') + 1)
  8783. - Date.UTC(this.get('year'), 0, 1)) / Date.units.day();
  8784. },
  8785. setDay: function(day, firstDayOfWeek){
  8786. if (firstDayOfWeek == null){
  8787. firstDayOfWeek = Date.getMsg('firstDayOfWeek');
  8788. if (firstDayOfWeek === '') firstDayOfWeek = 1;
  8789. }
  8790. day = (7 + Date.parseDay(day, true) - firstDayOfWeek) % 7;
  8791. var currentDay = (7 + this.get('day') - firstDayOfWeek) % 7;
  8792. return this.increment('day', day - currentDay);
  8793. },
  8794. getWeek: function(firstDayOfWeek){
  8795. if (firstDayOfWeek == null){
  8796. firstDayOfWeek = Date.getMsg('firstDayOfWeek');
  8797. if (firstDayOfWeek === '') firstDayOfWeek = 1;
  8798. }
  8799. var date = this,
  8800. dayOfWeek = (7 + date.get('day') - firstDayOfWeek) % 7,
  8801. dividend = 0,
  8802. firstDayOfYear;
  8803. if (firstDayOfWeek == 1){
  8804. // ISO-8601, week belongs to year that has the most days of the week (i.e. has the thursday of the week)
  8805. var month = date.get('month'),
  8806. startOfWeek = date.get('date') - dayOfWeek;
  8807. if (month == 11 && startOfWeek > 28) return 1; // Week 1 of next year
  8808. if (month == 0 && startOfWeek < -2){
  8809. // Use a date from last year to determine the week
  8810. date = new Date(date).decrement('day', dayOfWeek);
  8811. dayOfWeek = 0;
  8812. }
  8813. firstDayOfYear = new Date(date.get('year'), 0, 1).get('day') || 7;
  8814. if (firstDayOfYear > 4) dividend = -7; // First week of the year is not week 1
  8815. } else {
  8816. // In other cultures the first week of the year is always week 1 and the last week always 53 or 54.
  8817. // Days in the same week can have a different weeknumber if the week spreads across two years.
  8818. firstDayOfYear = new Date(date.get('year'), 0, 1).get('day');
  8819. }
  8820. dividend += date.get('dayofyear');
  8821. dividend += 6 - dayOfWeek; // Add days so we calculate the current date's week as a full week
  8822. dividend += (7 + firstDayOfYear - firstDayOfWeek) % 7; // Make up for first week of the year not being a full week
  8823. return (dividend / 7);
  8824. },
  8825. getOrdinal: function(day){
  8826. return Date.getMsg('ordinal', day || this.get('date'));
  8827. },
  8828. getTimezone: function(){
  8829. return this.toString()
  8830. .replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/, '$1')
  8831. .replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, '$1$2$3');
  8832. },
  8833. getGMTOffset: function(){
  8834. var off = this.get('timezoneOffset');
  8835. return ((off > 0) ? '-' : '+') + pad((off.abs() / 60).floor(), 2) + pad(off % 60, 2);
  8836. },
  8837. setAMPM: function(ampm){
  8838. ampm = ampm.toUpperCase();
  8839. var hr = this.get('hr');
  8840. if (hr > 11 && ampm == 'AM') return this.decrement('hour', 12);
  8841. else if (hr < 12 && ampm == 'PM') return this.increment('hour', 12);
  8842. return this;
  8843. },
  8844. getAMPM: function(){
  8845. return (this.get('hr') < 12) ? 'AM' : 'PM';
  8846. },
  8847. parse: function(str){
  8848. this.set('time', Date.parse(str));
  8849. return this;
  8850. },
  8851. isValid: function(date){
  8852. if (!date) date = this;
  8853. return typeOf(date) == 'date' && !isNaN(date.valueOf());
  8854. },
  8855. format: function(format){
  8856. if (!this.isValid()) return 'invalid date';
  8857. if (!format) format = '%x %X';
  8858. if (typeof format == 'string') format = formats[format.toLowerCase()] || format;
  8859. if (typeof format == 'function') return format(this);
  8860. var d = this;
  8861. return format.replace(/%([a-z%])/gi,
  8862. function($0, $1){
  8863. switch ($1){
  8864. case 'a': return Date.getMsg('days_abbr')[d.get('day')];
  8865. case 'A': return Date.getMsg('days')[d.get('day')];
  8866. case 'b': return Date.getMsg('months_abbr')[d.get('month')];
  8867. case 'B': return Date.getMsg('months')[d.get('month')];
  8868. case 'c': return d.format('%a %b %d %H:%M:%S %Y');
  8869. case 'd': return pad(d.get('date'), 2);
  8870. case 'e': return pad(d.get('date'), 2, ' ');
  8871. case 'H': return pad(d.get('hr'), 2);
  8872. case 'I': return pad((d.get('hr') % 12) || 12, 2);
  8873. case 'j': return pad(d.get('dayofyear'), 3);
  8874. case 'k': return pad(d.get('hr'), 2, ' ');
  8875. case 'l': return pad((d.get('hr') % 12) || 12, 2, ' ');
  8876. case 'L': return pad(d.get('ms'), 3);
  8877. case 'm': return pad((d.get('mo') + 1), 2);
  8878. case 'M': return pad(d.get('min'), 2);
  8879. case 'o': return d.get('ordinal');
  8880. case 'p': return Date.getMsg(d.get('ampm'));
  8881. case 's': return Math.round(d / 1000);
  8882. case 'S': return pad(d.get('seconds'), 2);
  8883. case 'T': return d.format('%H:%M:%S');
  8884. case 'U': return pad(d.get('week'), 2);
  8885. case 'w': return d.get('day');
  8886. case 'x': return d.format(Date.getMsg('shortDate'));
  8887. case 'X': return d.format(Date.getMsg('shortTime'));
  8888. case 'y': return d.get('year').toString().substr(2);
  8889. case 'Y': return d.get('year');
  8890. case 'z': return d.get('GMTOffset');
  8891. case 'Z': return d.get('Timezone');
  8892. }
  8893. return $1;
  8894. }
  8895. );
  8896. },
  8897. toISOString: function(){
  8898. return this.format('iso8601');
  8899. }
  8900. }).alias({
  8901. toJSON: 'toISOString',
  8902. compare: 'diff',
  8903. strftime: 'format'
  8904. });
  8905. // The day and month abbreviations are standardized, so we cannot use simply %a and %b because they will get localized
  8906. var rfcDayAbbr = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8907. rfcMonthAbbr = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
  8908. var formats = {
  8909. db: '%Y-%m-%d %H:%M:%S',
  8910. compact: '%Y%m%dT%H%M%S',
  8911. 'short': '%d %b %H:%M',
  8912. 'long': '%B %d, %Y %H:%M',
  8913. rfc822: function(date){
  8914. return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %Z');
  8915. },
  8916. rfc2822: function(date){
  8917. return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %z');
  8918. },
  8919. iso8601: function(date){
  8920. return (
  8921. date.getUTCFullYear() + '-' +
  8922. pad(date.getUTCMonth() + 1, 2) + '-' +
  8923. pad(date.getUTCDate(), 2) + 'T' +
  8924. pad(date.getUTCHours(), 2) + ':' +
  8925. pad(date.getUTCMinutes(), 2) + ':' +
  8926. pad(date.getUTCSeconds(), 2) + '.' +
  8927. pad(date.getUTCMilliseconds(), 3) + 'Z'
  8928. );
  8929. }
  8930. };
  8931. var parsePatterns = [],
  8932. nativeParse = Date.parse;
  8933. var parseWord = function(type, word, num){
  8934. var ret = -1,
  8935. translated = Date.getMsg(type + 's');
  8936. switch (typeOf(word)){
  8937. case 'object':
  8938. ret = translated[word.get(type)];
  8939. break;
  8940. case 'number':
  8941. ret = translated[word];
  8942. if (!ret) throw new Error('Invalid ' + type + ' index: ' + word);
  8943. break;
  8944. case 'string':
  8945. var match = translated.filter(function(name){
  8946. return this.test(name);
  8947. }, new RegExp('^' + word, 'i'));
  8948. if (!match.length) throw new Error('Invalid ' + type + ' string');
  8949. if (match.length > 1) throw new Error('Ambiguous ' + type);
  8950. ret = match[0];
  8951. }
  8952. return (num) ? translated.indexOf(ret) : ret;
  8953. };
  8954. var startCentury = 1900,
  8955. startYear = 70;
  8956. Date.extend({
  8957. getMsg: function(key, args){
  8958. return Locale.get('Date.' + key, args);
  8959. },
  8960. units: {
  8961. ms: Function.convert(1),
  8962. second: Function.convert(1000),
  8963. minute: Function.convert(60000),
  8964. hour: Function.convert(3600000),
  8965. day: Function.convert(86400000),
  8966. week: Function.convert(608400000),
  8967. month: function(month, year){
  8968. var d = new Date;
  8969. return Date.daysInMonth(month != null ? month : d.get('mo'), year != null ? year : d.get('year')) * 86400000;
  8970. },
  8971. year: function(year){
  8972. year = year || new Date().get('year');
  8973. return Date.isLeapYear(year) ? 31622400000 : 31536000000;
  8974. }
  8975. },
  8976. daysInMonth: function(month, year){
  8977. return [31, Date.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
  8978. },
  8979. isLeapYear: function(year){
  8980. return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);
  8981. },
  8982. parse: function(from){
  8983. var t = typeOf(from);
  8984. if (t == 'number') return new Date(from);
  8985. if (t != 'string') return from;
  8986. from = from.clean();
  8987. if (!from.length) return null;
  8988. var parsed;
  8989. parsePatterns.some(function(pattern){
  8990. var bits = pattern.re.exec(from);
  8991. return (bits) ? (parsed = pattern.handler(bits)) : false;
  8992. });
  8993. if (!(parsed && parsed.isValid())){
  8994. parsed = new Date(nativeParse(from));
  8995. if (!(parsed && parsed.isValid())) parsed = new Date(from.toInt());
  8996. }
  8997. return parsed;
  8998. },
  8999. parseDay: function(day, num){
  9000. return parseWord('day', day, num);
  9001. },
  9002. parseMonth: function(month, num){
  9003. return parseWord('month', month, num);
  9004. },
  9005. parseUTC: function(value){
  9006. var localDate = new Date(value);
  9007. var utcSeconds = Date.UTC(
  9008. localDate.get('year'),
  9009. localDate.get('mo'),
  9010. localDate.get('date'),
  9011. localDate.get('hr'),
  9012. localDate.get('min'),
  9013. localDate.get('sec'),
  9014. localDate.get('ms')
  9015. );
  9016. return new Date(utcSeconds);
  9017. },
  9018. orderIndex: function(unit){
  9019. return Date.getMsg('dateOrder').indexOf(unit) + 1;
  9020. },
  9021. defineFormat: function(name, format){
  9022. formats[name] = format;
  9023. return this;
  9024. },
  9025. //<1.2compat>
  9026. parsePatterns: parsePatterns,
  9027. //</1.2compat>
  9028. defineParser: function(pattern){
  9029. parsePatterns.push((pattern.re && pattern.handler) ? pattern : build(pattern));
  9030. return this;
  9031. },
  9032. defineParsers: function(){
  9033. Array.flatten(arguments).each(Date.defineParser);
  9034. return this;
  9035. },
  9036. define2DigitYearStart: function(year){
  9037. startYear = year % 100;
  9038. startCentury = year - startYear;
  9039. return this;
  9040. }
  9041. }).extend({
  9042. defineFormats: Date.defineFormat.overloadSetter()
  9043. });
  9044. var regexOf = function(type){
  9045. return new RegExp('(?:' + Date.getMsg(type).map(function(name){
  9046. return name.substr(0, 3);
  9047. }).join('|') + ')[a-z]*');
  9048. };
  9049. var replacers = function(key){
  9050. switch (key){
  9051. case 'T':
  9052. return '%H:%M:%S';
  9053. case 'x': // iso8601 covers yyyy-mm-dd, so just check if month is first
  9054. return ((Date.orderIndex('month') == 1) ? '%m[-./]%d' : '%d[-./]%m') + '([-./]%y)?';
  9055. case 'X':
  9056. return '%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%z?';
  9057. }
  9058. return null;
  9059. };
  9060. var keys = {
  9061. d: /[0-2]?[0-9]|3[01]/,
  9062. H: /[01]?[0-9]|2[0-3]/,
  9063. I: /0?[1-9]|1[0-2]/,
  9064. M: /[0-5]?\d/,
  9065. s: /\d+/,
  9066. o: /[a-z]*/,
  9067. p: /[ap]\.?m\.?/,
  9068. y: /\d{2}|\d{4}/,
  9069. Y: /\d{4}/,
  9070. z: /Z|[+-]\d{2}(?::?\d{2})?/
  9071. };
  9072. keys.m = keys.I;
  9073. keys.S = keys.M;
  9074. var currentLanguage;
  9075. var recompile = function(language){
  9076. currentLanguage = language;
  9077. keys.a = keys.A = regexOf('days');
  9078. keys.b = keys.B = regexOf('months');
  9079. parsePatterns.each(function(pattern, i){
  9080. if (pattern.format) parsePatterns[i] = build(pattern.format);
  9081. });
  9082. };
  9083. var build = function(format){
  9084. if (!currentLanguage) return {format: format};
  9085. var parsed = [];
  9086. var re = (format.source || format) // allow format to be regex
  9087. .replace(/%([a-z])/gi,
  9088. function($0, $1){
  9089. return replacers($1) || $0;
  9090. }
  9091. ).replace(/\((?!\?)/g, '(?:') // make all groups non-capturing
  9092. .replace(/ (?!\?|\*)/g, ',? ') // be forgiving with spaces and commas
  9093. .replace(/%([a-z%])/gi,
  9094. function($0, $1){
  9095. var p = keys[$1];
  9096. if (!p) return $1;
  9097. parsed.push($1);
  9098. return '(' + p.source + ')';
  9099. }
  9100. ).replace(/\[a-z\]/gi, '[a-z\\u00c0-\\uffff;\&]'); // handle unicode words
  9101. return {
  9102. format: format,
  9103. re: new RegExp('^' + re + '$', 'i'),
  9104. handler: function(bits){
  9105. bits = bits.slice(1).associate(parsed);
  9106. var date = new Date().clearTime(),
  9107. year = bits.y || bits.Y;
  9108. if (year != null) handle.call(date, 'y', year); // need to start in the right year
  9109. if ('d' in bits) handle.call(date, 'd', 1);
  9110. if ('m' in bits || bits.b || bits.B) handle.call(date, 'm', 1);
  9111. for (var key in bits) handle.call(date, key, bits[key]);
  9112. return date;
  9113. }
  9114. };
  9115. };
  9116. var handle = function(key, value){
  9117. if (!value) return this;
  9118. switch (key){
  9119. case 'a': case 'A': return this.set('day', Date.parseDay(value, true));
  9120. case 'b': case 'B': return this.set('mo', Date.parseMonth(value, true));
  9121. case 'd': return this.set('date', value);
  9122. case 'H': case 'I': return this.set('hr', value);
  9123. case 'm': return this.set('mo', value - 1);
  9124. case 'M': return this.set('min', value);
  9125. case 'p': return this.set('ampm', value.replace(/\./g, ''));
  9126. case 'S': return this.set('sec', value);
  9127. case 's': return this.set('ms', ('0.' + value) * 1000);
  9128. case 'w': return this.set('day', value);
  9129. case 'Y': return this.set('year', value);
  9130. case 'y':
  9131. value = +value;
  9132. if (value < 100) value += startCentury + (value < startYear ? 100 : 0);
  9133. return this.set('year', value);
  9134. case 'z':
  9135. if (value == 'Z') value = '+00';
  9136. var offset = value.match(/([+-])(\d{2}):?(\d{2})?/);
  9137. offset = (offset[1] + '1') * (offset[2] * 60 + (+offset[3] || 0)) + this.getTimezoneOffset();
  9138. return this.set('time', this - offset * 60000);
  9139. }
  9140. return this;
  9141. };
  9142. Date.defineParsers(
  9143. '%Y([-./]%m([-./]%d((T| )%X)?)?)?', // "1999-12-31", "1999-12-31 11:59pm", "1999-12-31 23:59:59", ISO8601
  9144. '%Y%m%d(T%H(%M%S?)?)?', // "19991231", "19991231T1159", compact
  9145. '%x( %X)?', // "12/31", "12.31.99", "12-31-1999", "12/31/2008 11:59 PM"
  9146. '%d%o( %b( %Y)?)?( %X)?', // "31st", "31st December", "31 Dec 1999", "31 Dec 1999 11:59pm"
  9147. '%b( %d%o)?( %Y)?( %X)?', // Same as above with month and day switched
  9148. '%Y %b( %d%o( %X)?)?', // Same as above with year coming first
  9149. '%o %b %d %X %z %Y', // "Thu Oct 22 08:11:23 +0000 2009"
  9150. '%T', // %H:%M:%S
  9151. '%H:%M( ?%p)?' // "11:05pm", "11:05 am" and "11:05"
  9152. );
  9153. Locale.addEvent('change', function(language){
  9154. if (Locale.get('Date')) recompile(language);
  9155. }).fireEvent('change', Locale.getCurrent());
  9156. })();
  9157. /*
  9158. ---
  9159. name: Locale.en-US.Form.Validator
  9160. description: Form Validator messages for English.
  9161. license: MIT-style license
  9162. authors:
  9163. - Aaron Newton
  9164. requires:
  9165. - Locale
  9166. provides: [Locale.en-US.Form.Validator]
  9167. ...
  9168. */
  9169. Locale.define('en-US', 'FormValidator', {
  9170. required: 'This field is required.',
  9171. length: 'Please enter {length} characters (you entered {elLength} characters)',
  9172. minLength: 'Please enter at least {minLength} characters (you entered {length} characters).',
  9173. maxLength: 'Please enter no more than {maxLength} characters (you entered {length} characters).',
  9174. integer: 'Please enter an integer in this field. Numbers with decimals (e.g. 1.25) are not permitted.',
  9175. numeric: 'Please enter only numeric values in this field (i.e. "1" or "1.1" or "-1" or "-1.1").',
  9176. digits: 'Please use numbers and punctuation only in this field (for example, a phone number with dashes or dots is permitted).',
  9177. alpha: 'Please use only letters (a-z) within this field. No spaces or other characters are allowed.',
  9178. alphanum: 'Please use only letters (a-z) or numbers (0-9) in this field. No spaces or other characters are allowed.',
  9179. dateSuchAs: 'Please enter a valid date such as {date}',
  9180. dateInFormatMDY: 'Please enter a valid date such as MM/DD/YYYY (i.e. "12/31/1999")',
  9181. email: 'Please enter a valid email address. For example "fred@domain.com".',
  9182. url: 'Please enter a valid URL such as http://www.example.com.',
  9183. currencyDollar: 'Please enter a valid $ amount. For example $100.00 .',
  9184. oneRequired: 'Please enter something for at least one of these inputs.',
  9185. errorPrefix: 'Error: ',
  9186. warningPrefix: 'Warning: ',
  9187. // Form.Validator.Extras
  9188. noSpace: 'There can be no spaces in this input.',
  9189. reqChkByNode: 'No items are selected.',
  9190. requiredChk: 'This field is required.',
  9191. reqChkByName: 'Please select a {label}.',
  9192. match: 'This field needs to match the {matchName} field',
  9193. startDate: 'the start date',
  9194. endDate: 'the end date',
  9195. currentDate: 'the current date',
  9196. afterDate: 'The date should be the same or after {label}.',
  9197. beforeDate: 'The date should be the same or before {label}.',
  9198. startMonth: 'Please select a start month',
  9199. sameMonth: 'These two dates must be in the same month - you must change one or the other.',
  9200. creditcard: 'The credit card number entered is invalid. Please check the number and try again. {length} digits entered.'
  9201. });
  9202. /*
  9203. ---
  9204. script: Form.Validator.js
  9205. name: Form.Validator
  9206. description: A css-class based form validation system.
  9207. license: MIT-style license
  9208. authors:
  9209. - Aaron Newton
  9210. requires:
  9211. - Core/Options
  9212. - Core/Events
  9213. - Core/Element.Delegation
  9214. - Core/Slick.Finder
  9215. - Core/Element.Event
  9216. - Core/Element.Style
  9217. - Core/JSON
  9218. - Locale
  9219. - Class.Binds
  9220. - Date
  9221. - Element.Forms
  9222. - Locale.en-US.Form.Validator
  9223. - Element.Shortcuts
  9224. provides: [Form.Validator, InputValidator, FormValidator.BaseValidators]
  9225. ...
  9226. */
  9227. if (!window.Form) window.Form = {};
  9228. var InputValidator = this.InputValidator = new Class({
  9229. Implements: [Options],
  9230. options: {
  9231. errorMsg: 'Validation failed.',
  9232. test: Function.convert(true)
  9233. },
  9234. initialize: function(className, options){
  9235. this.setOptions(options);
  9236. this.className = className;
  9237. },
  9238. test: function(field, props){
  9239. field = document.id(field);
  9240. return (field) ? this.options.test(field, props || this.getProps(field)) : false;
  9241. },
  9242. getError: function(field, props){
  9243. field = document.id(field);
  9244. var err = this.options.errorMsg;
  9245. if (typeOf(err) == 'function') err = err(field, props || this.getProps(field));
  9246. return err;
  9247. },
  9248. getProps: function(field){
  9249. field = document.id(field);
  9250. return (field) ? field.get('validatorProps') : {};
  9251. }
  9252. });
  9253. Element.Properties.validators = {
  9254. get: function(){
  9255. return (this.get('data-validators') || this.className).clean().replace(/'(\\.|[^'])*'|"(\\.|[^"])*"/g, function(match){
  9256. return match.replace(' ', '\\x20');
  9257. }).split(' ');
  9258. }
  9259. };
  9260. Element.Properties.validatorProps = {
  9261. set: function(props){
  9262. return this.eliminate('$moo:validatorProps').store('$moo:validatorProps', props);
  9263. },
  9264. get: function(props){
  9265. if (props) this.set(props);
  9266. if (this.retrieve('$moo:validatorProps')) return this.retrieve('$moo:validatorProps');
  9267. if (this.getProperty('data-validator-properties') || this.getProperty('validatorProps')){
  9268. try {
  9269. this.store('$moo:validatorProps', JSON.decode(this.getProperty('validatorProps') || this.getProperty('data-validator-properties'), false));
  9270. } catch (e){
  9271. return {};
  9272. }
  9273. } else {
  9274. var vals = this.get('validators').filter(function(cls){
  9275. return cls.test(':');
  9276. });
  9277. if (!vals.length){
  9278. this.store('$moo:validatorProps', {});
  9279. } else {
  9280. props = {};
  9281. vals.each(function(cls){
  9282. var split = cls.split(':');
  9283. if (split[1]){
  9284. try {
  9285. props[split[0]] = JSON.decode(split[1], false);
  9286. } catch (e){}
  9287. }
  9288. });
  9289. this.store('$moo:validatorProps', props);
  9290. }
  9291. }
  9292. return this.retrieve('$moo:validatorProps');
  9293. }
  9294. };
  9295. Form.Validator = new Class({
  9296. Implements: [Options, Events],
  9297. options: {/*
  9298. onFormValidate: function(isValid, form, event){},
  9299. onElementValidate: function(isValid, field, className, warn){},
  9300. onElementPass: function(field){},
  9301. onElementFail: function(field, validatorsFailed){}, */
  9302. fieldSelectors: 'input, select, textarea',
  9303. ignoreHidden: true,
  9304. ignoreDisabled: true,
  9305. useTitles: false,
  9306. evaluateOnSubmit: true,
  9307. evaluateFieldsOnBlur: true,
  9308. evaluateFieldsOnChange: true,
  9309. serial: true,
  9310. stopOnFailure: true,
  9311. warningPrefix: function(){
  9312. return Form.Validator.getMsg('warningPrefix') || 'Warning: ';
  9313. },
  9314. errorPrefix: function(){
  9315. return Form.Validator.getMsg('errorPrefix') || 'Error: ';
  9316. }
  9317. },
  9318. initialize: function(form, options){
  9319. this.setOptions(options);
  9320. this.element = document.id(form);
  9321. this.warningPrefix = Function.convert(this.options.warningPrefix)();
  9322. this.errorPrefix = Function.convert(this.options.errorPrefix)();
  9323. this._bound = {
  9324. onSubmit: this.onSubmit.bind(this),
  9325. blurOrChange: function(event, field){
  9326. this.validationMonitor(field, true);
  9327. }.bind(this)
  9328. };
  9329. this.enable();
  9330. },
  9331. toElement: function(){
  9332. return this.element;
  9333. },
  9334. getFields: function(){
  9335. return (this.fields = this.element.getElements(this.options.fieldSelectors));
  9336. },
  9337. enable: function(){
  9338. this.element.store('validator', this);
  9339. if (this.options.evaluateOnSubmit) this.element.addEvent('submit', this._bound.onSubmit);
  9340. if (this.options.evaluateFieldsOnBlur){
  9341. this.element.addEvent('blur:relay(input,select,textarea)', this._bound.blurOrChange);
  9342. }
  9343. if (this.options.evaluateFieldsOnChange){
  9344. this.element.addEvent('change:relay(input,select,textarea)', this._bound.blurOrChange);
  9345. }
  9346. },
  9347. disable: function(){
  9348. this.element.eliminate('validator');
  9349. this.element.removeEvents({
  9350. submit: this._bound.onSubmit,
  9351. 'blur:relay(input,select,textarea)': this._bound.blurOrChange,
  9352. 'change:relay(input,select,textarea)': this._bound.blurOrChange
  9353. });
  9354. },
  9355. validationMonitor: function(){
  9356. clearTimeout(this.timer);
  9357. this.timer = this.validateField.delay(50, this, arguments);
  9358. },
  9359. onSubmit: function(event){
  9360. if (this.validate(event)) this.reset();
  9361. },
  9362. reset: function(){
  9363. this.getFields().each(this.resetField, this);
  9364. return this;
  9365. },
  9366. validate: function(event){
  9367. var result = this.getFields().map(function(field){
  9368. return this.validateField(field, true);
  9369. }, this).every(function(v){
  9370. return v;
  9371. });
  9372. this.fireEvent('formValidate', [result, this.element, event]);
  9373. if (this.options.stopOnFailure && !result && event) event.preventDefault();
  9374. return result;
  9375. },
  9376. validateField: function(field, force){
  9377. if (this.paused) return true;
  9378. field = document.id(field);
  9379. var passed = !field.hasClass('validation-failed');
  9380. var failed, warned;
  9381. if (this.options.serial && !force){
  9382. failed = this.element.getElement('.validation-failed');
  9383. warned = this.element.getElement('.warning');
  9384. }
  9385. if (field && (!failed || force || field.hasClass('validation-failed') || (failed && !this.options.serial))){
  9386. var validationTypes = field.get('validators');
  9387. var validators = validationTypes.some(function(cn){
  9388. return this.getValidator(cn);
  9389. }, this);
  9390. var validatorsFailed = [];
  9391. validationTypes.each(function(className){
  9392. if (className && !this.test(className, field)) validatorsFailed.include(className);
  9393. }, this);
  9394. passed = validatorsFailed.length === 0;
  9395. if (validators && !this.hasValidator(field, 'warnOnly')){
  9396. if (passed){
  9397. field.addClass('validation-passed').removeClass('validation-failed');
  9398. this.fireEvent('elementPass', [field]);
  9399. } else {
  9400. field.addClass('validation-failed').removeClass('validation-passed');
  9401. this.fireEvent('elementFail', [field, validatorsFailed]);
  9402. }
  9403. }
  9404. if (!warned){
  9405. var warnings = validationTypes.some(function(cn){
  9406. if (cn.test('^warn'))
  9407. return this.getValidator(cn.replace(/^warn-/,''));
  9408. else return null;
  9409. }, this);
  9410. field.removeClass('warning');
  9411. var warnResult = validationTypes.map(function(cn){
  9412. if (cn.test('^warn'))
  9413. return this.test(cn.replace(/^warn-/,''), field, true);
  9414. else return null;
  9415. }, this);
  9416. }
  9417. }
  9418. return passed;
  9419. },
  9420. test: function(className, field, warn){
  9421. field = document.id(field);
  9422. if ((this.options.ignoreHidden && !field.isVisible()) || (this.options.ignoreDisabled && field.get('disabled'))) return true;
  9423. var validator = this.getValidator(className);
  9424. if (warn != null) warn = false;
  9425. if (this.hasValidator(field, 'warnOnly')) warn = true;
  9426. var isValid = field.hasClass('ignoreValidation') || (validator ? validator.test(field) : true);
  9427. if (validator) this.fireEvent('elementValidate', [isValid, field, className, warn]);
  9428. if (warn) return true;
  9429. return isValid;
  9430. },
  9431. hasValidator: function(field, value){
  9432. return field.get('validators').contains(value);
  9433. },
  9434. resetField: function(field){
  9435. field = document.id(field);
  9436. if (field){
  9437. field.get('validators').each(function(className){
  9438. if (className.test('^warn-')) className = className.replace(/^warn-/, '');
  9439. field.removeClass('validation-failed');
  9440. field.removeClass('warning');
  9441. field.removeClass('validation-passed');
  9442. }, this);
  9443. }
  9444. return this;
  9445. },
  9446. stop: function(){
  9447. this.paused = true;
  9448. return this;
  9449. },
  9450. start: function(){
  9451. this.paused = false;
  9452. return this;
  9453. },
  9454. ignoreField: function(field, warn){
  9455. field = document.id(field);
  9456. if (field){
  9457. this.enforceField(field);
  9458. if (warn) field.addClass('warnOnly');
  9459. else field.addClass('ignoreValidation');
  9460. }
  9461. return this;
  9462. },
  9463. enforceField: function(field){
  9464. field = document.id(field);
  9465. if (field) field.removeClass('warnOnly').removeClass('ignoreValidation');
  9466. return this;
  9467. }
  9468. });
  9469. Form.Validator.getMsg = function(key){
  9470. return Locale.get('FormValidator.' + key);
  9471. };
  9472. Form.Validator.adders = {
  9473. validators:{},
  9474. add : function(className, options){
  9475. this.validators[className] = new InputValidator(className, options);
  9476. //if this is a class (this method is used by instances of Form.Validator and the Form.Validator namespace)
  9477. //extend these validators into it
  9478. //this allows validators to be global and/or per instance
  9479. if (!this.initialize){
  9480. this.implement({
  9481. validators: this.validators
  9482. });
  9483. }
  9484. },
  9485. addAllThese : function(validators){
  9486. Array.convert(validators).each(function(validator){
  9487. this.add(validator[0], validator[1]);
  9488. }, this);
  9489. },
  9490. getValidator: function(className){
  9491. return this.validators[className.split(':')[0]];
  9492. }
  9493. };
  9494. Object.append(Form.Validator, Form.Validator.adders);
  9495. Form.Validator.implement(Form.Validator.adders);
  9496. Form.Validator.add('IsEmpty', {
  9497. errorMsg: false,
  9498. test: function(element){
  9499. if (element.type == 'select-one' || element.type == 'select')
  9500. return !(element.selectedIndex >= 0 && element.options[element.selectedIndex].value != '');
  9501. else
  9502. return ((element.get('value') == null) || (element.get('value').length == 0));
  9503. }
  9504. });
  9505. Form.Validator.addAllThese([
  9506. ['required', {
  9507. errorMsg: function(){
  9508. return Form.Validator.getMsg('required');
  9509. },
  9510. test: function(element){
  9511. return !Form.Validator.getValidator('IsEmpty').test(element);
  9512. }
  9513. }],
  9514. ['length', {
  9515. errorMsg: function(element, props){
  9516. if (typeOf(props.length) != 'null')
  9517. return Form.Validator.getMsg('length').substitute({length: props.length, elLength: element.get('value').length});
  9518. else return '';
  9519. },
  9520. test: function(element, props){
  9521. if (typeOf(props.length) != 'null') return (element.get('value').length == props.length || element.get('value').length == 0);
  9522. else return true;
  9523. }
  9524. }],
  9525. ['minLength', {
  9526. errorMsg: function(element, props){
  9527. if (typeOf(props.minLength) != 'null')
  9528. return Form.Validator.getMsg('minLength').substitute({minLength: props.minLength, length: element.get('value').length});
  9529. else return '';
  9530. },
  9531. test: function(element, props){
  9532. if (typeOf(props.minLength) != 'null') return (element.get('value').length >= (props.minLength || 0));
  9533. else return true;
  9534. }
  9535. }],
  9536. ['maxLength', {
  9537. errorMsg: function(element, props){
  9538. //props is {maxLength:10}
  9539. if (typeOf(props.maxLength) != 'null')
  9540. return Form.Validator.getMsg('maxLength').substitute({maxLength: props.maxLength, length: element.get('value').length});
  9541. else return '';
  9542. },
  9543. test: function(element, props){
  9544. return element.get('value').length <= (props.maxLength || 10000);
  9545. }
  9546. }],
  9547. ['validate-integer', {
  9548. errorMsg: Form.Validator.getMsg.pass('integer'),
  9549. test: function(element){
  9550. return Form.Validator.getValidator('IsEmpty').test(element) || (/^(-?[1-9]\d*|0)$/).test(element.get('value'));
  9551. }
  9552. }],
  9553. ['validate-numeric', {
  9554. errorMsg: Form.Validator.getMsg.pass('numeric'),
  9555. test: function(element){
  9556. return Form.Validator.getValidator('IsEmpty').test(element) ||
  9557. (/^-?(?:0$0(?=\d*\.)|[1-9]|0)\d*(\.\d+)?$/).test(element.get('value'));
  9558. }
  9559. }],
  9560. ['validate-digits', {
  9561. errorMsg: Form.Validator.getMsg.pass('digits'),
  9562. test: function(element){
  9563. return Form.Validator.getValidator('IsEmpty').test(element) || (/^[\d() .:\-\+#]+$/.test(element.get('value')));
  9564. }
  9565. }],
  9566. ['validate-alpha', {
  9567. errorMsg: Form.Validator.getMsg.pass('alpha'),
  9568. test: function(element){
  9569. return Form.Validator.getValidator('IsEmpty').test(element) || (/^[a-zA-Z]+$/).test(element.get('value'));
  9570. }
  9571. }],
  9572. ['validate-alphanum', {
  9573. errorMsg: Form.Validator.getMsg.pass('alphanum'),
  9574. test: function(element){
  9575. return Form.Validator.getValidator('IsEmpty').test(element) || !(/\W/).test(element.get('value'));
  9576. }
  9577. }],
  9578. ['validate-date', {
  9579. errorMsg: function(element, props){
  9580. if (Date.parse){
  9581. var format = props.dateFormat || '%x';
  9582. return Form.Validator.getMsg('dateSuchAs').substitute({date: new Date().format(format)});
  9583. } else {
  9584. return Form.Validator.getMsg('dateInFormatMDY');
  9585. }
  9586. },
  9587. test: function(element, props){
  9588. if (Form.Validator.getValidator('IsEmpty').test(element)) return true;
  9589. var dateLocale = Locale.get('Date'),
  9590. dateNouns = new RegExp([dateLocale.days, dateLocale.days_abbr, dateLocale.months, dateLocale.months_abbr, dateLocale.AM, dateLocale.PM].flatten().join('|'), 'i'),
  9591. value = element.get('value'),
  9592. wordsInValue = value.match(/[a-z]+/gi);
  9593. if (wordsInValue && !wordsInValue.every(dateNouns.exec, dateNouns)) return false;
  9594. var date = Date.parse(value);
  9595. if (!date) return false;
  9596. var format = props.dateFormat || '%x',
  9597. formatted = date.format(format);
  9598. if (formatted != 'invalid date') element.set('value', formatted);
  9599. return date.isValid();
  9600. }
  9601. }],
  9602. ['validate-email', {
  9603. errorMsg: Form.Validator.getMsg.pass('email'),
  9604. test: function(element){
  9605. /*
  9606. var chars = "[a-z0-9!#$%&'*+/=?^_`{|}~-]",
  9607. local = '(?:' + chars + '\\.?){0,63}' + chars,
  9608. label = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?',
  9609. hostname = '(?:' + label + '\\.)*' + label;
  9610. octet = '(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',
  9611. ipv4 = '\\[(?:' + octet + '\\.){3}' + octet + '\\]',
  9612. domain = '(?:' + hostname + '|' + ipv4 + ')';
  9613. var regex = new RegExp('^' + local + '@' + domain + '$', 'i');
  9614. */
  9615. 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'));
  9616. }
  9617. }],
  9618. ['validate-url', {
  9619. errorMsg: Form.Validator.getMsg.pass('url'),
  9620. test: function(element){
  9621. 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'));
  9622. }
  9623. }],
  9624. ['validate-currency-dollar', {
  9625. errorMsg: Form.Validator.getMsg.pass('currencyDollar'),
  9626. test: function(element){
  9627. 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'));
  9628. }
  9629. }],
  9630. ['validate-one-required', {
  9631. errorMsg: Form.Validator.getMsg.pass('oneRequired'),
  9632. test: function(element, props){
  9633. var p = document.id(props['validate-one-required']) || element.getParent(props['validate-one-required']);
  9634. return p.getElements('input').some(function(el){
  9635. if (['checkbox', 'radio'].contains(el.get('type'))) return el.get('checked');
  9636. return el.get('value');
  9637. });
  9638. }
  9639. }]
  9640. ]);
  9641. Element.Properties.validator = {
  9642. set: function(options){
  9643. this.get('validator').setOptions(options);
  9644. },
  9645. get: function(){
  9646. var validator = this.retrieve('validator');
  9647. if (!validator){
  9648. validator = new Form.Validator(this);
  9649. this.store('validator', validator);
  9650. }
  9651. return validator;
  9652. }
  9653. };
  9654. Element.implement({
  9655. validate: function(options){
  9656. if (options) this.set('validator', options);
  9657. return this.get('validator').validate();
  9658. }
  9659. });
  9660. //<1.2compat>
  9661. //legacy
  9662. var FormValidator = Form.Validator;
  9663. //</1.2compat>
  9664. /*
  9665. ---
  9666. script: Form.Validator.Extras.js
  9667. name: Form.Validator.Extras
  9668. description: Additional validators for the Form.Validator class.
  9669. license: MIT-style license
  9670. authors:
  9671. - Aaron Newton
  9672. requires:
  9673. - Form.Validator
  9674. provides: [Form.Validator.Extras]
  9675. ...
  9676. */
  9677. (function(){
  9678. function getItems(props, preference, children, cssSelector){
  9679. if (preference && props[preference]) return props[preference];
  9680. var el = document.id(props[children]);
  9681. if (!el) return [];
  9682. return el.getElements(cssSelector);
  9683. }
  9684. Form.Validator.addAllThese([
  9685. ['validate-enforce-oncheck', {
  9686. test: function(element, props){
  9687. var fv = element.getParent('form').retrieve('validator');
  9688. if (!fv) return true;
  9689. getItems(props, 'toEnforce', 'enforceChildrenOf', 'input, select, textarea').each(function(item){
  9690. if (element.checked){
  9691. fv.enforceField(item);
  9692. } else {
  9693. fv.ignoreField(item);
  9694. fv.resetField(item);
  9695. }
  9696. });
  9697. return true;
  9698. }
  9699. }],
  9700. ['validate-ignore-oncheck', {
  9701. test: function(element, props){
  9702. var fv = element.getParent('form').retrieve('validator');
  9703. if (!fv) return true;
  9704. getItems(props, 'toIgnore', 'ignoreChildrenOf', 'input, select, textarea').each(function(item){
  9705. if (element.checked){
  9706. fv.ignoreField(item);
  9707. fv.resetField(item);
  9708. } else {
  9709. fv.enforceField(item);
  9710. }
  9711. });
  9712. return true;
  9713. }
  9714. }],
  9715. ['validate-enforce-onselect-value', {
  9716. test: function(element, props){
  9717. if (!props.value) return true;
  9718. var fv = element.getParent('form').retrieve('validator');
  9719. if (!fv) return true;
  9720. getItems(props, 'toEnforce', 'enforceChildrenOf', 'input, select, textarea').each(function(item){
  9721. if (props.value == element.value){
  9722. fv.enforceField(item);
  9723. } else {
  9724. fv.ignoreField(item);
  9725. fv.resetField(item);
  9726. }
  9727. });
  9728. return true;
  9729. }
  9730. }],
  9731. ['validate-nospace', {
  9732. errorMsg: function(){
  9733. return Form.Validator.getMsg('noSpace');
  9734. },
  9735. test: function(element, props){
  9736. return !element.get('value').test(/\s/);
  9737. }
  9738. }],
  9739. ['validate-toggle-oncheck', {
  9740. test: function(element, props){
  9741. var fv = element.getParent('form').retrieve('validator');
  9742. if (!fv) return true;
  9743. var eleArr = getItems(props, 'toToggle', 'toToggleChildrenOf', 'input, select, textarea');
  9744. if (!element.checked){
  9745. eleArr.each(function(item){
  9746. fv.ignoreField(item);
  9747. fv.resetField(item);
  9748. });
  9749. } else {
  9750. eleArr.each(function(item){
  9751. fv.enforceField(item);
  9752. });
  9753. }
  9754. return true;
  9755. }
  9756. }],
  9757. ['validate-reqchk-bynode', {
  9758. errorMsg: function(){
  9759. return Form.Validator.getMsg('reqChkByNode');
  9760. },
  9761. test: function(element, props){
  9762. return getItems(props, false, 'nodeId', props.selector || 'input[type=checkbox], input[type=radio]').some(function(item){
  9763. return item.checked;
  9764. });
  9765. }
  9766. }],
  9767. ['validate-required-check', {
  9768. errorMsg: function(element, props){
  9769. return props.useTitle ? element.get('title') : Form.Validator.getMsg('requiredChk');
  9770. },
  9771. test: function(element, props){
  9772. return !!element.checked;
  9773. }
  9774. }],
  9775. ['validate-reqchk-byname', {
  9776. errorMsg: function(element, props){
  9777. return Form.Validator.getMsg('reqChkByName').substitute({label: props.label || element.get('type')});
  9778. },
  9779. test: function(element, props){
  9780. var grpName = props.groupName || element.get('name');
  9781. var grpNameEls = $$('[name=' + grpName +']');
  9782. var oneCheckedItem = grpNameEls.some(function(item, index){
  9783. return item.checked;
  9784. });
  9785. var fv = element.getParent('form').retrieve('validator');
  9786. if (oneCheckedItem && fv){
  9787. grpNameEls.each(function(item, index){ fv.resetField(item); });
  9788. }
  9789. return oneCheckedItem;
  9790. }
  9791. }],
  9792. ['validate-match', {
  9793. errorMsg: function(element, props){
  9794. return Form.Validator.getMsg('match').substitute({matchName: decodeURIComponent((props.matchName+'').replace(/\+/g, '%20')) || document.id(props.matchInput).get('name')});
  9795. },
  9796. test: function(element, props){
  9797. var eleVal = element.get('value');
  9798. var matchVal = document.id(props.matchInput) && document.id(props.matchInput).get('value');
  9799. return eleVal && matchVal ? eleVal == matchVal : true;
  9800. }
  9801. }],
  9802. ['validate-after-date', {
  9803. errorMsg: function(element, props){
  9804. return Form.Validator.getMsg('afterDate').substitute({
  9805. label: props.afterLabel || (props.afterElement ? Form.Validator.getMsg('startDate') : Form.Validator.getMsg('currentDate'))
  9806. });
  9807. },
  9808. test: function(element, props){
  9809. var start = document.id(props.afterElement) ? Date.parse(document.id(props.afterElement).get('value')) : new Date();
  9810. var end = Date.parse(element.get('value'));
  9811. return end && start ? end >= start : true;
  9812. }
  9813. }],
  9814. ['validate-before-date', {
  9815. errorMsg: function(element, props){
  9816. return Form.Validator.getMsg('beforeDate').substitute({
  9817. label: props.beforeLabel || (props.beforeElement ? Form.Validator.getMsg('endDate') : Form.Validator.getMsg('currentDate'))
  9818. });
  9819. },
  9820. test: function(element, props){
  9821. var start = Date.parse(element.get('value'));
  9822. var end = document.id(props.beforeElement) ? Date.parse(document.id(props.beforeElement).get('value')) : new Date();
  9823. return end && start ? end >= start : true;
  9824. }
  9825. }],
  9826. ['validate-custom-required', {
  9827. errorMsg: function(){
  9828. return Form.Validator.getMsg('required');
  9829. },
  9830. test: function(element, props){
  9831. return element.get('value') != props.emptyValue;
  9832. }
  9833. }],
  9834. ['validate-same-month', {
  9835. errorMsg: function(element, props){
  9836. var startMo = document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value');
  9837. var eleVal = element.get('value');
  9838. if (eleVal != '') return Form.Validator.getMsg(startMo ? 'sameMonth' : 'startMonth');
  9839. },
  9840. test: function(element, props){
  9841. var d1 = Date.parse(element.get('value'));
  9842. var d2 = Date.parse(document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value'));
  9843. return d1 && d2 ? d1.format('%B') == d2.format('%B') : true;
  9844. }
  9845. }],
  9846. ['validate-cc-num', {
  9847. errorMsg: function(element){
  9848. var ccNum = element.get('value').replace(/[^0-9]/g, '');
  9849. return Form.Validator.getMsg('creditcard').substitute({length: ccNum.length});
  9850. },
  9851. test: function(element){
  9852. // required is a different test
  9853. if (Form.Validator.getValidator('IsEmpty').test(element)) return true;
  9854. // Clean number value
  9855. var ccNum = element.get('value');
  9856. ccNum = ccNum.replace(/[^0-9]/g, '');
  9857. var validType = false;
  9858. if (ccNum.test(/^4[0-9]{12}([0-9]{3})?$/)) validType = 'Visa';
  9859. else if (ccNum.test(/^5[1-5]([0-9]{14})$/)) validType = 'Master Card';
  9860. else if (ccNum.test(/^3[47][0-9]{13}$/)) validType = 'American Express';
  9861. else if (ccNum.test(/^6(?:011|5[0-9]{2})[0-9]{12}$/)) validType = 'Discover';
  9862. else if (ccNum.test(/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/)) validType = 'Diners Club';
  9863. if (validType){
  9864. var sum = 0;
  9865. var cur = 0;
  9866. for (var i=ccNum.length-1; i>=0; --i){
  9867. cur = ccNum.charAt(i).toInt();
  9868. if (cur == 0) continue;
  9869. if ((ccNum.length-i) % 2 == 0) cur += cur;
  9870. if (cur > 9){
  9871. cur = cur.toString().charAt(0).toInt() + cur.toString().charAt(1).toInt();
  9872. }
  9873. sum += cur;
  9874. }
  9875. if ((sum % 10) == 0) return true;
  9876. }
  9877. var chunks = '';
  9878. while (ccNum != ''){
  9879. chunks += ' ' + ccNum.substr(0,4);
  9880. ccNum = ccNum.substr(4);
  9881. }
  9882. element.getParent('form').retrieve('validator').ignoreField(element);
  9883. element.set('value', chunks.clean());
  9884. element.getParent('form').retrieve('validator').enforceField(element);
  9885. return false;
  9886. }
  9887. }]
  9888. ]);
  9889. })();
  9890. /*
  9891. ---
  9892. script: Form.Validator.Inline.js
  9893. name: Form.Validator.Inline
  9894. description: Extends Form.Validator to add inline messages.
  9895. license: MIT-style license
  9896. authors:
  9897. - Aaron Newton
  9898. requires:
  9899. - Form.Validator
  9900. provides: [Form.Validator.Inline]
  9901. ...
  9902. */
  9903. Form.Validator.Inline = new Class({
  9904. Extends: Form.Validator,
  9905. options: {
  9906. showError: function(errorElement){
  9907. if (errorElement.reveal) errorElement.reveal();
  9908. else errorElement.setStyle('display', 'block');
  9909. },
  9910. hideError: function(errorElement){
  9911. if (errorElement.dissolve) errorElement.dissolve();
  9912. else errorElement.setStyle('display', 'none');
  9913. },
  9914. scrollToErrorsOnSubmit: true,
  9915. scrollToErrorsOnBlur: false,
  9916. scrollToErrorsOnChange: false,
  9917. scrollFxOptions: {
  9918. transition: 'quad:out',
  9919. offset: {
  9920. y: -20
  9921. }
  9922. }
  9923. },
  9924. initialize: function(form, options){
  9925. this.parent(form, options);
  9926. this.addEvent('onElementValidate', function(isValid, field, className, warn){
  9927. var validator = this.getValidator(className);
  9928. if (!isValid && validator.getError(field)){
  9929. if (warn) field.addClass('warning');
  9930. var advice = this.makeAdvice(className, field, validator.getError(field), warn);
  9931. this.insertAdvice(advice, field);
  9932. this.showAdvice(className, field);
  9933. } else {
  9934. this.hideAdvice(className, field);
  9935. }
  9936. });
  9937. },
  9938. makeAdvice: function(className, field, error, warn){
  9939. var errorMsg = (warn) ? this.warningPrefix : this.errorPrefix;
  9940. errorMsg += (this.options.useTitles) ? field.title || error:error;
  9941. var cssClass = (warn) ? 'warning-advice' : 'validation-advice';
  9942. var advice = this.getAdvice(className, field);
  9943. if (advice){
  9944. advice = advice.set('html', errorMsg);
  9945. } else {
  9946. advice = new Element('div', {
  9947. html: errorMsg,
  9948. styles: { display: 'none' },
  9949. id: 'advice-' + className.split(':')[0] + '-' + this.getFieldId(field)
  9950. }).addClass(cssClass);
  9951. }
  9952. field.store('$moo:advice-' + className, advice);
  9953. return advice;
  9954. },
  9955. getFieldId : function(field){
  9956. return field.id ? field.id : field.id = 'input_' + field.name;
  9957. },
  9958. showAdvice: function(className, field){
  9959. var advice = this.getAdvice(className, field);
  9960. if (
  9961. advice &&
  9962. !field.retrieve('$moo:' + this.getPropName(className)) &&
  9963. (
  9964. advice.getStyle('display') == 'none' ||
  9965. advice.getStyle('visibility') == 'hidden' ||
  9966. advice.getStyle('opacity') == 0
  9967. )
  9968. ){
  9969. field.store('$moo:' + this.getPropName(className), true);
  9970. this.options.showError(advice);
  9971. this.fireEvent('showAdvice', [field, advice, className]);
  9972. }
  9973. },
  9974. hideAdvice: function(className, field){
  9975. var advice = this.getAdvice(className, field);
  9976. if (advice && field.retrieve('$moo:' + this.getPropName(className))){
  9977. field.store('$moo:' + this.getPropName(className), false);
  9978. this.options.hideError(advice);
  9979. this.fireEvent('hideAdvice', [field, advice, className]);
  9980. }
  9981. },
  9982. getPropName: function(className){
  9983. return 'advice' + className;
  9984. },
  9985. resetField: function(field){
  9986. field = document.id(field);
  9987. if (!field) return this;
  9988. this.parent(field);
  9989. field.get('validators').each(function(className){
  9990. this.hideAdvice(className, field);
  9991. }, this);
  9992. return this;
  9993. },
  9994. getAllAdviceMessages: function(field, force){
  9995. var advice = [];
  9996. if (field.hasClass('ignoreValidation') && !force) return advice;
  9997. var validators = field.get('validators').some(function(cn){
  9998. var warner = cn.test('^warn-') || field.hasClass('warnOnly');
  9999. if (warner) cn = cn.replace(/^warn-/, '');
  10000. var validator = this.getValidator(cn);
  10001. if (!validator) return;
  10002. advice.push({
  10003. message: validator.getError(field),
  10004. warnOnly: warner,
  10005. passed: validator.test(),
  10006. validator: validator
  10007. });
  10008. }, this);
  10009. return advice;
  10010. },
  10011. getAdvice: function(className, field){
  10012. return field.retrieve('$moo:advice-' + className);
  10013. },
  10014. insertAdvice: function(advice, field){
  10015. //Check for error position prop
  10016. var props = field.get('validatorProps');
  10017. //Build advice
  10018. if (!props.msgPos || !document.id(props.msgPos)){
  10019. if (field.type && field.type.toLowerCase() == 'radio') field.getParent().adopt(advice);
  10020. else advice.inject(document.id(field), 'after');
  10021. } else {
  10022. document.id(props.msgPos).grab(advice);
  10023. }
  10024. },
  10025. validateField: function(field, force, scroll){
  10026. var result = this.parent(field, force);
  10027. if (((this.options.scrollToErrorsOnSubmit && scroll == null) || scroll) && !result){
  10028. var failed = document.id(this).getElement('.validation-failed');
  10029. var par = document.id(this).getParent();
  10030. while (par != document.body && par.getScrollSize().y == par.getSize().y){
  10031. par = par.getParent();
  10032. }
  10033. var fx = par.retrieve('$moo:fvScroller');
  10034. if (!fx && window.Fx && Fx.Scroll){
  10035. fx = new Fx.Scroll(par, this.options.scrollFxOptions);
  10036. par.store('$moo:fvScroller', fx);
  10037. }
  10038. if (failed){
  10039. if (fx) fx.toElement(failed);
  10040. else par.scrollTo(par.getScroll().x, failed.getPosition(par).y - 20);
  10041. }
  10042. }
  10043. return result;
  10044. },
  10045. watchFields: function(fields){
  10046. fields.each(function(el){
  10047. if (this.options.evaluateFieldsOnBlur){
  10048. el.addEvent('blur', this.validationMonitor.pass([el, false, this.options.scrollToErrorsOnBlur], this));
  10049. }
  10050. if (this.options.evaluateFieldsOnChange){
  10051. el.addEvent('change', this.validationMonitor.pass([el, true, this.options.scrollToErrorsOnChange], this));
  10052. }
  10053. }, this);
  10054. }
  10055. });
  10056. /*
  10057. ---
  10058. script: OverText.js
  10059. name: OverText
  10060. description: Shows text over an input that disappears when the user clicks into it. The text remains hidden if the user adds a value.
  10061. license: MIT-style license
  10062. authors:
  10063. - Aaron Newton
  10064. requires:
  10065. - Core/Options
  10066. - Core/Events
  10067. - Core/Element.Event
  10068. - Class.Binds
  10069. - Class.Occlude
  10070. - Element.Position
  10071. - Element.Shortcuts
  10072. provides: [OverText]
  10073. ...
  10074. */
  10075. (function(){
  10076. var OverText = this.OverText = new Class({
  10077. Implements: [Options, Events, Class.Occlude],
  10078. Binds: ['reposition', 'assert', 'focus', 'hide'],
  10079. options: {/*
  10080. textOverride: null,
  10081. onFocus: function(){},
  10082. onTextHide: function(textEl, inputEl){},
  10083. onTextShow: function(textEl, inputEl){}, */
  10084. element: 'label',
  10085. labelClass: 'overTxtLabel',
  10086. positionOptions: {
  10087. position: 'upperLeft',
  10088. edge: 'upperLeft',
  10089. offset: {
  10090. x: 4,
  10091. y: 2
  10092. }
  10093. },
  10094. poll: false,
  10095. pollInterval: 250,
  10096. wrap: false
  10097. },
  10098. property: 'OverText',
  10099. initialize: function(element, options){
  10100. element = this.element = document.id(element);
  10101. if (this.occlude()) return this.occluded;
  10102. this.setOptions(options);
  10103. this.attach(element);
  10104. OverText.instances.push(this);
  10105. if (this.options.poll) this.poll();
  10106. },
  10107. toElement: function(){
  10108. return this.element;
  10109. },
  10110. attach: function(){
  10111. var element = this.element,
  10112. options = this.options,
  10113. value = options.textOverride || element.get('alt') || element.get('title');
  10114. if (!value) return this;
  10115. var text = this.text = new Element(options.element, {
  10116. 'class': options.labelClass,
  10117. styles: {
  10118. lineHeight: 'normal',
  10119. position: 'absolute',
  10120. cursor: 'text'
  10121. },
  10122. html: value,
  10123. events: {
  10124. click: this.hide.pass(options.element == 'label', this)
  10125. }
  10126. }).inject(element, 'after');
  10127. if (options.element == 'label'){
  10128. if (!element.get('id')) element.set('id', 'input_' + String.uniqueID());
  10129. text.set('for', element.get('id'));
  10130. }
  10131. if (options.wrap){
  10132. this.textHolder = new Element('div.overTxtWrapper', {
  10133. styles: {
  10134. lineHeight: 'normal',
  10135. position: 'relative'
  10136. }
  10137. }).grab(text).inject(element, 'before');
  10138. }
  10139. return this.enable();
  10140. },
  10141. destroy: function(){
  10142. this.element.eliminate(this.property); // Class.Occlude storage
  10143. this.disable();
  10144. if (this.text) this.text.destroy();
  10145. if (this.textHolder) this.textHolder.destroy();
  10146. return this;
  10147. },
  10148. disable: function(){
  10149. this.element.removeEvents({
  10150. focus: this.focus,
  10151. blur: this.assert,
  10152. change: this.assert
  10153. });
  10154. window.removeEvent('resize', this.reposition);
  10155. this.hide(true, true);
  10156. return this;
  10157. },
  10158. enable: function(){
  10159. this.element.addEvents({
  10160. focus: this.focus,
  10161. blur: this.assert,
  10162. change: this.assert
  10163. });
  10164. window.addEvent('resize', this.reposition);
  10165. this.reposition();
  10166. return this;
  10167. },
  10168. wrap: function(){
  10169. if (this.options.element == 'label'){
  10170. if (!this.element.get('id')) this.element.set('id', 'input_' + String.uniqueID());
  10171. this.text.set('for', this.element.get('id'));
  10172. }
  10173. },
  10174. startPolling: function(){
  10175. this.pollingPaused = false;
  10176. return this.poll();
  10177. },
  10178. poll: function(stop){
  10179. //start immediately
  10180. //pause on focus
  10181. //resumeon blur
  10182. if (this.poller && !stop) return this;
  10183. if (stop){
  10184. clearInterval(this.poller);
  10185. } else {
  10186. this.poller = (function(){
  10187. if (!this.pollingPaused) this.assert(true);
  10188. }).periodical(this.options.pollInterval, this);
  10189. }
  10190. return this;
  10191. },
  10192. stopPolling: function(){
  10193. this.pollingPaused = true;
  10194. return this.poll(true);
  10195. },
  10196. focus: function(){
  10197. if (this.text && (!this.text.isDisplayed() || this.element.get('disabled'))) return this;
  10198. return this.hide();
  10199. },
  10200. hide: function(suppressFocus, force){
  10201. if (this.text && (this.text.isDisplayed() && (!this.element.get('disabled') || force))){
  10202. this.text.hide();
  10203. this.fireEvent('textHide', [this.text, this.element]);
  10204. this.pollingPaused = true;
  10205. if (!suppressFocus){
  10206. try {
  10207. this.element.fireEvent('focus');
  10208. this.element.focus();
  10209. } catch (e){} //IE barfs if you call focus on hidden elements
  10210. }
  10211. }
  10212. return this;
  10213. },
  10214. show: function(){
  10215. if (document.id(this.text) && !this.text.isDisplayed()){
  10216. this.text.show();
  10217. this.reposition();
  10218. this.fireEvent('textShow', [this.text, this.element]);
  10219. this.pollingPaused = false;
  10220. }
  10221. return this;
  10222. },
  10223. test: function(){
  10224. return !this.element.get('value');
  10225. },
  10226. assert: function(suppressFocus){
  10227. return this[this.test() ? 'show' : 'hide'](suppressFocus);
  10228. },
  10229. reposition: function(){
  10230. this.assert(true);
  10231. if (!this.element.isVisible()) return this.stopPolling().hide();
  10232. if (this.text && this.test()){
  10233. this.text.position(Object.merge(this.options.positionOptions, {
  10234. relativeTo: this.element
  10235. }));
  10236. }
  10237. return this;
  10238. }
  10239. });
  10240. })();
  10241. OverText.instances = [];
  10242. Object.append(OverText, {
  10243. each: function(fn){
  10244. return OverText.instances.each(function(ot, i){
  10245. if (ot.element && ot.text) fn.call(OverText, ot, i);
  10246. });
  10247. },
  10248. update: function(){
  10249. return OverText.each(function(ot){
  10250. return ot.reposition();
  10251. });
  10252. },
  10253. hideAll: function(){
  10254. return OverText.each(function(ot){
  10255. return ot.hide(true, true);
  10256. });
  10257. },
  10258. showAll: function(){
  10259. return OverText.each(function(ot){
  10260. return ot.show();
  10261. });
  10262. }
  10263. });
  10264. /*
  10265. ---
  10266. script: Fx.Elements.js
  10267. name: Fx.Elements
  10268. description: Effect to change any number of CSS properties of any number of Elements.
  10269. license: MIT-style license
  10270. authors:
  10271. - Valerio Proietti
  10272. requires:
  10273. - Core/Fx.CSS
  10274. - MooTools.More
  10275. provides: [Fx.Elements]
  10276. ...
  10277. */
  10278. Fx.Elements = new Class({
  10279. Extends: Fx.CSS,
  10280. initialize: function(elements, options){
  10281. this.elements = this.subject = $$(elements);
  10282. this.parent(options);
  10283. },
  10284. compute: function(from, to, delta){
  10285. var now = {};
  10286. for (var i in from){
  10287. var iFrom = from[i], iTo = to[i], iNow = now[i] = {};
  10288. for (var p in iFrom) iNow[p] = this.parent(iFrom[p], iTo[p], delta);
  10289. }
  10290. return now;
  10291. },
  10292. set: function(now){
  10293. for (var i in now){
  10294. if (!this.elements[i]) continue;
  10295. var iNow = now[i];
  10296. for (var p in iNow) this.render(this.elements[i], p, iNow[p], this.options.unit);
  10297. }
  10298. return this;
  10299. },
  10300. start: function(obj){
  10301. if (!this.check(obj)) return this;
  10302. var from = {}, to = {};
  10303. for (var i in obj){
  10304. if (!this.elements[i]) continue;
  10305. var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {};
  10306. for (var p in iProps){
  10307. var parsed = this.prepare(this.elements[i], p, iProps[p]);
  10308. iFrom[p] = parsed.from;
  10309. iTo[p] = parsed.to;
  10310. }
  10311. }
  10312. return this.parent(from, to);
  10313. }
  10314. });
  10315. /*
  10316. ---
  10317. script: Fx.Accordion.js
  10318. name: Fx.Accordion
  10319. description: An Fx.Elements extension which allows you to easily create accordion type controls.
  10320. license: MIT-style license
  10321. authors:
  10322. - Valerio Proietti
  10323. requires:
  10324. - Core/Element.Event
  10325. - Fx.Elements
  10326. provides: [Fx.Accordion]
  10327. ...
  10328. */
  10329. Fx.Accordion = new Class({
  10330. Extends: Fx.Elements,
  10331. options: {/*
  10332. onActive: function(toggler, section){},
  10333. onBackground: function(toggler, section){},*/
  10334. fixedHeight: false,
  10335. fixedWidth: false,
  10336. display: 0,
  10337. show: false,
  10338. height: true,
  10339. width: false,
  10340. opacity: true,
  10341. alwaysHide: false,
  10342. trigger: 'click',
  10343. initialDisplayFx: true,
  10344. resetHeight: true,
  10345. keepOpen: false
  10346. },
  10347. initialize: function(){
  10348. var defined = function(obj){
  10349. return obj != null;
  10350. };
  10351. var params = Array.link(arguments, {
  10352. 'container': Type.isElement, //deprecated
  10353. 'options': Type.isObject,
  10354. 'togglers': defined,
  10355. 'elements': defined
  10356. });
  10357. this.parent(params.elements, params.options);
  10358. var options = this.options,
  10359. togglers = this.togglers = $$(params.togglers);
  10360. this.previous = -1;
  10361. this.internalChain = new Chain();
  10362. if (options.alwaysHide) this.options.link = 'chain';
  10363. if (options.show || this.options.show === 0){
  10364. options.display = false;
  10365. this.previous = options.show;
  10366. }
  10367. if (options.start){
  10368. options.display = false;
  10369. options.show = false;
  10370. }
  10371. var effects = this.effects = {};
  10372. if (options.opacity) effects.opacity = 'fullOpacity';
  10373. if (options.width) effects.width = options.fixedWidth ? 'fullWidth' : 'offsetWidth';
  10374. if (options.height) effects.height = options.fixedHeight ? 'fullHeight' : 'scrollHeight';
  10375. for (var i = 0, l = togglers.length; i < l; i++) this.addSection(togglers[i], this.elements[i]);
  10376. this.elements.each(function(el, i){
  10377. if (options.show === i){
  10378. this.fireEvent('active', [togglers[i], el]);
  10379. } else {
  10380. for (var fx in effects) el.setStyle(fx, 0);
  10381. }
  10382. }, this);
  10383. if (options.display || options.display === 0 || options.initialDisplayFx === false){
  10384. this.display(options.display, options.initialDisplayFx);
  10385. }
  10386. if (options.fixedHeight !== false) options.resetHeight = false;
  10387. this.addEvent('complete', this.internalChain.callChain.bind(this.internalChain));
  10388. },
  10389. addSection: function(toggler, element){
  10390. toggler = document.id(toggler);
  10391. element = document.id(element);
  10392. this.togglers.include(toggler);
  10393. this.elements.include(element);
  10394. var togglers = this.togglers,
  10395. options = this.options,
  10396. test = togglers.contains(toggler),
  10397. idx = togglers.indexOf(toggler),
  10398. displayer = this.display.pass(idx, this);
  10399. toggler.store('accordion:display', displayer)
  10400. .addEvent(options.trigger, displayer);
  10401. if (options.height) element.setStyles({'padding-top': 0, 'border-top': 'none', 'padding-bottom': 0, 'border-bottom': 'none'});
  10402. if (options.width) element.setStyles({'padding-left': 0, 'border-left': 'none', 'padding-right': 0, 'border-right': 'none'});
  10403. element.fullOpacity = 1;
  10404. if (options.fixedWidth) element.fullWidth = options.fixedWidth;
  10405. if (options.fixedHeight) element.fullHeight = options.fixedHeight;
  10406. element.setStyle('overflow', 'hidden');
  10407. if (!test) for (var fx in this.effects){
  10408. element.setStyle(fx, 0);
  10409. }
  10410. return this;
  10411. },
  10412. removeSection: function(toggler, displayIndex){
  10413. var togglers = this.togglers,
  10414. idx = togglers.indexOf(toggler),
  10415. element = this.elements[idx];
  10416. var remover = function(){
  10417. togglers.erase(toggler);
  10418. this.elements.erase(element);
  10419. this.detach(toggler);
  10420. }.bind(this);
  10421. if (this.now == idx || displayIndex != null){
  10422. this.display(displayIndex != null ? displayIndex : (idx - 1 >= 0 ? idx - 1 : 0)).chain(remover);
  10423. } else {
  10424. remover();
  10425. }
  10426. return this;
  10427. },
  10428. detach: function(toggler){
  10429. var remove = function(toggler){
  10430. toggler.removeEvent(this.options.trigger, toggler.retrieve('accordion:display'));
  10431. }.bind(this);
  10432. if (!toggler) this.togglers.each(remove);
  10433. else remove(toggler);
  10434. return this;
  10435. },
  10436. display: function(index, useFx){
  10437. if (!this.check(index, useFx)) return this;
  10438. var obj = {},
  10439. elements = this.elements,
  10440. options = this.options,
  10441. effects = this.effects,
  10442. keepOpen = options.keepOpen,
  10443. alwaysHide = options.alwaysHide;
  10444. if (useFx == null) useFx = true;
  10445. if (typeOf(index) == 'element') index = elements.indexOf(index);
  10446. if (index == this.current && !alwaysHide && !keepOpen) return this;
  10447. if (options.resetHeight){
  10448. var prev = elements[this.current];
  10449. if (prev && !this.selfHidden){
  10450. for (var fx in effects) prev.setStyle(fx, prev[effects[fx]]);
  10451. }
  10452. }
  10453. if (this.timer && options.link == 'chain') return this;
  10454. if (this.current != null) this.previous = this.current;
  10455. this.current = index;
  10456. this.selfHidden = false;
  10457. elements.each(function(el, i){
  10458. obj[i] = {};
  10459. var hide, isOpen;
  10460. if (!keepOpen || i == index){
  10461. if (i == index) isOpen = (el.offsetHeight > 0 && options.height) || (el.offsetWidth > 0 && options.width);
  10462. if (i != index){
  10463. hide = true;
  10464. } else if ((alwaysHide || keepOpen) && isOpen){
  10465. hide = true;
  10466. this.selfHidden = true;
  10467. }
  10468. this.fireEvent(hide ? 'background' : 'active', [this.togglers[i], el]);
  10469. for (var fx in effects) obj[i][fx] = hide ? 0 : el[effects[fx]];
  10470. if (!useFx && !hide && options.resetHeight) obj[i].height = 'auto';
  10471. }
  10472. }, this);
  10473. this.internalChain.clearChain();
  10474. this.internalChain.chain(function(){
  10475. if (options.resetHeight && !this.selfHidden){
  10476. var el = elements[index];
  10477. if (el) el.setStyle('height', 'auto');
  10478. }
  10479. }.bind(this));
  10480. return useFx ? this.start(obj) : this.set(obj).internalChain.callChain();
  10481. }
  10482. });
  10483. /*<1.2compat>*/
  10484. /*
  10485. Compatibility with 1.2.0
  10486. */
  10487. var Accordion = new Class({
  10488. Extends: Fx.Accordion,
  10489. initialize: function(){
  10490. this.parent.apply(this, arguments);
  10491. var params = Array.link(arguments, {'container': Type.isElement});
  10492. this.container = params.container;
  10493. },
  10494. addSection: function(toggler, element, pos){
  10495. toggler = document.id(toggler);
  10496. element = document.id(element);
  10497. var test = this.togglers.contains(toggler);
  10498. var len = this.togglers.length;
  10499. if (len && (!test || pos)){
  10500. pos = pos != null ? pos : len - 1;
  10501. toggler.inject(this.togglers[pos], 'before');
  10502. element.inject(toggler, 'after');
  10503. } else if (this.container && !test){
  10504. toggler.inject(this.container);
  10505. element.inject(this.container);
  10506. }
  10507. return this.parent.apply(this, arguments);
  10508. }
  10509. });
  10510. /*</1.2compat>*/
  10511. /*
  10512. ---
  10513. script: Fx.Move.js
  10514. name: Fx.Move
  10515. description: Defines Fx.Move, a class that works with Element.Position.js to transition an element from one location to another.
  10516. license: MIT-style license
  10517. authors:
  10518. - Aaron Newton
  10519. requires:
  10520. - Core/Fx.Morph
  10521. - Element.Position
  10522. provides: [Fx.Move]
  10523. ...
  10524. */
  10525. Fx.Move = new Class({
  10526. Extends: Fx.Morph,
  10527. options: {
  10528. relativeTo: document.body,
  10529. position: 'center',
  10530. edge: false,
  10531. offset: {x: 0, y: 0}
  10532. },
  10533. start: function(destination){
  10534. var element = this.element,
  10535. topLeft = element.getStyles('top', 'left');
  10536. if (topLeft.top == 'auto' || topLeft.left == 'auto'){
  10537. element.setPosition(element.getPosition(element.getOffsetParent()));
  10538. }
  10539. return this.parent(element.position(Object.merge({}, this.options, destination, {returnPos: true})));
  10540. }
  10541. });
  10542. Element.Properties.move = {
  10543. set: function(options){
  10544. this.get('move').cancel().setOptions(options);
  10545. return this;
  10546. },
  10547. get: function(){
  10548. var move = this.retrieve('move');
  10549. if (!move){
  10550. move = new Fx.Move(this, {link: 'cancel'});
  10551. this.store('move', move);
  10552. }
  10553. return move;
  10554. }
  10555. };
  10556. Element.implement({
  10557. move: function(options){
  10558. this.get('move').start(options);
  10559. return this;
  10560. }
  10561. });
  10562. /*
  10563. ---
  10564. script: Fx.Scroll.js
  10565. name: Fx.Scroll
  10566. description: Effect to smoothly scroll any element, including the window.
  10567. license: MIT-style license
  10568. authors:
  10569. - Valerio Proietti
  10570. requires:
  10571. - Core/Fx
  10572. - Core/Element.Event
  10573. - Core/Element.Dimensions
  10574. - MooTools.More
  10575. provides: [Fx.Scroll]
  10576. ...
  10577. */
  10578. (function(){
  10579. Fx.Scroll = new Class({
  10580. Extends: Fx,
  10581. options: {
  10582. offset: {x: 0, y: 0},
  10583. wheelStops: true
  10584. },
  10585. initialize: function(element, options){
  10586. this.element = this.subject = document.id(element);
  10587. this.parent(options);
  10588. if (typeOf(this.element) != 'element') this.element = document.id(this.element.getDocument().body);
  10589. if (this.options.wheelStops){
  10590. var stopper = this.element,
  10591. cancel = this.cancel.pass(false, this);
  10592. this.addEvent('start', function(){
  10593. stopper.addEvent('mousewheel', cancel);
  10594. }, true);
  10595. this.addEvent('complete', function(){
  10596. stopper.removeEvent('mousewheel', cancel);
  10597. }, true);
  10598. }
  10599. },
  10600. set: function(){
  10601. var now = Array.flatten(arguments);
  10602. this.element.scrollTo(now[0], now[1]);
  10603. return this;
  10604. },
  10605. compute: function(from, to, delta){
  10606. return [0, 1].map(function(i){
  10607. return Fx.compute(from[i], to[i], delta);
  10608. });
  10609. },
  10610. start: function(x, y){
  10611. if (!this.check(x, y)) return this;
  10612. var scroll = this.element.getScroll();
  10613. return this.parent([scroll.x, scroll.y], [x, y]);
  10614. },
  10615. calculateScroll: function(x, y){
  10616. var element = this.element,
  10617. scrollSize = element.getScrollSize(),
  10618. scroll = element.getScroll(),
  10619. size = element.getSize(),
  10620. offset = this.options.offset,
  10621. values = {x: x, y: y};
  10622. for (var z in values){
  10623. if (!values[z] && values[z] !== 0) values[z] = scroll[z];
  10624. if (typeOf(values[z]) != 'number') values[z] = scrollSize[z] - size[z];
  10625. values[z] += offset[z];
  10626. }
  10627. return [values.x, values.y];
  10628. },
  10629. toTop: function(){
  10630. return this.start.apply(this, this.calculateScroll(false, 0));
  10631. },
  10632. toLeft: function(){
  10633. return this.start.apply(this, this.calculateScroll(0, false));
  10634. },
  10635. toRight: function(){
  10636. return this.start.apply(this, this.calculateScroll('right', false));
  10637. },
  10638. toBottom: function(){
  10639. return this.start.apply(this, this.calculateScroll(false, 'bottom'));
  10640. },
  10641. toElement: function(el, axes){
  10642. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10643. var scroll = isBody(this.element) ? {x: 0, y: 0} : this.element.getScroll();
  10644. var position = Object.map(document.id(el).getPosition(this.element), function(value, axis){
  10645. return axes.contains(axis) ? value + scroll[axis] : false;
  10646. });
  10647. return this.start.apply(this, this.calculateScroll(position.x, position.y));
  10648. },
  10649. toElementEdge: function(el, axes, offset){
  10650. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10651. el = document.id(el);
  10652. var to = {},
  10653. position = el.getPosition(this.element),
  10654. size = el.getSize(),
  10655. scroll = this.element.getScroll(),
  10656. containerSize = this.element.getSize(),
  10657. edge = {
  10658. x: position.x + size.x,
  10659. y: position.y + size.y
  10660. };
  10661. ['x', 'y'].each(function(axis){
  10662. if (axes.contains(axis)){
  10663. if (edge[axis] > scroll[axis] + containerSize[axis]) to[axis] = edge[axis] - containerSize[axis];
  10664. if (position[axis] < scroll[axis]) to[axis] = position[axis];
  10665. }
  10666. if (to[axis] == null) to[axis] = scroll[axis];
  10667. if (offset && offset[axis]) to[axis] = to[axis] + offset[axis];
  10668. }, this);
  10669. if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y);
  10670. return this;
  10671. },
  10672. toElementCenter: function(el, axes, offset){
  10673. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10674. el = document.id(el);
  10675. var to = {},
  10676. position = el.getPosition(this.element),
  10677. size = el.getSize(),
  10678. scroll = this.element.getScroll(),
  10679. containerSize = this.element.getSize();
  10680. ['x', 'y'].each(function(axis){
  10681. if (axes.contains(axis)){
  10682. to[axis] = position[axis] - (containerSize[axis] - size[axis]) / 2;
  10683. }
  10684. if (to[axis] == null) to[axis] = scroll[axis];
  10685. if (offset && offset[axis]) to[axis] = to[axis] + offset[axis];
  10686. }, this);
  10687. if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y);
  10688. return this;
  10689. }
  10690. });
  10691. //<1.2compat>
  10692. Fx.Scroll.implement({
  10693. scrollToCenter: function(){
  10694. return this.toElementCenter.apply(this, arguments);
  10695. },
  10696. scrollIntoView: function(){
  10697. return this.toElementEdge.apply(this, arguments);
  10698. }
  10699. });
  10700. //</1.2compat>
  10701. function isBody(element){
  10702. return (/^(?:body|html)$/i).test(element.tagName);
  10703. }
  10704. })();
  10705. /*
  10706. ---
  10707. script: Fx.Slide.js
  10708. name: Fx.Slide
  10709. description: Effect to slide an element in and out of view.
  10710. license: MIT-style license
  10711. authors:
  10712. - Valerio Proietti
  10713. requires:
  10714. - Core/Fx
  10715. - Core/Element.Style
  10716. - MooTools.More
  10717. provides: [Fx.Slide]
  10718. ...
  10719. */
  10720. Fx.Slide = new Class({
  10721. Extends: Fx,
  10722. options: {
  10723. mode: 'vertical',
  10724. wrapper: false,
  10725. hideOverflow: true,
  10726. resetHeight: false
  10727. },
  10728. initialize: function(element, options){
  10729. element = this.element = this.subject = document.id(element);
  10730. this.parent(options);
  10731. options = this.options;
  10732. var wrapper = element.retrieve('wrapper'),
  10733. styles = element.getStyles('margin', 'position', 'overflow');
  10734. if (options.hideOverflow) styles = Object.append(styles, {overflow: 'hidden'});
  10735. if (options.wrapper) wrapper = document.id(options.wrapper).setStyles(styles);
  10736. if (!wrapper) wrapper = new Element('div', {
  10737. styles: styles
  10738. }).wraps(element);
  10739. element.store('wrapper', wrapper).setStyle('margin', 0);
  10740. if (element.getStyle('overflow') == 'visible') element.setStyle('overflow', 'hidden');
  10741. this.now = [];
  10742. this.open = true;
  10743. this.wrapper = wrapper;
  10744. this.addEvent('complete', function(){
  10745. this.open = (wrapper['offset' + this.layout.capitalize()] != 0);
  10746. if (this.open && this.options.resetHeight) wrapper.setStyle('height', '');
  10747. }, true);
  10748. },
  10749. vertical: function(){
  10750. this.margin = 'margin-top';
  10751. this.layout = 'height';
  10752. this.offset = this.element.offsetHeight;
  10753. },
  10754. horizontal: function(){
  10755. this.margin = 'margin-left';
  10756. this.layout = 'width';
  10757. this.offset = this.element.offsetWidth;
  10758. },
  10759. set: function(now){
  10760. this.element.setStyle(this.margin, now[0]);
  10761. this.wrapper.setStyle(this.layout, now[1]);
  10762. return this;
  10763. },
  10764. compute: function(from, to, delta){
  10765. return [0, 1].map(function(i){
  10766. return Fx.compute(from[i], to[i], delta);
  10767. });
  10768. },
  10769. start: function(how, mode){
  10770. if (!this.check(how, mode)) return this;
  10771. this[mode || this.options.mode]();
  10772. var margin = this.element.getStyle(this.margin).toInt(),
  10773. layout = this.wrapper.getStyle(this.layout).toInt(),
  10774. caseIn = [[margin, layout], [0, this.offset]],
  10775. caseOut = [[margin, layout], [-this.offset, 0]],
  10776. start;
  10777. switch (how){
  10778. case 'in': start = caseIn; break;
  10779. case 'out': start = caseOut; break;
  10780. case 'toggle': start = (layout == 0) ? caseIn : caseOut;
  10781. }
  10782. return this.parent(start[0], start[1]);
  10783. },
  10784. slideIn: function(mode){
  10785. return this.start('in', mode);
  10786. },
  10787. slideOut: function(mode){
  10788. return this.start('out', mode);
  10789. },
  10790. hide: function(mode){
  10791. this[mode || this.options.mode]();
  10792. this.open = false;
  10793. return this.set([-this.offset, 0]);
  10794. },
  10795. show: function(mode){
  10796. this[mode || this.options.mode]();
  10797. this.open = true;
  10798. return this.set([0, this.offset]);
  10799. },
  10800. toggle: function(mode){
  10801. return this.start('toggle', mode);
  10802. }
  10803. });
  10804. Element.Properties.slide = {
  10805. set: function(options){
  10806. this.get('slide').cancel().setOptions(options);
  10807. return this;
  10808. },
  10809. get: function(){
  10810. var slide = this.retrieve('slide');
  10811. if (!slide){
  10812. slide = new Fx.Slide(this, {link: 'cancel'});
  10813. this.store('slide', slide);
  10814. }
  10815. return slide;
  10816. }
  10817. };
  10818. Element.implement({
  10819. slide: function(how, mode){
  10820. how = how || 'toggle';
  10821. var slide = this.get('slide'), toggle;
  10822. switch (how){
  10823. case 'hide': slide.hide(mode); break;
  10824. case 'show': slide.show(mode); break;
  10825. case 'toggle':
  10826. var flag = this.retrieve('slide:flag', slide.open);
  10827. slide[flag ? 'slideOut' : 'slideIn'](mode);
  10828. this.store('slide:flag', !flag);
  10829. toggle = true;
  10830. break;
  10831. default: slide.start(how, mode);
  10832. }
  10833. if (!toggle) this.eliminate('slide:flag');
  10834. return this;
  10835. }
  10836. });
  10837. /*
  10838. ---
  10839. script: Fx.SmoothScroll.js
  10840. name: Fx.SmoothScroll
  10841. description: Class for creating a smooth scrolling effect to all internal links on the page.
  10842. license: MIT-style license
  10843. authors:
  10844. - Valerio Proietti
  10845. requires:
  10846. - Core/Slick.Finder
  10847. - Fx.Scroll
  10848. provides: [Fx.SmoothScroll]
  10849. ...
  10850. */
  10851. /*<1.2compat>*/var SmoothScroll = /*</1.2compat>*/Fx.SmoothScroll = new Class({
  10852. Extends: Fx.Scroll,
  10853. options: {
  10854. axes: ['x', 'y']
  10855. },
  10856. initialize: function(options, context){
  10857. context = context || document;
  10858. this.doc = context.getDocument();
  10859. this.parent(this.doc, options);
  10860. var win = context.getWindow(),
  10861. location = win.location.href.match(/^[^#]*/)[0] + '#',
  10862. links = $$(this.options.links || this.doc.links);
  10863. links.each(function(link){
  10864. if (link.href.indexOf(location) != 0) return;
  10865. var anchor = link.href.substr(location.length);
  10866. if (anchor) this.useLink(link, anchor);
  10867. }, this);
  10868. this.addEvent('complete', function(){
  10869. win.location.hash = this.anchor;
  10870. this.element.scrollTo(this.to[0], this.to[1]);
  10871. }, true);
  10872. },
  10873. useLink: function(link, anchor){
  10874. link.addEvent('click', function(event){
  10875. var el = document.id(anchor) || this.doc.getElement('a[name=' + anchor + ']');
  10876. if (!el) return;
  10877. event.preventDefault();
  10878. this.toElement(el, this.options.axes).chain(function(){
  10879. this.fireEvent('scrolledTo', [link, el]);
  10880. }.bind(this));
  10881. this.anchor = anchor;
  10882. }.bind(this));
  10883. return this;
  10884. }
  10885. });
  10886. /*
  10887. ---
  10888. script: Fx.Sort.js
  10889. name: Fx.Sort
  10890. description: Defines Fx.Sort, a class that reorders lists with a transition.
  10891. license: MIT-style license
  10892. authors:
  10893. - Aaron Newton
  10894. requires:
  10895. - Core/Element.Dimensions
  10896. - Fx.Elements
  10897. - Element.Measure
  10898. provides: [Fx.Sort]
  10899. ...
  10900. */
  10901. Fx.Sort = new Class({
  10902. Extends: Fx.Elements,
  10903. options: {
  10904. mode: 'vertical'
  10905. },
  10906. initialize: function(elements, options){
  10907. this.parent(elements, options);
  10908. this.elements.each(function(el){
  10909. if (el.getStyle('position') == 'static') el.setStyle('position', 'relative');
  10910. });
  10911. this.setDefaultOrder();
  10912. },
  10913. setDefaultOrder: function(){
  10914. this.currentOrder = this.elements.map(function(el, index){
  10915. return index;
  10916. });
  10917. },
  10918. sort: function(){
  10919. if (!this.check(arguments)) return this;
  10920. var newOrder = Array.flatten(arguments);
  10921. var top = 0,
  10922. left = 0,
  10923. next = {},
  10924. zero = {},
  10925. vert = this.options.mode == 'vertical';
  10926. var current = this.elements.map(function(el, index){
  10927. var size = el.getComputedSize({styles: ['border', 'padding', 'margin']});
  10928. var val;
  10929. if (vert){
  10930. val = {
  10931. top: top,
  10932. margin: size['margin-top'],
  10933. height: size.totalHeight
  10934. };
  10935. top += val.height - size['margin-top'];
  10936. } else {
  10937. val = {
  10938. left: left,
  10939. margin: size['margin-left'],
  10940. width: size.totalWidth
  10941. };
  10942. left += val.width;
  10943. }
  10944. var plane = vert ? 'top' : 'left';
  10945. zero[index] = {};
  10946. var start = el.getStyle(plane).toInt();
  10947. zero[index][plane] = start || 0;
  10948. return val;
  10949. }, this);
  10950. this.set(zero);
  10951. newOrder = newOrder.map(function(i){ return i.toInt(); });
  10952. if (newOrder.length != this.elements.length){
  10953. this.currentOrder.each(function(index){
  10954. if (!newOrder.contains(index)) newOrder.push(index);
  10955. });
  10956. if (newOrder.length > this.elements.length)
  10957. newOrder.splice(this.elements.length-1, newOrder.length - this.elements.length);
  10958. }
  10959. var margin = 0;
  10960. top = left = 0;
  10961. newOrder.each(function(item){
  10962. var newPos = {};
  10963. if (vert){
  10964. newPos.top = top - current[item].top - margin;
  10965. top += current[item].height;
  10966. } else {
  10967. newPos.left = left - current[item].left;
  10968. left += current[item].width;
  10969. }
  10970. margin = margin + current[item].margin;
  10971. next[item]=newPos;
  10972. }, this);
  10973. var mapped = {};
  10974. Array.clone(newOrder).sort().each(function(index){
  10975. mapped[index] = next[index];
  10976. });
  10977. this.start(mapped);
  10978. this.currentOrder = newOrder;
  10979. return this;
  10980. },
  10981. rearrangeDOM: function(newOrder){
  10982. newOrder = newOrder || this.currentOrder;
  10983. var parent = this.elements[0].getParent();
  10984. var rearranged = [];
  10985. this.elements.setStyle('opacity', 0);
  10986. //move each element and store the new default order
  10987. newOrder.each(function(index){
  10988. rearranged.push(this.elements[index].inject(parent).setStyles({
  10989. top: 0,
  10990. left: 0
  10991. }));
  10992. }, this);
  10993. this.elements.setStyle('opacity', 1);
  10994. this.elements = $$(rearranged);
  10995. this.setDefaultOrder();
  10996. return this;
  10997. },
  10998. getDefaultOrder: function(){
  10999. return this.elements.map(function(el, index){
  11000. return index;
  11001. });
  11002. },
  11003. getCurrentOrder: function(){
  11004. return this.currentOrder;
  11005. },
  11006. forward: function(){
  11007. return this.sort(this.getDefaultOrder());
  11008. },
  11009. backward: function(){
  11010. return this.sort(this.getDefaultOrder().reverse());
  11011. },
  11012. reverse: function(){
  11013. return this.sort(this.currentOrder.reverse());
  11014. },
  11015. sortByElements: function(elements){
  11016. return this.sort(elements.map(function(el){
  11017. return this.elements.indexOf(el);
  11018. }, this));
  11019. },
  11020. swap: function(one, two){
  11021. if (typeOf(one) == 'element') one = this.elements.indexOf(one);
  11022. if (typeOf(two) == 'element') two = this.elements.indexOf(two);
  11023. var newOrder = Array.clone(this.currentOrder);
  11024. newOrder[this.currentOrder.indexOf(one)] = two;
  11025. newOrder[this.currentOrder.indexOf(two)] = one;
  11026. return this.sort(newOrder);
  11027. }
  11028. });
  11029. /*
  11030. ---
  11031. script: Keyboard.js
  11032. name: Keyboard
  11033. 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.
  11034. license: MIT-style license
  11035. authors:
  11036. - Perrin Westrich
  11037. - Aaron Newton
  11038. - Scott Kyle
  11039. requires:
  11040. - Core/Events
  11041. - Core/Options
  11042. - Core/Element.Event
  11043. - Element.Event.Pseudos.Keys
  11044. provides: [Keyboard]
  11045. ...
  11046. */
  11047. (function(){
  11048. var Keyboard = this.Keyboard = new Class({
  11049. Extends: Events,
  11050. Implements: [Options],
  11051. options: {/*
  11052. onActivate: function(){},
  11053. onDeactivate: function(){},*/
  11054. defaultEventType: 'keydown',
  11055. active: false,
  11056. manager: null,
  11057. events: {},
  11058. nonParsedEvents: ['activate', 'deactivate', 'onactivate', 'ondeactivate', 'changed', 'onchanged']
  11059. },
  11060. initialize: function(options){
  11061. if (options && options.manager){
  11062. this._manager = options.manager;
  11063. delete options.manager;
  11064. }
  11065. this.setOptions(options);
  11066. this._setup();
  11067. },
  11068. addEvent: function(type, fn, internal){
  11069. return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn, internal);
  11070. },
  11071. removeEvent: function(type, fn){
  11072. return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn);
  11073. },
  11074. toggleActive: function(){
  11075. return this[this.isActive() ? 'deactivate' : 'activate']();
  11076. },
  11077. activate: function(instance){
  11078. if (instance){
  11079. if (instance.isActive()) return this;
  11080. //if we're stealing focus, store the last keyboard to have it so the relinquish command works
  11081. if (this._activeKB && instance != this._activeKB){
  11082. this.previous = this._activeKB;
  11083. this.previous.fireEvent('deactivate');
  11084. }
  11085. //if we're enabling a child, assign it so that events are now passed to it
  11086. this._activeKB = instance.fireEvent('activate');
  11087. Keyboard.manager.fireEvent('changed');
  11088. } else if (this._manager){
  11089. //else we're enabling ourselves, we must ask our parent to do it for us
  11090. this._manager.activate(this);
  11091. }
  11092. return this;
  11093. },
  11094. isActive: function(){
  11095. return this._manager ? (this._manager._activeKB == this) : (Keyboard.manager == this);
  11096. },
  11097. deactivate: function(instance){
  11098. if (instance){
  11099. if (instance === this._activeKB){
  11100. this._activeKB = null;
  11101. instance.fireEvent('deactivate');
  11102. Keyboard.manager.fireEvent('changed');
  11103. }
  11104. } else if (this._manager){
  11105. this._manager.deactivate(this);
  11106. }
  11107. return this;
  11108. },
  11109. relinquish: function(){
  11110. if (this.isActive() && this._manager && this._manager.previous) this._manager.activate(this._manager.previous);
  11111. else this.deactivate();
  11112. return this;
  11113. },
  11114. //management logic
  11115. manage: function(instance){
  11116. if (instance._manager) instance._manager.drop(instance);
  11117. this._instances.push(instance);
  11118. instance._manager = this;
  11119. if (!this._activeKB) this.activate(instance);
  11120. return this;
  11121. },
  11122. drop: function(instance){
  11123. instance.relinquish();
  11124. this._instances.erase(instance);
  11125. if (this._activeKB == instance){
  11126. if (this.previous && this._instances.contains(this.previous)) this.activate(this.previous);
  11127. else this._activeKB = this._instances[0];
  11128. }
  11129. return this;
  11130. },
  11131. trace: function(){
  11132. Keyboard.trace(this);
  11133. },
  11134. each: function(fn){
  11135. Keyboard.each(this, fn);
  11136. },
  11137. /*
  11138. PRIVATE METHODS
  11139. */
  11140. _instances: [],
  11141. _disable: function(instance){
  11142. if (this._activeKB == instance) this._activeKB = null;
  11143. },
  11144. _setup: function(){
  11145. this.addEvents(this.options.events);
  11146. //if this is the root manager, nothing manages it
  11147. if (Keyboard.manager && !this._manager) Keyboard.manager.manage(this);
  11148. if (this.options.active) this.activate();
  11149. else this.relinquish();
  11150. },
  11151. _handle: function(event, type){
  11152. //Keyboard.stop(event) prevents key propagation
  11153. if (event.preventKeyboardPropagation) return;
  11154. var bubbles = !!this._manager;
  11155. if (bubbles && this._activeKB){
  11156. this._activeKB._handle(event, type);
  11157. if (event.preventKeyboardPropagation) return;
  11158. }
  11159. this.fireEvent(type, event);
  11160. if (!bubbles && this._activeKB) this._activeKB._handle(event, type);
  11161. }
  11162. });
  11163. var parsed = {};
  11164. var modifiers = ['shift', 'control', 'alt', 'meta'];
  11165. var regex = /^(?:shift|control|ctrl|alt|meta)$/;
  11166. Keyboard.parse = function(type, eventType, ignore){
  11167. if (ignore && ignore.contains(type.toLowerCase())) return type;
  11168. type = type.toLowerCase().replace(/^(keyup|keydown):/, function($0, $1){
  11169. eventType = $1;
  11170. return '';
  11171. });
  11172. if (!parsed[type]){
  11173. if (type != '+'){
  11174. var key, mods = {};
  11175. type.split('+').each(function(part){
  11176. if (regex.test(part)) mods[part] = true;
  11177. else key = part;
  11178. });
  11179. mods.control = mods.control || mods.ctrl; // allow both control and ctrl
  11180. var keys = [];
  11181. modifiers.each(function(mod){
  11182. if (mods[mod]) keys.push(mod);
  11183. });
  11184. if (key) keys.push(key);
  11185. parsed[type] = keys.join('+');
  11186. } else {
  11187. parsed[type] = type;
  11188. }
  11189. }
  11190. return eventType + ':keys(' + parsed[type] + ')';
  11191. };
  11192. Keyboard.each = function(keyboard, fn){
  11193. var current = keyboard || Keyboard.manager;
  11194. while (current){
  11195. fn(current);
  11196. current = current._activeKB;
  11197. }
  11198. };
  11199. Keyboard.stop = function(event){
  11200. event.preventKeyboardPropagation = true;
  11201. };
  11202. Keyboard.manager = new Keyboard({
  11203. active: true
  11204. });
  11205. Keyboard.trace = function(keyboard){
  11206. keyboard = keyboard || Keyboard.manager;
  11207. var hasConsole = window.console && console.log;
  11208. if (hasConsole) console.log('the following items have focus: ');
  11209. Keyboard.each(keyboard, function(current){
  11210. if (hasConsole) console.log(document.id(current.widget) || current.wiget || current);
  11211. });
  11212. };
  11213. var handler = function(event){
  11214. var keys = [];
  11215. modifiers.each(function(mod){
  11216. if (event[mod]) keys.push(mod);
  11217. });
  11218. if (!regex.test(event.key)) keys.push(event.key);
  11219. Keyboard.manager._handle(event, event.type + ':keys(' + keys.join('+') + ')');
  11220. };
  11221. document.addEvents({
  11222. 'keyup': handler,
  11223. 'keydown': handler
  11224. });
  11225. })();
  11226. /*
  11227. ---
  11228. script: Keyboard.Extras.js
  11229. name: Keyboard.Extras
  11230. 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.
  11231. license: MIT-style license
  11232. authors:
  11233. - Perrin Westrich
  11234. requires:
  11235. - Keyboard
  11236. - MooTools.More
  11237. provides: [Keyboard.Extras]
  11238. ...
  11239. */
  11240. Keyboard.prototype.options.nonParsedEvents.combine(['rebound', 'onrebound']);
  11241. Keyboard.implement({
  11242. /*
  11243. shortcut should be in the format of:
  11244. {
  11245. 'keys': 'shift+s', // the default to add as an event.
  11246. 'description': 'blah blah blah', // a brief description of the functionality.
  11247. 'handler': function(){} // the event handler to run when keys are pressed.
  11248. }
  11249. */
  11250. addShortcut: function(name, shortcut){
  11251. this._shortcuts = this._shortcuts || [];
  11252. this._shortcutIndex = this._shortcutIndex || {};
  11253. shortcut.getKeyboard = Function.convert(this);
  11254. shortcut.name = name;
  11255. this._shortcutIndex[name] = shortcut;
  11256. this._shortcuts.push(shortcut);
  11257. if (shortcut.keys) this.addEvent(shortcut.keys, shortcut.handler);
  11258. return this;
  11259. },
  11260. addShortcuts: function(obj){
  11261. for (var name in obj) this.addShortcut(name, obj[name]);
  11262. return this;
  11263. },
  11264. removeShortcut: function(name){
  11265. var shortcut = this.getShortcut(name);
  11266. if (shortcut && shortcut.keys){
  11267. this.removeEvent(shortcut.keys, shortcut.handler);
  11268. delete this._shortcutIndex[name];
  11269. this._shortcuts.erase(shortcut);
  11270. }
  11271. return this;
  11272. },
  11273. removeShortcuts: function(names){
  11274. names.each(this.removeShortcut, this);
  11275. return this;
  11276. },
  11277. getShortcuts: function(){
  11278. return this._shortcuts || [];
  11279. },
  11280. getShortcut: function(name){
  11281. return (this._shortcutIndex || {})[name];
  11282. }
  11283. });
  11284. Keyboard.rebind = function(newKeys, shortcuts){
  11285. Array.convert(shortcuts).each(function(shortcut){
  11286. shortcut.getKeyboard().removeEvent(shortcut.keys, shortcut.handler);
  11287. shortcut.getKeyboard().addEvent(newKeys, shortcut.handler);
  11288. shortcut.keys = newKeys;
  11289. shortcut.getKeyboard().fireEvent('rebound');
  11290. });
  11291. };
  11292. Keyboard.getActiveShortcuts = function(keyboard){
  11293. var activeKBS = [], activeSCS = [];
  11294. Keyboard.each(keyboard, [].push.bind(activeKBS));
  11295. activeKBS.each(function(kb){ activeSCS.extend(kb.getShortcuts()); });
  11296. return activeSCS;
  11297. };
  11298. Keyboard.getShortcut = function(name, keyboard, opts){
  11299. opts = opts || {};
  11300. var shortcuts = opts.many ? [] : null,
  11301. set = opts.many ? function(kb){
  11302. var shortcut = kb.getShortcut(name);
  11303. if (shortcut) shortcuts.push(shortcut);
  11304. } : function(kb){
  11305. if (!shortcuts) shortcuts = kb.getShortcut(name);
  11306. };
  11307. Keyboard.each(keyboard, set);
  11308. return shortcuts;
  11309. };
  11310. Keyboard.getShortcuts = function(name, keyboard){
  11311. return Keyboard.getShortcut(name, keyboard, { many: true });
  11312. };
  11313. /*
  11314. ---
  11315. script: HtmlTable.js
  11316. name: HtmlTable
  11317. description: Builds table elements with methods to add rows.
  11318. license: MIT-style license
  11319. authors:
  11320. - Aaron Newton
  11321. requires:
  11322. - Core/Options
  11323. - Core/Events
  11324. - Class.Occlude
  11325. provides: [HtmlTable]
  11326. ...
  11327. */
  11328. (function(){
  11329. var HtmlTable = this.HtmlTable = new Class({
  11330. Implements: [Options, Events, Class.Occlude],
  11331. options: {
  11332. properties: {
  11333. cellpadding: 0,
  11334. cellspacing: 0,
  11335. border: 0
  11336. },
  11337. rows: [],
  11338. headers: [],
  11339. footers: []
  11340. },
  11341. property: 'HtmlTable',
  11342. initialize: function(){
  11343. var params = Array.link(arguments, {options: Type.isObject, table: Type.isElement, id: Type.isString});
  11344. this.setOptions(params.options);
  11345. if (!params.table && params.id) params.table = document.id(params.id);
  11346. this.element = params.table || new Element('table', this.options.properties);
  11347. if (this.occlude()) return this.occluded;
  11348. this.build();
  11349. },
  11350. build: function(){
  11351. this.element.store('HtmlTable', this);
  11352. this.body = document.id(this.element.tBodies[0]) || new Element('tbody').inject(this.element);
  11353. $$(this.body.rows);
  11354. if (this.options.headers.length) this.setHeaders(this.options.headers);
  11355. else this.thead = document.id(this.element.tHead);
  11356. if (this.thead) this.head = this.getHead();
  11357. if (this.options.footers.length) this.setFooters(this.options.footers);
  11358. this.tfoot = document.id(this.element.tFoot);
  11359. if (this.tfoot) this.foot = document.id(this.tfoot.rows[0]);
  11360. this.options.rows.each(function(row){
  11361. this.push(row);
  11362. }, this);
  11363. },
  11364. toElement: function(){
  11365. return this.element;
  11366. },
  11367. empty: function(){
  11368. this.body.empty();
  11369. return this;
  11370. },
  11371. set: function(what, items){
  11372. var target = (what == 'headers') ? 'tHead' : 'tFoot',
  11373. lower = target.toLowerCase();
  11374. this[lower] = (document.id(this.element[target]) || new Element(lower).inject(this.element, 'top')).empty();
  11375. var data = this.push(items, {}, this[lower], what == 'headers' ? 'th' : 'td');
  11376. if (what == 'headers') this.head = this.getHead();
  11377. else this.foot = this.getHead();
  11378. return data;
  11379. },
  11380. getHead: function(){
  11381. var rows = this.thead.rows;
  11382. return rows.length > 1 ? $$(rows) : rows.length ? document.id(rows[0]) : false;
  11383. },
  11384. setHeaders: function(headers){
  11385. this.set('headers', headers);
  11386. return this;
  11387. },
  11388. setFooters: function(footers){
  11389. this.set('footers', footers);
  11390. return this;
  11391. },
  11392. update: function(tr, row, tag){
  11393. var tds = tr.getChildren(tag || 'td'), last = tds.length - 1;
  11394. row.each(function(data, index){
  11395. var td = tds[index] || new Element(tag || 'td').inject(tr),
  11396. content = ((data && Object.prototype.hasOwnProperty.call(data, 'content')) ? data.content : '') || data,
  11397. type = typeOf(content);
  11398. if (data && Object.prototype.hasOwnProperty.call(data, 'properties')) td.set(data.properties);
  11399. if (/(element(s?)|array|collection)/.test(type)) td.empty().adopt(content);
  11400. else td.set('html', content);
  11401. if (index > last) tds.push(td);
  11402. else tds[index] = td;
  11403. });
  11404. return {
  11405. tr: tr,
  11406. tds: tds
  11407. };
  11408. },
  11409. push: function(row, rowProperties, target, tag, where){
  11410. if (typeOf(row) == 'element' && row.get('tag') == 'tr'){
  11411. row.inject(target || this.body, where);
  11412. return {
  11413. tr: row,
  11414. tds: row.getChildren('td')
  11415. };
  11416. }
  11417. return this.update(new Element('tr', rowProperties).inject(target || this.body, where), row, tag);
  11418. },
  11419. pushMany: function(rows, rowProperties, target, tag, where){
  11420. return rows.map(function(row){
  11421. return this.push(row, rowProperties, target, tag, where);
  11422. }, this);
  11423. }
  11424. });
  11425. })();
  11426. ['adopt', 'inject', 'wraps', 'grab', 'replaces', 'dispose'].each(function(method){
  11427. HtmlTable.implement(method, function(){
  11428. this.element[method].apply(this.element, arguments);
  11429. return this;
  11430. });
  11431. });
  11432. /*
  11433. ---
  11434. script: HtmlTable.Select.js
  11435. name: HtmlTable.Select
  11436. description: Builds a stripy, sortable table with methods to add rows. Rows can be selected with the mouse or keyboard navigation.
  11437. license: MIT-style license
  11438. authors:
  11439. - Harald Kirschner
  11440. - Aaron Newton
  11441. requires:
  11442. - Keyboard
  11443. - Keyboard.Extras
  11444. - HtmlTable
  11445. - Class.refactor
  11446. - Element.Delegation.Pseudo
  11447. - Element.Shortcuts
  11448. provides: [HtmlTable.Select]
  11449. ...
  11450. */
  11451. HtmlTable = Class.refactor(HtmlTable, {
  11452. options: {
  11453. /*onRowFocus: function(){},
  11454. onRowUnfocus: function(){},*/
  11455. useKeyboard: true,
  11456. classRowSelected: 'table-tr-selected',
  11457. classRowHovered: 'table-tr-hovered',
  11458. classSelectable: 'table-selectable',
  11459. shiftForMultiSelect: true,
  11460. allowMultiSelect: true,
  11461. selectable: false,
  11462. selectHiddenRows: false
  11463. },
  11464. initialize: function(){
  11465. this.previous.apply(this, arguments);
  11466. if (this.occluded) return this.occluded;
  11467. this.selectedRows = new Elements();
  11468. if (!this.bound) this.bound = {};
  11469. this.bound.mouseleave = this.mouseleave.bind(this);
  11470. this.bound.clickRow = this.clickRow.bind(this);
  11471. this.bound.activateKeyboard = function(){
  11472. if (this.keyboard && this.selectEnabled) this.keyboard.activate();
  11473. }.bind(this);
  11474. if (this.options.selectable) this.enableSelect();
  11475. },
  11476. empty: function(){
  11477. if (this.body.rows.length) this.selectNone();
  11478. return this.previous();
  11479. },
  11480. enableSelect: function(){
  11481. this.selectEnabled = true;
  11482. this.attachSelects();
  11483. this.element.addClass(this.options.classSelectable);
  11484. return this;
  11485. },
  11486. disableSelect: function(){
  11487. this.selectEnabled = false;
  11488. this.attachSelects(false);
  11489. this.element.removeClass(this.options.classSelectable);
  11490. return this;
  11491. },
  11492. push: function(){
  11493. var ret = this.previous.apply(this, arguments);
  11494. this.updateSelects();
  11495. return ret;
  11496. },
  11497. toggleRow: function(row){
  11498. return this[(this.isSelected(row) ? 'de' : '') + 'selectRow'](row);
  11499. },
  11500. selectRow: function(row, _nocheck){
  11501. //private variable _nocheck: boolean whether or not to confirm the row is in the table body
  11502. //added here for optimization when selecting ranges
  11503. if (this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
  11504. if (!this.options.allowMultiSelect) this.selectNone();
  11505. if (!this.isSelected(row)){
  11506. this.selectedRows.push(row);
  11507. row.addClass(this.options.classRowSelected);
  11508. this.fireEvent('rowFocus', [row, this.selectedRows]);
  11509. this.fireEvent('stateChanged');
  11510. }
  11511. this.focused = row;
  11512. document.clearSelection();
  11513. return this;
  11514. },
  11515. isSelected: function(row){
  11516. return this.selectedRows.contains(row);
  11517. },
  11518. getSelected: function(){
  11519. return this.selectedRows;
  11520. },
  11521. serialize: function(){
  11522. var previousSerialization = this.previous.apply(this, arguments) || {};
  11523. if (this.options.selectable){
  11524. previousSerialization.selectedRows = this.selectedRows.map(function(row){
  11525. return Array.indexOf(this.body.rows, row);
  11526. }.bind(this));
  11527. }
  11528. return previousSerialization;
  11529. },
  11530. restore: function(tableState){
  11531. if (this.options.selectable && tableState.selectedRows){
  11532. tableState.selectedRows.each(function(index){
  11533. this.selectRow(this.body.rows[index]);
  11534. }.bind(this));
  11535. }
  11536. this.previous.apply(this, arguments);
  11537. },
  11538. deselectRow: function(row, _nocheck){
  11539. if (!this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
  11540. this.selectedRows = new Elements(Array.convert(this.selectedRows).erase(row));
  11541. row.removeClass(this.options.classRowSelected);
  11542. this.fireEvent('rowUnfocus', [row, this.selectedRows]);
  11543. this.fireEvent('stateChanged');
  11544. return this;
  11545. },
  11546. selectAll: function(selectNone){
  11547. if (!selectNone && !this.options.allowMultiSelect) return;
  11548. this.selectRange(0, this.body.rows.length, selectNone);
  11549. return this;
  11550. },
  11551. selectNone: function(){
  11552. return this.selectAll(true);
  11553. },
  11554. selectRange: function(startRow, endRow, _deselect){
  11555. if (!this.options.allowMultiSelect && !_deselect) return;
  11556. var method = _deselect ? 'deselectRow' : 'selectRow',
  11557. rows = Array.clone(this.body.rows);
  11558. if (typeOf(startRow) == 'element') startRow = rows.indexOf(startRow);
  11559. if (typeOf(endRow) == 'element') endRow = rows.indexOf(endRow);
  11560. endRow = endRow < rows.length - 1 ? endRow : rows.length - 1;
  11561. if (endRow < startRow){
  11562. var tmp = startRow;
  11563. startRow = endRow;
  11564. endRow = tmp;
  11565. }
  11566. for (var i = startRow; i <= endRow; i++){
  11567. if (this.options.selectHiddenRows || rows[i].isDisplayed()) this[method](rows[i], true);
  11568. }
  11569. return this;
  11570. },
  11571. deselectRange: function(startRow, endRow){
  11572. this.selectRange(startRow, endRow, true);
  11573. },
  11574. /*
  11575. Private methods:
  11576. */
  11577. enterRow: function(row){
  11578. if (this.hovered) this.hovered = this.leaveRow(this.hovered);
  11579. this.hovered = row.addClass(this.options.classRowHovered);
  11580. },
  11581. leaveRow: function(row){
  11582. row.removeClass(this.options.classRowHovered);
  11583. },
  11584. updateSelects: function(){
  11585. Array.each(this.body.rows, function(row){
  11586. var binders = row.retrieve('binders');
  11587. if (!binders && !this.selectEnabled) return;
  11588. if (!binders){
  11589. binders = {
  11590. mouseenter: this.enterRow.pass([row], this),
  11591. mouseleave: this.leaveRow.pass([row], this)
  11592. };
  11593. row.store('binders', binders);
  11594. }
  11595. if (this.selectEnabled) row.addEvents(binders);
  11596. else row.removeEvents(binders);
  11597. }, this);
  11598. },
  11599. shiftFocus: function(offset, event){
  11600. if (!this.focused) return this.selectRow(this.body.rows[0], event);
  11601. var to = this.getRowByOffset(offset, this.options.selectHiddenRows);
  11602. if (to === null || this.focused == this.body.rows[to]) return this;
  11603. this.toggleRow(this.body.rows[to], event);
  11604. },
  11605. clickRow: function(event, row){
  11606. var selecting = (event.shift || event.meta || event.control) && this.options.shiftForMultiSelect;
  11607. if (!selecting && !(event.rightClick && this.isSelected(row) && this.options.allowMultiSelect)) this.selectNone();
  11608. if (event.rightClick) this.selectRow(row);
  11609. else this.toggleRow(row);
  11610. if (event.shift){
  11611. this.selectRange(this.rangeStart || this.body.rows[0], row, this.rangeStart ? !this.isSelected(row) : true);
  11612. this.focused = row;
  11613. }
  11614. this.rangeStart = row;
  11615. },
  11616. getRowByOffset: function(offset, includeHiddenRows){
  11617. if (!this.focused) return 0;
  11618. var index = Array.indexOf(this.body.rows, this.focused);
  11619. if ((index == 0 && offset < 0) || (index == this.body.rows.length -1 && offset > 0)) return null;
  11620. if (includeHiddenRows){
  11621. index += offset;
  11622. } else {
  11623. var limit = 0,
  11624. count = 0;
  11625. if (offset > 0){
  11626. while (count < offset && index < this.body.rows.length -1){
  11627. if (this.body.rows[++index].isDisplayed()) count++;
  11628. }
  11629. } else {
  11630. while (count > offset && index > 0){
  11631. if (this.body.rows[--index].isDisplayed()) count--;
  11632. }
  11633. }
  11634. }
  11635. return index;
  11636. },
  11637. attachSelects: function(attach){
  11638. attach = attach != null ? attach : true;
  11639. var method = attach ? 'addEvents' : 'removeEvents';
  11640. this.element[method]({
  11641. mouseleave: this.bound.mouseleave,
  11642. click: this.bound.activateKeyboard
  11643. });
  11644. this.body[method]({
  11645. 'click:relay(tr)': this.bound.clickRow,
  11646. 'contextmenu:relay(tr)': this.bound.clickRow
  11647. });
  11648. if (this.options.useKeyboard || this.keyboard){
  11649. if (!this.keyboard) this.keyboard = new Keyboard();
  11650. if (!this.selectKeysDefined){
  11651. this.selectKeysDefined = true;
  11652. var timer, held;
  11653. var move = function(offset){
  11654. var mover = function(e){
  11655. clearTimeout(timer);
  11656. e.preventDefault();
  11657. var to = this.body.rows[this.getRowByOffset(offset, this.options.selectHiddenRows)];
  11658. if (e.shift && to && this.isSelected(to)){
  11659. this.deselectRow(this.focused);
  11660. this.focused = to;
  11661. } else {
  11662. if (to && (!this.options.allowMultiSelect || !e.shift)){
  11663. this.selectNone();
  11664. }
  11665. this.shiftFocus(offset, e);
  11666. }
  11667. if (held){
  11668. timer = mover.delay(100, this, e);
  11669. } else {
  11670. timer = (function(){
  11671. held = true;
  11672. mover(e);
  11673. }).delay(400);
  11674. }
  11675. }.bind(this);
  11676. return mover;
  11677. }.bind(this);
  11678. var clear = function(){
  11679. clearTimeout(timer);
  11680. held = false;
  11681. };
  11682. this.keyboard.addEvents({
  11683. 'keydown:shift+up': move(-1),
  11684. 'keydown:shift+down': move(1),
  11685. 'keyup:shift+up': clear,
  11686. 'keyup:shift+down': clear,
  11687. 'keyup:up': clear,
  11688. 'keyup:down': clear
  11689. });
  11690. var shiftHint = '';
  11691. if (this.options.allowMultiSelect && this.options.shiftForMultiSelect && this.options.useKeyboard){
  11692. shiftHint = ' (Shift multi-selects).';
  11693. }
  11694. this.keyboard.addShortcuts({
  11695. 'Select Previous Row': {
  11696. keys: 'up',
  11697. shortcut: 'up arrow',
  11698. handler: move(-1),
  11699. description: 'Select the previous row in the table.' + shiftHint
  11700. },
  11701. 'Select Next Row': {
  11702. keys: 'down',
  11703. shortcut: 'down arrow',
  11704. handler: move(1),
  11705. description: 'Select the next row in the table.' + shiftHint
  11706. }
  11707. });
  11708. }
  11709. this.keyboard[attach ? 'activate' : 'deactivate']();
  11710. }
  11711. this.updateSelects();
  11712. },
  11713. mouseleave: function(){
  11714. if (this.hovered) this.leaveRow(this.hovered);
  11715. }
  11716. });
  11717. /*
  11718. ---
  11719. script: HtmlTable.Sort.js
  11720. name: HtmlTable.Sort
  11721. description: Builds a stripy, sortable table with methods to add rows.
  11722. license: MIT-style license
  11723. authors:
  11724. - Harald Kirschner
  11725. - Aaron Newton
  11726. - Jacob Thornton
  11727. requires:
  11728. - Core/Hash
  11729. - HtmlTable
  11730. - Class.refactor
  11731. - Element.Delegation.Pseudo
  11732. - String.Extras
  11733. - Date
  11734. provides: [HtmlTable.Sort]
  11735. ...
  11736. */
  11737. (function(){
  11738. var readOnlyNess = document.createElement('table');
  11739. try {
  11740. readOnlyNess.innerHTML = '<tr><td></td></tr>';
  11741. readOnlyNess = readOnlyNess.childNodes.length === 0;
  11742. } catch (e){
  11743. readOnlyNess = true;
  11744. }
  11745. HtmlTable = Class.refactor(HtmlTable, {
  11746. options: {/*
  11747. onSort: function(){}, */
  11748. sortIndex: 0,
  11749. sortReverse: false,
  11750. parsers: [],
  11751. defaultParser: 'string',
  11752. classSortable: 'table-sortable',
  11753. classHeadSort: 'table-th-sort',
  11754. classHeadSortRev: 'table-th-sort-rev',
  11755. classNoSort: 'table-th-nosort',
  11756. classGroupHead: 'table-tr-group-head',
  11757. classGroup: 'table-tr-group',
  11758. classCellSort: 'table-td-sort',
  11759. classSortSpan: 'table-th-sort-span',
  11760. sortable: false,
  11761. thSelector: 'th'
  11762. },
  11763. initialize: function(){
  11764. this.previous.apply(this, arguments);
  11765. if (this.occluded) return this.occluded;
  11766. this.sorted = {index: null, dir: 1};
  11767. if (!this.bound) this.bound = {};
  11768. this.bound.headClick = this.headClick.bind(this);
  11769. this.sortSpans = new Elements();
  11770. if (this.options.sortable){
  11771. this.enableSort();
  11772. if (this.options.sortIndex != null) this.sort(this.options.sortIndex, this.options.sortReverse);
  11773. }
  11774. },
  11775. attachSorts: function(attach){
  11776. this.detachSorts();
  11777. if (attach !== false) this.element.addEvent('click:relay(' + this.options.thSelector + ')', this.bound.headClick);
  11778. },
  11779. detachSorts: function(){
  11780. this.element.removeEvents('click:relay(' + this.options.thSelector + ')');
  11781. },
  11782. setHeaders: function(){
  11783. this.previous.apply(this, arguments);
  11784. if (this.sortable) this.setParsers();
  11785. },
  11786. setParsers: function(){
  11787. this.parsers = this.detectParsers();
  11788. },
  11789. detectParsers: function(){
  11790. return this.head && this.head.getElements(this.options.thSelector).flatten().map(this.detectParser, this);
  11791. },
  11792. detectParser: function(cell, index){
  11793. if (cell.hasClass(this.options.classNoSort) || cell.retrieve('htmltable-parser')) return cell.retrieve('htmltable-parser');
  11794. var thDiv = new Element('div');
  11795. thDiv.adopt(cell.childNodes).inject(cell);
  11796. var sortSpan = new Element('span', {'class': this.options.classSortSpan}).inject(thDiv, 'top');
  11797. this.sortSpans.push(sortSpan);
  11798. var parser = this.options.parsers[index],
  11799. rows = this.body.rows,
  11800. cancel;
  11801. switch (typeOf(parser)){
  11802. case 'function': parser = {convert: parser}; cancel = true; break;
  11803. case 'string': parser = parser; cancel = true; break;
  11804. }
  11805. if (!cancel){
  11806. HtmlTable.ParserPriority.some(function(parserName){
  11807. var current = HtmlTable.Parsers[parserName],
  11808. match = current.match;
  11809. if (!match) return false;
  11810. for (var i = 0, j = rows.length; i < j; i++){
  11811. var cell = document.id(rows[i].cells[index]),
  11812. text = cell ? cell.get('html').clean() : '';
  11813. if (text && match.test(text)){
  11814. parser = current;
  11815. return true;
  11816. }
  11817. }
  11818. });
  11819. }
  11820. if (!parser) parser = this.options.defaultParser;
  11821. cell.store('htmltable-parser', parser);
  11822. return parser;
  11823. },
  11824. headClick: function(event, el){
  11825. if (!this.head || el.hasClass(this.options.classNoSort)) return;
  11826. return this.sort(Array.indexOf(this.head.getElements(this.options.thSelector).flatten(), el) % this.body.rows[0].cells.length);
  11827. },
  11828. serialize: function(){
  11829. var previousSerialization = this.previous.apply(this, arguments) || {};
  11830. if (this.options.sortable){
  11831. previousSerialization.sortIndex = this.sorted.index;
  11832. previousSerialization.sortReverse = this.sorted.reverse;
  11833. }
  11834. return previousSerialization;
  11835. },
  11836. restore: function(tableState){
  11837. if (this.options.sortable && tableState.sortIndex){
  11838. this.sort(tableState.sortIndex, tableState.sortReverse);
  11839. }
  11840. this.previous.apply(this, arguments);
  11841. },
  11842. setSortedState: function(index, reverse){
  11843. if (reverse != null) this.sorted.reverse = reverse;
  11844. else if (this.sorted.index == index) this.sorted.reverse = !this.sorted.reverse;
  11845. else this.sorted.reverse = this.sorted.index == null;
  11846. if (index != null) this.sorted.index = index;
  11847. },
  11848. setHeadSort: function(sorted){
  11849. var head = $$(!this.head.length ? this.head.cells[this.sorted.index] : this.head.map(function(row){
  11850. return row.getElements(this.options.thSelector)[this.sorted.index];
  11851. }, this).clean());
  11852. if (!head.length) return;
  11853. if (sorted){
  11854. head.addClass(this.options.classHeadSort);
  11855. if (this.sorted.reverse) head.addClass(this.options.classHeadSortRev);
  11856. else head.removeClass(this.options.classHeadSortRev);
  11857. } else {
  11858. head.removeClass(this.options.classHeadSort).removeClass(this.options.classHeadSortRev);
  11859. }
  11860. },
  11861. setRowSort: function(data, pre){
  11862. var count = data.length,
  11863. body = this.body,
  11864. group,
  11865. rowIndex;
  11866. while (count){
  11867. var item = data[--count],
  11868. position = item.position,
  11869. row = body.rows[position];
  11870. if (row.disabled) continue;
  11871. if (!pre){
  11872. group = this.setGroupSort(group, row, item);
  11873. this.setRowStyle(row, count);
  11874. }
  11875. body.appendChild(row);
  11876. for (rowIndex = 0; rowIndex < count; rowIndex++){
  11877. if (data[rowIndex].position > position) data[rowIndex].position--;
  11878. }
  11879. }
  11880. },
  11881. setRowStyle: function(row, i){
  11882. this.previous(row, i);
  11883. row.cells[this.sorted.index].addClass(this.options.classCellSort);
  11884. },
  11885. setGroupSort: function(group, row, item){
  11886. if (group == item.value) row.removeClass(this.options.classGroupHead).addClass(this.options.classGroup);
  11887. else row.removeClass(this.options.classGroup).addClass(this.options.classGroupHead);
  11888. return item.value;
  11889. },
  11890. getParser: function(){
  11891. var parser = this.parsers[this.sorted.index];
  11892. return typeOf(parser) == 'string' ? HtmlTable.Parsers[parser] : parser;
  11893. },
  11894. sort: function(index, reverse, pre, sortFunction){
  11895. if (!this.head) return;
  11896. if (!pre){
  11897. this.clearSort();
  11898. this.setSortedState(index, reverse);
  11899. this.setHeadSort(true);
  11900. }
  11901. var parser = this.getParser();
  11902. if (!parser) return;
  11903. var rel;
  11904. if (!readOnlyNess){
  11905. rel = this.body.getParent();
  11906. this.body.dispose();
  11907. }
  11908. var data = this.parseData(parser).sort(sortFunction ? sortFunction : function(a, b){
  11909. if (a.value === b.value) return 0;
  11910. return a.value > b.value ? 1 : -1;
  11911. });
  11912. var reversed = this.sorted.reverse == (parser == HtmlTable.Parsers['input-checked']);
  11913. if (reversed) data.reverse(true);
  11914. this.setRowSort(data, pre);
  11915. if (rel) rel.grab(this.body);
  11916. this.fireEvent('stateChanged');
  11917. return this.fireEvent('sort', [this.body, this.sorted.index, reversed ? 'asc' : 'desc']);
  11918. },
  11919. parseData: function(parser){
  11920. return Array.map(this.body.rows, function(row, i){
  11921. var value = parser.convert.call(document.id(row.cells[this.sorted.index]));
  11922. return {
  11923. position: i,
  11924. value: value
  11925. };
  11926. }, this);
  11927. },
  11928. clearSort: function(){
  11929. this.setHeadSort(false);
  11930. this.body.getElements('td').removeClass(this.options.classCellSort);
  11931. },
  11932. reSort: function(){
  11933. if (this.sortable) this.sort.call(this, this.sorted.index, this.sorted.reverse);
  11934. return this;
  11935. },
  11936. enableSort: function(){
  11937. this.element.addClass(this.options.classSortable);
  11938. this.attachSorts(true);
  11939. this.setParsers();
  11940. this.sortable = true;
  11941. return this;
  11942. },
  11943. disableSort: function(){
  11944. this.element.removeClass(this.options.classSortable);
  11945. this.attachSorts(false);
  11946. this.sortSpans.each(function(span){
  11947. span.destroy();
  11948. });
  11949. this.sortSpans.empty();
  11950. this.sortable = false;
  11951. return this;
  11952. }
  11953. });
  11954. HtmlTable.ParserPriority = ['date', 'input-checked', 'input-value', 'float', 'number'];
  11955. HtmlTable.Parsers = {
  11956. 'date': {
  11957. match: /^\d{2}[-\/ ]\d{2}[-\/ ]\d{2,4}$/,
  11958. convert: function(){
  11959. var d = Date.parse(this.get('text').stripTags());
  11960. return (typeOf(d) == 'date') ? d.format('db') : '';
  11961. },
  11962. type: 'date'
  11963. },
  11964. 'input-checked': {
  11965. match: / type="(radio|checkbox)"/,
  11966. convert: function(){
  11967. return this.getElement('input').checked;
  11968. }
  11969. },
  11970. 'input-value': {
  11971. match: /<input/,
  11972. convert: function(){
  11973. return this.getElement('input').value;
  11974. }
  11975. },
  11976. 'number': {
  11977. match: /^\d+[^\d.,]*$/,
  11978. convert: function(){
  11979. return this.get('text').stripTags().toInt();
  11980. },
  11981. number: true
  11982. },
  11983. 'numberLax': {
  11984. match: /^[^\d]+\d+$/,
  11985. convert: function(){
  11986. return this.get('text').replace(/[^-?^0-9]/, '').stripTags().toInt();
  11987. },
  11988. number: true
  11989. },
  11990. 'float': {
  11991. match: /^[\d]+\.[\d]+/,
  11992. convert: function(){
  11993. return this.get('text').replace(/[^-?^\d.e]/, '').stripTags().toFloat();
  11994. },
  11995. number: true
  11996. },
  11997. 'floatLax': {
  11998. match: /^[^\d]+[\d]+\.[\d]+$/,
  11999. convert: function(){
  12000. return this.get('text').replace(/[^-?^\d.]/, '').stripTags().toFloat();
  12001. },
  12002. number: true
  12003. },
  12004. 'string': {
  12005. match: null,
  12006. convert: function(){
  12007. return this.get('text').stripTags().toLowerCase();
  12008. }
  12009. },
  12010. 'title': {
  12011. match: null,
  12012. convert: function(){
  12013. return this.title;
  12014. }
  12015. }
  12016. };
  12017. //<1.2compat>
  12018. HtmlTable.Parsers = new Hash(HtmlTable.Parsers);
  12019. //</1.2compat>
  12020. HtmlTable.defineParsers = function(parsers){
  12021. HtmlTable.Parsers = Object.append(HtmlTable.Parsers, parsers);
  12022. for (var parser in parsers){
  12023. HtmlTable.ParserPriority.unshift(parser);
  12024. }
  12025. };
  12026. })();
  12027. /*
  12028. ---
  12029. script: HtmlTable.Zebra.js
  12030. name: HtmlTable.Zebra
  12031. description: Builds a stripy table with methods to add rows.
  12032. license: MIT-style license
  12033. authors:
  12034. - Harald Kirschner
  12035. - Aaron Newton
  12036. requires:
  12037. - HtmlTable
  12038. - Element.Shortcuts
  12039. - Class.refactor
  12040. provides: [HtmlTable.Zebra]
  12041. ...
  12042. */
  12043. HtmlTable = Class.refactor(HtmlTable, {
  12044. options: {
  12045. classZebra: 'table-tr-odd',
  12046. zebra: true,
  12047. zebraOnlyVisibleRows: true
  12048. },
  12049. initialize: function(){
  12050. this.previous.apply(this, arguments);
  12051. if (this.occluded) return this.occluded;
  12052. if (this.options.zebra) this.updateZebras();
  12053. },
  12054. updateZebras: function(){
  12055. var index = 0;
  12056. Array.each(this.body.rows, function(row){
  12057. if (!this.options.zebraOnlyVisibleRows || row.isDisplayed()){
  12058. this.zebra(row, index++);
  12059. }
  12060. }, this);
  12061. },
  12062. setRowStyle: function(row, i){
  12063. if (this.previous) this.previous(row, i);
  12064. this.zebra(row, i);
  12065. },
  12066. zebra: function(row, i){
  12067. return row[((i % 2) ? 'remove' : 'add')+'Class'](this.options.classZebra);
  12068. },
  12069. push: function(){
  12070. var pushed = this.previous.apply(this, arguments);
  12071. if (this.options.zebra) this.updateZebras();
  12072. return pushed;
  12073. }
  12074. });
  12075. /*
  12076. ---
  12077. script: Scroller.js
  12078. name: Scroller
  12079. description: Class which scrolls the contents of any Element (including the window) when the mouse reaches the Element's boundaries.
  12080. license: MIT-style license
  12081. authors:
  12082. - Valerio Proietti
  12083. requires:
  12084. - Core/Events
  12085. - Core/Options
  12086. - Core/Element.Event
  12087. - Core/Element.Dimensions
  12088. - MooTools.More
  12089. provides: [Scroller]
  12090. ...
  12091. */
  12092. (function(){
  12093. var Scroller = this.Scroller = new Class({
  12094. Implements: [Events, Options],
  12095. options: {
  12096. area: 20,
  12097. velocity: 1,
  12098. onChange: function(x, y){
  12099. this.element.scrollTo(x, y);
  12100. },
  12101. fps: 50
  12102. },
  12103. initialize: function(element, options){
  12104. this.setOptions(options);
  12105. this.element = document.id(element);
  12106. this.docBody = document.id(this.element.getDocument().body);
  12107. this.listener = (typeOf(this.element) != 'element') ? this.docBody : this.element;
  12108. this.timer = null;
  12109. this.bound = {
  12110. attach: this.attach.bind(this),
  12111. detach: this.detach.bind(this),
  12112. getCoords: this.getCoords.bind(this)
  12113. };
  12114. },
  12115. start: function(){
  12116. this.listener.addEvents({
  12117. mouseover: this.bound.attach,
  12118. mouseleave: this.bound.detach
  12119. });
  12120. return this;
  12121. },
  12122. stop: function(){
  12123. this.listener.removeEvents({
  12124. mouseover: this.bound.attach,
  12125. mouseleave: this.bound.detach
  12126. });
  12127. this.detach();
  12128. this.timer = clearInterval(this.timer);
  12129. return this;
  12130. },
  12131. attach: function(){
  12132. this.listener.addEvent('mousemove', this.bound.getCoords);
  12133. },
  12134. detach: function(){
  12135. this.listener.removeEvent('mousemove', this.bound.getCoords);
  12136. this.timer = clearInterval(this.timer);
  12137. },
  12138. getCoords: function(event){
  12139. this.page = (this.listener.get('tag') == 'body') ? event.client : event.page;
  12140. if (!this.timer) this.timer = this.scroll.periodical(Math.round(1000 / this.options.fps), this);
  12141. },
  12142. scroll: function(){
  12143. var size = this.element.getSize(),
  12144. scroll = this.element.getScroll(),
  12145. pos = ((this.element != this.docBody) && (this.element != window)) ? this.element.getOffsets() : {x: 0, y: 0},
  12146. scrollSize = this.element.getScrollSize(),
  12147. change = {x: 0, y: 0},
  12148. top = this.options.area.top || this.options.area,
  12149. bottom = this.options.area.bottom || this.options.area;
  12150. for (var z in this.page){
  12151. if (this.page[z] < (top + pos[z]) && scroll[z] != 0){
  12152. change[z] = (this.page[z] - top - pos[z]) * this.options.velocity;
  12153. } else if (this.page[z] + bottom > (size[z] + pos[z]) && scroll[z] + size[z] != scrollSize[z]){
  12154. change[z] = (this.page[z] - size[z] + bottom - pos[z]) * this.options.velocity;
  12155. }
  12156. change[z] = change[z].round();
  12157. }
  12158. if (change.y || change.x) this.fireEvent('change', [scroll.x + change.x, scroll.y + change.y]);
  12159. }
  12160. });
  12161. })();
  12162. /*
  12163. ---
  12164. script: Tips.js
  12165. name: Tips
  12166. description: Class for creating nice tips that follow the mouse cursor when hovering an element.
  12167. license: MIT-style license
  12168. authors:
  12169. - Valerio Proietti
  12170. - Christoph Pojer
  12171. - Luis Merino
  12172. requires:
  12173. - Core/Options
  12174. - Core/Events
  12175. - Core/Element.Event
  12176. - Core/Element.Style
  12177. - Core/Element.Dimensions
  12178. - MooTools.More
  12179. provides: [Tips]
  12180. ...
  12181. */
  12182. (function(){
  12183. var read = function(option, element){
  12184. return (option) ? (typeOf(option) == 'function' ? option(element) : element.get(option)) : '';
  12185. };
  12186. var Tips = this.Tips = new Class({
  12187. Implements: [Events, Options],
  12188. options: {/*
  12189. id: null,
  12190. onAttach: function(element){},
  12191. onDetach: function(element){},
  12192. onBound: function(coords){},*/
  12193. onShow: function(){
  12194. this.tip.setStyle('display', 'block');
  12195. },
  12196. onHide: function(){
  12197. this.tip.setStyle('display', 'none');
  12198. },
  12199. title: 'title',
  12200. text: function(element){
  12201. return element.get('rel') || element.get('href');
  12202. },
  12203. showDelay: 100,
  12204. hideDelay: 100,
  12205. className: 'tip-wrap',
  12206. offset: {x: 16, y: 16},
  12207. windowPadding: {x:0, y:0},
  12208. fixed: false,
  12209. waiAria: true,
  12210. hideEmpty: false
  12211. },
  12212. initialize: function(){
  12213. var params = Array.link(arguments, {
  12214. options: Type.isObject,
  12215. elements: function(obj){
  12216. return obj != null;
  12217. }
  12218. });
  12219. this.setOptions(params.options);
  12220. if (params.elements) this.attach(params.elements);
  12221. this.container = new Element('div', {'class': 'tip'});
  12222. if (this.options.id){
  12223. this.container.set('id', this.options.id);
  12224. if (this.options.waiAria) this.attachWaiAria();
  12225. }
  12226. },
  12227. toElement: function(){
  12228. if (this.tip) return this.tip;
  12229. this.tip = new Element('div', {
  12230. 'class': this.options.className,
  12231. styles: {
  12232. position: 'absolute',
  12233. top: 0,
  12234. left: 0,
  12235. display: 'none'
  12236. }
  12237. }).adopt(
  12238. new Element('div', {'class': 'tip-top'}),
  12239. this.container,
  12240. new Element('div', {'class': 'tip-bottom'})
  12241. );
  12242. return this.tip;
  12243. },
  12244. attachWaiAria: function(){
  12245. var id = this.options.id;
  12246. this.container.set('role', 'tooltip');
  12247. if (!this.waiAria){
  12248. this.waiAria = {
  12249. show: function(element){
  12250. if (id) element.set('aria-describedby', id);
  12251. this.container.set('aria-hidden', 'false');
  12252. },
  12253. hide: function(element){
  12254. if (id) element.erase('aria-describedby');
  12255. this.container.set('aria-hidden', 'true');
  12256. }
  12257. };
  12258. }
  12259. this.addEvents(this.waiAria);
  12260. },
  12261. detachWaiAria: function(){
  12262. if (this.waiAria){
  12263. this.container.erase('role');
  12264. this.container.erase('aria-hidden');
  12265. this.removeEvents(this.waiAria);
  12266. }
  12267. },
  12268. attach: function(elements){
  12269. $$(elements).each(function(element){
  12270. var title = read(this.options.title, element),
  12271. text = read(this.options.text, element);
  12272. element.set('title', '').store('tip:native', title).retrieve('tip:title', title);
  12273. element.retrieve('tip:text', text);
  12274. this.fireEvent('attach', [element]);
  12275. var events = ['enter', 'leave'];
  12276. if (!this.options.fixed) events.push('move');
  12277. events.each(function(value){
  12278. var event = element.retrieve('tip:' + value);
  12279. if (!event) event = function(event){
  12280. this['element' + value.capitalize()].apply(this, [event, element]);
  12281. }.bind(this);
  12282. element.store('tip:' + value, event).addEvent('mouse' + value, event);
  12283. }, this);
  12284. }, this);
  12285. return this;
  12286. },
  12287. detach: function(elements){
  12288. $$(elements).each(function(element){
  12289. ['enter', 'leave', 'move'].each(function(value){
  12290. element.removeEvent('mouse' + value, element.retrieve('tip:' + value)).eliminate('tip:' + value);
  12291. });
  12292. this.fireEvent('detach', [element]);
  12293. if (this.options.title == 'title'){ // This is necessary to check if we can revert the title
  12294. var original = element.retrieve('tip:native');
  12295. if (original) element.set('title', original);
  12296. }
  12297. }, this);
  12298. return this;
  12299. },
  12300. elementEnter: function(event, element){
  12301. clearTimeout(this.timer);
  12302. this.timer = (function(){
  12303. this.container.empty();
  12304. var showTip = !this.options.hideEmpty;
  12305. ['title', 'text'].each(function(value){
  12306. var content = element.retrieve('tip:' + value);
  12307. var div = this['_' + value + 'Element'] = new Element('div', {
  12308. 'class': 'tip-' + value
  12309. }).inject(this.container);
  12310. if (content){
  12311. this.fill(div, content);
  12312. showTip = true;
  12313. }
  12314. }, this);
  12315. if (showTip){
  12316. this.show(element);
  12317. } else {
  12318. this.hide(element);
  12319. }
  12320. this.position((this.options.fixed) ? {page: element.getPosition()} : event);
  12321. }).delay(this.options.showDelay, this);
  12322. },
  12323. elementLeave: function(event, element){
  12324. clearTimeout(this.timer);
  12325. this.timer = this.hide.delay(this.options.hideDelay, this, element);
  12326. this.fireForParent(event, element);
  12327. },
  12328. setTitle: function(title){
  12329. if (this._titleElement){
  12330. this._titleElement.empty();
  12331. this.fill(this._titleElement, title);
  12332. }
  12333. return this;
  12334. },
  12335. setText: function(text){
  12336. if (this._textElement){
  12337. this._textElement.empty();
  12338. this.fill(this._textElement, text);
  12339. }
  12340. return this;
  12341. },
  12342. fireForParent: function(event, element){
  12343. element = element.getParent();
  12344. if (!element || element == document.body) return;
  12345. if (element.retrieve('tip:enter')) element.fireEvent('mouseenter', event);
  12346. else this.fireForParent(event, element);
  12347. },
  12348. elementMove: function(event, element){
  12349. this.position(event);
  12350. },
  12351. position: function(event){
  12352. if (!this.tip) document.id(this);
  12353. var size = window.getSize(), scroll = window.getScroll(),
  12354. tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight},
  12355. props = {x: 'left', y: 'top'},
  12356. bounds = {y: false, x2: false, y2: false, x: false},
  12357. obj = {};
  12358. for (var z in props){
  12359. obj[props[z]] = event.page[z] + this.options.offset[z];
  12360. if (obj[props[z]] < 0) bounds[z] = true;
  12361. if ((obj[props[z]] + tip[z] - scroll[z]) > size[z] - this.options.windowPadding[z]){
  12362. obj[props[z]] = event.page[z] - this.options.offset[z] - tip[z];
  12363. bounds[z+'2'] = true;
  12364. }
  12365. }
  12366. this.fireEvent('bound', bounds);
  12367. this.tip.setStyles(obj);
  12368. },
  12369. fill: function(element, contents){
  12370. if (typeof contents == 'string') element.set('html', contents);
  12371. else element.adopt(contents);
  12372. },
  12373. show: function(element){
  12374. if (!this.tip) document.id(this);
  12375. if (!this.tip.getParent()) this.tip.inject(document.body);
  12376. this.fireEvent('show', [this.tip, element]);
  12377. },
  12378. hide: function(element){
  12379. if (!this.tip) document.id(this);
  12380. this.fireEvent('hide', [this.tip, element]);
  12381. }
  12382. });
  12383. })();
  12384. /*
  12385. ---
  12386. name: Locale.CH.Number
  12387. description: Number messages for Switzerland.
  12388. license: MIT-style license
  12389. authors:
  12390. - Kim D. Jeker
  12391. requires:
  12392. - Locale
  12393. provides: [Locale.CH.Number]
  12394. ...
  12395. */
  12396. Locale.define('CH', 'Number', {
  12397. decimal: ',',
  12398. group: '\'',
  12399. currency: {
  12400. decimal: '.',
  12401. suffix: ' CHF'
  12402. }
  12403. });
  12404. /*
  12405. ---
  12406. name: Locale.EU.Number
  12407. description: Number messages for Europe.
  12408. license: MIT-style license
  12409. authors:
  12410. - Arian Stolwijk
  12411. requires:
  12412. - Locale
  12413. provides: [Locale.EU.Number]
  12414. ...
  12415. */
  12416. Locale.define('EU', 'Number', {
  12417. decimal: ',',
  12418. group: '.',
  12419. currency: {
  12420. prefix: '€ '
  12421. }
  12422. });
  12423. /*
  12424. ---
  12425. script: Locale.Set.From.js
  12426. name: Locale.Set.From
  12427. description: Provides an alternative way to create Locale.Set objects.
  12428. license: MIT-style license
  12429. authors:
  12430. - Tim Wienk
  12431. requires:
  12432. - Core/JSON
  12433. - Locale
  12434. provides: Locale.Set.From
  12435. ...
  12436. */
  12437. (function(){
  12438. var parsers = {
  12439. 'json': JSON.decode
  12440. };
  12441. Locale.Set.defineParser = function(name, fn){
  12442. parsers[name] = fn;
  12443. };
  12444. Locale.Set.from = function(set, type){
  12445. if (instanceOf(set, Locale.Set)) return set;
  12446. if (!type && typeOf(set) == 'string') type = 'json';
  12447. if (parsers[type]) set = parsers[type](set);
  12448. var locale = new Locale.Set;
  12449. locale.sets = set.sets || {};
  12450. if (set.inherits){
  12451. locale.inherits.locales = Array.convert(set.inherits.locales);
  12452. locale.inherits.sets = set.inherits.sets || {};
  12453. }
  12454. return locale;
  12455. };
  12456. })();
  12457. /*
  12458. ---
  12459. name: Locale.ZA.Number
  12460. description: Number messages for ZA.
  12461. license: MIT-style license
  12462. authors:
  12463. - Werner Mollentze
  12464. requires:
  12465. - Locale
  12466. provides: [Locale.ZA.Number]
  12467. ...
  12468. */
  12469. Locale.define('ZA', 'Number', {
  12470. decimal: '.',
  12471. group: ',',
  12472. currency: {
  12473. prefix: 'R '
  12474. }
  12475. });
  12476. /*
  12477. ---
  12478. name: Locale.af-ZA.Date
  12479. description: Date messages for ZA Afrikaans.
  12480. license: MIT-style license
  12481. authors:
  12482. - Werner Mollentze
  12483. requires:
  12484. - Locale
  12485. provides: [Locale.af-ZA.Date]
  12486. ...
  12487. */
  12488. Locale.define('af-ZA', 'Date', {
  12489. months: ['Januarie', 'Februarie', 'Maart', 'April', 'Mei', 'Junie', 'Julie', 'Augustus', 'September', 'Oktober', 'November', 'Desember'],
  12490. months_abbr: ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
  12491. days: ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'],
  12492. days_abbr: ['Son', 'Maa', 'Din', 'Woe', 'Don', 'Vry', 'Sat'],
  12493. // Culture's date order: MM/DD/YYYY
  12494. dateOrder: ['date', 'month', 'year'],
  12495. shortDate: '%d-%m-%Y',
  12496. shortTime: '%H:%M',
  12497. AM: 'VM',
  12498. PM: 'NM',
  12499. firstDayOfWeek: 1,
  12500. // Date.Extras
  12501. ordinal: function(dayOfMonth){
  12502. return ((dayOfMonth > 1 && dayOfMonth < 20 && dayOfMonth != 8) || (dayOfMonth > 100 && dayOfMonth.toString().substr(-2, 1) == '1')) ? 'de' : 'ste';
  12503. },
  12504. lessThanMinuteAgo: 'minder as \'n minuut gelede',
  12505. minuteAgo: 'ongeveer \'n minuut gelede',
  12506. minutesAgo: '{delta} minute gelede',
  12507. hourAgo: 'omtret \'n uur gelede',
  12508. hoursAgo: 'ongeveer {delta} ure gelede',
  12509. dayAgo: '1 dag gelede',
  12510. daysAgo: '{delta} dae gelede',
  12511. weekAgo: '1 week gelede',
  12512. weeksAgo: '{delta} weke gelede',
  12513. monthAgo: '1 maand gelede',
  12514. monthsAgo: '{delta} maande gelede',
  12515. yearAgo: '1 jaar gelede',
  12516. yearsAgo: '{delta} jare gelede',
  12517. lessThanMinuteUntil: 'oor minder as \'n minuut',
  12518. minuteUntil: 'oor ongeveer \'n minuut',
  12519. minutesUntil: 'oor {delta} minute',
  12520. hourUntil: 'oor ongeveer \'n uur',
  12521. hoursUntil: 'oor {delta} uur',
  12522. dayUntil: 'oor ongeveer \'n dag',
  12523. daysUntil: 'oor {delta} dae',
  12524. weekUntil: 'oor \'n week',
  12525. weeksUntil: 'oor {delta} weke',
  12526. monthUntil: 'oor \'n maand',
  12527. monthsUntil: 'oor {delta} maande',
  12528. yearUntil: 'oor \'n jaar',
  12529. yearsUntil: 'oor {delta} jaar'
  12530. });
  12531. /*
  12532. ---
  12533. name: Locale.af-ZA.Form.Validator
  12534. description: Form Validator messages for Afrikaans.
  12535. license: MIT-style license
  12536. authors:
  12537. - Werner Mollentze
  12538. requires:
  12539. - Locale
  12540. provides: [Locale.af-ZA.Form.Validator]
  12541. ...
  12542. */
  12543. Locale.define('af-ZA', 'FormValidator', {
  12544. required: 'Hierdie veld word vereis.',
  12545. length: 'Voer asseblief {length} karakters in (u het {elLength} karakters ingevoer)',
  12546. minLength: 'Voer asseblief ten minste {minLength} karakters in (u het {length} karakters ingevoer).',
  12547. maxLength: 'Moet asseblief nie meer as {maxLength} karakters invoer nie (u het {length} karakters ingevoer).',
  12548. integer: 'Voer asseblief \'n heelgetal in hierdie veld in. Getalle met desimale (bv. 1.25) word nie toegelaat nie.',
  12549. numeric: 'Voer asseblief slegs numeriese waardes in hierdie veld in (bv. "1" of "1.1" of "-1" of "-1.1").',
  12550. digits: 'Gebruik asseblief slegs nommers en punktuasie in hierdie veld. (by voorbeeld, \'n telefoon nommer wat koppeltekens en punte bevat is toelaatbaar).',
  12551. alpha: 'Gebruik asseblief slegs letters (a-z) binne-in hierdie veld. Geen spasies of ander karakters word toegelaat nie.',
  12552. alphanum: 'Gebruik asseblief slegs letters (a-z) en nommers (0-9) binne-in hierdie veld. Geen spasies of ander karakters word toegelaat nie.',
  12553. dateSuchAs: 'Voer asseblief \'n geldige datum soos {date} in',
  12554. dateInFormatMDY: 'Voer asseblief \'n geldige datum soos MM/DD/YYYY in (bv. "12/31/1999")',
  12555. email: 'Voer asseblief \'n geldige e-pos adres in. Byvoorbeeld "fred@domain.com".',
  12556. url: 'Voer asseblief \'n geldige bronadres (URL) soos http://www.example.com in.',
  12557. currencyDollar: 'Voer asseblief \'n geldige $ bedrag in. Byvoorbeeld $100.00 .',
  12558. oneRequired: 'Voer asseblief iets in vir ten minste een van hierdie velde.',
  12559. errorPrefix: 'Fout: ',
  12560. warningPrefix: 'Waarskuwing: ',
  12561. // Form.Validator.Extras
  12562. noSpace: 'Daar mag geen spasies in hierdie toevoer wees nie.',
  12563. reqChkByNode: 'Geen items is gekies nie.',
  12564. requiredChk: 'Hierdie veld word vereis.',
  12565. reqChkByName: 'Kies asseblief \'n {label}.',
  12566. match: 'Hierdie veld moet by die {matchName} veld pas',
  12567. startDate: 'die begin datum',
  12568. endDate: 'die eind datum',
  12569. currentDate: 'die huidige datum',
  12570. afterDate: 'Die datum moet dieselfde of na {label} wees.',
  12571. beforeDate: 'Die datum moet dieselfde of voor {label} wees.',
  12572. startMonth: 'Kies asseblief \'n begin maand',
  12573. sameMonth: 'Hierdie twee datums moet in dieselfde maand wees - u moet een of beide verander.',
  12574. creditcard: 'Die ingevoerde kredietkaart nommer is ongeldig. Bevestig asseblief die nommer en probeer weer. {length} syfers is ingevoer.'
  12575. });
  12576. /*
  12577. ---
  12578. name: Locale.af-ZA.Number
  12579. description: Number messages for ZA Afrikaans.
  12580. license: MIT-style license
  12581. authors:
  12582. - Werner Mollentze
  12583. requires:
  12584. - Locale
  12585. - Locale.ZA.Number
  12586. provides: [Locale.af-ZA.Number]
  12587. ...
  12588. */
  12589. Locale.define('af-ZA').inherit('ZA', 'Number');
  12590. /*
  12591. ---
  12592. name: Locale.ar.Date
  12593. description: Date messages for Arabic.
  12594. license: MIT-style license
  12595. authors:
  12596. - Chafik Barbar
  12597. requires:
  12598. - Locale
  12599. provides: [Locale.ar.Date]
  12600. ...
  12601. */
  12602. Locale.define('ar', 'Date', {
  12603. // Culture's date order: DD/MM/YYYY
  12604. dateOrder: ['date', 'month', 'year'],
  12605. shortDate: '%d/%m/%Y',
  12606. shortTime: '%H:%M'
  12607. });
  12608. /*
  12609. ---
  12610. name: Locale.ar.Form.Validator
  12611. description: Form Validator messages for Arabic.
  12612. license: MIT-style license
  12613. authors:
  12614. - Chafik Barbar
  12615. requires:
  12616. - Locale
  12617. provides: [Locale.ar.Form.Validator]
  12618. ...
  12619. */
  12620. Locale.define('ar', 'FormValidator', {
  12621. required: 'هذا الحقل مطلوب.',
  12622. minLength: 'رجاءً إدخال {minLength} أحرف على الأقل (تم إدخال {length} أحرف).',
  12623. maxLength: 'الرجاء عدم إدخال أكثر من {maxLength} أحرف (تم إدخال {length} أحرف).',
  12624. integer: 'الرجاء إدخال عدد صحيح في هذا الحقل. أي رقم ذو كسر عشري أو مئوي (مثال 1.25 ) غير مسموح.',
  12625. numeric: 'الرجاء إدخال قيم رقمية في هذا الحقل (مثال "1" أو "1.1" أو "-1" أو "-1.1").',
  12626. digits: 'الرجاء أستخدام قيم رقمية وعلامات ترقيمية فقط في هذا الحقل (مثال, رقم هاتف مع نقطة أو شحطة)',
  12627. alpha: 'الرجاء أستخدام أحرف فقط (ا-ي) في هذا الحقل. أي فراغات أو علامات غير مسموحة.',
  12628. alphanum: 'الرجاء أستخدام أحرف فقط (ا-ي) أو أرقام (0-9) فقط في هذا الحقل. أي فراغات أو علامات غير مسموحة.',
  12629. dateSuchAs: 'الرجاء إدخال تاريخ صحيح كالتالي {date}',
  12630. dateInFormatMDY: 'الرجاء إدخال تاريخ صحيح (مثال, 31-12-1999)',
  12631. email: 'الرجاء إدخال بريد إلكتروني صحيح.',
  12632. url: 'الرجاء إدخال عنوان إلكتروني صحيح مثل http://www.example.com',
  12633. currencyDollar: 'الرجاء إدخال قيمة $ صحيحة. مثال, 100.00$',
  12634. oneRequired: 'الرجاء إدخال قيمة في أحد هذه الحقول على الأقل.',
  12635. errorPrefix: 'خطأ: ',
  12636. warningPrefix: 'تحذير: '
  12637. });
  12638. /*
  12639. ---
  12640. name: Locale.ca-CA.Date
  12641. description: Date messages for Catalan.
  12642. license: MIT-style license
  12643. authors:
  12644. - Ãlfons Sanchez
  12645. requires:
  12646. - Locale
  12647. provides: [Locale.ca-CA.Date]
  12648. ...
  12649. */
  12650. Locale.define('ca-CA', 'Date', {
  12651. months: ['Gener', 'Febrer', 'Març', 'Abril', 'Maig', 'Juny', 'Juli', 'Agost', 'Setembre', 'Octubre', 'Novembre', 'Desembre'],
  12652. months_abbr: ['gen.', 'febr.', 'març', 'abr.', 'maig', 'juny', 'jul.', 'ag.', 'set.', 'oct.', 'nov.', 'des.'],
  12653. days: ['Diumenge', 'Dilluns', 'Dimarts', 'Dimecres', 'Dijous', 'Divendres', 'Dissabte'],
  12654. days_abbr: ['dg', 'dl', 'dt', 'dc', 'dj', 'dv', 'ds'],
  12655. // Culture's date order: DD/MM/YYYY
  12656. dateOrder: ['date', 'month', 'year'],
  12657. shortDate: '%d/%m/%Y',
  12658. shortTime: '%H:%M',
  12659. AM: 'AM',
  12660. PM: 'PM',
  12661. firstDayOfWeek: 0,
  12662. // Date.Extras
  12663. ordinal: '',
  12664. lessThanMinuteAgo: 'fa menys d`un minut',
  12665. minuteAgo: 'fa un minut',
  12666. minutesAgo: 'fa {delta} minuts',
  12667. hourAgo: 'fa un hora',
  12668. hoursAgo: 'fa unes {delta} hores',
  12669. dayAgo: 'fa un dia',
  12670. daysAgo: 'fa {delta} dies',
  12671. lessThanMinuteUntil: 'menys d`un minut des d`ara',
  12672. minuteUntil: 'un minut des d`ara',
  12673. minutesUntil: '{delta} minuts des d`ara',
  12674. hourUntil: 'un hora des d`ara',
  12675. hoursUntil: 'unes {delta} hores des d`ara',
  12676. dayUntil: '1 dia des d`ara',
  12677. daysUntil: '{delta} dies des d`ara'
  12678. });
  12679. /*
  12680. ---
  12681. name: Locale.ca-CA.Form.Validator
  12682. description: Form Validator messages for Catalan.
  12683. license: MIT-style license
  12684. authors:
  12685. - Miquel Hudin
  12686. - Ãlfons Sanchez
  12687. requires:
  12688. - Locale
  12689. provides: [Locale.ca-CA.Form.Validator]
  12690. ...
  12691. */
  12692. Locale.define('ca-CA', 'FormValidator', {
  12693. required: 'Aquest camp es obligatori.',
  12694. minLength: 'Per favor introdueix al menys {minLength} caracters (has introduit {length} caracters).',
  12695. maxLength: 'Per favor introdueix no mes de {maxLength} caracters (has introduit {length} caracters).',
  12696. integer: 'Per favor introdueix un nombre enter en aquest camp. Nombres amb decimals (p.e. 1,25) no estan permesos.',
  12697. numeric: 'Per favor introdueix sols valors numerics en aquest camp (p.e. "1" o "1,1" o "-1" o "-1,1").',
  12698. digits: 'Per favor usa sols numeros i puntuacio en aquest camp (per exemple, un nombre de telefon amb guions i punts no esta permes).',
  12699. alpha: 'Per favor utilitza lletres nomes (a-z) en aquest camp. No s´admiteixen espais ni altres caracters.',
  12700. alphanum: 'Per favor, utilitza nomes lletres (a-z) o numeros (0-9) en aquest camp. No s´admiteixen espais ni altres caracters.',
  12701. dateSuchAs: 'Per favor introdueix una data valida com {date}',
  12702. dateInFormatMDY: 'Per favor introdueix una data valida com DD/MM/YYYY (p.e. "31/12/1999")',
  12703. email: 'Per favor, introdueix una adreça de correu electronic valida. Per exemple, "fred@domain.com".',
  12704. url: 'Per favor introdueix una URL valida com http://www.example.com.',
  12705. currencyDollar: 'Per favor introdueix una quantitat valida de €. Per exemple €100,00 .',
  12706. oneRequired: 'Per favor introdueix alguna cosa per al menys una d´aquestes entrades.',
  12707. errorPrefix: 'Error: ',
  12708. warningPrefix: 'Avis: ',
  12709. // Form.Validator.Extras
  12710. noSpace: 'No poden haver espais en aquesta entrada.',
  12711. reqChkByNode: 'No hi han elements seleccionats.',
  12712. requiredChk: 'Aquest camp es obligatori.',
  12713. reqChkByName: 'Per favor selecciona una {label}.',
  12714. match: 'Aquest camp necessita coincidir amb el camp {matchName}',
  12715. startDate: 'la data de inici',
  12716. endDate: 'la data de fi',
  12717. currentDate: 'la data actual',
  12718. afterDate: 'La data deu ser igual o posterior a {label}.',
  12719. beforeDate: 'La data deu ser igual o anterior a {label}.',
  12720. startMonth: 'Per favor selecciona un mes d´orige',
  12721. sameMonth: 'Aquestes dos dates deuen estar dins del mateix mes - deus canviar una o altra.'
  12722. });
  12723. /*
  12724. ---
  12725. name: Locale.cs-CZ.Date
  12726. description: Date messages for Czech.
  12727. license: MIT-style license
  12728. authors:
  12729. - Jan Černý chemiX
  12730. - Christopher Zukowski
  12731. requires:
  12732. - Locale
  12733. provides: [Locale.cs-CZ.Date]
  12734. ...
  12735. */
  12736. (function(){
  12737. // Czech language pluralization rules, see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  12738. // one -> n is 1; 1
  12739. // few -> n in 2..4; 2-4
  12740. // other -> everything else 0, 5-999, 1.31, 2.31, 5.31...
  12741. var pluralize = function(n, one, few, other){
  12742. if (n == 1) return one;
  12743. else if (n == 2 || n == 3 || n == 4) return few;
  12744. else return other;
  12745. };
  12746. Locale.define('cs-CZ', 'Date', {
  12747. months: ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'],
  12748. months_abbr: ['ledna', 'února', 'března', 'dubna', 'května', 'června', 'července', 'srpna', 'září', 'října', 'listopadu', 'prosince'],
  12749. days: ['Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'],
  12750. days_abbr: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
  12751. // Culture's date order: DD.MM.YYYY
  12752. dateOrder: ['date', 'month', 'year'],
  12753. shortDate: '%d.%m.%Y',
  12754. shortTime: '%H:%M',
  12755. AM: 'dop.',
  12756. PM: 'odp.',
  12757. firstDayOfWeek: 1,
  12758. // Date.Extras
  12759. ordinal: '.',
  12760. lessThanMinuteAgo: 'před chvílí',
  12761. minuteAgo: 'přibližně před minutou',
  12762. minutesAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'minutou', 'minutami', 'minutami'); },
  12763. hourAgo: 'přibližně před hodinou',
  12764. hoursAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'hodinou', 'hodinami', 'hodinami'); },
  12765. dayAgo: 'před dnem',
  12766. daysAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'dnem', 'dny', 'dny'); },
  12767. weekAgo: 'před týdnem',
  12768. weeksAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'týdnem', 'týdny', 'týdny'); },
  12769. monthAgo: 'před měsícem',
  12770. monthsAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'měsícem', 'měsíci', 'měsíci'); },
  12771. yearAgo: 'před rokem',
  12772. yearsAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'rokem', 'lety', 'lety'); },
  12773. lessThanMinuteUntil: 'za chvíli',
  12774. minuteUntil: 'přibližně za minutu',
  12775. minutesUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'minutu', 'minuty', 'minut'); },
  12776. hourUntil: 'přibližně za hodinu',
  12777. hoursUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'hodinu', 'hodiny', 'hodin'); },
  12778. dayUntil: 'za den',
  12779. daysUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'den', 'dny', 'dnů'); },
  12780. weekUntil: 'za týden',
  12781. weeksUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'týden', 'týdny', 'týdnů'); },
  12782. monthUntil: 'za měsíc',
  12783. monthsUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'měsíc', 'měsíce', 'měsíců'); },
  12784. yearUntil: 'za rok',
  12785. yearsUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'rok', 'roky', 'let'); }
  12786. });
  12787. })();
  12788. /*
  12789. ---
  12790. name: Locale.cs-CZ.Form.Validator
  12791. description: Form Validator messages for Czech.
  12792. license: MIT-style license
  12793. authors:
  12794. - Jan Černý chemiX
  12795. requires:
  12796. - Locale
  12797. provides: [Locale.cs-CZ.Form.Validator]
  12798. ...
  12799. */
  12800. Locale.define('cs-CZ', 'FormValidator', {
  12801. required: 'Tato položka je povinná.',
  12802. minLength: 'Zadejte prosím alespoň {minLength} znaků (napsáno {length} znaků).',
  12803. maxLength: 'Zadejte prosím méně než {maxLength} znaků (nápsáno {length} znaků).',
  12804. integer: 'Zadejte prosím celé číslo. Desetinná čísla (např. 1.25) nejsou povolena.',
  12805. numeric: 'Zadejte jen číselné hodnoty (tj. "1" nebo "1.1" nebo "-1" nebo "-1.1").',
  12806. digits: 'Zadejte prosím pouze čísla a interpunkční znaménka(například telefonní číslo s pomlčkami nebo tečkami je povoleno).',
  12807. alpha: 'Zadejte prosím pouze písmena (a-z). Mezery nebo jiné znaky nejsou povoleny.',
  12808. alphanum: 'Zadejte prosím pouze písmena (a-z) nebo číslice (0-9). Mezery nebo jiné znaky nejsou povoleny.',
  12809. dateSuchAs: 'Zadejte prosím platné datum jako {date}',
  12810. dateInFormatMDY: 'Zadejte prosím platné datum jako MM / DD / RRRR (tj. "12/31/1999")',
  12811. email: 'Zadejte prosím platnou e-mailovou adresu. Například "fred@domain.com".',
  12812. url: 'Zadejte prosím platnou URL adresu jako http://www.example.com.',
  12813. currencyDollar: 'Zadejte prosím platnou částku. Například $100.00.',
  12814. oneRequired: 'Zadejte prosím alespoň jednu hodnotu pro tyto položky.',
  12815. errorPrefix: 'Chyba: ',
  12816. warningPrefix: 'Upozornění: ',
  12817. // Form.Validator.Extras
  12818. noSpace: 'V této položce nejsou povoleny mezery',
  12819. reqChkByNode: 'Nejsou vybrány žádné položky.',
  12820. requiredChk: 'Tato položka je vyžadována.',
  12821. reqChkByName: 'Prosím vyberte {label}.',
  12822. match: 'Tato položka se musí shodovat s položkou {matchName}',
  12823. startDate: 'datum zahájení',
  12824. endDate: 'datum ukončení',
  12825. currentDate: 'aktuální datum',
  12826. afterDate: 'Datum by mělo být stejné nebo větší než {label}.',
  12827. beforeDate: 'Datum by mělo být stejné nebo menší než {label}.',
  12828. startMonth: 'Vyberte počáteční měsíc.',
  12829. sameMonth: 'Tyto dva datumy musí být ve stejném měsíci - změňte jeden z nich.',
  12830. creditcard: 'Zadané číslo kreditní karty je neplatné. Prosím opravte ho. Bylo zadáno {length} čísel.'
  12831. });
  12832. /*
  12833. ---
  12834. name: Locale.da-DK.Date
  12835. description: Date messages for Danish.
  12836. license: MIT-style license
  12837. authors:
  12838. - Martin Overgaard
  12839. - Henrik Hansen
  12840. requires:
  12841. - Locale
  12842. provides: [Locale.da-DK.Date]
  12843. ...
  12844. */
  12845. Locale.define('da-DK', 'Date', {
  12846. months: ['Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December'],
  12847. months_abbr: ['jan.', 'feb.', 'mar.', 'apr.', 'maj.', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
  12848. days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
  12849. days_abbr: ['søn', 'man', 'tir', 'ons', 'tor', 'fre', 'lør'],
  12850. // Culture's date order: DD-MM-YYYY
  12851. dateOrder: ['date', 'month', 'year'],
  12852. shortDate: '%d-%m-%Y',
  12853. shortTime: '%H:%M',
  12854. AM: 'AM',
  12855. PM: 'PM',
  12856. firstDayOfWeek: 1,
  12857. // Date.Extras
  12858. ordinal: '.',
  12859. lessThanMinuteAgo: 'mindre end et minut siden',
  12860. minuteAgo: 'omkring et minut siden',
  12861. minutesAgo: '{delta} minutter siden',
  12862. hourAgo: 'omkring en time siden',
  12863. hoursAgo: 'omkring {delta} timer siden',
  12864. dayAgo: '1 dag siden',
  12865. daysAgo: '{delta} dage siden',
  12866. weekAgo: '1 uge siden',
  12867. weeksAgo: '{delta} uger siden',
  12868. monthAgo: '1 måned siden',
  12869. monthsAgo: '{delta} måneder siden',
  12870. yearAgo: '1 år siden',
  12871. yearsAgo: '{delta} år siden',
  12872. lessThanMinuteUntil: 'mindre end et minut fra nu',
  12873. minuteUntil: 'omkring et minut fra nu',
  12874. minutesUntil: '{delta} minutter fra nu',
  12875. hourUntil: 'omkring en time fra nu',
  12876. hoursUntil: 'omkring {delta} timer fra nu',
  12877. dayUntil: '1 dag fra nu',
  12878. daysUntil: '{delta} dage fra nu',
  12879. weekUntil: '1 uge fra nu',
  12880. weeksUntil: '{delta} uger fra nu',
  12881. monthUntil: '1 måned fra nu',
  12882. monthsUntil: '{delta} måneder fra nu',
  12883. yearUntil: '1 år fra nu',
  12884. yearsUntil: '{delta} år fra nu'
  12885. });
  12886. /*
  12887. ---
  12888. name: Locale.da-DK.Form.Validator
  12889. description: Form Validator messages for Danish.
  12890. license: MIT-style license
  12891. authors:
  12892. - Martin Overgaard
  12893. requires:
  12894. - Locale
  12895. provides: [Locale.da-DK.Form.Validator]
  12896. ...
  12897. */
  12898. Locale.define('da-DK', 'FormValidator', {
  12899. required: 'Feltet skal udfyldes.',
  12900. minLength: 'Skriv mindst {minLength} tegn (du skrev {length} tegn).',
  12901. maxLength: 'Skriv maksimalt {maxLength} tegn (du skrev {length} tegn).',
  12902. integer: 'Skriv et tal i dette felt. Decimal tal (f.eks. 1.25) er ikke tilladt.',
  12903. numeric: 'Skriv kun tal i dette felt (i.e. "1" eller "1.1" eller "-1" eller "-1.1").',
  12904. digits: 'Skriv kun tal og tegnsætning i dette felt (eksempel, et telefon nummer med bindestreg eller punktum er tilladt).',
  12905. alpha: 'Skriv kun bogstaver (a-z) i dette felt. Mellemrum og andre tegn er ikke tilladt.',
  12906. alphanum: 'Skriv kun bogstaver (a-z) eller tal (0-9) i dette felt. Mellemrum og andre tegn er ikke tilladt.',
  12907. dateSuchAs: 'Skriv en gyldig dato som {date}',
  12908. dateInFormatMDY: 'Skriv dato i formatet DD-MM-YYYY (f.eks. "31-12-1999")',
  12909. email: 'Skriv en gyldig e-mail adresse. F.eks "fred@domain.com".',
  12910. url: 'Skriv en gyldig URL adresse. F.eks "http://www.example.com".',
  12911. currencyDollar: 'Skriv et gldigt beløb. F.eks Kr.100.00 .',
  12912. oneRequired: 'Et eller flere af felterne i denne formular skal udfyldes.',
  12913. errorPrefix: 'Fejl: ',
  12914. warningPrefix: 'Advarsel: ',
  12915. // Form.Validator.Extras
  12916. noSpace: 'Der må ikke benyttes mellemrum i dette felt.',
  12917. reqChkByNode: 'Foretag et valg.',
  12918. requiredChk: 'Dette felt skal udfyldes.',
  12919. reqChkByName: 'Vælg en {label}.',
  12920. match: 'Dette felt skal matche {matchName} feltet',
  12921. startDate: 'start dato',
  12922. endDate: 'slut dato',
  12923. currentDate: 'dags dato',
  12924. afterDate: 'Datoen skal være større end eller lig med {label}.',
  12925. beforeDate: 'Datoen skal være mindre end eller lig med {label}.',
  12926. startMonth: 'Vælg en start måned',
  12927. sameMonth: 'De valgte datoer skal være i samme måned - skift en af dem.'
  12928. });
  12929. /*
  12930. ---
  12931. name: Locale.de-DE.Date
  12932. description: Date messages for German.
  12933. license: MIT-style license
  12934. authors:
  12935. - Christoph Pojer
  12936. - Frank Rossi
  12937. - Ulrich Petri
  12938. - Fabian Beiner
  12939. requires:
  12940. - Locale
  12941. provides: [Locale.de-DE.Date]
  12942. ...
  12943. */
  12944. Locale.define('de-DE', 'Date', {
  12945. months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
  12946. months_abbr: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
  12947. days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
  12948. days_abbr: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
  12949. // Culture's date order: DD.MM.YYYY
  12950. dateOrder: ['date', 'month', 'year'],
  12951. shortDate: '%d.%m.%Y',
  12952. shortTime: '%H:%M',
  12953. AM: 'vormittags',
  12954. PM: 'nachmittags',
  12955. firstDayOfWeek: 1,
  12956. // Date.Extras
  12957. ordinal: '.',
  12958. lessThanMinuteAgo: 'vor weniger als einer Minute',
  12959. minuteAgo: 'vor einer Minute',
  12960. minutesAgo: 'vor {delta} Minuten',
  12961. hourAgo: 'vor einer Stunde',
  12962. hoursAgo: 'vor {delta} Stunden',
  12963. dayAgo: 'vor einem Tag',
  12964. daysAgo: 'vor {delta} Tagen',
  12965. weekAgo: 'vor einer Woche',
  12966. weeksAgo: 'vor {delta} Wochen',
  12967. monthAgo: 'vor einem Monat',
  12968. monthsAgo: 'vor {delta} Monaten',
  12969. yearAgo: 'vor einem Jahr',
  12970. yearsAgo: 'vor {delta} Jahren',
  12971. lessThanMinuteUntil: 'in weniger als einer Minute',
  12972. minuteUntil: 'in einer Minute',
  12973. minutesUntil: 'in {delta} Minuten',
  12974. hourUntil: 'in ca. einer Stunde',
  12975. hoursUntil: 'in ca. {delta} Stunden',
  12976. dayUntil: 'in einem Tag',
  12977. daysUntil: 'in {delta} Tagen',
  12978. weekUntil: 'in einer Woche',
  12979. weeksUntil: 'in {delta} Wochen',
  12980. monthUntil: 'in einem Monat',
  12981. monthsUntil: 'in {delta} Monaten',
  12982. yearUntil: 'in einem Jahr',
  12983. yearsUntil: 'in {delta} Jahren'
  12984. });
  12985. /*
  12986. ---
  12987. name: Locale.de-CH.Date
  12988. description: Date messages for German (Switzerland).
  12989. license: MIT-style license
  12990. authors:
  12991. - Michael van der Weg
  12992. requires:
  12993. - Locale
  12994. - Locale.de-DE.Date
  12995. provides: [Locale.de-CH.Date]
  12996. ...
  12997. */
  12998. Locale.define('de-CH').inherit('de-DE', 'Date');
  12999. /*
  13000. ---
  13001. name: Locale.de-CH.Form.Validator
  13002. description: Form Validator messages for German (Switzerland).
  13003. license: MIT-style license
  13004. authors:
  13005. - Michael van der Weg
  13006. requires:
  13007. - Locale
  13008. provides: [Locale.de-CH.Form.Validator]
  13009. ...
  13010. */
  13011. Locale.define('de-CH', 'FormValidator', {
  13012. required: 'Dieses Feld ist obligatorisch.',
  13013. minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13014. maxLength: 'Bitte geben Sie nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13015. integer: 'Geben Sie bitte eine ganze Zahl ein. Dezimalzahlen (z.B. 1.25) sind nicht erlaubt.',
  13016. 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;).',
  13017. digits: 'Benutzen Sie bitte nur Zahlen und Satzzeichen in diesem Eingabefeld (erlaubt ist z.B. eine Telefonnummer mit Bindestrichen und Punkten).',
  13018. alpha: 'Benutzen Sie bitte nur Buchstaben (a-z) in diesem Feld. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13019. alphanum: 'Benutzen Sie bitte nur Buchstaben (a-z) und Zahlen (0-9) in diesem Eingabefeld. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13020. dateSuchAs: 'Geben Sie bitte ein g&uuml;ltiges Datum ein. Wie zum Beispiel {date}',
  13021. dateInFormatMDY: 'Geben Sie bitte ein g&uuml;ltiges Datum ein. Wie zum Beispiel TT.MM.JJJJ (z.B. &quot;31.12.1999&quot;)',
  13022. email: 'Geben Sie bitte eine g&uuml;ltige E-Mail Adresse ein. Wie zum Beispiel &quot;maria@bernasconi.ch&quot;.',
  13023. url: 'Geben Sie bitte eine g&uuml;ltige URL ein. Wie zum Beispiel http://www.example.com.',
  13024. currencyDollar: 'Geben Sie bitte einen g&uuml;ltigen Betrag in Schweizer Franken ein. Wie zum Beispiel 100.00 CHF .',
  13025. oneRequired: 'Machen Sie f&uuml;r mindestens eines der Eingabefelder einen Eintrag.',
  13026. errorPrefix: 'Fehler: ',
  13027. warningPrefix: 'Warnung: ',
  13028. // Form.Validator.Extras
  13029. noSpace: 'In diesem Eingabefeld darf kein Leerzeichen sein.',
  13030. reqChkByNode: 'Es wurden keine Elemente gew&auml;hlt.',
  13031. requiredChk: 'Dieses Feld ist obligatorisch.',
  13032. reqChkByName: 'Bitte w&auml;hlen Sie ein {label}.',
  13033. match: 'Dieses Eingabefeld muss mit dem Feld {matchName} &uuml;bereinstimmen.',
  13034. startDate: 'Das Anfangsdatum',
  13035. endDate: 'Das Enddatum',
  13036. currentDate: 'Das aktuelle Datum',
  13037. afterDate: 'Das Datum sollte zur gleichen Zeit oder sp&auml;ter sein {label}.',
  13038. beforeDate: 'Das Datum sollte zur gleichen Zeit oder fr&uuml;her sein {label}.',
  13039. startMonth: 'W&auml;hlen Sie bitte einen Anfangsmonat',
  13040. sameMonth: 'Diese zwei Datumsangaben m&uuml;ssen im selben Monat sein - Sie m&uuml;ssen eine von beiden ver&auml;ndern.',
  13041. creditcard: 'Die eingegebene Kreditkartennummer ist ung&uuml;ltig. Bitte &uuml;berpr&uuml;fen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.'
  13042. });
  13043. /*
  13044. ---
  13045. name: Locale.de-CH.Number
  13046. description: Number messages for Switzerland.
  13047. license: MIT-style license
  13048. authors:
  13049. - Kim D. Jeker
  13050. requires:
  13051. - Locale
  13052. - Locale.CH.Number
  13053. provides: [Locale.de-CH.Number]
  13054. ...
  13055. */
  13056. Locale.define('de-CH').inherit('CH', 'Number');
  13057. /*
  13058. ---
  13059. name: Locale.de-DE.Form.Validator
  13060. description: Form Validator messages for German.
  13061. license: MIT-style license
  13062. authors:
  13063. - Frank Rossi
  13064. - Ulrich Petri
  13065. - Fabian Beiner
  13066. requires:
  13067. - Locale
  13068. provides: [Locale.de-DE.Form.Validator]
  13069. ...
  13070. */
  13071. Locale.define('de-DE', 'FormValidator', {
  13072. required: 'Dieses Eingabefeld muss ausgefüllt werden.',
  13073. minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben nur {length} Zeichen eingegeben).',
  13074. maxLength: 'Geben Sie bitte nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13075. integer: 'Geben Sie in diesem Eingabefeld bitte eine ganze Zahl ein. Dezimalzahlen (z.B. "1.25") sind nicht erlaubt.',
  13076. numeric: 'Geben Sie in diesem Eingabefeld bitte nur Zahlenwerte (z.B. "1", "1.1", "-1" oder "-1.1") ein.',
  13077. digits: 'Geben Sie in diesem Eingabefeld bitte nur Zahlen und Satzzeichen ein (z.B. eine Telefonnummer mit Bindestrichen und Punkten ist erlaubt).',
  13078. alpha: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) ein. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13079. alphanum: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) und Zahlen (0-9) ein. Leerzeichen oder andere Zeichen sind nicht erlaubt.',
  13080. dateSuchAs: 'Geben Sie bitte ein gültiges Datum ein (z.B. "{date}").',
  13081. dateInFormatMDY: 'Geben Sie bitte ein gültiges Datum im Format TT.MM.JJJJ ein (z.B. "31.12.1999").',
  13082. email: 'Geben Sie bitte eine gültige E-Mail-Adresse ein (z.B. "max@mustermann.de").',
  13083. url: 'Geben Sie bitte eine gültige URL ein (z.B. "http://www.example.com").',
  13084. currencyDollar: 'Geben Sie bitte einen gültigen Betrag in EURO ein (z.B. 100.00€).',
  13085. oneRequired: 'Bitte füllen Sie mindestens ein Eingabefeld aus.',
  13086. errorPrefix: 'Fehler: ',
  13087. warningPrefix: 'Warnung: ',
  13088. // Form.Validator.Extras
  13089. noSpace: 'Es darf kein Leerzeichen in diesem Eingabefeld sein.',
  13090. reqChkByNode: 'Es wurden keine Elemente gewählt.',
  13091. requiredChk: 'Dieses Feld muss ausgefüllt werden.',
  13092. reqChkByName: 'Bitte wählen Sie ein {label}.',
  13093. match: 'Dieses Eingabefeld muss mit dem {matchName} Eingabefeld übereinstimmen.',
  13094. startDate: 'Das Anfangsdatum',
  13095. endDate: 'Das Enddatum',
  13096. currentDate: 'Das aktuelle Datum',
  13097. afterDate: 'Das Datum sollte zur gleichen Zeit oder später sein als {label}.',
  13098. beforeDate: 'Das Datum sollte zur gleichen Zeit oder früher sein als {label}.',
  13099. startMonth: 'Wählen Sie bitte einen Anfangsmonat',
  13100. sameMonth: 'Diese zwei Datumsangaben müssen im selben Monat sein - Sie müssen eines von beiden verändern.',
  13101. creditcard: 'Die eingegebene Kreditkartennummer ist ungültig. Bitte überprüfen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.'
  13102. });
  13103. /*
  13104. ---
  13105. name: Locale.de-DE.Number
  13106. description: Number messages for German.
  13107. license: MIT-style license
  13108. authors:
  13109. - Christoph Pojer
  13110. requires:
  13111. - Locale
  13112. - Locale.EU.Number
  13113. provides: [Locale.de-DE.Number]
  13114. ...
  13115. */
  13116. Locale.define('de-DE').inherit('EU', 'Number');
  13117. /*
  13118. ---
  13119. name: Locale.el-GR.Date
  13120. description: Date messages for Greek language.
  13121. license: MIT-style license
  13122. authors:
  13123. - Periklis Argiriadis
  13124. requires:
  13125. - Locale
  13126. provides: [Locale.el-GR.Date]
  13127. ...
  13128. */
  13129. Locale.define('el-GR', 'Date', {
  13130. months: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
  13131. months_abbr: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μάι', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
  13132. days: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
  13133. days_abbr: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'],
  13134. // Culture's date order: DD/MM/YYYY
  13135. dateOrder: ['date', 'month', 'year'],
  13136. shortDate: '%d/%m/%Y',
  13137. shortTime: '%I:%M%p',
  13138. AM: 'πμ',
  13139. PM: 'μμ',
  13140. firstDayOfWeek: 1,
  13141. // Date.Extras
  13142. ordinal: function(dayOfMonth){
  13143. // 1st, 2nd, 3rd, etc.
  13144. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ος' : ['ος'][Math.min(dayOfMonth % 10, 4)];
  13145. },
  13146. lessThanMinuteAgo: 'λιγότερο από ένα λεπτό πριν',
  13147. minuteAgo: 'περίπου ένα λεπτό πριν',
  13148. minutesAgo: '{delta} λεπτά πριν',
  13149. hourAgo: 'περίπου μια ώρα πριν',
  13150. hoursAgo: 'περίπου {delta} ώρες πριν',
  13151. dayAgo: '1 ημέρα πριν',
  13152. daysAgo: '{delta} ημέρες πριν',
  13153. weekAgo: '1 εβδομάδα πριν',
  13154. weeksAgo: '{delta} εβδομάδες πριν',
  13155. monthAgo: '1 μήνα πριν',
  13156. monthsAgo: '{delta} μήνες πριν',
  13157. yearAgo: '1 χρόνο πριν',
  13158. yearsAgo: '{delta} χρόνια πριν',
  13159. lessThanMinuteUntil: 'λιγότερο από λεπτό από τώρα',
  13160. minuteUntil: 'περίπου ένα λεπτό από τώρα',
  13161. minutesUntil: '{delta} λεπτά από τώρα',
  13162. hourUntil: 'περίπου μια ώρα από τώρα',
  13163. hoursUntil: 'περίπου {delta} ώρες από τώρα',
  13164. dayUntil: '1 ημέρα από τώρα',
  13165. daysUntil: '{delta} ημέρες από τώρα',
  13166. weekUntil: '1 εβδομάδα από τώρα',
  13167. weeksUntil: '{delta} εβδομάδες από τώρα',
  13168. monthUntil: '1 μήνας από τώρα',
  13169. monthsUntil: '{delta} μήνες από τώρα',
  13170. yearUntil: '1 χρόνος από τώρα',
  13171. yearsUntil: '{delta} χρόνια από τώρα'
  13172. });
  13173. /*
  13174. ---
  13175. name: Locale.el-GR.Form.Validator
  13176. description: Form Validator messages for Greek language.
  13177. license: MIT-style license
  13178. authors:
  13179. - Dimitris Tsironis
  13180. requires:
  13181. - Locale
  13182. provides: [Locale.el-GR.Form.Validator]
  13183. ...
  13184. */
  13185. Locale.define('el-GR', 'FormValidator', {
  13186. required: 'Αυτό το πεδίο είναι απαραίτητο.',
  13187. length: 'Παρακαλούμε, εισάγετε {length} χαρακτήρες (έχετε ήδη εισάγει {elLength} χαρακτήρες).',
  13188. minLength: 'Παρακαλούμε, εισάγετε τουλάχιστον {minLength} χαρακτήρες (έχετε ήδη εισάγε {length} χαρακτήρες).',
  13189. maxlength: 'Παρακαλούμε, εισάγετε εώς {maxlength} χαρακτήρες (έχετε ήδη εισάγε {length} χαρακτήρες).',
  13190. integer: 'Παρακαλούμε, εισάγετε έναν ακέραιο αριθμό σε αυτό το πεδίο. Οι αριθμοί με δεκαδικά ψηφία (π.χ. 1.25) δεν επιτρέπονται.',
  13191. numeric: 'Παρακαλούμε, εισάγετε μόνο αριθμητικές τιμές σε αυτό το πεδίο (π.χ." 1 " ή " 1.1 " ή " -1 " ή " -1.1 " ).',
  13192. digits: 'Παρακαλούμε, χρησιμοποιήστε μόνο αριθμούς και σημεία στίξης σε αυτόν τον τομέα (π.χ. επιτρέπεται αριθμός τηλεφώνου με παύλες ή τελείες).',
  13193. alpha: 'Παρακαλούμε, χρησιμοποιήστε μόνο γράμματα (a-z) σε αυτό το πεδίο. Δεν επιτρέπονται κενά ή άλλοι χαρακτήρες.',
  13194. alphanum: 'Παρακαλούμε, χρησιμοποιήστε μόνο γράμματα (a-z) ή αριθμούς (0-9) σε αυτόν τον τομέα. Δεν επιτρέπονται κενά ή άλλοι χαρακτήρες.',
  13195. dateSuchAs: 'Παρακαλούμε, εισάγετε μια έγκυρη ημερομηνία, όπως {date}',
  13196. dateInFormatMDY: 'Παρακαλώ εισάγετε μια έγκυρη ημερομηνία, όπως ΜΜ/ΗΗ/ΕΕΕΕ (π.χ. "12/31/1999").',
  13197. email: 'Παρακαλούμε, εισάγετε μια έγκυρη διεύθυνση ηλεκτρονικού ταχυδρομείου (π.χ. "fred@domain.com").',
  13198. url: 'Παρακαλούμε, εισάγετε μια έγκυρη URL διεύθυνση, όπως http://www.example.com',
  13199. currencyDollar: 'Παρακαλούμε, εισάγετε ένα έγκυρο ποσό σε δολλάρια (π.χ. $100.00).',
  13200. oneRequired: 'Παρακαλούμε, εισάγετε κάτι για τουλάχιστον ένα από αυτά τα πεδία.',
  13201. errorPrefix: 'Σφάλμα: ',
  13202. warningPrefix: 'Προσοχή: ',
  13203. // Form.Validator.Extras
  13204. noSpace: 'Δεν επιτρέπονται τα κενά σε αυτό το πεδίο.',
  13205. reqChkByNode: 'Δεν έχει επιλεγεί κάποιο αντικείμενο',
  13206. requiredChk: 'Αυτό το πεδίο είναι απαραίτητο.',
  13207. reqChkByName: 'Παρακαλούμε, επιλέξτε μια ετικέτα {label}.',
  13208. match: 'Αυτό το πεδίο πρέπει να ταιριάζει με το πεδίο {matchName}.',
  13209. startDate: 'η ημερομηνία έναρξης',
  13210. endDate: 'η ημερομηνία λήξης',
  13211. currentDate: 'η τρέχουσα ημερομηνία',
  13212. afterDate: 'Η ημερομηνία πρέπει να είναι η ίδια ή μετά από την {label}.',
  13213. beforeDate: 'Η ημερομηνία πρέπει να είναι η ίδια ή πριν από την {label}.',
  13214. startMonth: 'Παρακαλώ επιλέξτε ένα μήνα αρχής.',
  13215. sameMonth: 'Αυτές οι δύο ημερομηνίες πρέπει να έχουν τον ίδιο μήνα - θα πρέπει να αλλάξετε ή το ένα ή το άλλο',
  13216. creditcard: 'Ο αριθμός της πιστωτικής κάρτας δεν είναι έγκυρος. Παρακαλούμε ελέγξτε τον αριθμό και δοκιμάστε ξανά. {length} μήκος ψηφίων.'
  13217. });
  13218. /*
  13219. ---
  13220. name: Locale.en-GB.Date
  13221. description: Date messages for British English.
  13222. license: MIT-style license
  13223. authors:
  13224. - Aaron Newton
  13225. requires:
  13226. - Locale
  13227. - Locale.en-US.Date
  13228. provides: [Locale.en-GB.Date]
  13229. ...
  13230. */
  13231. Locale.define('en-GB', 'Date', {
  13232. // Culture's date order: DD/MM/YYYY
  13233. dateOrder: ['date', 'month', 'year'],
  13234. shortDate: '%d/%m/%Y',
  13235. shortTime: '%H:%M'
  13236. }).inherit('en-US', 'Date');
  13237. /*
  13238. ---
  13239. name: Locale.en-US.Number
  13240. description: Number messages for US English.
  13241. license: MIT-style license
  13242. authors:
  13243. - Arian Stolwijk
  13244. requires:
  13245. - Locale
  13246. provides: [Locale.en-US.Number]
  13247. ...
  13248. */
  13249. Locale.define('en-US', 'Number', {
  13250. decimal: '.',
  13251. group: ',',
  13252. /* Commented properties are the defaults for Number.format
  13253. decimals: 0,
  13254. precision: 0,
  13255. scientific: null,
  13256. prefix: null,
  13257. suffic: null,
  13258. // Negative/Currency/percentage will mixin Number
  13259. negative: {
  13260. prefix: '-'
  13261. },*/
  13262. currency: {
  13263. // decimals: 2,
  13264. prefix: '$ '
  13265. }/*,
  13266. percentage: {
  13267. decimals: 2,
  13268. suffix: '%'
  13269. }*/
  13270. });
  13271. /*
  13272. ---
  13273. name: Locale.es-ES.Date
  13274. description: Date messages for Spanish.
  13275. license: MIT-style license
  13276. authors:
  13277. - Ãlfons Sanchez
  13278. requires:
  13279. - Locale
  13280. provides: [Locale.es-ES.Date]
  13281. ...
  13282. */
  13283. Locale.define('es-ES', 'Date', {
  13284. months: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
  13285. months_abbr: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'],
  13286. days: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
  13287. days_abbr: ['dom', 'lun', 'mar', 'mié', 'juv', 'vie', 'sáb'],
  13288. // Culture's date order: DD/MM/YYYY
  13289. dateOrder: ['date', 'month', 'year'],
  13290. shortDate: '%d/%m/%Y',
  13291. shortTime: '%H:%M',
  13292. AM: 'AM',
  13293. PM: 'PM',
  13294. firstDayOfWeek: 1,
  13295. // Date.Extras
  13296. ordinal: '',
  13297. lessThanMinuteAgo: 'hace menos de un minuto',
  13298. minuteAgo: 'hace un minuto',
  13299. minutesAgo: 'hace {delta} minutos',
  13300. hourAgo: 'hace una hora',
  13301. hoursAgo: 'hace unas {delta} horas',
  13302. dayAgo: 'hace un día',
  13303. daysAgo: 'hace {delta} días',
  13304. weekAgo: 'hace una semana',
  13305. weeksAgo: 'hace unas {delta} semanas',
  13306. monthAgo: 'hace un mes',
  13307. monthsAgo: 'hace {delta} meses',
  13308. yearAgo: 'hace un año',
  13309. yearsAgo: 'hace {delta} años',
  13310. lessThanMinuteUntil: 'menos de un minuto desde ahora',
  13311. minuteUntil: 'un minuto desde ahora',
  13312. minutesUntil: '{delta} minutos desde ahora',
  13313. hourUntil: 'una hora desde ahora',
  13314. hoursUntil: 'unas {delta} horas desde ahora',
  13315. dayUntil: 'un día desde ahora',
  13316. daysUntil: '{delta} días desde ahora',
  13317. weekUntil: 'una semana desde ahora',
  13318. weeksUntil: 'unas {delta} semanas desde ahora',
  13319. monthUntil: 'un mes desde ahora',
  13320. monthsUntil: '{delta} meses desde ahora',
  13321. yearUntil: 'un año desde ahora',
  13322. yearsUntil: '{delta} años desde ahora'
  13323. });
  13324. /*
  13325. ---
  13326. name: Locale.es-AR.Date
  13327. description: Date messages for Spanish (Argentina).
  13328. license: MIT-style license
  13329. authors:
  13330. - Ãlfons Sanchez
  13331. - Diego Massanti
  13332. requires:
  13333. - Locale
  13334. - Locale.es-ES.Date
  13335. provides: [Locale.es-AR.Date]
  13336. ...
  13337. */
  13338. Locale.define('es-AR').inherit('es-ES', 'Date');
  13339. /*
  13340. ---
  13341. name: Locale.es-AR.Form.Validator
  13342. description: Form Validator messages for Spanish (Argentina).
  13343. license: MIT-style license
  13344. authors:
  13345. - Diego Massanti
  13346. requires:
  13347. - Locale
  13348. provides: [Locale.es-AR.Form.Validator]
  13349. ...
  13350. */
  13351. Locale.define('es-AR', 'FormValidator', {
  13352. required: 'Este campo es obligatorio.',
  13353. minLength: 'Por favor ingrese al menos {minLength} caracteres (ha ingresado {length} caracteres).',
  13354. maxLength: 'Por favor no ingrese más de {maxLength} caracteres (ha ingresado {length} caracteres).',
  13355. integer: 'Por favor ingrese un número entero en este campo. Números con decimales (p.e. 1,25) no se permiten.',
  13356. numeric: 'Por favor ingrese solo valores numéricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',
  13357. 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).',
  13358. alpha: 'Por favor use sólo letras (a-z) en este campo. No se permiten espacios ni otros caracteres.',
  13359. alphanum: 'Por favor, usa sólo letras (a-z) o números (0-9) en este campo. No se permiten espacios u otros caracteres.',
  13360. dateSuchAs: 'Por favor ingrese una fecha válida como {date}',
  13361. dateInFormatMDY: 'Por favor ingrese una fecha válida, utulizando el formato DD/MM/YYYY (p.e. "31/12/1999")',
  13362. email: 'Por favor, ingrese una dirección de e-mail válida. Por ejemplo, "fred@dominio.com".',
  13363. url: 'Por favor ingrese una URL válida como http://www.example.com.',
  13364. currencyDollar: 'Por favor ingrese una cantidad válida de pesos. Por ejemplo $100,00 .',
  13365. oneRequired: 'Por favor ingrese algo para por lo menos una de estas entradas.',
  13366. errorPrefix: 'Error: ',
  13367. warningPrefix: 'Advertencia: ',
  13368. // Form.Validator.Extras
  13369. noSpace: 'No se permiten espacios en este campo.',
  13370. reqChkByNode: 'No hay elementos seleccionados.',
  13371. requiredChk: 'Este campo es obligatorio.',
  13372. reqChkByName: 'Por favor selecciona una {label}.',
  13373. match: 'Este campo necesita coincidir con el campo {matchName}',
  13374. startDate: 'la fecha de inicio',
  13375. endDate: 'la fecha de fin',
  13376. currentDate: 'la fecha actual',
  13377. afterDate: 'La fecha debe ser igual o posterior a {label}.',
  13378. beforeDate: 'La fecha debe ser igual o anterior a {label}.',
  13379. startMonth: 'Por favor selecciona un mes de origen',
  13380. sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.'
  13381. });
  13382. /*
  13383. ---
  13384. name: Locale.es-AR.Number
  13385. description: Number messages for es Argentina.
  13386. license: MIT-style license
  13387. authors:
  13388. - Oscar Kuchuk
  13389. requires:
  13390. - Locale
  13391. provides: [Locale.es-AR.Number]
  13392. ...
  13393. */
  13394. Locale.define('es-AR', 'Number', {
  13395. decimal: ',',
  13396. group: '.',
  13397. /* Commented properties are the defaults for Number.format
  13398. decimals: 0,
  13399. precision: 0,
  13400. scientific: null,
  13401. prefix: null,
  13402. suffic: null,
  13403. // Negative/Currency/percentage will mixin Number
  13404. negative: {
  13405. prefix: '-'
  13406. },*/
  13407. currency: {
  13408. decimals: 2,
  13409. prefix: '$ '
  13410. }/*,
  13411. percentage: {
  13412. decimals: 2,
  13413. suffix: '%'
  13414. }*/
  13415. });
  13416. /*
  13417. ---
  13418. name: Locale.es-ES.Form.Validator
  13419. description: Form Validator messages for Spanish.
  13420. license: MIT-style license
  13421. authors:
  13422. - Ãlfons Sanchez
  13423. requires:
  13424. - Locale
  13425. provides: [Locale.es-ES.Form.Validator]
  13426. ...
  13427. */
  13428. Locale.define('es-ES', 'FormValidator', {
  13429. required: 'Este campo es obligatorio.',
  13430. minLength: 'Por favor introduce al menos {minLength} caracteres (has introducido {length} caracteres).',
  13431. maxLength: 'Por favor introduce no m&aacute;s de {maxLength} caracteres (has introducido {length} caracteres).',
  13432. integer: 'Por favor introduce un n&uacute;mero entero en este campo. N&uacute;meros con decimales (p.e. 1,25) no se permiten.',
  13433. numeric: 'Por favor introduce solo valores num&eacute;ricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',
  13434. 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).',
  13435. alpha: 'Por favor usa letras solo (a-z) en este campo. No se admiten espacios ni otros caracteres.',
  13436. alphanum: 'Por favor, usa solo letras (a-z) o n&uacute;meros (0-9) en este campo. No se admiten espacios ni otros caracteres.',
  13437. dateSuchAs: 'Por favor introduce una fecha v&aacute;lida como {date}',
  13438. dateInFormatMDY: 'Por favor introduce una fecha v&aacute;lida como DD/MM/YYYY (p.e. "31/12/1999")',
  13439. email: 'Por favor, introduce una direcci&oacute;n de email v&aacute;lida. Por ejemplo, "fred@domain.com".',
  13440. url: 'Por favor introduce una URL v&aacute;lida como http://www.example.com.',
  13441. currencyDollar: 'Por favor introduce una cantidad v&aacute;lida de €. Por ejemplo €100,00 .',
  13442. oneRequired: 'Por favor introduce algo para por lo menos una de estas entradas.',
  13443. errorPrefix: 'Error: ',
  13444. warningPrefix: 'Aviso: ',
  13445. // Form.Validator.Extras
  13446. noSpace: 'No pueden haber espacios en esta entrada.',
  13447. reqChkByNode: 'No hay elementos seleccionados.',
  13448. requiredChk: 'Este campo es obligatorio.',
  13449. reqChkByName: 'Por favor selecciona una {label}.',
  13450. match: 'Este campo necesita coincidir con el campo {matchName}',
  13451. startDate: 'la fecha de inicio',
  13452. endDate: 'la fecha de fin',
  13453. currentDate: 'la fecha actual',
  13454. afterDate: 'La fecha debe ser igual o posterior a {label}.',
  13455. beforeDate: 'La fecha debe ser igual o anterior a {label}.',
  13456. startMonth: 'Por favor selecciona un mes de origen',
  13457. sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.'
  13458. });
  13459. /*
  13460. ---
  13461. name: Locale.es-VE.Date
  13462. description: Date messages for Spanish (Venezuela).
  13463. license: MIT-style license
  13464. authors:
  13465. - Daniel Barreto
  13466. requires:
  13467. - Locale
  13468. - Locale.es-ES.Date
  13469. provides: [Locale.es-VE.Date]
  13470. ...
  13471. */
  13472. Locale.define('es-VE').inherit('es-ES', 'Date');
  13473. /*
  13474. ---
  13475. name: Locale.es-VE.Form.Validator
  13476. description: Form Validator messages for Spanish (Venezuela).
  13477. license: MIT-style license
  13478. authors:
  13479. - Daniel Barreto
  13480. requires:
  13481. - Locale
  13482. - Locale.es-ES.Form.Validator
  13483. provides: [Locale.es-VE.Form.Validator]
  13484. ...
  13485. */
  13486. Locale.define('es-VE', 'FormValidator', {
  13487. 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.',
  13488. alpha: 'Por favor usa solo letras (a-z) en este campo. No se admiten espacios ni otros caracteres.',
  13489. currencyDollar: 'Por favor introduce una cantidad v&aacute;lida de Bs. Por ejemplo Bs. 100,00 .',
  13490. oneRequired: 'Por favor introduce un valor para por lo menos una de estas entradas.',
  13491. // Form.Validator.Extras
  13492. startDate: 'La fecha de inicio',
  13493. endDate: 'La fecha de fin',
  13494. currentDate: 'La fecha actual'
  13495. }).inherit('es-ES', 'FormValidator');
  13496. /*
  13497. ---
  13498. name: Locale.es-VE.Number
  13499. description: Number messages for Spanish (Venezuela).
  13500. license: MIT-style license
  13501. authors:
  13502. - Daniel Barreto
  13503. requires:
  13504. - Locale
  13505. provides: [Locale.es-VE.Number]
  13506. ...
  13507. */
  13508. Locale.define('es-VE', 'Number', {
  13509. decimal: ',',
  13510. group: '.',
  13511. /*
  13512. decimals: 0,
  13513. precision: 0,
  13514. */
  13515. // Negative/Currency/percentage will mixin Number
  13516. negative: {
  13517. prefix: '-'
  13518. },
  13519. currency: {
  13520. decimals: 2,
  13521. prefix: 'Bs. '
  13522. },
  13523. percentage: {
  13524. decimals: 2,
  13525. suffix: '%'
  13526. }
  13527. });
  13528. /*
  13529. ---
  13530. name: Locale.et-EE.Date
  13531. description: Date messages for Estonian.
  13532. license: MIT-style license
  13533. authors:
  13534. - Kevin Valdek
  13535. requires:
  13536. - Locale
  13537. provides: [Locale.et-EE.Date]
  13538. ...
  13539. */
  13540. Locale.define('et-EE', 'Date', {
  13541. months: ['jaanuar', 'veebruar', 'märts', 'aprill', 'mai', 'juuni', 'juuli', 'august', 'september', 'oktoober', 'november', 'detsember'],
  13542. months_abbr: ['jaan', 'veebr', 'märts', 'apr', 'mai', 'juuni', 'juuli', 'aug', 'sept', 'okt', 'nov', 'dets'],
  13543. days: ['pühapäev', 'esmaspäev', 'teisipäev', 'kolmapäev', 'neljapäev', 'reede', 'laupäev'],
  13544. days_abbr: ['pühap', 'esmasp', 'teisip', 'kolmap', 'neljap', 'reede', 'laup'],
  13545. // Culture's date order: MM.DD.YYYY
  13546. dateOrder: ['month', 'date', 'year'],
  13547. shortDate: '%m.%d.%Y',
  13548. shortTime: '%H:%M',
  13549. AM: 'AM',
  13550. PM: 'PM',
  13551. firstDayOfWeek: 1,
  13552. // Date.Extras
  13553. ordinal: '',
  13554. lessThanMinuteAgo: 'vähem kui minut aega tagasi',
  13555. minuteAgo: 'umbes minut aega tagasi',
  13556. minutesAgo: '{delta} minutit tagasi',
  13557. hourAgo: 'umbes tund aega tagasi',
  13558. hoursAgo: 'umbes {delta} tundi tagasi',
  13559. dayAgo: '1 päev tagasi',
  13560. daysAgo: '{delta} päeva tagasi',
  13561. weekAgo: '1 nädal tagasi',
  13562. weeksAgo: '{delta} nädalat tagasi',
  13563. monthAgo: '1 kuu tagasi',
  13564. monthsAgo: '{delta} kuud tagasi',
  13565. yearAgo: '1 aasta tagasi',
  13566. yearsAgo: '{delta} aastat tagasi',
  13567. lessThanMinuteUntil: 'vähem kui minuti aja pärast',
  13568. minuteUntil: 'umbes minuti aja pärast',
  13569. minutesUntil: '{delta} minuti pärast',
  13570. hourUntil: 'umbes tunni aja pärast',
  13571. hoursUntil: 'umbes {delta} tunni pärast',
  13572. dayUntil: '1 päeva pärast',
  13573. daysUntil: '{delta} päeva pärast',
  13574. weekUntil: '1 nädala pärast',
  13575. weeksUntil: '{delta} nädala pärast',
  13576. monthUntil: '1 kuu pärast',
  13577. monthsUntil: '{delta} kuu pärast',
  13578. yearUntil: '1 aasta pärast',
  13579. yearsUntil: '{delta} aasta pärast'
  13580. });
  13581. /*
  13582. ---
  13583. name: Locale.et-EE.Form.Validator
  13584. description: Form Validator messages for Estonian.
  13585. license: MIT-style license
  13586. authors:
  13587. - Kevin Valdek
  13588. requires:
  13589. - Locale
  13590. provides: [Locale.et-EE.Form.Validator]
  13591. ...
  13592. */
  13593. Locale.define('et-EE', 'FormValidator', {
  13594. required: 'Väli peab olema täidetud.',
  13595. minLength: 'Palun sisestage vähemalt {minLength} tähte (te sisestasite {length} tähte).',
  13596. maxLength: 'Palun ärge sisestage rohkem kui {maxLength} tähte (te sisestasite {length} tähte).',
  13597. integer: 'Palun sisestage väljale täisarv. Kümnendarvud (näiteks 1.25) ei ole lubatud.',
  13598. numeric: 'Palun sisestage ainult numbreid väljale (näiteks "1", "1.1", "-1" või "-1.1").',
  13599. digits: 'Palun kasutage ainult numbreid ja kirjavahemärke (telefoninumbri sisestamisel on lubatud kasutada kriipse ja punkte).',
  13600. alpha: 'Palun kasutage ainult tähti (a-z). Tühikud ja teised sümbolid on keelatud.',
  13601. alphanum: 'Palun kasutage ainult tähti (a-z) või numbreid (0-9). Tühikud ja teised sümbolid on keelatud.',
  13602. dateSuchAs: 'Palun sisestage kehtiv kuupäev kujul {date}',
  13603. dateInFormatMDY: 'Palun sisestage kehtiv kuupäev kujul MM.DD.YYYY (näiteks: "12.31.1999").',
  13604. email: 'Palun sisestage kehtiv e-maili aadress (näiteks: "fred@domain.com").',
  13605. url: 'Palun sisestage kehtiv URL (näiteks: http://www.example.com).',
  13606. currencyDollar: 'Palun sisestage kehtiv $ summa (näiteks: $100.00).',
  13607. oneRequired: 'Palun sisestage midagi vähemalt ühele antud väljadest.',
  13608. errorPrefix: 'Viga: ',
  13609. warningPrefix: 'Hoiatus: ',
  13610. // Form.Validator.Extras
  13611. noSpace: 'Väli ei tohi sisaldada tühikuid.',
  13612. reqChkByNode: 'Ükski väljadest pole valitud.',
  13613. requiredChk: 'Välja täitmine on vajalik.',
  13614. reqChkByName: 'Palun valige üks {label}.',
  13615. match: 'Väli peab sobima {matchName} väljaga',
  13616. startDate: 'algkuupäev',
  13617. endDate: 'lõppkuupäev',
  13618. currentDate: 'praegune kuupäev',
  13619. afterDate: 'Kuupäev peab olema võrdne või pärast {label}.',
  13620. beforeDate: 'Kuupäev peab olema võrdne või enne {label}.',
  13621. startMonth: 'Palun valige algkuupäev.',
  13622. sameMonth: 'Antud kaks kuupäeva peavad olema samas kuus - peate muutma ühte kuupäeva.'
  13623. });
  13624. /*
  13625. ---
  13626. name: Locale.fa.Date
  13627. description: Date messages for Persian.
  13628. license: MIT-style license
  13629. authors:
  13630. - Amir Hossein Hodjaty Pour
  13631. requires:
  13632. - Locale
  13633. provides: [Locale.fa.Date]
  13634. ...
  13635. */
  13636. Locale.define('fa', 'Date', {
  13637. months: ['ژانویه', 'فوریه', 'مارس', 'آپریل', 'مه', 'ژوئن', 'ژوئیه', 'آگوست', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
  13638. months_abbr: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
  13639. days: ['یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
  13640. days_abbr: ['ي', 'د', 'س', 'چ', 'پ', 'ج', 'ش'],
  13641. // Culture's date order: MM/DD/YYYY
  13642. dateOrder: ['month', 'date', 'year'],
  13643. shortDate: '%m/%d/%Y',
  13644. shortTime: '%I:%M%p',
  13645. AM: 'ق.ظ',
  13646. PM: 'ب.ظ',
  13647. // Date.Extras
  13648. ordinal: 'ام',
  13649. lessThanMinuteAgo: 'کمتر از یک دقیقه پیش',
  13650. minuteAgo: 'حدود یک دقیقه پیش',
  13651. minutesAgo: '{delta} دقیقه پیش',
  13652. hourAgo: 'حدود یک ساعت پیش',
  13653. hoursAgo: 'حدود {delta} ساعت پیش',
  13654. dayAgo: '1 روز پیش',
  13655. daysAgo: '{delta} روز پیش',
  13656. weekAgo: '1 هفته پیش',
  13657. weeksAgo: '{delta} هفته پیش',
  13658. monthAgo: '1 ماه پیش',
  13659. monthsAgo: '{delta} ماه پیش',
  13660. yearAgo: '1 سال پیش',
  13661. yearsAgo: '{delta} سال پیش',
  13662. lessThanMinuteUntil: 'کمتر از یک دقیقه از حالا',
  13663. minuteUntil: 'حدود یک دقیقه از حالا',
  13664. minutesUntil: '{delta} دقیقه از حالا',
  13665. hourUntil: 'حدود یک ساعت از حالا',
  13666. hoursUntil: 'حدود {delta} ساعت از حالا',
  13667. dayUntil: '1 روز از حالا',
  13668. daysUntil: '{delta} روز از حالا',
  13669. weekUntil: '1 هفته از حالا',
  13670. weeksUntil: '{delta} هفته از حالا',
  13671. monthUntil: '1 ماه از حالا',
  13672. monthsUntil: '{delta} ماه از حالا',
  13673. yearUntil: '1 سال از حالا',
  13674. yearsUntil: '{delta} سال از حالا'
  13675. });
  13676. /*
  13677. ---
  13678. name: Locale.fa.Form.Validator
  13679. description: Form Validator messages for Persian.
  13680. license: MIT-style license
  13681. authors:
  13682. - Amir Hossein Hodjaty Pour
  13683. requires:
  13684. - Locale
  13685. provides: [Locale.fa.Form.Validator]
  13686. ...
  13687. */
  13688. Locale.define('fa', 'FormValidator', {
  13689. required: 'این فیلد الزامی است.',
  13690. minLength: 'شما باید حداقل {minLength} حرف وارد کنید ({length} حرف وارد کرده اید).',
  13691. maxLength: 'لطفا حداکثر {maxLength} حرف وارد کنید (شما {length} حرف وارد کرده اید).',
  13692. integer: 'لطفا از عدد صحیح استفاده کنید. اعداد اعشاری (مانند 1.25) مجاز نیستند.',
  13693. numeric: 'لطفا فقط داده عددی وارد کنید (مانند "1" یا "1.1" یا "1-" یا "1.1-").',
  13694. digits: 'لطفا فقط از اعداد و علامتها در این فیلد استفاده کنید (برای مثال شماره تلفن با خط تیره و نقطه قابل قبول است).',
  13695. alpha: 'لطفا فقط از حروف الفباء برای این بخش استفاده کنید. کاراکترهای دیگر و فاصله مجاز نیستند.',
  13696. alphanum: 'لطفا فقط از حروف الفباء و اعداد در این بخش استفاده کنید. کاراکترهای دیگر و فاصله مجاز نیستند.',
  13697. dateSuchAs: 'لطفا یک تاریخ معتبر مانند {date} وارد کنید.',
  13698. dateInFormatMDY: 'لطفا یک تاریخ معتبر به شکل MM/DD/YYYY وارد کنید (مانند "12/31/1999").',
  13699. email: 'لطفا یک آدرس ایمیل معتبر وارد کنید. برای مثال "fred@domain.com".',
  13700. url: 'لطفا یک URL معتبر مانند http://www.example.com وارد کنید.',
  13701. currencyDollar: 'لطفا یک محدوده معتبر برای این بخش وارد کنید مانند 100.00$ .',
  13702. oneRequired: 'لطفا حداقل یکی از فیلدها را پر کنید.',
  13703. errorPrefix: 'خطا: ',
  13704. warningPrefix: 'هشدار: ',
  13705. // Form.Validator.Extras
  13706. noSpace: 'استفاده از فاصله در این بخش مجاز نیست.',
  13707. reqChkByNode: 'موردی انتخاب نشده است.',
  13708. requiredChk: 'این فیلد الزامی است.',
  13709. reqChkByName: 'لطفا یک {label} را انتخاب کنید.',
  13710. match: 'این فیلد باید با فیلد {matchName} مطابقت داشته باشد.',
  13711. startDate: 'تاریخ شروع',
  13712. endDate: 'تاریخ پایان',
  13713. currentDate: 'تاریخ کنونی',
  13714. afterDate: 'تاریخ میبایست برابر یا بعد از {label} باشد',
  13715. beforeDate: 'تاریخ میبایست برابر یا قبل از {label} باشد',
  13716. startMonth: 'لطفا ماه شروع را انتخاب کنید',
  13717. sameMonth: 'این دو تاریخ باید در یک ماه باشند - شما باید یکی یا هر دو را تغییر دهید.',
  13718. creditcard: 'شماره کارت اعتباری که وارد کرده اید معتبر نیست. لطفا شماره را بررسی کنید و مجددا تلاش کنید. {length} رقم وارد شده است.'
  13719. });
  13720. /*
  13721. ---
  13722. name: Locale.fi-FI.Date
  13723. description: Date messages for Finnish.
  13724. license: MIT-style license
  13725. authors:
  13726. - ksel
  13727. requires:
  13728. - Locale
  13729. provides: [Locale.fi-FI.Date]
  13730. ...
  13731. */
  13732. Locale.define('fi-FI', 'Date', {
  13733. // NOTE: months and days are not capitalized in finnish
  13734. months: ['tammikuu', 'helmikuu', 'maaliskuu', 'huhtikuu', 'toukokuu', 'kesäkuu', 'heinäkuu', 'elokuu', 'syyskuu', 'lokakuu', 'marraskuu', 'joulukuu'],
  13735. // these abbreviations are really not much used in finnish because they obviously won't abbreviate very much. ;)
  13736. // NOTE: sometimes one can see forms such as "tammi", "helmi", etc. but that is not proper finnish.
  13737. months_abbr: ['tammik.', 'helmik.', 'maalisk.', 'huhtik.', 'toukok.', 'kesäk.', 'heinäk.', 'elok.', 'syysk.', 'lokak.', 'marrask.', 'jouluk.'],
  13738. days: ['sunnuntai', 'maanantai', 'tiistai', 'keskiviikko', 'torstai', 'perjantai', 'lauantai'],
  13739. days_abbr: ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'],
  13740. // Culture's date order: DD/MM/YYYY
  13741. dateOrder: ['date', 'month', 'year'],
  13742. shortDate: '%d.%m.%Y',
  13743. shortTime: '%H:%M',
  13744. AM: 'AM',
  13745. PM: 'PM',
  13746. firstDayOfWeek: 1,
  13747. // Date.Extras
  13748. ordinal: '.',
  13749. lessThanMinuteAgo: 'vajaa minuutti sitten',
  13750. minuteAgo: 'noin minuutti sitten',
  13751. minutesAgo: '{delta} minuuttia sitten',
  13752. hourAgo: 'noin tunti sitten',
  13753. hoursAgo: 'noin {delta} tuntia sitten',
  13754. dayAgo: 'päivä sitten',
  13755. daysAgo: '{delta} päivää sitten',
  13756. weekAgo: 'viikko sitten',
  13757. weeksAgo: '{delta} viikkoa sitten',
  13758. monthAgo: 'kuukausi sitten',
  13759. monthsAgo: '{delta} kuukautta sitten',
  13760. yearAgo: 'vuosi sitten',
  13761. yearsAgo: '{delta} vuotta sitten',
  13762. lessThanMinuteUntil: 'vajaan minuutin kuluttua',
  13763. minuteUntil: 'noin minuutin kuluttua',
  13764. minutesUntil: '{delta} minuutin kuluttua',
  13765. hourUntil: 'noin tunnin kuluttua',
  13766. hoursUntil: 'noin {delta} tunnin kuluttua',
  13767. dayUntil: 'päivän kuluttua',
  13768. daysUntil: '{delta} päivän kuluttua',
  13769. weekUntil: 'viikon kuluttua',
  13770. weeksUntil: '{delta} viikon kuluttua',
  13771. monthUntil: 'kuukauden kuluttua',
  13772. monthsUntil: '{delta} kuukauden kuluttua',
  13773. yearUntil: 'vuoden kuluttua',
  13774. yearsUntil: '{delta} vuoden kuluttua'
  13775. });
  13776. /*
  13777. ---
  13778. name: Locale.fi-FI.Form.Validator
  13779. description: Form Validator messages for Finnish.
  13780. license: MIT-style license
  13781. authors:
  13782. - ksel
  13783. requires:
  13784. - Locale
  13785. provides: [Locale.fi-FI.Form.Validator]
  13786. ...
  13787. */
  13788. Locale.define('fi-FI', 'FormValidator', {
  13789. required: 'Tämä kenttä on pakollinen.',
  13790. minLength: 'Ole hyvä ja anna vähintään {minLength} merkkiä (annoit {length} merkkiä).',
  13791. maxLength: 'Älä anna enempää kuin {maxLength} merkkiä (annoit {length} merkkiä).',
  13792. integer: 'Ole hyvä ja anna kokonaisluku. Luvut, joissa on desimaaleja (esim. 1.25) eivät ole sallittuja.',
  13793. numeric: 'Anna tähän kenttään lukuarvo (kuten "1" tai "1.1" tai "-1" tai "-1.1").',
  13794. 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).',
  13795. alpha: 'Anna tähän kenttään vain kirjaimia (a-z). Välilyönnit tai muut merkit eivät ole sallittuja.',
  13796. 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.',
  13797. dateSuchAs: 'Ole hyvä ja anna kelvollinen päivmäärä, kuten esimerkiksi {date}',
  13798. dateInFormatMDY: 'Ole hyvä ja anna kelvollinen päivämäärä muodossa pp/kk/vvvv (kuten "12/31/1999")',
  13799. email: 'Ole hyvä ja anna kelvollinen sähköpostiosoite (kuten esimerkiksi "matti@meikalainen.com").',
  13800. url: 'Ole hyvä ja anna kelvollinen URL, kuten esimerkiksi http://www.example.com.',
  13801. currencyDollar: 'Ole hyvä ja anna kelvollinen eurosumma (kuten esimerkiksi 100,00 EUR) .',
  13802. oneRequired: 'Ole hyvä ja syötä jotakin ainakin johonkin näistä kentistä.',
  13803. errorPrefix: 'Virhe: ',
  13804. warningPrefix: 'Varoitus: ',
  13805. // Form.Validator.Extras
  13806. noSpace: 'Tässä syötteessä ei voi olla välilyöntejä',
  13807. reqChkByNode: 'Ei valintoja.',
  13808. requiredChk: 'Tämä kenttä on pakollinen.',
  13809. reqChkByName: 'Ole hyvä ja valitse {label}.',
  13810. match: 'Tämän kentän tulee vastata kenttää {matchName}',
  13811. startDate: 'alkupäivämäärä',
  13812. endDate: 'loppupäivämäärä',
  13813. currentDate: 'nykyinen päivämäärä',
  13814. afterDate: 'Päivämäärän tulisi olla sama tai myöhäisempi ajankohta kuin {label}.',
  13815. beforeDate: 'Päivämäärän tulisi olla sama tai aikaisempi ajankohta kuin {label}.',
  13816. startMonth: 'Ole hyvä ja valitse aloituskuukausi',
  13817. sameMonth: 'Näiden kahden päivämäärän tulee olla saman kuun sisällä -- sinun pitää muuttaa jompaa kumpaa.',
  13818. creditcard: 'Annettu luottokortin numero ei kelpaa. Ole hyvä ja tarkista numero sekä yritä uudelleen. {length} numeroa syötetty.'
  13819. });
  13820. /*
  13821. ---
  13822. name: Locale.fi-FI.Number
  13823. description: Finnish number messages
  13824. license: MIT-style license
  13825. authors:
  13826. - ksel
  13827. requires:
  13828. - Locale
  13829. - Locale.EU.Number
  13830. provides: [Locale.fi-FI.Number]
  13831. ...
  13832. */
  13833. Locale.define('fi-FI', 'Number', {
  13834. group: ' ' // grouped by space
  13835. }).inherit('EU', 'Number');
  13836. /*
  13837. ---
  13838. name: Locale.fr-FR.Date
  13839. description: Date messages for French.
  13840. license: MIT-style license
  13841. authors:
  13842. - Nicolas Sorosac
  13843. - Antoine Abt
  13844. requires:
  13845. - Locale
  13846. provides: [Locale.fr-FR.Date]
  13847. ...
  13848. */
  13849. Locale.define('fr-FR', 'Date', {
  13850. months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
  13851. months_abbr: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
  13852. days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
  13853. days_abbr: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
  13854. // Culture's date order: DD/MM/YYYY
  13855. dateOrder: ['date', 'month', 'year'],
  13856. shortDate: '%d/%m/%Y',
  13857. shortTime: '%H:%M',
  13858. AM: 'AM',
  13859. PM: 'PM',
  13860. firstDayOfWeek: 1,
  13861. // Date.Extras
  13862. ordinal: function(dayOfMonth){
  13863. return (dayOfMonth > 1) ? '' : 'er';
  13864. },
  13865. lessThanMinuteAgo: "il y a moins d'une minute",
  13866. minuteAgo: 'il y a une minute',
  13867. minutesAgo: 'il y a {delta} minutes',
  13868. hourAgo: 'il y a une heure',
  13869. hoursAgo: 'il y a {delta} heures',
  13870. dayAgo: 'il y a un jour',
  13871. daysAgo: 'il y a {delta} jours',
  13872. weekAgo: 'il y a une semaine',
  13873. weeksAgo: 'il y a {delta} semaines',
  13874. monthAgo: 'il y a 1 mois',
  13875. monthsAgo: 'il y a {delta} mois',
  13876. yearthAgo: 'il y a 1 an',
  13877. yearsAgo: 'il y a {delta} ans',
  13878. lessThanMinuteUntil: "dans moins d'une minute",
  13879. minuteUntil: 'dans une minute',
  13880. minutesUntil: 'dans {delta} minutes',
  13881. hourUntil: 'dans une heure',
  13882. hoursUntil: 'dans {delta} heures',
  13883. dayUntil: 'dans un jour',
  13884. daysUntil: 'dans {delta} jours',
  13885. weekUntil: 'dans 1 semaine',
  13886. weeksUntil: 'dans {delta} semaines',
  13887. monthUntil: 'dans 1 mois',
  13888. monthsUntil: 'dans {delta} mois',
  13889. yearUntil: 'dans 1 an',
  13890. yearsUntil: 'dans {delta} ans'
  13891. });
  13892. /*
  13893. ---
  13894. name: Locale.fr-FR.Form.Validator
  13895. description: Form Validator messages for French.
  13896. license: MIT-style license
  13897. authors:
  13898. - Miquel Hudin
  13899. - Nicolas Sorosac
  13900. requires:
  13901. - Locale
  13902. provides: [Locale.fr-FR.Form.Validator]
  13903. ...
  13904. */
  13905. /*eslint mootools-whitespace:0*/
  13906. Locale.define('fr-FR', 'FormValidator', {
  13907. required: 'Ce champ est obligatoire.',
  13908. length: 'Veuillez saisir {length} caract&egrave;re(s) (vous avez saisi {elLength} caract&egrave;re(s)',
  13909. minLength: 'Veuillez saisir un minimum de {minLength} caract&egrave;re(s) (vous avez saisi {length} caract&egrave;re(s)).',
  13910. maxLength: 'Veuillez saisir un maximum de {maxLength} caract&egrave;re(s) (vous avez saisi {length} caract&egrave;re(s)).',
  13911. integer: 'Veuillez saisir un nombre entier dans ce champ. Les nombres d&eacute;cimaux (ex : "1,25") ne sont pas autoris&eacute;s.',
  13912. numeric: 'Veuillez saisir uniquement des chiffres dans ce champ (ex : "1" ou "1,1" ou "-1" ou "-1,1").',
  13913. 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;).",
  13914. alpha: 'Veuillez saisir uniquement des lettres (a-z) dans ce champ. Les espaces ou autres caract&egrave;res ne sont pas autoris&eacute;s.',
  13915. 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.',
  13916. dateSuchAs: 'Veuillez saisir une date correcte comme {date}',
  13917. dateInFormatMDY: 'Veuillez saisir une date correcte, au format JJ/MM/AAAA (ex : "31/11/1999").',
  13918. email: 'Veuillez saisir une adresse de courrier &eacute;lectronique. Par exemple "fred@domaine.com".',
  13919. url: 'Veuillez saisir une URL, comme http://www.exemple.com.',
  13920. currencyDollar: 'Veuillez saisir une quantit&eacute; correcte. Par exemple 100,00&euro;.',
  13921. oneRequired: 'Veuillez s&eacute;lectionner au moins une de ces options.',
  13922. errorPrefix: 'Erreur : ',
  13923. warningPrefix: 'Attention : ',
  13924. // Form.Validator.Extras
  13925. noSpace: "Ce champ n'accepte pas les espaces.",
  13926. reqChkByNode: "Aucun &eacute;l&eacute;ment n'est s&eacute;lectionn&eacute;.",
  13927. requiredChk: 'Ce champ est obligatoire.',
  13928. reqChkByName: 'Veuillez s&eacute;lectionner un(e) {label}.',
  13929. match: 'Ce champ doit correspondre avec le champ {matchName}.',
  13930. startDate: 'date de d&eacute;but',
  13931. endDate: 'date de fin',
  13932. currentDate: 'date actuelle',
  13933. afterDate: 'La date doit &ecirc;tre identique ou post&eacute;rieure &agrave; {label}.',
  13934. beforeDate: 'La date doit &ecirc;tre identique ou ant&eacute;rieure &agrave; {label}.',
  13935. startMonth: 'Veuillez s&eacute;lectionner un mois de d&eacute;but.',
  13936. sameMonth: 'Ces deux dates doivent &ecirc;tre dans le m&ecirc;me mois - vous devez en modifier une.',
  13937. 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).'
  13938. });
  13939. /*
  13940. ---
  13941. name: Locale.fr-FR.Number
  13942. description: Number messages for French.
  13943. license: MIT-style license
  13944. authors:
  13945. - Arian Stolwijk
  13946. - sv1l
  13947. requires:
  13948. - Locale
  13949. - Locale.EU.Number
  13950. provides: [Locale.fr-FR.Number]
  13951. ...
  13952. */
  13953. Locale.define('fr-FR', 'Number', {
  13954. group: ' ' // In fr-FR localization, group character is a blank space
  13955. }).inherit('EU', 'Number');
  13956. /*
  13957. ---
  13958. name: Locale.he-IL.Date
  13959. description: Date messages for Hebrew.
  13960. license: MIT-style license
  13961. authors:
  13962. - Elad Ossadon
  13963. requires:
  13964. - Locale
  13965. provides: [Locale.he-IL.Date]
  13966. ...
  13967. */
  13968. Locale.define('he-IL', 'Date', {
  13969. months: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
  13970. months_abbr: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
  13971. days: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'],
  13972. days_abbr: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'],
  13973. // Culture's date order: MM/DD/YYYY
  13974. dateOrder: ['date', 'month', 'year'],
  13975. shortDate: '%d/%m/%Y',
  13976. shortTime: '%H:%M',
  13977. AM: 'AM',
  13978. PM: 'PM',
  13979. firstDayOfWeek: 0,
  13980. // Date.Extras
  13981. ordinal: '',
  13982. lessThanMinuteAgo: 'לפני פחות מדקה',
  13983. minuteAgo: 'לפני כדקה',
  13984. minutesAgo: 'לפני {delta} דקות',
  13985. hourAgo: 'לפני כשעה',
  13986. hoursAgo: 'לפני {delta} שעות',
  13987. dayAgo: 'לפני יום',
  13988. daysAgo: 'לפני {delta} ימים',
  13989. weekAgo: 'לפני שבוע',
  13990. weeksAgo: 'לפני {delta} שבועות',
  13991. monthAgo: 'לפני חודש',
  13992. monthsAgo: 'לפני {delta} חודשים',
  13993. yearAgo: 'לפני שנה',
  13994. yearsAgo: 'לפני {delta} שנים',
  13995. lessThanMinuteUntil: 'בעוד פחות מדקה',
  13996. minuteUntil: 'בעוד כדקה',
  13997. minutesUntil: 'בעוד {delta} דקות',
  13998. hourUntil: 'בעוד כשעה',
  13999. hoursUntil: 'בעוד {delta} שעות',
  14000. dayUntil: 'בעוד יום',
  14001. daysUntil: 'בעוד {delta} ימים',
  14002. weekUntil: 'בעוד שבוע',
  14003. weeksUntil: 'בעוד {delta} שבועות',
  14004. monthUntil: 'בעוד חודש',
  14005. monthsUntil: 'בעוד {delta} חודשים',
  14006. yearUntil: 'בעוד שנה',
  14007. yearsUntil: 'בעוד {delta} שנים'
  14008. });
  14009. /*
  14010. ---
  14011. name: Locale.he-IL.Form.Validator
  14012. description: Form Validator messages for Hebrew.
  14013. license: MIT-style license
  14014. authors:
  14015. - Elad Ossadon
  14016. requires:
  14017. - Locale
  14018. provides: [Locale.he-IL.Form.Validator]
  14019. ...
  14020. */
  14021. Locale.define('he-IL', 'FormValidator', {
  14022. required: 'נא למלא שדה זה.',
  14023. minLength: 'נא להזין לפחות {minLength} תווים (הזנת {length} תווים).',
  14024. maxLength: 'נא להזין עד {maxLength} תווים (הזנת {length} תווים).',
  14025. integer: 'נא להזין מספר שלם לשדה זה. מספרים עשרוניים (כמו 1.25) אינם חוקיים.',
  14026. numeric: 'נא להזין ערך מספרי בלבד בשדה זה (כמו "1", "1.1", "-1" או "-1.1").',
  14027. digits: 'נא להזין רק ספרות וסימני הפרדה בשדה זה (למשל, מספר טלפון עם מקפים או נקודות הוא חוקי).',
  14028. alpha: 'נא להזין רק אותיות באנגלית (a-z) בשדה זה. רווחים או תווים אחרים אינם חוקיים.',
  14029. alphanum: 'נא להזין רק אותריות באנגלית (a-z) או ספרות (0-9) בשדה זה. אווחרים או תווים אחרים אינם חוקיים.',
  14030. dateSuchAs: 'נא להזין תאריך חוקי, כמו {date}',
  14031. dateInFormatMDY: 'נא להזין תאריך חוקי בפורמט MM/DD/YYYY (כמו "12/31/1999")',
  14032. email: 'נא להזין כתובת אימייל חוקית. לדוגמה: "fred@domain.com".',
  14033. url: 'נא להזין כתובת אתר חוקית, כמו http://www.example.com.',
  14034. currencyDollar: 'נא להזין סכום דולרי חוקי. לדוגמה $100.00.',
  14035. oneRequired: 'נא לבחור לפחות בשדה אחד.',
  14036. errorPrefix: 'שגיאה: ',
  14037. warningPrefix: 'אזהרה: ',
  14038. // Form.Validator.Extras
  14039. noSpace: 'אין להזין רווחים בשדה זה.',
  14040. reqChkByNode: 'נא לבחור אחת מהאפשרויות.',
  14041. requiredChk: 'שדה זה נדרש.',
  14042. reqChkByName: 'נא לבחור {label}.',
  14043. match: 'שדה זה צריך להתאים לשדה {matchName}',
  14044. startDate: 'תאריך ההתחלה',
  14045. endDate: 'תאריך הסיום',
  14046. currentDate: 'התאריך הנוכחי',
  14047. afterDate: 'התאריך צריך להיות זהה או אחרי {label}.',
  14048. beforeDate: 'התאריך צריך להיות זהה או לפני {label}.',
  14049. startMonth: 'נא לבחור חודש התחלה',
  14050. sameMonth: 'שני תאריכים אלה צריכים להיות באותו חודש - נא לשנות אחד התאריכים.',
  14051. creditcard: 'מספר כרטיס האשראי שהוזן אינו חוקי. נא לבדוק שנית. הוזנו {length} ספרות.'
  14052. });
  14053. /*
  14054. ---
  14055. name: Locale.he-IL.Number
  14056. description: Number messages for Hebrew.
  14057. license: MIT-style license
  14058. authors:
  14059. - Elad Ossadon
  14060. requires:
  14061. - Locale
  14062. provides: [Locale.he-IL.Number]
  14063. ...
  14064. */
  14065. Locale.define('he-IL', 'Number', {
  14066. decimal: '.',
  14067. group: ',',
  14068. currency: {
  14069. suffix: ' ₪'
  14070. }
  14071. });
  14072. /*
  14073. ---
  14074. name: Locale.hu-HU.Date
  14075. description: Date messages for Hungarian.
  14076. license: MIT-style license
  14077. authors:
  14078. - Zsolt Szegheő
  14079. requires:
  14080. - Locale
  14081. provides: [Locale.hu-HU.Date]
  14082. ...
  14083. */
  14084. Locale.define('hu-HU', 'Date', {
  14085. months: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június', 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],
  14086. months_abbr: ['jan.', 'febr.', 'márc.', 'ápr.', 'máj.', 'jún.', 'júl.', 'aug.', 'szept.', 'okt.', 'nov.', 'dec.'],
  14087. days: ['Vasárnap', 'Hétfő', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
  14088. days_abbr: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
  14089. // Culture's date order: YYYY.MM.DD.
  14090. dateOrder: ['year', 'month', 'date'],
  14091. shortDate: '%Y.%m.%d.',
  14092. shortTime: '%I:%M',
  14093. AM: 'de.',
  14094. PM: 'du.',
  14095. firstDayOfWeek: 1,
  14096. // Date.Extras
  14097. ordinal: '.',
  14098. lessThanMinuteAgo: 'alig egy perce',
  14099. minuteAgo: 'egy perce',
  14100. minutesAgo: '{delta} perce',
  14101. hourAgo: 'egy órája',
  14102. hoursAgo: '{delta} órája',
  14103. dayAgo: '1 napja',
  14104. daysAgo: '{delta} napja',
  14105. weekAgo: '1 hete',
  14106. weeksAgo: '{delta} hete',
  14107. monthAgo: '1 hónapja',
  14108. monthsAgo: '{delta} hónapja',
  14109. yearAgo: '1 éve',
  14110. yearsAgo: '{delta} éve',
  14111. lessThanMinuteUntil: 'alig egy perc múlva',
  14112. minuteUntil: 'egy perc múlva',
  14113. minutesUntil: '{delta} perc múlva',
  14114. hourUntil: 'egy óra múlva',
  14115. hoursUntil: '{delta} óra múlva',
  14116. dayUntil: '1 nap múlva',
  14117. daysUntil: '{delta} nap múlva',
  14118. weekUntil: '1 hét múlva',
  14119. weeksUntil: '{delta} hét múlva',
  14120. monthUntil: '1 hónap múlva',
  14121. monthsUntil: '{delta} hónap múlva',
  14122. yearUntil: '1 év múlva',
  14123. yearsUntil: '{delta} év múlva'
  14124. });
  14125. /*
  14126. ---
  14127. name: Locale.hu-HU.Form.Validator
  14128. description: Form Validator messages for Hungarian.
  14129. license: MIT-style license
  14130. authors:
  14131. - Zsolt Szegheő
  14132. requires:
  14133. - Locale
  14134. provides: [Locale.hu-HU.Form.Validator]
  14135. ...
  14136. */
  14137. /*eslint mootools-whitespace:0*/
  14138. Locale.define('hu-HU', 'FormValidator', {
  14139. required: 'A mező kitöltése kötelező.',
  14140. minLength: 'Legalább {minLength} karakter megadása szükséges (megadva {length} karakter).',
  14141. maxLength: 'Legfeljebb {maxLength} karakter megadása lehetséges (megadva {length} karakter).',
  14142. integer: 'Egész szám megadása szükséges. A tizedesjegyek (pl. 1.25) nem engedélyezettek.',
  14143. numeric: 'Szám megadása szükséges (pl. "1" vagy "1.1" vagy "-1" vagy "-1.1").',
  14144. digits: 'Csak számok és írásjelek megadása lehetséges (pl. telefonszám kötőjelek és/vagy perjelekkel).',
  14145. alpha: 'Csak betűk (a-z) megadása lehetséges. Szóköz és egyéb karakterek nem engedélyezettek.',
  14146. 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.',
  14147. dateSuchAs: 'Valós dátum megadása szükséges (pl. {date}).',
  14148. dateInFormatMDY: 'Valós dátum megadása szükséges ÉÉÉÉ.HH.NN. formában. (pl. "1999.12.31.")',
  14149. email: 'Valós e-mail cím megadása szükséges (pl. "fred@domain.hu").',
  14150. url: 'Valós URL megadása szükséges (pl. http://www.example.com).',
  14151. currencyDollar: 'Valós pénzösszeg megadása szükséges (pl. 100.00 Ft.).',
  14152. oneRequired: 'Az alábbi mezők legalább egyikének kitöltése kötelező.',
  14153. errorPrefix: 'Hiba: ',
  14154. warningPrefix: 'Figyelem: ',
  14155. // Form.Validator.Extras
  14156. noSpace: 'A mező nem tartalmazhat szóközöket.',
  14157. reqChkByNode: 'Nincs egyetlen kijelölt elem sem.',
  14158. requiredChk: 'A mező kitöltése kötelező.',
  14159. reqChkByName: 'Egy {label} kiválasztása szükséges.',
  14160. match: 'A mezőnek egyeznie kell a(z) {matchName} mezővel.',
  14161. startDate: 'a kezdet dátuma',
  14162. endDate: 'a vég dátuma',
  14163. currentDate: 'jelenlegi dátum',
  14164. afterDate: 'A dátum nem lehet kisebb, mint {label}.',
  14165. beforeDate: 'A dátum nem lehet nagyobb, mint {label}.',
  14166. startMonth: 'Kezdeti hónap megadása szükséges.',
  14167. sameMonth: 'A két dátumnak ugyanazon hónapban kell lennie.',
  14168. creditcard: 'A megadott bankkártyaszám nem valódi (megadva {length} számjegy).'
  14169. });
  14170. /*
  14171. ---
  14172. name: Locale.it-IT.Date
  14173. description: Date messages for Italian.
  14174. license: MIT-style license.
  14175. authors:
  14176. - Andrea Novero
  14177. - Valerio Proietti
  14178. requires:
  14179. - Locale
  14180. provides: [Locale.it-IT.Date]
  14181. ...
  14182. */
  14183. Locale.define('it-IT', 'Date', {
  14184. months: ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'],
  14185. months_abbr: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
  14186. days: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
  14187. days_abbr: ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'],
  14188. // Culture's date order: DD/MM/YYYY
  14189. dateOrder: ['date', 'month', 'year'],
  14190. shortDate: '%d/%m/%Y',
  14191. shortTime: '%H.%M',
  14192. AM: 'AM',
  14193. PM: 'PM',
  14194. firstDayOfWeek: 1,
  14195. // Date.Extras
  14196. ordinal: 'º',
  14197. lessThanMinuteAgo: 'meno di un minuto fa',
  14198. minuteAgo: 'circa un minuto fa',
  14199. minutesAgo: 'circa {delta} minuti fa',
  14200. hourAgo: "circa un'ora fa",
  14201. hoursAgo: 'circa {delta} ore fa',
  14202. dayAgo: 'circa 1 giorno fa',
  14203. daysAgo: 'circa {delta} giorni fa',
  14204. weekAgo: 'una settimana fa',
  14205. weeksAgo: '{delta} settimane fa',
  14206. monthAgo: 'un mese fa',
  14207. monthsAgo: '{delta} mesi fa',
  14208. yearAgo: 'un anno fa',
  14209. yearsAgo: '{delta} anni fa',
  14210. lessThanMinuteUntil: 'tra meno di un minuto',
  14211. minuteUntil: 'tra circa un minuto',
  14212. minutesUntil: 'tra circa {delta} minuti',
  14213. hourUntil: "tra circa un'ora",
  14214. hoursUntil: 'tra circa {delta} ore',
  14215. dayUntil: 'tra circa un giorno',
  14216. daysUntil: 'tra circa {delta} giorni',
  14217. weekUntil: 'tra una settimana',
  14218. weeksUntil: 'tra {delta} settimane',
  14219. monthUntil: 'tra un mese',
  14220. monthsUntil: 'tra {delta} mesi',
  14221. yearUntil: 'tra un anno',
  14222. yearsUntil: 'tra {delta} anni'
  14223. });
  14224. /*
  14225. ---
  14226. name: Locale.it-IT.Form.Validator
  14227. description: Form Validator messages for Italian.
  14228. license: MIT-style license
  14229. authors:
  14230. - Leonardo Laureti
  14231. - Andrea Novero
  14232. requires:
  14233. - Locale
  14234. provides: [Locale.it-IT.Form.Validator]
  14235. ...
  14236. */
  14237. /*eslint mootools-whitespace:0*/
  14238. Locale.define('it-IT', 'FormValidator', {
  14239. required: 'Il campo &egrave; obbligatorio.',
  14240. minLength: 'Inserire almeno {minLength} caratteri (ne sono stati inseriti {length}).',
  14241. maxLength: 'Inserire al massimo {maxLength} caratteri (ne sono stati inseriti {length}).',
  14242. integer: 'Inserire un numero intero. Non sono consentiti decimali (es.: 1.25).',
  14243. numeric: 'Inserire solo valori numerici (es.: "1" oppure "1.1" oppure "-1" oppure "-1.1").',
  14244. digits: 'Inserire solo numeri e caratteri di punteggiatura. Per esempio &egrave; consentito un numero telefonico con trattini o punti.',
  14245. alpha: 'Inserire solo lettere (a-z). Non sono consentiti spazi o altri caratteri.',
  14246. alphanum: 'Inserire solo lettere (a-z) o numeri (0-9). Non sono consentiti spazi o altri caratteri.',
  14247. dateSuchAs: 'Inserire una data valida del tipo {date}',
  14248. dateInFormatMDY: 'Inserire una data valida nel formato MM/GG/AAAA (es.: "12/31/1999")',
  14249. email: 'Inserire un indirizzo email valido. Per esempio "nome@dominio.com".',
  14250. url: 'Inserire un indirizzo valido. Per esempio "http://www.example.com".',
  14251. currencyDollar: 'Inserire un importo valido. Per esempio "$100.00".',
  14252. oneRequired: 'Completare almeno uno dei campi richiesti.',
  14253. errorPrefix: 'Errore: ',
  14254. warningPrefix: 'Attenzione: ',
  14255. // Form.Validator.Extras
  14256. noSpace: 'Non sono consentiti spazi.',
  14257. reqChkByNode: 'Nessuna voce selezionata.',
  14258. requiredChk: 'Il campo &egrave; obbligatorio.',
  14259. reqChkByName: 'Selezionare un(a) {label}.',
  14260. match: 'Il valore deve corrispondere al campo {matchName}',
  14261. startDate: "data d'inizio",
  14262. endDate: 'data di fine',
  14263. currentDate: 'data attuale',
  14264. afterDate: 'La data deve corrispondere o essere successiva al {label}.',
  14265. beforeDate: 'La data deve corrispondere o essere precedente al {label}.',
  14266. startMonth: "Selezionare un mese d'inizio",
  14267. sameMonth: 'Le due date devono essere dello stesso mese - occorre modificarne una.'
  14268. });
  14269. /*
  14270. ---
  14271. name: Locale.ja-JP.Date
  14272. description: Date messages for Japanese.
  14273. license: MIT-style license
  14274. authors:
  14275. - Noritaka Horio
  14276. requires:
  14277. - Locale
  14278. provides: [Locale.ja-JP.Date]
  14279. ...
  14280. */
  14281. Locale.define('ja-JP', 'Date', {
  14282. months: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  14283. months_abbr: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  14284. days: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
  14285. days_abbr: ['日', '月', '火', '水', '木', '金', '土'],
  14286. // Culture's date order: YYYY/MM/DD
  14287. dateOrder: ['year', 'month', 'date'],
  14288. shortDate: '%Y/%m/%d',
  14289. shortTime: '%H:%M',
  14290. AM: '午前',
  14291. PM: '午後',
  14292. firstDayOfWeek: 0,
  14293. // Date.Extras
  14294. ordinal: '',
  14295. lessThanMinuteAgo: '1分以内前',
  14296. minuteAgo: '約1分前',
  14297. minutesAgo: '約{delta}分前',
  14298. hourAgo: '約1時間前',
  14299. hoursAgo: '約{delta}時間前',
  14300. dayAgo: '1日前',
  14301. daysAgo: '{delta}日前',
  14302. weekAgo: '1週間前',
  14303. weeksAgo: '{delta}週間前',
  14304. monthAgo: '1ヶ月前',
  14305. monthsAgo: '{delta}ヶ月前',
  14306. yearAgo: '1年前',
  14307. yearsAgo: '{delta}年前',
  14308. lessThanMinuteUntil: '今から約1分以内',
  14309. minuteUntil: '今から約1分',
  14310. minutesUntil: '今から約{delta}分',
  14311. hourUntil: '今から約1時間',
  14312. hoursUntil: '今から約{delta}時間',
  14313. dayUntil: '今から1日間',
  14314. daysUntil: '今から{delta}日間',
  14315. weekUntil: '今から1週間',
  14316. weeksUntil: '今から{delta}週間',
  14317. monthUntil: '今から1ヶ月',
  14318. monthsUntil: '今から{delta}ヶ月',
  14319. yearUntil: '今から1年',
  14320. yearsUntil: '今から{delta}年'
  14321. });
  14322. /*
  14323. ---
  14324. name: Locale.ja-JP.Form.Validator
  14325. description: Form Validator messages for Japanese.
  14326. license: MIT-style license
  14327. authors:
  14328. - Noritaka Horio
  14329. requires:
  14330. - Locale
  14331. provides: [Locale.ja-JP.Form.Validator]
  14332. ...
  14333. */
  14334. Locale.define('ja-JP', 'FormValidator', {
  14335. required: '入力は必須です。',
  14336. minLength: '入力文字数は{minLength}以上にしてください。({length}文字)',
  14337. maxLength: '入力文字数は{maxLength}以下にしてください。({length}文字)',
  14338. integer: '整数を入力してください。',
  14339. numeric: '入力できるのは数値だけです。(例: "1", "1.1", "-1", "-1.1"....)',
  14340. digits: '入力できるのは数値と句読記号です。 (例: -や+を含む電話番号など).',
  14341. alpha: '入力できるのは半角英字だけです。それ以外の文字は入力できません。',
  14342. alphanum: '入力できるのは半角英数字だけです。それ以外の文字は入力できません。',
  14343. dateSuchAs: '有効な日付を入力してください。{date}',
  14344. dateInFormatMDY: '日付の書式に誤りがあります。YYYY/MM/DD (i.e. "1999/12/31")',
  14345. email: 'メールアドレスに誤りがあります。',
  14346. url: 'URLアドレスに誤りがあります。',
  14347. currencyDollar: '金額に誤りがあります。',
  14348. oneRequired: 'ひとつ以上入力してください。',
  14349. errorPrefix: 'エラー: ',
  14350. warningPrefix: '警告: ',
  14351. // FormValidator.Extras
  14352. noSpace: 'スペースは入力できません。',
  14353. reqChkByNode: '選択されていません。',
  14354. requiredChk: 'この項目は必須です。',
  14355. reqChkByName: '{label}を選択してください。',
  14356. match: '{matchName}が入力されている場合必須です。',
  14357. startDate: '開始日',
  14358. endDate: '終了日',
  14359. currentDate: '今日',
  14360. afterDate: '{label}以降の日付にしてください。',
  14361. beforeDate: '{label}以前の日付にしてください。',
  14362. startMonth: '開始月を選択してください。',
  14363. sameMonth: '日付が同一です。どちらかを変更してください。'
  14364. });
  14365. /*
  14366. ---
  14367. name: Locale.ja-JP.Number
  14368. description: Number messages for Japanese.
  14369. license: MIT-style license
  14370. authors:
  14371. - Noritaka Horio
  14372. requires:
  14373. - Locale
  14374. provides: [Locale.ja-JP.Number]
  14375. ...
  14376. */
  14377. Locale.define('ja-JP', 'Number', {
  14378. decimal: '.',
  14379. group: ',',
  14380. currency: {
  14381. decimals: 0,
  14382. prefix: '\\'
  14383. }
  14384. });
  14385. /*
  14386. ---
  14387. name: Locale.nl-NL.Date
  14388. description: Date messages for Dutch.
  14389. license: MIT-style license
  14390. authors:
  14391. - Lennart Pilon
  14392. - Tim Wienk
  14393. requires:
  14394. - Locale
  14395. provides: [Locale.nl-NL.Date]
  14396. ...
  14397. */
  14398. Locale.define('nl-NL', 'Date', {
  14399. months: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
  14400. months_abbr: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
  14401. days: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
  14402. days_abbr: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
  14403. // Culture's date order: DD-MM-YYYY
  14404. dateOrder: ['date', 'month', 'year'],
  14405. shortDate: '%d-%m-%Y',
  14406. shortTime: '%H:%M',
  14407. AM: 'AM',
  14408. PM: 'PM',
  14409. firstDayOfWeek: 1,
  14410. // Date.Extras
  14411. ordinal: 'e',
  14412. lessThanMinuteAgo: 'minder dan een minuut geleden',
  14413. minuteAgo: 'ongeveer een minuut geleden',
  14414. minutesAgo: '{delta} minuten geleden',
  14415. hourAgo: 'ongeveer een uur geleden',
  14416. hoursAgo: 'ongeveer {delta} uur geleden',
  14417. dayAgo: 'een dag geleden',
  14418. daysAgo: '{delta} dagen geleden',
  14419. weekAgo: 'een week geleden',
  14420. weeksAgo: '{delta} weken geleden',
  14421. monthAgo: 'een maand geleden',
  14422. monthsAgo: '{delta} maanden geleden',
  14423. yearAgo: 'een jaar geleden',
  14424. yearsAgo: '{delta} jaar geleden',
  14425. lessThanMinuteUntil: 'over minder dan een minuut',
  14426. minuteUntil: 'over ongeveer een minuut',
  14427. minutesUntil: 'over {delta} minuten',
  14428. hourUntil: 'over ongeveer een uur',
  14429. hoursUntil: 'over {delta} uur',
  14430. dayUntil: 'over ongeveer een dag',
  14431. daysUntil: 'over {delta} dagen',
  14432. weekUntil: 'over een week',
  14433. weeksUntil: 'over {delta} weken',
  14434. monthUntil: 'over een maand',
  14435. monthsUntil: 'over {delta} maanden',
  14436. yearUntil: 'over een jaar',
  14437. yearsUntil: 'over {delta} jaar'
  14438. });
  14439. /*
  14440. ---
  14441. name: Locale.nl-NL.Form.Validator
  14442. description: Form Validator messages for Dutch.
  14443. license: MIT-style license
  14444. authors:
  14445. - Lennart Pilon
  14446. - Arian Stolwijk
  14447. - Tim Wienk
  14448. requires:
  14449. - Locale
  14450. provides: [Locale.nl-NL.Form.Validator]
  14451. ...
  14452. */
  14453. Locale.define('nl-NL', 'FormValidator', {
  14454. required: 'Dit veld is verplicht.',
  14455. length: 'Vul precies {length} karakters in (je hebt {elLength} karakters ingevoerd).',
  14456. minLength: 'Vul minimaal {minLength} karakters in (je hebt {length} karakters ingevoerd).',
  14457. maxLength: 'Vul niet meer dan {maxLength} karakters in (je hebt {length} karakters ingevoerd).',
  14458. integer: 'Vul een getal in. Getallen met decimalen (bijvoorbeeld 1.25) zijn niet toegestaan.',
  14459. numeric: 'Vul alleen numerieke waarden in (bijvoorbeeld "1" of "1.1" of "-1" of "-1.1").',
  14460. digits: 'Vul alleen nummers en leestekens in (bijvoorbeeld een telefoonnummer met streepjes is toegestaan).',
  14461. alpha: 'Vul alleen letters in (a-z). Spaties en andere karakters zijn niet toegestaan.',
  14462. alphanum: 'Vul alleen letters (a-z) of nummers (0-9) in. Spaties en andere karakters zijn niet toegestaan.',
  14463. dateSuchAs: 'Vul een geldige datum in, zoals {date}',
  14464. dateInFormatMDY: 'Vul een geldige datum, in het formaat MM/DD/YYYY (bijvoorbeeld "12/31/1999")',
  14465. email: 'Vul een geldig e-mailadres in. Bijvoorbeeld "fred@domein.nl".',
  14466. url: 'Vul een geldige URL in, zoals http://www.example.com.',
  14467. currencyDollar: 'Vul een geldig $ bedrag in. Bijvoorbeeld $100.00 .',
  14468. oneRequired: 'Vul iets in bij in ieder geval een van deze velden.',
  14469. warningPrefix: 'Waarschuwing: ',
  14470. errorPrefix: 'Fout: ',
  14471. // Form.Validator.Extras
  14472. noSpace: 'Spaties zijn niet toegestaan in dit veld.',
  14473. reqChkByNode: 'Er zijn geen items geselecteerd.',
  14474. requiredChk: 'Dit veld is verplicht.',
  14475. reqChkByName: 'Selecteer een {label}.',
  14476. match: 'Dit veld moet overeen komen met het {matchName} veld',
  14477. startDate: 'de begin datum',
  14478. endDate: 'de eind datum',
  14479. currentDate: 'de huidige datum',
  14480. afterDate: 'De datum moet hetzelfde of na {label} zijn.',
  14481. beforeDate: 'De datum moet hetzelfde of voor {label} zijn.',
  14482. startMonth: 'Selecteer een begin maand',
  14483. sameMonth: 'Deze twee data moeten in dezelfde maand zijn - u moet een van beide aanpassen.',
  14484. creditcard: 'Het ingevulde creditcardnummer is niet geldig. Controleer het nummer en probeer opnieuw. {length} getallen ingevuld.'
  14485. });
  14486. /*
  14487. ---
  14488. name: Locale.nl-NL.Number
  14489. description: Number messages for Dutch.
  14490. license: MIT-style license
  14491. authors:
  14492. - Arian Stolwijk
  14493. requires:
  14494. - Locale
  14495. - Locale.EU.Number
  14496. provides: [Locale.nl-NL.Number]
  14497. ...
  14498. */
  14499. Locale.define('nl-NL').inherit('EU', 'Number');
  14500. /*
  14501. ---
  14502. name: Locale.no-NO.Date
  14503. description: Date messages for Norwegian.
  14504. license: MIT-style license
  14505. authors:
  14506. - Espen 'Rexxars' Hovlandsdal
  14507. - Ole Tøsse Kolvik
  14508. requires:
  14509. - Locale
  14510. provides: [Locale.no-NO.Date]
  14511. ...
  14512. */
  14513. Locale.define('no-NO', 'Date', {
  14514. months: ['Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'],
  14515. months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
  14516. days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
  14517. days_abbr: ['Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'],
  14518. // Culture's date order: DD.MM.YYYY
  14519. dateOrder: ['date', 'month', 'year'],
  14520. shortDate: '%d.%m.%Y',
  14521. shortTime: '%H:%M',
  14522. AM: 'AM',
  14523. PM: 'PM',
  14524. firstDayOfWeek: 1,
  14525. lessThanMinuteAgo: 'mindre enn et minutt siden',
  14526. minuteAgo: 'omtrent et minutt siden',
  14527. minutesAgo: '{delta} minutter siden',
  14528. hourAgo: 'omtrent en time siden',
  14529. hoursAgo: 'omtrent {delta} timer siden',
  14530. dayAgo: '{delta} dag siden',
  14531. daysAgo: '{delta} dager siden',
  14532. weekAgo: 'en uke siden',
  14533. weeksAgo: '{delta} uker siden',
  14534. monthAgo: 'en måned siden',
  14535. monthsAgo: '{delta} måneder siden',
  14536. yearAgo: 'ett år siden',
  14537. yearsAgo: '{delta} år siden',
  14538. lessThanMinuteUntil: 'mindre enn et minutt til',
  14539. minuteUntil: 'omtrent et minutt til',
  14540. minutesUntil: '{delta} minutter til',
  14541. hourUntil: 'omtrent en time til',
  14542. hoursUntil: 'omtrent {delta} timer til',
  14543. dayUntil: 'en dag til',
  14544. daysUntil: '{delta} dager til',
  14545. weekUntil: 'en uke til',
  14546. weeksUntil: '{delta} uker til',
  14547. monthUntil: 'en måned til',
  14548. monthsUntil: '{delta} måneder til',
  14549. yearUntil: 'et år til',
  14550. yearsUntil: '{delta} år til'
  14551. });
  14552. /*
  14553. ---
  14554. name: Locale.no-NO.Form.Validator
  14555. description: Form Validator messages for Norwegian.
  14556. license: MIT-style license
  14557. authors:
  14558. - Aaron Newton
  14559. - Espen 'Rexxars' Hovlandsdal
  14560. - Ole Tøsse Kolvik
  14561. requires:
  14562. - Locale
  14563. provides: [Locale.no-NO.Form.Validator]
  14564. ...
  14565. */
  14566. Locale.define('no-NO', 'FormValidator', {
  14567. required: 'Dette feltet er påkrevd.',
  14568. length: 'Skriv inn {length} tegn (du skrev {elLength} tegn)',
  14569. minLength: 'Skriv inn minst {minLength} tegn (du skrev {length} tegn).',
  14570. maxLength: 'Ikke skriv mer enn {maxLength} tegn (du skrev {length} tegn).',
  14571. integer: 'Skriv inn et tall i dette feltet. Tall med desimaler (f.eks. 1,25) er ikke tillat.',
  14572. numeric: 'Skriv kun inn numeriske verdier i dette feltet (f.eks. "1", "1.1", "-1" eller "-1.1").',
  14573. digits: 'Skriv kun nummer og skilletegn i dette feltet.',
  14574. alpha: 'Skriv kun bokstaver (a-å) i dette feltet. Ingen mellomrom eller andre tegn er tillat.',
  14575. alphanum: 'Skriv kun bokstaver (a-å) eller nummer (0-9) i dette feltet. Ingen mellomrom eller andre tegn er tillat.',
  14576. dateSuchAs: 'Skriv inn en gyldig dato, som f.eks. {date}',
  14577. dateInFormatMDY: 'Skriv inn en gyldig dato, f.eks. DD/MM/YYYY ("31/12/1999")',
  14578. email: 'Skriv inn en gyldig epost-adresse. F.eks. "ola.nordmann@example.com".',
  14579. url: 'Skriv inn en gyldig URL, f.eks. http://www.example.com.',
  14580. currencyDollar: 'Skriv inn et gyldig beløp. F.eks. 100,00.',
  14581. oneRequired: 'Minst ett av disse feltene må fylles ut.',
  14582. errorPrefix: 'Feil: ',
  14583. warningPrefix: 'Advarsel: ',
  14584. // Form.Validator.Extras
  14585. noSpace: 'Mellomrom er ikke tillatt i dette feltet.',
  14586. reqChkByNode: 'Ingen objekter er valgt.',
  14587. requiredChk: 'Dette feltet er påkrevd.',
  14588. reqChkByName: 'Velg en {label}.',
  14589. match: 'Dette feltet må være lik {matchName}',
  14590. startDate: 'startdato',
  14591. endDate: 'sluttdato',
  14592. currentDate: 'dagens dato',
  14593. afterDate: 'Datoen må være den samme som eller etter {label}.',
  14594. beforeDate: 'Datoen må være den samme som eller før {label}.',
  14595. startMonth: 'Velg en startmåned',
  14596. sameMonth: 'Datoene må være i den samme måneden - velg den ene eller den andre.',
  14597. creditcard: 'Kortnummeret du skrev inn er ikke gyldig. Prøv igjen. Du skrev {length} siffer.'
  14598. });
  14599. /*
  14600. ---
  14601. name: Locale.no-NO.Number
  14602. description: Number messages for Norwegian.
  14603. license: MIT-style license
  14604. authors:
  14605. - Arian Stolwijk
  14606. - Martin Lundgren
  14607. - Ole T�sse Kolvik
  14608. requires:
  14609. - Locale
  14610. - Locale.EU.Number
  14611. provides: [Locale.no-NO.Number]
  14612. ...
  14613. */
  14614. Locale.define('no-NO', 'Number', {
  14615. currency: {
  14616. prefix: 'NOK '
  14617. }
  14618. }).inherit('EU', 'Number');
  14619. /*
  14620. ---
  14621. name: Locale.pl-PL.Date
  14622. description: Date messages for Polish.
  14623. license: MIT-style license
  14624. authors:
  14625. - Oskar Krawczyk
  14626. requires:
  14627. - Locale
  14628. provides: [Locale.pl-PL.Date]
  14629. ...
  14630. */
  14631. Locale.define('pl-PL', 'Date', {
  14632. months: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'],
  14633. months_abbr: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
  14634. days: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],
  14635. days_abbr: ['niedz.', 'pon.', 'wt.', 'śr.', 'czw.', 'pt.', 'sob.'],
  14636. // Culture's date order: YYYY-MM-DD
  14637. dateOrder: ['year', 'month', 'date'],
  14638. shortDate: '%Y-%m-%d',
  14639. shortTime: '%H:%M',
  14640. AM: 'nad ranem',
  14641. PM: 'po południu',
  14642. firstDayOfWeek: 1,
  14643. // Date.Extras
  14644. ordinal: function(dayOfMonth){
  14645. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ty' : ['ty', 'szy', 'gi', 'ci', 'ty'][Math.min(dayOfMonth % 10, 4)];
  14646. },
  14647. lessThanMinuteAgo: 'mniej niż minute temu',
  14648. minuteAgo: 'około minutę temu',
  14649. minutesAgo: '{delta} minut temu',
  14650. hourAgo: 'około godzinę temu',
  14651. hoursAgo: 'około {delta} godzin temu',
  14652. dayAgo: 'Wczoraj',
  14653. daysAgo: '{delta} dni temu',
  14654. lessThanMinuteUntil: 'za niecałą minutę',
  14655. minuteUntil: 'za około minutę',
  14656. minutesUntil: 'za {delta} minut',
  14657. hourUntil: 'za około godzinę',
  14658. hoursUntil: 'za około {delta} godzin',
  14659. dayUntil: 'za 1 dzień',
  14660. daysUntil: 'za {delta} dni'
  14661. });
  14662. /*
  14663. ---
  14664. name: Locale.pl-PL.Form.Validator
  14665. description: Form Validator messages for Polish.
  14666. license: MIT-style license
  14667. authors:
  14668. - Oskar Krawczyk
  14669. requires:
  14670. - Locale
  14671. provides: [Locale.pl-PL.Form.Validator]
  14672. ...
  14673. */
  14674. Locale.define('pl-PL', 'FormValidator', {
  14675. required: 'To pole jest wymagane.',
  14676. minLength: 'Wymagane jest przynajmniej {minLength} znaków (wpisanych zostało tylko {length}).',
  14677. maxLength: 'Dozwolone jest nie więcej niż {maxLength} znaków (wpisanych zostało {length})',
  14678. integer: 'To pole wymaga liczb całych. Liczby dziesiętne (np. 1.25) są niedozwolone.',
  14679. numeric: 'Prosimy używać tylko numerycznych wartości w tym polu (np. "1", "1.1", "-1" lub "-1.1").',
  14680. digits: 'Prosimy używać liczb oraz zankow punktuacyjnych w typ polu (dla przykładu, przy numerze telefonu myślniki i kropki są dozwolone).',
  14681. alpha: 'Prosimy używać tylko liter (a-z) w tym polu. Spacje oraz inne znaki są niedozwolone.',
  14682. alphanum: 'Prosimy używać tylko liter (a-z) lub liczb (0-9) w tym polu. Spacje oraz inne znaki są niedozwolone.',
  14683. dateSuchAs: 'Prosimy podać prawidłową datę w formacie: {date}',
  14684. dateInFormatMDY: 'Prosimy podać poprawną date w formacie DD.MM.RRRR (i.e. "12.01.2009")',
  14685. email: 'Prosimy podać prawidłowy adres e-mail, np. "jan@domena.pl".',
  14686. url: 'Prosimy podać prawidłowy adres URL, np. http://www.example.com.',
  14687. currencyDollar: 'Prosimy podać prawidłową sumę w PLN. Dla przykładu: 100.00 PLN.',
  14688. oneRequired: 'Prosimy wypełnić chociaż jedno z pól.',
  14689. errorPrefix: 'Błąd: ',
  14690. warningPrefix: 'Uwaga: ',
  14691. // Form.Validator.Extras
  14692. noSpace: 'W tym polu nie mogą znajdować się spacje.',
  14693. reqChkByNode: 'Brak zaznaczonych elementów.',
  14694. requiredChk: 'To pole jest wymagane.',
  14695. reqChkByName: 'Prosimy wybrać z {label}.',
  14696. match: 'To pole musi być takie samo jak {matchName}',
  14697. startDate: 'data początkowa',
  14698. endDate: 'data końcowa',
  14699. currentDate: 'aktualna data',
  14700. afterDate: 'Podana data poinna być taka sama lub po {label}.',
  14701. beforeDate: 'Podana data poinna być taka sama lub przed {label}.',
  14702. startMonth: 'Prosimy wybrać początkowy miesiąc.',
  14703. sameMonth: 'Te dwie daty muszą być w zakresie tego samego miesiąca - wymagana jest zmiana któregoś z pól.'
  14704. });
  14705. /*
  14706. ---
  14707. name: Locale.pt-PT.Date
  14708. description: Date messages for Portuguese.
  14709. license: MIT-style license
  14710. authors:
  14711. - Fabio Miranda Costa
  14712. requires:
  14713. - Locale
  14714. provides: [Locale.pt-PT.Date]
  14715. ...
  14716. */
  14717. Locale.define('pt-PT', 'Date', {
  14718. months: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
  14719. months_abbr: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
  14720. days: ['Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'],
  14721. days_abbr: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
  14722. // Culture's date order: DD-MM-YYYY
  14723. dateOrder: ['date', 'month', 'year'],
  14724. shortDate: '%d-%m-%Y',
  14725. shortTime: '%H:%M',
  14726. AM: 'AM',
  14727. PM: 'PM',
  14728. firstDayOfWeek: 1,
  14729. // Date.Extras
  14730. ordinal: 'º',
  14731. lessThanMinuteAgo: 'há menos de um minuto',
  14732. minuteAgo: 'há cerca de um minuto',
  14733. minutesAgo: 'há {delta} minutos',
  14734. hourAgo: 'há cerca de uma hora',
  14735. hoursAgo: 'há cerca de {delta} horas',
  14736. dayAgo: 'há um dia',
  14737. daysAgo: 'há {delta} dias',
  14738. weekAgo: 'há uma semana',
  14739. weeksAgo: 'há {delta} semanas',
  14740. monthAgo: 'há um mês',
  14741. monthsAgo: 'há {delta} meses',
  14742. yearAgo: 'há um ano',
  14743. yearsAgo: 'há {delta} anos',
  14744. lessThanMinuteUntil: 'em menos de um minuto',
  14745. minuteUntil: 'em um minuto',
  14746. minutesUntil: 'em {delta} minutos',
  14747. hourUntil: 'em uma hora',
  14748. hoursUntil: 'em {delta} horas',
  14749. dayUntil: 'em um dia',
  14750. daysUntil: 'em {delta} dias',
  14751. weekUntil: 'em uma semana',
  14752. weeksUntil: 'em {delta} semanas',
  14753. monthUntil: 'em um mês',
  14754. monthsUntil: 'em {delta} meses',
  14755. yearUntil: 'em um ano',
  14756. yearsUntil: 'em {delta} anos'
  14757. });
  14758. /*
  14759. ---
  14760. name: Locale.pt-BR.Date
  14761. description: Date messages for Portuguese (Brazil).
  14762. license: MIT-style license
  14763. authors:
  14764. - Fabio Miranda Costa
  14765. requires:
  14766. - Locale
  14767. - Locale.pt-PT.Date
  14768. provides: [Locale.pt-BR.Date]
  14769. ...
  14770. */
  14771. Locale.define('pt-BR', 'Date', {
  14772. // Culture's date order: DD/MM/YYYY
  14773. shortDate: '%d/%m/%Y'
  14774. }).inherit('pt-PT', 'Date');
  14775. /*
  14776. ---
  14777. name: Locale.pt-BR.Form.Validator
  14778. description: Form Validator messages for Portuguese (Brazil).
  14779. license: MIT-style license
  14780. authors:
  14781. - Fábio Miranda Costa
  14782. requires:
  14783. - Locale
  14784. provides: [Locale.pt-BR.Form.Validator]
  14785. ...
  14786. */
  14787. Locale.define('pt-BR', 'FormValidator', {
  14788. required: 'Este campo é obrigatório.',
  14789. minLength: 'Digite pelo menos {minLength} caracteres (tamanho atual: {length}).',
  14790. maxLength: 'Não digite mais de {maxLength} caracteres (tamanho atual: {length}).',
  14791. integer: 'Por favor digite apenas um número inteiro neste campo. Não são permitidos números decimais (por exemplo, 1,25).',
  14792. numeric: 'Por favor digite apenas valores numéricos neste campo (por exemplo, "1" ou "1.1" ou "-1" ou "-1,1").',
  14793. 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).',
  14794. alpha: 'Por favor use somente letras (a-z). Espaço e outros caracteres não são permitidos.',
  14795. alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Espaço e outros caracteres não são permitidos.',
  14796. dateSuchAs: 'Digite uma data válida, como {date}',
  14797. dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (por exemplo, "31/12/1999")',
  14798. email: 'Digite um endereço de email válido. Por exemplo "nome@dominio.com".',
  14799. url: 'Digite uma URL válida. Exemplo: http://www.example.com.',
  14800. currencyDollar: 'Digite um valor em dinheiro válido. Exemplo: R$100,00 .',
  14801. oneRequired: 'Digite algo para pelo menos um desses campos.',
  14802. errorPrefix: 'Erro: ',
  14803. warningPrefix: 'Aviso: ',
  14804. // Form.Validator.Extras
  14805. noSpace: 'Não é possível digitar espaços neste campo.',
  14806. reqChkByNode: 'Não foi selecionado nenhum item.',
  14807. requiredChk: 'Este campo é obrigatório.',
  14808. reqChkByName: 'Por favor digite um {label}.',
  14809. match: 'Este campo deve ser igual ao campo {matchName}.',
  14810. startDate: 'a data inicial',
  14811. endDate: 'a data final',
  14812. currentDate: 'a data atual',
  14813. afterDate: 'A data deve ser igual ou posterior a {label}.',
  14814. beforeDate: 'A data deve ser igual ou anterior a {label}.',
  14815. startMonth: 'Por favor selecione uma data inicial.',
  14816. sameMonth: 'Estas duas datas devem ter o mesmo mês - você deve modificar uma das duas.',
  14817. 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.'
  14818. });
  14819. /*
  14820. ---
  14821. name: Locale.pt-BR.Number
  14822. description: Number messages for PT Brazilian.
  14823. license: MIT-style license
  14824. authors:
  14825. - Arian Stolwijk
  14826. - Danillo César
  14827. requires:
  14828. - Locale
  14829. provides: [Locale.pt-BR.Number]
  14830. ...
  14831. */
  14832. Locale.define('pt-BR', 'Number', {
  14833. decimal: ',',
  14834. group: '.',
  14835. currency: {
  14836. prefix: 'R$ '
  14837. }
  14838. });
  14839. /*
  14840. ---
  14841. name: Locale.pt-PT.Form.Validator
  14842. description: Form Validator messages for Portuguese.
  14843. license: MIT-style license
  14844. authors:
  14845. - Miquel Hudin
  14846. requires:
  14847. - Locale
  14848. provides: [Locale.pt-PT.Form.Validator]
  14849. ...
  14850. */
  14851. Locale.define('pt-PT', 'FormValidator', {
  14852. required: 'Este campo é necessário.',
  14853. minLength: 'Digite pelo menos{minLength} caracteres (comprimento {length} caracteres).',
  14854. maxLength: 'Não insira mais de {maxLength} caracteres (comprimento {length} caracteres).',
  14855. integer: 'Digite um número inteiro neste domínio. Com números decimais (por exemplo, 1,25), não são permitidas.',
  14856. numeric: 'Digite apenas valores numéricos neste domínio (p.ex., "1" ou "1.1" ou "-1" ou "-1,1").',
  14857. 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).',
  14858. alpha: 'Por favor use somente letras (a-z), com nesta área. Não utilize espaços nem outros caracteres são permitidos.',
  14859. alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Não utilize espaços nem outros caracteres são permitidos.',
  14860. dateSuchAs: 'Digite uma data válida, como {date}',
  14861. dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (p.ex. "31/12/1999")',
  14862. email: 'Digite um endereço de email válido. Por exemplo "fred@domain.com".',
  14863. url: 'Digite uma URL válida, como http://www.example.com.',
  14864. currencyDollar: 'Digite um valor válido $. Por exemplo $ 100,00. ',
  14865. oneRequired: 'Digite algo para pelo menos um desses insumos.',
  14866. errorPrefix: 'Erro: ',
  14867. warningPrefix: 'Aviso: '
  14868. });
  14869. /*
  14870. ---
  14871. name: Locale.ru-RU-unicode.Date
  14872. description: Date messages for Russian (utf-8).
  14873. license: MIT-style license
  14874. authors:
  14875. - Evstigneev Pavel
  14876. - Kuryanovich Egor
  14877. requires:
  14878. - Locale
  14879. provides: [Locale.ru-RU.Date]
  14880. ...
  14881. */
  14882. (function(){
  14883. // Russian language pluralization rules, taken from CLDR project, http://unicode.org/cldr/
  14884. // one -> n mod 10 is 1 and n mod 100 is not 11;
  14885. // few -> n mod 10 in 2..4 and n mod 100 not in 12..14;
  14886. // many -> n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14;
  14887. // other -> everything else (example 3.14)
  14888. var pluralize = function(n, one, few, many, other){
  14889. var modulo10 = n % 10,
  14890. modulo100 = n % 100;
  14891. if (modulo10 == 1 && modulo100 != 11){
  14892. return one;
  14893. } else if ((modulo10 == 2 || modulo10 == 3 || modulo10 == 4) && !(modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){
  14894. return few;
  14895. } else if (modulo10 == 0 || (modulo10 == 5 || modulo10 == 6 || modulo10 == 7 || modulo10 == 8 || modulo10 == 9) || (modulo100 == 11 || modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){
  14896. return many;
  14897. } else {
  14898. return other;
  14899. }
  14900. };
  14901. Locale.define('ru-RU', 'Date', {
  14902. months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],
  14903. months_abbr: ['янв', 'февр', 'март', 'апр', 'май','июнь','июль','авг','сент','окт','нояб','дек'],
  14904. days: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
  14905. days_abbr: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
  14906. // Culture's date order: DD.MM.YYYY
  14907. dateOrder: ['date', 'month', 'year'],
  14908. shortDate: '%d.%m.%Y',
  14909. shortTime: '%H:%M',
  14910. AM: 'AM',
  14911. PM: 'PM',
  14912. firstDayOfWeek: 1,
  14913. // Date.Extras
  14914. ordinal: '',
  14915. lessThanMinuteAgo: 'меньше минуты назад',
  14916. minuteAgo: 'минуту назад',
  14917. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'минуту', 'минуты', 'минут') + ' назад'; },
  14918. hourAgo: 'час назад',
  14919. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'час', 'часа', 'часов') + ' назад'; },
  14920. dayAgo: 'вчера',
  14921. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'день', 'дня', 'дней') + ' назад'; },
  14922. weekAgo: 'неделю назад',
  14923. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'неделя', 'недели', 'недель') + ' назад'; },
  14924. monthAgo: 'месяц назад',
  14925. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'месяц', 'месяца', 'месяцев') + ' назад'; },
  14926. yearAgo: 'год назад',
  14927. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'год', 'года', 'лет') + ' назад'; },
  14928. lessThanMinuteUntil: 'меньше чем через минуту',
  14929. minuteUntil: 'через минуту',
  14930. minutesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'минуту', 'минуты', 'минут') + ''; },
  14931. hourUntil: 'через час',
  14932. hoursUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'час', 'часа', 'часов') + ''; },
  14933. dayUntil: 'завтра',
  14934. daysUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'день', 'дня', 'дней') + ''; },
  14935. weekUntil: 'через неделю',
  14936. weeksUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'неделю', 'недели', 'недель') + ''; },
  14937. monthUntil: 'через месяц',
  14938. monthsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'месяц', 'месяца', 'месяцев') + ''; },
  14939. yearUntil: 'через',
  14940. yearsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'год', 'года', 'лет') + ''; }
  14941. });
  14942. //<1.2compat>
  14943. Locale.define('ru-RU-unicode').inherit('ru-RU', 'Date');
  14944. //</1.2compat>
  14945. })();
  14946. /*
  14947. ---
  14948. name: Locale.ru-RU-unicode.Form.Validator
  14949. description: Form Validator messages for Russian (utf-8).
  14950. license: MIT-style license
  14951. authors:
  14952. - Chernodarov Egor
  14953. requires:
  14954. - Locale
  14955. provides: [Locale.ru-RU.Form.Validator]
  14956. ...
  14957. */
  14958. Locale.define('ru-RU', 'FormValidator', {
  14959. required: 'Это поле обязательно к заполнению.',
  14960. minLength: 'Пожалуйста, введите хотя бы {minLength} символов (Вы ввели {length}).',
  14961. maxLength: 'Пожалуйста, введите не больше {maxLength} символов (Вы ввели {length}).',
  14962. integer: 'Пожалуйста, введите в это поле число. Дробные числа (например 1.25) тут не разрешены.',
  14963. numeric: 'Пожалуйста, введите в это поле число (например "1" или "1.1", или "-1", или "-1.1").',
  14964. digits: 'В этом поле Вы можете использовать только цифры и знаки пунктуации (например, телефонный номер со знаками дефиса или с точками).',
  14965. alpha: 'В этом поле можно использовать только латинские буквы (a-z). Пробелы и другие символы запрещены.',
  14966. alphanum: 'В этом поле можно использовать только латинские буквы (a-z) и цифры (0-9). Пробелы и другие символы запрещены.',
  14967. dateSuchAs: 'Пожалуйста, введите корректную дату {date}',
  14968. dateInFormatMDY: 'Пожалуйста, введите дату в формате ММ/ДД/ГГГГ (например "12/31/1999")',
  14969. email: 'Пожалуйста, введите корректный емейл-адрес. Для примера "fred@domain.com".',
  14970. url: 'Пожалуйста, введите правильную ссылку вида http://www.example.com.',
  14971. currencyDollar: 'Пожалуйста, введите сумму в долларах. Например: $100.00 .',
  14972. oneRequired: 'Пожалуйста, выберите хоть что-нибудь в одном из этих полей.',
  14973. errorPrefix: 'Ошибка: ',
  14974. warningPrefix: 'Внимание: '
  14975. });
  14976. //<1.2compat>
  14977. Locale.define('ru-RU-unicode').inherit('ru-RU', 'FormValidator');
  14978. //</1.2compat>
  14979. /*
  14980. ---
  14981. name: Locale.sk-SK.Date
  14982. description: Date messages for Slovak.
  14983. license: MIT-style license
  14984. authors:
  14985. - Ivan Masár
  14986. requires:
  14987. - Locale
  14988. provides: [Locale.sk-SK.Date]
  14989. ...
  14990. */
  14991. (function(){
  14992. // Slovak language pluralization rules, see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  14993. // one -> n is 1; 1
  14994. // few -> n in 2..4; 2-4
  14995. // other -> everything else 0, 5-999, 1.31, 2.31, 5.31...
  14996. var pluralize = function(n, one, few, other){
  14997. if (n == 1) return one;
  14998. else if (n == 2 || n == 3 || n == 4) return few;
  14999. else return other;
  15000. };
  15001. Locale.define('sk-SK', 'Date', {
  15002. months: ['Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'December'],
  15003. months_abbr: ['januára', 'februára', 'marca', 'apríla', 'mája', 'júna', 'júla', 'augusta', 'septembra', 'októbra', 'novembra', 'decembra'],
  15004. days: ['Nedele', 'Pondelí', 'Úterý', 'Streda', 'Čtvrtek', 'Pátek', 'Sobota'],
  15005. days_abbr: ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so'],
  15006. // Culture's date order: DD.MM.YYYY
  15007. dateOrder: ['date', 'month', 'year'],
  15008. shortDate: '%d.%m.%Y',
  15009. shortTime: '%H:%M',
  15010. AM: 'dop.',
  15011. PM: 'pop.',
  15012. firstDayOfWeek: 1,
  15013. // Date.Extras
  15014. ordinal: '.',
  15015. lessThanMinuteAgo: 'pred chvíľou',
  15016. minuteAgo: 'približne pred minútou',
  15017. minutesAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'minútou', 'minútami', 'minútami'); },
  15018. hourAgo: 'približne pred hodinou',
  15019. hoursAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'hodinou', 'hodinami', 'hodinami'); },
  15020. dayAgo: 'pred dňom',
  15021. daysAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'dňom', 'dňami', 'dňami'); },
  15022. weekAgo: 'pred týždňom',
  15023. weeksAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'týždňom', 'týždňami', 'týždňami'); },
  15024. monthAgo: 'pred mesiacom',
  15025. monthsAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'mesiacom', 'mesiacmi', 'mesiacmi'); },
  15026. yearAgo: 'pred rokom',
  15027. yearsAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'rokom', 'rokmi', 'rokmi'); },
  15028. lessThanMinuteUntil: 'o chvíľu',
  15029. minuteUntil: 'približne o minútu',
  15030. minutesUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'minútu', 'minúty', 'minúty'); },
  15031. hourUntil: 'približne o hodinu',
  15032. hoursUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'hodinu', 'hodiny', 'hodín'); },
  15033. dayUntil: 'o deň',
  15034. daysUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'deň', 'dni', 'dní'); },
  15035. weekUntil: 'o týždeň',
  15036. weeksUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'týždeň', 'týždne', 'týždňov'); },
  15037. monthUntil: 'o mesiac',
  15038. monthsUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'mesiac', 'mesiace', 'mesiacov'); },
  15039. yearUntil: 'o rok',
  15040. yearsUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'rok', 'roky', 'rokov'); }
  15041. });
  15042. })();
  15043. /*
  15044. ---
  15045. name: Locale.sk-SK.Form.Validator
  15046. description: Form Validator messages for Czech.
  15047. license: MIT-style license
  15048. authors:
  15049. - Ivan Masár
  15050. requires:
  15051. - Locale
  15052. provides: [Locale.sk-SK.Form.Validator]
  15053. ...
  15054. */
  15055. Locale.define('sk-SK', 'FormValidator', {
  15056. required: 'Táto položka je povinná.',
  15057. minLength: 'Zadajte prosím aspoň {minLength} znakov (momentálne {length} znakov).',
  15058. maxLength: 'Zadajte prosím menej ako {maxLength} znakov (momentálne {length} znakov).',
  15059. integer: 'Zadajte prosím celé číslo. Desetinné čísla (napr. 1.25) nie sú povolené.',
  15060. numeric: 'Zadajte len číselné hodnoty (t.j. „1“ alebo „1.1“ alebo „-1“ alebo „-1.1“).',
  15061. digits: 'Zadajte prosím len čísla a interpunkčné znamienka (napríklad telefónne číslo s pomlčkami albo bodkami je povolené).',
  15062. alpha: 'Zadajte prosím len písmená (a-z). Medzery alebo iné znaky nie sú povolené.',
  15063. alphanum: 'Zadajte prosím len písmená (a-z) alebo číslice (0-9). Medzery alebo iné znaky nie sú povolené.',
  15064. dateSuchAs: 'Zadajte prosím platný dátum v tvare {date}',
  15065. dateInFormatMDY: 'Zadajte prosím platný datum v tvare MM / DD / RRRR (t.j. „12/31/1999“)',
  15066. email: 'Zadajte prosím platnú emailovú adresu. Napríklad „fred@domain.com“.',
  15067. url: 'Zadajte prosím platnoú adresu URL v tvare http://www.example.com.',
  15068. currencyDollar: 'Zadajte prosím platnú čiastku. Napríklad $100.00.',
  15069. oneRequired: 'Zadajte prosím aspoň jednu hodnotu z týchto položiek.',
  15070. errorPrefix: 'Chyba: ',
  15071. warningPrefix: 'Upozornenie: ',
  15072. // Form.Validator.Extras
  15073. noSpace: 'V tejto položle nie sú povolené medzery',
  15074. reqChkByNode: 'Nie sú vybrané žiadne položky.',
  15075. requiredChk: 'Táto položka je povinná.',
  15076. reqChkByName: 'Prosím vyberte {label}.',
  15077. match: 'Táto položka sa musí zhodovať s položkou {matchName}',
  15078. startDate: 'dátum začiatku',
  15079. endDate: 'dátum ukončenia',
  15080. currendDate: 'aktuálny dátum',
  15081. afterDate: 'Dátum by mal býť rovnaký alebo väčší ako {label}.',
  15082. beforeDate: 'Dátum by mal byť rovnaký alebo menší ako {label}.',
  15083. startMonth: 'Vyberte počiatočný mesiac.',
  15084. sameMonth: 'Tieto dva dátumy musia býť v rovnakom mesiaci - zmeňte jeden z nich.',
  15085. creditcard: 'Zadané číslo kreditnej karty je neplatné. Prosím, opravte ho. Bolo zadaných {length} číslic.'
  15086. });
  15087. /*
  15088. ---
  15089. name: Locale.si-SI.Date
  15090. description: Date messages for Slovenian.
  15091. license: MIT-style license
  15092. authors:
  15093. - Radovan Lozej
  15094. requires:
  15095. - Locale
  15096. provides: [Locale.si-SI.Date]
  15097. ...
  15098. */
  15099. (function(){
  15100. var pluralize = function(n, one, two, three, other){
  15101. return (n >= 1 && n <= 3) ? arguments[n] : other;
  15102. };
  15103. Locale.define('sl-SI', 'Date', {
  15104. months: ['januar', 'februar', 'marec', 'april', 'maj', 'junij', 'julij', 'avgust', 'september', 'oktober', 'november', 'december'],
  15105. months_abbr: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'avg', 'sep', 'okt', 'nov', 'dec'],
  15106. days: ['nedelja', 'ponedeljek', 'torek', 'sreda', 'četrtek', 'petek', 'sobota'],
  15107. days_abbr: ['ned', 'pon', 'tor', 'sre', 'čet', 'pet', 'sob'],
  15108. // Culture's date order: DD.MM.YYYY
  15109. dateOrder: ['date', 'month', 'year'],
  15110. shortDate: '%d.%m.%Y',
  15111. shortTime: '%H.%M',
  15112. AM: 'AM',
  15113. PM: 'PM',
  15114. firstDayOfWeek: 1,
  15115. // Date.Extras
  15116. ordinal: '.',
  15117. lessThanMinuteAgo: 'manj kot minuto nazaj',
  15118. minuteAgo: 'minuto nazaj',
  15119. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'minuto', 'minuti', 'minute', 'minut') + ' nazaj'; },
  15120. hourAgo: 'uro nazaj',
  15121. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'uro', 'uri', 'ure', 'ur') + ' nazaj'; },
  15122. dayAgo: 'dan nazaj',
  15123. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'dan', 'dneva', 'dni', 'dni') + ' nazaj'; },
  15124. weekAgo: 'teden nazaj',
  15125. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'teden', 'tedna', 'tedne', 'tednov') + ' nazaj'; },
  15126. monthAgo: 'mesec nazaj',
  15127. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'mesec', 'meseca', 'mesece', 'mesecov') + ' nazaj'; },
  15128. yearthAgo: 'leto nazaj',
  15129. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'leto', 'leti', 'leta', 'let') + ' nazaj'; },
  15130. lessThanMinuteUntil: 'še manj kot minuto',
  15131. minuteUntil: 'še minuta',
  15132. minutesUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'minuta', 'minuti', 'minute', 'minut'); },
  15133. hourUntil: 'še ura',
  15134. hoursUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'ura', 'uri', 'ure', 'ur'); },
  15135. dayUntil: 'še dan',
  15136. daysUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'dan', 'dneva', 'dnevi', 'dni'); },
  15137. weekUntil: 'še tedn',
  15138. weeksUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'teden', 'tedna', 'tedni', 'tednov'); },
  15139. monthUntil: 'še mesec',
  15140. monthsUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'mesec', 'meseca', 'meseci', 'mesecov'); },
  15141. yearUntil: 'še leto',
  15142. yearsUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'leto', 'leti', 'leta', 'let'); }
  15143. });
  15144. })();
  15145. /*
  15146. ---
  15147. name: Locale.si-SI.Form.Validator
  15148. description: Form Validator messages for Slovenian.
  15149. license: MIT-style license
  15150. authors:
  15151. - Radovan Lozej
  15152. requires:
  15153. - Locale
  15154. provides: [Locale.si-SI.Form.Validator]
  15155. ...
  15156. */
  15157. Locale.define('sl-SI', 'FormValidator', {
  15158. required: 'To polje je obvezno',
  15159. minLength: 'Prosim, vnesite vsaj {minLength} znakov (vnesli ste {length} znakov).',
  15160. maxLength: 'Prosim, ne vnesite več kot {maxLength} znakov (vnesli ste {length} znakov).',
  15161. integer: 'Prosim, vnesite celo število. Decimalna števila (kot 1,25) niso dovoljena.',
  15162. numeric: 'Prosim, vnesite samo numerične vrednosti (kot "1" ali "1.1" ali "-1" ali "-1.1").',
  15163. digits: 'Prosim, uporabite številke in ločila le na tem polju (na primer, dovoljena je telefonska številka z pomišlaji ali pikami).',
  15164. alpha: 'Prosim, uporabite le črke v tem plju. Presledki in drugi znaki niso dovoljeni.',
  15165. alphanum: 'Prosim, uporabite samo črke ali številke v tem polju. Presledki in drugi znaki niso dovoljeni.',
  15166. dateSuchAs: 'Prosim, vnesite pravilen datum kot {date}',
  15167. dateInFormatMDY: 'Prosim, vnesite pravilen datum kot MM.DD.YYYY (primer "12.31.1999")',
  15168. email: 'Prosim, vnesite pravilen email naslov. Na primer "fred@domain.com".',
  15169. url: 'Prosim, vnesite pravilen URL kot http://www.example.com.',
  15170. currencyDollar: 'Prosim, vnesit epravilno vrednost €. Primer 100,00€ .',
  15171. oneRequired: 'Prosimo, vnesite nekaj za vsaj eno izmed teh polj.',
  15172. errorPrefix: 'Napaka: ',
  15173. warningPrefix: 'Opozorilo: ',
  15174. // Form.Validator.Extras
  15175. noSpace: 'To vnosno polje ne dopušča presledkov.',
  15176. reqChkByNode: 'Nič niste izbrali.',
  15177. requiredChk: 'To polje je obvezno',
  15178. reqChkByName: 'Prosim, izberite {label}.',
  15179. match: 'To polje se mora ujemati z poljem {matchName}',
  15180. startDate: 'datum začetka',
  15181. endDate: 'datum konca',
  15182. currentDate: 'trenuten datum',
  15183. afterDate: 'Datum bi moral biti isti ali po {label}.',
  15184. beforeDate: 'Datum bi moral biti isti ali pred {label}.',
  15185. startMonth: 'Prosim, vnesite začetni datum',
  15186. sameMonth: 'Ta dva datuma morata biti v istem mesecu - premeniti morate eno ali drugo.',
  15187. creditcard: 'Številka kreditne kartice ni pravilna. Preverite številko ali poskusite še enkrat. Vnešenih {length} znakov.'
  15188. });
  15189. /*
  15190. ---
  15191. name: Locale.sv-SE.Date
  15192. description: Date messages for Swedish.
  15193. license: MIT-style license
  15194. authors:
  15195. - Martin Lundgren
  15196. requires:
  15197. - Locale
  15198. provides: [Locale.sv-SE.Date]
  15199. ...
  15200. */
  15201. Locale.define('sv-SE', 'Date', {
  15202. months: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'],
  15203. months_abbr: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
  15204. days: ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'],
  15205. days_abbr: ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör'],
  15206. // Culture's date order: YYYY-MM-DD
  15207. dateOrder: ['year', 'month', 'date'],
  15208. shortDate: '%Y-%m-%d',
  15209. shortTime: '%H:%M',
  15210. AM: '',
  15211. PM: '',
  15212. firstDayOfWeek: 1,
  15213. // Date.Extras
  15214. ordinal: '',
  15215. lessThanMinuteAgo: 'mindre än en minut sedan',
  15216. minuteAgo: 'ungefär en minut sedan',
  15217. minutesAgo: '{delta} minuter sedan',
  15218. hourAgo: 'ungefär en timme sedan',
  15219. hoursAgo: 'ungefär {delta} timmar sedan',
  15220. dayAgo: '1 dag sedan',
  15221. daysAgo: '{delta} dagar sedan',
  15222. lessThanMinuteUntil: 'mindre än en minut sedan',
  15223. minuteUntil: 'ungefär en minut sedan',
  15224. minutesUntil: '{delta} minuter sedan',
  15225. hourUntil: 'ungefär en timme sedan',
  15226. hoursUntil: 'ungefär {delta} timmar sedan',
  15227. dayUntil: '1 dag sedan',
  15228. daysUntil: '{delta} dagar sedan'
  15229. });
  15230. /*
  15231. ---
  15232. name: Locale.sv-SE.Form.Validator
  15233. description: Form Validator messages for Swedish.
  15234. license: MIT-style license
  15235. authors:
  15236. - Martin Lundgren
  15237. requires:
  15238. - Locale
  15239. provides: [Locale.sv-SE.Form.Validator]
  15240. ...
  15241. */
  15242. Locale.define('sv-SE', 'FormValidator', {
  15243. required: 'Fältet är obligatoriskt.',
  15244. minLength: 'Ange minst {minLength} tecken (du angav {length} tecken).',
  15245. maxLength: 'Ange högst {maxLength} tecken (du angav {length} tecken). ',
  15246. integer: 'Ange ett heltal i fältet. Tal med decimaler (t.ex. 1,25) är inte tillåtna.',
  15247. numeric: 'Ange endast numeriska värden i detta fält (t.ex. "1" eller "1.1" eller "-1" eller "-1,1").',
  15248. digits: 'Använd endast siffror och skiljetecken i detta fält (till exempel ett telefonnummer med bindestreck tillåtet).',
  15249. alpha: 'Använd endast bokstäver (a-ö) i detta fält. Inga mellanslag eller andra tecken är tillåtna.',
  15250. alphanum: 'Använd endast bokstäver (a-ö) och siffror (0-9) i detta fält. Inga mellanslag eller andra tecken är tillåtna.',
  15251. dateSuchAs: 'Ange ett giltigt datum som t.ex. {date}',
  15252. dateInFormatMDY: 'Ange ett giltigt datum som t.ex. YYYY-MM-DD (i.e. "1999-12-31")',
  15253. email: 'Ange en giltig e-postadress. Till exempel "erik@domain.com".',
  15254. url: 'Ange en giltig webbadress som http://www.example.com.',
  15255. currencyDollar: 'Ange en giltig belopp. Exempelvis 100,00.',
  15256. oneRequired: 'Vänligen ange minst ett av dessa alternativ.',
  15257. errorPrefix: 'Fel: ',
  15258. warningPrefix: 'Varning: ',
  15259. // Form.Validator.Extras
  15260. noSpace: 'Det får inte finnas några mellanslag i detta fält.',
  15261. reqChkByNode: 'Inga objekt är valda.',
  15262. requiredChk: 'Detta är ett obligatoriskt fält.',
  15263. reqChkByName: 'Välj en {label}.',
  15264. match: 'Detta fält måste matcha {matchName}',
  15265. startDate: 'startdatumet',
  15266. endDate: 'slutdatum',
  15267. currentDate: 'dagens datum',
  15268. afterDate: 'Datumet bör vara samma eller senare än {label}.',
  15269. beforeDate: 'Datumet bör vara samma eller tidigare än {label}.',
  15270. startMonth: 'Välj en start månad',
  15271. sameMonth: 'Dessa två datum måste vara i samma månad - du måste ändra det ena eller det andra.'
  15272. });
  15273. /*
  15274. ---
  15275. name: Locale.sv-SE.Number
  15276. description: Number messages for Swedish.
  15277. license: MIT-style license
  15278. authors:
  15279. - Arian Stolwijk
  15280. - Martin Lundgren
  15281. requires:
  15282. - Locale
  15283. - Locale.EU.Number
  15284. provides: [Locale.sv-SE.Number]
  15285. ...
  15286. */
  15287. Locale.define('sv-SE', 'Number', {
  15288. currency: {
  15289. prefix: 'SEK '
  15290. }
  15291. }).inherit('EU', 'Number');
  15292. /*
  15293. ---
  15294. name: Locale.tr-TR.Date
  15295. description: Date messages for Turkish.
  15296. license: MIT-style license
  15297. authors:
  15298. - Faruk Can Bilir
  15299. requires:
  15300. - Locale
  15301. provides: [Locale.tr-TR.Date]
  15302. ...
  15303. */
  15304. Locale.define('tr-TR', 'Date', {
  15305. months: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
  15306. months_abbr: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
  15307. days: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],
  15308. days_abbr: ['Pa', 'Pzt', 'Sa', 'Ça', 'Pe', 'Cu', 'Cmt'],
  15309. // Culture's date order: MM/DD/YYYY
  15310. dateOrder: ['date', 'month', 'year'],
  15311. shortDate: '%d/%m/%Y',
  15312. shortTime: '%H.%M',
  15313. AM: 'AM',
  15314. PM: 'PM',
  15315. firstDayOfWeek: 1,
  15316. // Date.Extras
  15317. ordinal: '',
  15318. lessThanMinuteAgo: 'bir dakikadan önce',
  15319. minuteAgo: 'yaklaşık bir dakika önce',
  15320. minutesAgo: '{delta} dakika önce',
  15321. hourAgo: 'bir saat kadar önce',
  15322. hoursAgo: '{delta} saat kadar önce',
  15323. dayAgo: 'bir gün önce',
  15324. daysAgo: '{delta} gün önce',
  15325. weekAgo: 'bir hafta önce',
  15326. weeksAgo: '{delta} hafta önce',
  15327. monthAgo: 'bir ay önce',
  15328. monthsAgo: '{delta} ay önce',
  15329. yearAgo: 'bir yıl önce',
  15330. yearsAgo: '{delta} yıl önce',
  15331. lessThanMinuteUntil: 'bir dakikadan az sonra',
  15332. minuteUntil: 'bir dakika kadar sonra',
  15333. minutesUntil: '{delta} dakika sonra',
  15334. hourUntil: 'bir saat kadar sonra',
  15335. hoursUntil: '{delta} saat kadar sonra',
  15336. dayUntil: 'bir gün sonra',
  15337. daysUntil: '{delta} gün sonra',
  15338. weekUntil: 'bir hafta sonra',
  15339. weeksUntil: '{delta} hafta sonra',
  15340. monthUntil: 'bir ay sonra',
  15341. monthsUntil: '{delta} ay sonra',
  15342. yearUntil: 'bir yıl sonra',
  15343. yearsUntil: '{delta} yıl sonra'
  15344. });
  15345. /*
  15346. ---
  15347. name: Locale.tr-TR.Form.Validator
  15348. description: Form Validator messages for Turkish.
  15349. license: MIT-style license
  15350. authors:
  15351. - Faruk Can Bilir
  15352. requires:
  15353. - Locale
  15354. provides: [Locale.tr-TR.Form.Validator]
  15355. ...
  15356. */
  15357. Locale.define('tr-TR', 'FormValidator', {
  15358. required: 'Bu alan zorunlu.',
  15359. minLength: 'Lütfen en az {minLength} karakter girin (siz {length} karakter girdiniz).',
  15360. maxLength: 'Lütfen en fazla {maxLength} karakter girin (siz {length} karakter girdiniz).',
  15361. integer: 'Lütfen bu alana sadece tamsayı girin. Ondalıklı sayılar (ör: 1.25) kullanılamaz.',
  15362. numeric: 'Lütfen bu alana sadece sayısal değer girin (ör: "1", "1.1", "-1" ya da "-1.1").',
  15363. 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).',
  15364. alpha: 'Lütfen bu alanda yalnızca harf kullanın. Boşluk ve diğer karakterler kullanılamaz.',
  15365. alphanum: 'Lütfen bu alanda sadece harf ve rakam kullanın. Boşluk ve diğer karakterler kullanılamaz.',
  15366. dateSuchAs: 'Lütfen geçerli bir tarih girin (Ör: {date})',
  15367. dateInFormatMDY: 'Lütfen geçerli bir tarih girin (GG/AA/YYYY, ör: "31/12/1999")',
  15368. email: 'Lütfen geçerli bir email adresi girin. Ör: "kemal@etikan.com".',
  15369. url: 'Lütfen geçerli bir URL girin. Ör: http://www.example.com.',
  15370. currencyDollar: 'Lütfen geçerli bir TL miktarı girin. Ör: 100,00 TL .',
  15371. oneRequired: 'Lütfen en az bir tanesini doldurun.',
  15372. errorPrefix: 'Hata: ',
  15373. warningPrefix: 'Uyarı: ',
  15374. // Form.Validator.Extras
  15375. noSpace: 'Bu alanda boşluk kullanılamaz.',
  15376. reqChkByNode: 'Hiçbir öğe seçilmemiş.',
  15377. requiredChk: 'Bu alan zorunlu.',
  15378. reqChkByName: 'Lütfen bir {label} girin.',
  15379. match: 'Bu alan, {matchName} alanıyla uyuşmalı',
  15380. startDate: 'başlangıç tarihi',
  15381. endDate: 'bitiş tarihi',
  15382. currentDate: 'bugünün tarihi',
  15383. afterDate: 'Tarih, {label} tarihiyle aynı gün ya da ondan sonra olmalıdır.',
  15384. beforeDate: 'Tarih, {label} tarihiyle aynı gün ya da ondan önce olmalıdır.',
  15385. startMonth: 'Lütfen bir başlangıç ayı seçin',
  15386. sameMonth: 'Bu iki tarih aynı ayda olmalı - bir tanesini değiştirmeniz gerekiyor.',
  15387. creditcard: 'Girdiğiniz kredi kartı numarası geçersiz. Lütfen kontrol edip tekrar deneyin. {length} hane girildi.'
  15388. });
  15389. /*
  15390. ---
  15391. name: Locale.tr-TR.Number
  15392. description: Number messages for Turkish.
  15393. license: MIT-style license
  15394. authors:
  15395. - Faruk Can Bilir
  15396. requires:
  15397. - Locale
  15398. - Locale.EU.Number
  15399. provides: [Locale.tr-TR.Number]
  15400. ...
  15401. */
  15402. Locale.define('tr-TR', 'Number', {
  15403. currency: {
  15404. decimals: 0,
  15405. suffix: ' TL'
  15406. }
  15407. }).inherit('EU', 'Number');
  15408. /*
  15409. ---
  15410. name: Locale.uk-UA.Date
  15411. description: Date messages for Ukrainian (utf-8).
  15412. license: MIT-style license
  15413. authors:
  15414. - Slik
  15415. requires:
  15416. - Locale
  15417. provides: [Locale.uk-UA.Date]
  15418. ...
  15419. */
  15420. (function(){
  15421. var pluralize = function(n, one, few, many, other){
  15422. var d = (n / 10).toInt(),
  15423. z = n % 10,
  15424. s = (n / 100).toInt();
  15425. if (d == 1 && n > 10) return many;
  15426. if (z == 1) return one;
  15427. if (z > 0 && z < 5) return few;
  15428. return many;
  15429. };
  15430. Locale.define('uk-UA', 'Date', {
  15431. months: ['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'],
  15432. months_abbr: ['Січ', 'Лют', 'Бер', 'Квіт', 'Трав', 'Черв', 'Лип', 'Серп', 'Вер', 'Жовт', 'Лист', 'Груд' ],
  15433. days: ['Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', "П'ятниця", 'Субота'],
  15434. days_abbr: ['Нд', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
  15435. // Culture's date order: DD/MM/YYYY
  15436. dateOrder: ['date', 'month', 'year'],
  15437. shortDate: '%d/%m/%Y',
  15438. shortTime: '%H:%M',
  15439. AM: 'до полудня',
  15440. PM: 'по полудню',
  15441. firstDayOfWeek: 1,
  15442. // Date.Extras
  15443. ordinal: '',
  15444. lessThanMinuteAgo: 'меньше хвилини тому',
  15445. minuteAgo: 'хвилину тому',
  15446. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'хвилину', 'хвилини', 'хвилин') + ' тому'; },
  15447. hourAgo: 'годину тому',
  15448. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'годину', 'години', 'годин') + ' тому'; },
  15449. dayAgo: 'вчора',
  15450. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'день', 'дня', 'днів') + ' тому'; },
  15451. weekAgo: 'тиждень тому',
  15452. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'тиждень', 'тижні', 'тижнів') + ' тому'; },
  15453. monthAgo: 'місяць тому',
  15454. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'місяць', 'місяці', 'місяців') + ' тому'; },
  15455. yearAgo: 'рік тому',
  15456. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'рік', 'роки', 'років') + ' тому'; },
  15457. lessThanMinuteUntil: 'за мить',
  15458. minuteUntil: 'через хвилину',
  15459. minutesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'хвилину', 'хвилини', 'хвилин'); },
  15460. hourUntil: 'через годину',
  15461. hoursUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'годину', 'години', 'годин'); },
  15462. dayUntil: 'завтра',
  15463. daysUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'день', 'дня', 'днів'); },
  15464. weekUntil: 'через тиждень',
  15465. weeksUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'тиждень', 'тижні', 'тижнів'); },
  15466. monthUntil: 'через місяць',
  15467. monthesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'місяць', 'місяці', 'місяців'); },
  15468. yearUntil: 'через рік',
  15469. yearsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'рік', 'роки', 'років'); }
  15470. });
  15471. })();
  15472. /*
  15473. ---
  15474. name: Locale.uk-UA.Form.Validator
  15475. description: Form Validator messages for Ukrainian (utf-8).
  15476. license: MIT-style license
  15477. authors:
  15478. - Slik
  15479. requires:
  15480. - Locale
  15481. provides: [Locale.uk-UA.Form.Validator]
  15482. ...
  15483. */
  15484. Locale.define('uk-UA', 'FormValidator', {
  15485. required: 'Це поле повинне бути заповненим.',
  15486. minLength: 'Введіть хоча б {minLength} символів (Ви ввели {length}).',
  15487. maxLength: 'Кількість символів не може бути більше {maxLength} (Ви ввели {length}).',
  15488. integer: 'Введіть в це поле число. Дробові числа (наприклад 1.25) не дозволені.',
  15489. numeric: 'Введіть в це поле число (наприклад "1" або "1.1", або "-1", або "-1.1").',
  15490. digits: 'В цьому полі ви можете використовувати лише цифри і знаки пунктіації (наприклад, телефонний номер з знаками дефізу або з крапками).',
  15491. alpha: 'В цьому полі можна використовувати лише латинські літери (a-z). Пробіли і інші символи заборонені.',
  15492. alphanum: 'В цьому полі можна використовувати лише латинські літери (a-z) і цифри (0-9). Пробіли і інші символи заборонені.',
  15493. dateSuchAs: 'Введіть коректну дату {date}.',
  15494. dateInFormatMDY: 'Введіть дату в форматі ММ/ДД/РРРР (наприклад "12/31/2009").',
  15495. email: 'Введіть коректну адресу електронної пошти (наприклад "name@domain.com").',
  15496. url: 'Введіть коректне інтернет-посилання (наприклад http://www.example.com).',
  15497. currencyDollar: 'Введіть суму в доларах (наприклад "$100.00").',
  15498. oneRequired: 'Заповніть одне з полів.',
  15499. errorPrefix: 'Помилка: ',
  15500. warningPrefix: 'Увага: ',
  15501. noSpace: 'Пробіли заборонені.',
  15502. reqChkByNode: 'Не відмічено жодного варіанту.',
  15503. requiredChk: 'Це поле повинне бути віміченим.',
  15504. reqChkByName: 'Будь ласка, відмітьте {label}.',
  15505. match: 'Це поле повинно відповідати {matchName}',
  15506. startDate: 'початкова дата',
  15507. endDate: 'кінцева дата',
  15508. currentDate: 'сьогоднішня дата',
  15509. afterDate: 'Ця дата повинна бути такою ж, або пізнішою за {label}.',
  15510. beforeDate: 'Ця дата повинна бути такою ж, або ранішою за {label}.',
  15511. startMonth: 'Будь ласка, виберіть початковий місяць',
  15512. sameMonth: 'Ці дати повинні відноситись одного і того ж місяця. Будь ласка, змініть одну з них.',
  15513. creditcard: 'Номер кредитної карти введений неправильно. Будь ласка, перевірте його. Введено {length} символів.'
  15514. });
  15515. /*
  15516. ---
  15517. name: Locale.zh-CH.Date
  15518. description: Date messages for Chinese (simplified and traditional).
  15519. license: MIT-style license
  15520. authors:
  15521. - YMind Chan
  15522. requires:
  15523. - Locale
  15524. provides: [Locale.zh-CH.Date]
  15525. ...
  15526. */
  15527. // Simplified Chinese
  15528. Locale.define('zh-CHS', 'Date', {
  15529. months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  15530. months_abbr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  15531. days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  15532. days_abbr: ['日', '一', '二', '三', '四', '五', '六'],
  15533. // Culture's date order: YYYY-MM-DD
  15534. dateOrder: ['year', 'month', 'date'],
  15535. shortDate: '%Y-%m-%d',
  15536. shortTime: '%I:%M%p',
  15537. AM: 'AM',
  15538. PM: 'PM',
  15539. firstDayOfWeek: 1,
  15540. // Date.Extras
  15541. ordinal: '',
  15542. lessThanMinuteAgo: '不到1分钟前',
  15543. minuteAgo: '大约1分钟前',
  15544. minutesAgo: '{delta}分钟之前',
  15545. hourAgo: '大约1小时前',
  15546. hoursAgo: '大约{delta}小时前',
  15547. dayAgo: '1天前',
  15548. daysAgo: '{delta}天前',
  15549. weekAgo: '1星期前',
  15550. weeksAgo: '{delta}星期前',
  15551. monthAgo: '1个月前',
  15552. monthsAgo: '{delta}个月前',
  15553. yearAgo: '1年前',
  15554. yearsAgo: '{delta}年前',
  15555. lessThanMinuteUntil: '从现在开始不到1分钟',
  15556. minuteUntil: '从现在开始約1分钟',
  15557. minutesUntil: '从现在开始约{delta}分钟',
  15558. hourUntil: '从现在开始1小时',
  15559. hoursUntil: '从现在开始约{delta}小时',
  15560. dayUntil: '从现在开始1天',
  15561. daysUntil: '从现在开始{delta}天',
  15562. weekUntil: '从现在开始1星期',
  15563. weeksUntil: '从现在开始{delta}星期',
  15564. monthUntil: '从现在开始一个月',
  15565. monthsUntil: '从现在开始{delta}个月',
  15566. yearUntil: '从现在开始1年',
  15567. yearsUntil: '从现在开始{delta}年'
  15568. });
  15569. // Traditional Chinese
  15570. Locale.define('zh-CHT', 'Date', {
  15571. months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  15572. months_abbr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  15573. days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  15574. days_abbr: ['日', '一', '二', '三', '四', '五', '六'],
  15575. // Culture's date order: YYYY-MM-DD
  15576. dateOrder: ['year', 'month', 'date'],
  15577. shortDate: '%Y-%m-%d',
  15578. shortTime: '%I:%M%p',
  15579. AM: 'AM',
  15580. PM: 'PM',
  15581. firstDayOfWeek: 1,
  15582. // Date.Extras
  15583. ordinal: '',
  15584. lessThanMinuteAgo: '不到1分鐘前',
  15585. minuteAgo: '大約1分鐘前',
  15586. minutesAgo: '{delta}分鐘之前',
  15587. hourAgo: '大約1小時前',
  15588. hoursAgo: '大約{delta}小時前',
  15589. dayAgo: '1天前',
  15590. daysAgo: '{delta}天前',
  15591. weekAgo: '1星期前',
  15592. weeksAgo: '{delta}星期前',
  15593. monthAgo: '1个月前',
  15594. monthsAgo: '{delta}个月前',
  15595. yearAgo: '1年前',
  15596. yearsAgo: '{delta}年前',
  15597. lessThanMinuteUntil: '從現在開始不到1分鐘',
  15598. minuteUntil: '從現在開始約1分鐘',
  15599. minutesUntil: '從現在開始約{delta}分鐘',
  15600. hourUntil: '從現在開始1小時',
  15601. hoursUntil: '從現在開始約{delta}小時',
  15602. dayUntil: '從現在開始1天',
  15603. daysUntil: '從現在開始{delta}天',
  15604. weekUntil: '從現在開始1星期',
  15605. weeksUntil: '從現在開始{delta}星期',
  15606. monthUntil: '從現在開始一個月',
  15607. monthsUntil: '從現在開始{delta}個月',
  15608. yearUntil: '從現在開始1年',
  15609. yearsUntil: '從現在開始{delta}年'
  15610. });
  15611. /*
  15612. ---
  15613. name: Locale.zh-CH.Form.Validator
  15614. description: Form Validator messages for Chinese (simplified and traditional).
  15615. license: MIT-style license
  15616. authors:
  15617. - YMind Chan
  15618. requires:
  15619. - Locale
  15620. - Form.Validator
  15621. provides: [Form.zh-CH.Form.Validator, Form.Validator.CurrencyYuanValidator]
  15622. ...
  15623. */
  15624. // Simplified Chinese
  15625. Locale.define('zh-CHS', 'FormValidator', {
  15626. required: '此项必填。',
  15627. minLength: '请至少输入 {minLength} 个字符 (已输入 {length} 个)。',
  15628. maxLength: '最多只能输入 {maxLength} 个字符 (已输入 {length} 个)。',
  15629. integer: '请输入一个整数,不能包含小数点。例如:"1", "200"。',
  15630. numeric: '请输入一个数字,例如:"1", "1.1", "-1", "-1.1"。',
  15631. digits: '请输入由数字和标点符号组成的内容。例如电话号码。',
  15632. alpha: '请输入 A-Z 的 26 个字母,不能包含空格或任何其他字符。',
  15633. alphanum: '请输入 A-Z 的 26 个字母或 0-9 的 10 个数字,不能包含空格或任何其他字符。',
  15634. dateSuchAs: '请输入合法的日期格式,如:{date}。',
  15635. dateInFormatMDY: '请输入合法的日期格式,例如:YYYY-MM-DD ("2010-12-31")。',
  15636. email: '请输入合法的电子信箱地址,例如:"fred@domain.com"。',
  15637. url: '请输入合法的 Url 地址,例如:http://www.example.com。',
  15638. currencyDollar: '请输入合法的货币符号,例如:¥100.0',
  15639. oneRequired: '请至少选择一项。',
  15640. errorPrefix: '错误:',
  15641. warningPrefix: '警告:',
  15642. // Form.Validator.Extras
  15643. noSpace: '不能包含空格。',
  15644. reqChkByNode: '未选择任何内容。',
  15645. requiredChk: '此项必填。',
  15646. reqChkByName: '请选择 {label}.',
  15647. match: '必须与{matchName}相匹配',
  15648. startDate: '起始日期',
  15649. endDate: '结束日期',
  15650. currentDate: '当前日期',
  15651. afterDate: '日期必须等于或晚于 {label}.',
  15652. beforeDate: '日期必须早于或等于 {label}.',
  15653. startMonth: '请选择起始月份',
  15654. sameMonth: '您必须修改两个日期中的一个,以确保它们在同一月份。',
  15655. creditcard: '您输入的信用卡号码不正确。当前已输入{length}个字符。'
  15656. });
  15657. // Traditional Chinese
  15658. Locale.define('zh-CHT', 'FormValidator', {
  15659. required: '此項必填。 ',
  15660. minLength: '請至少輸入{minLength} 個字符(已輸入{length} 個)。 ',
  15661. maxLength: '最多只能輸入{maxLength} 個字符(已輸入{length} 個)。 ',
  15662. integer: '請輸入一個整數,不能包含小數點。例如:"1", "200"。 ',
  15663. numeric: '請輸入一個數字,例如:"1", "1.1", "-1", "-1.1"。 ',
  15664. digits: '請輸入由數字和標點符號組成的內容。例如電話號碼。 ',
  15665. alpha: '請輸入AZ 的26 個字母,不能包含空格或任何其他字符。 ',
  15666. alphanum: '請輸入AZ 的26 個字母或0-9 的10 個數字,不能包含空格或任何其他字符。 ',
  15667. dateSuchAs: '請輸入合法的日期格式,如:{date}。 ',
  15668. dateInFormatMDY: '請輸入合法的日期格式,例如:YYYY-MM-DD ("2010-12-31")。 ',
  15669. email: '請輸入合法的電子信箱地址,例如:"fred@domain.com"。 ',
  15670. url: '請輸入合法的Url 地址,例如:http://www.example.com。 ',
  15671. currencyDollar: '請輸入合法的貨幣符號,例如:¥100.0',
  15672. oneRequired: '請至少選擇一項。 ',
  15673. errorPrefix: '錯誤:',
  15674. warningPrefix: '警告:',
  15675. // Form.Validator.Extras
  15676. noSpace: '不能包含空格。 ',
  15677. reqChkByNode: '未選擇任何內容。 ',
  15678. requiredChk: '此項必填。 ',
  15679. reqChkByName: '請選擇 {label}.',
  15680. match: '必須與{matchName}相匹配',
  15681. startDate: '起始日期',
  15682. endDate: '結束日期',
  15683. currentDate: '當前日期',
  15684. afterDate: '日期必須等於或晚於{label}.',
  15685. beforeDate: '日期必須早於或等於{label}.',
  15686. startMonth: '請選擇起始月份',
  15687. sameMonth: '您必須修改兩個日期中的一個,以確保它們在同一月份。 ',
  15688. creditcard: '您輸入的信用卡號碼不正確。當前已輸入{length}個字符。 '
  15689. });
  15690. Form.Validator.add('validate-currency-yuan', {
  15691. errorMsg: function(){
  15692. return Form.Validator.getMsg('currencyYuan');
  15693. },
  15694. test: function(element){
  15695. // [¥]1[##][,###]+[.##]
  15696. // [¥]1###+[.##]
  15697. // [¥]0.##
  15698. // [¥].##
  15699. 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'));
  15700. }
  15701. });
  15702. /*
  15703. ---
  15704. name: Locale.zh-CH.Number
  15705. description: Number messages for for Chinese (simplified and traditional).
  15706. license: MIT-style license
  15707. authors:
  15708. - YMind Chan
  15709. requires:
  15710. - Locale
  15711. - Locale.en-US.Number
  15712. provides: [Locale.zh-CH.Number]
  15713. ...
  15714. */
  15715. // Simplified Chinese
  15716. Locale.define('zh-CHS', 'Number', {
  15717. currency: {
  15718. prefix: '¥ '
  15719. }
  15720. }).inherit('en-US', 'Number');
  15721. // Traditional Chinese
  15722. Locale.define('zh-CHT').inherit('zh-CHS', 'Number');
  15723. /*
  15724. ---
  15725. script: Request.JSONP.js
  15726. name: Request.JSONP
  15727. description: Defines Request.JSONP, a class for cross domain javascript via script injection.
  15728. license: MIT-style license
  15729. authors:
  15730. - Aaron Newton
  15731. - Guillermo Rauch
  15732. - Arian Stolwijk
  15733. requires:
  15734. - Core/Element
  15735. - Core/Request
  15736. - MooTools.More
  15737. provides: [Request.JSONP]
  15738. ...
  15739. */
  15740. Request.JSONP = new Class({
  15741. Implements: [Chain, Events, Options],
  15742. options: {/*
  15743. onRequest: function(src, scriptElement){},
  15744. onComplete: function(data){},
  15745. onSuccess: function(data){},
  15746. onCancel: function(){},
  15747. onTimeout: function(){},
  15748. onError: function(){}, */
  15749. onRequest: function(src){
  15750. if (this.options.log && window.console && console.log){
  15751. console.log('JSONP retrieving script with url:' + src);
  15752. }
  15753. },
  15754. onError: function(src){
  15755. if (this.options.log && window.console && console.warn){
  15756. console.warn('JSONP '+ src +' will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs');
  15757. }
  15758. },
  15759. url: '',
  15760. callbackKey: 'callback',
  15761. injectScript: document.head,
  15762. data: '',
  15763. link: 'ignore',
  15764. timeout: 0,
  15765. log: false
  15766. },
  15767. initialize: function(options){
  15768. this.setOptions(options);
  15769. },
  15770. send: function(options){
  15771. if (!Request.prototype.check.call(this, options)) return this;
  15772. this.running = true;
  15773. var type = typeOf(options);
  15774. if (type == 'string' || type == 'element') options = {data: options};
  15775. options = Object.merge(this.options, options || {});
  15776. var data = options.data;
  15777. switch (typeOf(data)){
  15778. case 'element': data = document.id(data).toQueryString(); break;
  15779. case 'object': case 'hash': data = Object.toQueryString(data);
  15780. }
  15781. var index = this.index = Request.JSONP.counter++,
  15782. key = 'request_' + index;
  15783. var src = options.url +
  15784. (options.url.test('\\?') ? '&' :'?') +
  15785. (options.callbackKey) +
  15786. '=Request.JSONP.request_map.request_'+ index +
  15787. (data ? '&' + data : '');
  15788. if (src.length > 2083) this.fireEvent('error', src);
  15789. Request.JSONP.request_map[key] = function(){
  15790. delete Request.JSONP.request_map[key];
  15791. this.success(arguments, index);
  15792. }.bind(this);
  15793. var script = this.getScript(src).inject(options.injectScript);
  15794. this.fireEvent('request', [src, script]);
  15795. if (options.timeout) this.timeout.delay(options.timeout, this);
  15796. return this;
  15797. },
  15798. getScript: function(src){
  15799. if (!this.script) this.script = new Element('script', {
  15800. type: 'text/javascript',
  15801. async: true,
  15802. src: src
  15803. });
  15804. return this.script;
  15805. },
  15806. success: function(args){
  15807. if (!this.running) return;
  15808. this.clear()
  15809. .fireEvent('complete', args).fireEvent('success', args)
  15810. .callChain();
  15811. },
  15812. cancel: function(){
  15813. if (this.running) this.clear().fireEvent('cancel');
  15814. return this;
  15815. },
  15816. isRunning: function(){
  15817. return !!this.running;
  15818. },
  15819. clear: function(){
  15820. this.running = false;
  15821. if (this.script){
  15822. this.script.destroy();
  15823. this.script = null;
  15824. }
  15825. return this;
  15826. },
  15827. timeout: function(){
  15828. if (this.running){
  15829. this.running = false;
  15830. this.fireEvent('timeout', [this.script.get('src'), this.script]).fireEvent('failure').cancel();
  15831. }
  15832. return this;
  15833. }
  15834. });
  15835. Request.JSONP.counter = 0;
  15836. Request.JSONP.request_map = {};
  15837. /*
  15838. ---
  15839. script: Request.Periodical.js
  15840. name: Request.Periodical
  15841. description: Requests the same URL to pull data from a server but increases the intervals if no data is returned to reduce the load
  15842. license: MIT-style license
  15843. authors:
  15844. - Christoph Pojer
  15845. requires:
  15846. - Core/Request
  15847. - MooTools.More
  15848. provides: [Request.Periodical]
  15849. ...
  15850. */
  15851. Request.implement({
  15852. options: {
  15853. initialDelay: 5000,
  15854. delay: 5000,
  15855. limit: 60000
  15856. },
  15857. startTimer: function(data){
  15858. var fn = function(){
  15859. if (!this.running) this.send({data: data});
  15860. };
  15861. this.lastDelay = this.options.initialDelay;
  15862. this.timer = fn.delay(this.lastDelay, this);
  15863. this.completeCheck = function(response){
  15864. clearTimeout(this.timer);
  15865. this.lastDelay = (response) ? this.options.delay : (this.lastDelay + this.options.delay).min(this.options.limit);
  15866. this.timer = fn.delay(this.lastDelay, this);
  15867. };
  15868. return this.addEvent('complete', this.completeCheck);
  15869. },
  15870. stopTimer: function(){
  15871. clearTimeout(this.timer);
  15872. return this.removeEvent('complete', this.completeCheck);
  15873. }
  15874. });
  15875. /*
  15876. ---
  15877. script: Request.Queue.js
  15878. name: Request.Queue
  15879. description: Controls several instances of Request and its variants to run only one request at a time.
  15880. license: MIT-style license
  15881. authors:
  15882. - Aaron Newton
  15883. requires:
  15884. - Core/Element
  15885. - Core/Request
  15886. - Class.Binds
  15887. provides: [Request.Queue]
  15888. ...
  15889. */
  15890. Request.Queue = new Class({
  15891. Implements: [Options, Events],
  15892. Binds: ['attach', 'request', 'complete', 'cancel', 'success', 'failure', 'exception'],
  15893. options: {/*
  15894. onRequest: function(argsPassedToOnRequest){},
  15895. onSuccess: function(argsPassedToOnSuccess){},
  15896. onComplete: function(argsPassedToOnComplete){},
  15897. onCancel: function(argsPassedToOnCancel){},
  15898. onException: function(argsPassedToOnException){},
  15899. onFailure: function(argsPassedToOnFailure){},
  15900. onEnd: function(){},
  15901. */
  15902. stopOnFailure: true,
  15903. autoAdvance: true,
  15904. concurrent: 1,
  15905. requests: {}
  15906. },
  15907. initialize: function(options){
  15908. var requests;
  15909. if (options){
  15910. requests = options.requests;
  15911. delete options.requests;
  15912. }
  15913. this.setOptions(options);
  15914. this.requests = {};
  15915. this.queue = [];
  15916. this.reqBinders = {};
  15917. if (requests) this.addRequests(requests);
  15918. },
  15919. addRequest: function(name, request){
  15920. this.requests[name] = request;
  15921. this.attach(name, request);
  15922. return this;
  15923. },
  15924. addRequests: function(obj){
  15925. Object.each(obj, function(req, name){
  15926. this.addRequest(name, req);
  15927. }, this);
  15928. return this;
  15929. },
  15930. getName: function(req){
  15931. return Object.keyOf(this.requests, req);
  15932. },
  15933. attach: function(name, req){
  15934. if (req._groupSend) return this;
  15935. ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){
  15936. if (!this.reqBinders[name]) this.reqBinders[name] = {};
  15937. this.reqBinders[name][evt] = function(){
  15938. this['on' + evt.capitalize()].apply(this, [name, req].append(arguments));
  15939. }.bind(this);
  15940. req.addEvent(evt, this.reqBinders[name][evt]);
  15941. }, this);
  15942. req._groupSend = req.send;
  15943. req.send = function(options){
  15944. this.send(name, options);
  15945. return req;
  15946. }.bind(this);
  15947. return this;
  15948. },
  15949. removeRequest: function(req){
  15950. var name = typeOf(req) == 'object' ? this.getName(req) : req;
  15951. if (!name && typeOf(name) != 'string') return this;
  15952. req = this.requests[name];
  15953. if (!req) return this;
  15954. ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){
  15955. req.removeEvent(evt, this.reqBinders[name][evt]);
  15956. }, this);
  15957. req.send = req._groupSend;
  15958. delete req._groupSend;
  15959. return this;
  15960. },
  15961. getRunning: function(){
  15962. return Object.filter(this.requests, function(r){
  15963. return r.running;
  15964. });
  15965. },
  15966. isRunning: function(){
  15967. return !!(Object.keys(this.getRunning()).length);
  15968. },
  15969. send: function(name, options){
  15970. var q = function(){
  15971. this.requests[name]._groupSend(options);
  15972. this.queue.erase(q);
  15973. }.bind(this);
  15974. q.name = name;
  15975. if (Object.keys(this.getRunning()).length >= this.options.concurrent || (this.error && this.options.stopOnFailure)) this.queue.push(q);
  15976. else q();
  15977. return this;
  15978. },
  15979. hasNext: function(name){
  15980. return (!name) ? !!this.queue.length : !!this.queue.filter(function(q){ return q.name == name; }).length;
  15981. },
  15982. resume: function(){
  15983. this.error = false;
  15984. (this.options.concurrent - Object.keys(this.getRunning()).length).times(this.runNext, this);
  15985. return this;
  15986. },
  15987. runNext: function(name){
  15988. if (!this.queue.length) return this;
  15989. if (!name){
  15990. this.queue[0]();
  15991. } else {
  15992. var found;
  15993. this.queue.each(function(q){
  15994. if (!found && q.name == name){
  15995. found = true;
  15996. q();
  15997. }
  15998. });
  15999. }
  16000. return this;
  16001. },
  16002. runAll: function(){
  16003. this.queue.each(function(q){
  16004. q();
  16005. });
  16006. return this;
  16007. },
  16008. clear: function(name){
  16009. if (!name){
  16010. this.queue.empty();
  16011. } else {
  16012. this.queue = this.queue.map(function(q){
  16013. if (q.name != name) return q;
  16014. else return false;
  16015. }).filter(function(q){
  16016. return q;
  16017. });
  16018. }
  16019. return this;
  16020. },
  16021. cancel: function(name){
  16022. this.requests[name].cancel();
  16023. return this;
  16024. },
  16025. onRequest: function(){
  16026. this.fireEvent('request', arguments);
  16027. },
  16028. onComplete: function(){
  16029. this.fireEvent('complete', arguments);
  16030. if (!this.queue.length) this.fireEvent('end');
  16031. },
  16032. onCancel: function(){
  16033. if (this.options.autoAdvance && !this.error) this.runNext();
  16034. this.fireEvent('cancel', arguments);
  16035. },
  16036. onSuccess: function(){
  16037. if (this.options.autoAdvance && !this.error) this.runNext();
  16038. this.fireEvent('success', arguments);
  16039. },
  16040. onFailure: function(){
  16041. this.error = true;
  16042. if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext();
  16043. this.fireEvent('failure', arguments);
  16044. },
  16045. onException: function(){
  16046. this.error = true;
  16047. if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext();
  16048. this.fireEvent('exception', arguments);
  16049. }
  16050. });
  16051. /*
  16052. ---
  16053. script: Array.Extras.js
  16054. name: Array.Extras
  16055. description: Extends the Array native object to include useful methods to work with arrays.
  16056. license: MIT-style license
  16057. authors:
  16058. - Christoph Pojer
  16059. - Sebastian Markbåge
  16060. requires:
  16061. - Core/Array
  16062. - MooTools.More
  16063. provides: [Array.Extras]
  16064. ...
  16065. */
  16066. (function(nil){
  16067. Array.implement({
  16068. min: function(){
  16069. return Math.min.apply(null, this);
  16070. },
  16071. max: function(){
  16072. return Math.max.apply(null, this);
  16073. },
  16074. average: function(){
  16075. return this.length ? this.sum() / this.length : 0;
  16076. },
  16077. sum: function(){
  16078. var result = 0, l = this.length;
  16079. if (l){
  16080. while (l--){
  16081. if (this[l] != null) result += parseFloat(this[l]);
  16082. }
  16083. }
  16084. return result;
  16085. },
  16086. unique: function(){
  16087. return [].combine(this);
  16088. },
  16089. shuffle: function(){
  16090. for (var i = this.length; i && --i;){
  16091. var temp = this[i], r = Math.floor(Math.random() * ( i + 1 ));
  16092. this[i] = this[r];
  16093. this[r] = temp;
  16094. }
  16095. return this;
  16096. },
  16097. reduce: function(fn, value){
  16098. for (var i = 0, l = this.length; i < l; i++){
  16099. if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this);
  16100. }
  16101. return value;
  16102. },
  16103. reduceRight: function(fn, value){
  16104. var i = this.length;
  16105. while (i--){
  16106. if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this);
  16107. }
  16108. return value;
  16109. },
  16110. pluck: function(prop){
  16111. return this.map(function(item){
  16112. return item[prop];
  16113. });
  16114. }
  16115. });
  16116. })();
  16117. /*
  16118. ---
  16119. script: Date.Extras.js
  16120. name: Date.Extras
  16121. description: Extends the Date native object to include extra methods (on top of those in Date.js).
  16122. license: MIT-style license
  16123. authors:
  16124. - Aaron Newton
  16125. - Scott Kyle
  16126. requires:
  16127. - Date
  16128. provides: [Date.Extras]
  16129. ...
  16130. */
  16131. Date.implement({
  16132. timeDiffInWords: function(to){
  16133. return Date.distanceOfTimeInWords(this, to || new Date);
  16134. },
  16135. timeDiff: function(to, separator){
  16136. if (to == null) to = new Date;
  16137. var delta = ((to - this) / 1000).floor().abs();
  16138. var vals = [],
  16139. durations = [60, 60, 24, 365, 0],
  16140. names = ['s', 'm', 'h', 'd', 'y'],
  16141. value, duration;
  16142. for (var item = 0; item < durations.length; item++){
  16143. if (item && !delta) break;
  16144. value = delta;
  16145. if ((duration = durations[item])){
  16146. value = (delta % duration);
  16147. delta = (delta / duration).floor();
  16148. }
  16149. vals.unshift(value + (names[item] || ''));
  16150. }
  16151. return vals.join(separator || ':');
  16152. }
  16153. }).extend({
  16154. distanceOfTimeInWords: function(from, to){
  16155. return Date.getTimePhrase(((to - from) / 1000).toInt());
  16156. },
  16157. getTimePhrase: function(delta){
  16158. var suffix = (delta < 0) ? 'Until' : 'Ago';
  16159. if (delta < 0) delta *= -1;
  16160. var units = {
  16161. minute: 60,
  16162. hour: 60,
  16163. day: 24,
  16164. week: 7,
  16165. month: 52 / 12,
  16166. year: 12,
  16167. eon: Infinity
  16168. };
  16169. var msg = 'lessThanMinute';
  16170. for (var unit in units){
  16171. var interval = units[unit];
  16172. if (delta < 1.5 * interval){
  16173. if (delta > 0.75 * interval) msg = unit;
  16174. break;
  16175. }
  16176. delta /= interval;
  16177. msg = unit + 's';
  16178. }
  16179. delta = delta.round();
  16180. return Date.getMsg(msg + suffix, delta).substitute({delta: delta});
  16181. }
  16182. }).defineParsers(
  16183. {
  16184. // "today", "tomorrow", "yesterday"
  16185. re: /^(?:tod|tom|yes)/i,
  16186. handler: function(bits){
  16187. var d = new Date().clearTime();
  16188. switch (bits[0]){
  16189. case 'tom': return d.increment();
  16190. case 'yes': return d.decrement();
  16191. default: return d;
  16192. }
  16193. }
  16194. },
  16195. {
  16196. // "next Wednesday", "last Thursday"
  16197. re: /^(next|last) ([a-z]+)$/i,
  16198. handler: function(bits){
  16199. var d = new Date().clearTime();
  16200. var day = d.getDay();
  16201. var newDay = Date.parseDay(bits[2], true);
  16202. var addDays = newDay - day;
  16203. if (newDay <= day) addDays += 7;
  16204. if (bits[1] == 'last') addDays -= 7;
  16205. return d.set('date', d.getDate() + addDays);
  16206. }
  16207. }
  16208. ).alias('timeAgoInWords', 'timeDiffInWords');
  16209. /*
  16210. ---
  16211. name: Hash
  16212. description: Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects.
  16213. license: MIT-style license.
  16214. requires:
  16215. - Core/Object
  16216. - MooTools.More
  16217. provides: [Hash]
  16218. ...
  16219. */
  16220. (function(){
  16221. if (this.Hash) return;
  16222. var Hash = this.Hash = new Type('Hash', function(object){
  16223. if (typeOf(object) == 'hash') object = Object.clone(object.getClean());
  16224. for (var key in object) this[key] = object[key];
  16225. return this;
  16226. });
  16227. this.$H = function(object){
  16228. return new Hash(object);
  16229. };
  16230. Hash.implement({
  16231. forEach: function(fn, bind){
  16232. Object.forEach(this, fn, bind);
  16233. },
  16234. getClean: function(){
  16235. var clean = {};
  16236. for (var key in this){
  16237. if (this.hasOwnProperty(key)) clean[key] = this[key];
  16238. }
  16239. return clean;
  16240. },
  16241. getLength: function(){
  16242. var length = 0;
  16243. for (var key in this){
  16244. if (this.hasOwnProperty(key)) length++;
  16245. }
  16246. return length;
  16247. }
  16248. });
  16249. Hash.alias('each', 'forEach');
  16250. Hash.implement({
  16251. has: Object.prototype.hasOwnProperty,
  16252. keyOf: function(value){
  16253. return Object.keyOf(this, value);
  16254. },
  16255. hasValue: function(value){
  16256. return Object.contains(this, value);
  16257. },
  16258. extend: function(properties){
  16259. Hash.each(properties || {}, function(value, key){
  16260. Hash.set(this, key, value);
  16261. }, this);
  16262. return this;
  16263. },
  16264. combine: function(properties){
  16265. Hash.each(properties || {}, function(value, key){
  16266. Hash.include(this, key, value);
  16267. }, this);
  16268. return this;
  16269. },
  16270. erase: function(key){
  16271. if (this.hasOwnProperty(key)) delete this[key];
  16272. return this;
  16273. },
  16274. get: function(key){
  16275. return (this.hasOwnProperty(key)) ? this[key] : null;
  16276. },
  16277. set: function(key, value){
  16278. if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
  16279. return this;
  16280. },
  16281. empty: function(){
  16282. Hash.each(this, function(value, key){
  16283. delete this[key];
  16284. }, this);
  16285. return this;
  16286. },
  16287. include: function(key, value){
  16288. if (this[key] == undefined) this[key] = value;
  16289. return this;
  16290. },
  16291. map: function(fn, bind){
  16292. return new Hash(Object.map(this, fn, bind));
  16293. },
  16294. filter: function(fn, bind){
  16295. return new Hash(Object.filter(this, fn, bind));
  16296. },
  16297. every: function(fn, bind){
  16298. return Object.every(this, fn, bind);
  16299. },
  16300. some: function(fn, bind){
  16301. return Object.some(this, fn, bind);
  16302. },
  16303. getKeys: function(){
  16304. return Object.keys(this);
  16305. },
  16306. getValues: function(){
  16307. return Object.values(this);
  16308. },
  16309. toQueryString: function(base){
  16310. return Object.toQueryString(this, base);
  16311. }
  16312. });
  16313. Hash.alias({indexOf: 'keyOf', contains: 'hasValue'});
  16314. })();
  16315. /*
  16316. ---
  16317. script: Hash.Extras.js
  16318. name: Hash.Extras
  16319. description: Extends the Hash Type to include getFromPath which allows a path notation to child elements.
  16320. license: MIT-style license
  16321. authors:
  16322. - Aaron Newton
  16323. requires:
  16324. - Hash
  16325. - Object.Extras
  16326. provides: [Hash.Extras]
  16327. ...
  16328. */
  16329. Hash.implement({
  16330. getFromPath: function(notation){
  16331. return Object.getFromPath(this, notation);
  16332. },
  16333. cleanValues: function(method){
  16334. return new Hash(Object.cleanValues(this, method));
  16335. },
  16336. run: function(){
  16337. Object.run(arguments);
  16338. }
  16339. });
  16340. /*
  16341. ---
  16342. name: Number.Format
  16343. description: Extends the Number Type object to include a number formatting method.
  16344. license: MIT-style license
  16345. authors: [Arian Stolwijk]
  16346. requires: [Core/Number, Locale.en-US.Number]
  16347. # Number.Extras is for compatibility
  16348. provides: [Number.Format, Number.Extras]
  16349. ...
  16350. */
  16351. Number.implement({
  16352. format: function(options){
  16353. // Thanks dojo and YUI for some inspiration
  16354. var value = this;
  16355. options = options ? Object.clone(options) : {};
  16356. var getOption = function(key){
  16357. if (options[key] != null) return options[key];
  16358. return Locale.get('Number.' + key);
  16359. };
  16360. var negative = value < 0,
  16361. decimal = getOption('decimal'),
  16362. precision = getOption('precision'),
  16363. group = getOption('group'),
  16364. decimals = getOption('decimals');
  16365. if (negative){
  16366. var negativeLocale = getOption('negative') || {};
  16367. if (negativeLocale.prefix == null && negativeLocale.suffix == null) negativeLocale.prefix = '-';
  16368. ['prefix', 'suffix'].each(function(key){
  16369. if (negativeLocale[key]) options[key] = getOption(key) + negativeLocale[key];
  16370. });
  16371. value = -value;
  16372. }
  16373. var prefix = getOption('prefix'),
  16374. suffix = getOption('suffix');
  16375. if (decimals !== '' && decimals >= 0 && decimals <= 20) value = value.toFixed(decimals);
  16376. if (precision >= 1 && precision <= 21) value = (+value).toPrecision(precision);
  16377. value += '';
  16378. var index;
  16379. if (getOption('scientific') === false && value.indexOf('e') > -1){
  16380. var match = value.split('e'),
  16381. zeros = +match[1];
  16382. value = match[0].replace('.', '');
  16383. if (zeros < 0){
  16384. zeros = -zeros - 1;
  16385. index = match[0].indexOf('.');
  16386. if (index > -1) zeros -= index - 1;
  16387. while (zeros--) value = '0' + value;
  16388. value = '0.' + value;
  16389. } else {
  16390. index = match[0].lastIndexOf('.');
  16391. if (index > -1) zeros -= match[0].length - index - 1;
  16392. while (zeros--) value += '0';
  16393. }
  16394. }
  16395. if (decimal != '.') value = value.replace('.', decimal);
  16396. if (group){
  16397. index = value.lastIndexOf(decimal);
  16398. index = (index > -1) ? index : value.length;
  16399. var newOutput = value.substring(index),
  16400. i = index;
  16401. while (i--){
  16402. if ((index - i - 1) % 3 == 0 && i != (index - 1)) newOutput = group + newOutput;
  16403. newOutput = value.charAt(i) + newOutput;
  16404. }
  16405. value = newOutput;
  16406. }
  16407. if (prefix) value = prefix + value;
  16408. if (suffix) value += suffix;
  16409. return value;
  16410. },
  16411. formatCurrency: function(decimals){
  16412. var locale = Locale.get('Number.currency') || {};
  16413. if (locale.scientific == null) locale.scientific = false;
  16414. locale.decimals = decimals != null ? decimals
  16415. : (locale.decimals == null ? 2 : locale.decimals);
  16416. return this.format(locale);
  16417. },
  16418. formatPercentage: function(decimals){
  16419. var locale = Locale.get('Number.percentage') || {};
  16420. if (locale.suffix == null) locale.suffix = '%';
  16421. locale.decimals = decimals != null ? decimals
  16422. : (locale.decimals == null ? 2 : locale.decimals);
  16423. return this.format(locale);
  16424. }
  16425. });
  16426. /*
  16427. ---
  16428. script: URI.js
  16429. name: URI
  16430. description: Provides methods useful in managing the window location and uris.
  16431. license: MIT-style license
  16432. authors:
  16433. - Sebastian Markbåge
  16434. - Aaron Newton
  16435. requires:
  16436. - Core/Object
  16437. - Core/Class
  16438. - Core/Class.Extras
  16439. - Core/Element
  16440. - String.QueryString
  16441. provides: [URI]
  16442. ...
  16443. */
  16444. (function(){
  16445. var toString = function(){
  16446. return this.get('value');
  16447. };
  16448. var URI = this.URI = new Class({
  16449. Implements: Options,
  16450. options: {
  16451. /*base: false*/
  16452. },
  16453. regex: /^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[A-Fa-f0-9:]+\]|[^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,
  16454. parts: ['scheme', 'user', 'password', 'host', 'port', 'directory', 'file', 'query', 'fragment'],
  16455. schemes: {http: 80, https: 443, ftp: 21, rtsp: 554, mms: 1755, file: 0},
  16456. initialize: function(uri, options){
  16457. this.setOptions(options);
  16458. var base = this.options.base || URI.base;
  16459. if (!uri) uri = base;
  16460. if (uri && uri.parsed) this.parsed = Object.clone(uri.parsed);
  16461. else this.set('value', uri.href || uri.toString(), base ? new URI(base) : false);
  16462. },
  16463. parse: function(value, base){
  16464. var bits = value.match(this.regex);
  16465. if (!bits) return false;
  16466. bits.shift();
  16467. return this.merge(bits.associate(this.parts), base);
  16468. },
  16469. merge: function(bits, base){
  16470. if ((!bits || !bits.scheme) && (!base || !base.scheme)) return false;
  16471. if (base){
  16472. this.parts.every(function(part){
  16473. if (bits[part]) return false;
  16474. bits[part] = base[part] || '';
  16475. return true;
  16476. });
  16477. }
  16478. bits.port = bits.port || this.schemes[bits.scheme.toLowerCase()];
  16479. bits.directory = bits.directory ? this.parseDirectory(bits.directory, base ? base.directory : '') : '/';
  16480. return bits;
  16481. },
  16482. parseDirectory: function(directory, baseDirectory){
  16483. directory = (directory.substr(0, 1) == '/' ? '' : (baseDirectory || '/')) + directory;
  16484. if (!directory.test(URI.regs.directoryDot)) return directory;
  16485. var result = [];
  16486. directory.replace(URI.regs.endSlash, '').split('/').each(function(dir){
  16487. if (dir == '..' && result.length > 0) result.pop();
  16488. else if (dir != '.') result.push(dir);
  16489. });
  16490. return result.join('/') + '/';
  16491. },
  16492. combine: function(bits){
  16493. return bits.value || bits.scheme + '://' +
  16494. (bits.user ? bits.user + (bits.password ? ':' + bits.password : '') + '@' : '') +
  16495. (bits.host || '') + (bits.port && bits.port != this.schemes[bits.scheme] ? ':' + bits.port : '') +
  16496. (bits.directory || '/') + (bits.file || '') +
  16497. (bits.query ? '?' + bits.query : '') +
  16498. (bits.fragment ? '#' + bits.fragment : '');
  16499. },
  16500. set: function(part, value, base){
  16501. if (part == 'value'){
  16502. var scheme = value.match(URI.regs.scheme);
  16503. if (scheme) scheme = scheme[1];
  16504. if (scheme && this.schemes[scheme.toLowerCase()] == null) this.parsed = { scheme: scheme, value: value };
  16505. else this.parsed = this.parse(value, (base || this).parsed) || (scheme ? { scheme: scheme, value: value } : { value: value });
  16506. } else if (part == 'data'){
  16507. this.setData(value);
  16508. } else {
  16509. this.parsed[part] = value;
  16510. }
  16511. return this;
  16512. },
  16513. get: function(part, base){
  16514. switch (part){
  16515. case 'value': return this.combine(this.parsed, base ? base.parsed : false);
  16516. case 'data' : return this.getData();
  16517. }
  16518. return this.parsed[part] || '';
  16519. },
  16520. go: function(){
  16521. document.location.href = this.toString();
  16522. },
  16523. toURI: function(){
  16524. return this;
  16525. },
  16526. getData: function(key, part){
  16527. var qs = this.get(part || 'query');
  16528. if (!(qs || qs === 0)) return key ? null : {};
  16529. var obj = qs.parseQueryString();
  16530. return key ? obj[key] : obj;
  16531. },
  16532. setData: function(values, merge, part){
  16533. if (typeof values == 'string'){
  16534. var data = this.getData();
  16535. data[arguments[0]] = arguments[1];
  16536. values = data;
  16537. } else if (merge){
  16538. values = Object.merge(this.getData(null, part), values);
  16539. }
  16540. return this.set(part || 'query', Object.toQueryString(values));
  16541. },
  16542. clearData: function(part){
  16543. return this.set(part || 'query', '');
  16544. },
  16545. toString: toString,
  16546. valueOf: toString
  16547. });
  16548. URI.regs = {
  16549. endSlash: /\/$/,
  16550. scheme: /^(\w+):/,
  16551. directoryDot: /\.\/|\.$/
  16552. };
  16553. URI.base = new URI(Array.convert(document.getElements('base[href]', true)).getLast(), {base: document.location});
  16554. String.implement({
  16555. toURI: function(options){
  16556. return new URI(this, options);
  16557. }
  16558. });
  16559. })();
  16560. /*
  16561. ---
  16562. script: URI.Relative.js
  16563. name: URI.Relative
  16564. description: Extends the URI class to add methods for computing relative and absolute urls.
  16565. license: MIT-style license
  16566. authors:
  16567. - Sebastian Markbåge
  16568. requires:
  16569. - Class.refactor
  16570. - URI
  16571. provides: [URI.Relative]
  16572. ...
  16573. */
  16574. URI = Class.refactor(URI, {
  16575. combine: function(bits, base){
  16576. if (!base || bits.scheme != base.scheme || bits.host != base.host || bits.port != base.port)
  16577. return this.previous.apply(this, arguments);
  16578. var end = bits.file + (bits.query ? '?' + bits.query : '') + (bits.fragment ? '#' + bits.fragment : '');
  16579. if (!base.directory) return (bits.directory || (bits.file ? '' : './')) + end;
  16580. var baseDir = base.directory.split('/'),
  16581. relDir = bits.directory.split('/'),
  16582. path = '',
  16583. offset;
  16584. var i = 0;
  16585. for (offset = 0; offset < baseDir.length && offset < relDir.length && baseDir[offset] == relDir[offset]; offset++);
  16586. for (i = 0; i < baseDir.length - offset - 1; i++) path += '../';
  16587. for (i = offset; i < relDir.length - 1; i++) path += relDir[i] + '/';
  16588. return (path || (bits.file ? '' : './')) + end;
  16589. },
  16590. toAbsolute: function(base){
  16591. base = new URI(base);
  16592. if (base) base.set('directory', '').set('file', '');
  16593. return this.toRelative(base);
  16594. },
  16595. toRelative: function(base){
  16596. return this.get('value', new URI(base));
  16597. }
  16598. });
  16599. /*
  16600. ---
  16601. script: Assets.js
  16602. name: Assets
  16603. description: Provides methods to dynamically load JavaScript, CSS, and Image files into the document.
  16604. license: MIT-style license
  16605. authors:
  16606. - Valerio Proietti
  16607. requires:
  16608. - Core/Element.Event
  16609. - MooTools.More
  16610. provides: [Assets, Asset.javascript, Asset.css, Asset.image, Asset.images]
  16611. ...
  16612. */
  16613. ;(function(){
  16614. var Asset = this.Asset = {
  16615. javascript: function(source, properties){
  16616. if (!properties) properties = {};
  16617. var script = new Element('script', {src: source, type: 'text/javascript'}),
  16618. doc = properties.document || document,
  16619. load = properties.onload || properties.onLoad;
  16620. delete properties.onload;
  16621. delete properties.onLoad;
  16622. delete properties.document;
  16623. if (load){
  16624. if (!script.addEventListener){
  16625. script.addEvent('readystatechange', function(){
  16626. if (['loaded', 'complete'].contains(this.readyState)) load.call(this);
  16627. });
  16628. } else {
  16629. script.addEvent('load', load);
  16630. }
  16631. }
  16632. return script.set(properties).inject(doc.head);
  16633. },
  16634. css: function(source, properties){
  16635. if (!properties) properties = {};
  16636. var load = properties.onload || properties.onLoad,
  16637. doc = properties.document || document,
  16638. timeout = properties.timeout || 3000;
  16639. ['onload', 'onLoad', 'document'].each(function(prop){
  16640. delete properties[prop];
  16641. });
  16642. var link = new Element('link', {
  16643. type: 'text/css',
  16644. rel: 'stylesheet',
  16645. media: 'screen',
  16646. href: source
  16647. }).setProperties(properties).inject(doc.head);
  16648. if (load){
  16649. // based on article at http://www.yearofmoo.com/2011/03/cross-browser-stylesheet-preloading.html
  16650. var loaded = false, retries = 0;
  16651. var check = function(){
  16652. var stylesheets = document.styleSheets;
  16653. for (var i = 0; i < stylesheets.length; i++){
  16654. var file = stylesheets[i];
  16655. var owner = file.ownerNode ? file.ownerNode : file.owningElement;
  16656. if (owner && owner == link){
  16657. loaded = true;
  16658. return load.call(link);
  16659. }
  16660. }
  16661. retries++;
  16662. if (!loaded && retries < timeout / 50) return setTimeout(check, 50);
  16663. };
  16664. setTimeout(check, 0);
  16665. }
  16666. return link;
  16667. },
  16668. image: function(source, properties){
  16669. if (!properties) properties = {};
  16670. var image = new Image(),
  16671. element = document.id(image) || new Element('img');
  16672. ['load', 'abort', 'error'].each(function(name){
  16673. var type = 'on' + name,
  16674. cap = 'on' + name.capitalize(),
  16675. event = properties[type] || properties[cap] || function(){};
  16676. delete properties[cap];
  16677. delete properties[type];
  16678. image[type] = function(){
  16679. if (!image) return;
  16680. if (!element.parentNode){
  16681. element.width = image.width;
  16682. element.height = image.height;
  16683. }
  16684. image = image.onload = image.onabort = image.onerror = null;
  16685. event.delay(1, element, element);
  16686. element.fireEvent(name, element, 1);
  16687. };
  16688. });
  16689. image.src = element.src = source;
  16690. if (image && image.complete) image.onload.delay(1);
  16691. return element.set(properties);
  16692. },
  16693. images: function(sources, options){
  16694. sources = Array.convert(sources);
  16695. var fn = function(){},
  16696. counter = 0;
  16697. options = Object.merge({
  16698. onComplete: fn,
  16699. onProgress: fn,
  16700. onError: fn,
  16701. properties: {}
  16702. }, options);
  16703. return new Elements(sources.map(function(source, index){
  16704. return Asset.image(source, Object.append(options.properties, {
  16705. onload: function(){
  16706. counter++;
  16707. options.onProgress.call(this, counter, index, source);
  16708. if (counter == sources.length) options.onComplete();
  16709. },
  16710. onerror: function(){
  16711. counter++;
  16712. options.onError.call(this, counter, index, source);
  16713. if (counter == sources.length) options.onComplete();
  16714. }
  16715. }));
  16716. }));
  16717. }
  16718. };
  16719. })();
  16720. /*
  16721. ---
  16722. script: Color.js
  16723. name: Color
  16724. description: Class for creating and manipulating colors in JavaScript. Supports HSB -> RGB Conversions and vice versa.
  16725. license: MIT-style license
  16726. authors:
  16727. - Valerio Proietti
  16728. requires:
  16729. - Core/Array
  16730. - Core/String
  16731. - Core/Number
  16732. - Core/Hash
  16733. - Core/Function
  16734. - MooTools.More
  16735. provides: [Color]
  16736. ...
  16737. */
  16738. (function(){
  16739. var Color = this.Color = new Type('Color', function(color, type){
  16740. if (arguments.length >= 3){
  16741. type = 'rgb'; color = Array.slice(arguments, 0, 3);
  16742. } else if (typeof color == 'string'){
  16743. if (color.match(/rgb/)) color = color.rgbToHex().hexToRgb(true);
  16744. else if (color.match(/hsb/)) color = color.hsbToRgb();
  16745. else color = color.hexToRgb(true);
  16746. }
  16747. type = type || 'rgb';
  16748. switch (type){
  16749. case 'hsb':
  16750. var old = color;
  16751. color = color.hsbToRgb();
  16752. color.hsb = old;
  16753. break;
  16754. case 'hex': color = color.hexToRgb(true); break;
  16755. }
  16756. color.rgb = color.slice(0, 3);
  16757. color.hsb = color.hsb || color.rgbToHsb();
  16758. color.hex = color.rgbToHex();
  16759. return Object.append(color, this);
  16760. });
  16761. Color.implement({
  16762. mix: function(){
  16763. var colors = Array.slice(arguments);
  16764. var alpha = (typeOf(colors.getLast()) == 'number') ? colors.pop() : 50;
  16765. var rgb = this.slice();
  16766. colors.each(function(color){
  16767. color = new Color(color);
  16768. for (var i = 0; i < 3; i++) rgb[i] = Math.round((rgb[i] / 100 * (100 - alpha)) + (color[i] / 100 * alpha));
  16769. });
  16770. return new Color(rgb, 'rgb');
  16771. },
  16772. invert: function(){
  16773. return new Color(this.map(function(value){
  16774. return 255 - value;
  16775. }));
  16776. },
  16777. setHue: function(value){
  16778. return new Color([value, this.hsb[1], this.hsb[2]], 'hsb');
  16779. },
  16780. setSaturation: function(percent){
  16781. return new Color([this.hsb[0], percent, this.hsb[2]], 'hsb');
  16782. },
  16783. setBrightness: function(percent){
  16784. return new Color([this.hsb[0], this.hsb[1], percent], 'hsb');
  16785. }
  16786. });
  16787. this.$RGB = function(r, g, b){
  16788. return new Color([r, g, b], 'rgb');
  16789. };
  16790. this.$HSB = function(h, s, b){
  16791. return new Color([h, s, b], 'hsb');
  16792. };
  16793. this.$HEX = function(hex){
  16794. return new Color(hex, 'hex');
  16795. };
  16796. Array.implement({
  16797. rgbToHsb: function(){
  16798. var red = this[0],
  16799. green = this[1],
  16800. blue = this[2],
  16801. hue = 0,
  16802. max = Math.max(red, green, blue),
  16803. min = Math.min(red, green, blue),
  16804. delta = max - min,
  16805. brightness = max / 255,
  16806. saturation = (max != 0) ? delta / max : 0;
  16807. if (saturation != 0){
  16808. var rr = (max - red) / delta;
  16809. var gr = (max - green) / delta;
  16810. var br = (max - blue) / delta;
  16811. if (red == max) hue = br - gr;
  16812. else if (green == max) hue = 2 + rr - br;
  16813. else hue = 4 + gr - rr;
  16814. hue /= 6;
  16815. if (hue < 0) hue++;
  16816. }
  16817. return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)];
  16818. },
  16819. hsbToRgb: function(){
  16820. var br = Math.round(this[2] / 100 * 255);
  16821. if (this[1] == 0){
  16822. return [br, br, br];
  16823. } else {
  16824. var hue = this[0] % 360;
  16825. var f = hue % 60;
  16826. var p = Math.round((this[2] * (100 - this[1])) / 10000 * 255);
  16827. var q = Math.round((this[2] * (6000 - this[1] * f)) / 600000 * 255);
  16828. var t = Math.round((this[2] * (6000 - this[1] * (60 - f))) / 600000 * 255);
  16829. switch (Math.floor(hue / 60)){
  16830. case 0: return [br, t, p];
  16831. case 1: return [q, br, p];
  16832. case 2: return [p, br, t];
  16833. case 3: return [p, q, br];
  16834. case 4: return [t, p, br];
  16835. case 5: return [br, p, q];
  16836. }
  16837. }
  16838. return false;
  16839. }
  16840. });
  16841. String.implement({
  16842. rgbToHsb: function(){
  16843. var rgb = this.match(/\d{1,3}/g);
  16844. return (rgb) ? rgb.rgbToHsb() : null;
  16845. },
  16846. hsbToRgb: function(){
  16847. var hsb = this.match(/\d{1,3}/g);
  16848. return (hsb) ? hsb.hsbToRgb() : null;
  16849. }
  16850. });
  16851. })();
  16852. /*
  16853. ---
  16854. script: Group.js
  16855. name: Group
  16856. description: Class for monitoring collections of events
  16857. license: MIT-style license
  16858. authors:
  16859. - Valerio Proietti
  16860. requires:
  16861. - Core/Events
  16862. - MooTools.More
  16863. provides: [Group]
  16864. ...
  16865. */
  16866. (function(){
  16867. var Group = this.Group = new Class({
  16868. initialize: function(){
  16869. this.instances = Array.flatten(arguments);
  16870. },
  16871. addEvent: function(type, fn){
  16872. var instances = this.instances,
  16873. len = instances.length,
  16874. togo = len,
  16875. args = new Array(len),
  16876. self = this;
  16877. instances.each(function(instance, i){
  16878. instance.addEvent(type, function(){
  16879. if (!args[i]) togo--;
  16880. args[i] = arguments;
  16881. if (!togo){
  16882. fn.call(self, instances, instance, args);
  16883. togo = len;
  16884. args = new Array(len);
  16885. }
  16886. });
  16887. });
  16888. }
  16889. });
  16890. })();
  16891. /*
  16892. ---
  16893. script: Hash.Cookie.js
  16894. name: Hash.Cookie
  16895. description: Class for creating, reading, and deleting Cookies in JSON format.
  16896. license: MIT-style license
  16897. authors:
  16898. - Valerio Proietti
  16899. - Aaron Newton
  16900. requires:
  16901. - Core/Cookie
  16902. - Core/JSON
  16903. - MooTools.More
  16904. - Hash
  16905. provides: [Hash.Cookie]
  16906. ...
  16907. */
  16908. Hash.Cookie = new Class({
  16909. Extends: Cookie,
  16910. options: {
  16911. autoSave: true
  16912. },
  16913. initialize: function(name, options){
  16914. this.parent(name, options);
  16915. this.load();
  16916. },
  16917. save: function(){
  16918. var value = JSON.encode(this.hash);
  16919. if (!value || value.length > 4096) return false; //cookie would be truncated!
  16920. if (value == '{}') this.dispose();
  16921. else this.write(value);
  16922. return true;
  16923. },
  16924. load: function(){
  16925. this.hash = new Hash(JSON.decode(this.read(), true));
  16926. return this;
  16927. }
  16928. });
  16929. Hash.each(Hash.prototype, function(method, name){
  16930. if (typeof method == 'function') Hash.Cookie.implement(name, function(){
  16931. var value = method.apply(this.hash, arguments);
  16932. if (this.options.autoSave) this.save();
  16933. return value;
  16934. });
  16935. });
  16936. /*
  16937. ---
  16938. name: Swiff
  16939. description: Wrapper for embedding SWF movies. Supports External Interface Communication.
  16940. license: MIT-style license.
  16941. credits:
  16942. - Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject.
  16943. requires: [Core/Options, Core/Object, Core/Element]
  16944. provides: Swiff
  16945. ...
  16946. */
  16947. (function(){
  16948. var Swiff = this.Swiff = new Class({
  16949. Implements: Options,
  16950. options: {
  16951. id: null,
  16952. height: 1,
  16953. width: 1,
  16954. container: null,
  16955. properties: {},
  16956. params: {
  16957. quality: 'high',
  16958. allowScriptAccess: 'always',
  16959. wMode: 'window',
  16960. swLiveConnect: true
  16961. },
  16962. callBacks: {},
  16963. vars: {}
  16964. },
  16965. toElement: function(){
  16966. return this.object;
  16967. },
  16968. initialize: function(path, options){
  16969. this.instance = 'Swiff_' + String.uniqueID();
  16970. this.setOptions(options);
  16971. options = this.options;
  16972. var id = this.id = options.id || this.instance;
  16973. var container = document.id(options.container);
  16974. Swiff.CallBacks[this.instance] = {};
  16975. var params = options.params, vars = options.vars, callBacks = options.callBacks;
  16976. var properties = Object.append({height: options.height, width: options.width}, options.properties);
  16977. var self = this;
  16978. for (var callBack in callBacks){
  16979. Swiff.CallBacks[this.instance][callBack] = (function(option){
  16980. return function(){
  16981. return option.apply(self.object, arguments);
  16982. };
  16983. })(callBacks[callBack]);
  16984. vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack;
  16985. }
  16986. params.flashVars = Object.toQueryString(vars);
  16987. if ('ActiveXObject' in window){
  16988. properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
  16989. params.movie = path;
  16990. } else {
  16991. properties.type = 'application/x-shockwave-flash';
  16992. }
  16993. properties.data = path;
  16994. var build = '<object id="' + id + '"';
  16995. for (var property in properties) build += ' ' + property + '="' + properties[property] + '"';
  16996. build += '>';
  16997. for (var param in params){
  16998. if (params[param]) build += '<param name="' + param + '" value="' + params[param] + '" />';
  16999. }
  17000. build += '</object>';
  17001. this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild;
  17002. },
  17003. replaces: function(element){
  17004. element = document.id(element, true);
  17005. element.parentNode.replaceChild(this.toElement(), element);
  17006. return this;
  17007. },
  17008. inject: function(element){
  17009. document.id(element, true).appendChild(this.toElement());
  17010. return this;
  17011. },
  17012. remote: function(){
  17013. return Swiff.remote.apply(Swiff, [this.toElement()].append(arguments));
  17014. }
  17015. });
  17016. Swiff.CallBacks = {};
  17017. Swiff.remote = function(obj, fn){
  17018. var rs = obj.CallFunction('<invoke name="' + fn + '" returntype="javascript">' + __flash__argumentsToXML(arguments, 2) + '</invoke>');
  17019. return eval(rs);
  17020. };
  17021. })();
  17022. /*
  17023. ---
  17024. name: Table
  17025. description: LUA-Style table implementation.
  17026. license: MIT-style license
  17027. authors:
  17028. - Valerio Proietti
  17029. requires: [Core/Array]
  17030. provides: [Table]
  17031. ...
  17032. */
  17033. (function(){
  17034. var Table = this.Table = function(){
  17035. this.length = 0;
  17036. var keys = [],
  17037. values = [];
  17038. this.set = function(key, value){
  17039. var index = keys.indexOf(key);
  17040. if (index == -1){
  17041. var length = keys.length;
  17042. keys[length] = key;
  17043. values[length] = value;
  17044. this.length++;
  17045. } else {
  17046. values[index] = value;
  17047. }
  17048. return this;
  17049. };
  17050. this.get = function(key){
  17051. var index = keys.indexOf(key);
  17052. return (index == -1) ? null : values[index];
  17053. };
  17054. this.erase = function(key){
  17055. var index = keys.indexOf(key);
  17056. if (index != -1){
  17057. this.length--;
  17058. keys.splice(index, 1);
  17059. return values.splice(index, 1)[0];
  17060. }
  17061. return null;
  17062. };
  17063. this.each = this.forEach = function(fn, bind){
  17064. for (var i = 0, l = this.length; i < l; i++) fn.call(bind, keys[i], values[i], this);
  17065. };
  17066. };
  17067. if (this.Type) new Type('Table', Table);
  17068. })();