mootools-1.6.0_all.js 551 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729
  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. if (window.Request){
  19. window.NativeRequest = window.Request;
  20. }
  21. /*! MooTools: the javascript framework. license: MIT-style license. copyright: Copyright (c) 2006-2015 [Valerio Proietti](http://mad4milk.net/).*/
  22. (function(){
  23. this.MooTools = {
  24. version: '1.6.0',
  25. build: '529422872adfff401b901b8b6c7ca5114ee95e2b'
  26. };
  27. // typeOf, instanceOf
  28. var typeOf = this.typeOf = function(item){
  29. if (item == null) return 'null';
  30. if (item.$family != null) return item.$family();
  31. if (item.nodeName){
  32. if (item.nodeType == 1) return 'element';
  33. if (item.nodeType == 3) return (/\S/).test(item.nodeValue) ? 'textnode' : 'whitespace';
  34. } else if (typeof item.length == 'number'){
  35. if ('callee' in item) return 'arguments';
  36. if ('item' in item) return 'collection';
  37. }
  38. return typeof item;
  39. };
  40. var instanceOf = this.instanceOf = function(item, object){
  41. if (item == null) return false;
  42. var constructor = item.$constructor || item.constructor;
  43. while (constructor){
  44. if (constructor === object) return true;
  45. constructor = constructor.parent;
  46. }
  47. /*<ltIE8>*/
  48. if (!item.hasOwnProperty) return false;
  49. /*</ltIE8>*/
  50. return item instanceof object;
  51. };
  52. var hasOwnProperty = Object.prototype.hasOwnProperty;
  53. /*<ltIE8>*/
  54. var enumerables = true;
  55. for (var i in {toString: 1}) enumerables = null;
  56. if (enumerables) enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor'];
  57. function forEachObjectEnumberableKey(object, fn, bind){
  58. if (enumerables) for (var i = enumerables.length; i--;){
  59. var k = enumerables[i];
  60. // signature has key-value, so overloadSetter can directly pass the
  61. // method function, without swapping arguments.
  62. if (hasOwnProperty.call(object, k)) fn.call(bind, k, object[k]);
  63. }
  64. }
  65. /*</ltIE8>*/
  66. // Function overloading
  67. var Function = this.Function;
  68. Function.prototype.overloadSetter = function(usePlural){
  69. var self = this;
  70. return function(a, b){
  71. if (a == null) return this;
  72. if (usePlural || typeof a != 'string'){
  73. for (var k in a) self.call(this, k, a[k]);
  74. /*<ltIE8>*/
  75. forEachObjectEnumberableKey(a, self, this);
  76. /*</ltIE8>*/
  77. } else {
  78. self.call(this, a, b);
  79. }
  80. return this;
  81. };
  82. };
  83. Function.prototype.overloadGetter = function(usePlural){
  84. var self = this;
  85. return function(a){
  86. var args, result;
  87. if (typeof a != 'string') args = a;
  88. else if (arguments.length > 1) args = arguments;
  89. else if (usePlural) args = [a];
  90. if (args){
  91. result = {};
  92. for (var i = 0; i < args.length; i++) result[args[i]] = self.call(this, args[i]);
  93. } else {
  94. result = self.call(this, a);
  95. }
  96. return result;
  97. };
  98. };
  99. Function.prototype.extend = function(key, value){
  100. this[key] = value;
  101. }.overloadSetter();
  102. Function.prototype.implement = function(key, value){
  103. this.prototype[key] = value;
  104. }.overloadSetter();
  105. // From
  106. var slice = Array.prototype.slice;
  107. Array.convert = function(item){
  108. if (item == null) return [];
  109. return (Type.isEnumerable(item) && typeof item != 'string') ? (typeOf(item) == 'array') ? item : slice.call(item) : [item];
  110. };
  111. Function.convert = function(item){
  112. return (typeOf(item) == 'function') ? item : function(){
  113. return item;
  114. };
  115. };
  116. Number.convert = function(item){
  117. var number = parseFloat(item);
  118. return isFinite(number) ? number : null;
  119. };
  120. String.convert = function(item){
  121. return item + '';
  122. };
  123. /*<1.5compat>*/
  124. if(!Array.from)Array.from = Array.convert;
  125. /*</1.5compat>*/
  126. Function.from = Function.convert;
  127. Number.from = Number.convert;
  128. String.from = String.convert;
  129. // hide, protect
  130. Function.implement({
  131. hide: function(){
  132. this.$hidden = true;
  133. return this;
  134. },
  135. protect: function(){
  136. this.$protected = true;
  137. return this;
  138. }
  139. });
  140. // Type
  141. var Type = this.Type = function(name, object){
  142. if (name){
  143. var lower = name.toLowerCase();
  144. var typeCheck = function(item){
  145. return (typeOf(item) == lower);
  146. };
  147. Type['is' + name] = typeCheck;
  148. if (object != null){
  149. object.prototype.$family = (function(){
  150. return lower;
  151. }).hide();
  152. //<1.2compat>
  153. object.type = typeCheck;
  154. //</1.2compat>
  155. }
  156. }
  157. if (object == null) return null;
  158. object.extend(this);
  159. object.$constructor = Type;
  160. object.prototype.$constructor = object;
  161. return object;
  162. };
  163. var toString = Object.prototype.toString;
  164. Type.isEnumerable = function(item){
  165. return (item != null && typeof item.length == 'number' && toString.call(item) != '[object Function]' );
  166. };
  167. var hooks = {};
  168. var hooksOf = function(object){
  169. var type = typeOf(object.prototype);
  170. return hooks[type] || (hooks[type] = []);
  171. };
  172. var implement = function(name, method){
  173. if (method && method.$hidden) return;
  174. var hooks = hooksOf(this);
  175. for (var i = 0; i < hooks.length; i++){
  176. var hook = hooks[i];
  177. if (typeOf(hook) == 'type') implement.call(hook, name, method);
  178. else hook.call(this, name, method);
  179. }
  180. var previous = this.prototype[name];
  181. if (previous == null || !previous.$protected) this.prototype[name] = method;
  182. if (this[name] == null && typeOf(method) == 'function') extend.call(this, name, function(item){
  183. return method.apply(item, slice.call(arguments, 1));
  184. });
  185. };
  186. var extend = function(name, method){
  187. if (method && method.$hidden) return;
  188. var previous = this[name];
  189. if (previous == null || !previous.$protected) this[name] = method;
  190. };
  191. Type.implement({
  192. implement: implement.overloadSetter(),
  193. extend: extend.overloadSetter(),
  194. alias: function(name, existing){
  195. implement.call(this, name, this.prototype[existing]);
  196. }.overloadSetter(),
  197. mirror: function(hook){
  198. hooksOf(this).push(hook);
  199. return this;
  200. }
  201. });
  202. new Type('Type', Type);
  203. // Default Types
  204. var force = function(name, object, methods){
  205. var isType = (object != Object),
  206. prototype = object.prototype;
  207. if (isType) object = new Type(name, object);
  208. for (var i = 0, l = methods.length; i < l; i++){
  209. var key = methods[i],
  210. generic = object[key],
  211. proto = prototype[key];
  212. if (generic) generic.protect();
  213. if (isType && proto) object.implement(key, proto.protect());
  214. }
  215. if (isType){
  216. var methodsEnumerable = prototype.propertyIsEnumerable(methods[0]);
  217. object.forEachMethod = function(fn){
  218. if (!methodsEnumerable) for (var i = 0, l = methods.length; i < l; i++){
  219. fn.call(prototype, prototype[methods[i]], methods[i]);
  220. }
  221. for (var key in prototype) fn.call(prototype, prototype[key], key);
  222. };
  223. }
  224. return force;
  225. };
  226. force('String', String, [
  227. 'charAt', 'charCodeAt', 'concat', 'contains', 'indexOf', 'lastIndexOf', 'match', 'quote', 'replace', 'search',
  228. 'slice', 'split', 'substr', 'substring', 'trim', 'toLowerCase', 'toUpperCase'
  229. ])('Array', Array, [
  230. 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice',
  231. 'indexOf', 'lastIndexOf', 'filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight', 'contains'
  232. ])('Number', Number, [
  233. 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision'
  234. ])('Function', Function, [
  235. 'apply', 'call', 'bind'
  236. ])('RegExp', RegExp, [
  237. 'exec', 'test'
  238. ])('Object', Object, [
  239. 'create', 'defineProperty', 'defineProperties', 'keys',
  240. 'getPrototypeOf', 'getOwnPropertyDescriptor', 'getOwnPropertyNames',
  241. 'preventExtensions', 'isExtensible', 'seal', 'isSealed', 'freeze', 'isFrozen'
  242. ])('Date', Date, ['now']);
  243. Object.extend = extend.overloadSetter();
  244. Date.extend('now', function(){
  245. return +(new Date);
  246. });
  247. new Type('Boolean', Boolean);
  248. // fixes NaN returning as Number
  249. Number.prototype.$family = function(){
  250. return isFinite(this) ? 'number' : 'null';
  251. }.hide();
  252. // Number.random
  253. Number.extend('random', function(min, max){
  254. return Math.floor(Math.random() * (max - min + 1) + min);
  255. });
  256. // forEach, each, keys
  257. Array.implement({
  258. /*<!ES5>*/
  259. forEach: function(fn, bind){
  260. for (var i = 0, l = this.length; i < l; i++){
  261. if (i in this) fn.call(bind, this[i], i, this);
  262. }
  263. },
  264. /*</!ES5>*/
  265. each: function(fn, bind){
  266. Array.forEach(this, fn, bind);
  267. return this;
  268. }
  269. });
  270. Object.extend({
  271. keys: function(object){
  272. var keys = [];
  273. for (var k in object){
  274. if (hasOwnProperty.call(object, k)) keys.push(k);
  275. }
  276. /*<ltIE8>*/
  277. forEachObjectEnumberableKey(object, function(k){
  278. keys.push(k);
  279. });
  280. /*</ltIE8>*/
  281. return keys;
  282. },
  283. forEach: function(object, fn, bind){
  284. if (object) Object.keys(object).forEach(function(key){
  285. fn.call(bind, object[key], key, object);
  286. });
  287. }
  288. });
  289. Object.each = Object.forEach;
  290. // Array & Object cloning, Object merging and appending
  291. var cloneOf = function(item){
  292. switch (typeOf(item)){
  293. case 'array': return item.clone();
  294. case 'object': return Object.clone(item);
  295. default: return item;
  296. }
  297. };
  298. Array.implement('clone', function(){
  299. var i = this.length, clone = new Array(i);
  300. while (i--) clone[i] = cloneOf(this[i]);
  301. return clone;
  302. });
  303. var mergeOne = function(source, key, current){
  304. switch (typeOf(current)){
  305. case 'object':
  306. if (typeOf(source[key]) == 'object') Object.merge(source[key], current);
  307. else source[key] = Object.clone(current);
  308. break;
  309. case 'array': source[key] = current.clone(); break;
  310. default: source[key] = current;
  311. }
  312. return source;
  313. };
  314. Object.extend({
  315. merge: function(source, k, v){
  316. if (typeOf(k) == 'string') return mergeOne(source, k, v);
  317. for (var i = 1, l = arguments.length; i < l; i++){
  318. var object = arguments[i];
  319. for (var key in object) mergeOne(source, key, object[key]);
  320. }
  321. return source;
  322. },
  323. clone: function(object){
  324. var clone = {};
  325. for (var key in object) clone[key] = cloneOf(object[key]);
  326. return clone;
  327. },
  328. append: function(original){
  329. for (var i = 1, l = arguments.length; i < l; i++){
  330. var extended = arguments[i] || {};
  331. for (var key in extended) original[key] = extended[key];
  332. }
  333. return original;
  334. }
  335. });
  336. // Object-less types
  337. ['Object', 'WhiteSpace', 'TextNode', 'Collection', 'Arguments'].each(function(name){
  338. new Type(name);
  339. });
  340. // Unique ID
  341. var UID = Date.now();
  342. String.extend('uniqueID', function(){
  343. return (UID++).toString(36);
  344. });
  345. //<1.2compat>
  346. var Hash = this.Hash = new Type('Hash', function(object){
  347. if (typeOf(object) == 'hash') object = Object.clone(object.getClean());
  348. for (var key in object) this[key] = object[key];
  349. return this;
  350. });
  351. Hash.implement({
  352. forEach: function(fn, bind){
  353. Object.forEach(this, fn, bind);
  354. },
  355. getClean: function(){
  356. var clean = {};
  357. for (var key in this){
  358. if (this.hasOwnProperty(key)) clean[key] = this[key];
  359. }
  360. return clean;
  361. },
  362. getLength: function(){
  363. var length = 0;
  364. for (var key in this){
  365. if (this.hasOwnProperty(key)) length++;
  366. }
  367. return length;
  368. }
  369. });
  370. Hash.alias('each', 'forEach');
  371. Object.type = Type.isObject;
  372. var Native = this.Native = function(properties){
  373. return new Type(properties.name, properties.initialize);
  374. };
  375. Native.type = Type.type;
  376. Native.implement = function(objects, methods){
  377. for (var i = 0; i < objects.length; i++) objects[i].implement(methods);
  378. return Native;
  379. };
  380. var arrayType = Array.type;
  381. Array.type = function(item){
  382. return instanceOf(item, Array) || arrayType(item);
  383. };
  384. this.$A = function(item){
  385. return Array.convert(item).slice();
  386. };
  387. this.$arguments = function(i){
  388. return function(){
  389. return arguments[i];
  390. };
  391. };
  392. this.$chk = function(obj){
  393. return !!(obj || obj === 0);
  394. };
  395. this.$clear = function(timer){
  396. clearTimeout(timer);
  397. clearInterval(timer);
  398. return null;
  399. };
  400. this.$defined = function(obj){
  401. return (obj != null);
  402. };
  403. this.$each = function(iterable, fn, bind){
  404. var type = typeOf(iterable);
  405. ((type == 'arguments' || type == 'collection' || type == 'array' || type == 'elements') ? Array : Object).each(iterable, fn, bind);
  406. };
  407. this.$empty = function(){};
  408. this.$extend = function(original, extended){
  409. return Object.append(original, extended);
  410. };
  411. this.$H = function(object){
  412. return new Hash(object);
  413. };
  414. this.$merge = function(){
  415. var args = Array.slice(arguments);
  416. args.unshift({});
  417. return Object.merge.apply(null, args);
  418. };
  419. this.$lambda = Function.convert;
  420. this.$mixin = Object.merge;
  421. this.$random = Number.random;
  422. this.$splat = Array.convert;
  423. this.$time = Date.now;
  424. this.$type = function(object){
  425. var type = typeOf(object);
  426. if (type == 'elements') return 'array';
  427. return (type == 'null') ? false : type;
  428. };
  429. this.$unlink = function(object){
  430. switch (typeOf(object)){
  431. case 'object': return Object.clone(object);
  432. case 'array': return Array.clone(object);
  433. case 'hash': return new Hash(object);
  434. default: return object;
  435. }
  436. };
  437. //</1.2compat>
  438. })();
  439. /*
  440. ---
  441. name: Array
  442. description: Contains Array Prototypes like each, contains, and erase.
  443. license: MIT-style license.
  444. requires: [Type]
  445. provides: Array
  446. ...
  447. */
  448. Array.implement({
  449. /*<!ES5>*/
  450. every: function(fn, bind){
  451. for (var i = 0, l = this.length >>> 0; i < l; i++){
  452. if ((i in this) && !fn.call(bind, this[i], i, this)) return false;
  453. }
  454. return true;
  455. },
  456. filter: function(fn, bind){
  457. var results = [];
  458. for (var value, i = 0, l = this.length >>> 0; i < l; i++) if (i in this){
  459. value = this[i];
  460. if (fn.call(bind, value, i, this)) results.push(value);
  461. }
  462. return results;
  463. },
  464. indexOf: function(item, from){
  465. var length = this.length >>> 0;
  466. for (var i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++){
  467. if (this[i] === item) return i;
  468. }
  469. return -1;
  470. },
  471. map: function(fn, bind){
  472. var length = this.length >>> 0, results = Array(length);
  473. for (var i = 0; i < length; i++){
  474. if (i in this) results[i] = fn.call(bind, this[i], i, this);
  475. }
  476. return results;
  477. },
  478. some: function(fn, bind){
  479. for (var i = 0, l = this.length >>> 0; i < l; i++){
  480. if ((i in this) && fn.call(bind, this[i], i, this)) return true;
  481. }
  482. return false;
  483. },
  484. /*</!ES5>*/
  485. clean: function(){
  486. return this.filter(function(item){
  487. return item != null;
  488. });
  489. },
  490. invoke: function(methodName){
  491. var args = Array.slice(arguments, 1);
  492. return this.map(function(item){
  493. return item[methodName].apply(item, args);
  494. });
  495. },
  496. associate: function(keys){
  497. var obj = {}, length = Math.min(this.length, keys.length);
  498. for (var i = 0; i < length; i++) obj[keys[i]] = this[i];
  499. return obj;
  500. },
  501. link: function(object){
  502. var result = {};
  503. for (var i = 0, l = this.length; i < l; i++){
  504. for (var key in object){
  505. if (object[key](this[i])){
  506. result[key] = this[i];
  507. delete object[key];
  508. break;
  509. }
  510. }
  511. }
  512. return result;
  513. },
  514. contains: function(item, from){
  515. return this.indexOf(item, from) != -1;
  516. },
  517. append: function(array){
  518. this.push.apply(this, array);
  519. return this;
  520. },
  521. getLast: function(){
  522. return (this.length) ? this[this.length - 1] : null;
  523. },
  524. getRandom: function(){
  525. return (this.length) ? this[Number.random(0, this.length - 1)] : null;
  526. },
  527. include: function(item){
  528. if (!this.contains(item)) this.push(item);
  529. return this;
  530. },
  531. combine: function(array){
  532. for (var i = 0, l = array.length; i < l; i++) this.include(array[i]);
  533. return this;
  534. },
  535. erase: function(item){
  536. for (var i = this.length; i--;){
  537. if (this[i] === item) this.splice(i, 1);
  538. }
  539. return this;
  540. },
  541. empty: function(){
  542. this.length = 0;
  543. return this;
  544. },
  545. flatten: function(){
  546. var array = [];
  547. for (var i = 0, l = this.length; i < l; i++){
  548. var type = typeOf(this[i]);
  549. if (type == 'null') continue;
  550. array = array.concat((type == 'array' || type == 'collection' || type == 'arguments' || instanceOf(this[i], Array)) ? Array.flatten(this[i]) : this[i]);
  551. }
  552. return array;
  553. },
  554. pick: function(){
  555. for (var i = 0, l = this.length; i < l; i++){
  556. if (this[i] != null) return this[i];
  557. }
  558. return null;
  559. },
  560. hexToRgb: function(array){
  561. if (this.length != 3) return null;
  562. var rgb = this.map(function(value){
  563. if (value.length == 1) value += value;
  564. return parseInt(value, 16);
  565. });
  566. return (array) ? rgb : 'rgb(' + rgb + ')';
  567. },
  568. rgbToHex: function(array){
  569. if (this.length < 3) return null;
  570. if (this.length == 4 && this[3] == 0 && !array) return 'transparent';
  571. var hex = [];
  572. for (var i = 0; i < 3; i++){
  573. var bit = (this[i] - 0).toString(16);
  574. hex.push((bit.length == 1) ? '0' + bit : bit);
  575. }
  576. return (array) ? hex : '#' + hex.join('');
  577. }
  578. });
  579. //<1.2compat>
  580. Array.alias('extend', 'append');
  581. var $pick = this.$pick = function(){
  582. return Array.convert(arguments).pick();
  583. };
  584. //</1.2compat>
  585. /*
  586. ---
  587. name: Function
  588. description: Contains Function Prototypes like create, bind, pass, and delay.
  589. license: MIT-style license.
  590. requires: Type
  591. provides: Function
  592. ...
  593. */
  594. Function.extend({
  595. attempt: function(){
  596. for (var i = 0, l = arguments.length; i < l; i++){
  597. try {
  598. return arguments[i]();
  599. } catch (e){}
  600. }
  601. return null;
  602. }
  603. });
  604. Function.implement({
  605. attempt: function(args, bind){
  606. try {
  607. return this.apply(bind, Array.convert(args));
  608. } catch (e){}
  609. return null;
  610. },
  611. /*<!ES5-bind>*/
  612. bind: function(that){
  613. var self = this,
  614. args = arguments.length > 1 ? Array.slice(arguments, 1) : null,
  615. F = function(){};
  616. var bound = function(){
  617. var context = that, length = arguments.length;
  618. if (this instanceof bound){
  619. F.prototype = self.prototype;
  620. context = new F;
  621. }
  622. var result = (!args && !length)
  623. ? self.call(context)
  624. : self.apply(context, args && length ? args.concat(Array.slice(arguments)) : args || arguments);
  625. return context == that ? result : context;
  626. };
  627. return bound;
  628. },
  629. /*</!ES5-bind>*/
  630. pass: function(args, bind){
  631. var self = this;
  632. if (args != null) args = Array.convert(args);
  633. return function(){
  634. return self.apply(bind, args || arguments);
  635. };
  636. },
  637. delay: function(delay, bind, args){
  638. return setTimeout(this.pass((args == null ? [] : args), bind), delay);
  639. },
  640. periodical: function(periodical, bind, args){
  641. return setInterval(this.pass((args == null ? [] : args), bind), periodical);
  642. }
  643. });
  644. //<1.2compat>
  645. //delete Function.prototype.bind;
  646. Function.implement({
  647. create: function(options){
  648. var self = this;
  649. options = options || {};
  650. return function(event){
  651. var args = options.arguments;
  652. args = (args != null) ? Array.convert(args) : Array.slice(arguments, (options.event) ? 1 : 0);
  653. if (options.event) args.unshift(event || window.event);
  654. var returns = function(){
  655. return self.apply(options.bind || null, args);
  656. };
  657. if (options.delay) return setTimeout(returns, options.delay);
  658. if (options.periodical) return setInterval(returns, options.periodical);
  659. if (options.attempt) return Function.attempt(returns);
  660. return returns();
  661. };
  662. },
  663. // bind: function(bind, args){
  664. // var self = this;
  665. // if (args != null) args = Array.convert(args);
  666. // return function(){
  667. // return self.apply(bind, args || arguments);
  668. // };
  669. // },
  670. bindWithEvent: function(bind, args){
  671. var self = this;
  672. if (args != null) args = Array.convert(args);
  673. return function(event){
  674. return self.apply(bind, (args == null) ? arguments : [event].concat(args));
  675. };
  676. },
  677. run: function(args, bind){
  678. return this.apply(bind, Array.convert(args));
  679. }
  680. });
  681. if (Object.create == Function.prototype.create) Object.create = null;
  682. var $try = Function.attempt;
  683. //</1.2compat>
  684. /*
  685. ---
  686. name: Number
  687. description: Contains Number Prototypes like limit, round, times, and ceil.
  688. license: MIT-style license.
  689. requires: Type
  690. provides: Number
  691. ...
  692. */
  693. Number.implement({
  694. limit: function(min, max){
  695. return Math.min(max, Math.max(min, this));
  696. },
  697. round: function(precision){
  698. precision = Math.pow(10, precision || 0).toFixed(precision < 0 ? -precision : 0);
  699. return Math.round(this * precision) / precision;
  700. },
  701. times: function(fn, bind){
  702. for (var i = 0; i < this; i++) fn.call(bind, i, this);
  703. },
  704. toFloat: function(){
  705. return parseFloat(this);
  706. },
  707. toInt: function(base){
  708. return parseInt(this, base || 10);
  709. }
  710. });
  711. Number.alias('each', 'times');
  712. (function(math){
  713. var methods = {};
  714. math.each(function(name){
  715. if (!Number[name]) methods[name] = function(){
  716. return Math[name].apply(null, [this].concat(Array.convert(arguments)));
  717. };
  718. });
  719. Number.implement(methods);
  720. })(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']);
  721. /*
  722. ---
  723. name: String
  724. description: Contains String Prototypes like camelCase, capitalize, test, and toInt.
  725. license: MIT-style license.
  726. requires: [Type, Array]
  727. provides: String
  728. ...
  729. */
  730. String.implement({
  731. //<!ES6>
  732. contains: function(string, index){
  733. return (index ? String(this).slice(index) : String(this)).indexOf(string) > -1;
  734. },
  735. //</!ES6>
  736. test: function(regex, params){
  737. return ((typeOf(regex) == 'regexp') ? regex : new RegExp('' + regex, params)).test(this);
  738. },
  739. trim: function(){
  740. return String(this).replace(/^\s+|\s+$/g, '');
  741. },
  742. clean: function(){
  743. return String(this).replace(/\s+/g, ' ').trim();
  744. },
  745. camelCase: function(){
  746. return String(this).replace(/-\D/g, function(match){
  747. return match.charAt(1).toUpperCase();
  748. });
  749. },
  750. hyphenate: function(){
  751. return String(this).replace(/[A-Z]/g, function(match){
  752. return ('-' + match.charAt(0).toLowerCase());
  753. });
  754. },
  755. capitalize: function(){
  756. return String(this).replace(/\b[a-z]/g, function(match){
  757. return match.toUpperCase();
  758. });
  759. },
  760. escapeRegExp: function(){
  761. return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1');
  762. },
  763. toInt: function(base){
  764. return parseInt(this, base || 10);
  765. },
  766. toFloat: function(){
  767. return parseFloat(this);
  768. },
  769. hexToRgb: function(array){
  770. var hex = String(this).match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
  771. return (hex) ? hex.slice(1).hexToRgb(array) : null;
  772. },
  773. rgbToHex: function(array){
  774. var rgb = String(this).match(/\d{1,3}/g);
  775. return (rgb) ? rgb.rgbToHex(array) : null;
  776. },
  777. substitute: function(object, regexp){
  778. return String(this).replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){
  779. if (match.charAt(0) == '\\') return match.slice(1);
  780. return (object[name] != null) ? object[name] : '';
  781. });
  782. }
  783. });
  784. //<1.4compat>
  785. String.prototype.contains = function(string, separator){
  786. return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : String(this).indexOf(string) > -1;
  787. };
  788. //</1.4compat>
  789. /*
  790. ---
  791. name: Browser
  792. description: The Browser Object. Contains Browser initialization, Window and Document, and the Browser Hash.
  793. license: MIT-style license.
  794. requires: [Array, Function, Number, String]
  795. provides: [Browser, Window, Document]
  796. ...
  797. */
  798. (function(){
  799. var document = this.document;
  800. var window = document.window = this;
  801. var parse = function(ua, platform){
  802. ua = ua.toLowerCase();
  803. platform = (platform ? platform.toLowerCase() : '');
  804. // chrome is included in the edge UA, so need to check for edge first,
  805. // before checking if it's chrome.
  806. var UA = ua.match(/(edge)[\s\/:]([\w\d\.]+)/);
  807. if (!UA){
  808. UA = ua.match(/(opera|ie|firefox|chrome|trident|crios|version)[\s\/:]([\w\d\.]+)?.*?(safari|(?:rv[\s\/:]|version[\s\/:])([\w\d\.]+)|$)/) || [null, 'unknown', 0];
  809. }
  810. if (UA[1] == 'trident'){
  811. UA[1] = 'ie';
  812. if (UA[4]) UA[2] = UA[4];
  813. } else if (UA[1] == 'crios'){
  814. UA[1] = 'chrome';
  815. }
  816. platform = ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android)/) || ua.match(/mac|win|linux/) || ['other'])[0];
  817. if (platform == 'win') platform = 'windows';
  818. return {
  819. extend: Function.prototype.extend,
  820. name: (UA[1] == 'version') ? UA[3] : UA[1],
  821. version: parseFloat((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]),
  822. platform: platform
  823. };
  824. };
  825. var Browser = this.Browser = parse(navigator.userAgent, navigator.platform);
  826. if (Browser.name == 'ie' && document.documentMode){
  827. Browser.version = document.documentMode;
  828. }
  829. Browser.extend({
  830. Features: {
  831. xpath: !!(document.evaluate),
  832. air: !!(window.runtime),
  833. query: !!(document.querySelector),
  834. json: !!(window.JSON)
  835. },
  836. parseUA: parse
  837. });
  838. //<1.4compat>
  839. Browser[Browser.name] = true;
  840. Browser[Browser.name + parseInt(Browser.version, 10)] = true;
  841. if (Browser.name == 'ie' && Browser.version >= '11'){
  842. delete Browser.ie;
  843. }
  844. var platform = Browser.platform;
  845. if (platform == 'windows'){
  846. platform = 'win';
  847. }
  848. Browser.Platform = {
  849. name: platform
  850. };
  851. Browser.Platform[platform] = true;
  852. //</1.4compat>
  853. // Request
  854. Browser.Request = (function(){
  855. var XMLHTTP = function(){
  856. return new XMLHttpRequest();
  857. };
  858. var MSXML2 = function(){
  859. return new ActiveXObject('MSXML2.XMLHTTP');
  860. };
  861. var MSXML = function(){
  862. return new ActiveXObject('Microsoft.XMLHTTP');
  863. };
  864. return Function.attempt(function(){
  865. XMLHTTP();
  866. return XMLHTTP;
  867. }, function(){
  868. MSXML2();
  869. return MSXML2;
  870. }, function(){
  871. MSXML();
  872. return MSXML;
  873. });
  874. })();
  875. Browser.Features.xhr = !!(Browser.Request);
  876. //<1.4compat>
  877. // Flash detection
  878. var version = (Function.attempt(function(){
  879. return navigator.plugins['Shockwave Flash'].description;
  880. }, function(){
  881. return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
  882. }) || '0 r0').match(/\d+/g);
  883. Browser.Plugins = {
  884. Flash: {
  885. version: Number(version[0] || '0.' + version[1]) || 0,
  886. build: Number(version[2]) || 0
  887. }
  888. };
  889. //</1.4compat>
  890. // String scripts
  891. Browser.exec = function(text){
  892. if (!text) return text;
  893. if (window.execScript){
  894. window.execScript(text);
  895. } else {
  896. var script = document.createElement('script');
  897. script.setAttribute('type', 'text/javascript');
  898. script.text = text;
  899. var head = document.head;
  900. head.appendChild(script);
  901. head.removeChild(script);
  902. }
  903. return text;
  904. };
  905. String.implement('stripScripts', function(exec){
  906. var scripts = '';
  907. var text = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(all, code){
  908. scripts += code + '\n';
  909. return '';
  910. });
  911. if (exec === true) Browser.exec(scripts);
  912. else if (typeOf(exec) == 'function') exec(scripts, text);
  913. return text;
  914. });
  915. String.implement('stripScriptSrcs', function(exec){
  916. var scripts = '';
  917. var text = this.replace(/<script[^<]src\s*=\s*"([^"]*)[^\]]>/gi, function(all, code){
  918. scripts += code + '\n';
  919. return '';
  920. });
  921. if (exec === true) Browser.exec(scripts);
  922. else if (typeOf(exec) == 'function') exec(scripts, text);
  923. return text;
  924. });
  925. // Window, Document
  926. Browser.extend({
  927. Document: this.Document,
  928. Window: this.Window,
  929. Element: this.Element,
  930. Event: this.Event
  931. });
  932. this.Window = this.$constructor = new Type('Window', function(){});
  933. this.$family = Function.convert('window').hide();
  934. Window.mirror(function(name, method){
  935. window[name] = method;
  936. });
  937. this.Document = document.$constructor = new Type('Document', function(){});
  938. document.$family = Function.convert('document').hide();
  939. Document.mirror(function(name, method){
  940. document[name] = method;
  941. });
  942. document.html = document.documentElement;
  943. if (!document.head) document.head = document.getElementsByTagName('head')[0];
  944. if (document.execCommand) try {
  945. document.execCommand('BackgroundImageCache', false, true);
  946. } catch (e){}
  947. /*<ltIE9>*/
  948. if (this.attachEvent && !this.addEventListener){
  949. var unloadEvent = function(){
  950. this.detachEvent('onunload', unloadEvent);
  951. document.head = document.html = document.window = null;
  952. window = this.Window = document = null;
  953. };
  954. this.attachEvent('onunload', unloadEvent);
  955. }
  956. // IE fails on collections and <select>.options (refers to <select>)
  957. var arrayFrom = Array.convert;
  958. try {
  959. arrayFrom(document.html.childNodes);
  960. } catch (e){
  961. Array.convert = function(item){
  962. if (typeof item != 'string' && Type.isEnumerable(item) && typeOf(item) != 'array'){
  963. var i = item.length, array = new Array(i);
  964. while (i--) array[i] = item[i];
  965. return array;
  966. }
  967. return arrayFrom(item);
  968. };
  969. var prototype = Array.prototype,
  970. slice = prototype.slice;
  971. ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice'].each(function(name){
  972. var method = prototype[name];
  973. Array[name] = function(item){
  974. return method.apply(Array.convert(item), slice.call(arguments, 1));
  975. };
  976. });
  977. }
  978. /*</ltIE9>*/
  979. //<1.2compat>
  980. if (Browser.Platform.ios) Browser.Platform.ipod = true;
  981. Browser.Engine = {};
  982. var setEngine = function(name, version){
  983. Browser.Engine.name = name;
  984. Browser.Engine[name + version] = true;
  985. Browser.Engine.version = version;
  986. };
  987. if (Browser.ie){
  988. Browser.Engine.trident = true;
  989. switch (Browser.version){
  990. case 6: setEngine('trident', 4); break;
  991. case 7: setEngine('trident', 5); break;
  992. case 8: setEngine('trident', 6);
  993. }
  994. }
  995. if (Browser.firefox){
  996. Browser.Engine.gecko = true;
  997. if (Browser.version >= 3) setEngine('gecko', 19);
  998. else setEngine('gecko', 18);
  999. }
  1000. if (Browser.safari || Browser.chrome){
  1001. Browser.Engine.webkit = true;
  1002. switch (Browser.version){
  1003. case 2: setEngine('webkit', 419); break;
  1004. case 3: setEngine('webkit', 420); break;
  1005. case 4: setEngine('webkit', 525);
  1006. }
  1007. }
  1008. if (Browser.opera){
  1009. Browser.Engine.presto = true;
  1010. if (Browser.version >= 9.6) setEngine('presto', 960);
  1011. else if (Browser.version >= 9.5) setEngine('presto', 950);
  1012. else setEngine('presto', 925);
  1013. }
  1014. if (Browser.name == 'unknown'){
  1015. switch ((navigator.userAgent.toLowerCase().match(/(?:webkit|khtml|gecko)/) || [])[0]){
  1016. case 'webkit':
  1017. case 'khtml':
  1018. Browser.Engine.webkit = true;
  1019. break;
  1020. case 'gecko':
  1021. Browser.Engine.gecko = true;
  1022. }
  1023. }
  1024. this.$exec = Browser.exec;
  1025. //</1.2compat>
  1026. })();
  1027. /*
  1028. ---
  1029. name: Class
  1030. description: Contains the Class Function for easily creating, extending, and implementing reusable Classes.
  1031. license: MIT-style license.
  1032. requires: [Array, String, Function, Number]
  1033. provides: Class
  1034. ...
  1035. */
  1036. (function(){
  1037. var Class = this.Class = new Type('Class', function(params){
  1038. if (instanceOf(params, Function)) params = {initialize: params};
  1039. var newClass = function(){
  1040. reset(this);
  1041. if (newClass.$prototyping) return this;
  1042. this.$caller = null;
  1043. this.$family = null;
  1044. var value = (this.initialize) ? this.initialize.apply(this, arguments) : this;
  1045. this.$caller = this.caller = null;
  1046. return value;
  1047. }.extend(this).implement(params);
  1048. newClass.$constructor = Class;
  1049. newClass.prototype.$constructor = newClass;
  1050. newClass.prototype.parent = parent;
  1051. return newClass;
  1052. });
  1053. var parent = function(){
  1054. if (!this.$caller) throw new Error('The method "parent" cannot be called.');
  1055. var name = this.$caller.$name,
  1056. parent = this.$caller.$owner.parent,
  1057. previous = (parent) ? parent.prototype[name] : null;
  1058. if (!previous) throw new Error('The method "' + name + '" has no parent.');
  1059. return previous.apply(this, arguments);
  1060. };
  1061. var reset = function(object){
  1062. for (var key in object){
  1063. var value = object[key];
  1064. switch (typeOf(value)){
  1065. case 'object':
  1066. var F = function(){};
  1067. F.prototype = value;
  1068. object[key] = reset(new F);
  1069. break;
  1070. case 'array': object[key] = value.clone(); break;
  1071. }
  1072. }
  1073. return object;
  1074. };
  1075. var wrap = function(self, key, method){
  1076. if (method.$origin) method = method.$origin;
  1077. var wrapper = function(){
  1078. if (method.$protected && this.$caller == null) throw new Error('The method "' + key + '" cannot be called.');
  1079. var caller = this.caller, current = this.$caller;
  1080. this.caller = current; this.$caller = wrapper;
  1081. var result = method.apply(this, arguments);
  1082. this.$caller = current; this.caller = caller;
  1083. return result;
  1084. }.extend({$owner: self, $origin: method, $name: key});
  1085. return wrapper;
  1086. };
  1087. var implement = function(key, value, retain){
  1088. if (Class.Mutators.hasOwnProperty(key)){
  1089. value = Class.Mutators[key].call(this, value);
  1090. if (value == null) return this;
  1091. }
  1092. if (typeOf(value) == 'function'){
  1093. if (value.$hidden) return this;
  1094. this.prototype[key] = (retain) ? value : wrap(this, key, value);
  1095. } else {
  1096. Object.merge(this.prototype, key, value);
  1097. }
  1098. return this;
  1099. };
  1100. var getInstance = function(klass){
  1101. klass.$prototyping = true;
  1102. var proto = new klass;
  1103. delete klass.$prototyping;
  1104. return proto;
  1105. };
  1106. Class.implement('implement', implement.overloadSetter());
  1107. Class.Mutators = {
  1108. Extends: function(parent){
  1109. this.parent = parent;
  1110. this.prototype = getInstance(parent);
  1111. },
  1112. Implements: function(items){
  1113. Array.convert(items).each(function(item){
  1114. var instance = new item;
  1115. for (var key in instance) implement.call(this, key, instance[key], true);
  1116. }, this);
  1117. }
  1118. };
  1119. })();
  1120. /*
  1121. ---
  1122. name: Class.Extras
  1123. description: Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks.
  1124. license: MIT-style license.
  1125. requires: Class
  1126. provides: [Class.Extras, Chain, Events, Options]
  1127. ...
  1128. */
  1129. (function(){
  1130. this.Chain = new Class({
  1131. $chain: [],
  1132. chain: function(){
  1133. this.$chain.append(Array.flatten(arguments));
  1134. return this;
  1135. },
  1136. callChain: function(){
  1137. return (this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false;
  1138. },
  1139. clearChain: function(){
  1140. this.$chain.empty();
  1141. return this;
  1142. }
  1143. });
  1144. var removeOn = function(string){
  1145. return string.replace(/^on([A-Z])/, function(full, first){
  1146. return first.toLowerCase();
  1147. });
  1148. };
  1149. this.Events = new Class({
  1150. $events: {},
  1151. addEvent: function(type, fn, internal){
  1152. type = removeOn(type);
  1153. /*<1.2compat>*/
  1154. if (fn == $empty) return this;
  1155. /*</1.2compat>*/
  1156. this.$events[type] = (this.$events[type] || []).include(fn);
  1157. if (internal) fn.internal = true;
  1158. return this;
  1159. },
  1160. addEvents: function(events){
  1161. for (var type in events) this.addEvent(type, events[type]);
  1162. return this;
  1163. },
  1164. fireEvent: function(type, args, delay){
  1165. type = removeOn(type);
  1166. var events = this.$events[type];
  1167. if (!events) return this;
  1168. args = Array.convert(args);
  1169. events.each(function(fn){
  1170. if (delay) fn.delay(delay, this, args);
  1171. else fn.apply(this, args);
  1172. }, this);
  1173. return this;
  1174. },
  1175. removeEvent: function(type, fn){
  1176. type = removeOn(type);
  1177. var events = this.$events[type];
  1178. if (events && !fn.internal){
  1179. var index = events.indexOf(fn);
  1180. if (index != -1) delete events[index];
  1181. }
  1182. return this;
  1183. },
  1184. removeEvents: function(events){
  1185. var type;
  1186. if (typeOf(events) == 'object'){
  1187. for (type in events) this.removeEvent(type, events[type]);
  1188. return this;
  1189. }
  1190. if (events) events = removeOn(events);
  1191. for (type in this.$events){
  1192. if (events && events != type) continue;
  1193. var fns = this.$events[type];
  1194. for (var i = fns.length; i--;) if (i in fns){
  1195. this.removeEvent(type, fns[i]);
  1196. }
  1197. }
  1198. return this;
  1199. }
  1200. });
  1201. this.Options = new Class({
  1202. setOptions: function(){
  1203. var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments));
  1204. if (this.addEvent) for (var option in options){
  1205. if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue;
  1206. this.addEvent(option, options[option]);
  1207. delete options[option];
  1208. }
  1209. return this;
  1210. }
  1211. });
  1212. })();
  1213. /*
  1214. ---
  1215. name: Class.Thenable
  1216. description: Contains a Utility Class that can be implemented into your own Classes to make them "thenable".
  1217. license: MIT-style license.
  1218. requires: Class
  1219. provides: [Class.Thenable]
  1220. ...
  1221. */
  1222. (function(){
  1223. var STATE_PENDING = 0,
  1224. STATE_FULFILLED = 1,
  1225. STATE_REJECTED = 2;
  1226. var Thenable = Class.Thenable = new Class({
  1227. $thenableState: STATE_PENDING,
  1228. $thenableResult: null,
  1229. $thenableReactions: [],
  1230. resolve: function(value){
  1231. resolve(this, value);
  1232. return this;
  1233. },
  1234. reject: function(reason){
  1235. reject(this, reason);
  1236. return this;
  1237. },
  1238. getThenableState: function(){
  1239. switch (this.$thenableState){
  1240. case STATE_PENDING:
  1241. return 'pending';
  1242. case STATE_FULFILLED:
  1243. return 'fulfilled';
  1244. case STATE_REJECTED:
  1245. return 'rejected';
  1246. }
  1247. },
  1248. resetThenable: function(reason){
  1249. reject(this, reason);
  1250. reset(this);
  1251. return this;
  1252. },
  1253. then: function(onFulfilled, onRejected){
  1254. if (typeof onFulfilled !== 'function') onFulfilled = 'Identity';
  1255. if (typeof onRejected !== 'function') onRejected = 'Thrower';
  1256. var thenable = new Thenable();
  1257. this.$thenableReactions.push({
  1258. thenable: thenable,
  1259. fulfillHandler: onFulfilled,
  1260. rejectHandler: onRejected
  1261. });
  1262. if (this.$thenableState !== STATE_PENDING){
  1263. react(this);
  1264. }
  1265. return thenable;
  1266. },
  1267. 'catch': function(onRejected){
  1268. return this.then(null, onRejected);
  1269. }
  1270. });
  1271. Thenable.extend({
  1272. resolve: function(value){
  1273. var thenable;
  1274. if (value instanceof Thenable){
  1275. thenable = value;
  1276. } else {
  1277. thenable = new Thenable();
  1278. resolve(thenable, value);
  1279. }
  1280. return thenable;
  1281. },
  1282. reject: function(reason){
  1283. var thenable = new Thenable();
  1284. reject(thenable, reason);
  1285. return thenable;
  1286. }
  1287. });
  1288. // Private functions
  1289. function resolve(thenable, value){
  1290. if (thenable.$thenableState === STATE_PENDING){
  1291. if (thenable === value){
  1292. reject(thenable, new TypeError('Tried to resolve a thenable with itself.'));
  1293. } else if (value && (typeof value === 'object' || typeof value === 'function')){
  1294. var then;
  1295. try {
  1296. then = value.then;
  1297. } catch (exception){
  1298. reject(thenable, exception);
  1299. }
  1300. if (typeof then === 'function'){
  1301. var resolved = false;
  1302. defer(function(){
  1303. try {
  1304. then.call(
  1305. value,
  1306. function(nextValue){
  1307. if (!resolved){
  1308. resolved = true;
  1309. resolve(thenable, nextValue);
  1310. }
  1311. },
  1312. function(reason){
  1313. if (!resolved){
  1314. resolved = true;
  1315. reject(thenable, reason);
  1316. }
  1317. }
  1318. );
  1319. } catch (exception){
  1320. if (!resolved){
  1321. resolved = true;
  1322. reject(thenable, exception);
  1323. }
  1324. }
  1325. });
  1326. } else {
  1327. fulfill(thenable, value);
  1328. }
  1329. } else {
  1330. fulfill(thenable, value);
  1331. }
  1332. }
  1333. }
  1334. function fulfill(thenable, value){
  1335. if (thenable.$thenableState === STATE_PENDING){
  1336. thenable.$thenableResult = value;
  1337. thenable.$thenableState = STATE_FULFILLED;
  1338. react(thenable);
  1339. }
  1340. }
  1341. function reject(thenable, reason){
  1342. if (thenable.$thenableState === STATE_PENDING){
  1343. thenable.$thenableResult = reason;
  1344. thenable.$thenableState = STATE_REJECTED;
  1345. react(thenable);
  1346. }
  1347. }
  1348. function reset(thenable){
  1349. if (thenable.$thenableState !== STATE_PENDING){
  1350. thenable.$thenableResult = null;
  1351. thenable.$thenableState = STATE_PENDING;
  1352. }
  1353. }
  1354. function react(thenable){
  1355. var state = thenable.$thenableState,
  1356. result = thenable.$thenableResult,
  1357. reactions = thenable.$thenableReactions,
  1358. type;
  1359. if (state === STATE_FULFILLED){
  1360. thenable.$thenableReactions = [];
  1361. type = 'fulfillHandler';
  1362. } else if (state == STATE_REJECTED){
  1363. thenable.$thenableReactions = [];
  1364. type = 'rejectHandler';
  1365. }
  1366. if (type){
  1367. defer(handle.pass([result, reactions, type]));
  1368. }
  1369. }
  1370. function handle(result, reactions, type){
  1371. for (var i = 0, l = reactions.length; i < l; ++i){
  1372. var reaction = reactions[i],
  1373. handler = reaction[type];
  1374. if (handler === 'Identity'){
  1375. resolve(reaction.thenable, result);
  1376. } else if (handler === 'Thrower'){
  1377. reject(reaction.thenable, result);
  1378. } else {
  1379. try {
  1380. resolve(reaction.thenable, handler(result));
  1381. } catch (exception){
  1382. reject(reaction.thenable, exception);
  1383. }
  1384. }
  1385. }
  1386. }
  1387. var defer;
  1388. if (typeof process !== 'undefined' && typeof process.nextTick === 'function'){
  1389. defer = process.nextTick;
  1390. } else if (typeof setImmediate !== 'undefined'){
  1391. defer = setImmediate;
  1392. } else {
  1393. defer = function(fn){
  1394. setTimeout(fn, 0);
  1395. };
  1396. }
  1397. })();
  1398. /*
  1399. ---
  1400. name: Object
  1401. description: Object generic methods
  1402. license: MIT-style license.
  1403. requires: Type
  1404. provides: [Object, Hash]
  1405. ...
  1406. */
  1407. (function(){
  1408. Object.extend({
  1409. subset: function(object, keys){
  1410. var results = {};
  1411. for (var i = 0, l = keys.length; i < l; i++){
  1412. var k = keys[i];
  1413. if (k in object) results[k] = object[k];
  1414. }
  1415. return results;
  1416. },
  1417. map: function(object, fn, bind){
  1418. var results = {};
  1419. var keys = Object.keys(object);
  1420. for (var i = 0; i < keys.length; i++){
  1421. var key = keys[i];
  1422. results[key] = fn.call(bind, object[key], key, object);
  1423. }
  1424. return results;
  1425. },
  1426. filter: function(object, fn, bind){
  1427. var results = {};
  1428. var keys = Object.keys(object);
  1429. for (var i = 0; i < keys.length; i++){
  1430. var key = keys[i], value = object[key];
  1431. if (fn.call(bind, value, key, object)) results[key] = value;
  1432. }
  1433. return results;
  1434. },
  1435. every: function(object, fn, bind){
  1436. var keys = Object.keys(object);
  1437. for (var i = 0; i < keys.length; i++){
  1438. var key = keys[i];
  1439. if (!fn.call(bind, object[key], key)) return false;
  1440. }
  1441. return true;
  1442. },
  1443. some: function(object, fn, bind){
  1444. var keys = Object.keys(object);
  1445. for (var i = 0; i < keys.length; i++){
  1446. var key = keys[i];
  1447. if (fn.call(bind, object[key], key)) return true;
  1448. }
  1449. return false;
  1450. },
  1451. values: function(object){
  1452. var values = [];
  1453. var keys = Object.keys(object);
  1454. for (var i = 0; i < keys.length; i++){
  1455. var k = keys[i];
  1456. values.push(object[k]);
  1457. }
  1458. return values;
  1459. },
  1460. getLength: function(object){
  1461. return Object.keys(object).length;
  1462. },
  1463. keyOf: function(object, value){
  1464. var keys = Object.keys(object);
  1465. for (var i = 0; i < keys.length; i++){
  1466. var key = keys[i];
  1467. if (object[key] === value) return key;
  1468. }
  1469. return null;
  1470. },
  1471. contains: function(object, value){
  1472. return Object.keyOf(object, value) != null;
  1473. },
  1474. toQueryString: function(object, base){
  1475. var queryString = [];
  1476. Object.each(object, function(value, key){
  1477. if (base) key = base + '[' + key + ']';
  1478. var result;
  1479. switch (typeOf(value)){
  1480. case 'object': result = Object.toQueryString(value, key); break;
  1481. case 'array':
  1482. var qs = {};
  1483. value.each(function(val, i){
  1484. qs[i] = val;
  1485. });
  1486. result = Object.toQueryString(qs, key);
  1487. break;
  1488. default: result = key + '=' + encodeURIComponent(value);
  1489. }
  1490. if (value != null) queryString.push(result);
  1491. });
  1492. return queryString.join('&');
  1493. }
  1494. });
  1495. })();
  1496. //<1.2compat>
  1497. Hash.implement({
  1498. has: Object.prototype.hasOwnProperty,
  1499. keyOf: function(value){
  1500. return Object.keyOf(this, value);
  1501. },
  1502. hasValue: function(value){
  1503. return Object.contains(this, value);
  1504. },
  1505. extend: function(properties){
  1506. Hash.each(properties || {}, function(value, key){
  1507. Hash.set(this, key, value);
  1508. }, this);
  1509. return this;
  1510. },
  1511. combine: function(properties){
  1512. Hash.each(properties || {}, function(value, key){
  1513. Hash.include(this, key, value);
  1514. }, this);
  1515. return this;
  1516. },
  1517. erase: function(key){
  1518. if (this.hasOwnProperty(key)) delete this[key];
  1519. return this;
  1520. },
  1521. get: function(key){
  1522. return (this.hasOwnProperty(key)) ? this[key] : null;
  1523. },
  1524. set: function(key, value){
  1525. if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
  1526. return this;
  1527. },
  1528. empty: function(){
  1529. Hash.each(this, function(value, key){
  1530. delete this[key];
  1531. }, this);
  1532. return this;
  1533. },
  1534. include: function(key, value){
  1535. if (this[key] == null) this[key] = value;
  1536. return this;
  1537. },
  1538. map: function(fn, bind){
  1539. return new Hash(Object.map(this, fn, bind));
  1540. },
  1541. filter: function(fn, bind){
  1542. return new Hash(Object.filter(this, fn, bind));
  1543. },
  1544. every: function(fn, bind){
  1545. return Object.every(this, fn, bind);
  1546. },
  1547. some: function(fn, bind){
  1548. return Object.some(this, fn, bind);
  1549. },
  1550. getKeys: function(){
  1551. return Object.keys(this);
  1552. },
  1553. getValues: function(){
  1554. return Object.values(this);
  1555. },
  1556. toQueryString: function(base){
  1557. return Object.toQueryString(this, base);
  1558. }
  1559. });
  1560. Hash.extend = Object.append;
  1561. Hash.alias({indexOf: 'keyOf', contains: 'hasValue'});
  1562. //</1.2compat>
  1563. /*
  1564. ---
  1565. name: Slick.Parser
  1566. description: Standalone CSS3 Selector parser
  1567. provides: Slick.Parser
  1568. ...
  1569. */
  1570. ;(function(){
  1571. var parsed,
  1572. separatorIndex,
  1573. combinatorIndex,
  1574. reversed,
  1575. cache = {},
  1576. reverseCache = {},
  1577. reUnescape = /\\/g;
  1578. var parse = function(expression, isReversed){
  1579. if (expression == null) return null;
  1580. if (expression.Slick === true) return expression;
  1581. expression = ('' + expression).replace(/^\s+|\s+$/g, '');
  1582. reversed = !!isReversed;
  1583. var currentCache = (reversed) ? reverseCache : cache;
  1584. if (currentCache[expression]) return currentCache[expression];
  1585. parsed = {
  1586. Slick: true,
  1587. expressions: [],
  1588. raw: expression,
  1589. reverse: function(){
  1590. return parse(this.raw, true);
  1591. }
  1592. };
  1593. separatorIndex = -1;
  1594. while (expression != (expression = expression.replace(regexp, parser)));
  1595. parsed.length = parsed.expressions.length;
  1596. return currentCache[parsed.raw] = (reversed) ? reverse(parsed) : parsed;
  1597. };
  1598. var reverseCombinator = function(combinator){
  1599. if (combinator === '!') return ' ';
  1600. else if (combinator === ' ') return '!';
  1601. else if ((/^!/).test(combinator)) return combinator.replace(/^!/, '');
  1602. else return '!' + combinator;
  1603. };
  1604. var reverse = function(expression){
  1605. var expressions = expression.expressions;
  1606. for (var i = 0; i < expressions.length; i++){
  1607. var exp = expressions[i];
  1608. var last = {parts: [], tag: '*', combinator: reverseCombinator(exp[0].combinator)};
  1609. for (var j = 0; j < exp.length; j++){
  1610. var cexp = exp[j];
  1611. if (!cexp.reverseCombinator) cexp.reverseCombinator = ' ';
  1612. cexp.combinator = cexp.reverseCombinator;
  1613. delete cexp.reverseCombinator;
  1614. }
  1615. exp.reverse().push(last);
  1616. }
  1617. return expression;
  1618. };
  1619. var escapeRegExp = function(string){// Credit: XRegExp 0.6.1 (c) 2007-2008 Steven Levithan <http://stevenlevithan.com/regex/xregexp/> MIT License
  1620. return string.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, function(match){
  1621. return '\\' + match;
  1622. });
  1623. };
  1624. var regexp = new RegExp(
  1625. /*
  1626. #!/usr/bin/env ruby
  1627. puts "\t\t" + DATA.read.gsub(/\(\?x\)|\s+#.*$|\s+|\\$|\\n/,'')
  1628. __END__
  1629. "(?x)^(?:\
  1630. \\s* ( , ) \\s* # Separator \n\
  1631. | \\s* ( <combinator>+ ) \\s* # Combinator \n\
  1632. | ( \\s+ ) # CombinatorChildren \n\
  1633. | ( <unicode>+ | \\* ) # Tag \n\
  1634. | \\# ( <unicode>+ ) # ID \n\
  1635. | \\. ( <unicode>+ ) # ClassName \n\
  1636. | # Attribute \n\
  1637. \\[ \
  1638. \\s* (<unicode1>+) (?: \
  1639. \\s* ([*^$!~|]?=) (?: \
  1640. \\s* (?:\
  1641. ([\"']?)(.*?)\\9 \
  1642. )\
  1643. ) \
  1644. )? \\s* \
  1645. \\](?!\\]) \n\
  1646. | :+ ( <unicode>+ )(?:\
  1647. \\( (?:\
  1648. (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\
  1649. ) \\)\
  1650. )?\
  1651. )"
  1652. */
  1653. "^(?:\\s*(,)\\s*|\\s*(<combinator>+)\\s*|(\\s+)|(<unicode>+|\\*)|\\#(<unicode>+)|\\.(<unicode>+)|\\[\\s*(<unicode1>+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(<unicode>+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)"
  1654. .replace(/<combinator>/, '[' + escapeRegExp('>+~`!@$%^&={}\\;</') + ']')
  1655. .replace(/<unicode>/g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])')
  1656. .replace(/<unicode1>/g, '(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])')
  1657. );
  1658. function parser(
  1659. rawMatch,
  1660. separator,
  1661. combinator,
  1662. combinatorChildren,
  1663. tagName,
  1664. id,
  1665. className,
  1666. attributeKey,
  1667. attributeOperator,
  1668. attributeQuote,
  1669. attributeValue,
  1670. pseudoMarker,
  1671. pseudoClass,
  1672. pseudoQuote,
  1673. pseudoClassQuotedValue,
  1674. pseudoClassValue
  1675. ){
  1676. if (separator || separatorIndex === -1){
  1677. parsed.expressions[++separatorIndex] = [];
  1678. combinatorIndex = -1;
  1679. if (separator) return '';
  1680. }
  1681. if (combinator || combinatorChildren || combinatorIndex === -1){
  1682. combinator = combinator || ' ';
  1683. var currentSeparator = parsed.expressions[separatorIndex];
  1684. if (reversed && currentSeparator[combinatorIndex])
  1685. currentSeparator[combinatorIndex].reverseCombinator = reverseCombinator(combinator);
  1686. currentSeparator[++combinatorIndex] = {combinator: combinator, tag: '*'};
  1687. }
  1688. var currentParsed = parsed.expressions[separatorIndex][combinatorIndex];
  1689. if (tagName){
  1690. currentParsed.tag = tagName.replace(reUnescape, '');
  1691. } else if (id){
  1692. currentParsed.id = id.replace(reUnescape, '');
  1693. } else if (className){
  1694. className = className.replace(reUnescape, '');
  1695. if (!currentParsed.classList) currentParsed.classList = [];
  1696. if (!currentParsed.classes) currentParsed.classes = [];
  1697. currentParsed.classList.push(className);
  1698. currentParsed.classes.push({
  1699. value: className,
  1700. regexp: new RegExp('(^|\\s)' + escapeRegExp(className) + '(\\s|$)')
  1701. });
  1702. } else if (pseudoClass){
  1703. pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue;
  1704. pseudoClassValue = pseudoClassValue ? pseudoClassValue.replace(reUnescape, '') : null;
  1705. if (!currentParsed.pseudos) currentParsed.pseudos = [];
  1706. currentParsed.pseudos.push({
  1707. key: pseudoClass.replace(reUnescape, ''),
  1708. value: pseudoClassValue,
  1709. type: pseudoMarker.length == 1 ? 'class' : 'element'
  1710. });
  1711. } else if (attributeKey){
  1712. attributeKey = attributeKey.replace(reUnescape, '');
  1713. attributeValue = (attributeValue || '').replace(reUnescape, '');
  1714. var test, regexp;
  1715. switch (attributeOperator){
  1716. case '^=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) ); break;
  1717. case '$=' : regexp = new RegExp( escapeRegExp(attributeValue) +'$' ); break;
  1718. case '~=' : regexp = new RegExp( '(^|\\s)'+ escapeRegExp(attributeValue) +'(\\s|$)' ); break;
  1719. case '|=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) +'(-|$)' ); break;
  1720. case '=' : test = function(value){
  1721. return attributeValue == value;
  1722. }; break;
  1723. case '*=' : test = function(value){
  1724. return value && value.indexOf(attributeValue) > -1;
  1725. }; break;
  1726. case '!=' : test = function(value){
  1727. return attributeValue != value;
  1728. }; break;
  1729. default : test = function(value){
  1730. return !!value;
  1731. };
  1732. }
  1733. if (attributeValue == '' && (/^[*$^]=$/).test(attributeOperator)) test = function(){
  1734. return false;
  1735. };
  1736. if (!test) test = function(value){
  1737. return value && regexp.test(value);
  1738. };
  1739. if (!currentParsed.attributes) currentParsed.attributes = [];
  1740. currentParsed.attributes.push({
  1741. key: attributeKey,
  1742. operator: attributeOperator,
  1743. value: attributeValue,
  1744. test: test
  1745. });
  1746. }
  1747. return '';
  1748. };
  1749. // Slick NS
  1750. var Slick = (this.Slick || {});
  1751. Slick.parse = function(expression){
  1752. return parse(expression);
  1753. };
  1754. Slick.escapeRegExp = escapeRegExp;
  1755. if (!this.Slick) this.Slick = Slick;
  1756. }).apply(/*<CommonJS>*/(typeof exports != 'undefined') ? exports : /*</CommonJS>*/this);
  1757. /*
  1758. ---
  1759. name: Slick.Finder
  1760. description: The new, superfast css selector engine.
  1761. provides: Slick.Finder
  1762. requires: Slick.Parser
  1763. ...
  1764. */
  1765. ;(function(){
  1766. var local = {},
  1767. featuresCache = {},
  1768. toString = Object.prototype.toString;
  1769. // Feature / Bug detection
  1770. local.isNativeCode = function(fn){
  1771. return (/\{\s*\[native code\]\s*\}/).test('' + fn);
  1772. };
  1773. local.isXML = function(document){
  1774. return (!!document.xmlVersion) || (!!document.xml) || (toString.call(document) == '[object XMLDocument]') ||
  1775. (document.nodeType == 9 && document.documentElement.nodeName != 'HTML');
  1776. };
  1777. local.setDocument = function(document){
  1778. // convert elements / window arguments to document. if document cannot be extrapolated, the function returns.
  1779. var nodeType = document.nodeType;
  1780. if (nodeType == 9); // document
  1781. else if (nodeType) document = document.ownerDocument; // node
  1782. else if (document.navigator) document = document.document; // window
  1783. else return;
  1784. // check if it's the old document
  1785. if (this.document === document) return;
  1786. this.document = document;
  1787. // check if we have done feature detection on this document before
  1788. var root = document.documentElement,
  1789. rootUid = this.getUIDXML(root),
  1790. features = featuresCache[rootUid],
  1791. feature;
  1792. if (features){
  1793. for (feature in features){
  1794. this[feature] = features[feature];
  1795. }
  1796. return;
  1797. }
  1798. features = featuresCache[rootUid] = {};
  1799. features.root = root;
  1800. features.isXMLDocument = this.isXML(document);
  1801. features.brokenStarGEBTN
  1802. = features.starSelectsClosedQSA
  1803. = features.idGetsName
  1804. = features.brokenMixedCaseQSA
  1805. = features.brokenGEBCN
  1806. = features.brokenCheckedQSA
  1807. = features.brokenEmptyAttributeQSA
  1808. = features.isHTMLDocument
  1809. = features.nativeMatchesSelector
  1810. = false;
  1811. var starSelectsClosed, starSelectsComments,
  1812. brokenSecondClassNameGEBCN, cachedGetElementsByClassName,
  1813. brokenFormAttributeGetter;
  1814. var selected, id = 'slick_uniqueid';
  1815. var testNode = document.createElement('div');
  1816. var testRoot = document.body || document.getElementsByTagName('body')[0] || root;
  1817. testRoot.appendChild(testNode);
  1818. // on non-HTML documents innerHTML and getElementsById doesnt work properly
  1819. try {
  1820. testNode.innerHTML = '<a id="'+id+'"></a>';
  1821. features.isHTMLDocument = !!document.getElementById(id);
  1822. } catch (e){}
  1823. if (features.isHTMLDocument){
  1824. testNode.style.display = 'none';
  1825. // IE returns comment nodes for getElementsByTagName('*') for some documents
  1826. testNode.appendChild(document.createComment(''));
  1827. starSelectsComments = (testNode.getElementsByTagName('*').length > 1);
  1828. // IE returns closed nodes (EG:"</foo>") for getElementsByTagName('*') for some documents
  1829. try {
  1830. testNode.innerHTML = 'foo</foo>';
  1831. selected = testNode.getElementsByTagName('*');
  1832. starSelectsClosed = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/');
  1833. } catch (e){};
  1834. features.brokenStarGEBTN = starSelectsComments || starSelectsClosed;
  1835. // IE returns elements with the name instead of just id for getElementsById for some documents
  1836. try {
  1837. testNode.innerHTML = '<a name="'+ id +'"></a><b id="'+ id +'"></b>';
  1838. features.idGetsName = document.getElementById(id) === testNode.firstChild;
  1839. } catch (e){}
  1840. if (testNode.getElementsByClassName){
  1841. // Safari 3.2 getElementsByClassName caches results
  1842. try {
  1843. testNode.innerHTML = '<a class="f"></a><a class="b"></a>';
  1844. testNode.getElementsByClassName('b').length;
  1845. testNode.firstChild.className = 'b';
  1846. cachedGetElementsByClassName = (testNode.getElementsByClassName('b').length != 2);
  1847. } catch (e){};
  1848. // Opera 9.6 getElementsByClassName doesnt detects the class if its not the first one
  1849. try {
  1850. testNode.innerHTML = '<a class="a"></a><a class="f b a"></a>';
  1851. brokenSecondClassNameGEBCN = (testNode.getElementsByClassName('a').length != 2);
  1852. } catch (e){}
  1853. features.brokenGEBCN = cachedGetElementsByClassName || brokenSecondClassNameGEBCN;
  1854. }
  1855. if (testNode.querySelectorAll){
  1856. // IE 8 returns closed nodes (EG:"</foo>") for querySelectorAll('*') for some documents
  1857. try {
  1858. testNode.innerHTML = 'foo</foo>';
  1859. selected = testNode.querySelectorAll('*');
  1860. features.starSelectsClosedQSA = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/');
  1861. } catch (e){}
  1862. // Safari 3.2 querySelectorAll doesnt work with mixedcase on quirksmode
  1863. try {
  1864. testNode.innerHTML = '<a class="MiX"></a>';
  1865. features.brokenMixedCaseQSA = !testNode.querySelectorAll('.MiX').length;
  1866. } catch (e){}
  1867. // Webkit and Opera dont return selected options on querySelectorAll
  1868. try {
  1869. testNode.innerHTML = '<select><option selected="selected">a</option></select>';
  1870. features.brokenCheckedQSA = (testNode.querySelectorAll(':checked').length == 0);
  1871. } catch (e){};
  1872. // IE returns incorrect results for attr[*^$]="" selectors on querySelectorAll
  1873. try {
  1874. testNode.innerHTML = '<a class=""></a>';
  1875. features.brokenEmptyAttributeQSA = (testNode.querySelectorAll('[class*=""]').length != 0);
  1876. } catch (e){}
  1877. }
  1878. // IE6-7, if a form has an input of id x, form.getAttribute(x) returns a reference to the input
  1879. try {
  1880. testNode.innerHTML = '<form action="s"><input id="action"/></form>';
  1881. brokenFormAttributeGetter = (testNode.firstChild.getAttribute('action') != 's');
  1882. } catch (e){}
  1883. // native matchesSelector function
  1884. features.nativeMatchesSelector = root.matches || /*root.msMatchesSelector ||*/ root.mozMatchesSelector || root.webkitMatchesSelector;
  1885. if (features.nativeMatchesSelector) try {
  1886. // if matchesSelector trows errors on incorrect sintaxes we can use it
  1887. features.nativeMatchesSelector.call(root, ':slick');
  1888. features.nativeMatchesSelector = null;
  1889. } catch (e){}
  1890. }
  1891. try {
  1892. root.slick_expando = 1;
  1893. delete root.slick_expando;
  1894. features.getUID = this.getUIDHTML;
  1895. } catch (e){
  1896. features.getUID = this.getUIDXML;
  1897. }
  1898. testRoot.removeChild(testNode);
  1899. testNode = selected = testRoot = null;
  1900. // getAttribute
  1901. features.getAttribute = (features.isHTMLDocument && brokenFormAttributeGetter) ? function(node, name){
  1902. var method = this.attributeGetters[name];
  1903. if (method) return method.call(node);
  1904. var attributeNode = node.getAttributeNode(name);
  1905. return (attributeNode) ? attributeNode.nodeValue : null;
  1906. } : function(node, name){
  1907. var method = this.attributeGetters[name];
  1908. return (method) ? method.call(node) : node.getAttribute(name);
  1909. };
  1910. // hasAttribute
  1911. features.hasAttribute = (root && this.isNativeCode(root.hasAttribute)) ? function(node, attribute){
  1912. return node.hasAttribute(attribute);
  1913. } : function(node, attribute){
  1914. node = node.getAttributeNode(attribute);
  1915. return !!(node && (node.specified || node.nodeValue));
  1916. };
  1917. // contains
  1918. // FIXME: Add specs: local.contains should be different for xml and html documents?
  1919. var nativeRootContains = root && this.isNativeCode(root.contains),
  1920. nativeDocumentContains = document && this.isNativeCode(document.contains);
  1921. features.contains = (nativeRootContains && nativeDocumentContains) ? function(context, node){
  1922. return context.contains(node);
  1923. } : (nativeRootContains && !nativeDocumentContains) ? function(context, node){
  1924. // IE8 does not have .contains on document.
  1925. return context === node || ((context === document) ? document.documentElement : context).contains(node);
  1926. } : (root && root.compareDocumentPosition) ? function(context, node){
  1927. return context === node || !!(context.compareDocumentPosition(node) & 16);
  1928. } : function(context, node){
  1929. if (node) do {
  1930. if (node === context) return true;
  1931. } while ((node = node.parentNode));
  1932. return false;
  1933. };
  1934. // document order sorting
  1935. // credits to Sizzle (http://sizzlejs.com/)
  1936. features.documentSorter = (root.compareDocumentPosition) ? function(a, b){
  1937. if (!a.compareDocumentPosition || !b.compareDocumentPosition) return 0;
  1938. return a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
  1939. } : ('sourceIndex' in root) ? function(a, b){
  1940. if (!a.sourceIndex || !b.sourceIndex) return 0;
  1941. return a.sourceIndex - b.sourceIndex;
  1942. } : (document.createRange) ? function(a, b){
  1943. if (!a.ownerDocument || !b.ownerDocument) return 0;
  1944. var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
  1945. aRange.setStart(a, 0);
  1946. aRange.setEnd(a, 0);
  1947. bRange.setStart(b, 0);
  1948. bRange.setEnd(b, 0);
  1949. return aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
  1950. } : null;
  1951. root = null;
  1952. for (feature in features){
  1953. this[feature] = features[feature];
  1954. }
  1955. };
  1956. // Main Method
  1957. var reSimpleSelector = /^([#.]?)((?:[\w-]+|\*))$/,
  1958. reEmptyAttribute = /\[.+[*$^]=(?:""|'')?\]/,
  1959. qsaFailExpCache = {};
  1960. local.search = function(context, expression, append, first){
  1961. var found = this.found = (first) ? null : (append || []);
  1962. if (!context) return found;
  1963. else if (context.navigator) context = context.document; // Convert the node from a window to a document
  1964. else if (!context.nodeType) return found;
  1965. // setup
  1966. var parsed, i, node, nodes,
  1967. uniques = this.uniques = {},
  1968. hasOthers = !!(append && append.length),
  1969. contextIsDocument = (context.nodeType == 9);
  1970. if (this.document !== (contextIsDocument ? context : context.ownerDocument)) this.setDocument(context);
  1971. // avoid duplicating items already in the append array
  1972. if (hasOthers) for (i = found.length; i--;) uniques[this.getUID(found[i])] = true;
  1973. // expression checks
  1974. if (typeof expression == 'string'){ // expression is a string
  1975. /*<simple-selectors-override>*/
  1976. var simpleSelector = expression.match(reSimpleSelector);
  1977. simpleSelectors: if (simpleSelector){
  1978. var symbol = simpleSelector[1],
  1979. name = simpleSelector[2];
  1980. if (!symbol){
  1981. if (name == '*' && this.brokenStarGEBTN) break simpleSelectors;
  1982. nodes = context.getElementsByTagName(name);
  1983. if (first) return nodes[0] || null;
  1984. for (i = 0; node = nodes[i++];){
  1985. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1986. }
  1987. } else if (symbol == '#'){
  1988. if (!this.isHTMLDocument || !contextIsDocument) break simpleSelectors;
  1989. node = context.getElementById(name);
  1990. if (!node) return found;
  1991. if (this.idGetsName && node.getAttributeNode('id').nodeValue != name) break simpleSelectors;
  1992. if (first) return node || null;
  1993. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1994. } else if (symbol == '.'){
  1995. if (!this.isHTMLDocument || ((!context.getElementsByClassName || this.brokenGEBCN) && context.querySelectorAll)) break simpleSelectors;
  1996. if (context.getElementsByClassName && !this.brokenGEBCN){
  1997. nodes = context.getElementsByClassName(name);
  1998. if (first) return nodes[0] || null;
  1999. for (i = 0; node = nodes[i++];){
  2000. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  2001. }
  2002. } else {
  2003. var matchClass = new RegExp('(^|\\s)'+ Slick.escapeRegExp(name) +'(\\s|$)');
  2004. nodes = context.getElementsByTagName('*');
  2005. for (i = 0; node = nodes[i++];){
  2006. className = node.className;
  2007. if (!(className && matchClass.test(className))) continue;
  2008. if (first) return node;
  2009. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  2010. }
  2011. }
  2012. }
  2013. if (hasOthers) this.sort(found);
  2014. return (first) ? null : found;
  2015. }
  2016. /*</simple-selectors-override>*/
  2017. /*<query-selector-override>*/
  2018. querySelector: if (context.querySelectorAll){
  2019. if (!this.isHTMLDocument
  2020. || qsaFailExpCache[expression]
  2021. //TODO: only skip when expression is actually mixed case
  2022. || this.brokenMixedCaseQSA
  2023. || (this.brokenCheckedQSA && expression.indexOf(':checked') > -1)
  2024. || (this.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression))
  2025. || (!contextIsDocument //Abort when !contextIsDocument and...
  2026. // there are multiple expressions in the selector
  2027. // since we currently only fix non-document rooted QSA for single expression selectors
  2028. && expression.indexOf(',') > -1
  2029. )
  2030. || Slick.disableQSA
  2031. ) break querySelector;
  2032. var _expression = expression, _context = context, currentId;
  2033. if (!contextIsDocument){
  2034. // non-document rooted QSA
  2035. // credits to Andrew Dupont
  2036. currentId = _context.getAttribute('id'), slickid = 'slickid__';
  2037. _context.setAttribute('id', slickid);
  2038. _expression = '#' + slickid + ' ' + _expression;
  2039. context = _context.parentNode;
  2040. }
  2041. try {
  2042. if (first) return context.querySelector(_expression) || null;
  2043. else nodes = context.querySelectorAll(_expression);
  2044. } catch (e){
  2045. qsaFailExpCache[expression] = 1;
  2046. break querySelector;
  2047. } finally {
  2048. if (!contextIsDocument){
  2049. if (currentId) _context.setAttribute('id', currentId);
  2050. else _context.removeAttribute('id');
  2051. context = _context;
  2052. }
  2053. }
  2054. if (this.starSelectsClosedQSA) for (i = 0; node = nodes[i++];){
  2055. if (node.nodeName > '@' && !(hasOthers && uniques[this.getUID(node)])) found.push(node);
  2056. } else for (i = 0; node = nodes[i++];){
  2057. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  2058. }
  2059. if (hasOthers) this.sort(found);
  2060. return found;
  2061. }
  2062. /*</query-selector-override>*/
  2063. parsed = this.Slick.parse(expression);
  2064. if (!parsed.length) return found;
  2065. } else if (expression == null){ // there is no expression
  2066. return found;
  2067. } else if (expression.Slick){ // expression is a parsed Slick object
  2068. parsed = expression;
  2069. } else if (this.contains(context.documentElement || context, expression)){ // expression is a node
  2070. (found) ? found.push(expression) : found = expression;
  2071. return found;
  2072. } else { // other junk
  2073. return found;
  2074. }
  2075. /*<pseudo-selectors>*//*<nth-pseudo-selectors>*/
  2076. // cache elements for the nth selectors
  2077. this.posNTH = {};
  2078. this.posNTHLast = {};
  2079. this.posNTHType = {};
  2080. this.posNTHTypeLast = {};
  2081. /*</nth-pseudo-selectors>*//*</pseudo-selectors>*/
  2082. // if append is null and there is only a single selector with one expression use pushArray, else use pushUID
  2083. this.push = (!hasOthers && (first || (parsed.length == 1 && parsed.expressions[0].length == 1))) ? this.pushArray : this.pushUID;
  2084. if (found == null) found = [];
  2085. // default engine
  2086. var j, m, n;
  2087. var combinator, tag, id, classList, classes, attributes, pseudos;
  2088. var currentItems, currentExpression, currentBit, lastBit, expressions = parsed.expressions;
  2089. search: for (i = 0; (currentExpression = expressions[i]); i++) for (j = 0; (currentBit = currentExpression[j]); j++){
  2090. combinator = 'combinator:' + currentBit.combinator;
  2091. if (!this[combinator]) continue search;
  2092. tag = (this.isXMLDocument) ? currentBit.tag : currentBit.tag.toUpperCase();
  2093. id = currentBit.id;
  2094. classList = currentBit.classList;
  2095. classes = currentBit.classes;
  2096. attributes = currentBit.attributes;
  2097. pseudos = currentBit.pseudos;
  2098. lastBit = (j === (currentExpression.length - 1));
  2099. this.bitUniques = {};
  2100. if (lastBit){
  2101. this.uniques = uniques;
  2102. this.found = found;
  2103. } else {
  2104. this.uniques = {};
  2105. this.found = [];
  2106. }
  2107. if (j === 0){
  2108. this[combinator](context, tag, id, classes, attributes, pseudos, classList);
  2109. if (first && lastBit && found.length) break search;
  2110. } else {
  2111. if (first && lastBit) for (m = 0, n = currentItems.length; m < n; m++){
  2112. this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList);
  2113. if (found.length) break search;
  2114. } else for (m = 0, n = currentItems.length; m < n; m++) this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList);
  2115. }
  2116. currentItems = this.found;
  2117. }
  2118. // should sort if there are nodes in append and if you pass multiple expressions.
  2119. if (hasOthers || (parsed.expressions.length > 1)) this.sort(found);
  2120. return (first) ? (found[0] || null) : found;
  2121. };
  2122. // Utils
  2123. local.uidx = 1;
  2124. local.uidk = 'slick-uniqueid';
  2125. local.getUIDXML = function(node){
  2126. var uid = node.getAttribute(this.uidk);
  2127. if (!uid){
  2128. uid = this.uidx++;
  2129. node.setAttribute(this.uidk, uid);
  2130. }
  2131. return uid;
  2132. };
  2133. local.getUIDHTML = function(node){
  2134. return node.uniqueNumber || (node.uniqueNumber = this.uidx++);
  2135. };
  2136. // sort based on the setDocument documentSorter method.
  2137. local.sort = function(results){
  2138. if (!this.documentSorter) return results;
  2139. results.sort(this.documentSorter);
  2140. return results;
  2141. };
  2142. /*<pseudo-selectors>*//*<nth-pseudo-selectors>*/
  2143. local.cacheNTH = {};
  2144. local.matchNTH = /^([+-]?\d*)?([a-z]+)?([+-]\d+)?$/;
  2145. local.parseNTHArgument = function(argument){
  2146. var parsed = argument.match(this.matchNTH);
  2147. if (!parsed) return false;
  2148. var special = parsed[2] || false;
  2149. var a = parsed[1] || 1;
  2150. if (a == '-') a = -1;
  2151. var b = +parsed[3] || 0;
  2152. parsed =
  2153. (special == 'n') ? {a: a, b: b} :
  2154. (special == 'odd') ? {a: 2, b: 1} :
  2155. (special == 'even') ? {a: 2, b: 0} : {a: 0, b: a};
  2156. return (this.cacheNTH[argument] = parsed);
  2157. };
  2158. local.createNTHPseudo = function(child, sibling, positions, ofType){
  2159. return function(node, argument){
  2160. var uid = this.getUID(node);
  2161. if (!this[positions][uid]){
  2162. var parent = node.parentNode;
  2163. if (!parent) return false;
  2164. var el = parent[child], count = 1;
  2165. if (ofType){
  2166. var nodeName = node.nodeName;
  2167. do {
  2168. if (el.nodeName != nodeName) continue;
  2169. this[positions][this.getUID(el)] = count++;
  2170. } while ((el = el[sibling]));
  2171. } else {
  2172. do {
  2173. if (el.nodeType != 1) continue;
  2174. this[positions][this.getUID(el)] = count++;
  2175. } while ((el = el[sibling]));
  2176. }
  2177. }
  2178. argument = argument || 'n';
  2179. var parsed = this.cacheNTH[argument] || this.parseNTHArgument(argument);
  2180. if (!parsed) return false;
  2181. var a = parsed.a, b = parsed.b, pos = this[positions][uid];
  2182. if (a == 0) return b == pos;
  2183. if (a > 0){
  2184. if (pos < b) return false;
  2185. } else {
  2186. if (b < pos) return false;
  2187. }
  2188. return ((pos - b) % a) == 0;
  2189. };
  2190. };
  2191. /*</nth-pseudo-selectors>*//*</pseudo-selectors>*/
  2192. local.pushArray = function(node, tag, id, classes, attributes, pseudos){
  2193. if (this.matchSelector(node, tag, id, classes, attributes, pseudos)) this.found.push(node);
  2194. };
  2195. local.pushUID = function(node, tag, id, classes, attributes, pseudos){
  2196. var uid = this.getUID(node);
  2197. if (!this.uniques[uid] && this.matchSelector(node, tag, id, classes, attributes, pseudos)){
  2198. this.uniques[uid] = true;
  2199. this.found.push(node);
  2200. }
  2201. };
  2202. local.matchNode = function(node, selector){
  2203. if (this.isHTMLDocument && this.nativeMatchesSelector){
  2204. try {
  2205. return this.nativeMatchesSelector.call(node, selector.replace(/\[([^=]+)=\s*([^'"\]]+?)\s*\]/g, '[$1="$2"]'));
  2206. } catch (matchError){}
  2207. }
  2208. var parsed = this.Slick.parse(selector);
  2209. if (!parsed) return true;
  2210. // simple (single) selectors
  2211. var expressions = parsed.expressions, simpleExpCounter = 0, i, currentExpression;
  2212. for (i = 0; (currentExpression = expressions[i]); i++){
  2213. if (currentExpression.length == 1){
  2214. var exp = currentExpression[0];
  2215. if (this.matchSelector(node, (this.isXMLDocument) ? exp.tag : exp.tag.toUpperCase(), exp.id, exp.classes, exp.attributes, exp.pseudos)) return true;
  2216. simpleExpCounter++;
  2217. }
  2218. }
  2219. if (simpleExpCounter == parsed.length) return false;
  2220. var nodes = this.search(this.document, parsed), item;
  2221. for (i = 0; item = nodes[i++];){
  2222. if (item === node) return true;
  2223. }
  2224. return false;
  2225. };
  2226. local.matchPseudo = function(node, name, argument){
  2227. var pseudoName = 'pseudo:' + name;
  2228. if (this[pseudoName]) return this[pseudoName](node, argument);
  2229. var attribute = this.getAttribute(node, name);
  2230. return (argument) ? argument == attribute : !!attribute;
  2231. };
  2232. local.matchSelector = function(node, tag, id, classes, attributes, pseudos){
  2233. if (tag){
  2234. var nodeName = (this.isXMLDocument) ? node.nodeName : node.nodeName.toUpperCase();
  2235. if (tag == '*'){
  2236. if (nodeName < '@') return false; // Fix for comment nodes and closed nodes
  2237. } else {
  2238. if (nodeName != tag) return false;
  2239. }
  2240. }
  2241. if (id && node.getAttribute('id') != id) return false;
  2242. var i, part, cls;
  2243. if (classes) for (i = classes.length; i--;){
  2244. cls = this.getAttribute(node, 'class');
  2245. if (!(cls && classes[i].regexp.test(cls))) return false;
  2246. }
  2247. if (attributes) for (i = attributes.length; i--;){
  2248. part = attributes[i];
  2249. if (part.operator ? !part.test(this.getAttribute(node, part.key)) : !this.hasAttribute(node, part.key)) return false;
  2250. }
  2251. if (pseudos) for (i = pseudos.length; i--;){
  2252. part = pseudos[i];
  2253. if (!this.matchPseudo(node, part.key, part.value)) return false;
  2254. }
  2255. return true;
  2256. };
  2257. var combinators = {
  2258. ' ': function(node, tag, id, classes, attributes, pseudos, classList){ // all child nodes, any level
  2259. var i, item, children;
  2260. if (this.isHTMLDocument){
  2261. getById: if (id){
  2262. item = this.document.getElementById(id);
  2263. if ((!item && node.all) || (this.idGetsName && item && item.getAttributeNode('id').nodeValue != id)){
  2264. // all[id] returns all the elements with that name or id inside node
  2265. // if theres just one it will return the element, else it will be a collection
  2266. children = node.all[id];
  2267. if (!children) return;
  2268. if (!children[0]) children = [children];
  2269. for (i = 0; item = children[i++];){
  2270. var idNode = item.getAttributeNode('id');
  2271. if (idNode && idNode.nodeValue == id){
  2272. this.push(item, tag, null, classes, attributes, pseudos);
  2273. break;
  2274. }
  2275. }
  2276. return;
  2277. }
  2278. if (!item){
  2279. // if the context is in the dom we return, else we will try GEBTN, breaking the getById label
  2280. if (this.contains(this.root, node)) return;
  2281. else break getById;
  2282. } else if (this.document !== node && !this.contains(node, item)) return;
  2283. this.push(item, tag, null, classes, attributes, pseudos);
  2284. return;
  2285. }
  2286. getByClass: if (classes && node.getElementsByClassName && !this.brokenGEBCN){
  2287. children = node.getElementsByClassName(classList.join(' '));
  2288. if (!(children && children.length)) break getByClass;
  2289. for (i = 0; item = children[i++];) this.push(item, tag, id, null, attributes, pseudos);
  2290. return;
  2291. }
  2292. }
  2293. getByTag: {
  2294. children = node.getElementsByTagName(tag);
  2295. if (!(children && children.length)) break getByTag;
  2296. if (!this.brokenStarGEBTN) tag = null;
  2297. for (i = 0; item = children[i++];) this.push(item, tag, id, classes, attributes, pseudos);
  2298. }
  2299. },
  2300. '>': function(node, tag, id, classes, attributes, pseudos){ // direct children
  2301. if ((node = node.firstChild)) do {
  2302. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2303. } while ((node = node.nextSibling));
  2304. },
  2305. '+': function(node, tag, id, classes, attributes, pseudos){ // next sibling
  2306. while ((node = node.nextSibling)) if (node.nodeType == 1){
  2307. this.push(node, tag, id, classes, attributes, pseudos);
  2308. break;
  2309. }
  2310. },
  2311. '^': function(node, tag, id, classes, attributes, pseudos){ // first child
  2312. node = node.firstChild;
  2313. if (node){
  2314. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2315. else this['combinator:+'](node, tag, id, classes, attributes, pseudos);
  2316. }
  2317. },
  2318. '~': function(node, tag, id, classes, attributes, pseudos){ // next siblings
  2319. while ((node = node.nextSibling)){
  2320. if (node.nodeType != 1) continue;
  2321. var uid = this.getUID(node);
  2322. if (this.bitUniques[uid]) break;
  2323. this.bitUniques[uid] = true;
  2324. this.push(node, tag, id, classes, attributes, pseudos);
  2325. }
  2326. },
  2327. '++': function(node, tag, id, classes, attributes, pseudos){ // next sibling and previous sibling
  2328. this['combinator:+'](node, tag, id, classes, attributes, pseudos);
  2329. this['combinator:!+'](node, tag, id, classes, attributes, pseudos);
  2330. },
  2331. '~~': function(node, tag, id, classes, attributes, pseudos){ // next siblings and previous siblings
  2332. this['combinator:~'](node, tag, id, classes, attributes, pseudos);
  2333. this['combinator:!~'](node, tag, id, classes, attributes, pseudos);
  2334. },
  2335. '!': function(node, tag, id, classes, attributes, pseudos){ // all parent nodes up to document
  2336. while ((node = node.parentNode)) if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos);
  2337. },
  2338. '!>': function(node, tag, id, classes, attributes, pseudos){ // direct parent (one level)
  2339. node = node.parentNode;
  2340. if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos);
  2341. },
  2342. '!+': function(node, tag, id, classes, attributes, pseudos){ // previous sibling
  2343. while ((node = node.previousSibling)) if (node.nodeType == 1){
  2344. this.push(node, tag, id, classes, attributes, pseudos);
  2345. break;
  2346. }
  2347. },
  2348. '!^': function(node, tag, id, classes, attributes, pseudos){ // last child
  2349. node = node.lastChild;
  2350. if (node){
  2351. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2352. else this['combinator:!+'](node, tag, id, classes, attributes, pseudos);
  2353. }
  2354. },
  2355. '!~': function(node, tag, id, classes, attributes, pseudos){ // previous siblings
  2356. while ((node = node.previousSibling)){
  2357. if (node.nodeType != 1) continue;
  2358. var uid = this.getUID(node);
  2359. if (this.bitUniques[uid]) break;
  2360. this.bitUniques[uid] = true;
  2361. this.push(node, tag, id, classes, attributes, pseudos);
  2362. }
  2363. }
  2364. };
  2365. for (var c in combinators) local['combinator:' + c] = combinators[c];
  2366. var pseudos = {
  2367. /*<pseudo-selectors>*/
  2368. 'empty': function(node){
  2369. var child = node.firstChild;
  2370. return !(child && child.nodeType == 1) && !(node.innerText || node.textContent || '').length;
  2371. },
  2372. 'not': function(node, expression){
  2373. return !this.matchNode(node, expression);
  2374. },
  2375. 'contains': function(node, text){
  2376. return (node.innerText || node.textContent || '').indexOf(text) > -1;
  2377. },
  2378. 'first-child': function(node){
  2379. while ((node = node.previousSibling)) if (node.nodeType == 1) return false;
  2380. return true;
  2381. },
  2382. 'last-child': function(node){
  2383. while ((node = node.nextSibling)) if (node.nodeType == 1) return false;
  2384. return true;
  2385. },
  2386. 'only-child': function(node){
  2387. var prev = node;
  2388. while ((prev = prev.previousSibling)) if (prev.nodeType == 1) return false;
  2389. var next = node;
  2390. while ((next = next.nextSibling)) if (next.nodeType == 1) return false;
  2391. return true;
  2392. },
  2393. /*<nth-pseudo-selectors>*/
  2394. 'nth-child': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTH'),
  2395. 'nth-last-child': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHLast'),
  2396. 'nth-of-type': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTHType', true),
  2397. 'nth-last-of-type': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHTypeLast', true),
  2398. 'index': function(node, index){
  2399. return this['pseudo:nth-child'](node, '' + (index + 1));
  2400. },
  2401. 'even': function(node){
  2402. return this['pseudo:nth-child'](node, '2n');
  2403. },
  2404. 'odd': function(node){
  2405. return this['pseudo:nth-child'](node, '2n+1');
  2406. },
  2407. /*</nth-pseudo-selectors>*/
  2408. /*<of-type-pseudo-selectors>*/
  2409. 'first-of-type': function(node){
  2410. var nodeName = node.nodeName;
  2411. while ((node = node.previousSibling)) if (node.nodeName == nodeName) return false;
  2412. return true;
  2413. },
  2414. 'last-of-type': function(node){
  2415. var nodeName = node.nodeName;
  2416. while ((node = node.nextSibling)) if (node.nodeName == nodeName) return false;
  2417. return true;
  2418. },
  2419. 'only-of-type': function(node){
  2420. var prev = node, nodeName = node.nodeName;
  2421. while ((prev = prev.previousSibling)) if (prev.nodeName == nodeName) return false;
  2422. var next = node;
  2423. while ((next = next.nextSibling)) if (next.nodeName == nodeName) return false;
  2424. return true;
  2425. },
  2426. /*</of-type-pseudo-selectors>*/
  2427. // custom pseudos
  2428. 'enabled': function(node){
  2429. return !node.disabled;
  2430. },
  2431. 'disabled': function(node){
  2432. return node.disabled;
  2433. },
  2434. 'checked': function(node){
  2435. return node.checked || node.selected;
  2436. },
  2437. 'focus': function(node){
  2438. return this.isHTMLDocument && this.document.activeElement === node && (node.href || node.type || this.hasAttribute(node, 'tabindex'));
  2439. },
  2440. 'root': function(node){
  2441. return (node === this.root);
  2442. },
  2443. 'selected': function(node){
  2444. return node.selected;
  2445. }
  2446. /*</pseudo-selectors>*/
  2447. };
  2448. for (var p in pseudos) local['pseudo:' + p] = pseudos[p];
  2449. // attributes methods
  2450. var attributeGetters = local.attributeGetters = {
  2451. 'for': function(){
  2452. return ('htmlFor' in this) ? this.htmlFor : this.getAttribute('for');
  2453. },
  2454. 'href': function(){
  2455. return ('href' in this) ? this.getAttribute('href', 2) : this.getAttribute('href');
  2456. },
  2457. 'style': function(){
  2458. return (this.style) ? this.style.cssText : this.getAttribute('style');
  2459. },
  2460. 'tabindex': function(){
  2461. var attributeNode = this.getAttributeNode('tabindex');
  2462. return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null;
  2463. },
  2464. 'type': function(){
  2465. return this.getAttribute('type');
  2466. },
  2467. 'maxlength': function(){
  2468. var attributeNode = this.getAttributeNode('maxLength');
  2469. return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null;
  2470. }
  2471. };
  2472. attributeGetters.MAXLENGTH = attributeGetters.maxLength = attributeGetters.maxlength;
  2473. // Slick
  2474. var Slick = local.Slick = (this.Slick || {});
  2475. Slick.version = '1.1.7';
  2476. // Slick finder
  2477. Slick.search = function(context, expression, append){
  2478. return local.search(context, expression, append);
  2479. };
  2480. Slick.find = function(context, expression){
  2481. return local.search(context, expression, null, true);
  2482. };
  2483. // Slick containment checker
  2484. Slick.contains = function(container, node){
  2485. local.setDocument(container);
  2486. return local.contains(container, node);
  2487. };
  2488. // Slick attribute getter
  2489. Slick.getAttribute = function(node, name){
  2490. local.setDocument(node);
  2491. return local.getAttribute(node, name);
  2492. };
  2493. Slick.hasAttribute = function(node, name){
  2494. local.setDocument(node);
  2495. return local.hasAttribute(node, name);
  2496. };
  2497. // Slick matcher
  2498. Slick.match = function(node, selector){
  2499. if (!(node && selector)) return false;
  2500. if (!selector || selector === node) return true;
  2501. local.setDocument(node);
  2502. return local.matchNode(node, selector);
  2503. };
  2504. // Slick attribute accessor
  2505. Slick.defineAttributeGetter = function(name, fn){
  2506. local.attributeGetters[name] = fn;
  2507. return this;
  2508. };
  2509. Slick.lookupAttributeGetter = function(name){
  2510. return local.attributeGetters[name];
  2511. };
  2512. // Slick pseudo accessor
  2513. Slick.definePseudo = function(name, fn){
  2514. local['pseudo:' + name] = function(node, argument){
  2515. return fn.call(node, argument);
  2516. };
  2517. return this;
  2518. };
  2519. Slick.lookupPseudo = function(name){
  2520. var pseudo = local['pseudo:' + name];
  2521. if (pseudo) return function(argument){
  2522. return pseudo.call(this, argument);
  2523. };
  2524. return null;
  2525. };
  2526. // Slick overrides accessor
  2527. Slick.override = function(regexp, fn){
  2528. local.override(regexp, fn);
  2529. return this;
  2530. };
  2531. Slick.isXML = local.isXML;
  2532. Slick.uidOf = function(node){
  2533. return local.getUIDHTML(node);
  2534. };
  2535. if (!this.Slick) this.Slick = Slick;
  2536. }).apply(/*<CommonJS>*/(typeof exports != 'undefined') ? exports : /*</CommonJS>*/this);
  2537. /*
  2538. ---
  2539. name: Element
  2540. 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.
  2541. license: MIT-style license.
  2542. requires: [Window, Document, Array, String, Function, Object, Number, Slick.Parser, Slick.Finder]
  2543. provides: [Element, Elements, $, $$, IFrame, Selectors]
  2544. ...
  2545. */
  2546. var Element = this.Element = function(tag, props){
  2547. var konstructor = Element.Constructors[tag];
  2548. if (konstructor) return konstructor(props);
  2549. if (typeof tag != 'string') return document.id(tag).set(props);
  2550. if (!props) props = {};
  2551. if (!(/^[\w-]+$/).test(tag)){
  2552. var parsed = Slick.parse(tag).expressions[0][0];
  2553. tag = (parsed.tag == '*') ? 'div' : parsed.tag;
  2554. if (parsed.id && props.id == null) props.id = parsed.id;
  2555. var attributes = parsed.attributes;
  2556. if (attributes) for (var attr, i = 0, l = attributes.length; i < l; i++){
  2557. attr = attributes[i];
  2558. if (props[attr.key] != null) continue;
  2559. if (attr.value != null && attr.operator == '=') props[attr.key] = attr.value;
  2560. else if (!attr.value && !attr.operator) props[attr.key] = true;
  2561. }
  2562. if (parsed.classList && props['class'] == null) props['class'] = parsed.classList.join(' ');
  2563. }
  2564. return document.newElement(tag, props);
  2565. };
  2566. if (Browser.Element){
  2567. Element.prototype = Browser.Element.prototype;
  2568. // IE8 and IE9 require the wrapping.
  2569. Element.prototype._fireEvent = (function(fireEvent){
  2570. return function(type, event){
  2571. return fireEvent.call(this, type, event);
  2572. };
  2573. })(Element.prototype.fireEvent);
  2574. }
  2575. new Type('Element', Element).mirror(function(name){
  2576. if (Array.prototype[name]) return;
  2577. var obj = {};
  2578. obj[name] = function(){
  2579. var results = [], args = arguments, elements = true;
  2580. for (var i = 0, l = this.length; i < l; i++){
  2581. var element = this[i], result = results[i] = element[name].apply(element, args);
  2582. elements = (elements && typeOf(result) == 'element');
  2583. }
  2584. return (elements) ? new Elements(results) : results;
  2585. };
  2586. Elements.implement(obj);
  2587. });
  2588. if (!Browser.Element){
  2589. Element.parent = Object;
  2590. Element.Prototype = {
  2591. '$constructor': Element,
  2592. '$family': Function.convert('element').hide()
  2593. };
  2594. Element.mirror(function(name, method){
  2595. Element.Prototype[name] = method;
  2596. });
  2597. }
  2598. Element.Constructors = {};
  2599. //<1.2compat>
  2600. Element.Constructors = new Hash;
  2601. //</1.2compat>
  2602. var IFrame = new Type('IFrame', function(){
  2603. var params = Array.link(arguments, {
  2604. properties: Type.isObject,
  2605. iframe: function(obj){
  2606. return (obj != null);
  2607. }
  2608. });
  2609. var props = params.properties || {}, iframe;
  2610. if (params.iframe) iframe = document.id(params.iframe);
  2611. var onload = props.onload || function(){};
  2612. delete props.onload;
  2613. props.id = props.name = [props.id, props.name, iframe ? (iframe.id || iframe.name) : 'IFrame_' + String.uniqueID()].pick();
  2614. iframe = new Element(iframe || 'iframe', props);
  2615. var onLoad = function(){
  2616. onload.call(iframe.contentWindow);
  2617. };
  2618. if (window.frames[props.id]) onLoad();
  2619. else iframe.addListener('load', onLoad);
  2620. return iframe;
  2621. });
  2622. var Elements = this.Elements = function(nodes){
  2623. if (nodes && nodes.length){
  2624. var uniques = {}, node;
  2625. for (var i = 0; node = nodes[i++];){
  2626. var uid = Slick.uidOf(node);
  2627. if (!uniques[uid]){
  2628. uniques[uid] = true;
  2629. this.push(node);
  2630. }
  2631. }
  2632. }
  2633. };
  2634. Elements.prototype = {length: 0};
  2635. Elements.parent = Array;
  2636. new Type('Elements', Elements).implement({
  2637. filter: function(filter, bind){
  2638. if (!filter) return this;
  2639. return new Elements(Array.filter(this, (typeOf(filter) == 'string') ? function(item){
  2640. return item.match(filter);
  2641. } : filter, bind));
  2642. }.protect(),
  2643. push: function(){
  2644. var length = this.length;
  2645. for (var i = 0, l = arguments.length; i < l; i++){
  2646. var item = document.id(arguments[i]);
  2647. if (item) this[length++] = item;
  2648. }
  2649. return (this.length = length);
  2650. }.protect(),
  2651. unshift: function(){
  2652. var items = [];
  2653. for (var i = 0, l = arguments.length; i < l; i++){
  2654. var item = document.id(arguments[i]);
  2655. if (item) items.push(item);
  2656. }
  2657. return Array.prototype.unshift.apply(this, items);
  2658. }.protect(),
  2659. concat: function(){
  2660. var newElements = new Elements(this);
  2661. for (var i = 0, l = arguments.length; i < l; i++){
  2662. var item = arguments[i];
  2663. if (Type.isEnumerable(item)) newElements.append(item);
  2664. else newElements.push(item);
  2665. }
  2666. return newElements;
  2667. }.protect(),
  2668. append: function(collection){
  2669. for (var i = 0, l = collection.length; i < l; i++) this.push(collection[i]);
  2670. return this;
  2671. }.protect(),
  2672. empty: function(){
  2673. while (this.length) delete this[--this.length];
  2674. return this;
  2675. }.protect()
  2676. });
  2677. //<1.2compat>
  2678. Elements.alias('extend', 'append');
  2679. //</1.2compat>
  2680. (function(){
  2681. // FF, IE
  2682. var splice = Array.prototype.splice, object = {'0': 0, '1': 1, length: 2};
  2683. splice.call(object, 1, 1);
  2684. if (object[1] == 1) Elements.implement('splice', function(){
  2685. var length = this.length;
  2686. var result = splice.apply(this, arguments);
  2687. while (length >= this.length) delete this[length--];
  2688. return result;
  2689. }.protect());
  2690. Array.forEachMethod(function(method, name){
  2691. Elements.implement(name, method);
  2692. });
  2693. Array.mirror(Elements);
  2694. /*<ltIE8>*/
  2695. var createElementAcceptsHTML;
  2696. try {
  2697. createElementAcceptsHTML = (document.createElement('<input name=x>').name == 'x');
  2698. } catch (e){}
  2699. var escapeQuotes = function(html){
  2700. return ('' + html).replace(/&/g, '&amp;').replace(/"/g, '&quot;');
  2701. };
  2702. /*</ltIE8>*/
  2703. /*<ltIE9>*/
  2704. // #2479 - IE8 Cannot set HTML of style element
  2705. var canChangeStyleHTML = (function(){
  2706. var div = document.createElement('style'),
  2707. flag = false;
  2708. try {
  2709. div.innerHTML = '#justTesing{margin: 0px;}';
  2710. flag = !!div.innerHTML;
  2711. } catch (e){}
  2712. return flag;
  2713. })();
  2714. /*</ltIE9>*/
  2715. Document.implement({
  2716. newElement: function(tag, props){
  2717. if (props){
  2718. if (props.checked != null) props.defaultChecked = props.checked;
  2719. if ((props.type == 'checkbox' || props.type == 'radio') && props.value == null) props.value = 'on';
  2720. /*<ltIE9>*/ // IE needs the type to be set before changing content of style element
  2721. if (!canChangeStyleHTML && tag == 'style'){
  2722. var styleElement = document.createElement('style');
  2723. styleElement.setAttribute('type', 'text/css');
  2724. if (props.type) delete props.type;
  2725. return this.id(styleElement).set(props);
  2726. }
  2727. /*</ltIE9>*/
  2728. /*<ltIE8>*/// Fix for readonly name and type properties in IE < 8
  2729. if (createElementAcceptsHTML){
  2730. tag = '<' + tag;
  2731. if (props.name) tag += ' name="' + escapeQuotes(props.name) + '"';
  2732. if (props.type) tag += ' type="' + escapeQuotes(props.type) + '"';
  2733. tag += '>';
  2734. delete props.name;
  2735. delete props.type;
  2736. }
  2737. /*</ltIE8>*/
  2738. }
  2739. return this.id(this.createElement(tag)).set(props);
  2740. }
  2741. });
  2742. })();
  2743. (function(){
  2744. Slick.uidOf(window);
  2745. Slick.uidOf(document);
  2746. Document.implement({
  2747. newTextNode: function(text){
  2748. return this.createTextNode(text);
  2749. },
  2750. getDocument: function(){
  2751. return this;
  2752. },
  2753. getWindow: function(){
  2754. return this.window;
  2755. },
  2756. id: (function(){
  2757. var types = {
  2758. string: function(id, nocash, doc){
  2759. id = Slick.find(doc, '#' + id.replace(/(\W)/g, '\\$1'));
  2760. return (id) ? types.element(id, nocash) : null;
  2761. },
  2762. element: function(el, nocash){
  2763. Slick.uidOf(el);
  2764. if (!nocash && !el.$family && !(/^(?:object|embed)$/i).test(el.tagName)){
  2765. var fireEvent = el.fireEvent;
  2766. // wrapping needed in IE7, or else crash
  2767. el._fireEvent = function(type, event){
  2768. return fireEvent(type, event);
  2769. };
  2770. Object.append(el, Element.Prototype);
  2771. }
  2772. return el;
  2773. },
  2774. object: function(obj, nocash, doc){
  2775. if (obj.toElement) return types.element(obj.toElement(doc), nocash);
  2776. return null;
  2777. }
  2778. };
  2779. types.textnode = types.whitespace = types.window = types.document = function(zero){
  2780. return zero;
  2781. };
  2782. return function(el, nocash, doc){
  2783. if (el && el.$family && el.uniqueNumber) return el;
  2784. var type = typeOf(el);
  2785. return (types[type]) ? types[type](el, nocash, doc || document) : null;
  2786. };
  2787. })()
  2788. });
  2789. if (window.$ == null) Window.implement('$', function(el, nc){
  2790. return document.id(el, nc, this.document);
  2791. });
  2792. Window.implement({
  2793. getDocument: function(){
  2794. return this.document;
  2795. },
  2796. getWindow: function(){
  2797. return this;
  2798. }
  2799. });
  2800. [Document, Element].invoke('implement', {
  2801. getElements: function(expression){
  2802. return Slick.search(this, expression, new Elements);
  2803. },
  2804. getElement: function(expression){
  2805. return document.id(Slick.find(this, expression));
  2806. }
  2807. });
  2808. var contains = {contains: function(element){
  2809. return Slick.contains(this, element);
  2810. }};
  2811. if (!document.contains) Document.implement(contains);
  2812. if (!document.createElement('div').contains) Element.implement(contains);
  2813. //<1.2compat>
  2814. Element.implement('hasChild', function(element){
  2815. return this !== element && this.contains(element);
  2816. });
  2817. (function(search, find, match){
  2818. this.Selectors = {};
  2819. var pseudos = this.Selectors.Pseudo = new Hash();
  2820. var addSlickPseudos = function(){
  2821. for (var name in pseudos) if (pseudos.hasOwnProperty(name)){
  2822. Slick.definePseudo(name, pseudos[name]);
  2823. delete pseudos[name];
  2824. }
  2825. };
  2826. Slick.search = function(context, expression, append){
  2827. addSlickPseudos();
  2828. return search.call(this, context, expression, append);
  2829. };
  2830. Slick.find = function(context, expression){
  2831. addSlickPseudos();
  2832. return find.call(this, context, expression);
  2833. };
  2834. Slick.match = function(node, selector){
  2835. addSlickPseudos();
  2836. return match.call(this, node, selector);
  2837. };
  2838. })(Slick.search, Slick.find, Slick.match);
  2839. //</1.2compat>
  2840. // tree walking
  2841. var injectCombinator = function(expression, combinator){
  2842. if (!expression) return combinator;
  2843. expression = Object.clone(Slick.parse(expression));
  2844. var expressions = expression.expressions;
  2845. for (var i = expressions.length; i--;)
  2846. expressions[i][0].combinator = combinator;
  2847. return expression;
  2848. };
  2849. Object.forEach({
  2850. getNext: '~',
  2851. getPrevious: '!~',
  2852. getParent: '!'
  2853. }, function(combinator, method){
  2854. Element.implement(method, function(expression){
  2855. return this.getElement(injectCombinator(expression, combinator));
  2856. });
  2857. });
  2858. Object.forEach({
  2859. getAllNext: '~',
  2860. getAllPrevious: '!~',
  2861. getSiblings: '~~',
  2862. getChildren: '>',
  2863. getParents: '!'
  2864. }, function(combinator, method){
  2865. Element.implement(method, function(expression){
  2866. return this.getElements(injectCombinator(expression, combinator));
  2867. });
  2868. });
  2869. Element.implement({
  2870. getFirst: function(expression){
  2871. return document.id(Slick.search(this, injectCombinator(expression, '>'))[0]);
  2872. },
  2873. getLast: function(expression){
  2874. return document.id(Slick.search(this, injectCombinator(expression, '>')).getLast());
  2875. },
  2876. getWindow: function(){
  2877. return this.ownerDocument.window;
  2878. },
  2879. getDocument: function(){
  2880. return this.ownerDocument;
  2881. },
  2882. getElementById: function(id){
  2883. return document.id(Slick.find(this, '#' + ('' + id).replace(/(\W)/g, '\\$1')));
  2884. },
  2885. match: function(expression){
  2886. return !expression || Slick.match(this, expression);
  2887. }
  2888. });
  2889. //<1.2compat>
  2890. if (window.$$ == null) Window.implement('$$', function(selector){
  2891. var elements = new Elements;
  2892. if (arguments.length == 1 && typeof selector == 'string') return Slick.search(this.document, selector, elements);
  2893. var args = Array.flatten(arguments);
  2894. for (var i = 0, l = args.length; i < l; i++){
  2895. var item = args[i];
  2896. switch (typeOf(item)){
  2897. case 'element': elements.push(item); break;
  2898. case 'string': Slick.search(this.document, item, elements);
  2899. }
  2900. }
  2901. return elements;
  2902. });
  2903. //</1.2compat>
  2904. if (window.$$ == null) Window.implement('$$', function(selector){
  2905. if (arguments.length == 1){
  2906. if (typeof selector == 'string') return Slick.search(this.document, selector, new Elements);
  2907. else if (Type.isEnumerable(selector)) return new Elements(selector);
  2908. }
  2909. return new Elements(arguments);
  2910. });
  2911. // Inserters
  2912. var inserters = {
  2913. before: function(context, element){
  2914. var parent = element.parentNode;
  2915. if (parent) parent.insertBefore(context, element);
  2916. },
  2917. after: function(context, element){
  2918. var parent = element.parentNode;
  2919. if (parent) parent.insertBefore(context, element.nextSibling);
  2920. },
  2921. bottom: function(context, element){
  2922. element.appendChild(context);
  2923. },
  2924. top: function(context, element){
  2925. element.insertBefore(context, element.firstChild);
  2926. }
  2927. };
  2928. inserters.inside = inserters.bottom;
  2929. //<1.2compat>
  2930. Object.each(inserters, function(inserter, where){
  2931. where = where.capitalize();
  2932. var methods = {};
  2933. methods['inject' + where] = function(el){
  2934. inserter(this, document.id(el, true));
  2935. return this;
  2936. };
  2937. methods['grab' + where] = function(el){
  2938. inserter(document.id(el, true), this);
  2939. return this;
  2940. };
  2941. Element.implement(methods);
  2942. });
  2943. //</1.2compat>
  2944. // getProperty / setProperty
  2945. var propertyGetters = {}, propertySetters = {};
  2946. // properties
  2947. var properties = {};
  2948. Array.forEach([
  2949. 'type', 'value', 'defaultValue', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan',
  2950. 'frameBorder', 'rowSpan', 'tabIndex', 'useMap'
  2951. ], function(property){
  2952. properties[property.toLowerCase()] = property;
  2953. });
  2954. properties.html = 'innerHTML';
  2955. properties.text = (document.createElement('div').textContent == null) ? 'innerText': 'textContent';
  2956. Object.forEach(properties, function(real, key){
  2957. propertySetters[key] = function(node, value){
  2958. node[real] = value;
  2959. };
  2960. propertyGetters[key] = function(node){
  2961. return node[real];
  2962. };
  2963. });
  2964. /*<ltIE9>*/
  2965. propertySetters.text = (function(){
  2966. return function(node, value){
  2967. if (node.get('tag') == 'style') node.set('html', value);
  2968. else node[properties.text] = value;
  2969. };
  2970. })(propertySetters.text);
  2971. propertyGetters.text = (function(getter){
  2972. return function(node){
  2973. return (node.get('tag') == 'style') ? node.innerHTML : getter(node);
  2974. };
  2975. })(propertyGetters.text);
  2976. /*</ltIE9>*/
  2977. // Booleans
  2978. var bools = [
  2979. 'compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked',
  2980. 'disabled', 'readOnly', 'multiple', 'selected', 'noresize',
  2981. 'defer', 'defaultChecked', 'autofocus', 'controls', 'autoplay',
  2982. 'loop'
  2983. ];
  2984. var booleans = {};
  2985. Array.forEach(bools, function(bool){
  2986. var lower = bool.toLowerCase();
  2987. booleans[lower] = bool;
  2988. propertySetters[lower] = function(node, value){
  2989. node[bool] = !!value;
  2990. };
  2991. propertyGetters[lower] = function(node){
  2992. return !!node[bool];
  2993. };
  2994. });
  2995. // Special cases
  2996. Object.append(propertySetters, {
  2997. 'class': function(node, value){
  2998. ('className' in node) ? node.className = (value || '') : node.setAttribute('class', value);
  2999. },
  3000. 'for': function(node, value){
  3001. ('htmlFor' in node) ? node.htmlFor = value : node.setAttribute('for', value);
  3002. },
  3003. 'style': function(node, value){
  3004. (node.style) ? node.style.cssText = value : node.setAttribute('style', value);
  3005. },
  3006. 'value': function(node, value){
  3007. node.value = (value != null) ? value : '';
  3008. }
  3009. });
  3010. propertyGetters['class'] = function(node){
  3011. return ('className' in node) ? node.className || null : node.getAttribute('class');
  3012. };
  3013. /* <webkit> */
  3014. var el = document.createElement('button');
  3015. // IE sets type as readonly and throws
  3016. try { el.type = 'button'; } catch (e){}
  3017. if (el.type != 'button') propertySetters.type = function(node, value){
  3018. node.setAttribute('type', value);
  3019. };
  3020. el = null;
  3021. /* </webkit> */
  3022. /*<IE>*/
  3023. /*<ltIE9>*/
  3024. // #2479 - IE8 Cannot set HTML of style element
  3025. var canChangeStyleHTML = (function(){
  3026. var div = document.createElement('style'),
  3027. flag = false;
  3028. try {
  3029. div.innerHTML = '#justTesing{margin: 0px;}';
  3030. flag = !!div.innerHTML;
  3031. } catch (e){}
  3032. return flag;
  3033. })();
  3034. /*</ltIE9>*/
  3035. var input = document.createElement('input'), volatileInputValue, html5InputSupport;
  3036. // #2178
  3037. input.value = 't';
  3038. input.type = 'submit';
  3039. volatileInputValue = input.value != 't';
  3040. // #2443 - IE throws "Invalid Argument" when trying to use html5 input types
  3041. try {
  3042. input.value = '';
  3043. input.type = 'email';
  3044. html5InputSupport = input.type == 'email';
  3045. } catch (e){}
  3046. input = null;
  3047. if (volatileInputValue || !html5InputSupport) propertySetters.type = function(node, type){
  3048. try {
  3049. var value = node.value;
  3050. node.type = type;
  3051. node.value = value;
  3052. } catch (e){}
  3053. };
  3054. /*</IE>*/
  3055. /* getProperty, setProperty */
  3056. /* <ltIE9> */
  3057. var pollutesGetAttribute = (function(div){
  3058. div.random = 'attribute';
  3059. return (div.getAttribute('random') == 'attribute');
  3060. })(document.createElement('div'));
  3061. var hasCloneBug = (function(test){
  3062. test.innerHTML = '<object><param name="should_fix" value="the unknown" /></object>';
  3063. return test.cloneNode(true).firstChild.childNodes.length != 1;
  3064. })(document.createElement('div'));
  3065. /* </ltIE9> */
  3066. var hasClassList = !!document.createElement('div').classList;
  3067. var classes = function(className){
  3068. var classNames = (className || '').clean().split(' '), uniques = {};
  3069. return classNames.filter(function(className){
  3070. if (className !== '' && !uniques[className]) return uniques[className] = className;
  3071. });
  3072. };
  3073. var addToClassList = function(name){
  3074. this.classList.add(name);
  3075. };
  3076. var removeFromClassList = function(name){
  3077. this.classList.remove(name);
  3078. };
  3079. Element.implement({
  3080. setProperty: function(name, value){
  3081. var setter = propertySetters[name.toLowerCase()];
  3082. if (setter){
  3083. setter(this, value);
  3084. } else {
  3085. /* <ltIE9> */
  3086. var attributeWhiteList;
  3087. if (pollutesGetAttribute) attributeWhiteList = this.retrieve('$attributeWhiteList', {});
  3088. /* </ltIE9> */
  3089. if (value == null){
  3090. this.removeAttribute(name);
  3091. /* <ltIE9> */
  3092. if (pollutesGetAttribute) delete attributeWhiteList[name];
  3093. /* </ltIE9> */
  3094. } else {
  3095. this.setAttribute(name, '' + value);
  3096. /* <ltIE9> */
  3097. if (pollutesGetAttribute) attributeWhiteList[name] = true;
  3098. /* </ltIE9> */
  3099. }
  3100. }
  3101. return this;
  3102. },
  3103. setProperties: function(attributes){
  3104. for (var attribute in attributes) this.setProperty(attribute, attributes[attribute]);
  3105. return this;
  3106. },
  3107. getProperty: function(name){
  3108. var getter = propertyGetters[name.toLowerCase()];
  3109. if (getter) return getter(this);
  3110. /* <ltIE9> */
  3111. if (pollutesGetAttribute){
  3112. var attr = this.getAttributeNode(name), attributeWhiteList = this.retrieve('$attributeWhiteList', {});
  3113. if (!attr) return null;
  3114. if (attr.expando && !attributeWhiteList[name]){
  3115. var outer = this.outerHTML;
  3116. // segment by the opening tag and find mention of attribute name
  3117. if (outer.substr(0, outer.search(/\/?['"]?>(?![^<]*<['"])/)).indexOf(name) < 0) return null;
  3118. attributeWhiteList[name] = true;
  3119. }
  3120. }
  3121. /* </ltIE9> */
  3122. var result = Slick.getAttribute(this, name);
  3123. return (!result && !Slick.hasAttribute(this, name)) ? null : result;
  3124. },
  3125. getProperties: function(){
  3126. var args = Array.convert(arguments);
  3127. return args.map(this.getProperty, this).associate(args);
  3128. },
  3129. removeProperty: function(name){
  3130. return this.setProperty(name, null);
  3131. },
  3132. removeProperties: function(){
  3133. Array.each(arguments, this.removeProperty, this);
  3134. return this;
  3135. },
  3136. set: function(prop, value){
  3137. var property = Element.Properties[prop];
  3138. (property && property.set) ? property.set.call(this, value) : this.setProperty(prop, value);
  3139. }.overloadSetter(),
  3140. get: function(prop){
  3141. var property = Element.Properties[prop];
  3142. return (property && property.get) ? property.get.apply(this) : this.getProperty(prop);
  3143. }.overloadGetter(),
  3144. erase: function(prop){
  3145. var property = Element.Properties[prop];
  3146. (property && property.erase) ? property.erase.apply(this) : this.removeProperty(prop);
  3147. return this;
  3148. },
  3149. hasClass: hasClassList ? function(className){
  3150. return this.classList.contains(className);
  3151. } : function(className){
  3152. return classes(this.className).contains(className);
  3153. },
  3154. addClass: hasClassList ? function(className){
  3155. classes(className).forEach(addToClassList, this);
  3156. return this;
  3157. } : function(className){
  3158. this.className = classes(className + ' ' + this.className).join(' ');
  3159. return this;
  3160. },
  3161. removeClass: hasClassList ? function(className){
  3162. classes(className).forEach(removeFromClassList, this);
  3163. return this;
  3164. } : function(className){
  3165. var classNames = classes(this.className);
  3166. classes(className).forEach(classNames.erase, classNames);
  3167. this.className = classNames.join(' ');
  3168. return this;
  3169. },
  3170. toggleClass: function(className, force){
  3171. if (force == null) force = !this.hasClass(className);
  3172. return (force) ? this.addClass(className) : this.removeClass(className);
  3173. },
  3174. adopt: function(){
  3175. var parent = this, fragment, elements = Array.flatten(arguments), length = elements.length;
  3176. if (length > 1) parent = fragment = document.createDocumentFragment();
  3177. for (var i = 0; i < length; i++){
  3178. var element = document.id(elements[i], true);
  3179. if (element) parent.appendChild(element);
  3180. }
  3181. if (fragment) this.appendChild(fragment);
  3182. return this;
  3183. },
  3184. appendText: function(text, where){
  3185. return this.grab(this.getDocument().newTextNode(text), where);
  3186. },
  3187. grab: function(el, where){
  3188. inserters[where || 'bottom'](document.id(el, true), this);
  3189. return this;
  3190. },
  3191. inject: function(el, where){
  3192. inserters[where || 'bottom'](this, document.id(el, true));
  3193. return this;
  3194. },
  3195. replaces: function(el){
  3196. el = document.id(el, true);
  3197. el.parentNode.replaceChild(this, el);
  3198. return this;
  3199. },
  3200. wraps: function(el, where){
  3201. el = document.id(el, true);
  3202. return this.replaces(el).grab(el, where);
  3203. },
  3204. getSelected: function(){
  3205. this.selectedIndex; // Safari 3.2.1
  3206. return new Elements(Array.convert(this.options).filter(function(option){
  3207. return option.selected;
  3208. }));
  3209. },
  3210. toQueryString: function(){
  3211. var queryString = [];
  3212. this.getElements('input, select, textarea').each(function(el){
  3213. var type = el.type;
  3214. if (!el.name || el.disabled || type == 'submit' || type == 'reset' || type == 'file' || type == 'image') return;
  3215. var value = (el.get('tag') == 'select') ? el.getSelected().map(function(opt){
  3216. // IE
  3217. return document.id(opt).get('value');
  3218. }) : ((type == 'radio' || type == 'checkbox') && !el.checked) ? null : el.get('value');
  3219. Array.convert(value).each(function(val){
  3220. if (typeof val != 'undefined') queryString.push(encodeURIComponent(el.name) + '=' + encodeURIComponent(val));
  3221. });
  3222. });
  3223. return queryString.join('&');
  3224. }
  3225. });
  3226. // appendHTML
  3227. var appendInserters = {
  3228. before: 'beforeBegin',
  3229. after: 'afterEnd',
  3230. bottom: 'beforeEnd',
  3231. top: 'afterBegin',
  3232. inside: 'beforeEnd'
  3233. };
  3234. Element.implement('appendHTML', ('insertAdjacentHTML' in document.createElement('div')) ? function(html, where){
  3235. this.insertAdjacentHTML(appendInserters[where || 'bottom'], html);
  3236. return this;
  3237. } : function(html, where){
  3238. var temp = new Element('div', {html: html}),
  3239. children = temp.childNodes,
  3240. fragment = temp.firstChild;
  3241. if (!fragment) return this;
  3242. if (children.length > 1){
  3243. fragment = document.createDocumentFragment();
  3244. for (var i = 0, l = children.length; i < l; i++){
  3245. fragment.appendChild(children[i]);
  3246. }
  3247. }
  3248. inserters[where || 'bottom'](fragment, this);
  3249. return this;
  3250. });
  3251. var collected = {}, storage = {};
  3252. var get = function(uid){
  3253. return (storage[uid] || (storage[uid] = {}));
  3254. };
  3255. var clean = function(item){
  3256. var uid = item.uniqueNumber;
  3257. if (item.removeEvents) item.removeEvents();
  3258. if (item.clearAttributes) item.clearAttributes();
  3259. if (uid != null){
  3260. delete collected[uid];
  3261. delete storage[uid];
  3262. }
  3263. return item;
  3264. };
  3265. var formProps = {input: 'checked', option: 'selected', textarea: 'value'};
  3266. Element.implement({
  3267. destroy: function(){
  3268. var children = clean(this).getElementsByTagName('*');
  3269. Array.each(children, clean);
  3270. Element.dispose(this);
  3271. return null;
  3272. },
  3273. empty: function(){
  3274. Array.convert(this.childNodes).each(Element.dispose);
  3275. return this;
  3276. },
  3277. dispose: function(){
  3278. return (this.parentNode) ? this.parentNode.removeChild(this) : this;
  3279. },
  3280. clone: function(contents, keepid){
  3281. contents = contents !== false;
  3282. var clone = this.cloneNode(contents), ce = [clone], te = [this], i;
  3283. if (contents){
  3284. ce.append(Array.convert(clone.getElementsByTagName('*')));
  3285. te.append(Array.convert(this.getElementsByTagName('*')));
  3286. }
  3287. for (i = ce.length; i--;){
  3288. var node = ce[i], element = te[i];
  3289. if (!keepid) node.removeAttribute('id');
  3290. /*<ltIE9>*/
  3291. if (node.clearAttributes){
  3292. node.clearAttributes();
  3293. node.mergeAttributes(element);
  3294. node.removeAttribute('uniqueNumber');
  3295. if (node.options){
  3296. var no = node.options, eo = element.options;
  3297. for (var j = no.length; j--;) no[j].selected = eo[j].selected;
  3298. }
  3299. }
  3300. /*</ltIE9>*/
  3301. var prop = formProps[element.tagName.toLowerCase()];
  3302. if (prop && element[prop]) node[prop] = element[prop];
  3303. }
  3304. /*<ltIE9>*/
  3305. if (hasCloneBug){
  3306. var co = clone.getElementsByTagName('object'), to = this.getElementsByTagName('object');
  3307. for (i = co.length; i--;) co[i].outerHTML = to[i].outerHTML;
  3308. }
  3309. /*</ltIE9>*/
  3310. return document.id(clone);
  3311. }
  3312. });
  3313. [Element, Window, Document].invoke('implement', {
  3314. addListener: function(type, fn){
  3315. if (window.attachEvent && !window.addEventListener){
  3316. collected[Slick.uidOf(this)] = this;
  3317. }
  3318. if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]);
  3319. else this.attachEvent('on' + type, fn);
  3320. return this;
  3321. },
  3322. removeListener: function(type, fn){
  3323. if (this.removeEventListener) this.removeEventListener(type, fn, !!arguments[2]);
  3324. else this.detachEvent('on' + type, fn);
  3325. return this;
  3326. },
  3327. retrieve: function(property, dflt){
  3328. var storage = get(Slick.uidOf(this)), prop = storage[property];
  3329. if (dflt != null && prop == null) prop = storage[property] = dflt;
  3330. return prop != null ? prop : null;
  3331. },
  3332. store: function(property, value){
  3333. var storage = get(Slick.uidOf(this));
  3334. storage[property] = value;
  3335. return this;
  3336. },
  3337. eliminate: function(property){
  3338. var storage = get(Slick.uidOf(this));
  3339. delete storage[property];
  3340. return this;
  3341. }
  3342. });
  3343. /*<ltIE9>*/
  3344. if (window.attachEvent && !window.addEventListener){
  3345. var gc = function(){
  3346. Object.each(collected, clean);
  3347. if (window.CollectGarbage) CollectGarbage();
  3348. window.removeListener('unload', gc);
  3349. };
  3350. window.addListener('unload', gc);
  3351. }
  3352. /*</ltIE9>*/
  3353. Element.Properties = {};
  3354. //<1.2compat>
  3355. Element.Properties = new Hash;
  3356. //</1.2compat>
  3357. Element.Properties.style = {
  3358. set: function(style){
  3359. this.style.cssText = style;
  3360. },
  3361. get: function(){
  3362. return this.style.cssText;
  3363. },
  3364. erase: function(){
  3365. this.style.cssText = '';
  3366. }
  3367. };
  3368. Element.Properties.tag = {
  3369. get: function(){
  3370. return this.tagName.toLowerCase();
  3371. }
  3372. };
  3373. Element.Properties.html = {
  3374. set: function(html){
  3375. if (html == null) html = '';
  3376. else if (typeOf(html) == 'array') html = html.join('');
  3377. /*<ltIE9>*/
  3378. if (this.styleSheet && !canChangeStyleHTML) this.styleSheet.cssText = html;
  3379. else /*</ltIE9>*/this.innerHTML = html;
  3380. },
  3381. erase: function(){
  3382. this.set('html', '');
  3383. }
  3384. };
  3385. var supportsHTML5Elements = true, supportsTableInnerHTML = true, supportsTRInnerHTML = true;
  3386. /*<ltIE9>*/
  3387. // technique by jdbarlett - http://jdbartlett.com/innershiv/
  3388. var div = document.createElement('div');
  3389. var fragment;
  3390. div.innerHTML = '<nav></nav>';
  3391. supportsHTML5Elements = (div.childNodes.length == 1);
  3392. if (!supportsHTML5Elements){
  3393. var tags = 'abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' ');
  3394. fragment = document.createDocumentFragment(), l = tags.length;
  3395. while (l--) fragment.createElement(tags[l]);
  3396. }
  3397. div = null;
  3398. /*</ltIE9>*/
  3399. /*<IE>*/
  3400. supportsTableInnerHTML = Function.attempt(function(){
  3401. var table = document.createElement('table');
  3402. table.innerHTML = '<tr><td></td></tr>';
  3403. return true;
  3404. });
  3405. /*<ltFF4>*/
  3406. var tr = document.createElement('tr'), html = '<td></td>';
  3407. tr.innerHTML = html;
  3408. supportsTRInnerHTML = (tr.innerHTML == html);
  3409. tr = null;
  3410. /*</ltFF4>*/
  3411. if (!supportsTableInnerHTML || !supportsTRInnerHTML || !supportsHTML5Elements){
  3412. Element.Properties.html.set = (function(set){
  3413. var translations = {
  3414. table: [1, '<table>', '</table>'],
  3415. select: [1, '<select>', '</select>'],
  3416. tbody: [2, '<table><tbody>', '</tbody></table>'],
  3417. tr: [3, '<table><tbody><tr>', '</tr></tbody></table>']
  3418. };
  3419. translations.thead = translations.tfoot = translations.tbody;
  3420. return function(html){
  3421. /*<ltIE9>*/
  3422. if (this.styleSheet) return set.call(this, html);
  3423. /*</ltIE9>*/
  3424. var wrap = translations[this.get('tag')];
  3425. if (!wrap && !supportsHTML5Elements) wrap = [0, '', ''];
  3426. if (!wrap) return set.call(this, html);
  3427. var level = wrap[0], wrapper = document.createElement('div'), target = wrapper;
  3428. if (!supportsHTML5Elements) fragment.appendChild(wrapper);
  3429. wrapper.innerHTML = [wrap[1], html, wrap[2]].flatten().join('');
  3430. while (level--) target = target.firstChild;
  3431. this.empty().adopt(target.childNodes);
  3432. if (!supportsHTML5Elements) fragment.removeChild(wrapper);
  3433. wrapper = null;
  3434. };
  3435. })(Element.Properties.html.set);
  3436. }
  3437. /*</IE>*/
  3438. /*<ltIE9>*/
  3439. var testForm = document.createElement('form');
  3440. testForm.innerHTML = '<select><option>s</option></select>';
  3441. if (testForm.firstChild.value != 's') Element.Properties.value = {
  3442. set: function(value){
  3443. var tag = this.get('tag');
  3444. if (tag != 'select') return this.setProperty('value', value);
  3445. var options = this.getElements('option');
  3446. value = String(value);
  3447. for (var i = 0; i < options.length; i++){
  3448. var option = options[i],
  3449. attr = option.getAttributeNode('value'),
  3450. optionValue = (attr && attr.specified) ? option.value : option.get('text');
  3451. if (optionValue === value) return option.selected = true;
  3452. }
  3453. },
  3454. get: function(){
  3455. var option = this, tag = option.get('tag');
  3456. if (tag != 'select' && tag != 'option') return this.getProperty('value');
  3457. if (tag == 'select' && !(option = option.getSelected()[0])) return '';
  3458. var attr = option.getAttributeNode('value');
  3459. return (attr && attr.specified) ? option.value : option.get('text');
  3460. }
  3461. };
  3462. testForm = null;
  3463. /*</ltIE9>*/
  3464. /*<IE>*/
  3465. if (document.createElement('div').getAttributeNode('id')) Element.Properties.id = {
  3466. set: function(id){
  3467. this.id = this.getAttributeNode('id').value = id;
  3468. },
  3469. get: function(){
  3470. return this.id || null;
  3471. },
  3472. erase: function(){
  3473. this.id = this.getAttributeNode('id').value = '';
  3474. }
  3475. };
  3476. /*</IE>*/
  3477. })();
  3478. /*
  3479. ---
  3480. name: Event
  3481. description: Contains the Event Type, to make the event object cross-browser.
  3482. license: MIT-style license.
  3483. requires: [Window, Document, Array, Function, String, Object]
  3484. provides: Event
  3485. ...
  3486. */
  3487. (function(){
  3488. var _keys = {};
  3489. var normalizeWheelSpeed = function(event){
  3490. var normalized;
  3491. if (event.wheelDelta){
  3492. normalized = event.wheelDelta % 120 == 0 ? event.wheelDelta / 120 : event.wheelDelta / 12;
  3493. } else {
  3494. var rawAmount = event.deltaY || event.detail || 0;
  3495. normalized = -(rawAmount % 3 == 0 ? rawAmount / 3 : rawAmount * 10);
  3496. }
  3497. return normalized;
  3498. };
  3499. var DOMEvent = this.DOMEvent = new Type('DOMEvent', function(event, win){
  3500. if (!win) win = window;
  3501. event = event || win.event;
  3502. if (event.$extended) return event;
  3503. this.event = event;
  3504. this.$extended = true;
  3505. this.shift = event.shiftKey;
  3506. this.control = event.ctrlKey;
  3507. this.alt = event.altKey;
  3508. this.meta = event.metaKey;
  3509. var type = this.type = event.type;
  3510. var target = event.target || event.srcElement;
  3511. while (target && target.nodeType == 3) target = target.parentNode;
  3512. this.target = document.id(target);
  3513. if (type.indexOf('key') == 0){
  3514. var code = this.code = (event.which || event.keyCode);
  3515. if (!this.shift || type != 'keypress') this.key = _keys[code];
  3516. if (type == 'keydown' || type == 'keyup'){
  3517. if (code > 111 && code < 124) this.key = 'f' + (code - 111);
  3518. else if (code > 95 && code < 106) this.key = code - 96;
  3519. }
  3520. if (this.key == null) this.key = String.fromCharCode(code).toLowerCase();
  3521. } else if (type == 'click' || type == 'dblclick' || type == 'contextmenu' || type == 'wheel' || type == 'DOMMouseScroll' || type.indexOf('mouse') == 0){
  3522. var doc = win.document;
  3523. doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
  3524. this.page = {
  3525. x: (event.pageX != null) ? event.pageX : event.clientX + doc.scrollLeft,
  3526. y: (event.pageY != null) ? event.pageY : event.clientY + doc.scrollTop
  3527. };
  3528. this.client = {
  3529. x: (event.pageX != null) ? event.pageX - win.pageXOffset : event.clientX,
  3530. y: (event.pageY != null) ? event.pageY - win.pageYOffset : event.clientY
  3531. };
  3532. if (type == 'DOMMouseScroll' || type == 'wheel' || type == 'mousewheel') this.wheel = normalizeWheelSpeed(event);
  3533. this.rightClick = (event.which == 3 || event.button == 2);
  3534. if (type == 'mouseover' || type == 'mouseout' || type == 'mouseenter' || type == 'mouseleave'){
  3535. var overTarget = type == 'mouseover' || type == 'mouseenter';
  3536. var related = event.relatedTarget || event[(overTarget ? 'from' : 'to') + 'Element'];
  3537. while (related && related.nodeType == 3) related = related.parentNode;
  3538. this.relatedTarget = document.id(related);
  3539. }
  3540. } else if (type.indexOf('touch') == 0 || type.indexOf('gesture') == 0){
  3541. this.rotation = event.rotation;
  3542. this.scale = event.scale;
  3543. this.targetTouches = event.targetTouches;
  3544. this.changedTouches = event.changedTouches;
  3545. var touches = this.touches = event.touches;
  3546. if (touches && touches[0]){
  3547. var touch = touches[0];
  3548. this.page = {x: touch.pageX, y: touch.pageY};
  3549. this.client = {x: touch.clientX, y: touch.clientY};
  3550. }
  3551. }
  3552. if (!this.client) this.client = {};
  3553. if (!this.page) this.page = {};
  3554. });
  3555. DOMEvent.implement({
  3556. stop: function(){
  3557. return this.preventDefault().stopPropagation();
  3558. },
  3559. stopPropagation: function(){
  3560. if (this.event.stopPropagation) this.event.stopPropagation();
  3561. else this.event.cancelBubble = true;
  3562. return this;
  3563. },
  3564. preventDefault: function(){
  3565. if (this.event.preventDefault) this.event.preventDefault();
  3566. else this.event.returnValue = false;
  3567. return this;
  3568. }
  3569. });
  3570. DOMEvent.defineKey = function(code, key){
  3571. _keys[code] = key;
  3572. return this;
  3573. };
  3574. DOMEvent.defineKeys = DOMEvent.defineKey.overloadSetter(true);
  3575. DOMEvent.defineKeys({
  3576. '38': 'up', '40': 'down', '37': 'left', '39': 'right',
  3577. '27': 'esc', '32': 'space', '8': 'backspace', '9': 'tab',
  3578. '46': 'delete', '13': 'enter'
  3579. });
  3580. })();
  3581. // /*<1.3compat>*/
  3582. // var Event = this.Event = DOMEvent;
  3583. // Event.Keys = {};
  3584. // /*</1.3compat>*/
  3585. //
  3586. // /*<1.2compat>*/
  3587. //
  3588. // Event.Keys = new Hash(Event.Keys);
  3589. //
  3590. // /*</1.2compat>*/
  3591. /*
  3592. ---
  3593. name: Element.Event
  3594. description: Contains Element methods for dealing with events. This file also includes mouseenter and mouseleave custom Element Events, if necessary.
  3595. license: MIT-style license.
  3596. requires: [Element, Event]
  3597. provides: Element.Event
  3598. ...
  3599. */
  3600. (function(){
  3601. Element.Properties.events = {set: function(events){
  3602. this.addEvents(events);
  3603. }};
  3604. [Element, Window, Document].invoke('implement', {
  3605. addEvent: function(type, fn){
  3606. var events = this.retrieve('events', {});
  3607. if (!events[type]) events[type] = {keys: [], values: []};
  3608. if (events[type].keys.contains(fn)) return this;
  3609. events[type].keys.push(fn);
  3610. var realType = type,
  3611. custom = Element.Events[type],
  3612. condition = fn,
  3613. self = this;
  3614. if (custom){
  3615. if (custom.onAdd) custom.onAdd.call(this, fn, type);
  3616. if (custom.condition){
  3617. condition = function(event){
  3618. if (custom.condition.call(this, event, type)) return fn.call(this, event);
  3619. return true;
  3620. };
  3621. }
  3622. if (custom.base) realType = Function.convert(custom.base).call(this, type);
  3623. }
  3624. var defn = function(){
  3625. return fn.call(self);
  3626. };
  3627. var nativeEvent = Element.NativeEvents[realType];
  3628. if (nativeEvent){
  3629. if (nativeEvent == 2){
  3630. defn = function(event){
  3631. event = new DOMEvent(event, self.getWindow());
  3632. if (condition.call(self, event) === false) event.stop();
  3633. };
  3634. }
  3635. this.addListener(realType, defn, arguments[2]);
  3636. }
  3637. events[type].values.push(defn);
  3638. return this;
  3639. },
  3640. removeEvent: function(type, fn){
  3641. var events = this.retrieve('events');
  3642. if (!events || !events[type]) return this;
  3643. var list = events[type];
  3644. var index = list.keys.indexOf(fn);
  3645. if (index == -1) return this;
  3646. var value = list.values[index];
  3647. delete list.keys[index];
  3648. delete list.values[index];
  3649. var custom = Element.Events[type];
  3650. if (custom){
  3651. if (custom.onRemove) custom.onRemove.call(this, fn, type);
  3652. if (custom.base) type = Function.convert(custom.base).call(this, type);
  3653. }
  3654. return (Element.NativeEvents[type]) ? this.removeListener(type, value, arguments[2]) : this;
  3655. },
  3656. addEvents: function(events){
  3657. for (var event in events) this.addEvent(event, events[event]);
  3658. return this;
  3659. },
  3660. removeEvents: function(events){
  3661. var type;
  3662. if (typeOf(events) == 'object'){
  3663. for (type in events) this.removeEvent(type, events[type]);
  3664. return this;
  3665. }
  3666. var attached = this.retrieve('events');
  3667. if (!attached) return this;
  3668. if (!events){
  3669. for (type in attached) this.removeEvents(type);
  3670. this.eliminate('events');
  3671. } else if (attached[events]){
  3672. attached[events].keys.each(function(fn){
  3673. this.removeEvent(events, fn);
  3674. }, this);
  3675. delete attached[events];
  3676. }
  3677. return this;
  3678. },
  3679. fireEvent: function(type, args, delay){
  3680. var events = this.retrieve('events');
  3681. if (!events || !events[type]) return this;
  3682. args = Array.convert(args);
  3683. events[type].keys.each(function(fn){
  3684. if (delay) fn.delay(delay, this, args);
  3685. else fn.apply(this, args);
  3686. }, this);
  3687. return this;
  3688. },
  3689. cloneEvents: function(from, type){
  3690. from = document.id(from);
  3691. var events = from.retrieve('events');
  3692. if (!events) return this;
  3693. if (!type){
  3694. for (var eventType in events) this.cloneEvents(from, eventType);
  3695. } else if (events[type]){
  3696. events[type].keys.each(function(fn){
  3697. this.addEvent(type, fn);
  3698. }, this);
  3699. }
  3700. return this;
  3701. }
  3702. });
  3703. Element.NativeEvents = {
  3704. click: 2, dblclick: 2, mouseup: 2, mousedown: 2, contextmenu: 2, //mouse buttons
  3705. wheel: 2, mousewheel: 2, DOMMouseScroll: 2, //mouse wheel
  3706. mouseover: 2, mouseout: 2, mousemove: 2, selectstart: 2, selectend: 2, //mouse movement
  3707. keydown: 2, keypress: 2, keyup: 2, //keyboard
  3708. orientationchange: 2, // mobile
  3709. touchstart: 2, touchmove: 2, touchend: 2, touchcancel: 2, // touch
  3710. gesturestart: 2, gesturechange: 2, gestureend: 2, // gesture
  3711. focus: 2, blur: 2, change: 2, reset: 2, select: 2, submit: 2, paste: 2, input: 2, //form elements
  3712. load: 2, unload: 1, beforeunload: 2, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window
  3713. hashchange: 1, popstate: 2, pageshow: 2, pagehide: 2, // history
  3714. error: 1, abort: 1, scroll: 1, message: 2 //misc
  3715. };
  3716. Element.Events = {
  3717. mousewheel: {
  3718. base: 'onwheel' in document ? 'wheel' : 'onmousewheel' in document ? 'mousewheel' : 'DOMMouseScroll'
  3719. }
  3720. };
  3721. var check = function(event){
  3722. var related = event.relatedTarget;
  3723. if (related == null) return true;
  3724. if (!related) return false;
  3725. return (related != this && related.prefix != 'xul' && typeOf(this) != 'document' && !this.contains(related));
  3726. };
  3727. if ('onmouseenter' in document.documentElement){
  3728. Element.NativeEvents.mouseenter = Element.NativeEvents.mouseleave = 2;
  3729. Element.MouseenterCheck = check;
  3730. } else {
  3731. Element.Events.mouseenter = {
  3732. base: 'mouseover',
  3733. condition: check
  3734. };
  3735. Element.Events.mouseleave = {
  3736. base: 'mouseout',
  3737. condition: check
  3738. };
  3739. }
  3740. /*<ltIE9>*/
  3741. if (!window.addEventListener){
  3742. Element.NativeEvents.propertychange = 2;
  3743. Element.Events.change = {
  3744. base: function(){
  3745. var type = this.type;
  3746. return (this.get('tag') == 'input' && (type == 'radio' || type == 'checkbox')) ? 'propertychange' : 'change';
  3747. },
  3748. condition: function(event){
  3749. return event.type != 'propertychange' || event.event.propertyName == 'checked';
  3750. }
  3751. };
  3752. }
  3753. /*</ltIE9>*/
  3754. //<1.2compat>
  3755. Element.Events = new Hash(Element.Events);
  3756. //</1.2compat>
  3757. })();
  3758. /*
  3759. ---
  3760. name: Element.Delegation
  3761. description: Extends the Element native object to include the delegate method for more efficient event management.
  3762. license: MIT-style license.
  3763. requires: [Element.Event]
  3764. provides: [Element.Delegation]
  3765. ...
  3766. */
  3767. (function(){
  3768. var eventListenerSupport = !!window.addEventListener;
  3769. Element.NativeEvents.focusin = Element.NativeEvents.focusout = 2;
  3770. var bubbleUp = function(self, match, fn, event, target){
  3771. while (target && target != self){
  3772. if (match(target, event)) return fn.call(target, event, target);
  3773. target = document.id(target.parentNode);
  3774. }
  3775. };
  3776. var map = {
  3777. mouseenter: {
  3778. base: 'mouseover',
  3779. condition: Element.MouseenterCheck
  3780. },
  3781. mouseleave: {
  3782. base: 'mouseout',
  3783. condition: Element.MouseenterCheck
  3784. },
  3785. focus: {
  3786. base: 'focus' + (eventListenerSupport ? '' : 'in'),
  3787. capture: true
  3788. },
  3789. blur: {
  3790. base: eventListenerSupport ? 'blur' : 'focusout',
  3791. capture: true
  3792. }
  3793. };
  3794. /*<ltIE9>*/
  3795. var _key = '$delegation:';
  3796. var formObserver = function(type){
  3797. return {
  3798. base: 'focusin',
  3799. remove: function(self, uid){
  3800. var list = self.retrieve(_key + type + 'listeners', {})[uid];
  3801. if (list && list.forms) for (var i = list.forms.length; i--;){
  3802. // the form may have been destroyed, so it won't have the
  3803. // removeEvent method anymore. In that case the event was
  3804. // removed as well.
  3805. if (list.forms[i].removeEvent) list.forms[i].removeEvent(type, list.fns[i]);
  3806. }
  3807. },
  3808. listen: function(self, match, fn, event, target, uid){
  3809. var form = (target.get('tag') == 'form') ? target : event.target.getParent('form');
  3810. if (!form) return;
  3811. var listeners = self.retrieve(_key + type + 'listeners', {}),
  3812. listener = listeners[uid] || {forms: [], fns: []},
  3813. forms = listener.forms, fns = listener.fns;
  3814. if (forms.indexOf(form) != -1) return;
  3815. forms.push(form);
  3816. var _fn = function(event){
  3817. bubbleUp(self, match, fn, event, target);
  3818. };
  3819. form.addEvent(type, _fn);
  3820. fns.push(_fn);
  3821. listeners[uid] = listener;
  3822. self.store(_key + type + 'listeners', listeners);
  3823. }
  3824. };
  3825. };
  3826. var inputObserver = function(type){
  3827. return {
  3828. base: 'focusin',
  3829. listen: function(self, match, fn, event, target){
  3830. var events = {blur: function(){
  3831. this.removeEvents(events);
  3832. }};
  3833. events[type] = function(event){
  3834. bubbleUp(self, match, fn, event, target);
  3835. };
  3836. event.target.addEvents(events);
  3837. }
  3838. };
  3839. };
  3840. if (!eventListenerSupport) Object.append(map, {
  3841. submit: formObserver('submit'),
  3842. reset: formObserver('reset'),
  3843. change: inputObserver('change'),
  3844. select: inputObserver('select')
  3845. });
  3846. /*</ltIE9>*/
  3847. var proto = Element.prototype,
  3848. addEvent = proto.addEvent,
  3849. removeEvent = proto.removeEvent;
  3850. var relay = function(old, method){
  3851. return function(type, fn, useCapture){
  3852. if (type.indexOf(':relay') == -1) return old.call(this, type, fn, useCapture);
  3853. var parsed = Slick.parse(type).expressions[0][0];
  3854. if (parsed.pseudos[0].key != 'relay') return old.call(this, type, fn, useCapture);
  3855. var newType = parsed.tag;
  3856. parsed.pseudos.slice(1).each(function(pseudo){
  3857. newType += ':' + pseudo.key + (pseudo.value ? '(' + pseudo.value + ')' : '');
  3858. });
  3859. old.call(this, type, fn);
  3860. return method.call(this, newType, parsed.pseudos[0].value, fn);
  3861. };
  3862. };
  3863. var delegation = {
  3864. addEvent: function(type, match, fn){
  3865. var storage = this.retrieve('$delegates', {}), stored = storage[type];
  3866. if (stored) for (var _uid in stored){
  3867. if (stored[_uid].fn == fn && stored[_uid].match == match) return this;
  3868. }
  3869. var _type = type, _match = match, _fn = fn, _map = map[type] || {};
  3870. type = _map.base || _type;
  3871. match = function(target){
  3872. return Slick.match(target, _match);
  3873. };
  3874. var elementEvent = Element.Events[_type];
  3875. if (_map.condition || elementEvent && elementEvent.condition){
  3876. var __match = match, condition = _map.condition || elementEvent.condition;
  3877. match = function(target, event){
  3878. return __match(target, event) && condition.call(target, event, type);
  3879. };
  3880. }
  3881. var self = this, uid = String.uniqueID();
  3882. var delegator = _map.listen ? function(event, target){
  3883. if (!target && event && event.target) target = event.target;
  3884. if (target) _map.listen(self, match, fn, event, target, uid);
  3885. } : function(event, target){
  3886. if (!target && event && event.target) target = event.target;
  3887. if (target) bubbleUp(self, match, fn, event, target);
  3888. };
  3889. if (!stored) stored = {};
  3890. stored[uid] = {
  3891. match: _match,
  3892. fn: _fn,
  3893. delegator: delegator
  3894. };
  3895. storage[_type] = stored;
  3896. return addEvent.call(this, type, delegator, _map.capture);
  3897. },
  3898. removeEvent: function(type, match, fn, _uid){
  3899. var storage = this.retrieve('$delegates', {}), stored = storage[type];
  3900. if (!stored) return this;
  3901. if (_uid){
  3902. var _type = type, delegator = stored[_uid].delegator, _map = map[type] || {};
  3903. type = _map.base || _type;
  3904. if (_map.remove) _map.remove(this, _uid);
  3905. delete stored[_uid];
  3906. storage[_type] = stored;
  3907. return removeEvent.call(this, type, delegator, _map.capture);
  3908. }
  3909. var __uid, s;
  3910. if (fn) for (__uid in stored){
  3911. s = stored[__uid];
  3912. if (s.match == match && s.fn == fn) return delegation.removeEvent.call(this, type, match, fn, __uid);
  3913. } else for (__uid in stored){
  3914. s = stored[__uid];
  3915. if (s.match == match) delegation.removeEvent.call(this, type, match, s.fn, __uid);
  3916. }
  3917. return this;
  3918. }
  3919. };
  3920. [Element, Window, Document].invoke('implement', {
  3921. addEvent: relay(addEvent, delegation.addEvent),
  3922. removeEvent: relay(removeEvent, delegation.removeEvent)
  3923. });
  3924. })();
  3925. /*
  3926. ---
  3927. name: Element.Style
  3928. description: Contains methods for interacting with the styles of Elements in a fashionable way.
  3929. license: MIT-style license.
  3930. requires: Element
  3931. provides: Element.Style
  3932. ...
  3933. */
  3934. (function(){
  3935. var html = document.html, el;
  3936. //<ltIE9>
  3937. // Check for oldIE, which does not remove styles when they're set to null
  3938. el = document.createElement('div');
  3939. el.style.color = 'red';
  3940. el.style.color = null;
  3941. var doesNotRemoveStyles = el.style.color == 'red';
  3942. // check for oldIE, which returns border* shorthand styles in the wrong order (color-width-style instead of width-style-color)
  3943. var border = '1px solid #123abc';
  3944. el.style.border = border;
  3945. var returnsBordersInWrongOrder = el.style.border != border;
  3946. el = null;
  3947. //</ltIE9>
  3948. var hasGetComputedStyle = !!window.getComputedStyle,
  3949. supportBorderRadius = document.createElement('div').style.borderRadius != null;
  3950. Element.Properties.styles = {set: function(styles){
  3951. this.setStyles(styles);
  3952. }};
  3953. var hasOpacity = (html.style.opacity != null),
  3954. hasFilter = (html.style.filter != null),
  3955. reAlpha = /alpha\(opacity=([\d.]+)\)/i;
  3956. var setVisibility = function(element, opacity){
  3957. element.store('$opacity', opacity);
  3958. element.style.visibility = opacity > 0 || opacity == null ? 'visible' : 'hidden';
  3959. };
  3960. //<ltIE9>
  3961. var setFilter = function(element, regexp, value){
  3962. var style = element.style,
  3963. filter = style.filter || element.getComputedStyle('filter') || '';
  3964. style.filter = (regexp.test(filter) ? filter.replace(regexp, value) : filter + ' ' + value).trim();
  3965. if (!style.filter) style.removeAttribute('filter');
  3966. };
  3967. //</ltIE9>
  3968. var setOpacity = (hasOpacity ? function(element, opacity){
  3969. element.style.opacity = opacity;
  3970. } : (hasFilter ? function(element, opacity){
  3971. if (!element.currentStyle || !element.currentStyle.hasLayout) element.style.zoom = 1;
  3972. if (opacity == null || opacity == 1){
  3973. setFilter(element, reAlpha, '');
  3974. if (opacity == 1 && getOpacity(element) != 1) setFilter(element, reAlpha, 'alpha(opacity=100)');
  3975. } else {
  3976. setFilter(element, reAlpha, 'alpha(opacity=' + (opacity * 100).limit(0, 100).round() + ')');
  3977. }
  3978. } : setVisibility));
  3979. var getOpacity = (hasOpacity ? function(element){
  3980. var opacity = element.style.opacity || element.getComputedStyle('opacity');
  3981. return (opacity == '') ? 1 : opacity.toFloat();
  3982. } : (hasFilter ? function(element){
  3983. var filter = (element.style.filter || element.getComputedStyle('filter')),
  3984. opacity;
  3985. if (filter) opacity = filter.match(reAlpha);
  3986. return (opacity == null || filter == null) ? 1 : (opacity[1] / 100);
  3987. } : function(element){
  3988. var opacity = element.retrieve('$opacity');
  3989. if (opacity == null) opacity = (element.style.visibility == 'hidden' ? 0 : 1);
  3990. return opacity;
  3991. }));
  3992. var floatName = (html.style.cssFloat == null) ? 'styleFloat' : 'cssFloat',
  3993. namedPositions = {left: '0%', top: '0%', center: '50%', right: '100%', bottom: '100%'},
  3994. hasBackgroundPositionXY = (html.style.backgroundPositionX != null),
  3995. prefixPattern = /^-(ms)-/;
  3996. var camelCase = function(property){
  3997. return property.replace(prefixPattern, '$1-').camelCase();
  3998. };
  3999. //<ltIE9>
  4000. var removeStyle = function(style, property){
  4001. if (property == 'backgroundPosition'){
  4002. style.removeAttribute(property + 'X');
  4003. property += 'Y';
  4004. }
  4005. style.removeAttribute(property);
  4006. };
  4007. //</ltIE9>
  4008. Element.implement({
  4009. getComputedStyle: function(property){
  4010. if (!hasGetComputedStyle && this.currentStyle) return this.currentStyle[camelCase(property)];
  4011. var defaultView = Element.getDocument(this).defaultView,
  4012. computed = defaultView ? defaultView.getComputedStyle(this, null) : null;
  4013. return (computed) ? computed.getPropertyValue((property == floatName) ? 'float' : property.hyphenate()) : '';
  4014. },
  4015. setStyle: function(property, value){
  4016. if (property == 'opacity'){
  4017. if (value != null) value = parseFloat(value);
  4018. setOpacity(this, value);
  4019. return this;
  4020. }
  4021. property = camelCase(property == 'float' ? floatName : property);
  4022. if (typeOf(value) != 'string'){
  4023. var map = (Element.Styles[property] || '@').split(' ');
  4024. value = Array.convert(value).map(function(val, i){
  4025. if (!map[i]) return '';
  4026. return (typeOf(val) == 'number') ? map[i].replace('@', Math.round(val)) : val;
  4027. }).join(' ');
  4028. } else if (value == String(Number(value))){
  4029. value = Math.round(value);
  4030. }
  4031. this.style[property] = value;
  4032. //<ltIE9>
  4033. if ((value == '' || value == null) && doesNotRemoveStyles && this.style.removeAttribute){
  4034. removeStyle(this.style, property);
  4035. }
  4036. //</ltIE9>
  4037. return this;
  4038. },
  4039. getStyle: function(property){
  4040. if (property == 'opacity') return getOpacity(this);
  4041. property = camelCase(property == 'float' ? floatName : property);
  4042. if (supportBorderRadius && property.indexOf('borderRadius') != -1){
  4043. return ['borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomRightRadius', 'borderBottomLeftRadius'].map(function(corner){
  4044. return this.style[corner] || '0px';
  4045. }, this).join(' ');
  4046. }
  4047. var result = this.style[property];
  4048. if (!result || property == 'zIndex'){
  4049. if (Element.ShortStyles.hasOwnProperty(property)){
  4050. result = [];
  4051. for (var s in Element.ShortStyles[property]) result.push(this.getStyle(s));
  4052. return result.join(' ');
  4053. }
  4054. result = this.getComputedStyle(property);
  4055. }
  4056. if (hasBackgroundPositionXY && /^backgroundPosition[XY]?$/.test(property)){
  4057. return result.replace(/(top|right|bottom|left)/g, function(position){
  4058. return namedPositions[position];
  4059. }) || '0px';
  4060. }
  4061. if (!result && property == 'backgroundPosition') return '0px 0px';
  4062. if (result){
  4063. result = String(result);
  4064. var color = result.match(/rgba?\([\d\s,]+\)/);
  4065. if (color) result = result.replace(color[0], color[0].rgbToHex());
  4066. }
  4067. if (!hasGetComputedStyle && !this.style[property]){
  4068. if ((/^(height|width)$/).test(property) && !(/px$/.test(result))){
  4069. var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0;
  4070. values.each(function(value){
  4071. size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt();
  4072. }, this);
  4073. return this['offset' + property.capitalize()] - size + 'px';
  4074. }
  4075. if ((/^border(.+)Width|margin|padding/).test(property) && isNaN(parseFloat(result))){
  4076. return '0px';
  4077. }
  4078. }
  4079. //<ltIE9>
  4080. if (returnsBordersInWrongOrder && /^border(Top|Right|Bottom|Left)?$/.test(property) && /^#/.test(result)){
  4081. return result.replace(/^(.+)\s(.+)\s(.+)$/, '$2 $3 $1');
  4082. }
  4083. //</ltIE9>
  4084. return result;
  4085. },
  4086. setStyles: function(styles){
  4087. for (var style in styles) this.setStyle(style, styles[style]);
  4088. return this;
  4089. },
  4090. getStyles: function(){
  4091. var result = {};
  4092. Array.flatten(arguments).each(function(key){
  4093. result[key] = this.getStyle(key);
  4094. }, this);
  4095. return result;
  4096. }
  4097. });
  4098. Element.Styles = {
  4099. left: '@px', top: '@px', bottom: '@px', right: '@px',
  4100. width: '@px', height: '@px', maxWidth: '@px', maxHeight: '@px', minWidth: '@px', minHeight: '@px',
  4101. backgroundColor: 'rgb(@, @, @)', backgroundSize: '@px', backgroundPosition: '@px @px', color: 'rgb(@, @, @)',
  4102. fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)',
  4103. margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)',
  4104. borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)',
  4105. zIndex: '@', 'zoom': '@', fontWeight: '@', textIndent: '@px', opacity: '@', borderRadius: '@px @px @px @px'
  4106. };
  4107. //<1.3compat>
  4108. Element.implement({
  4109. setOpacity: function(value){
  4110. setOpacity(this, value);
  4111. return this;
  4112. },
  4113. getOpacity: function(){
  4114. return getOpacity(this);
  4115. }
  4116. });
  4117. Element.Properties.opacity = {
  4118. set: function(opacity){
  4119. setOpacity(this, opacity);
  4120. setVisibility(this, opacity);
  4121. },
  4122. get: function(){
  4123. return getOpacity(this);
  4124. }
  4125. };
  4126. //</1.3compat>
  4127. //<1.2compat>
  4128. Element.Styles = new Hash(Element.Styles);
  4129. //</1.2compat>
  4130. Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, borderStyle: {}, borderColor: {}};
  4131. ['Top', 'Right', 'Bottom', 'Left'].each(function(direction){
  4132. var Short = Element.ShortStyles;
  4133. var All = Element.Styles;
  4134. ['margin', 'padding'].each(function(style){
  4135. var sd = style + direction;
  4136. Short[style][sd] = All[sd] = '@px';
  4137. });
  4138. var bd = 'border' + direction;
  4139. Short.border[bd] = All[bd] = '@px @ rgb(@, @, @)';
  4140. var bdw = bd + 'Width', bds = bd + 'Style', bdc = bd + 'Color';
  4141. Short[bd] = {};
  4142. Short.borderWidth[bdw] = Short[bd][bdw] = All[bdw] = '@px';
  4143. Short.borderStyle[bds] = Short[bd][bds] = All[bds] = '@';
  4144. Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)';
  4145. });
  4146. if (hasBackgroundPositionXY) Element.ShortStyles.backgroundPosition = {backgroundPositionX: '@', backgroundPositionY: '@'};
  4147. })();
  4148. /*
  4149. ---
  4150. name: Element.Dimensions
  4151. description: Contains methods to work with size, scroll, or positioning of Elements and the window object.
  4152. license: MIT-style license.
  4153. credits:
  4154. - Element positioning based on the [qooxdoo](http://qooxdoo.org/) code and smart browser fixes, [LGPL License](http://www.gnu.org/licenses/lgpl.html).
  4155. - Viewport dimensions based on [YUI](http://developer.yahoo.com/yui/) code, [BSD License](http://developer.yahoo.com/yui/license.html).
  4156. requires: [Element, Element.Style]
  4157. provides: [Element.Dimensions]
  4158. ...
  4159. */
  4160. (function(){
  4161. var element = document.createElement('div'),
  4162. child = document.createElement('div');
  4163. element.style.height = '0';
  4164. element.appendChild(child);
  4165. var brokenOffsetParent = (child.offsetParent === element);
  4166. element = child = null;
  4167. var heightComponents = ['height', 'paddingTop', 'paddingBottom', 'borderTopWidth', 'borderBottomWidth'],
  4168. widthComponents = ['width', 'paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'];
  4169. var svgCalculateSize = function(el){
  4170. var gCS = window.getComputedStyle(el),
  4171. bounds = {x: 0, y: 0};
  4172. heightComponents.each(function(css){
  4173. bounds.y += parseFloat(gCS[css]);
  4174. });
  4175. widthComponents.each(function(css){
  4176. bounds.x += parseFloat(gCS[css]);
  4177. });
  4178. return bounds;
  4179. };
  4180. var isOffset = function(el){
  4181. return styleString(el, 'position') != 'static' || isBody(el);
  4182. };
  4183. var isOffsetStatic = function(el){
  4184. return isOffset(el) || (/^(?:table|td|th)$/i).test(el.tagName);
  4185. };
  4186. Element.implement({
  4187. scrollTo: function(x, y){
  4188. if (isBody(this)){
  4189. this.getWindow().scrollTo(x, y);
  4190. } else {
  4191. this.scrollLeft = x;
  4192. this.scrollTop = y;
  4193. }
  4194. return this;
  4195. },
  4196. getSize: function(){
  4197. if (isBody(this)) return this.getWindow().getSize();
  4198. //<ltIE9>
  4199. // This if clause is because IE8- cannot calculate getBoundingClientRect of elements with visibility hidden.
  4200. if (!window.getComputedStyle) return {x: this.offsetWidth, y: this.offsetHeight};
  4201. //</ltIE9>
  4202. // This svg section under, calling `svgCalculateSize()`, can be removed when FF fixed the svg size bug.
  4203. // Bug info: https://bugzilla.mozilla.org/show_bug.cgi?id=530985
  4204. if (this.get('tag') == 'svg') return svgCalculateSize(this);
  4205. try {
  4206. var bounds = this.getBoundingClientRect();
  4207. return {x: bounds.width, y: bounds.height};
  4208. } catch (e){
  4209. return {x: 0, y: 0};
  4210. }
  4211. },
  4212. getScrollSize: function(){
  4213. if (isBody(this)) return this.getWindow().getScrollSize();
  4214. return {x: this.scrollWidth, y: this.scrollHeight};
  4215. },
  4216. getScroll: function(){
  4217. if (isBody(this)) return this.getWindow().getScroll();
  4218. return {x: this.scrollLeft, y: this.scrollTop};
  4219. },
  4220. getScrolls: function(){
  4221. var element = this.parentNode, position = {x: 0, y: 0};
  4222. while (element && !isBody(element)){
  4223. position.x += element.scrollLeft;
  4224. position.y += element.scrollTop;
  4225. element = element.parentNode;
  4226. }
  4227. return position;
  4228. },
  4229. getOffsetParent: brokenOffsetParent ? function(){
  4230. var element = this;
  4231. if (isBody(element) || styleString(element, 'position') == 'fixed') return null;
  4232. var isOffsetCheck = (styleString(element, 'position') == 'static') ? isOffsetStatic : isOffset;
  4233. while ((element = element.parentNode)){
  4234. if (isOffsetCheck(element)) return element;
  4235. }
  4236. return null;
  4237. } : function(){
  4238. var element = this;
  4239. if (isBody(element) || styleString(element, 'position') == 'fixed') return null;
  4240. try {
  4241. return element.offsetParent;
  4242. } catch (e){}
  4243. return null;
  4244. },
  4245. getOffsets: function(){
  4246. var hasGetBoundingClientRect = this.getBoundingClientRect;
  4247. //<1.4compat>
  4248. hasGetBoundingClientRect = hasGetBoundingClientRect && !Browser.Platform.ios;
  4249. //</1.4compat>
  4250. if (hasGetBoundingClientRect){
  4251. var bound = this.getBoundingClientRect(),
  4252. html = document.id(this.getDocument().documentElement),
  4253. htmlScroll = html.getScroll(),
  4254. elemScrolls = this.getScrolls(),
  4255. isFixed = (styleString(this, 'position') == 'fixed');
  4256. return {
  4257. x: bound.left.toFloat() + elemScrolls.x + ((isFixed) ? 0 : htmlScroll.x) - html.clientLeft,
  4258. y: bound.top.toFloat() + elemScrolls.y + ((isFixed) ? 0 : htmlScroll.y) - html.clientTop
  4259. };
  4260. }
  4261. var element = this, position = {x: 0, y: 0};
  4262. if (isBody(this)) return position;
  4263. while (element && !isBody(element)){
  4264. position.x += element.offsetLeft;
  4265. position.y += element.offsetTop;
  4266. //<1.4compat>
  4267. if (Browser.firefox){
  4268. if (!borderBox(element)){
  4269. position.x += leftBorder(element);
  4270. position.y += topBorder(element);
  4271. }
  4272. var parent = element.parentNode;
  4273. if (parent && styleString(parent, 'overflow') != 'visible'){
  4274. position.x += leftBorder(parent);
  4275. position.y += topBorder(parent);
  4276. }
  4277. } else if (element != this && Browser.safari){
  4278. position.x += leftBorder(element);
  4279. position.y += topBorder(element);
  4280. }
  4281. //</1.4compat>
  4282. element = element.offsetParent;
  4283. }
  4284. //<1.4compat>
  4285. if (Browser.firefox && !borderBox(this)){
  4286. position.x -= leftBorder(this);
  4287. position.y -= topBorder(this);
  4288. }
  4289. //</1.4compat>
  4290. return position;
  4291. },
  4292. getPosition: function(relative){
  4293. var offset = this.getOffsets(),
  4294. scroll = this.getScrolls();
  4295. var position = {
  4296. x: offset.x - scroll.x,
  4297. y: offset.y - scroll.y
  4298. };
  4299. if (relative && (relative = document.id(relative))){
  4300. var relativePosition = relative.getPosition();
  4301. return {x: position.x - relativePosition.x - leftBorder(relative), y: position.y - relativePosition.y - topBorder(relative)};
  4302. }
  4303. return position;
  4304. },
  4305. getCoordinates: function(element){
  4306. if (isBody(this)) return this.getWindow().getCoordinates();
  4307. var position = this.getPosition(element),
  4308. size = this.getSize();
  4309. var obj = {
  4310. left: position.x,
  4311. top: position.y,
  4312. width: size.x,
  4313. height: size.y
  4314. };
  4315. obj.right = obj.left + obj.width;
  4316. obj.bottom = obj.top + obj.height;
  4317. return obj;
  4318. },
  4319. computePosition: function(obj){
  4320. return {
  4321. left: obj.x - styleNumber(this, 'margin-left'),
  4322. top: obj.y - styleNumber(this, 'margin-top')
  4323. };
  4324. },
  4325. setPosition: function(obj){
  4326. return this.setStyles(this.computePosition(obj));
  4327. }
  4328. });
  4329. [Document, Window].invoke('implement', {
  4330. getSize: function(){
  4331. var doc = getCompatElement(this);
  4332. return {x: doc.clientWidth, y: doc.clientHeight};
  4333. },
  4334. getScroll: function(){
  4335. var win = this.getWindow(), doc = getCompatElement(this);
  4336. return {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop};
  4337. },
  4338. getScrollSize: function(){
  4339. var doc = getCompatElement(this),
  4340. min = this.getSize(),
  4341. body = this.getDocument().body;
  4342. return {x: Math.max(doc.scrollWidth, body.scrollWidth, min.x), y: Math.max(doc.scrollHeight, body.scrollHeight, min.y)};
  4343. },
  4344. getPosition: function(){
  4345. return {x: 0, y: 0};
  4346. },
  4347. getCoordinates: function(){
  4348. var size = this.getSize();
  4349. return {top: 0, left: 0, bottom: size.y, right: size.x, height: size.y, width: size.x};
  4350. }
  4351. });
  4352. // private methods
  4353. var styleString = Element.getComputedStyle;
  4354. function styleNumber(element, style){
  4355. return styleString(element, style).toInt() || 0;
  4356. }
  4357. //<1.4compat>
  4358. function borderBox(element){
  4359. return styleString(element, '-moz-box-sizing') == 'border-box';
  4360. }
  4361. //</1.4compat>
  4362. function topBorder(element){
  4363. return styleNumber(element, 'border-top-width');
  4364. }
  4365. function leftBorder(element){
  4366. return styleNumber(element, 'border-left-width');
  4367. }
  4368. function isBody(element){
  4369. return (/^(?:body|html)$/i).test(element.tagName);
  4370. }
  4371. function getCompatElement(element){
  4372. var doc = element.getDocument();
  4373. return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
  4374. }
  4375. })();
  4376. //aliases
  4377. Element.alias({position: 'setPosition'}); //compatability
  4378. [Window, Document, Element].invoke('implement', {
  4379. getHeight: function(){
  4380. return this.getSize().y;
  4381. },
  4382. getWidth: function(){
  4383. return this.getSize().x;
  4384. },
  4385. getScrollTop: function(){
  4386. return this.getScroll().y;
  4387. },
  4388. getScrollLeft: function(){
  4389. return this.getScroll().x;
  4390. },
  4391. getScrollHeight: function(){
  4392. return this.getScrollSize().y;
  4393. },
  4394. getScrollWidth: function(){
  4395. return this.getScrollSize().x;
  4396. },
  4397. getTop: function(){
  4398. return this.getPosition().y;
  4399. },
  4400. getLeft: function(){
  4401. return this.getPosition().x;
  4402. }
  4403. });
  4404. /*
  4405. ---
  4406. name: Fx
  4407. description: Contains the basic animation logic to be extended by all other Fx Classes.
  4408. license: MIT-style license.
  4409. requires: [Chain, Events, Options, Class.Thenable]
  4410. provides: Fx
  4411. ...
  4412. */
  4413. (function(){
  4414. var Fx = this.Fx = new Class({
  4415. Implements: [Chain, Events, Options, Class.Thenable],
  4416. options: {
  4417. /*
  4418. onStart: nil,
  4419. onCancel: nil,
  4420. onComplete: nil,
  4421. */
  4422. fps: 60,
  4423. unit: false,
  4424. duration: 500,
  4425. frames: null,
  4426. frameSkip: true,
  4427. link: 'ignore'
  4428. },
  4429. initialize: function(options){
  4430. this.subject = this.subject || this;
  4431. this.setOptions(options);
  4432. },
  4433. getTransition: function(){
  4434. return function(p){
  4435. return -(Math.cos(Math.PI * p) - 1) / 2;
  4436. };
  4437. },
  4438. step: function(now){
  4439. if (this.options.frameSkip){
  4440. var diff = (this.time != null) ? (now - this.time) : 0, frames = diff / this.frameInterval;
  4441. this.time = now;
  4442. this.frame += frames;
  4443. } else {
  4444. this.frame++;
  4445. }
  4446. if (this.frame < this.frames){
  4447. var delta = this.transition(this.frame / this.frames);
  4448. this.set(this.compute(this.from, this.to, delta));
  4449. } else {
  4450. this.frame = this.frames;
  4451. this.set(this.compute(this.from, this.to, 1));
  4452. this.stop();
  4453. }
  4454. },
  4455. set: function(now){
  4456. return now;
  4457. },
  4458. compute: function(from, to, delta){
  4459. return Fx.compute(from, to, delta);
  4460. },
  4461. check: function(){
  4462. if (!this.isRunning()) return true;
  4463. switch (this.options.link){
  4464. case 'cancel': this.cancel(); return true;
  4465. case 'chain': this.chain(this.caller.pass(arguments, this)); return false;
  4466. }
  4467. return false;
  4468. },
  4469. start: function(from, to){
  4470. if (!this.check(from, to)) return this;
  4471. this.from = from;
  4472. this.to = to;
  4473. this.frame = (this.options.frameSkip) ? 0 : -1;
  4474. this.time = null;
  4475. this.transition = this.getTransition();
  4476. var frames = this.options.frames, fps = this.options.fps, duration = this.options.duration;
  4477. this.duration = Fx.Durations[duration] || duration.toInt();
  4478. this.frameInterval = 1000 / fps;
  4479. this.frames = frames || Math.round(this.duration / this.frameInterval);
  4480. if (this.getThenableState() !== 'pending'){
  4481. this.resetThenable(this.subject);
  4482. }
  4483. this.fireEvent('start', this.subject);
  4484. pushInstance.call(this, fps);
  4485. return this;
  4486. },
  4487. stop: function(){
  4488. if (this.isRunning()){
  4489. this.time = null;
  4490. pullInstance.call(this, this.options.fps);
  4491. if (this.frames == this.frame){
  4492. this.fireEvent('complete', this.subject);
  4493. if (!this.callChain()) this.fireEvent('chainComplete', this.subject);
  4494. } else {
  4495. this.fireEvent('stop', this.subject);
  4496. }
  4497. this.resolve(this.subject === this ? null : this.subject);
  4498. }
  4499. return this;
  4500. },
  4501. cancel: function(){
  4502. if (this.isRunning()){
  4503. this.time = null;
  4504. pullInstance.call(this, this.options.fps);
  4505. this.frame = this.frames;
  4506. this.fireEvent('cancel', this.subject).clearChain();
  4507. this.reject(this.subject);
  4508. }
  4509. return this;
  4510. },
  4511. pause: function(){
  4512. if (this.isRunning()){
  4513. this.time = null;
  4514. pullInstance.call(this, this.options.fps);
  4515. }
  4516. return this;
  4517. },
  4518. resume: function(){
  4519. if (this.isPaused()) pushInstance.call(this, this.options.fps);
  4520. return this;
  4521. },
  4522. isRunning: function(){
  4523. var list = instances[this.options.fps];
  4524. return list && list.contains(this);
  4525. },
  4526. isPaused: function(){
  4527. return (this.frame < this.frames) && !this.isRunning();
  4528. }
  4529. });
  4530. Fx.compute = function(from, to, delta){
  4531. return (to - from) * delta + from;
  4532. };
  4533. Fx.Durations = {'short': 250, 'normal': 500, 'long': 1000};
  4534. // global timers
  4535. var instances = {}, timers = {};
  4536. var loop = function(){
  4537. var now = Date.now();
  4538. for (var i = this.length; i--;){
  4539. var instance = this[i];
  4540. if (instance) instance.step(now);
  4541. }
  4542. };
  4543. var pushInstance = function(fps){
  4544. var list = instances[fps] || (instances[fps] = []);
  4545. list.push(this);
  4546. if (!timers[fps]) timers[fps] = loop.periodical(Math.round(1000 / fps), list);
  4547. };
  4548. var pullInstance = function(fps){
  4549. var list = instances[fps];
  4550. if (list){
  4551. list.erase(this);
  4552. if (!list.length && timers[fps]){
  4553. delete instances[fps];
  4554. timers[fps] = clearInterval(timers[fps]);
  4555. }
  4556. }
  4557. };
  4558. })();
  4559. /*
  4560. ---
  4561. name: Fx.CSS
  4562. description: Contains the CSS animation logic. Used by Fx.Tween, Fx.Morph, Fx.Elements.
  4563. license: MIT-style license.
  4564. requires: [Fx, Element.Style]
  4565. provides: Fx.CSS
  4566. ...
  4567. */
  4568. Fx.CSS = new Class({
  4569. Extends: Fx,
  4570. //prepares the base from/to object
  4571. prepare: function(element, property, values){
  4572. values = Array.convert(values);
  4573. var from = values[0], to = values[1];
  4574. if (to == null){
  4575. to = from;
  4576. from = element.getStyle(property);
  4577. var unit = this.options.unit;
  4578. // adapted from: https://github.com/ryanmorr/fx/blob/master/fx.js#L299
  4579. if (unit && from && typeof from == 'string' && from.slice(-unit.length) != unit && parseFloat(from) != 0){
  4580. element.setStyle(property, to + unit);
  4581. var value = element.getComputedStyle(property);
  4582. // IE and Opera support pixelLeft or pixelWidth
  4583. if (!(/px$/.test(value))){
  4584. value = element.style[('pixel-' + property).camelCase()];
  4585. if (value == null){
  4586. // adapted from Dean Edwards' http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  4587. var left = element.style.left;
  4588. element.style.left = to + unit;
  4589. value = element.style.pixelLeft;
  4590. element.style.left = left;
  4591. }
  4592. }
  4593. from = (to || 1) / (parseFloat(value) || 1) * (parseFloat(from) || 0);
  4594. element.setStyle(property, from + unit);
  4595. }
  4596. }
  4597. return {from: this.parse(from), to: this.parse(to)};
  4598. },
  4599. //parses a value into an array
  4600. parse: function(value){
  4601. value = Function.convert(value)();
  4602. value = (typeof value == 'string') ? value.split(' ') : Array.convert(value);
  4603. return value.map(function(val){
  4604. val = String(val);
  4605. var found = false;
  4606. Object.each(Fx.CSS.Parsers, function(parser){
  4607. if (found) return;
  4608. var parsed = parser.parse(val);
  4609. if (parsed || parsed === 0) found = {value: parsed, parser: parser};
  4610. });
  4611. found = found || {value: val, parser: Fx.CSS.Parsers.String};
  4612. return found;
  4613. });
  4614. },
  4615. //computes by a from and to prepared objects, using their parsers.
  4616. compute: function(from, to, delta){
  4617. var computed = [];
  4618. (Math.min(from.length, to.length)).times(function(i){
  4619. computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser});
  4620. });
  4621. computed.$family = Function.convert('fx:css:value');
  4622. return computed;
  4623. },
  4624. //serves the value as settable
  4625. serve: function(value, unit){
  4626. if (typeOf(value) != 'fx:css:value') value = this.parse(value);
  4627. var returned = [];
  4628. value.each(function(bit){
  4629. returned = returned.concat(bit.parser.serve(bit.value, unit));
  4630. });
  4631. return returned;
  4632. },
  4633. //renders the change to an element
  4634. render: function(element, property, value, unit){
  4635. element.setStyle(property, this.serve(value, unit));
  4636. },
  4637. //searches inside the page css to find the values for a selector
  4638. search: function(selector){
  4639. if (Fx.CSS.Cache[selector]) return Fx.CSS.Cache[selector];
  4640. var to = {}, selectorTest = new RegExp('^' + selector.escapeRegExp() + '$');
  4641. var searchStyles = function(rules){
  4642. Array.each(rules, function(rule){
  4643. if (rule.media){
  4644. searchStyles(rule.rules || rule.cssRules);
  4645. return;
  4646. }
  4647. if (!rule.style) return;
  4648. var selectorText = (rule.selectorText) ? rule.selectorText.replace(/^\w+/, function(m){
  4649. return m.toLowerCase();
  4650. }) : null;
  4651. if (!selectorText || !selectorTest.test(selectorText)) return;
  4652. Object.each(Element.Styles, function(value, style){
  4653. if (!rule.style[style] || Element.ShortStyles[style]) return;
  4654. value = String(rule.style[style]);
  4655. to[style] = ((/^rgb/).test(value)) ? value.rgbToHex() : value;
  4656. });
  4657. });
  4658. };
  4659. Array.each(document.styleSheets, function(sheet){
  4660. var href = sheet.href;
  4661. if (href && href.indexOf('://') > -1 && href.indexOf(document.domain) == -1) return;
  4662. var rules = sheet.rules || sheet.cssRules;
  4663. searchStyles(rules);
  4664. });
  4665. return Fx.CSS.Cache[selector] = to;
  4666. }
  4667. });
  4668. Fx.CSS.Cache = {};
  4669. Fx.CSS.Parsers = {
  4670. Color: {
  4671. parse: function(value){
  4672. if (value.match(/^#[0-9a-f]{3,6}$/i)) return value.hexToRgb(true);
  4673. return ((value = value.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [value[1], value[2], value[3]] : false;
  4674. },
  4675. compute: function(from, to, delta){
  4676. return from.map(function(value, i){
  4677. return Math.round(Fx.compute(from[i], to[i], delta));
  4678. });
  4679. },
  4680. serve: function(value){
  4681. return value.map(Number);
  4682. }
  4683. },
  4684. Number: {
  4685. parse: parseFloat,
  4686. compute: Fx.compute,
  4687. serve: function(value, unit){
  4688. return (unit) ? value + unit : value;
  4689. }
  4690. },
  4691. String: {
  4692. parse: Function.convert(false),
  4693. compute: function(zero, one){
  4694. return one;
  4695. },
  4696. serve: function(zero){
  4697. return zero;
  4698. }
  4699. }
  4700. };
  4701. //<1.2compat>
  4702. Fx.CSS.Parsers = new Hash(Fx.CSS.Parsers);
  4703. //</1.2compat>
  4704. /*
  4705. ---
  4706. name: Fx.Morph
  4707. 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.
  4708. license: MIT-style license.
  4709. requires: Fx.CSS
  4710. provides: Fx.Morph
  4711. ...
  4712. */
  4713. Fx.Morph = new Class({
  4714. Extends: Fx.CSS,
  4715. initialize: function(element, options){
  4716. this.element = this.subject = document.id(element);
  4717. this.parent(options);
  4718. },
  4719. set: function(now){
  4720. if (typeof now == 'string') now = this.search(now);
  4721. for (var p in now) this.render(this.element, p, now[p], this.options.unit);
  4722. return this;
  4723. },
  4724. compute: function(from, to, delta){
  4725. var now = {};
  4726. for (var p in from) now[p] = this.parent(from[p], to[p], delta);
  4727. return now;
  4728. },
  4729. start: function(properties){
  4730. if (!this.check(properties)) return this;
  4731. if (typeof properties == 'string') properties = this.search(properties);
  4732. var from = {}, to = {};
  4733. for (var p in properties){
  4734. var parsed = this.prepare(this.element, p, properties[p]);
  4735. from[p] = parsed.from;
  4736. to[p] = parsed.to;
  4737. }
  4738. return this.parent(from, to);
  4739. }
  4740. });
  4741. Element.Properties.morph = {
  4742. set: function(options){
  4743. this.get('morph').cancel().setOptions(options);
  4744. return this;
  4745. },
  4746. get: function(){
  4747. var morph = this.retrieve('morph');
  4748. if (!morph){
  4749. morph = new Fx.Morph(this, {link: 'cancel'});
  4750. this.store('morph', morph);
  4751. }
  4752. return morph;
  4753. }
  4754. };
  4755. Element.implement({
  4756. morph: function(props){
  4757. this.get('morph').start(props);
  4758. return this;
  4759. }
  4760. });
  4761. /*
  4762. ---
  4763. name: Fx.Transitions
  4764. description: Contains a set of advanced transitions to be used with any of the Fx Classes.
  4765. license: MIT-style license.
  4766. credits:
  4767. - Easing Equations by Robert Penner, <http://www.robertpenner.com/easing/>, modified and optimized to be used with MooTools.
  4768. requires: Fx
  4769. provides: Fx.Transitions
  4770. ...
  4771. */
  4772. Fx.implement({
  4773. getTransition: function(){
  4774. var trans = this.options.transition || Fx.Transitions.Sine.easeInOut;
  4775. if (typeof trans == 'string'){
  4776. var data = trans.split(':');
  4777. trans = Fx.Transitions;
  4778. trans = trans[data[0]] || trans[data[0].capitalize()];
  4779. if (data[1]) trans = trans['ease' + data[1].capitalize() + (data[2] ? data[2].capitalize() : '')];
  4780. }
  4781. return trans;
  4782. }
  4783. });
  4784. Fx.Transition = function(transition, params){
  4785. params = Array.convert(params);
  4786. var easeIn = function(pos){
  4787. return transition(pos, params);
  4788. };
  4789. return Object.append(easeIn, {
  4790. easeIn: easeIn,
  4791. easeOut: function(pos){
  4792. return 1 - transition(1 - pos, params);
  4793. },
  4794. easeInOut: function(pos){
  4795. return (pos <= 0.5 ? transition(2 * pos, params) : (2 - transition(2 * (1 - pos), params))) / 2;
  4796. }
  4797. });
  4798. };
  4799. Fx.Transitions = {
  4800. linear: function(zero){
  4801. return zero;
  4802. }
  4803. };
  4804. //<1.2compat>
  4805. Fx.Transitions = new Hash(Fx.Transitions);
  4806. //</1.2compat>
  4807. Fx.Transitions.extend = function(transitions){
  4808. for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]);
  4809. };
  4810. Fx.Transitions.extend({
  4811. Pow: function(p, x){
  4812. return Math.pow(p, x && x[0] || 6);
  4813. },
  4814. Expo: function(p){
  4815. return Math.pow(2, 8 * (p - 1));
  4816. },
  4817. Circ: function(p){
  4818. return 1 - Math.sin(Math.acos(p));
  4819. },
  4820. Sine: function(p){
  4821. return 1 - Math.cos(p * Math.PI / 2);
  4822. },
  4823. Back: function(p, x){
  4824. x = x && x[0] || 1.618;
  4825. return Math.pow(p, 2) * ((x + 1) * p - x);
  4826. },
  4827. Bounce: function(p){
  4828. var value;
  4829. for (var a = 0, b = 1; 1; a += b, b /= 2){
  4830. if (p >= (7 - 4 * a) / 11){
  4831. value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2);
  4832. break;
  4833. }
  4834. }
  4835. return value;
  4836. },
  4837. Elastic: function(p, x){
  4838. return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x && x[0] || 1) / 3);
  4839. }
  4840. });
  4841. ['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){
  4842. Fx.Transitions[transition] = new Fx.Transition(function(p){
  4843. return Math.pow(p, i + 2);
  4844. });
  4845. });
  4846. /*
  4847. ---
  4848. name: Fx.Tween
  4849. description: Formerly Fx.Style, effect to transition any CSS property for an element.
  4850. license: MIT-style license.
  4851. requires: Fx.CSS
  4852. provides: [Fx.Tween, Element.fade, Element.highlight]
  4853. ...
  4854. */
  4855. Fx.Tween = new Class({
  4856. Extends: Fx.CSS,
  4857. initialize: function(element, options){
  4858. this.element = this.subject = document.id(element);
  4859. this.parent(options);
  4860. },
  4861. set: function(property, now){
  4862. if (arguments.length == 1){
  4863. now = property;
  4864. property = this.property || this.options.property;
  4865. }
  4866. this.render(this.element, property, now, this.options.unit);
  4867. return this;
  4868. },
  4869. start: function(property, from, to){
  4870. if (!this.check(property, from, to)) return this;
  4871. var args = Array.flatten(arguments);
  4872. this.property = this.options.property || args.shift();
  4873. var parsed = this.prepare(this.element, this.property, args);
  4874. return this.parent(parsed.from, parsed.to);
  4875. }
  4876. });
  4877. Element.Properties.tween = {
  4878. set: function(options){
  4879. this.get('tween').cancel().setOptions(options);
  4880. return this;
  4881. },
  4882. get: function(){
  4883. var tween = this.retrieve('tween');
  4884. if (!tween){
  4885. tween = new Fx.Tween(this, {link: 'cancel'});
  4886. this.store('tween', tween);
  4887. }
  4888. return tween;
  4889. }
  4890. };
  4891. Element.implement({
  4892. tween: function(property, from, to){
  4893. this.get('tween').start(property, from, to);
  4894. return this;
  4895. },
  4896. fade: function(){
  4897. var fade = this.get('tween'), method, args = ['opacity'].append(arguments), toggle;
  4898. if (args[1] == null) args[1] = 'toggle';
  4899. switch (args[1]){
  4900. case 'in': method = 'start'; args[1] = 1; break;
  4901. case 'out': method = 'start'; args[1] = 0; break;
  4902. case 'show': method = 'set'; args[1] = 1; break;
  4903. case 'hide': method = 'set'; args[1] = 0; break;
  4904. case 'toggle':
  4905. var flag = this.retrieve('fade:flag', this.getStyle('opacity') == 1);
  4906. method = 'start';
  4907. args[1] = flag ? 0 : 1;
  4908. this.store('fade:flag', !flag);
  4909. toggle = true;
  4910. break;
  4911. default: method = 'start';
  4912. }
  4913. if (!toggle) this.eliminate('fade:flag');
  4914. fade[method].apply(fade, args);
  4915. var to = args[args.length - 1];
  4916. if (method == 'set'){
  4917. this.setStyle('visibility', to == 0 ? 'hidden' : 'visible');
  4918. } else if (to != 0){
  4919. if (fade.$chain.length){
  4920. fade.chain(function(){
  4921. this.element.setStyle('visibility', 'visible');
  4922. this.callChain();
  4923. });
  4924. } else {
  4925. this.setStyle('visibility', 'visible');
  4926. }
  4927. } else {
  4928. fade.chain(function(){
  4929. if (this.element.getStyle('opacity')) return;
  4930. this.element.setStyle('visibility', 'hidden');
  4931. this.callChain();
  4932. });
  4933. }
  4934. return this;
  4935. },
  4936. highlight: function(start, end){
  4937. if (!end){
  4938. end = this.retrieve('highlight:original', this.getStyle('background-color'));
  4939. end = (end == 'transparent') ? '#fff' : end;
  4940. }
  4941. var tween = this.get('tween');
  4942. tween.start('background-color', start || '#ffff88', end).chain(function(){
  4943. this.setStyle('background-color', this.retrieve('highlight:original'));
  4944. tween.callChain();
  4945. }.bind(this));
  4946. return this;
  4947. }
  4948. });
  4949. /*
  4950. ---
  4951. name: Request
  4952. description: Powerful all purpose Request Class. Uses XMLHTTPRequest.
  4953. license: MIT-style license.
  4954. requires: [Object, Element, Chain, Events, Options, Class.Thenable, Browser]
  4955. provides: Request
  4956. ...
  4957. */
  4958. (function(){
  4959. var empty = function(){},
  4960. progressSupport = ('onprogress' in new Browser.Request);
  4961. var Request = this.Request = new Class({
  4962. Implements: [Chain, Events, Options, Class.Thenable],
  4963. options: {/*
  4964. onRequest: function(){},
  4965. onLoadstart: function(event, xhr){},
  4966. onProgress: function(event, xhr){},
  4967. onComplete: function(){},
  4968. onCancel: function(){},
  4969. onSuccess: function(responseText, responseXML){},
  4970. onFailure: function(xhr){},
  4971. onException: function(headerName, value){},
  4972. onTimeout: function(){},
  4973. user: '',
  4974. password: '',
  4975. withCredentials: false,*/
  4976. url: '',
  4977. data: '',
  4978. headers: {
  4979. //'X-Requested-With': 'XMLHttpRequest',
  4980. 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
  4981. },
  4982. async: true,
  4983. format: false,
  4984. method: 'post',
  4985. link: 'ignore',
  4986. isSuccess: null,
  4987. emulation: true,
  4988. urlEncoded: true,
  4989. encoding: 'utf-8',
  4990. evalScripts: false,
  4991. evalResponse: false,
  4992. timeout: 0,
  4993. noCache: false
  4994. },
  4995. initialize: function(options){
  4996. this.xhr = new Browser.Request();
  4997. this.setOptions(options);
  4998. this.headers = this.options.headers;
  4999. },
  5000. onStateChange: function(){
  5001. var xhr = this.xhr;
  5002. if (xhr.readyState != 4 || !this.running) return;
  5003. this.running = false;
  5004. this.status = 0;
  5005. Function.attempt(function(){
  5006. var status = xhr.status;
  5007. this.status = (status == 1223) ? 204 : status;
  5008. }.bind(this));
  5009. xhr.onreadystatechange = empty;
  5010. if (progressSupport) xhr.onprogress = xhr.onloadstart = empty;
  5011. if (this.timer){
  5012. clearTimeout(this.timer);
  5013. delete this.timer;
  5014. }
  5015. this.response = {text: this.xhr.responseText || '', xml: this.xhr.responseXML};
  5016. if (this.options.isSuccess.call(this, this.status))
  5017. this.success(this.response.text, this.response.xml);
  5018. else
  5019. this.failure();
  5020. },
  5021. isSuccess: function(){
  5022. var status = this.status;
  5023. return (status >= 200 && status < 300);
  5024. },
  5025. isRunning: function(){
  5026. return !!this.running;
  5027. },
  5028. processScripts: function(text){
  5029. if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return Browser.exec(text);
  5030. return text.stripScripts(this.options.evalScripts);
  5031. },
  5032. success: function(text, xml){
  5033. this.onSuccess(this.processScripts(text), xml);
  5034. this.resolve({text: text, xml: xml});
  5035. },
  5036. onSuccess: function(){
  5037. this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain();
  5038. },
  5039. failure: function(){
  5040. this.onFailure();
  5041. this.reject({reason: 'failure', xhr: this.xhr});
  5042. },
  5043. onFailure: function(){
  5044. this.fireEvent('complete').fireEvent('failure', this.xhr);
  5045. },
  5046. loadstart: function(event){
  5047. this.fireEvent('loadstart', [event, this.xhr]);
  5048. },
  5049. progress: function(event){
  5050. this.fireEvent('progress', [event, this.xhr]);
  5051. },
  5052. timeout: function(){
  5053. this.fireEvent('timeout', this.xhr);
  5054. this.reject({reason: 'timeout', xhr: this.xhr});
  5055. },
  5056. setHeader: function(name, value){
  5057. this.headers[name] = value;
  5058. return this;
  5059. },
  5060. getHeader: function(name){
  5061. return Function.attempt(function(){
  5062. return this.xhr.getResponseHeader(name);
  5063. }.bind(this));
  5064. },
  5065. check: function(){
  5066. if (!this.running) return true;
  5067. switch (this.options.link){
  5068. case 'cancel': this.cancel(); return true;
  5069. case 'chain': this.chain(this.caller.pass(arguments, this)); return false;
  5070. }
  5071. return false;
  5072. },
  5073. send: function(options){
  5074. if (!this.check(options)) return this;
  5075. this.options.isSuccess = this.options.isSuccess || this.isSuccess;
  5076. this.running = true;
  5077. var type = typeOf(options);
  5078. if (type == 'string' || type == 'element') options = {data: options};
  5079. var old = this.options;
  5080. options = Object.append({data: old.data, url: old.url, method: old.method}, options);
  5081. var data = options.data, url = String(options.url), method = options.method.toLowerCase();
  5082. switch (typeOf(data)){
  5083. case 'element': data = document.id(data).toQueryString(); break;
  5084. case 'object': case 'hash': data = Object.toQueryString(data);
  5085. }
  5086. if (this.options.format){
  5087. var format = 'format=' + this.options.format;
  5088. data = (data) ? format + '&' + data : format;
  5089. }
  5090. if (this.options.emulation && !['get', 'post'].contains(method)){
  5091. var _method = '_method=' + method;
  5092. data = (data) ? _method + '&' + data : _method;
  5093. method = 'post';
  5094. }
  5095. if (this.options.urlEncoded && ['post', 'put'].contains(method)){
  5096. var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : '';
  5097. //this.headers['Content-type'] = 'application/x-www-form-urlencoded' + encoding; //mootools1.6.0
  5098. if (!this.headers['Content-Type']) this.headers['Content-type'] = 'application/x-www-form-urlencoded' + encoding; //modify by tommy
  5099. }
  5100. if (!url) url = document.location.pathname;
  5101. var trimPosition = url.lastIndexOf('/');
  5102. if (trimPosition > -1 && (trimPosition = url.indexOf('#')) > -1) url = url.substr(0, trimPosition);
  5103. if (this.options.noCache)
  5104. url += (url.indexOf('?') > -1 ? '&' : '?') + String.uniqueID();
  5105. if (data && (method == 'get' || method == 'delete')){
  5106. url += (url.indexOf('?') > -1 ? '&' : '?') + data;
  5107. data = null;
  5108. }
  5109. var xhr = this.xhr;
  5110. if (progressSupport){
  5111. xhr.onloadstart = this.loadstart.bind(this);
  5112. xhr.onprogress = this.progress.bind(this);
  5113. }
  5114. //modify by Tommy--
  5115. var isWithCredentials = ((this.options.withCredentials && 'withCredentials' in xhr) || (this.options.user && 'withCredentials' in xhr) && (method.toUpperCase()=="POST" || method.toUpperCase()=="PUT"));
  5116. var isWithCredentialsSync = isWithCredentials && !this.options.async;
  5117. //-----------------
  5118. xhr.open(method.toUpperCase(), url, this.options.async, this.options.user, this.options.password);
  5119. if ((/*<1.4compat>*/this.options.user || /*</1.4compat>*/this.options.withCredentials) && 'withCredentials' in xhr) xhr.withCredentials = true;
  5120. //modify by Tommy--
  5121. // if (Browser.name=="firefox"){
  5122. // if (this.options.async){
  5123. // if (isWithCredentials) xhr.withCredentials = true;
  5124. // }else{
  5125. // xhr.setRequestHeader(o2.tokenName, Cookie.read(o2.tokenName));
  5126. // }
  5127. // }else{
  5128. if (isWithCredentials) xhr.withCredentials = true;
  5129. // }
  5130. //-----------------
  5131. xhr.onreadystatechange = this.onStateChange.bind(this);
  5132. Object.each(this.headers, function(value, key){
  5133. try {
  5134. xhr.setRequestHeader(key, value);
  5135. } catch (e){
  5136. this.fireEvent('exception', [key, value]);
  5137. this.reject({reason: 'exception', xhr: xhr, exception: e});
  5138. }
  5139. }, this);
  5140. if (this.getThenableState() !== 'pending'){
  5141. this.resetThenable({reason: 'send'});
  5142. }
  5143. if (url.indexOf("v=4.0")!=-1){
  5144. debugger;
  5145. }
  5146. this.fireEvent('request');
  5147. xhr.send(data);
  5148. if (!this.options.async) this.onStateChange();
  5149. else if (this.options.timeout) this.timer = this.timeout.delay(this.options.timeout, this);
  5150. return this;
  5151. },
  5152. cancel: function(){
  5153. if (!this.running) return this;
  5154. this.running = false;
  5155. var xhr = this.xhr;
  5156. xhr.abort();
  5157. if (this.timer){
  5158. clearTimeout(this.timer);
  5159. delete this.timer;
  5160. }
  5161. xhr.onreadystatechange = empty;
  5162. if (progressSupport) xhr.onprogress = xhr.onloadstart = empty;
  5163. this.xhr = new Browser.Request();
  5164. this.fireEvent('cancel');
  5165. this.reject({reason: 'cancel', xhr: xhr});
  5166. return this;
  5167. }
  5168. });
  5169. var methods = {};
  5170. ['get', 'post', 'put', 'delete', 'patch', 'head', 'GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'].each(function(method){
  5171. methods[method] = function(data){
  5172. var object = {
  5173. method: method
  5174. };
  5175. if (data != null) object.data = data;
  5176. return this.send(object);
  5177. };
  5178. });
  5179. Request.implement(methods);
  5180. Element.Properties.send = {
  5181. set: function(options){
  5182. var send = this.get('send').cancel();
  5183. send.setOptions(options);
  5184. return this;
  5185. },
  5186. get: function(){
  5187. var send = this.retrieve('send');
  5188. if (!send){
  5189. send = new Request({
  5190. data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action')
  5191. });
  5192. this.store('send', send);
  5193. }
  5194. return send;
  5195. }
  5196. };
  5197. Element.implement({
  5198. send: function(url){
  5199. var sender = this.get('send');
  5200. sender.send({data: this, url: url || sender.options.url});
  5201. return this;
  5202. }
  5203. });
  5204. })();
  5205. /*
  5206. ---
  5207. name: Request.HTML
  5208. description: Extends the basic Request Class with additional methods for interacting with HTML responses.
  5209. license: MIT-style license.
  5210. requires: [Element, Request]
  5211. provides: Request.HTML
  5212. ...
  5213. */
  5214. Request.HTML = new Class({
  5215. Extends: Request,
  5216. options: {
  5217. update: false,
  5218. append: false,
  5219. evalScripts: true,
  5220. filter: false,
  5221. headers: {
  5222. Accept: 'text/html, application/xml, text/xml, */*'
  5223. }
  5224. },
  5225. success: function(text){
  5226. var options = this.options, response = this.response;
  5227. response.html = text.stripScripts(function(script){
  5228. response.javascript = script;
  5229. });
  5230. var match = response.html.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
  5231. if (match) response.html = match[1];
  5232. var temp = new Element('div').set('html', response.html);
  5233. response.tree = temp.childNodes;
  5234. response.elements = temp.getElements(options.filter || '*');
  5235. if (options.filter) response.tree = response.elements;
  5236. if (options.update){
  5237. var update = document.id(options.update).empty();
  5238. if (options.filter) update.adopt(response.elements);
  5239. else update.set('html', response.html);
  5240. } else if (options.append){
  5241. var append = document.id(options.append);
  5242. if (options.filter) response.elements.reverse().inject(append);
  5243. else append.adopt(temp.getChildren());
  5244. }
  5245. if (options.evalScripts) Browser.exec(response.javascript);
  5246. this.onSuccess(response.tree, response.elements, response.html, response.javascript);
  5247. this.resolve({tree: response.tree, elements: response.elements, html: response.html, javascript: response.javascript});
  5248. }
  5249. });
  5250. Element.Properties.load = {
  5251. set: function(options){
  5252. var load = this.get('load').cancel();
  5253. load.setOptions(options);
  5254. return this;
  5255. },
  5256. get: function(){
  5257. var load = this.retrieve('load');
  5258. if (!load){
  5259. load = new Request.HTML({data: this, link: 'cancel', update: this, method: 'get'});
  5260. this.store('load', load);
  5261. }
  5262. return load;
  5263. }
  5264. };
  5265. Element.implement({
  5266. load: function(){
  5267. this.get('load').send(Array.link(arguments, {data: Type.isObject, url: Type.isString}));
  5268. return this;
  5269. }
  5270. });
  5271. /*
  5272. ---
  5273. name: JSON
  5274. description: JSON encoder and decoder.
  5275. license: MIT-style license.
  5276. SeeAlso: <http://www.json.org/>
  5277. requires: [Array, String, Number, Function]
  5278. provides: JSON
  5279. ...
  5280. */
  5281. if (typeof JSON == 'undefined') this.JSON = {};
  5282. //<1.2compat>
  5283. JSON = new Hash({
  5284. stringify: JSON.stringify,
  5285. parse: JSON.parse
  5286. });
  5287. //</1.2compat>
  5288. (function(){
  5289. var special = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'};
  5290. var escape = function(chr){
  5291. return special[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16)).slice(-4);
  5292. };
  5293. JSON.validate = function(string){
  5294. string = string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
  5295. replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
  5296. replace(/(?:^|:|,)(?:\s*\[)+/g, '');
  5297. return (/^[\],:{}\s]*$/).test(string);
  5298. };
  5299. JSON.encode = JSON.stringify ? function(obj){
  5300. return JSON.stringify(obj);
  5301. } : function(obj){
  5302. if (obj && obj.toJSON) obj = obj.toJSON();
  5303. switch (typeOf(obj)){
  5304. case 'string':
  5305. return '"' + obj.replace(/[\x00-\x1f\\"]/g, escape) + '"';
  5306. case 'array':
  5307. return '[' + obj.map(JSON.encode).clean() + ']';
  5308. case 'object': case 'hash':
  5309. var string = [];
  5310. Object.each(obj, function(value, key){
  5311. var json = JSON.encode(value);
  5312. if (json) string.push(JSON.encode(key) + ':' + json);
  5313. });
  5314. return '{' + string + '}';
  5315. case 'number': case 'boolean': return '' + obj;
  5316. case 'null': return 'null';
  5317. }
  5318. return null;
  5319. };
  5320. JSON.secure = true;
  5321. //<1.4compat>
  5322. JSON.secure = false;
  5323. //</1.4compat>
  5324. JSON.decode = function(string, secure){
  5325. if (!string || typeOf(string) != 'string') return null;
  5326. if (secure == null) secure = JSON.secure;
  5327. if (secure){
  5328. if (JSON.parse) return JSON.parse(string);
  5329. if (!JSON.validate(string)) throw new Error('JSON could not decode the input; security is enabled and the value is not secure.');
  5330. }
  5331. return eval('(' + string + ')');
  5332. };
  5333. })();
  5334. /*
  5335. ---
  5336. name: Request.JSON
  5337. description: Extends the basic Request Class with additional methods for sending and receiving JSON data.
  5338. license: MIT-style license.
  5339. requires: [Request, JSON]
  5340. provides: Request.JSON
  5341. ...
  5342. */
  5343. Request.JSON = new Class({
  5344. Extends: Request,
  5345. options: {
  5346. /*onError: function(text, error){},*/
  5347. secure: true
  5348. },
  5349. initialize: function(options){
  5350. this.parent(options);
  5351. Object.append(this.headers, {
  5352. 'Accept': 'application/json',
  5353. // 'X-Request': 'JSON'
  5354. });
  5355. },
  5356. success: function(text){
  5357. var json;
  5358. try {
  5359. json = this.response.json = JSON.decode(text, this.options.secure);
  5360. } catch (error){
  5361. this.fireEvent('error', [text, error]);
  5362. return;
  5363. }
  5364. if (json == null){
  5365. this.failure();
  5366. } else {
  5367. this.onSuccess(json, text);
  5368. this.resolve({json: json, text: text});
  5369. }
  5370. }
  5371. });
  5372. /*
  5373. ---
  5374. name: Cookie
  5375. description: Class for creating, reading, and deleting browser Cookies.
  5376. license: MIT-style license.
  5377. credits:
  5378. - Based on the functions by Peter-Paul Koch (http://quirksmode.org).
  5379. requires: [Options, Browser]
  5380. provides: Cookie
  5381. ...
  5382. */
  5383. var Cookie = new Class({
  5384. Implements: Options,
  5385. options: {
  5386. path: '/',
  5387. domain: false,
  5388. duration: false,
  5389. secure: false,
  5390. document: document,
  5391. encode: true,
  5392. httpOnly: false
  5393. },
  5394. initialize: function(key, options){
  5395. this.key = key;
  5396. this.setOptions(options);
  5397. },
  5398. write: function(value){
  5399. if (this.options.encode) value = encodeURIComponent(value);
  5400. if (this.options.domain) value += '; domain=' + this.options.domain;
  5401. if (this.options.path) value += '; path=' + this.options.path;
  5402. if (this.options.duration){
  5403. var date = new Date();
  5404. date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000);
  5405. value += '; expires=' + date.toGMTString();
  5406. }
  5407. if (this.options.secure) value += '; secure';
  5408. if (this.options.httpOnly) value += '; HttpOnly';
  5409. this.options.document.cookie = this.key + '=' + value;
  5410. return this;
  5411. },
  5412. read: function(){
  5413. var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)');
  5414. return (value) ? decodeURIComponent(value[1]) : null;
  5415. },
  5416. dispose: function(){
  5417. new Cookie(this.key, Object.merge({}, this.options, {duration: -1})).write('');
  5418. return this;
  5419. }
  5420. });
  5421. Cookie.write = function(key, value, options){
  5422. return new Cookie(key, options).write(value);
  5423. };
  5424. Cookie.read = function(key){
  5425. return new Cookie(key).read();
  5426. };
  5427. Cookie.dispose = function(key, options){
  5428. return new Cookie(key, options).dispose();
  5429. };
  5430. /*
  5431. ---
  5432. name: DOMReady
  5433. description: Contains the custom event domready.
  5434. license: MIT-style license.
  5435. requires: [Browser, Element, Element.Event]
  5436. provides: [DOMReady, DomReady]
  5437. ...
  5438. */
  5439. (function(window, document){
  5440. var ready,
  5441. loaded,
  5442. checks = [],
  5443. shouldPoll,
  5444. timer,
  5445. testElement = document.createElement('div');
  5446. var domready = function(){
  5447. clearTimeout(timer);
  5448. if (!ready){
  5449. Browser.loaded = ready = true;
  5450. document.removeListener('DOMContentLoaded', domready).removeListener('readystatechange', check);
  5451. document.fireEvent('domready');
  5452. window.fireEvent('domready');
  5453. }
  5454. // cleanup scope vars
  5455. document = window = testElement = null;
  5456. };
  5457. var check = function(){
  5458. for (var i = checks.length; i--;) if (checks[i]()){
  5459. domready();
  5460. return true;
  5461. }
  5462. return false;
  5463. };
  5464. var poll = function(){
  5465. clearTimeout(timer);
  5466. if (!check()) timer = setTimeout(poll, 10);
  5467. };
  5468. document.addListener('DOMContentLoaded', domready);
  5469. /*<ltIE8>*/
  5470. // doScroll technique by Diego Perini http://javascript.nwbox.com/IEContentLoaded/
  5471. // testElement.doScroll() throws when the DOM is not ready, only in the top window
  5472. var doScrollWorks = function(){
  5473. try {
  5474. testElement.doScroll();
  5475. return true;
  5476. } catch (e){}
  5477. return false;
  5478. };
  5479. // If doScroll works already, it can't be used to determine domready
  5480. // e.g. in an iframe
  5481. if (testElement.doScroll && !doScrollWorks()){
  5482. checks.push(doScrollWorks);
  5483. shouldPoll = true;
  5484. }
  5485. /*</ltIE8>*/
  5486. if (document.readyState) checks.push(function(){
  5487. var state = document.readyState;
  5488. return (state == 'loaded' || state == 'complete');
  5489. });
  5490. if ('onreadystatechange' in document) document.addListener('readystatechange', check);
  5491. else shouldPoll = true;
  5492. if (shouldPoll) poll();
  5493. Element.Events.domready = {
  5494. onAdd: function(fn){
  5495. if (ready) fn.call(this);
  5496. }
  5497. };
  5498. // Make sure that domready fires before load
  5499. Element.Events.load = {
  5500. base: 'load',
  5501. onAdd: function(fn){
  5502. if (loaded && this == window) fn.call(this);
  5503. },
  5504. condition: function(){
  5505. if (this == window){
  5506. domready();
  5507. delete Element.Events.load;
  5508. }
  5509. return true;
  5510. }
  5511. };
  5512. // This is based on the custom load event
  5513. if (window) window.addEvent('load', function(){
  5514. loaded = true;
  5515. });
  5516. })(window, document);
  5517. /*
  5518. ---
  5519. script: More.js
  5520. name: More
  5521. description: MooTools More
  5522. license: MIT-style license
  5523. authors:
  5524. - Guillermo Rauch
  5525. - Thomas Aylott
  5526. - Scott Kyle
  5527. - Arian Stolwijk
  5528. - Tim Wienk
  5529. - Christoph Pojer
  5530. - Aaron Newton
  5531. - Jacob Thornton
  5532. requires:
  5533. - Core/MooTools
  5534. provides: [MooTools.More]
  5535. ...
  5536. */
  5537. MooTools.More = {
  5538. version: '1.6.0',
  5539. build: '45b71db70f879781a7e0b0d3fb3bb1307c2521eb'
  5540. };
  5541. /*
  5542. ---
  5543. script: Chain.Wait.js
  5544. name: Chain.Wait
  5545. description: value, Adds a method to inject pauses between chained events.
  5546. license: MIT-style license.
  5547. authors:
  5548. - Aaron Newton
  5549. requires:
  5550. - Core/Chain
  5551. - Core/Element
  5552. - Core/Fx
  5553. - MooTools.More
  5554. provides: [Chain.Wait]
  5555. ...
  5556. */
  5557. (function(){
  5558. var wait = {
  5559. wait: function(duration){
  5560. return this.chain(function(){
  5561. this.callChain.delay(duration == null ? 500 : duration, this);
  5562. return this;
  5563. }.bind(this));
  5564. }
  5565. };
  5566. Chain.implement(wait);
  5567. if (this.Fx) Fx.implement(wait);
  5568. if (this.Element && Element.implement && this.Fx){
  5569. Element.implement({
  5570. chains: function(effects){
  5571. Array.convert(effects || ['tween', 'morph', 'reveal']).each(function(effect){
  5572. effect = this.get(effect);
  5573. if (!effect) return;
  5574. effect.setOptions({
  5575. link:'chain'
  5576. });
  5577. }, this);
  5578. return this;
  5579. },
  5580. pauseFx: function(duration, effect){
  5581. this.chains(effect).get(effect || 'tween').wait(duration);
  5582. return this;
  5583. }
  5584. });
  5585. }
  5586. })();
  5587. /*
  5588. ---
  5589. script: Class.Binds.js
  5590. name: Class.Binds
  5591. description: Automagically binds specified methods in a class to the instance of the class.
  5592. license: MIT-style license
  5593. authors:
  5594. - Aaron Newton
  5595. requires:
  5596. - Core/Class
  5597. - MooTools.More
  5598. provides: [Class.Binds]
  5599. ...
  5600. */
  5601. Class.Mutators.Binds = function(binds){
  5602. if (!this.prototype.initialize) this.implement('initialize', function(){});
  5603. return Array.convert(binds).concat(this.prototype.Binds || []);
  5604. };
  5605. Class.Mutators.initialize = function(initialize){
  5606. return function(){
  5607. Array.convert(this.Binds).each(function(name){
  5608. var original = this[name];
  5609. if (original) this[name] = original.bind(this);
  5610. }, this);
  5611. return initialize.apply(this, arguments);
  5612. };
  5613. };
  5614. /*
  5615. ---
  5616. script: Class.Occlude.js
  5617. name: Class.Occlude
  5618. description: Prevents a class from being applied to a DOM element twice.
  5619. license: MIT-style license.
  5620. authors:
  5621. - Aaron Newton
  5622. requires:
  5623. - Core/Class
  5624. - Core/Element
  5625. - MooTools.More
  5626. provides: [Class.Occlude]
  5627. ...
  5628. */
  5629. Class.Occlude = new Class({
  5630. occlude: function(property, element){
  5631. element = document.id(element || this.element);
  5632. var instance = element.retrieve(property || this.property);
  5633. if (instance && !this.occluded)
  5634. return (this.occluded = instance);
  5635. this.occluded = false;
  5636. element.store(property || this.property, this);
  5637. return this.occluded;
  5638. }
  5639. });
  5640. /*
  5641. ---
  5642. script: Class.Refactor.js
  5643. name: Class.Refactor
  5644. description: Extends a class onto itself with new property, preserving any items attached to the class's namespace.
  5645. license: MIT-style license
  5646. authors:
  5647. - Aaron Newton
  5648. requires:
  5649. - Core/Class
  5650. - MooTools.More
  5651. # Some modules declare themselves dependent on Class.Refactor
  5652. provides: [Class.refactor, Class.Refactor]
  5653. ...
  5654. */
  5655. Class.refactor = function(original, refactors){
  5656. Object.each(refactors, function(item, name){
  5657. var origin = original.prototype[name];
  5658. origin = (origin && origin.$origin) || origin || function(){};
  5659. original.implement(name, (typeof item == 'function') ? function(){
  5660. var old = this.previous;
  5661. this.previous = origin;
  5662. var value = item.apply(this, arguments);
  5663. this.previous = old;
  5664. return value;
  5665. } : item);
  5666. });
  5667. return original;
  5668. };
  5669. /*
  5670. ---
  5671. script: Class.Singleton.js
  5672. name: Class.Singleton
  5673. description: Always provides a single instance of a class
  5674. license: MIT-style license.
  5675. authors:
  5676. - Hristo Chakarov
  5677. requires:
  5678. - Core/Class
  5679. provides: [Class.Singleton]
  5680. ...
  5681. */
  5682. Class.Singleton = new Class({
  5683. initialize : function(descriptor){
  5684. // here we keep reference of the single instance
  5685. var singleton;
  5686. // create a regular Class
  5687. var constructor = new Class(descriptor);
  5688. // We return another constructor, because we need to make sure that we
  5689. // always return the same one and only instance.
  5690. return function(){
  5691. if (singleton){
  5692. return singleton;
  5693. }
  5694. // Obviously we instantiate that class for the first time.
  5695. // Create brand new object & extend it with the prototype of the
  5696. // original `constructor`.
  5697. singleton = Object.append({}, constructor.prototype);
  5698. singleton.constructor = constructor;
  5699. // We also need to call the constructor as a function, passing the
  5700. // arguments object.
  5701. var returnValue = constructor.apply(singleton, arguments);
  5702. // In case the `constructor` returns something other than `this` -
  5703. // return that value; otherwise return the `singleton`.
  5704. singleton = typeof returnValue == 'object' ? returnValue : singleton;
  5705. return singleton;
  5706. };
  5707. }
  5708. });
  5709. /*
  5710. ---
  5711. name: Events.Pseudos
  5712. description: Adds the functionality to add pseudo events
  5713. license: MIT-style license
  5714. authors:
  5715. - Arian Stolwijk
  5716. requires: [Core/Class.Extras, Core/Slick.Parser, MooTools.More]
  5717. provides: [Events.Pseudos]
  5718. ...
  5719. */
  5720. (function(){
  5721. Events.Pseudos = function(pseudos, addEvent, removeEvent){
  5722. var storeKey = '_monitorEvents:';
  5723. var storageOf = function(object){
  5724. return {
  5725. store: object.store ? function(key, value){
  5726. object.store(storeKey + key, value);
  5727. } : function(key, value){
  5728. (object._monitorEvents || (object._monitorEvents = {}))[key] = value;
  5729. },
  5730. retrieve: object.retrieve ? function(key, dflt){
  5731. return object.retrieve(storeKey + key, dflt);
  5732. } : function(key, dflt){
  5733. if (!object._monitorEvents) return dflt;
  5734. return object._monitorEvents[key] || dflt;
  5735. }
  5736. };
  5737. };
  5738. var splitType = function(type){
  5739. if (type.indexOf(':') == -1 || !pseudos) return null;
  5740. var parsed = Slick.parse(type).expressions[0][0],
  5741. parsedPseudos = parsed.pseudos,
  5742. l = parsedPseudos.length,
  5743. splits = [];
  5744. while (l--){
  5745. var pseudo = parsedPseudos[l].key,
  5746. listener = pseudos[pseudo];
  5747. if (listener != null) splits.push({
  5748. event: parsed.tag,
  5749. value: parsedPseudos[l].value,
  5750. pseudo: pseudo,
  5751. original: type,
  5752. listener: listener
  5753. });
  5754. }
  5755. return splits.length ? splits : null;
  5756. };
  5757. return {
  5758. addEvent: function(type, fn, internal){
  5759. var split = splitType(type);
  5760. if (!split) return addEvent.call(this, type, fn, internal);
  5761. var storage = storageOf(this),
  5762. events = storage.retrieve(type, []),
  5763. eventType = split[0].event,
  5764. args = Array.slice(arguments, 2),
  5765. stack = fn,
  5766. self = this;
  5767. split.each(function(item){
  5768. var listener = item.listener,
  5769. stackFn = stack;
  5770. if (listener == false) eventType += ':' + item.pseudo + '(' + item.value + ')';
  5771. else stack = function(){
  5772. listener.call(self, item, stackFn, arguments, stack);
  5773. };
  5774. });
  5775. events.include({type: eventType, event: fn, monitor: stack});
  5776. storage.store(type, events);
  5777. if (type != eventType) addEvent.apply(this, [type, fn].concat(args));
  5778. return addEvent.apply(this, [eventType, stack].concat(args));
  5779. },
  5780. removeEvent: function(type, fn){
  5781. var split = splitType(type);
  5782. if (!split) return removeEvent.call(this, type, fn);
  5783. var storage = storageOf(this),
  5784. events = storage.retrieve(type);
  5785. if (!events) return this;
  5786. var args = Array.slice(arguments, 2);
  5787. removeEvent.apply(this, [type, fn].concat(args));
  5788. events.each(function(monitor, i){
  5789. if (!fn || monitor.event == fn) removeEvent.apply(this, [monitor.type, monitor.monitor].concat(args));
  5790. delete events[i];
  5791. }, this);
  5792. storage.store(type, events);
  5793. return this;
  5794. }
  5795. };
  5796. };
  5797. var pseudos = {
  5798. once: function(split, fn, args, monitor){
  5799. fn.apply(this, args);
  5800. this.removeEvent(split.event, monitor)
  5801. .removeEvent(split.original, fn);
  5802. },
  5803. throttle: function(split, fn, args){
  5804. if (!fn._throttled){
  5805. fn.apply(this, args);
  5806. fn._throttled = setTimeout(function(){
  5807. fn._throttled = false;
  5808. }, split.value || 250);
  5809. }
  5810. },
  5811. pause: function(split, fn, args){
  5812. clearTimeout(fn._pause);
  5813. fn._pause = fn.delay(split.value || 250, this, args);
  5814. }
  5815. };
  5816. Events.definePseudo = function(key, listener){
  5817. pseudos[key] = listener;
  5818. return this;
  5819. };
  5820. Events.lookupPseudo = function(key){
  5821. return pseudos[key];
  5822. };
  5823. var proto = Events.prototype;
  5824. Events.implement(Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
  5825. ['Request', 'Fx'].each(function(klass){
  5826. if (this[klass]) this[klass].implement(Events.prototype);
  5827. });
  5828. })();
  5829. /*
  5830. ---
  5831. script: Drag.js
  5832. name: Drag
  5833. description: The base Drag Class. Can be used to drag and resize Elements using mouse events.
  5834. license: MIT-style license
  5835. authors:
  5836. - Valerio Proietti
  5837. - Tom Occhinno
  5838. - Jan Kassens
  5839. requires:
  5840. - Core/Events
  5841. - Core/Options
  5842. - Core/Element.Event
  5843. - Core/Element.Style
  5844. - Core/Element.Dimensions
  5845. - MooTools.More
  5846. provides: [Drag]
  5847. ...
  5848. */
  5849. (function(){
  5850. var Drag = this.Drag = new Class({
  5851. Implements: [Events, Options],
  5852. options: {/*
  5853. onBeforeStart: function(thisElement){},
  5854. onStart: function(thisElement, event){},
  5855. onSnap: function(thisElement){},
  5856. onDrag: function(thisElement, event){},
  5857. onCancel: function(thisElement){},
  5858. onComplete: function(thisElement, event){},*/
  5859. snap: 6,
  5860. unit: 'px',
  5861. grid: false,
  5862. style: true,
  5863. limit: false,
  5864. handle: false,
  5865. invert: false,
  5866. unDraggableTags: ['button', 'input', 'a', 'textarea', 'select', 'option'],
  5867. preventDefault: false,
  5868. stopPropagation: false,
  5869. compensateScroll: false,
  5870. modifiers: {x: 'left', y: 'top'}
  5871. },
  5872. initialize: function(){
  5873. var params = Array.link(arguments, {
  5874. 'options': Type.isObject,
  5875. 'element': function(obj){
  5876. return obj != null;
  5877. }
  5878. });
  5879. this.element = document.id(params.element);
  5880. this.document = this.element.getDocument();
  5881. this.setOptions(params.options || {});
  5882. var htype = typeOf(this.options.handle);
  5883. this.handles = ((htype == 'array' || htype == 'collection') ? $$(this.options.handle) : document.id(this.options.handle)) || this.element;
  5884. this.mouse = {'now': {}, 'pos': {}};
  5885. this.value = {'start': {}, 'now': {}};
  5886. this.offsetParent = (function(el){
  5887. var offsetParent = el.getOffsetParent();
  5888. var isBody = !offsetParent || (/^(?:body|html)$/i).test(offsetParent.tagName);
  5889. return isBody ? window : document.id(offsetParent);
  5890. })(this.element);
  5891. this.selection = 'selectstart' in document ? 'selectstart' : 'mousedown';
  5892. this.compensateScroll = {start: {}, diff: {}, last: {}};
  5893. if ('ondragstart' in document && !('FileReader' in window) && !Drag.ondragstartFixed){
  5894. document.ondragstart = Function.convert(false);
  5895. Drag.ondragstartFixed = true;
  5896. }
  5897. this.bound = {
  5898. start: this.start.bind(this),
  5899. check: this.check.bind(this),
  5900. drag: this.drag.bind(this),
  5901. stop: this.stop.bind(this),
  5902. cancel: this.cancel.bind(this),
  5903. eventStop: Function.convert(false),
  5904. scrollListener: this.scrollListener.bind(this)
  5905. };
  5906. this.attach();
  5907. },
  5908. attach: function(){
  5909. this.handles.addEvent('mousedown', this.bound.start);
  5910. this.handles.addEvent('touchstart', this.bound.start);
  5911. if (this.options.compensateScroll) this.offsetParent.addEvent('scroll', this.bound.scrollListener);
  5912. return this;
  5913. },
  5914. detach: function(){
  5915. this.handles.removeEvent('mousedown', this.bound.start);
  5916. this.handles.removeEvent('touchstart', this.bound.start);
  5917. if (this.options.compensateScroll) this.offsetParent.removeEvent('scroll', this.bound.scrollListener);
  5918. return this;
  5919. },
  5920. scrollListener: function(){
  5921. if (!this.mouse.start) return;
  5922. var newScrollValue = this.offsetParent.getScroll();
  5923. if (this.element.getStyle('position') == 'absolute'){
  5924. var scrollDiff = this.sumValues(newScrollValue, this.compensateScroll.last, -1);
  5925. this.mouse.now = this.sumValues(this.mouse.now, scrollDiff, 1);
  5926. } else {
  5927. this.compensateScroll.diff = this.sumValues(newScrollValue, this.compensateScroll.start, -1);
  5928. }
  5929. if (this.offsetParent != window) this.compensateScroll.diff = this.sumValues(this.compensateScroll.start, newScrollValue, -1);
  5930. this.compensateScroll.last = newScrollValue;
  5931. this.render(this.options);
  5932. },
  5933. sumValues: function(alpha, beta, op){
  5934. var sum = {}, options = this.options;
  5935. for (var z in options.modifiers){
  5936. if (!options.modifiers[z]) continue;
  5937. sum[z] = alpha[z] + beta[z] * op;
  5938. }
  5939. return sum;
  5940. },
  5941. start: function(event){
  5942. if (this.options.unDraggableTags.contains(event.target.get('tag'))) return;
  5943. var options = this.options;
  5944. if (event.rightClick) return;
  5945. if (options.preventDefault) event.preventDefault();
  5946. if (options.stopPropagation) event.stopPropagation();
  5947. this.compensateScroll.start = this.compensateScroll.last = this.offsetParent.getScroll();
  5948. this.compensateScroll.diff = {x: 0, y: 0};
  5949. this.mouse.start = event.page;
  5950. this.fireEvent('beforeStart', this.element);
  5951. var limit = options.limit;
  5952. this.limit = {x: [], y: []};
  5953. var z, coordinates, offsetParent = this.offsetParent == window ? null : this.offsetParent;
  5954. for (z in options.modifiers){
  5955. if (!options.modifiers[z]) continue;
  5956. var style = this.element.getStyle(options.modifiers[z]);
  5957. // Some browsers (IE and Opera) don't always return pixels.
  5958. if (style && !style.match(/px$/)){
  5959. if (!coordinates) coordinates = this.element.getCoordinates(offsetParent);
  5960. style = coordinates[options.modifiers[z]];
  5961. }
  5962. if (options.style) this.value.now[z] = (style || 0).toInt();
  5963. else this.value.now[z] = this.element[options.modifiers[z]];
  5964. if (options.invert) this.value.now[z] *= -1;
  5965. this.mouse.pos[z] = event.page[z] - this.value.now[z];
  5966. if (limit && limit[z]){
  5967. var i = 2;
  5968. while (i--){
  5969. var limitZI = limit[z][i];
  5970. if (limitZI || limitZI === 0) this.limit[z][i] = (typeof limitZI == 'function') ? limitZI() : limitZI;
  5971. }
  5972. }
  5973. }
  5974. if (typeOf(this.options.grid) == 'number') this.options.grid = {
  5975. x: this.options.grid,
  5976. y: this.options.grid
  5977. };
  5978. var events = {
  5979. mousemove: this.bound.check,
  5980. mouseup: this.bound.cancel,
  5981. touchmove: this.bound.check,
  5982. touchend: this.bound.cancel
  5983. };
  5984. events[this.selection] = this.bound.eventStop;
  5985. this.document.addEvents(events);
  5986. },
  5987. check: function(event){
  5988. if (this.options.preventDefault) event.preventDefault();
  5989. 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)));
  5990. if (distance > this.options.snap){
  5991. this.cancel();
  5992. this.document.addEvents({
  5993. mousemove: this.bound.drag,
  5994. mouseup: this.bound.stop,
  5995. touchmove: this.bound.drag,
  5996. touchend: this.bound.stop
  5997. });
  5998. this.fireEvent('start', [this.element, event]).fireEvent('snap', this.element);
  5999. }
  6000. },
  6001. drag: function(event){
  6002. var options = this.options;
  6003. if (options.preventDefault) event.preventDefault();
  6004. this.mouse.now = this.sumValues(event.page, this.compensateScroll.diff, -1);
  6005. this.render(options);
  6006. this.fireEvent('drag', [this.element, event]);
  6007. },
  6008. render: function(options){
  6009. for (var z in options.modifiers){
  6010. if (!options.modifiers[z]) continue;
  6011. this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z];
  6012. if (options.invert) this.value.now[z] *= -1;
  6013. if (options.limit && this.limit[z]){
  6014. if ((this.limit[z][1] || this.limit[z][1] === 0) && (this.value.now[z] > this.limit[z][1])){
  6015. this.value.now[z] = this.limit[z][1];
  6016. } else if ((this.limit[z][0] || this.limit[z][0] === 0) && (this.value.now[z] < this.limit[z][0])){
  6017. this.value.now[z] = this.limit[z][0];
  6018. }
  6019. }
  6020. if (options.grid[z]) this.value.now[z] -= ((this.value.now[z] - (this.limit[z][0]||0)) % options.grid[z]);
  6021. if (options.style) this.element.setStyle(options.modifiers[z], this.value.now[z] + options.unit);
  6022. else this.element[options.modifiers[z]] = this.value.now[z];
  6023. }
  6024. },
  6025. cancel: function(event){
  6026. this.document.removeEvents({
  6027. mousemove: this.bound.check,
  6028. mouseup: this.bound.cancel,
  6029. touchmove: this.bound.check,
  6030. touchend: this.bound.cancel
  6031. });
  6032. if (event){
  6033. this.document.removeEvent(this.selection, this.bound.eventStop);
  6034. this.fireEvent('cancel', this.element);
  6035. }
  6036. },
  6037. stop: function(event){
  6038. var events = {
  6039. mousemove: this.bound.drag,
  6040. mouseup: this.bound.stop,
  6041. touchmove: this.bound.drag,
  6042. touchend: this.bound.stop
  6043. };
  6044. events[this.selection] = this.bound.eventStop;
  6045. this.document.removeEvents(events);
  6046. this.mouse.start = null;
  6047. if (event) this.fireEvent('complete', [this.element, event]);
  6048. }
  6049. });
  6050. })();
  6051. Element.implement({
  6052. makeResizable: function(options){
  6053. var drag = new Drag(this, Object.merge({
  6054. modifiers: {
  6055. x: 'width',
  6056. y: 'height'
  6057. }
  6058. }, options));
  6059. this.store('resizer', drag);
  6060. return drag.addEvent('drag', function(){
  6061. this.fireEvent('resize', drag);
  6062. }.bind(this));
  6063. }
  6064. });
  6065. /*
  6066. ---
  6067. script: Drag.Move.js
  6068. name: Drag.Move
  6069. description: A Drag extension that provides support for the constraining of draggables to containers and droppables.
  6070. license: MIT-style license
  6071. authors:
  6072. - Valerio Proietti
  6073. - Tom Occhinno
  6074. - Jan Kassens
  6075. - Aaron Newton
  6076. - Scott Kyle
  6077. requires:
  6078. - Core/Element.Dimensions
  6079. - Drag
  6080. provides: [Drag.Move]
  6081. ...
  6082. */
  6083. Drag.Move = new Class({
  6084. Extends: Drag,
  6085. options: {/*
  6086. onEnter: function(thisElement, overed){},
  6087. onLeave: function(thisElement, overed){},
  6088. onDrop: function(thisElement, overed, event){},*/
  6089. droppables: [],
  6090. container: false,
  6091. precalculate: false,
  6092. includeMargins: true,
  6093. checkDroppables: true
  6094. },
  6095. initialize: function(element, options){
  6096. this.parent(element, options);
  6097. element = this.element;
  6098. this.droppables = $$(this.options.droppables);
  6099. this.setContainer(this.options.container);
  6100. if (this.options.style){
  6101. if (this.options.modifiers.x == 'left' && this.options.modifiers.y == 'top'){
  6102. var parent = element.getOffsetParent(),
  6103. styles = element.getStyles('left', 'top');
  6104. if (parent && (styles.left == 'auto' || styles.top == 'auto')){
  6105. element.setPosition(element.getPosition(parent));
  6106. }
  6107. }
  6108. if (element.getStyle('position') == 'static') element.setStyle('position', 'absolute');
  6109. }
  6110. this.addEvent('start', this.checkDroppables, true);
  6111. this.overed = null;
  6112. },
  6113. setContainer: function(container){
  6114. this.container = document.id(container);
  6115. if (this.container && typeOf(this.container) != 'element'){
  6116. this.container = document.id(this.container.getDocument().body);
  6117. }
  6118. },
  6119. start: function(event){
  6120. if (this.container) this.options.limit = this.calculateLimit();
  6121. if (this.options.precalculate){
  6122. this.positions = this.droppables.map(function(el){
  6123. return el.getCoordinates();
  6124. });
  6125. }
  6126. this.parent(event);
  6127. },
  6128. calculateLimit: function(){
  6129. var element = this.element,
  6130. container = this.container,
  6131. offsetParent = document.id(element.getOffsetParent()) || document.body,
  6132. containerCoordinates = container.getCoordinates(offsetParent),
  6133. elementMargin = {},
  6134. elementBorder = {},
  6135. containerMargin = {},
  6136. containerBorder = {},
  6137. offsetParentPadding = {},
  6138. offsetScroll = offsetParent.getScroll();
  6139. ['top', 'right', 'bottom', 'left'].each(function(pad){
  6140. elementMargin[pad] = element.getStyle('margin-' + pad).toInt();
  6141. elementBorder[pad] = element.getStyle('border-' + pad).toInt();
  6142. containerMargin[pad] = container.getStyle('margin-' + pad).toInt();
  6143. containerBorder[pad] = container.getStyle('border-' + pad).toInt();
  6144. offsetParentPadding[pad] = offsetParent.getStyle('padding-' + pad).toInt();
  6145. }, this);
  6146. var width = element.offsetWidth + elementMargin.left + elementMargin.right,
  6147. height = element.offsetHeight + elementMargin.top + elementMargin.bottom,
  6148. left = 0 + offsetScroll.x,
  6149. top = 0 + offsetScroll.y,
  6150. right = containerCoordinates.right - containerBorder.right - width + offsetScroll.x,
  6151. bottom = containerCoordinates.bottom - containerBorder.bottom - height + offsetScroll.y;
  6152. if (this.options.includeMargins){
  6153. left += elementMargin.left;
  6154. top += elementMargin.top;
  6155. } else {
  6156. right += elementMargin.right;
  6157. bottom += elementMargin.bottom;
  6158. }
  6159. if (element.getStyle('position') == 'relative'){
  6160. var coords = element.getCoordinates(offsetParent);
  6161. coords.left -= element.getStyle('left').toInt();
  6162. coords.top -= element.getStyle('top').toInt();
  6163. left -= coords.left;
  6164. top -= coords.top;
  6165. if (container.getStyle('position') != 'relative'){
  6166. left += containerBorder.left;
  6167. top += containerBorder.top;
  6168. }
  6169. right += elementMargin.left - coords.left;
  6170. bottom += elementMargin.top - coords.top;
  6171. if (container != offsetParent){
  6172. left += containerMargin.left + offsetParentPadding.left;
  6173. if (!offsetParentPadding.left && left < 0) left = 0;
  6174. top += offsetParent == document.body ? 0 : containerMargin.top + offsetParentPadding.top;
  6175. if (!offsetParentPadding.top && top < 0) top = 0;
  6176. }
  6177. } else {
  6178. left -= elementMargin.left;
  6179. top -= elementMargin.top;
  6180. if (container != offsetParent){
  6181. left += containerCoordinates.left + containerBorder.left;
  6182. top += containerCoordinates.top + containerBorder.top;
  6183. }
  6184. }
  6185. return {
  6186. x: [left, right],
  6187. y: [top, bottom]
  6188. };
  6189. },
  6190. getDroppableCoordinates: function(element){
  6191. var position = element.getCoordinates();
  6192. if (element.getStyle('position') == 'fixed'){
  6193. var scroll = window.getScroll();
  6194. position.left += scroll.x;
  6195. position.right += scroll.x;
  6196. position.top += scroll.y;
  6197. position.bottom += scroll.y;
  6198. }
  6199. return position;
  6200. },
  6201. //modify by Tommy
  6202. checkDroppables:function(){
  6203. var overedList = this.droppables.filter(function(el, i){
  6204. el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el);
  6205. var now = this.mouse.now;
  6206. return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
  6207. }, this);
  6208. var overed = overedList.getLast();
  6209. if (overed) for (var x=0;x<overedList.length-1;x++) if(overed.contains(overedList[x])) overed=overedList[x];
  6210. if(this.overed!=overed){
  6211. if(this.overed) this.fireEvent("leave",[this.element,this.overed]);
  6212. if(overed) this.fireEvent("enter",[this.element,overed]);
  6213. this.overed=overed;
  6214. }
  6215. },
  6216. //mootools....
  6217. //checkDroppables: function(){
  6218. // var overed = this.droppables.filter(function(el, i){
  6219. // el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el);
  6220. // var now = this.mouse.now;
  6221. // return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
  6222. // }, this).getLast();
  6223. //
  6224. // if (this.overed != overed){
  6225. // if (this.overed) this.fireEvent('leave', [this.element, this.overed]);
  6226. // if (overed) this.fireEvent('enter', [this.element, overed]);
  6227. // this.overed = overed;
  6228. // }
  6229. //},
  6230. drag: function(event){
  6231. this.parent(event);
  6232. if (this.options.checkDroppables && this.droppables.length) this.checkDroppables();
  6233. },
  6234. stop: function(event){
  6235. this.checkDroppables();
  6236. this.fireEvent('drop', [this.element, this.overed, event]);
  6237. this.overed = null;
  6238. return this.parent(event);
  6239. }
  6240. });
  6241. Element.implement({
  6242. makeDraggable: function(options){
  6243. var drag = new Drag.Move(this, options);
  6244. this.store('dragger', drag);
  6245. return drag;
  6246. }
  6247. });
  6248. /*
  6249. ---
  6250. script: Element.Measure.js
  6251. name: Element.Measure
  6252. description: Extends the Element native object to include methods useful in measuring dimensions.
  6253. credits: "Element.measure / .expose methods by Daniel Steigerwald License: MIT-style license. Copyright: Copyright (c) 2008 Daniel Steigerwald, daniel.steigerwald.cz"
  6254. license: MIT-style license
  6255. authors:
  6256. - Aaron Newton
  6257. requires:
  6258. - Core/Element.Style
  6259. - Core/Element.Dimensions
  6260. - MooTools.More
  6261. provides: [Element.Measure]
  6262. ...
  6263. */
  6264. (function(){
  6265. var getStylesList = function(styles, planes){
  6266. var list = [];
  6267. Object.each(planes, function(directions){
  6268. Object.each(directions, function(edge){
  6269. styles.each(function(style){
  6270. list.push(style + '-' + edge + (style == 'border' ? '-width' : ''));
  6271. });
  6272. });
  6273. });
  6274. return list;
  6275. };
  6276. var calculateEdgeSize = function(edge, styles){
  6277. var total = 0;
  6278. Object.each(styles, function(value, style){
  6279. if (style.test(edge)) total = total + value.toInt();
  6280. });
  6281. return total;
  6282. };
  6283. var isVisible = function(el){
  6284. return !!(!el || el.offsetHeight || el.offsetWidth);
  6285. };
  6286. Element.implement({
  6287. measure: function(fn){
  6288. if (isVisible(this)) return fn.call(this);
  6289. var parent = this.getParent(),
  6290. toMeasure = [];
  6291. while (!isVisible(parent) && parent != document.body){
  6292. toMeasure.push(parent.expose());
  6293. parent = parent.getParent();
  6294. }
  6295. var restore = this.expose(),
  6296. result = fn.call(this);
  6297. restore();
  6298. toMeasure.each(function(restore){
  6299. restore();
  6300. });
  6301. return result;
  6302. },
  6303. expose: function(){
  6304. if (this.getStyle('display') != 'none') return function(){};
  6305. var before = this.style.cssText;
  6306. this.setStyles({
  6307. display: 'block',
  6308. position: 'absolute',
  6309. visibility: 'hidden'
  6310. });
  6311. return function(){
  6312. this.style.cssText = before;
  6313. }.bind(this);
  6314. },
  6315. getDimensions: function(options){
  6316. options = Object.merge({computeSize: false}, options);
  6317. var dim = {x: 0, y: 0};
  6318. var getSize = function(el, options){
  6319. return (options.computeSize) ? el.getComputedSize(options) : el.getSize();
  6320. };
  6321. var parent = this.getParent('body');
  6322. if (parent && this.getStyle('display') == 'none'){
  6323. dim = this.measure(function(){
  6324. return getSize(this, options);
  6325. });
  6326. } else if (parent){
  6327. try { //safari sometimes crashes here, so catch it
  6328. dim = getSize(this, options);
  6329. } catch (e){}
  6330. }
  6331. return Object.append(dim, (dim.x || dim.x === 0) ? {
  6332. width: dim.x,
  6333. height: dim.y
  6334. } : {
  6335. x: dim.width,
  6336. y: dim.height
  6337. });
  6338. },
  6339. getComputedSize: function(options){
  6340. //<1.2compat>
  6341. //legacy support for my stupid spelling error
  6342. if (options && options.plains) options.planes = options.plains;
  6343. //</1.2compat>
  6344. options = Object.merge({
  6345. styles: ['padding','border'],
  6346. planes: {
  6347. height: ['top','bottom'],
  6348. width: ['left','right']
  6349. },
  6350. mode: 'both'
  6351. }, options);
  6352. var styles = {},
  6353. size = {width: 0, height: 0},
  6354. dimensions;
  6355. if (options.mode == 'vertical'){
  6356. delete size.width;
  6357. delete options.planes.width;
  6358. } else if (options.mode == 'horizontal'){
  6359. delete size.height;
  6360. delete options.planes.height;
  6361. }
  6362. getStylesList(options.styles, options.planes).each(function(style){
  6363. styles[style] = this.getStyle(style).toInt();
  6364. }, this);
  6365. Object.each(options.planes, function(edges, plane){
  6366. var capitalized = plane.capitalize(),
  6367. style = this.getStyle(plane);
  6368. if (style == 'auto' && !dimensions) dimensions = this.getDimensions();
  6369. style = styles[plane] = (style == 'auto') ? dimensions[plane] : style.toInt();
  6370. size['total' + capitalized] = style;
  6371. edges.each(function(edge){
  6372. var edgesize = calculateEdgeSize(edge, styles);
  6373. size['computed' + edge.capitalize()] = edgesize;
  6374. size['total' + capitalized] += edgesize;
  6375. });
  6376. }, this);
  6377. return Object.append(size, styles);
  6378. }
  6379. });
  6380. })();
  6381. /*
  6382. ---
  6383. script: Slider.js
  6384. name: Slider
  6385. description: Class for creating horizontal and vertical slider controls.
  6386. license: MIT-style license
  6387. authors:
  6388. - Valerio Proietti
  6389. requires:
  6390. - Core/Element.Dimensions
  6391. - Core/Number
  6392. - Class.Binds
  6393. - Drag
  6394. - Element.Measure
  6395. provides: [Slider]
  6396. ...
  6397. */
  6398. (function(){
  6399. var Slider = this.Slider = new Class({
  6400. Implements: [Events, Options],
  6401. Binds: ['clickedElement', 'draggedKnob', 'scrolledElement'],
  6402. options: {/*
  6403. onTick: function(intPosition){},
  6404. onMove: function(){},
  6405. onChange: function(intStep){},
  6406. onComplete: function(strStep){},*/
  6407. onTick: function(position){
  6408. this.setKnobPosition(position);
  6409. },
  6410. initialStep: 0,
  6411. snap: false,
  6412. offset: 0,
  6413. range: false,
  6414. wheel: false,
  6415. steps: 100,
  6416. mode: 'horizontal'
  6417. },
  6418. initialize: function(element, knob, options){
  6419. this.setOptions(options);
  6420. options = this.options;
  6421. this.element = document.id(element);
  6422. knob = this.knob = document.id(knob);
  6423. this.previousChange = this.previousEnd = this.step = options.initialStep ? options.initialStep : options.range ? options.range[0] : 0;
  6424. var limit = {},
  6425. modifiers = {x: false, y: false};
  6426. switch (options.mode){
  6427. case 'vertical':
  6428. this.axis = 'y';
  6429. this.property = 'top';
  6430. this.offset = 'offsetHeight';
  6431. break;
  6432. case 'horizontal':
  6433. this.axis = 'x';
  6434. this.property = 'left';
  6435. this.offset = 'offsetWidth';
  6436. }
  6437. this.setSliderDimensions();
  6438. this.setRange(options.range, null, true);
  6439. if (knob.getStyle('position') == 'static') knob.setStyle('position', 'relative');
  6440. knob.setStyle(this.property, -options.offset);
  6441. modifiers[this.axis] = this.property;
  6442. limit[this.axis] = [-options.offset, this.full - options.offset];
  6443. var dragOptions = {
  6444. snap: 0,
  6445. limit: limit,
  6446. modifiers: modifiers,
  6447. onDrag: this.draggedKnob,
  6448. onStart: this.draggedKnob,
  6449. onBeforeStart: (function(){
  6450. this.isDragging = true;
  6451. }).bind(this),
  6452. onCancel: function(){
  6453. this.isDragging = false;
  6454. }.bind(this),
  6455. onComplete: function(){
  6456. this.isDragging = false;
  6457. this.draggedKnob();
  6458. this.end();
  6459. }.bind(this)
  6460. };
  6461. if (options.snap) this.setSnap(dragOptions);
  6462. this.drag = new Drag(knob, dragOptions);
  6463. if (options.initialStep != null) this.set(options.initialStep, true);
  6464. this.attach();
  6465. },
  6466. attach: function(){
  6467. this.element.addEvent('mousedown', this.clickedElement);
  6468. if (this.options.wheel) this.element.addEvent('mousewheel', this.scrolledElement);
  6469. this.drag.attach();
  6470. return this;
  6471. },
  6472. detach: function(){
  6473. this.element.removeEvent('mousedown', this.clickedElement)
  6474. .removeEvent('mousewheel', this.scrolledElement);
  6475. this.drag.detach();
  6476. return this;
  6477. },
  6478. autosize: function(){
  6479. this.setSliderDimensions()
  6480. .setKnobPosition(this.toPosition(this.step));
  6481. this.drag.options.limit[this.axis] = [-this.options.offset, this.full - this.options.offset];
  6482. if (this.options.snap) this.setSnap();
  6483. return this;
  6484. },
  6485. setSnap: function(options){
  6486. if (!options) options = this.drag.options;
  6487. options.grid = Math.ceil(this.stepWidth);
  6488. options.limit[this.axis][1] = this.element[this.offset];
  6489. return this;
  6490. },
  6491. setKnobPosition: function(position){
  6492. if (this.options.snap) position = this.toPosition(this.step);
  6493. this.knob.setStyle(this.property, position);
  6494. return this;
  6495. },
  6496. setSliderDimensions: function(){
  6497. this.full = this.element.measure(function(){
  6498. this.half = this.knob[this.offset] / 2;
  6499. return this.element[this.offset] - this.knob[this.offset] + (this.options.offset * 2);
  6500. }.bind(this));
  6501. return this;
  6502. },
  6503. set: function(step, silently){
  6504. if (!((this.range > 0) ^ (step < this.min))) step = this.min;
  6505. if (!((this.range > 0) ^ (step > this.max))) step = this.max;
  6506. this.step = (step).round(this.modulus.decimalLength);
  6507. if (silently) this.checkStep().setKnobPosition(this.toPosition(this.step));
  6508. else this.checkStep().fireEvent('tick', this.toPosition(this.step)).fireEvent('move').end();
  6509. return this;
  6510. },
  6511. setRange: function(range, pos, silently){
  6512. this.min = Array.pick([range[0], 0]);
  6513. this.max = Array.pick([range[1], this.options.steps]);
  6514. this.range = this.max - this.min;
  6515. this.steps = this.options.steps || this.full;
  6516. var stepSize = this.stepSize = Math.abs(this.range) / this.steps;
  6517. this.stepWidth = this.stepSize * this.full / Math.abs(this.range);
  6518. this.setModulus();
  6519. if (range) this.set(Array.pick([pos, this.step]).limit(this.min,this.max), silently);
  6520. return this;
  6521. },
  6522. setModulus: function(){
  6523. var decimals = ((this.stepSize + '').split('.')[1] || []).length,
  6524. modulus = 1 + '';
  6525. while (decimals--) modulus += '0';
  6526. this.modulus = {multiplier: (modulus).toInt(10), decimalLength: modulus.length - 1};
  6527. },
  6528. clickedElement: function(event){
  6529. if (this.isDragging || event.target == this.knob) return;
  6530. var dir = this.range < 0 ? -1 : 1,
  6531. position = event.page[this.axis] - this.element.getPosition()[this.axis] - this.half;
  6532. position = position.limit(-this.options.offset, this.full - this.options.offset);
  6533. this.step = (this.min + dir * this.toStep(position)).round(this.modulus.decimalLength);
  6534. this.checkStep()
  6535. .fireEvent('tick', position)
  6536. .fireEvent('move')
  6537. .end();
  6538. },
  6539. scrolledElement: function(event){
  6540. var mode = (this.options.mode == 'horizontal') ? (event.wheel < 0) : (event.wheel > 0);
  6541. this.set(this.step + (mode ? -1 : 1) * this.stepSize);
  6542. event.stop();
  6543. },
  6544. draggedKnob: function(){
  6545. var dir = this.range < 0 ? -1 : 1,
  6546. position = this.drag.value.now[this.axis];
  6547. position = position.limit(-this.options.offset, this.full -this.options.offset);
  6548. this.step = (this.min + dir * this.toStep(position)).round(this.modulus.decimalLength);
  6549. this.checkStep();
  6550. this.fireEvent('move');
  6551. },
  6552. checkStep: function(){
  6553. var step = this.step;
  6554. if (this.previousChange != step){
  6555. this.previousChange = step;
  6556. this.fireEvent('change', step);
  6557. }
  6558. return this;
  6559. },
  6560. end: function(){
  6561. var step = this.step;
  6562. if (this.previousEnd !== step){
  6563. this.previousEnd = step;
  6564. this.fireEvent('complete', step + '');
  6565. }
  6566. return this;
  6567. },
  6568. toStep: function(position){
  6569. var step = (position + this.options.offset) * this.stepSize / this.full * this.steps;
  6570. return this.options.steps ? (step - (step * this.modulus.multiplier) % (this.stepSize * this.modulus.multiplier) / this.modulus.multiplier).round(this.modulus.decimalLength) : step;
  6571. },
  6572. toPosition: function(step){
  6573. return (this.full * Math.abs(this.min - step)) / (this.steps * this.stepSize) - this.options.offset || 0;
  6574. }
  6575. });
  6576. })();
  6577. /*
  6578. ---
  6579. script: Sortables.js
  6580. name: Sortables
  6581. description: Class for creating a drag and drop sorting interface for lists of items.
  6582. license: MIT-style license
  6583. authors:
  6584. - Tom Occhino
  6585. requires:
  6586. - Core/Fx.Morph
  6587. - Drag.Move
  6588. provides: [Sortables]
  6589. ...
  6590. */
  6591. (function(){
  6592. var Sortables = this.Sortables = new Class({
  6593. Implements: [Events, Options],
  6594. options: {/*
  6595. onSort: function(element, clone){},
  6596. onStart: function(element, clone){},
  6597. onComplete: function(element){},*/
  6598. opacity: 1,
  6599. clone: false,
  6600. revert: false,
  6601. handle: false,
  6602. dragOptions: {},
  6603. unDraggableTags: ['button', 'input', 'a', 'textarea', 'select', 'option']/*<1.2compat>*/,
  6604. snap: 4,
  6605. constrain: false,
  6606. preventDefault: false
  6607. /*</1.2compat>*/
  6608. },
  6609. initialize: function(lists, options){
  6610. this.setOptions(options);
  6611. this.elements = [];
  6612. this.lists = [];
  6613. this.idle = true;
  6614. this.addLists($$(document.id(lists) || lists));
  6615. if (!this.options.clone) this.options.revert = false;
  6616. if (this.options.revert) this.effect = new Fx.Morph(null, Object.merge({
  6617. duration: 250,
  6618. link: 'cancel'
  6619. }, this.options.revert));
  6620. },
  6621. attach: function(){
  6622. this.addLists(this.lists);
  6623. return this;
  6624. },
  6625. detach: function(){
  6626. this.lists = this.removeLists(this.lists);
  6627. return this;
  6628. },
  6629. addItems: function(){
  6630. Array.flatten(arguments).each(function(element){
  6631. this.elements.push(element);
  6632. var start = element.retrieve('sortables:start', function(event){
  6633. this.start.call(this, event, element);
  6634. }.bind(this));
  6635. (this.options.handle ? element.getElement(this.options.handle) || element : element).addEvent('mousedown', start);
  6636. }, this);
  6637. return this;
  6638. },
  6639. addLists: function(){
  6640. Array.flatten(arguments).each(function(list){
  6641. this.lists.include(list);
  6642. this.addItems(list.getChildren());
  6643. }, this);
  6644. return this;
  6645. },
  6646. removeItems: function(){
  6647. return $$(Array.flatten(arguments).map(function(element){
  6648. this.elements.erase(element);
  6649. var start = element.retrieve('sortables:start');
  6650. (this.options.handle ? element.getElement(this.options.handle) || element : element).removeEvent('mousedown', start);
  6651. return element;
  6652. }, this));
  6653. },
  6654. removeLists: function(){
  6655. return $$(Array.flatten(arguments).map(function(list){
  6656. this.lists.erase(list);
  6657. this.removeItems(list.getChildren());
  6658. return list;
  6659. }, this));
  6660. },
  6661. getDroppableCoordinates: function(element){
  6662. var offsetParent = element.getOffsetParent();
  6663. var position = element.getPosition(offsetParent);
  6664. var scroll = {
  6665. w: window.getScroll(),
  6666. offsetParent: offsetParent.getScroll()
  6667. };
  6668. position.x += scroll.offsetParent.x;
  6669. position.y += scroll.offsetParent.y;
  6670. if (offsetParent.getStyle('position') == 'fixed'){
  6671. position.x -= scroll.w.x;
  6672. position.y -= scroll.w.y;
  6673. }
  6674. return position;
  6675. },
  6676. getClone: function(event, element){
  6677. if (!this.options.clone) return new Element(element.tagName).inject(document.body);
  6678. if (typeOf(this.options.clone) == 'function') return this.options.clone.call(this, event, element, this.list);
  6679. var clone = element.clone(true).setStyles({
  6680. margin: 0,
  6681. position: 'absolute',
  6682. visibility: 'hidden',
  6683. width: element.getStyle('width')
  6684. }).addEvent('mousedown', function(event){
  6685. element.fireEvent('mousedown', event);
  6686. });
  6687. //prevent the duplicated radio inputs from unchecking the real one
  6688. if (clone.get('html').test('radio')){
  6689. clone.getElements('input[type=radio]').each(function(input, i){
  6690. input.set('name', 'clone_' + i);
  6691. if (input.get('checked')) element.getElements('input[type=radio]')[i].set('checked', true);
  6692. });
  6693. }
  6694. return clone.inject(this.list).setPosition(this.getDroppableCoordinates(this.element));
  6695. },
  6696. getDroppables: function(){
  6697. var droppables = this.list.getChildren().erase(this.clone).erase(this.element);
  6698. if (!this.options.constrain) droppables.append(this.lists).erase(this.list);
  6699. return droppables;
  6700. },
  6701. insert: function(dragging, element){
  6702. var where = 'inside';
  6703. if (this.lists.contains(element)){
  6704. this.list = element;
  6705. this.drag.droppables = this.getDroppables();
  6706. } else {
  6707. where = this.element.getAllPrevious().contains(element) ? 'before' : 'after';
  6708. }
  6709. this.element.inject(element, where);
  6710. this.fireEvent('sort', [this.element, this.clone]);
  6711. },
  6712. start: function(event, element){
  6713. if (
  6714. !this.idle ||
  6715. event.rightClick ||
  6716. (!this.options.handle && this.options.unDraggableTags.contains(event.target.get('tag')))
  6717. ) return;
  6718. this.idle = false;
  6719. this.element = element;
  6720. this.opacity = element.getStyle('opacity');
  6721. this.list = element.getParent();
  6722. this.clone = this.getClone(event, element);
  6723. this.drag = new Drag.Move(this.clone, Object.merge({
  6724. /*<1.2compat>*/
  6725. preventDefault: this.options.preventDefault,
  6726. snap: this.options.snap,
  6727. container: this.options.constrain && this.element.getParent(),
  6728. /*</1.2compat>*/
  6729. droppables: this.getDroppables()
  6730. }, this.options.dragOptions)).addEvents({
  6731. onSnap: function(){
  6732. event.stop();
  6733. this.clone.setStyle('visibility', 'visible');
  6734. this.element.setStyle('opacity', this.options.opacity || 0);
  6735. this.fireEvent('start', [this.element, this.clone]);
  6736. }.bind(this),
  6737. onEnter: this.insert.bind(this),
  6738. onCancel: this.end.bind(this),
  6739. onComplete: this.end.bind(this)
  6740. });
  6741. this.clone.inject(this.element, 'before');
  6742. this.drag.start(event);
  6743. },
  6744. end: function(){
  6745. this.drag.detach();
  6746. this.element.setStyle('opacity', this.opacity);
  6747. var self = this;
  6748. if (this.effect){
  6749. var dim = this.element.getStyles('width', 'height'),
  6750. clone = this.clone,
  6751. pos = clone.computePosition(this.getDroppableCoordinates(clone));
  6752. var destroy = function(){
  6753. this.removeEvent('cancel', destroy);
  6754. clone.destroy();
  6755. self.reset();
  6756. };
  6757. this.effect.element = clone;
  6758. this.effect.start({
  6759. top: pos.top,
  6760. left: pos.left,
  6761. width: dim.width,
  6762. height: dim.height,
  6763. opacity: 0.25
  6764. }).addEvent('cancel', destroy).chain(destroy);
  6765. } else {
  6766. this.clone.destroy();
  6767. self.reset();
  6768. }
  6769. },
  6770. reset: function(){
  6771. this.idle = true;
  6772. this.fireEvent('complete', this.element);
  6773. },
  6774. serialize: function(){
  6775. var params = Array.link(arguments, {
  6776. modifier: Type.isFunction,
  6777. index: function(obj){
  6778. return obj != null;
  6779. }
  6780. });
  6781. var serial = this.lists.map(function(list){
  6782. return list.getChildren().map(params.modifier || function(element){
  6783. return element.get('id');
  6784. }, this);
  6785. }, this);
  6786. var index = params.index;
  6787. if (this.lists.length == 1) index = 0;
  6788. return (index || index === 0) && index >= 0 && index < this.lists.length ? serial[index] : serial;
  6789. }
  6790. });
  6791. })();
  6792. /*
  6793. ---
  6794. name: Element.Event.Pseudos
  6795. description: Adds the functionality to add pseudo events for Elements
  6796. license: MIT-style license
  6797. authors:
  6798. - Arian Stolwijk
  6799. requires: [Core/Element.Event, Core/Element.Delegation, Events.Pseudos]
  6800. provides: [Element.Event.Pseudos, Element.Delegation.Pseudo]
  6801. ...
  6802. */
  6803. (function(){
  6804. var pseudos = {relay: false},
  6805. copyFromEvents = ['once', 'throttle', 'pause'],
  6806. count = copyFromEvents.length;
  6807. while (count--) pseudos[copyFromEvents[count]] = Events.lookupPseudo(copyFromEvents[count]);
  6808. DOMEvent.definePseudo = function(key, listener){
  6809. pseudos[key] = listener;
  6810. return this;
  6811. };
  6812. var proto = Element.prototype;
  6813. [Element, Window, Document].invoke('implement', Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
  6814. })();
  6815. /*
  6816. ---
  6817. name: Element.Event.Pseudos.Keys
  6818. description: Adds functionality fire events if certain keycombinations are pressed
  6819. license: MIT-style license
  6820. authors:
  6821. - Arian Stolwijk
  6822. requires: [Element.Event.Pseudos]
  6823. provides: [Element.Event.Pseudos.Keys]
  6824. ...
  6825. */
  6826. (function(){
  6827. var keysStoreKey = '$moo:keys-pressed',
  6828. keysKeyupStoreKey = '$moo:keys-keyup';
  6829. DOMEvent.definePseudo('keys', function(split, fn, args){
  6830. var event = args[0],
  6831. keys = [],
  6832. pressed = this.retrieve(keysStoreKey, []),
  6833. value = split.value;
  6834. if (value != '+') keys.append(value.replace('++', function(){
  6835. keys.push('+'); // shift++ and shift+++a
  6836. return '';
  6837. }).split('+'));
  6838. else keys = ['+'];
  6839. pressed.include(event.key);
  6840. if (keys.every(function(key){
  6841. return pressed.contains(key);
  6842. })) fn.apply(this, args);
  6843. this.store(keysStoreKey, pressed);
  6844. if (!this.retrieve(keysKeyupStoreKey)){
  6845. var keyup = function(event){
  6846. (function(){
  6847. pressed = this.retrieve(keysStoreKey, []).erase(event.key);
  6848. this.store(keysStoreKey, pressed);
  6849. }).delay(0, this); // Fix for IE
  6850. };
  6851. this.store(keysKeyupStoreKey, keyup).addEvent('keyup', keyup);
  6852. }
  6853. });
  6854. DOMEvent.defineKeys({
  6855. '16': 'shift',
  6856. '17': 'control',
  6857. '18': 'alt',
  6858. '20': 'capslock',
  6859. '33': 'pageup',
  6860. '34': 'pagedown',
  6861. '35': 'end',
  6862. '36': 'home',
  6863. '144': 'numlock',
  6864. '145': 'scrolllock',
  6865. '186': ';',
  6866. '187': '=',
  6867. '188': ',',
  6868. '190': '.',
  6869. '191': '/',
  6870. '192': '`',
  6871. '219': '[',
  6872. '220': '\\',
  6873. '221': ']',
  6874. '222': "'",
  6875. '107': '+',
  6876. '109': '-', // subtract
  6877. '189': '-' // dash
  6878. });
  6879. })();
  6880. /*
  6881. ---
  6882. script: String.Extras.js
  6883. name: String.Extras
  6884. description: Extends the String native object to include methods useful in managing various kinds of strings (query strings, urls, html, etc).
  6885. license: MIT-style license
  6886. authors:
  6887. - Aaron Newton
  6888. - Guillermo Rauch
  6889. - Christopher Pitt
  6890. requires:
  6891. - Core/String
  6892. - Core/Array
  6893. - MooTools.More
  6894. provides: [String.Extras]
  6895. ...
  6896. */
  6897. (function(){
  6898. var special = {
  6899. 'a': /[àáâãäåăą]/g,
  6900. 'A': /[ÀÁÂÃÄÅĂĄ]/g,
  6901. 'c': /[ćčç]/g,
  6902. 'C': /[ĆČÇ]/g,
  6903. 'd': /[ďđ]/g,
  6904. 'D': /[ĎÐ]/g,
  6905. 'e': /[èéêëěę]/g,
  6906. 'E': /[ÈÉÊËĚĘ]/g,
  6907. 'g': /[ğ]/g,
  6908. 'G': /[Ğ]/g,
  6909. 'i': /[ìíîï]/g,
  6910. 'I': /[ÌÍÎÏ]/g,
  6911. 'l': /[ĺľł]/g,
  6912. 'L': /[ĹĽŁ]/g,
  6913. 'n': /[ñňń]/g,
  6914. 'N': /[ÑŇŃ]/g,
  6915. 'o': /[òóôõöøő]/g,
  6916. 'O': /[ÒÓÔÕÖØ]/g,
  6917. 'r': /[řŕ]/g,
  6918. 'R': /[ŘŔ]/g,
  6919. 's': /[ššş]/g,
  6920. 'S': /[ŠŞŚ]/g,
  6921. 't': /[ťţ]/g,
  6922. 'T': /[ŤŢ]/g,
  6923. 'u': /[ùúûůüµ]/g,
  6924. 'U': /[ÙÚÛŮÜ]/g,
  6925. 'y': /[ÿý]/g,
  6926. 'Y': /[ŸÝ]/g,
  6927. 'z': /[žźż]/g,
  6928. 'Z': /[ŽŹŻ]/g,
  6929. 'th': /[þ]/g,
  6930. 'TH': /[Þ]/g,
  6931. 'dh': /[ð]/g,
  6932. 'DH': /[Ð]/g,
  6933. 'ss': /[ß]/g,
  6934. 'oe': /[œ]/g,
  6935. 'OE': /[Œ]/g,
  6936. 'ae': /[æ]/g,
  6937. 'AE': /[Æ]/g
  6938. },
  6939. tidy = {
  6940. ' ': /[\xa0\u2002\u2003\u2009]/g,
  6941. '*': /[\xb7]/g,
  6942. '\'': /[\u2018\u2019]/g,
  6943. '"': /[\u201c\u201d]/g,
  6944. '...': /[\u2026]/g,
  6945. '-': /[\u2013]/g,
  6946. // '--': /[\u2014]/g,
  6947. '&raquo;': /[\uFFFD]/g
  6948. },
  6949. conversions = {
  6950. ms: 1,
  6951. s: 1000,
  6952. m: 6e4,
  6953. h: 36e5
  6954. },
  6955. findUnits = /(\d*.?\d+)([msh]+)/;
  6956. var walk = function(string, replacements){
  6957. var result = string, key;
  6958. for (key in replacements) result = result.replace(replacements[key], key);
  6959. return result;
  6960. };
  6961. var getRegexForTag = function(tag, contents){
  6962. tag = tag || (contents ? '' : '\\w+');
  6963. var regstr = contents ? '<' + tag + '(?!\\w)[^>]*>([\\s\\S]*?)<\/' + tag + '(?!\\w)>' : '<\/?' + tag + '\/?>|<' + tag + '[\\s|\/][^>]*>';
  6964. return new RegExp(regstr, 'gi');
  6965. };
  6966. String.implement({
  6967. standardize: function(){
  6968. return walk(this, special);
  6969. },
  6970. repeat: function(times){
  6971. return new Array(times + 1).join(this);
  6972. },
  6973. pad: function(length, str, direction){
  6974. if (this.length >= length) return this;
  6975. var pad = (str == null ? ' ' : '' + str)
  6976. .repeat(length - this.length)
  6977. .substr(0, length - this.length);
  6978. if (!direction || direction == 'right') return this + pad;
  6979. if (direction == 'left') return pad + this;
  6980. return pad.substr(0, (pad.length / 2).floor()) + this + pad.substr(0, (pad.length / 2).ceil());
  6981. },
  6982. getTags: function(tag, contents){
  6983. return this.match(getRegexForTag(tag, contents)) || [];
  6984. },
  6985. stripTags: function(tag, contents){
  6986. return this.replace(getRegexForTag(tag, contents), '');
  6987. },
  6988. tidy: function(){
  6989. return walk(this, tidy);
  6990. },
  6991. truncate: function(max, trail, atChar){
  6992. var string = this;
  6993. if (trail == null && arguments.length == 1) trail = '…';
  6994. if (string.length > max){
  6995. string = string.substring(0, max);
  6996. if (atChar){
  6997. var index = string.lastIndexOf(atChar);
  6998. if (index != -1) string = string.substr(0, index);
  6999. }
  7000. if (trail) string += trail;
  7001. }
  7002. return string;
  7003. },
  7004. ms: function(){
  7005. // "Borrowed" from https://gist.github.com/1503944
  7006. var units = findUnits.exec(this);
  7007. if (units == null) return Number(this);
  7008. return Number(units[1]) * conversions[units[2]];
  7009. }
  7010. });
  7011. })();
  7012. /*
  7013. ---
  7014. script: Element.Forms.js
  7015. name: Element.Forms
  7016. description: Extends the Element native object to include methods useful in managing inputs.
  7017. license: MIT-style license
  7018. authors:
  7019. - Aaron Newton
  7020. requires:
  7021. - Core/Element
  7022. - String.Extras
  7023. - MooTools.More
  7024. provides: [Element.Forms]
  7025. ...
  7026. */
  7027. Element.implement({
  7028. tidy: function(){
  7029. this.set('value', this.get('value').tidy());
  7030. },
  7031. getTextInRange: function(start, end){
  7032. return this.get('value').substring(start, end);
  7033. },
  7034. getSelectedText: function(){
  7035. if (this.setSelectionRange) return this.getTextInRange(this.getSelectionStart(), this.getSelectionEnd());
  7036. return document.selection.createRange().text;
  7037. },
  7038. getSelectedRange: function(){
  7039. if (this.selectionStart != null){
  7040. return {
  7041. start: this.selectionStart,
  7042. end: this.selectionEnd
  7043. };
  7044. }
  7045. var pos = {
  7046. start: 0,
  7047. end: 0
  7048. };
  7049. var range = this.getDocument().selection.createRange();
  7050. if (!range || range.parentElement() != this) return pos;
  7051. var duplicate = range.duplicate();
  7052. if (this.type == 'text'){
  7053. pos.start = 0 - duplicate.moveStart('character', -100000);
  7054. pos.end = pos.start + range.text.length;
  7055. } else {
  7056. var value = this.get('value');
  7057. var offset = value.length;
  7058. duplicate.moveToElementText(this);
  7059. duplicate.setEndPoint('StartToEnd', range);
  7060. if (duplicate.text.length) offset -= value.match(/[\n\r]*$/)[0].length;
  7061. pos.end = offset - duplicate.text.length;
  7062. duplicate.setEndPoint('StartToStart', range);
  7063. pos.start = offset - duplicate.text.length;
  7064. }
  7065. return pos;
  7066. },
  7067. getSelectionStart: function(){
  7068. return this.getSelectedRange().start;
  7069. },
  7070. getSelectionEnd: function(){
  7071. return this.getSelectedRange().end;
  7072. },
  7073. setCaretPosition: function(pos){
  7074. if (pos == 'end') pos = this.get('value').length;
  7075. this.selectRange(pos, pos);
  7076. return this;
  7077. },
  7078. getCaretPosition: function(){
  7079. return this.getSelectedRange().start;
  7080. },
  7081. selectRange: function(start, end){
  7082. if (this.setSelectionRange){
  7083. this.focus();
  7084. this.setSelectionRange(start, end);
  7085. } else {
  7086. var value = this.get('value');
  7087. var diff = value.substr(start, end - start).replace(/\r/g, '').length;
  7088. start = value.substr(0, start).replace(/\r/g, '').length;
  7089. var range = this.createTextRange();
  7090. range.collapse(true);
  7091. range.moveEnd('character', start + diff);
  7092. range.moveStart('character', start);
  7093. range.select();
  7094. }
  7095. return this;
  7096. },
  7097. insertAtCursor: function(value, select){
  7098. var pos = this.getSelectedRange();
  7099. var text = this.get('value');
  7100. this.set('value', text.substring(0, pos.start) + value + text.substring(pos.end, text.length));
  7101. if (select !== false) this.selectRange(pos.start, pos.start + value.length);
  7102. else this.setCaretPosition(pos.start + value.length);
  7103. return this;
  7104. },
  7105. insertAroundCursor: function(options, select){
  7106. options = Object.append({
  7107. before: '',
  7108. defaultMiddle: '',
  7109. after: ''
  7110. }, options);
  7111. var value = this.getSelectedText() || options.defaultMiddle;
  7112. var pos = this.getSelectedRange();
  7113. var text = this.get('value');
  7114. if (pos.start == pos.end){
  7115. this.set('value', text.substring(0, pos.start) + options.before + value + options.after + text.substring(pos.end, text.length));
  7116. this.selectRange(pos.start + options.before.length, pos.end + options.before.length + value.length);
  7117. } else {
  7118. var current = text.substring(pos.start, pos.end);
  7119. this.set('value', text.substring(0, pos.start) + options.before + current + options.after + text.substring(pos.end, text.length));
  7120. var selStart = pos.start + options.before.length;
  7121. if (select !== false) this.selectRange(selStart, selStart + current.length);
  7122. else this.setCaretPosition(selStart + text.length);
  7123. }
  7124. return this;
  7125. }
  7126. });
  7127. /*
  7128. ---
  7129. script: Element.Pin.js
  7130. name: Element.Pin
  7131. description: Extends the Element native object to include the pin method useful for fixed positioning for elements.
  7132. license: MIT-style license
  7133. authors:
  7134. - Aaron Newton
  7135. requires:
  7136. - Core/Element.Event
  7137. - Core/Element.Dimensions
  7138. - Core/Element.Style
  7139. - MooTools.More
  7140. provides: [Element.Pin]
  7141. ...
  7142. */
  7143. (function(){
  7144. var supportsPositionFixed = false,
  7145. supportTested = false;
  7146. var testPositionFixed = function(){
  7147. var test = new Element('div').setStyles({
  7148. position: 'fixed',
  7149. top: 0,
  7150. right: 0
  7151. }).inject(document.body);
  7152. supportsPositionFixed = (test.offsetTop === 0);
  7153. test.dispose();
  7154. supportTested = true;
  7155. };
  7156. Element.implement({
  7157. pin: function(enable, forceScroll){
  7158. if (!supportTested) testPositionFixed();
  7159. if (this.getStyle('display') == 'none') return this;
  7160. var pinnedPosition,
  7161. scroll = window.getScroll(),
  7162. parent,
  7163. scrollFixer;
  7164. if (enable !== false){
  7165. pinnedPosition = this.getPosition();
  7166. if (!this.retrieve('pin:_pinned')){
  7167. var currentPosition = {
  7168. top: pinnedPosition.y - scroll.y,
  7169. left: pinnedPosition.x - scroll.x,
  7170. margin: '0px',
  7171. padding: '0px'
  7172. };
  7173. if (supportsPositionFixed && !forceScroll){
  7174. this.setStyle('position', 'fixed').setStyles(currentPosition);
  7175. } else {
  7176. parent = this.getOffsetParent();
  7177. var position = this.getPosition(parent),
  7178. styles = this.getStyles('left', 'top');
  7179. if (parent && styles.left == 'auto' || styles.top == 'auto') this.setPosition(position);
  7180. if (this.getStyle('position') == 'static') this.setStyle('position', 'absolute');
  7181. position = {
  7182. x: styles.left.toInt() - scroll.x,
  7183. y: styles.top.toInt() - scroll.y
  7184. };
  7185. scrollFixer = function(){
  7186. if (!this.retrieve('pin:_pinned')) return;
  7187. var scroll = window.getScroll();
  7188. this.setStyles({
  7189. left: position.x + scroll.x,
  7190. top: position.y + scroll.y
  7191. });
  7192. }.bind(this);
  7193. this.store('pin:_scrollFixer', scrollFixer);
  7194. window.addEvent('scroll', scrollFixer);
  7195. }
  7196. this.store('pin:_pinned', true);
  7197. }
  7198. } else {
  7199. if (!this.retrieve('pin:_pinned')) return this;
  7200. parent = this.getParent();
  7201. var offsetParent = (parent.getComputedStyle('position') != 'static' ? parent : parent.getOffsetParent());
  7202. pinnedPosition = this.getPosition();
  7203. this.store('pin:_pinned', false);
  7204. scrollFixer = this.retrieve('pin:_scrollFixer');
  7205. if (!scrollFixer){
  7206. this.setStyles({
  7207. position: 'absolute',
  7208. top: pinnedPosition.y + scroll.y,
  7209. left: pinnedPosition.x + scroll.x
  7210. });
  7211. } else {
  7212. this.store('pin:_scrollFixer', null);
  7213. window.removeEvent('scroll', scrollFixer);
  7214. }
  7215. this.removeClass('isPinned');
  7216. }
  7217. return this;
  7218. },
  7219. unpin: function(){
  7220. return this.pin(false);
  7221. },
  7222. togglePin: function(){
  7223. return this.pin(!this.retrieve('pin:_pinned'));
  7224. }
  7225. });
  7226. //<1.2compat>
  7227. Element.alias('togglepin', 'togglePin');
  7228. //</1.2compat>
  7229. })();
  7230. /*
  7231. ---
  7232. script: Element.Position.js
  7233. name: Element.Position
  7234. description: Extends the Element native object to include methods useful positioning elements relative to others.
  7235. license: MIT-style license
  7236. authors:
  7237. - Aaron Newton
  7238. - Jacob Thornton
  7239. requires:
  7240. - Core/Options
  7241. - Core/Element.Dimensions
  7242. - Element.Measure
  7243. provides: [Element.Position]
  7244. ...
  7245. */
  7246. (function(original){
  7247. var local = Element.Position = {
  7248. options: {/*
  7249. edge: false,
  7250. returnPos: false,
  7251. minimum: {x: 0, y: 0},
  7252. maximum: {x: 0, y: 0},
  7253. relFixedPosition: false,
  7254. ignoreMargins: false,
  7255. ignoreScroll: false,
  7256. allowNegative: false,*/
  7257. relativeTo: document.body,
  7258. position: {
  7259. x: 'center', //left, center, right
  7260. y: 'center' //top, center, bottom
  7261. },
  7262. offset: {x: 0, y: 0}
  7263. },
  7264. getOptions: function(element, options){
  7265. options = Object.merge({}, local.options, options);
  7266. local.setPositionOption(options);
  7267. local.setEdgeOption(options);
  7268. local.setOffsetOption(element, options);
  7269. local.setDimensionsOption(element, options);
  7270. return options;
  7271. },
  7272. setPositionOption: function(options){
  7273. options.position = local.getCoordinateFromValue(options.position);
  7274. },
  7275. setEdgeOption: function(options){
  7276. var edgeOption = local.getCoordinateFromValue(options.edge);
  7277. options.edge = edgeOption ? edgeOption :
  7278. (options.position.x == 'center' && options.position.y == 'center') ? {x: 'center', y: 'center'} :
  7279. {x: 'left', y: 'top'};
  7280. },
  7281. setOffsetOption: function(element, options){
  7282. var parentOffset = {x: 0, y: 0};
  7283. var parentScroll = {x: 0, y: 0};
  7284. var offsetParent = element.measure(function(){
  7285. return document.id(this.getOffsetParent());
  7286. });
  7287. if (!offsetParent || offsetParent == element.getDocument().body || offsetParent==document.documentElement) return;
  7288. parentScroll = offsetParent.getScroll();
  7289. parentOffset = offsetParent.measure(function(){
  7290. var position = this.getPosition();
  7291. if (this.getStyle('position') == 'fixed'){
  7292. var scroll = window.getScroll();
  7293. position.x += scroll.x;
  7294. position.y += scroll.y;
  7295. }
  7296. return position;
  7297. });
  7298. options.offset = {
  7299. parentPositioned: offsetParent != document.id(options.relativeTo),
  7300. x: options.offset.x - parentOffset.x + parentScroll.x,
  7301. y: options.offset.y - parentOffset.y + parentScroll.y
  7302. };
  7303. },
  7304. setDimensionsOption: function(element, options){
  7305. options.dimensions = element.getDimensions({
  7306. computeSize: true,
  7307. styles: ['padding', 'border', 'margin']
  7308. });
  7309. },
  7310. getPosition: function(element, options){
  7311. var position = {};
  7312. options = local.getOptions(element, options);
  7313. var relativeTo = document.id(options.relativeTo) || document.body;
  7314. local.setPositionCoordinates(options, position, relativeTo);
  7315. if (options.edge) local.toEdge(position, options);
  7316. var offset = options.offset;
  7317. position.left = ((position.x >= 0 || offset.parentPositioned || options.allowNegative) ? position.x : 0).toInt();
  7318. position.top = ((position.y >= 0 || offset.parentPositioned || options.allowNegative) ? position.y : 0).toInt();
  7319. local.toMinMax(position, options);
  7320. if (options.relFixedPosition || relativeTo.getStyle('position') == 'fixed') local.toRelFixedPosition(relativeTo, position);
  7321. if (options.ignoreScroll) local.toIgnoreScroll(relativeTo, position);
  7322. if (options.ignoreMargins) local.toIgnoreMargins(position, options);
  7323. position.left = Math.ceil(position.left);
  7324. position.top = Math.ceil(position.top);
  7325. delete position.x;
  7326. delete position.y;
  7327. return position;
  7328. },
  7329. setPositionCoordinates: function(options, position, relativeTo){
  7330. var offsetY = options.offset.y,
  7331. offsetX = options.offset.x,
  7332. calc = (relativeTo == document.body) ? window.getScroll() : relativeTo.getPosition(),
  7333. top = calc.y,
  7334. left = calc.x,
  7335. winSize = window.getSize();
  7336. switch (options.position.x){
  7337. case 'left': position.x = left + offsetX; break;
  7338. case 'right': position.x = left + offsetX + relativeTo.offsetWidth; break;
  7339. default: position.x = left + ((relativeTo == document.body ? winSize.x : relativeTo.offsetWidth) / 2) + offsetX; break;
  7340. }
  7341. switch (options.position.y){
  7342. case 'top': position.y = top + offsetY; break;
  7343. case 'bottom': position.y = top + offsetY + relativeTo.offsetHeight; break;
  7344. default: position.y = top + ((relativeTo == document.body ? winSize.y : relativeTo.offsetHeight) / 2) + offsetY; break;
  7345. }
  7346. },
  7347. toMinMax: function(position, options){
  7348. var xy = {left: 'x', top: 'y'}, value;
  7349. ['minimum', 'maximum'].each(function(minmax){
  7350. ['left', 'top'].each(function(lr){
  7351. value = options[minmax] ? options[minmax][xy[lr]] : null;
  7352. if (value != null && ((minmax == 'minimum') ? position[lr] < value : position[lr] > value)) position[lr] = value;
  7353. });
  7354. });
  7355. },
  7356. toRelFixedPosition: function(relativeTo, position){
  7357. var winScroll = window.getScroll();
  7358. position.top += winScroll.y;
  7359. position.left += winScroll.x;
  7360. },
  7361. toIgnoreScroll: function(relativeTo, position){
  7362. var relScroll = relativeTo.getScroll();
  7363. position.top -= relScroll.y;
  7364. position.left -= relScroll.x;
  7365. },
  7366. toIgnoreMargins: function(position, options){
  7367. position.left += options.edge.x == 'right'
  7368. ? options.dimensions['margin-right']
  7369. : (options.edge.x != 'center'
  7370. ? -options.dimensions['margin-left']
  7371. : -options.dimensions['margin-left'] + ((options.dimensions['margin-right'] + options.dimensions['margin-left']) / 2));
  7372. position.top += options.edge.y == 'bottom'
  7373. ? options.dimensions['margin-bottom']
  7374. : (options.edge.y != 'center'
  7375. ? -options.dimensions['margin-top']
  7376. : -options.dimensions['margin-top'] + ((options.dimensions['margin-bottom'] + options.dimensions['margin-top']) / 2));
  7377. },
  7378. toEdge: function(position, options){
  7379. var edgeOffset = {},
  7380. dimensions = options.dimensions,
  7381. edge = options.edge;
  7382. switch (edge.x){
  7383. case 'left': edgeOffset.x = 0; break;
  7384. case 'right': edgeOffset.x = -dimensions.x - dimensions.computedRight - dimensions.computedLeft; break;
  7385. // center
  7386. default: edgeOffset.x = -(Math.round(dimensions.totalWidth / 2)); break;
  7387. }
  7388. switch (edge.y){
  7389. case 'top': edgeOffset.y = 0; break;
  7390. case 'bottom': edgeOffset.y = -dimensions.y - dimensions.computedTop - dimensions.computedBottom; break;
  7391. // center
  7392. default: edgeOffset.y = -(Math.round(dimensions.totalHeight / 2)); break;
  7393. }
  7394. position.x += edgeOffset.x;
  7395. position.y += edgeOffset.y;
  7396. },
  7397. getCoordinateFromValue: function(option){
  7398. if (typeOf(option) != 'string') return option;
  7399. option = option.toLowerCase();
  7400. return {
  7401. x: option.test('left') ? 'left'
  7402. : (option.test('right') ? 'right' : 'center'),
  7403. y: option.test(/upper|top/) ? 'top'
  7404. : (option.test('bottom') ? 'bottom' : 'center')
  7405. };
  7406. }
  7407. };
  7408. Element.implement({
  7409. position: function(options){
  7410. if (options && (options.x != null || options.y != null)){
  7411. return (original ? original.apply(this, arguments) : this);
  7412. }
  7413. var position = this.setStyle('position', 'absolute').calculatePosition(options);
  7414. return (options && options.returnPos) ? position : this.setStyles(position);
  7415. },
  7416. calculatePosition: function(options){
  7417. return local.getPosition(this, options);
  7418. }
  7419. });
  7420. })(Element.prototype.position);
  7421. /*
  7422. ---
  7423. script: Element.Shortcuts.js
  7424. name: Element.Shortcuts
  7425. description: Extends the Element native object to include some shortcut methods.
  7426. license: MIT-style license
  7427. authors:
  7428. - Aaron Newton
  7429. requires:
  7430. - Core/Element.Style
  7431. - MooTools.More
  7432. provides: [Element.Shortcuts]
  7433. ...
  7434. */
  7435. Element.implement({
  7436. isDisplayed: function(){
  7437. return this.getStyle('display') != 'none';
  7438. },
  7439. isVisible: function(){
  7440. var w = this.offsetWidth,
  7441. h = this.offsetHeight;
  7442. return (w == 0 && h == 0) ? false : (w > 0 && h > 0) ? true : this.style.display != 'none';
  7443. },
  7444. toggle: function(){
  7445. return this[this.isDisplayed() ? 'hide' : 'show']();
  7446. },
  7447. hide: function(){
  7448. var d;
  7449. try {
  7450. //IE fails here if the element is not in the dom
  7451. d = this.getStyle('display');
  7452. } catch (e){}
  7453. if (d == 'none') return this;
  7454. return this.store('element:_originalDisplay', d || '').setStyle('display', 'none');
  7455. },
  7456. show: function(display){
  7457. if (!display && this.isDisplayed()) return this;
  7458. display = display || this.retrieve('element:_originalDisplay') || 'block';
  7459. return this.setStyle('display', (display == 'none') ? 'block' : display);
  7460. },
  7461. swapClass: function(remove, add){
  7462. return this.removeClass(remove).addClass(add);
  7463. }
  7464. });
  7465. Document.implement({
  7466. clearSelection: function(){
  7467. if (window.getSelection){
  7468. var selection = window.getSelection();
  7469. if (selection && selection.removeAllRanges) selection.removeAllRanges();
  7470. } else if (document.selection && document.selection.empty){
  7471. try {
  7472. //IE fails here if selected element is not in dom
  7473. document.selection.empty();
  7474. } catch (e){}
  7475. }
  7476. }
  7477. });
  7478. /*
  7479. ---
  7480. script: Elements.From.js
  7481. name: Elements.From
  7482. description: Returns a collection of elements from a string of html.
  7483. license: MIT-style license
  7484. authors:
  7485. - Aaron Newton
  7486. requires:
  7487. - Core/String
  7488. - Core/Element
  7489. - MooTools.More
  7490. provides: [Elements.from, Elements.From]
  7491. ...
  7492. */
  7493. Elements.from = function(text, excludeScripts){
  7494. if (excludeScripts || excludeScripts == null) text = text.stripScripts();
  7495. var container, match = text.match(/^\s*(?:<!--.*?-->\s*)*<(t[dhr]|tbody|tfoot|thead)/i);
  7496. if (match){
  7497. container = new Element('table');
  7498. var tag = match[1].toLowerCase();
  7499. if (['td', 'th', 'tr'].contains(tag)){
  7500. container = new Element('tbody').inject(container);
  7501. if (tag != 'tr') container = new Element('tr').inject(container);
  7502. }
  7503. }
  7504. return (container || new Element('div')).set('html', text).getChildren();
  7505. };
  7506. /*
  7507. ---
  7508. script: IframeShim.js
  7509. name: IframeShim
  7510. description: Defines IframeShim, a class for obscuring select lists and flash objects in IE.
  7511. license: MIT-style license
  7512. authors:
  7513. - Aaron Newton
  7514. requires:
  7515. - Core/Element.Event
  7516. - Core/Element.Style
  7517. - Core/Options
  7518. - Core/Events
  7519. - Element.Position
  7520. - Class.Occlude
  7521. provides: [IframeShim]
  7522. ...
  7523. */
  7524. (function(){
  7525. var browsers = false;
  7526. //<1.4compat>
  7527. browsers = Browser.ie6 || (Browser.firefox && Browser.version < 3 && Browser.Platform.mac);
  7528. //</1.4compat>
  7529. var IframeShim = this.IframeShim = new Class({
  7530. Implements: [Options, Events, Class.Occlude],
  7531. options: {
  7532. className: 'iframeShim',
  7533. src: 'javascript:false;document.write("");',
  7534. display: false,
  7535. zIndex: null,
  7536. margin: 0,
  7537. offset: {x: 0, y: 0},
  7538. browsers: browsers
  7539. },
  7540. property: 'IframeShim',
  7541. initialize: function(element, options){
  7542. this.element = document.id(element);
  7543. if (this.occlude()) return this.occluded;
  7544. this.setOptions(options);
  7545. this.makeShim();
  7546. return this;
  7547. },
  7548. makeShim: function(){
  7549. if (this.options.browsers){
  7550. var zIndex = this.element.getStyle('zIndex').toInt();
  7551. if (!zIndex){
  7552. zIndex = 1;
  7553. var pos = this.element.getStyle('position');
  7554. if (pos == 'static' || !pos) this.element.setStyle('position', 'relative');
  7555. this.element.setStyle('zIndex', zIndex);
  7556. }
  7557. zIndex = ((this.options.zIndex != null || this.options.zIndex === 0) && zIndex > this.options.zIndex) ? this.options.zIndex : zIndex - 1;
  7558. if (zIndex < 0) zIndex = 1;
  7559. this.shim = new Element('iframe', {
  7560. src: this.options.src,
  7561. scrolling: 'no',
  7562. frameborder: 0,
  7563. styles: {
  7564. zIndex: zIndex,
  7565. position: 'absolute',
  7566. border: 'none',
  7567. filter: 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'
  7568. },
  7569. 'class': this.options.className
  7570. }).store('IframeShim', this);
  7571. var inject = (function(){
  7572. this.shim.inject(this.element, 'after');
  7573. this[this.options.display ? 'show' : 'hide']();
  7574. this.fireEvent('inject');
  7575. }).bind(this);
  7576. if (!IframeShim.ready) window.addEvent('load', inject);
  7577. else inject();
  7578. } else {
  7579. this.position = this.hide = this.show = this.dispose = Function.convert(this);
  7580. }
  7581. },
  7582. position: function(){
  7583. if (!IframeShim.ready || !this.shim) return this;
  7584. var size = this.element.measure(function(){
  7585. return this.getSize();
  7586. });
  7587. if (this.options.margin != undefined){
  7588. size.x = size.x - (this.options.margin * 2);
  7589. size.y = size.y - (this.options.margin * 2);
  7590. this.options.offset.x += this.options.margin;
  7591. this.options.offset.y += this.options.margin;
  7592. }
  7593. this.shim.set({width: size.x, height: size.y}).position({
  7594. relativeTo: this.element,
  7595. offset: this.options.offset
  7596. });
  7597. return this;
  7598. },
  7599. hide: function(){
  7600. if (this.shim) this.shim.setStyle('display', 'none');
  7601. return this;
  7602. },
  7603. show: function(){
  7604. if (this.shim) this.shim.setStyle('display', 'block');
  7605. return this.position();
  7606. },
  7607. dispose: function(){
  7608. if (this.shim) this.shim.dispose();
  7609. return this;
  7610. },
  7611. destroy: function(){
  7612. if (this.shim) this.shim.destroy();
  7613. return this;
  7614. }
  7615. });
  7616. })();
  7617. window.addEvent('load', function(){
  7618. IframeShim.ready = true;
  7619. });
  7620. /*
  7621. ---
  7622. script: Mask.js
  7623. name: Mask
  7624. description: Creates a mask element to cover another.
  7625. license: MIT-style license
  7626. authors:
  7627. - Aaron Newton
  7628. requires:
  7629. - Core/Options
  7630. - Core/Events
  7631. - Core/Element.Event
  7632. - Class.Binds
  7633. - Element.Position
  7634. - IframeShim
  7635. provides: [Mask]
  7636. ...
  7637. */
  7638. (function(){
  7639. var Mask = this.Mask = new Class({
  7640. Implements: [Options, Events],
  7641. Binds: ['position'],
  7642. options: {/*
  7643. onShow: function(){},
  7644. onHide: function(){},
  7645. onDestroy: function(){},
  7646. onClick: function(event){},
  7647. inject: {
  7648. where: 'after',
  7649. target: null,
  7650. },
  7651. hideOnClick: false,
  7652. id: null,
  7653. destroyOnHide: false,*/
  7654. style: {},
  7655. 'class': 'mask',
  7656. maskMargins: false,
  7657. useIframeShim: true,
  7658. iframeShimOptions: {}
  7659. },
  7660. initialize: function(target, options){
  7661. this.target = document.id(target) || document.id(document.body);
  7662. this.target.store('mask', this);
  7663. this.setOptions(options);
  7664. this.render();
  7665. this.inject();
  7666. },
  7667. render: function(){
  7668. this.element = new Element('div', {
  7669. 'class': this.options['class'],
  7670. id: this.options.id || 'mask-' + String.uniqueID(),
  7671. styles: Object.merge({}, this.options.style, {
  7672. display: 'none'
  7673. }),
  7674. events: {
  7675. click: function(event){
  7676. this.fireEvent('click', event);
  7677. if (this.options.hideOnClick) this.hide();
  7678. }.bind(this)
  7679. }
  7680. });
  7681. this.hidden = true;
  7682. },
  7683. toElement: function(){
  7684. return this.element;
  7685. },
  7686. inject: function(target, where){
  7687. where = where || (this.options.inject ? this.options.inject.where : '') || (this.target == document.body ? 'inside' : 'after');
  7688. target = target || (this.options.inject && this.options.inject.target) || this.target;
  7689. this.element.inject(target, where);
  7690. if (this.options.useIframeShim){
  7691. this.shim = new IframeShim(this.element, this.options.iframeShimOptions);
  7692. this.addEvents({
  7693. show: this.shim.show.bind(this.shim),
  7694. hide: this.shim.hide.bind(this.shim),
  7695. destroy: this.shim.destroy.bind(this.shim)
  7696. });
  7697. }
  7698. },
  7699. position: function(){
  7700. this.resize(this.options.width, this.options.height);
  7701. this.element.position({
  7702. relativeTo: this.target,
  7703. position: 'topLeft',
  7704. ignoreMargins: !this.options.maskMargins,
  7705. ignoreScroll: this.target == document.body
  7706. });
  7707. return this;
  7708. },
  7709. resize: function(x, y){
  7710. var opt = {
  7711. styles: ['padding', 'border']
  7712. };
  7713. if (this.options.maskMargins) opt.styles.push('margin');
  7714. var dim = this.target.getComputedSize(opt);
  7715. var s = this.target.getSize();
  7716. if (dim.totalHeight<s.y) dim.totalHeight = s.y;
  7717. if (dim.totalWidth<s.x) dim.totalWidth = s.x;
  7718. if (this.target == document.body){
  7719. this.element.setStyles({width: 0, height: 0});
  7720. var win = window.getScrollSize();
  7721. if (dim.totalHeight < win.y) dim.totalHeight = win.y;
  7722. if (dim.totalWidth < win.x) dim.totalWidth = win.x;
  7723. }
  7724. this.element.setStyles({
  7725. width: Array.pick([x, dim.totalWidth, dim.x]),
  7726. height: Array.pick([y, dim.totalHeight, dim.y])
  7727. });
  7728. return this;
  7729. },
  7730. show: function(){
  7731. if (!this.hidden) return this;
  7732. window.addEvent('resize', this.position);
  7733. this.position();
  7734. this.showMask.apply(this, arguments);
  7735. return this;
  7736. },
  7737. showMask: function(){
  7738. this.element.setStyle('display', 'block');
  7739. this.hidden = false;
  7740. this.fireEvent('show');
  7741. },
  7742. hide: function(){
  7743. if (this.hidden) return this;
  7744. window.removeEvent('resize', this.position);
  7745. this.hideMask.apply(this, arguments);
  7746. if (this.options.destroyOnHide) return this.destroy();
  7747. return this;
  7748. },
  7749. hideMask: function(){
  7750. this.element.setStyle('display', 'none');
  7751. this.hidden = true;
  7752. this.fireEvent('hide');
  7753. },
  7754. toggle: function(){
  7755. this[this.hidden ? 'show' : 'hide']();
  7756. },
  7757. destroy: function(){
  7758. this.hide();
  7759. this.element.destroy();
  7760. this.fireEvent('destroy');
  7761. this.target.eliminate('mask');
  7762. }
  7763. });
  7764. })();
  7765. Element.Properties.mask = {
  7766. set: function(options){
  7767. var mask = this.retrieve('mask');
  7768. if (mask) mask.destroy();
  7769. return this.eliminate('mask').store('mask:options', options);
  7770. },
  7771. get: function(){
  7772. var mask = this.retrieve('mask');
  7773. if (!mask){
  7774. mask = new Mask(this, this.retrieve('mask:options'));
  7775. this.store('mask', mask);
  7776. }
  7777. return mask;
  7778. }
  7779. };
  7780. Element.implement({
  7781. mask: function(options){
  7782. if (options) this.set('mask', options);
  7783. this.get('mask').show();
  7784. return this;
  7785. },
  7786. unmask: function(){
  7787. this.get('mask').hide();
  7788. return this;
  7789. }
  7790. });
  7791. /*
  7792. ---
  7793. script: Spinner.js
  7794. name: Spinner
  7795. description: Adds a semi-transparent overlay over a dom element with a spinnin ajax icon.
  7796. license: MIT-style license
  7797. authors:
  7798. - Aaron Newton
  7799. requires:
  7800. - Core/Fx.Tween
  7801. - Core/Request
  7802. - Class.refactor
  7803. - Mask
  7804. provides: [Spinner]
  7805. ...
  7806. */
  7807. (function(){
  7808. var Spinner = this.Spinner = new Class({
  7809. Extends: this.Mask,
  7810. Implements: Chain,
  7811. options: {/*
  7812. message: false,*/
  7813. 'class': 'spinner',
  7814. containerPosition: {},
  7815. content: {
  7816. 'class': 'spinner-content'
  7817. },
  7818. messageContainer: {
  7819. 'class': 'spinner-msg'
  7820. },
  7821. img: {
  7822. 'class': 'spinner-img'
  7823. },
  7824. fxOptions: {
  7825. link: 'chain'
  7826. }
  7827. },
  7828. initialize: function(target, options){
  7829. this.target = document.id(target) || document.id(document.body);
  7830. this.target.store('spinner', this);
  7831. this.setOptions(options);
  7832. this.render();
  7833. this.inject();
  7834. // Add this to events for when noFx is true; parent methods handle hide/show.
  7835. var deactivate = function(){ this.active = false; }.bind(this);
  7836. this.addEvents({
  7837. hide: deactivate,
  7838. show: deactivate
  7839. });
  7840. },
  7841. render: function(){
  7842. this.parent();
  7843. this.element.set('id', this.options.id || 'spinner-' + String.uniqueID());
  7844. this.content = document.id(this.options.content) || new Element('div', this.options.content);
  7845. this.content.inject(this.element);
  7846. if (this.options.message){
  7847. this.msg = document.id(this.options.message) || new Element('p', this.options.messageContainer).appendText(this.options.message);
  7848. this.msg.inject(this.content);
  7849. }
  7850. if (this.options.img){
  7851. this.img = document.id(this.options.img) || new Element('div', this.options.img);
  7852. this.img.inject(this.content);
  7853. }
  7854. this.element.set('tween', this.options.fxOptions);
  7855. },
  7856. show: function(noFx){
  7857. if (this.active) return this.chain(this.show.bind(this));
  7858. if (!this.hidden){
  7859. this.callChain.delay(20, this);
  7860. return this;
  7861. }
  7862. this.target.set('aria-busy', 'true');
  7863. this.active = true;
  7864. return this.parent(noFx);
  7865. },
  7866. showMask: function(noFx){
  7867. var pos = function(){
  7868. this.content.position(Object.merge({
  7869. relativeTo: this.element
  7870. }, this.options.containerPosition));
  7871. }.bind(this);
  7872. if (noFx){
  7873. this.parent();
  7874. pos();
  7875. } else {
  7876. if (!this.options.style.opacity) this.options.style.opacity = this.element.getStyle('opacity').toFloat();
  7877. this.element.setStyles({
  7878. display: 'block',
  7879. opacity: 0
  7880. }).tween('opacity', this.options.style.opacity);
  7881. pos();
  7882. this.hidden = false;
  7883. this.fireEvent('show');
  7884. this.callChain();
  7885. }
  7886. },
  7887. hide: function(noFx){
  7888. if (this.active) return this.chain(this.hide.bind(this));
  7889. if (this.hidden){
  7890. this.callChain.delay(20, this);
  7891. return this;
  7892. }
  7893. this.target.set('aria-busy', 'false');
  7894. this.active = true;
  7895. return this.parent(noFx);
  7896. },
  7897. hideMask: function(noFx){
  7898. if (noFx) return this.parent();
  7899. this.element.tween('opacity', 0).get('tween').chain(function(){
  7900. this.element.setStyle('display', 'none');
  7901. this.hidden = true;
  7902. this.fireEvent('hide');
  7903. this.callChain();
  7904. }.bind(this));
  7905. },
  7906. destroy: function(){
  7907. this.content.destroy();
  7908. this.parent();
  7909. this.target.eliminate('spinner');
  7910. }
  7911. });
  7912. })();
  7913. Request = Class.refactor(Request, {
  7914. options: {
  7915. useSpinner: false,
  7916. spinnerOptions: {},
  7917. spinnerTarget: false
  7918. },
  7919. initialize: function(options){
  7920. this._send = this.send;
  7921. this.send = function(options){
  7922. var spinner = this.getSpinner();
  7923. if (spinner) spinner.chain(this._send.pass(options, this)).show();
  7924. else this._send(options);
  7925. return this;
  7926. };
  7927. this.previous(options);
  7928. },
  7929. getSpinner: function(){
  7930. if (!this.spinner){
  7931. var update = document.id(this.options.spinnerTarget) || document.id(this.options.update);
  7932. if (this.options.useSpinner && update){
  7933. update.set('spinner', this.options.spinnerOptions);
  7934. var spinner = this.spinner = update.get('spinner');
  7935. ['complete', 'exception', 'cancel'].each(function(event){
  7936. this.addEvent(event, spinner.hide.bind(spinner));
  7937. }, this);
  7938. }
  7939. }
  7940. return this.spinner;
  7941. }
  7942. });
  7943. Element.Properties.spinner = {
  7944. set: function(options){
  7945. var spinner = this.retrieve('spinner');
  7946. if (spinner) spinner.destroy();
  7947. return this.eliminate('spinner').store('spinner:options', options);
  7948. },
  7949. get: function(){
  7950. var spinner = this.retrieve('spinner');
  7951. if (!spinner){
  7952. spinner = new Spinner(this, this.retrieve('spinner:options'));
  7953. this.store('spinner', spinner);
  7954. }
  7955. return spinner;
  7956. }
  7957. };
  7958. Element.implement({
  7959. spin: function(options){
  7960. if (options) this.set('spinner', options);
  7961. this.get('spinner').show();
  7962. return this;
  7963. },
  7964. unspin: function(){
  7965. this.get('spinner').hide();
  7966. return this;
  7967. }
  7968. });
  7969. /*
  7970. ---
  7971. script: String.QueryString.js
  7972. name: String.QueryString
  7973. description: Methods for dealing with URI query strings.
  7974. license: MIT-style license
  7975. authors:
  7976. - Sebastian Markbåge
  7977. - Aaron Newton
  7978. - Lennart Pilon
  7979. - Valerio Proietti
  7980. requires:
  7981. - Core/Array
  7982. - Core/String
  7983. - MooTools.More
  7984. provides: [String.QueryString]
  7985. ...
  7986. */
  7987. (function(){
  7988. /**
  7989. * decodeURIComponent doesn't do the correct thing with query parameter keys or
  7990. * values. Specifically, it leaves '+' as '+' when it should be converting them
  7991. * to spaces as that's the specification. When browsers submit HTML forms via
  7992. * GET, the values are encoded using 'application/x-www-form-urlencoded'
  7993. * which converts spaces to '+'.
  7994. *
  7995. * See: http://unixpapa.com/js/querystring.html for a description of the
  7996. * problem.
  7997. */
  7998. var decodeComponent = function(str){
  7999. return decodeURIComponent(str.replace(/\+/g, ' '));
  8000. };
  8001. String.implement({
  8002. parseQueryString: function(decodeKeys, decodeValues){
  8003. if (decodeKeys == null) decodeKeys = true;
  8004. if (decodeValues == null) decodeValues = true;
  8005. var vars = this.split(/[&;]/),
  8006. object = {};
  8007. if (!vars.length) return object;
  8008. vars.each(function(val){
  8009. var index = val.indexOf('=') + 1,
  8010. value = index ? val.substr(index) : '',
  8011. keys = index ? val.substr(0, index - 1).match(/([^\]\[]+|(\B)(?=\]))/g) : [val],
  8012. obj = object;
  8013. if (!keys) return;
  8014. if (decodeValues) value = decodeComponent(value);
  8015. keys.each(function(key, i){
  8016. if (decodeKeys) key = decodeComponent(key);
  8017. var current = obj[key];
  8018. if (i < keys.length - 1) obj = obj[key] = current || {};
  8019. else if (typeOf(current) == 'array') current.push(value);
  8020. else obj[key] = current != null ? [current, value] : value;
  8021. });
  8022. });
  8023. return object;
  8024. },
  8025. cleanQueryString: function(method){
  8026. return this.split('&').filter(function(val){
  8027. var index = val.indexOf('='),
  8028. key = index < 0 ? '' : val.substr(0, index),
  8029. value = val.substr(index + 1);
  8030. return method ? method.call(null, key, value) : (value || value === 0);
  8031. }).join('&');
  8032. }
  8033. });
  8034. })();
  8035. /*
  8036. ---
  8037. script: Form.Request.js
  8038. name: Form.Request
  8039. description: Handles the basic functionality of submitting a form and updating a dom element with the result.
  8040. license: MIT-style license
  8041. authors:
  8042. - Aaron Newton
  8043. requires:
  8044. - Core/Request.HTML
  8045. - Class.Binds
  8046. - Class.Occlude
  8047. - Spinner
  8048. - String.QueryString
  8049. - Element.Delegation.Pseudo
  8050. provides: [Form.Request]
  8051. ...
  8052. */
  8053. if (!window.Form) window.Form = {};
  8054. (function(){
  8055. Form.Request = new Class({
  8056. Binds: ['onSubmit', 'onFormValidate'],
  8057. Implements: [Options, Events, Class.Occlude],
  8058. options: {/*
  8059. onFailure: function(){},
  8060. onSuccess: function(){}, // aliased to onComplete,
  8061. onSend: function(){}*/
  8062. requestOptions: {
  8063. evalScripts: true,
  8064. useSpinner: true,
  8065. emulation: false,
  8066. link: 'ignore'
  8067. },
  8068. sendButtonClicked: true,
  8069. extraData: {},
  8070. resetForm: true
  8071. },
  8072. property: 'form.request',
  8073. initialize: function(form, target, options){
  8074. this.element = document.id(form);
  8075. if (this.occlude()) return this.occluded;
  8076. this.setOptions(options)
  8077. .setTarget(target)
  8078. .attach();
  8079. },
  8080. setTarget: function(target){
  8081. this.target = document.id(target);
  8082. if (!this.request){
  8083. this.makeRequest();
  8084. } else {
  8085. this.request.setOptions({
  8086. update: this.target
  8087. });
  8088. }
  8089. return this;
  8090. },
  8091. toElement: function(){
  8092. return this.element;
  8093. },
  8094. makeRequest: function(){
  8095. var self = this;
  8096. this.request = new Request.HTML(Object.merge({
  8097. update: this.target,
  8098. emulation: false,
  8099. spinnerTarget: this.element,
  8100. method: this.element.get('method') || 'post'
  8101. }, this.options.requestOptions)).addEvents({
  8102. success: function(tree, elements, html, javascript){
  8103. ['complete', 'success'].each(function(evt){
  8104. self.fireEvent(evt, [self.target, tree, elements, html, javascript]);
  8105. });
  8106. },
  8107. failure: function(){
  8108. self.fireEvent('complete', arguments).fireEvent('failure', arguments);
  8109. },
  8110. exception: function(){
  8111. self.fireEvent('failure', arguments);
  8112. }
  8113. });
  8114. return this.attachReset();
  8115. },
  8116. attachReset: function(){
  8117. if (!this.options.resetForm) return this;
  8118. this.request.addEvent('success', function(){
  8119. Function.attempt(function(){
  8120. this.element.reset();
  8121. }.bind(this));
  8122. if (window.OverText) OverText.update();
  8123. }.bind(this));
  8124. return this;
  8125. },
  8126. attach: function(attach){
  8127. var method = (attach != false) ? 'addEvent' : 'removeEvent';
  8128. this.element[method]('click:relay(button, input[type=submit])', this.saveClickedButton.bind(this));
  8129. var fv = this.element.retrieve('validator');
  8130. if (fv) fv[method]('onFormValidate', this.onFormValidate);
  8131. else this.element[method]('submit', this.onSubmit);
  8132. return this;
  8133. },
  8134. detach: function(){
  8135. return this.attach(false);
  8136. },
  8137. //public method
  8138. enable: function(){
  8139. return this.attach();
  8140. },
  8141. //public method
  8142. disable: function(){
  8143. return this.detach();
  8144. },
  8145. onFormValidate: function(valid, form, event){
  8146. //if there's no event, then this wasn't a submit event
  8147. if (!event) return;
  8148. var fv = this.element.retrieve('validator');
  8149. if (valid || (fv && !fv.options.stopOnFailure)){
  8150. event.stop();
  8151. this.send();
  8152. }
  8153. },
  8154. onSubmit: function(event){
  8155. var fv = this.element.retrieve('validator');
  8156. if (fv){
  8157. //form validator was created after Form.Request
  8158. this.element.removeEvent('submit', this.onSubmit);
  8159. fv.addEvent('onFormValidate', this.onFormValidate);
  8160. fv.validate(event);
  8161. return;
  8162. }
  8163. if (event) event.stop();
  8164. this.send();
  8165. },
  8166. saveClickedButton: function(event, target){
  8167. var targetName = target.get('name');
  8168. if (!targetName || !this.options.sendButtonClicked) return;
  8169. this.options.extraData[targetName] = target.get('value') || true;
  8170. this.clickedCleaner = function(){
  8171. delete this.options.extraData[targetName];
  8172. this.clickedCleaner = function(){};
  8173. }.bind(this);
  8174. },
  8175. clickedCleaner: function(){},
  8176. send: function(){
  8177. var str = this.element.toQueryString().trim(),
  8178. data = Object.toQueryString(this.options.extraData);
  8179. if (str) str += '&' + data;
  8180. else str = data;
  8181. this.fireEvent('send', [this.element, str.parseQueryString()]);
  8182. this.request.send({
  8183. data: str,
  8184. url: this.options.requestOptions.url || this.element.get('action')
  8185. });
  8186. this.clickedCleaner();
  8187. return this;
  8188. }
  8189. });
  8190. Element.implement('formUpdate', function(update, options){
  8191. var fq = this.retrieve('form.request');
  8192. if (!fq){
  8193. fq = new Form.Request(this, update, options);
  8194. } else {
  8195. if (update) fq.setTarget(update);
  8196. if (options) fq.setOptions(options).makeRequest();
  8197. }
  8198. fq.send();
  8199. return this;
  8200. });
  8201. })();
  8202. /*
  8203. ---
  8204. script: Fx.Reveal.js
  8205. name: Fx.Reveal
  8206. description: Defines Fx.Reveal, a class that shows and hides elements with a transition.
  8207. license: MIT-style license
  8208. authors:
  8209. - Aaron Newton
  8210. requires:
  8211. - Core/Fx.Morph
  8212. - Element.Shortcuts
  8213. - Element.Measure
  8214. provides: [Fx.Reveal]
  8215. ...
  8216. */
  8217. (function(){
  8218. var hideTheseOf = function(object){
  8219. var hideThese = object.options.hideInputs;
  8220. if (window.OverText){
  8221. var otClasses = [null];
  8222. OverText.each(function(ot){
  8223. otClasses.include('.' + ot.options.labelClass);
  8224. });
  8225. if (otClasses) hideThese += otClasses.join(', ');
  8226. }
  8227. return (hideThese) ? object.element.getElements(hideThese) : null;
  8228. };
  8229. Fx.Reveal = new Class({
  8230. Extends: Fx.Morph,
  8231. options: {/*
  8232. onShow: function(thisElement){},
  8233. onHide: function(thisElement){},
  8234. onComplete: function(thisElement){},
  8235. heightOverride: null,
  8236. widthOverride: null,*/
  8237. link: 'cancel',
  8238. styles: ['padding', 'border', 'margin'],
  8239. transitionOpacity: 'opacity' in document.documentElement,
  8240. mode: 'vertical',
  8241. display: function(){
  8242. return this.element.get('tag') != 'tr' ? 'block' : 'table-row';
  8243. },
  8244. opacity: 1,
  8245. hideInputs: !('opacity' in document.documentElement) ? 'select, input, textarea, object, embed' : null
  8246. },
  8247. dissolve: function(){
  8248. if (!this.hiding && !this.showing){
  8249. if (this.element.getStyle('display') != 'none'){
  8250. this.hiding = true;
  8251. this.showing = false;
  8252. this.hidden = true;
  8253. this.cssText = this.element.style.cssText;
  8254. var startStyles = this.element.getComputedSize({
  8255. styles: this.options.styles,
  8256. mode: this.options.mode
  8257. });
  8258. if (this.options.transitionOpacity) startStyles.opacity = this.options.opacity;
  8259. var zero = {};
  8260. Object.each(startStyles, function(style, name){
  8261. zero[name] = [style, 0];
  8262. });
  8263. this.element.setStyles({
  8264. display: Function.convert(this.options.display).call(this),
  8265. overflow: 'hidden'
  8266. });
  8267. var hideThese = hideTheseOf(this);
  8268. if (hideThese) hideThese.setStyle('visibility', 'hidden');
  8269. this.$chain.unshift(function(){
  8270. if (this.hidden){
  8271. this.hiding = false;
  8272. this.element.style.cssText = this.cssText;
  8273. this.element.setStyle('display', 'none');
  8274. if (hideThese) hideThese.setStyle('visibility', 'visible');
  8275. }
  8276. this.fireEvent('hide', this.element);
  8277. this.callChain();
  8278. }.bind(this));
  8279. this.start(zero);
  8280. } else {
  8281. this.callChain.delay(10, this);
  8282. this.fireEvent('complete', this.element);
  8283. this.fireEvent('hide', this.element);
  8284. }
  8285. } else if (this.options.link == 'chain'){
  8286. this.chain(this.dissolve.bind(this));
  8287. } else if (this.options.link == 'cancel' && !this.hiding){
  8288. this.cancel();
  8289. this.dissolve();
  8290. }
  8291. return this;
  8292. },
  8293. reveal: function(){
  8294. if (!this.showing && !this.hiding){
  8295. if (this.element.getStyle('display') == 'none'){
  8296. this.hiding = false;
  8297. this.showing = true;
  8298. this.hidden = false;
  8299. this.cssText = this.element.style.cssText;
  8300. var startStyles;
  8301. this.element.measure(function(){
  8302. startStyles = this.element.getComputedSize({
  8303. styles: this.options.styles,
  8304. mode: this.options.mode
  8305. });
  8306. }.bind(this));
  8307. if (this.options.heightOverride != null) startStyles.height = this.options.heightOverride.toInt();
  8308. if (this.options.widthOverride != null) startStyles.width = this.options.widthOverride.toInt();
  8309. if (this.options.transitionOpacity){
  8310. this.element.setStyle('opacity', 0);
  8311. startStyles.opacity = this.options.opacity;
  8312. }
  8313. var zero = {
  8314. height: 0,
  8315. display: Function.convert(this.options.display).call(this)
  8316. };
  8317. Object.each(startStyles, function(style, name){
  8318. zero[name] = 0;
  8319. });
  8320. zero.overflow = 'hidden';
  8321. this.element.setStyles(zero);
  8322. var hideThese = hideTheseOf(this);
  8323. if (hideThese) hideThese.setStyle('visibility', 'hidden');
  8324. this.$chain.unshift(function(){
  8325. this.element.style.cssText = this.cssText;
  8326. this.element.setStyle('display', Function.convert(this.options.display).call(this));
  8327. if (!this.hidden) this.showing = false;
  8328. if (hideThese) hideThese.setStyle('visibility', 'visible');
  8329. this.callChain();
  8330. this.fireEvent('show', this.element);
  8331. }.bind(this));
  8332. this.start(startStyles);
  8333. } else {
  8334. this.callChain();
  8335. this.fireEvent('complete', this.element);
  8336. this.fireEvent('show', this.element);
  8337. }
  8338. } else if (this.options.link == 'chain'){
  8339. this.chain(this.reveal.bind(this));
  8340. } else if (this.options.link == 'cancel' && !this.showing){
  8341. this.cancel();
  8342. this.reveal();
  8343. }
  8344. return this;
  8345. },
  8346. toggle: function(){
  8347. if (this.element.getStyle('display') == 'none'){
  8348. this.reveal();
  8349. } else {
  8350. this.dissolve();
  8351. }
  8352. return this;
  8353. },
  8354. cancel: function(){
  8355. this.parent.apply(this, arguments);
  8356. if (this.cssText != null) this.element.style.cssText = this.cssText;
  8357. this.hiding = false;
  8358. this.showing = false;
  8359. return this;
  8360. }
  8361. });
  8362. Element.Properties.reveal = {
  8363. set: function(options){
  8364. this.get('reveal').cancel().setOptions(options);
  8365. return this;
  8366. },
  8367. get: function(){
  8368. var reveal = this.retrieve('reveal');
  8369. if (!reveal){
  8370. reveal = new Fx.Reveal(this);
  8371. this.store('reveal', reveal);
  8372. }
  8373. return reveal;
  8374. }
  8375. };
  8376. Element.Properties.dissolve = Element.Properties.reveal;
  8377. Element.implement({
  8378. reveal: function(options){
  8379. this.get('reveal').setOptions(options).reveal();
  8380. return this;
  8381. },
  8382. dissolve: function(options){
  8383. this.get('reveal').setOptions(options).dissolve();
  8384. return this;
  8385. },
  8386. nix: function(options){
  8387. var params = Array.link(arguments, {destroy: Type.isBoolean, options: Type.isObject});
  8388. this.get('reveal').setOptions(options).dissolve().chain(function(){
  8389. this[params.destroy ? 'destroy' : 'dispose']();
  8390. }.bind(this));
  8391. return this;
  8392. },
  8393. wink: function(){
  8394. var params = Array.link(arguments, {duration: Type.isNumber, options: Type.isObject});
  8395. var reveal = this.get('reveal').setOptions(params.options);
  8396. reveal.reveal().chain(function(){
  8397. (function(){
  8398. reveal.dissolve();
  8399. }).delay(params.duration || 2000);
  8400. });
  8401. }
  8402. });
  8403. })();
  8404. /*
  8405. ---
  8406. script: Form.Request.Append.js
  8407. name: Form.Request.Append
  8408. 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.
  8409. license: MIT-style license
  8410. authors:
  8411. - Aaron Newton
  8412. requires:
  8413. - Form.Request
  8414. - Fx.Reveal
  8415. - Elements.from
  8416. provides: [Form.Request.Append]
  8417. ...
  8418. */
  8419. Form.Request.Append = new Class({
  8420. Extends: Form.Request,
  8421. options: {
  8422. //onBeforeEffect: function(){},
  8423. useReveal: true,
  8424. revealOptions: {},
  8425. inject: 'bottom'
  8426. },
  8427. makeRequest: function(){
  8428. this.request = new Request.HTML(Object.merge({
  8429. url: this.element.get('action'),
  8430. method: this.element.get('method') || 'post',
  8431. spinnerTarget: this.element
  8432. }, this.options.requestOptions, {
  8433. evalScripts: false
  8434. })).addEvents({
  8435. success: function(tree, elements, html, javascript){
  8436. var container;
  8437. var kids = Elements.from(html);
  8438. if (kids.length == 1){
  8439. container = kids[0];
  8440. } else {
  8441. container = new Element('div', {
  8442. styles: {
  8443. display: 'none'
  8444. }
  8445. }).adopt(kids);
  8446. }
  8447. container.inject(this.target, this.options.inject);
  8448. if (this.options.requestOptions.evalScripts) Browser.exec(javascript);
  8449. this.fireEvent('beforeEffect', container);
  8450. var finish = function(){
  8451. this.fireEvent('success', [container, this.target, tree, elements, html, javascript]);
  8452. }.bind(this);
  8453. if (this.options.useReveal){
  8454. container.set('reveal', this.options.revealOptions).get('reveal').chain(finish);
  8455. container.reveal();
  8456. } else {
  8457. finish();
  8458. }
  8459. }.bind(this),
  8460. failure: function(xhr){
  8461. this.fireEvent('failure', xhr);
  8462. }.bind(this)
  8463. });
  8464. this.attachReset();
  8465. }
  8466. });
  8467. /*
  8468. ---
  8469. script: Object.Extras.js
  8470. name: Object.Extras
  8471. description: Extra Object generics, like getFromPath which allows a path notation to child elements.
  8472. license: MIT-style license
  8473. authors:
  8474. - Aaron Newton
  8475. requires:
  8476. - Core/Object
  8477. - MooTools.More
  8478. provides: [Object.Extras]
  8479. ...
  8480. */
  8481. (function(){
  8482. var defined = function(value){
  8483. return value != null;
  8484. };
  8485. var hasOwnProperty = Object.prototype.hasOwnProperty;
  8486. Object.extend({
  8487. getFromPath: function(source, parts){
  8488. if (typeof parts == 'string') parts = parts.split('.');
  8489. for (var i = 0, l = parts.length; i < l; i++){
  8490. if (hasOwnProperty.call(source, parts[i])) source = source[parts[i]];
  8491. else return null;
  8492. }
  8493. return source;
  8494. },
  8495. cleanValues: function(object, method){
  8496. method = method || defined;
  8497. for (var key in object) if (!method(object[key])){
  8498. delete object[key];
  8499. }
  8500. return object;
  8501. },
  8502. erase: function(object, key){
  8503. if (hasOwnProperty.call(object, key)) delete object[key];
  8504. return object;
  8505. },
  8506. run: function(object){
  8507. var args = Array.slice(arguments, 1);
  8508. for (var key in object) if (object[key].apply){
  8509. object[key].apply(object, args);
  8510. }
  8511. return object;
  8512. }
  8513. });
  8514. })();
  8515. /*
  8516. ---
  8517. script: Locale.js
  8518. name: Locale
  8519. description: Provides methods for localization.
  8520. license: MIT-style license
  8521. authors:
  8522. - Aaron Newton
  8523. - Arian Stolwijk
  8524. requires:
  8525. - Core/Events
  8526. - Object.Extras
  8527. - MooTools.More
  8528. provides: [Locale, Lang]
  8529. ...
  8530. */
  8531. (function(){
  8532. var current = null,
  8533. locales = {},
  8534. inherits = {};
  8535. var getSet = function(set){
  8536. if (instanceOf(set, Locale.Set)) return set;
  8537. else return locales[set];
  8538. };
  8539. var Locale = this.Locale = {
  8540. define: function(locale, set, key, value){
  8541. var name;
  8542. if (instanceOf(locale, Locale.Set)){
  8543. name = locale.name;
  8544. if (name) locales[name] = locale;
  8545. } else {
  8546. name = locale;
  8547. if (!locales[name]) locales[name] = new Locale.Set(name);
  8548. locale = locales[name];
  8549. }
  8550. if (set) locale.define(set, key, value);
  8551. /*<1.2compat>*/
  8552. if (set == 'cascade') return Locale.inherit(name, key);
  8553. /*</1.2compat>*/
  8554. if (!current) current = locale;
  8555. return locale;
  8556. },
  8557. use: function(locale){
  8558. locale = getSet(locale);
  8559. if (locale){
  8560. current = locale;
  8561. this.fireEvent('change', locale);
  8562. /*<1.2compat>*/
  8563. this.fireEvent('langChange', locale.name);
  8564. /*</1.2compat>*/
  8565. }
  8566. return this;
  8567. },
  8568. getCurrent: function(){
  8569. return current;
  8570. },
  8571. get: function(key, args){
  8572. return (current) ? current.get(key, args) : '';
  8573. },
  8574. inherit: function(locale, inherits, set){
  8575. locale = getSet(locale);
  8576. if (locale) locale.inherit(inherits, set);
  8577. return this;
  8578. },
  8579. list: function(){
  8580. return Object.keys(locales);
  8581. }
  8582. };
  8583. Object.append(Locale, new Events);
  8584. Locale.Set = new Class({
  8585. sets: {},
  8586. inherits: {
  8587. locales: [],
  8588. sets: {}
  8589. },
  8590. initialize: function(name){
  8591. this.name = name || '';
  8592. },
  8593. define: function(set, key, value){
  8594. var defineData = this.sets[set];
  8595. if (!defineData) defineData = {};
  8596. if (key){
  8597. if (typeOf(key) == 'object') defineData = Object.merge(defineData, key);
  8598. else defineData[key] = value;
  8599. }
  8600. this.sets[set] = defineData;
  8601. return this;
  8602. },
  8603. get: function(key, args, _base){
  8604. var value = Object.getFromPath(this.sets, key);
  8605. if (value != null){
  8606. var type = typeOf(value);
  8607. if (type == 'function') value = value.apply(null, Array.convert(args));
  8608. else if (type == 'object') value = Object.clone(value);
  8609. return value;
  8610. }
  8611. // get value of inherited locales
  8612. var index = key.indexOf('.'),
  8613. set = index < 0 ? key : key.substr(0, index),
  8614. names = (this.inherits.sets[set] || []).combine(this.inherits.locales).include('en-US');
  8615. if (!_base) _base = [];
  8616. for (var i = 0, l = names.length; i < l; i++){
  8617. if (_base.contains(names[i])) continue;
  8618. _base.include(names[i]);
  8619. var locale = locales[names[i]];
  8620. if (!locale) continue;
  8621. value = locale.get(key, args, _base);
  8622. if (value != null) return value;
  8623. }
  8624. return '';
  8625. },
  8626. inherit: function(names, set){
  8627. names = Array.convert(names);
  8628. if (set && !this.inherits.sets[set]) this.inherits.sets[set] = [];
  8629. var l = names.length;
  8630. while (l--) (set ? this.inherits.sets[set] : this.inherits.locales).unshift(names[l]);
  8631. return this;
  8632. }
  8633. });
  8634. /*<1.2compat>*/
  8635. var lang = MooTools.lang = {};
  8636. Object.append(lang, Locale, {
  8637. setLanguage: Locale.use,
  8638. getCurrentLanguage: function(){
  8639. var current = Locale.getCurrent();
  8640. return (current) ? current.name : null;
  8641. },
  8642. set: function(){
  8643. Locale.define.apply(this, arguments);
  8644. return this;
  8645. },
  8646. get: function(set, key, args){
  8647. if (key) set += '.' + key;
  8648. return Locale.get(set, args);
  8649. }
  8650. });
  8651. /*</1.2compat>*/
  8652. })();
  8653. /*
  8654. ---
  8655. name: Locale.en-US.Date
  8656. description: Date messages for US English.
  8657. license: MIT-style license
  8658. authors:
  8659. - Aaron Newton
  8660. requires:
  8661. - Locale
  8662. provides: [Locale.en-US.Date]
  8663. ...
  8664. */
  8665. Locale.define('en-US', 'Date', {
  8666. months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
  8667. months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  8668. days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  8669. days_abbr: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8670. // Culture's date order: MM/DD/YYYY
  8671. dateOrder: ['month', 'date', 'year'],
  8672. shortDate: '%m/%d/%Y',
  8673. shortTime: '%I:%M%p',
  8674. AM: 'AM',
  8675. PM: 'PM',
  8676. firstDayOfWeek: 0,
  8677. // Date.Extras
  8678. ordinal: function(dayOfMonth){
  8679. // 1st, 2nd, 3rd, etc.
  8680. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'th' : ['th', 'st', 'nd', 'rd', 'th'][Math.min(dayOfMonth % 10, 4)];
  8681. },
  8682. lessThanMinuteAgo: 'less than a minute ago',
  8683. minuteAgo: 'about a minute ago',
  8684. minutesAgo: '{delta} minutes ago',
  8685. hourAgo: 'about an hour ago',
  8686. hoursAgo: 'about {delta} hours ago',
  8687. dayAgo: '1 day ago',
  8688. daysAgo: '{delta} days ago',
  8689. weekAgo: '1 week ago',
  8690. weeksAgo: '{delta} weeks ago',
  8691. monthAgo: '1 month ago',
  8692. monthsAgo: '{delta} months ago',
  8693. yearAgo: '1 year ago',
  8694. yearsAgo: '{delta} years ago',
  8695. lessThanMinuteUntil: 'less than a minute from now',
  8696. minuteUntil: 'about a minute from now',
  8697. minutesUntil: '{delta} minutes from now',
  8698. hourUntil: 'about an hour from now',
  8699. hoursUntil: 'about {delta} hours from now',
  8700. dayUntil: '1 day from now',
  8701. daysUntil: '{delta} days from now',
  8702. weekUntil: '1 week from now',
  8703. weeksUntil: '{delta} weeks from now',
  8704. monthUntil: '1 month from now',
  8705. monthsUntil: '{delta} months from now',
  8706. yearUntil: '1 year from now',
  8707. yearsUntil: '{delta} years from now'
  8708. });
  8709. /*
  8710. ---
  8711. script: Date.js
  8712. name: Date
  8713. description: Extends the Date native object to include methods useful in managing dates.
  8714. license: MIT-style license
  8715. authors:
  8716. - Aaron Newton
  8717. - Nicholas Barthelemy - https://svn.nbarthelemy.com/date-js/
  8718. - Harald Kirshner - mail [at] digitarald.de; http://digitarald.de
  8719. - Scott Kyle - scott [at] appden.com; http://appden.com
  8720. requires:
  8721. - Core/Array
  8722. - Core/String
  8723. - Core/Number
  8724. - MooTools.More
  8725. - Locale
  8726. - Locale.en-US.Date
  8727. provides: [Date]
  8728. ...
  8729. */
  8730. (function(){
  8731. var Date = this.Date;
  8732. var DateMethods = Date.Methods = {
  8733. ms: 'Milliseconds',
  8734. year: 'FullYear',
  8735. min: 'Minutes',
  8736. mo: 'Month',
  8737. sec: 'Seconds',
  8738. hr: 'Hours'
  8739. };
  8740. [
  8741. 'Date', 'Day', 'FullYear', 'Hours', 'Milliseconds', 'Minutes', 'Month', 'Seconds', 'Time', 'TimezoneOffset',
  8742. 'Week', 'Timezone', 'GMTOffset', 'DayOfYear', 'LastMonth', 'LastDayOfMonth', 'UTCDate', 'UTCDay', 'UTCFullYear',
  8743. 'AMPM', 'Ordinal', 'UTCHours', 'UTCMilliseconds', 'UTCMinutes', 'UTCMonth', 'UTCSeconds', 'UTCMilliseconds'
  8744. ].each(function(method){
  8745. Date.Methods[method.toLowerCase()] = method;
  8746. });
  8747. var pad = function(n, digits, string){
  8748. if (digits == 1) return n;
  8749. return n < Math.pow(10, digits - 1) ? (string || '0') + pad(n, digits - 1, string) : n;
  8750. };
  8751. Date.implement({
  8752. set: function(prop, value){
  8753. prop = prop.toLowerCase();
  8754. var method = DateMethods[prop] && 'set' + DateMethods[prop];
  8755. if (method && this[method]) this[method](value);
  8756. return this;
  8757. }.overloadSetter(),
  8758. get: function(prop){
  8759. prop = prop.toLowerCase();
  8760. var method = DateMethods[prop] && 'get' + DateMethods[prop];
  8761. if (method && this[method]) return this[method]();
  8762. return null;
  8763. }.overloadGetter(),
  8764. clone: function(){
  8765. return new Date(this.get('time'));
  8766. },
  8767. increment: function(interval, times){
  8768. interval = interval || 'day';
  8769. times = times != null ? times : 1;
  8770. switch (interval){
  8771. case 'year':
  8772. return this.increment('month', times * 12);
  8773. case 'month':
  8774. var d = this.get('date');
  8775. this.set('date', 1).set('mo', this.get('mo') + times);
  8776. return this.set('date', d.min(this.get('lastdayofmonth')));
  8777. case 'week':
  8778. return this.increment('day', times * 7);
  8779. case 'day':
  8780. return this.set('date', this.get('date') + times);
  8781. }
  8782. if (!Date.units[interval]) throw new Error(interval + ' is not a supported interval');
  8783. return this.set('time', this.get('time') + times * Date.units[interval]());
  8784. },
  8785. decrement: function(interval, times){
  8786. return this.increment(interval, -1 * (times != null ? times : 1));
  8787. },
  8788. isLeapYear: function(){
  8789. return Date.isLeapYear(this.get('year'));
  8790. },
  8791. clearTime: function(){
  8792. return this.set({hr: 0, min: 0, sec: 0, ms: 0});
  8793. },
  8794. diff: function(date, resolution){
  8795. if (typeOf(date) == 'string') date = Date.parse(date);
  8796. return ((date - this) / Date.units[resolution || 'day'](3, 3)).round(); // non-leap year, 30-day month
  8797. },
  8798. getLastDayOfMonth: function(){
  8799. return Date.daysInMonth(this.get('mo'), this.get('year'));
  8800. },
  8801. getDayOfYear: function(){
  8802. return (Date.UTC(this.get('year'), this.get('mo'), this.get('date') + 1)
  8803. - Date.UTC(this.get('year'), 0, 1)) / Date.units.day();
  8804. },
  8805. setDay: function(day, firstDayOfWeek){
  8806. if (firstDayOfWeek == null){
  8807. firstDayOfWeek = Date.getMsg('firstDayOfWeek');
  8808. if (firstDayOfWeek === '') firstDayOfWeek = 1;
  8809. }
  8810. day = (7 + Date.parseDay(day, true) - firstDayOfWeek) % 7;
  8811. var currentDay = (7 + this.get('day') - firstDayOfWeek) % 7;
  8812. return this.increment('day', day - currentDay);
  8813. },
  8814. getWeek: function(firstDayOfWeek){
  8815. if (firstDayOfWeek == null){
  8816. firstDayOfWeek = Date.getMsg('firstDayOfWeek');
  8817. if (firstDayOfWeek === '') firstDayOfWeek = 1;
  8818. }
  8819. var date = this,
  8820. dayOfWeek = (7 + date.get('day') - firstDayOfWeek) % 7,
  8821. dividend = 0,
  8822. firstDayOfYear;
  8823. if (firstDayOfWeek == 1){
  8824. // ISO-8601, week belongs to year that has the most days of the week (i.e. has the thursday of the week)
  8825. var month = date.get('month'),
  8826. startOfWeek = date.get('date') - dayOfWeek;
  8827. if (month == 11 && startOfWeek > 28) return 1; // Week 1 of next year
  8828. if (month == 0 && startOfWeek < -2){
  8829. // Use a date from last year to determine the week
  8830. date = new Date(date).decrement('day', dayOfWeek);
  8831. dayOfWeek = 0;
  8832. }
  8833. firstDayOfYear = new Date(date.get('year'), 0, 1).get('day') || 7;
  8834. if (firstDayOfYear > 4) dividend = -7; // First week of the year is not week 1
  8835. } else {
  8836. // In other cultures the first week of the year is always week 1 and the last week always 53 or 54.
  8837. // Days in the same week can have a different weeknumber if the week spreads across two years.
  8838. firstDayOfYear = new Date(date.get('year'), 0, 1).get('day');
  8839. }
  8840. dividend += date.get('dayofyear');
  8841. dividend += 6 - dayOfWeek; // Add days so we calculate the current date's week as a full week
  8842. dividend += (7 + firstDayOfYear - firstDayOfWeek) % 7; // Make up for first week of the year not being a full week
  8843. return (dividend / 7);
  8844. },
  8845. getOrdinal: function(day){
  8846. return Date.getMsg('ordinal', day || this.get('date'));
  8847. },
  8848. getTimezone: function(){
  8849. return this.toString()
  8850. .replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/, '$1')
  8851. .replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, '$1$2$3');
  8852. },
  8853. getGMTOffset: function(){
  8854. var off = this.get('timezoneOffset');
  8855. return ((off > 0) ? '-' : '+') + pad((off.abs() / 60).floor(), 2) + pad(off % 60, 2);
  8856. },
  8857. setAMPM: function(ampm){
  8858. ampm = ampm.toUpperCase();
  8859. var hr = this.get('hr');
  8860. if (hr > 11 && ampm == 'AM') return this.decrement('hour', 12);
  8861. else if (hr < 12 && ampm == 'PM') return this.increment('hour', 12);
  8862. return this;
  8863. },
  8864. getAMPM: function(){
  8865. return (this.get('hr') < 12) ? 'AM' : 'PM';
  8866. },
  8867. parse: function(str){
  8868. this.set('time', Date.parse(str));
  8869. return this;
  8870. },
  8871. isValid: function(date){
  8872. if (!date) date = this;
  8873. return typeOf(date) == 'date' && !isNaN(date.valueOf());
  8874. },
  8875. format: function(format){
  8876. if (!this.isValid()) return 'invalid date';
  8877. if (!format) format = '%x %X';
  8878. if (typeof format == 'string') format = formats[format.toLowerCase()] || format;
  8879. if (typeof format == 'function') return format(this);
  8880. var d = this;
  8881. return format.replace(/%([a-z%])/gi,
  8882. function($0, $1){
  8883. switch ($1){
  8884. case 'a': return Date.getMsg('days_abbr')[d.get('day')];
  8885. case 'A': return Date.getMsg('days')[d.get('day')];
  8886. case 'b': return Date.getMsg('months_abbr')[d.get('month')];
  8887. case 'B': return Date.getMsg('months')[d.get('month')];
  8888. case 'c': return d.format('%a %b %d %H:%M:%S %Y');
  8889. case 'd': return pad(d.get('date'), 2);
  8890. case 'e': return pad(d.get('date'), 2, ' ');
  8891. case 'H': return pad(d.get('hr'), 2);
  8892. case 'I': return pad((d.get('hr') % 12) || 12, 2);
  8893. case 'j': return pad(d.get('dayofyear'), 3);
  8894. case 'k': return pad(d.get('hr'), 2, ' ');
  8895. case 'l': return pad((d.get('hr') % 12) || 12, 2, ' ');
  8896. case 'L': return pad(d.get('ms'), 3);
  8897. case 'm': return pad((d.get('mo') + 1), 2);
  8898. case 'M': return pad(d.get('min'), 2);
  8899. case 'o': return d.get('ordinal');
  8900. case 'p': return Date.getMsg(d.get('ampm'));
  8901. case 's': return Math.round(d / 1000);
  8902. case 'S': return pad(d.get('seconds'), 2);
  8903. case 'T': return d.format('%H:%M:%S');
  8904. case 'U': return pad(d.get('week'), 2);
  8905. case 'w': return d.get('day');
  8906. case 'x': return d.format(Date.getMsg('shortDate'));
  8907. case 'X': return d.format(Date.getMsg('shortTime'));
  8908. case 'y': return d.get('year').toString().substr(2);
  8909. case 'Y': return d.get('year');
  8910. case 'z': return d.get('GMTOffset');
  8911. case 'Z': return d.get('Timezone');
  8912. }
  8913. return $1;
  8914. }
  8915. );
  8916. },
  8917. toISOString: function(){
  8918. return this.format('iso8601');
  8919. }
  8920. }).alias({
  8921. toJSON: 'toISOString',
  8922. compare: 'diff',
  8923. strftime: 'format'
  8924. });
  8925. // The day and month abbreviations are standardized, so we cannot use simply %a and %b because they will get localized
  8926. var rfcDayAbbr = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8927. rfcMonthAbbr = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
  8928. var formats = {
  8929. db: '%Y-%m-%d %H:%M:%S',
  8930. compact: '%Y%m%dT%H%M%S',
  8931. 'short': '%d %b %H:%M',
  8932. 'long': '%B %d, %Y %H:%M',
  8933. rfc822: function(date){
  8934. return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %Z');
  8935. },
  8936. rfc2822: function(date){
  8937. return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %z');
  8938. },
  8939. iso8601: function(date){
  8940. return (
  8941. date.getUTCFullYear() + '-' +
  8942. pad(date.getUTCMonth() + 1, 2) + '-' +
  8943. pad(date.getUTCDate(), 2) + 'T' +
  8944. pad(date.getUTCHours(), 2) + ':' +
  8945. pad(date.getUTCMinutes(), 2) + ':' +
  8946. pad(date.getUTCSeconds(), 2) + '.' +
  8947. pad(date.getUTCMilliseconds(), 3) + 'Z'
  8948. );
  8949. }
  8950. };
  8951. var parsePatterns = [],
  8952. nativeParse = Date.parse;
  8953. var parseWord = function(type, word, num){
  8954. var ret = -1,
  8955. translated = Date.getMsg(type + 's');
  8956. switch (typeOf(word)){
  8957. case 'object':
  8958. ret = translated[word.get(type)];
  8959. break;
  8960. case 'number':
  8961. ret = translated[word];
  8962. if (!ret) throw new Error('Invalid ' + type + ' index: ' + word);
  8963. break;
  8964. case 'string':
  8965. var match = translated.filter(function(name){
  8966. return this.test(name);
  8967. }, new RegExp('^' + word, 'i'));
  8968. if (!match.length) throw new Error('Invalid ' + type + ' string');
  8969. if (match.length > 1) throw new Error('Ambiguous ' + type);
  8970. ret = match[0];
  8971. }
  8972. return (num) ? translated.indexOf(ret) : ret;
  8973. };
  8974. var startCentury = 1900,
  8975. startYear = 70;
  8976. Date.extend({
  8977. getMsg: function(key, args){
  8978. return Locale.get('Date.' + key, args);
  8979. },
  8980. units: {
  8981. ms: Function.convert(1),
  8982. second: Function.convert(1000),
  8983. minute: Function.convert(60000),
  8984. hour: Function.convert(3600000),
  8985. day: Function.convert(86400000),
  8986. week: Function.convert(608400000),
  8987. month: function(month, year){
  8988. var d = new Date;
  8989. return Date.daysInMonth(month != null ? month : d.get('mo'), year != null ? year : d.get('year')) * 86400000;
  8990. },
  8991. year: function(year){
  8992. year = year || new Date().get('year');
  8993. return Date.isLeapYear(year) ? 31622400000 : 31536000000;
  8994. }
  8995. },
  8996. daysInMonth: function(month, year){
  8997. return [31, Date.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
  8998. },
  8999. isLeapYear: function(year){
  9000. return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);
  9001. },
  9002. parse: function(from){
  9003. var t = typeOf(from);
  9004. if (t == 'number') return new Date(from);
  9005. if (t != 'string') return from;
  9006. from = from.clean();
  9007. if (!from.length) return null;
  9008. var parsed;
  9009. parsePatterns.some(function(pattern){
  9010. var bits = pattern.re.exec(from);
  9011. return (bits) ? (parsed = pattern.handler(bits)) : false;
  9012. });
  9013. if (!(parsed && parsed.isValid())){
  9014. parsed = new Date(nativeParse(from));
  9015. if (!(parsed && parsed.isValid())) parsed = new Date(from.toInt());
  9016. }
  9017. return parsed;
  9018. },
  9019. parseDay: function(day, num){
  9020. return parseWord('day', day, num);
  9021. },
  9022. parseMonth: function(month, num){
  9023. return parseWord('month', month, num);
  9024. },
  9025. parseUTC: function(value){
  9026. var localDate = new Date(value);
  9027. var utcSeconds = Date.UTC(
  9028. localDate.get('year'),
  9029. localDate.get('mo'),
  9030. localDate.get('date'),
  9031. localDate.get('hr'),
  9032. localDate.get('min'),
  9033. localDate.get('sec'),
  9034. localDate.get('ms')
  9035. );
  9036. return new Date(utcSeconds);
  9037. },
  9038. orderIndex: function(unit){
  9039. return Date.getMsg('dateOrder').indexOf(unit) + 1;
  9040. },
  9041. defineFormat: function(name, format){
  9042. formats[name] = format;
  9043. return this;
  9044. },
  9045. //<1.2compat>
  9046. parsePatterns: parsePatterns,
  9047. //</1.2compat>
  9048. defineParser: function(pattern){
  9049. parsePatterns.push((pattern.re && pattern.handler) ? pattern : build(pattern));
  9050. return this;
  9051. },
  9052. defineParsers: function(){
  9053. Array.flatten(arguments).each(Date.defineParser);
  9054. return this;
  9055. },
  9056. define2DigitYearStart: function(year){
  9057. startYear = year % 100;
  9058. startCentury = year - startYear;
  9059. return this;
  9060. }
  9061. }).extend({
  9062. defineFormats: Date.defineFormat.overloadSetter()
  9063. });
  9064. var regexOf = function(type){
  9065. return new RegExp('(?:' + Date.getMsg(type).map(function(name){
  9066. return name.substr(0, 3);
  9067. }).join('|') + ')[a-z]*');
  9068. };
  9069. var replacers = function(key){
  9070. switch (key){
  9071. case 'T':
  9072. return '%H:%M:%S';
  9073. case 'x': // iso8601 covers yyyy-mm-dd, so just check if month is first
  9074. return ((Date.orderIndex('month') == 1) ? '%m[-./]%d' : '%d[-./]%m') + '([-./]%y)?';
  9075. case 'X':
  9076. return '%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%z?';
  9077. }
  9078. return null;
  9079. };
  9080. var keys = {
  9081. d: /[0-2]?[0-9]|3[01]/,
  9082. H: /[01]?[0-9]|2[0-3]/,
  9083. I: /0?[1-9]|1[0-2]/,
  9084. M: /[0-5]?\d/,
  9085. s: /\d+/,
  9086. o: /[a-z]*/,
  9087. p: /[ap]\.?m\.?/,
  9088. y: /\d{2}|\d{4}/,
  9089. Y: /\d{4}/,
  9090. z: /Z|[+-]\d{2}(?::?\d{2})?/
  9091. };
  9092. keys.m = keys.I;
  9093. keys.S = keys.M;
  9094. var currentLanguage;
  9095. var recompile = function(language){
  9096. currentLanguage = language;
  9097. keys.a = keys.A = regexOf('days');
  9098. keys.b = keys.B = regexOf('months');
  9099. parsePatterns.each(function(pattern, i){
  9100. if (pattern.format) parsePatterns[i] = build(pattern.format);
  9101. });
  9102. };
  9103. var build = function(format){
  9104. if (!currentLanguage) return {format: format};
  9105. var parsed = [];
  9106. var re = (format.source || format) // allow format to be regex
  9107. .replace(/%([a-z])/gi,
  9108. function($0, $1){
  9109. return replacers($1) || $0;
  9110. }
  9111. ).replace(/\((?!\?)/g, '(?:') // make all groups non-capturing
  9112. .replace(/ (?!\?|\*)/g, ',? ') // be forgiving with spaces and commas
  9113. .replace(/%([a-z%])/gi,
  9114. function($0, $1){
  9115. var p = keys[$1];
  9116. if (!p) return $1;
  9117. parsed.push($1);
  9118. return '(' + p.source + ')';
  9119. }
  9120. ).replace(/\[a-z\]/gi, '[a-z\\u00c0-\\uffff;\&]'); // handle unicode words
  9121. return {
  9122. format: format,
  9123. re: new RegExp('^' + re + '$', 'i'),
  9124. handler: function(bits){
  9125. bits = bits.slice(1).associate(parsed);
  9126. var date = new Date().clearTime(),
  9127. year = bits.y || bits.Y;
  9128. if (year != null) handle.call(date, 'y', year); // need to start in the right year
  9129. if ('d' in bits) handle.call(date, 'd', 1);
  9130. if ('m' in bits || bits.b || bits.B) handle.call(date, 'm', 1);
  9131. for (var key in bits) handle.call(date, key, bits[key]);
  9132. return date;
  9133. }
  9134. };
  9135. };
  9136. var handle = function(key, value){
  9137. if (!value) return this;
  9138. switch (key){
  9139. case 'a': case 'A': return this.set('day', Date.parseDay(value, true));
  9140. case 'b': case 'B': return this.set('mo', Date.parseMonth(value, true));
  9141. case 'd': return this.set('date', value);
  9142. case 'H': case 'I': return this.set('hr', value);
  9143. case 'm': return this.set('mo', value - 1);
  9144. case 'M': return this.set('min', value);
  9145. case 'p': return this.set('ampm', value.replace(/\./g, ''));
  9146. case 'S': return this.set('sec', value);
  9147. case 's': return this.set('ms', ('0.' + value) * 1000);
  9148. case 'w': return this.set('day', value);
  9149. case 'Y': return this.set('year', value);
  9150. case 'y':
  9151. value = +value;
  9152. if (value < 100) value += startCentury + (value < startYear ? 100 : 0);
  9153. return this.set('year', value);
  9154. case 'z':
  9155. if (value == 'Z') value = '+00';
  9156. var offset = value.match(/([+-])(\d{2}):?(\d{2})?/);
  9157. offset = (offset[1] + '1') * (offset[2] * 60 + (+offset[3] || 0)) + this.getTimezoneOffset();
  9158. return this.set('time', this - offset * 60000);
  9159. }
  9160. return this;
  9161. };
  9162. Date.defineParsers(
  9163. '%Y([-./]%m([-./]%d((T| )%X)?)?)?', // "1999-12-31", "1999-12-31 11:59pm", "1999-12-31 23:59:59", ISO8601
  9164. '%Y%m%d(T%H(%M%S?)?)?', // "19991231", "19991231T1159", compact
  9165. '%x( %X)?', // "12/31", "12.31.99", "12-31-1999", "12/31/2008 11:59 PM"
  9166. '%d%o( %b( %Y)?)?( %X)?', // "31st", "31st December", "31 Dec 1999", "31 Dec 1999 11:59pm"
  9167. '%b( %d%o)?( %Y)?( %X)?', // Same as above with month and day switched
  9168. '%Y %b( %d%o( %X)?)?', // Same as above with year coming first
  9169. '%o %b %d %X %z %Y', // "Thu Oct 22 08:11:23 +0000 2009"
  9170. '%T', // %H:%M:%S
  9171. '%H:%M( ?%p)?' // "11:05pm", "11:05 am" and "11:05"
  9172. );
  9173. Locale.addEvent('change', function(language){
  9174. if (Locale.get('Date')) recompile(language);
  9175. }).fireEvent('change', Locale.getCurrent());
  9176. })();
  9177. /*
  9178. ---
  9179. name: Locale.en-US.Form.Validator
  9180. description: Form Validator messages for English.
  9181. license: MIT-style license
  9182. authors:
  9183. - Aaron Newton
  9184. requires:
  9185. - Locale
  9186. provides: [Locale.en-US.Form.Validator]
  9187. ...
  9188. */
  9189. Locale.define('en-US', 'FormValidator', {
  9190. required: 'This field is required.',
  9191. length: 'Please enter {length} characters (you entered {elLength} characters)',
  9192. minLength: 'Please enter at least {minLength} characters (you entered {length} characters).',
  9193. maxLength: 'Please enter no more than {maxLength} characters (you entered {length} characters).',
  9194. integer: 'Please enter an integer in this field. Numbers with decimals (e.g. 1.25) are not permitted.',
  9195. numeric: 'Please enter only numeric values in this field (i.e. "1" or "1.1" or "-1" or "-1.1").',
  9196. digits: 'Please use numbers and punctuation only in this field (for example, a phone number with dashes or dots is permitted).',
  9197. alpha: 'Please use only letters (a-z) within this field. No spaces or other characters are allowed.',
  9198. alphanum: 'Please use only letters (a-z) or numbers (0-9) in this field. No spaces or other characters are allowed.',
  9199. dateSuchAs: 'Please enter a valid date such as {date}',
  9200. dateInFormatMDY: 'Please enter a valid date such as MM/DD/YYYY (i.e. "12/31/1999")',
  9201. email: 'Please enter a valid email address. For example "fred@domain.com".',
  9202. url: 'Please enter a valid URL such as http://www.example.com.',
  9203. currencyDollar: 'Please enter a valid $ amount. For example $100.00 .',
  9204. oneRequired: 'Please enter something for at least one of these inputs.',
  9205. errorPrefix: 'Error: ',
  9206. warningPrefix: 'Warning: ',
  9207. // Form.Validator.Extras
  9208. noSpace: 'There can be no spaces in this input.',
  9209. reqChkByNode: 'No items are selected.',
  9210. requiredChk: 'This field is required.',
  9211. reqChkByName: 'Please select a {label}.',
  9212. match: 'This field needs to match the {matchName} field',
  9213. startDate: 'the start date',
  9214. endDate: 'the end date',
  9215. currentDate: 'the current date',
  9216. afterDate: 'The date should be the same or after {label}.',
  9217. beforeDate: 'The date should be the same or before {label}.',
  9218. startMonth: 'Please select a start month',
  9219. sameMonth: 'These two dates must be in the same month - you must change one or the other.',
  9220. creditcard: 'The credit card number entered is invalid. Please check the number and try again. {length} digits entered.'
  9221. });
  9222. /*
  9223. ---
  9224. script: Form.Validator.js
  9225. name: Form.Validator
  9226. description: A css-class based form validation system.
  9227. license: MIT-style license
  9228. authors:
  9229. - Aaron Newton
  9230. requires:
  9231. - Core/Options
  9232. - Core/Events
  9233. - Core/Element.Delegation
  9234. - Core/Slick.Finder
  9235. - Core/Element.Event
  9236. - Core/Element.Style
  9237. - Core/JSON
  9238. - Locale
  9239. - Class.Binds
  9240. - Date
  9241. - Element.Forms
  9242. - Locale.en-US.Form.Validator
  9243. - Element.Shortcuts
  9244. provides: [Form.Validator, InputValidator, FormValidator.BaseValidators]
  9245. ...
  9246. */
  9247. if (!window.Form) window.Form = {};
  9248. var InputValidator = this.InputValidator = new Class({
  9249. Implements: [Options],
  9250. options: {
  9251. errorMsg: 'Validation failed.',
  9252. test: Function.convert(true)
  9253. },
  9254. initialize: function(className, options){
  9255. this.setOptions(options);
  9256. this.className = className;
  9257. },
  9258. test: function(field, props){
  9259. field = document.id(field);
  9260. return (field) ? this.options.test(field, props || this.getProps(field)) : false;
  9261. },
  9262. getError: function(field, props){
  9263. field = document.id(field);
  9264. var err = this.options.errorMsg;
  9265. if (typeOf(err) == 'function') err = err(field, props || this.getProps(field));
  9266. return err;
  9267. },
  9268. getProps: function(field){
  9269. field = document.id(field);
  9270. return (field) ? field.get('validatorProps') : {};
  9271. }
  9272. });
  9273. Element.Properties.validators = {
  9274. get: function(){
  9275. return (this.get('data-validators') || this.className).clean().replace(/'(\\.|[^'])*'|"(\\.|[^"])*"/g, function(match){
  9276. return match.replace(' ', '\\x20');
  9277. }).split(' ');
  9278. }
  9279. };
  9280. Element.Properties.validatorProps = {
  9281. set: function(props){
  9282. return this.eliminate('$moo:validatorProps').store('$moo:validatorProps', props);
  9283. },
  9284. get: function(props){
  9285. if (props) this.set(props);
  9286. if (this.retrieve('$moo:validatorProps')) return this.retrieve('$moo:validatorProps');
  9287. if (this.getProperty('data-validator-properties') || this.getProperty('validatorProps')){
  9288. try {
  9289. this.store('$moo:validatorProps', JSON.decode(this.getProperty('validatorProps') || this.getProperty('data-validator-properties'), false));
  9290. } catch (e){
  9291. return {};
  9292. }
  9293. } else {
  9294. var vals = this.get('validators').filter(function(cls){
  9295. return cls.test(':');
  9296. });
  9297. if (!vals.length){
  9298. this.store('$moo:validatorProps', {});
  9299. } else {
  9300. props = {};
  9301. vals.each(function(cls){
  9302. var split = cls.split(':');
  9303. if (split[1]){
  9304. try {
  9305. props[split[0]] = JSON.decode(split[1], false);
  9306. } catch (e){}
  9307. }
  9308. });
  9309. this.store('$moo:validatorProps', props);
  9310. }
  9311. }
  9312. return this.retrieve('$moo:validatorProps');
  9313. }
  9314. };
  9315. Form.Validator = new Class({
  9316. Implements: [Options, Events],
  9317. options: {/*
  9318. onFormValidate: function(isValid, form, event){},
  9319. onElementValidate: function(isValid, field, className, warn){},
  9320. onElementPass: function(field){},
  9321. onElementFail: function(field, validatorsFailed){}, */
  9322. fieldSelectors: 'input, select, textarea',
  9323. ignoreHidden: true,
  9324. ignoreDisabled: true,
  9325. useTitles: false,
  9326. evaluateOnSubmit: true,
  9327. evaluateFieldsOnBlur: true,
  9328. evaluateFieldsOnChange: true,
  9329. serial: true,
  9330. stopOnFailure: true,
  9331. warningPrefix: function(){
  9332. return Form.Validator.getMsg('warningPrefix') || 'Warning: ';
  9333. },
  9334. errorPrefix: function(){
  9335. return Form.Validator.getMsg('errorPrefix') || 'Error: ';
  9336. }
  9337. },
  9338. initialize: function(form, options){
  9339. this.setOptions(options);
  9340. this.element = document.id(form);
  9341. this.warningPrefix = Function.convert(this.options.warningPrefix)();
  9342. this.errorPrefix = Function.convert(this.options.errorPrefix)();
  9343. this._bound = {
  9344. onSubmit: this.onSubmit.bind(this),
  9345. blurOrChange: function(event, field){
  9346. this.validationMonitor(field, true);
  9347. }.bind(this)
  9348. };
  9349. this.enable();
  9350. },
  9351. toElement: function(){
  9352. return this.element;
  9353. },
  9354. getFields: function(){
  9355. return (this.fields = this.element.getElements(this.options.fieldSelectors));
  9356. },
  9357. enable: function(){
  9358. this.element.store('validator', this);
  9359. if (this.options.evaluateOnSubmit) this.element.addEvent('submit', this._bound.onSubmit);
  9360. if (this.options.evaluateFieldsOnBlur){
  9361. this.element.addEvent('blur:relay(input,select,textarea)', this._bound.blurOrChange);
  9362. }
  9363. if (this.options.evaluateFieldsOnChange){
  9364. this.element.addEvent('change:relay(input,select,textarea)', this._bound.blurOrChange);
  9365. }
  9366. },
  9367. disable: function(){
  9368. this.element.eliminate('validator');
  9369. this.element.removeEvents({
  9370. submit: this._bound.onSubmit,
  9371. 'blur:relay(input,select,textarea)': this._bound.blurOrChange,
  9372. 'change:relay(input,select,textarea)': this._bound.blurOrChange
  9373. });
  9374. },
  9375. validationMonitor: function(){
  9376. clearTimeout(this.timer);
  9377. this.timer = this.validateField.delay(50, this, arguments);
  9378. },
  9379. onSubmit: function(event){
  9380. if (this.validate(event)) this.reset();
  9381. },
  9382. reset: function(){
  9383. this.getFields().each(this.resetField, this);
  9384. return this;
  9385. },
  9386. validate: function(event){
  9387. var result = this.getFields().map(function(field){
  9388. return this.validateField(field, true);
  9389. }, this).every(function(v){
  9390. return v;
  9391. });
  9392. this.fireEvent('formValidate', [result, this.element, event]);
  9393. if (this.options.stopOnFailure && !result && event) event.preventDefault();
  9394. return result;
  9395. },
  9396. validateField: function(field, force){
  9397. if (this.paused) return true;
  9398. field = document.id(field);
  9399. var passed = !field.hasClass('validation-failed');
  9400. var failed, warned;
  9401. if (this.options.serial && !force){
  9402. failed = this.element.getElement('.validation-failed');
  9403. warned = this.element.getElement('.warning');
  9404. }
  9405. if (field && (!failed || force || field.hasClass('validation-failed') || (failed && !this.options.serial))){
  9406. var validationTypes = field.get('validators');
  9407. var validators = validationTypes.some(function(cn){
  9408. return this.getValidator(cn);
  9409. }, this);
  9410. var validatorsFailed = [];
  9411. validationTypes.each(function(className){
  9412. if (className && !this.test(className, field)) validatorsFailed.include(className);
  9413. }, this);
  9414. passed = validatorsFailed.length === 0;
  9415. if (validators && !this.hasValidator(field, 'warnOnly')){
  9416. if (passed){
  9417. field.addClass('validation-passed').removeClass('validation-failed');
  9418. this.fireEvent('elementPass', [field]);
  9419. } else {
  9420. field.addClass('validation-failed').removeClass('validation-passed');
  9421. this.fireEvent('elementFail', [field, validatorsFailed]);
  9422. }
  9423. }
  9424. if (!warned){
  9425. var warnings = validationTypes.some(function(cn){
  9426. if (cn.test('^warn'))
  9427. return this.getValidator(cn.replace(/^warn-/,''));
  9428. else return null;
  9429. }, this);
  9430. field.removeClass('warning');
  9431. var warnResult = validationTypes.map(function(cn){
  9432. if (cn.test('^warn'))
  9433. return this.test(cn.replace(/^warn-/,''), field, true);
  9434. else return null;
  9435. }, this);
  9436. }
  9437. }
  9438. return passed;
  9439. },
  9440. test: function(className, field, warn){
  9441. field = document.id(field);
  9442. if ((this.options.ignoreHidden && !field.isVisible()) || (this.options.ignoreDisabled && field.get('disabled'))) return true;
  9443. var validator = this.getValidator(className);
  9444. if (warn != null) warn = false;
  9445. if (this.hasValidator(field, 'warnOnly')) warn = true;
  9446. var isValid = field.hasClass('ignoreValidation') || (validator ? validator.test(field) : true);
  9447. if (validator) this.fireEvent('elementValidate', [isValid, field, className, warn]);
  9448. if (warn) return true;
  9449. return isValid;
  9450. },
  9451. hasValidator: function(field, value){
  9452. return field.get('validators').contains(value);
  9453. },
  9454. resetField: function(field){
  9455. field = document.id(field);
  9456. if (field){
  9457. field.get('validators').each(function(className){
  9458. if (className.test('^warn-')) className = className.replace(/^warn-/, '');
  9459. field.removeClass('validation-failed');
  9460. field.removeClass('warning');
  9461. field.removeClass('validation-passed');
  9462. }, this);
  9463. }
  9464. return this;
  9465. },
  9466. stop: function(){
  9467. this.paused = true;
  9468. return this;
  9469. },
  9470. start: function(){
  9471. this.paused = false;
  9472. return this;
  9473. },
  9474. ignoreField: function(field, warn){
  9475. field = document.id(field);
  9476. if (field){
  9477. this.enforceField(field);
  9478. if (warn) field.addClass('warnOnly');
  9479. else field.addClass('ignoreValidation');
  9480. }
  9481. return this;
  9482. },
  9483. enforceField: function(field){
  9484. field = document.id(field);
  9485. if (field) field.removeClass('warnOnly').removeClass('ignoreValidation');
  9486. return this;
  9487. }
  9488. });
  9489. Form.Validator.getMsg = function(key){
  9490. return Locale.get('FormValidator.' + key);
  9491. };
  9492. Form.Validator.adders = {
  9493. validators:{},
  9494. add : function(className, options){
  9495. this.validators[className] = new InputValidator(className, options);
  9496. //if this is a class (this method is used by instances of Form.Validator and the Form.Validator namespace)
  9497. //extend these validators into it
  9498. //this allows validators to be global and/or per instance
  9499. if (!this.initialize){
  9500. this.implement({
  9501. validators: this.validators
  9502. });
  9503. }
  9504. },
  9505. addAllThese : function(validators){
  9506. Array.convert(validators).each(function(validator){
  9507. this.add(validator[0], validator[1]);
  9508. }, this);
  9509. },
  9510. getValidator: function(className){
  9511. return this.validators[className.split(':')[0]];
  9512. }
  9513. };
  9514. Object.append(Form.Validator, Form.Validator.adders);
  9515. Form.Validator.implement(Form.Validator.adders);
  9516. Form.Validator.add('IsEmpty', {
  9517. errorMsg: false,
  9518. test: function(element){
  9519. if (element.type == 'select-one' || element.type == 'select')
  9520. return !(element.selectedIndex >= 0 && element.options[element.selectedIndex].value != '');
  9521. else
  9522. return ((element.get('value') == null) || (element.get('value').length == 0));
  9523. }
  9524. });
  9525. Form.Validator.addAllThese([
  9526. ['required', {
  9527. errorMsg: function(){
  9528. return Form.Validator.getMsg('required');
  9529. },
  9530. test: function(element){
  9531. return !Form.Validator.getValidator('IsEmpty').test(element);
  9532. }
  9533. }],
  9534. ['length', {
  9535. errorMsg: function(element, props){
  9536. if (typeOf(props.length) != 'null')
  9537. return Form.Validator.getMsg('length').substitute({length: props.length, elLength: element.get('value').length});
  9538. else return '';
  9539. },
  9540. test: function(element, props){
  9541. if (typeOf(props.length) != 'null') return (element.get('value').length == props.length || element.get('value').length == 0);
  9542. else return true;
  9543. }
  9544. }],
  9545. ['minLength', {
  9546. errorMsg: function(element, props){
  9547. if (typeOf(props.minLength) != 'null')
  9548. return Form.Validator.getMsg('minLength').substitute({minLength: props.minLength, length: element.get('value').length});
  9549. else return '';
  9550. },
  9551. test: function(element, props){
  9552. if (typeOf(props.minLength) != 'null') return (element.get('value').length >= (props.minLength || 0));
  9553. else return true;
  9554. }
  9555. }],
  9556. ['maxLength', {
  9557. errorMsg: function(element, props){
  9558. //props is {maxLength:10}
  9559. if (typeOf(props.maxLength) != 'null')
  9560. return Form.Validator.getMsg('maxLength').substitute({maxLength: props.maxLength, length: element.get('value').length});
  9561. else return '';
  9562. },
  9563. test: function(element, props){
  9564. return element.get('value').length <= (props.maxLength || 10000);
  9565. }
  9566. }],
  9567. ['validate-integer', {
  9568. errorMsg: Form.Validator.getMsg.pass('integer'),
  9569. test: function(element){
  9570. return Form.Validator.getValidator('IsEmpty').test(element) || (/^(-?[1-9]\d*|0)$/).test(element.get('value'));
  9571. }
  9572. }],
  9573. ['validate-numeric', {
  9574. errorMsg: Form.Validator.getMsg.pass('numeric'),
  9575. test: function(element){
  9576. return Form.Validator.getValidator('IsEmpty').test(element) ||
  9577. (/^-?(?:0$0(?=\d*\.)|[1-9]|0)\d*(\.\d+)?$/).test(element.get('value'));
  9578. }
  9579. }],
  9580. ['validate-digits', {
  9581. errorMsg: Form.Validator.getMsg.pass('digits'),
  9582. test: function(element){
  9583. return Form.Validator.getValidator('IsEmpty').test(element) || (/^[\d() .:\-\+#]+$/.test(element.get('value')));
  9584. }
  9585. }],
  9586. ['validate-alpha', {
  9587. errorMsg: Form.Validator.getMsg.pass('alpha'),
  9588. test: function(element){
  9589. return Form.Validator.getValidator('IsEmpty').test(element) || (/^[a-zA-Z]+$/).test(element.get('value'));
  9590. }
  9591. }],
  9592. ['validate-alphanum', {
  9593. errorMsg: Form.Validator.getMsg.pass('alphanum'),
  9594. test: function(element){
  9595. return Form.Validator.getValidator('IsEmpty').test(element) || !(/\W/).test(element.get('value'));
  9596. }
  9597. }],
  9598. ['validate-date', {
  9599. errorMsg: function(element, props){
  9600. if (Date.parse){
  9601. var format = props.dateFormat || '%x';
  9602. return Form.Validator.getMsg('dateSuchAs').substitute({date: new Date().format(format)});
  9603. } else {
  9604. return Form.Validator.getMsg('dateInFormatMDY');
  9605. }
  9606. },
  9607. test: function(element, props){
  9608. if (Form.Validator.getValidator('IsEmpty').test(element)) return true;
  9609. var dateLocale = Locale.get('Date'),
  9610. dateNouns = new RegExp([dateLocale.days, dateLocale.days_abbr, dateLocale.months, dateLocale.months_abbr, dateLocale.AM, dateLocale.PM].flatten().join('|'), 'i'),
  9611. value = element.get('value'),
  9612. wordsInValue = value.match(/[a-z]+/gi);
  9613. if (wordsInValue && !wordsInValue.every(dateNouns.exec, dateNouns)) return false;
  9614. var date = Date.parse(value);
  9615. if (!date) return false;
  9616. var format = props.dateFormat || '%x',
  9617. formatted = date.format(format);
  9618. if (formatted != 'invalid date') element.set('value', formatted);
  9619. return date.isValid();
  9620. }
  9621. }],
  9622. ['validate-email', {
  9623. errorMsg: Form.Validator.getMsg.pass('email'),
  9624. test: function(element){
  9625. /*
  9626. var chars = "[a-z0-9!#$%&'*+/=?^_`{|}~-]",
  9627. local = '(?:' + chars + '\\.?){0,63}' + chars,
  9628. label = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?',
  9629. hostname = '(?:' + label + '\\.)*' + label;
  9630. octet = '(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',
  9631. ipv4 = '\\[(?:' + octet + '\\.){3}' + octet + '\\]',
  9632. domain = '(?:' + hostname + '|' + ipv4 + ')';
  9633. var regex = new RegExp('^' + local + '@' + domain + '$', 'i');
  9634. */
  9635. 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'));
  9636. }
  9637. }],
  9638. ['validate-url', {
  9639. errorMsg: Form.Validator.getMsg.pass('url'),
  9640. test: function(element){
  9641. 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'));
  9642. }
  9643. }],
  9644. ['validate-currency-dollar', {
  9645. errorMsg: Form.Validator.getMsg.pass('currencyDollar'),
  9646. test: function(element){
  9647. 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'));
  9648. }
  9649. }],
  9650. ['validate-one-required', {
  9651. errorMsg: Form.Validator.getMsg.pass('oneRequired'),
  9652. test: function(element, props){
  9653. var p = document.id(props['validate-one-required']) || element.getParent(props['validate-one-required']);
  9654. return p.getElements('input').some(function(el){
  9655. if (['checkbox', 'radio'].contains(el.get('type'))) return el.get('checked');
  9656. return el.get('value');
  9657. });
  9658. }
  9659. }]
  9660. ]);
  9661. Element.Properties.validator = {
  9662. set: function(options){
  9663. this.get('validator').setOptions(options);
  9664. },
  9665. get: function(){
  9666. var validator = this.retrieve('validator');
  9667. if (!validator){
  9668. validator = new Form.Validator(this);
  9669. this.store('validator', validator);
  9670. }
  9671. return validator;
  9672. }
  9673. };
  9674. Element.implement({
  9675. validate: function(options){
  9676. if (options) this.set('validator', options);
  9677. return this.get('validator').validate();
  9678. }
  9679. });
  9680. //<1.2compat>
  9681. //legacy
  9682. var FormValidator = Form.Validator;
  9683. //</1.2compat>
  9684. /*
  9685. ---
  9686. script: Form.Validator.Extras.js
  9687. name: Form.Validator.Extras
  9688. description: Additional validators for the Form.Validator class.
  9689. license: MIT-style license
  9690. authors:
  9691. - Aaron Newton
  9692. requires:
  9693. - Form.Validator
  9694. provides: [Form.Validator.Extras]
  9695. ...
  9696. */
  9697. (function(){
  9698. function getItems(props, preference, children, cssSelector){
  9699. if (preference && props[preference]) return props[preference];
  9700. var el = document.id(props[children]);
  9701. if (!el) return [];
  9702. return el.getElements(cssSelector);
  9703. }
  9704. Form.Validator.addAllThese([
  9705. ['validate-enforce-oncheck', {
  9706. test: function(element, props){
  9707. var fv = element.getParent('form').retrieve('validator');
  9708. if (!fv) return true;
  9709. getItems(props, 'toEnforce', 'enforceChildrenOf', 'input, select, textarea').each(function(item){
  9710. if (element.checked){
  9711. fv.enforceField(item);
  9712. } else {
  9713. fv.ignoreField(item);
  9714. fv.resetField(item);
  9715. }
  9716. });
  9717. return true;
  9718. }
  9719. }],
  9720. ['validate-ignore-oncheck', {
  9721. test: function(element, props){
  9722. var fv = element.getParent('form').retrieve('validator');
  9723. if (!fv) return true;
  9724. getItems(props, 'toIgnore', 'ignoreChildrenOf', 'input, select, textarea').each(function(item){
  9725. if (element.checked){
  9726. fv.ignoreField(item);
  9727. fv.resetField(item);
  9728. } else {
  9729. fv.enforceField(item);
  9730. }
  9731. });
  9732. return true;
  9733. }
  9734. }],
  9735. ['validate-enforce-onselect-value', {
  9736. test: function(element, props){
  9737. if (!props.value) return true;
  9738. var fv = element.getParent('form').retrieve('validator');
  9739. if (!fv) return true;
  9740. getItems(props, 'toEnforce', 'enforceChildrenOf', 'input, select, textarea').each(function(item){
  9741. if (props.value == element.value){
  9742. fv.enforceField(item);
  9743. } else {
  9744. fv.ignoreField(item);
  9745. fv.resetField(item);
  9746. }
  9747. });
  9748. return true;
  9749. }
  9750. }],
  9751. ['validate-nospace', {
  9752. errorMsg: function(){
  9753. return Form.Validator.getMsg('noSpace');
  9754. },
  9755. test: function(element, props){
  9756. return !element.get('value').test(/\s/);
  9757. }
  9758. }],
  9759. ['validate-toggle-oncheck', {
  9760. test: function(element, props){
  9761. var fv = element.getParent('form').retrieve('validator');
  9762. if (!fv) return true;
  9763. var eleArr = getItems(props, 'toToggle', 'toToggleChildrenOf', 'input, select, textarea');
  9764. if (!element.checked){
  9765. eleArr.each(function(item){
  9766. fv.ignoreField(item);
  9767. fv.resetField(item);
  9768. });
  9769. } else {
  9770. eleArr.each(function(item){
  9771. fv.enforceField(item);
  9772. });
  9773. }
  9774. return true;
  9775. }
  9776. }],
  9777. ['validate-reqchk-bynode', {
  9778. errorMsg: function(){
  9779. return Form.Validator.getMsg('reqChkByNode');
  9780. },
  9781. test: function(element, props){
  9782. return getItems(props, false, 'nodeId', props.selector || 'input[type=checkbox], input[type=radio]').some(function(item){
  9783. return item.checked;
  9784. });
  9785. }
  9786. }],
  9787. ['validate-required-check', {
  9788. errorMsg: function(element, props){
  9789. return props.useTitle ? element.get('title') : Form.Validator.getMsg('requiredChk');
  9790. },
  9791. test: function(element, props){
  9792. return !!element.checked;
  9793. }
  9794. }],
  9795. ['validate-reqchk-byname', {
  9796. errorMsg: function(element, props){
  9797. return Form.Validator.getMsg('reqChkByName').substitute({label: props.label || element.get('type')});
  9798. },
  9799. test: function(element, props){
  9800. var grpName = props.groupName || element.get('name');
  9801. var grpNameEls = $$('[name=' + grpName +']');
  9802. var oneCheckedItem = grpNameEls.some(function(item, index){
  9803. return item.checked;
  9804. });
  9805. var fv = element.getParent('form').retrieve('validator');
  9806. if (oneCheckedItem && fv){
  9807. grpNameEls.each(function(item, index){ fv.resetField(item); });
  9808. }
  9809. return oneCheckedItem;
  9810. }
  9811. }],
  9812. ['validate-match', {
  9813. errorMsg: function(element, props){
  9814. return Form.Validator.getMsg('match').substitute({matchName: decodeURIComponent((props.matchName+'').replace(/\+/g, '%20')) || document.id(props.matchInput).get('name')});
  9815. },
  9816. test: function(element, props){
  9817. var eleVal = element.get('value');
  9818. var matchVal = document.id(props.matchInput) && document.id(props.matchInput).get('value');
  9819. return eleVal && matchVal ? eleVal == matchVal : true;
  9820. }
  9821. }],
  9822. ['validate-after-date', {
  9823. errorMsg: function(element, props){
  9824. return Form.Validator.getMsg('afterDate').substitute({
  9825. label: props.afterLabel || (props.afterElement ? Form.Validator.getMsg('startDate') : Form.Validator.getMsg('currentDate'))
  9826. });
  9827. },
  9828. test: function(element, props){
  9829. var start = document.id(props.afterElement) ? Date.parse(document.id(props.afterElement).get('value')) : new Date();
  9830. var end = Date.parse(element.get('value'));
  9831. return end && start ? end >= start : true;
  9832. }
  9833. }],
  9834. ['validate-before-date', {
  9835. errorMsg: function(element, props){
  9836. return Form.Validator.getMsg('beforeDate').substitute({
  9837. label: props.beforeLabel || (props.beforeElement ? Form.Validator.getMsg('endDate') : Form.Validator.getMsg('currentDate'))
  9838. });
  9839. },
  9840. test: function(element, props){
  9841. var start = Date.parse(element.get('value'));
  9842. var end = document.id(props.beforeElement) ? Date.parse(document.id(props.beforeElement).get('value')) : new Date();
  9843. return end && start ? end >= start : true;
  9844. }
  9845. }],
  9846. ['validate-custom-required', {
  9847. errorMsg: function(){
  9848. return Form.Validator.getMsg('required');
  9849. },
  9850. test: function(element, props){
  9851. return element.get('value') != props.emptyValue;
  9852. }
  9853. }],
  9854. ['validate-same-month', {
  9855. errorMsg: function(element, props){
  9856. var startMo = document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value');
  9857. var eleVal = element.get('value');
  9858. if (eleVal != '') return Form.Validator.getMsg(startMo ? 'sameMonth' : 'startMonth');
  9859. },
  9860. test: function(element, props){
  9861. var d1 = Date.parse(element.get('value'));
  9862. var d2 = Date.parse(document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value'));
  9863. return d1 && d2 ? d1.format('%B') == d2.format('%B') : true;
  9864. }
  9865. }],
  9866. ['validate-cc-num', {
  9867. errorMsg: function(element){
  9868. var ccNum = element.get('value').replace(/[^0-9]/g, '');
  9869. return Form.Validator.getMsg('creditcard').substitute({length: ccNum.length});
  9870. },
  9871. test: function(element){
  9872. // required is a different test
  9873. if (Form.Validator.getValidator('IsEmpty').test(element)) return true;
  9874. // Clean number value
  9875. var ccNum = element.get('value');
  9876. ccNum = ccNum.replace(/[^0-9]/g, '');
  9877. var validType = false;
  9878. if (ccNum.test(/^4[0-9]{12}([0-9]{3})?$/)) validType = 'Visa';
  9879. else if (ccNum.test(/^5[1-5]([0-9]{14})$/)) validType = 'Master Card';
  9880. else if (ccNum.test(/^3[47][0-9]{13}$/)) validType = 'American Express';
  9881. else if (ccNum.test(/^6(?:011|5[0-9]{2})[0-9]{12}$/)) validType = 'Discover';
  9882. else if (ccNum.test(/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/)) validType = 'Diners Club';
  9883. if (validType){
  9884. var sum = 0;
  9885. var cur = 0;
  9886. for (var i=ccNum.length-1; i>=0; --i){
  9887. cur = ccNum.charAt(i).toInt();
  9888. if (cur == 0) continue;
  9889. if ((ccNum.length-i) % 2 == 0) cur += cur;
  9890. if (cur > 9){
  9891. cur = cur.toString().charAt(0).toInt() + cur.toString().charAt(1).toInt();
  9892. }
  9893. sum += cur;
  9894. }
  9895. if ((sum % 10) == 0) return true;
  9896. }
  9897. var chunks = '';
  9898. while (ccNum != ''){
  9899. chunks += ' ' + ccNum.substr(0,4);
  9900. ccNum = ccNum.substr(4);
  9901. }
  9902. element.getParent('form').retrieve('validator').ignoreField(element);
  9903. element.set('value', chunks.clean());
  9904. element.getParent('form').retrieve('validator').enforceField(element);
  9905. return false;
  9906. }
  9907. }]
  9908. ]);
  9909. })();
  9910. /*
  9911. ---
  9912. script: Form.Validator.Inline.js
  9913. name: Form.Validator.Inline
  9914. description: Extends Form.Validator to add inline messages.
  9915. license: MIT-style license
  9916. authors:
  9917. - Aaron Newton
  9918. requires:
  9919. - Form.Validator
  9920. provides: [Form.Validator.Inline]
  9921. ...
  9922. */
  9923. Form.Validator.Inline = new Class({
  9924. Extends: Form.Validator,
  9925. options: {
  9926. showError: function(errorElement){
  9927. if (errorElement.reveal) errorElement.reveal();
  9928. else errorElement.setStyle('display', 'block');
  9929. },
  9930. hideError: function(errorElement){
  9931. if (errorElement.dissolve) errorElement.dissolve();
  9932. else errorElement.setStyle('display', 'none');
  9933. },
  9934. scrollToErrorsOnSubmit: true,
  9935. scrollToErrorsOnBlur: false,
  9936. scrollToErrorsOnChange: false,
  9937. scrollFxOptions: {
  9938. transition: 'quad:out',
  9939. offset: {
  9940. y: -20
  9941. }
  9942. }
  9943. },
  9944. initialize: function(form, options){
  9945. this.parent(form, options);
  9946. this.addEvent('onElementValidate', function(isValid, field, className, warn){
  9947. var validator = this.getValidator(className);
  9948. if (!isValid && validator.getError(field)){
  9949. if (warn) field.addClass('warning');
  9950. var advice = this.makeAdvice(className, field, validator.getError(field), warn);
  9951. this.insertAdvice(advice, field);
  9952. this.showAdvice(className, field);
  9953. } else {
  9954. this.hideAdvice(className, field);
  9955. }
  9956. });
  9957. },
  9958. makeAdvice: function(className, field, error, warn){
  9959. var errorMsg = (warn) ? this.warningPrefix : this.errorPrefix;
  9960. errorMsg += (this.options.useTitles) ? field.title || error:error;
  9961. var cssClass = (warn) ? 'warning-advice' : 'validation-advice';
  9962. var advice = this.getAdvice(className, field);
  9963. if (advice){
  9964. advice = advice.set('html', errorMsg);
  9965. } else {
  9966. advice = new Element('div', {
  9967. html: errorMsg,
  9968. styles: { display: 'none' },
  9969. id: 'advice-' + className.split(':')[0] + '-' + this.getFieldId(field)
  9970. }).addClass(cssClass);
  9971. }
  9972. field.store('$moo:advice-' + className, advice);
  9973. return advice;
  9974. },
  9975. getFieldId : function(field){
  9976. return field.id ? field.id : field.id = 'input_' + field.name;
  9977. },
  9978. showAdvice: function(className, field){
  9979. var advice = this.getAdvice(className, field);
  9980. if (
  9981. advice &&
  9982. !field.retrieve('$moo:' + this.getPropName(className)) &&
  9983. (
  9984. advice.getStyle('display') == 'none' ||
  9985. advice.getStyle('visibility') == 'hidden' ||
  9986. advice.getStyle('opacity') == 0
  9987. )
  9988. ){
  9989. field.store('$moo:' + this.getPropName(className), true);
  9990. this.options.showError(advice);
  9991. this.fireEvent('showAdvice', [field, advice, className]);
  9992. }
  9993. },
  9994. hideAdvice: function(className, field){
  9995. var advice = this.getAdvice(className, field);
  9996. if (advice && field.retrieve('$moo:' + this.getPropName(className))){
  9997. field.store('$moo:' + this.getPropName(className), false);
  9998. this.options.hideError(advice);
  9999. this.fireEvent('hideAdvice', [field, advice, className]);
  10000. }
  10001. },
  10002. getPropName: function(className){
  10003. return 'advice' + className;
  10004. },
  10005. resetField: function(field){
  10006. field = document.id(field);
  10007. if (!field) return this;
  10008. this.parent(field);
  10009. field.get('validators').each(function(className){
  10010. this.hideAdvice(className, field);
  10011. }, this);
  10012. return this;
  10013. },
  10014. getAllAdviceMessages: function(field, force){
  10015. var advice = [];
  10016. if (field.hasClass('ignoreValidation') && !force) return advice;
  10017. var validators = field.get('validators').some(function(cn){
  10018. var warner = cn.test('^warn-') || field.hasClass('warnOnly');
  10019. if (warner) cn = cn.replace(/^warn-/, '');
  10020. var validator = this.getValidator(cn);
  10021. if (!validator) return;
  10022. advice.push({
  10023. message: validator.getError(field),
  10024. warnOnly: warner,
  10025. passed: validator.test(),
  10026. validator: validator
  10027. });
  10028. }, this);
  10029. return advice;
  10030. },
  10031. getAdvice: function(className, field){
  10032. return field.retrieve('$moo:advice-' + className);
  10033. },
  10034. insertAdvice: function(advice, field){
  10035. //Check for error position prop
  10036. var props = field.get('validatorProps');
  10037. //Build advice
  10038. if (!props.msgPos || !document.id(props.msgPos)){
  10039. if (field.type && field.type.toLowerCase() == 'radio') field.getParent().adopt(advice);
  10040. else advice.inject(document.id(field), 'after');
  10041. } else {
  10042. document.id(props.msgPos).grab(advice);
  10043. }
  10044. },
  10045. validateField: function(field, force, scroll){
  10046. var result = this.parent(field, force);
  10047. if (((this.options.scrollToErrorsOnSubmit && scroll == null) || scroll) && !result){
  10048. var failed = document.id(this).getElement('.validation-failed');
  10049. var par = document.id(this).getParent();
  10050. while (par != document.body && par.getScrollSize().y == par.getSize().y){
  10051. par = par.getParent();
  10052. }
  10053. var fx = par.retrieve('$moo:fvScroller');
  10054. if (!fx && window.Fx && Fx.Scroll){
  10055. fx = new Fx.Scroll(par, this.options.scrollFxOptions);
  10056. par.store('$moo:fvScroller', fx);
  10057. }
  10058. if (failed){
  10059. if (fx) fx.toElement(failed);
  10060. else par.scrollTo(par.getScroll().x, failed.getPosition(par).y - 20);
  10061. }
  10062. }
  10063. return result;
  10064. },
  10065. watchFields: function(fields){
  10066. fields.each(function(el){
  10067. if (this.options.evaluateFieldsOnBlur){
  10068. el.addEvent('blur', this.validationMonitor.pass([el, false, this.options.scrollToErrorsOnBlur], this));
  10069. }
  10070. if (this.options.evaluateFieldsOnChange){
  10071. el.addEvent('change', this.validationMonitor.pass([el, true, this.options.scrollToErrorsOnChange], this));
  10072. }
  10073. }, this);
  10074. }
  10075. });
  10076. /*
  10077. ---
  10078. script: OverText.js
  10079. name: OverText
  10080. description: Shows text over an input that disappears when the user clicks into it. The text remains hidden if the user adds a value.
  10081. license: MIT-style license
  10082. authors:
  10083. - Aaron Newton
  10084. requires:
  10085. - Core/Options
  10086. - Core/Events
  10087. - Core/Element.Event
  10088. - Class.Binds
  10089. - Class.Occlude
  10090. - Element.Position
  10091. - Element.Shortcuts
  10092. provides: [OverText]
  10093. ...
  10094. */
  10095. (function(){
  10096. var OverText = this.OverText = new Class({
  10097. Implements: [Options, Events, Class.Occlude],
  10098. Binds: ['reposition', 'assert', 'focus', 'hide'],
  10099. options: {/*
  10100. textOverride: null,
  10101. onFocus: function(){},
  10102. onTextHide: function(textEl, inputEl){},
  10103. onTextShow: function(textEl, inputEl){}, */
  10104. element: 'label',
  10105. labelClass: 'overTxtLabel',
  10106. positionOptions: {
  10107. position: 'upperLeft',
  10108. edge: 'upperLeft',
  10109. offset: {
  10110. x: 4,
  10111. y: 2
  10112. }
  10113. },
  10114. poll: false,
  10115. pollInterval: 250,
  10116. wrap: false
  10117. },
  10118. property: 'OverText',
  10119. initialize: function(element, options){
  10120. element = this.element = document.id(element);
  10121. if (this.occlude()) return this.occluded;
  10122. this.setOptions(options);
  10123. this.attach(element);
  10124. OverText.instances.push(this);
  10125. if (this.options.poll) this.poll();
  10126. },
  10127. toElement: function(){
  10128. return this.element;
  10129. },
  10130. attach: function(){
  10131. var element = this.element,
  10132. options = this.options,
  10133. value = options.textOverride || element.get('alt') || element.get('title');
  10134. if (!value) return this;
  10135. var text = this.text = new Element(options.element, {
  10136. 'class': options.labelClass,
  10137. styles: {
  10138. lineHeight: 'normal',
  10139. position: 'absolute',
  10140. cursor: 'text'
  10141. },
  10142. html: value,
  10143. events: {
  10144. click: this.hide.pass(options.element == 'label', this)
  10145. }
  10146. }).inject(element, 'after');
  10147. if (options.element == 'label'){
  10148. if (!element.get('id')) element.set('id', 'input_' + String.uniqueID());
  10149. text.set('for', element.get('id'));
  10150. }
  10151. if (options.wrap){
  10152. this.textHolder = new Element('div.overTxtWrapper', {
  10153. styles: {
  10154. lineHeight: 'normal',
  10155. position: 'relative'
  10156. }
  10157. }).grab(text).inject(element, 'before');
  10158. }
  10159. return this.enable();
  10160. },
  10161. destroy: function(){
  10162. this.element.eliminate(this.property); // Class.Occlude storage
  10163. this.disable();
  10164. if (this.text) this.text.destroy();
  10165. if (this.textHolder) this.textHolder.destroy();
  10166. return this;
  10167. },
  10168. disable: function(){
  10169. this.element.removeEvents({
  10170. focus: this.focus,
  10171. blur: this.assert,
  10172. change: this.assert
  10173. });
  10174. window.removeEvent('resize', this.reposition);
  10175. this.hide(true, true);
  10176. return this;
  10177. },
  10178. enable: function(){
  10179. this.element.addEvents({
  10180. focus: this.focus,
  10181. blur: this.assert,
  10182. change: this.assert
  10183. });
  10184. window.addEvent('resize', this.reposition);
  10185. this.reposition();
  10186. return this;
  10187. },
  10188. wrap: function(){
  10189. if (this.options.element == 'label'){
  10190. if (!this.element.get('id')) this.element.set('id', 'input_' + String.uniqueID());
  10191. this.text.set('for', this.element.get('id'));
  10192. }
  10193. },
  10194. startPolling: function(){
  10195. this.pollingPaused = false;
  10196. return this.poll();
  10197. },
  10198. poll: function(stop){
  10199. //start immediately
  10200. //pause on focus
  10201. //resumeon blur
  10202. if (this.poller && !stop) return this;
  10203. if (stop){
  10204. clearInterval(this.poller);
  10205. } else {
  10206. this.poller = (function(){
  10207. if (!this.pollingPaused) this.assert(true);
  10208. }).periodical(this.options.pollInterval, this);
  10209. }
  10210. return this;
  10211. },
  10212. stopPolling: function(){
  10213. this.pollingPaused = true;
  10214. return this.poll(true);
  10215. },
  10216. focus: function(){
  10217. if (this.text && (!this.text.isDisplayed() || this.element.get('disabled'))) return this;
  10218. return this.hide();
  10219. },
  10220. hide: function(suppressFocus, force){
  10221. if (this.text && (this.text.isDisplayed() && (!this.element.get('disabled') || force))){
  10222. this.text.hide();
  10223. this.fireEvent('textHide', [this.text, this.element]);
  10224. this.pollingPaused = true;
  10225. if (!suppressFocus){
  10226. try {
  10227. this.element.fireEvent('focus');
  10228. this.element.focus();
  10229. } catch (e){} //IE barfs if you call focus on hidden elements
  10230. }
  10231. }
  10232. return this;
  10233. },
  10234. show: function(){
  10235. if (document.id(this.text) && !this.text.isDisplayed()){
  10236. this.text.show();
  10237. this.reposition();
  10238. this.fireEvent('textShow', [this.text, this.element]);
  10239. this.pollingPaused = false;
  10240. }
  10241. return this;
  10242. },
  10243. test: function(){
  10244. return !this.element.get('value');
  10245. },
  10246. assert: function(suppressFocus){
  10247. return this[this.test() ? 'show' : 'hide'](suppressFocus);
  10248. },
  10249. reposition: function(){
  10250. this.assert(true);
  10251. if (!this.element.isVisible()) return this.stopPolling().hide();
  10252. if (this.text && this.test()){
  10253. this.text.position(Object.merge(this.options.positionOptions, {
  10254. relativeTo: this.element
  10255. }));
  10256. }
  10257. return this;
  10258. }
  10259. });
  10260. })();
  10261. OverText.instances = [];
  10262. Object.append(OverText, {
  10263. each: function(fn){
  10264. return OverText.instances.each(function(ot, i){
  10265. if (ot.element && ot.text) fn.call(OverText, ot, i);
  10266. });
  10267. },
  10268. update: function(){
  10269. return OverText.each(function(ot){
  10270. return ot.reposition();
  10271. });
  10272. },
  10273. hideAll: function(){
  10274. return OverText.each(function(ot){
  10275. return ot.hide(true, true);
  10276. });
  10277. },
  10278. showAll: function(){
  10279. return OverText.each(function(ot){
  10280. return ot.show();
  10281. });
  10282. }
  10283. });
  10284. /*
  10285. ---
  10286. script: Fx.Elements.js
  10287. name: Fx.Elements
  10288. description: Effect to change any number of CSS properties of any number of Elements.
  10289. license: MIT-style license
  10290. authors:
  10291. - Valerio Proietti
  10292. requires:
  10293. - Core/Fx.CSS
  10294. - MooTools.More
  10295. provides: [Fx.Elements]
  10296. ...
  10297. */
  10298. Fx.Elements = new Class({
  10299. Extends: Fx.CSS,
  10300. initialize: function(elements, options){
  10301. this.elements = this.subject = $$(elements);
  10302. this.parent(options);
  10303. },
  10304. compute: function(from, to, delta){
  10305. var now = {};
  10306. for (var i in from){
  10307. var iFrom = from[i], iTo = to[i], iNow = now[i] = {};
  10308. for (var p in iFrom) iNow[p] = this.parent(iFrom[p], iTo[p], delta);
  10309. }
  10310. return now;
  10311. },
  10312. set: function(now){
  10313. for (var i in now){
  10314. if (!this.elements[i]) continue;
  10315. var iNow = now[i];
  10316. for (var p in iNow) this.render(this.elements[i], p, iNow[p], this.options.unit);
  10317. }
  10318. return this;
  10319. },
  10320. start: function(obj){
  10321. if (!this.check(obj)) return this;
  10322. var from = {}, to = {};
  10323. for (var i in obj){
  10324. if (!this.elements[i]) continue;
  10325. var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {};
  10326. for (var p in iProps){
  10327. var parsed = this.prepare(this.elements[i], p, iProps[p]);
  10328. iFrom[p] = parsed.from;
  10329. iTo[p] = parsed.to;
  10330. }
  10331. }
  10332. return this.parent(from, to);
  10333. }
  10334. });
  10335. /*
  10336. ---
  10337. script: Fx.Accordion.js
  10338. name: Fx.Accordion
  10339. description: An Fx.Elements extension which allows you to easily create accordion type controls.
  10340. license: MIT-style license
  10341. authors:
  10342. - Valerio Proietti
  10343. requires:
  10344. - Core/Element.Event
  10345. - Fx.Elements
  10346. provides: [Fx.Accordion]
  10347. ...
  10348. */
  10349. Fx.Accordion = new Class({
  10350. Extends: Fx.Elements,
  10351. options: {/*
  10352. onActive: function(toggler, section){},
  10353. onBackground: function(toggler, section){},*/
  10354. fixedHeight: false,
  10355. fixedWidth: false,
  10356. display: 0,
  10357. show: false,
  10358. height: true,
  10359. width: false,
  10360. opacity: true,
  10361. alwaysHide: false,
  10362. trigger: 'click',
  10363. initialDisplayFx: true,
  10364. resetHeight: true,
  10365. keepOpen: false
  10366. },
  10367. initialize: function(){
  10368. var defined = function(obj){
  10369. return obj != null;
  10370. };
  10371. var params = Array.link(arguments, {
  10372. 'container': Type.isElement, //deprecated
  10373. 'options': Type.isObject,
  10374. 'togglers': defined,
  10375. 'elements': defined
  10376. });
  10377. this.parent(params.elements, params.options);
  10378. var options = this.options,
  10379. togglers = this.togglers = $$(params.togglers);
  10380. this.previous = -1;
  10381. this.internalChain = new Chain();
  10382. if (options.alwaysHide) this.options.link = 'chain';
  10383. if (options.show || this.options.show === 0){
  10384. options.display = false;
  10385. this.previous = options.show;
  10386. }
  10387. if (options.start){
  10388. options.display = false;
  10389. options.show = false;
  10390. }
  10391. var effects = this.effects = {};
  10392. if (options.opacity) effects.opacity = 'fullOpacity';
  10393. if (options.width) effects.width = options.fixedWidth ? 'fullWidth' : 'offsetWidth';
  10394. if (options.height) effects.height = options.fixedHeight ? 'fullHeight' : 'scrollHeight';
  10395. for (var i = 0, l = togglers.length; i < l; i++) this.addSection(togglers[i], this.elements[i]);
  10396. this.elements.each(function(el, i){
  10397. if (options.show === i){
  10398. this.fireEvent('active', [togglers[i], el]);
  10399. } else {
  10400. for (var fx in effects) el.setStyle(fx, 0);
  10401. }
  10402. }, this);
  10403. if (options.display || options.display === 0 || options.initialDisplayFx === false){
  10404. this.display(options.display, options.initialDisplayFx);
  10405. }
  10406. if (options.fixedHeight !== false) options.resetHeight = false;
  10407. this.addEvent('complete', this.internalChain.callChain.bind(this.internalChain));
  10408. },
  10409. addSection: function(toggler, element){
  10410. toggler = document.id(toggler);
  10411. element = document.id(element);
  10412. this.togglers.include(toggler);
  10413. this.elements.include(element);
  10414. var togglers = this.togglers,
  10415. options = this.options,
  10416. test = togglers.contains(toggler),
  10417. idx = togglers.indexOf(toggler),
  10418. displayer = this.display.pass(idx, this);
  10419. toggler.store('accordion:display', displayer)
  10420. .addEvent(options.trigger, displayer);
  10421. if (options.height) element.setStyles({'padding-top': 0, 'border-top': 'none', 'padding-bottom': 0, 'border-bottom': 'none'});
  10422. if (options.width) element.setStyles({'padding-left': 0, 'border-left': 'none', 'padding-right': 0, 'border-right': 'none'});
  10423. element.fullOpacity = 1;
  10424. if (options.fixedWidth) element.fullWidth = options.fixedWidth;
  10425. if (options.fixedHeight) element.fullHeight = options.fixedHeight;
  10426. element.setStyle('overflow', 'hidden');
  10427. if (!test) for (var fx in this.effects){
  10428. element.setStyle(fx, 0);
  10429. }
  10430. return this;
  10431. },
  10432. removeSection: function(toggler, displayIndex){
  10433. var togglers = this.togglers,
  10434. idx = togglers.indexOf(toggler),
  10435. element = this.elements[idx];
  10436. var remover = function(){
  10437. togglers.erase(toggler);
  10438. this.elements.erase(element);
  10439. this.detach(toggler);
  10440. }.bind(this);
  10441. if (this.now == idx || displayIndex != null){
  10442. this.display(displayIndex != null ? displayIndex : (idx - 1 >= 0 ? idx - 1 : 0)).chain(remover);
  10443. } else {
  10444. remover();
  10445. }
  10446. return this;
  10447. },
  10448. detach: function(toggler){
  10449. var remove = function(toggler){
  10450. toggler.removeEvent(this.options.trigger, toggler.retrieve('accordion:display'));
  10451. }.bind(this);
  10452. if (!toggler) this.togglers.each(remove);
  10453. else remove(toggler);
  10454. return this;
  10455. },
  10456. display: function(index, useFx){
  10457. if (!this.check(index, useFx)) return this;
  10458. var obj = {},
  10459. elements = this.elements,
  10460. options = this.options,
  10461. effects = this.effects,
  10462. keepOpen = options.keepOpen,
  10463. alwaysHide = options.alwaysHide;
  10464. if (useFx == null) useFx = true;
  10465. if (typeOf(index) == 'element') index = elements.indexOf(index);
  10466. if (index == this.current && !alwaysHide && !keepOpen) return this;
  10467. if (options.resetHeight){
  10468. var prev = elements[this.current];
  10469. if (prev && !this.selfHidden){
  10470. for (var fx in effects) prev.setStyle(fx, prev[effects[fx]]);
  10471. }
  10472. }
  10473. if (this.timer && options.link == 'chain') return this;
  10474. if (this.current != null) this.previous = this.current;
  10475. this.current = index;
  10476. this.selfHidden = false;
  10477. elements.each(function(el, i){
  10478. obj[i] = {};
  10479. var hide, isOpen;
  10480. if (!keepOpen || i == index){
  10481. if (i == index) isOpen = (el.offsetHeight > 0 && options.height) || (el.offsetWidth > 0 && options.width);
  10482. if (i != index){
  10483. hide = true;
  10484. } else if ((alwaysHide || keepOpen) && isOpen){
  10485. hide = true;
  10486. this.selfHidden = true;
  10487. }
  10488. this.fireEvent(hide ? 'background' : 'active', [this.togglers[i], el]);
  10489. for (var fx in effects) obj[i][fx] = hide ? 0 : el[effects[fx]];
  10490. if (!useFx && !hide && options.resetHeight) obj[i].height = 'auto';
  10491. }
  10492. }, this);
  10493. this.internalChain.clearChain();
  10494. this.internalChain.chain(function(){
  10495. if (options.resetHeight && !this.selfHidden){
  10496. var el = elements[index];
  10497. if (el) el.setStyle('height', 'auto');
  10498. }
  10499. }.bind(this));
  10500. return useFx ? this.start(obj) : this.set(obj).internalChain.callChain();
  10501. }
  10502. });
  10503. /*<1.2compat>*/
  10504. /*
  10505. Compatibility with 1.2.0
  10506. */
  10507. var Accordion = new Class({
  10508. Extends: Fx.Accordion,
  10509. initialize: function(){
  10510. this.parent.apply(this, arguments);
  10511. var params = Array.link(arguments, {'container': Type.isElement});
  10512. this.container = params.container;
  10513. },
  10514. addSection: function(toggler, element, pos){
  10515. toggler = document.id(toggler);
  10516. element = document.id(element);
  10517. var test = this.togglers.contains(toggler);
  10518. var len = this.togglers.length;
  10519. if (len && (!test || pos)){
  10520. pos = pos != null ? pos : len - 1;
  10521. toggler.inject(this.togglers[pos], 'before');
  10522. element.inject(toggler, 'after');
  10523. } else if (this.container && !test){
  10524. toggler.inject(this.container);
  10525. element.inject(this.container);
  10526. }
  10527. return this.parent.apply(this, arguments);
  10528. }
  10529. });
  10530. /*</1.2compat>*/
  10531. /*
  10532. ---
  10533. script: Fx.Move.js
  10534. name: Fx.Move
  10535. description: Defines Fx.Move, a class that works with Element.Position.js to transition an element from one location to another.
  10536. license: MIT-style license
  10537. authors:
  10538. - Aaron Newton
  10539. requires:
  10540. - Core/Fx.Morph
  10541. - Element.Position
  10542. provides: [Fx.Move]
  10543. ...
  10544. */
  10545. Fx.Move = new Class({
  10546. Extends: Fx.Morph,
  10547. options: {
  10548. relativeTo: document.body,
  10549. position: 'center',
  10550. edge: false,
  10551. offset: {x: 0, y: 0}
  10552. },
  10553. start: function(destination){
  10554. var element = this.element,
  10555. topLeft = element.getStyles('top', 'left');
  10556. if (topLeft.top == 'auto' || topLeft.left == 'auto'){
  10557. element.setPosition(element.getPosition(element.getOffsetParent()));
  10558. }
  10559. return this.parent(element.position(Object.merge({}, this.options, destination, {returnPos: true})));
  10560. }
  10561. });
  10562. Element.Properties.move = {
  10563. set: function(options){
  10564. this.get('move').cancel().setOptions(options);
  10565. return this;
  10566. },
  10567. get: function(){
  10568. var move = this.retrieve('move');
  10569. if (!move){
  10570. move = new Fx.Move(this, {link: 'cancel'});
  10571. this.store('move', move);
  10572. }
  10573. return move;
  10574. }
  10575. };
  10576. Element.implement({
  10577. move: function(options){
  10578. this.get('move').start(options);
  10579. return this;
  10580. }
  10581. });
  10582. /*
  10583. ---
  10584. script: Fx.Scroll.js
  10585. name: Fx.Scroll
  10586. description: Effect to smoothly scroll any element, including the window.
  10587. license: MIT-style license
  10588. authors:
  10589. - Valerio Proietti
  10590. requires:
  10591. - Core/Fx
  10592. - Core/Element.Event
  10593. - Core/Element.Dimensions
  10594. - MooTools.More
  10595. provides: [Fx.Scroll]
  10596. ...
  10597. */
  10598. (function(){
  10599. Fx.Scroll = new Class({
  10600. Extends: Fx,
  10601. options: {
  10602. offset: {x: 0, y: 0},
  10603. wheelStops: true
  10604. },
  10605. initialize: function(element, options){
  10606. this.element = this.subject = document.id(element);
  10607. this.parent(options);
  10608. if (typeOf(this.element) != 'element') this.element = document.id(this.element.getDocument().body);
  10609. if (this.options.wheelStops){
  10610. var stopper = this.element,
  10611. cancel = this.cancel.pass(false, this);
  10612. this.addEvent('start', function(){
  10613. stopper.addEvent('mousewheel', cancel);
  10614. }, true);
  10615. this.addEvent('complete', function(){
  10616. stopper.removeEvent('mousewheel', cancel);
  10617. }, true);
  10618. }
  10619. },
  10620. set: function(){
  10621. var now = Array.flatten(arguments);
  10622. this.element.scrollTo(now[0], now[1]);
  10623. return this;
  10624. },
  10625. compute: function(from, to, delta){
  10626. return [0, 1].map(function(i){
  10627. return Fx.compute(from[i], to[i], delta);
  10628. });
  10629. },
  10630. start: function(x, y){
  10631. if (!this.check(x, y)) return this;
  10632. var scroll = this.element.getScroll();
  10633. return this.parent([scroll.x, scroll.y], [x, y]);
  10634. },
  10635. calculateScroll: function(x, y){
  10636. var element = this.element,
  10637. scrollSize = element.getScrollSize(),
  10638. scroll = element.getScroll(),
  10639. size = element.getSize(),
  10640. offset = this.options.offset,
  10641. values = {x: x, y: y};
  10642. for (var z in values){
  10643. if (!values[z] && values[z] !== 0) values[z] = scroll[z];
  10644. if (typeOf(values[z]) != 'number') values[z] = scrollSize[z] - size[z];
  10645. values[z] += offset[z];
  10646. }
  10647. return [values.x, values.y];
  10648. },
  10649. toTop: function(){
  10650. return this.start.apply(this, this.calculateScroll(false, 0));
  10651. },
  10652. toLeft: function(){
  10653. return this.start.apply(this, this.calculateScroll(0, false));
  10654. },
  10655. toRight: function(){
  10656. return this.start.apply(this, this.calculateScroll('right', false));
  10657. },
  10658. toBottom: function(){
  10659. return this.start.apply(this, this.calculateScroll(false, 'bottom'));
  10660. },
  10661. toElement: function(el, axes){
  10662. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10663. var scroll = isBody(this.element) ? {x: 0, y: 0} : this.element.getScroll();
  10664. var position = Object.map(document.id(el).getPosition(this.element), function(value, axis){
  10665. return axes.contains(axis) ? value + scroll[axis] : false;
  10666. });
  10667. return this.start.apply(this, this.calculateScroll(position.x, position.y));
  10668. },
  10669. toElementEdge: function(el, axes, offset){
  10670. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10671. el = document.id(el);
  10672. var to = {},
  10673. position = el.getPosition(this.element),
  10674. size = el.getSize(),
  10675. scroll = this.element.getScroll(),
  10676. containerSize = this.element.getSize(),
  10677. edge = {
  10678. x: position.x + size.x,
  10679. y: position.y + size.y
  10680. };
  10681. ['x', 'y'].each(function(axis){
  10682. if (axes.contains(axis)){
  10683. if (edge[axis] > scroll[axis] + containerSize[axis]) to[axis] = edge[axis] - containerSize[axis];
  10684. if (position[axis] < scroll[axis]) to[axis] = position[axis];
  10685. }
  10686. if (to[axis] == null) to[axis] = scroll[axis];
  10687. if (offset && offset[axis]) to[axis] = to[axis] + offset[axis];
  10688. }, this);
  10689. if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y);
  10690. return this;
  10691. },
  10692. toElementCenter: function(el, axes, offset){
  10693. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10694. el = document.id(el);
  10695. var to = {},
  10696. position = el.getPosition(this.element),
  10697. size = el.getSize(),
  10698. scroll = this.element.getScroll(),
  10699. containerSize = this.element.getSize();
  10700. ['x', 'y'].each(function(axis){
  10701. if (axes.contains(axis)){
  10702. to[axis] = position[axis] - (containerSize[axis] - size[axis]) / 2;
  10703. }
  10704. if (to[axis] == null) to[axis] = scroll[axis];
  10705. if (offset && offset[axis]) to[axis] = to[axis] + offset[axis];
  10706. }, this);
  10707. if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y);
  10708. return this;
  10709. }
  10710. });
  10711. //<1.2compat>
  10712. Fx.Scroll.implement({
  10713. scrollToCenter: function(){
  10714. return this.toElementCenter.apply(this, arguments);
  10715. },
  10716. scrollIntoView: function(){
  10717. return this.toElementEdge.apply(this, arguments);
  10718. }
  10719. });
  10720. //</1.2compat>
  10721. function isBody(element){
  10722. return (/^(?:body|html)$/i).test(element.tagName);
  10723. }
  10724. })();
  10725. /*
  10726. ---
  10727. script: Fx.Slide.js
  10728. name: Fx.Slide
  10729. description: Effect to slide an element in and out of view.
  10730. license: MIT-style license
  10731. authors:
  10732. - Valerio Proietti
  10733. requires:
  10734. - Core/Fx
  10735. - Core/Element.Style
  10736. - MooTools.More
  10737. provides: [Fx.Slide]
  10738. ...
  10739. */
  10740. Fx.Slide = new Class({
  10741. Extends: Fx,
  10742. options: {
  10743. mode: 'vertical',
  10744. wrapper: false,
  10745. hideOverflow: true,
  10746. resetHeight: false
  10747. },
  10748. initialize: function(element, options){
  10749. element = this.element = this.subject = document.id(element);
  10750. this.parent(options);
  10751. options = this.options;
  10752. var wrapper = element.retrieve('wrapper'),
  10753. styles = element.getStyles('margin', 'position', 'overflow');
  10754. if (options.hideOverflow) styles = Object.append(styles, {overflow: 'hidden'});
  10755. if (options.wrapper) wrapper = document.id(options.wrapper).setStyles(styles);
  10756. if (!wrapper) wrapper = new Element('div', {
  10757. styles: styles
  10758. }).wraps(element);
  10759. element.store('wrapper', wrapper).setStyle('margin', 0);
  10760. if (element.getStyle('overflow') == 'visible') element.setStyle('overflow', 'hidden');
  10761. this.now = [];
  10762. this.open = true;
  10763. this.wrapper = wrapper;
  10764. this.addEvent('complete', function(){
  10765. this.open = (wrapper['offset' + this.layout.capitalize()] != 0);
  10766. if (this.open && this.options.resetHeight) wrapper.setStyle('height', '');
  10767. }, true);
  10768. },
  10769. vertical: function(){
  10770. this.margin = 'margin-top';
  10771. this.layout = 'height';
  10772. this.offset = this.element.offsetHeight;
  10773. },
  10774. horizontal: function(){
  10775. this.margin = 'margin-left';
  10776. this.layout = 'width';
  10777. this.offset = this.element.offsetWidth;
  10778. },
  10779. set: function(now){
  10780. this.element.setStyle(this.margin, now[0]);
  10781. this.wrapper.setStyle(this.layout, now[1]);
  10782. return this;
  10783. },
  10784. compute: function(from, to, delta){
  10785. return [0, 1].map(function(i){
  10786. return Fx.compute(from[i], to[i], delta);
  10787. });
  10788. },
  10789. start: function(how, mode){
  10790. if (!this.check(how, mode)) return this;
  10791. this[mode || this.options.mode]();
  10792. var margin = this.element.getStyle(this.margin).toInt(),
  10793. layout = this.wrapper.getStyle(this.layout).toInt(),
  10794. caseIn = [[margin, layout], [0, this.offset]],
  10795. caseOut = [[margin, layout], [-this.offset, 0]],
  10796. start;
  10797. switch (how){
  10798. case 'in': start = caseIn; break;
  10799. case 'out': start = caseOut; break;
  10800. case 'toggle': start = (layout == 0) ? caseIn : caseOut;
  10801. }
  10802. return this.parent(start[0], start[1]);
  10803. },
  10804. slideIn: function(mode){
  10805. return this.start('in', mode);
  10806. },
  10807. slideOut: function(mode){
  10808. return this.start('out', mode);
  10809. },
  10810. hide: function(mode){
  10811. this[mode || this.options.mode]();
  10812. this.open = false;
  10813. return this.set([-this.offset, 0]);
  10814. },
  10815. show: function(mode){
  10816. this[mode || this.options.mode]();
  10817. this.open = true;
  10818. return this.set([0, this.offset]);
  10819. },
  10820. toggle: function(mode){
  10821. return this.start('toggle', mode);
  10822. }
  10823. });
  10824. Element.Properties.slide = {
  10825. set: function(options){
  10826. this.get('slide').cancel().setOptions(options);
  10827. return this;
  10828. },
  10829. get: function(){
  10830. var slide = this.retrieve('slide');
  10831. if (!slide){
  10832. slide = new Fx.Slide(this, {link: 'cancel'});
  10833. this.store('slide', slide);
  10834. }
  10835. return slide;
  10836. }
  10837. };
  10838. Element.implement({
  10839. slide: function(how, mode){
  10840. how = how || 'toggle';
  10841. var slide = this.get('slide'), toggle;
  10842. switch (how){
  10843. case 'hide': slide.hide(mode); break;
  10844. case 'show': slide.show(mode); break;
  10845. case 'toggle':
  10846. var flag = this.retrieve('slide:flag', slide.open);
  10847. slide[flag ? 'slideOut' : 'slideIn'](mode);
  10848. this.store('slide:flag', !flag);
  10849. toggle = true;
  10850. break;
  10851. default: slide.start(how, mode);
  10852. }
  10853. if (!toggle) this.eliminate('slide:flag');
  10854. return this;
  10855. }
  10856. });
  10857. /*
  10858. ---
  10859. script: Fx.SmoothScroll.js
  10860. name: Fx.SmoothScroll
  10861. description: Class for creating a smooth scrolling effect to all internal links on the page.
  10862. license: MIT-style license
  10863. authors:
  10864. - Valerio Proietti
  10865. requires:
  10866. - Core/Slick.Finder
  10867. - Fx.Scroll
  10868. provides: [Fx.SmoothScroll]
  10869. ...
  10870. */
  10871. /*<1.2compat>*/var SmoothScroll = /*</1.2compat>*/Fx.SmoothScroll = new Class({
  10872. Extends: Fx.Scroll,
  10873. options: {
  10874. axes: ['x', 'y']
  10875. },
  10876. initialize: function(options, context){
  10877. context = context || document;
  10878. this.doc = context.getDocument();
  10879. this.parent(this.doc, options);
  10880. var win = context.getWindow(),
  10881. location = win.location.href.match(/^[^#]*/)[0] + '#',
  10882. links = $$(this.options.links || this.doc.links);
  10883. links.each(function(link){
  10884. if (link.href.indexOf(location) != 0) return;
  10885. var anchor = link.href.substr(location.length);
  10886. if (anchor) this.useLink(link, anchor);
  10887. }, this);
  10888. this.addEvent('complete', function(){
  10889. win.location.hash = this.anchor;
  10890. this.element.scrollTo(this.to[0], this.to[1]);
  10891. }, true);
  10892. },
  10893. useLink: function(link, anchor){
  10894. link.addEvent('click', function(event){
  10895. var el = document.id(anchor) || this.doc.getElement('a[name=' + anchor + ']');
  10896. if (!el) return;
  10897. event.preventDefault();
  10898. this.toElement(el, this.options.axes).chain(function(){
  10899. this.fireEvent('scrolledTo', [link, el]);
  10900. }.bind(this));
  10901. this.anchor = anchor;
  10902. }.bind(this));
  10903. return this;
  10904. }
  10905. });
  10906. /*
  10907. ---
  10908. script: Fx.Sort.js
  10909. name: Fx.Sort
  10910. description: Defines Fx.Sort, a class that reorders lists with a transition.
  10911. license: MIT-style license
  10912. authors:
  10913. - Aaron Newton
  10914. requires:
  10915. - Core/Element.Dimensions
  10916. - Fx.Elements
  10917. - Element.Measure
  10918. provides: [Fx.Sort]
  10919. ...
  10920. */
  10921. Fx.Sort = new Class({
  10922. Extends: Fx.Elements,
  10923. options: {
  10924. mode: 'vertical'
  10925. },
  10926. initialize: function(elements, options){
  10927. this.parent(elements, options);
  10928. this.elements.each(function(el){
  10929. if (el.getStyle('position') == 'static') el.setStyle('position', 'relative');
  10930. });
  10931. this.setDefaultOrder();
  10932. },
  10933. setDefaultOrder: function(){
  10934. this.currentOrder = this.elements.map(function(el, index){
  10935. return index;
  10936. });
  10937. },
  10938. sort: function(){
  10939. if (!this.check(arguments)) return this;
  10940. var newOrder = Array.flatten(arguments);
  10941. var top = 0,
  10942. left = 0,
  10943. next = {},
  10944. zero = {},
  10945. vert = this.options.mode == 'vertical';
  10946. var current = this.elements.map(function(el, index){
  10947. var size = el.getComputedSize({styles: ['border', 'padding', 'margin']});
  10948. var val;
  10949. if (vert){
  10950. val = {
  10951. top: top,
  10952. margin: size['margin-top'],
  10953. height: size.totalHeight
  10954. };
  10955. top += val.height - size['margin-top'];
  10956. } else {
  10957. val = {
  10958. left: left,
  10959. margin: size['margin-left'],
  10960. width: size.totalWidth
  10961. };
  10962. left += val.width;
  10963. }
  10964. var plane = vert ? 'top' : 'left';
  10965. zero[index] = {};
  10966. var start = el.getStyle(plane).toInt();
  10967. zero[index][plane] = start || 0;
  10968. return val;
  10969. }, this);
  10970. this.set(zero);
  10971. newOrder = newOrder.map(function(i){ return i.toInt(); });
  10972. if (newOrder.length != this.elements.length){
  10973. this.currentOrder.each(function(index){
  10974. if (!newOrder.contains(index)) newOrder.push(index);
  10975. });
  10976. if (newOrder.length > this.elements.length)
  10977. newOrder.splice(this.elements.length-1, newOrder.length - this.elements.length);
  10978. }
  10979. var margin = 0;
  10980. top = left = 0;
  10981. newOrder.each(function(item){
  10982. var newPos = {};
  10983. if (vert){
  10984. newPos.top = top - current[item].top - margin;
  10985. top += current[item].height;
  10986. } else {
  10987. newPos.left = left - current[item].left;
  10988. left += current[item].width;
  10989. }
  10990. margin = margin + current[item].margin;
  10991. next[item]=newPos;
  10992. }, this);
  10993. var mapped = {};
  10994. Array.clone(newOrder).sort().each(function(index){
  10995. mapped[index] = next[index];
  10996. });
  10997. this.start(mapped);
  10998. this.currentOrder = newOrder;
  10999. return this;
  11000. },
  11001. rearrangeDOM: function(newOrder){
  11002. newOrder = newOrder || this.currentOrder;
  11003. var parent = this.elements[0].getParent();
  11004. var rearranged = [];
  11005. this.elements.setStyle('opacity', 0);
  11006. //move each element and store the new default order
  11007. newOrder.each(function(index){
  11008. rearranged.push(this.elements[index].inject(parent).setStyles({
  11009. top: 0,
  11010. left: 0
  11011. }));
  11012. }, this);
  11013. this.elements.setStyle('opacity', 1);
  11014. this.elements = $$(rearranged);
  11015. this.setDefaultOrder();
  11016. return this;
  11017. },
  11018. getDefaultOrder: function(){
  11019. return this.elements.map(function(el, index){
  11020. return index;
  11021. });
  11022. },
  11023. getCurrentOrder: function(){
  11024. return this.currentOrder;
  11025. },
  11026. forward: function(){
  11027. return this.sort(this.getDefaultOrder());
  11028. },
  11029. backward: function(){
  11030. return this.sort(this.getDefaultOrder().reverse());
  11031. },
  11032. reverse: function(){
  11033. return this.sort(this.currentOrder.reverse());
  11034. },
  11035. sortByElements: function(elements){
  11036. return this.sort(elements.map(function(el){
  11037. return this.elements.indexOf(el);
  11038. }, this));
  11039. },
  11040. swap: function(one, two){
  11041. if (typeOf(one) == 'element') one = this.elements.indexOf(one);
  11042. if (typeOf(two) == 'element') two = this.elements.indexOf(two);
  11043. var newOrder = Array.clone(this.currentOrder);
  11044. newOrder[this.currentOrder.indexOf(one)] = two;
  11045. newOrder[this.currentOrder.indexOf(two)] = one;
  11046. return this.sort(newOrder);
  11047. }
  11048. });
  11049. /*
  11050. ---
  11051. script: Keyboard.js
  11052. name: Keyboard
  11053. 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.
  11054. license: MIT-style license
  11055. authors:
  11056. - Perrin Westrich
  11057. - Aaron Newton
  11058. - Scott Kyle
  11059. requires:
  11060. - Core/Events
  11061. - Core/Options
  11062. - Core/Element.Event
  11063. - Element.Event.Pseudos.Keys
  11064. provides: [Keyboard]
  11065. ...
  11066. */
  11067. (function(){
  11068. var Keyboard = this.Keyboard = new Class({
  11069. Extends: Events,
  11070. Implements: [Options],
  11071. options: {/*
  11072. onActivate: function(){},
  11073. onDeactivate: function(){},*/
  11074. defaultEventType: 'keydown',
  11075. active: false,
  11076. manager: null,
  11077. events: {},
  11078. nonParsedEvents: ['activate', 'deactivate', 'onactivate', 'ondeactivate', 'changed', 'onchanged']
  11079. },
  11080. initialize: function(options){
  11081. if (options && options.manager){
  11082. this._manager = options.manager;
  11083. delete options.manager;
  11084. }
  11085. this.setOptions(options);
  11086. this._setup();
  11087. },
  11088. addEvent: function(type, fn, internal){
  11089. return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn, internal);
  11090. },
  11091. removeEvent: function(type, fn){
  11092. return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn);
  11093. },
  11094. toggleActive: function(){
  11095. return this[this.isActive() ? 'deactivate' : 'activate']();
  11096. },
  11097. activate: function(instance){
  11098. if (instance){
  11099. if (instance.isActive()) return this;
  11100. //if we're stealing focus, store the last keyboard to have it so the relinquish command works
  11101. if (this._activeKB && instance != this._activeKB){
  11102. this.previous = this._activeKB;
  11103. this.previous.fireEvent('deactivate');
  11104. }
  11105. //if we're enabling a child, assign it so that events are now passed to it
  11106. this._activeKB = instance.fireEvent('activate');
  11107. Keyboard.manager.fireEvent('changed');
  11108. } else if (this._manager){
  11109. //else we're enabling ourselves, we must ask our parent to do it for us
  11110. this._manager.activate(this);
  11111. }
  11112. return this;
  11113. },
  11114. isActive: function(){
  11115. return this._manager ? (this._manager._activeKB == this) : (Keyboard.manager == this);
  11116. },
  11117. deactivate: function(instance){
  11118. if (instance){
  11119. if (instance === this._activeKB){
  11120. this._activeKB = null;
  11121. instance.fireEvent('deactivate');
  11122. Keyboard.manager.fireEvent('changed');
  11123. }
  11124. } else if (this._manager){
  11125. this._manager.deactivate(this);
  11126. }
  11127. return this;
  11128. },
  11129. relinquish: function(){
  11130. if (this.isActive() && this._manager && this._manager.previous) this._manager.activate(this._manager.previous);
  11131. else this.deactivate();
  11132. return this;
  11133. },
  11134. //management logic
  11135. manage: function(instance){
  11136. if (instance._manager) instance._manager.drop(instance);
  11137. this._instances.push(instance);
  11138. instance._manager = this;
  11139. if (!this._activeKB) this.activate(instance);
  11140. return this;
  11141. },
  11142. drop: function(instance){
  11143. instance.relinquish();
  11144. this._instances.erase(instance);
  11145. if (this._activeKB == instance){
  11146. if (this.previous && this._instances.contains(this.previous)) this.activate(this.previous);
  11147. else this._activeKB = this._instances[0];
  11148. }
  11149. return this;
  11150. },
  11151. trace: function(){
  11152. Keyboard.trace(this);
  11153. },
  11154. each: function(fn){
  11155. Keyboard.each(this, fn);
  11156. },
  11157. /*
  11158. PRIVATE METHODS
  11159. */
  11160. _instances: [],
  11161. _disable: function(instance){
  11162. if (this._activeKB == instance) this._activeKB = null;
  11163. },
  11164. _setup: function(){
  11165. this.addEvents(this.options.events);
  11166. //if this is the root manager, nothing manages it
  11167. if (Keyboard.manager && !this._manager) Keyboard.manager.manage(this);
  11168. if (this.options.active) this.activate();
  11169. else this.relinquish();
  11170. },
  11171. _handle: function(event, type){
  11172. //Keyboard.stop(event) prevents key propagation
  11173. if (event.preventKeyboardPropagation) return;
  11174. var bubbles = !!this._manager;
  11175. if (bubbles && this._activeKB){
  11176. this._activeKB._handle(event, type);
  11177. if (event.preventKeyboardPropagation) return;
  11178. }
  11179. this.fireEvent(type, event);
  11180. if (!bubbles && this._activeKB) this._activeKB._handle(event, type);
  11181. }
  11182. });
  11183. var parsed = {};
  11184. var modifiers = ['shift', 'control', 'alt', 'meta'];
  11185. var regex = /^(?:shift|control|ctrl|alt|meta)$/;
  11186. Keyboard.parse = function(type, eventType, ignore){
  11187. if (ignore && ignore.contains(type.toLowerCase())) return type;
  11188. type = type.toLowerCase().replace(/^(keyup|keydown):/, function($0, $1){
  11189. eventType = $1;
  11190. return '';
  11191. });
  11192. if (!parsed[type]){
  11193. if (type != '+'){
  11194. var key, mods = {};
  11195. type.split('+').each(function(part){
  11196. if (regex.test(part)) mods[part] = true;
  11197. else key = part;
  11198. });
  11199. mods.control = mods.control || mods.ctrl; // allow both control and ctrl
  11200. var keys = [];
  11201. modifiers.each(function(mod){
  11202. if (mods[mod]) keys.push(mod);
  11203. });
  11204. if (key) keys.push(key);
  11205. parsed[type] = keys.join('+');
  11206. } else {
  11207. parsed[type] = type;
  11208. }
  11209. }
  11210. return eventType + ':keys(' + parsed[type] + ')';
  11211. };
  11212. Keyboard.each = function(keyboard, fn){
  11213. var current = keyboard || Keyboard.manager;
  11214. while (current){
  11215. fn(current);
  11216. current = current._activeKB;
  11217. }
  11218. };
  11219. Keyboard.stop = function(event){
  11220. event.preventKeyboardPropagation = true;
  11221. };
  11222. Keyboard.manager = new Keyboard({
  11223. active: true
  11224. });
  11225. Keyboard.trace = function(keyboard){
  11226. keyboard = keyboard || Keyboard.manager;
  11227. var hasConsole = window.console && console.log;
  11228. if (hasConsole) console.log('the following items have focus: ');
  11229. Keyboard.each(keyboard, function(current){
  11230. if (hasConsole) console.log(document.id(current.widget) || current.wiget || current);
  11231. });
  11232. };
  11233. var handler = function(event){
  11234. var keys = [];
  11235. modifiers.each(function(mod){
  11236. if (event[mod]) keys.push(mod);
  11237. });
  11238. if (!regex.test(event.key)) keys.push(event.key);
  11239. Keyboard.manager._handle(event, event.type + ':keys(' + keys.join('+') + ')');
  11240. };
  11241. document.addEvents({
  11242. 'keyup': handler,
  11243. 'keydown': handler
  11244. });
  11245. })();
  11246. /*
  11247. ---
  11248. script: Keyboard.Extras.js
  11249. name: Keyboard.Extras
  11250. 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.
  11251. license: MIT-style license
  11252. authors:
  11253. - Perrin Westrich
  11254. requires:
  11255. - Keyboard
  11256. - MooTools.More
  11257. provides: [Keyboard.Extras]
  11258. ...
  11259. */
  11260. Keyboard.prototype.options.nonParsedEvents.combine(['rebound', 'onrebound']);
  11261. Keyboard.implement({
  11262. /*
  11263. shortcut should be in the format of:
  11264. {
  11265. 'keys': 'shift+s', // the default to add as an event.
  11266. 'description': 'blah blah blah', // a brief description of the functionality.
  11267. 'handler': function(){} // the event handler to run when keys are pressed.
  11268. }
  11269. */
  11270. addShortcut: function(name, shortcut){
  11271. this._shortcuts = this._shortcuts || [];
  11272. this._shortcutIndex = this._shortcutIndex || {};
  11273. shortcut.getKeyboard = Function.convert(this);
  11274. shortcut.name = name;
  11275. this._shortcutIndex[name] = shortcut;
  11276. this._shortcuts.push(shortcut);
  11277. if (shortcut.keys) this.addEvent(shortcut.keys, shortcut.handler);
  11278. return this;
  11279. },
  11280. addShortcuts: function(obj){
  11281. for (var name in obj) this.addShortcut(name, obj[name]);
  11282. return this;
  11283. },
  11284. removeShortcut: function(name){
  11285. var shortcut = this.getShortcut(name);
  11286. if (shortcut && shortcut.keys){
  11287. this.removeEvent(shortcut.keys, shortcut.handler);
  11288. delete this._shortcutIndex[name];
  11289. this._shortcuts.erase(shortcut);
  11290. }
  11291. return this;
  11292. },
  11293. removeShortcuts: function(names){
  11294. names.each(this.removeShortcut, this);
  11295. return this;
  11296. },
  11297. getShortcuts: function(){
  11298. return this._shortcuts || [];
  11299. },
  11300. getShortcut: function(name){
  11301. return (this._shortcutIndex || {})[name];
  11302. }
  11303. });
  11304. Keyboard.rebind = function(newKeys, shortcuts){
  11305. Array.convert(shortcuts).each(function(shortcut){
  11306. shortcut.getKeyboard().removeEvent(shortcut.keys, shortcut.handler);
  11307. shortcut.getKeyboard().addEvent(newKeys, shortcut.handler);
  11308. shortcut.keys = newKeys;
  11309. shortcut.getKeyboard().fireEvent('rebound');
  11310. });
  11311. };
  11312. Keyboard.getActiveShortcuts = function(keyboard){
  11313. var activeKBS = [], activeSCS = [];
  11314. Keyboard.each(keyboard, [].push.bind(activeKBS));
  11315. activeKBS.each(function(kb){ activeSCS.extend(kb.getShortcuts()); });
  11316. return activeSCS;
  11317. };
  11318. Keyboard.getShortcut = function(name, keyboard, opts){
  11319. opts = opts || {};
  11320. var shortcuts = opts.many ? [] : null,
  11321. set = opts.many ? function(kb){
  11322. var shortcut = kb.getShortcut(name);
  11323. if (shortcut) shortcuts.push(shortcut);
  11324. } : function(kb){
  11325. if (!shortcuts) shortcuts = kb.getShortcut(name);
  11326. };
  11327. Keyboard.each(keyboard, set);
  11328. return shortcuts;
  11329. };
  11330. Keyboard.getShortcuts = function(name, keyboard){
  11331. return Keyboard.getShortcut(name, keyboard, { many: true });
  11332. };
  11333. /*
  11334. ---
  11335. script: HtmlTable.js
  11336. name: HtmlTable
  11337. description: Builds table elements with methods to add rows.
  11338. license: MIT-style license
  11339. authors:
  11340. - Aaron Newton
  11341. requires:
  11342. - Core/Options
  11343. - Core/Events
  11344. - Class.Occlude
  11345. provides: [HtmlTable]
  11346. ...
  11347. */
  11348. (function(){
  11349. var HtmlTable = this.HtmlTable = new Class({
  11350. Implements: [Options, Events, Class.Occlude],
  11351. options: {
  11352. properties: {
  11353. cellpadding: 0,
  11354. cellspacing: 0,
  11355. border: 0
  11356. },
  11357. rows: [],
  11358. headers: [],
  11359. footers: []
  11360. },
  11361. property: 'HtmlTable',
  11362. initialize: function(){
  11363. var params = Array.link(arguments, {options: Type.isObject, table: Type.isElement, id: Type.isString});
  11364. this.setOptions(params.options);
  11365. if (!params.table && params.id) params.table = document.id(params.id);
  11366. this.element = params.table || new Element('table', this.options.properties);
  11367. if (this.occlude()) return this.occluded;
  11368. this.build();
  11369. },
  11370. build: function(){
  11371. this.element.store('HtmlTable', this);
  11372. this.body = document.id(this.element.tBodies[0]) || new Element('tbody').inject(this.element);
  11373. $$(this.body.rows);
  11374. if (this.options.headers.length) this.setHeaders(this.options.headers);
  11375. else this.thead = document.id(this.element.tHead);
  11376. if (this.thead) this.head = this.getHead();
  11377. if (this.options.footers.length) this.setFooters(this.options.footers);
  11378. this.tfoot = document.id(this.element.tFoot);
  11379. if (this.tfoot) this.foot = document.id(this.tfoot.rows[0]);
  11380. this.options.rows.each(function(row){
  11381. this.push(row);
  11382. }, this);
  11383. },
  11384. toElement: function(){
  11385. return this.element;
  11386. },
  11387. empty: function(){
  11388. this.body.empty();
  11389. return this;
  11390. },
  11391. set: function(what, items){
  11392. var target = (what == 'headers') ? 'tHead' : 'tFoot',
  11393. lower = target.toLowerCase();
  11394. this[lower] = (document.id(this.element[target]) || new Element(lower).inject(this.element, 'top')).empty();
  11395. var data = this.push(items, {}, this[lower], what == 'headers' ? 'th' : 'td');
  11396. if (what == 'headers') this.head = this.getHead();
  11397. else this.foot = this.getHead();
  11398. return data;
  11399. },
  11400. getHead: function(){
  11401. var rows = this.thead.rows;
  11402. return rows.length > 1 ? $$(rows) : rows.length ? document.id(rows[0]) : false;
  11403. },
  11404. setHeaders: function(headers){
  11405. this.set('headers', headers);
  11406. return this;
  11407. },
  11408. setFooters: function(footers){
  11409. this.set('footers', footers);
  11410. return this;
  11411. },
  11412. update: function(tr, row, tag){
  11413. var tds = tr.getChildren(tag || 'td'), last = tds.length - 1;
  11414. row.each(function(data, index){
  11415. var td = tds[index] || new Element(tag || 'td').inject(tr),
  11416. content = ((data && Object.prototype.hasOwnProperty.call(data, 'content')) ? data.content : '') || data,
  11417. type = typeOf(content);
  11418. if (data && Object.prototype.hasOwnProperty.call(data, 'properties')) td.set(data.properties);
  11419. if (/(element(s?)|array|collection)/.test(type)) td.empty().adopt(content);
  11420. else td.set('html', content);
  11421. if (index > last) tds.push(td);
  11422. else tds[index] = td;
  11423. });
  11424. return {
  11425. tr: tr,
  11426. tds: tds
  11427. };
  11428. },
  11429. push: function(row, rowProperties, target, tag, where){
  11430. if (typeOf(row) == 'element' && row.get('tag') == 'tr'){
  11431. row.inject(target || this.body, where);
  11432. return {
  11433. tr: row,
  11434. tds: row.getChildren('td')
  11435. };
  11436. }
  11437. return this.update(new Element('tr', rowProperties).inject(target || this.body, where), row, tag);
  11438. },
  11439. pushMany: function(rows, rowProperties, target, tag, where){
  11440. return rows.map(function(row){
  11441. return this.push(row, rowProperties, target, tag, where);
  11442. }, this);
  11443. }
  11444. });
  11445. })();
  11446. ['adopt', 'inject', 'wraps', 'grab', 'replaces', 'dispose'].each(function(method){
  11447. HtmlTable.implement(method, function(){
  11448. this.element[method].apply(this.element, arguments);
  11449. return this;
  11450. });
  11451. });
  11452. /*
  11453. ---
  11454. script: HtmlTable.Select.js
  11455. name: HtmlTable.Select
  11456. description: Builds a stripy, sortable table with methods to add rows. Rows can be selected with the mouse or keyboard navigation.
  11457. license: MIT-style license
  11458. authors:
  11459. - Harald Kirschner
  11460. - Aaron Newton
  11461. requires:
  11462. - Keyboard
  11463. - Keyboard.Extras
  11464. - HtmlTable
  11465. - Class.refactor
  11466. - Element.Delegation.Pseudo
  11467. - Element.Shortcuts
  11468. provides: [HtmlTable.Select]
  11469. ...
  11470. */
  11471. HtmlTable = Class.refactor(HtmlTable, {
  11472. options: {
  11473. /*onRowFocus: function(){},
  11474. onRowUnfocus: function(){},*/
  11475. useKeyboard: true,
  11476. classRowSelected: 'table-tr-selected',
  11477. classRowHovered: 'table-tr-hovered',
  11478. classSelectable: 'table-selectable',
  11479. shiftForMultiSelect: true,
  11480. allowMultiSelect: true,
  11481. selectable: false,
  11482. selectHiddenRows: false
  11483. },
  11484. initialize: function(){
  11485. this.previous.apply(this, arguments);
  11486. if (this.occluded) return this.occluded;
  11487. this.selectedRows = new Elements();
  11488. if (!this.bound) this.bound = {};
  11489. this.bound.mouseleave = this.mouseleave.bind(this);
  11490. this.bound.clickRow = this.clickRow.bind(this);
  11491. this.bound.activateKeyboard = function(){
  11492. if (this.keyboard && this.selectEnabled) this.keyboard.activate();
  11493. }.bind(this);
  11494. if (this.options.selectable) this.enableSelect();
  11495. },
  11496. empty: function(){
  11497. if (this.body.rows.length) this.selectNone();
  11498. return this.previous();
  11499. },
  11500. enableSelect: function(){
  11501. this.selectEnabled = true;
  11502. this.attachSelects();
  11503. this.element.addClass(this.options.classSelectable);
  11504. return this;
  11505. },
  11506. disableSelect: function(){
  11507. this.selectEnabled = false;
  11508. this.attachSelects(false);
  11509. this.element.removeClass(this.options.classSelectable);
  11510. return this;
  11511. },
  11512. push: function(){
  11513. var ret = this.previous.apply(this, arguments);
  11514. this.updateSelects();
  11515. return ret;
  11516. },
  11517. toggleRow: function(row){
  11518. return this[(this.isSelected(row) ? 'de' : '') + 'selectRow'](row);
  11519. },
  11520. selectRow: function(row, _nocheck){
  11521. //private variable _nocheck: boolean whether or not to confirm the row is in the table body
  11522. //added here for optimization when selecting ranges
  11523. if (this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
  11524. if (!this.options.allowMultiSelect) this.selectNone();
  11525. if (!this.isSelected(row)){
  11526. this.selectedRows.push(row);
  11527. row.addClass(this.options.classRowSelected);
  11528. this.fireEvent('rowFocus', [row, this.selectedRows]);
  11529. this.fireEvent('stateChanged');
  11530. }
  11531. this.focused = row;
  11532. document.clearSelection();
  11533. return this;
  11534. },
  11535. isSelected: function(row){
  11536. return this.selectedRows.contains(row);
  11537. },
  11538. getSelected: function(){
  11539. return this.selectedRows;
  11540. },
  11541. serialize: function(){
  11542. var previousSerialization = this.previous.apply(this, arguments) || {};
  11543. if (this.options.selectable){
  11544. previousSerialization.selectedRows = this.selectedRows.map(function(row){
  11545. return Array.indexOf(this.body.rows, row);
  11546. }.bind(this));
  11547. }
  11548. return previousSerialization;
  11549. },
  11550. restore: function(tableState){
  11551. if (this.options.selectable && tableState.selectedRows){
  11552. tableState.selectedRows.each(function(index){
  11553. this.selectRow(this.body.rows[index]);
  11554. }.bind(this));
  11555. }
  11556. this.previous.apply(this, arguments);
  11557. },
  11558. deselectRow: function(row, _nocheck){
  11559. if (!this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
  11560. this.selectedRows = new Elements(Array.convert(this.selectedRows).erase(row));
  11561. row.removeClass(this.options.classRowSelected);
  11562. this.fireEvent('rowUnfocus', [row, this.selectedRows]);
  11563. this.fireEvent('stateChanged');
  11564. return this;
  11565. },
  11566. selectAll: function(selectNone){
  11567. if (!selectNone && !this.options.allowMultiSelect) return;
  11568. this.selectRange(0, this.body.rows.length, selectNone);
  11569. return this;
  11570. },
  11571. selectNone: function(){
  11572. return this.selectAll(true);
  11573. },
  11574. selectRange: function(startRow, endRow, _deselect){
  11575. if (!this.options.allowMultiSelect && !_deselect) return;
  11576. var method = _deselect ? 'deselectRow' : 'selectRow',
  11577. rows = Array.clone(this.body.rows);
  11578. if (typeOf(startRow) == 'element') startRow = rows.indexOf(startRow);
  11579. if (typeOf(endRow) == 'element') endRow = rows.indexOf(endRow);
  11580. endRow = endRow < rows.length - 1 ? endRow : rows.length - 1;
  11581. if (endRow < startRow){
  11582. var tmp = startRow;
  11583. startRow = endRow;
  11584. endRow = tmp;
  11585. }
  11586. for (var i = startRow; i <= endRow; i++){
  11587. if (this.options.selectHiddenRows || rows[i].isDisplayed()) this[method](rows[i], true);
  11588. }
  11589. return this;
  11590. },
  11591. deselectRange: function(startRow, endRow){
  11592. this.selectRange(startRow, endRow, true);
  11593. },
  11594. /*
  11595. Private methods:
  11596. */
  11597. enterRow: function(row){
  11598. if (this.hovered) this.hovered = this.leaveRow(this.hovered);
  11599. this.hovered = row.addClass(this.options.classRowHovered);
  11600. },
  11601. leaveRow: function(row){
  11602. row.removeClass(this.options.classRowHovered);
  11603. },
  11604. updateSelects: function(){
  11605. Array.each(this.body.rows, function(row){
  11606. var binders = row.retrieve('binders');
  11607. if (!binders && !this.selectEnabled) return;
  11608. if (!binders){
  11609. binders = {
  11610. mouseenter: this.enterRow.pass([row], this),
  11611. mouseleave: this.leaveRow.pass([row], this)
  11612. };
  11613. row.store('binders', binders);
  11614. }
  11615. if (this.selectEnabled) row.addEvents(binders);
  11616. else row.removeEvents(binders);
  11617. }, this);
  11618. },
  11619. shiftFocus: function(offset, event){
  11620. if (!this.focused) return this.selectRow(this.body.rows[0], event);
  11621. var to = this.getRowByOffset(offset, this.options.selectHiddenRows);
  11622. if (to === null || this.focused == this.body.rows[to]) return this;
  11623. this.toggleRow(this.body.rows[to], event);
  11624. },
  11625. clickRow: function(event, row){
  11626. var selecting = (event.shift || event.meta || event.control) && this.options.shiftForMultiSelect;
  11627. if (!selecting && !(event.rightClick && this.isSelected(row) && this.options.allowMultiSelect)) this.selectNone();
  11628. if (event.rightClick) this.selectRow(row);
  11629. else this.toggleRow(row);
  11630. if (event.shift){
  11631. this.selectRange(this.rangeStart || this.body.rows[0], row, this.rangeStart ? !this.isSelected(row) : true);
  11632. this.focused = row;
  11633. }
  11634. this.rangeStart = row;
  11635. },
  11636. getRowByOffset: function(offset, includeHiddenRows){
  11637. if (!this.focused) return 0;
  11638. var index = Array.indexOf(this.body.rows, this.focused);
  11639. if ((index == 0 && offset < 0) || (index == this.body.rows.length -1 && offset > 0)) return null;
  11640. if (includeHiddenRows){
  11641. index += offset;
  11642. } else {
  11643. var limit = 0,
  11644. count = 0;
  11645. if (offset > 0){
  11646. while (count < offset && index < this.body.rows.length -1){
  11647. if (this.body.rows[++index].isDisplayed()) count++;
  11648. }
  11649. } else {
  11650. while (count > offset && index > 0){
  11651. if (this.body.rows[--index].isDisplayed()) count--;
  11652. }
  11653. }
  11654. }
  11655. return index;
  11656. },
  11657. attachSelects: function(attach){
  11658. attach = attach != null ? attach : true;
  11659. var method = attach ? 'addEvents' : 'removeEvents';
  11660. this.element[method]({
  11661. mouseleave: this.bound.mouseleave,
  11662. click: this.bound.activateKeyboard
  11663. });
  11664. this.body[method]({
  11665. 'click:relay(tr)': this.bound.clickRow,
  11666. 'contextmenu:relay(tr)': this.bound.clickRow
  11667. });
  11668. if (this.options.useKeyboard || this.keyboard){
  11669. if (!this.keyboard) this.keyboard = new Keyboard();
  11670. if (!this.selectKeysDefined){
  11671. this.selectKeysDefined = true;
  11672. var timer, held;
  11673. var move = function(offset){
  11674. var mover = function(e){
  11675. clearTimeout(timer);
  11676. e.preventDefault();
  11677. var to = this.body.rows[this.getRowByOffset(offset, this.options.selectHiddenRows)];
  11678. if (e.shift && to && this.isSelected(to)){
  11679. this.deselectRow(this.focused);
  11680. this.focused = to;
  11681. } else {
  11682. if (to && (!this.options.allowMultiSelect || !e.shift)){
  11683. this.selectNone();
  11684. }
  11685. this.shiftFocus(offset, e);
  11686. }
  11687. if (held){
  11688. timer = mover.delay(100, this, e);
  11689. } else {
  11690. timer = (function(){
  11691. held = true;
  11692. mover(e);
  11693. }).delay(400);
  11694. }
  11695. }.bind(this);
  11696. return mover;
  11697. }.bind(this);
  11698. var clear = function(){
  11699. clearTimeout(timer);
  11700. held = false;
  11701. };
  11702. this.keyboard.addEvents({
  11703. 'keydown:shift+up': move(-1),
  11704. 'keydown:shift+down': move(1),
  11705. 'keyup:shift+up': clear,
  11706. 'keyup:shift+down': clear,
  11707. 'keyup:up': clear,
  11708. 'keyup:down': clear
  11709. });
  11710. var shiftHint = '';
  11711. if (this.options.allowMultiSelect && this.options.shiftForMultiSelect && this.options.useKeyboard){
  11712. shiftHint = ' (Shift multi-selects).';
  11713. }
  11714. this.keyboard.addShortcuts({
  11715. 'Select Previous Row': {
  11716. keys: 'up',
  11717. shortcut: 'up arrow',
  11718. handler: move(-1),
  11719. description: 'Select the previous row in the table.' + shiftHint
  11720. },
  11721. 'Select Next Row': {
  11722. keys: 'down',
  11723. shortcut: 'down arrow',
  11724. handler: move(1),
  11725. description: 'Select the next row in the table.' + shiftHint
  11726. }
  11727. });
  11728. }
  11729. this.keyboard[attach ? 'activate' : 'deactivate']();
  11730. }
  11731. this.updateSelects();
  11732. },
  11733. mouseleave: function(){
  11734. if (this.hovered) this.leaveRow(this.hovered);
  11735. }
  11736. });
  11737. /*
  11738. ---
  11739. script: HtmlTable.Sort.js
  11740. name: HtmlTable.Sort
  11741. description: Builds a stripy, sortable table with methods to add rows.
  11742. license: MIT-style license
  11743. authors:
  11744. - Harald Kirschner
  11745. - Aaron Newton
  11746. - Jacob Thornton
  11747. requires:
  11748. - Core/Hash
  11749. - HtmlTable
  11750. - Class.refactor
  11751. - Element.Delegation.Pseudo
  11752. - String.Extras
  11753. - Date
  11754. provides: [HtmlTable.Sort]
  11755. ...
  11756. */
  11757. (function(){
  11758. var readOnlyNess = document.createElement('table');
  11759. try {
  11760. readOnlyNess.innerHTML = '<tr><td></td></tr>';
  11761. readOnlyNess = readOnlyNess.childNodes.length === 0;
  11762. } catch (e){
  11763. readOnlyNess = true;
  11764. }
  11765. HtmlTable = Class.refactor(HtmlTable, {
  11766. options: {/*
  11767. onSort: function(){}, */
  11768. sortIndex: 0,
  11769. sortReverse: false,
  11770. parsers: [],
  11771. defaultParser: 'string',
  11772. classSortable: 'table-sortable',
  11773. classHeadSort: 'table-th-sort',
  11774. classHeadSortRev: 'table-th-sort-rev',
  11775. classNoSort: 'table-th-nosort',
  11776. classGroupHead: 'table-tr-group-head',
  11777. classGroup: 'table-tr-group',
  11778. classCellSort: 'table-td-sort',
  11779. classSortSpan: 'table-th-sort-span',
  11780. sortable: false,
  11781. thSelector: 'th'
  11782. },
  11783. initialize: function(){
  11784. this.previous.apply(this, arguments);
  11785. if (this.occluded) return this.occluded;
  11786. this.sorted = {index: null, dir: 1};
  11787. if (!this.bound) this.bound = {};
  11788. this.bound.headClick = this.headClick.bind(this);
  11789. this.sortSpans = new Elements();
  11790. if (this.options.sortable){
  11791. this.enableSort();
  11792. if (this.options.sortIndex != null) this.sort(this.options.sortIndex, this.options.sortReverse);
  11793. }
  11794. },
  11795. attachSorts: function(attach){
  11796. this.detachSorts();
  11797. if (attach !== false) this.element.addEvent('click:relay(' + this.options.thSelector + ')', this.bound.headClick);
  11798. },
  11799. detachSorts: function(){
  11800. this.element.removeEvents('click:relay(' + this.options.thSelector + ')');
  11801. },
  11802. setHeaders: function(){
  11803. this.previous.apply(this, arguments);
  11804. if (this.sortable) this.setParsers();
  11805. },
  11806. setParsers: function(){
  11807. this.parsers = this.detectParsers();
  11808. },
  11809. detectParsers: function(){
  11810. return this.head && this.head.getElements(this.options.thSelector).flatten().map(this.detectParser, this);
  11811. },
  11812. detectParser: function(cell, index){
  11813. if (cell.hasClass(this.options.classNoSort) || cell.retrieve('htmltable-parser')) return cell.retrieve('htmltable-parser');
  11814. var thDiv = new Element('div');
  11815. thDiv.adopt(cell.childNodes).inject(cell);
  11816. var sortSpan = new Element('span', {'class': this.options.classSortSpan}).inject(thDiv, 'top');
  11817. this.sortSpans.push(sortSpan);
  11818. var parser = this.options.parsers[index],
  11819. rows = this.body.rows,
  11820. cancel;
  11821. switch (typeOf(parser)){
  11822. case 'function': parser = {convert: parser}; cancel = true; break;
  11823. case 'string': parser = parser; cancel = true; break;
  11824. }
  11825. if (!cancel){
  11826. HtmlTable.ParserPriority.some(function(parserName){
  11827. var current = HtmlTable.Parsers[parserName],
  11828. match = current.match;
  11829. if (!match) return false;
  11830. for (var i = 0, j = rows.length; i < j; i++){
  11831. var cell = document.id(rows[i].cells[index]),
  11832. text = cell ? cell.get('html').clean() : '';
  11833. if (text && match.test(text)){
  11834. parser = current;
  11835. return true;
  11836. }
  11837. }
  11838. });
  11839. }
  11840. if (!parser) parser = this.options.defaultParser;
  11841. cell.store('htmltable-parser', parser);
  11842. return parser;
  11843. },
  11844. headClick: function(event, el){
  11845. if (!this.head || el.hasClass(this.options.classNoSort)) return;
  11846. return this.sort(Array.indexOf(this.head.getElements(this.options.thSelector).flatten(), el) % this.body.rows[0].cells.length);
  11847. },
  11848. serialize: function(){
  11849. var previousSerialization = this.previous.apply(this, arguments) || {};
  11850. if (this.options.sortable){
  11851. previousSerialization.sortIndex = this.sorted.index;
  11852. previousSerialization.sortReverse = this.sorted.reverse;
  11853. }
  11854. return previousSerialization;
  11855. },
  11856. restore: function(tableState){
  11857. if (this.options.sortable && tableState.sortIndex){
  11858. this.sort(tableState.sortIndex, tableState.sortReverse);
  11859. }
  11860. this.previous.apply(this, arguments);
  11861. },
  11862. setSortedState: function(index, reverse){
  11863. if (reverse != null) this.sorted.reverse = reverse;
  11864. else if (this.sorted.index == index) this.sorted.reverse = !this.sorted.reverse;
  11865. else this.sorted.reverse = this.sorted.index == null;
  11866. if (index != null) this.sorted.index = index;
  11867. },
  11868. setHeadSort: function(sorted){
  11869. var head = $$(!this.head.length ? this.head.cells[this.sorted.index] : this.head.map(function(row){
  11870. return row.getElements(this.options.thSelector)[this.sorted.index];
  11871. }, this).clean());
  11872. if (!head.length) return;
  11873. if (sorted){
  11874. head.addClass(this.options.classHeadSort);
  11875. if (this.sorted.reverse) head.addClass(this.options.classHeadSortRev);
  11876. else head.removeClass(this.options.classHeadSortRev);
  11877. } else {
  11878. head.removeClass(this.options.classHeadSort).removeClass(this.options.classHeadSortRev);
  11879. }
  11880. },
  11881. setRowSort: function(data, pre){
  11882. var count = data.length,
  11883. body = this.body,
  11884. group,
  11885. rowIndex;
  11886. while (count){
  11887. var item = data[--count],
  11888. position = item.position,
  11889. row = body.rows[position];
  11890. if (row.disabled) continue;
  11891. if (!pre){
  11892. group = this.setGroupSort(group, row, item);
  11893. this.setRowStyle(row, count);
  11894. }
  11895. body.appendChild(row);
  11896. for (rowIndex = 0; rowIndex < count; rowIndex++){
  11897. if (data[rowIndex].position > position) data[rowIndex].position--;
  11898. }
  11899. }
  11900. },
  11901. setRowStyle: function(row, i){
  11902. this.previous(row, i);
  11903. row.cells[this.sorted.index].addClass(this.options.classCellSort);
  11904. },
  11905. setGroupSort: function(group, row, item){
  11906. if (group == item.value) row.removeClass(this.options.classGroupHead).addClass(this.options.classGroup);
  11907. else row.removeClass(this.options.classGroup).addClass(this.options.classGroupHead);
  11908. return item.value;
  11909. },
  11910. getParser: function(){
  11911. var parser = this.parsers[this.sorted.index];
  11912. return typeOf(parser) == 'string' ? HtmlTable.Parsers[parser] : parser;
  11913. },
  11914. sort: function(index, reverse, pre, sortFunction){
  11915. if (!this.head) return;
  11916. if (!pre){
  11917. this.clearSort();
  11918. this.setSortedState(index, reverse);
  11919. this.setHeadSort(true);
  11920. }
  11921. var parser = this.getParser();
  11922. if (!parser) return;
  11923. var rel;
  11924. if (!readOnlyNess){
  11925. rel = this.body.getParent();
  11926. this.body.dispose();
  11927. }
  11928. var data = this.parseData(parser).sort(sortFunction ? sortFunction : function(a, b){
  11929. if (a.value === b.value) return 0;
  11930. return a.value > b.value ? 1 : -1;
  11931. });
  11932. var reversed = this.sorted.reverse == (parser == HtmlTable.Parsers['input-checked']);
  11933. if (reversed) data.reverse(true);
  11934. this.setRowSort(data, pre);
  11935. if (rel) rel.grab(this.body);
  11936. this.fireEvent('stateChanged');
  11937. return this.fireEvent('sort', [this.body, this.sorted.index, reversed ? 'asc' : 'desc']);
  11938. },
  11939. parseData: function(parser){
  11940. return Array.map(this.body.rows, function(row, i){
  11941. var value = parser.convert.call(document.id(row.cells[this.sorted.index]));
  11942. return {
  11943. position: i,
  11944. value: value
  11945. };
  11946. }, this);
  11947. },
  11948. clearSort: function(){
  11949. this.setHeadSort(false);
  11950. this.body.getElements('td').removeClass(this.options.classCellSort);
  11951. },
  11952. reSort: function(){
  11953. if (this.sortable) this.sort.call(this, this.sorted.index, this.sorted.reverse);
  11954. return this;
  11955. },
  11956. enableSort: function(){
  11957. this.element.addClass(this.options.classSortable);
  11958. this.attachSorts(true);
  11959. this.setParsers();
  11960. this.sortable = true;
  11961. return this;
  11962. },
  11963. disableSort: function(){
  11964. this.element.removeClass(this.options.classSortable);
  11965. this.attachSorts(false);
  11966. this.sortSpans.each(function(span){
  11967. span.destroy();
  11968. });
  11969. this.sortSpans.empty();
  11970. this.sortable = false;
  11971. return this;
  11972. }
  11973. });
  11974. HtmlTable.ParserPriority = ['date', 'input-checked', 'input-value', 'float', 'number'];
  11975. HtmlTable.Parsers = {
  11976. 'date': {
  11977. match: /^\d{2}[-\/ ]\d{2}[-\/ ]\d{2,4}$/,
  11978. convert: function(){
  11979. var d = Date.parse(this.get('text').stripTags());
  11980. return (typeOf(d) == 'date') ? d.format('db') : '';
  11981. },
  11982. type: 'date'
  11983. },
  11984. 'input-checked': {
  11985. match: / type="(radio|checkbox)"/,
  11986. convert: function(){
  11987. return this.getElement('input').checked;
  11988. }
  11989. },
  11990. 'input-value': {
  11991. match: /<input/,
  11992. convert: function(){
  11993. return this.getElement('input').value;
  11994. }
  11995. },
  11996. 'number': {
  11997. match: /^\d+[^\d.,]*$/,
  11998. convert: function(){
  11999. return this.get('text').stripTags().toInt();
  12000. },
  12001. number: true
  12002. },
  12003. 'numberLax': {
  12004. match: /^[^\d]+\d+$/,
  12005. convert: function(){
  12006. return this.get('text').replace(/[^-?^0-9]/, '').stripTags().toInt();
  12007. },
  12008. number: true
  12009. },
  12010. 'float': {
  12011. match: /^[\d]+\.[\d]+/,
  12012. convert: function(){
  12013. return this.get('text').replace(/[^-?^\d.e]/, '').stripTags().toFloat();
  12014. },
  12015. number: true
  12016. },
  12017. 'floatLax': {
  12018. match: /^[^\d]+[\d]+\.[\d]+$/,
  12019. convert: function(){
  12020. return this.get('text').replace(/[^-?^\d.]/, '').stripTags().toFloat();
  12021. },
  12022. number: true
  12023. },
  12024. 'string': {
  12025. match: null,
  12026. convert: function(){
  12027. return this.get('text').stripTags().toLowerCase();
  12028. }
  12029. },
  12030. 'title': {
  12031. match: null,
  12032. convert: function(){
  12033. return this.title;
  12034. }
  12035. }
  12036. };
  12037. //<1.2compat>
  12038. HtmlTable.Parsers = new Hash(HtmlTable.Parsers);
  12039. //</1.2compat>
  12040. HtmlTable.defineParsers = function(parsers){
  12041. HtmlTable.Parsers = Object.append(HtmlTable.Parsers, parsers);
  12042. for (var parser in parsers){
  12043. HtmlTable.ParserPriority.unshift(parser);
  12044. }
  12045. };
  12046. })();
  12047. /*
  12048. ---
  12049. script: HtmlTable.Zebra.js
  12050. name: HtmlTable.Zebra
  12051. description: Builds a stripy table with methods to add rows.
  12052. license: MIT-style license
  12053. authors:
  12054. - Harald Kirschner
  12055. - Aaron Newton
  12056. requires:
  12057. - HtmlTable
  12058. - Element.Shortcuts
  12059. - Class.refactor
  12060. provides: [HtmlTable.Zebra]
  12061. ...
  12062. */
  12063. HtmlTable = Class.refactor(HtmlTable, {
  12064. options: {
  12065. classZebra: 'table-tr-odd',
  12066. zebra: true,
  12067. zebraOnlyVisibleRows: true
  12068. },
  12069. initialize: function(){
  12070. this.previous.apply(this, arguments);
  12071. if (this.occluded) return this.occluded;
  12072. if (this.options.zebra) this.updateZebras();
  12073. },
  12074. updateZebras: function(){
  12075. var index = 0;
  12076. Array.each(this.body.rows, function(row){
  12077. if (!this.options.zebraOnlyVisibleRows || row.isDisplayed()){
  12078. this.zebra(row, index++);
  12079. }
  12080. }, this);
  12081. },
  12082. setRowStyle: function(row, i){
  12083. if (this.previous) this.previous(row, i);
  12084. this.zebra(row, i);
  12085. },
  12086. zebra: function(row, i){
  12087. return row[((i % 2) ? 'remove' : 'add')+'Class'](this.options.classZebra);
  12088. },
  12089. push: function(){
  12090. var pushed = this.previous.apply(this, arguments);
  12091. if (this.options.zebra) this.updateZebras();
  12092. return pushed;
  12093. }
  12094. });
  12095. /*
  12096. ---
  12097. script: Scroller.js
  12098. name: Scroller
  12099. description: Class which scrolls the contents of any Element (including the window) when the mouse reaches the Element's boundaries.
  12100. license: MIT-style license
  12101. authors:
  12102. - Valerio Proietti
  12103. requires:
  12104. - Core/Events
  12105. - Core/Options
  12106. - Core/Element.Event
  12107. - Core/Element.Dimensions
  12108. - MooTools.More
  12109. provides: [Scroller]
  12110. ...
  12111. */
  12112. (function(){
  12113. var Scroller = this.Scroller = new Class({
  12114. Implements: [Events, Options],
  12115. options: {
  12116. area: 20,
  12117. velocity: 1,
  12118. onChange: function(x, y){
  12119. this.element.scrollTo(x, y);
  12120. },
  12121. fps: 50
  12122. },
  12123. initialize: function(element, options){
  12124. this.setOptions(options);
  12125. this.element = document.id(element);
  12126. this.docBody = document.id(this.element.getDocument().body);
  12127. this.listener = (typeOf(this.element) != 'element') ? this.docBody : this.element;
  12128. this.timer = null;
  12129. this.bound = {
  12130. attach: this.attach.bind(this),
  12131. detach: this.detach.bind(this),
  12132. getCoords: this.getCoords.bind(this)
  12133. };
  12134. },
  12135. start: function(){
  12136. this.listener.addEvents({
  12137. mouseover: this.bound.attach,
  12138. mouseleave: this.bound.detach
  12139. });
  12140. return this;
  12141. },
  12142. stop: function(){
  12143. this.listener.removeEvents({
  12144. mouseover: this.bound.attach,
  12145. mouseleave: this.bound.detach
  12146. });
  12147. this.detach();
  12148. this.timer = clearInterval(this.timer);
  12149. return this;
  12150. },
  12151. attach: function(){
  12152. this.listener.addEvent('mousemove', this.bound.getCoords);
  12153. },
  12154. detach: function(){
  12155. this.listener.removeEvent('mousemove', this.bound.getCoords);
  12156. this.timer = clearInterval(this.timer);
  12157. },
  12158. getCoords: function(event){
  12159. this.page = (this.listener.get('tag') == 'body') ? event.client : event.page;
  12160. if (!this.timer) this.timer = this.scroll.periodical(Math.round(1000 / this.options.fps), this);
  12161. },
  12162. scroll: function(){
  12163. var size = this.element.getSize(),
  12164. scroll = this.element.getScroll(),
  12165. pos = ((this.element != this.docBody) && (this.element != window)) ? this.element.getOffsets() : {x: 0, y: 0},
  12166. scrollSize = this.element.getScrollSize(),
  12167. change = {x: 0, y: 0},
  12168. top = this.options.area.top || this.options.area,
  12169. bottom = this.options.area.bottom || this.options.area;
  12170. for (var z in this.page){
  12171. if (this.page[z] < (top + pos[z]) && scroll[z] != 0){
  12172. change[z] = (this.page[z] - top - pos[z]) * this.options.velocity;
  12173. } else if (this.page[z] + bottom > (size[z] + pos[z]) && scroll[z] + size[z] != scrollSize[z]){
  12174. change[z] = (this.page[z] - size[z] + bottom - pos[z]) * this.options.velocity;
  12175. }
  12176. change[z] = change[z].round();
  12177. }
  12178. if (change.y || change.x) this.fireEvent('change', [scroll.x + change.x, scroll.y + change.y]);
  12179. }
  12180. });
  12181. })();
  12182. /*
  12183. ---
  12184. script: Tips.js
  12185. name: Tips
  12186. description: Class for creating nice tips that follow the mouse cursor when hovering an element.
  12187. license: MIT-style license
  12188. authors:
  12189. - Valerio Proietti
  12190. - Christoph Pojer
  12191. - Luis Merino
  12192. requires:
  12193. - Core/Options
  12194. - Core/Events
  12195. - Core/Element.Event
  12196. - Core/Element.Style
  12197. - Core/Element.Dimensions
  12198. - MooTools.More
  12199. provides: [Tips]
  12200. ...
  12201. */
  12202. (function(){
  12203. var read = function(option, element){
  12204. return (option) ? (typeOf(option) == 'function' ? option(element) : element.get(option)) : '';
  12205. };
  12206. var Tips = this.Tips = new Class({
  12207. Implements: [Events, Options],
  12208. options: {/*
  12209. id: null,
  12210. onAttach: function(element){},
  12211. onDetach: function(element){},
  12212. onBound: function(coords){},*/
  12213. onShow: function(){
  12214. this.tip.setStyle('display', 'block');
  12215. },
  12216. onHide: function(){
  12217. this.tip.setStyle('display', 'none');
  12218. },
  12219. title: 'title',
  12220. text: function(element){
  12221. return element.get('rel') || element.get('href');
  12222. },
  12223. showDelay: 100,
  12224. hideDelay: 100,
  12225. className: 'tip-wrap',
  12226. offset: {x: 16, y: 16},
  12227. windowPadding: {x:0, y:0},
  12228. fixed: false,
  12229. waiAria: true,
  12230. hideEmpty: false
  12231. },
  12232. initialize: function(){
  12233. var params = Array.link(arguments, {
  12234. options: Type.isObject,
  12235. elements: function(obj){
  12236. return obj != null;
  12237. }
  12238. });
  12239. this.setOptions(params.options);
  12240. if (params.elements) this.attach(params.elements);
  12241. this.container = new Element('div', {'class': 'tip'});
  12242. if (this.options.id){
  12243. this.container.set('id', this.options.id);
  12244. if (this.options.waiAria) this.attachWaiAria();
  12245. }
  12246. },
  12247. toElement: function(){
  12248. if (this.tip) return this.tip;
  12249. this.tip = new Element('div', {
  12250. 'class': this.options.className,
  12251. styles: {
  12252. position: 'absolute',
  12253. top: 0,
  12254. left: 0,
  12255. display: 'none'
  12256. }
  12257. }).adopt(
  12258. new Element('div', {'class': 'tip-top'}),
  12259. this.container,
  12260. new Element('div', {'class': 'tip-bottom'})
  12261. );
  12262. return this.tip;
  12263. },
  12264. attachWaiAria: function(){
  12265. var id = this.options.id;
  12266. this.container.set('role', 'tooltip');
  12267. if (!this.waiAria){
  12268. this.waiAria = {
  12269. show: function(element){
  12270. if (id) element.set('aria-describedby', id);
  12271. this.container.set('aria-hidden', 'false');
  12272. },
  12273. hide: function(element){
  12274. if (id) element.erase('aria-describedby');
  12275. this.container.set('aria-hidden', 'true');
  12276. }
  12277. };
  12278. }
  12279. this.addEvents(this.waiAria);
  12280. },
  12281. detachWaiAria: function(){
  12282. if (this.waiAria){
  12283. this.container.erase('role');
  12284. this.container.erase('aria-hidden');
  12285. this.removeEvents(this.waiAria);
  12286. }
  12287. },
  12288. attach: function(elements){
  12289. $$(elements).each(function(element){
  12290. var title = read(this.options.title, element),
  12291. text = read(this.options.text, element);
  12292. element.set('title', '').store('tip:native', title).retrieve('tip:title', title);
  12293. element.retrieve('tip:text', text);
  12294. this.fireEvent('attach', [element]);
  12295. var events = ['enter', 'leave'];
  12296. if (!this.options.fixed) events.push('move');
  12297. events.each(function(value){
  12298. var event = element.retrieve('tip:' + value);
  12299. if (!event) event = function(event){
  12300. this['element' + value.capitalize()].apply(this, [event, element]);
  12301. }.bind(this);
  12302. element.store('tip:' + value, event).addEvent('mouse' + value, event);
  12303. }, this);
  12304. }, this);
  12305. return this;
  12306. },
  12307. detach: function(elements){
  12308. $$(elements).each(function(element){
  12309. ['enter', 'leave', 'move'].each(function(value){
  12310. element.removeEvent('mouse' + value, element.retrieve('tip:' + value)).eliminate('tip:' + value);
  12311. });
  12312. this.fireEvent('detach', [element]);
  12313. if (this.options.title == 'title'){ // This is necessary to check if we can revert the title
  12314. var original = element.retrieve('tip:native');
  12315. if (original) element.set('title', original);
  12316. }
  12317. }, this);
  12318. return this;
  12319. },
  12320. elementEnter: function(event, element){
  12321. clearTimeout(this.timer);
  12322. this.timer = (function(){
  12323. this.container.empty();
  12324. var showTip = !this.options.hideEmpty;
  12325. ['title', 'text'].each(function(value){
  12326. var content = element.retrieve('tip:' + value);
  12327. var div = this['_' + value + 'Element'] = new Element('div', {
  12328. 'class': 'tip-' + value
  12329. }).inject(this.container);
  12330. if (content){
  12331. this.fill(div, content);
  12332. showTip = true;
  12333. }
  12334. }, this);
  12335. if (showTip){
  12336. this.show(element);
  12337. } else {
  12338. this.hide(element);
  12339. }
  12340. this.position((this.options.fixed) ? {page: element.getPosition()} : event);
  12341. }).delay(this.options.showDelay, this);
  12342. },
  12343. elementLeave: function(event, element){
  12344. clearTimeout(this.timer);
  12345. this.timer = this.hide.delay(this.options.hideDelay, this, element);
  12346. this.fireForParent(event, element);
  12347. },
  12348. setTitle: function(title){
  12349. if (this._titleElement){
  12350. this._titleElement.empty();
  12351. this.fill(this._titleElement, title);
  12352. }
  12353. return this;
  12354. },
  12355. setText: function(text){
  12356. if (this._textElement){
  12357. this._textElement.empty();
  12358. this.fill(this._textElement, text);
  12359. }
  12360. return this;
  12361. },
  12362. fireForParent: function(event, element){
  12363. element = element.getParent();
  12364. if (!element || element == document.body) return;
  12365. if (element.retrieve('tip:enter')) element.fireEvent('mouseenter', event);
  12366. else this.fireForParent(event, element);
  12367. },
  12368. elementMove: function(event, element){
  12369. this.position(event);
  12370. },
  12371. position: function(event){
  12372. if (!this.tip) document.id(this);
  12373. var size = window.getSize(), scroll = window.getScroll(),
  12374. tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight},
  12375. props = {x: 'left', y: 'top'},
  12376. bounds = {y: false, x2: false, y2: false, x: false},
  12377. obj = {};
  12378. for (var z in props){
  12379. obj[props[z]] = event.page[z] + this.options.offset[z];
  12380. if (obj[props[z]] < 0) bounds[z] = true;
  12381. if ((obj[props[z]] + tip[z] - scroll[z]) > size[z] - this.options.windowPadding[z]){
  12382. obj[props[z]] = event.page[z] - this.options.offset[z] - tip[z];
  12383. bounds[z+'2'] = true;
  12384. }
  12385. }
  12386. this.fireEvent('bound', bounds);
  12387. this.tip.setStyles(obj);
  12388. },
  12389. fill: function(element, contents){
  12390. if (typeof contents == 'string') element.set('html', contents);
  12391. else element.adopt(contents);
  12392. },
  12393. show: function(element){
  12394. if (!this.tip) document.id(this);
  12395. if (!this.tip.getParent()) this.tip.inject(document.body);
  12396. this.fireEvent('show', [this.tip, element]);
  12397. },
  12398. hide: function(element){
  12399. if (!this.tip) document.id(this);
  12400. this.fireEvent('hide', [this.tip, element]);
  12401. }
  12402. });
  12403. })();
  12404. /*
  12405. ---
  12406. name: Locale.CH.Number
  12407. description: Number messages for Switzerland.
  12408. license: MIT-style license
  12409. authors:
  12410. - Kim D. Jeker
  12411. requires:
  12412. - Locale
  12413. provides: [Locale.CH.Number]
  12414. ...
  12415. */
  12416. Locale.define('CH', 'Number', {
  12417. decimal: ',',
  12418. group: '\'',
  12419. currency: {
  12420. decimal: '.',
  12421. suffix: ' CHF'
  12422. }
  12423. });
  12424. /*
  12425. ---
  12426. name: Locale.EU.Number
  12427. description: Number messages for Europe.
  12428. license: MIT-style license
  12429. authors:
  12430. - Arian Stolwijk
  12431. requires:
  12432. - Locale
  12433. provides: [Locale.EU.Number]
  12434. ...
  12435. */
  12436. Locale.define('EU', 'Number', {
  12437. decimal: ',',
  12438. group: '.',
  12439. currency: {
  12440. prefix: '€ '
  12441. }
  12442. });
  12443. /*
  12444. ---
  12445. script: Locale.Set.From.js
  12446. name: Locale.Set.From
  12447. description: Provides an alternative way to create Locale.Set objects.
  12448. license: MIT-style license
  12449. authors:
  12450. - Tim Wienk
  12451. requires:
  12452. - Core/JSON
  12453. - Locale
  12454. provides: Locale.Set.From
  12455. ...
  12456. */
  12457. (function(){
  12458. var parsers = {
  12459. 'json': JSON.decode
  12460. };
  12461. Locale.Set.defineParser = function(name, fn){
  12462. parsers[name] = fn;
  12463. };
  12464. Locale.Set.from = function(set, type){
  12465. if (instanceOf(set, Locale.Set)) return set;
  12466. if (!type && typeOf(set) == 'string') type = 'json';
  12467. if (parsers[type]) set = parsers[type](set);
  12468. var locale = new Locale.Set;
  12469. locale.sets = set.sets || {};
  12470. if (set.inherits){
  12471. locale.inherits.locales = Array.convert(set.inherits.locales);
  12472. locale.inherits.sets = set.inherits.sets || {};
  12473. }
  12474. return locale;
  12475. };
  12476. })();
  12477. /*
  12478. ---
  12479. name: Locale.ZA.Number
  12480. description: Number messages for ZA.
  12481. license: MIT-style license
  12482. authors:
  12483. - Werner Mollentze
  12484. requires:
  12485. - Locale
  12486. provides: [Locale.ZA.Number]
  12487. ...
  12488. */
  12489. Locale.define('ZA', 'Number', {
  12490. decimal: '.',
  12491. group: ',',
  12492. currency: {
  12493. prefix: 'R '
  12494. }
  12495. });
  12496. /*
  12497. ---
  12498. name: Locale.af-ZA.Date
  12499. description: Date messages for ZA Afrikaans.
  12500. license: MIT-style license
  12501. authors:
  12502. - Werner Mollentze
  12503. requires:
  12504. - Locale
  12505. provides: [Locale.af-ZA.Date]
  12506. ...
  12507. */
  12508. Locale.define('af-ZA', 'Date', {
  12509. months: ['Januarie', 'Februarie', 'Maart', 'April', 'Mei', 'Junie', 'Julie', 'Augustus', 'September', 'Oktober', 'November', 'Desember'],
  12510. months_abbr: ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
  12511. days: ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'],
  12512. days_abbr: ['Son', 'Maa', 'Din', 'Woe', 'Don', 'Vry', 'Sat'],
  12513. // Culture's date order: MM/DD/YYYY
  12514. dateOrder: ['date', 'month', 'year'],
  12515. shortDate: '%d-%m-%Y',
  12516. shortTime: '%H:%M',
  12517. AM: 'VM',
  12518. PM: 'NM',
  12519. firstDayOfWeek: 1,
  12520. // Date.Extras
  12521. ordinal: function(dayOfMonth){
  12522. return ((dayOfMonth > 1 && dayOfMonth < 20 && dayOfMonth != 8) || (dayOfMonth > 100 && dayOfMonth.toString().substr(-2, 1) == '1')) ? 'de' : 'ste';
  12523. },
  12524. lessThanMinuteAgo: 'minder as \'n minuut gelede',
  12525. minuteAgo: 'ongeveer \'n minuut gelede',
  12526. minutesAgo: '{delta} minute gelede',
  12527. hourAgo: 'omtret \'n uur gelede',
  12528. hoursAgo: 'ongeveer {delta} ure gelede',
  12529. dayAgo: '1 dag gelede',
  12530. daysAgo: '{delta} dae gelede',
  12531. weekAgo: '1 week gelede',
  12532. weeksAgo: '{delta} weke gelede',
  12533. monthAgo: '1 maand gelede',
  12534. monthsAgo: '{delta} maande gelede',
  12535. yearAgo: '1 jaar gelede',
  12536. yearsAgo: '{delta} jare gelede',
  12537. lessThanMinuteUntil: 'oor minder as \'n minuut',
  12538. minuteUntil: 'oor ongeveer \'n minuut',
  12539. minutesUntil: 'oor {delta} minute',
  12540. hourUntil: 'oor ongeveer \'n uur',
  12541. hoursUntil: 'oor {delta} uur',
  12542. dayUntil: 'oor ongeveer \'n dag',
  12543. daysUntil: 'oor {delta} dae',
  12544. weekUntil: 'oor \'n week',
  12545. weeksUntil: 'oor {delta} weke',
  12546. monthUntil: 'oor \'n maand',
  12547. monthsUntil: 'oor {delta} maande',
  12548. yearUntil: 'oor \'n jaar',
  12549. yearsUntil: 'oor {delta} jaar'
  12550. });
  12551. /*
  12552. ---
  12553. name: Locale.af-ZA.Form.Validator
  12554. description: Form Validator messages for Afrikaans.
  12555. license: MIT-style license
  12556. authors:
  12557. - Werner Mollentze
  12558. requires:
  12559. - Locale
  12560. provides: [Locale.af-ZA.Form.Validator]
  12561. ...
  12562. */
  12563. Locale.define('af-ZA', 'FormValidator', {
  12564. required: 'Hierdie veld word vereis.',
  12565. length: 'Voer asseblief {length} karakters in (u het {elLength} karakters ingevoer)',
  12566. minLength: 'Voer asseblief ten minste {minLength} karakters in (u het {length} karakters ingevoer).',
  12567. maxLength: 'Moet asseblief nie meer as {maxLength} karakters invoer nie (u het {length} karakters ingevoer).',
  12568. integer: 'Voer asseblief \'n heelgetal in hierdie veld in. Getalle met desimale (bv. 1.25) word nie toegelaat nie.',
  12569. numeric: 'Voer asseblief slegs numeriese waardes in hierdie veld in (bv. "1" of "1.1" of "-1" of "-1.1").',
  12570. digits: 'Gebruik asseblief slegs nommers en punktuasie in hierdie veld. (by voorbeeld, \'n telefoon nommer wat koppeltekens en punte bevat is toelaatbaar).',
  12571. alpha: 'Gebruik asseblief slegs letters (a-z) binne-in hierdie veld. Geen spasies of ander karakters word toegelaat nie.',
  12572. alphanum: 'Gebruik asseblief slegs letters (a-z) en nommers (0-9) binne-in hierdie veld. Geen spasies of ander karakters word toegelaat nie.',
  12573. dateSuchAs: 'Voer asseblief \'n geldige datum soos {date} in',
  12574. dateInFormatMDY: 'Voer asseblief \'n geldige datum soos MM/DD/YYYY in (bv. "12/31/1999")',
  12575. email: 'Voer asseblief \'n geldige e-pos adres in. Byvoorbeeld "fred@domain.com".',
  12576. url: 'Voer asseblief \'n geldige bronadres (URL) soos http://www.example.com in.',
  12577. currencyDollar: 'Voer asseblief \'n geldige $ bedrag in. Byvoorbeeld $100.00 .',
  12578. oneRequired: 'Voer asseblief iets in vir ten minste een van hierdie velde.',
  12579. errorPrefix: 'Fout: ',
  12580. warningPrefix: 'Waarskuwing: ',
  12581. // Form.Validator.Extras
  12582. noSpace: 'Daar mag geen spasies in hierdie toevoer wees nie.',
  12583. reqChkByNode: 'Geen items is gekies nie.',
  12584. requiredChk: 'Hierdie veld word vereis.',
  12585. reqChkByName: 'Kies asseblief \'n {label}.',
  12586. match: 'Hierdie veld moet by die {matchName} veld pas',
  12587. startDate: 'die begin datum',
  12588. endDate: 'die eind datum',
  12589. currentDate: 'die huidige datum',
  12590. afterDate: 'Die datum moet dieselfde of na {label} wees.',
  12591. beforeDate: 'Die datum moet dieselfde of voor {label} wees.',
  12592. startMonth: 'Kies asseblief \'n begin maand',
  12593. sameMonth: 'Hierdie twee datums moet in dieselfde maand wees - u moet een of beide verander.',
  12594. creditcard: 'Die ingevoerde kredietkaart nommer is ongeldig. Bevestig asseblief die nommer en probeer weer. {length} syfers is ingevoer.'
  12595. });
  12596. /*
  12597. ---
  12598. name: Locale.af-ZA.Number
  12599. description: Number messages for ZA Afrikaans.
  12600. license: MIT-style license
  12601. authors:
  12602. - Werner Mollentze
  12603. requires:
  12604. - Locale
  12605. - Locale.ZA.Number
  12606. provides: [Locale.af-ZA.Number]
  12607. ...
  12608. */
  12609. Locale.define('af-ZA').inherit('ZA', 'Number');
  12610. /*
  12611. ---
  12612. name: Locale.ar.Date
  12613. description: Date messages for Arabic.
  12614. license: MIT-style license
  12615. authors:
  12616. - Chafik Barbar
  12617. requires:
  12618. - Locale
  12619. provides: [Locale.ar.Date]
  12620. ...
  12621. */
  12622. Locale.define('ar', 'Date', {
  12623. // Culture's date order: DD/MM/YYYY
  12624. dateOrder: ['date', 'month', 'year'],
  12625. shortDate: '%d/%m/%Y',
  12626. shortTime: '%H:%M'
  12627. });
  12628. /*
  12629. ---
  12630. name: Locale.ar.Form.Validator
  12631. description: Form Validator messages for Arabic.
  12632. license: MIT-style license
  12633. authors:
  12634. - Chafik Barbar
  12635. requires:
  12636. - Locale
  12637. provides: [Locale.ar.Form.Validator]
  12638. ...
  12639. */
  12640. Locale.define('ar', 'FormValidator', {
  12641. required: 'هذا الحقل مطلوب.',
  12642. minLength: 'رجاءً إدخال {minLength} أحرف على الأقل (تم إدخال {length} أحرف).',
  12643. maxLength: 'الرجاء عدم إدخال أكثر من {maxLength} أحرف (تم إدخال {length} أحرف).',
  12644. integer: 'الرجاء إدخال عدد صحيح في هذا الحقل. أي رقم ذو كسر عشري أو مئوي (مثال 1.25 ) غير مسموح.',
  12645. numeric: 'الرجاء إدخال قيم رقمية في هذا الحقل (مثال "1" أو "1.1" أو "-1" أو "-1.1").',
  12646. digits: 'الرجاء أستخدام قيم رقمية وعلامات ترقيمية فقط في هذا الحقل (مثال, رقم هاتف مع نقطة أو شحطة)',
  12647. alpha: 'الرجاء أستخدام أحرف فقط (ا-ي) في هذا الحقل. أي فراغات أو علامات غير مسموحة.',
  12648. alphanum: 'الرجاء أستخدام أحرف فقط (ا-ي) أو أرقام (0-9) فقط في هذا الحقل. أي فراغات أو علامات غير مسموحة.',
  12649. dateSuchAs: 'الرجاء إدخال تاريخ صحيح كالتالي {date}',
  12650. dateInFormatMDY: 'الرجاء إدخال تاريخ صحيح (مثال, 31-12-1999)',
  12651. email: 'الرجاء إدخال بريد إلكتروني صحيح.',
  12652. url: 'الرجاء إدخال عنوان إلكتروني صحيح مثل http://www.example.com',
  12653. currencyDollar: 'الرجاء إدخال قيمة $ صحيحة. مثال, 100.00$',
  12654. oneRequired: 'الرجاء إدخال قيمة في أحد هذه الحقول على الأقل.',
  12655. errorPrefix: 'خطأ: ',
  12656. warningPrefix: 'تحذير: '
  12657. });
  12658. /*
  12659. ---
  12660. name: Locale.ca-CA.Date
  12661. description: Date messages for Catalan.
  12662. license: MIT-style license
  12663. authors:
  12664. - Ãlfons Sanchez
  12665. requires:
  12666. - Locale
  12667. provides: [Locale.ca-CA.Date]
  12668. ...
  12669. */
  12670. Locale.define('ca-CA', 'Date', {
  12671. months: ['Gener', 'Febrer', 'Març', 'Abril', 'Maig', 'Juny', 'Juli', 'Agost', 'Setembre', 'Octubre', 'Novembre', 'Desembre'],
  12672. months_abbr: ['gen.', 'febr.', 'març', 'abr.', 'maig', 'juny', 'jul.', 'ag.', 'set.', 'oct.', 'nov.', 'des.'],
  12673. days: ['Diumenge', 'Dilluns', 'Dimarts', 'Dimecres', 'Dijous', 'Divendres', 'Dissabte'],
  12674. days_abbr: ['dg', 'dl', 'dt', 'dc', 'dj', 'dv', 'ds'],
  12675. // Culture's date order: DD/MM/YYYY
  12676. dateOrder: ['date', 'month', 'year'],
  12677. shortDate: '%d/%m/%Y',
  12678. shortTime: '%H:%M',
  12679. AM: 'AM',
  12680. PM: 'PM',
  12681. firstDayOfWeek: 0,
  12682. // Date.Extras
  12683. ordinal: '',
  12684. lessThanMinuteAgo: 'fa menys d`un minut',
  12685. minuteAgo: 'fa un minut',
  12686. minutesAgo: 'fa {delta} minuts',
  12687. hourAgo: 'fa un hora',
  12688. hoursAgo: 'fa unes {delta} hores',
  12689. dayAgo: 'fa un dia',
  12690. daysAgo: 'fa {delta} dies',
  12691. lessThanMinuteUntil: 'menys d`un minut des d`ara',
  12692. minuteUntil: 'un minut des d`ara',
  12693. minutesUntil: '{delta} minuts des d`ara',
  12694. hourUntil: 'un hora des d`ara',
  12695. hoursUntil: 'unes {delta} hores des d`ara',
  12696. dayUntil: '1 dia des d`ara',
  12697. daysUntil: '{delta} dies des d`ara'
  12698. });
  12699. /*
  12700. ---
  12701. name: Locale.ca-CA.Form.Validator
  12702. description: Form Validator messages for Catalan.
  12703. license: MIT-style license
  12704. authors:
  12705. - Miquel Hudin
  12706. - Ãlfons Sanchez
  12707. requires:
  12708. - Locale
  12709. provides: [Locale.ca-CA.Form.Validator]
  12710. ...
  12711. */
  12712. Locale.define('ca-CA', 'FormValidator', {
  12713. required: 'Aquest camp es obligatori.',
  12714. minLength: 'Per favor introdueix al menys {minLength} caracters (has introduit {length} caracters).',
  12715. maxLength: 'Per favor introdueix no mes de {maxLength} caracters (has introduit {length} caracters).',
  12716. integer: 'Per favor introdueix un nombre enter en aquest camp. Nombres amb decimals (p.e. 1,25) no estan permesos.',
  12717. numeric: 'Per favor introdueix sols valors numerics en aquest camp (p.e. "1" o "1,1" o "-1" o "-1,1").',
  12718. digits: 'Per favor usa sols numeros i puntuacio en aquest camp (per exemple, un nombre de telefon amb guions i punts no esta permes).',
  12719. alpha: 'Per favor utilitza lletres nomes (a-z) en aquest camp. No s´admiteixen espais ni altres caracters.',
  12720. alphanum: 'Per favor, utilitza nomes lletres (a-z) o numeros (0-9) en aquest camp. No s´admiteixen espais ni altres caracters.',
  12721. dateSuchAs: 'Per favor introdueix una data valida com {date}',
  12722. dateInFormatMDY: 'Per favor introdueix una data valida com DD/MM/YYYY (p.e. "31/12/1999")',
  12723. email: 'Per favor, introdueix una adreça de correu electronic valida. Per exemple, "fred@domain.com".',
  12724. url: 'Per favor introdueix una URL valida com http://www.example.com.',
  12725. currencyDollar: 'Per favor introdueix una quantitat valida de €. Per exemple €100,00 .',
  12726. oneRequired: 'Per favor introdueix alguna cosa per al menys una d´aquestes entrades.',
  12727. errorPrefix: 'Error: ',
  12728. warningPrefix: 'Avis: ',
  12729. // Form.Validator.Extras
  12730. noSpace: 'No poden haver espais en aquesta entrada.',
  12731. reqChkByNode: 'No hi han elements seleccionats.',
  12732. requiredChk: 'Aquest camp es obligatori.',
  12733. reqChkByName: 'Per favor selecciona una {label}.',
  12734. match: 'Aquest camp necessita coincidir amb el camp {matchName}',
  12735. startDate: 'la data de inici',
  12736. endDate: 'la data de fi',
  12737. currentDate: 'la data actual',
  12738. afterDate: 'La data deu ser igual o posterior a {label}.',
  12739. beforeDate: 'La data deu ser igual o anterior a {label}.',
  12740. startMonth: 'Per favor selecciona un mes d´orige',
  12741. sameMonth: 'Aquestes dos dates deuen estar dins del mateix mes - deus canviar una o altra.'
  12742. });
  12743. /*
  12744. ---
  12745. name: Locale.cs-CZ.Date
  12746. description: Date messages for Czech.
  12747. license: MIT-style license
  12748. authors:
  12749. - Jan Černý chemiX
  12750. - Christopher Zukowski
  12751. requires:
  12752. - Locale
  12753. provides: [Locale.cs-CZ.Date]
  12754. ...
  12755. */
  12756. (function(){
  12757. // Czech language pluralization rules, see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  12758. // one -> n is 1; 1
  12759. // few -> n in 2..4; 2-4
  12760. // other -> everything else 0, 5-999, 1.31, 2.31, 5.31...
  12761. var pluralize = function(n, one, few, other){
  12762. if (n == 1) return one;
  12763. else if (n == 2 || n == 3 || n == 4) return few;
  12764. else return other;
  12765. };
  12766. Locale.define('cs-CZ', 'Date', {
  12767. months: ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'],
  12768. months_abbr: ['ledna', 'února', 'března', 'dubna', 'května', 'června', 'července', 'srpna', 'září', 'října', 'listopadu', 'prosince'],
  12769. days: ['Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'],
  12770. days_abbr: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
  12771. // Culture's date order: DD.MM.YYYY
  12772. dateOrder: ['date', 'month', 'year'],
  12773. shortDate: '%d.%m.%Y',
  12774. shortTime: '%H:%M',
  12775. AM: 'dop.',
  12776. PM: 'odp.',
  12777. firstDayOfWeek: 1,
  12778. // Date.Extras
  12779. ordinal: '.',
  12780. lessThanMinuteAgo: 'před chvílí',
  12781. minuteAgo: 'přibližně před minutou',
  12782. minutesAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'minutou', 'minutami', 'minutami'); },
  12783. hourAgo: 'přibližně před hodinou',
  12784. hoursAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'hodinou', 'hodinami', 'hodinami'); },
  12785. dayAgo: 'před dnem',
  12786. daysAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'dnem', 'dny', 'dny'); },
  12787. weekAgo: 'před týdnem',
  12788. weeksAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'týdnem', 'týdny', 'týdny'); },
  12789. monthAgo: 'před měsícem',
  12790. monthsAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'měsícem', 'měsíci', 'měsíci'); },
  12791. yearAgo: 'před rokem',
  12792. yearsAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'rokem', 'lety', 'lety'); },
  12793. lessThanMinuteUntil: 'za chvíli',
  12794. minuteUntil: 'přibližně za minutu',
  12795. minutesUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'minutu', 'minuty', 'minut'); },
  12796. hourUntil: 'přibližně za hodinu',
  12797. hoursUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'hodinu', 'hodiny', 'hodin'); },
  12798. dayUntil: 'za den',
  12799. daysUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'den', 'dny', 'dnů'); },
  12800. weekUntil: 'za týden',
  12801. weeksUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'týden', 'týdny', 'týdnů'); },
  12802. monthUntil: 'za měsíc',
  12803. monthsUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'měsíc', 'měsíce', 'měsíců'); },
  12804. yearUntil: 'za rok',
  12805. yearsUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'rok', 'roky', 'let'); }
  12806. });
  12807. })();
  12808. /*
  12809. ---
  12810. name: Locale.cs-CZ.Form.Validator
  12811. description: Form Validator messages for Czech.
  12812. license: MIT-style license
  12813. authors:
  12814. - Jan Černý chemiX
  12815. requires:
  12816. - Locale
  12817. provides: [Locale.cs-CZ.Form.Validator]
  12818. ...
  12819. */
  12820. Locale.define('cs-CZ', 'FormValidator', {
  12821. required: 'Tato položka je povinná.',
  12822. minLength: 'Zadejte prosím alespoň {minLength} znaků (napsáno {length} znaků).',
  12823. maxLength: 'Zadejte prosím méně než {maxLength} znaků (nápsáno {length} znaků).',
  12824. integer: 'Zadejte prosím celé číslo. Desetinná čísla (např. 1.25) nejsou povolena.',
  12825. numeric: 'Zadejte jen číselné hodnoty (tj. "1" nebo "1.1" nebo "-1" nebo "-1.1").',
  12826. digits: 'Zadejte prosím pouze čísla a interpunkční znaménka(například telefonní číslo s pomlčkami nebo tečkami je povoleno).',
  12827. alpha: 'Zadejte prosím pouze písmena (a-z). Mezery nebo jiné znaky nejsou povoleny.',
  12828. alphanum: 'Zadejte prosím pouze písmena (a-z) nebo číslice (0-9). Mezery nebo jiné znaky nejsou povoleny.',
  12829. dateSuchAs: 'Zadejte prosím platné datum jako {date}',
  12830. dateInFormatMDY: 'Zadejte prosím platné datum jako MM / DD / RRRR (tj. "12/31/1999")',
  12831. email: 'Zadejte prosím platnou e-mailovou adresu. Například "fred@domain.com".',
  12832. url: 'Zadejte prosím platnou URL adresu jako http://www.example.com.',
  12833. currencyDollar: 'Zadejte prosím platnou částku. Například $100.00.',
  12834. oneRequired: 'Zadejte prosím alespoň jednu hodnotu pro tyto položky.',
  12835. errorPrefix: 'Chyba: ',
  12836. warningPrefix: 'Upozornění: ',
  12837. // Form.Validator.Extras
  12838. noSpace: 'V této položce nejsou povoleny mezery',
  12839. reqChkByNode: 'Nejsou vybrány žádné položky.',
  12840. requiredChk: 'Tato položka je vyžadována.',
  12841. reqChkByName: 'Prosím vyberte {label}.',
  12842. match: 'Tato položka se musí shodovat s položkou {matchName}',
  12843. startDate: 'datum zahájení',
  12844. endDate: 'datum ukončení',
  12845. currentDate: 'aktuální datum',
  12846. afterDate: 'Datum by mělo být stejné nebo větší než {label}.',
  12847. beforeDate: 'Datum by mělo být stejné nebo menší než {label}.',
  12848. startMonth: 'Vyberte počáteční měsíc.',
  12849. sameMonth: 'Tyto dva datumy musí být ve stejném měsíci - změňte jeden z nich.',
  12850. creditcard: 'Zadané číslo kreditní karty je neplatné. Prosím opravte ho. Bylo zadáno {length} čísel.'
  12851. });
  12852. /*
  12853. ---
  12854. name: Locale.da-DK.Date
  12855. description: Date messages for Danish.
  12856. license: MIT-style license
  12857. authors:
  12858. - Martin Overgaard
  12859. - Henrik Hansen
  12860. requires:
  12861. - Locale
  12862. provides: [Locale.da-DK.Date]
  12863. ...
  12864. */
  12865. Locale.define('da-DK', 'Date', {
  12866. months: ['Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December'],
  12867. months_abbr: ['jan.', 'feb.', 'mar.', 'apr.', 'maj.', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
  12868. days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
  12869. days_abbr: ['søn', 'man', 'tir', 'ons', 'tor', 'fre', 'lør'],
  12870. // Culture's date order: DD-MM-YYYY
  12871. dateOrder: ['date', 'month', 'year'],
  12872. shortDate: '%d-%m-%Y',
  12873. shortTime: '%H:%M',
  12874. AM: 'AM',
  12875. PM: 'PM',
  12876. firstDayOfWeek: 1,
  12877. // Date.Extras
  12878. ordinal: '.',
  12879. lessThanMinuteAgo: 'mindre end et minut siden',
  12880. minuteAgo: 'omkring et minut siden',
  12881. minutesAgo: '{delta} minutter siden',
  12882. hourAgo: 'omkring en time siden',
  12883. hoursAgo: 'omkring {delta} timer siden',
  12884. dayAgo: '1 dag siden',
  12885. daysAgo: '{delta} dage siden',
  12886. weekAgo: '1 uge siden',
  12887. weeksAgo: '{delta} uger siden',
  12888. monthAgo: '1 måned siden',
  12889. monthsAgo: '{delta} måneder siden',
  12890. yearAgo: '1 år siden',
  12891. yearsAgo: '{delta} år siden',
  12892. lessThanMinuteUntil: 'mindre end et minut fra nu',
  12893. minuteUntil: 'omkring et minut fra nu',
  12894. minutesUntil: '{delta} minutter fra nu',
  12895. hourUntil: 'omkring en time fra nu',
  12896. hoursUntil: 'omkring {delta} timer fra nu',
  12897. dayUntil: '1 dag fra nu',
  12898. daysUntil: '{delta} dage fra nu',
  12899. weekUntil: '1 uge fra nu',
  12900. weeksUntil: '{delta} uger fra nu',
  12901. monthUntil: '1 måned fra nu',
  12902. monthsUntil: '{delta} måneder fra nu',
  12903. yearUntil: '1 år fra nu',
  12904. yearsUntil: '{delta} år fra nu'
  12905. });
  12906. /*
  12907. ---
  12908. name: Locale.da-DK.Form.Validator
  12909. description: Form Validator messages for Danish.
  12910. license: MIT-style license
  12911. authors:
  12912. - Martin Overgaard
  12913. requires:
  12914. - Locale
  12915. provides: [Locale.da-DK.Form.Validator]
  12916. ...
  12917. */
  12918. Locale.define('da-DK', 'FormValidator', {
  12919. required: 'Feltet skal udfyldes.',
  12920. minLength: 'Skriv mindst {minLength} tegn (du skrev {length} tegn).',
  12921. maxLength: 'Skriv maksimalt {maxLength} tegn (du skrev {length} tegn).',
  12922. integer: 'Skriv et tal i dette felt. Decimal tal (f.eks. 1.25) er ikke tilladt.',
  12923. numeric: 'Skriv kun tal i dette felt (i.e. "1" eller "1.1" eller "-1" eller "-1.1").',
  12924. digits: 'Skriv kun tal og tegnsætning i dette felt (eksempel, et telefon nummer med bindestreg eller punktum er tilladt).',
  12925. alpha: 'Skriv kun bogstaver (a-z) i dette felt. Mellemrum og andre tegn er ikke tilladt.',
  12926. alphanum: 'Skriv kun bogstaver (a-z) eller tal (0-9) i dette felt. Mellemrum og andre tegn er ikke tilladt.',
  12927. dateSuchAs: 'Skriv en gyldig dato som {date}',
  12928. dateInFormatMDY: 'Skriv dato i formatet DD-MM-YYYY (f.eks. "31-12-1999")',
  12929. email: 'Skriv en gyldig e-mail adresse. F.eks "fred@domain.com".',
  12930. url: 'Skriv en gyldig URL adresse. F.eks "http://www.example.com".',
  12931. currencyDollar: 'Skriv et gldigt beløb. F.eks Kr.100.00 .',
  12932. oneRequired: 'Et eller flere af felterne i denne formular skal udfyldes.',
  12933. errorPrefix: 'Fejl: ',
  12934. warningPrefix: 'Advarsel: ',
  12935. // Form.Validator.Extras
  12936. noSpace: 'Der må ikke benyttes mellemrum i dette felt.',
  12937. reqChkByNode: 'Foretag et valg.',
  12938. requiredChk: 'Dette felt skal udfyldes.',
  12939. reqChkByName: 'Vælg en {label}.',
  12940. match: 'Dette felt skal matche {matchName} feltet',
  12941. startDate: 'start dato',
  12942. endDate: 'slut dato',
  12943. currentDate: 'dags dato',
  12944. afterDate: 'Datoen skal være større end eller lig med {label}.',
  12945. beforeDate: 'Datoen skal være mindre end eller lig med {label}.',
  12946. startMonth: 'Vælg en start måned',
  12947. sameMonth: 'De valgte datoer skal være i samme måned - skift en af dem.'
  12948. });
  12949. /*
  12950. ---
  12951. name: Locale.de-DE.Date
  12952. description: Date messages for German.
  12953. license: MIT-style license
  12954. authors:
  12955. - Christoph Pojer
  12956. - Frank Rossi
  12957. - Ulrich Petri
  12958. - Fabian Beiner
  12959. requires:
  12960. - Locale
  12961. provides: [Locale.de-DE.Date]
  12962. ...
  12963. */
  12964. Locale.define('de-DE', 'Date', {
  12965. months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
  12966. months_abbr: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
  12967. days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
  12968. days_abbr: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
  12969. // Culture's date order: DD.MM.YYYY
  12970. dateOrder: ['date', 'month', 'year'],
  12971. shortDate: '%d.%m.%Y',
  12972. shortTime: '%H:%M',
  12973. AM: 'vormittags',
  12974. PM: 'nachmittags',
  12975. firstDayOfWeek: 1,
  12976. // Date.Extras
  12977. ordinal: '.',
  12978. lessThanMinuteAgo: 'vor weniger als einer Minute',
  12979. minuteAgo: 'vor einer Minute',
  12980. minutesAgo: 'vor {delta} Minuten',
  12981. hourAgo: 'vor einer Stunde',
  12982. hoursAgo: 'vor {delta} Stunden',
  12983. dayAgo: 'vor einem Tag',
  12984. daysAgo: 'vor {delta} Tagen',
  12985. weekAgo: 'vor einer Woche',
  12986. weeksAgo: 'vor {delta} Wochen',
  12987. monthAgo: 'vor einem Monat',
  12988. monthsAgo: 'vor {delta} Monaten',
  12989. yearAgo: 'vor einem Jahr',
  12990. yearsAgo: 'vor {delta} Jahren',
  12991. lessThanMinuteUntil: 'in weniger als einer Minute',
  12992. minuteUntil: 'in einer Minute',
  12993. minutesUntil: 'in {delta} Minuten',
  12994. hourUntil: 'in ca. einer Stunde',
  12995. hoursUntil: 'in ca. {delta} Stunden',
  12996. dayUntil: 'in einem Tag',
  12997. daysUntil: 'in {delta} Tagen',
  12998. weekUntil: 'in einer Woche',
  12999. weeksUntil: 'in {delta} Wochen',
  13000. monthUntil: 'in einem Monat',
  13001. monthsUntil: 'in {delta} Monaten',
  13002. yearUntil: 'in einem Jahr',
  13003. yearsUntil: 'in {delta} Jahren'
  13004. });
  13005. /*
  13006. ---
  13007. name: Locale.de-CH.Date
  13008. description: Date messages for German (Switzerland).
  13009. license: MIT-style license
  13010. authors:
  13011. - Michael van der Weg
  13012. requires:
  13013. - Locale
  13014. - Locale.de-DE.Date
  13015. provides: [Locale.de-CH.Date]
  13016. ...
  13017. */
  13018. Locale.define('de-CH').inherit('de-DE', 'Date');
  13019. /*
  13020. ---
  13021. name: Locale.de-CH.Form.Validator
  13022. description: Form Validator messages for German (Switzerland).
  13023. license: MIT-style license
  13024. authors:
  13025. - Michael van der Weg
  13026. requires:
  13027. - Locale
  13028. provides: [Locale.de-CH.Form.Validator]
  13029. ...
  13030. */
  13031. Locale.define('de-CH', 'FormValidator', {
  13032. required: 'Dieses Feld ist obligatorisch.',
  13033. minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13034. maxLength: 'Bitte geben Sie nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13035. integer: 'Geben Sie bitte eine ganze Zahl ein. Dezimalzahlen (z.B. 1.25) sind nicht erlaubt.',
  13036. 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;).',
  13037. digits: 'Benutzen Sie bitte nur Zahlen und Satzzeichen in diesem Eingabefeld (erlaubt ist z.B. eine Telefonnummer mit Bindestrichen und Punkten).',
  13038. alpha: 'Benutzen Sie bitte nur Buchstaben (a-z) in diesem Feld. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13039. alphanum: 'Benutzen Sie bitte nur Buchstaben (a-z) und Zahlen (0-9) in diesem Eingabefeld. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13040. dateSuchAs: 'Geben Sie bitte ein g&uuml;ltiges Datum ein. Wie zum Beispiel {date}',
  13041. dateInFormatMDY: 'Geben Sie bitte ein g&uuml;ltiges Datum ein. Wie zum Beispiel TT.MM.JJJJ (z.B. &quot;31.12.1999&quot;)',
  13042. email: 'Geben Sie bitte eine g&uuml;ltige E-Mail Adresse ein. Wie zum Beispiel &quot;maria@bernasconi.ch&quot;.',
  13043. url: 'Geben Sie bitte eine g&uuml;ltige URL ein. Wie zum Beispiel http://www.example.com.',
  13044. currencyDollar: 'Geben Sie bitte einen g&uuml;ltigen Betrag in Schweizer Franken ein. Wie zum Beispiel 100.00 CHF .',
  13045. oneRequired: 'Machen Sie f&uuml;r mindestens eines der Eingabefelder einen Eintrag.',
  13046. errorPrefix: 'Fehler: ',
  13047. warningPrefix: 'Warnung: ',
  13048. // Form.Validator.Extras
  13049. noSpace: 'In diesem Eingabefeld darf kein Leerzeichen sein.',
  13050. reqChkByNode: 'Es wurden keine Elemente gew&auml;hlt.',
  13051. requiredChk: 'Dieses Feld ist obligatorisch.',
  13052. reqChkByName: 'Bitte w&auml;hlen Sie ein {label}.',
  13053. match: 'Dieses Eingabefeld muss mit dem Feld {matchName} &uuml;bereinstimmen.',
  13054. startDate: 'Das Anfangsdatum',
  13055. endDate: 'Das Enddatum',
  13056. currentDate: 'Das aktuelle Datum',
  13057. afterDate: 'Das Datum sollte zur gleichen Zeit oder sp&auml;ter sein {label}.',
  13058. beforeDate: 'Das Datum sollte zur gleichen Zeit oder fr&uuml;her sein {label}.',
  13059. startMonth: 'W&auml;hlen Sie bitte einen Anfangsmonat',
  13060. sameMonth: 'Diese zwei Datumsangaben m&uuml;ssen im selben Monat sein - Sie m&uuml;ssen eine von beiden ver&auml;ndern.',
  13061. creditcard: 'Die eingegebene Kreditkartennummer ist ung&uuml;ltig. Bitte &uuml;berpr&uuml;fen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.'
  13062. });
  13063. /*
  13064. ---
  13065. name: Locale.de-CH.Number
  13066. description: Number messages for Switzerland.
  13067. license: MIT-style license
  13068. authors:
  13069. - Kim D. Jeker
  13070. requires:
  13071. - Locale
  13072. - Locale.CH.Number
  13073. provides: [Locale.de-CH.Number]
  13074. ...
  13075. */
  13076. Locale.define('de-CH').inherit('CH', 'Number');
  13077. /*
  13078. ---
  13079. name: Locale.de-DE.Form.Validator
  13080. description: Form Validator messages for German.
  13081. license: MIT-style license
  13082. authors:
  13083. - Frank Rossi
  13084. - Ulrich Petri
  13085. - Fabian Beiner
  13086. requires:
  13087. - Locale
  13088. provides: [Locale.de-DE.Form.Validator]
  13089. ...
  13090. */
  13091. Locale.define('de-DE', 'FormValidator', {
  13092. required: 'Dieses Eingabefeld muss ausgefüllt werden.',
  13093. minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben nur {length} Zeichen eingegeben).',
  13094. maxLength: 'Geben Sie bitte nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13095. integer: 'Geben Sie in diesem Eingabefeld bitte eine ganze Zahl ein. Dezimalzahlen (z.B. "1.25") sind nicht erlaubt.',
  13096. numeric: 'Geben Sie in diesem Eingabefeld bitte nur Zahlenwerte (z.B. "1", "1.1", "-1" oder "-1.1") ein.',
  13097. digits: 'Geben Sie in diesem Eingabefeld bitte nur Zahlen und Satzzeichen ein (z.B. eine Telefonnummer mit Bindestrichen und Punkten ist erlaubt).',
  13098. alpha: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) ein. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13099. alphanum: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) und Zahlen (0-9) ein. Leerzeichen oder andere Zeichen sind nicht erlaubt.',
  13100. dateSuchAs: 'Geben Sie bitte ein gültiges Datum ein (z.B. "{date}").',
  13101. dateInFormatMDY: 'Geben Sie bitte ein gültiges Datum im Format TT.MM.JJJJ ein (z.B. "31.12.1999").',
  13102. email: 'Geben Sie bitte eine gültige E-Mail-Adresse ein (z.B. "max@mustermann.de").',
  13103. url: 'Geben Sie bitte eine gültige URL ein (z.B. "http://www.example.com").',
  13104. currencyDollar: 'Geben Sie bitte einen gültigen Betrag in EURO ein (z.B. 100.00€).',
  13105. oneRequired: 'Bitte füllen Sie mindestens ein Eingabefeld aus.',
  13106. errorPrefix: 'Fehler: ',
  13107. warningPrefix: 'Warnung: ',
  13108. // Form.Validator.Extras
  13109. noSpace: 'Es darf kein Leerzeichen in diesem Eingabefeld sein.',
  13110. reqChkByNode: 'Es wurden keine Elemente gewählt.',
  13111. requiredChk: 'Dieses Feld muss ausgefüllt werden.',
  13112. reqChkByName: 'Bitte wählen Sie ein {label}.',
  13113. match: 'Dieses Eingabefeld muss mit dem {matchName} Eingabefeld übereinstimmen.',
  13114. startDate: 'Das Anfangsdatum',
  13115. endDate: 'Das Enddatum',
  13116. currentDate: 'Das aktuelle Datum',
  13117. afterDate: 'Das Datum sollte zur gleichen Zeit oder später sein als {label}.',
  13118. beforeDate: 'Das Datum sollte zur gleichen Zeit oder früher sein als {label}.',
  13119. startMonth: 'Wählen Sie bitte einen Anfangsmonat',
  13120. sameMonth: 'Diese zwei Datumsangaben müssen im selben Monat sein - Sie müssen eines von beiden verändern.',
  13121. creditcard: 'Die eingegebene Kreditkartennummer ist ungültig. Bitte überprüfen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.'
  13122. });
  13123. /*
  13124. ---
  13125. name: Locale.de-DE.Number
  13126. description: Number messages for German.
  13127. license: MIT-style license
  13128. authors:
  13129. - Christoph Pojer
  13130. requires:
  13131. - Locale
  13132. - Locale.EU.Number
  13133. provides: [Locale.de-DE.Number]
  13134. ...
  13135. */
  13136. Locale.define('de-DE').inherit('EU', 'Number');
  13137. /*
  13138. ---
  13139. name: Locale.el-GR.Date
  13140. description: Date messages for Greek language.
  13141. license: MIT-style license
  13142. authors:
  13143. - Periklis Argiriadis
  13144. requires:
  13145. - Locale
  13146. provides: [Locale.el-GR.Date]
  13147. ...
  13148. */
  13149. Locale.define('el-GR', 'Date', {
  13150. months: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
  13151. months_abbr: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μάι', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
  13152. days: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
  13153. days_abbr: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'],
  13154. // Culture's date order: DD/MM/YYYY
  13155. dateOrder: ['date', 'month', 'year'],
  13156. shortDate: '%d/%m/%Y',
  13157. shortTime: '%I:%M%p',
  13158. AM: 'πμ',
  13159. PM: 'μμ',
  13160. firstDayOfWeek: 1,
  13161. // Date.Extras
  13162. ordinal: function(dayOfMonth){
  13163. // 1st, 2nd, 3rd, etc.
  13164. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ος' : ['ος'][Math.min(dayOfMonth % 10, 4)];
  13165. },
  13166. lessThanMinuteAgo: 'λιγότερο από ένα λεπτό πριν',
  13167. minuteAgo: 'περίπου ένα λεπτό πριν',
  13168. minutesAgo: '{delta} λεπτά πριν',
  13169. hourAgo: 'περίπου μια ώρα πριν',
  13170. hoursAgo: 'περίπου {delta} ώρες πριν',
  13171. dayAgo: '1 ημέρα πριν',
  13172. daysAgo: '{delta} ημέρες πριν',
  13173. weekAgo: '1 εβδομάδα πριν',
  13174. weeksAgo: '{delta} εβδομάδες πριν',
  13175. monthAgo: '1 μήνα πριν',
  13176. monthsAgo: '{delta} μήνες πριν',
  13177. yearAgo: '1 χρόνο πριν',
  13178. yearsAgo: '{delta} χρόνια πριν',
  13179. lessThanMinuteUntil: 'λιγότερο από λεπτό από τώρα',
  13180. minuteUntil: 'περίπου ένα λεπτό από τώρα',
  13181. minutesUntil: '{delta} λεπτά από τώρα',
  13182. hourUntil: 'περίπου μια ώρα από τώρα',
  13183. hoursUntil: 'περίπου {delta} ώρες από τώρα',
  13184. dayUntil: '1 ημέρα από τώρα',
  13185. daysUntil: '{delta} ημέρες από τώρα',
  13186. weekUntil: '1 εβδομάδα από τώρα',
  13187. weeksUntil: '{delta} εβδομάδες από τώρα',
  13188. monthUntil: '1 μήνας από τώρα',
  13189. monthsUntil: '{delta} μήνες από τώρα',
  13190. yearUntil: '1 χρόνος από τώρα',
  13191. yearsUntil: '{delta} χρόνια από τώρα'
  13192. });
  13193. /*
  13194. ---
  13195. name: Locale.el-GR.Form.Validator
  13196. description: Form Validator messages for Greek language.
  13197. license: MIT-style license
  13198. authors:
  13199. - Dimitris Tsironis
  13200. requires:
  13201. - Locale
  13202. provides: [Locale.el-GR.Form.Validator]
  13203. ...
  13204. */
  13205. Locale.define('el-GR', 'FormValidator', {
  13206. required: 'Αυτό το πεδίο είναι απαραίτητο.',
  13207. length: 'Παρακαλούμε, εισάγετε {length} χαρακτήρες (έχετε ήδη εισάγει {elLength} χαρακτήρες).',
  13208. minLength: 'Παρακαλούμε, εισάγετε τουλάχιστον {minLength} χαρακτήρες (έχετε ήδη εισάγε {length} χαρακτήρες).',
  13209. maxlength: 'Παρακαλούμε, εισάγετε εώς {maxlength} χαρακτήρες (έχετε ήδη εισάγε {length} χαρακτήρες).',
  13210. integer: 'Παρακαλούμε, εισάγετε έναν ακέραιο αριθμό σε αυτό το πεδίο. Οι αριθμοί με δεκαδικά ψηφία (π.χ. 1.25) δεν επιτρέπονται.',
  13211. numeric: 'Παρακαλούμε, εισάγετε μόνο αριθμητικές τιμές σε αυτό το πεδίο (π.χ." 1 " ή " 1.1 " ή " -1 " ή " -1.1 " ).',
  13212. digits: 'Παρακαλούμε, χρησιμοποιήστε μόνο αριθμούς και σημεία στίξης σε αυτόν τον τομέα (π.χ. επιτρέπεται αριθμός τηλεφώνου με παύλες ή τελείες).',
  13213. alpha: 'Παρακαλούμε, χρησιμοποιήστε μόνο γράμματα (a-z) σε αυτό το πεδίο. Δεν επιτρέπονται κενά ή άλλοι χαρακτήρες.',
  13214. alphanum: 'Παρακαλούμε, χρησιμοποιήστε μόνο γράμματα (a-z) ή αριθμούς (0-9) σε αυτόν τον τομέα. Δεν επιτρέπονται κενά ή άλλοι χαρακτήρες.',
  13215. dateSuchAs: 'Παρακαλούμε, εισάγετε μια έγκυρη ημερομηνία, όπως {date}',
  13216. dateInFormatMDY: 'Παρακαλώ εισάγετε μια έγκυρη ημερομηνία, όπως ΜΜ/ΗΗ/ΕΕΕΕ (π.χ. "12/31/1999").',
  13217. email: 'Παρακαλούμε, εισάγετε μια έγκυρη διεύθυνση ηλεκτρονικού ταχυδρομείου (π.χ. "fred@domain.com").',
  13218. url: 'Παρακαλούμε, εισάγετε μια έγκυρη URL διεύθυνση, όπως http://www.example.com',
  13219. currencyDollar: 'Παρακαλούμε, εισάγετε ένα έγκυρο ποσό σε δολλάρια (π.χ. $100.00).',
  13220. oneRequired: 'Παρακαλούμε, εισάγετε κάτι για τουλάχιστον ένα από αυτά τα πεδία.',
  13221. errorPrefix: 'Σφάλμα: ',
  13222. warningPrefix: 'Προσοχή: ',
  13223. // Form.Validator.Extras
  13224. noSpace: 'Δεν επιτρέπονται τα κενά σε αυτό το πεδίο.',
  13225. reqChkByNode: 'Δεν έχει επιλεγεί κάποιο αντικείμενο',
  13226. requiredChk: 'Αυτό το πεδίο είναι απαραίτητο.',
  13227. reqChkByName: 'Παρακαλούμε, επιλέξτε μια ετικέτα {label}.',
  13228. match: 'Αυτό το πεδίο πρέπει να ταιριάζει με το πεδίο {matchName}.',
  13229. startDate: 'η ημερομηνία έναρξης',
  13230. endDate: 'η ημερομηνία λήξης',
  13231. currentDate: 'η τρέχουσα ημερομηνία',
  13232. afterDate: 'Η ημερομηνία πρέπει να είναι η ίδια ή μετά από την {label}.',
  13233. beforeDate: 'Η ημερομηνία πρέπει να είναι η ίδια ή πριν από την {label}.',
  13234. startMonth: 'Παρακαλώ επιλέξτε ένα μήνα αρχής.',
  13235. sameMonth: 'Αυτές οι δύο ημερομηνίες πρέπει να έχουν τον ίδιο μήνα - θα πρέπει να αλλάξετε ή το ένα ή το άλλο',
  13236. creditcard: 'Ο αριθμός της πιστωτικής κάρτας δεν είναι έγκυρος. Παρακαλούμε ελέγξτε τον αριθμό και δοκιμάστε ξανά. {length} μήκος ψηφίων.'
  13237. });
  13238. /*
  13239. ---
  13240. name: Locale.en-GB.Date
  13241. description: Date messages for British English.
  13242. license: MIT-style license
  13243. authors:
  13244. - Aaron Newton
  13245. requires:
  13246. - Locale
  13247. - Locale.en-US.Date
  13248. provides: [Locale.en-GB.Date]
  13249. ...
  13250. */
  13251. Locale.define('en-GB', 'Date', {
  13252. // Culture's date order: DD/MM/YYYY
  13253. dateOrder: ['date', 'month', 'year'],
  13254. shortDate: '%d/%m/%Y',
  13255. shortTime: '%H:%M'
  13256. }).inherit('en-US', 'Date');
  13257. /*
  13258. ---
  13259. name: Locale.en-US.Number
  13260. description: Number messages for US English.
  13261. license: MIT-style license
  13262. authors:
  13263. - Arian Stolwijk
  13264. requires:
  13265. - Locale
  13266. provides: [Locale.en-US.Number]
  13267. ...
  13268. */
  13269. Locale.define('en-US', 'Number', {
  13270. decimal: '.',
  13271. group: ',',
  13272. /* Commented properties are the defaults for Number.format
  13273. decimals: 0,
  13274. precision: 0,
  13275. scientific: null,
  13276. prefix: null,
  13277. suffic: null,
  13278. // Negative/Currency/percentage will mixin Number
  13279. negative: {
  13280. prefix: '-'
  13281. },*/
  13282. currency: {
  13283. // decimals: 2,
  13284. prefix: '$ '
  13285. }/*,
  13286. percentage: {
  13287. decimals: 2,
  13288. suffix: '%'
  13289. }*/
  13290. });
  13291. /*
  13292. ---
  13293. name: Locale.es-ES.Date
  13294. description: Date messages for Spanish.
  13295. license: MIT-style license
  13296. authors:
  13297. - Ãlfons Sanchez
  13298. requires:
  13299. - Locale
  13300. provides: [Locale.es-ES.Date]
  13301. ...
  13302. */
  13303. Locale.define('es-ES', 'Date', {
  13304. months: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
  13305. months_abbr: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'],
  13306. days: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
  13307. days_abbr: ['dom', 'lun', 'mar', 'mié', 'juv', 'vie', 'sáb'],
  13308. // Culture's date order: DD/MM/YYYY
  13309. dateOrder: ['date', 'month', 'year'],
  13310. shortDate: '%d/%m/%Y',
  13311. shortTime: '%H:%M',
  13312. AM: 'AM',
  13313. PM: 'PM',
  13314. firstDayOfWeek: 1,
  13315. // Date.Extras
  13316. ordinal: '',
  13317. lessThanMinuteAgo: 'hace menos de un minuto',
  13318. minuteAgo: 'hace un minuto',
  13319. minutesAgo: 'hace {delta} minutos',
  13320. hourAgo: 'hace una hora',
  13321. hoursAgo: 'hace unas {delta} horas',
  13322. dayAgo: 'hace un día',
  13323. daysAgo: 'hace {delta} días',
  13324. weekAgo: 'hace una semana',
  13325. weeksAgo: 'hace unas {delta} semanas',
  13326. monthAgo: 'hace un mes',
  13327. monthsAgo: 'hace {delta} meses',
  13328. yearAgo: 'hace un año',
  13329. yearsAgo: 'hace {delta} años',
  13330. lessThanMinuteUntil: 'menos de un minuto desde ahora',
  13331. minuteUntil: 'un minuto desde ahora',
  13332. minutesUntil: '{delta} minutos desde ahora',
  13333. hourUntil: 'una hora desde ahora',
  13334. hoursUntil: 'unas {delta} horas desde ahora',
  13335. dayUntil: 'un día desde ahora',
  13336. daysUntil: '{delta} días desde ahora',
  13337. weekUntil: 'una semana desde ahora',
  13338. weeksUntil: 'unas {delta} semanas desde ahora',
  13339. monthUntil: 'un mes desde ahora',
  13340. monthsUntil: '{delta} meses desde ahora',
  13341. yearUntil: 'un año desde ahora',
  13342. yearsUntil: '{delta} años desde ahora'
  13343. });
  13344. /*
  13345. ---
  13346. name: Locale.es-AR.Date
  13347. description: Date messages for Spanish (Argentina).
  13348. license: MIT-style license
  13349. authors:
  13350. - Ãlfons Sanchez
  13351. - Diego Massanti
  13352. requires:
  13353. - Locale
  13354. - Locale.es-ES.Date
  13355. provides: [Locale.es-AR.Date]
  13356. ...
  13357. */
  13358. Locale.define('es-AR').inherit('es-ES', 'Date');
  13359. /*
  13360. ---
  13361. name: Locale.es-AR.Form.Validator
  13362. description: Form Validator messages for Spanish (Argentina).
  13363. license: MIT-style license
  13364. authors:
  13365. - Diego Massanti
  13366. requires:
  13367. - Locale
  13368. provides: [Locale.es-AR.Form.Validator]
  13369. ...
  13370. */
  13371. Locale.define('es-AR', 'FormValidator', {
  13372. required: 'Este campo es obligatorio.',
  13373. minLength: 'Por favor ingrese al menos {minLength} caracteres (ha ingresado {length} caracteres).',
  13374. maxLength: 'Por favor no ingrese más de {maxLength} caracteres (ha ingresado {length} caracteres).',
  13375. integer: 'Por favor ingrese un número entero en este campo. Números con decimales (p.e. 1,25) no se permiten.',
  13376. numeric: 'Por favor ingrese solo valores numéricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',
  13377. 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).',
  13378. alpha: 'Por favor use sólo letras (a-z) en este campo. No se permiten espacios ni otros caracteres.',
  13379. alphanum: 'Por favor, usa sólo letras (a-z) o números (0-9) en este campo. No se permiten espacios u otros caracteres.',
  13380. dateSuchAs: 'Por favor ingrese una fecha válida como {date}',
  13381. dateInFormatMDY: 'Por favor ingrese una fecha válida, utulizando el formato DD/MM/YYYY (p.e. "31/12/1999")',
  13382. email: 'Por favor, ingrese una dirección de e-mail válida. Por ejemplo, "fred@dominio.com".',
  13383. url: 'Por favor ingrese una URL válida como http://www.example.com.',
  13384. currencyDollar: 'Por favor ingrese una cantidad válida de pesos. Por ejemplo $100,00 .',
  13385. oneRequired: 'Por favor ingrese algo para por lo menos una de estas entradas.',
  13386. errorPrefix: 'Error: ',
  13387. warningPrefix: 'Advertencia: ',
  13388. // Form.Validator.Extras
  13389. noSpace: 'No se permiten espacios en este campo.',
  13390. reqChkByNode: 'No hay elementos seleccionados.',
  13391. requiredChk: 'Este campo es obligatorio.',
  13392. reqChkByName: 'Por favor selecciona una {label}.',
  13393. match: 'Este campo necesita coincidir con el campo {matchName}',
  13394. startDate: 'la fecha de inicio',
  13395. endDate: 'la fecha de fin',
  13396. currentDate: 'la fecha actual',
  13397. afterDate: 'La fecha debe ser igual o posterior a {label}.',
  13398. beforeDate: 'La fecha debe ser igual o anterior a {label}.',
  13399. startMonth: 'Por favor selecciona un mes de origen',
  13400. sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.'
  13401. });
  13402. /*
  13403. ---
  13404. name: Locale.es-AR.Number
  13405. description: Number messages for es Argentina.
  13406. license: MIT-style license
  13407. authors:
  13408. - Oscar Kuchuk
  13409. requires:
  13410. - Locale
  13411. provides: [Locale.es-AR.Number]
  13412. ...
  13413. */
  13414. Locale.define('es-AR', 'Number', {
  13415. decimal: ',',
  13416. group: '.',
  13417. /* Commented properties are the defaults for Number.format
  13418. decimals: 0,
  13419. precision: 0,
  13420. scientific: null,
  13421. prefix: null,
  13422. suffic: null,
  13423. // Negative/Currency/percentage will mixin Number
  13424. negative: {
  13425. prefix: '-'
  13426. },*/
  13427. currency: {
  13428. decimals: 2,
  13429. prefix: '$ '
  13430. }/*,
  13431. percentage: {
  13432. decimals: 2,
  13433. suffix: '%'
  13434. }*/
  13435. });
  13436. /*
  13437. ---
  13438. name: Locale.es-ES.Form.Validator
  13439. description: Form Validator messages for Spanish.
  13440. license: MIT-style license
  13441. authors:
  13442. - Ãlfons Sanchez
  13443. requires:
  13444. - Locale
  13445. provides: [Locale.es-ES.Form.Validator]
  13446. ...
  13447. */
  13448. Locale.define('es-ES', 'FormValidator', {
  13449. required: 'Este campo es obligatorio.',
  13450. minLength: 'Por favor introduce al menos {minLength} caracteres (has introducido {length} caracteres).',
  13451. maxLength: 'Por favor introduce no m&aacute;s de {maxLength} caracteres (has introducido {length} caracteres).',
  13452. integer: 'Por favor introduce un n&uacute;mero entero en este campo. N&uacute;meros con decimales (p.e. 1,25) no se permiten.',
  13453. numeric: 'Por favor introduce solo valores num&eacute;ricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',
  13454. 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).',
  13455. alpha: 'Por favor usa letras solo (a-z) en este campo. No se admiten espacios ni otros caracteres.',
  13456. alphanum: 'Por favor, usa solo letras (a-z) o n&uacute;meros (0-9) en este campo. No se admiten espacios ni otros caracteres.',
  13457. dateSuchAs: 'Por favor introduce una fecha v&aacute;lida como {date}',
  13458. dateInFormatMDY: 'Por favor introduce una fecha v&aacute;lida como DD/MM/YYYY (p.e. "31/12/1999")',
  13459. email: 'Por favor, introduce una direcci&oacute;n de email v&aacute;lida. Por ejemplo, "fred@domain.com".',
  13460. url: 'Por favor introduce una URL v&aacute;lida como http://www.example.com.',
  13461. currencyDollar: 'Por favor introduce una cantidad v&aacute;lida de €. Por ejemplo €100,00 .',
  13462. oneRequired: 'Por favor introduce algo para por lo menos una de estas entradas.',
  13463. errorPrefix: 'Error: ',
  13464. warningPrefix: 'Aviso: ',
  13465. // Form.Validator.Extras
  13466. noSpace: 'No pueden haber espacios en esta entrada.',
  13467. reqChkByNode: 'No hay elementos seleccionados.',
  13468. requiredChk: 'Este campo es obligatorio.',
  13469. reqChkByName: 'Por favor selecciona una {label}.',
  13470. match: 'Este campo necesita coincidir con el campo {matchName}',
  13471. startDate: 'la fecha de inicio',
  13472. endDate: 'la fecha de fin',
  13473. currentDate: 'la fecha actual',
  13474. afterDate: 'La fecha debe ser igual o posterior a {label}.',
  13475. beforeDate: 'La fecha debe ser igual o anterior a {label}.',
  13476. startMonth: 'Por favor selecciona un mes de origen',
  13477. sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.'
  13478. });
  13479. /*
  13480. ---
  13481. name: Locale.es-VE.Date
  13482. description: Date messages for Spanish (Venezuela).
  13483. license: MIT-style license
  13484. authors:
  13485. - Daniel Barreto
  13486. requires:
  13487. - Locale
  13488. - Locale.es-ES.Date
  13489. provides: [Locale.es-VE.Date]
  13490. ...
  13491. */
  13492. Locale.define('es-VE').inherit('es-ES', 'Date');
  13493. /*
  13494. ---
  13495. name: Locale.es-VE.Form.Validator
  13496. description: Form Validator messages for Spanish (Venezuela).
  13497. license: MIT-style license
  13498. authors:
  13499. - Daniel Barreto
  13500. requires:
  13501. - Locale
  13502. - Locale.es-ES.Form.Validator
  13503. provides: [Locale.es-VE.Form.Validator]
  13504. ...
  13505. */
  13506. Locale.define('es-VE', 'FormValidator', {
  13507. 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.',
  13508. alpha: 'Por favor usa solo letras (a-z) en este campo. No se admiten espacios ni otros caracteres.',
  13509. currencyDollar: 'Por favor introduce una cantidad v&aacute;lida de Bs. Por ejemplo Bs. 100,00 .',
  13510. oneRequired: 'Por favor introduce un valor para por lo menos una de estas entradas.',
  13511. // Form.Validator.Extras
  13512. startDate: 'La fecha de inicio',
  13513. endDate: 'La fecha de fin',
  13514. currentDate: 'La fecha actual'
  13515. }).inherit('es-ES', 'FormValidator');
  13516. /*
  13517. ---
  13518. name: Locale.es-VE.Number
  13519. description: Number messages for Spanish (Venezuela).
  13520. license: MIT-style license
  13521. authors:
  13522. - Daniel Barreto
  13523. requires:
  13524. - Locale
  13525. provides: [Locale.es-VE.Number]
  13526. ...
  13527. */
  13528. Locale.define('es-VE', 'Number', {
  13529. decimal: ',',
  13530. group: '.',
  13531. /*
  13532. decimals: 0,
  13533. precision: 0,
  13534. */
  13535. // Negative/Currency/percentage will mixin Number
  13536. negative: {
  13537. prefix: '-'
  13538. },
  13539. currency: {
  13540. decimals: 2,
  13541. prefix: 'Bs. '
  13542. },
  13543. percentage: {
  13544. decimals: 2,
  13545. suffix: '%'
  13546. }
  13547. });
  13548. /*
  13549. ---
  13550. name: Locale.et-EE.Date
  13551. description: Date messages for Estonian.
  13552. license: MIT-style license
  13553. authors:
  13554. - Kevin Valdek
  13555. requires:
  13556. - Locale
  13557. provides: [Locale.et-EE.Date]
  13558. ...
  13559. */
  13560. Locale.define('et-EE', 'Date', {
  13561. months: ['jaanuar', 'veebruar', 'märts', 'aprill', 'mai', 'juuni', 'juuli', 'august', 'september', 'oktoober', 'november', 'detsember'],
  13562. months_abbr: ['jaan', 'veebr', 'märts', 'apr', 'mai', 'juuni', 'juuli', 'aug', 'sept', 'okt', 'nov', 'dets'],
  13563. days: ['pühapäev', 'esmaspäev', 'teisipäev', 'kolmapäev', 'neljapäev', 'reede', 'laupäev'],
  13564. days_abbr: ['pühap', 'esmasp', 'teisip', 'kolmap', 'neljap', 'reede', 'laup'],
  13565. // Culture's date order: MM.DD.YYYY
  13566. dateOrder: ['month', 'date', 'year'],
  13567. shortDate: '%m.%d.%Y',
  13568. shortTime: '%H:%M',
  13569. AM: 'AM',
  13570. PM: 'PM',
  13571. firstDayOfWeek: 1,
  13572. // Date.Extras
  13573. ordinal: '',
  13574. lessThanMinuteAgo: 'vähem kui minut aega tagasi',
  13575. minuteAgo: 'umbes minut aega tagasi',
  13576. minutesAgo: '{delta} minutit tagasi',
  13577. hourAgo: 'umbes tund aega tagasi',
  13578. hoursAgo: 'umbes {delta} tundi tagasi',
  13579. dayAgo: '1 päev tagasi',
  13580. daysAgo: '{delta} päeva tagasi',
  13581. weekAgo: '1 nädal tagasi',
  13582. weeksAgo: '{delta} nädalat tagasi',
  13583. monthAgo: '1 kuu tagasi',
  13584. monthsAgo: '{delta} kuud tagasi',
  13585. yearAgo: '1 aasta tagasi',
  13586. yearsAgo: '{delta} aastat tagasi',
  13587. lessThanMinuteUntil: 'vähem kui minuti aja pärast',
  13588. minuteUntil: 'umbes minuti aja pärast',
  13589. minutesUntil: '{delta} minuti pärast',
  13590. hourUntil: 'umbes tunni aja pärast',
  13591. hoursUntil: 'umbes {delta} tunni pärast',
  13592. dayUntil: '1 päeva pärast',
  13593. daysUntil: '{delta} päeva pärast',
  13594. weekUntil: '1 nädala pärast',
  13595. weeksUntil: '{delta} nädala pärast',
  13596. monthUntil: '1 kuu pärast',
  13597. monthsUntil: '{delta} kuu pärast',
  13598. yearUntil: '1 aasta pärast',
  13599. yearsUntil: '{delta} aasta pärast'
  13600. });
  13601. /*
  13602. ---
  13603. name: Locale.et-EE.Form.Validator
  13604. description: Form Validator messages for Estonian.
  13605. license: MIT-style license
  13606. authors:
  13607. - Kevin Valdek
  13608. requires:
  13609. - Locale
  13610. provides: [Locale.et-EE.Form.Validator]
  13611. ...
  13612. */
  13613. Locale.define('et-EE', 'FormValidator', {
  13614. required: 'Väli peab olema täidetud.',
  13615. minLength: 'Palun sisestage vähemalt {minLength} tähte (te sisestasite {length} tähte).',
  13616. maxLength: 'Palun ärge sisestage rohkem kui {maxLength} tähte (te sisestasite {length} tähte).',
  13617. integer: 'Palun sisestage väljale täisarv. Kümnendarvud (näiteks 1.25) ei ole lubatud.',
  13618. numeric: 'Palun sisestage ainult numbreid väljale (näiteks "1", "1.1", "-1" või "-1.1").',
  13619. digits: 'Palun kasutage ainult numbreid ja kirjavahemärke (telefoninumbri sisestamisel on lubatud kasutada kriipse ja punkte).',
  13620. alpha: 'Palun kasutage ainult tähti (a-z). Tühikud ja teised sümbolid on keelatud.',
  13621. alphanum: 'Palun kasutage ainult tähti (a-z) või numbreid (0-9). Tühikud ja teised sümbolid on keelatud.',
  13622. dateSuchAs: 'Palun sisestage kehtiv kuupäev kujul {date}',
  13623. dateInFormatMDY: 'Palun sisestage kehtiv kuupäev kujul MM.DD.YYYY (näiteks: "12.31.1999").',
  13624. email: 'Palun sisestage kehtiv e-maili aadress (näiteks: "fred@domain.com").',
  13625. url: 'Palun sisestage kehtiv URL (näiteks: http://www.example.com).',
  13626. currencyDollar: 'Palun sisestage kehtiv $ summa (näiteks: $100.00).',
  13627. oneRequired: 'Palun sisestage midagi vähemalt ühele antud väljadest.',
  13628. errorPrefix: 'Viga: ',
  13629. warningPrefix: 'Hoiatus: ',
  13630. // Form.Validator.Extras
  13631. noSpace: 'Väli ei tohi sisaldada tühikuid.',
  13632. reqChkByNode: 'Ükski väljadest pole valitud.',
  13633. requiredChk: 'Välja täitmine on vajalik.',
  13634. reqChkByName: 'Palun valige üks {label}.',
  13635. match: 'Väli peab sobima {matchName} väljaga',
  13636. startDate: 'algkuupäev',
  13637. endDate: 'lõppkuupäev',
  13638. currentDate: 'praegune kuupäev',
  13639. afterDate: 'Kuupäev peab olema võrdne või pärast {label}.',
  13640. beforeDate: 'Kuupäev peab olema võrdne või enne {label}.',
  13641. startMonth: 'Palun valige algkuupäev.',
  13642. sameMonth: 'Antud kaks kuupäeva peavad olema samas kuus - peate muutma ühte kuupäeva.'
  13643. });
  13644. /*
  13645. ---
  13646. name: Locale.fa.Date
  13647. description: Date messages for Persian.
  13648. license: MIT-style license
  13649. authors:
  13650. - Amir Hossein Hodjaty Pour
  13651. requires:
  13652. - Locale
  13653. provides: [Locale.fa.Date]
  13654. ...
  13655. */
  13656. Locale.define('fa', 'Date', {
  13657. months: ['ژانویه', 'فوریه', 'مارس', 'آپریل', 'مه', 'ژوئن', 'ژوئیه', 'آگوست', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
  13658. months_abbr: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
  13659. days: ['یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
  13660. days_abbr: ['ي', 'د', 'س', 'چ', 'پ', 'ج', 'ش'],
  13661. // Culture's date order: MM/DD/YYYY
  13662. dateOrder: ['month', 'date', 'year'],
  13663. shortDate: '%m/%d/%Y',
  13664. shortTime: '%I:%M%p',
  13665. AM: 'ق.ظ',
  13666. PM: 'ب.ظ',
  13667. // Date.Extras
  13668. ordinal: 'ام',
  13669. lessThanMinuteAgo: 'کمتر از یک دقیقه پیش',
  13670. minuteAgo: 'حدود یک دقیقه پیش',
  13671. minutesAgo: '{delta} دقیقه پیش',
  13672. hourAgo: 'حدود یک ساعت پیش',
  13673. hoursAgo: 'حدود {delta} ساعت پیش',
  13674. dayAgo: '1 روز پیش',
  13675. daysAgo: '{delta} روز پیش',
  13676. weekAgo: '1 هفته پیش',
  13677. weeksAgo: '{delta} هفته پیش',
  13678. monthAgo: '1 ماه پیش',
  13679. monthsAgo: '{delta} ماه پیش',
  13680. yearAgo: '1 سال پیش',
  13681. yearsAgo: '{delta} سال پیش',
  13682. lessThanMinuteUntil: 'کمتر از یک دقیقه از حالا',
  13683. minuteUntil: 'حدود یک دقیقه از حالا',
  13684. minutesUntil: '{delta} دقیقه از حالا',
  13685. hourUntil: 'حدود یک ساعت از حالا',
  13686. hoursUntil: 'حدود {delta} ساعت از حالا',
  13687. dayUntil: '1 روز از حالا',
  13688. daysUntil: '{delta} روز از حالا',
  13689. weekUntil: '1 هفته از حالا',
  13690. weeksUntil: '{delta} هفته از حالا',
  13691. monthUntil: '1 ماه از حالا',
  13692. monthsUntil: '{delta} ماه از حالا',
  13693. yearUntil: '1 سال از حالا',
  13694. yearsUntil: '{delta} سال از حالا'
  13695. });
  13696. /*
  13697. ---
  13698. name: Locale.fa.Form.Validator
  13699. description: Form Validator messages for Persian.
  13700. license: MIT-style license
  13701. authors:
  13702. - Amir Hossein Hodjaty Pour
  13703. requires:
  13704. - Locale
  13705. provides: [Locale.fa.Form.Validator]
  13706. ...
  13707. */
  13708. Locale.define('fa', 'FormValidator', {
  13709. required: 'این فیلد الزامی است.',
  13710. minLength: 'شما باید حداقل {minLength} حرف وارد کنید ({length} حرف وارد کرده اید).',
  13711. maxLength: 'لطفا حداکثر {maxLength} حرف وارد کنید (شما {length} حرف وارد کرده اید).',
  13712. integer: 'لطفا از عدد صحیح استفاده کنید. اعداد اعشاری (مانند 1.25) مجاز نیستند.',
  13713. numeric: 'لطفا فقط داده عددی وارد کنید (مانند "1" یا "1.1" یا "1-" یا "1.1-").',
  13714. digits: 'لطفا فقط از اعداد و علامتها در این فیلد استفاده کنید (برای مثال شماره تلفن با خط تیره و نقطه قابل قبول است).',
  13715. alpha: 'لطفا فقط از حروف الفباء برای این بخش استفاده کنید. کاراکترهای دیگر و فاصله مجاز نیستند.',
  13716. alphanum: 'لطفا فقط از حروف الفباء و اعداد در این بخش استفاده کنید. کاراکترهای دیگر و فاصله مجاز نیستند.',
  13717. dateSuchAs: 'لطفا یک تاریخ معتبر مانند {date} وارد کنید.',
  13718. dateInFormatMDY: 'لطفا یک تاریخ معتبر به شکل MM/DD/YYYY وارد کنید (مانند "12/31/1999").',
  13719. email: 'لطفا یک آدرس ایمیل معتبر وارد کنید. برای مثال "fred@domain.com".',
  13720. url: 'لطفا یک URL معتبر مانند http://www.example.com وارد کنید.',
  13721. currencyDollar: 'لطفا یک محدوده معتبر برای این بخش وارد کنید مانند 100.00$ .',
  13722. oneRequired: 'لطفا حداقل یکی از فیلدها را پر کنید.',
  13723. errorPrefix: 'خطا: ',
  13724. warningPrefix: 'هشدار: ',
  13725. // Form.Validator.Extras
  13726. noSpace: 'استفاده از فاصله در این بخش مجاز نیست.',
  13727. reqChkByNode: 'موردی انتخاب نشده است.',
  13728. requiredChk: 'این فیلد الزامی است.',
  13729. reqChkByName: 'لطفا یک {label} را انتخاب کنید.',
  13730. match: 'این فیلد باید با فیلد {matchName} مطابقت داشته باشد.',
  13731. startDate: 'تاریخ شروع',
  13732. endDate: 'تاریخ پایان',
  13733. currentDate: 'تاریخ کنونی',
  13734. afterDate: 'تاریخ میبایست برابر یا بعد از {label} باشد',
  13735. beforeDate: 'تاریخ میبایست برابر یا قبل از {label} باشد',
  13736. startMonth: 'لطفا ماه شروع را انتخاب کنید',
  13737. sameMonth: 'این دو تاریخ باید در یک ماه باشند - شما باید یکی یا هر دو را تغییر دهید.',
  13738. creditcard: 'شماره کارت اعتباری که وارد کرده اید معتبر نیست. لطفا شماره را بررسی کنید و مجددا تلاش کنید. {length} رقم وارد شده است.'
  13739. });
  13740. /*
  13741. ---
  13742. name: Locale.fi-FI.Date
  13743. description: Date messages for Finnish.
  13744. license: MIT-style license
  13745. authors:
  13746. - ksel
  13747. requires:
  13748. - Locale
  13749. provides: [Locale.fi-FI.Date]
  13750. ...
  13751. */
  13752. Locale.define('fi-FI', 'Date', {
  13753. // NOTE: months and days are not capitalized in finnish
  13754. months: ['tammikuu', 'helmikuu', 'maaliskuu', 'huhtikuu', 'toukokuu', 'kesäkuu', 'heinäkuu', 'elokuu', 'syyskuu', 'lokakuu', 'marraskuu', 'joulukuu'],
  13755. // these abbreviations are really not much used in finnish because they obviously won't abbreviate very much. ;)
  13756. // NOTE: sometimes one can see forms such as "tammi", "helmi", etc. but that is not proper finnish.
  13757. months_abbr: ['tammik.', 'helmik.', 'maalisk.', 'huhtik.', 'toukok.', 'kesäk.', 'heinäk.', 'elok.', 'syysk.', 'lokak.', 'marrask.', 'jouluk.'],
  13758. days: ['sunnuntai', 'maanantai', 'tiistai', 'keskiviikko', 'torstai', 'perjantai', 'lauantai'],
  13759. days_abbr: ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'],
  13760. // Culture's date order: DD/MM/YYYY
  13761. dateOrder: ['date', 'month', 'year'],
  13762. shortDate: '%d.%m.%Y',
  13763. shortTime: '%H:%M',
  13764. AM: 'AM',
  13765. PM: 'PM',
  13766. firstDayOfWeek: 1,
  13767. // Date.Extras
  13768. ordinal: '.',
  13769. lessThanMinuteAgo: 'vajaa minuutti sitten',
  13770. minuteAgo: 'noin minuutti sitten',
  13771. minutesAgo: '{delta} minuuttia sitten',
  13772. hourAgo: 'noin tunti sitten',
  13773. hoursAgo: 'noin {delta} tuntia sitten',
  13774. dayAgo: 'päivä sitten',
  13775. daysAgo: '{delta} päivää sitten',
  13776. weekAgo: 'viikko sitten',
  13777. weeksAgo: '{delta} viikkoa sitten',
  13778. monthAgo: 'kuukausi sitten',
  13779. monthsAgo: '{delta} kuukautta sitten',
  13780. yearAgo: 'vuosi sitten',
  13781. yearsAgo: '{delta} vuotta sitten',
  13782. lessThanMinuteUntil: 'vajaan minuutin kuluttua',
  13783. minuteUntil: 'noin minuutin kuluttua',
  13784. minutesUntil: '{delta} minuutin kuluttua',
  13785. hourUntil: 'noin tunnin kuluttua',
  13786. hoursUntil: 'noin {delta} tunnin kuluttua',
  13787. dayUntil: 'päivän kuluttua',
  13788. daysUntil: '{delta} päivän kuluttua',
  13789. weekUntil: 'viikon kuluttua',
  13790. weeksUntil: '{delta} viikon kuluttua',
  13791. monthUntil: 'kuukauden kuluttua',
  13792. monthsUntil: '{delta} kuukauden kuluttua',
  13793. yearUntil: 'vuoden kuluttua',
  13794. yearsUntil: '{delta} vuoden kuluttua'
  13795. });
  13796. /*
  13797. ---
  13798. name: Locale.fi-FI.Form.Validator
  13799. description: Form Validator messages for Finnish.
  13800. license: MIT-style license
  13801. authors:
  13802. - ksel
  13803. requires:
  13804. - Locale
  13805. provides: [Locale.fi-FI.Form.Validator]
  13806. ...
  13807. */
  13808. Locale.define('fi-FI', 'FormValidator', {
  13809. required: 'Tämä kenttä on pakollinen.',
  13810. minLength: 'Ole hyvä ja anna vähintään {minLength} merkkiä (annoit {length} merkkiä).',
  13811. maxLength: 'Älä anna enempää kuin {maxLength} merkkiä (annoit {length} merkkiä).',
  13812. integer: 'Ole hyvä ja anna kokonaisluku. Luvut, joissa on desimaaleja (esim. 1.25) eivät ole sallittuja.',
  13813. numeric: 'Anna tähän kenttään lukuarvo (kuten "1" tai "1.1" tai "-1" tai "-1.1").',
  13814. 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).',
  13815. alpha: 'Anna tähän kenttään vain kirjaimia (a-z). Välilyönnit tai muut merkit eivät ole sallittuja.',
  13816. 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.',
  13817. dateSuchAs: 'Ole hyvä ja anna kelvollinen päivmäärä, kuten esimerkiksi {date}',
  13818. dateInFormatMDY: 'Ole hyvä ja anna kelvollinen päivämäärä muodossa pp/kk/vvvv (kuten "12/31/1999")',
  13819. email: 'Ole hyvä ja anna kelvollinen sähköpostiosoite (kuten esimerkiksi "matti@meikalainen.com").',
  13820. url: 'Ole hyvä ja anna kelvollinen URL, kuten esimerkiksi http://www.example.com.',
  13821. currencyDollar: 'Ole hyvä ja anna kelvollinen eurosumma (kuten esimerkiksi 100,00 EUR) .',
  13822. oneRequired: 'Ole hyvä ja syötä jotakin ainakin johonkin näistä kentistä.',
  13823. errorPrefix: 'Virhe: ',
  13824. warningPrefix: 'Varoitus: ',
  13825. // Form.Validator.Extras
  13826. noSpace: 'Tässä syötteessä ei voi olla välilyöntejä',
  13827. reqChkByNode: 'Ei valintoja.',
  13828. requiredChk: 'Tämä kenttä on pakollinen.',
  13829. reqChkByName: 'Ole hyvä ja valitse {label}.',
  13830. match: 'Tämän kentän tulee vastata kenttää {matchName}',
  13831. startDate: 'alkupäivämäärä',
  13832. endDate: 'loppupäivämäärä',
  13833. currentDate: 'nykyinen päivämäärä',
  13834. afterDate: 'Päivämäärän tulisi olla sama tai myöhäisempi ajankohta kuin {label}.',
  13835. beforeDate: 'Päivämäärän tulisi olla sama tai aikaisempi ajankohta kuin {label}.',
  13836. startMonth: 'Ole hyvä ja valitse aloituskuukausi',
  13837. sameMonth: 'Näiden kahden päivämäärän tulee olla saman kuun sisällä -- sinun pitää muuttaa jompaa kumpaa.',
  13838. creditcard: 'Annettu luottokortin numero ei kelpaa. Ole hyvä ja tarkista numero sekä yritä uudelleen. {length} numeroa syötetty.'
  13839. });
  13840. /*
  13841. ---
  13842. name: Locale.fi-FI.Number
  13843. description: Finnish number messages
  13844. license: MIT-style license
  13845. authors:
  13846. - ksel
  13847. requires:
  13848. - Locale
  13849. - Locale.EU.Number
  13850. provides: [Locale.fi-FI.Number]
  13851. ...
  13852. */
  13853. Locale.define('fi-FI', 'Number', {
  13854. group: ' ' // grouped by space
  13855. }).inherit('EU', 'Number');
  13856. /*
  13857. ---
  13858. name: Locale.fr-FR.Date
  13859. description: Date messages for French.
  13860. license: MIT-style license
  13861. authors:
  13862. - Nicolas Sorosac
  13863. - Antoine Abt
  13864. requires:
  13865. - Locale
  13866. provides: [Locale.fr-FR.Date]
  13867. ...
  13868. */
  13869. Locale.define('fr-FR', 'Date', {
  13870. months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
  13871. months_abbr: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
  13872. days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
  13873. days_abbr: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
  13874. // Culture's date order: DD/MM/YYYY
  13875. dateOrder: ['date', 'month', 'year'],
  13876. shortDate: '%d/%m/%Y',
  13877. shortTime: '%H:%M',
  13878. AM: 'AM',
  13879. PM: 'PM',
  13880. firstDayOfWeek: 1,
  13881. // Date.Extras
  13882. ordinal: function(dayOfMonth){
  13883. return (dayOfMonth > 1) ? '' : 'er';
  13884. },
  13885. lessThanMinuteAgo: "il y a moins d'une minute",
  13886. minuteAgo: 'il y a une minute',
  13887. minutesAgo: 'il y a {delta} minutes',
  13888. hourAgo: 'il y a une heure',
  13889. hoursAgo: 'il y a {delta} heures',
  13890. dayAgo: 'il y a un jour',
  13891. daysAgo: 'il y a {delta} jours',
  13892. weekAgo: 'il y a une semaine',
  13893. weeksAgo: 'il y a {delta} semaines',
  13894. monthAgo: 'il y a 1 mois',
  13895. monthsAgo: 'il y a {delta} mois',
  13896. yearthAgo: 'il y a 1 an',
  13897. yearsAgo: 'il y a {delta} ans',
  13898. lessThanMinuteUntil: "dans moins d'une minute",
  13899. minuteUntil: 'dans une minute',
  13900. minutesUntil: 'dans {delta} minutes',
  13901. hourUntil: 'dans une heure',
  13902. hoursUntil: 'dans {delta} heures',
  13903. dayUntil: 'dans un jour',
  13904. daysUntil: 'dans {delta} jours',
  13905. weekUntil: 'dans 1 semaine',
  13906. weeksUntil: 'dans {delta} semaines',
  13907. monthUntil: 'dans 1 mois',
  13908. monthsUntil: 'dans {delta} mois',
  13909. yearUntil: 'dans 1 an',
  13910. yearsUntil: 'dans {delta} ans'
  13911. });
  13912. /*
  13913. ---
  13914. name: Locale.fr-FR.Form.Validator
  13915. description: Form Validator messages for French.
  13916. license: MIT-style license
  13917. authors:
  13918. - Miquel Hudin
  13919. - Nicolas Sorosac
  13920. requires:
  13921. - Locale
  13922. provides: [Locale.fr-FR.Form.Validator]
  13923. ...
  13924. */
  13925. /*eslint mootools-whitespace:0*/
  13926. Locale.define('fr-FR', 'FormValidator', {
  13927. required: 'Ce champ est obligatoire.',
  13928. length: 'Veuillez saisir {length} caract&egrave;re(s) (vous avez saisi {elLength} caract&egrave;re(s)',
  13929. minLength: 'Veuillez saisir un minimum de {minLength} caract&egrave;re(s) (vous avez saisi {length} caract&egrave;re(s)).',
  13930. maxLength: 'Veuillez saisir un maximum de {maxLength} caract&egrave;re(s) (vous avez saisi {length} caract&egrave;re(s)).',
  13931. integer: 'Veuillez saisir un nombre entier dans ce champ. Les nombres d&eacute;cimaux (ex : "1,25") ne sont pas autoris&eacute;s.',
  13932. numeric: 'Veuillez saisir uniquement des chiffres dans ce champ (ex : "1" ou "1,1" ou "-1" ou "-1,1").',
  13933. 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;).",
  13934. alpha: 'Veuillez saisir uniquement des lettres (a-z) dans ce champ. Les espaces ou autres caract&egrave;res ne sont pas autoris&eacute;s.',
  13935. 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.',
  13936. dateSuchAs: 'Veuillez saisir une date correcte comme {date}',
  13937. dateInFormatMDY: 'Veuillez saisir une date correcte, au format JJ/MM/AAAA (ex : "31/11/1999").',
  13938. email: 'Veuillez saisir une adresse de courrier &eacute;lectronique. Par exemple "fred@domaine.com".',
  13939. url: 'Veuillez saisir une URL, comme http://www.exemple.com.',
  13940. currencyDollar: 'Veuillez saisir une quantit&eacute; correcte. Par exemple 100,00&euro;.',
  13941. oneRequired: 'Veuillez s&eacute;lectionner au moins une de ces options.',
  13942. errorPrefix: 'Erreur : ',
  13943. warningPrefix: 'Attention : ',
  13944. // Form.Validator.Extras
  13945. noSpace: "Ce champ n'accepte pas les espaces.",
  13946. reqChkByNode: "Aucun &eacute;l&eacute;ment n'est s&eacute;lectionn&eacute;.",
  13947. requiredChk: 'Ce champ est obligatoire.',
  13948. reqChkByName: 'Veuillez s&eacute;lectionner un(e) {label}.',
  13949. match: 'Ce champ doit correspondre avec le champ {matchName}.',
  13950. startDate: 'date de d&eacute;but',
  13951. endDate: 'date de fin',
  13952. currentDate: 'date actuelle',
  13953. afterDate: 'La date doit &ecirc;tre identique ou post&eacute;rieure &agrave; {label}.',
  13954. beforeDate: 'La date doit &ecirc;tre identique ou ant&eacute;rieure &agrave; {label}.',
  13955. startMonth: 'Veuillez s&eacute;lectionner un mois de d&eacute;but.',
  13956. sameMonth: 'Ces deux dates doivent &ecirc;tre dans le m&ecirc;me mois - vous devez en modifier une.',
  13957. 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).'
  13958. });
  13959. /*
  13960. ---
  13961. name: Locale.fr-FR.Number
  13962. description: Number messages for French.
  13963. license: MIT-style license
  13964. authors:
  13965. - Arian Stolwijk
  13966. - sv1l
  13967. requires:
  13968. - Locale
  13969. - Locale.EU.Number
  13970. provides: [Locale.fr-FR.Number]
  13971. ...
  13972. */
  13973. Locale.define('fr-FR', 'Number', {
  13974. group: ' ' // In fr-FR localization, group character is a blank space
  13975. }).inherit('EU', 'Number');
  13976. /*
  13977. ---
  13978. name: Locale.he-IL.Date
  13979. description: Date messages for Hebrew.
  13980. license: MIT-style license
  13981. authors:
  13982. - Elad Ossadon
  13983. requires:
  13984. - Locale
  13985. provides: [Locale.he-IL.Date]
  13986. ...
  13987. */
  13988. Locale.define('he-IL', 'Date', {
  13989. months: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
  13990. months_abbr: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
  13991. days: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'],
  13992. days_abbr: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'],
  13993. // Culture's date order: MM/DD/YYYY
  13994. dateOrder: ['date', 'month', 'year'],
  13995. shortDate: '%d/%m/%Y',
  13996. shortTime: '%H:%M',
  13997. AM: 'AM',
  13998. PM: 'PM',
  13999. firstDayOfWeek: 0,
  14000. // Date.Extras
  14001. ordinal: '',
  14002. lessThanMinuteAgo: 'לפני פחות מדקה',
  14003. minuteAgo: 'לפני כדקה',
  14004. minutesAgo: 'לפני {delta} דקות',
  14005. hourAgo: 'לפני כשעה',
  14006. hoursAgo: 'לפני {delta} שעות',
  14007. dayAgo: 'לפני יום',
  14008. daysAgo: 'לפני {delta} ימים',
  14009. weekAgo: 'לפני שבוע',
  14010. weeksAgo: 'לפני {delta} שבועות',
  14011. monthAgo: 'לפני חודש',
  14012. monthsAgo: 'לפני {delta} חודשים',
  14013. yearAgo: 'לפני שנה',
  14014. yearsAgo: 'לפני {delta} שנים',
  14015. lessThanMinuteUntil: 'בעוד פחות מדקה',
  14016. minuteUntil: 'בעוד כדקה',
  14017. minutesUntil: 'בעוד {delta} דקות',
  14018. hourUntil: 'בעוד כשעה',
  14019. hoursUntil: 'בעוד {delta} שעות',
  14020. dayUntil: 'בעוד יום',
  14021. daysUntil: 'בעוד {delta} ימים',
  14022. weekUntil: 'בעוד שבוע',
  14023. weeksUntil: 'בעוד {delta} שבועות',
  14024. monthUntil: 'בעוד חודש',
  14025. monthsUntil: 'בעוד {delta} חודשים',
  14026. yearUntil: 'בעוד שנה',
  14027. yearsUntil: 'בעוד {delta} שנים'
  14028. });
  14029. /*
  14030. ---
  14031. name: Locale.he-IL.Form.Validator
  14032. description: Form Validator messages for Hebrew.
  14033. license: MIT-style license
  14034. authors:
  14035. - Elad Ossadon
  14036. requires:
  14037. - Locale
  14038. provides: [Locale.he-IL.Form.Validator]
  14039. ...
  14040. */
  14041. Locale.define('he-IL', 'FormValidator', {
  14042. required: 'נא למלא שדה זה.',
  14043. minLength: 'נא להזין לפחות {minLength} תווים (הזנת {length} תווים).',
  14044. maxLength: 'נא להזין עד {maxLength} תווים (הזנת {length} תווים).',
  14045. integer: 'נא להזין מספר שלם לשדה זה. מספרים עשרוניים (כמו 1.25) אינם חוקיים.',
  14046. numeric: 'נא להזין ערך מספרי בלבד בשדה זה (כמו "1", "1.1", "-1" או "-1.1").',
  14047. digits: 'נא להזין רק ספרות וסימני הפרדה בשדה זה (למשל, מספר טלפון עם מקפים או נקודות הוא חוקי).',
  14048. alpha: 'נא להזין רק אותיות באנגלית (a-z) בשדה זה. רווחים או תווים אחרים אינם חוקיים.',
  14049. alphanum: 'נא להזין רק אותריות באנגלית (a-z) או ספרות (0-9) בשדה זה. אווחרים או תווים אחרים אינם חוקיים.',
  14050. dateSuchAs: 'נא להזין תאריך חוקי, כמו {date}',
  14051. dateInFormatMDY: 'נא להזין תאריך חוקי בפורמט MM/DD/YYYY (כמו "12/31/1999")',
  14052. email: 'נא להזין כתובת אימייל חוקית. לדוגמה: "fred@domain.com".',
  14053. url: 'נא להזין כתובת אתר חוקית, כמו http://www.example.com.',
  14054. currencyDollar: 'נא להזין סכום דולרי חוקי. לדוגמה $100.00.',
  14055. oneRequired: 'נא לבחור לפחות בשדה אחד.',
  14056. errorPrefix: 'שגיאה: ',
  14057. warningPrefix: 'אזהרה: ',
  14058. // Form.Validator.Extras
  14059. noSpace: 'אין להזין רווחים בשדה זה.',
  14060. reqChkByNode: 'נא לבחור אחת מהאפשרויות.',
  14061. requiredChk: 'שדה זה נדרש.',
  14062. reqChkByName: 'נא לבחור {label}.',
  14063. match: 'שדה זה צריך להתאים לשדה {matchName}',
  14064. startDate: 'תאריך ההתחלה',
  14065. endDate: 'תאריך הסיום',
  14066. currentDate: 'התאריך הנוכחי',
  14067. afterDate: 'התאריך צריך להיות זהה או אחרי {label}.',
  14068. beforeDate: 'התאריך צריך להיות זהה או לפני {label}.',
  14069. startMonth: 'נא לבחור חודש התחלה',
  14070. sameMonth: 'שני תאריכים אלה צריכים להיות באותו חודש - נא לשנות אחד התאריכים.',
  14071. creditcard: 'מספר כרטיס האשראי שהוזן אינו חוקי. נא לבדוק שנית. הוזנו {length} ספרות.'
  14072. });
  14073. /*
  14074. ---
  14075. name: Locale.he-IL.Number
  14076. description: Number messages for Hebrew.
  14077. license: MIT-style license
  14078. authors:
  14079. - Elad Ossadon
  14080. requires:
  14081. - Locale
  14082. provides: [Locale.he-IL.Number]
  14083. ...
  14084. */
  14085. Locale.define('he-IL', 'Number', {
  14086. decimal: '.',
  14087. group: ',',
  14088. currency: {
  14089. suffix: ' ₪'
  14090. }
  14091. });
  14092. /*
  14093. ---
  14094. name: Locale.hu-HU.Date
  14095. description: Date messages for Hungarian.
  14096. license: MIT-style license
  14097. authors:
  14098. - Zsolt Szegheő
  14099. requires:
  14100. - Locale
  14101. provides: [Locale.hu-HU.Date]
  14102. ...
  14103. */
  14104. Locale.define('hu-HU', 'Date', {
  14105. months: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június', 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],
  14106. months_abbr: ['jan.', 'febr.', 'márc.', 'ápr.', 'máj.', 'jún.', 'júl.', 'aug.', 'szept.', 'okt.', 'nov.', 'dec.'],
  14107. days: ['Vasárnap', 'Hétfő', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
  14108. days_abbr: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
  14109. // Culture's date order: YYYY.MM.DD.
  14110. dateOrder: ['year', 'month', 'date'],
  14111. shortDate: '%Y.%m.%d.',
  14112. shortTime: '%I:%M',
  14113. AM: 'de.',
  14114. PM: 'du.',
  14115. firstDayOfWeek: 1,
  14116. // Date.Extras
  14117. ordinal: '.',
  14118. lessThanMinuteAgo: 'alig egy perce',
  14119. minuteAgo: 'egy perce',
  14120. minutesAgo: '{delta} perce',
  14121. hourAgo: 'egy órája',
  14122. hoursAgo: '{delta} órája',
  14123. dayAgo: '1 napja',
  14124. daysAgo: '{delta} napja',
  14125. weekAgo: '1 hete',
  14126. weeksAgo: '{delta} hete',
  14127. monthAgo: '1 hónapja',
  14128. monthsAgo: '{delta} hónapja',
  14129. yearAgo: '1 éve',
  14130. yearsAgo: '{delta} éve',
  14131. lessThanMinuteUntil: 'alig egy perc múlva',
  14132. minuteUntil: 'egy perc múlva',
  14133. minutesUntil: '{delta} perc múlva',
  14134. hourUntil: 'egy óra múlva',
  14135. hoursUntil: '{delta} óra múlva',
  14136. dayUntil: '1 nap múlva',
  14137. daysUntil: '{delta} nap múlva',
  14138. weekUntil: '1 hét múlva',
  14139. weeksUntil: '{delta} hét múlva',
  14140. monthUntil: '1 hónap múlva',
  14141. monthsUntil: '{delta} hónap múlva',
  14142. yearUntil: '1 év múlva',
  14143. yearsUntil: '{delta} év múlva'
  14144. });
  14145. /*
  14146. ---
  14147. name: Locale.hu-HU.Form.Validator
  14148. description: Form Validator messages for Hungarian.
  14149. license: MIT-style license
  14150. authors:
  14151. - Zsolt Szegheő
  14152. requires:
  14153. - Locale
  14154. provides: [Locale.hu-HU.Form.Validator]
  14155. ...
  14156. */
  14157. /*eslint mootools-whitespace:0*/
  14158. Locale.define('hu-HU', 'FormValidator', {
  14159. required: 'A mező kitöltése kötelező.',
  14160. minLength: 'Legalább {minLength} karakter megadása szükséges (megadva {length} karakter).',
  14161. maxLength: 'Legfeljebb {maxLength} karakter megadása lehetséges (megadva {length} karakter).',
  14162. integer: 'Egész szám megadása szükséges. A tizedesjegyek (pl. 1.25) nem engedélyezettek.',
  14163. numeric: 'Szám megadása szükséges (pl. "1" vagy "1.1" vagy "-1" vagy "-1.1").',
  14164. digits: 'Csak számok és írásjelek megadása lehetséges (pl. telefonszám kötőjelek és/vagy perjelekkel).',
  14165. alpha: 'Csak betűk (a-z) megadása lehetséges. Szóköz és egyéb karakterek nem engedélyezettek.',
  14166. 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.',
  14167. dateSuchAs: 'Valós dátum megadása szükséges (pl. {date}).',
  14168. dateInFormatMDY: 'Valós dátum megadása szükséges ÉÉÉÉ.HH.NN. formában. (pl. "1999.12.31.")',
  14169. email: 'Valós e-mail cím megadása szükséges (pl. "fred@domain.hu").',
  14170. url: 'Valós URL megadása szükséges (pl. http://www.example.com).',
  14171. currencyDollar: 'Valós pénzösszeg megadása szükséges (pl. 100.00 Ft.).',
  14172. oneRequired: 'Az alábbi mezők legalább egyikének kitöltése kötelező.',
  14173. errorPrefix: 'Hiba: ',
  14174. warningPrefix: 'Figyelem: ',
  14175. // Form.Validator.Extras
  14176. noSpace: 'A mező nem tartalmazhat szóközöket.',
  14177. reqChkByNode: 'Nincs egyetlen kijelölt elem sem.',
  14178. requiredChk: 'A mező kitöltése kötelező.',
  14179. reqChkByName: 'Egy {label} kiválasztása szükséges.',
  14180. match: 'A mezőnek egyeznie kell a(z) {matchName} mezővel.',
  14181. startDate: 'a kezdet dátuma',
  14182. endDate: 'a vég dátuma',
  14183. currentDate: 'jelenlegi dátum',
  14184. afterDate: 'A dátum nem lehet kisebb, mint {label}.',
  14185. beforeDate: 'A dátum nem lehet nagyobb, mint {label}.',
  14186. startMonth: 'Kezdeti hónap megadása szükséges.',
  14187. sameMonth: 'A két dátumnak ugyanazon hónapban kell lennie.',
  14188. creditcard: 'A megadott bankkártyaszám nem valódi (megadva {length} számjegy).'
  14189. });
  14190. /*
  14191. ---
  14192. name: Locale.it-IT.Date
  14193. description: Date messages for Italian.
  14194. license: MIT-style license.
  14195. authors:
  14196. - Andrea Novero
  14197. - Valerio Proietti
  14198. requires:
  14199. - Locale
  14200. provides: [Locale.it-IT.Date]
  14201. ...
  14202. */
  14203. Locale.define('it-IT', 'Date', {
  14204. months: ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'],
  14205. months_abbr: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
  14206. days: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
  14207. days_abbr: ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'],
  14208. // Culture's date order: DD/MM/YYYY
  14209. dateOrder: ['date', 'month', 'year'],
  14210. shortDate: '%d/%m/%Y',
  14211. shortTime: '%H.%M',
  14212. AM: 'AM',
  14213. PM: 'PM',
  14214. firstDayOfWeek: 1,
  14215. // Date.Extras
  14216. ordinal: 'º',
  14217. lessThanMinuteAgo: 'meno di un minuto fa',
  14218. minuteAgo: 'circa un minuto fa',
  14219. minutesAgo: 'circa {delta} minuti fa',
  14220. hourAgo: "circa un'ora fa",
  14221. hoursAgo: 'circa {delta} ore fa',
  14222. dayAgo: 'circa 1 giorno fa',
  14223. daysAgo: 'circa {delta} giorni fa',
  14224. weekAgo: 'una settimana fa',
  14225. weeksAgo: '{delta} settimane fa',
  14226. monthAgo: 'un mese fa',
  14227. monthsAgo: '{delta} mesi fa',
  14228. yearAgo: 'un anno fa',
  14229. yearsAgo: '{delta} anni fa',
  14230. lessThanMinuteUntil: 'tra meno di un minuto',
  14231. minuteUntil: 'tra circa un minuto',
  14232. minutesUntil: 'tra circa {delta} minuti',
  14233. hourUntil: "tra circa un'ora",
  14234. hoursUntil: 'tra circa {delta} ore',
  14235. dayUntil: 'tra circa un giorno',
  14236. daysUntil: 'tra circa {delta} giorni',
  14237. weekUntil: 'tra una settimana',
  14238. weeksUntil: 'tra {delta} settimane',
  14239. monthUntil: 'tra un mese',
  14240. monthsUntil: 'tra {delta} mesi',
  14241. yearUntil: 'tra un anno',
  14242. yearsUntil: 'tra {delta} anni'
  14243. });
  14244. /*
  14245. ---
  14246. name: Locale.it-IT.Form.Validator
  14247. description: Form Validator messages for Italian.
  14248. license: MIT-style license
  14249. authors:
  14250. - Leonardo Laureti
  14251. - Andrea Novero
  14252. requires:
  14253. - Locale
  14254. provides: [Locale.it-IT.Form.Validator]
  14255. ...
  14256. */
  14257. /*eslint mootools-whitespace:0*/
  14258. Locale.define('it-IT', 'FormValidator', {
  14259. required: 'Il campo &egrave; obbligatorio.',
  14260. minLength: 'Inserire almeno {minLength} caratteri (ne sono stati inseriti {length}).',
  14261. maxLength: 'Inserire al massimo {maxLength} caratteri (ne sono stati inseriti {length}).',
  14262. integer: 'Inserire un numero intero. Non sono consentiti decimali (es.: 1.25).',
  14263. numeric: 'Inserire solo valori numerici (es.: "1" oppure "1.1" oppure "-1" oppure "-1.1").',
  14264. digits: 'Inserire solo numeri e caratteri di punteggiatura. Per esempio &egrave; consentito un numero telefonico con trattini o punti.',
  14265. alpha: 'Inserire solo lettere (a-z). Non sono consentiti spazi o altri caratteri.',
  14266. alphanum: 'Inserire solo lettere (a-z) o numeri (0-9). Non sono consentiti spazi o altri caratteri.',
  14267. dateSuchAs: 'Inserire una data valida del tipo {date}',
  14268. dateInFormatMDY: 'Inserire una data valida nel formato MM/GG/AAAA (es.: "12/31/1999")',
  14269. email: 'Inserire un indirizzo email valido. Per esempio "nome@dominio.com".',
  14270. url: 'Inserire un indirizzo valido. Per esempio "http://www.example.com".',
  14271. currencyDollar: 'Inserire un importo valido. Per esempio "$100.00".',
  14272. oneRequired: 'Completare almeno uno dei campi richiesti.',
  14273. errorPrefix: 'Errore: ',
  14274. warningPrefix: 'Attenzione: ',
  14275. // Form.Validator.Extras
  14276. noSpace: 'Non sono consentiti spazi.',
  14277. reqChkByNode: 'Nessuna voce selezionata.',
  14278. requiredChk: 'Il campo &egrave; obbligatorio.',
  14279. reqChkByName: 'Selezionare un(a) {label}.',
  14280. match: 'Il valore deve corrispondere al campo {matchName}',
  14281. startDate: "data d'inizio",
  14282. endDate: 'data di fine',
  14283. currentDate: 'data attuale',
  14284. afterDate: 'La data deve corrispondere o essere successiva al {label}.',
  14285. beforeDate: 'La data deve corrispondere o essere precedente al {label}.',
  14286. startMonth: "Selezionare un mese d'inizio",
  14287. sameMonth: 'Le due date devono essere dello stesso mese - occorre modificarne una.'
  14288. });
  14289. /*
  14290. ---
  14291. name: Locale.ja-JP.Date
  14292. description: Date messages for Japanese.
  14293. license: MIT-style license
  14294. authors:
  14295. - Noritaka Horio
  14296. requires:
  14297. - Locale
  14298. provides: [Locale.ja-JP.Date]
  14299. ...
  14300. */
  14301. Locale.define('ja-JP', 'Date', {
  14302. months: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  14303. months_abbr: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  14304. days: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
  14305. days_abbr: ['日', '月', '火', '水', '木', '金', '土'],
  14306. // Culture's date order: YYYY/MM/DD
  14307. dateOrder: ['year', 'month', 'date'],
  14308. shortDate: '%Y/%m/%d',
  14309. shortTime: '%H:%M',
  14310. AM: '午前',
  14311. PM: '午後',
  14312. firstDayOfWeek: 0,
  14313. // Date.Extras
  14314. ordinal: '',
  14315. lessThanMinuteAgo: '1分以内前',
  14316. minuteAgo: '約1分前',
  14317. minutesAgo: '約{delta}分前',
  14318. hourAgo: '約1時間前',
  14319. hoursAgo: '約{delta}時間前',
  14320. dayAgo: '1日前',
  14321. daysAgo: '{delta}日前',
  14322. weekAgo: '1週間前',
  14323. weeksAgo: '{delta}週間前',
  14324. monthAgo: '1ヶ月前',
  14325. monthsAgo: '{delta}ヶ月前',
  14326. yearAgo: '1年前',
  14327. yearsAgo: '{delta}年前',
  14328. lessThanMinuteUntil: '今から約1分以内',
  14329. minuteUntil: '今から約1分',
  14330. minutesUntil: '今から約{delta}分',
  14331. hourUntil: '今から約1時間',
  14332. hoursUntil: '今から約{delta}時間',
  14333. dayUntil: '今から1日間',
  14334. daysUntil: '今から{delta}日間',
  14335. weekUntil: '今から1週間',
  14336. weeksUntil: '今から{delta}週間',
  14337. monthUntil: '今から1ヶ月',
  14338. monthsUntil: '今から{delta}ヶ月',
  14339. yearUntil: '今から1年',
  14340. yearsUntil: '今から{delta}年'
  14341. });
  14342. /*
  14343. ---
  14344. name: Locale.ja-JP.Form.Validator
  14345. description: Form Validator messages for Japanese.
  14346. license: MIT-style license
  14347. authors:
  14348. - Noritaka Horio
  14349. requires:
  14350. - Locale
  14351. provides: [Locale.ja-JP.Form.Validator]
  14352. ...
  14353. */
  14354. Locale.define('ja-JP', 'FormValidator', {
  14355. required: '入力は必須です。',
  14356. minLength: '入力文字数は{minLength}以上にしてください。({length}文字)',
  14357. maxLength: '入力文字数は{maxLength}以下にしてください。({length}文字)',
  14358. integer: '整数を入力してください。',
  14359. numeric: '入力できるのは数値だけです。(例: "1", "1.1", "-1", "-1.1"....)',
  14360. digits: '入力できるのは数値と句読記号です。 (例: -や+を含む電話番号など).',
  14361. alpha: '入力できるのは半角英字だけです。それ以外の文字は入力できません。',
  14362. alphanum: '入力できるのは半角英数字だけです。それ以外の文字は入力できません。',
  14363. dateSuchAs: '有効な日付を入力してください。{date}',
  14364. dateInFormatMDY: '日付の書式に誤りがあります。YYYY/MM/DD (i.e. "1999/12/31")',
  14365. email: 'メールアドレスに誤りがあります。',
  14366. url: 'URLアドレスに誤りがあります。',
  14367. currencyDollar: '金額に誤りがあります。',
  14368. oneRequired: 'ひとつ以上入力してください。',
  14369. errorPrefix: 'エラー: ',
  14370. warningPrefix: '警告: ',
  14371. // FormValidator.Extras
  14372. noSpace: 'スペースは入力できません。',
  14373. reqChkByNode: '選択されていません。',
  14374. requiredChk: 'この項目は必須です。',
  14375. reqChkByName: '{label}を選択してください。',
  14376. match: '{matchName}が入力されている場合必須です。',
  14377. startDate: '開始日',
  14378. endDate: '終了日',
  14379. currentDate: '今日',
  14380. afterDate: '{label}以降の日付にしてください。',
  14381. beforeDate: '{label}以前の日付にしてください。',
  14382. startMonth: '開始月を選択してください。',
  14383. sameMonth: '日付が同一です。どちらかを変更してください。'
  14384. });
  14385. /*
  14386. ---
  14387. name: Locale.ja-JP.Number
  14388. description: Number messages for Japanese.
  14389. license: MIT-style license
  14390. authors:
  14391. - Noritaka Horio
  14392. requires:
  14393. - Locale
  14394. provides: [Locale.ja-JP.Number]
  14395. ...
  14396. */
  14397. Locale.define('ja-JP', 'Number', {
  14398. decimal: '.',
  14399. group: ',',
  14400. currency: {
  14401. decimals: 0,
  14402. prefix: '\\'
  14403. }
  14404. });
  14405. /*
  14406. ---
  14407. name: Locale.nl-NL.Date
  14408. description: Date messages for Dutch.
  14409. license: MIT-style license
  14410. authors:
  14411. - Lennart Pilon
  14412. - Tim Wienk
  14413. requires:
  14414. - Locale
  14415. provides: [Locale.nl-NL.Date]
  14416. ...
  14417. */
  14418. Locale.define('nl-NL', 'Date', {
  14419. months: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
  14420. months_abbr: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
  14421. days: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
  14422. days_abbr: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
  14423. // Culture's date order: DD-MM-YYYY
  14424. dateOrder: ['date', 'month', 'year'],
  14425. shortDate: '%d-%m-%Y',
  14426. shortTime: '%H:%M',
  14427. AM: 'AM',
  14428. PM: 'PM',
  14429. firstDayOfWeek: 1,
  14430. // Date.Extras
  14431. ordinal: 'e',
  14432. lessThanMinuteAgo: 'minder dan een minuut geleden',
  14433. minuteAgo: 'ongeveer een minuut geleden',
  14434. minutesAgo: '{delta} minuten geleden',
  14435. hourAgo: 'ongeveer een uur geleden',
  14436. hoursAgo: 'ongeveer {delta} uur geleden',
  14437. dayAgo: 'een dag geleden',
  14438. daysAgo: '{delta} dagen geleden',
  14439. weekAgo: 'een week geleden',
  14440. weeksAgo: '{delta} weken geleden',
  14441. monthAgo: 'een maand geleden',
  14442. monthsAgo: '{delta} maanden geleden',
  14443. yearAgo: 'een jaar geleden',
  14444. yearsAgo: '{delta} jaar geleden',
  14445. lessThanMinuteUntil: 'over minder dan een minuut',
  14446. minuteUntil: 'over ongeveer een minuut',
  14447. minutesUntil: 'over {delta} minuten',
  14448. hourUntil: 'over ongeveer een uur',
  14449. hoursUntil: 'over {delta} uur',
  14450. dayUntil: 'over ongeveer een dag',
  14451. daysUntil: 'over {delta} dagen',
  14452. weekUntil: 'over een week',
  14453. weeksUntil: 'over {delta} weken',
  14454. monthUntil: 'over een maand',
  14455. monthsUntil: 'over {delta} maanden',
  14456. yearUntil: 'over een jaar',
  14457. yearsUntil: 'over {delta} jaar'
  14458. });
  14459. /*
  14460. ---
  14461. name: Locale.nl-NL.Form.Validator
  14462. description: Form Validator messages for Dutch.
  14463. license: MIT-style license
  14464. authors:
  14465. - Lennart Pilon
  14466. - Arian Stolwijk
  14467. - Tim Wienk
  14468. requires:
  14469. - Locale
  14470. provides: [Locale.nl-NL.Form.Validator]
  14471. ...
  14472. */
  14473. Locale.define('nl-NL', 'FormValidator', {
  14474. required: 'Dit veld is verplicht.',
  14475. length: 'Vul precies {length} karakters in (je hebt {elLength} karakters ingevoerd).',
  14476. minLength: 'Vul minimaal {minLength} karakters in (je hebt {length} karakters ingevoerd).',
  14477. maxLength: 'Vul niet meer dan {maxLength} karakters in (je hebt {length} karakters ingevoerd).',
  14478. integer: 'Vul een getal in. Getallen met decimalen (bijvoorbeeld 1.25) zijn niet toegestaan.',
  14479. numeric: 'Vul alleen numerieke waarden in (bijvoorbeeld "1" of "1.1" of "-1" of "-1.1").',
  14480. digits: 'Vul alleen nummers en leestekens in (bijvoorbeeld een telefoonnummer met streepjes is toegestaan).',
  14481. alpha: 'Vul alleen letters in (a-z). Spaties en andere karakters zijn niet toegestaan.',
  14482. alphanum: 'Vul alleen letters (a-z) of nummers (0-9) in. Spaties en andere karakters zijn niet toegestaan.',
  14483. dateSuchAs: 'Vul een geldige datum in, zoals {date}',
  14484. dateInFormatMDY: 'Vul een geldige datum, in het formaat MM/DD/YYYY (bijvoorbeeld "12/31/1999")',
  14485. email: 'Vul een geldig e-mailadres in. Bijvoorbeeld "fred@domein.nl".',
  14486. url: 'Vul een geldige URL in, zoals http://www.example.com.',
  14487. currencyDollar: 'Vul een geldig $ bedrag in. Bijvoorbeeld $100.00 .',
  14488. oneRequired: 'Vul iets in bij in ieder geval een van deze velden.',
  14489. warningPrefix: 'Waarschuwing: ',
  14490. errorPrefix: 'Fout: ',
  14491. // Form.Validator.Extras
  14492. noSpace: 'Spaties zijn niet toegestaan in dit veld.',
  14493. reqChkByNode: 'Er zijn geen items geselecteerd.',
  14494. requiredChk: 'Dit veld is verplicht.',
  14495. reqChkByName: 'Selecteer een {label}.',
  14496. match: 'Dit veld moet overeen komen met het {matchName} veld',
  14497. startDate: 'de begin datum',
  14498. endDate: 'de eind datum',
  14499. currentDate: 'de huidige datum',
  14500. afterDate: 'De datum moet hetzelfde of na {label} zijn.',
  14501. beforeDate: 'De datum moet hetzelfde of voor {label} zijn.',
  14502. startMonth: 'Selecteer een begin maand',
  14503. sameMonth: 'Deze twee data moeten in dezelfde maand zijn - u moet een van beide aanpassen.',
  14504. creditcard: 'Het ingevulde creditcardnummer is niet geldig. Controleer het nummer en probeer opnieuw. {length} getallen ingevuld.'
  14505. });
  14506. /*
  14507. ---
  14508. name: Locale.nl-NL.Number
  14509. description: Number messages for Dutch.
  14510. license: MIT-style license
  14511. authors:
  14512. - Arian Stolwijk
  14513. requires:
  14514. - Locale
  14515. - Locale.EU.Number
  14516. provides: [Locale.nl-NL.Number]
  14517. ...
  14518. */
  14519. Locale.define('nl-NL').inherit('EU', 'Number');
  14520. /*
  14521. ---
  14522. name: Locale.no-NO.Date
  14523. description: Date messages for Norwegian.
  14524. license: MIT-style license
  14525. authors:
  14526. - Espen 'Rexxars' Hovlandsdal
  14527. - Ole Tøsse Kolvik
  14528. requires:
  14529. - Locale
  14530. provides: [Locale.no-NO.Date]
  14531. ...
  14532. */
  14533. Locale.define('no-NO', 'Date', {
  14534. months: ['Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'],
  14535. months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
  14536. days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
  14537. days_abbr: ['Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'],
  14538. // Culture's date order: DD.MM.YYYY
  14539. dateOrder: ['date', 'month', 'year'],
  14540. shortDate: '%d.%m.%Y',
  14541. shortTime: '%H:%M',
  14542. AM: 'AM',
  14543. PM: 'PM',
  14544. firstDayOfWeek: 1,
  14545. lessThanMinuteAgo: 'mindre enn et minutt siden',
  14546. minuteAgo: 'omtrent et minutt siden',
  14547. minutesAgo: '{delta} minutter siden',
  14548. hourAgo: 'omtrent en time siden',
  14549. hoursAgo: 'omtrent {delta} timer siden',
  14550. dayAgo: '{delta} dag siden',
  14551. daysAgo: '{delta} dager siden',
  14552. weekAgo: 'en uke siden',
  14553. weeksAgo: '{delta} uker siden',
  14554. monthAgo: 'en måned siden',
  14555. monthsAgo: '{delta} måneder siden',
  14556. yearAgo: 'ett år siden',
  14557. yearsAgo: '{delta} år siden',
  14558. lessThanMinuteUntil: 'mindre enn et minutt til',
  14559. minuteUntil: 'omtrent et minutt til',
  14560. minutesUntil: '{delta} minutter til',
  14561. hourUntil: 'omtrent en time til',
  14562. hoursUntil: 'omtrent {delta} timer til',
  14563. dayUntil: 'en dag til',
  14564. daysUntil: '{delta} dager til',
  14565. weekUntil: 'en uke til',
  14566. weeksUntil: '{delta} uker til',
  14567. monthUntil: 'en måned til',
  14568. monthsUntil: '{delta} måneder til',
  14569. yearUntil: 'et år til',
  14570. yearsUntil: '{delta} år til'
  14571. });
  14572. /*
  14573. ---
  14574. name: Locale.no-NO.Form.Validator
  14575. description: Form Validator messages for Norwegian.
  14576. license: MIT-style license
  14577. authors:
  14578. - Aaron Newton
  14579. - Espen 'Rexxars' Hovlandsdal
  14580. - Ole Tøsse Kolvik
  14581. requires:
  14582. - Locale
  14583. provides: [Locale.no-NO.Form.Validator]
  14584. ...
  14585. */
  14586. Locale.define('no-NO', 'FormValidator', {
  14587. required: 'Dette feltet er påkrevd.',
  14588. length: 'Skriv inn {length} tegn (du skrev {elLength} tegn)',
  14589. minLength: 'Skriv inn minst {minLength} tegn (du skrev {length} tegn).',
  14590. maxLength: 'Ikke skriv mer enn {maxLength} tegn (du skrev {length} tegn).',
  14591. integer: 'Skriv inn et tall i dette feltet. Tall med desimaler (f.eks. 1,25) er ikke tillat.',
  14592. numeric: 'Skriv kun inn numeriske verdier i dette feltet (f.eks. "1", "1.1", "-1" eller "-1.1").',
  14593. digits: 'Skriv kun nummer og skilletegn i dette feltet.',
  14594. alpha: 'Skriv kun bokstaver (a-å) i dette feltet. Ingen mellomrom eller andre tegn er tillat.',
  14595. alphanum: 'Skriv kun bokstaver (a-å) eller nummer (0-9) i dette feltet. Ingen mellomrom eller andre tegn er tillat.',
  14596. dateSuchAs: 'Skriv inn en gyldig dato, som f.eks. {date}',
  14597. dateInFormatMDY: 'Skriv inn en gyldig dato, f.eks. DD/MM/YYYY ("31/12/1999")',
  14598. email: 'Skriv inn en gyldig epost-adresse. F.eks. "ola.nordmann@example.com".',
  14599. url: 'Skriv inn en gyldig URL, f.eks. http://www.example.com.',
  14600. currencyDollar: 'Skriv inn et gyldig beløp. F.eks. 100,00.',
  14601. oneRequired: 'Minst ett av disse feltene må fylles ut.',
  14602. errorPrefix: 'Feil: ',
  14603. warningPrefix: 'Advarsel: ',
  14604. // Form.Validator.Extras
  14605. noSpace: 'Mellomrom er ikke tillatt i dette feltet.',
  14606. reqChkByNode: 'Ingen objekter er valgt.',
  14607. requiredChk: 'Dette feltet er påkrevd.',
  14608. reqChkByName: 'Velg en {label}.',
  14609. match: 'Dette feltet må være lik {matchName}',
  14610. startDate: 'startdato',
  14611. endDate: 'sluttdato',
  14612. currentDate: 'dagens dato',
  14613. afterDate: 'Datoen må være den samme som eller etter {label}.',
  14614. beforeDate: 'Datoen må være den samme som eller før {label}.',
  14615. startMonth: 'Velg en startmåned',
  14616. sameMonth: 'Datoene må være i den samme måneden - velg den ene eller den andre.',
  14617. creditcard: 'Kortnummeret du skrev inn er ikke gyldig. Prøv igjen. Du skrev {length} siffer.'
  14618. });
  14619. /*
  14620. ---
  14621. name: Locale.no-NO.Number
  14622. description: Number messages for Norwegian.
  14623. license: MIT-style license
  14624. authors:
  14625. - Arian Stolwijk
  14626. - Martin Lundgren
  14627. - Ole T�sse Kolvik
  14628. requires:
  14629. - Locale
  14630. - Locale.EU.Number
  14631. provides: [Locale.no-NO.Number]
  14632. ...
  14633. */
  14634. Locale.define('no-NO', 'Number', {
  14635. currency: {
  14636. prefix: 'NOK '
  14637. }
  14638. }).inherit('EU', 'Number');
  14639. /*
  14640. ---
  14641. name: Locale.pl-PL.Date
  14642. description: Date messages for Polish.
  14643. license: MIT-style license
  14644. authors:
  14645. - Oskar Krawczyk
  14646. requires:
  14647. - Locale
  14648. provides: [Locale.pl-PL.Date]
  14649. ...
  14650. */
  14651. Locale.define('pl-PL', 'Date', {
  14652. months: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'],
  14653. months_abbr: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
  14654. days: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],
  14655. days_abbr: ['niedz.', 'pon.', 'wt.', 'śr.', 'czw.', 'pt.', 'sob.'],
  14656. // Culture's date order: YYYY-MM-DD
  14657. dateOrder: ['year', 'month', 'date'],
  14658. shortDate: '%Y-%m-%d',
  14659. shortTime: '%H:%M',
  14660. AM: 'nad ranem',
  14661. PM: 'po południu',
  14662. firstDayOfWeek: 1,
  14663. // Date.Extras
  14664. ordinal: function(dayOfMonth){
  14665. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ty' : ['ty', 'szy', 'gi', 'ci', 'ty'][Math.min(dayOfMonth % 10, 4)];
  14666. },
  14667. lessThanMinuteAgo: 'mniej niż minute temu',
  14668. minuteAgo: 'około minutę temu',
  14669. minutesAgo: '{delta} minut temu',
  14670. hourAgo: 'około godzinę temu',
  14671. hoursAgo: 'około {delta} godzin temu',
  14672. dayAgo: 'Wczoraj',
  14673. daysAgo: '{delta} dni temu',
  14674. lessThanMinuteUntil: 'za niecałą minutę',
  14675. minuteUntil: 'za około minutę',
  14676. minutesUntil: 'za {delta} minut',
  14677. hourUntil: 'za około godzinę',
  14678. hoursUntil: 'za około {delta} godzin',
  14679. dayUntil: 'za 1 dzień',
  14680. daysUntil: 'za {delta} dni'
  14681. });
  14682. /*
  14683. ---
  14684. name: Locale.pl-PL.Form.Validator
  14685. description: Form Validator messages for Polish.
  14686. license: MIT-style license
  14687. authors:
  14688. - Oskar Krawczyk
  14689. requires:
  14690. - Locale
  14691. provides: [Locale.pl-PL.Form.Validator]
  14692. ...
  14693. */
  14694. Locale.define('pl-PL', 'FormValidator', {
  14695. required: 'To pole jest wymagane.',
  14696. minLength: 'Wymagane jest przynajmniej {minLength} znaków (wpisanych zostało tylko {length}).',
  14697. maxLength: 'Dozwolone jest nie więcej niż {maxLength} znaków (wpisanych zostało {length})',
  14698. integer: 'To pole wymaga liczb całych. Liczby dziesiętne (np. 1.25) są niedozwolone.',
  14699. numeric: 'Prosimy używać tylko numerycznych wartości w tym polu (np. "1", "1.1", "-1" lub "-1.1").',
  14700. digits: 'Prosimy używać liczb oraz zankow punktuacyjnych w typ polu (dla przykładu, przy numerze telefonu myślniki i kropki są dozwolone).',
  14701. alpha: 'Prosimy używać tylko liter (a-z) w tym polu. Spacje oraz inne znaki są niedozwolone.',
  14702. alphanum: 'Prosimy używać tylko liter (a-z) lub liczb (0-9) w tym polu. Spacje oraz inne znaki są niedozwolone.',
  14703. dateSuchAs: 'Prosimy podać prawidłową datę w formacie: {date}',
  14704. dateInFormatMDY: 'Prosimy podać poprawną date w formacie DD.MM.RRRR (i.e. "12.01.2009")',
  14705. email: 'Prosimy podać prawidłowy adres e-mail, np. "jan@domena.pl".',
  14706. url: 'Prosimy podać prawidłowy adres URL, np. http://www.example.com.',
  14707. currencyDollar: 'Prosimy podać prawidłową sumę w PLN. Dla przykładu: 100.00 PLN.',
  14708. oneRequired: 'Prosimy wypełnić chociaż jedno z pól.',
  14709. errorPrefix: 'Błąd: ',
  14710. warningPrefix: 'Uwaga: ',
  14711. // Form.Validator.Extras
  14712. noSpace: 'W tym polu nie mogą znajdować się spacje.',
  14713. reqChkByNode: 'Brak zaznaczonych elementów.',
  14714. requiredChk: 'To pole jest wymagane.',
  14715. reqChkByName: 'Prosimy wybrać z {label}.',
  14716. match: 'To pole musi być takie samo jak {matchName}',
  14717. startDate: 'data początkowa',
  14718. endDate: 'data końcowa',
  14719. currentDate: 'aktualna data',
  14720. afterDate: 'Podana data poinna być taka sama lub po {label}.',
  14721. beforeDate: 'Podana data poinna być taka sama lub przed {label}.',
  14722. startMonth: 'Prosimy wybrać początkowy miesiąc.',
  14723. sameMonth: 'Te dwie daty muszą być w zakresie tego samego miesiąca - wymagana jest zmiana któregoś z pól.'
  14724. });
  14725. /*
  14726. ---
  14727. name: Locale.pt-PT.Date
  14728. description: Date messages for Portuguese.
  14729. license: MIT-style license
  14730. authors:
  14731. - Fabio Miranda Costa
  14732. requires:
  14733. - Locale
  14734. provides: [Locale.pt-PT.Date]
  14735. ...
  14736. */
  14737. Locale.define('pt-PT', 'Date', {
  14738. months: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
  14739. months_abbr: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
  14740. days: ['Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'],
  14741. days_abbr: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
  14742. // Culture's date order: DD-MM-YYYY
  14743. dateOrder: ['date', 'month', 'year'],
  14744. shortDate: '%d-%m-%Y',
  14745. shortTime: '%H:%M',
  14746. AM: 'AM',
  14747. PM: 'PM',
  14748. firstDayOfWeek: 1,
  14749. // Date.Extras
  14750. ordinal: 'º',
  14751. lessThanMinuteAgo: 'há menos de um minuto',
  14752. minuteAgo: 'há cerca de um minuto',
  14753. minutesAgo: 'há {delta} minutos',
  14754. hourAgo: 'há cerca de uma hora',
  14755. hoursAgo: 'há cerca de {delta} horas',
  14756. dayAgo: 'há um dia',
  14757. daysAgo: 'há {delta} dias',
  14758. weekAgo: 'há uma semana',
  14759. weeksAgo: 'há {delta} semanas',
  14760. monthAgo: 'há um mês',
  14761. monthsAgo: 'há {delta} meses',
  14762. yearAgo: 'há um ano',
  14763. yearsAgo: 'há {delta} anos',
  14764. lessThanMinuteUntil: 'em menos de um minuto',
  14765. minuteUntil: 'em um minuto',
  14766. minutesUntil: 'em {delta} minutos',
  14767. hourUntil: 'em uma hora',
  14768. hoursUntil: 'em {delta} horas',
  14769. dayUntil: 'em um dia',
  14770. daysUntil: 'em {delta} dias',
  14771. weekUntil: 'em uma semana',
  14772. weeksUntil: 'em {delta} semanas',
  14773. monthUntil: 'em um mês',
  14774. monthsUntil: 'em {delta} meses',
  14775. yearUntil: 'em um ano',
  14776. yearsUntil: 'em {delta} anos'
  14777. });
  14778. /*
  14779. ---
  14780. name: Locale.pt-BR.Date
  14781. description: Date messages for Portuguese (Brazil).
  14782. license: MIT-style license
  14783. authors:
  14784. - Fabio Miranda Costa
  14785. requires:
  14786. - Locale
  14787. - Locale.pt-PT.Date
  14788. provides: [Locale.pt-BR.Date]
  14789. ...
  14790. */
  14791. Locale.define('pt-BR', 'Date', {
  14792. // Culture's date order: DD/MM/YYYY
  14793. shortDate: '%d/%m/%Y'
  14794. }).inherit('pt-PT', 'Date');
  14795. /*
  14796. ---
  14797. name: Locale.pt-BR.Form.Validator
  14798. description: Form Validator messages for Portuguese (Brazil).
  14799. license: MIT-style license
  14800. authors:
  14801. - Fábio Miranda Costa
  14802. requires:
  14803. - Locale
  14804. provides: [Locale.pt-BR.Form.Validator]
  14805. ...
  14806. */
  14807. Locale.define('pt-BR', 'FormValidator', {
  14808. required: 'Este campo é obrigatório.',
  14809. minLength: 'Digite pelo menos {minLength} caracteres (tamanho atual: {length}).',
  14810. maxLength: 'Não digite mais de {maxLength} caracteres (tamanho atual: {length}).',
  14811. integer: 'Por favor digite apenas um número inteiro neste campo. Não são permitidos números decimais (por exemplo, 1,25).',
  14812. numeric: 'Por favor digite apenas valores numéricos neste campo (por exemplo, "1" ou "1.1" ou "-1" ou "-1,1").',
  14813. 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).',
  14814. alpha: 'Por favor use somente letras (a-z). Espaço e outros caracteres não são permitidos.',
  14815. alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Espaço e outros caracteres não são permitidos.',
  14816. dateSuchAs: 'Digite uma data válida, como {date}',
  14817. dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (por exemplo, "31/12/1999")',
  14818. email: 'Digite um endereço de email válido. Por exemplo "nome@dominio.com".',
  14819. url: 'Digite uma URL válida. Exemplo: http://www.example.com.',
  14820. currencyDollar: 'Digite um valor em dinheiro válido. Exemplo: R$100,00 .',
  14821. oneRequired: 'Digite algo para pelo menos um desses campos.',
  14822. errorPrefix: 'Erro: ',
  14823. warningPrefix: 'Aviso: ',
  14824. // Form.Validator.Extras
  14825. noSpace: 'Não é possível digitar espaços neste campo.',
  14826. reqChkByNode: 'Não foi selecionado nenhum item.',
  14827. requiredChk: 'Este campo é obrigatório.',
  14828. reqChkByName: 'Por favor digite um {label}.',
  14829. match: 'Este campo deve ser igual ao campo {matchName}.',
  14830. startDate: 'a data inicial',
  14831. endDate: 'a data final',
  14832. currentDate: 'a data atual',
  14833. afterDate: 'A data deve ser igual ou posterior a {label}.',
  14834. beforeDate: 'A data deve ser igual ou anterior a {label}.',
  14835. startMonth: 'Por favor selecione uma data inicial.',
  14836. sameMonth: 'Estas duas datas devem ter o mesmo mês - você deve modificar uma das duas.',
  14837. 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.'
  14838. });
  14839. /*
  14840. ---
  14841. name: Locale.pt-BR.Number
  14842. description: Number messages for PT Brazilian.
  14843. license: MIT-style license
  14844. authors:
  14845. - Arian Stolwijk
  14846. - Danillo César
  14847. requires:
  14848. - Locale
  14849. provides: [Locale.pt-BR.Number]
  14850. ...
  14851. */
  14852. Locale.define('pt-BR', 'Number', {
  14853. decimal: ',',
  14854. group: '.',
  14855. currency: {
  14856. prefix: 'R$ '
  14857. }
  14858. });
  14859. /*
  14860. ---
  14861. name: Locale.pt-PT.Form.Validator
  14862. description: Form Validator messages for Portuguese.
  14863. license: MIT-style license
  14864. authors:
  14865. - Miquel Hudin
  14866. requires:
  14867. - Locale
  14868. provides: [Locale.pt-PT.Form.Validator]
  14869. ...
  14870. */
  14871. Locale.define('pt-PT', 'FormValidator', {
  14872. required: 'Este campo é necessário.',
  14873. minLength: 'Digite pelo menos{minLength} caracteres (comprimento {length} caracteres).',
  14874. maxLength: 'Não insira mais de {maxLength} caracteres (comprimento {length} caracteres).',
  14875. integer: 'Digite um número inteiro neste domínio. Com números decimais (por exemplo, 1,25), não são permitidas.',
  14876. numeric: 'Digite apenas valores numéricos neste domínio (p.ex., "1" ou "1.1" ou "-1" ou "-1,1").',
  14877. 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).',
  14878. alpha: 'Por favor use somente letras (a-z), com nesta área. Não utilize espaços nem outros caracteres são permitidos.',
  14879. alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Não utilize espaços nem outros caracteres são permitidos.',
  14880. dateSuchAs: 'Digite uma data válida, como {date}',
  14881. dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (p.ex. "31/12/1999")',
  14882. email: 'Digite um endereço de email válido. Por exemplo "fred@domain.com".',
  14883. url: 'Digite uma URL válida, como http://www.example.com.',
  14884. currencyDollar: 'Digite um valor válido $. Por exemplo $ 100,00. ',
  14885. oneRequired: 'Digite algo para pelo menos um desses insumos.',
  14886. errorPrefix: 'Erro: ',
  14887. warningPrefix: 'Aviso: '
  14888. });
  14889. /*
  14890. ---
  14891. name: Locale.ru-RU-unicode.Date
  14892. description: Date messages for Russian (utf-8).
  14893. license: MIT-style license
  14894. authors:
  14895. - Evstigneev Pavel
  14896. - Kuryanovich Egor
  14897. requires:
  14898. - Locale
  14899. provides: [Locale.ru-RU.Date]
  14900. ...
  14901. */
  14902. (function(){
  14903. // Russian language pluralization rules, taken from CLDR project, http://unicode.org/cldr/
  14904. // one -> n mod 10 is 1 and n mod 100 is not 11;
  14905. // few -> n mod 10 in 2..4 and n mod 100 not in 12..14;
  14906. // many -> n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14;
  14907. // other -> everything else (example 3.14)
  14908. var pluralize = function(n, one, few, many, other){
  14909. var modulo10 = n % 10,
  14910. modulo100 = n % 100;
  14911. if (modulo10 == 1 && modulo100 != 11){
  14912. return one;
  14913. } else if ((modulo10 == 2 || modulo10 == 3 || modulo10 == 4) && !(modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){
  14914. return few;
  14915. } else if (modulo10 == 0 || (modulo10 == 5 || modulo10 == 6 || modulo10 == 7 || modulo10 == 8 || modulo10 == 9) || (modulo100 == 11 || modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){
  14916. return many;
  14917. } else {
  14918. return other;
  14919. }
  14920. };
  14921. Locale.define('ru-RU', 'Date', {
  14922. months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],
  14923. months_abbr: ['янв', 'февр', 'март', 'апр', 'май','июнь','июль','авг','сент','окт','нояб','дек'],
  14924. days: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
  14925. days_abbr: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
  14926. // Culture's date order: DD.MM.YYYY
  14927. dateOrder: ['date', 'month', 'year'],
  14928. shortDate: '%d.%m.%Y',
  14929. shortTime: '%H:%M',
  14930. AM: 'AM',
  14931. PM: 'PM',
  14932. firstDayOfWeek: 1,
  14933. // Date.Extras
  14934. ordinal: '',
  14935. lessThanMinuteAgo: 'меньше минуты назад',
  14936. minuteAgo: 'минуту назад',
  14937. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'минуту', 'минуты', 'минут') + ' назад'; },
  14938. hourAgo: 'час назад',
  14939. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'час', 'часа', 'часов') + ' назад'; },
  14940. dayAgo: 'вчера',
  14941. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'день', 'дня', 'дней') + ' назад'; },
  14942. weekAgo: 'неделю назад',
  14943. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'неделя', 'недели', 'недель') + ' назад'; },
  14944. monthAgo: 'месяц назад',
  14945. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'месяц', 'месяца', 'месяцев') + ' назад'; },
  14946. yearAgo: 'год назад',
  14947. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'год', 'года', 'лет') + ' назад'; },
  14948. lessThanMinuteUntil: 'меньше чем через минуту',
  14949. minuteUntil: 'через минуту',
  14950. minutesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'минуту', 'минуты', 'минут') + ''; },
  14951. hourUntil: 'через час',
  14952. hoursUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'час', 'часа', 'часов') + ''; },
  14953. dayUntil: 'завтра',
  14954. daysUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'день', 'дня', 'дней') + ''; },
  14955. weekUntil: 'через неделю',
  14956. weeksUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'неделю', 'недели', 'недель') + ''; },
  14957. monthUntil: 'через месяц',
  14958. monthsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'месяц', 'месяца', 'месяцев') + ''; },
  14959. yearUntil: 'через',
  14960. yearsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'год', 'года', 'лет') + ''; }
  14961. });
  14962. //<1.2compat>
  14963. Locale.define('ru-RU-unicode').inherit('ru-RU', 'Date');
  14964. //</1.2compat>
  14965. })();
  14966. /*
  14967. ---
  14968. name: Locale.ru-RU-unicode.Form.Validator
  14969. description: Form Validator messages for Russian (utf-8).
  14970. license: MIT-style license
  14971. authors:
  14972. - Chernodarov Egor
  14973. requires:
  14974. - Locale
  14975. provides: [Locale.ru-RU.Form.Validator]
  14976. ...
  14977. */
  14978. Locale.define('ru-RU', 'FormValidator', {
  14979. required: 'Это поле обязательно к заполнению.',
  14980. minLength: 'Пожалуйста, введите хотя бы {minLength} символов (Вы ввели {length}).',
  14981. maxLength: 'Пожалуйста, введите не больше {maxLength} символов (Вы ввели {length}).',
  14982. integer: 'Пожалуйста, введите в это поле число. Дробные числа (например 1.25) тут не разрешены.',
  14983. numeric: 'Пожалуйста, введите в это поле число (например "1" или "1.1", или "-1", или "-1.1").',
  14984. digits: 'В этом поле Вы можете использовать только цифры и знаки пунктуации (например, телефонный номер со знаками дефиса или с точками).',
  14985. alpha: 'В этом поле можно использовать только латинские буквы (a-z). Пробелы и другие символы запрещены.',
  14986. alphanum: 'В этом поле можно использовать только латинские буквы (a-z) и цифры (0-9). Пробелы и другие символы запрещены.',
  14987. dateSuchAs: 'Пожалуйста, введите корректную дату {date}',
  14988. dateInFormatMDY: 'Пожалуйста, введите дату в формате ММ/ДД/ГГГГ (например "12/31/1999")',
  14989. email: 'Пожалуйста, введите корректный емейл-адрес. Для примера "fred@domain.com".',
  14990. url: 'Пожалуйста, введите правильную ссылку вида http://www.example.com.',
  14991. currencyDollar: 'Пожалуйста, введите сумму в долларах. Например: $100.00 .',
  14992. oneRequired: 'Пожалуйста, выберите хоть что-нибудь в одном из этих полей.',
  14993. errorPrefix: 'Ошибка: ',
  14994. warningPrefix: 'Внимание: '
  14995. });
  14996. //<1.2compat>
  14997. Locale.define('ru-RU-unicode').inherit('ru-RU', 'FormValidator');
  14998. //</1.2compat>
  14999. /*
  15000. ---
  15001. name: Locale.sk-SK.Date
  15002. description: Date messages for Slovak.
  15003. license: MIT-style license
  15004. authors:
  15005. - Ivan Masár
  15006. requires:
  15007. - Locale
  15008. provides: [Locale.sk-SK.Date]
  15009. ...
  15010. */
  15011. (function(){
  15012. // Slovak language pluralization rules, see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  15013. // one -> n is 1; 1
  15014. // few -> n in 2..4; 2-4
  15015. // other -> everything else 0, 5-999, 1.31, 2.31, 5.31...
  15016. var pluralize = function(n, one, few, other){
  15017. if (n == 1) return one;
  15018. else if (n == 2 || n == 3 || n == 4) return few;
  15019. else return other;
  15020. };
  15021. Locale.define('sk-SK', 'Date', {
  15022. months: ['Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'December'],
  15023. months_abbr: ['januára', 'februára', 'marca', 'apríla', 'mája', 'júna', 'júla', 'augusta', 'septembra', 'októbra', 'novembra', 'decembra'],
  15024. days: ['Nedele', 'Pondelí', 'Úterý', 'Streda', 'Čtvrtek', 'Pátek', 'Sobota'],
  15025. days_abbr: ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so'],
  15026. // Culture's date order: DD.MM.YYYY
  15027. dateOrder: ['date', 'month', 'year'],
  15028. shortDate: '%d.%m.%Y',
  15029. shortTime: '%H:%M',
  15030. AM: 'dop.',
  15031. PM: 'pop.',
  15032. firstDayOfWeek: 1,
  15033. // Date.Extras
  15034. ordinal: '.',
  15035. lessThanMinuteAgo: 'pred chvíľou',
  15036. minuteAgo: 'približne pred minútou',
  15037. minutesAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'minútou', 'minútami', 'minútami'); },
  15038. hourAgo: 'približne pred hodinou',
  15039. hoursAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'hodinou', 'hodinami', 'hodinami'); },
  15040. dayAgo: 'pred dňom',
  15041. daysAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'dňom', 'dňami', 'dňami'); },
  15042. weekAgo: 'pred týždňom',
  15043. weeksAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'týždňom', 'týždňami', 'týždňami'); },
  15044. monthAgo: 'pred mesiacom',
  15045. monthsAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'mesiacom', 'mesiacmi', 'mesiacmi'); },
  15046. yearAgo: 'pred rokom',
  15047. yearsAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'rokom', 'rokmi', 'rokmi'); },
  15048. lessThanMinuteUntil: 'o chvíľu',
  15049. minuteUntil: 'približne o minútu',
  15050. minutesUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'minútu', 'minúty', 'minúty'); },
  15051. hourUntil: 'približne o hodinu',
  15052. hoursUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'hodinu', 'hodiny', 'hodín'); },
  15053. dayUntil: 'o deň',
  15054. daysUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'deň', 'dni', 'dní'); },
  15055. weekUntil: 'o týždeň',
  15056. weeksUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'týždeň', 'týždne', 'týždňov'); },
  15057. monthUntil: 'o mesiac',
  15058. monthsUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'mesiac', 'mesiace', 'mesiacov'); },
  15059. yearUntil: 'o rok',
  15060. yearsUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'rok', 'roky', 'rokov'); }
  15061. });
  15062. })();
  15063. /*
  15064. ---
  15065. name: Locale.sk-SK.Form.Validator
  15066. description: Form Validator messages for Czech.
  15067. license: MIT-style license
  15068. authors:
  15069. - Ivan Masár
  15070. requires:
  15071. - Locale
  15072. provides: [Locale.sk-SK.Form.Validator]
  15073. ...
  15074. */
  15075. Locale.define('sk-SK', 'FormValidator', {
  15076. required: 'Táto položka je povinná.',
  15077. minLength: 'Zadajte prosím aspoň {minLength} znakov (momentálne {length} znakov).',
  15078. maxLength: 'Zadajte prosím menej ako {maxLength} znakov (momentálne {length} znakov).',
  15079. integer: 'Zadajte prosím celé číslo. Desetinné čísla (napr. 1.25) nie sú povolené.',
  15080. numeric: 'Zadajte len číselné hodnoty (t.j. „1“ alebo „1.1“ alebo „-1“ alebo „-1.1“).',
  15081. digits: 'Zadajte prosím len čísla a interpunkčné znamienka (napríklad telefónne číslo s pomlčkami albo bodkami je povolené).',
  15082. alpha: 'Zadajte prosím len písmená (a-z). Medzery alebo iné znaky nie sú povolené.',
  15083. alphanum: 'Zadajte prosím len písmená (a-z) alebo číslice (0-9). Medzery alebo iné znaky nie sú povolené.',
  15084. dateSuchAs: 'Zadajte prosím platný dátum v tvare {date}',
  15085. dateInFormatMDY: 'Zadajte prosím platný datum v tvare MM / DD / RRRR (t.j. „12/31/1999“)',
  15086. email: 'Zadajte prosím platnú emailovú adresu. Napríklad „fred@domain.com“.',
  15087. url: 'Zadajte prosím platnoú adresu URL v tvare http://www.example.com.',
  15088. currencyDollar: 'Zadajte prosím platnú čiastku. Napríklad $100.00.',
  15089. oneRequired: 'Zadajte prosím aspoň jednu hodnotu z týchto položiek.',
  15090. errorPrefix: 'Chyba: ',
  15091. warningPrefix: 'Upozornenie: ',
  15092. // Form.Validator.Extras
  15093. noSpace: 'V tejto položle nie sú povolené medzery',
  15094. reqChkByNode: 'Nie sú vybrané žiadne položky.',
  15095. requiredChk: 'Táto položka je povinná.',
  15096. reqChkByName: 'Prosím vyberte {label}.',
  15097. match: 'Táto položka sa musí zhodovať s položkou {matchName}',
  15098. startDate: 'dátum začiatku',
  15099. endDate: 'dátum ukončenia',
  15100. currendDate: 'aktuálny dátum',
  15101. afterDate: 'Dátum by mal býť rovnaký alebo väčší ako {label}.',
  15102. beforeDate: 'Dátum by mal byť rovnaký alebo menší ako {label}.',
  15103. startMonth: 'Vyberte počiatočný mesiac.',
  15104. sameMonth: 'Tieto dva dátumy musia býť v rovnakom mesiaci - zmeňte jeden z nich.',
  15105. creditcard: 'Zadané číslo kreditnej karty je neplatné. Prosím, opravte ho. Bolo zadaných {length} číslic.'
  15106. });
  15107. /*
  15108. ---
  15109. name: Locale.si-SI.Date
  15110. description: Date messages for Slovenian.
  15111. license: MIT-style license
  15112. authors:
  15113. - Radovan Lozej
  15114. requires:
  15115. - Locale
  15116. provides: [Locale.si-SI.Date]
  15117. ...
  15118. */
  15119. (function(){
  15120. var pluralize = function(n, one, two, three, other){
  15121. return (n >= 1 && n <= 3) ? arguments[n] : other;
  15122. };
  15123. Locale.define('sl-SI', 'Date', {
  15124. months: ['januar', 'februar', 'marec', 'april', 'maj', 'junij', 'julij', 'avgust', 'september', 'oktober', 'november', 'december'],
  15125. months_abbr: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'avg', 'sep', 'okt', 'nov', 'dec'],
  15126. days: ['nedelja', 'ponedeljek', 'torek', 'sreda', 'četrtek', 'petek', 'sobota'],
  15127. days_abbr: ['ned', 'pon', 'tor', 'sre', 'čet', 'pet', 'sob'],
  15128. // Culture's date order: DD.MM.YYYY
  15129. dateOrder: ['date', 'month', 'year'],
  15130. shortDate: '%d.%m.%Y',
  15131. shortTime: '%H.%M',
  15132. AM: 'AM',
  15133. PM: 'PM',
  15134. firstDayOfWeek: 1,
  15135. // Date.Extras
  15136. ordinal: '.',
  15137. lessThanMinuteAgo: 'manj kot minuto nazaj',
  15138. minuteAgo: 'minuto nazaj',
  15139. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'minuto', 'minuti', 'minute', 'minut') + ' nazaj'; },
  15140. hourAgo: 'uro nazaj',
  15141. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'uro', 'uri', 'ure', 'ur') + ' nazaj'; },
  15142. dayAgo: 'dan nazaj',
  15143. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'dan', 'dneva', 'dni', 'dni') + ' nazaj'; },
  15144. weekAgo: 'teden nazaj',
  15145. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'teden', 'tedna', 'tedne', 'tednov') + ' nazaj'; },
  15146. monthAgo: 'mesec nazaj',
  15147. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'mesec', 'meseca', 'mesece', 'mesecov') + ' nazaj'; },
  15148. yearthAgo: 'leto nazaj',
  15149. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'leto', 'leti', 'leta', 'let') + ' nazaj'; },
  15150. lessThanMinuteUntil: 'še manj kot minuto',
  15151. minuteUntil: 'še minuta',
  15152. minutesUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'minuta', 'minuti', 'minute', 'minut'); },
  15153. hourUntil: 'še ura',
  15154. hoursUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'ura', 'uri', 'ure', 'ur'); },
  15155. dayUntil: 'še dan',
  15156. daysUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'dan', 'dneva', 'dnevi', 'dni'); },
  15157. weekUntil: 'še tedn',
  15158. weeksUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'teden', 'tedna', 'tedni', 'tednov'); },
  15159. monthUntil: 'še mesec',
  15160. monthsUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'mesec', 'meseca', 'meseci', 'mesecov'); },
  15161. yearUntil: 'še leto',
  15162. yearsUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'leto', 'leti', 'leta', 'let'); }
  15163. });
  15164. })();
  15165. /*
  15166. ---
  15167. name: Locale.si-SI.Form.Validator
  15168. description: Form Validator messages for Slovenian.
  15169. license: MIT-style license
  15170. authors:
  15171. - Radovan Lozej
  15172. requires:
  15173. - Locale
  15174. provides: [Locale.si-SI.Form.Validator]
  15175. ...
  15176. */
  15177. Locale.define('sl-SI', 'FormValidator', {
  15178. required: 'To polje je obvezno',
  15179. minLength: 'Prosim, vnesite vsaj {minLength} znakov (vnesli ste {length} znakov).',
  15180. maxLength: 'Prosim, ne vnesite več kot {maxLength} znakov (vnesli ste {length} znakov).',
  15181. integer: 'Prosim, vnesite celo število. Decimalna števila (kot 1,25) niso dovoljena.',
  15182. numeric: 'Prosim, vnesite samo numerične vrednosti (kot "1" ali "1.1" ali "-1" ali "-1.1").',
  15183. digits: 'Prosim, uporabite številke in ločila le na tem polju (na primer, dovoljena je telefonska številka z pomišlaji ali pikami).',
  15184. alpha: 'Prosim, uporabite le črke v tem plju. Presledki in drugi znaki niso dovoljeni.',
  15185. alphanum: 'Prosim, uporabite samo črke ali številke v tem polju. Presledki in drugi znaki niso dovoljeni.',
  15186. dateSuchAs: 'Prosim, vnesite pravilen datum kot {date}',
  15187. dateInFormatMDY: 'Prosim, vnesite pravilen datum kot MM.DD.YYYY (primer "12.31.1999")',
  15188. email: 'Prosim, vnesite pravilen email naslov. Na primer "fred@domain.com".',
  15189. url: 'Prosim, vnesite pravilen URL kot http://www.example.com.',
  15190. currencyDollar: 'Prosim, vnesit epravilno vrednost €. Primer 100,00€ .',
  15191. oneRequired: 'Prosimo, vnesite nekaj za vsaj eno izmed teh polj.',
  15192. errorPrefix: 'Napaka: ',
  15193. warningPrefix: 'Opozorilo: ',
  15194. // Form.Validator.Extras
  15195. noSpace: 'To vnosno polje ne dopušča presledkov.',
  15196. reqChkByNode: 'Nič niste izbrali.',
  15197. requiredChk: 'To polje je obvezno',
  15198. reqChkByName: 'Prosim, izberite {label}.',
  15199. match: 'To polje se mora ujemati z poljem {matchName}',
  15200. startDate: 'datum začetka',
  15201. endDate: 'datum konca',
  15202. currentDate: 'trenuten datum',
  15203. afterDate: 'Datum bi moral biti isti ali po {label}.',
  15204. beforeDate: 'Datum bi moral biti isti ali pred {label}.',
  15205. startMonth: 'Prosim, vnesite začetni datum',
  15206. sameMonth: 'Ta dva datuma morata biti v istem mesecu - premeniti morate eno ali drugo.',
  15207. creditcard: 'Številka kreditne kartice ni pravilna. Preverite številko ali poskusite še enkrat. Vnešenih {length} znakov.'
  15208. });
  15209. /*
  15210. ---
  15211. name: Locale.sv-SE.Date
  15212. description: Date messages for Swedish.
  15213. license: MIT-style license
  15214. authors:
  15215. - Martin Lundgren
  15216. requires:
  15217. - Locale
  15218. provides: [Locale.sv-SE.Date]
  15219. ...
  15220. */
  15221. Locale.define('sv-SE', 'Date', {
  15222. months: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'],
  15223. months_abbr: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
  15224. days: ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'],
  15225. days_abbr: ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör'],
  15226. // Culture's date order: YYYY-MM-DD
  15227. dateOrder: ['year', 'month', 'date'],
  15228. shortDate: '%Y-%m-%d',
  15229. shortTime: '%H:%M',
  15230. AM: '',
  15231. PM: '',
  15232. firstDayOfWeek: 1,
  15233. // Date.Extras
  15234. ordinal: '',
  15235. lessThanMinuteAgo: 'mindre än en minut sedan',
  15236. minuteAgo: 'ungefär en minut sedan',
  15237. minutesAgo: '{delta} minuter sedan',
  15238. hourAgo: 'ungefär en timme sedan',
  15239. hoursAgo: 'ungefär {delta} timmar sedan',
  15240. dayAgo: '1 dag sedan',
  15241. daysAgo: '{delta} dagar sedan',
  15242. lessThanMinuteUntil: 'mindre än en minut sedan',
  15243. minuteUntil: 'ungefär en minut sedan',
  15244. minutesUntil: '{delta} minuter sedan',
  15245. hourUntil: 'ungefär en timme sedan',
  15246. hoursUntil: 'ungefär {delta} timmar sedan',
  15247. dayUntil: '1 dag sedan',
  15248. daysUntil: '{delta} dagar sedan'
  15249. });
  15250. /*
  15251. ---
  15252. name: Locale.sv-SE.Form.Validator
  15253. description: Form Validator messages for Swedish.
  15254. license: MIT-style license
  15255. authors:
  15256. - Martin Lundgren
  15257. requires:
  15258. - Locale
  15259. provides: [Locale.sv-SE.Form.Validator]
  15260. ...
  15261. */
  15262. Locale.define('sv-SE', 'FormValidator', {
  15263. required: 'Fältet är obligatoriskt.',
  15264. minLength: 'Ange minst {minLength} tecken (du angav {length} tecken).',
  15265. maxLength: 'Ange högst {maxLength} tecken (du angav {length} tecken). ',
  15266. integer: 'Ange ett heltal i fältet. Tal med decimaler (t.ex. 1,25) är inte tillåtna.',
  15267. numeric: 'Ange endast numeriska värden i detta fält (t.ex. "1" eller "1.1" eller "-1" eller "-1,1").',
  15268. digits: 'Använd endast siffror och skiljetecken i detta fält (till exempel ett telefonnummer med bindestreck tillåtet).',
  15269. alpha: 'Använd endast bokstäver (a-ö) i detta fält. Inga mellanslag eller andra tecken är tillåtna.',
  15270. alphanum: 'Använd endast bokstäver (a-ö) och siffror (0-9) i detta fält. Inga mellanslag eller andra tecken är tillåtna.',
  15271. dateSuchAs: 'Ange ett giltigt datum som t.ex. {date}',
  15272. dateInFormatMDY: 'Ange ett giltigt datum som t.ex. YYYY-MM-DD (i.e. "1999-12-31")',
  15273. email: 'Ange en giltig e-postadress. Till exempel "erik@domain.com".',
  15274. url: 'Ange en giltig webbadress som http://www.example.com.',
  15275. currencyDollar: 'Ange en giltig belopp. Exempelvis 100,00.',
  15276. oneRequired: 'Vänligen ange minst ett av dessa alternativ.',
  15277. errorPrefix: 'Fel: ',
  15278. warningPrefix: 'Varning: ',
  15279. // Form.Validator.Extras
  15280. noSpace: 'Det får inte finnas några mellanslag i detta fält.',
  15281. reqChkByNode: 'Inga objekt är valda.',
  15282. requiredChk: 'Detta är ett obligatoriskt fält.',
  15283. reqChkByName: 'Välj en {label}.',
  15284. match: 'Detta fält måste matcha {matchName}',
  15285. startDate: 'startdatumet',
  15286. endDate: 'slutdatum',
  15287. currentDate: 'dagens datum',
  15288. afterDate: 'Datumet bör vara samma eller senare än {label}.',
  15289. beforeDate: 'Datumet bör vara samma eller tidigare än {label}.',
  15290. startMonth: 'Välj en start månad',
  15291. sameMonth: 'Dessa två datum måste vara i samma månad - du måste ändra det ena eller det andra.'
  15292. });
  15293. /*
  15294. ---
  15295. name: Locale.sv-SE.Number
  15296. description: Number messages for Swedish.
  15297. license: MIT-style license
  15298. authors:
  15299. - Arian Stolwijk
  15300. - Martin Lundgren
  15301. requires:
  15302. - Locale
  15303. - Locale.EU.Number
  15304. provides: [Locale.sv-SE.Number]
  15305. ...
  15306. */
  15307. Locale.define('sv-SE', 'Number', {
  15308. currency: {
  15309. prefix: 'SEK '
  15310. }
  15311. }).inherit('EU', 'Number');
  15312. /*
  15313. ---
  15314. name: Locale.tr-TR.Date
  15315. description: Date messages for Turkish.
  15316. license: MIT-style license
  15317. authors:
  15318. - Faruk Can Bilir
  15319. requires:
  15320. - Locale
  15321. provides: [Locale.tr-TR.Date]
  15322. ...
  15323. */
  15324. Locale.define('tr-TR', 'Date', {
  15325. months: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
  15326. months_abbr: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
  15327. days: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],
  15328. days_abbr: ['Pa', 'Pzt', 'Sa', 'Ça', 'Pe', 'Cu', 'Cmt'],
  15329. // Culture's date order: MM/DD/YYYY
  15330. dateOrder: ['date', 'month', 'year'],
  15331. shortDate: '%d/%m/%Y',
  15332. shortTime: '%H.%M',
  15333. AM: 'AM',
  15334. PM: 'PM',
  15335. firstDayOfWeek: 1,
  15336. // Date.Extras
  15337. ordinal: '',
  15338. lessThanMinuteAgo: 'bir dakikadan önce',
  15339. minuteAgo: 'yaklaşık bir dakika önce',
  15340. minutesAgo: '{delta} dakika önce',
  15341. hourAgo: 'bir saat kadar önce',
  15342. hoursAgo: '{delta} saat kadar önce',
  15343. dayAgo: 'bir gün önce',
  15344. daysAgo: '{delta} gün önce',
  15345. weekAgo: 'bir hafta önce',
  15346. weeksAgo: '{delta} hafta önce',
  15347. monthAgo: 'bir ay önce',
  15348. monthsAgo: '{delta} ay önce',
  15349. yearAgo: 'bir yıl önce',
  15350. yearsAgo: '{delta} yıl önce',
  15351. lessThanMinuteUntil: 'bir dakikadan az sonra',
  15352. minuteUntil: 'bir dakika kadar sonra',
  15353. minutesUntil: '{delta} dakika sonra',
  15354. hourUntil: 'bir saat kadar sonra',
  15355. hoursUntil: '{delta} saat kadar sonra',
  15356. dayUntil: 'bir gün sonra',
  15357. daysUntil: '{delta} gün sonra',
  15358. weekUntil: 'bir hafta sonra',
  15359. weeksUntil: '{delta} hafta sonra',
  15360. monthUntil: 'bir ay sonra',
  15361. monthsUntil: '{delta} ay sonra',
  15362. yearUntil: 'bir yıl sonra',
  15363. yearsUntil: '{delta} yıl sonra'
  15364. });
  15365. /*
  15366. ---
  15367. name: Locale.tr-TR.Form.Validator
  15368. description: Form Validator messages for Turkish.
  15369. license: MIT-style license
  15370. authors:
  15371. - Faruk Can Bilir
  15372. requires:
  15373. - Locale
  15374. provides: [Locale.tr-TR.Form.Validator]
  15375. ...
  15376. */
  15377. Locale.define('tr-TR', 'FormValidator', {
  15378. required: 'Bu alan zorunlu.',
  15379. minLength: 'Lütfen en az {minLength} karakter girin (siz {length} karakter girdiniz).',
  15380. maxLength: 'Lütfen en fazla {maxLength} karakter girin (siz {length} karakter girdiniz).',
  15381. integer: 'Lütfen bu alana sadece tamsayı girin. Ondalıklı sayılar (ör: 1.25) kullanılamaz.',
  15382. numeric: 'Lütfen bu alana sadece sayısal değer girin (ör: "1", "1.1", "-1" ya da "-1.1").',
  15383. 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).',
  15384. alpha: 'Lütfen bu alanda yalnızca harf kullanın. Boşluk ve diğer karakterler kullanılamaz.',
  15385. alphanum: 'Lütfen bu alanda sadece harf ve rakam kullanın. Boşluk ve diğer karakterler kullanılamaz.',
  15386. dateSuchAs: 'Lütfen geçerli bir tarih girin (Ör: {date})',
  15387. dateInFormatMDY: 'Lütfen geçerli bir tarih girin (GG/AA/YYYY, ör: "31/12/1999")',
  15388. email: 'Lütfen geçerli bir email adresi girin. Ör: "kemal@etikan.com".',
  15389. url: 'Lütfen geçerli bir URL girin. Ör: http://www.example.com.',
  15390. currencyDollar: 'Lütfen geçerli bir TL miktarı girin. Ör: 100,00 TL .',
  15391. oneRequired: 'Lütfen en az bir tanesini doldurun.',
  15392. errorPrefix: 'Hata: ',
  15393. warningPrefix: 'Uyarı: ',
  15394. // Form.Validator.Extras
  15395. noSpace: 'Bu alanda boşluk kullanılamaz.',
  15396. reqChkByNode: 'Hiçbir öğe seçilmemiş.',
  15397. requiredChk: 'Bu alan zorunlu.',
  15398. reqChkByName: 'Lütfen bir {label} girin.',
  15399. match: 'Bu alan, {matchName} alanıyla uyuşmalı',
  15400. startDate: 'başlangıç tarihi',
  15401. endDate: 'bitiş tarihi',
  15402. currentDate: 'bugünün tarihi',
  15403. afterDate: 'Tarih, {label} tarihiyle aynı gün ya da ondan sonra olmalıdır.',
  15404. beforeDate: 'Tarih, {label} tarihiyle aynı gün ya da ondan önce olmalıdır.',
  15405. startMonth: 'Lütfen bir başlangıç ayı seçin',
  15406. sameMonth: 'Bu iki tarih aynı ayda olmalı - bir tanesini değiştirmeniz gerekiyor.',
  15407. creditcard: 'Girdiğiniz kredi kartı numarası geçersiz. Lütfen kontrol edip tekrar deneyin. {length} hane girildi.'
  15408. });
  15409. /*
  15410. ---
  15411. name: Locale.tr-TR.Number
  15412. description: Number messages for Turkish.
  15413. license: MIT-style license
  15414. authors:
  15415. - Faruk Can Bilir
  15416. requires:
  15417. - Locale
  15418. - Locale.EU.Number
  15419. provides: [Locale.tr-TR.Number]
  15420. ...
  15421. */
  15422. Locale.define('tr-TR', 'Number', {
  15423. currency: {
  15424. decimals: 0,
  15425. suffix: ' TL'
  15426. }
  15427. }).inherit('EU', 'Number');
  15428. /*
  15429. ---
  15430. name: Locale.uk-UA.Date
  15431. description: Date messages for Ukrainian (utf-8).
  15432. license: MIT-style license
  15433. authors:
  15434. - Slik
  15435. requires:
  15436. - Locale
  15437. provides: [Locale.uk-UA.Date]
  15438. ...
  15439. */
  15440. (function(){
  15441. var pluralize = function(n, one, few, many, other){
  15442. var d = (n / 10).toInt(),
  15443. z = n % 10,
  15444. s = (n / 100).toInt();
  15445. if (d == 1 && n > 10) return many;
  15446. if (z == 1) return one;
  15447. if (z > 0 && z < 5) return few;
  15448. return many;
  15449. };
  15450. Locale.define('uk-UA', 'Date', {
  15451. months: ['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'],
  15452. months_abbr: ['Січ', 'Лют', 'Бер', 'Квіт', 'Трав', 'Черв', 'Лип', 'Серп', 'Вер', 'Жовт', 'Лист', 'Груд' ],
  15453. days: ['Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', "П'ятниця", 'Субота'],
  15454. days_abbr: ['Нд', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
  15455. // Culture's date order: DD/MM/YYYY
  15456. dateOrder: ['date', 'month', 'year'],
  15457. shortDate: '%d/%m/%Y',
  15458. shortTime: '%H:%M',
  15459. AM: 'до полудня',
  15460. PM: 'по полудню',
  15461. firstDayOfWeek: 1,
  15462. // Date.Extras
  15463. ordinal: '',
  15464. lessThanMinuteAgo: 'меньше хвилини тому',
  15465. minuteAgo: 'хвилину тому',
  15466. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'хвилину', 'хвилини', 'хвилин') + ' тому'; },
  15467. hourAgo: 'годину тому',
  15468. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'годину', 'години', 'годин') + ' тому'; },
  15469. dayAgo: 'вчора',
  15470. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'день', 'дня', 'днів') + ' тому'; },
  15471. weekAgo: 'тиждень тому',
  15472. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'тиждень', 'тижні', 'тижнів') + ' тому'; },
  15473. monthAgo: 'місяць тому',
  15474. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'місяць', 'місяці', 'місяців') + ' тому'; },
  15475. yearAgo: 'рік тому',
  15476. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'рік', 'роки', 'років') + ' тому'; },
  15477. lessThanMinuteUntil: 'за мить',
  15478. minuteUntil: 'через хвилину',
  15479. minutesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'хвилину', 'хвилини', 'хвилин'); },
  15480. hourUntil: 'через годину',
  15481. hoursUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'годину', 'години', 'годин'); },
  15482. dayUntil: 'завтра',
  15483. daysUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'день', 'дня', 'днів'); },
  15484. weekUntil: 'через тиждень',
  15485. weeksUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'тиждень', 'тижні', 'тижнів'); },
  15486. monthUntil: 'через місяць',
  15487. monthesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'місяць', 'місяці', 'місяців'); },
  15488. yearUntil: 'через рік',
  15489. yearsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'рік', 'роки', 'років'); }
  15490. });
  15491. })();
  15492. /*
  15493. ---
  15494. name: Locale.uk-UA.Form.Validator
  15495. description: Form Validator messages for Ukrainian (utf-8).
  15496. license: MIT-style license
  15497. authors:
  15498. - Slik
  15499. requires:
  15500. - Locale
  15501. provides: [Locale.uk-UA.Form.Validator]
  15502. ...
  15503. */
  15504. Locale.define('uk-UA', 'FormValidator', {
  15505. required: 'Це поле повинне бути заповненим.',
  15506. minLength: 'Введіть хоча б {minLength} символів (Ви ввели {length}).',
  15507. maxLength: 'Кількість символів не може бути більше {maxLength} (Ви ввели {length}).',
  15508. integer: 'Введіть в це поле число. Дробові числа (наприклад 1.25) не дозволені.',
  15509. numeric: 'Введіть в це поле число (наприклад "1" або "1.1", або "-1", або "-1.1").',
  15510. digits: 'В цьому полі ви можете використовувати лише цифри і знаки пунктіації (наприклад, телефонний номер з знаками дефізу або з крапками).',
  15511. alpha: 'В цьому полі можна використовувати лише латинські літери (a-z). Пробіли і інші символи заборонені.',
  15512. alphanum: 'В цьому полі можна використовувати лише латинські літери (a-z) і цифри (0-9). Пробіли і інші символи заборонені.',
  15513. dateSuchAs: 'Введіть коректну дату {date}.',
  15514. dateInFormatMDY: 'Введіть дату в форматі ММ/ДД/РРРР (наприклад "12/31/2009").',
  15515. email: 'Введіть коректну адресу електронної пошти (наприклад "name@domain.com").',
  15516. url: 'Введіть коректне інтернет-посилання (наприклад http://www.example.com).',
  15517. currencyDollar: 'Введіть суму в доларах (наприклад "$100.00").',
  15518. oneRequired: 'Заповніть одне з полів.',
  15519. errorPrefix: 'Помилка: ',
  15520. warningPrefix: 'Увага: ',
  15521. noSpace: 'Пробіли заборонені.',
  15522. reqChkByNode: 'Не відмічено жодного варіанту.',
  15523. requiredChk: 'Це поле повинне бути віміченим.',
  15524. reqChkByName: 'Будь ласка, відмітьте {label}.',
  15525. match: 'Це поле повинно відповідати {matchName}',
  15526. startDate: 'початкова дата',
  15527. endDate: 'кінцева дата',
  15528. currentDate: 'сьогоднішня дата',
  15529. afterDate: 'Ця дата повинна бути такою ж, або пізнішою за {label}.',
  15530. beforeDate: 'Ця дата повинна бути такою ж, або ранішою за {label}.',
  15531. startMonth: 'Будь ласка, виберіть початковий місяць',
  15532. sameMonth: 'Ці дати повинні відноситись одного і того ж місяця. Будь ласка, змініть одну з них.',
  15533. creditcard: 'Номер кредитної карти введений неправильно. Будь ласка, перевірте його. Введено {length} символів.'
  15534. });
  15535. /*
  15536. ---
  15537. name: Locale.zh-CH.Date
  15538. description: Date messages for Chinese (simplified and traditional).
  15539. license: MIT-style license
  15540. authors:
  15541. - YMind Chan
  15542. requires:
  15543. - Locale
  15544. provides: [Locale.zh-CH.Date]
  15545. ...
  15546. */
  15547. // Simplified Chinese
  15548. Locale.define('zh-CHS', 'Date', {
  15549. months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  15550. months_abbr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  15551. days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  15552. days_abbr: ['日', '一', '二', '三', '四', '五', '六'],
  15553. // Culture's date order: YYYY-MM-DD
  15554. dateOrder: ['year', 'month', 'date'],
  15555. shortDate: '%Y-%m-%d',
  15556. shortTime: '%I:%M%p',
  15557. AM: 'AM',
  15558. PM: 'PM',
  15559. firstDayOfWeek: 1,
  15560. // Date.Extras
  15561. ordinal: '',
  15562. lessThanMinuteAgo: '不到1分钟前',
  15563. minuteAgo: '大约1分钟前',
  15564. minutesAgo: '{delta}分钟之前',
  15565. hourAgo: '大约1小时前',
  15566. hoursAgo: '大约{delta}小时前',
  15567. dayAgo: '1天前',
  15568. daysAgo: '{delta}天前',
  15569. weekAgo: '1星期前',
  15570. weeksAgo: '{delta}星期前',
  15571. monthAgo: '1个月前',
  15572. monthsAgo: '{delta}个月前',
  15573. yearAgo: '1年前',
  15574. yearsAgo: '{delta}年前',
  15575. lessThanMinuteUntil: '从现在开始不到1分钟',
  15576. minuteUntil: '从现在开始約1分钟',
  15577. minutesUntil: '从现在开始约{delta}分钟',
  15578. hourUntil: '从现在开始1小时',
  15579. hoursUntil: '从现在开始约{delta}小时',
  15580. dayUntil: '从现在开始1天',
  15581. daysUntil: '从现在开始{delta}天',
  15582. weekUntil: '从现在开始1星期',
  15583. weeksUntil: '从现在开始{delta}星期',
  15584. monthUntil: '从现在开始一个月',
  15585. monthsUntil: '从现在开始{delta}个月',
  15586. yearUntil: '从现在开始1年',
  15587. yearsUntil: '从现在开始{delta}年'
  15588. });
  15589. // Traditional Chinese
  15590. Locale.define('zh-CHT', 'Date', {
  15591. months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  15592. months_abbr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  15593. days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  15594. days_abbr: ['日', '一', '二', '三', '四', '五', '六'],
  15595. // Culture's date order: YYYY-MM-DD
  15596. dateOrder: ['year', 'month', 'date'],
  15597. shortDate: '%Y-%m-%d',
  15598. shortTime: '%I:%M%p',
  15599. AM: 'AM',
  15600. PM: 'PM',
  15601. firstDayOfWeek: 1,
  15602. // Date.Extras
  15603. ordinal: '',
  15604. lessThanMinuteAgo: '不到1分鐘前',
  15605. minuteAgo: '大約1分鐘前',
  15606. minutesAgo: '{delta}分鐘之前',
  15607. hourAgo: '大約1小時前',
  15608. hoursAgo: '大約{delta}小時前',
  15609. dayAgo: '1天前',
  15610. daysAgo: '{delta}天前',
  15611. weekAgo: '1星期前',
  15612. weeksAgo: '{delta}星期前',
  15613. monthAgo: '1个月前',
  15614. monthsAgo: '{delta}个月前',
  15615. yearAgo: '1年前',
  15616. yearsAgo: '{delta}年前',
  15617. lessThanMinuteUntil: '從現在開始不到1分鐘',
  15618. minuteUntil: '從現在開始約1分鐘',
  15619. minutesUntil: '從現在開始約{delta}分鐘',
  15620. hourUntil: '從現在開始1小時',
  15621. hoursUntil: '從現在開始約{delta}小時',
  15622. dayUntil: '從現在開始1天',
  15623. daysUntil: '從現在開始{delta}天',
  15624. weekUntil: '從現在開始1星期',
  15625. weeksUntil: '從現在開始{delta}星期',
  15626. monthUntil: '從現在開始一個月',
  15627. monthsUntil: '從現在開始{delta}個月',
  15628. yearUntil: '從現在開始1年',
  15629. yearsUntil: '從現在開始{delta}年'
  15630. });
  15631. /*
  15632. ---
  15633. name: Locale.zh-CH.Form.Validator
  15634. description: Form Validator messages for Chinese (simplified and traditional).
  15635. license: MIT-style license
  15636. authors:
  15637. - YMind Chan
  15638. requires:
  15639. - Locale
  15640. - Form.Validator
  15641. provides: [Form.zh-CH.Form.Validator, Form.Validator.CurrencyYuanValidator]
  15642. ...
  15643. */
  15644. // Simplified Chinese
  15645. Locale.define('zh-CHS', 'FormValidator', {
  15646. required: '此项必填。',
  15647. minLength: '请至少输入 {minLength} 个字符 (已输入 {length} 个)。',
  15648. maxLength: '最多只能输入 {maxLength} 个字符 (已输入 {length} 个)。',
  15649. integer: '请输入一个整数,不能包含小数点。例如:"1", "200"。',
  15650. numeric: '请输入一个数字,例如:"1", "1.1", "-1", "-1.1"。',
  15651. digits: '请输入由数字和标点符号组成的内容。例如电话号码。',
  15652. alpha: '请输入 A-Z 的 26 个字母,不能包含空格或任何其他字符。',
  15653. alphanum: '请输入 A-Z 的 26 个字母或 0-9 的 10 个数字,不能包含空格或任何其他字符。',
  15654. dateSuchAs: '请输入合法的日期格式,如:{date}。',
  15655. dateInFormatMDY: '请输入合法的日期格式,例如:YYYY-MM-DD ("2010-12-31")。',
  15656. email: '请输入合法的电子信箱地址,例如:"fred@domain.com"。',
  15657. url: '请输入合法的 Url 地址,例如:http://www.example.com。',
  15658. currencyDollar: '请输入合法的货币符号,例如:¥100.0',
  15659. oneRequired: '请至少选择一项。',
  15660. errorPrefix: '错误:',
  15661. warningPrefix: '警告:',
  15662. // Form.Validator.Extras
  15663. noSpace: '不能包含空格。',
  15664. reqChkByNode: '未选择任何内容。',
  15665. requiredChk: '此项必填。',
  15666. reqChkByName: '请选择 {label}.',
  15667. match: '必须与{matchName}相匹配',
  15668. startDate: '起始日期',
  15669. endDate: '结束日期',
  15670. currentDate: '当前日期',
  15671. afterDate: '日期必须等于或晚于 {label}.',
  15672. beforeDate: '日期必须早于或等于 {label}.',
  15673. startMonth: '请选择起始月份',
  15674. sameMonth: '您必须修改两个日期中的一个,以确保它们在同一月份。',
  15675. creditcard: '您输入的信用卡号码不正确。当前已输入{length}个字符。'
  15676. });
  15677. // Traditional Chinese
  15678. Locale.define('zh-CHT', 'FormValidator', {
  15679. required: '此項必填。 ',
  15680. minLength: '請至少輸入{minLength} 個字符(已輸入{length} 個)。 ',
  15681. maxLength: '最多只能輸入{maxLength} 個字符(已輸入{length} 個)。 ',
  15682. integer: '請輸入一個整數,不能包含小數點。例如:"1", "200"。 ',
  15683. numeric: '請輸入一個數字,例如:"1", "1.1", "-1", "-1.1"。 ',
  15684. digits: '請輸入由數字和標點符號組成的內容。例如電話號碼。 ',
  15685. alpha: '請輸入AZ 的26 個字母,不能包含空格或任何其他字符。 ',
  15686. alphanum: '請輸入AZ 的26 個字母或0-9 的10 個數字,不能包含空格或任何其他字符。 ',
  15687. dateSuchAs: '請輸入合法的日期格式,如:{date}。 ',
  15688. dateInFormatMDY: '請輸入合法的日期格式,例如:YYYY-MM-DD ("2010-12-31")。 ',
  15689. email: '請輸入合法的電子信箱地址,例如:"fred@domain.com"。 ',
  15690. url: '請輸入合法的Url 地址,例如:http://www.example.com。 ',
  15691. currencyDollar: '請輸入合法的貨幣符號,例如:¥100.0',
  15692. oneRequired: '請至少選擇一項。 ',
  15693. errorPrefix: '錯誤:',
  15694. warningPrefix: '警告:',
  15695. // Form.Validator.Extras
  15696. noSpace: '不能包含空格。 ',
  15697. reqChkByNode: '未選擇任何內容。 ',
  15698. requiredChk: '此項必填。 ',
  15699. reqChkByName: '請選擇 {label}.',
  15700. match: '必須與{matchName}相匹配',
  15701. startDate: '起始日期',
  15702. endDate: '結束日期',
  15703. currentDate: '當前日期',
  15704. afterDate: '日期必須等於或晚於{label}.',
  15705. beforeDate: '日期必須早於或等於{label}.',
  15706. startMonth: '請選擇起始月份',
  15707. sameMonth: '您必須修改兩個日期中的一個,以確保它們在同一月份。 ',
  15708. creditcard: '您輸入的信用卡號碼不正確。當前已輸入{length}個字符。 '
  15709. });
  15710. Form.Validator.add('validate-currency-yuan', {
  15711. errorMsg: function(){
  15712. return Form.Validator.getMsg('currencyYuan');
  15713. },
  15714. test: function(element){
  15715. // [¥]1[##][,###]+[.##]
  15716. // [¥]1###+[.##]
  15717. // [¥]0.##
  15718. // [¥].##
  15719. 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'));
  15720. }
  15721. });
  15722. /*
  15723. ---
  15724. name: Locale.zh-CH.Number
  15725. description: Number messages for for Chinese (simplified and traditional).
  15726. license: MIT-style license
  15727. authors:
  15728. - YMind Chan
  15729. requires:
  15730. - Locale
  15731. - Locale.en-US.Number
  15732. provides: [Locale.zh-CH.Number]
  15733. ...
  15734. */
  15735. // Simplified Chinese
  15736. Locale.define('zh-CHS', 'Number', {
  15737. currency: {
  15738. prefix: '¥ '
  15739. }
  15740. }).inherit('en-US', 'Number');
  15741. // Traditional Chinese
  15742. Locale.define('zh-CHT').inherit('zh-CHS', 'Number');
  15743. /*
  15744. ---
  15745. script: Request.JSONP.js
  15746. name: Request.JSONP
  15747. description: Defines Request.JSONP, a class for cross domain javascript via script injection.
  15748. license: MIT-style license
  15749. authors:
  15750. - Aaron Newton
  15751. - Guillermo Rauch
  15752. - Arian Stolwijk
  15753. requires:
  15754. - Core/Element
  15755. - Core/Request
  15756. - MooTools.More
  15757. provides: [Request.JSONP]
  15758. ...
  15759. */
  15760. Request.JSONP = new Class({
  15761. Implements: [Chain, Events, Options],
  15762. options: {/*
  15763. onRequest: function(src, scriptElement){},
  15764. onComplete: function(data){},
  15765. onSuccess: function(data){},
  15766. onCancel: function(){},
  15767. onTimeout: function(){},
  15768. onError: function(){}, */
  15769. onRequest: function(src){
  15770. if (this.options.log && window.console && console.log){
  15771. console.log('JSONP retrieving script with url:' + src);
  15772. }
  15773. },
  15774. onError: function(src){
  15775. if (this.options.log && window.console && console.warn){
  15776. console.warn('JSONP '+ src +' will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs');
  15777. }
  15778. },
  15779. url: '',
  15780. callbackKey: 'callback',
  15781. injectScript: document.head,
  15782. data: '',
  15783. link: 'ignore',
  15784. timeout: 0,
  15785. log: false
  15786. },
  15787. initialize: function(options){
  15788. this.setOptions(options);
  15789. },
  15790. send: function(options){
  15791. if (!Request.prototype.check.call(this, options)) return this;
  15792. this.running = true;
  15793. var type = typeOf(options);
  15794. if (type == 'string' || type == 'element') options = {data: options};
  15795. options = Object.merge(this.options, options || {});
  15796. var data = options.data;
  15797. switch (typeOf(data)){
  15798. case 'element': data = document.id(data).toQueryString(); break;
  15799. case 'object': case 'hash': data = Object.toQueryString(data);
  15800. }
  15801. var index = this.index = Request.JSONP.counter++,
  15802. key = 'request_' + index;
  15803. var src = options.url +
  15804. (options.url.test('\\?') ? '&' :'?') +
  15805. (options.callbackKey) +
  15806. '=Request.JSONP.request_map.request_'+ index +
  15807. (data ? '&' + data : '');
  15808. if (src.length > 2083) this.fireEvent('error', src);
  15809. Request.JSONP.request_map[key] = function(){
  15810. delete Request.JSONP.request_map[key];
  15811. this.success(arguments, index);
  15812. }.bind(this);
  15813. var script = this.getScript(src).inject(options.injectScript);
  15814. this.fireEvent('request', [src, script]);
  15815. if (options.timeout) this.timeout.delay(options.timeout, this);
  15816. return this;
  15817. },
  15818. getScript: function(src){
  15819. if (!this.script) this.script = new Element('script', {
  15820. type: 'text/javascript',
  15821. async: true,
  15822. src: src
  15823. });
  15824. return this.script;
  15825. },
  15826. success: function(args){
  15827. if (!this.running) return;
  15828. this.clear()
  15829. .fireEvent('complete', args).fireEvent('success', args)
  15830. .callChain();
  15831. },
  15832. cancel: function(){
  15833. if (this.running) this.clear().fireEvent('cancel');
  15834. return this;
  15835. },
  15836. isRunning: function(){
  15837. return !!this.running;
  15838. },
  15839. clear: function(){
  15840. this.running = false;
  15841. if (this.script){
  15842. this.script.destroy();
  15843. this.script = null;
  15844. }
  15845. return this;
  15846. },
  15847. timeout: function(){
  15848. if (this.running){
  15849. this.running = false;
  15850. this.fireEvent('timeout', [this.script.get('src'), this.script]).fireEvent('failure').cancel();
  15851. }
  15852. return this;
  15853. }
  15854. });
  15855. Request.JSONP.counter = 0;
  15856. Request.JSONP.request_map = {};
  15857. /*
  15858. ---
  15859. script: Request.Periodical.js
  15860. name: Request.Periodical
  15861. description: Requests the same URL to pull data from a server but increases the intervals if no data is returned to reduce the load
  15862. license: MIT-style license
  15863. authors:
  15864. - Christoph Pojer
  15865. requires:
  15866. - Core/Request
  15867. - MooTools.More
  15868. provides: [Request.Periodical]
  15869. ...
  15870. */
  15871. Request.implement({
  15872. options: {
  15873. initialDelay: 5000,
  15874. delay: 5000,
  15875. limit: 60000
  15876. },
  15877. startTimer: function(data){
  15878. var fn = function(){
  15879. if (!this.running) this.send({data: data});
  15880. };
  15881. this.lastDelay = this.options.initialDelay;
  15882. this.timer = fn.delay(this.lastDelay, this);
  15883. this.completeCheck = function(response){
  15884. clearTimeout(this.timer);
  15885. this.lastDelay = (response) ? this.options.delay : (this.lastDelay + this.options.delay).min(this.options.limit);
  15886. this.timer = fn.delay(this.lastDelay, this);
  15887. };
  15888. return this.addEvent('complete', this.completeCheck);
  15889. },
  15890. stopTimer: function(){
  15891. clearTimeout(this.timer);
  15892. return this.removeEvent('complete', this.completeCheck);
  15893. }
  15894. });
  15895. /*
  15896. ---
  15897. script: Request.Queue.js
  15898. name: Request.Queue
  15899. description: Controls several instances of Request and its variants to run only one request at a time.
  15900. license: MIT-style license
  15901. authors:
  15902. - Aaron Newton
  15903. requires:
  15904. - Core/Element
  15905. - Core/Request
  15906. - Class.Binds
  15907. provides: [Request.Queue]
  15908. ...
  15909. */
  15910. Request.Queue = new Class({
  15911. Implements: [Options, Events],
  15912. Binds: ['attach', 'request', 'complete', 'cancel', 'success', 'failure', 'exception'],
  15913. options: {/*
  15914. onRequest: function(argsPassedToOnRequest){},
  15915. onSuccess: function(argsPassedToOnSuccess){},
  15916. onComplete: function(argsPassedToOnComplete){},
  15917. onCancel: function(argsPassedToOnCancel){},
  15918. onException: function(argsPassedToOnException){},
  15919. onFailure: function(argsPassedToOnFailure){},
  15920. onEnd: function(){},
  15921. */
  15922. stopOnFailure: true,
  15923. autoAdvance: true,
  15924. concurrent: 1,
  15925. requests: {}
  15926. },
  15927. initialize: function(options){
  15928. var requests;
  15929. if (options){
  15930. requests = options.requests;
  15931. delete options.requests;
  15932. }
  15933. this.setOptions(options);
  15934. this.requests = {};
  15935. this.queue = [];
  15936. this.reqBinders = {};
  15937. if (requests) this.addRequests(requests);
  15938. },
  15939. addRequest: function(name, request){
  15940. this.requests[name] = request;
  15941. this.attach(name, request);
  15942. return this;
  15943. },
  15944. addRequests: function(obj){
  15945. Object.each(obj, function(req, name){
  15946. this.addRequest(name, req);
  15947. }, this);
  15948. return this;
  15949. },
  15950. getName: function(req){
  15951. return Object.keyOf(this.requests, req);
  15952. },
  15953. attach: function(name, req){
  15954. if (req._groupSend) return this;
  15955. ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){
  15956. if (!this.reqBinders[name]) this.reqBinders[name] = {};
  15957. this.reqBinders[name][evt] = function(){
  15958. this['on' + evt.capitalize()].apply(this, [name, req].append(arguments));
  15959. }.bind(this);
  15960. req.addEvent(evt, this.reqBinders[name][evt]);
  15961. }, this);
  15962. req._groupSend = req.send;
  15963. req.send = function(options){
  15964. this.send(name, options);
  15965. return req;
  15966. }.bind(this);
  15967. return this;
  15968. },
  15969. removeRequest: function(req){
  15970. var name = typeOf(req) == 'object' ? this.getName(req) : req;
  15971. if (!name && typeOf(name) != 'string') return this;
  15972. req = this.requests[name];
  15973. if (!req) return this;
  15974. ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){
  15975. req.removeEvent(evt, this.reqBinders[name][evt]);
  15976. }, this);
  15977. req.send = req._groupSend;
  15978. delete req._groupSend;
  15979. return this;
  15980. },
  15981. getRunning: function(){
  15982. return Object.filter(this.requests, function(r){
  15983. return r.running;
  15984. });
  15985. },
  15986. isRunning: function(){
  15987. return !!(Object.keys(this.getRunning()).length);
  15988. },
  15989. send: function(name, options){
  15990. var q = function(){
  15991. this.requests[name]._groupSend(options);
  15992. this.queue.erase(q);
  15993. }.bind(this);
  15994. q.name = name;
  15995. if (Object.keys(this.getRunning()).length >= this.options.concurrent || (this.error && this.options.stopOnFailure)) this.queue.push(q);
  15996. else q();
  15997. return this;
  15998. },
  15999. hasNext: function(name){
  16000. return (!name) ? !!this.queue.length : !!this.queue.filter(function(q){ return q.name == name; }).length;
  16001. },
  16002. resume: function(){
  16003. this.error = false;
  16004. (this.options.concurrent - Object.keys(this.getRunning()).length).times(this.runNext, this);
  16005. return this;
  16006. },
  16007. runNext: function(name){
  16008. if (!this.queue.length) return this;
  16009. if (!name){
  16010. this.queue[0]();
  16011. } else {
  16012. var found;
  16013. this.queue.each(function(q){
  16014. if (!found && q.name == name){
  16015. found = true;
  16016. q();
  16017. }
  16018. });
  16019. }
  16020. return this;
  16021. },
  16022. runAll: function(){
  16023. this.queue.each(function(q){
  16024. q();
  16025. });
  16026. return this;
  16027. },
  16028. clear: function(name){
  16029. if (!name){
  16030. this.queue.empty();
  16031. } else {
  16032. this.queue = this.queue.map(function(q){
  16033. if (q.name != name) return q;
  16034. else return false;
  16035. }).filter(function(q){
  16036. return q;
  16037. });
  16038. }
  16039. return this;
  16040. },
  16041. cancel: function(name){
  16042. this.requests[name].cancel();
  16043. return this;
  16044. },
  16045. onRequest: function(){
  16046. this.fireEvent('request', arguments);
  16047. },
  16048. onComplete: function(){
  16049. this.fireEvent('complete', arguments);
  16050. if (!this.queue.length) this.fireEvent('end');
  16051. },
  16052. onCancel: function(){
  16053. if (this.options.autoAdvance && !this.error) this.runNext();
  16054. this.fireEvent('cancel', arguments);
  16055. },
  16056. onSuccess: function(){
  16057. if (this.options.autoAdvance && !this.error) this.runNext();
  16058. this.fireEvent('success', arguments);
  16059. },
  16060. onFailure: function(){
  16061. this.error = true;
  16062. if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext();
  16063. this.fireEvent('failure', arguments);
  16064. },
  16065. onException: function(){
  16066. this.error = true;
  16067. if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext();
  16068. this.fireEvent('exception', arguments);
  16069. }
  16070. });
  16071. /*
  16072. ---
  16073. script: Array.Extras.js
  16074. name: Array.Extras
  16075. description: Extends the Array native object to include useful methods to work with arrays.
  16076. license: MIT-style license
  16077. authors:
  16078. - Christoph Pojer
  16079. - Sebastian Markbåge
  16080. requires:
  16081. - Core/Array
  16082. - MooTools.More
  16083. provides: [Array.Extras]
  16084. ...
  16085. */
  16086. (function(nil){
  16087. Array.implement({
  16088. min: function(){
  16089. return Math.min.apply(null, this);
  16090. },
  16091. max: function(){
  16092. return Math.max.apply(null, this);
  16093. },
  16094. average: function(){
  16095. return this.length ? this.sum() / this.length : 0;
  16096. },
  16097. sum: function(){
  16098. var result = 0, l = this.length;
  16099. if (l){
  16100. while (l--){
  16101. if (this[l] != null) result += parseFloat(this[l]);
  16102. }
  16103. }
  16104. return result;
  16105. },
  16106. unique: function(){
  16107. return [].combine(this);
  16108. },
  16109. shuffle: function(){
  16110. for (var i = this.length; i && --i;){
  16111. var temp = this[i], r = Math.floor(Math.random() * ( i + 1 ));
  16112. this[i] = this[r];
  16113. this[r] = temp;
  16114. }
  16115. return this;
  16116. },
  16117. reduce: function(fn, value){
  16118. for (var i = 0, l = this.length; i < l; i++){
  16119. if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this);
  16120. }
  16121. return value;
  16122. },
  16123. reduceRight: function(fn, value){
  16124. var i = this.length;
  16125. while (i--){
  16126. if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this);
  16127. }
  16128. return value;
  16129. },
  16130. pluck: function(prop){
  16131. return this.map(function(item){
  16132. return item[prop];
  16133. });
  16134. }
  16135. });
  16136. })();
  16137. /*
  16138. ---
  16139. script: Date.Extras.js
  16140. name: Date.Extras
  16141. description: Extends the Date native object to include extra methods (on top of those in Date.js).
  16142. license: MIT-style license
  16143. authors:
  16144. - Aaron Newton
  16145. - Scott Kyle
  16146. requires:
  16147. - Date
  16148. provides: [Date.Extras]
  16149. ...
  16150. */
  16151. Date.implement({
  16152. timeDiffInWords: function(to){
  16153. return Date.distanceOfTimeInWords(this, to || new Date);
  16154. },
  16155. timeDiff: function(to, separator){
  16156. if (to == null) to = new Date;
  16157. var delta = ((to - this) / 1000).floor().abs();
  16158. var vals = [],
  16159. durations = [60, 60, 24, 365, 0],
  16160. names = ['s', 'm', 'h', 'd', 'y'],
  16161. value, duration;
  16162. for (var item = 0; item < durations.length; item++){
  16163. if (item && !delta) break;
  16164. value = delta;
  16165. if ((duration = durations[item])){
  16166. value = (delta % duration);
  16167. delta = (delta / duration).floor();
  16168. }
  16169. vals.unshift(value + (names[item] || ''));
  16170. }
  16171. return vals.join(separator || ':');
  16172. }
  16173. }).extend({
  16174. distanceOfTimeInWords: function(from, to){
  16175. return Date.getTimePhrase(((to - from) / 1000).toInt());
  16176. },
  16177. getTimePhrase: function(delta){
  16178. var suffix = (delta < 0) ? 'Until' : 'Ago';
  16179. if (delta < 0) delta *= -1;
  16180. var units = {
  16181. minute: 60,
  16182. hour: 60,
  16183. day: 24,
  16184. week: 7,
  16185. month: 52 / 12,
  16186. year: 12,
  16187. eon: Infinity
  16188. };
  16189. var msg = 'lessThanMinute';
  16190. for (var unit in units){
  16191. var interval = units[unit];
  16192. if (delta < 1.5 * interval){
  16193. if (delta > 0.75 * interval) msg = unit;
  16194. break;
  16195. }
  16196. delta /= interval;
  16197. msg = unit + 's';
  16198. }
  16199. delta = delta.round();
  16200. return Date.getMsg(msg + suffix, delta).substitute({delta: delta});
  16201. }
  16202. }).defineParsers(
  16203. {
  16204. // "today", "tomorrow", "yesterday"
  16205. re: /^(?:tod|tom|yes)/i,
  16206. handler: function(bits){
  16207. var d = new Date().clearTime();
  16208. switch (bits[0]){
  16209. case 'tom': return d.increment();
  16210. case 'yes': return d.decrement();
  16211. default: return d;
  16212. }
  16213. }
  16214. },
  16215. {
  16216. // "next Wednesday", "last Thursday"
  16217. re: /^(next|last) ([a-z]+)$/i,
  16218. handler: function(bits){
  16219. var d = new Date().clearTime();
  16220. var day = d.getDay();
  16221. var newDay = Date.parseDay(bits[2], true);
  16222. var addDays = newDay - day;
  16223. if (newDay <= day) addDays += 7;
  16224. if (bits[1] == 'last') addDays -= 7;
  16225. return d.set('date', d.getDate() + addDays);
  16226. }
  16227. }
  16228. ).alias('timeAgoInWords', 'timeDiffInWords');
  16229. /*
  16230. ---
  16231. name: Hash
  16232. description: Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects.
  16233. license: MIT-style license.
  16234. requires:
  16235. - Core/Object
  16236. - MooTools.More
  16237. provides: [Hash]
  16238. ...
  16239. */
  16240. (function(){
  16241. if (this.Hash) return;
  16242. var Hash = this.Hash = new Type('Hash', function(object){
  16243. if (typeOf(object) == 'hash') object = Object.clone(object.getClean());
  16244. for (var key in object) this[key] = object[key];
  16245. return this;
  16246. });
  16247. this.$H = function(object){
  16248. return new Hash(object);
  16249. };
  16250. Hash.implement({
  16251. forEach: function(fn, bind){
  16252. Object.forEach(this, fn, bind);
  16253. },
  16254. getClean: function(){
  16255. var clean = {};
  16256. for (var key in this){
  16257. if (this.hasOwnProperty(key)) clean[key] = this[key];
  16258. }
  16259. return clean;
  16260. },
  16261. getLength: function(){
  16262. var length = 0;
  16263. for (var key in this){
  16264. if (this.hasOwnProperty(key)) length++;
  16265. }
  16266. return length;
  16267. }
  16268. });
  16269. Hash.alias('each', 'forEach');
  16270. Hash.implement({
  16271. has: Object.prototype.hasOwnProperty,
  16272. keyOf: function(value){
  16273. return Object.keyOf(this, value);
  16274. },
  16275. hasValue: function(value){
  16276. return Object.contains(this, value);
  16277. },
  16278. extend: function(properties){
  16279. Hash.each(properties || {}, function(value, key){
  16280. Hash.set(this, key, value);
  16281. }, this);
  16282. return this;
  16283. },
  16284. combine: function(properties){
  16285. Hash.each(properties || {}, function(value, key){
  16286. Hash.include(this, key, value);
  16287. }, this);
  16288. return this;
  16289. },
  16290. erase: function(key){
  16291. if (this.hasOwnProperty(key)) delete this[key];
  16292. return this;
  16293. },
  16294. get: function(key){
  16295. return (this.hasOwnProperty(key)) ? this[key] : null;
  16296. },
  16297. set: function(key, value){
  16298. if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
  16299. return this;
  16300. },
  16301. empty: function(){
  16302. Hash.each(this, function(value, key){
  16303. delete this[key];
  16304. }, this);
  16305. return this;
  16306. },
  16307. include: function(key, value){
  16308. if (this[key] == undefined) this[key] = value;
  16309. return this;
  16310. },
  16311. map: function(fn, bind){
  16312. return new Hash(Object.map(this, fn, bind));
  16313. },
  16314. filter: function(fn, bind){
  16315. return new Hash(Object.filter(this, fn, bind));
  16316. },
  16317. every: function(fn, bind){
  16318. return Object.every(this, fn, bind);
  16319. },
  16320. some: function(fn, bind){
  16321. return Object.some(this, fn, bind);
  16322. },
  16323. getKeys: function(){
  16324. return Object.keys(this);
  16325. },
  16326. getValues: function(){
  16327. return Object.values(this);
  16328. },
  16329. toQueryString: function(base){
  16330. return Object.toQueryString(this, base);
  16331. }
  16332. });
  16333. Hash.alias({indexOf: 'keyOf', contains: 'hasValue'});
  16334. })();
  16335. /*
  16336. ---
  16337. script: Hash.Extras.js
  16338. name: Hash.Extras
  16339. description: Extends the Hash Type to include getFromPath which allows a path notation to child elements.
  16340. license: MIT-style license
  16341. authors:
  16342. - Aaron Newton
  16343. requires:
  16344. - Hash
  16345. - Object.Extras
  16346. provides: [Hash.Extras]
  16347. ...
  16348. */
  16349. Hash.implement({
  16350. getFromPath: function(notation){
  16351. return Object.getFromPath(this, notation);
  16352. },
  16353. cleanValues: function(method){
  16354. return new Hash(Object.cleanValues(this, method));
  16355. },
  16356. run: function(){
  16357. Object.run(arguments);
  16358. }
  16359. });
  16360. /*
  16361. ---
  16362. name: Number.Format
  16363. description: Extends the Number Type object to include a number formatting method.
  16364. license: MIT-style license
  16365. authors: [Arian Stolwijk]
  16366. requires: [Core/Number, Locale.en-US.Number]
  16367. # Number.Extras is for compatibility
  16368. provides: [Number.Format, Number.Extras]
  16369. ...
  16370. */
  16371. Number.implement({
  16372. format: function(options){
  16373. // Thanks dojo and YUI for some inspiration
  16374. var value = this;
  16375. options = options ? Object.clone(options) : {};
  16376. var getOption = function(key){
  16377. if (options[key] != null) return options[key];
  16378. return Locale.get('Number.' + key);
  16379. };
  16380. var negative = value < 0,
  16381. decimal = getOption('decimal'),
  16382. precision = getOption('precision'),
  16383. group = getOption('group'),
  16384. decimals = getOption('decimals');
  16385. if (negative){
  16386. var negativeLocale = getOption('negative') || {};
  16387. if (negativeLocale.prefix == null && negativeLocale.suffix == null) negativeLocale.prefix = '-';
  16388. ['prefix', 'suffix'].each(function(key){
  16389. if (negativeLocale[key]) options[key] = getOption(key) + negativeLocale[key];
  16390. });
  16391. value = -value;
  16392. }
  16393. var prefix = getOption('prefix'),
  16394. suffix = getOption('suffix');
  16395. if (decimals !== '' && decimals >= 0 && decimals <= 20) value = value.toFixed(decimals);
  16396. if (precision >= 1 && precision <= 21) value = (+value).toPrecision(precision);
  16397. value += '';
  16398. var index;
  16399. if (getOption('scientific') === false && value.indexOf('e') > -1){
  16400. var match = value.split('e'),
  16401. zeros = +match[1];
  16402. value = match[0].replace('.', '');
  16403. if (zeros < 0){
  16404. zeros = -zeros - 1;
  16405. index = match[0].indexOf('.');
  16406. if (index > -1) zeros -= index - 1;
  16407. while (zeros--) value = '0' + value;
  16408. value = '0.' + value;
  16409. } else {
  16410. index = match[0].lastIndexOf('.');
  16411. if (index > -1) zeros -= match[0].length - index - 1;
  16412. while (zeros--) value += '0';
  16413. }
  16414. }
  16415. if (decimal != '.') value = value.replace('.', decimal);
  16416. if (group){
  16417. index = value.lastIndexOf(decimal);
  16418. index = (index > -1) ? index : value.length;
  16419. var newOutput = value.substring(index),
  16420. i = index;
  16421. while (i--){
  16422. if ((index - i - 1) % 3 == 0 && i != (index - 1)) newOutput = group + newOutput;
  16423. newOutput = value.charAt(i) + newOutput;
  16424. }
  16425. value = newOutput;
  16426. }
  16427. if (prefix) value = prefix + value;
  16428. if (suffix) value += suffix;
  16429. return value;
  16430. },
  16431. formatCurrency: function(decimals){
  16432. var locale = Locale.get('Number.currency') || {};
  16433. if (locale.scientific == null) locale.scientific = false;
  16434. locale.decimals = decimals != null ? decimals
  16435. : (locale.decimals == null ? 2 : locale.decimals);
  16436. return this.format(locale);
  16437. },
  16438. formatPercentage: function(decimals){
  16439. var locale = Locale.get('Number.percentage') || {};
  16440. if (locale.suffix == null) locale.suffix = '%';
  16441. locale.decimals = decimals != null ? decimals
  16442. : (locale.decimals == null ? 2 : locale.decimals);
  16443. return this.format(locale);
  16444. }
  16445. });
  16446. /*
  16447. ---
  16448. script: URI.js
  16449. name: URI
  16450. description: Provides methods useful in managing the window location and uris.
  16451. license: MIT-style license
  16452. authors:
  16453. - Sebastian Markbåge
  16454. - Aaron Newton
  16455. requires:
  16456. - Core/Object
  16457. - Core/Class
  16458. - Core/Class.Extras
  16459. - Core/Element
  16460. - String.QueryString
  16461. provides: [URI]
  16462. ...
  16463. */
  16464. (function(){
  16465. var toString = function(){
  16466. return this.get('value');
  16467. };
  16468. var URI = this.URI = new Class({
  16469. Implements: Options,
  16470. options: {
  16471. /*base: false*/
  16472. },
  16473. regex: /^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[A-Fa-f0-9:]+\]|[^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,
  16474. parts: ['scheme', 'user', 'password', 'host', 'port', 'directory', 'file', 'query', 'fragment'],
  16475. schemes: {http: 80, https: 443, ftp: 21, rtsp: 554, mms: 1755, file: 0},
  16476. initialize: function(uri, options){
  16477. this.setOptions(options);
  16478. var base = this.options.base || URI.base;
  16479. if (!uri) uri = base;
  16480. if (uri && uri.parsed) this.parsed = Object.clone(uri.parsed);
  16481. else this.set('value', uri.href || uri.toString(), base ? new URI(base) : false);
  16482. },
  16483. parse: function(value, base){
  16484. var bits = value.match(this.regex);
  16485. if (!bits) return false;
  16486. bits.shift();
  16487. return this.merge(bits.associate(this.parts), base);
  16488. },
  16489. merge: function(bits, base){
  16490. if ((!bits || !bits.scheme) && (!base || !base.scheme)) return false;
  16491. if (base){
  16492. this.parts.every(function(part){
  16493. if (bits[part]) return false;
  16494. bits[part] = base[part] || '';
  16495. return true;
  16496. });
  16497. }
  16498. bits.port = bits.port || this.schemes[bits.scheme.toLowerCase()];
  16499. bits.directory = bits.directory ? this.parseDirectory(bits.directory, base ? base.directory : '') : '/';
  16500. return bits;
  16501. },
  16502. parseDirectory: function(directory, baseDirectory){
  16503. directory = (directory.substr(0, 1) == '/' ? '' : (baseDirectory || '/')) + directory;
  16504. if (!directory.test(URI.regs.directoryDot)) return directory;
  16505. var result = [];
  16506. directory.replace(URI.regs.endSlash, '').split('/').each(function(dir){
  16507. if (dir == '..' && result.length > 0) result.pop();
  16508. else if (dir != '.') result.push(dir);
  16509. });
  16510. return result.join('/') + '/';
  16511. },
  16512. combine: function(bits){
  16513. return bits.value || bits.scheme + '://' +
  16514. (bits.user ? bits.user + (bits.password ? ':' + bits.password : '') + '@' : '') +
  16515. (bits.host || '') + (bits.port && bits.port != this.schemes[bits.scheme] ? ':' + bits.port : '') +
  16516. (bits.directory || '/') + (bits.file || '') +
  16517. (bits.query ? '?' + bits.query : '') +
  16518. (bits.fragment ? '#' + bits.fragment : '');
  16519. },
  16520. set: function(part, value, base){
  16521. if (part == 'value'){
  16522. var scheme = value.match(URI.regs.scheme);
  16523. if (scheme) scheme = scheme[1];
  16524. if (scheme && this.schemes[scheme.toLowerCase()] == null) this.parsed = { scheme: scheme, value: value };
  16525. else this.parsed = this.parse(value, (base || this).parsed) || (scheme ? { scheme: scheme, value: value } : { value: value });
  16526. } else if (part == 'data'){
  16527. this.setData(value);
  16528. } else {
  16529. this.parsed[part] = value;
  16530. }
  16531. return this;
  16532. },
  16533. get: function(part, base){
  16534. switch (part){
  16535. case 'value': return this.combine(this.parsed, base ? base.parsed : false);
  16536. case 'data' : return this.getData();
  16537. }
  16538. return this.parsed[part] || '';
  16539. },
  16540. go: function(){
  16541. document.location.href = this.toString();
  16542. },
  16543. toURI: function(){
  16544. return this;
  16545. },
  16546. getData: function(key, part){
  16547. var qs = this.get(part || 'query');
  16548. if (!(qs || qs === 0)) return key ? null : {};
  16549. var obj = qs.parseQueryString();
  16550. return key ? obj[key] : obj;
  16551. },
  16552. setData: function(values, merge, part){
  16553. if (typeof values == 'string'){
  16554. var data = this.getData();
  16555. data[arguments[0]] = arguments[1];
  16556. values = data;
  16557. } else if (merge){
  16558. values = Object.merge(this.getData(null, part), values);
  16559. }
  16560. return this.set(part || 'query', Object.toQueryString(values));
  16561. },
  16562. clearData: function(part){
  16563. return this.set(part || 'query', '');
  16564. },
  16565. toString: toString,
  16566. valueOf: toString
  16567. });
  16568. URI.regs = {
  16569. endSlash: /\/$/,
  16570. scheme: /^(\w+):/,
  16571. directoryDot: /\.\/|\.$/
  16572. };
  16573. URI.base = new URI(Array.convert(document.getElements('base[href]', true)).getLast(), {base: document.location});
  16574. String.implement({
  16575. toURI: function(options){
  16576. return new URI(this, options);
  16577. }
  16578. });
  16579. })();
  16580. /*
  16581. ---
  16582. script: URI.Relative.js
  16583. name: URI.Relative
  16584. description: Extends the URI class to add methods for computing relative and absolute urls.
  16585. license: MIT-style license
  16586. authors:
  16587. - Sebastian Markbåge
  16588. requires:
  16589. - Class.refactor
  16590. - URI
  16591. provides: [URI.Relative]
  16592. ...
  16593. */
  16594. URI = Class.refactor(URI, {
  16595. combine: function(bits, base){
  16596. if (!base || bits.scheme != base.scheme || bits.host != base.host || bits.port != base.port)
  16597. return this.previous.apply(this, arguments);
  16598. var end = bits.file + (bits.query ? '?' + bits.query : '') + (bits.fragment ? '#' + bits.fragment : '');
  16599. if (!base.directory) return (bits.directory || (bits.file ? '' : './')) + end;
  16600. var baseDir = base.directory.split('/'),
  16601. relDir = bits.directory.split('/'),
  16602. path = '',
  16603. offset;
  16604. var i = 0;
  16605. for (offset = 0; offset < baseDir.length && offset < relDir.length && baseDir[offset] == relDir[offset]; offset++);
  16606. for (i = 0; i < baseDir.length - offset - 1; i++) path += '../';
  16607. for (i = offset; i < relDir.length - 1; i++) path += relDir[i] + '/';
  16608. return (path || (bits.file ? '' : './')) + end;
  16609. },
  16610. toAbsolute: function(base){
  16611. base = new URI(base);
  16612. if (base) base.set('directory', '').set('file', '');
  16613. return this.toRelative(base);
  16614. },
  16615. toRelative: function(base){
  16616. return this.get('value', new URI(base));
  16617. }
  16618. });
  16619. /*
  16620. ---
  16621. script: Assets.js
  16622. name: Assets
  16623. description: Provides methods to dynamically load JavaScript, CSS, and Image files into the document.
  16624. license: MIT-style license
  16625. authors:
  16626. - Valerio Proietti
  16627. requires:
  16628. - Core/Element.Event
  16629. - MooTools.More
  16630. provides: [Assets, Asset.javascript, Asset.css, Asset.image, Asset.images]
  16631. ...
  16632. */
  16633. ;(function(){
  16634. var Asset = this.Asset = {
  16635. javascript: function(source, properties){
  16636. if (!properties) properties = {};
  16637. var script = new Element('script', {src: source, type: 'text/javascript'}),
  16638. doc = properties.document || document,
  16639. load = properties.onload || properties.onLoad;
  16640. delete properties.onload;
  16641. delete properties.onLoad;
  16642. delete properties.document;
  16643. if (load){
  16644. if (!script.addEventListener){
  16645. script.addEvent('readystatechange', function(){
  16646. if (['loaded', 'complete'].contains(this.readyState)) load.call(this);
  16647. });
  16648. } else {
  16649. script.addEvent('load', load);
  16650. }
  16651. }
  16652. return script.set(properties).inject(doc.head);
  16653. },
  16654. css: function(source, properties){
  16655. if (!properties) properties = {};
  16656. var load = properties.onload || properties.onLoad,
  16657. doc = properties.document || document,
  16658. timeout = properties.timeout || 3000;
  16659. ['onload', 'onLoad', 'document'].each(function(prop){
  16660. delete properties[prop];
  16661. });
  16662. var link = new Element('link', {
  16663. type: 'text/css',
  16664. rel: 'stylesheet',
  16665. media: 'screen',
  16666. href: source
  16667. }).setProperties(properties).inject(doc.head);
  16668. if (load){
  16669. // based on article at http://www.yearofmoo.com/2011/03/cross-browser-stylesheet-preloading.html
  16670. var loaded = false, retries = 0;
  16671. var check = function(){
  16672. var stylesheets = document.styleSheets;
  16673. for (var i = 0; i < stylesheets.length; i++){
  16674. var file = stylesheets[i];
  16675. var owner = file.ownerNode ? file.ownerNode : file.owningElement;
  16676. if (owner && owner == link){
  16677. loaded = true;
  16678. return load.call(link);
  16679. }
  16680. }
  16681. retries++;
  16682. if (!loaded && retries < timeout / 50) return setTimeout(check, 50);
  16683. };
  16684. setTimeout(check, 0);
  16685. }
  16686. return link;
  16687. },
  16688. image: function(source, properties){
  16689. if (!properties) properties = {};
  16690. var image = new Image(),
  16691. element = document.id(image) || new Element('img');
  16692. ['load', 'abort', 'error'].each(function(name){
  16693. var type = 'on' + name,
  16694. cap = 'on' + name.capitalize(),
  16695. event = properties[type] || properties[cap] || function(){};
  16696. delete properties[cap];
  16697. delete properties[type];
  16698. image[type] = function(){
  16699. if (!image) return;
  16700. if (!element.parentNode){
  16701. element.width = image.width;
  16702. element.height = image.height;
  16703. }
  16704. image = image.onload = image.onabort = image.onerror = null;
  16705. event.delay(1, element, element);
  16706. element.fireEvent(name, element, 1);
  16707. };
  16708. });
  16709. image.src = element.src = source;
  16710. if (image && image.complete) image.onload.delay(1);
  16711. return element.set(properties);
  16712. },
  16713. images: function(sources, options){
  16714. sources = Array.convert(sources);
  16715. var fn = function(){},
  16716. counter = 0;
  16717. options = Object.merge({
  16718. onComplete: fn,
  16719. onProgress: fn,
  16720. onError: fn,
  16721. properties: {}
  16722. }, options);
  16723. return new Elements(sources.map(function(source, index){
  16724. return Asset.image(source, Object.append(options.properties, {
  16725. onload: function(){
  16726. counter++;
  16727. options.onProgress.call(this, counter, index, source);
  16728. if (counter == sources.length) options.onComplete();
  16729. },
  16730. onerror: function(){
  16731. counter++;
  16732. options.onError.call(this, counter, index, source);
  16733. if (counter == sources.length) options.onComplete();
  16734. }
  16735. }));
  16736. }));
  16737. }
  16738. };
  16739. })();
  16740. /*
  16741. ---
  16742. script: Color.js
  16743. name: Color
  16744. description: Class for creating and manipulating colors in JavaScript. Supports HSB -> RGB Conversions and vice versa.
  16745. license: MIT-style license
  16746. authors:
  16747. - Valerio Proietti
  16748. requires:
  16749. - Core/Array
  16750. - Core/String
  16751. - Core/Number
  16752. - Core/Hash
  16753. - Core/Function
  16754. - MooTools.More
  16755. provides: [Color]
  16756. ...
  16757. */
  16758. (function(){
  16759. var Color = this.Color = new Type('Color', function(color, type){
  16760. if (arguments.length >= 3){
  16761. type = 'rgb'; color = Array.slice(arguments, 0, 3);
  16762. } else if (typeof color == 'string'){
  16763. if (color.match(/rgb/)) color = color.rgbToHex().hexToRgb(true);
  16764. else if (color.match(/hsb/)) color = color.hsbToRgb();
  16765. else color = color.hexToRgb(true);
  16766. }
  16767. type = type || 'rgb';
  16768. switch (type){
  16769. case 'hsb':
  16770. var old = color;
  16771. color = color.hsbToRgb();
  16772. color.hsb = old;
  16773. break;
  16774. case 'hex': color = color.hexToRgb(true); break;
  16775. }
  16776. color.rgb = color.slice(0, 3);
  16777. color.hsb = color.hsb || color.rgbToHsb();
  16778. color.hex = color.rgbToHex();
  16779. return Object.append(color, this);
  16780. });
  16781. Color.implement({
  16782. mix: function(){
  16783. var colors = Array.slice(arguments);
  16784. var alpha = (typeOf(colors.getLast()) == 'number') ? colors.pop() : 50;
  16785. var rgb = this.slice();
  16786. colors.each(function(color){
  16787. color = new Color(color);
  16788. for (var i = 0; i < 3; i++) rgb[i] = Math.round((rgb[i] / 100 * (100 - alpha)) + (color[i] / 100 * alpha));
  16789. });
  16790. return new Color(rgb, 'rgb');
  16791. },
  16792. invert: function(){
  16793. return new Color(this.map(function(value){
  16794. return 255 - value;
  16795. }));
  16796. },
  16797. setHue: function(value){
  16798. return new Color([value, this.hsb[1], this.hsb[2]], 'hsb');
  16799. },
  16800. setSaturation: function(percent){
  16801. return new Color([this.hsb[0], percent, this.hsb[2]], 'hsb');
  16802. },
  16803. setBrightness: function(percent){
  16804. return new Color([this.hsb[0], this.hsb[1], percent], 'hsb');
  16805. }
  16806. });
  16807. this.$RGB = function(r, g, b){
  16808. return new Color([r, g, b], 'rgb');
  16809. };
  16810. this.$HSB = function(h, s, b){
  16811. return new Color([h, s, b], 'hsb');
  16812. };
  16813. this.$HEX = function(hex){
  16814. return new Color(hex, 'hex');
  16815. };
  16816. Array.implement({
  16817. rgbToHsb: function(){
  16818. var red = this[0],
  16819. green = this[1],
  16820. blue = this[2],
  16821. hue = 0,
  16822. max = Math.max(red, green, blue),
  16823. min = Math.min(red, green, blue),
  16824. delta = max - min,
  16825. brightness = max / 255,
  16826. saturation = (max != 0) ? delta / max : 0;
  16827. if (saturation != 0){
  16828. var rr = (max - red) / delta;
  16829. var gr = (max - green) / delta;
  16830. var br = (max - blue) / delta;
  16831. if (red == max) hue = br - gr;
  16832. else if (green == max) hue = 2 + rr - br;
  16833. else hue = 4 + gr - rr;
  16834. hue /= 6;
  16835. if (hue < 0) hue++;
  16836. }
  16837. return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)];
  16838. },
  16839. hsbToRgb: function(){
  16840. var br = Math.round(this[2] / 100 * 255);
  16841. if (this[1] == 0){
  16842. return [br, br, br];
  16843. } else {
  16844. var hue = this[0] % 360;
  16845. var f = hue % 60;
  16846. var p = Math.round((this[2] * (100 - this[1])) / 10000 * 255);
  16847. var q = Math.round((this[2] * (6000 - this[1] * f)) / 600000 * 255);
  16848. var t = Math.round((this[2] * (6000 - this[1] * (60 - f))) / 600000 * 255);
  16849. switch (Math.floor(hue / 60)){
  16850. case 0: return [br, t, p];
  16851. case 1: return [q, br, p];
  16852. case 2: return [p, br, t];
  16853. case 3: return [p, q, br];
  16854. case 4: return [t, p, br];
  16855. case 5: return [br, p, q];
  16856. }
  16857. }
  16858. return false;
  16859. }
  16860. });
  16861. String.implement({
  16862. rgbToHsb: function(){
  16863. var rgb = this.match(/\d{1,3}/g);
  16864. return (rgb) ? rgb.rgbToHsb() : null;
  16865. },
  16866. hsbToRgb: function(){
  16867. var hsb = this.match(/\d{1,3}/g);
  16868. return (hsb) ? hsb.hsbToRgb() : null;
  16869. }
  16870. });
  16871. })();
  16872. /*
  16873. ---
  16874. script: Group.js
  16875. name: Group
  16876. description: Class for monitoring collections of events
  16877. license: MIT-style license
  16878. authors:
  16879. - Valerio Proietti
  16880. requires:
  16881. - Core/Events
  16882. - MooTools.More
  16883. provides: [Group]
  16884. ...
  16885. */
  16886. (function(){
  16887. var Group = this.Group = new Class({
  16888. initialize: function(){
  16889. this.instances = Array.flatten(arguments);
  16890. },
  16891. addEvent: function(type, fn){
  16892. var instances = this.instances,
  16893. len = instances.length,
  16894. togo = len,
  16895. args = new Array(len),
  16896. self = this;
  16897. instances.each(function(instance, i){
  16898. instance.addEvent(type, function(){
  16899. if (!args[i]) togo--;
  16900. args[i] = arguments;
  16901. if (!togo){
  16902. fn.call(self, instances, instance, args);
  16903. togo = len;
  16904. args = new Array(len);
  16905. }
  16906. });
  16907. });
  16908. }
  16909. });
  16910. })();
  16911. /*
  16912. ---
  16913. script: Hash.Cookie.js
  16914. name: Hash.Cookie
  16915. description: Class for creating, reading, and deleting Cookies in JSON format.
  16916. license: MIT-style license
  16917. authors:
  16918. - Valerio Proietti
  16919. - Aaron Newton
  16920. requires:
  16921. - Core/Cookie
  16922. - Core/JSON
  16923. - MooTools.More
  16924. - Hash
  16925. provides: [Hash.Cookie]
  16926. ...
  16927. */
  16928. Hash.Cookie = new Class({
  16929. Extends: Cookie,
  16930. options: {
  16931. autoSave: true
  16932. },
  16933. initialize: function(name, options){
  16934. this.parent(name, options);
  16935. this.load();
  16936. },
  16937. save: function(){
  16938. var value = JSON.encode(this.hash);
  16939. if (!value || value.length > 4096) return false; //cookie would be truncated!
  16940. if (value == '{}') this.dispose();
  16941. else this.write(value);
  16942. return true;
  16943. },
  16944. load: function(){
  16945. this.hash = new Hash(JSON.decode(this.read(), true));
  16946. return this;
  16947. }
  16948. });
  16949. Hash.each(Hash.prototype, function(method, name){
  16950. if (typeof method == 'function') Hash.Cookie.implement(name, function(){
  16951. var value = method.apply(this.hash, arguments);
  16952. if (this.options.autoSave) this.save();
  16953. return value;
  16954. });
  16955. });
  16956. /*
  16957. ---
  16958. name: Swiff
  16959. description: Wrapper for embedding SWF movies. Supports External Interface Communication.
  16960. license: MIT-style license.
  16961. credits:
  16962. - Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject.
  16963. requires: [Core/Options, Core/Object, Core/Element]
  16964. provides: Swiff
  16965. ...
  16966. */
  16967. (function(){
  16968. var Swiff = this.Swiff = new Class({
  16969. Implements: Options,
  16970. options: {
  16971. id: null,
  16972. height: 1,
  16973. width: 1,
  16974. container: null,
  16975. properties: {},
  16976. params: {
  16977. quality: 'high',
  16978. allowScriptAccess: 'always',
  16979. wMode: 'window',
  16980. swLiveConnect: true
  16981. },
  16982. callBacks: {},
  16983. vars: {}
  16984. },
  16985. toElement: function(){
  16986. return this.object;
  16987. },
  16988. initialize: function(path, options){
  16989. this.instance = 'Swiff_' + String.uniqueID();
  16990. this.setOptions(options);
  16991. options = this.options;
  16992. var id = this.id = options.id || this.instance;
  16993. var container = document.id(options.container);
  16994. Swiff.CallBacks[this.instance] = {};
  16995. var params = options.params, vars = options.vars, callBacks = options.callBacks;
  16996. var properties = Object.append({height: options.height, width: options.width}, options.properties);
  16997. var self = this;
  16998. for (var callBack in callBacks){
  16999. Swiff.CallBacks[this.instance][callBack] = (function(option){
  17000. return function(){
  17001. return option.apply(self.object, arguments);
  17002. };
  17003. })(callBacks[callBack]);
  17004. vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack;
  17005. }
  17006. params.flashVars = Object.toQueryString(vars);
  17007. if ('ActiveXObject' in window){
  17008. properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
  17009. params.movie = path;
  17010. } else {
  17011. properties.type = 'application/x-shockwave-flash';
  17012. }
  17013. properties.data = path;
  17014. var build = '<object id="' + id + '"';
  17015. for (var property in properties) build += ' ' + property + '="' + properties[property] + '"';
  17016. build += '>';
  17017. for (var param in params){
  17018. if (params[param]) build += '<param name="' + param + '" value="' + params[param] + '" />';
  17019. }
  17020. build += '</object>';
  17021. this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild;
  17022. },
  17023. replaces: function(element){
  17024. element = document.id(element, true);
  17025. element.parentNode.replaceChild(this.toElement(), element);
  17026. return this;
  17027. },
  17028. inject: function(element){
  17029. document.id(element, true).appendChild(this.toElement());
  17030. return this;
  17031. },
  17032. remote: function(){
  17033. return Swiff.remote.apply(Swiff, [this.toElement()].append(arguments));
  17034. }
  17035. });
  17036. Swiff.CallBacks = {};
  17037. Swiff.remote = function(obj, fn){
  17038. var rs = obj.CallFunction('<invoke name="' + fn + '" returntype="javascript">' + __flash__argumentsToXML(arguments, 2) + '</invoke>');
  17039. return eval(rs);
  17040. };
  17041. })();
  17042. /*
  17043. ---
  17044. name: Table
  17045. description: LUA-Style table implementation.
  17046. license: MIT-style license
  17047. authors:
  17048. - Valerio Proietti
  17049. requires: [Core/Array]
  17050. provides: [Table]
  17051. ...
  17052. */
  17053. (function(){
  17054. var Table = this.Table = function(){
  17055. this.length = 0;
  17056. var keys = [],
  17057. values = [];
  17058. this.set = function(key, value){
  17059. var index = keys.indexOf(key);
  17060. if (index == -1){
  17061. var length = keys.length;
  17062. keys[length] = key;
  17063. values[length] = value;
  17064. this.length++;
  17065. } else {
  17066. values[index] = value;
  17067. }
  17068. return this;
  17069. };
  17070. this.get = function(key){
  17071. var index = keys.indexOf(key);
  17072. return (index == -1) ? null : values[index];
  17073. };
  17074. this.erase = function(key){
  17075. var index = keys.indexOf(key);
  17076. if (index != -1){
  17077. this.length--;
  17078. keys.splice(index, 1);
  17079. return values.splice(index, 1)[0];
  17080. }
  17081. return null;
  17082. };
  17083. this.each = this.forEach = function(fn, bind){
  17084. for (var i = 0, l = this.length; i < l; i++) fn.call(bind, keys[i], values[i], this);
  17085. };
  17086. };
  17087. if (this.Type) new Type('Table', Table);
  17088. })();