mootools-1.6.0_all.js 550 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711
  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. 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. document.head.appendChild(script);
  900. document.head.removeChild(script);
  901. }
  902. return text;
  903. };
  904. String.implement('stripScripts', function(exec){
  905. var scripts = '';
  906. var text = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(all, code){
  907. scripts += code + '\n';
  908. return '';
  909. });
  910. if (exec === true) Browser.exec(scripts);
  911. else if (typeOf(exec) == 'function') exec(scripts, text);
  912. return text;
  913. });
  914. // Window, Document
  915. Browser.extend({
  916. Document: this.Document,
  917. Window: this.Window,
  918. Element: this.Element,
  919. Event: this.Event
  920. });
  921. this.Window = this.$constructor = new Type('Window', function(){});
  922. this.$family = Function.convert('window').hide();
  923. Window.mirror(function(name, method){
  924. window[name] = method;
  925. });
  926. this.Document = document.$constructor = new Type('Document', function(){});
  927. document.$family = Function.convert('document').hide();
  928. Document.mirror(function(name, method){
  929. document[name] = method;
  930. });
  931. document.html = document.documentElement;
  932. if (!document.head) document.head = document.getElementsByTagName('head')[0];
  933. if (document.execCommand) try {
  934. document.execCommand('BackgroundImageCache', false, true);
  935. } catch (e){}
  936. /*<ltIE9>*/
  937. if (this.attachEvent && !this.addEventListener){
  938. var unloadEvent = function(){
  939. this.detachEvent('onunload', unloadEvent);
  940. document.head = document.html = document.window = null;
  941. window = this.Window = document = null;
  942. };
  943. this.attachEvent('onunload', unloadEvent);
  944. }
  945. // IE fails on collections and <select>.options (refers to <select>)
  946. var arrayFrom = Array.convert;
  947. try {
  948. arrayFrom(document.html.childNodes);
  949. } catch (e){
  950. Array.convert = function(item){
  951. if (typeof item != 'string' && Type.isEnumerable(item) && typeOf(item) != 'array'){
  952. var i = item.length, array = new Array(i);
  953. while (i--) array[i] = item[i];
  954. return array;
  955. }
  956. return arrayFrom(item);
  957. };
  958. var prototype = Array.prototype,
  959. slice = prototype.slice;
  960. ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice'].each(function(name){
  961. var method = prototype[name];
  962. Array[name] = function(item){
  963. return method.apply(Array.convert(item), slice.call(arguments, 1));
  964. };
  965. });
  966. }
  967. /*</ltIE9>*/
  968. //<1.2compat>
  969. if (Browser.Platform.ios) Browser.Platform.ipod = true;
  970. Browser.Engine = {};
  971. var setEngine = function(name, version){
  972. Browser.Engine.name = name;
  973. Browser.Engine[name + version] = true;
  974. Browser.Engine.version = version;
  975. };
  976. if (Browser.ie){
  977. Browser.Engine.trident = true;
  978. switch (Browser.version){
  979. case 6: setEngine('trident', 4); break;
  980. case 7: setEngine('trident', 5); break;
  981. case 8: setEngine('trident', 6);
  982. }
  983. }
  984. if (Browser.firefox){
  985. Browser.Engine.gecko = true;
  986. if (Browser.version >= 3) setEngine('gecko', 19);
  987. else setEngine('gecko', 18);
  988. }
  989. if (Browser.safari || Browser.chrome){
  990. Browser.Engine.webkit = true;
  991. switch (Browser.version){
  992. case 2: setEngine('webkit', 419); break;
  993. case 3: setEngine('webkit', 420); break;
  994. case 4: setEngine('webkit', 525);
  995. }
  996. }
  997. if (Browser.opera){
  998. Browser.Engine.presto = true;
  999. if (Browser.version >= 9.6) setEngine('presto', 960);
  1000. else if (Browser.version >= 9.5) setEngine('presto', 950);
  1001. else setEngine('presto', 925);
  1002. }
  1003. if (Browser.name == 'unknown'){
  1004. switch ((navigator.userAgent.toLowerCase().match(/(?:webkit|khtml|gecko)/) || [])[0]){
  1005. case 'webkit':
  1006. case 'khtml':
  1007. Browser.Engine.webkit = true;
  1008. break;
  1009. case 'gecko':
  1010. Browser.Engine.gecko = true;
  1011. }
  1012. }
  1013. this.$exec = Browser.exec;
  1014. //</1.2compat>
  1015. })();
  1016. /*
  1017. ---
  1018. name: Class
  1019. description: Contains the Class Function for easily creating, extending, and implementing reusable Classes.
  1020. license: MIT-style license.
  1021. requires: [Array, String, Function, Number]
  1022. provides: Class
  1023. ...
  1024. */
  1025. (function(){
  1026. var Class = this.Class = new Type('Class', function(params){
  1027. if (instanceOf(params, Function)) params = {initialize: params};
  1028. var newClass = function(){
  1029. reset(this);
  1030. if (newClass.$prototyping) return this;
  1031. this.$caller = null;
  1032. this.$family = null;
  1033. var value = (this.initialize) ? this.initialize.apply(this, arguments) : this;
  1034. this.$caller = this.caller = null;
  1035. return value;
  1036. }.extend(this).implement(params);
  1037. newClass.$constructor = Class;
  1038. newClass.prototype.$constructor = newClass;
  1039. newClass.prototype.parent = parent;
  1040. return newClass;
  1041. });
  1042. var parent = function(){
  1043. if (!this.$caller) throw new Error('The method "parent" cannot be called.');
  1044. var name = this.$caller.$name,
  1045. parent = this.$caller.$owner.parent,
  1046. previous = (parent) ? parent.prototype[name] : null;
  1047. if (!previous) throw new Error('The method "' + name + '" has no parent.');
  1048. return previous.apply(this, arguments);
  1049. };
  1050. var reset = function(object){
  1051. for (var key in object){
  1052. var value = object[key];
  1053. switch (typeOf(value)){
  1054. case 'object':
  1055. var F = function(){};
  1056. F.prototype = value;
  1057. object[key] = reset(new F);
  1058. break;
  1059. case 'array': object[key] = value.clone(); break;
  1060. }
  1061. }
  1062. return object;
  1063. };
  1064. var wrap = function(self, key, method){
  1065. if (method.$origin) method = method.$origin;
  1066. var wrapper = function(){
  1067. if (method.$protected && this.$caller == null) throw new Error('The method "' + key + '" cannot be called.');
  1068. var caller = this.caller, current = this.$caller;
  1069. this.caller = current; this.$caller = wrapper;
  1070. var result = method.apply(this, arguments);
  1071. this.$caller = current; this.caller = caller;
  1072. return result;
  1073. }.extend({$owner: self, $origin: method, $name: key});
  1074. return wrapper;
  1075. };
  1076. var implement = function(key, value, retain){
  1077. if (Class.Mutators.hasOwnProperty(key)){
  1078. value = Class.Mutators[key].call(this, value);
  1079. if (value == null) return this;
  1080. }
  1081. if (typeOf(value) == 'function'){
  1082. if (value.$hidden) return this;
  1083. this.prototype[key] = (retain) ? value : wrap(this, key, value);
  1084. } else {
  1085. Object.merge(this.prototype, key, value);
  1086. }
  1087. return this;
  1088. };
  1089. var getInstance = function(klass){
  1090. klass.$prototyping = true;
  1091. var proto = new klass;
  1092. delete klass.$prototyping;
  1093. return proto;
  1094. };
  1095. Class.implement('implement', implement.overloadSetter());
  1096. Class.Mutators = {
  1097. Extends: function(parent){
  1098. this.parent = parent;
  1099. this.prototype = getInstance(parent);
  1100. },
  1101. Implements: function(items){
  1102. Array.convert(items).each(function(item){
  1103. var instance = new item;
  1104. for (var key in instance) implement.call(this, key, instance[key], true);
  1105. }, this);
  1106. }
  1107. };
  1108. })();
  1109. /*
  1110. ---
  1111. name: Class.Extras
  1112. description: Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks.
  1113. license: MIT-style license.
  1114. requires: Class
  1115. provides: [Class.Extras, Chain, Events, Options]
  1116. ...
  1117. */
  1118. (function(){
  1119. this.Chain = new Class({
  1120. $chain: [],
  1121. chain: function(){
  1122. this.$chain.append(Array.flatten(arguments));
  1123. return this;
  1124. },
  1125. callChain: function(){
  1126. return (this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false;
  1127. },
  1128. clearChain: function(){
  1129. this.$chain.empty();
  1130. return this;
  1131. }
  1132. });
  1133. var removeOn = function(string){
  1134. return string.replace(/^on([A-Z])/, function(full, first){
  1135. return first.toLowerCase();
  1136. });
  1137. };
  1138. this.Events = new Class({
  1139. $events: {},
  1140. addEvent: function(type, fn, internal){
  1141. type = removeOn(type);
  1142. /*<1.2compat>*/
  1143. if (fn == $empty) return this;
  1144. /*</1.2compat>*/
  1145. this.$events[type] = (this.$events[type] || []).include(fn);
  1146. if (internal) fn.internal = true;
  1147. return this;
  1148. },
  1149. addEvents: function(events){
  1150. for (var type in events) this.addEvent(type, events[type]);
  1151. return this;
  1152. },
  1153. fireEvent: function(type, args, delay){
  1154. type = removeOn(type);
  1155. var events = this.$events[type];
  1156. if (!events) return this;
  1157. args = Array.convert(args);
  1158. events.each(function(fn){
  1159. if (delay) fn.delay(delay, this, args);
  1160. else fn.apply(this, args);
  1161. }, this);
  1162. return this;
  1163. },
  1164. removeEvent: function(type, fn){
  1165. type = removeOn(type);
  1166. var events = this.$events[type];
  1167. if (events && !fn.internal){
  1168. var index = events.indexOf(fn);
  1169. if (index != -1) delete events[index];
  1170. }
  1171. return this;
  1172. },
  1173. removeEvents: function(events){
  1174. var type;
  1175. if (typeOf(events) == 'object'){
  1176. for (type in events) this.removeEvent(type, events[type]);
  1177. return this;
  1178. }
  1179. if (events) events = removeOn(events);
  1180. for (type in this.$events){
  1181. if (events && events != type) continue;
  1182. var fns = this.$events[type];
  1183. for (var i = fns.length; i--;) if (i in fns){
  1184. this.removeEvent(type, fns[i]);
  1185. }
  1186. }
  1187. return this;
  1188. }
  1189. });
  1190. this.Options = new Class({
  1191. setOptions: function(){
  1192. var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments));
  1193. if (this.addEvent) for (var option in options){
  1194. if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue;
  1195. this.addEvent(option, options[option]);
  1196. delete options[option];
  1197. }
  1198. return this;
  1199. }
  1200. });
  1201. })();
  1202. /*
  1203. ---
  1204. name: Class.Thenable
  1205. description: Contains a Utility Class that can be implemented into your own Classes to make them "thenable".
  1206. license: MIT-style license.
  1207. requires: Class
  1208. provides: [Class.Thenable]
  1209. ...
  1210. */
  1211. (function(){
  1212. var STATE_PENDING = 0,
  1213. STATE_FULFILLED = 1,
  1214. STATE_REJECTED = 2;
  1215. var Thenable = Class.Thenable = new Class({
  1216. $thenableState: STATE_PENDING,
  1217. $thenableResult: null,
  1218. $thenableReactions: [],
  1219. resolve: function(value){
  1220. resolve(this, value);
  1221. return this;
  1222. },
  1223. reject: function(reason){
  1224. reject(this, reason);
  1225. return this;
  1226. },
  1227. getThenableState: function(){
  1228. switch (this.$thenableState){
  1229. case STATE_PENDING:
  1230. return 'pending';
  1231. case STATE_FULFILLED:
  1232. return 'fulfilled';
  1233. case STATE_REJECTED:
  1234. return 'rejected';
  1235. }
  1236. },
  1237. resetThenable: function(reason){
  1238. reject(this, reason);
  1239. reset(this);
  1240. return this;
  1241. },
  1242. then: function(onFulfilled, onRejected){
  1243. if (typeof onFulfilled !== 'function') onFulfilled = 'Identity';
  1244. if (typeof onRejected !== 'function') onRejected = 'Thrower';
  1245. var thenable = new Thenable();
  1246. this.$thenableReactions.push({
  1247. thenable: thenable,
  1248. fulfillHandler: onFulfilled,
  1249. rejectHandler: onRejected
  1250. });
  1251. if (this.$thenableState !== STATE_PENDING){
  1252. react(this);
  1253. }
  1254. return thenable;
  1255. },
  1256. 'catch': function(onRejected){
  1257. return this.then(null, onRejected);
  1258. }
  1259. });
  1260. Thenable.extend({
  1261. resolve: function(value){
  1262. var thenable;
  1263. if (value instanceof Thenable){
  1264. thenable = value;
  1265. } else {
  1266. thenable = new Thenable();
  1267. resolve(thenable, value);
  1268. }
  1269. return thenable;
  1270. },
  1271. reject: function(reason){
  1272. var thenable = new Thenable();
  1273. reject(thenable, reason);
  1274. return thenable;
  1275. }
  1276. });
  1277. // Private functions
  1278. function resolve(thenable, value){
  1279. if (thenable.$thenableState === STATE_PENDING){
  1280. if (thenable === value){
  1281. reject(thenable, new TypeError('Tried to resolve a thenable with itself.'));
  1282. } else if (value && (typeof value === 'object' || typeof value === 'function')){
  1283. var then;
  1284. try {
  1285. then = value.then;
  1286. } catch (exception){
  1287. reject(thenable, exception);
  1288. }
  1289. if (typeof then === 'function'){
  1290. var resolved = false;
  1291. defer(function(){
  1292. try {
  1293. then.call(
  1294. value,
  1295. function(nextValue){
  1296. if (!resolved){
  1297. resolved = true;
  1298. resolve(thenable, nextValue);
  1299. }
  1300. },
  1301. function(reason){
  1302. if (!resolved){
  1303. resolved = true;
  1304. reject(thenable, reason);
  1305. }
  1306. }
  1307. );
  1308. } catch (exception){
  1309. if (!resolved){
  1310. resolved = true;
  1311. reject(thenable, exception);
  1312. }
  1313. }
  1314. });
  1315. } else {
  1316. fulfill(thenable, value);
  1317. }
  1318. } else {
  1319. fulfill(thenable, value);
  1320. }
  1321. }
  1322. }
  1323. function fulfill(thenable, value){
  1324. if (thenable.$thenableState === STATE_PENDING){
  1325. thenable.$thenableResult = value;
  1326. thenable.$thenableState = STATE_FULFILLED;
  1327. react(thenable);
  1328. }
  1329. }
  1330. function reject(thenable, reason){
  1331. if (thenable.$thenableState === STATE_PENDING){
  1332. thenable.$thenableResult = reason;
  1333. thenable.$thenableState = STATE_REJECTED;
  1334. react(thenable);
  1335. }
  1336. }
  1337. function reset(thenable){
  1338. if (thenable.$thenableState !== STATE_PENDING){
  1339. thenable.$thenableResult = null;
  1340. thenable.$thenableState = STATE_PENDING;
  1341. }
  1342. }
  1343. function react(thenable){
  1344. var state = thenable.$thenableState,
  1345. result = thenable.$thenableResult,
  1346. reactions = thenable.$thenableReactions,
  1347. type;
  1348. if (state === STATE_FULFILLED){
  1349. thenable.$thenableReactions = [];
  1350. type = 'fulfillHandler';
  1351. } else if (state == STATE_REJECTED){
  1352. thenable.$thenableReactions = [];
  1353. type = 'rejectHandler';
  1354. }
  1355. if (type){
  1356. defer(handle.pass([result, reactions, type]));
  1357. }
  1358. }
  1359. function handle(result, reactions, type){
  1360. for (var i = 0, l = reactions.length; i < l; ++i){
  1361. var reaction = reactions[i],
  1362. handler = reaction[type];
  1363. if (handler === 'Identity'){
  1364. resolve(reaction.thenable, result);
  1365. } else if (handler === 'Thrower'){
  1366. reject(reaction.thenable, result);
  1367. } else {
  1368. try {
  1369. resolve(reaction.thenable, handler(result));
  1370. } catch (exception){
  1371. reject(reaction.thenable, exception);
  1372. }
  1373. }
  1374. }
  1375. }
  1376. var defer;
  1377. if (typeof process !== 'undefined' && typeof process.nextTick === 'function'){
  1378. defer = process.nextTick;
  1379. } else if (typeof setImmediate !== 'undefined'){
  1380. defer = setImmediate;
  1381. } else {
  1382. defer = function(fn){
  1383. setTimeout(fn, 0);
  1384. };
  1385. }
  1386. })();
  1387. /*
  1388. ---
  1389. name: Object
  1390. description: Object generic methods
  1391. license: MIT-style license.
  1392. requires: Type
  1393. provides: [Object, Hash]
  1394. ...
  1395. */
  1396. (function(){
  1397. Object.extend({
  1398. subset: function(object, keys){
  1399. var results = {};
  1400. for (var i = 0, l = keys.length; i < l; i++){
  1401. var k = keys[i];
  1402. if (k in object) results[k] = object[k];
  1403. }
  1404. return results;
  1405. },
  1406. map: function(object, fn, bind){
  1407. var results = {};
  1408. var keys = Object.keys(object);
  1409. for (var i = 0; i < keys.length; i++){
  1410. var key = keys[i];
  1411. results[key] = fn.call(bind, object[key], key, object);
  1412. }
  1413. return results;
  1414. },
  1415. filter: function(object, fn, bind){
  1416. var results = {};
  1417. var keys = Object.keys(object);
  1418. for (var i = 0; i < keys.length; i++){
  1419. var key = keys[i], value = object[key];
  1420. if (fn.call(bind, value, key, object)) results[key] = value;
  1421. }
  1422. return results;
  1423. },
  1424. every: function(object, fn, bind){
  1425. var keys = Object.keys(object);
  1426. for (var i = 0; i < keys.length; i++){
  1427. var key = keys[i];
  1428. if (!fn.call(bind, object[key], key)) return false;
  1429. }
  1430. return true;
  1431. },
  1432. some: function(object, fn, bind){
  1433. var keys = Object.keys(object);
  1434. for (var i = 0; i < keys.length; i++){
  1435. var key = keys[i];
  1436. if (fn.call(bind, object[key], key)) return true;
  1437. }
  1438. return false;
  1439. },
  1440. values: function(object){
  1441. var values = [];
  1442. var keys = Object.keys(object);
  1443. for (var i = 0; i < keys.length; i++){
  1444. var k = keys[i];
  1445. values.push(object[k]);
  1446. }
  1447. return values;
  1448. },
  1449. getLength: function(object){
  1450. return Object.keys(object).length;
  1451. },
  1452. keyOf: function(object, value){
  1453. var keys = Object.keys(object);
  1454. for (var i = 0; i < keys.length; i++){
  1455. var key = keys[i];
  1456. if (object[key] === value) return key;
  1457. }
  1458. return null;
  1459. },
  1460. contains: function(object, value){
  1461. return Object.keyOf(object, value) != null;
  1462. },
  1463. toQueryString: function(object, base){
  1464. var queryString = [];
  1465. Object.each(object, function(value, key){
  1466. if (base) key = base + '[' + key + ']';
  1467. var result;
  1468. switch (typeOf(value)){
  1469. case 'object': result = Object.toQueryString(value, key); break;
  1470. case 'array':
  1471. var qs = {};
  1472. value.each(function(val, i){
  1473. qs[i] = val;
  1474. });
  1475. result = Object.toQueryString(qs, key);
  1476. break;
  1477. default: result = key + '=' + encodeURIComponent(value);
  1478. }
  1479. if (value != null) queryString.push(result);
  1480. });
  1481. return queryString.join('&');
  1482. }
  1483. });
  1484. })();
  1485. //<1.2compat>
  1486. Hash.implement({
  1487. has: Object.prototype.hasOwnProperty,
  1488. keyOf: function(value){
  1489. return Object.keyOf(this, value);
  1490. },
  1491. hasValue: function(value){
  1492. return Object.contains(this, value);
  1493. },
  1494. extend: function(properties){
  1495. Hash.each(properties || {}, function(value, key){
  1496. Hash.set(this, key, value);
  1497. }, this);
  1498. return this;
  1499. },
  1500. combine: function(properties){
  1501. Hash.each(properties || {}, function(value, key){
  1502. Hash.include(this, key, value);
  1503. }, this);
  1504. return this;
  1505. },
  1506. erase: function(key){
  1507. if (this.hasOwnProperty(key)) delete this[key];
  1508. return this;
  1509. },
  1510. get: function(key){
  1511. return (this.hasOwnProperty(key)) ? this[key] : null;
  1512. },
  1513. set: function(key, value){
  1514. if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
  1515. return this;
  1516. },
  1517. empty: function(){
  1518. Hash.each(this, function(value, key){
  1519. delete this[key];
  1520. }, this);
  1521. return this;
  1522. },
  1523. include: function(key, value){
  1524. if (this[key] == null) this[key] = value;
  1525. return this;
  1526. },
  1527. map: function(fn, bind){
  1528. return new Hash(Object.map(this, fn, bind));
  1529. },
  1530. filter: function(fn, bind){
  1531. return new Hash(Object.filter(this, fn, bind));
  1532. },
  1533. every: function(fn, bind){
  1534. return Object.every(this, fn, bind);
  1535. },
  1536. some: function(fn, bind){
  1537. return Object.some(this, fn, bind);
  1538. },
  1539. getKeys: function(){
  1540. return Object.keys(this);
  1541. },
  1542. getValues: function(){
  1543. return Object.values(this);
  1544. },
  1545. toQueryString: function(base){
  1546. return Object.toQueryString(this, base);
  1547. }
  1548. });
  1549. Hash.extend = Object.append;
  1550. Hash.alias({indexOf: 'keyOf', contains: 'hasValue'});
  1551. //</1.2compat>
  1552. /*
  1553. ---
  1554. name: Slick.Parser
  1555. description: Standalone CSS3 Selector parser
  1556. provides: Slick.Parser
  1557. ...
  1558. */
  1559. ;(function(){
  1560. var parsed,
  1561. separatorIndex,
  1562. combinatorIndex,
  1563. reversed,
  1564. cache = {},
  1565. reverseCache = {},
  1566. reUnescape = /\\/g;
  1567. var parse = function(expression, isReversed){
  1568. if (expression == null) return null;
  1569. if (expression.Slick === true) return expression;
  1570. expression = ('' + expression).replace(/^\s+|\s+$/g, '');
  1571. reversed = !!isReversed;
  1572. var currentCache = (reversed) ? reverseCache : cache;
  1573. if (currentCache[expression]) return currentCache[expression];
  1574. parsed = {
  1575. Slick: true,
  1576. expressions: [],
  1577. raw: expression,
  1578. reverse: function(){
  1579. return parse(this.raw, true);
  1580. }
  1581. };
  1582. separatorIndex = -1;
  1583. while (expression != (expression = expression.replace(regexp, parser)));
  1584. parsed.length = parsed.expressions.length;
  1585. return currentCache[parsed.raw] = (reversed) ? reverse(parsed) : parsed;
  1586. };
  1587. var reverseCombinator = function(combinator){
  1588. if (combinator === '!') return ' ';
  1589. else if (combinator === ' ') return '!';
  1590. else if ((/^!/).test(combinator)) return combinator.replace(/^!/, '');
  1591. else return '!' + combinator;
  1592. };
  1593. var reverse = function(expression){
  1594. var expressions = expression.expressions;
  1595. for (var i = 0; i < expressions.length; i++){
  1596. var exp = expressions[i];
  1597. var last = {parts: [], tag: '*', combinator: reverseCombinator(exp[0].combinator)};
  1598. for (var j = 0; j < exp.length; j++){
  1599. var cexp = exp[j];
  1600. if (!cexp.reverseCombinator) cexp.reverseCombinator = ' ';
  1601. cexp.combinator = cexp.reverseCombinator;
  1602. delete cexp.reverseCombinator;
  1603. }
  1604. exp.reverse().push(last);
  1605. }
  1606. return expression;
  1607. };
  1608. var escapeRegExp = function(string){// Credit: XRegExp 0.6.1 (c) 2007-2008 Steven Levithan <http://stevenlevithan.com/regex/xregexp/> MIT License
  1609. return string.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, function(match){
  1610. return '\\' + match;
  1611. });
  1612. };
  1613. var regexp = new RegExp(
  1614. /*
  1615. #!/usr/bin/env ruby
  1616. puts "\t\t" + DATA.read.gsub(/\(\?x\)|\s+#.*$|\s+|\\$|\\n/,'')
  1617. __END__
  1618. "(?x)^(?:\
  1619. \\s* ( , ) \\s* # Separator \n\
  1620. | \\s* ( <combinator>+ ) \\s* # Combinator \n\
  1621. | ( \\s+ ) # CombinatorChildren \n\
  1622. | ( <unicode>+ | \\* ) # Tag \n\
  1623. | \\# ( <unicode>+ ) # ID \n\
  1624. | \\. ( <unicode>+ ) # ClassName \n\
  1625. | # Attribute \n\
  1626. \\[ \
  1627. \\s* (<unicode1>+) (?: \
  1628. \\s* ([*^$!~|]?=) (?: \
  1629. \\s* (?:\
  1630. ([\"']?)(.*?)\\9 \
  1631. )\
  1632. ) \
  1633. )? \\s* \
  1634. \\](?!\\]) \n\
  1635. | :+ ( <unicode>+ )(?:\
  1636. \\( (?:\
  1637. (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\
  1638. ) \\)\
  1639. )?\
  1640. )"
  1641. */
  1642. "^(?:\\s*(,)\\s*|\\s*(<combinator>+)\\s*|(\\s+)|(<unicode>+|\\*)|\\#(<unicode>+)|\\.(<unicode>+)|\\[\\s*(<unicode1>+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(<unicode>+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)"
  1643. .replace(/<combinator>/, '[' + escapeRegExp('>+~`!@$%^&={}\\;</') + ']')
  1644. .replace(/<unicode>/g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])')
  1645. .replace(/<unicode1>/g, '(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])')
  1646. );
  1647. function parser(
  1648. rawMatch,
  1649. separator,
  1650. combinator,
  1651. combinatorChildren,
  1652. tagName,
  1653. id,
  1654. className,
  1655. attributeKey,
  1656. attributeOperator,
  1657. attributeQuote,
  1658. attributeValue,
  1659. pseudoMarker,
  1660. pseudoClass,
  1661. pseudoQuote,
  1662. pseudoClassQuotedValue,
  1663. pseudoClassValue
  1664. ){
  1665. if (separator || separatorIndex === -1){
  1666. parsed.expressions[++separatorIndex] = [];
  1667. combinatorIndex = -1;
  1668. if (separator) return '';
  1669. }
  1670. if (combinator || combinatorChildren || combinatorIndex === -1){
  1671. combinator = combinator || ' ';
  1672. var currentSeparator = parsed.expressions[separatorIndex];
  1673. if (reversed && currentSeparator[combinatorIndex])
  1674. currentSeparator[combinatorIndex].reverseCombinator = reverseCombinator(combinator);
  1675. currentSeparator[++combinatorIndex] = {combinator: combinator, tag: '*'};
  1676. }
  1677. var currentParsed = parsed.expressions[separatorIndex][combinatorIndex];
  1678. if (tagName){
  1679. currentParsed.tag = tagName.replace(reUnescape, '');
  1680. } else if (id){
  1681. currentParsed.id = id.replace(reUnescape, '');
  1682. } else if (className){
  1683. className = className.replace(reUnescape, '');
  1684. if (!currentParsed.classList) currentParsed.classList = [];
  1685. if (!currentParsed.classes) currentParsed.classes = [];
  1686. currentParsed.classList.push(className);
  1687. currentParsed.classes.push({
  1688. value: className,
  1689. regexp: new RegExp('(^|\\s)' + escapeRegExp(className) + '(\\s|$)')
  1690. });
  1691. } else if (pseudoClass){
  1692. pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue;
  1693. pseudoClassValue = pseudoClassValue ? pseudoClassValue.replace(reUnescape, '') : null;
  1694. if (!currentParsed.pseudos) currentParsed.pseudos = [];
  1695. currentParsed.pseudos.push({
  1696. key: pseudoClass.replace(reUnescape, ''),
  1697. value: pseudoClassValue,
  1698. type: pseudoMarker.length == 1 ? 'class' : 'element'
  1699. });
  1700. } else if (attributeKey){
  1701. attributeKey = attributeKey.replace(reUnescape, '');
  1702. attributeValue = (attributeValue || '').replace(reUnescape, '');
  1703. var test, regexp;
  1704. switch (attributeOperator){
  1705. case '^=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) ); break;
  1706. case '$=' : regexp = new RegExp( escapeRegExp(attributeValue) +'$' ); break;
  1707. case '~=' : regexp = new RegExp( '(^|\\s)'+ escapeRegExp(attributeValue) +'(\\s|$)' ); break;
  1708. case '|=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) +'(-|$)' ); break;
  1709. case '=' : test = function(value){
  1710. return attributeValue == value;
  1711. }; break;
  1712. case '*=' : test = function(value){
  1713. return value && value.indexOf(attributeValue) > -1;
  1714. }; break;
  1715. case '!=' : test = function(value){
  1716. return attributeValue != value;
  1717. }; break;
  1718. default : test = function(value){
  1719. return !!value;
  1720. };
  1721. }
  1722. if (attributeValue == '' && (/^[*$^]=$/).test(attributeOperator)) test = function(){
  1723. return false;
  1724. };
  1725. if (!test) test = function(value){
  1726. return value && regexp.test(value);
  1727. };
  1728. if (!currentParsed.attributes) currentParsed.attributes = [];
  1729. currentParsed.attributes.push({
  1730. key: attributeKey,
  1731. operator: attributeOperator,
  1732. value: attributeValue,
  1733. test: test
  1734. });
  1735. }
  1736. return '';
  1737. };
  1738. // Slick NS
  1739. var Slick = (this.Slick || {});
  1740. Slick.parse = function(expression){
  1741. return parse(expression);
  1742. };
  1743. Slick.escapeRegExp = escapeRegExp;
  1744. if (!this.Slick) this.Slick = Slick;
  1745. }).apply(/*<CommonJS>*/(typeof exports != 'undefined') ? exports : /*</CommonJS>*/this);
  1746. /*
  1747. ---
  1748. name: Slick.Finder
  1749. description: The new, superfast css selector engine.
  1750. provides: Slick.Finder
  1751. requires: Slick.Parser
  1752. ...
  1753. */
  1754. ;(function(){
  1755. var local = {},
  1756. featuresCache = {},
  1757. toString = Object.prototype.toString;
  1758. // Feature / Bug detection
  1759. local.isNativeCode = function(fn){
  1760. return (/\{\s*\[native code\]\s*\}/).test('' + fn);
  1761. };
  1762. local.isXML = function(document){
  1763. return (!!document.xmlVersion) || (!!document.xml) || (toString.call(document) == '[object XMLDocument]') ||
  1764. (document.nodeType == 9 && document.documentElement.nodeName != 'HTML');
  1765. };
  1766. local.setDocument = function(document){
  1767. // convert elements / window arguments to document. if document cannot be extrapolated, the function returns.
  1768. var nodeType = document.nodeType;
  1769. if (nodeType == 9); // document
  1770. else if (nodeType) document = document.ownerDocument; // node
  1771. else if (document.navigator) document = document.document; // window
  1772. else return;
  1773. // check if it's the old document
  1774. if (this.document === document) return;
  1775. this.document = document;
  1776. // check if we have done feature detection on this document before
  1777. var root = document.documentElement,
  1778. rootUid = this.getUIDXML(root),
  1779. features = featuresCache[rootUid],
  1780. feature;
  1781. if (features){
  1782. for (feature in features){
  1783. this[feature] = features[feature];
  1784. }
  1785. return;
  1786. }
  1787. features = featuresCache[rootUid] = {};
  1788. features.root = root;
  1789. features.isXMLDocument = this.isXML(document);
  1790. features.brokenStarGEBTN
  1791. = features.starSelectsClosedQSA
  1792. = features.idGetsName
  1793. = features.brokenMixedCaseQSA
  1794. = features.brokenGEBCN
  1795. = features.brokenCheckedQSA
  1796. = features.brokenEmptyAttributeQSA
  1797. = features.isHTMLDocument
  1798. = features.nativeMatchesSelector
  1799. = false;
  1800. var starSelectsClosed, starSelectsComments,
  1801. brokenSecondClassNameGEBCN, cachedGetElementsByClassName,
  1802. brokenFormAttributeGetter;
  1803. var selected, id = 'slick_uniqueid';
  1804. var testNode = document.createElement('div');
  1805. var testRoot = document.body || document.getElementsByTagName('body')[0] || root;
  1806. testRoot.appendChild(testNode);
  1807. // on non-HTML documents innerHTML and getElementsById doesnt work properly
  1808. try {
  1809. testNode.innerHTML = '<a id="'+id+'"></a>';
  1810. features.isHTMLDocument = !!document.getElementById(id);
  1811. } catch (e){}
  1812. if (features.isHTMLDocument){
  1813. testNode.style.display = 'none';
  1814. // IE returns comment nodes for getElementsByTagName('*') for some documents
  1815. testNode.appendChild(document.createComment(''));
  1816. starSelectsComments = (testNode.getElementsByTagName('*').length > 1);
  1817. // IE returns closed nodes (EG:"</foo>") for getElementsByTagName('*') for some documents
  1818. try {
  1819. testNode.innerHTML = 'foo</foo>';
  1820. selected = testNode.getElementsByTagName('*');
  1821. starSelectsClosed = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/');
  1822. } catch (e){};
  1823. features.brokenStarGEBTN = starSelectsComments || starSelectsClosed;
  1824. // IE returns elements with the name instead of just id for getElementsById for some documents
  1825. try {
  1826. testNode.innerHTML = '<a name="'+ id +'"></a><b id="'+ id +'"></b>';
  1827. features.idGetsName = document.getElementById(id) === testNode.firstChild;
  1828. } catch (e){}
  1829. if (testNode.getElementsByClassName){
  1830. // Safari 3.2 getElementsByClassName caches results
  1831. try {
  1832. testNode.innerHTML = '<a class="f"></a><a class="b"></a>';
  1833. testNode.getElementsByClassName('b').length;
  1834. testNode.firstChild.className = 'b';
  1835. cachedGetElementsByClassName = (testNode.getElementsByClassName('b').length != 2);
  1836. } catch (e){};
  1837. // Opera 9.6 getElementsByClassName doesnt detects the class if its not the first one
  1838. try {
  1839. testNode.innerHTML = '<a class="a"></a><a class="f b a"></a>';
  1840. brokenSecondClassNameGEBCN = (testNode.getElementsByClassName('a').length != 2);
  1841. } catch (e){}
  1842. features.brokenGEBCN = cachedGetElementsByClassName || brokenSecondClassNameGEBCN;
  1843. }
  1844. if (testNode.querySelectorAll){
  1845. // IE 8 returns closed nodes (EG:"</foo>") for querySelectorAll('*') for some documents
  1846. try {
  1847. testNode.innerHTML = 'foo</foo>';
  1848. selected = testNode.querySelectorAll('*');
  1849. features.starSelectsClosedQSA = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/');
  1850. } catch (e){}
  1851. // Safari 3.2 querySelectorAll doesnt work with mixedcase on quirksmode
  1852. try {
  1853. testNode.innerHTML = '<a class="MiX"></a>';
  1854. features.brokenMixedCaseQSA = !testNode.querySelectorAll('.MiX').length;
  1855. } catch (e){}
  1856. // Webkit and Opera dont return selected options on querySelectorAll
  1857. try {
  1858. testNode.innerHTML = '<select><option selected="selected">a</option></select>';
  1859. features.brokenCheckedQSA = (testNode.querySelectorAll(':checked').length == 0);
  1860. } catch (e){};
  1861. // IE returns incorrect results for attr[*^$]="" selectors on querySelectorAll
  1862. try {
  1863. testNode.innerHTML = '<a class=""></a>';
  1864. features.brokenEmptyAttributeQSA = (testNode.querySelectorAll('[class*=""]').length != 0);
  1865. } catch (e){}
  1866. }
  1867. // IE6-7, if a form has an input of id x, form.getAttribute(x) returns a reference to the input
  1868. try {
  1869. testNode.innerHTML = '<form action="s"><input id="action"/></form>';
  1870. brokenFormAttributeGetter = (testNode.firstChild.getAttribute('action') != 's');
  1871. } catch (e){}
  1872. // native matchesSelector function
  1873. features.nativeMatchesSelector = root.matches || /*root.msMatchesSelector ||*/ root.mozMatchesSelector || root.webkitMatchesSelector;
  1874. if (features.nativeMatchesSelector) try {
  1875. // if matchesSelector trows errors on incorrect sintaxes we can use it
  1876. features.nativeMatchesSelector.call(root, ':slick');
  1877. features.nativeMatchesSelector = null;
  1878. } catch (e){}
  1879. }
  1880. try {
  1881. root.slick_expando = 1;
  1882. delete root.slick_expando;
  1883. features.getUID = this.getUIDHTML;
  1884. } catch (e){
  1885. features.getUID = this.getUIDXML;
  1886. }
  1887. testRoot.removeChild(testNode);
  1888. testNode = selected = testRoot = null;
  1889. // getAttribute
  1890. features.getAttribute = (features.isHTMLDocument && brokenFormAttributeGetter) ? function(node, name){
  1891. var method = this.attributeGetters[name];
  1892. if (method) return method.call(node);
  1893. var attributeNode = node.getAttributeNode(name);
  1894. return (attributeNode) ? attributeNode.nodeValue : null;
  1895. } : function(node, name){
  1896. var method = this.attributeGetters[name];
  1897. return (method) ? method.call(node) : node.getAttribute(name);
  1898. };
  1899. // hasAttribute
  1900. features.hasAttribute = (root && this.isNativeCode(root.hasAttribute)) ? function(node, attribute){
  1901. return node.hasAttribute(attribute);
  1902. } : function(node, attribute){
  1903. node = node.getAttributeNode(attribute);
  1904. return !!(node && (node.specified || node.nodeValue));
  1905. };
  1906. // contains
  1907. // FIXME: Add specs: local.contains should be different for xml and html documents?
  1908. var nativeRootContains = root && this.isNativeCode(root.contains),
  1909. nativeDocumentContains = document && this.isNativeCode(document.contains);
  1910. features.contains = (nativeRootContains && nativeDocumentContains) ? function(context, node){
  1911. return context.contains(node);
  1912. } : (nativeRootContains && !nativeDocumentContains) ? function(context, node){
  1913. // IE8 does not have .contains on document.
  1914. return context === node || ((context === document) ? document.documentElement : context).contains(node);
  1915. } : (root && root.compareDocumentPosition) ? function(context, node){
  1916. return context === node || !!(context.compareDocumentPosition(node) & 16);
  1917. } : function(context, node){
  1918. if (node) do {
  1919. if (node === context) return true;
  1920. } while ((node = node.parentNode));
  1921. return false;
  1922. };
  1923. // document order sorting
  1924. // credits to Sizzle (http://sizzlejs.com/)
  1925. features.documentSorter = (root.compareDocumentPosition) ? function(a, b){
  1926. if (!a.compareDocumentPosition || !b.compareDocumentPosition) return 0;
  1927. return a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
  1928. } : ('sourceIndex' in root) ? function(a, b){
  1929. if (!a.sourceIndex || !b.sourceIndex) return 0;
  1930. return a.sourceIndex - b.sourceIndex;
  1931. } : (document.createRange) ? function(a, b){
  1932. if (!a.ownerDocument || !b.ownerDocument) return 0;
  1933. var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
  1934. aRange.setStart(a, 0);
  1935. aRange.setEnd(a, 0);
  1936. bRange.setStart(b, 0);
  1937. bRange.setEnd(b, 0);
  1938. return aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
  1939. } : null;
  1940. root = null;
  1941. for (feature in features){
  1942. this[feature] = features[feature];
  1943. }
  1944. };
  1945. // Main Method
  1946. var reSimpleSelector = /^([#.]?)((?:[\w-]+|\*))$/,
  1947. reEmptyAttribute = /\[.+[*$^]=(?:""|'')?\]/,
  1948. qsaFailExpCache = {};
  1949. local.search = function(context, expression, append, first){
  1950. var found = this.found = (first) ? null : (append || []);
  1951. if (!context) return found;
  1952. else if (context.navigator) context = context.document; // Convert the node from a window to a document
  1953. else if (!context.nodeType) return found;
  1954. // setup
  1955. var parsed, i, node, nodes,
  1956. uniques = this.uniques = {},
  1957. hasOthers = !!(append && append.length),
  1958. contextIsDocument = (context.nodeType == 9);
  1959. if (this.document !== (contextIsDocument ? context : context.ownerDocument)) this.setDocument(context);
  1960. // avoid duplicating items already in the append array
  1961. if (hasOthers) for (i = found.length; i--;) uniques[this.getUID(found[i])] = true;
  1962. // expression checks
  1963. if (typeof expression == 'string'){ // expression is a string
  1964. /*<simple-selectors-override>*/
  1965. var simpleSelector = expression.match(reSimpleSelector);
  1966. simpleSelectors: if (simpleSelector){
  1967. var symbol = simpleSelector[1],
  1968. name = simpleSelector[2];
  1969. if (!symbol){
  1970. if (name == '*' && this.brokenStarGEBTN) break simpleSelectors;
  1971. nodes = context.getElementsByTagName(name);
  1972. if (first) return nodes[0] || null;
  1973. for (i = 0; node = nodes[i++];){
  1974. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1975. }
  1976. } else if (symbol == '#'){
  1977. if (!this.isHTMLDocument || !contextIsDocument) break simpleSelectors;
  1978. node = context.getElementById(name);
  1979. if (!node) return found;
  1980. if (this.idGetsName && node.getAttributeNode('id').nodeValue != name) break simpleSelectors;
  1981. if (first) return node || null;
  1982. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1983. } else if (symbol == '.'){
  1984. if (!this.isHTMLDocument || ((!context.getElementsByClassName || this.brokenGEBCN) && context.querySelectorAll)) break simpleSelectors;
  1985. if (context.getElementsByClassName && !this.brokenGEBCN){
  1986. nodes = context.getElementsByClassName(name);
  1987. if (first) return nodes[0] || null;
  1988. for (i = 0; node = nodes[i++];){
  1989. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1990. }
  1991. } else {
  1992. var matchClass = new RegExp('(^|\\s)'+ Slick.escapeRegExp(name) +'(\\s|$)');
  1993. nodes = context.getElementsByTagName('*');
  1994. for (i = 0; node = nodes[i++];){
  1995. className = node.className;
  1996. if (!(className && matchClass.test(className))) continue;
  1997. if (first) return node;
  1998. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1999. }
  2000. }
  2001. }
  2002. if (hasOthers) this.sort(found);
  2003. return (first) ? null : found;
  2004. }
  2005. /*</simple-selectors-override>*/
  2006. /*<query-selector-override>*/
  2007. querySelector: if (context.querySelectorAll){
  2008. if (!this.isHTMLDocument
  2009. || qsaFailExpCache[expression]
  2010. //TODO: only skip when expression is actually mixed case
  2011. || this.brokenMixedCaseQSA
  2012. || (this.brokenCheckedQSA && expression.indexOf(':checked') > -1)
  2013. || (this.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression))
  2014. || (!contextIsDocument //Abort when !contextIsDocument and...
  2015. // there are multiple expressions in the selector
  2016. // since we currently only fix non-document rooted QSA for single expression selectors
  2017. && expression.indexOf(',') > -1
  2018. )
  2019. || Slick.disableQSA
  2020. ) break querySelector;
  2021. var _expression = expression, _context = context, currentId;
  2022. if (!contextIsDocument){
  2023. // non-document rooted QSA
  2024. // credits to Andrew Dupont
  2025. currentId = _context.getAttribute('id'), slickid = 'slickid__';
  2026. _context.setAttribute('id', slickid);
  2027. _expression = '#' + slickid + ' ' + _expression;
  2028. context = _context.parentNode;
  2029. }
  2030. try {
  2031. if (first) return context.querySelector(_expression) || null;
  2032. else nodes = context.querySelectorAll(_expression);
  2033. } catch (e){
  2034. qsaFailExpCache[expression] = 1;
  2035. break querySelector;
  2036. } finally {
  2037. if (!contextIsDocument){
  2038. if (currentId) _context.setAttribute('id', currentId);
  2039. else _context.removeAttribute('id');
  2040. context = _context;
  2041. }
  2042. }
  2043. if (this.starSelectsClosedQSA) for (i = 0; node = nodes[i++];){
  2044. if (node.nodeName > '@' && !(hasOthers && uniques[this.getUID(node)])) found.push(node);
  2045. } else for (i = 0; node = nodes[i++];){
  2046. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  2047. }
  2048. if (hasOthers) this.sort(found);
  2049. return found;
  2050. }
  2051. /*</query-selector-override>*/
  2052. parsed = this.Slick.parse(expression);
  2053. if (!parsed.length) return found;
  2054. } else if (expression == null){ // there is no expression
  2055. return found;
  2056. } else if (expression.Slick){ // expression is a parsed Slick object
  2057. parsed = expression;
  2058. } else if (this.contains(context.documentElement || context, expression)){ // expression is a node
  2059. (found) ? found.push(expression) : found = expression;
  2060. return found;
  2061. } else { // other junk
  2062. return found;
  2063. }
  2064. /*<pseudo-selectors>*//*<nth-pseudo-selectors>*/
  2065. // cache elements for the nth selectors
  2066. this.posNTH = {};
  2067. this.posNTHLast = {};
  2068. this.posNTHType = {};
  2069. this.posNTHTypeLast = {};
  2070. /*</nth-pseudo-selectors>*//*</pseudo-selectors>*/
  2071. // if append is null and there is only a single selector with one expression use pushArray, else use pushUID
  2072. this.push = (!hasOthers && (first || (parsed.length == 1 && parsed.expressions[0].length == 1))) ? this.pushArray : this.pushUID;
  2073. if (found == null) found = [];
  2074. // default engine
  2075. var j, m, n;
  2076. var combinator, tag, id, classList, classes, attributes, pseudos;
  2077. var currentItems, currentExpression, currentBit, lastBit, expressions = parsed.expressions;
  2078. search: for (i = 0; (currentExpression = expressions[i]); i++) for (j = 0; (currentBit = currentExpression[j]); j++){
  2079. combinator = 'combinator:' + currentBit.combinator;
  2080. if (!this[combinator]) continue search;
  2081. tag = (this.isXMLDocument) ? currentBit.tag : currentBit.tag.toUpperCase();
  2082. id = currentBit.id;
  2083. classList = currentBit.classList;
  2084. classes = currentBit.classes;
  2085. attributes = currentBit.attributes;
  2086. pseudos = currentBit.pseudos;
  2087. lastBit = (j === (currentExpression.length - 1));
  2088. this.bitUniques = {};
  2089. if (lastBit){
  2090. this.uniques = uniques;
  2091. this.found = found;
  2092. } else {
  2093. this.uniques = {};
  2094. this.found = [];
  2095. }
  2096. if (j === 0){
  2097. this[combinator](context, tag, id, classes, attributes, pseudos, classList);
  2098. if (first && lastBit && found.length) break search;
  2099. } else {
  2100. if (first && lastBit) for (m = 0, n = currentItems.length; m < n; m++){
  2101. this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList);
  2102. if (found.length) break search;
  2103. } else for (m = 0, n = currentItems.length; m < n; m++) this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList);
  2104. }
  2105. currentItems = this.found;
  2106. }
  2107. // should sort if there are nodes in append and if you pass multiple expressions.
  2108. if (hasOthers || (parsed.expressions.length > 1)) this.sort(found);
  2109. return (first) ? (found[0] || null) : found;
  2110. };
  2111. // Utils
  2112. local.uidx = 1;
  2113. local.uidk = 'slick-uniqueid';
  2114. local.getUIDXML = function(node){
  2115. var uid = node.getAttribute(this.uidk);
  2116. if (!uid){
  2117. uid = this.uidx++;
  2118. node.setAttribute(this.uidk, uid);
  2119. }
  2120. return uid;
  2121. };
  2122. local.getUIDHTML = function(node){
  2123. return node.uniqueNumber || (node.uniqueNumber = this.uidx++);
  2124. };
  2125. // sort based on the setDocument documentSorter method.
  2126. local.sort = function(results){
  2127. if (!this.documentSorter) return results;
  2128. results.sort(this.documentSorter);
  2129. return results;
  2130. };
  2131. /*<pseudo-selectors>*//*<nth-pseudo-selectors>*/
  2132. local.cacheNTH = {};
  2133. local.matchNTH = /^([+-]?\d*)?([a-z]+)?([+-]\d+)?$/;
  2134. local.parseNTHArgument = function(argument){
  2135. var parsed = argument.match(this.matchNTH);
  2136. if (!parsed) return false;
  2137. var special = parsed[2] || false;
  2138. var a = parsed[1] || 1;
  2139. if (a == '-') a = -1;
  2140. var b = +parsed[3] || 0;
  2141. parsed =
  2142. (special == 'n') ? {a: a, b: b} :
  2143. (special == 'odd') ? {a: 2, b: 1} :
  2144. (special == 'even') ? {a: 2, b: 0} : {a: 0, b: a};
  2145. return (this.cacheNTH[argument] = parsed);
  2146. };
  2147. local.createNTHPseudo = function(child, sibling, positions, ofType){
  2148. return function(node, argument){
  2149. var uid = this.getUID(node);
  2150. if (!this[positions][uid]){
  2151. var parent = node.parentNode;
  2152. if (!parent) return false;
  2153. var el = parent[child], count = 1;
  2154. if (ofType){
  2155. var nodeName = node.nodeName;
  2156. do {
  2157. if (el.nodeName != nodeName) continue;
  2158. this[positions][this.getUID(el)] = count++;
  2159. } while ((el = el[sibling]));
  2160. } else {
  2161. do {
  2162. if (el.nodeType != 1) continue;
  2163. this[positions][this.getUID(el)] = count++;
  2164. } while ((el = el[sibling]));
  2165. }
  2166. }
  2167. argument = argument || 'n';
  2168. var parsed = this.cacheNTH[argument] || this.parseNTHArgument(argument);
  2169. if (!parsed) return false;
  2170. var a = parsed.a, b = parsed.b, pos = this[positions][uid];
  2171. if (a == 0) return b == pos;
  2172. if (a > 0){
  2173. if (pos < b) return false;
  2174. } else {
  2175. if (b < pos) return false;
  2176. }
  2177. return ((pos - b) % a) == 0;
  2178. };
  2179. };
  2180. /*</nth-pseudo-selectors>*//*</pseudo-selectors>*/
  2181. local.pushArray = function(node, tag, id, classes, attributes, pseudos){
  2182. if (this.matchSelector(node, tag, id, classes, attributes, pseudos)) this.found.push(node);
  2183. };
  2184. local.pushUID = function(node, tag, id, classes, attributes, pseudos){
  2185. var uid = this.getUID(node);
  2186. if (!this.uniques[uid] && this.matchSelector(node, tag, id, classes, attributes, pseudos)){
  2187. this.uniques[uid] = true;
  2188. this.found.push(node);
  2189. }
  2190. };
  2191. local.matchNode = function(node, selector){
  2192. if (this.isHTMLDocument && this.nativeMatchesSelector){
  2193. try {
  2194. return this.nativeMatchesSelector.call(node, selector.replace(/\[([^=]+)=\s*([^'"\]]+?)\s*\]/g, '[$1="$2"]'));
  2195. } catch (matchError){}
  2196. }
  2197. var parsed = this.Slick.parse(selector);
  2198. if (!parsed) return true;
  2199. // simple (single) selectors
  2200. var expressions = parsed.expressions, simpleExpCounter = 0, i, currentExpression;
  2201. for (i = 0; (currentExpression = expressions[i]); i++){
  2202. if (currentExpression.length == 1){
  2203. var exp = currentExpression[0];
  2204. if (this.matchSelector(node, (this.isXMLDocument) ? exp.tag : exp.tag.toUpperCase(), exp.id, exp.classes, exp.attributes, exp.pseudos)) return true;
  2205. simpleExpCounter++;
  2206. }
  2207. }
  2208. if (simpleExpCounter == parsed.length) return false;
  2209. var nodes = this.search(this.document, parsed), item;
  2210. for (i = 0; item = nodes[i++];){
  2211. if (item === node) return true;
  2212. }
  2213. return false;
  2214. };
  2215. local.matchPseudo = function(node, name, argument){
  2216. var pseudoName = 'pseudo:' + name;
  2217. if (this[pseudoName]) return this[pseudoName](node, argument);
  2218. var attribute = this.getAttribute(node, name);
  2219. return (argument) ? argument == attribute : !!attribute;
  2220. };
  2221. local.matchSelector = function(node, tag, id, classes, attributes, pseudos){
  2222. if (tag){
  2223. var nodeName = (this.isXMLDocument) ? node.nodeName : node.nodeName.toUpperCase();
  2224. if (tag == '*'){
  2225. if (nodeName < '@') return false; // Fix for comment nodes and closed nodes
  2226. } else {
  2227. if (nodeName != tag) return false;
  2228. }
  2229. }
  2230. if (id && node.getAttribute('id') != id) return false;
  2231. var i, part, cls;
  2232. if (classes) for (i = classes.length; i--;){
  2233. cls = this.getAttribute(node, 'class');
  2234. if (!(cls && classes[i].regexp.test(cls))) return false;
  2235. }
  2236. if (attributes) for (i = attributes.length; i--;){
  2237. part = attributes[i];
  2238. if (part.operator ? !part.test(this.getAttribute(node, part.key)) : !this.hasAttribute(node, part.key)) return false;
  2239. }
  2240. if (pseudos) for (i = pseudos.length; i--;){
  2241. part = pseudos[i];
  2242. if (!this.matchPseudo(node, part.key, part.value)) return false;
  2243. }
  2244. return true;
  2245. };
  2246. var combinators = {
  2247. ' ': function(node, tag, id, classes, attributes, pseudos, classList){ // all child nodes, any level
  2248. var i, item, children;
  2249. if (this.isHTMLDocument){
  2250. getById: if (id){
  2251. item = this.document.getElementById(id);
  2252. if ((!item && node.all) || (this.idGetsName && item && item.getAttributeNode('id').nodeValue != id)){
  2253. // all[id] returns all the elements with that name or id inside node
  2254. // if theres just one it will return the element, else it will be a collection
  2255. children = node.all[id];
  2256. if (!children) return;
  2257. if (!children[0]) children = [children];
  2258. for (i = 0; item = children[i++];){
  2259. var idNode = item.getAttributeNode('id');
  2260. if (idNode && idNode.nodeValue == id){
  2261. this.push(item, tag, null, classes, attributes, pseudos);
  2262. break;
  2263. }
  2264. }
  2265. return;
  2266. }
  2267. if (!item){
  2268. // if the context is in the dom we return, else we will try GEBTN, breaking the getById label
  2269. if (this.contains(this.root, node)) return;
  2270. else break getById;
  2271. } else if (this.document !== node && !this.contains(node, item)) return;
  2272. this.push(item, tag, null, classes, attributes, pseudos);
  2273. return;
  2274. }
  2275. getByClass: if (classes && node.getElementsByClassName && !this.brokenGEBCN){
  2276. children = node.getElementsByClassName(classList.join(' '));
  2277. if (!(children && children.length)) break getByClass;
  2278. for (i = 0; item = children[i++];) this.push(item, tag, id, null, attributes, pseudos);
  2279. return;
  2280. }
  2281. }
  2282. getByTag: {
  2283. children = node.getElementsByTagName(tag);
  2284. if (!(children && children.length)) break getByTag;
  2285. if (!this.brokenStarGEBTN) tag = null;
  2286. for (i = 0; item = children[i++];) this.push(item, tag, id, classes, attributes, pseudos);
  2287. }
  2288. },
  2289. '>': function(node, tag, id, classes, attributes, pseudos){ // direct children
  2290. if ((node = node.firstChild)) do {
  2291. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2292. } while ((node = node.nextSibling));
  2293. },
  2294. '+': function(node, tag, id, classes, attributes, pseudos){ // next sibling
  2295. while ((node = node.nextSibling)) if (node.nodeType == 1){
  2296. this.push(node, tag, id, classes, attributes, pseudos);
  2297. break;
  2298. }
  2299. },
  2300. '^': function(node, tag, id, classes, attributes, pseudos){ // first child
  2301. node = node.firstChild;
  2302. if (node){
  2303. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2304. else this['combinator:+'](node, tag, id, classes, attributes, pseudos);
  2305. }
  2306. },
  2307. '~': function(node, tag, id, classes, attributes, pseudos){ // next siblings
  2308. while ((node = node.nextSibling)){
  2309. if (node.nodeType != 1) continue;
  2310. var uid = this.getUID(node);
  2311. if (this.bitUniques[uid]) break;
  2312. this.bitUniques[uid] = true;
  2313. this.push(node, tag, id, classes, attributes, pseudos);
  2314. }
  2315. },
  2316. '++': function(node, tag, id, classes, attributes, pseudos){ // next sibling and previous sibling
  2317. this['combinator:+'](node, tag, id, classes, attributes, pseudos);
  2318. this['combinator:!+'](node, tag, id, classes, attributes, pseudos);
  2319. },
  2320. '~~': function(node, tag, id, classes, attributes, pseudos){ // next siblings and previous siblings
  2321. this['combinator:~'](node, tag, id, classes, attributes, pseudos);
  2322. this['combinator:!~'](node, tag, id, classes, attributes, pseudos);
  2323. },
  2324. '!': function(node, tag, id, classes, attributes, pseudos){ // all parent nodes up to document
  2325. while ((node = node.parentNode)) if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos);
  2326. },
  2327. '!>': function(node, tag, id, classes, attributes, pseudos){ // direct parent (one level)
  2328. node = node.parentNode;
  2329. if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos);
  2330. },
  2331. '!+': function(node, tag, id, classes, attributes, pseudos){ // previous sibling
  2332. while ((node = node.previousSibling)) if (node.nodeType == 1){
  2333. this.push(node, tag, id, classes, attributes, pseudos);
  2334. break;
  2335. }
  2336. },
  2337. '!^': function(node, tag, id, classes, attributes, pseudos){ // last child
  2338. node = node.lastChild;
  2339. if (node){
  2340. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2341. else this['combinator:!+'](node, tag, id, classes, attributes, pseudos);
  2342. }
  2343. },
  2344. '!~': function(node, tag, id, classes, attributes, pseudos){ // previous siblings
  2345. while ((node = node.previousSibling)){
  2346. if (node.nodeType != 1) continue;
  2347. var uid = this.getUID(node);
  2348. if (this.bitUniques[uid]) break;
  2349. this.bitUniques[uid] = true;
  2350. this.push(node, tag, id, classes, attributes, pseudos);
  2351. }
  2352. }
  2353. };
  2354. for (var c in combinators) local['combinator:' + c] = combinators[c];
  2355. var pseudos = {
  2356. /*<pseudo-selectors>*/
  2357. 'empty': function(node){
  2358. var child = node.firstChild;
  2359. return !(child && child.nodeType == 1) && !(node.innerText || node.textContent || '').length;
  2360. },
  2361. 'not': function(node, expression){
  2362. return !this.matchNode(node, expression);
  2363. },
  2364. 'contains': function(node, text){
  2365. return (node.innerText || node.textContent || '').indexOf(text) > -1;
  2366. },
  2367. 'first-child': function(node){
  2368. while ((node = node.previousSibling)) if (node.nodeType == 1) return false;
  2369. return true;
  2370. },
  2371. 'last-child': function(node){
  2372. while ((node = node.nextSibling)) if (node.nodeType == 1) return false;
  2373. return true;
  2374. },
  2375. 'only-child': function(node){
  2376. var prev = node;
  2377. while ((prev = prev.previousSibling)) if (prev.nodeType == 1) return false;
  2378. var next = node;
  2379. while ((next = next.nextSibling)) if (next.nodeType == 1) return false;
  2380. return true;
  2381. },
  2382. /*<nth-pseudo-selectors>*/
  2383. 'nth-child': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTH'),
  2384. 'nth-last-child': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHLast'),
  2385. 'nth-of-type': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTHType', true),
  2386. 'nth-last-of-type': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHTypeLast', true),
  2387. 'index': function(node, index){
  2388. return this['pseudo:nth-child'](node, '' + (index + 1));
  2389. },
  2390. 'even': function(node){
  2391. return this['pseudo:nth-child'](node, '2n');
  2392. },
  2393. 'odd': function(node){
  2394. return this['pseudo:nth-child'](node, '2n+1');
  2395. },
  2396. /*</nth-pseudo-selectors>*/
  2397. /*<of-type-pseudo-selectors>*/
  2398. 'first-of-type': function(node){
  2399. var nodeName = node.nodeName;
  2400. while ((node = node.previousSibling)) if (node.nodeName == nodeName) return false;
  2401. return true;
  2402. },
  2403. 'last-of-type': function(node){
  2404. var nodeName = node.nodeName;
  2405. while ((node = node.nextSibling)) if (node.nodeName == nodeName) return false;
  2406. return true;
  2407. },
  2408. 'only-of-type': function(node){
  2409. var prev = node, nodeName = node.nodeName;
  2410. while ((prev = prev.previousSibling)) if (prev.nodeName == nodeName) return false;
  2411. var next = node;
  2412. while ((next = next.nextSibling)) if (next.nodeName == nodeName) return false;
  2413. return true;
  2414. },
  2415. /*</of-type-pseudo-selectors>*/
  2416. // custom pseudos
  2417. 'enabled': function(node){
  2418. return !node.disabled;
  2419. },
  2420. 'disabled': function(node){
  2421. return node.disabled;
  2422. },
  2423. 'checked': function(node){
  2424. return node.checked || node.selected;
  2425. },
  2426. 'focus': function(node){
  2427. return this.isHTMLDocument && this.document.activeElement === node && (node.href || node.type || this.hasAttribute(node, 'tabindex'));
  2428. },
  2429. 'root': function(node){
  2430. return (node === this.root);
  2431. },
  2432. 'selected': function(node){
  2433. return node.selected;
  2434. }
  2435. /*</pseudo-selectors>*/
  2436. };
  2437. for (var p in pseudos) local['pseudo:' + p] = pseudos[p];
  2438. // attributes methods
  2439. var attributeGetters = local.attributeGetters = {
  2440. 'for': function(){
  2441. return ('htmlFor' in this) ? this.htmlFor : this.getAttribute('for');
  2442. },
  2443. 'href': function(){
  2444. return ('href' in this) ? this.getAttribute('href', 2) : this.getAttribute('href');
  2445. },
  2446. 'style': function(){
  2447. return (this.style) ? this.style.cssText : this.getAttribute('style');
  2448. },
  2449. 'tabindex': function(){
  2450. var attributeNode = this.getAttributeNode('tabindex');
  2451. return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null;
  2452. },
  2453. 'type': function(){
  2454. return this.getAttribute('type');
  2455. },
  2456. 'maxlength': function(){
  2457. var attributeNode = this.getAttributeNode('maxLength');
  2458. return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null;
  2459. }
  2460. };
  2461. attributeGetters.MAXLENGTH = attributeGetters.maxLength = attributeGetters.maxlength;
  2462. // Slick
  2463. var Slick = local.Slick = (this.Slick || {});
  2464. Slick.version = '1.1.7';
  2465. // Slick finder
  2466. Slick.search = function(context, expression, append){
  2467. return local.search(context, expression, append);
  2468. };
  2469. Slick.find = function(context, expression){
  2470. return local.search(context, expression, null, true);
  2471. };
  2472. // Slick containment checker
  2473. Slick.contains = function(container, node){
  2474. local.setDocument(container);
  2475. return local.contains(container, node);
  2476. };
  2477. // Slick attribute getter
  2478. Slick.getAttribute = function(node, name){
  2479. local.setDocument(node);
  2480. return local.getAttribute(node, name);
  2481. };
  2482. Slick.hasAttribute = function(node, name){
  2483. local.setDocument(node);
  2484. return local.hasAttribute(node, name);
  2485. };
  2486. // Slick matcher
  2487. Slick.match = function(node, selector){
  2488. if (!(node && selector)) return false;
  2489. if (!selector || selector === node) return true;
  2490. local.setDocument(node);
  2491. return local.matchNode(node, selector);
  2492. };
  2493. // Slick attribute accessor
  2494. Slick.defineAttributeGetter = function(name, fn){
  2495. local.attributeGetters[name] = fn;
  2496. return this;
  2497. };
  2498. Slick.lookupAttributeGetter = function(name){
  2499. return local.attributeGetters[name];
  2500. };
  2501. // Slick pseudo accessor
  2502. Slick.definePseudo = function(name, fn){
  2503. local['pseudo:' + name] = function(node, argument){
  2504. return fn.call(node, argument);
  2505. };
  2506. return this;
  2507. };
  2508. Slick.lookupPseudo = function(name){
  2509. var pseudo = local['pseudo:' + name];
  2510. if (pseudo) return function(argument){
  2511. return pseudo.call(this, argument);
  2512. };
  2513. return null;
  2514. };
  2515. // Slick overrides accessor
  2516. Slick.override = function(regexp, fn){
  2517. local.override(regexp, fn);
  2518. return this;
  2519. };
  2520. Slick.isXML = local.isXML;
  2521. Slick.uidOf = function(node){
  2522. return local.getUIDHTML(node);
  2523. };
  2524. if (!this.Slick) this.Slick = Slick;
  2525. }).apply(/*<CommonJS>*/(typeof exports != 'undefined') ? exports : /*</CommonJS>*/this);
  2526. /*
  2527. ---
  2528. name: Element
  2529. 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.
  2530. license: MIT-style license.
  2531. requires: [Window, Document, Array, String, Function, Object, Number, Slick.Parser, Slick.Finder]
  2532. provides: [Element, Elements, $, $$, IFrame, Selectors]
  2533. ...
  2534. */
  2535. var Element = this.Element = function(tag, props){
  2536. var konstructor = Element.Constructors[tag];
  2537. if (konstructor) return konstructor(props);
  2538. if (typeof tag != 'string') return document.id(tag).set(props);
  2539. if (!props) props = {};
  2540. if (!(/^[\w-]+$/).test(tag)){
  2541. var parsed = Slick.parse(tag).expressions[0][0];
  2542. tag = (parsed.tag == '*') ? 'div' : parsed.tag;
  2543. if (parsed.id && props.id == null) props.id = parsed.id;
  2544. var attributes = parsed.attributes;
  2545. if (attributes) for (var attr, i = 0, l = attributes.length; i < l; i++){
  2546. attr = attributes[i];
  2547. if (props[attr.key] != null) continue;
  2548. if (attr.value != null && attr.operator == '=') props[attr.key] = attr.value;
  2549. else if (!attr.value && !attr.operator) props[attr.key] = true;
  2550. }
  2551. if (parsed.classList && props['class'] == null) props['class'] = parsed.classList.join(' ');
  2552. }
  2553. return document.newElement(tag, props);
  2554. };
  2555. if (Browser.Element){
  2556. Element.prototype = Browser.Element.prototype;
  2557. // IE8 and IE9 require the wrapping.
  2558. Element.prototype._fireEvent = (function(fireEvent){
  2559. return function(type, event){
  2560. return fireEvent.call(this, type, event);
  2561. };
  2562. })(Element.prototype.fireEvent);
  2563. }
  2564. new Type('Element', Element).mirror(function(name){
  2565. if (Array.prototype[name]) return;
  2566. var obj = {};
  2567. obj[name] = function(){
  2568. var results = [], args = arguments, elements = true;
  2569. for (var i = 0, l = this.length; i < l; i++){
  2570. var element = this[i], result = results[i] = element[name].apply(element, args);
  2571. elements = (elements && typeOf(result) == 'element');
  2572. }
  2573. return (elements) ? new Elements(results) : results;
  2574. };
  2575. Elements.implement(obj);
  2576. });
  2577. if (!Browser.Element){
  2578. Element.parent = Object;
  2579. Element.Prototype = {
  2580. '$constructor': Element,
  2581. '$family': Function.convert('element').hide()
  2582. };
  2583. Element.mirror(function(name, method){
  2584. Element.Prototype[name] = method;
  2585. });
  2586. }
  2587. Element.Constructors = {};
  2588. //<1.2compat>
  2589. Element.Constructors = new Hash;
  2590. //</1.2compat>
  2591. var IFrame = new Type('IFrame', function(){
  2592. var params = Array.link(arguments, {
  2593. properties: Type.isObject,
  2594. iframe: function(obj){
  2595. return (obj != null);
  2596. }
  2597. });
  2598. var props = params.properties || {}, iframe;
  2599. if (params.iframe) iframe = document.id(params.iframe);
  2600. var onload = props.onload || function(){};
  2601. delete props.onload;
  2602. props.id = props.name = [props.id, props.name, iframe ? (iframe.id || iframe.name) : 'IFrame_' + String.uniqueID()].pick();
  2603. iframe = new Element(iframe || 'iframe', props);
  2604. var onLoad = function(){
  2605. onload.call(iframe.contentWindow);
  2606. };
  2607. if (window.frames[props.id]) onLoad();
  2608. else iframe.addListener('load', onLoad);
  2609. return iframe;
  2610. });
  2611. var Elements = this.Elements = function(nodes){
  2612. if (nodes && nodes.length){
  2613. var uniques = {}, node;
  2614. for (var i = 0; node = nodes[i++];){
  2615. var uid = Slick.uidOf(node);
  2616. if (!uniques[uid]){
  2617. uniques[uid] = true;
  2618. this.push(node);
  2619. }
  2620. }
  2621. }
  2622. };
  2623. Elements.prototype = {length: 0};
  2624. Elements.parent = Array;
  2625. new Type('Elements', Elements).implement({
  2626. filter: function(filter, bind){
  2627. if (!filter) return this;
  2628. return new Elements(Array.filter(this, (typeOf(filter) == 'string') ? function(item){
  2629. return item.match(filter);
  2630. } : filter, bind));
  2631. }.protect(),
  2632. push: function(){
  2633. var length = this.length;
  2634. for (var i = 0, l = arguments.length; i < l; i++){
  2635. var item = document.id(arguments[i]);
  2636. if (item) this[length++] = item;
  2637. }
  2638. return (this.length = length);
  2639. }.protect(),
  2640. unshift: function(){
  2641. var items = [];
  2642. for (var i = 0, l = arguments.length; i < l; i++){
  2643. var item = document.id(arguments[i]);
  2644. if (item) items.push(item);
  2645. }
  2646. return Array.prototype.unshift.apply(this, items);
  2647. }.protect(),
  2648. concat: function(){
  2649. var newElements = new Elements(this);
  2650. for (var i = 0, l = arguments.length; i < l; i++){
  2651. var item = arguments[i];
  2652. if (Type.isEnumerable(item)) newElements.append(item);
  2653. else newElements.push(item);
  2654. }
  2655. return newElements;
  2656. }.protect(),
  2657. append: function(collection){
  2658. for (var i = 0, l = collection.length; i < l; i++) this.push(collection[i]);
  2659. return this;
  2660. }.protect(),
  2661. empty: function(){
  2662. while (this.length) delete this[--this.length];
  2663. return this;
  2664. }.protect()
  2665. });
  2666. //<1.2compat>
  2667. Elements.alias('extend', 'append');
  2668. //</1.2compat>
  2669. (function(){
  2670. // FF, IE
  2671. var splice = Array.prototype.splice, object = {'0': 0, '1': 1, length: 2};
  2672. splice.call(object, 1, 1);
  2673. if (object[1] == 1) Elements.implement('splice', function(){
  2674. var length = this.length;
  2675. var result = splice.apply(this, arguments);
  2676. while (length >= this.length) delete this[length--];
  2677. return result;
  2678. }.protect());
  2679. Array.forEachMethod(function(method, name){
  2680. Elements.implement(name, method);
  2681. });
  2682. Array.mirror(Elements);
  2683. /*<ltIE8>*/
  2684. var createElementAcceptsHTML;
  2685. try {
  2686. createElementAcceptsHTML = (document.createElement('<input name=x>').name == 'x');
  2687. } catch (e){}
  2688. var escapeQuotes = function(html){
  2689. return ('' + html).replace(/&/g, '&amp;').replace(/"/g, '&quot;');
  2690. };
  2691. /*</ltIE8>*/
  2692. /*<ltIE9>*/
  2693. // #2479 - IE8 Cannot set HTML of style element
  2694. var canChangeStyleHTML = (function(){
  2695. var div = document.createElement('style'),
  2696. flag = false;
  2697. try {
  2698. div.innerHTML = '#justTesing{margin: 0px;}';
  2699. flag = !!div.innerHTML;
  2700. } catch (e){}
  2701. return flag;
  2702. })();
  2703. /*</ltIE9>*/
  2704. Document.implement({
  2705. newElement: function(tag, props){
  2706. if (props){
  2707. if (props.checked != null) props.defaultChecked = props.checked;
  2708. if ((props.type == 'checkbox' || props.type == 'radio') && props.value == null) props.value = 'on';
  2709. /*<ltIE9>*/ // IE needs the type to be set before changing content of style element
  2710. if (!canChangeStyleHTML && tag == 'style'){
  2711. var styleElement = document.createElement('style');
  2712. styleElement.setAttribute('type', 'text/css');
  2713. if (props.type) delete props.type;
  2714. return this.id(styleElement).set(props);
  2715. }
  2716. /*</ltIE9>*/
  2717. /*<ltIE8>*/// Fix for readonly name and type properties in IE < 8
  2718. if (createElementAcceptsHTML){
  2719. tag = '<' + tag;
  2720. if (props.name) tag += ' name="' + escapeQuotes(props.name) + '"';
  2721. if (props.type) tag += ' type="' + escapeQuotes(props.type) + '"';
  2722. tag += '>';
  2723. delete props.name;
  2724. delete props.type;
  2725. }
  2726. /*</ltIE8>*/
  2727. }
  2728. return this.id(this.createElement(tag)).set(props);
  2729. }
  2730. });
  2731. })();
  2732. (function(){
  2733. Slick.uidOf(window);
  2734. Slick.uidOf(document);
  2735. Document.implement({
  2736. newTextNode: function(text){
  2737. return this.createTextNode(text);
  2738. },
  2739. getDocument: function(){
  2740. return this;
  2741. },
  2742. getWindow: function(){
  2743. return this.window;
  2744. },
  2745. id: (function(){
  2746. var types = {
  2747. string: function(id, nocash, doc){
  2748. id = Slick.find(doc, '#' + id.replace(/(\W)/g, '\\$1'));
  2749. return (id) ? types.element(id, nocash) : null;
  2750. },
  2751. element: function(el, nocash){
  2752. Slick.uidOf(el);
  2753. if (!nocash && !el.$family && !(/^(?:object|embed)$/i).test(el.tagName)){
  2754. var fireEvent = el.fireEvent;
  2755. // wrapping needed in IE7, or else crash
  2756. el._fireEvent = function(type, event){
  2757. return fireEvent(type, event);
  2758. };
  2759. Object.append(el, Element.Prototype);
  2760. }
  2761. return el;
  2762. },
  2763. object: function(obj, nocash, doc){
  2764. if (obj.toElement) return types.element(obj.toElement(doc), nocash);
  2765. return null;
  2766. }
  2767. };
  2768. types.textnode = types.whitespace = types.window = types.document = function(zero){
  2769. return zero;
  2770. };
  2771. return function(el, nocash, doc){
  2772. if (el && el.$family && el.uniqueNumber) return el;
  2773. var type = typeOf(el);
  2774. return (types[type]) ? types[type](el, nocash, doc || document) : null;
  2775. };
  2776. })()
  2777. });
  2778. if (window.$ == null) Window.implement('$', function(el, nc){
  2779. return document.id(el, nc, this.document);
  2780. });
  2781. Window.implement({
  2782. getDocument: function(){
  2783. return this.document;
  2784. },
  2785. getWindow: function(){
  2786. return this;
  2787. }
  2788. });
  2789. [Document, Element].invoke('implement', {
  2790. getElements: function(expression){
  2791. return Slick.search(this, expression, new Elements);
  2792. },
  2793. getElement: function(expression){
  2794. return document.id(Slick.find(this, expression));
  2795. }
  2796. });
  2797. var contains = {contains: function(element){
  2798. return Slick.contains(this, element);
  2799. }};
  2800. if (!document.contains) Document.implement(contains);
  2801. if (!document.createElement('div').contains) Element.implement(contains);
  2802. //<1.2compat>
  2803. Element.implement('hasChild', function(element){
  2804. return this !== element && this.contains(element);
  2805. });
  2806. (function(search, find, match){
  2807. this.Selectors = {};
  2808. var pseudos = this.Selectors.Pseudo = new Hash();
  2809. var addSlickPseudos = function(){
  2810. for (var name in pseudos) if (pseudos.hasOwnProperty(name)){
  2811. Slick.definePseudo(name, pseudos[name]);
  2812. delete pseudos[name];
  2813. }
  2814. };
  2815. Slick.search = function(context, expression, append){
  2816. addSlickPseudos();
  2817. return search.call(this, context, expression, append);
  2818. };
  2819. Slick.find = function(context, expression){
  2820. addSlickPseudos();
  2821. return find.call(this, context, expression);
  2822. };
  2823. Slick.match = function(node, selector){
  2824. addSlickPseudos();
  2825. return match.call(this, node, selector);
  2826. };
  2827. })(Slick.search, Slick.find, Slick.match);
  2828. //</1.2compat>
  2829. // tree walking
  2830. var injectCombinator = function(expression, combinator){
  2831. if (!expression) return combinator;
  2832. expression = Object.clone(Slick.parse(expression));
  2833. var expressions = expression.expressions;
  2834. for (var i = expressions.length; i--;)
  2835. expressions[i][0].combinator = combinator;
  2836. return expression;
  2837. };
  2838. Object.forEach({
  2839. getNext: '~',
  2840. getPrevious: '!~',
  2841. getParent: '!'
  2842. }, function(combinator, method){
  2843. Element.implement(method, function(expression){
  2844. return this.getElement(injectCombinator(expression, combinator));
  2845. });
  2846. });
  2847. Object.forEach({
  2848. getAllNext: '~',
  2849. getAllPrevious: '!~',
  2850. getSiblings: '~~',
  2851. getChildren: '>',
  2852. getParents: '!'
  2853. }, function(combinator, method){
  2854. Element.implement(method, function(expression){
  2855. return this.getElements(injectCombinator(expression, combinator));
  2856. });
  2857. });
  2858. Element.implement({
  2859. getFirst: function(expression){
  2860. return document.id(Slick.search(this, injectCombinator(expression, '>'))[0]);
  2861. },
  2862. getLast: function(expression){
  2863. return document.id(Slick.search(this, injectCombinator(expression, '>')).getLast());
  2864. },
  2865. getWindow: function(){
  2866. return this.ownerDocument.window;
  2867. },
  2868. getDocument: function(){
  2869. return this.ownerDocument;
  2870. },
  2871. getElementById: function(id){
  2872. return document.id(Slick.find(this, '#' + ('' + id).replace(/(\W)/g, '\\$1')));
  2873. },
  2874. match: function(expression){
  2875. return !expression || Slick.match(this, expression);
  2876. }
  2877. });
  2878. //<1.2compat>
  2879. if (window.$$ == null) Window.implement('$$', function(selector){
  2880. var elements = new Elements;
  2881. if (arguments.length == 1 && typeof selector == 'string') return Slick.search(this.document, selector, elements);
  2882. var args = Array.flatten(arguments);
  2883. for (var i = 0, l = args.length; i < l; i++){
  2884. var item = args[i];
  2885. switch (typeOf(item)){
  2886. case 'element': elements.push(item); break;
  2887. case 'string': Slick.search(this.document, item, elements);
  2888. }
  2889. }
  2890. return elements;
  2891. });
  2892. //</1.2compat>
  2893. if (window.$$ == null) Window.implement('$$', function(selector){
  2894. if (arguments.length == 1){
  2895. if (typeof selector == 'string') return Slick.search(this.document, selector, new Elements);
  2896. else if (Type.isEnumerable(selector)) return new Elements(selector);
  2897. }
  2898. return new Elements(arguments);
  2899. });
  2900. // Inserters
  2901. var inserters = {
  2902. before: function(context, element){
  2903. var parent = element.parentNode;
  2904. if (parent) parent.insertBefore(context, element);
  2905. },
  2906. after: function(context, element){
  2907. var parent = element.parentNode;
  2908. if (parent) parent.insertBefore(context, element.nextSibling);
  2909. },
  2910. bottom: function(context, element){
  2911. element.appendChild(context);
  2912. },
  2913. top: function(context, element){
  2914. element.insertBefore(context, element.firstChild);
  2915. }
  2916. };
  2917. inserters.inside = inserters.bottom;
  2918. //<1.2compat>
  2919. Object.each(inserters, function(inserter, where){
  2920. where = where.capitalize();
  2921. var methods = {};
  2922. methods['inject' + where] = function(el){
  2923. inserter(this, document.id(el, true));
  2924. return this;
  2925. };
  2926. methods['grab' + where] = function(el){
  2927. inserter(document.id(el, true), this);
  2928. return this;
  2929. };
  2930. Element.implement(methods);
  2931. });
  2932. //</1.2compat>
  2933. // getProperty / setProperty
  2934. var propertyGetters = {}, propertySetters = {};
  2935. // properties
  2936. var properties = {};
  2937. Array.forEach([
  2938. 'type', 'value', 'defaultValue', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan',
  2939. 'frameBorder', 'rowSpan', 'tabIndex', 'useMap'
  2940. ], function(property){
  2941. properties[property.toLowerCase()] = property;
  2942. });
  2943. properties.html = 'innerHTML';
  2944. properties.text = (document.createElement('div').textContent == null) ? 'innerText': 'textContent';
  2945. Object.forEach(properties, function(real, key){
  2946. propertySetters[key] = function(node, value){
  2947. node[real] = value;
  2948. };
  2949. propertyGetters[key] = function(node){
  2950. return node[real];
  2951. };
  2952. });
  2953. /*<ltIE9>*/
  2954. propertySetters.text = (function(){
  2955. return function(node, value){
  2956. if (node.get('tag') == 'style') node.set('html', value);
  2957. else node[properties.text] = value;
  2958. };
  2959. })(propertySetters.text);
  2960. propertyGetters.text = (function(getter){
  2961. return function(node){
  2962. return (node.get('tag') == 'style') ? node.innerHTML : getter(node);
  2963. };
  2964. })(propertyGetters.text);
  2965. /*</ltIE9>*/
  2966. // Booleans
  2967. var bools = [
  2968. 'compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked',
  2969. 'disabled', 'readOnly', 'multiple', 'selected', 'noresize',
  2970. 'defer', 'defaultChecked', 'autofocus', 'controls', 'autoplay',
  2971. 'loop'
  2972. ];
  2973. var booleans = {};
  2974. Array.forEach(bools, function(bool){
  2975. var lower = bool.toLowerCase();
  2976. booleans[lower] = bool;
  2977. propertySetters[lower] = function(node, value){
  2978. node[bool] = !!value;
  2979. };
  2980. propertyGetters[lower] = function(node){
  2981. return !!node[bool];
  2982. };
  2983. });
  2984. // Special cases
  2985. Object.append(propertySetters, {
  2986. 'class': function(node, value){
  2987. ('className' in node) ? node.className = (value || '') : node.setAttribute('class', value);
  2988. },
  2989. 'for': function(node, value){
  2990. ('htmlFor' in node) ? node.htmlFor = value : node.setAttribute('for', value);
  2991. },
  2992. 'style': function(node, value){
  2993. (node.style) ? node.style.cssText = value : node.setAttribute('style', value);
  2994. },
  2995. 'value': function(node, value){
  2996. node.value = (value != null) ? value : '';
  2997. }
  2998. });
  2999. propertyGetters['class'] = function(node){
  3000. return ('className' in node) ? node.className || null : node.getAttribute('class');
  3001. };
  3002. /* <webkit> */
  3003. var el = document.createElement('button');
  3004. // IE sets type as readonly and throws
  3005. try { el.type = 'button'; } catch (e){}
  3006. if (el.type != 'button') propertySetters.type = function(node, value){
  3007. node.setAttribute('type', value);
  3008. };
  3009. el = null;
  3010. /* </webkit> */
  3011. /*<IE>*/
  3012. /*<ltIE9>*/
  3013. // #2479 - IE8 Cannot set HTML of style element
  3014. var canChangeStyleHTML = (function(){
  3015. var div = document.createElement('style'),
  3016. flag = false;
  3017. try {
  3018. div.innerHTML = '#justTesing{margin: 0px;}';
  3019. flag = !!div.innerHTML;
  3020. } catch (e){}
  3021. return flag;
  3022. })();
  3023. /*</ltIE9>*/
  3024. var input = document.createElement('input'), volatileInputValue, html5InputSupport;
  3025. // #2178
  3026. input.value = 't';
  3027. input.type = 'submit';
  3028. volatileInputValue = input.value != 't';
  3029. // #2443 - IE throws "Invalid Argument" when trying to use html5 input types
  3030. try {
  3031. input.value = '';
  3032. input.type = 'email';
  3033. html5InputSupport = input.type == 'email';
  3034. } catch (e){}
  3035. input = null;
  3036. if (volatileInputValue || !html5InputSupport) propertySetters.type = function(node, type){
  3037. try {
  3038. var value = node.value;
  3039. node.type = type;
  3040. node.value = value;
  3041. } catch (e){}
  3042. };
  3043. /*</IE>*/
  3044. /* getProperty, setProperty */
  3045. /* <ltIE9> */
  3046. var pollutesGetAttribute = (function(div){
  3047. div.random = 'attribute';
  3048. return (div.getAttribute('random') == 'attribute');
  3049. })(document.createElement('div'));
  3050. var hasCloneBug = (function(test){
  3051. test.innerHTML = '<object><param name="should_fix" value="the unknown" /></object>';
  3052. return test.cloneNode(true).firstChild.childNodes.length != 1;
  3053. })(document.createElement('div'));
  3054. /* </ltIE9> */
  3055. var hasClassList = !!document.createElement('div').classList;
  3056. var classes = function(className){
  3057. var classNames = (className || '').clean().split(' '), uniques = {};
  3058. return classNames.filter(function(className){
  3059. if (className !== '' && !uniques[className]) return uniques[className] = className;
  3060. });
  3061. };
  3062. var addToClassList = function(name){
  3063. this.classList.add(name);
  3064. };
  3065. var removeFromClassList = function(name){
  3066. this.classList.remove(name);
  3067. };
  3068. Element.implement({
  3069. setProperty: function(name, value){
  3070. var setter = propertySetters[name.toLowerCase()];
  3071. if (setter){
  3072. setter(this, value);
  3073. } else {
  3074. /* <ltIE9> */
  3075. var attributeWhiteList;
  3076. if (pollutesGetAttribute) attributeWhiteList = this.retrieve('$attributeWhiteList', {});
  3077. /* </ltIE9> */
  3078. if (value == null){
  3079. this.removeAttribute(name);
  3080. /* <ltIE9> */
  3081. if (pollutesGetAttribute) delete attributeWhiteList[name];
  3082. /* </ltIE9> */
  3083. } else {
  3084. this.setAttribute(name, '' + value);
  3085. /* <ltIE9> */
  3086. if (pollutesGetAttribute) attributeWhiteList[name] = true;
  3087. /* </ltIE9> */
  3088. }
  3089. }
  3090. return this;
  3091. },
  3092. setProperties: function(attributes){
  3093. for (var attribute in attributes) this.setProperty(attribute, attributes[attribute]);
  3094. return this;
  3095. },
  3096. getProperty: function(name){
  3097. var getter = propertyGetters[name.toLowerCase()];
  3098. if (getter) return getter(this);
  3099. /* <ltIE9> */
  3100. if (pollutesGetAttribute){
  3101. var attr = this.getAttributeNode(name), attributeWhiteList = this.retrieve('$attributeWhiteList', {});
  3102. if (!attr) return null;
  3103. if (attr.expando && !attributeWhiteList[name]){
  3104. var outer = this.outerHTML;
  3105. // segment by the opening tag and find mention of attribute name
  3106. if (outer.substr(0, outer.search(/\/?['"]?>(?![^<]*<['"])/)).indexOf(name) < 0) return null;
  3107. attributeWhiteList[name] = true;
  3108. }
  3109. }
  3110. /* </ltIE9> */
  3111. var result = Slick.getAttribute(this, name);
  3112. return (!result && !Slick.hasAttribute(this, name)) ? null : result;
  3113. },
  3114. getProperties: function(){
  3115. var args = Array.convert(arguments);
  3116. return args.map(this.getProperty, this).associate(args);
  3117. },
  3118. removeProperty: function(name){
  3119. return this.setProperty(name, null);
  3120. },
  3121. removeProperties: function(){
  3122. Array.each(arguments, this.removeProperty, this);
  3123. return this;
  3124. },
  3125. set: function(prop, value){
  3126. var property = Element.Properties[prop];
  3127. (property && property.set) ? property.set.call(this, value) : this.setProperty(prop, value);
  3128. }.overloadSetter(),
  3129. get: function(prop){
  3130. var property = Element.Properties[prop];
  3131. return (property && property.get) ? property.get.apply(this) : this.getProperty(prop);
  3132. }.overloadGetter(),
  3133. erase: function(prop){
  3134. var property = Element.Properties[prop];
  3135. (property && property.erase) ? property.erase.apply(this) : this.removeProperty(prop);
  3136. return this;
  3137. },
  3138. hasClass: hasClassList ? function(className){
  3139. return this.classList.contains(className);
  3140. } : function(className){
  3141. return classes(this.className).contains(className);
  3142. },
  3143. addClass: hasClassList ? function(className){
  3144. classes(className).forEach(addToClassList, this);
  3145. return this;
  3146. } : function(className){
  3147. this.className = classes(className + ' ' + this.className).join(' ');
  3148. return this;
  3149. },
  3150. removeClass: hasClassList ? function(className){
  3151. classes(className).forEach(removeFromClassList, this);
  3152. return this;
  3153. } : function(className){
  3154. var classNames = classes(this.className);
  3155. classes(className).forEach(classNames.erase, classNames);
  3156. this.className = classNames.join(' ');
  3157. return this;
  3158. },
  3159. toggleClass: function(className, force){
  3160. if (force == null) force = !this.hasClass(className);
  3161. return (force) ? this.addClass(className) : this.removeClass(className);
  3162. },
  3163. adopt: function(){
  3164. var parent = this, fragment, elements = Array.flatten(arguments), length = elements.length;
  3165. if (length > 1) parent = fragment = document.createDocumentFragment();
  3166. for (var i = 0; i < length; i++){
  3167. var element = document.id(elements[i], true);
  3168. if (element) parent.appendChild(element);
  3169. }
  3170. if (fragment) this.appendChild(fragment);
  3171. return this;
  3172. },
  3173. appendText: function(text, where){
  3174. return this.grab(this.getDocument().newTextNode(text), where);
  3175. },
  3176. grab: function(el, where){
  3177. inserters[where || 'bottom'](document.id(el, true), this);
  3178. return this;
  3179. },
  3180. inject: function(el, where){
  3181. inserters[where || 'bottom'](this, document.id(el, true));
  3182. return this;
  3183. },
  3184. replaces: function(el){
  3185. el = document.id(el, true);
  3186. el.parentNode.replaceChild(this, el);
  3187. return this;
  3188. },
  3189. wraps: function(el, where){
  3190. el = document.id(el, true);
  3191. return this.replaces(el).grab(el, where);
  3192. },
  3193. getSelected: function(){
  3194. this.selectedIndex; // Safari 3.2.1
  3195. return new Elements(Array.convert(this.options).filter(function(option){
  3196. return option.selected;
  3197. }));
  3198. },
  3199. toQueryString: function(){
  3200. var queryString = [];
  3201. this.getElements('input, select, textarea').each(function(el){
  3202. var type = el.type;
  3203. if (!el.name || el.disabled || type == 'submit' || type == 'reset' || type == 'file' || type == 'image') return;
  3204. var value = (el.get('tag') == 'select') ? el.getSelected().map(function(opt){
  3205. // IE
  3206. return document.id(opt).get('value');
  3207. }) : ((type == 'radio' || type == 'checkbox') && !el.checked) ? null : el.get('value');
  3208. Array.convert(value).each(function(val){
  3209. if (typeof val != 'undefined') queryString.push(encodeURIComponent(el.name) + '=' + encodeURIComponent(val));
  3210. });
  3211. });
  3212. return queryString.join('&');
  3213. }
  3214. });
  3215. // appendHTML
  3216. var appendInserters = {
  3217. before: 'beforeBegin',
  3218. after: 'afterEnd',
  3219. bottom: 'beforeEnd',
  3220. top: 'afterBegin',
  3221. inside: 'beforeEnd'
  3222. };
  3223. Element.implement('appendHTML', ('insertAdjacentHTML' in document.createElement('div')) ? function(html, where){
  3224. this.insertAdjacentHTML(appendInserters[where || 'bottom'], html);
  3225. return this;
  3226. } : function(html, where){
  3227. var temp = new Element('div', {html: html}),
  3228. children = temp.childNodes,
  3229. fragment = temp.firstChild;
  3230. if (!fragment) return this;
  3231. if (children.length > 1){
  3232. fragment = document.createDocumentFragment();
  3233. for (var i = 0, l = children.length; i < l; i++){
  3234. fragment.appendChild(children[i]);
  3235. }
  3236. }
  3237. inserters[where || 'bottom'](fragment, this);
  3238. return this;
  3239. });
  3240. var collected = {}, storage = {};
  3241. var get = function(uid){
  3242. return (storage[uid] || (storage[uid] = {}));
  3243. };
  3244. var clean = function(item){
  3245. var uid = item.uniqueNumber;
  3246. if (item.removeEvents) item.removeEvents();
  3247. if (item.clearAttributes) item.clearAttributes();
  3248. if (uid != null){
  3249. delete collected[uid];
  3250. delete storage[uid];
  3251. }
  3252. return item;
  3253. };
  3254. var formProps = {input: 'checked', option: 'selected', textarea: 'value'};
  3255. Element.implement({
  3256. destroy: function(){
  3257. var children = clean(this).getElementsByTagName('*');
  3258. Array.each(children, clean);
  3259. Element.dispose(this);
  3260. return null;
  3261. },
  3262. empty: function(){
  3263. Array.convert(this.childNodes).each(Element.dispose);
  3264. return this;
  3265. },
  3266. dispose: function(){
  3267. return (this.parentNode) ? this.parentNode.removeChild(this) : this;
  3268. },
  3269. clone: function(contents, keepid){
  3270. contents = contents !== false;
  3271. var clone = this.cloneNode(contents), ce = [clone], te = [this], i;
  3272. if (contents){
  3273. ce.append(Array.convert(clone.getElementsByTagName('*')));
  3274. te.append(Array.convert(this.getElementsByTagName('*')));
  3275. }
  3276. for (i = ce.length; i--;){
  3277. var node = ce[i], element = te[i];
  3278. if (!keepid) node.removeAttribute('id');
  3279. /*<ltIE9>*/
  3280. if (node.clearAttributes){
  3281. node.clearAttributes();
  3282. node.mergeAttributes(element);
  3283. node.removeAttribute('uniqueNumber');
  3284. if (node.options){
  3285. var no = node.options, eo = element.options;
  3286. for (var j = no.length; j--;) no[j].selected = eo[j].selected;
  3287. }
  3288. }
  3289. /*</ltIE9>*/
  3290. var prop = formProps[element.tagName.toLowerCase()];
  3291. if (prop && element[prop]) node[prop] = element[prop];
  3292. }
  3293. /*<ltIE9>*/
  3294. if (hasCloneBug){
  3295. var co = clone.getElementsByTagName('object'), to = this.getElementsByTagName('object');
  3296. for (i = co.length; i--;) co[i].outerHTML = to[i].outerHTML;
  3297. }
  3298. /*</ltIE9>*/
  3299. return document.id(clone);
  3300. }
  3301. });
  3302. [Element, Window, Document].invoke('implement', {
  3303. addListener: function(type, fn){
  3304. if (window.attachEvent && !window.addEventListener){
  3305. collected[Slick.uidOf(this)] = this;
  3306. }
  3307. if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]);
  3308. else this.attachEvent('on' + type, fn);
  3309. return this;
  3310. },
  3311. removeListener: function(type, fn){
  3312. if (this.removeEventListener) this.removeEventListener(type, fn, !!arguments[2]);
  3313. else this.detachEvent('on' + type, fn);
  3314. return this;
  3315. },
  3316. retrieve: function(property, dflt){
  3317. var storage = get(Slick.uidOf(this)), prop = storage[property];
  3318. if (dflt != null && prop == null) prop = storage[property] = dflt;
  3319. return prop != null ? prop : null;
  3320. },
  3321. store: function(property, value){
  3322. var storage = get(Slick.uidOf(this));
  3323. storage[property] = value;
  3324. return this;
  3325. },
  3326. eliminate: function(property){
  3327. var storage = get(Slick.uidOf(this));
  3328. delete storage[property];
  3329. return this;
  3330. }
  3331. });
  3332. /*<ltIE9>*/
  3333. if (window.attachEvent && !window.addEventListener){
  3334. var gc = function(){
  3335. Object.each(collected, clean);
  3336. if (window.CollectGarbage) CollectGarbage();
  3337. window.removeListener('unload', gc);
  3338. };
  3339. window.addListener('unload', gc);
  3340. }
  3341. /*</ltIE9>*/
  3342. Element.Properties = {};
  3343. //<1.2compat>
  3344. Element.Properties = new Hash;
  3345. //</1.2compat>
  3346. Element.Properties.style = {
  3347. set: function(style){
  3348. this.style.cssText = style;
  3349. },
  3350. get: function(){
  3351. return this.style.cssText;
  3352. },
  3353. erase: function(){
  3354. this.style.cssText = '';
  3355. }
  3356. };
  3357. Element.Properties.tag = {
  3358. get: function(){
  3359. return this.tagName.toLowerCase();
  3360. }
  3361. };
  3362. Element.Properties.html = {
  3363. set: function(html){
  3364. if (html == null) html = '';
  3365. else if (typeOf(html) == 'array') html = html.join('');
  3366. /*<ltIE9>*/
  3367. if (this.styleSheet && !canChangeStyleHTML) this.styleSheet.cssText = html;
  3368. else /*</ltIE9>*/this.innerHTML = html;
  3369. },
  3370. erase: function(){
  3371. this.set('html', '');
  3372. }
  3373. };
  3374. var supportsHTML5Elements = true, supportsTableInnerHTML = true, supportsTRInnerHTML = true;
  3375. /*<ltIE9>*/
  3376. // technique by jdbarlett - http://jdbartlett.com/innershiv/
  3377. var div = document.createElement('div');
  3378. var fragment;
  3379. div.innerHTML = '<nav></nav>';
  3380. supportsHTML5Elements = (div.childNodes.length == 1);
  3381. if (!supportsHTML5Elements){
  3382. var tags = 'abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' ');
  3383. fragment = document.createDocumentFragment(), l = tags.length;
  3384. while (l--) fragment.createElement(tags[l]);
  3385. }
  3386. div = null;
  3387. /*</ltIE9>*/
  3388. /*<IE>*/
  3389. supportsTableInnerHTML = Function.attempt(function(){
  3390. var table = document.createElement('table');
  3391. table.innerHTML = '<tr><td></td></tr>';
  3392. return true;
  3393. });
  3394. /*<ltFF4>*/
  3395. var tr = document.createElement('tr'), html = '<td></td>';
  3396. tr.innerHTML = html;
  3397. supportsTRInnerHTML = (tr.innerHTML == html);
  3398. tr = null;
  3399. /*</ltFF4>*/
  3400. if (!supportsTableInnerHTML || !supportsTRInnerHTML || !supportsHTML5Elements){
  3401. Element.Properties.html.set = (function(set){
  3402. var translations = {
  3403. table: [1, '<table>', '</table>'],
  3404. select: [1, '<select>', '</select>'],
  3405. tbody: [2, '<table><tbody>', '</tbody></table>'],
  3406. tr: [3, '<table><tbody><tr>', '</tr></tbody></table>']
  3407. };
  3408. translations.thead = translations.tfoot = translations.tbody;
  3409. return function(html){
  3410. /*<ltIE9>*/
  3411. if (this.styleSheet) return set.call(this, html);
  3412. /*</ltIE9>*/
  3413. var wrap = translations[this.get('tag')];
  3414. if (!wrap && !supportsHTML5Elements) wrap = [0, '', ''];
  3415. if (!wrap) return set.call(this, html);
  3416. var level = wrap[0], wrapper = document.createElement('div'), target = wrapper;
  3417. if (!supportsHTML5Elements) fragment.appendChild(wrapper);
  3418. wrapper.innerHTML = [wrap[1], html, wrap[2]].flatten().join('');
  3419. while (level--) target = target.firstChild;
  3420. this.empty().adopt(target.childNodes);
  3421. if (!supportsHTML5Elements) fragment.removeChild(wrapper);
  3422. wrapper = null;
  3423. };
  3424. })(Element.Properties.html.set);
  3425. }
  3426. /*</IE>*/
  3427. /*<ltIE9>*/
  3428. var testForm = document.createElement('form');
  3429. testForm.innerHTML = '<select><option>s</option></select>';
  3430. if (testForm.firstChild.value != 's') Element.Properties.value = {
  3431. set: function(value){
  3432. var tag = this.get('tag');
  3433. if (tag != 'select') return this.setProperty('value', value);
  3434. var options = this.getElements('option');
  3435. value = String(value);
  3436. for (var i = 0; i < options.length; i++){
  3437. var option = options[i],
  3438. attr = option.getAttributeNode('value'),
  3439. optionValue = (attr && attr.specified) ? option.value : option.get('text');
  3440. if (optionValue === value) return option.selected = true;
  3441. }
  3442. },
  3443. get: function(){
  3444. var option = this, tag = option.get('tag');
  3445. if (tag != 'select' && tag != 'option') return this.getProperty('value');
  3446. if (tag == 'select' && !(option = option.getSelected()[0])) return '';
  3447. var attr = option.getAttributeNode('value');
  3448. return (attr && attr.specified) ? option.value : option.get('text');
  3449. }
  3450. };
  3451. testForm = null;
  3452. /*</ltIE9>*/
  3453. /*<IE>*/
  3454. if (document.createElement('div').getAttributeNode('id')) Element.Properties.id = {
  3455. set: function(id){
  3456. this.id = this.getAttributeNode('id').value = id;
  3457. },
  3458. get: function(){
  3459. return this.id || null;
  3460. },
  3461. erase: function(){
  3462. this.id = this.getAttributeNode('id').value = '';
  3463. }
  3464. };
  3465. /*</IE>*/
  3466. })();
  3467. /*
  3468. ---
  3469. name: Event
  3470. description: Contains the Event Type, to make the event object cross-browser.
  3471. license: MIT-style license.
  3472. requires: [Window, Document, Array, Function, String, Object]
  3473. provides: Event
  3474. ...
  3475. */
  3476. (function(){
  3477. var _keys = {};
  3478. var normalizeWheelSpeed = function(event){
  3479. var normalized;
  3480. if (event.wheelDelta){
  3481. normalized = event.wheelDelta % 120 == 0 ? event.wheelDelta / 120 : event.wheelDelta / 12;
  3482. } else {
  3483. var rawAmount = event.deltaY || event.detail || 0;
  3484. normalized = -(rawAmount % 3 == 0 ? rawAmount / 3 : rawAmount * 10);
  3485. }
  3486. return normalized;
  3487. };
  3488. var DOMEvent = this.DOMEvent = new Type('DOMEvent', function(event, win){
  3489. if (!win) win = window;
  3490. event = event || win.event;
  3491. if (event.$extended) return event;
  3492. this.event = event;
  3493. this.$extended = true;
  3494. this.shift = event.shiftKey;
  3495. this.control = event.ctrlKey;
  3496. this.alt = event.altKey;
  3497. this.meta = event.metaKey;
  3498. var type = this.type = event.type;
  3499. var target = event.target || event.srcElement;
  3500. while (target && target.nodeType == 3) target = target.parentNode;
  3501. this.target = document.id(target);
  3502. if (type.indexOf('key') == 0){
  3503. var code = this.code = (event.which || event.keyCode);
  3504. if (!this.shift || type != 'keypress') this.key = _keys[code]/*<1.3compat>*/ || Object.keyOf(Event.Keys, code)/*</1.3compat>*/;
  3505. if (type == 'keydown' || type == 'keyup'){
  3506. if (code > 111 && code < 124) this.key = 'f' + (code - 111);
  3507. else if (code > 95 && code < 106) this.key = code - 96;
  3508. }
  3509. if (this.key == null) this.key = String.fromCharCode(code).toLowerCase();
  3510. } else if (type == 'click' || type == 'dblclick' || type == 'contextmenu' || type == 'wheel' || type == 'DOMMouseScroll' || type.indexOf('mouse') == 0){
  3511. var doc = win.document;
  3512. doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
  3513. this.page = {
  3514. x: (event.pageX != null) ? event.pageX : event.clientX + doc.scrollLeft,
  3515. y: (event.pageY != null) ? event.pageY : event.clientY + doc.scrollTop
  3516. };
  3517. this.client = {
  3518. x: (event.pageX != null) ? event.pageX - win.pageXOffset : event.clientX,
  3519. y: (event.pageY != null) ? event.pageY - win.pageYOffset : event.clientY
  3520. };
  3521. if (type == 'DOMMouseScroll' || type == 'wheel' || type == 'mousewheel') this.wheel = normalizeWheelSpeed(event);
  3522. this.rightClick = (event.which == 3 || event.button == 2);
  3523. if (type == 'mouseover' || type == 'mouseout' || type == 'mouseenter' || type == 'mouseleave'){
  3524. var overTarget = type == 'mouseover' || type == 'mouseenter';
  3525. var related = event.relatedTarget || event[(overTarget ? 'from' : 'to') + 'Element'];
  3526. while (related && related.nodeType == 3) related = related.parentNode;
  3527. this.relatedTarget = document.id(related);
  3528. }
  3529. } else if (type.indexOf('touch') == 0 || type.indexOf('gesture') == 0){
  3530. this.rotation = event.rotation;
  3531. this.scale = event.scale;
  3532. this.targetTouches = event.targetTouches;
  3533. this.changedTouches = event.changedTouches;
  3534. var touches = this.touches = event.touches;
  3535. if (touches && touches[0]){
  3536. var touch = touches[0];
  3537. this.page = {x: touch.pageX, y: touch.pageY};
  3538. this.client = {x: touch.clientX, y: touch.clientY};
  3539. }
  3540. }
  3541. if (!this.client) this.client = {};
  3542. if (!this.page) this.page = {};
  3543. });
  3544. DOMEvent.implement({
  3545. stop: function(){
  3546. return this.preventDefault().stopPropagation();
  3547. },
  3548. stopPropagation: function(){
  3549. if (this.event.stopPropagation) this.event.stopPropagation();
  3550. else this.event.cancelBubble = true;
  3551. return this;
  3552. },
  3553. preventDefault: function(){
  3554. if (this.event.preventDefault) this.event.preventDefault();
  3555. else this.event.returnValue = false;
  3556. return this;
  3557. }
  3558. });
  3559. DOMEvent.defineKey = function(code, key){
  3560. _keys[code] = key;
  3561. return this;
  3562. };
  3563. DOMEvent.defineKeys = DOMEvent.defineKey.overloadSetter(true);
  3564. DOMEvent.defineKeys({
  3565. '38': 'up', '40': 'down', '37': 'left', '39': 'right',
  3566. '27': 'esc', '32': 'space', '8': 'backspace', '9': 'tab',
  3567. '46': 'delete', '13': 'enter'
  3568. });
  3569. })();
  3570. /*<1.3compat>*/
  3571. var Event = this.Event = DOMEvent;
  3572. Event.Keys = {};
  3573. /*</1.3compat>*/
  3574. /*<1.2compat>*/
  3575. Event.Keys = new Hash(Event.Keys);
  3576. /*</1.2compat>*/
  3577. /*
  3578. ---
  3579. name: Element.Event
  3580. description: Contains Element methods for dealing with events. This file also includes mouseenter and mouseleave custom Element Events, if necessary.
  3581. license: MIT-style license.
  3582. requires: [Element, Event]
  3583. provides: Element.Event
  3584. ...
  3585. */
  3586. (function(){
  3587. Element.Properties.events = {set: function(events){
  3588. this.addEvents(events);
  3589. }};
  3590. [Element, Window, Document].invoke('implement', {
  3591. addEvent: function(type, fn){
  3592. var events = this.retrieve('events', {});
  3593. if (!events[type]) events[type] = {keys: [], values: []};
  3594. if (events[type].keys.contains(fn)) return this;
  3595. events[type].keys.push(fn);
  3596. var realType = type,
  3597. custom = Element.Events[type],
  3598. condition = fn,
  3599. self = this;
  3600. if (custom){
  3601. if (custom.onAdd) custom.onAdd.call(this, fn, type);
  3602. if (custom.condition){
  3603. condition = function(event){
  3604. if (custom.condition.call(this, event, type)) return fn.call(this, event);
  3605. return true;
  3606. };
  3607. }
  3608. if (custom.base) realType = Function.convert(custom.base).call(this, type);
  3609. }
  3610. var defn = function(){
  3611. return fn.call(self);
  3612. };
  3613. var nativeEvent = Element.NativeEvents[realType];
  3614. if (nativeEvent){
  3615. if (nativeEvent == 2){
  3616. defn = function(event){
  3617. event = new DOMEvent(event, self.getWindow());
  3618. if (condition.call(self, event) === false) event.stop();
  3619. };
  3620. }
  3621. this.addListener(realType, defn, arguments[2]);
  3622. }
  3623. events[type].values.push(defn);
  3624. return this;
  3625. },
  3626. removeEvent: function(type, fn){
  3627. var events = this.retrieve('events');
  3628. if (!events || !events[type]) return this;
  3629. var list = events[type];
  3630. var index = list.keys.indexOf(fn);
  3631. if (index == -1) return this;
  3632. var value = list.values[index];
  3633. delete list.keys[index];
  3634. delete list.values[index];
  3635. var custom = Element.Events[type];
  3636. if (custom){
  3637. if (custom.onRemove) custom.onRemove.call(this, fn, type);
  3638. if (custom.base) type = Function.convert(custom.base).call(this, type);
  3639. }
  3640. return (Element.NativeEvents[type]) ? this.removeListener(type, value, arguments[2]) : this;
  3641. },
  3642. addEvents: function(events){
  3643. for (var event in events) this.addEvent(event, events[event]);
  3644. return this;
  3645. },
  3646. removeEvents: function(events){
  3647. var type;
  3648. if (typeOf(events) == 'object'){
  3649. for (type in events) this.removeEvent(type, events[type]);
  3650. return this;
  3651. }
  3652. var attached = this.retrieve('events');
  3653. if (!attached) return this;
  3654. if (!events){
  3655. for (type in attached) this.removeEvents(type);
  3656. this.eliminate('events');
  3657. } else if (attached[events]){
  3658. attached[events].keys.each(function(fn){
  3659. this.removeEvent(events, fn);
  3660. }, this);
  3661. delete attached[events];
  3662. }
  3663. return this;
  3664. },
  3665. fireEvent: function(type, args, delay){
  3666. var events = this.retrieve('events');
  3667. if (!events || !events[type]) return this;
  3668. args = Array.convert(args);
  3669. events[type].keys.each(function(fn){
  3670. if (delay) fn.delay(delay, this, args);
  3671. else fn.apply(this, args);
  3672. }, this);
  3673. return this;
  3674. },
  3675. cloneEvents: function(from, type){
  3676. from = document.id(from);
  3677. var events = from.retrieve('events');
  3678. if (!events) return this;
  3679. if (!type){
  3680. for (var eventType in events) this.cloneEvents(from, eventType);
  3681. } else if (events[type]){
  3682. events[type].keys.each(function(fn){
  3683. this.addEvent(type, fn);
  3684. }, this);
  3685. }
  3686. return this;
  3687. }
  3688. });
  3689. Element.NativeEvents = {
  3690. click: 2, dblclick: 2, mouseup: 2, mousedown: 2, contextmenu: 2, //mouse buttons
  3691. wheel: 2, mousewheel: 2, DOMMouseScroll: 2, //mouse wheel
  3692. mouseover: 2, mouseout: 2, mousemove: 2, selectstart: 2, selectend: 2, //mouse movement
  3693. keydown: 2, keypress: 2, keyup: 2, //keyboard
  3694. orientationchange: 2, // mobile
  3695. touchstart: 2, touchmove: 2, touchend: 2, touchcancel: 2, // touch
  3696. gesturestart: 2, gesturechange: 2, gestureend: 2, // gesture
  3697. focus: 2, blur: 2, change: 2, reset: 2, select: 2, submit: 2, paste: 2, input: 2, //form elements
  3698. load: 2, unload: 1, beforeunload: 2, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window
  3699. hashchange: 1, popstate: 2, pageshow: 2, pagehide: 2, // history
  3700. error: 1, abort: 1, scroll: 1, message: 2 //misc
  3701. };
  3702. Element.Events = {
  3703. mousewheel: {
  3704. base: 'onwheel' in document ? 'wheel' : 'onmousewheel' in document ? 'mousewheel' : 'DOMMouseScroll'
  3705. }
  3706. };
  3707. var check = function(event){
  3708. var related = event.relatedTarget;
  3709. if (related == null) return true;
  3710. if (!related) return false;
  3711. return (related != this && related.prefix != 'xul' && typeOf(this) != 'document' && !this.contains(related));
  3712. };
  3713. if ('onmouseenter' in document.documentElement){
  3714. Element.NativeEvents.mouseenter = Element.NativeEvents.mouseleave = 2;
  3715. Element.MouseenterCheck = check;
  3716. } else {
  3717. Element.Events.mouseenter = {
  3718. base: 'mouseover',
  3719. condition: check
  3720. };
  3721. Element.Events.mouseleave = {
  3722. base: 'mouseout',
  3723. condition: check
  3724. };
  3725. }
  3726. /*<ltIE9>*/
  3727. if (!window.addEventListener){
  3728. Element.NativeEvents.propertychange = 2;
  3729. Element.Events.change = {
  3730. base: function(){
  3731. var type = this.type;
  3732. return (this.get('tag') == 'input' && (type == 'radio' || type == 'checkbox')) ? 'propertychange' : 'change';
  3733. },
  3734. condition: function(event){
  3735. return event.type != 'propertychange' || event.event.propertyName == 'checked';
  3736. }
  3737. };
  3738. }
  3739. /*</ltIE9>*/
  3740. //<1.2compat>
  3741. Element.Events = new Hash(Element.Events);
  3742. //</1.2compat>
  3743. })();
  3744. /*
  3745. ---
  3746. name: Element.Delegation
  3747. description: Extends the Element native object to include the delegate method for more efficient event management.
  3748. license: MIT-style license.
  3749. requires: [Element.Event]
  3750. provides: [Element.Delegation]
  3751. ...
  3752. */
  3753. (function(){
  3754. var eventListenerSupport = !!window.addEventListener;
  3755. Element.NativeEvents.focusin = Element.NativeEvents.focusout = 2;
  3756. var bubbleUp = function(self, match, fn, event, target){
  3757. while (target && target != self){
  3758. if (match(target, event)) return fn.call(target, event, target);
  3759. target = document.id(target.parentNode);
  3760. }
  3761. };
  3762. var map = {
  3763. mouseenter: {
  3764. base: 'mouseover',
  3765. condition: Element.MouseenterCheck
  3766. },
  3767. mouseleave: {
  3768. base: 'mouseout',
  3769. condition: Element.MouseenterCheck
  3770. },
  3771. focus: {
  3772. base: 'focus' + (eventListenerSupport ? '' : 'in'),
  3773. capture: true
  3774. },
  3775. blur: {
  3776. base: eventListenerSupport ? 'blur' : 'focusout',
  3777. capture: true
  3778. }
  3779. };
  3780. /*<ltIE9>*/
  3781. var _key = '$delegation:';
  3782. var formObserver = function(type){
  3783. return {
  3784. base: 'focusin',
  3785. remove: function(self, uid){
  3786. var list = self.retrieve(_key + type + 'listeners', {})[uid];
  3787. if (list && list.forms) for (var i = list.forms.length; i--;){
  3788. // the form may have been destroyed, so it won't have the
  3789. // removeEvent method anymore. In that case the event was
  3790. // removed as well.
  3791. if (list.forms[i].removeEvent) list.forms[i].removeEvent(type, list.fns[i]);
  3792. }
  3793. },
  3794. listen: function(self, match, fn, event, target, uid){
  3795. var form = (target.get('tag') == 'form') ? target : event.target.getParent('form');
  3796. if (!form) return;
  3797. var listeners = self.retrieve(_key + type + 'listeners', {}),
  3798. listener = listeners[uid] || {forms: [], fns: []},
  3799. forms = listener.forms, fns = listener.fns;
  3800. if (forms.indexOf(form) != -1) return;
  3801. forms.push(form);
  3802. var _fn = function(event){
  3803. bubbleUp(self, match, fn, event, target);
  3804. };
  3805. form.addEvent(type, _fn);
  3806. fns.push(_fn);
  3807. listeners[uid] = listener;
  3808. self.store(_key + type + 'listeners', listeners);
  3809. }
  3810. };
  3811. };
  3812. var inputObserver = function(type){
  3813. return {
  3814. base: 'focusin',
  3815. listen: function(self, match, fn, event, target){
  3816. var events = {blur: function(){
  3817. this.removeEvents(events);
  3818. }};
  3819. events[type] = function(event){
  3820. bubbleUp(self, match, fn, event, target);
  3821. };
  3822. event.target.addEvents(events);
  3823. }
  3824. };
  3825. };
  3826. if (!eventListenerSupport) Object.append(map, {
  3827. submit: formObserver('submit'),
  3828. reset: formObserver('reset'),
  3829. change: inputObserver('change'),
  3830. select: inputObserver('select')
  3831. });
  3832. /*</ltIE9>*/
  3833. var proto = Element.prototype,
  3834. addEvent = proto.addEvent,
  3835. removeEvent = proto.removeEvent;
  3836. var relay = function(old, method){
  3837. return function(type, fn, useCapture){
  3838. if (type.indexOf(':relay') == -1) return old.call(this, type, fn, useCapture);
  3839. var parsed = Slick.parse(type).expressions[0][0];
  3840. if (parsed.pseudos[0].key != 'relay') return old.call(this, type, fn, useCapture);
  3841. var newType = parsed.tag;
  3842. parsed.pseudos.slice(1).each(function(pseudo){
  3843. newType += ':' + pseudo.key + (pseudo.value ? '(' + pseudo.value + ')' : '');
  3844. });
  3845. old.call(this, type, fn);
  3846. return method.call(this, newType, parsed.pseudos[0].value, fn);
  3847. };
  3848. };
  3849. var delegation = {
  3850. addEvent: function(type, match, fn){
  3851. var storage = this.retrieve('$delegates', {}), stored = storage[type];
  3852. if (stored) for (var _uid in stored){
  3853. if (stored[_uid].fn == fn && stored[_uid].match == match) return this;
  3854. }
  3855. var _type = type, _match = match, _fn = fn, _map = map[type] || {};
  3856. type = _map.base || _type;
  3857. match = function(target){
  3858. return Slick.match(target, _match);
  3859. };
  3860. var elementEvent = Element.Events[_type];
  3861. if (_map.condition || elementEvent && elementEvent.condition){
  3862. var __match = match, condition = _map.condition || elementEvent.condition;
  3863. match = function(target, event){
  3864. return __match(target, event) && condition.call(target, event, type);
  3865. };
  3866. }
  3867. var self = this, uid = String.uniqueID();
  3868. var delegator = _map.listen ? function(event, target){
  3869. if (!target && event && event.target) target = event.target;
  3870. if (target) _map.listen(self, match, fn, event, target, uid);
  3871. } : function(event, target){
  3872. if (!target && event && event.target) target = event.target;
  3873. if (target) bubbleUp(self, match, fn, event, target);
  3874. };
  3875. if (!stored) stored = {};
  3876. stored[uid] = {
  3877. match: _match,
  3878. fn: _fn,
  3879. delegator: delegator
  3880. };
  3881. storage[_type] = stored;
  3882. return addEvent.call(this, type, delegator, _map.capture);
  3883. },
  3884. removeEvent: function(type, match, fn, _uid){
  3885. var storage = this.retrieve('$delegates', {}), stored = storage[type];
  3886. if (!stored) return this;
  3887. if (_uid){
  3888. var _type = type, delegator = stored[_uid].delegator, _map = map[type] || {};
  3889. type = _map.base || _type;
  3890. if (_map.remove) _map.remove(this, _uid);
  3891. delete stored[_uid];
  3892. storage[_type] = stored;
  3893. return removeEvent.call(this, type, delegator, _map.capture);
  3894. }
  3895. var __uid, s;
  3896. if (fn) for (__uid in stored){
  3897. s = stored[__uid];
  3898. if (s.match == match && s.fn == fn) return delegation.removeEvent.call(this, type, match, fn, __uid);
  3899. } else for (__uid in stored){
  3900. s = stored[__uid];
  3901. if (s.match == match) delegation.removeEvent.call(this, type, match, s.fn, __uid);
  3902. }
  3903. return this;
  3904. }
  3905. };
  3906. [Element, Window, Document].invoke('implement', {
  3907. addEvent: relay(addEvent, delegation.addEvent),
  3908. removeEvent: relay(removeEvent, delegation.removeEvent)
  3909. });
  3910. })();
  3911. /*
  3912. ---
  3913. name: Element.Style
  3914. description: Contains methods for interacting with the styles of Elements in a fashionable way.
  3915. license: MIT-style license.
  3916. requires: Element
  3917. provides: Element.Style
  3918. ...
  3919. */
  3920. (function(){
  3921. var html = document.html, el;
  3922. //<ltIE9>
  3923. // Check for oldIE, which does not remove styles when they're set to null
  3924. el = document.createElement('div');
  3925. el.style.color = 'red';
  3926. el.style.color = null;
  3927. var doesNotRemoveStyles = el.style.color == 'red';
  3928. // check for oldIE, which returns border* shorthand styles in the wrong order (color-width-style instead of width-style-color)
  3929. var border = '1px solid #123abc';
  3930. el.style.border = border;
  3931. var returnsBordersInWrongOrder = el.style.border != border;
  3932. el = null;
  3933. //</ltIE9>
  3934. var hasGetComputedStyle = !!window.getComputedStyle,
  3935. supportBorderRadius = document.createElement('div').style.borderRadius != null;
  3936. Element.Properties.styles = {set: function(styles){
  3937. this.setStyles(styles);
  3938. }};
  3939. var hasOpacity = (html.style.opacity != null),
  3940. hasFilter = (html.style.filter != null),
  3941. reAlpha = /alpha\(opacity=([\d.]+)\)/i;
  3942. var setVisibility = function(element, opacity){
  3943. element.store('$opacity', opacity);
  3944. element.style.visibility = opacity > 0 || opacity == null ? 'visible' : 'hidden';
  3945. };
  3946. //<ltIE9>
  3947. var setFilter = function(element, regexp, value){
  3948. var style = element.style,
  3949. filter = style.filter || element.getComputedStyle('filter') || '';
  3950. style.filter = (regexp.test(filter) ? filter.replace(regexp, value) : filter + ' ' + value).trim();
  3951. if (!style.filter) style.removeAttribute('filter');
  3952. };
  3953. //</ltIE9>
  3954. var setOpacity = (hasOpacity ? function(element, opacity){
  3955. element.style.opacity = opacity;
  3956. } : (hasFilter ? function(element, opacity){
  3957. if (!element.currentStyle || !element.currentStyle.hasLayout) element.style.zoom = 1;
  3958. if (opacity == null || opacity == 1){
  3959. setFilter(element, reAlpha, '');
  3960. if (opacity == 1 && getOpacity(element) != 1) setFilter(element, reAlpha, 'alpha(opacity=100)');
  3961. } else {
  3962. setFilter(element, reAlpha, 'alpha(opacity=' + (opacity * 100).limit(0, 100).round() + ')');
  3963. }
  3964. } : setVisibility));
  3965. var getOpacity = (hasOpacity ? function(element){
  3966. var opacity = element.style.opacity || element.getComputedStyle('opacity');
  3967. return (opacity == '') ? 1 : opacity.toFloat();
  3968. } : (hasFilter ? function(element){
  3969. var filter = (element.style.filter || element.getComputedStyle('filter')),
  3970. opacity;
  3971. if (filter) opacity = filter.match(reAlpha);
  3972. return (opacity == null || filter == null) ? 1 : (opacity[1] / 100);
  3973. } : function(element){
  3974. var opacity = element.retrieve('$opacity');
  3975. if (opacity == null) opacity = (element.style.visibility == 'hidden' ? 0 : 1);
  3976. return opacity;
  3977. }));
  3978. var floatName = (html.style.cssFloat == null) ? 'styleFloat' : 'cssFloat',
  3979. namedPositions = {left: '0%', top: '0%', center: '50%', right: '100%', bottom: '100%'},
  3980. hasBackgroundPositionXY = (html.style.backgroundPositionX != null),
  3981. prefixPattern = /^-(ms)-/;
  3982. var camelCase = function(property){
  3983. return property.replace(prefixPattern, '$1-').camelCase();
  3984. };
  3985. //<ltIE9>
  3986. var removeStyle = function(style, property){
  3987. if (property == 'backgroundPosition'){
  3988. style.removeAttribute(property + 'X');
  3989. property += 'Y';
  3990. }
  3991. style.removeAttribute(property);
  3992. };
  3993. //</ltIE9>
  3994. Element.implement({
  3995. getComputedStyle: function(property){
  3996. if (!hasGetComputedStyle && this.currentStyle) return this.currentStyle[camelCase(property)];
  3997. var defaultView = Element.getDocument(this).defaultView,
  3998. computed = defaultView ? defaultView.getComputedStyle(this, null) : null;
  3999. return (computed) ? computed.getPropertyValue((property == floatName) ? 'float' : property.hyphenate()) : '';
  4000. },
  4001. setStyle: function(property, value){
  4002. if (property == 'opacity'){
  4003. if (value != null) value = parseFloat(value);
  4004. setOpacity(this, value);
  4005. return this;
  4006. }
  4007. property = camelCase(property == 'float' ? floatName : property);
  4008. if (typeOf(value) != 'string'){
  4009. var map = (Element.Styles[property] || '@').split(' ');
  4010. value = Array.convert(value).map(function(val, i){
  4011. if (!map[i]) return '';
  4012. return (typeOf(val) == 'number') ? map[i].replace('@', Math.round(val)) : val;
  4013. }).join(' ');
  4014. } else if (value == String(Number(value))){
  4015. value = Math.round(value);
  4016. }
  4017. this.style[property] = value;
  4018. //<ltIE9>
  4019. if ((value == '' || value == null) && doesNotRemoveStyles && this.style.removeAttribute){
  4020. removeStyle(this.style, property);
  4021. }
  4022. //</ltIE9>
  4023. return this;
  4024. },
  4025. getStyle: function(property){
  4026. if (property == 'opacity') return getOpacity(this);
  4027. property = camelCase(property == 'float' ? floatName : property);
  4028. if (supportBorderRadius && property.indexOf('borderRadius') != -1){
  4029. return ['borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomRightRadius', 'borderBottomLeftRadius'].map(function(corner){
  4030. return this.style[corner] || '0px';
  4031. }, this).join(' ');
  4032. }
  4033. var result = this.style[property];
  4034. if (!result || property == 'zIndex'){
  4035. if (Element.ShortStyles.hasOwnProperty(property)){
  4036. result = [];
  4037. for (var s in Element.ShortStyles[property]) result.push(this.getStyle(s));
  4038. return result.join(' ');
  4039. }
  4040. result = this.getComputedStyle(property);
  4041. }
  4042. if (hasBackgroundPositionXY && /^backgroundPosition[XY]?$/.test(property)){
  4043. return result.replace(/(top|right|bottom|left)/g, function(position){
  4044. return namedPositions[position];
  4045. }) || '0px';
  4046. }
  4047. if (!result && property == 'backgroundPosition') return '0px 0px';
  4048. if (result){
  4049. result = String(result);
  4050. var color = result.match(/rgba?\([\d\s,]+\)/);
  4051. if (color) result = result.replace(color[0], color[0].rgbToHex());
  4052. }
  4053. if (!hasGetComputedStyle && !this.style[property]){
  4054. if ((/^(height|width)$/).test(property) && !(/px$/.test(result))){
  4055. var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0;
  4056. values.each(function(value){
  4057. size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt();
  4058. }, this);
  4059. return this['offset' + property.capitalize()] - size + 'px';
  4060. }
  4061. if ((/^border(.+)Width|margin|padding/).test(property) && isNaN(parseFloat(result))){
  4062. return '0px';
  4063. }
  4064. }
  4065. //<ltIE9>
  4066. if (returnsBordersInWrongOrder && /^border(Top|Right|Bottom|Left)?$/.test(property) && /^#/.test(result)){
  4067. return result.replace(/^(.+)\s(.+)\s(.+)$/, '$2 $3 $1');
  4068. }
  4069. //</ltIE9>
  4070. return result;
  4071. },
  4072. setStyles: function(styles){
  4073. for (var style in styles) this.setStyle(style, styles[style]);
  4074. return this;
  4075. },
  4076. getStyles: function(){
  4077. var result = {};
  4078. Array.flatten(arguments).each(function(key){
  4079. result[key] = this.getStyle(key);
  4080. }, this);
  4081. return result;
  4082. }
  4083. });
  4084. Element.Styles = {
  4085. left: '@px', top: '@px', bottom: '@px', right: '@px',
  4086. width: '@px', height: '@px', maxWidth: '@px', maxHeight: '@px', minWidth: '@px', minHeight: '@px',
  4087. backgroundColor: 'rgb(@, @, @)', backgroundSize: '@px', backgroundPosition: '@px @px', color: 'rgb(@, @, @)',
  4088. fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)',
  4089. margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)',
  4090. borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)',
  4091. zIndex: '@', 'zoom': '@', fontWeight: '@', textIndent: '@px', opacity: '@', borderRadius: '@px @px @px @px'
  4092. };
  4093. //<1.3compat>
  4094. Element.implement({
  4095. setOpacity: function(value){
  4096. setOpacity(this, value);
  4097. return this;
  4098. },
  4099. getOpacity: function(){
  4100. return getOpacity(this);
  4101. }
  4102. });
  4103. Element.Properties.opacity = {
  4104. set: function(opacity){
  4105. setOpacity(this, opacity);
  4106. setVisibility(this, opacity);
  4107. },
  4108. get: function(){
  4109. return getOpacity(this);
  4110. }
  4111. };
  4112. //</1.3compat>
  4113. //<1.2compat>
  4114. Element.Styles = new Hash(Element.Styles);
  4115. //</1.2compat>
  4116. Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, borderStyle: {}, borderColor: {}};
  4117. ['Top', 'Right', 'Bottom', 'Left'].each(function(direction){
  4118. var Short = Element.ShortStyles;
  4119. var All = Element.Styles;
  4120. ['margin', 'padding'].each(function(style){
  4121. var sd = style + direction;
  4122. Short[style][sd] = All[sd] = '@px';
  4123. });
  4124. var bd = 'border' + direction;
  4125. Short.border[bd] = All[bd] = '@px @ rgb(@, @, @)';
  4126. var bdw = bd + 'Width', bds = bd + 'Style', bdc = bd + 'Color';
  4127. Short[bd] = {};
  4128. Short.borderWidth[bdw] = Short[bd][bdw] = All[bdw] = '@px';
  4129. Short.borderStyle[bds] = Short[bd][bds] = All[bds] = '@';
  4130. Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)';
  4131. });
  4132. if (hasBackgroundPositionXY) Element.ShortStyles.backgroundPosition = {backgroundPositionX: '@', backgroundPositionY: '@'};
  4133. })();
  4134. /*
  4135. ---
  4136. name: Element.Dimensions
  4137. description: Contains methods to work with size, scroll, or positioning of Elements and the window object.
  4138. license: MIT-style license.
  4139. credits:
  4140. - Element positioning based on the [qooxdoo](http://qooxdoo.org/) code and smart browser fixes, [LGPL License](http://www.gnu.org/licenses/lgpl.html).
  4141. - Viewport dimensions based on [YUI](http://developer.yahoo.com/yui/) code, [BSD License](http://developer.yahoo.com/yui/license.html).
  4142. requires: [Element, Element.Style]
  4143. provides: [Element.Dimensions]
  4144. ...
  4145. */
  4146. (function(){
  4147. var element = document.createElement('div'),
  4148. child = document.createElement('div');
  4149. element.style.height = '0';
  4150. element.appendChild(child);
  4151. var brokenOffsetParent = (child.offsetParent === element);
  4152. element = child = null;
  4153. var heightComponents = ['height', 'paddingTop', 'paddingBottom', 'borderTopWidth', 'borderBottomWidth'],
  4154. widthComponents = ['width', 'paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'];
  4155. var svgCalculateSize = function(el){
  4156. var gCS = window.getComputedStyle(el),
  4157. bounds = {x: 0, y: 0};
  4158. heightComponents.each(function(css){
  4159. bounds.y += parseFloat(gCS[css]);
  4160. });
  4161. widthComponents.each(function(css){
  4162. bounds.x += parseFloat(gCS[css]);
  4163. });
  4164. return bounds;
  4165. };
  4166. var isOffset = function(el){
  4167. return styleString(el, 'position') != 'static' || isBody(el);
  4168. };
  4169. var isOffsetStatic = function(el){
  4170. return isOffset(el) || (/^(?:table|td|th)$/i).test(el.tagName);
  4171. };
  4172. Element.implement({
  4173. scrollTo: function(x, y){
  4174. if (isBody(this)){
  4175. this.getWindow().scrollTo(x, y);
  4176. } else {
  4177. this.scrollLeft = x;
  4178. this.scrollTop = y;
  4179. }
  4180. return this;
  4181. },
  4182. getSize: function(){
  4183. if (isBody(this)) return this.getWindow().getSize();
  4184. //<ltIE9>
  4185. // This if clause is because IE8- cannot calculate getBoundingClientRect of elements with visibility hidden.
  4186. if (!window.getComputedStyle) return {x: this.offsetWidth, y: this.offsetHeight};
  4187. //</ltIE9>
  4188. // This svg section under, calling `svgCalculateSize()`, can be removed when FF fixed the svg size bug.
  4189. // Bug info: https://bugzilla.mozilla.org/show_bug.cgi?id=530985
  4190. if (this.get('tag') == 'svg') return svgCalculateSize(this);
  4191. try {
  4192. var bounds = this.getBoundingClientRect();
  4193. return {x: bounds.width, y: bounds.height};
  4194. } catch (e){
  4195. return {x: 0, y: 0};
  4196. }
  4197. },
  4198. getScrollSize: function(){
  4199. if (isBody(this)) return this.getWindow().getScrollSize();
  4200. return {x: this.scrollWidth, y: this.scrollHeight};
  4201. },
  4202. getScroll: function(){
  4203. if (isBody(this)) return this.getWindow().getScroll();
  4204. return {x: this.scrollLeft, y: this.scrollTop};
  4205. },
  4206. getScrolls: function(){
  4207. var element = this.parentNode, position = {x: 0, y: 0};
  4208. while (element && !isBody(element)){
  4209. position.x += element.scrollLeft;
  4210. position.y += element.scrollTop;
  4211. element = element.parentNode;
  4212. }
  4213. return position;
  4214. },
  4215. getOffsetParent: brokenOffsetParent ? function(){
  4216. var element = this;
  4217. if (isBody(element) || styleString(element, 'position') == 'fixed') return null;
  4218. var isOffsetCheck = (styleString(element, 'position') == 'static') ? isOffsetStatic : isOffset;
  4219. while ((element = element.parentNode)){
  4220. if (isOffsetCheck(element)) return element;
  4221. }
  4222. return null;
  4223. } : function(){
  4224. var element = this;
  4225. if (isBody(element) || styleString(element, 'position') == 'fixed') return null;
  4226. try {
  4227. return element.offsetParent;
  4228. } catch (e){}
  4229. return null;
  4230. },
  4231. getOffsets: function(){
  4232. var hasGetBoundingClientRect = this.getBoundingClientRect;
  4233. //<1.4compat>
  4234. hasGetBoundingClientRect = hasGetBoundingClientRect && !Browser.Platform.ios;
  4235. //</1.4compat>
  4236. if (hasGetBoundingClientRect){
  4237. var bound = this.getBoundingClientRect(),
  4238. html = document.id(this.getDocument().documentElement),
  4239. htmlScroll = html.getScroll(),
  4240. elemScrolls = this.getScrolls(),
  4241. isFixed = (styleString(this, 'position') == 'fixed');
  4242. return {
  4243. x: bound.left.toFloat() + elemScrolls.x + ((isFixed) ? 0 : htmlScroll.x) - html.clientLeft,
  4244. y: bound.top.toFloat() + elemScrolls.y + ((isFixed) ? 0 : htmlScroll.y) - html.clientTop
  4245. };
  4246. }
  4247. var element = this, position = {x: 0, y: 0};
  4248. if (isBody(this)) return position;
  4249. while (element && !isBody(element)){
  4250. position.x += element.offsetLeft;
  4251. position.y += element.offsetTop;
  4252. //<1.4compat>
  4253. if (Browser.firefox){
  4254. if (!borderBox(element)){
  4255. position.x += leftBorder(element);
  4256. position.y += topBorder(element);
  4257. }
  4258. var parent = element.parentNode;
  4259. if (parent && styleString(parent, 'overflow') != 'visible'){
  4260. position.x += leftBorder(parent);
  4261. position.y += topBorder(parent);
  4262. }
  4263. } else if (element != this && Browser.safari){
  4264. position.x += leftBorder(element);
  4265. position.y += topBorder(element);
  4266. }
  4267. //</1.4compat>
  4268. element = element.offsetParent;
  4269. }
  4270. //<1.4compat>
  4271. if (Browser.firefox && !borderBox(this)){
  4272. position.x -= leftBorder(this);
  4273. position.y -= topBorder(this);
  4274. }
  4275. //</1.4compat>
  4276. return position;
  4277. },
  4278. getPosition: function(relative){
  4279. var offset = this.getOffsets(),
  4280. scroll = this.getScrolls();
  4281. var position = {
  4282. x: offset.x - scroll.x,
  4283. y: offset.y - scroll.y
  4284. };
  4285. if (relative && (relative = document.id(relative))){
  4286. var relativePosition = relative.getPosition();
  4287. return {x: position.x - relativePosition.x - leftBorder(relative), y: position.y - relativePosition.y - topBorder(relative)};
  4288. }
  4289. return position;
  4290. },
  4291. getCoordinates: function(element){
  4292. if (isBody(this)) return this.getWindow().getCoordinates();
  4293. var position = this.getPosition(element),
  4294. size = this.getSize();
  4295. var obj = {
  4296. left: position.x,
  4297. top: position.y,
  4298. width: size.x,
  4299. height: size.y
  4300. };
  4301. obj.right = obj.left + obj.width;
  4302. obj.bottom = obj.top + obj.height;
  4303. return obj;
  4304. },
  4305. computePosition: function(obj){
  4306. return {
  4307. left: obj.x - styleNumber(this, 'margin-left'),
  4308. top: obj.y - styleNumber(this, 'margin-top')
  4309. };
  4310. },
  4311. setPosition: function(obj){
  4312. return this.setStyles(this.computePosition(obj));
  4313. }
  4314. });
  4315. [Document, Window].invoke('implement', {
  4316. getSize: function(){
  4317. var doc = getCompatElement(this);
  4318. return {x: doc.clientWidth, y: doc.clientHeight};
  4319. },
  4320. getScroll: function(){
  4321. var win = this.getWindow(), doc = getCompatElement(this);
  4322. return {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop};
  4323. },
  4324. getScrollSize: function(){
  4325. var doc = getCompatElement(this),
  4326. min = this.getSize(),
  4327. body = this.getDocument().body;
  4328. return {x: Math.max(doc.scrollWidth, body.scrollWidth, min.x), y: Math.max(doc.scrollHeight, body.scrollHeight, min.y)};
  4329. },
  4330. getPosition: function(){
  4331. return {x: 0, y: 0};
  4332. },
  4333. getCoordinates: function(){
  4334. var size = this.getSize();
  4335. return {top: 0, left: 0, bottom: size.y, right: size.x, height: size.y, width: size.x};
  4336. }
  4337. });
  4338. // private methods
  4339. var styleString = Element.getComputedStyle;
  4340. function styleNumber(element, style){
  4341. return styleString(element, style).toInt() || 0;
  4342. }
  4343. //<1.4compat>
  4344. function borderBox(element){
  4345. return styleString(element, '-moz-box-sizing') == 'border-box';
  4346. }
  4347. //</1.4compat>
  4348. function topBorder(element){
  4349. return styleNumber(element, 'border-top-width');
  4350. }
  4351. function leftBorder(element){
  4352. return styleNumber(element, 'border-left-width');
  4353. }
  4354. function isBody(element){
  4355. return (/^(?:body|html)$/i).test(element.tagName);
  4356. }
  4357. function getCompatElement(element){
  4358. var doc = element.getDocument();
  4359. return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
  4360. }
  4361. })();
  4362. //aliases
  4363. Element.alias({position: 'setPosition'}); //compatability
  4364. [Window, Document, Element].invoke('implement', {
  4365. getHeight: function(){
  4366. return this.getSize().y;
  4367. },
  4368. getWidth: function(){
  4369. return this.getSize().x;
  4370. },
  4371. getScrollTop: function(){
  4372. return this.getScroll().y;
  4373. },
  4374. getScrollLeft: function(){
  4375. return this.getScroll().x;
  4376. },
  4377. getScrollHeight: function(){
  4378. return this.getScrollSize().y;
  4379. },
  4380. getScrollWidth: function(){
  4381. return this.getScrollSize().x;
  4382. },
  4383. getTop: function(){
  4384. return this.getPosition().y;
  4385. },
  4386. getLeft: function(){
  4387. return this.getPosition().x;
  4388. }
  4389. });
  4390. /*
  4391. ---
  4392. name: Fx
  4393. description: Contains the basic animation logic to be extended by all other Fx Classes.
  4394. license: MIT-style license.
  4395. requires: [Chain, Events, Options, Class.Thenable]
  4396. provides: Fx
  4397. ...
  4398. */
  4399. (function(){
  4400. var Fx = this.Fx = new Class({
  4401. Implements: [Chain, Events, Options, Class.Thenable],
  4402. options: {
  4403. /*
  4404. onStart: nil,
  4405. onCancel: nil,
  4406. onComplete: nil,
  4407. */
  4408. fps: 60,
  4409. unit: false,
  4410. duration: 500,
  4411. frames: null,
  4412. frameSkip: true,
  4413. link: 'ignore'
  4414. },
  4415. initialize: function(options){
  4416. this.subject = this.subject || this;
  4417. this.setOptions(options);
  4418. },
  4419. getTransition: function(){
  4420. return function(p){
  4421. return -(Math.cos(Math.PI * p) - 1) / 2;
  4422. };
  4423. },
  4424. step: function(now){
  4425. if (this.options.frameSkip){
  4426. var diff = (this.time != null) ? (now - this.time) : 0, frames = diff / this.frameInterval;
  4427. this.time = now;
  4428. this.frame += frames;
  4429. } else {
  4430. this.frame++;
  4431. }
  4432. if (this.frame < this.frames){
  4433. var delta = this.transition(this.frame / this.frames);
  4434. this.set(this.compute(this.from, this.to, delta));
  4435. } else {
  4436. this.frame = this.frames;
  4437. this.set(this.compute(this.from, this.to, 1));
  4438. this.stop();
  4439. }
  4440. },
  4441. set: function(now){
  4442. return now;
  4443. },
  4444. compute: function(from, to, delta){
  4445. return Fx.compute(from, to, delta);
  4446. },
  4447. check: function(){
  4448. if (!this.isRunning()) return true;
  4449. switch (this.options.link){
  4450. case 'cancel': this.cancel(); return true;
  4451. case 'chain': this.chain(this.caller.pass(arguments, this)); return false;
  4452. }
  4453. return false;
  4454. },
  4455. start: function(from, to){
  4456. if (!this.check(from, to)) return this;
  4457. this.from = from;
  4458. this.to = to;
  4459. this.frame = (this.options.frameSkip) ? 0 : -1;
  4460. this.time = null;
  4461. this.transition = this.getTransition();
  4462. var frames = this.options.frames, fps = this.options.fps, duration = this.options.duration;
  4463. this.duration = Fx.Durations[duration] || duration.toInt();
  4464. this.frameInterval = 1000 / fps;
  4465. this.frames = frames || Math.round(this.duration / this.frameInterval);
  4466. if (this.getThenableState() !== 'pending'){
  4467. this.resetThenable(this.subject);
  4468. }
  4469. this.fireEvent('start', this.subject);
  4470. pushInstance.call(this, fps);
  4471. return this;
  4472. },
  4473. stop: function(){
  4474. if (this.isRunning()){
  4475. this.time = null;
  4476. pullInstance.call(this, this.options.fps);
  4477. if (this.frames == this.frame){
  4478. this.fireEvent('complete', this.subject);
  4479. if (!this.callChain()) this.fireEvent('chainComplete', this.subject);
  4480. } else {
  4481. this.fireEvent('stop', this.subject);
  4482. }
  4483. this.resolve(this.subject === this ? null : this.subject);
  4484. }
  4485. return this;
  4486. },
  4487. cancel: function(){
  4488. if (this.isRunning()){
  4489. this.time = null;
  4490. pullInstance.call(this, this.options.fps);
  4491. this.frame = this.frames;
  4492. this.fireEvent('cancel', this.subject).clearChain();
  4493. this.reject(this.subject);
  4494. }
  4495. return this;
  4496. },
  4497. pause: function(){
  4498. if (this.isRunning()){
  4499. this.time = null;
  4500. pullInstance.call(this, this.options.fps);
  4501. }
  4502. return this;
  4503. },
  4504. resume: function(){
  4505. if (this.isPaused()) pushInstance.call(this, this.options.fps);
  4506. return this;
  4507. },
  4508. isRunning: function(){
  4509. var list = instances[this.options.fps];
  4510. return list && list.contains(this);
  4511. },
  4512. isPaused: function(){
  4513. return (this.frame < this.frames) && !this.isRunning();
  4514. }
  4515. });
  4516. Fx.compute = function(from, to, delta){
  4517. return (to - from) * delta + from;
  4518. };
  4519. Fx.Durations = {'short': 250, 'normal': 500, 'long': 1000};
  4520. // global timers
  4521. var instances = {}, timers = {};
  4522. var loop = function(){
  4523. var now = Date.now();
  4524. for (var i = this.length; i--;){
  4525. var instance = this[i];
  4526. if (instance) instance.step(now);
  4527. }
  4528. };
  4529. var pushInstance = function(fps){
  4530. var list = instances[fps] || (instances[fps] = []);
  4531. list.push(this);
  4532. if (!timers[fps]) timers[fps] = loop.periodical(Math.round(1000 / fps), list);
  4533. };
  4534. var pullInstance = function(fps){
  4535. var list = instances[fps];
  4536. if (list){
  4537. list.erase(this);
  4538. if (!list.length && timers[fps]){
  4539. delete instances[fps];
  4540. timers[fps] = clearInterval(timers[fps]);
  4541. }
  4542. }
  4543. };
  4544. })();
  4545. /*
  4546. ---
  4547. name: Fx.CSS
  4548. description: Contains the CSS animation logic. Used by Fx.Tween, Fx.Morph, Fx.Elements.
  4549. license: MIT-style license.
  4550. requires: [Fx, Element.Style]
  4551. provides: Fx.CSS
  4552. ...
  4553. */
  4554. Fx.CSS = new Class({
  4555. Extends: Fx,
  4556. //prepares the base from/to object
  4557. prepare: function(element, property, values){
  4558. values = Array.convert(values);
  4559. var from = values[0], to = values[1];
  4560. if (to == null){
  4561. to = from;
  4562. from = element.getStyle(property);
  4563. var unit = this.options.unit;
  4564. // adapted from: https://github.com/ryanmorr/fx/blob/master/fx.js#L299
  4565. if (unit && from && typeof from == 'string' && from.slice(-unit.length) != unit && parseFloat(from) != 0){
  4566. element.setStyle(property, to + unit);
  4567. var value = element.getComputedStyle(property);
  4568. // IE and Opera support pixelLeft or pixelWidth
  4569. if (!(/px$/.test(value))){
  4570. value = element.style[('pixel-' + property).camelCase()];
  4571. if (value == null){
  4572. // adapted from Dean Edwards' http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  4573. var left = element.style.left;
  4574. element.style.left = to + unit;
  4575. value = element.style.pixelLeft;
  4576. element.style.left = left;
  4577. }
  4578. }
  4579. from = (to || 1) / (parseFloat(value) || 1) * (parseFloat(from) || 0);
  4580. element.setStyle(property, from + unit);
  4581. }
  4582. }
  4583. return {from: this.parse(from), to: this.parse(to)};
  4584. },
  4585. //parses a value into an array
  4586. parse: function(value){
  4587. value = Function.convert(value)();
  4588. value = (typeof value == 'string') ? value.split(' ') : Array.convert(value);
  4589. return value.map(function(val){
  4590. val = String(val);
  4591. var found = false;
  4592. Object.each(Fx.CSS.Parsers, function(parser){
  4593. if (found) return;
  4594. var parsed = parser.parse(val);
  4595. if (parsed || parsed === 0) found = {value: parsed, parser: parser};
  4596. });
  4597. found = found || {value: val, parser: Fx.CSS.Parsers.String};
  4598. return found;
  4599. });
  4600. },
  4601. //computes by a from and to prepared objects, using their parsers.
  4602. compute: function(from, to, delta){
  4603. var computed = [];
  4604. (Math.min(from.length, to.length)).times(function(i){
  4605. computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser});
  4606. });
  4607. computed.$family = Function.convert('fx:css:value');
  4608. return computed;
  4609. },
  4610. //serves the value as settable
  4611. serve: function(value, unit){
  4612. if (typeOf(value) != 'fx:css:value') value = this.parse(value);
  4613. var returned = [];
  4614. value.each(function(bit){
  4615. returned = returned.concat(bit.parser.serve(bit.value, unit));
  4616. });
  4617. return returned;
  4618. },
  4619. //renders the change to an element
  4620. render: function(element, property, value, unit){
  4621. element.setStyle(property, this.serve(value, unit));
  4622. },
  4623. //searches inside the page css to find the values for a selector
  4624. search: function(selector){
  4625. if (Fx.CSS.Cache[selector]) return Fx.CSS.Cache[selector];
  4626. var to = {}, selectorTest = new RegExp('^' + selector.escapeRegExp() + '$');
  4627. var searchStyles = function(rules){
  4628. Array.each(rules, function(rule){
  4629. if (rule.media){
  4630. searchStyles(rule.rules || rule.cssRules);
  4631. return;
  4632. }
  4633. if (!rule.style) return;
  4634. var selectorText = (rule.selectorText) ? rule.selectorText.replace(/^\w+/, function(m){
  4635. return m.toLowerCase();
  4636. }) : null;
  4637. if (!selectorText || !selectorTest.test(selectorText)) return;
  4638. Object.each(Element.Styles, function(value, style){
  4639. if (!rule.style[style] || Element.ShortStyles[style]) return;
  4640. value = String(rule.style[style]);
  4641. to[style] = ((/^rgb/).test(value)) ? value.rgbToHex() : value;
  4642. });
  4643. });
  4644. };
  4645. Array.each(document.styleSheets, function(sheet){
  4646. var href = sheet.href;
  4647. if (href && href.indexOf('://') > -1 && href.indexOf(document.domain) == -1) return;
  4648. var rules = sheet.rules || sheet.cssRules;
  4649. searchStyles(rules);
  4650. });
  4651. return Fx.CSS.Cache[selector] = to;
  4652. }
  4653. });
  4654. Fx.CSS.Cache = {};
  4655. Fx.CSS.Parsers = {
  4656. Color: {
  4657. parse: function(value){
  4658. if (value.match(/^#[0-9a-f]{3,6}$/i)) return value.hexToRgb(true);
  4659. return ((value = value.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [value[1], value[2], value[3]] : false;
  4660. },
  4661. compute: function(from, to, delta){
  4662. return from.map(function(value, i){
  4663. return Math.round(Fx.compute(from[i], to[i], delta));
  4664. });
  4665. },
  4666. serve: function(value){
  4667. return value.map(Number);
  4668. }
  4669. },
  4670. Number: {
  4671. parse: parseFloat,
  4672. compute: Fx.compute,
  4673. serve: function(value, unit){
  4674. return (unit) ? value + unit : value;
  4675. }
  4676. },
  4677. String: {
  4678. parse: Function.convert(false),
  4679. compute: function(zero, one){
  4680. return one;
  4681. },
  4682. serve: function(zero){
  4683. return zero;
  4684. }
  4685. }
  4686. };
  4687. //<1.2compat>
  4688. Fx.CSS.Parsers = new Hash(Fx.CSS.Parsers);
  4689. //</1.2compat>
  4690. /*
  4691. ---
  4692. name: Fx.Morph
  4693. 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.
  4694. license: MIT-style license.
  4695. requires: Fx.CSS
  4696. provides: Fx.Morph
  4697. ...
  4698. */
  4699. Fx.Morph = new Class({
  4700. Extends: Fx.CSS,
  4701. initialize: function(element, options){
  4702. this.element = this.subject = document.id(element);
  4703. this.parent(options);
  4704. },
  4705. set: function(now){
  4706. if (typeof now == 'string') now = this.search(now);
  4707. for (var p in now) this.render(this.element, p, now[p], this.options.unit);
  4708. return this;
  4709. },
  4710. compute: function(from, to, delta){
  4711. var now = {};
  4712. for (var p in from) now[p] = this.parent(from[p], to[p], delta);
  4713. return now;
  4714. },
  4715. start: function(properties){
  4716. if (!this.check(properties)) return this;
  4717. if (typeof properties == 'string') properties = this.search(properties);
  4718. var from = {}, to = {};
  4719. for (var p in properties){
  4720. var parsed = this.prepare(this.element, p, properties[p]);
  4721. from[p] = parsed.from;
  4722. to[p] = parsed.to;
  4723. }
  4724. return this.parent(from, to);
  4725. }
  4726. });
  4727. Element.Properties.morph = {
  4728. set: function(options){
  4729. this.get('morph').cancel().setOptions(options);
  4730. return this;
  4731. },
  4732. get: function(){
  4733. var morph = this.retrieve('morph');
  4734. if (!morph){
  4735. morph = new Fx.Morph(this, {link: 'cancel'});
  4736. this.store('morph', morph);
  4737. }
  4738. return morph;
  4739. }
  4740. };
  4741. Element.implement({
  4742. morph: function(props){
  4743. this.get('morph').start(props);
  4744. return this;
  4745. }
  4746. });
  4747. /*
  4748. ---
  4749. name: Fx.Transitions
  4750. description: Contains a set of advanced transitions to be used with any of the Fx Classes.
  4751. license: MIT-style license.
  4752. credits:
  4753. - Easing Equations by Robert Penner, <http://www.robertpenner.com/easing/>, modified and optimized to be used with MooTools.
  4754. requires: Fx
  4755. provides: Fx.Transitions
  4756. ...
  4757. */
  4758. Fx.implement({
  4759. getTransition: function(){
  4760. var trans = this.options.transition || Fx.Transitions.Sine.easeInOut;
  4761. if (typeof trans == 'string'){
  4762. var data = trans.split(':');
  4763. trans = Fx.Transitions;
  4764. trans = trans[data[0]] || trans[data[0].capitalize()];
  4765. if (data[1]) trans = trans['ease' + data[1].capitalize() + (data[2] ? data[2].capitalize() : '')];
  4766. }
  4767. return trans;
  4768. }
  4769. });
  4770. Fx.Transition = function(transition, params){
  4771. params = Array.convert(params);
  4772. var easeIn = function(pos){
  4773. return transition(pos, params);
  4774. };
  4775. return Object.append(easeIn, {
  4776. easeIn: easeIn,
  4777. easeOut: function(pos){
  4778. return 1 - transition(1 - pos, params);
  4779. },
  4780. easeInOut: function(pos){
  4781. return (pos <= 0.5 ? transition(2 * pos, params) : (2 - transition(2 * (1 - pos), params))) / 2;
  4782. }
  4783. });
  4784. };
  4785. Fx.Transitions = {
  4786. linear: function(zero){
  4787. return zero;
  4788. }
  4789. };
  4790. //<1.2compat>
  4791. Fx.Transitions = new Hash(Fx.Transitions);
  4792. //</1.2compat>
  4793. Fx.Transitions.extend = function(transitions){
  4794. for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]);
  4795. };
  4796. Fx.Transitions.extend({
  4797. Pow: function(p, x){
  4798. return Math.pow(p, x && x[0] || 6);
  4799. },
  4800. Expo: function(p){
  4801. return Math.pow(2, 8 * (p - 1));
  4802. },
  4803. Circ: function(p){
  4804. return 1 - Math.sin(Math.acos(p));
  4805. },
  4806. Sine: function(p){
  4807. return 1 - Math.cos(p * Math.PI / 2);
  4808. },
  4809. Back: function(p, x){
  4810. x = x && x[0] || 1.618;
  4811. return Math.pow(p, 2) * ((x + 1) * p - x);
  4812. },
  4813. Bounce: function(p){
  4814. var value;
  4815. for (var a = 0, b = 1; 1; a += b, b /= 2){
  4816. if (p >= (7 - 4 * a) / 11){
  4817. value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2);
  4818. break;
  4819. }
  4820. }
  4821. return value;
  4822. },
  4823. Elastic: function(p, x){
  4824. return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x && x[0] || 1) / 3);
  4825. }
  4826. });
  4827. ['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){
  4828. Fx.Transitions[transition] = new Fx.Transition(function(p){
  4829. return Math.pow(p, i + 2);
  4830. });
  4831. });
  4832. /*
  4833. ---
  4834. name: Fx.Tween
  4835. description: Formerly Fx.Style, effect to transition any CSS property for an element.
  4836. license: MIT-style license.
  4837. requires: Fx.CSS
  4838. provides: [Fx.Tween, Element.fade, Element.highlight]
  4839. ...
  4840. */
  4841. Fx.Tween = new Class({
  4842. Extends: Fx.CSS,
  4843. initialize: function(element, options){
  4844. this.element = this.subject = document.id(element);
  4845. this.parent(options);
  4846. },
  4847. set: function(property, now){
  4848. if (arguments.length == 1){
  4849. now = property;
  4850. property = this.property || this.options.property;
  4851. }
  4852. this.render(this.element, property, now, this.options.unit);
  4853. return this;
  4854. },
  4855. start: function(property, from, to){
  4856. if (!this.check(property, from, to)) return this;
  4857. var args = Array.flatten(arguments);
  4858. this.property = this.options.property || args.shift();
  4859. var parsed = this.prepare(this.element, this.property, args);
  4860. return this.parent(parsed.from, parsed.to);
  4861. }
  4862. });
  4863. Element.Properties.tween = {
  4864. set: function(options){
  4865. this.get('tween').cancel().setOptions(options);
  4866. return this;
  4867. },
  4868. get: function(){
  4869. var tween = this.retrieve('tween');
  4870. if (!tween){
  4871. tween = new Fx.Tween(this, {link: 'cancel'});
  4872. this.store('tween', tween);
  4873. }
  4874. return tween;
  4875. }
  4876. };
  4877. Element.implement({
  4878. tween: function(property, from, to){
  4879. this.get('tween').start(property, from, to);
  4880. return this;
  4881. },
  4882. fade: function(){
  4883. var fade = this.get('tween'), method, args = ['opacity'].append(arguments), toggle;
  4884. if (args[1] == null) args[1] = 'toggle';
  4885. switch (args[1]){
  4886. case 'in': method = 'start'; args[1] = 1; break;
  4887. case 'out': method = 'start'; args[1] = 0; break;
  4888. case 'show': method = 'set'; args[1] = 1; break;
  4889. case 'hide': method = 'set'; args[1] = 0; break;
  4890. case 'toggle':
  4891. var flag = this.retrieve('fade:flag', this.getStyle('opacity') == 1);
  4892. method = 'start';
  4893. args[1] = flag ? 0 : 1;
  4894. this.store('fade:flag', !flag);
  4895. toggle = true;
  4896. break;
  4897. default: method = 'start';
  4898. }
  4899. if (!toggle) this.eliminate('fade:flag');
  4900. fade[method].apply(fade, args);
  4901. var to = args[args.length - 1];
  4902. if (method == 'set'){
  4903. this.setStyle('visibility', to == 0 ? 'hidden' : 'visible');
  4904. } else if (to != 0){
  4905. if (fade.$chain.length){
  4906. fade.chain(function(){
  4907. this.element.setStyle('visibility', 'visible');
  4908. this.callChain();
  4909. });
  4910. } else {
  4911. this.setStyle('visibility', 'visible');
  4912. }
  4913. } else {
  4914. fade.chain(function(){
  4915. if (this.element.getStyle('opacity')) return;
  4916. this.element.setStyle('visibility', 'hidden');
  4917. this.callChain();
  4918. });
  4919. }
  4920. return this;
  4921. },
  4922. highlight: function(start, end){
  4923. if (!end){
  4924. end = this.retrieve('highlight:original', this.getStyle('background-color'));
  4925. end = (end == 'transparent') ? '#fff' : end;
  4926. }
  4927. var tween = this.get('tween');
  4928. tween.start('background-color', start || '#ffff88', end).chain(function(){
  4929. this.setStyle('background-color', this.retrieve('highlight:original'));
  4930. tween.callChain();
  4931. }.bind(this));
  4932. return this;
  4933. }
  4934. });
  4935. /*
  4936. ---
  4937. name: Request
  4938. description: Powerful all purpose Request Class. Uses XMLHTTPRequest.
  4939. license: MIT-style license.
  4940. requires: [Object, Element, Chain, Events, Options, Class.Thenable, Browser]
  4941. provides: Request
  4942. ...
  4943. */
  4944. (function(){
  4945. var empty = function(){},
  4946. progressSupport = ('onprogress' in new Browser.Request);
  4947. var Request = this.Request = new Class({
  4948. Implements: [Chain, Events, Options, Class.Thenable],
  4949. options: {/*
  4950. onRequest: function(){},
  4951. onLoadstart: function(event, xhr){},
  4952. onProgress: function(event, xhr){},
  4953. onComplete: function(){},
  4954. onCancel: function(){},
  4955. onSuccess: function(responseText, responseXML){},
  4956. onFailure: function(xhr){},
  4957. onException: function(headerName, value){},
  4958. onTimeout: function(){},
  4959. user: '',
  4960. password: '',
  4961. withCredentials: false,*/
  4962. url: '',
  4963. data: '',
  4964. headers: {
  4965. 'X-Requested-With': 'XMLHttpRequest',
  4966. 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
  4967. },
  4968. async: true,
  4969. format: false,
  4970. method: 'post',
  4971. link: 'ignore',
  4972. isSuccess: null,
  4973. emulation: true,
  4974. urlEncoded: true,
  4975. encoding: 'utf-8',
  4976. evalScripts: false,
  4977. evalResponse: false,
  4978. timeout: 0,
  4979. noCache: false
  4980. },
  4981. initialize: function(options){
  4982. this.xhr = new Browser.Request();
  4983. this.setOptions(options);
  4984. this.headers = this.options.headers;
  4985. },
  4986. onStateChange: function(){
  4987. var xhr = this.xhr;
  4988. if (xhr.readyState != 4 || !this.running) return;
  4989. this.running = false;
  4990. this.status = 0;
  4991. Function.attempt(function(){
  4992. var status = xhr.status;
  4993. this.status = (status == 1223) ? 204 : status;
  4994. }.bind(this));
  4995. xhr.onreadystatechange = empty;
  4996. if (progressSupport) xhr.onprogress = xhr.onloadstart = empty;
  4997. if (this.timer){
  4998. clearTimeout(this.timer);
  4999. delete this.timer;
  5000. }
  5001. this.response = {text: this.xhr.responseText || '', xml: this.xhr.responseXML};
  5002. if (this.options.isSuccess.call(this, this.status))
  5003. this.success(this.response.text, this.response.xml);
  5004. else
  5005. this.failure();
  5006. },
  5007. isSuccess: function(){
  5008. var status = this.status;
  5009. return (status >= 200 && status < 300);
  5010. },
  5011. isRunning: function(){
  5012. return !!this.running;
  5013. },
  5014. processScripts: function(text){
  5015. if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return Browser.exec(text);
  5016. return text.stripScripts(this.options.evalScripts);
  5017. },
  5018. success: function(text, xml){
  5019. this.onSuccess(this.processScripts(text), xml);
  5020. this.resolve({text: text, xml: xml});
  5021. },
  5022. onSuccess: function(){
  5023. this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain();
  5024. },
  5025. failure: function(){
  5026. this.onFailure();
  5027. this.reject({reason: 'failure', xhr: this.xhr});
  5028. },
  5029. onFailure: function(){
  5030. this.fireEvent('complete').fireEvent('failure', this.xhr);
  5031. },
  5032. loadstart: function(event){
  5033. this.fireEvent('loadstart', [event, this.xhr]);
  5034. },
  5035. progress: function(event){
  5036. this.fireEvent('progress', [event, this.xhr]);
  5037. },
  5038. timeout: function(){
  5039. this.fireEvent('timeout', this.xhr);
  5040. this.reject({reason: 'timeout', xhr: this.xhr});
  5041. },
  5042. setHeader: function(name, value){
  5043. this.headers[name] = value;
  5044. return this;
  5045. },
  5046. getHeader: function(name){
  5047. return Function.attempt(function(){
  5048. return this.xhr.getResponseHeader(name);
  5049. }.bind(this));
  5050. },
  5051. check: function(){
  5052. if (!this.running) return true;
  5053. switch (this.options.link){
  5054. case 'cancel': this.cancel(); return true;
  5055. case 'chain': this.chain(this.caller.pass(arguments, this)); return false;
  5056. }
  5057. return false;
  5058. },
  5059. send: function(options){
  5060. if (!this.check(options)) return this;
  5061. this.options.isSuccess = this.options.isSuccess || this.isSuccess;
  5062. this.running = true;
  5063. var type = typeOf(options);
  5064. if (type == 'string' || type == 'element') options = {data: options};
  5065. var old = this.options;
  5066. options = Object.append({data: old.data, url: old.url, method: old.method}, options);
  5067. var data = options.data, url = String(options.url), method = options.method.toLowerCase();
  5068. switch (typeOf(data)){
  5069. case 'element': data = document.id(data).toQueryString(); break;
  5070. case 'object': case 'hash': data = Object.toQueryString(data);
  5071. }
  5072. if (this.options.format){
  5073. var format = 'format=' + this.options.format;
  5074. data = (data) ? format + '&' + data : format;
  5075. }
  5076. if (this.options.emulation && !['get', 'post'].contains(method)){
  5077. var _method = '_method=' + method;
  5078. data = (data) ? _method + '&' + data : _method;
  5079. method = 'post';
  5080. }
  5081. if (this.options.urlEncoded && ['post', 'put'].contains(method)){
  5082. var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : '';
  5083. //this.headers['Content-type'] = 'application/x-www-form-urlencoded' + encoding; //mootools1.6.0
  5084. if (!this.headers['Content-Type']) this.headers['Content-type'] = 'application/x-www-form-urlencoded' + encoding; //modify by tommy
  5085. }
  5086. if (!url) url = document.location.pathname;
  5087. var trimPosition = url.lastIndexOf('/');
  5088. if (trimPosition > -1 && (trimPosition = url.indexOf('#')) > -1) url = url.substr(0, trimPosition);
  5089. if (this.options.noCache)
  5090. url += (url.indexOf('?') > -1 ? '&' : '?') + String.uniqueID();
  5091. if (data && (method == 'get' || method == 'delete')){
  5092. url += (url.indexOf('?') > -1 ? '&' : '?') + data;
  5093. data = null;
  5094. }
  5095. var xhr = this.xhr;
  5096. if (progressSupport){
  5097. xhr.onloadstart = this.loadstart.bind(this);
  5098. xhr.onprogress = this.progress.bind(this);
  5099. }
  5100. //modify by Tommy--
  5101. var isWithCredentials = ((this.options.withCredentials && 'withCredentials' in xhr) || (this.options.user && 'withCredentials' in xhr) && (method.toUpperCase()=="POST" || method.toUpperCase()=="PUT"));
  5102. var isWithCredentialsSync = isWithCredentials && !this.options.async;
  5103. //-----------------
  5104. xhr.open(method.toUpperCase(), url, this.options.async, this.options.user, this.options.password);
  5105. if ((/*<1.4compat>*/this.options.user || /*</1.4compat>*/this.options.withCredentials) && 'withCredentials' in xhr) xhr.withCredentials = true;
  5106. //modify by Tommy--
  5107. if (Browser.name=="firefox"){
  5108. if (this.options.async){
  5109. if (isWithCredentials) xhr.withCredentials = true;
  5110. }else{
  5111. xhr.setRequestHeader("x-token", Cookie.read("x-token"));
  5112. }
  5113. }else{
  5114. if (isWithCredentials) xhr.withCredentials = true;
  5115. }
  5116. //-----------------
  5117. xhr.onreadystatechange = this.onStateChange.bind(this);
  5118. Object.each(this.headers, function(value, key){
  5119. try {
  5120. xhr.setRequestHeader(key, value);
  5121. } catch (e){
  5122. this.fireEvent('exception', [key, value]);
  5123. this.reject({reason: 'exception', xhr: xhr, exception: e});
  5124. }
  5125. }, this);
  5126. if (this.getThenableState() !== 'pending'){
  5127. this.resetThenable({reason: 'send'});
  5128. }
  5129. if (url.indexOf("v=4.0")!=-1){
  5130. debugger;
  5131. }
  5132. this.fireEvent('request');
  5133. xhr.send(data);
  5134. if (!this.options.async) this.onStateChange();
  5135. else if (this.options.timeout) this.timer = this.timeout.delay(this.options.timeout, this);
  5136. return this;
  5137. },
  5138. cancel: function(){
  5139. if (!this.running) return this;
  5140. this.running = false;
  5141. var xhr = this.xhr;
  5142. xhr.abort();
  5143. if (this.timer){
  5144. clearTimeout(this.timer);
  5145. delete this.timer;
  5146. }
  5147. xhr.onreadystatechange = empty;
  5148. if (progressSupport) xhr.onprogress = xhr.onloadstart = empty;
  5149. this.xhr = new Browser.Request();
  5150. this.fireEvent('cancel');
  5151. this.reject({reason: 'cancel', xhr: xhr});
  5152. return this;
  5153. }
  5154. });
  5155. var methods = {};
  5156. ['get', 'post', 'put', 'delete', 'patch', 'head', 'GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'].each(function(method){
  5157. methods[method] = function(data){
  5158. var object = {
  5159. method: method
  5160. };
  5161. if (data != null) object.data = data;
  5162. return this.send(object);
  5163. };
  5164. });
  5165. Request.implement(methods);
  5166. Element.Properties.send = {
  5167. set: function(options){
  5168. var send = this.get('send').cancel();
  5169. send.setOptions(options);
  5170. return this;
  5171. },
  5172. get: function(){
  5173. var send = this.retrieve('send');
  5174. if (!send){
  5175. send = new Request({
  5176. data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action')
  5177. });
  5178. this.store('send', send);
  5179. }
  5180. return send;
  5181. }
  5182. };
  5183. Element.implement({
  5184. send: function(url){
  5185. var sender = this.get('send');
  5186. sender.send({data: this, url: url || sender.options.url});
  5187. return this;
  5188. }
  5189. });
  5190. })();
  5191. /*
  5192. ---
  5193. name: Request.HTML
  5194. description: Extends the basic Request Class with additional methods for interacting with HTML responses.
  5195. license: MIT-style license.
  5196. requires: [Element, Request]
  5197. provides: Request.HTML
  5198. ...
  5199. */
  5200. Request.HTML = new Class({
  5201. Extends: Request,
  5202. options: {
  5203. update: false,
  5204. append: false,
  5205. evalScripts: true,
  5206. filter: false,
  5207. headers: {
  5208. Accept: 'text/html, application/xml, text/xml, */*'
  5209. }
  5210. },
  5211. success: function(text){
  5212. var options = this.options, response = this.response;
  5213. response.html = text.stripScripts(function(script){
  5214. response.javascript = script;
  5215. });
  5216. var match = response.html.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
  5217. if (match) response.html = match[1];
  5218. var temp = new Element('div').set('html', response.html);
  5219. response.tree = temp.childNodes;
  5220. response.elements = temp.getElements(options.filter || '*');
  5221. if (options.filter) response.tree = response.elements;
  5222. if (options.update){
  5223. var update = document.id(options.update).empty();
  5224. if (options.filter) update.adopt(response.elements);
  5225. else update.set('html', response.html);
  5226. } else if (options.append){
  5227. var append = document.id(options.append);
  5228. if (options.filter) response.elements.reverse().inject(append);
  5229. else append.adopt(temp.getChildren());
  5230. }
  5231. if (options.evalScripts) Browser.exec(response.javascript);
  5232. this.onSuccess(response.tree, response.elements, response.html, response.javascript);
  5233. this.resolve({tree: response.tree, elements: response.elements, html: response.html, javascript: response.javascript});
  5234. }
  5235. });
  5236. Element.Properties.load = {
  5237. set: function(options){
  5238. var load = this.get('load').cancel();
  5239. load.setOptions(options);
  5240. return this;
  5241. },
  5242. get: function(){
  5243. var load = this.retrieve('load');
  5244. if (!load){
  5245. load = new Request.HTML({data: this, link: 'cancel', update: this, method: 'get'});
  5246. this.store('load', load);
  5247. }
  5248. return load;
  5249. }
  5250. };
  5251. Element.implement({
  5252. load: function(){
  5253. this.get('load').send(Array.link(arguments, {data: Type.isObject, url: Type.isString}));
  5254. return this;
  5255. }
  5256. });
  5257. /*
  5258. ---
  5259. name: JSON
  5260. description: JSON encoder and decoder.
  5261. license: MIT-style license.
  5262. SeeAlso: <http://www.json.org/>
  5263. requires: [Array, String, Number, Function]
  5264. provides: JSON
  5265. ...
  5266. */
  5267. if (typeof JSON == 'undefined') this.JSON = {};
  5268. //<1.2compat>
  5269. JSON = new Hash({
  5270. stringify: JSON.stringify,
  5271. parse: JSON.parse
  5272. });
  5273. //</1.2compat>
  5274. (function(){
  5275. var special = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'};
  5276. var escape = function(chr){
  5277. return special[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16)).slice(-4);
  5278. };
  5279. JSON.validate = function(string){
  5280. string = string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
  5281. replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
  5282. replace(/(?:^|:|,)(?:\s*\[)+/g, '');
  5283. return (/^[\],:{}\s]*$/).test(string);
  5284. };
  5285. JSON.encode = JSON.stringify ? function(obj){
  5286. return JSON.stringify(obj);
  5287. } : function(obj){
  5288. if (obj && obj.toJSON) obj = obj.toJSON();
  5289. switch (typeOf(obj)){
  5290. case 'string':
  5291. return '"' + obj.replace(/[\x00-\x1f\\"]/g, escape) + '"';
  5292. case 'array':
  5293. return '[' + obj.map(JSON.encode).clean() + ']';
  5294. case 'object': case 'hash':
  5295. var string = [];
  5296. Object.each(obj, function(value, key){
  5297. var json = JSON.encode(value);
  5298. if (json) string.push(JSON.encode(key) + ':' + json);
  5299. });
  5300. return '{' + string + '}';
  5301. case 'number': case 'boolean': return '' + obj;
  5302. case 'null': return 'null';
  5303. }
  5304. return null;
  5305. };
  5306. JSON.secure = true;
  5307. //<1.4compat>
  5308. JSON.secure = false;
  5309. //</1.4compat>
  5310. JSON.decode = function(string, secure){
  5311. if (!string || typeOf(string) != 'string') return null;
  5312. if (secure == null) secure = JSON.secure;
  5313. if (secure){
  5314. if (JSON.parse) return JSON.parse(string);
  5315. if (!JSON.validate(string)) throw new Error('JSON could not decode the input; security is enabled and the value is not secure.');
  5316. }
  5317. return eval('(' + string + ')');
  5318. };
  5319. })();
  5320. /*
  5321. ---
  5322. name: Request.JSON
  5323. description: Extends the basic Request Class with additional methods for sending and receiving JSON data.
  5324. license: MIT-style license.
  5325. requires: [Request, JSON]
  5326. provides: Request.JSON
  5327. ...
  5328. */
  5329. Request.JSON = new Class({
  5330. Extends: Request,
  5331. options: {
  5332. /*onError: function(text, error){},*/
  5333. secure: true
  5334. },
  5335. initialize: function(options){
  5336. this.parent(options);
  5337. Object.append(this.headers, {
  5338. 'Accept': 'application/json',
  5339. // 'X-Request': 'JSON'
  5340. });
  5341. },
  5342. success: function(text){
  5343. var json;
  5344. try {
  5345. json = this.response.json = JSON.decode(text, this.options.secure);
  5346. } catch (error){
  5347. this.fireEvent('error', [text, error]);
  5348. return;
  5349. }
  5350. if (json == null){
  5351. this.failure();
  5352. } else {
  5353. this.onSuccess(json, text);
  5354. this.resolve({json: json, text: text});
  5355. }
  5356. }
  5357. });
  5358. /*
  5359. ---
  5360. name: Cookie
  5361. description: Class for creating, reading, and deleting browser Cookies.
  5362. license: MIT-style license.
  5363. credits:
  5364. - Based on the functions by Peter-Paul Koch (http://quirksmode.org).
  5365. requires: [Options, Browser]
  5366. provides: Cookie
  5367. ...
  5368. */
  5369. var Cookie = new Class({
  5370. Implements: Options,
  5371. options: {
  5372. path: '/',
  5373. domain: false,
  5374. duration: false,
  5375. secure: false,
  5376. document: document,
  5377. encode: true,
  5378. httpOnly: false
  5379. },
  5380. initialize: function(key, options){
  5381. this.key = key;
  5382. this.setOptions(options);
  5383. },
  5384. write: function(value){
  5385. if (this.options.encode) value = encodeURIComponent(value);
  5386. if (this.options.domain) value += '; domain=' + this.options.domain;
  5387. if (this.options.path) value += '; path=' + this.options.path;
  5388. if (this.options.duration){
  5389. var date = new Date();
  5390. date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000);
  5391. value += '; expires=' + date.toGMTString();
  5392. }
  5393. if (this.options.secure) value += '; secure';
  5394. if (this.options.httpOnly) value += '; HttpOnly';
  5395. this.options.document.cookie = this.key + '=' + value;
  5396. return this;
  5397. },
  5398. read: function(){
  5399. var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)');
  5400. return (value) ? decodeURIComponent(value[1]) : null;
  5401. },
  5402. dispose: function(){
  5403. new Cookie(this.key, Object.merge({}, this.options, {duration: -1})).write('');
  5404. return this;
  5405. }
  5406. });
  5407. Cookie.write = function(key, value, options){
  5408. return new Cookie(key, options).write(value);
  5409. };
  5410. Cookie.read = function(key){
  5411. return new Cookie(key).read();
  5412. };
  5413. Cookie.dispose = function(key, options){
  5414. return new Cookie(key, options).dispose();
  5415. };
  5416. /*
  5417. ---
  5418. name: DOMReady
  5419. description: Contains the custom event domready.
  5420. license: MIT-style license.
  5421. requires: [Browser, Element, Element.Event]
  5422. provides: [DOMReady, DomReady]
  5423. ...
  5424. */
  5425. (function(window, document){
  5426. var ready,
  5427. loaded,
  5428. checks = [],
  5429. shouldPoll,
  5430. timer,
  5431. testElement = document.createElement('div');
  5432. var domready = function(){
  5433. clearTimeout(timer);
  5434. if (!ready){
  5435. Browser.loaded = ready = true;
  5436. document.removeListener('DOMContentLoaded', domready).removeListener('readystatechange', check);
  5437. document.fireEvent('domready');
  5438. window.fireEvent('domready');
  5439. }
  5440. // cleanup scope vars
  5441. document = window = testElement = null;
  5442. };
  5443. var check = function(){
  5444. for (var i = checks.length; i--;) if (checks[i]()){
  5445. domready();
  5446. return true;
  5447. }
  5448. return false;
  5449. };
  5450. var poll = function(){
  5451. clearTimeout(timer);
  5452. if (!check()) timer = setTimeout(poll, 10);
  5453. };
  5454. document.addListener('DOMContentLoaded', domready);
  5455. /*<ltIE8>*/
  5456. // doScroll technique by Diego Perini http://javascript.nwbox.com/IEContentLoaded/
  5457. // testElement.doScroll() throws when the DOM is not ready, only in the top window
  5458. var doScrollWorks = function(){
  5459. try {
  5460. testElement.doScroll();
  5461. return true;
  5462. } catch (e){}
  5463. return false;
  5464. };
  5465. // If doScroll works already, it can't be used to determine domready
  5466. // e.g. in an iframe
  5467. if (testElement.doScroll && !doScrollWorks()){
  5468. checks.push(doScrollWorks);
  5469. shouldPoll = true;
  5470. }
  5471. /*</ltIE8>*/
  5472. if (document.readyState) checks.push(function(){
  5473. var state = document.readyState;
  5474. return (state == 'loaded' || state == 'complete');
  5475. });
  5476. if ('onreadystatechange' in document) document.addListener('readystatechange', check);
  5477. else shouldPoll = true;
  5478. if (shouldPoll) poll();
  5479. Element.Events.domready = {
  5480. onAdd: function(fn){
  5481. if (ready) fn.call(this);
  5482. }
  5483. };
  5484. // Make sure that domready fires before load
  5485. Element.Events.load = {
  5486. base: 'load',
  5487. onAdd: function(fn){
  5488. if (loaded && this == window) fn.call(this);
  5489. },
  5490. condition: function(){
  5491. if (this == window){
  5492. domready();
  5493. delete Element.Events.load;
  5494. }
  5495. return true;
  5496. }
  5497. };
  5498. // This is based on the custom load event
  5499. if (window) window.addEvent('load', function(){
  5500. loaded = true;
  5501. });
  5502. })(window, document);
  5503. /*
  5504. ---
  5505. script: More.js
  5506. name: More
  5507. description: MooTools More
  5508. license: MIT-style license
  5509. authors:
  5510. - Guillermo Rauch
  5511. - Thomas Aylott
  5512. - Scott Kyle
  5513. - Arian Stolwijk
  5514. - Tim Wienk
  5515. - Christoph Pojer
  5516. - Aaron Newton
  5517. - Jacob Thornton
  5518. requires:
  5519. - Core/MooTools
  5520. provides: [MooTools.More]
  5521. ...
  5522. */
  5523. MooTools.More = {
  5524. version: '1.6.0',
  5525. build: '45b71db70f879781a7e0b0d3fb3bb1307c2521eb'
  5526. };
  5527. /*
  5528. ---
  5529. script: Chain.Wait.js
  5530. name: Chain.Wait
  5531. description: value, Adds a method to inject pauses between chained events.
  5532. license: MIT-style license.
  5533. authors:
  5534. - Aaron Newton
  5535. requires:
  5536. - Core/Chain
  5537. - Core/Element
  5538. - Core/Fx
  5539. - MooTools.More
  5540. provides: [Chain.Wait]
  5541. ...
  5542. */
  5543. (function(){
  5544. var wait = {
  5545. wait: function(duration){
  5546. return this.chain(function(){
  5547. this.callChain.delay(duration == null ? 500 : duration, this);
  5548. return this;
  5549. }.bind(this));
  5550. }
  5551. };
  5552. Chain.implement(wait);
  5553. if (this.Fx) Fx.implement(wait);
  5554. if (this.Element && Element.implement && this.Fx){
  5555. Element.implement({
  5556. chains: function(effects){
  5557. Array.convert(effects || ['tween', 'morph', 'reveal']).each(function(effect){
  5558. effect = this.get(effect);
  5559. if (!effect) return;
  5560. effect.setOptions({
  5561. link:'chain'
  5562. });
  5563. }, this);
  5564. return this;
  5565. },
  5566. pauseFx: function(duration, effect){
  5567. this.chains(effect).get(effect || 'tween').wait(duration);
  5568. return this;
  5569. }
  5570. });
  5571. }
  5572. })();
  5573. /*
  5574. ---
  5575. script: Class.Binds.js
  5576. name: Class.Binds
  5577. description: Automagically binds specified methods in a class to the instance of the class.
  5578. license: MIT-style license
  5579. authors:
  5580. - Aaron Newton
  5581. requires:
  5582. - Core/Class
  5583. - MooTools.More
  5584. provides: [Class.Binds]
  5585. ...
  5586. */
  5587. Class.Mutators.Binds = function(binds){
  5588. if (!this.prototype.initialize) this.implement('initialize', function(){});
  5589. return Array.convert(binds).concat(this.prototype.Binds || []);
  5590. };
  5591. Class.Mutators.initialize = function(initialize){
  5592. return function(){
  5593. Array.convert(this.Binds).each(function(name){
  5594. var original = this[name];
  5595. if (original) this[name] = original.bind(this);
  5596. }, this);
  5597. return initialize.apply(this, arguments);
  5598. };
  5599. };
  5600. /*
  5601. ---
  5602. script: Class.Occlude.js
  5603. name: Class.Occlude
  5604. description: Prevents a class from being applied to a DOM element twice.
  5605. license: MIT-style license.
  5606. authors:
  5607. - Aaron Newton
  5608. requires:
  5609. - Core/Class
  5610. - Core/Element
  5611. - MooTools.More
  5612. provides: [Class.Occlude]
  5613. ...
  5614. */
  5615. Class.Occlude = new Class({
  5616. occlude: function(property, element){
  5617. element = document.id(element || this.element);
  5618. var instance = element.retrieve(property || this.property);
  5619. if (instance && !this.occluded)
  5620. return (this.occluded = instance);
  5621. this.occluded = false;
  5622. element.store(property || this.property, this);
  5623. return this.occluded;
  5624. }
  5625. });
  5626. /*
  5627. ---
  5628. script: Class.Refactor.js
  5629. name: Class.Refactor
  5630. description: Extends a class onto itself with new property, preserving any items attached to the class's namespace.
  5631. license: MIT-style license
  5632. authors:
  5633. - Aaron Newton
  5634. requires:
  5635. - Core/Class
  5636. - MooTools.More
  5637. # Some modules declare themselves dependent on Class.Refactor
  5638. provides: [Class.refactor, Class.Refactor]
  5639. ...
  5640. */
  5641. Class.refactor = function(original, refactors){
  5642. Object.each(refactors, function(item, name){
  5643. var origin = original.prototype[name];
  5644. origin = (origin && origin.$origin) || origin || function(){};
  5645. original.implement(name, (typeof item == 'function') ? function(){
  5646. var old = this.previous;
  5647. this.previous = origin;
  5648. var value = item.apply(this, arguments);
  5649. this.previous = old;
  5650. return value;
  5651. } : item);
  5652. });
  5653. return original;
  5654. };
  5655. /*
  5656. ---
  5657. script: Class.Singleton.js
  5658. name: Class.Singleton
  5659. description: Always provides a single instance of a class
  5660. license: MIT-style license.
  5661. authors:
  5662. - Hristo Chakarov
  5663. requires:
  5664. - Core/Class
  5665. provides: [Class.Singleton]
  5666. ...
  5667. */
  5668. Class.Singleton = new Class({
  5669. initialize : function(descriptor){
  5670. // here we keep reference of the single instance
  5671. var singleton;
  5672. // create a regular Class
  5673. var constructor = new Class(descriptor);
  5674. // We return another constructor, because we need to make sure that we
  5675. // always return the same one and only instance.
  5676. return function(){
  5677. if (singleton){
  5678. return singleton;
  5679. }
  5680. // Obviously we instantiate that class for the first time.
  5681. // Create brand new object & extend it with the prototype of the
  5682. // original `constructor`.
  5683. singleton = Object.append({}, constructor.prototype);
  5684. singleton.constructor = constructor;
  5685. // We also need to call the constructor as a function, passing the
  5686. // arguments object.
  5687. var returnValue = constructor.apply(singleton, arguments);
  5688. // In case the `constructor` returns something other than `this` -
  5689. // return that value; otherwise return the `singleton`.
  5690. singleton = typeof returnValue == 'object' ? returnValue : singleton;
  5691. return singleton;
  5692. };
  5693. }
  5694. });
  5695. /*
  5696. ---
  5697. name: Events.Pseudos
  5698. description: Adds the functionality to add pseudo events
  5699. license: MIT-style license
  5700. authors:
  5701. - Arian Stolwijk
  5702. requires: [Core/Class.Extras, Core/Slick.Parser, MooTools.More]
  5703. provides: [Events.Pseudos]
  5704. ...
  5705. */
  5706. (function(){
  5707. Events.Pseudos = function(pseudos, addEvent, removeEvent){
  5708. var storeKey = '_monitorEvents:';
  5709. var storageOf = function(object){
  5710. return {
  5711. store: object.store ? function(key, value){
  5712. object.store(storeKey + key, value);
  5713. } : function(key, value){
  5714. (object._monitorEvents || (object._monitorEvents = {}))[key] = value;
  5715. },
  5716. retrieve: object.retrieve ? function(key, dflt){
  5717. return object.retrieve(storeKey + key, dflt);
  5718. } : function(key, dflt){
  5719. if (!object._monitorEvents) return dflt;
  5720. return object._monitorEvents[key] || dflt;
  5721. }
  5722. };
  5723. };
  5724. var splitType = function(type){
  5725. if (type.indexOf(':') == -1 || !pseudos) return null;
  5726. var parsed = Slick.parse(type).expressions[0][0],
  5727. parsedPseudos = parsed.pseudos,
  5728. l = parsedPseudos.length,
  5729. splits = [];
  5730. while (l--){
  5731. var pseudo = parsedPseudos[l].key,
  5732. listener = pseudos[pseudo];
  5733. if (listener != null) splits.push({
  5734. event: parsed.tag,
  5735. value: parsedPseudos[l].value,
  5736. pseudo: pseudo,
  5737. original: type,
  5738. listener: listener
  5739. });
  5740. }
  5741. return splits.length ? splits : null;
  5742. };
  5743. return {
  5744. addEvent: function(type, fn, internal){
  5745. var split = splitType(type);
  5746. if (!split) return addEvent.call(this, type, fn, internal);
  5747. var storage = storageOf(this),
  5748. events = storage.retrieve(type, []),
  5749. eventType = split[0].event,
  5750. args = Array.slice(arguments, 2),
  5751. stack = fn,
  5752. self = this;
  5753. split.each(function(item){
  5754. var listener = item.listener,
  5755. stackFn = stack;
  5756. if (listener == false) eventType += ':' + item.pseudo + '(' + item.value + ')';
  5757. else stack = function(){
  5758. listener.call(self, item, stackFn, arguments, stack);
  5759. };
  5760. });
  5761. events.include({type: eventType, event: fn, monitor: stack});
  5762. storage.store(type, events);
  5763. if (type != eventType) addEvent.apply(this, [type, fn].concat(args));
  5764. return addEvent.apply(this, [eventType, stack].concat(args));
  5765. },
  5766. removeEvent: function(type, fn){
  5767. var split = splitType(type);
  5768. if (!split) return removeEvent.call(this, type, fn);
  5769. var storage = storageOf(this),
  5770. events = storage.retrieve(type);
  5771. if (!events) return this;
  5772. var args = Array.slice(arguments, 2);
  5773. removeEvent.apply(this, [type, fn].concat(args));
  5774. events.each(function(monitor, i){
  5775. if (!fn || monitor.event == fn) removeEvent.apply(this, [monitor.type, monitor.monitor].concat(args));
  5776. delete events[i];
  5777. }, this);
  5778. storage.store(type, events);
  5779. return this;
  5780. }
  5781. };
  5782. };
  5783. var pseudos = {
  5784. once: function(split, fn, args, monitor){
  5785. fn.apply(this, args);
  5786. this.removeEvent(split.event, monitor)
  5787. .removeEvent(split.original, fn);
  5788. },
  5789. throttle: function(split, fn, args){
  5790. if (!fn._throttled){
  5791. fn.apply(this, args);
  5792. fn._throttled = setTimeout(function(){
  5793. fn._throttled = false;
  5794. }, split.value || 250);
  5795. }
  5796. },
  5797. pause: function(split, fn, args){
  5798. clearTimeout(fn._pause);
  5799. fn._pause = fn.delay(split.value || 250, this, args);
  5800. }
  5801. };
  5802. Events.definePseudo = function(key, listener){
  5803. pseudos[key] = listener;
  5804. return this;
  5805. };
  5806. Events.lookupPseudo = function(key){
  5807. return pseudos[key];
  5808. };
  5809. var proto = Events.prototype;
  5810. Events.implement(Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
  5811. ['Request', 'Fx'].each(function(klass){
  5812. if (this[klass]) this[klass].implement(Events.prototype);
  5813. });
  5814. })();
  5815. /*
  5816. ---
  5817. script: Drag.js
  5818. name: Drag
  5819. description: The base Drag Class. Can be used to drag and resize Elements using mouse events.
  5820. license: MIT-style license
  5821. authors:
  5822. - Valerio Proietti
  5823. - Tom Occhinno
  5824. - Jan Kassens
  5825. requires:
  5826. - Core/Events
  5827. - Core/Options
  5828. - Core/Element.Event
  5829. - Core/Element.Style
  5830. - Core/Element.Dimensions
  5831. - MooTools.More
  5832. provides: [Drag]
  5833. ...
  5834. */
  5835. (function(){
  5836. var Drag = this.Drag = new Class({
  5837. Implements: [Events, Options],
  5838. options: {/*
  5839. onBeforeStart: function(thisElement){},
  5840. onStart: function(thisElement, event){},
  5841. onSnap: function(thisElement){},
  5842. onDrag: function(thisElement, event){},
  5843. onCancel: function(thisElement){},
  5844. onComplete: function(thisElement, event){},*/
  5845. snap: 6,
  5846. unit: 'px',
  5847. grid: false,
  5848. style: true,
  5849. limit: false,
  5850. handle: false,
  5851. invert: false,
  5852. unDraggableTags: ['button', 'input', 'a', 'textarea', 'select', 'option'],
  5853. preventDefault: false,
  5854. stopPropagation: false,
  5855. compensateScroll: false,
  5856. modifiers: {x: 'left', y: 'top'}
  5857. },
  5858. initialize: function(){
  5859. var params = Array.link(arguments, {
  5860. 'options': Type.isObject,
  5861. 'element': function(obj){
  5862. return obj != null;
  5863. }
  5864. });
  5865. this.element = document.id(params.element);
  5866. this.document = this.element.getDocument();
  5867. this.setOptions(params.options || {});
  5868. var htype = typeOf(this.options.handle);
  5869. this.handles = ((htype == 'array' || htype == 'collection') ? $$(this.options.handle) : document.id(this.options.handle)) || this.element;
  5870. this.mouse = {'now': {}, 'pos': {}};
  5871. this.value = {'start': {}, 'now': {}};
  5872. this.offsetParent = (function(el){
  5873. var offsetParent = el.getOffsetParent();
  5874. var isBody = !offsetParent || (/^(?:body|html)$/i).test(offsetParent.tagName);
  5875. return isBody ? window : document.id(offsetParent);
  5876. })(this.element);
  5877. this.selection = 'selectstart' in document ? 'selectstart' : 'mousedown';
  5878. this.compensateScroll = {start: {}, diff: {}, last: {}};
  5879. if ('ondragstart' in document && !('FileReader' in window) && !Drag.ondragstartFixed){
  5880. document.ondragstart = Function.convert(false);
  5881. Drag.ondragstartFixed = true;
  5882. }
  5883. this.bound = {
  5884. start: this.start.bind(this),
  5885. check: this.check.bind(this),
  5886. drag: this.drag.bind(this),
  5887. stop: this.stop.bind(this),
  5888. cancel: this.cancel.bind(this),
  5889. eventStop: Function.convert(false),
  5890. scrollListener: this.scrollListener.bind(this)
  5891. };
  5892. this.attach();
  5893. },
  5894. attach: function(){
  5895. this.handles.addEvent('mousedown', this.bound.start);
  5896. this.handles.addEvent('touchstart', this.bound.start);
  5897. if (this.options.compensateScroll) this.offsetParent.addEvent('scroll', this.bound.scrollListener);
  5898. return this;
  5899. },
  5900. detach: function(){
  5901. this.handles.removeEvent('mousedown', this.bound.start);
  5902. this.handles.removeEvent('touchstart', this.bound.start);
  5903. if (this.options.compensateScroll) this.offsetParent.removeEvent('scroll', this.bound.scrollListener);
  5904. return this;
  5905. },
  5906. scrollListener: function(){
  5907. if (!this.mouse.start) return;
  5908. var newScrollValue = this.offsetParent.getScroll();
  5909. if (this.element.getStyle('position') == 'absolute'){
  5910. var scrollDiff = this.sumValues(newScrollValue, this.compensateScroll.last, -1);
  5911. this.mouse.now = this.sumValues(this.mouse.now, scrollDiff, 1);
  5912. } else {
  5913. this.compensateScroll.diff = this.sumValues(newScrollValue, this.compensateScroll.start, -1);
  5914. }
  5915. if (this.offsetParent != window) this.compensateScroll.diff = this.sumValues(this.compensateScroll.start, newScrollValue, -1);
  5916. this.compensateScroll.last = newScrollValue;
  5917. this.render(this.options);
  5918. },
  5919. sumValues: function(alpha, beta, op){
  5920. var sum = {}, options = this.options;
  5921. for (var z in options.modifiers){
  5922. if (!options.modifiers[z]) continue;
  5923. sum[z] = alpha[z] + beta[z] * op;
  5924. }
  5925. return sum;
  5926. },
  5927. start: function(event){
  5928. if (this.options.unDraggableTags.contains(event.target.get('tag'))) return;
  5929. var options = this.options;
  5930. if (event.rightClick) return;
  5931. if (options.preventDefault) event.preventDefault();
  5932. if (options.stopPropagation) event.stopPropagation();
  5933. this.compensateScroll.start = this.compensateScroll.last = this.offsetParent.getScroll();
  5934. this.compensateScroll.diff = {x: 0, y: 0};
  5935. this.mouse.start = event.page;
  5936. this.fireEvent('beforeStart', this.element);
  5937. var limit = options.limit;
  5938. this.limit = {x: [], y: []};
  5939. var z, coordinates, offsetParent = this.offsetParent == window ? null : this.offsetParent;
  5940. for (z in options.modifiers){
  5941. if (!options.modifiers[z]) continue;
  5942. var style = this.element.getStyle(options.modifiers[z]);
  5943. // Some browsers (IE and Opera) don't always return pixels.
  5944. if (style && !style.match(/px$/)){
  5945. if (!coordinates) coordinates = this.element.getCoordinates(offsetParent);
  5946. style = coordinates[options.modifiers[z]];
  5947. }
  5948. if (options.style) this.value.now[z] = (style || 0).toInt();
  5949. else this.value.now[z] = this.element[options.modifiers[z]];
  5950. if (options.invert) this.value.now[z] *= -1;
  5951. this.mouse.pos[z] = event.page[z] - this.value.now[z];
  5952. if (limit && limit[z]){
  5953. var i = 2;
  5954. while (i--){
  5955. var limitZI = limit[z][i];
  5956. if (limitZI || limitZI === 0) this.limit[z][i] = (typeof limitZI == 'function') ? limitZI() : limitZI;
  5957. }
  5958. }
  5959. }
  5960. if (typeOf(this.options.grid) == 'number') this.options.grid = {
  5961. x: this.options.grid,
  5962. y: this.options.grid
  5963. };
  5964. var events = {
  5965. mousemove: this.bound.check,
  5966. mouseup: this.bound.cancel,
  5967. touchmove: this.bound.check,
  5968. touchend: this.bound.cancel
  5969. };
  5970. events[this.selection] = this.bound.eventStop;
  5971. this.document.addEvents(events);
  5972. },
  5973. check: function(event){
  5974. if (this.options.preventDefault) event.preventDefault();
  5975. 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)));
  5976. if (distance > this.options.snap){
  5977. this.cancel();
  5978. this.document.addEvents({
  5979. mousemove: this.bound.drag,
  5980. mouseup: this.bound.stop,
  5981. touchmove: this.bound.drag,
  5982. touchend: this.bound.stop
  5983. });
  5984. this.fireEvent('start', [this.element, event]).fireEvent('snap', this.element);
  5985. }
  5986. },
  5987. drag: function(event){
  5988. var options = this.options;
  5989. if (options.preventDefault) event.preventDefault();
  5990. this.mouse.now = this.sumValues(event.page, this.compensateScroll.diff, -1);
  5991. this.render(options);
  5992. this.fireEvent('drag', [this.element, event]);
  5993. },
  5994. render: function(options){
  5995. for (var z in options.modifiers){
  5996. if (!options.modifiers[z]) continue;
  5997. this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z];
  5998. if (options.invert) this.value.now[z] *= -1;
  5999. if (options.limit && this.limit[z]){
  6000. if ((this.limit[z][1] || this.limit[z][1] === 0) && (this.value.now[z] > this.limit[z][1])){
  6001. this.value.now[z] = this.limit[z][1];
  6002. } else if ((this.limit[z][0] || this.limit[z][0] === 0) && (this.value.now[z] < this.limit[z][0])){
  6003. this.value.now[z] = this.limit[z][0];
  6004. }
  6005. }
  6006. if (options.grid[z]) this.value.now[z] -= ((this.value.now[z] - (this.limit[z][0]||0)) % options.grid[z]);
  6007. if (options.style) this.element.setStyle(options.modifiers[z], this.value.now[z] + options.unit);
  6008. else this.element[options.modifiers[z]] = this.value.now[z];
  6009. }
  6010. },
  6011. cancel: function(event){
  6012. this.document.removeEvents({
  6013. mousemove: this.bound.check,
  6014. mouseup: this.bound.cancel,
  6015. touchmove: this.bound.check,
  6016. touchend: this.bound.cancel
  6017. });
  6018. if (event){
  6019. this.document.removeEvent(this.selection, this.bound.eventStop);
  6020. this.fireEvent('cancel', this.element);
  6021. }
  6022. },
  6023. stop: function(event){
  6024. var events = {
  6025. mousemove: this.bound.drag,
  6026. mouseup: this.bound.stop,
  6027. touchmove: this.bound.drag,
  6028. touchend: this.bound.stop
  6029. };
  6030. events[this.selection] = this.bound.eventStop;
  6031. this.document.removeEvents(events);
  6032. this.mouse.start = null;
  6033. if (event) this.fireEvent('complete', [this.element, event]);
  6034. }
  6035. });
  6036. })();
  6037. Element.implement({
  6038. makeResizable: function(options){
  6039. var drag = new Drag(this, Object.merge({
  6040. modifiers: {
  6041. x: 'width',
  6042. y: 'height'
  6043. }
  6044. }, options));
  6045. this.store('resizer', drag);
  6046. return drag.addEvent('drag', function(){
  6047. this.fireEvent('resize', drag);
  6048. }.bind(this));
  6049. }
  6050. });
  6051. /*
  6052. ---
  6053. script: Drag.Move.js
  6054. name: Drag.Move
  6055. description: A Drag extension that provides support for the constraining of draggables to containers and droppables.
  6056. license: MIT-style license
  6057. authors:
  6058. - Valerio Proietti
  6059. - Tom Occhinno
  6060. - Jan Kassens
  6061. - Aaron Newton
  6062. - Scott Kyle
  6063. requires:
  6064. - Core/Element.Dimensions
  6065. - Drag
  6066. provides: [Drag.Move]
  6067. ...
  6068. */
  6069. Drag.Move = new Class({
  6070. Extends: Drag,
  6071. options: {/*
  6072. onEnter: function(thisElement, overed){},
  6073. onLeave: function(thisElement, overed){},
  6074. onDrop: function(thisElement, overed, event){},*/
  6075. droppables: [],
  6076. container: false,
  6077. precalculate: false,
  6078. includeMargins: true,
  6079. checkDroppables: true
  6080. },
  6081. initialize: function(element, options){
  6082. this.parent(element, options);
  6083. element = this.element;
  6084. this.droppables = $$(this.options.droppables);
  6085. this.setContainer(this.options.container);
  6086. if (this.options.style){
  6087. if (this.options.modifiers.x == 'left' && this.options.modifiers.y == 'top'){
  6088. var parent = element.getOffsetParent(),
  6089. styles = element.getStyles('left', 'top');
  6090. if (parent && (styles.left == 'auto' || styles.top == 'auto')){
  6091. element.setPosition(element.getPosition(parent));
  6092. }
  6093. }
  6094. if (element.getStyle('position') == 'static') element.setStyle('position', 'absolute');
  6095. }
  6096. this.addEvent('start', this.checkDroppables, true);
  6097. this.overed = null;
  6098. },
  6099. setContainer: function(container){
  6100. this.container = document.id(container);
  6101. if (this.container && typeOf(this.container) != 'element'){
  6102. this.container = document.id(this.container.getDocument().body);
  6103. }
  6104. },
  6105. start: function(event){
  6106. if (this.container) this.options.limit = this.calculateLimit();
  6107. if (this.options.precalculate){
  6108. this.positions = this.droppables.map(function(el){
  6109. return el.getCoordinates();
  6110. });
  6111. }
  6112. this.parent(event);
  6113. },
  6114. calculateLimit: function(){
  6115. var element = this.element,
  6116. container = this.container,
  6117. offsetParent = document.id(element.getOffsetParent()) || document.body,
  6118. containerCoordinates = container.getCoordinates(offsetParent),
  6119. elementMargin = {},
  6120. elementBorder = {},
  6121. containerMargin = {},
  6122. containerBorder = {},
  6123. offsetParentPadding = {},
  6124. offsetScroll = offsetParent.getScroll();
  6125. ['top', 'right', 'bottom', 'left'].each(function(pad){
  6126. elementMargin[pad] = element.getStyle('margin-' + pad).toInt();
  6127. elementBorder[pad] = element.getStyle('border-' + pad).toInt();
  6128. containerMargin[pad] = container.getStyle('margin-' + pad).toInt();
  6129. containerBorder[pad] = container.getStyle('border-' + pad).toInt();
  6130. offsetParentPadding[pad] = offsetParent.getStyle('padding-' + pad).toInt();
  6131. }, this);
  6132. var width = element.offsetWidth + elementMargin.left + elementMargin.right,
  6133. height = element.offsetHeight + elementMargin.top + elementMargin.bottom,
  6134. left = 0 + offsetScroll.x,
  6135. top = 0 + offsetScroll.y,
  6136. right = containerCoordinates.right - containerBorder.right - width + offsetScroll.x,
  6137. bottom = containerCoordinates.bottom - containerBorder.bottom - height + offsetScroll.y;
  6138. if (this.options.includeMargins){
  6139. left += elementMargin.left;
  6140. top += elementMargin.top;
  6141. } else {
  6142. right += elementMargin.right;
  6143. bottom += elementMargin.bottom;
  6144. }
  6145. if (element.getStyle('position') == 'relative'){
  6146. var coords = element.getCoordinates(offsetParent);
  6147. coords.left -= element.getStyle('left').toInt();
  6148. coords.top -= element.getStyle('top').toInt();
  6149. left -= coords.left;
  6150. top -= coords.top;
  6151. if (container.getStyle('position') != 'relative'){
  6152. left += containerBorder.left;
  6153. top += containerBorder.top;
  6154. }
  6155. right += elementMargin.left - coords.left;
  6156. bottom += elementMargin.top - coords.top;
  6157. if (container != offsetParent){
  6158. left += containerMargin.left + offsetParentPadding.left;
  6159. if (!offsetParentPadding.left && left < 0) left = 0;
  6160. top += offsetParent == document.body ? 0 : containerMargin.top + offsetParentPadding.top;
  6161. if (!offsetParentPadding.top && top < 0) top = 0;
  6162. }
  6163. } else {
  6164. left -= elementMargin.left;
  6165. top -= elementMargin.top;
  6166. if (container != offsetParent){
  6167. left += containerCoordinates.left + containerBorder.left;
  6168. top += containerCoordinates.top + containerBorder.top;
  6169. }
  6170. }
  6171. return {
  6172. x: [left, right],
  6173. y: [top, bottom]
  6174. };
  6175. },
  6176. getDroppableCoordinates: function(element){
  6177. var position = element.getCoordinates();
  6178. if (element.getStyle('position') == 'fixed'){
  6179. var scroll = window.getScroll();
  6180. position.left += scroll.x;
  6181. position.right += scroll.x;
  6182. position.top += scroll.y;
  6183. position.bottom += scroll.y;
  6184. }
  6185. return position;
  6186. },
  6187. //modify by Tommy
  6188. checkDroppables:function(){
  6189. var overedList = this.droppables.filter(function(el, i){
  6190. el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el);
  6191. var now = this.mouse.now;
  6192. return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
  6193. }, this);
  6194. var overed = overedList.getLast();
  6195. if (overed) for (var x=0;x<overedList.length-1;x++) if(overed.contains(overedList[x])) overed=overedList[x];
  6196. if(this.overed!=overed){
  6197. if(this.overed) this.fireEvent("leave",[this.element,this.overed]);
  6198. if(overed) this.fireEvent("enter",[this.element,overed]);
  6199. this.overed=overed;
  6200. }
  6201. },
  6202. //mootools....
  6203. //checkDroppables: function(){
  6204. // var overed = this.droppables.filter(function(el, i){
  6205. // el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el);
  6206. // var now = this.mouse.now;
  6207. // return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
  6208. // }, this).getLast();
  6209. //
  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. drag: function(event){
  6217. this.parent(event);
  6218. if (this.options.checkDroppables && this.droppables.length) this.checkDroppables();
  6219. },
  6220. stop: function(event){
  6221. this.checkDroppables();
  6222. this.fireEvent('drop', [this.element, this.overed, event]);
  6223. this.overed = null;
  6224. return this.parent(event);
  6225. }
  6226. });
  6227. Element.implement({
  6228. makeDraggable: function(options){
  6229. var drag = new Drag.Move(this, options);
  6230. this.store('dragger', drag);
  6231. return drag;
  6232. }
  6233. });
  6234. /*
  6235. ---
  6236. script: Element.Measure.js
  6237. name: Element.Measure
  6238. description: Extends the Element native object to include methods useful in measuring dimensions.
  6239. credits: "Element.measure / .expose methods by Daniel Steigerwald License: MIT-style license. Copyright: Copyright (c) 2008 Daniel Steigerwald, daniel.steigerwald.cz"
  6240. license: MIT-style license
  6241. authors:
  6242. - Aaron Newton
  6243. requires:
  6244. - Core/Element.Style
  6245. - Core/Element.Dimensions
  6246. - MooTools.More
  6247. provides: [Element.Measure]
  6248. ...
  6249. */
  6250. (function(){
  6251. var getStylesList = function(styles, planes){
  6252. var list = [];
  6253. Object.each(planes, function(directions){
  6254. Object.each(directions, function(edge){
  6255. styles.each(function(style){
  6256. list.push(style + '-' + edge + (style == 'border' ? '-width' : ''));
  6257. });
  6258. });
  6259. });
  6260. return list;
  6261. };
  6262. var calculateEdgeSize = function(edge, styles){
  6263. var total = 0;
  6264. Object.each(styles, function(value, style){
  6265. if (style.test(edge)) total = total + value.toInt();
  6266. });
  6267. return total;
  6268. };
  6269. var isVisible = function(el){
  6270. return !!(!el || el.offsetHeight || el.offsetWidth);
  6271. };
  6272. Element.implement({
  6273. measure: function(fn){
  6274. if (isVisible(this)) return fn.call(this);
  6275. var parent = this.getParent(),
  6276. toMeasure = [];
  6277. while (!isVisible(parent) && parent != document.body){
  6278. toMeasure.push(parent.expose());
  6279. parent = parent.getParent();
  6280. }
  6281. var restore = this.expose(),
  6282. result = fn.call(this);
  6283. restore();
  6284. toMeasure.each(function(restore){
  6285. restore();
  6286. });
  6287. return result;
  6288. },
  6289. expose: function(){
  6290. if (this.getStyle('display') != 'none') return function(){};
  6291. var before = this.style.cssText;
  6292. this.setStyles({
  6293. display: 'block',
  6294. position: 'absolute',
  6295. visibility: 'hidden'
  6296. });
  6297. return function(){
  6298. this.style.cssText = before;
  6299. }.bind(this);
  6300. },
  6301. getDimensions: function(options){
  6302. options = Object.merge({computeSize: false}, options);
  6303. var dim = {x: 0, y: 0};
  6304. var getSize = function(el, options){
  6305. return (options.computeSize) ? el.getComputedSize(options) : el.getSize();
  6306. };
  6307. var parent = this.getParent('body');
  6308. if (parent && this.getStyle('display') == 'none'){
  6309. dim = this.measure(function(){
  6310. return getSize(this, options);
  6311. });
  6312. } else if (parent){
  6313. try { //safari sometimes crashes here, so catch it
  6314. dim = getSize(this, options);
  6315. } catch (e){}
  6316. }
  6317. return Object.append(dim, (dim.x || dim.x === 0) ? {
  6318. width: dim.x,
  6319. height: dim.y
  6320. } : {
  6321. x: dim.width,
  6322. y: dim.height
  6323. });
  6324. },
  6325. getComputedSize: function(options){
  6326. //<1.2compat>
  6327. //legacy support for my stupid spelling error
  6328. if (options && options.plains) options.planes = options.plains;
  6329. //</1.2compat>
  6330. options = Object.merge({
  6331. styles: ['padding','border'],
  6332. planes: {
  6333. height: ['top','bottom'],
  6334. width: ['left','right']
  6335. },
  6336. mode: 'both'
  6337. }, options);
  6338. var styles = {},
  6339. size = {width: 0, height: 0},
  6340. dimensions;
  6341. if (options.mode == 'vertical'){
  6342. delete size.width;
  6343. delete options.planes.width;
  6344. } else if (options.mode == 'horizontal'){
  6345. delete size.height;
  6346. delete options.planes.height;
  6347. }
  6348. getStylesList(options.styles, options.planes).each(function(style){
  6349. styles[style] = this.getStyle(style).toInt();
  6350. }, this);
  6351. Object.each(options.planes, function(edges, plane){
  6352. var capitalized = plane.capitalize(),
  6353. style = this.getStyle(plane);
  6354. if (style == 'auto' && !dimensions) dimensions = this.getDimensions();
  6355. style = styles[plane] = (style == 'auto') ? dimensions[plane] : style.toInt();
  6356. size['total' + capitalized] = style;
  6357. edges.each(function(edge){
  6358. var edgesize = calculateEdgeSize(edge, styles);
  6359. size['computed' + edge.capitalize()] = edgesize;
  6360. size['total' + capitalized] += edgesize;
  6361. });
  6362. }, this);
  6363. return Object.append(size, styles);
  6364. }
  6365. });
  6366. })();
  6367. /*
  6368. ---
  6369. script: Slider.js
  6370. name: Slider
  6371. description: Class for creating horizontal and vertical slider controls.
  6372. license: MIT-style license
  6373. authors:
  6374. - Valerio Proietti
  6375. requires:
  6376. - Core/Element.Dimensions
  6377. - Core/Number
  6378. - Class.Binds
  6379. - Drag
  6380. - Element.Measure
  6381. provides: [Slider]
  6382. ...
  6383. */
  6384. (function(){
  6385. var Slider = this.Slider = new Class({
  6386. Implements: [Events, Options],
  6387. Binds: ['clickedElement', 'draggedKnob', 'scrolledElement'],
  6388. options: {/*
  6389. onTick: function(intPosition){},
  6390. onMove: function(){},
  6391. onChange: function(intStep){},
  6392. onComplete: function(strStep){},*/
  6393. onTick: function(position){
  6394. this.setKnobPosition(position);
  6395. },
  6396. initialStep: 0,
  6397. snap: false,
  6398. offset: 0,
  6399. range: false,
  6400. wheel: false,
  6401. steps: 100,
  6402. mode: 'horizontal'
  6403. },
  6404. initialize: function(element, knob, options){
  6405. this.setOptions(options);
  6406. options = this.options;
  6407. this.element = document.id(element);
  6408. knob = this.knob = document.id(knob);
  6409. this.previousChange = this.previousEnd = this.step = options.initialStep ? options.initialStep : options.range ? options.range[0] : 0;
  6410. var limit = {},
  6411. modifiers = {x: false, y: false};
  6412. switch (options.mode){
  6413. case 'vertical':
  6414. this.axis = 'y';
  6415. this.property = 'top';
  6416. this.offset = 'offsetHeight';
  6417. break;
  6418. case 'horizontal':
  6419. this.axis = 'x';
  6420. this.property = 'left';
  6421. this.offset = 'offsetWidth';
  6422. }
  6423. this.setSliderDimensions();
  6424. this.setRange(options.range, null, true);
  6425. if (knob.getStyle('position') == 'static') knob.setStyle('position', 'relative');
  6426. knob.setStyle(this.property, -options.offset);
  6427. modifiers[this.axis] = this.property;
  6428. limit[this.axis] = [-options.offset, this.full - options.offset];
  6429. var dragOptions = {
  6430. snap: 0,
  6431. limit: limit,
  6432. modifiers: modifiers,
  6433. onDrag: this.draggedKnob,
  6434. onStart: this.draggedKnob,
  6435. onBeforeStart: (function(){
  6436. this.isDragging = true;
  6437. }).bind(this),
  6438. onCancel: function(){
  6439. this.isDragging = false;
  6440. }.bind(this),
  6441. onComplete: function(){
  6442. this.isDragging = false;
  6443. this.draggedKnob();
  6444. this.end();
  6445. }.bind(this)
  6446. };
  6447. if (options.snap) this.setSnap(dragOptions);
  6448. this.drag = new Drag(knob, dragOptions);
  6449. if (options.initialStep != null) this.set(options.initialStep, true);
  6450. this.attach();
  6451. },
  6452. attach: function(){
  6453. this.element.addEvent('mousedown', this.clickedElement);
  6454. if (this.options.wheel) this.element.addEvent('mousewheel', this.scrolledElement);
  6455. this.drag.attach();
  6456. return this;
  6457. },
  6458. detach: function(){
  6459. this.element.removeEvent('mousedown', this.clickedElement)
  6460. .removeEvent('mousewheel', this.scrolledElement);
  6461. this.drag.detach();
  6462. return this;
  6463. },
  6464. autosize: function(){
  6465. this.setSliderDimensions()
  6466. .setKnobPosition(this.toPosition(this.step));
  6467. this.drag.options.limit[this.axis] = [-this.options.offset, this.full - this.options.offset];
  6468. if (this.options.snap) this.setSnap();
  6469. return this;
  6470. },
  6471. setSnap: function(options){
  6472. if (!options) options = this.drag.options;
  6473. options.grid = Math.ceil(this.stepWidth);
  6474. options.limit[this.axis][1] = this.element[this.offset];
  6475. return this;
  6476. },
  6477. setKnobPosition: function(position){
  6478. if (this.options.snap) position = this.toPosition(this.step);
  6479. this.knob.setStyle(this.property, position);
  6480. return this;
  6481. },
  6482. setSliderDimensions: function(){
  6483. this.full = this.element.measure(function(){
  6484. this.half = this.knob[this.offset] / 2;
  6485. return this.element[this.offset] - this.knob[this.offset] + (this.options.offset * 2);
  6486. }.bind(this));
  6487. return this;
  6488. },
  6489. set: function(step, silently){
  6490. if (!((this.range > 0) ^ (step < this.min))) step = this.min;
  6491. if (!((this.range > 0) ^ (step > this.max))) step = this.max;
  6492. this.step = (step).round(this.modulus.decimalLength);
  6493. if (silently) this.checkStep().setKnobPosition(this.toPosition(this.step));
  6494. else this.checkStep().fireEvent('tick', this.toPosition(this.step)).fireEvent('move').end();
  6495. return this;
  6496. },
  6497. setRange: function(range, pos, silently){
  6498. this.min = Array.pick([range[0], 0]);
  6499. this.max = Array.pick([range[1], this.options.steps]);
  6500. this.range = this.max - this.min;
  6501. this.steps = this.options.steps || this.full;
  6502. var stepSize = this.stepSize = Math.abs(this.range) / this.steps;
  6503. this.stepWidth = this.stepSize * this.full / Math.abs(this.range);
  6504. this.setModulus();
  6505. if (range) this.set(Array.pick([pos, this.step]).limit(this.min,this.max), silently);
  6506. return this;
  6507. },
  6508. setModulus: function(){
  6509. var decimals = ((this.stepSize + '').split('.')[1] || []).length,
  6510. modulus = 1 + '';
  6511. while (decimals--) modulus += '0';
  6512. this.modulus = {multiplier: (modulus).toInt(10), decimalLength: modulus.length - 1};
  6513. },
  6514. clickedElement: function(event){
  6515. if (this.isDragging || event.target == this.knob) return;
  6516. var dir = this.range < 0 ? -1 : 1,
  6517. position = event.page[this.axis] - this.element.getPosition()[this.axis] - this.half;
  6518. position = position.limit(-this.options.offset, this.full - this.options.offset);
  6519. this.step = (this.min + dir * this.toStep(position)).round(this.modulus.decimalLength);
  6520. this.checkStep()
  6521. .fireEvent('tick', position)
  6522. .fireEvent('move')
  6523. .end();
  6524. },
  6525. scrolledElement: function(event){
  6526. var mode = (this.options.mode == 'horizontal') ? (event.wheel < 0) : (event.wheel > 0);
  6527. this.set(this.step + (mode ? -1 : 1) * this.stepSize);
  6528. event.stop();
  6529. },
  6530. draggedKnob: function(){
  6531. var dir = this.range < 0 ? -1 : 1,
  6532. position = this.drag.value.now[this.axis];
  6533. position = position.limit(-this.options.offset, this.full -this.options.offset);
  6534. this.step = (this.min + dir * this.toStep(position)).round(this.modulus.decimalLength);
  6535. this.checkStep();
  6536. this.fireEvent('move');
  6537. },
  6538. checkStep: function(){
  6539. var step = this.step;
  6540. if (this.previousChange != step){
  6541. this.previousChange = step;
  6542. this.fireEvent('change', step);
  6543. }
  6544. return this;
  6545. },
  6546. end: function(){
  6547. var step = this.step;
  6548. if (this.previousEnd !== step){
  6549. this.previousEnd = step;
  6550. this.fireEvent('complete', step + '');
  6551. }
  6552. return this;
  6553. },
  6554. toStep: function(position){
  6555. var step = (position + this.options.offset) * this.stepSize / this.full * this.steps;
  6556. return this.options.steps ? (step - (step * this.modulus.multiplier) % (this.stepSize * this.modulus.multiplier) / this.modulus.multiplier).round(this.modulus.decimalLength) : step;
  6557. },
  6558. toPosition: function(step){
  6559. return (this.full * Math.abs(this.min - step)) / (this.steps * this.stepSize) - this.options.offset || 0;
  6560. }
  6561. });
  6562. })();
  6563. /*
  6564. ---
  6565. script: Sortables.js
  6566. name: Sortables
  6567. description: Class for creating a drag and drop sorting interface for lists of items.
  6568. license: MIT-style license
  6569. authors:
  6570. - Tom Occhino
  6571. requires:
  6572. - Core/Fx.Morph
  6573. - Drag.Move
  6574. provides: [Sortables]
  6575. ...
  6576. */
  6577. (function(){
  6578. var Sortables = this.Sortables = new Class({
  6579. Implements: [Events, Options],
  6580. options: {/*
  6581. onSort: function(element, clone){},
  6582. onStart: function(element, clone){},
  6583. onComplete: function(element){},*/
  6584. opacity: 1,
  6585. clone: false,
  6586. revert: false,
  6587. handle: false,
  6588. dragOptions: {},
  6589. unDraggableTags: ['button', 'input', 'a', 'textarea', 'select', 'option']/*<1.2compat>*/,
  6590. snap: 4,
  6591. constrain: false,
  6592. preventDefault: false
  6593. /*</1.2compat>*/
  6594. },
  6595. initialize: function(lists, options){
  6596. this.setOptions(options);
  6597. this.elements = [];
  6598. this.lists = [];
  6599. this.idle = true;
  6600. this.addLists($$(document.id(lists) || lists));
  6601. if (!this.options.clone) this.options.revert = false;
  6602. if (this.options.revert) this.effect = new Fx.Morph(null, Object.merge({
  6603. duration: 250,
  6604. link: 'cancel'
  6605. }, this.options.revert));
  6606. },
  6607. attach: function(){
  6608. this.addLists(this.lists);
  6609. return this;
  6610. },
  6611. detach: function(){
  6612. this.lists = this.removeLists(this.lists);
  6613. return this;
  6614. },
  6615. addItems: function(){
  6616. Array.flatten(arguments).each(function(element){
  6617. this.elements.push(element);
  6618. var start = element.retrieve('sortables:start', function(event){
  6619. this.start.call(this, event, element);
  6620. }.bind(this));
  6621. (this.options.handle ? element.getElement(this.options.handle) || element : element).addEvent('mousedown', start);
  6622. }, this);
  6623. return this;
  6624. },
  6625. addLists: function(){
  6626. Array.flatten(arguments).each(function(list){
  6627. this.lists.include(list);
  6628. this.addItems(list.getChildren());
  6629. }, this);
  6630. return this;
  6631. },
  6632. removeItems: function(){
  6633. return $$(Array.flatten(arguments).map(function(element){
  6634. this.elements.erase(element);
  6635. var start = element.retrieve('sortables:start');
  6636. (this.options.handle ? element.getElement(this.options.handle) || element : element).removeEvent('mousedown', start);
  6637. return element;
  6638. }, this));
  6639. },
  6640. removeLists: function(){
  6641. return $$(Array.flatten(arguments).map(function(list){
  6642. this.lists.erase(list);
  6643. this.removeItems(list.getChildren());
  6644. return list;
  6645. }, this));
  6646. },
  6647. getDroppableCoordinates: function(element){
  6648. var offsetParent = element.getOffsetParent();
  6649. var position = element.getPosition(offsetParent);
  6650. var scroll = {
  6651. w: window.getScroll(),
  6652. offsetParent: offsetParent.getScroll()
  6653. };
  6654. position.x += scroll.offsetParent.x;
  6655. position.y += scroll.offsetParent.y;
  6656. if (offsetParent.getStyle('position') == 'fixed'){
  6657. position.x -= scroll.w.x;
  6658. position.y -= scroll.w.y;
  6659. }
  6660. return position;
  6661. },
  6662. getClone: function(event, element){
  6663. if (!this.options.clone) return new Element(element.tagName).inject(document.body);
  6664. if (typeOf(this.options.clone) == 'function') return this.options.clone.call(this, event, element, this.list);
  6665. var clone = element.clone(true).setStyles({
  6666. margin: 0,
  6667. position: 'absolute',
  6668. visibility: 'hidden',
  6669. width: element.getStyle('width')
  6670. }).addEvent('mousedown', function(event){
  6671. element.fireEvent('mousedown', event);
  6672. });
  6673. //prevent the duplicated radio inputs from unchecking the real one
  6674. if (clone.get('html').test('radio')){
  6675. clone.getElements('input[type=radio]').each(function(input, i){
  6676. input.set('name', 'clone_' + i);
  6677. if (input.get('checked')) element.getElements('input[type=radio]')[i].set('checked', true);
  6678. });
  6679. }
  6680. return clone.inject(this.list).setPosition(this.getDroppableCoordinates(this.element));
  6681. },
  6682. getDroppables: function(){
  6683. var droppables = this.list.getChildren().erase(this.clone).erase(this.element);
  6684. if (!this.options.constrain) droppables.append(this.lists).erase(this.list);
  6685. return droppables;
  6686. },
  6687. insert: function(dragging, element){
  6688. var where = 'inside';
  6689. if (this.lists.contains(element)){
  6690. this.list = element;
  6691. this.drag.droppables = this.getDroppables();
  6692. } else {
  6693. where = this.element.getAllPrevious().contains(element) ? 'before' : 'after';
  6694. }
  6695. this.element.inject(element, where);
  6696. this.fireEvent('sort', [this.element, this.clone]);
  6697. },
  6698. start: function(event, element){
  6699. if (
  6700. !this.idle ||
  6701. event.rightClick ||
  6702. (!this.options.handle && this.options.unDraggableTags.contains(event.target.get('tag')))
  6703. ) return;
  6704. this.idle = false;
  6705. this.element = element;
  6706. this.opacity = element.getStyle('opacity');
  6707. this.list = element.getParent();
  6708. this.clone = this.getClone(event, element);
  6709. this.drag = new Drag.Move(this.clone, Object.merge({
  6710. /*<1.2compat>*/
  6711. preventDefault: this.options.preventDefault,
  6712. snap: this.options.snap,
  6713. container: this.options.constrain && this.element.getParent(),
  6714. /*</1.2compat>*/
  6715. droppables: this.getDroppables()
  6716. }, this.options.dragOptions)).addEvents({
  6717. onSnap: function(){
  6718. event.stop();
  6719. this.clone.setStyle('visibility', 'visible');
  6720. this.element.setStyle('opacity', this.options.opacity || 0);
  6721. this.fireEvent('start', [this.element, this.clone]);
  6722. }.bind(this),
  6723. onEnter: this.insert.bind(this),
  6724. onCancel: this.end.bind(this),
  6725. onComplete: this.end.bind(this)
  6726. });
  6727. this.clone.inject(this.element, 'before');
  6728. this.drag.start(event);
  6729. },
  6730. end: function(){
  6731. this.drag.detach();
  6732. this.element.setStyle('opacity', this.opacity);
  6733. var self = this;
  6734. if (this.effect){
  6735. var dim = this.element.getStyles('width', 'height'),
  6736. clone = this.clone,
  6737. pos = clone.computePosition(this.getDroppableCoordinates(clone));
  6738. var destroy = function(){
  6739. this.removeEvent('cancel', destroy);
  6740. clone.destroy();
  6741. self.reset();
  6742. };
  6743. this.effect.element = clone;
  6744. this.effect.start({
  6745. top: pos.top,
  6746. left: pos.left,
  6747. width: dim.width,
  6748. height: dim.height,
  6749. opacity: 0.25
  6750. }).addEvent('cancel', destroy).chain(destroy);
  6751. } else {
  6752. this.clone.destroy();
  6753. self.reset();
  6754. }
  6755. },
  6756. reset: function(){
  6757. this.idle = true;
  6758. this.fireEvent('complete', this.element);
  6759. },
  6760. serialize: function(){
  6761. var params = Array.link(arguments, {
  6762. modifier: Type.isFunction,
  6763. index: function(obj){
  6764. return obj != null;
  6765. }
  6766. });
  6767. var serial = this.lists.map(function(list){
  6768. return list.getChildren().map(params.modifier || function(element){
  6769. return element.get('id');
  6770. }, this);
  6771. }, this);
  6772. var index = params.index;
  6773. if (this.lists.length == 1) index = 0;
  6774. return (index || index === 0) && index >= 0 && index < this.lists.length ? serial[index] : serial;
  6775. }
  6776. });
  6777. })();
  6778. /*
  6779. ---
  6780. name: Element.Event.Pseudos
  6781. description: Adds the functionality to add pseudo events for Elements
  6782. license: MIT-style license
  6783. authors:
  6784. - Arian Stolwijk
  6785. requires: [Core/Element.Event, Core/Element.Delegation, Events.Pseudos]
  6786. provides: [Element.Event.Pseudos, Element.Delegation.Pseudo]
  6787. ...
  6788. */
  6789. (function(){
  6790. var pseudos = {relay: false},
  6791. copyFromEvents = ['once', 'throttle', 'pause'],
  6792. count = copyFromEvents.length;
  6793. while (count--) pseudos[copyFromEvents[count]] = Events.lookupPseudo(copyFromEvents[count]);
  6794. DOMEvent.definePseudo = function(key, listener){
  6795. pseudos[key] = listener;
  6796. return this;
  6797. };
  6798. var proto = Element.prototype;
  6799. [Element, Window, Document].invoke('implement', Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
  6800. })();
  6801. /*
  6802. ---
  6803. name: Element.Event.Pseudos.Keys
  6804. description: Adds functionality fire events if certain keycombinations are pressed
  6805. license: MIT-style license
  6806. authors:
  6807. - Arian Stolwijk
  6808. requires: [Element.Event.Pseudos]
  6809. provides: [Element.Event.Pseudos.Keys]
  6810. ...
  6811. */
  6812. (function(){
  6813. var keysStoreKey = '$moo:keys-pressed',
  6814. keysKeyupStoreKey = '$moo:keys-keyup';
  6815. DOMEvent.definePseudo('keys', function(split, fn, args){
  6816. var event = args[0],
  6817. keys = [],
  6818. pressed = this.retrieve(keysStoreKey, []),
  6819. value = split.value;
  6820. if (value != '+') keys.append(value.replace('++', function(){
  6821. keys.push('+'); // shift++ and shift+++a
  6822. return '';
  6823. }).split('+'));
  6824. else keys = ['+'];
  6825. pressed.include(event.key);
  6826. if (keys.every(function(key){
  6827. return pressed.contains(key);
  6828. })) fn.apply(this, args);
  6829. this.store(keysStoreKey, pressed);
  6830. if (!this.retrieve(keysKeyupStoreKey)){
  6831. var keyup = function(event){
  6832. (function(){
  6833. pressed = this.retrieve(keysStoreKey, []).erase(event.key);
  6834. this.store(keysStoreKey, pressed);
  6835. }).delay(0, this); // Fix for IE
  6836. };
  6837. this.store(keysKeyupStoreKey, keyup).addEvent('keyup', keyup);
  6838. }
  6839. });
  6840. DOMEvent.defineKeys({
  6841. '16': 'shift',
  6842. '17': 'control',
  6843. '18': 'alt',
  6844. '20': 'capslock',
  6845. '33': 'pageup',
  6846. '34': 'pagedown',
  6847. '35': 'end',
  6848. '36': 'home',
  6849. '144': 'numlock',
  6850. '145': 'scrolllock',
  6851. '186': ';',
  6852. '187': '=',
  6853. '188': ',',
  6854. '190': '.',
  6855. '191': '/',
  6856. '192': '`',
  6857. '219': '[',
  6858. '220': '\\',
  6859. '221': ']',
  6860. '222': "'",
  6861. '107': '+',
  6862. '109': '-', // subtract
  6863. '189': '-' // dash
  6864. });
  6865. })();
  6866. /*
  6867. ---
  6868. script: String.Extras.js
  6869. name: String.Extras
  6870. description: Extends the String native object to include methods useful in managing various kinds of strings (query strings, urls, html, etc).
  6871. license: MIT-style license
  6872. authors:
  6873. - Aaron Newton
  6874. - Guillermo Rauch
  6875. - Christopher Pitt
  6876. requires:
  6877. - Core/String
  6878. - Core/Array
  6879. - MooTools.More
  6880. provides: [String.Extras]
  6881. ...
  6882. */
  6883. (function(){
  6884. var special = {
  6885. 'a': /[àáâãäåăą]/g,
  6886. 'A': /[ÀÁÂÃÄÅĂĄ]/g,
  6887. 'c': /[ćčç]/g,
  6888. 'C': /[ĆČÇ]/g,
  6889. 'd': /[ďđ]/g,
  6890. 'D': /[ĎÐ]/g,
  6891. 'e': /[èéêëěę]/g,
  6892. 'E': /[ÈÉÊËĚĘ]/g,
  6893. 'g': /[ğ]/g,
  6894. 'G': /[Ğ]/g,
  6895. 'i': /[ìíîï]/g,
  6896. 'I': /[ÌÍÎÏ]/g,
  6897. 'l': /[ĺľł]/g,
  6898. 'L': /[ĹĽŁ]/g,
  6899. 'n': /[ñňń]/g,
  6900. 'N': /[ÑŇŃ]/g,
  6901. 'o': /[òóôõöøő]/g,
  6902. 'O': /[ÒÓÔÕÖØ]/g,
  6903. 'r': /[řŕ]/g,
  6904. 'R': /[ŘŔ]/g,
  6905. 's': /[ššş]/g,
  6906. 'S': /[ŠŞŚ]/g,
  6907. 't': /[ťţ]/g,
  6908. 'T': /[ŤŢ]/g,
  6909. 'u': /[ùúûůüµ]/g,
  6910. 'U': /[ÙÚÛŮÜ]/g,
  6911. 'y': /[ÿý]/g,
  6912. 'Y': /[ŸÝ]/g,
  6913. 'z': /[žźż]/g,
  6914. 'Z': /[ŽŹŻ]/g,
  6915. 'th': /[þ]/g,
  6916. 'TH': /[Þ]/g,
  6917. 'dh': /[ð]/g,
  6918. 'DH': /[Ð]/g,
  6919. 'ss': /[ß]/g,
  6920. 'oe': /[œ]/g,
  6921. 'OE': /[Œ]/g,
  6922. 'ae': /[æ]/g,
  6923. 'AE': /[Æ]/g
  6924. },
  6925. tidy = {
  6926. ' ': /[\xa0\u2002\u2003\u2009]/g,
  6927. '*': /[\xb7]/g,
  6928. '\'': /[\u2018\u2019]/g,
  6929. '"': /[\u201c\u201d]/g,
  6930. '...': /[\u2026]/g,
  6931. '-': /[\u2013]/g,
  6932. // '--': /[\u2014]/g,
  6933. '&raquo;': /[\uFFFD]/g
  6934. },
  6935. conversions = {
  6936. ms: 1,
  6937. s: 1000,
  6938. m: 6e4,
  6939. h: 36e5
  6940. },
  6941. findUnits = /(\d*.?\d+)([msh]+)/;
  6942. var walk = function(string, replacements){
  6943. var result = string, key;
  6944. for (key in replacements) result = result.replace(replacements[key], key);
  6945. return result;
  6946. };
  6947. var getRegexForTag = function(tag, contents){
  6948. tag = tag || (contents ? '' : '\\w+');
  6949. var regstr = contents ? '<' + tag + '(?!\\w)[^>]*>([\\s\\S]*?)<\/' + tag + '(?!\\w)>' : '<\/?' + tag + '\/?>|<' + tag + '[\\s|\/][^>]*>';
  6950. return new RegExp(regstr, 'gi');
  6951. };
  6952. String.implement({
  6953. standardize: function(){
  6954. return walk(this, special);
  6955. },
  6956. repeat: function(times){
  6957. return new Array(times + 1).join(this);
  6958. },
  6959. pad: function(length, str, direction){
  6960. if (this.length >= length) return this;
  6961. var pad = (str == null ? ' ' : '' + str)
  6962. .repeat(length - this.length)
  6963. .substr(0, length - this.length);
  6964. if (!direction || direction == 'right') return this + pad;
  6965. if (direction == 'left') return pad + this;
  6966. return pad.substr(0, (pad.length / 2).floor()) + this + pad.substr(0, (pad.length / 2).ceil());
  6967. },
  6968. getTags: function(tag, contents){
  6969. return this.match(getRegexForTag(tag, contents)) || [];
  6970. },
  6971. stripTags: function(tag, contents){
  6972. return this.replace(getRegexForTag(tag, contents), '');
  6973. },
  6974. tidy: function(){
  6975. return walk(this, tidy);
  6976. },
  6977. truncate: function(max, trail, atChar){
  6978. var string = this;
  6979. if (trail == null && arguments.length == 1) trail = '…';
  6980. if (string.length > max){
  6981. string = string.substring(0, max);
  6982. if (atChar){
  6983. var index = string.lastIndexOf(atChar);
  6984. if (index != -1) string = string.substr(0, index);
  6985. }
  6986. if (trail) string += trail;
  6987. }
  6988. return string;
  6989. },
  6990. ms: function(){
  6991. // "Borrowed" from https://gist.github.com/1503944
  6992. var units = findUnits.exec(this);
  6993. if (units == null) return Number(this);
  6994. return Number(units[1]) * conversions[units[2]];
  6995. }
  6996. });
  6997. })();
  6998. /*
  6999. ---
  7000. script: Element.Forms.js
  7001. name: Element.Forms
  7002. description: Extends the Element native object to include methods useful in managing inputs.
  7003. license: MIT-style license
  7004. authors:
  7005. - Aaron Newton
  7006. requires:
  7007. - Core/Element
  7008. - String.Extras
  7009. - MooTools.More
  7010. provides: [Element.Forms]
  7011. ...
  7012. */
  7013. Element.implement({
  7014. tidy: function(){
  7015. this.set('value', this.get('value').tidy());
  7016. },
  7017. getTextInRange: function(start, end){
  7018. return this.get('value').substring(start, end);
  7019. },
  7020. getSelectedText: function(){
  7021. if (this.setSelectionRange) return this.getTextInRange(this.getSelectionStart(), this.getSelectionEnd());
  7022. return document.selection.createRange().text;
  7023. },
  7024. getSelectedRange: function(){
  7025. if (this.selectionStart != null){
  7026. return {
  7027. start: this.selectionStart,
  7028. end: this.selectionEnd
  7029. };
  7030. }
  7031. var pos = {
  7032. start: 0,
  7033. end: 0
  7034. };
  7035. var range = this.getDocument().selection.createRange();
  7036. if (!range || range.parentElement() != this) return pos;
  7037. var duplicate = range.duplicate();
  7038. if (this.type == 'text'){
  7039. pos.start = 0 - duplicate.moveStart('character', -100000);
  7040. pos.end = pos.start + range.text.length;
  7041. } else {
  7042. var value = this.get('value');
  7043. var offset = value.length;
  7044. duplicate.moveToElementText(this);
  7045. duplicate.setEndPoint('StartToEnd', range);
  7046. if (duplicate.text.length) offset -= value.match(/[\n\r]*$/)[0].length;
  7047. pos.end = offset - duplicate.text.length;
  7048. duplicate.setEndPoint('StartToStart', range);
  7049. pos.start = offset - duplicate.text.length;
  7050. }
  7051. return pos;
  7052. },
  7053. getSelectionStart: function(){
  7054. return this.getSelectedRange().start;
  7055. },
  7056. getSelectionEnd: function(){
  7057. return this.getSelectedRange().end;
  7058. },
  7059. setCaretPosition: function(pos){
  7060. if (pos == 'end') pos = this.get('value').length;
  7061. this.selectRange(pos, pos);
  7062. return this;
  7063. },
  7064. getCaretPosition: function(){
  7065. return this.getSelectedRange().start;
  7066. },
  7067. selectRange: function(start, end){
  7068. if (this.setSelectionRange){
  7069. this.focus();
  7070. this.setSelectionRange(start, end);
  7071. } else {
  7072. var value = this.get('value');
  7073. var diff = value.substr(start, end - start).replace(/\r/g, '').length;
  7074. start = value.substr(0, start).replace(/\r/g, '').length;
  7075. var range = this.createTextRange();
  7076. range.collapse(true);
  7077. range.moveEnd('character', start + diff);
  7078. range.moveStart('character', start);
  7079. range.select();
  7080. }
  7081. return this;
  7082. },
  7083. insertAtCursor: function(value, select){
  7084. var pos = this.getSelectedRange();
  7085. var text = this.get('value');
  7086. this.set('value', text.substring(0, pos.start) + value + text.substring(pos.end, text.length));
  7087. if (select !== false) this.selectRange(pos.start, pos.start + value.length);
  7088. else this.setCaretPosition(pos.start + value.length);
  7089. return this;
  7090. },
  7091. insertAroundCursor: function(options, select){
  7092. options = Object.append({
  7093. before: '',
  7094. defaultMiddle: '',
  7095. after: ''
  7096. }, options);
  7097. var value = this.getSelectedText() || options.defaultMiddle;
  7098. var pos = this.getSelectedRange();
  7099. var text = this.get('value');
  7100. if (pos.start == pos.end){
  7101. this.set('value', text.substring(0, pos.start) + options.before + value + options.after + text.substring(pos.end, text.length));
  7102. this.selectRange(pos.start + options.before.length, pos.end + options.before.length + value.length);
  7103. } else {
  7104. var current = text.substring(pos.start, pos.end);
  7105. this.set('value', text.substring(0, pos.start) + options.before + current + options.after + text.substring(pos.end, text.length));
  7106. var selStart = pos.start + options.before.length;
  7107. if (select !== false) this.selectRange(selStart, selStart + current.length);
  7108. else this.setCaretPosition(selStart + text.length);
  7109. }
  7110. return this;
  7111. }
  7112. });
  7113. /*
  7114. ---
  7115. script: Element.Pin.js
  7116. name: Element.Pin
  7117. description: Extends the Element native object to include the pin method useful for fixed positioning for elements.
  7118. license: MIT-style license
  7119. authors:
  7120. - Aaron Newton
  7121. requires:
  7122. - Core/Element.Event
  7123. - Core/Element.Dimensions
  7124. - Core/Element.Style
  7125. - MooTools.More
  7126. provides: [Element.Pin]
  7127. ...
  7128. */
  7129. (function(){
  7130. var supportsPositionFixed = false,
  7131. supportTested = false;
  7132. var testPositionFixed = function(){
  7133. var test = new Element('div').setStyles({
  7134. position: 'fixed',
  7135. top: 0,
  7136. right: 0
  7137. }).inject(document.body);
  7138. supportsPositionFixed = (test.offsetTop === 0);
  7139. test.dispose();
  7140. supportTested = true;
  7141. };
  7142. Element.implement({
  7143. pin: function(enable, forceScroll){
  7144. if (!supportTested) testPositionFixed();
  7145. if (this.getStyle('display') == 'none') return this;
  7146. var pinnedPosition,
  7147. scroll = window.getScroll(),
  7148. parent,
  7149. scrollFixer;
  7150. if (enable !== false){
  7151. pinnedPosition = this.getPosition();
  7152. if (!this.retrieve('pin:_pinned')){
  7153. var currentPosition = {
  7154. top: pinnedPosition.y - scroll.y,
  7155. left: pinnedPosition.x - scroll.x,
  7156. margin: '0px',
  7157. padding: '0px'
  7158. };
  7159. if (supportsPositionFixed && !forceScroll){
  7160. this.setStyle('position', 'fixed').setStyles(currentPosition);
  7161. } else {
  7162. parent = this.getOffsetParent();
  7163. var position = this.getPosition(parent),
  7164. styles = this.getStyles('left', 'top');
  7165. if (parent && styles.left == 'auto' || styles.top == 'auto') this.setPosition(position);
  7166. if (this.getStyle('position') == 'static') this.setStyle('position', 'absolute');
  7167. position = {
  7168. x: styles.left.toInt() - scroll.x,
  7169. y: styles.top.toInt() - scroll.y
  7170. };
  7171. scrollFixer = function(){
  7172. if (!this.retrieve('pin:_pinned')) return;
  7173. var scroll = window.getScroll();
  7174. this.setStyles({
  7175. left: position.x + scroll.x,
  7176. top: position.y + scroll.y
  7177. });
  7178. }.bind(this);
  7179. this.store('pin:_scrollFixer', scrollFixer);
  7180. window.addEvent('scroll', scrollFixer);
  7181. }
  7182. this.store('pin:_pinned', true);
  7183. }
  7184. } else {
  7185. if (!this.retrieve('pin:_pinned')) return this;
  7186. parent = this.getParent();
  7187. var offsetParent = (parent.getComputedStyle('position') != 'static' ? parent : parent.getOffsetParent());
  7188. pinnedPosition = this.getPosition();
  7189. this.store('pin:_pinned', false);
  7190. scrollFixer = this.retrieve('pin:_scrollFixer');
  7191. if (!scrollFixer){
  7192. this.setStyles({
  7193. position: 'absolute',
  7194. top: pinnedPosition.y + scroll.y,
  7195. left: pinnedPosition.x + scroll.x
  7196. });
  7197. } else {
  7198. this.store('pin:_scrollFixer', null);
  7199. window.removeEvent('scroll', scrollFixer);
  7200. }
  7201. this.removeClass('isPinned');
  7202. }
  7203. return this;
  7204. },
  7205. unpin: function(){
  7206. return this.pin(false);
  7207. },
  7208. togglePin: function(){
  7209. return this.pin(!this.retrieve('pin:_pinned'));
  7210. }
  7211. });
  7212. //<1.2compat>
  7213. Element.alias('togglepin', 'togglePin');
  7214. //</1.2compat>
  7215. })();
  7216. /*
  7217. ---
  7218. script: Element.Position.js
  7219. name: Element.Position
  7220. description: Extends the Element native object to include methods useful positioning elements relative to others.
  7221. license: MIT-style license
  7222. authors:
  7223. - Aaron Newton
  7224. - Jacob Thornton
  7225. requires:
  7226. - Core/Options
  7227. - Core/Element.Dimensions
  7228. - Element.Measure
  7229. provides: [Element.Position]
  7230. ...
  7231. */
  7232. (function(original){
  7233. var local = Element.Position = {
  7234. options: {/*
  7235. edge: false,
  7236. returnPos: false,
  7237. minimum: {x: 0, y: 0},
  7238. maximum: {x: 0, y: 0},
  7239. relFixedPosition: false,
  7240. ignoreMargins: false,
  7241. ignoreScroll: false,
  7242. allowNegative: false,*/
  7243. relativeTo: document.body,
  7244. position: {
  7245. x: 'center', //left, center, right
  7246. y: 'center' //top, center, bottom
  7247. },
  7248. offset: {x: 0, y: 0}
  7249. },
  7250. getOptions: function(element, options){
  7251. options = Object.merge({}, local.options, options);
  7252. local.setPositionOption(options);
  7253. local.setEdgeOption(options);
  7254. local.setOffsetOption(element, options);
  7255. local.setDimensionsOption(element, options);
  7256. return options;
  7257. },
  7258. setPositionOption: function(options){
  7259. options.position = local.getCoordinateFromValue(options.position);
  7260. },
  7261. setEdgeOption: function(options){
  7262. var edgeOption = local.getCoordinateFromValue(options.edge);
  7263. options.edge = edgeOption ? edgeOption :
  7264. (options.position.x == 'center' && options.position.y == 'center') ? {x: 'center', y: 'center'} :
  7265. {x: 'left', y: 'top'};
  7266. },
  7267. setOffsetOption: function(element, options){
  7268. var parentOffset = {x: 0, y: 0};
  7269. var parentScroll = {x: 0, y: 0};
  7270. var offsetParent = element.measure(function(){
  7271. return document.id(this.getOffsetParent());
  7272. });
  7273. if (!offsetParent || offsetParent == element.getDocument().body) return;
  7274. parentScroll = offsetParent.getScroll();
  7275. parentOffset = offsetParent.measure(function(){
  7276. var position = this.getPosition();
  7277. if (this.getStyle('position') == 'fixed'){
  7278. var scroll = window.getScroll();
  7279. position.x += scroll.x;
  7280. position.y += scroll.y;
  7281. }
  7282. return position;
  7283. });
  7284. options.offset = {
  7285. parentPositioned: offsetParent != document.id(options.relativeTo),
  7286. x: options.offset.x - parentOffset.x + parentScroll.x,
  7287. y: options.offset.y - parentOffset.y + parentScroll.y
  7288. };
  7289. },
  7290. setDimensionsOption: function(element, options){
  7291. options.dimensions = element.getDimensions({
  7292. computeSize: true,
  7293. styles: ['padding', 'border', 'margin']
  7294. });
  7295. },
  7296. getPosition: function(element, options){
  7297. var position = {};
  7298. options = local.getOptions(element, options);
  7299. var relativeTo = document.id(options.relativeTo) || document.body;
  7300. local.setPositionCoordinates(options, position, relativeTo);
  7301. if (options.edge) local.toEdge(position, options);
  7302. var offset = options.offset;
  7303. position.left = ((position.x >= 0 || offset.parentPositioned || options.allowNegative) ? position.x : 0).toInt();
  7304. position.top = ((position.y >= 0 || offset.parentPositioned || options.allowNegative) ? position.y : 0).toInt();
  7305. local.toMinMax(position, options);
  7306. if (options.relFixedPosition || relativeTo.getStyle('position') == 'fixed') local.toRelFixedPosition(relativeTo, position);
  7307. if (options.ignoreScroll) local.toIgnoreScroll(relativeTo, position);
  7308. if (options.ignoreMargins) local.toIgnoreMargins(position, options);
  7309. position.left = Math.ceil(position.left);
  7310. position.top = Math.ceil(position.top);
  7311. delete position.x;
  7312. delete position.y;
  7313. return position;
  7314. },
  7315. setPositionCoordinates: function(options, position, relativeTo){
  7316. var offsetY = options.offset.y,
  7317. offsetX = options.offset.x,
  7318. calc = (relativeTo == document.body) ? window.getScroll() : relativeTo.getPosition(),
  7319. top = calc.y,
  7320. left = calc.x,
  7321. winSize = window.getSize();
  7322. switch (options.position.x){
  7323. case 'left': position.x = left + offsetX; break;
  7324. case 'right': position.x = left + offsetX + relativeTo.offsetWidth; break;
  7325. default: position.x = left + ((relativeTo == document.body ? winSize.x : relativeTo.offsetWidth) / 2) + offsetX; break;
  7326. }
  7327. switch (options.position.y){
  7328. case 'top': position.y = top + offsetY; break;
  7329. case 'bottom': position.y = top + offsetY + relativeTo.offsetHeight; break;
  7330. default: position.y = top + ((relativeTo == document.body ? winSize.y : relativeTo.offsetHeight) / 2) + offsetY; break;
  7331. }
  7332. },
  7333. toMinMax: function(position, options){
  7334. var xy = {left: 'x', top: 'y'}, value;
  7335. ['minimum', 'maximum'].each(function(minmax){
  7336. ['left', 'top'].each(function(lr){
  7337. value = options[minmax] ? options[minmax][xy[lr]] : null;
  7338. if (value != null && ((minmax == 'minimum') ? position[lr] < value : position[lr] > value)) position[lr] = value;
  7339. });
  7340. });
  7341. },
  7342. toRelFixedPosition: function(relativeTo, position){
  7343. var winScroll = window.getScroll();
  7344. position.top += winScroll.y;
  7345. position.left += winScroll.x;
  7346. },
  7347. toIgnoreScroll: function(relativeTo, position){
  7348. var relScroll = relativeTo.getScroll();
  7349. position.top -= relScroll.y;
  7350. position.left -= relScroll.x;
  7351. },
  7352. toIgnoreMargins: function(position, options){
  7353. position.left += options.edge.x == 'right'
  7354. ? options.dimensions['margin-right']
  7355. : (options.edge.x != 'center'
  7356. ? -options.dimensions['margin-left']
  7357. : -options.dimensions['margin-left'] + ((options.dimensions['margin-right'] + options.dimensions['margin-left']) / 2));
  7358. position.top += options.edge.y == 'bottom'
  7359. ? options.dimensions['margin-bottom']
  7360. : (options.edge.y != 'center'
  7361. ? -options.dimensions['margin-top']
  7362. : -options.dimensions['margin-top'] + ((options.dimensions['margin-bottom'] + options.dimensions['margin-top']) / 2));
  7363. },
  7364. toEdge: function(position, options){
  7365. var edgeOffset = {},
  7366. dimensions = options.dimensions,
  7367. edge = options.edge;
  7368. switch (edge.x){
  7369. case 'left': edgeOffset.x = 0; break;
  7370. case 'right': edgeOffset.x = -dimensions.x - dimensions.computedRight - dimensions.computedLeft; break;
  7371. // center
  7372. default: edgeOffset.x = -(Math.round(dimensions.totalWidth / 2)); break;
  7373. }
  7374. switch (edge.y){
  7375. case 'top': edgeOffset.y = 0; break;
  7376. case 'bottom': edgeOffset.y = -dimensions.y - dimensions.computedTop - dimensions.computedBottom; break;
  7377. // center
  7378. default: edgeOffset.y = -(Math.round(dimensions.totalHeight / 2)); break;
  7379. }
  7380. position.x += edgeOffset.x;
  7381. position.y += edgeOffset.y;
  7382. },
  7383. getCoordinateFromValue: function(option){
  7384. if (typeOf(option) != 'string') return option;
  7385. option = option.toLowerCase();
  7386. return {
  7387. x: option.test('left') ? 'left'
  7388. : (option.test('right') ? 'right' : 'center'),
  7389. y: option.test(/upper|top/) ? 'top'
  7390. : (option.test('bottom') ? 'bottom' : 'center')
  7391. };
  7392. }
  7393. };
  7394. Element.implement({
  7395. position: function(options){
  7396. if (options && (options.x != null || options.y != null)){
  7397. return (original ? original.apply(this, arguments) : this);
  7398. }
  7399. var position = this.setStyle('position', 'absolute').calculatePosition(options);
  7400. return (options && options.returnPos) ? position : this.setStyles(position);
  7401. },
  7402. calculatePosition: function(options){
  7403. return local.getPosition(this, options);
  7404. }
  7405. });
  7406. })(Element.prototype.position);
  7407. /*
  7408. ---
  7409. script: Element.Shortcuts.js
  7410. name: Element.Shortcuts
  7411. description: Extends the Element native object to include some shortcut methods.
  7412. license: MIT-style license
  7413. authors:
  7414. - Aaron Newton
  7415. requires:
  7416. - Core/Element.Style
  7417. - MooTools.More
  7418. provides: [Element.Shortcuts]
  7419. ...
  7420. */
  7421. Element.implement({
  7422. isDisplayed: function(){
  7423. return this.getStyle('display') != 'none';
  7424. },
  7425. isVisible: function(){
  7426. var w = this.offsetWidth,
  7427. h = this.offsetHeight;
  7428. return (w == 0 && h == 0) ? false : (w > 0 && h > 0) ? true : this.style.display != 'none';
  7429. },
  7430. toggle: function(){
  7431. return this[this.isDisplayed() ? 'hide' : 'show']();
  7432. },
  7433. hide: function(){
  7434. var d;
  7435. try {
  7436. //IE fails here if the element is not in the dom
  7437. d = this.getStyle('display');
  7438. } catch (e){}
  7439. if (d == 'none') return this;
  7440. return this.store('element:_originalDisplay', d || '').setStyle('display', 'none');
  7441. },
  7442. show: function(display){
  7443. if (!display && this.isDisplayed()) return this;
  7444. display = display || this.retrieve('element:_originalDisplay') || 'block';
  7445. return this.setStyle('display', (display == 'none') ? 'block' : display);
  7446. },
  7447. swapClass: function(remove, add){
  7448. return this.removeClass(remove).addClass(add);
  7449. }
  7450. });
  7451. Document.implement({
  7452. clearSelection: function(){
  7453. if (window.getSelection){
  7454. var selection = window.getSelection();
  7455. if (selection && selection.removeAllRanges) selection.removeAllRanges();
  7456. } else if (document.selection && document.selection.empty){
  7457. try {
  7458. //IE fails here if selected element is not in dom
  7459. document.selection.empty();
  7460. } catch (e){}
  7461. }
  7462. }
  7463. });
  7464. /*
  7465. ---
  7466. script: Elements.From.js
  7467. name: Elements.From
  7468. description: Returns a collection of elements from a string of html.
  7469. license: MIT-style license
  7470. authors:
  7471. - Aaron Newton
  7472. requires:
  7473. - Core/String
  7474. - Core/Element
  7475. - MooTools.More
  7476. provides: [Elements.from, Elements.From]
  7477. ...
  7478. */
  7479. Elements.from = function(text, excludeScripts){
  7480. if (excludeScripts || excludeScripts == null) text = text.stripScripts();
  7481. var container, match = text.match(/^\s*(?:<!--.*?-->\s*)*<(t[dhr]|tbody|tfoot|thead)/i);
  7482. if (match){
  7483. container = new Element('table');
  7484. var tag = match[1].toLowerCase();
  7485. if (['td', 'th', 'tr'].contains(tag)){
  7486. container = new Element('tbody').inject(container);
  7487. if (tag != 'tr') container = new Element('tr').inject(container);
  7488. }
  7489. }
  7490. return (container || new Element('div')).set('html', text).getChildren();
  7491. };
  7492. /*
  7493. ---
  7494. script: IframeShim.js
  7495. name: IframeShim
  7496. description: Defines IframeShim, a class for obscuring select lists and flash objects in IE.
  7497. license: MIT-style license
  7498. authors:
  7499. - Aaron Newton
  7500. requires:
  7501. - Core/Element.Event
  7502. - Core/Element.Style
  7503. - Core/Options
  7504. - Core/Events
  7505. - Element.Position
  7506. - Class.Occlude
  7507. provides: [IframeShim]
  7508. ...
  7509. */
  7510. (function(){
  7511. var browsers = false;
  7512. //<1.4compat>
  7513. browsers = Browser.ie6 || (Browser.firefox && Browser.version < 3 && Browser.Platform.mac);
  7514. //</1.4compat>
  7515. var IframeShim = this.IframeShim = new Class({
  7516. Implements: [Options, Events, Class.Occlude],
  7517. options: {
  7518. className: 'iframeShim',
  7519. src: 'javascript:false;document.write("");',
  7520. display: false,
  7521. zIndex: null,
  7522. margin: 0,
  7523. offset: {x: 0, y: 0},
  7524. browsers: browsers
  7525. },
  7526. property: 'IframeShim',
  7527. initialize: function(element, options){
  7528. this.element = document.id(element);
  7529. if (this.occlude()) return this.occluded;
  7530. this.setOptions(options);
  7531. this.makeShim();
  7532. return this;
  7533. },
  7534. makeShim: function(){
  7535. if (this.options.browsers){
  7536. var zIndex = this.element.getStyle('zIndex').toInt();
  7537. if (!zIndex){
  7538. zIndex = 1;
  7539. var pos = this.element.getStyle('position');
  7540. if (pos == 'static' || !pos) this.element.setStyle('position', 'relative');
  7541. this.element.setStyle('zIndex', zIndex);
  7542. }
  7543. zIndex = ((this.options.zIndex != null || this.options.zIndex === 0) && zIndex > this.options.zIndex) ? this.options.zIndex : zIndex - 1;
  7544. if (zIndex < 0) zIndex = 1;
  7545. this.shim = new Element('iframe', {
  7546. src: this.options.src,
  7547. scrolling: 'no',
  7548. frameborder: 0,
  7549. styles: {
  7550. zIndex: zIndex,
  7551. position: 'absolute',
  7552. border: 'none',
  7553. filter: 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'
  7554. },
  7555. 'class': this.options.className
  7556. }).store('IframeShim', this);
  7557. var inject = (function(){
  7558. this.shim.inject(this.element, 'after');
  7559. this[this.options.display ? 'show' : 'hide']();
  7560. this.fireEvent('inject');
  7561. }).bind(this);
  7562. if (!IframeShim.ready) window.addEvent('load', inject);
  7563. else inject();
  7564. } else {
  7565. this.position = this.hide = this.show = this.dispose = Function.convert(this);
  7566. }
  7567. },
  7568. position: function(){
  7569. if (!IframeShim.ready || !this.shim) return this;
  7570. var size = this.element.measure(function(){
  7571. return this.getSize();
  7572. });
  7573. if (this.options.margin != undefined){
  7574. size.x = size.x - (this.options.margin * 2);
  7575. size.y = size.y - (this.options.margin * 2);
  7576. this.options.offset.x += this.options.margin;
  7577. this.options.offset.y += this.options.margin;
  7578. }
  7579. this.shim.set({width: size.x, height: size.y}).position({
  7580. relativeTo: this.element,
  7581. offset: this.options.offset
  7582. });
  7583. return this;
  7584. },
  7585. hide: function(){
  7586. if (this.shim) this.shim.setStyle('display', 'none');
  7587. return this;
  7588. },
  7589. show: function(){
  7590. if (this.shim) this.shim.setStyle('display', 'block');
  7591. return this.position();
  7592. },
  7593. dispose: function(){
  7594. if (this.shim) this.shim.dispose();
  7595. return this;
  7596. },
  7597. destroy: function(){
  7598. if (this.shim) this.shim.destroy();
  7599. return this;
  7600. }
  7601. });
  7602. })();
  7603. window.addEvent('load', function(){
  7604. IframeShim.ready = true;
  7605. });
  7606. /*
  7607. ---
  7608. script: Mask.js
  7609. name: Mask
  7610. description: Creates a mask element to cover another.
  7611. license: MIT-style license
  7612. authors:
  7613. - Aaron Newton
  7614. requires:
  7615. - Core/Options
  7616. - Core/Events
  7617. - Core/Element.Event
  7618. - Class.Binds
  7619. - Element.Position
  7620. - IframeShim
  7621. provides: [Mask]
  7622. ...
  7623. */
  7624. (function(){
  7625. var Mask = this.Mask = new Class({
  7626. Implements: [Options, Events],
  7627. Binds: ['position'],
  7628. options: {/*
  7629. onShow: function(){},
  7630. onHide: function(){},
  7631. onDestroy: function(){},
  7632. onClick: function(event){},
  7633. inject: {
  7634. where: 'after',
  7635. target: null,
  7636. },
  7637. hideOnClick: false,
  7638. id: null,
  7639. destroyOnHide: false,*/
  7640. style: {},
  7641. 'class': 'mask',
  7642. maskMargins: false,
  7643. useIframeShim: true,
  7644. iframeShimOptions: {}
  7645. },
  7646. initialize: function(target, options){
  7647. this.target = document.id(target) || document.id(document.body);
  7648. this.target.store('mask', this);
  7649. this.setOptions(options);
  7650. this.render();
  7651. this.inject();
  7652. },
  7653. render: function(){
  7654. this.element = new Element('div', {
  7655. 'class': this.options['class'],
  7656. id: this.options.id || 'mask-' + String.uniqueID(),
  7657. styles: Object.merge({}, this.options.style, {
  7658. display: 'none'
  7659. }),
  7660. events: {
  7661. click: function(event){
  7662. this.fireEvent('click', event);
  7663. if (this.options.hideOnClick) this.hide();
  7664. }.bind(this)
  7665. }
  7666. });
  7667. this.hidden = true;
  7668. },
  7669. toElement: function(){
  7670. return this.element;
  7671. },
  7672. inject: function(target, where){
  7673. where = where || (this.options.inject ? this.options.inject.where : '') || (this.target == document.body ? 'inside' : 'after');
  7674. target = target || (this.options.inject && this.options.inject.target) || this.target;
  7675. this.element.inject(target, where);
  7676. if (this.options.useIframeShim){
  7677. this.shim = new IframeShim(this.element, this.options.iframeShimOptions);
  7678. this.addEvents({
  7679. show: this.shim.show.bind(this.shim),
  7680. hide: this.shim.hide.bind(this.shim),
  7681. destroy: this.shim.destroy.bind(this.shim)
  7682. });
  7683. }
  7684. },
  7685. position: function(){
  7686. this.resize(this.options.width, this.options.height);
  7687. this.element.position({
  7688. relativeTo: this.target,
  7689. position: 'topLeft',
  7690. ignoreMargins: !this.options.maskMargins,
  7691. ignoreScroll: this.target == document.body
  7692. });
  7693. return this;
  7694. },
  7695. resize: function(x, y){
  7696. var opt = {
  7697. styles: ['padding', 'border']
  7698. };
  7699. if (this.options.maskMargins) opt.styles.push('margin');
  7700. var dim = this.target.getComputedSize(opt);
  7701. var s = this.target.getSize();
  7702. if (dim.totalHeight<s.y) dim.totalHeight = s.y;
  7703. if (dim.totalWidth<s.x) dim.totalWidth = s.x;
  7704. if (this.target == document.body){
  7705. this.element.setStyles({width: 0, height: 0});
  7706. var win = window.getScrollSize();
  7707. if (dim.totalHeight < win.y) dim.totalHeight = win.y;
  7708. if (dim.totalWidth < win.x) dim.totalWidth = win.x;
  7709. }
  7710. this.element.setStyles({
  7711. width: Array.pick([x, dim.totalWidth, dim.x]),
  7712. height: Array.pick([y, dim.totalHeight, dim.y])
  7713. });
  7714. return this;
  7715. },
  7716. show: function(){
  7717. if (!this.hidden) return this;
  7718. window.addEvent('resize', this.position);
  7719. this.position();
  7720. this.showMask.apply(this, arguments);
  7721. return this;
  7722. },
  7723. showMask: function(){
  7724. this.element.setStyle('display', 'block');
  7725. this.hidden = false;
  7726. this.fireEvent('show');
  7727. },
  7728. hide: function(){
  7729. if (this.hidden) return this;
  7730. window.removeEvent('resize', this.position);
  7731. this.hideMask.apply(this, arguments);
  7732. if (this.options.destroyOnHide) return this.destroy();
  7733. return this;
  7734. },
  7735. hideMask: function(){
  7736. this.element.setStyle('display', 'none');
  7737. this.hidden = true;
  7738. this.fireEvent('hide');
  7739. },
  7740. toggle: function(){
  7741. this[this.hidden ? 'show' : 'hide']();
  7742. },
  7743. destroy: function(){
  7744. this.hide();
  7745. this.element.destroy();
  7746. this.fireEvent('destroy');
  7747. this.target.eliminate('mask');
  7748. }
  7749. });
  7750. })();
  7751. Element.Properties.mask = {
  7752. set: function(options){
  7753. var mask = this.retrieve('mask');
  7754. if (mask) mask.destroy();
  7755. return this.eliminate('mask').store('mask:options', options);
  7756. },
  7757. get: function(){
  7758. var mask = this.retrieve('mask');
  7759. if (!mask){
  7760. mask = new Mask(this, this.retrieve('mask:options'));
  7761. this.store('mask', mask);
  7762. }
  7763. return mask;
  7764. }
  7765. };
  7766. Element.implement({
  7767. mask: function(options){
  7768. if (options) this.set('mask', options);
  7769. this.get('mask').show();
  7770. return this;
  7771. },
  7772. unmask: function(){
  7773. this.get('mask').hide();
  7774. return this;
  7775. }
  7776. });
  7777. /*
  7778. ---
  7779. script: Spinner.js
  7780. name: Spinner
  7781. description: Adds a semi-transparent overlay over a dom element with a spinnin ajax icon.
  7782. license: MIT-style license
  7783. authors:
  7784. - Aaron Newton
  7785. requires:
  7786. - Core/Fx.Tween
  7787. - Core/Request
  7788. - Class.refactor
  7789. - Mask
  7790. provides: [Spinner]
  7791. ...
  7792. */
  7793. (function(){
  7794. var Spinner = this.Spinner = new Class({
  7795. Extends: this.Mask,
  7796. Implements: Chain,
  7797. options: {/*
  7798. message: false,*/
  7799. 'class': 'spinner',
  7800. containerPosition: {},
  7801. content: {
  7802. 'class': 'spinner-content'
  7803. },
  7804. messageContainer: {
  7805. 'class': 'spinner-msg'
  7806. },
  7807. img: {
  7808. 'class': 'spinner-img'
  7809. },
  7810. fxOptions: {
  7811. link: 'chain'
  7812. }
  7813. },
  7814. initialize: function(target, options){
  7815. this.target = document.id(target) || document.id(document.body);
  7816. this.target.store('spinner', this);
  7817. this.setOptions(options);
  7818. this.render();
  7819. this.inject();
  7820. // Add this to events for when noFx is true; parent methods handle hide/show.
  7821. var deactivate = function(){ this.active = false; }.bind(this);
  7822. this.addEvents({
  7823. hide: deactivate,
  7824. show: deactivate
  7825. });
  7826. },
  7827. render: function(){
  7828. this.parent();
  7829. this.element.set('id', this.options.id || 'spinner-' + String.uniqueID());
  7830. this.content = document.id(this.options.content) || new Element('div', this.options.content);
  7831. this.content.inject(this.element);
  7832. if (this.options.message){
  7833. this.msg = document.id(this.options.message) || new Element('p', this.options.messageContainer).appendText(this.options.message);
  7834. this.msg.inject(this.content);
  7835. }
  7836. if (this.options.img){
  7837. this.img = document.id(this.options.img) || new Element('div', this.options.img);
  7838. this.img.inject(this.content);
  7839. }
  7840. this.element.set('tween', this.options.fxOptions);
  7841. },
  7842. show: function(noFx){
  7843. if (this.active) return this.chain(this.show.bind(this));
  7844. if (!this.hidden){
  7845. this.callChain.delay(20, this);
  7846. return this;
  7847. }
  7848. this.target.set('aria-busy', 'true');
  7849. this.active = true;
  7850. return this.parent(noFx);
  7851. },
  7852. showMask: function(noFx){
  7853. var pos = function(){
  7854. this.content.position(Object.merge({
  7855. relativeTo: this.element
  7856. }, this.options.containerPosition));
  7857. }.bind(this);
  7858. if (noFx){
  7859. this.parent();
  7860. pos();
  7861. } else {
  7862. if (!this.options.style.opacity) this.options.style.opacity = this.element.getStyle('opacity').toFloat();
  7863. this.element.setStyles({
  7864. display: 'block',
  7865. opacity: 0
  7866. }).tween('opacity', this.options.style.opacity);
  7867. pos();
  7868. this.hidden = false;
  7869. this.fireEvent('show');
  7870. this.callChain();
  7871. }
  7872. },
  7873. hide: function(noFx){
  7874. if (this.active) return this.chain(this.hide.bind(this));
  7875. if (this.hidden){
  7876. this.callChain.delay(20, this);
  7877. return this;
  7878. }
  7879. this.target.set('aria-busy', 'false');
  7880. this.active = true;
  7881. return this.parent(noFx);
  7882. },
  7883. hideMask: function(noFx){
  7884. if (noFx) return this.parent();
  7885. this.element.tween('opacity', 0).get('tween').chain(function(){
  7886. this.element.setStyle('display', 'none');
  7887. this.hidden = true;
  7888. this.fireEvent('hide');
  7889. this.callChain();
  7890. }.bind(this));
  7891. },
  7892. destroy: function(){
  7893. this.content.destroy();
  7894. this.parent();
  7895. this.target.eliminate('spinner');
  7896. }
  7897. });
  7898. })();
  7899. Request = Class.refactor(Request, {
  7900. options: {
  7901. useSpinner: false,
  7902. spinnerOptions: {},
  7903. spinnerTarget: false
  7904. },
  7905. initialize: function(options){
  7906. this._send = this.send;
  7907. this.send = function(options){
  7908. var spinner = this.getSpinner();
  7909. if (spinner) spinner.chain(this._send.pass(options, this)).show();
  7910. else this._send(options);
  7911. return this;
  7912. };
  7913. this.previous(options);
  7914. },
  7915. getSpinner: function(){
  7916. if (!this.spinner){
  7917. var update = document.id(this.options.spinnerTarget) || document.id(this.options.update);
  7918. if (this.options.useSpinner && update){
  7919. update.set('spinner', this.options.spinnerOptions);
  7920. var spinner = this.spinner = update.get('spinner');
  7921. ['complete', 'exception', 'cancel'].each(function(event){
  7922. this.addEvent(event, spinner.hide.bind(spinner));
  7923. }, this);
  7924. }
  7925. }
  7926. return this.spinner;
  7927. }
  7928. });
  7929. Element.Properties.spinner = {
  7930. set: function(options){
  7931. var spinner = this.retrieve('spinner');
  7932. if (spinner) spinner.destroy();
  7933. return this.eliminate('spinner').store('spinner:options', options);
  7934. },
  7935. get: function(){
  7936. var spinner = this.retrieve('spinner');
  7937. if (!spinner){
  7938. spinner = new Spinner(this, this.retrieve('spinner:options'));
  7939. this.store('spinner', spinner);
  7940. }
  7941. return spinner;
  7942. }
  7943. };
  7944. Element.implement({
  7945. spin: function(options){
  7946. if (options) this.set('spinner', options);
  7947. this.get('spinner').show();
  7948. return this;
  7949. },
  7950. unspin: function(){
  7951. this.get('spinner').hide();
  7952. return this;
  7953. }
  7954. });
  7955. /*
  7956. ---
  7957. script: String.QueryString.js
  7958. name: String.QueryString
  7959. description: Methods for dealing with URI query strings.
  7960. license: MIT-style license
  7961. authors:
  7962. - Sebastian Markbåge
  7963. - Aaron Newton
  7964. - Lennart Pilon
  7965. - Valerio Proietti
  7966. requires:
  7967. - Core/Array
  7968. - Core/String
  7969. - MooTools.More
  7970. provides: [String.QueryString]
  7971. ...
  7972. */
  7973. (function(){
  7974. /**
  7975. * decodeURIComponent doesn't do the correct thing with query parameter keys or
  7976. * values. Specifically, it leaves '+' as '+' when it should be converting them
  7977. * to spaces as that's the specification. When browsers submit HTML forms via
  7978. * GET, the values are encoded using 'application/x-www-form-urlencoded'
  7979. * which converts spaces to '+'.
  7980. *
  7981. * See: http://unixpapa.com/js/querystring.html for a description of the
  7982. * problem.
  7983. */
  7984. var decodeComponent = function(str){
  7985. return decodeURIComponent(str.replace(/\+/g, ' '));
  7986. };
  7987. String.implement({
  7988. parseQueryString: function(decodeKeys, decodeValues){
  7989. if (decodeKeys == null) decodeKeys = true;
  7990. if (decodeValues == null) decodeValues = true;
  7991. var vars = this.split(/[&;]/),
  7992. object = {};
  7993. if (!vars.length) return object;
  7994. vars.each(function(val){
  7995. var index = val.indexOf('=') + 1,
  7996. value = index ? val.substr(index) : '',
  7997. keys = index ? val.substr(0, index - 1).match(/([^\]\[]+|(\B)(?=\]))/g) : [val],
  7998. obj = object;
  7999. if (!keys) return;
  8000. if (decodeValues) value = decodeComponent(value);
  8001. keys.each(function(key, i){
  8002. if (decodeKeys) key = decodeComponent(key);
  8003. var current = obj[key];
  8004. if (i < keys.length - 1) obj = obj[key] = current || {};
  8005. else if (typeOf(current) == 'array') current.push(value);
  8006. else obj[key] = current != null ? [current, value] : value;
  8007. });
  8008. });
  8009. return object;
  8010. },
  8011. cleanQueryString: function(method){
  8012. return this.split('&').filter(function(val){
  8013. var index = val.indexOf('='),
  8014. key = index < 0 ? '' : val.substr(0, index),
  8015. value = val.substr(index + 1);
  8016. return method ? method.call(null, key, value) : (value || value === 0);
  8017. }).join('&');
  8018. }
  8019. });
  8020. })();
  8021. /*
  8022. ---
  8023. script: Form.Request.js
  8024. name: Form.Request
  8025. description: Handles the basic functionality of submitting a form and updating a dom element with the result.
  8026. license: MIT-style license
  8027. authors:
  8028. - Aaron Newton
  8029. requires:
  8030. - Core/Request.HTML
  8031. - Class.Binds
  8032. - Class.Occlude
  8033. - Spinner
  8034. - String.QueryString
  8035. - Element.Delegation.Pseudo
  8036. provides: [Form.Request]
  8037. ...
  8038. */
  8039. if (!window.Form) window.Form = {};
  8040. (function(){
  8041. Form.Request = new Class({
  8042. Binds: ['onSubmit', 'onFormValidate'],
  8043. Implements: [Options, Events, Class.Occlude],
  8044. options: {/*
  8045. onFailure: function(){},
  8046. onSuccess: function(){}, // aliased to onComplete,
  8047. onSend: function(){}*/
  8048. requestOptions: {
  8049. evalScripts: true,
  8050. useSpinner: true,
  8051. emulation: false,
  8052. link: 'ignore'
  8053. },
  8054. sendButtonClicked: true,
  8055. extraData: {},
  8056. resetForm: true
  8057. },
  8058. property: 'form.request',
  8059. initialize: function(form, target, options){
  8060. this.element = document.id(form);
  8061. if (this.occlude()) return this.occluded;
  8062. this.setOptions(options)
  8063. .setTarget(target)
  8064. .attach();
  8065. },
  8066. setTarget: function(target){
  8067. this.target = document.id(target);
  8068. if (!this.request){
  8069. this.makeRequest();
  8070. } else {
  8071. this.request.setOptions({
  8072. update: this.target
  8073. });
  8074. }
  8075. return this;
  8076. },
  8077. toElement: function(){
  8078. return this.element;
  8079. },
  8080. makeRequest: function(){
  8081. var self = this;
  8082. this.request = new Request.HTML(Object.merge({
  8083. update: this.target,
  8084. emulation: false,
  8085. spinnerTarget: this.element,
  8086. method: this.element.get('method') || 'post'
  8087. }, this.options.requestOptions)).addEvents({
  8088. success: function(tree, elements, html, javascript){
  8089. ['complete', 'success'].each(function(evt){
  8090. self.fireEvent(evt, [self.target, tree, elements, html, javascript]);
  8091. });
  8092. },
  8093. failure: function(){
  8094. self.fireEvent('complete', arguments).fireEvent('failure', arguments);
  8095. },
  8096. exception: function(){
  8097. self.fireEvent('failure', arguments);
  8098. }
  8099. });
  8100. return this.attachReset();
  8101. },
  8102. attachReset: function(){
  8103. if (!this.options.resetForm) return this;
  8104. this.request.addEvent('success', function(){
  8105. Function.attempt(function(){
  8106. this.element.reset();
  8107. }.bind(this));
  8108. if (window.OverText) OverText.update();
  8109. }.bind(this));
  8110. return this;
  8111. },
  8112. attach: function(attach){
  8113. var method = (attach != false) ? 'addEvent' : 'removeEvent';
  8114. this.element[method]('click:relay(button, input[type=submit])', this.saveClickedButton.bind(this));
  8115. var fv = this.element.retrieve('validator');
  8116. if (fv) fv[method]('onFormValidate', this.onFormValidate);
  8117. else this.element[method]('submit', this.onSubmit);
  8118. return this;
  8119. },
  8120. detach: function(){
  8121. return this.attach(false);
  8122. },
  8123. //public method
  8124. enable: function(){
  8125. return this.attach();
  8126. },
  8127. //public method
  8128. disable: function(){
  8129. return this.detach();
  8130. },
  8131. onFormValidate: function(valid, form, event){
  8132. //if there's no event, then this wasn't a submit event
  8133. if (!event) return;
  8134. var fv = this.element.retrieve('validator');
  8135. if (valid || (fv && !fv.options.stopOnFailure)){
  8136. event.stop();
  8137. this.send();
  8138. }
  8139. },
  8140. onSubmit: function(event){
  8141. var fv = this.element.retrieve('validator');
  8142. if (fv){
  8143. //form validator was created after Form.Request
  8144. this.element.removeEvent('submit', this.onSubmit);
  8145. fv.addEvent('onFormValidate', this.onFormValidate);
  8146. fv.validate(event);
  8147. return;
  8148. }
  8149. if (event) event.stop();
  8150. this.send();
  8151. },
  8152. saveClickedButton: function(event, target){
  8153. var targetName = target.get('name');
  8154. if (!targetName || !this.options.sendButtonClicked) return;
  8155. this.options.extraData[targetName] = target.get('value') || true;
  8156. this.clickedCleaner = function(){
  8157. delete this.options.extraData[targetName];
  8158. this.clickedCleaner = function(){};
  8159. }.bind(this);
  8160. },
  8161. clickedCleaner: function(){},
  8162. send: function(){
  8163. var str = this.element.toQueryString().trim(),
  8164. data = Object.toQueryString(this.options.extraData);
  8165. if (str) str += '&' + data;
  8166. else str = data;
  8167. this.fireEvent('send', [this.element, str.parseQueryString()]);
  8168. this.request.send({
  8169. data: str,
  8170. url: this.options.requestOptions.url || this.element.get('action')
  8171. });
  8172. this.clickedCleaner();
  8173. return this;
  8174. }
  8175. });
  8176. Element.implement('formUpdate', function(update, options){
  8177. var fq = this.retrieve('form.request');
  8178. if (!fq){
  8179. fq = new Form.Request(this, update, options);
  8180. } else {
  8181. if (update) fq.setTarget(update);
  8182. if (options) fq.setOptions(options).makeRequest();
  8183. }
  8184. fq.send();
  8185. return this;
  8186. });
  8187. })();
  8188. /*
  8189. ---
  8190. script: Fx.Reveal.js
  8191. name: Fx.Reveal
  8192. description: Defines Fx.Reveal, a class that shows and hides elements with a transition.
  8193. license: MIT-style license
  8194. authors:
  8195. - Aaron Newton
  8196. requires:
  8197. - Core/Fx.Morph
  8198. - Element.Shortcuts
  8199. - Element.Measure
  8200. provides: [Fx.Reveal]
  8201. ...
  8202. */
  8203. (function(){
  8204. var hideTheseOf = function(object){
  8205. var hideThese = object.options.hideInputs;
  8206. if (window.OverText){
  8207. var otClasses = [null];
  8208. OverText.each(function(ot){
  8209. otClasses.include('.' + ot.options.labelClass);
  8210. });
  8211. if (otClasses) hideThese += otClasses.join(', ');
  8212. }
  8213. return (hideThese) ? object.element.getElements(hideThese) : null;
  8214. };
  8215. Fx.Reveal = new Class({
  8216. Extends: Fx.Morph,
  8217. options: {/*
  8218. onShow: function(thisElement){},
  8219. onHide: function(thisElement){},
  8220. onComplete: function(thisElement){},
  8221. heightOverride: null,
  8222. widthOverride: null,*/
  8223. link: 'cancel',
  8224. styles: ['padding', 'border', 'margin'],
  8225. transitionOpacity: 'opacity' in document.documentElement,
  8226. mode: 'vertical',
  8227. display: function(){
  8228. return this.element.get('tag') != 'tr' ? 'block' : 'table-row';
  8229. },
  8230. opacity: 1,
  8231. hideInputs: !('opacity' in document.documentElement) ? 'select, input, textarea, object, embed' : null
  8232. },
  8233. dissolve: function(){
  8234. if (!this.hiding && !this.showing){
  8235. if (this.element.getStyle('display') != 'none'){
  8236. this.hiding = true;
  8237. this.showing = false;
  8238. this.hidden = true;
  8239. this.cssText = this.element.style.cssText;
  8240. var startStyles = this.element.getComputedSize({
  8241. styles: this.options.styles,
  8242. mode: this.options.mode
  8243. });
  8244. if (this.options.transitionOpacity) startStyles.opacity = this.options.opacity;
  8245. var zero = {};
  8246. Object.each(startStyles, function(style, name){
  8247. zero[name] = [style, 0];
  8248. });
  8249. this.element.setStyles({
  8250. display: Function.convert(this.options.display).call(this),
  8251. overflow: 'hidden'
  8252. });
  8253. var hideThese = hideTheseOf(this);
  8254. if (hideThese) hideThese.setStyle('visibility', 'hidden');
  8255. this.$chain.unshift(function(){
  8256. if (this.hidden){
  8257. this.hiding = false;
  8258. this.element.style.cssText = this.cssText;
  8259. this.element.setStyle('display', 'none');
  8260. if (hideThese) hideThese.setStyle('visibility', 'visible');
  8261. }
  8262. this.fireEvent('hide', this.element);
  8263. this.callChain();
  8264. }.bind(this));
  8265. this.start(zero);
  8266. } else {
  8267. this.callChain.delay(10, this);
  8268. this.fireEvent('complete', this.element);
  8269. this.fireEvent('hide', this.element);
  8270. }
  8271. } else if (this.options.link == 'chain'){
  8272. this.chain(this.dissolve.bind(this));
  8273. } else if (this.options.link == 'cancel' && !this.hiding){
  8274. this.cancel();
  8275. this.dissolve();
  8276. }
  8277. return this;
  8278. },
  8279. reveal: function(){
  8280. if (!this.showing && !this.hiding){
  8281. if (this.element.getStyle('display') == 'none'){
  8282. this.hiding = false;
  8283. this.showing = true;
  8284. this.hidden = false;
  8285. this.cssText = this.element.style.cssText;
  8286. var startStyles;
  8287. this.element.measure(function(){
  8288. startStyles = this.element.getComputedSize({
  8289. styles: this.options.styles,
  8290. mode: this.options.mode
  8291. });
  8292. }.bind(this));
  8293. if (this.options.heightOverride != null) startStyles.height = this.options.heightOverride.toInt();
  8294. if (this.options.widthOverride != null) startStyles.width = this.options.widthOverride.toInt();
  8295. if (this.options.transitionOpacity){
  8296. this.element.setStyle('opacity', 0);
  8297. startStyles.opacity = this.options.opacity;
  8298. }
  8299. var zero = {
  8300. height: 0,
  8301. display: Function.convert(this.options.display).call(this)
  8302. };
  8303. Object.each(startStyles, function(style, name){
  8304. zero[name] = 0;
  8305. });
  8306. zero.overflow = 'hidden';
  8307. this.element.setStyles(zero);
  8308. var hideThese = hideTheseOf(this);
  8309. if (hideThese) hideThese.setStyle('visibility', 'hidden');
  8310. this.$chain.unshift(function(){
  8311. this.element.style.cssText = this.cssText;
  8312. this.element.setStyle('display', Function.convert(this.options.display).call(this));
  8313. if (!this.hidden) this.showing = false;
  8314. if (hideThese) hideThese.setStyle('visibility', 'visible');
  8315. this.callChain();
  8316. this.fireEvent('show', this.element);
  8317. }.bind(this));
  8318. this.start(startStyles);
  8319. } else {
  8320. this.callChain();
  8321. this.fireEvent('complete', this.element);
  8322. this.fireEvent('show', this.element);
  8323. }
  8324. } else if (this.options.link == 'chain'){
  8325. this.chain(this.reveal.bind(this));
  8326. } else if (this.options.link == 'cancel' && !this.showing){
  8327. this.cancel();
  8328. this.reveal();
  8329. }
  8330. return this;
  8331. },
  8332. toggle: function(){
  8333. if (this.element.getStyle('display') == 'none'){
  8334. this.reveal();
  8335. } else {
  8336. this.dissolve();
  8337. }
  8338. return this;
  8339. },
  8340. cancel: function(){
  8341. this.parent.apply(this, arguments);
  8342. if (this.cssText != null) this.element.style.cssText = this.cssText;
  8343. this.hiding = false;
  8344. this.showing = false;
  8345. return this;
  8346. }
  8347. });
  8348. Element.Properties.reveal = {
  8349. set: function(options){
  8350. this.get('reveal').cancel().setOptions(options);
  8351. return this;
  8352. },
  8353. get: function(){
  8354. var reveal = this.retrieve('reveal');
  8355. if (!reveal){
  8356. reveal = new Fx.Reveal(this);
  8357. this.store('reveal', reveal);
  8358. }
  8359. return reveal;
  8360. }
  8361. };
  8362. Element.Properties.dissolve = Element.Properties.reveal;
  8363. Element.implement({
  8364. reveal: function(options){
  8365. this.get('reveal').setOptions(options).reveal();
  8366. return this;
  8367. },
  8368. dissolve: function(options){
  8369. this.get('reveal').setOptions(options).dissolve();
  8370. return this;
  8371. },
  8372. nix: function(options){
  8373. var params = Array.link(arguments, {destroy: Type.isBoolean, options: Type.isObject});
  8374. this.get('reveal').setOptions(options).dissolve().chain(function(){
  8375. this[params.destroy ? 'destroy' : 'dispose']();
  8376. }.bind(this));
  8377. return this;
  8378. },
  8379. wink: function(){
  8380. var params = Array.link(arguments, {duration: Type.isNumber, options: Type.isObject});
  8381. var reveal = this.get('reveal').setOptions(params.options);
  8382. reveal.reveal().chain(function(){
  8383. (function(){
  8384. reveal.dissolve();
  8385. }).delay(params.duration || 2000);
  8386. });
  8387. }
  8388. });
  8389. })();
  8390. /*
  8391. ---
  8392. script: Form.Request.Append.js
  8393. name: Form.Request.Append
  8394. 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.
  8395. license: MIT-style license
  8396. authors:
  8397. - Aaron Newton
  8398. requires:
  8399. - Form.Request
  8400. - Fx.Reveal
  8401. - Elements.from
  8402. provides: [Form.Request.Append]
  8403. ...
  8404. */
  8405. Form.Request.Append = new Class({
  8406. Extends: Form.Request,
  8407. options: {
  8408. //onBeforeEffect: function(){},
  8409. useReveal: true,
  8410. revealOptions: {},
  8411. inject: 'bottom'
  8412. },
  8413. makeRequest: function(){
  8414. this.request = new Request.HTML(Object.merge({
  8415. url: this.element.get('action'),
  8416. method: this.element.get('method') || 'post',
  8417. spinnerTarget: this.element
  8418. }, this.options.requestOptions, {
  8419. evalScripts: false
  8420. })).addEvents({
  8421. success: function(tree, elements, html, javascript){
  8422. var container;
  8423. var kids = Elements.from(html);
  8424. if (kids.length == 1){
  8425. container = kids[0];
  8426. } else {
  8427. container = new Element('div', {
  8428. styles: {
  8429. display: 'none'
  8430. }
  8431. }).adopt(kids);
  8432. }
  8433. container.inject(this.target, this.options.inject);
  8434. if (this.options.requestOptions.evalScripts) Browser.exec(javascript);
  8435. this.fireEvent('beforeEffect', container);
  8436. var finish = function(){
  8437. this.fireEvent('success', [container, this.target, tree, elements, html, javascript]);
  8438. }.bind(this);
  8439. if (this.options.useReveal){
  8440. container.set('reveal', this.options.revealOptions).get('reveal').chain(finish);
  8441. container.reveal();
  8442. } else {
  8443. finish();
  8444. }
  8445. }.bind(this),
  8446. failure: function(xhr){
  8447. this.fireEvent('failure', xhr);
  8448. }.bind(this)
  8449. });
  8450. this.attachReset();
  8451. }
  8452. });
  8453. /*
  8454. ---
  8455. script: Object.Extras.js
  8456. name: Object.Extras
  8457. description: Extra Object generics, like getFromPath which allows a path notation to child elements.
  8458. license: MIT-style license
  8459. authors:
  8460. - Aaron Newton
  8461. requires:
  8462. - Core/Object
  8463. - MooTools.More
  8464. provides: [Object.Extras]
  8465. ...
  8466. */
  8467. (function(){
  8468. var defined = function(value){
  8469. return value != null;
  8470. };
  8471. var hasOwnProperty = Object.prototype.hasOwnProperty;
  8472. Object.extend({
  8473. getFromPath: function(source, parts){
  8474. if (typeof parts == 'string') parts = parts.split('.');
  8475. for (var i = 0, l = parts.length; i < l; i++){
  8476. if (hasOwnProperty.call(source, parts[i])) source = source[parts[i]];
  8477. else return null;
  8478. }
  8479. return source;
  8480. },
  8481. cleanValues: function(object, method){
  8482. method = method || defined;
  8483. for (var key in object) if (!method(object[key])){
  8484. delete object[key];
  8485. }
  8486. return object;
  8487. },
  8488. erase: function(object, key){
  8489. if (hasOwnProperty.call(object, key)) delete object[key];
  8490. return object;
  8491. },
  8492. run: function(object){
  8493. var args = Array.slice(arguments, 1);
  8494. for (var key in object) if (object[key].apply){
  8495. object[key].apply(object, args);
  8496. }
  8497. return object;
  8498. }
  8499. });
  8500. })();
  8501. /*
  8502. ---
  8503. script: Locale.js
  8504. name: Locale
  8505. description: Provides methods for localization.
  8506. license: MIT-style license
  8507. authors:
  8508. - Aaron Newton
  8509. - Arian Stolwijk
  8510. requires:
  8511. - Core/Events
  8512. - Object.Extras
  8513. - MooTools.More
  8514. provides: [Locale, Lang]
  8515. ...
  8516. */
  8517. (function(){
  8518. var current = null,
  8519. locales = {},
  8520. inherits = {};
  8521. var getSet = function(set){
  8522. if (instanceOf(set, Locale.Set)) return set;
  8523. else return locales[set];
  8524. };
  8525. var Locale = this.Locale = {
  8526. define: function(locale, set, key, value){
  8527. var name;
  8528. if (instanceOf(locale, Locale.Set)){
  8529. name = locale.name;
  8530. if (name) locales[name] = locale;
  8531. } else {
  8532. name = locale;
  8533. if (!locales[name]) locales[name] = new Locale.Set(name);
  8534. locale = locales[name];
  8535. }
  8536. if (set) locale.define(set, key, value);
  8537. /*<1.2compat>*/
  8538. if (set == 'cascade') return Locale.inherit(name, key);
  8539. /*</1.2compat>*/
  8540. if (!current) current = locale;
  8541. return locale;
  8542. },
  8543. use: function(locale){
  8544. locale = getSet(locale);
  8545. if (locale){
  8546. current = locale;
  8547. this.fireEvent('change', locale);
  8548. /*<1.2compat>*/
  8549. this.fireEvent('langChange', locale.name);
  8550. /*</1.2compat>*/
  8551. }
  8552. return this;
  8553. },
  8554. getCurrent: function(){
  8555. return current;
  8556. },
  8557. get: function(key, args){
  8558. return (current) ? current.get(key, args) : '';
  8559. },
  8560. inherit: function(locale, inherits, set){
  8561. locale = getSet(locale);
  8562. if (locale) locale.inherit(inherits, set);
  8563. return this;
  8564. },
  8565. list: function(){
  8566. return Object.keys(locales);
  8567. }
  8568. };
  8569. Object.append(Locale, new Events);
  8570. Locale.Set = new Class({
  8571. sets: {},
  8572. inherits: {
  8573. locales: [],
  8574. sets: {}
  8575. },
  8576. initialize: function(name){
  8577. this.name = name || '';
  8578. },
  8579. define: function(set, key, value){
  8580. var defineData = this.sets[set];
  8581. if (!defineData) defineData = {};
  8582. if (key){
  8583. if (typeOf(key) == 'object') defineData = Object.merge(defineData, key);
  8584. else defineData[key] = value;
  8585. }
  8586. this.sets[set] = defineData;
  8587. return this;
  8588. },
  8589. get: function(key, args, _base){
  8590. var value = Object.getFromPath(this.sets, key);
  8591. if (value != null){
  8592. var type = typeOf(value);
  8593. if (type == 'function') value = value.apply(null, Array.convert(args));
  8594. else if (type == 'object') value = Object.clone(value);
  8595. return value;
  8596. }
  8597. // get value of inherited locales
  8598. var index = key.indexOf('.'),
  8599. set = index < 0 ? key : key.substr(0, index),
  8600. names = (this.inherits.sets[set] || []).combine(this.inherits.locales).include('en-US');
  8601. if (!_base) _base = [];
  8602. for (var i = 0, l = names.length; i < l; i++){
  8603. if (_base.contains(names[i])) continue;
  8604. _base.include(names[i]);
  8605. var locale = locales[names[i]];
  8606. if (!locale) continue;
  8607. value = locale.get(key, args, _base);
  8608. if (value != null) return value;
  8609. }
  8610. return '';
  8611. },
  8612. inherit: function(names, set){
  8613. names = Array.convert(names);
  8614. if (set && !this.inherits.sets[set]) this.inherits.sets[set] = [];
  8615. var l = names.length;
  8616. while (l--) (set ? this.inherits.sets[set] : this.inherits.locales).unshift(names[l]);
  8617. return this;
  8618. }
  8619. });
  8620. /*<1.2compat>*/
  8621. var lang = MooTools.lang = {};
  8622. Object.append(lang, Locale, {
  8623. setLanguage: Locale.use,
  8624. getCurrentLanguage: function(){
  8625. var current = Locale.getCurrent();
  8626. return (current) ? current.name : null;
  8627. },
  8628. set: function(){
  8629. Locale.define.apply(this, arguments);
  8630. return this;
  8631. },
  8632. get: function(set, key, args){
  8633. if (key) set += '.' + key;
  8634. return Locale.get(set, args);
  8635. }
  8636. });
  8637. /*</1.2compat>*/
  8638. })();
  8639. /*
  8640. ---
  8641. name: Locale.en-US.Date
  8642. description: Date messages for US English.
  8643. license: MIT-style license
  8644. authors:
  8645. - Aaron Newton
  8646. requires:
  8647. - Locale
  8648. provides: [Locale.en-US.Date]
  8649. ...
  8650. */
  8651. Locale.define('en-US', 'Date', {
  8652. months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
  8653. months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  8654. days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  8655. days_abbr: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8656. // Culture's date order: MM/DD/YYYY
  8657. dateOrder: ['month', 'date', 'year'],
  8658. shortDate: '%m/%d/%Y',
  8659. shortTime: '%I:%M%p',
  8660. AM: 'AM',
  8661. PM: 'PM',
  8662. firstDayOfWeek: 0,
  8663. // Date.Extras
  8664. ordinal: function(dayOfMonth){
  8665. // 1st, 2nd, 3rd, etc.
  8666. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'th' : ['th', 'st', 'nd', 'rd', 'th'][Math.min(dayOfMonth % 10, 4)];
  8667. },
  8668. lessThanMinuteAgo: 'less than a minute ago',
  8669. minuteAgo: 'about a minute ago',
  8670. minutesAgo: '{delta} minutes ago',
  8671. hourAgo: 'about an hour ago',
  8672. hoursAgo: 'about {delta} hours ago',
  8673. dayAgo: '1 day ago',
  8674. daysAgo: '{delta} days ago',
  8675. weekAgo: '1 week ago',
  8676. weeksAgo: '{delta} weeks ago',
  8677. monthAgo: '1 month ago',
  8678. monthsAgo: '{delta} months ago',
  8679. yearAgo: '1 year ago',
  8680. yearsAgo: '{delta} years ago',
  8681. lessThanMinuteUntil: 'less than a minute from now',
  8682. minuteUntil: 'about a minute from now',
  8683. minutesUntil: '{delta} minutes from now',
  8684. hourUntil: 'about an hour from now',
  8685. hoursUntil: 'about {delta} hours from now',
  8686. dayUntil: '1 day from now',
  8687. daysUntil: '{delta} days from now',
  8688. weekUntil: '1 week from now',
  8689. weeksUntil: '{delta} weeks from now',
  8690. monthUntil: '1 month from now',
  8691. monthsUntil: '{delta} months from now',
  8692. yearUntil: '1 year from now',
  8693. yearsUntil: '{delta} years from now'
  8694. });
  8695. /*
  8696. ---
  8697. script: Date.js
  8698. name: Date
  8699. description: Extends the Date native object to include methods useful in managing dates.
  8700. license: MIT-style license
  8701. authors:
  8702. - Aaron Newton
  8703. - Nicholas Barthelemy - https://svn.nbarthelemy.com/date-js/
  8704. - Harald Kirshner - mail [at] digitarald.de; http://digitarald.de
  8705. - Scott Kyle - scott [at] appden.com; http://appden.com
  8706. requires:
  8707. - Core/Array
  8708. - Core/String
  8709. - Core/Number
  8710. - MooTools.More
  8711. - Locale
  8712. - Locale.en-US.Date
  8713. provides: [Date]
  8714. ...
  8715. */
  8716. (function(){
  8717. var Date = this.Date;
  8718. var DateMethods = Date.Methods = {
  8719. ms: 'Milliseconds',
  8720. year: 'FullYear',
  8721. min: 'Minutes',
  8722. mo: 'Month',
  8723. sec: 'Seconds',
  8724. hr: 'Hours'
  8725. };
  8726. [
  8727. 'Date', 'Day', 'FullYear', 'Hours', 'Milliseconds', 'Minutes', 'Month', 'Seconds', 'Time', 'TimezoneOffset',
  8728. 'Week', 'Timezone', 'GMTOffset', 'DayOfYear', 'LastMonth', 'LastDayOfMonth', 'UTCDate', 'UTCDay', 'UTCFullYear',
  8729. 'AMPM', 'Ordinal', 'UTCHours', 'UTCMilliseconds', 'UTCMinutes', 'UTCMonth', 'UTCSeconds', 'UTCMilliseconds'
  8730. ].each(function(method){
  8731. Date.Methods[method.toLowerCase()] = method;
  8732. });
  8733. var pad = function(n, digits, string){
  8734. if (digits == 1) return n;
  8735. return n < Math.pow(10, digits - 1) ? (string || '0') + pad(n, digits - 1, string) : n;
  8736. };
  8737. Date.implement({
  8738. set: function(prop, value){
  8739. prop = prop.toLowerCase();
  8740. var method = DateMethods[prop] && 'set' + DateMethods[prop];
  8741. if (method && this[method]) this[method](value);
  8742. return this;
  8743. }.overloadSetter(),
  8744. get: function(prop){
  8745. prop = prop.toLowerCase();
  8746. var method = DateMethods[prop] && 'get' + DateMethods[prop];
  8747. if (method && this[method]) return this[method]();
  8748. return null;
  8749. }.overloadGetter(),
  8750. clone: function(){
  8751. return new Date(this.get('time'));
  8752. },
  8753. increment: function(interval, times){
  8754. interval = interval || 'day';
  8755. times = times != null ? times : 1;
  8756. switch (interval){
  8757. case 'year':
  8758. return this.increment('month', times * 12);
  8759. case 'month':
  8760. var d = this.get('date');
  8761. this.set('date', 1).set('mo', this.get('mo') + times);
  8762. return this.set('date', d.min(this.get('lastdayofmonth')));
  8763. case 'week':
  8764. return this.increment('day', times * 7);
  8765. case 'day':
  8766. return this.set('date', this.get('date') + times);
  8767. }
  8768. if (!Date.units[interval]) throw new Error(interval + ' is not a supported interval');
  8769. return this.set('time', this.get('time') + times * Date.units[interval]());
  8770. },
  8771. decrement: function(interval, times){
  8772. return this.increment(interval, -1 * (times != null ? times : 1));
  8773. },
  8774. isLeapYear: function(){
  8775. return Date.isLeapYear(this.get('year'));
  8776. },
  8777. clearTime: function(){
  8778. return this.set({hr: 0, min: 0, sec: 0, ms: 0});
  8779. },
  8780. diff: function(date, resolution){
  8781. if (typeOf(date) == 'string') date = Date.parse(date);
  8782. return ((date - this) / Date.units[resolution || 'day'](3, 3)).round(); // non-leap year, 30-day month
  8783. },
  8784. getLastDayOfMonth: function(){
  8785. return Date.daysInMonth(this.get('mo'), this.get('year'));
  8786. },
  8787. getDayOfYear: function(){
  8788. return (Date.UTC(this.get('year'), this.get('mo'), this.get('date') + 1)
  8789. - Date.UTC(this.get('year'), 0, 1)) / Date.units.day();
  8790. },
  8791. setDay: function(day, firstDayOfWeek){
  8792. if (firstDayOfWeek == null){
  8793. firstDayOfWeek = Date.getMsg('firstDayOfWeek');
  8794. if (firstDayOfWeek === '') firstDayOfWeek = 1;
  8795. }
  8796. day = (7 + Date.parseDay(day, true) - firstDayOfWeek) % 7;
  8797. var currentDay = (7 + this.get('day') - firstDayOfWeek) % 7;
  8798. return this.increment('day', day - currentDay);
  8799. },
  8800. getWeek: function(firstDayOfWeek){
  8801. if (firstDayOfWeek == null){
  8802. firstDayOfWeek = Date.getMsg('firstDayOfWeek');
  8803. if (firstDayOfWeek === '') firstDayOfWeek = 1;
  8804. }
  8805. var date = this,
  8806. dayOfWeek = (7 + date.get('day') - firstDayOfWeek) % 7,
  8807. dividend = 0,
  8808. firstDayOfYear;
  8809. if (firstDayOfWeek == 1){
  8810. // ISO-8601, week belongs to year that has the most days of the week (i.e. has the thursday of the week)
  8811. var month = date.get('month'),
  8812. startOfWeek = date.get('date') - dayOfWeek;
  8813. if (month == 11 && startOfWeek > 28) return 1; // Week 1 of next year
  8814. if (month == 0 && startOfWeek < -2){
  8815. // Use a date from last year to determine the week
  8816. date = new Date(date).decrement('day', dayOfWeek);
  8817. dayOfWeek = 0;
  8818. }
  8819. firstDayOfYear = new Date(date.get('year'), 0, 1).get('day') || 7;
  8820. if (firstDayOfYear > 4) dividend = -7; // First week of the year is not week 1
  8821. } else {
  8822. // In other cultures the first week of the year is always week 1 and the last week always 53 or 54.
  8823. // Days in the same week can have a different weeknumber if the week spreads across two years.
  8824. firstDayOfYear = new Date(date.get('year'), 0, 1).get('day');
  8825. }
  8826. dividend += date.get('dayofyear');
  8827. dividend += 6 - dayOfWeek; // Add days so we calculate the current date's week as a full week
  8828. dividend += (7 + firstDayOfYear - firstDayOfWeek) % 7; // Make up for first week of the year not being a full week
  8829. return (dividend / 7);
  8830. },
  8831. getOrdinal: function(day){
  8832. return Date.getMsg('ordinal', day || this.get('date'));
  8833. },
  8834. getTimezone: function(){
  8835. return this.toString()
  8836. .replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/, '$1')
  8837. .replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, '$1$2$3');
  8838. },
  8839. getGMTOffset: function(){
  8840. var off = this.get('timezoneOffset');
  8841. return ((off > 0) ? '-' : '+') + pad((off.abs() / 60).floor(), 2) + pad(off % 60, 2);
  8842. },
  8843. setAMPM: function(ampm){
  8844. ampm = ampm.toUpperCase();
  8845. var hr = this.get('hr');
  8846. if (hr > 11 && ampm == 'AM') return this.decrement('hour', 12);
  8847. else if (hr < 12 && ampm == 'PM') return this.increment('hour', 12);
  8848. return this;
  8849. },
  8850. getAMPM: function(){
  8851. return (this.get('hr') < 12) ? 'AM' : 'PM';
  8852. },
  8853. parse: function(str){
  8854. this.set('time', Date.parse(str));
  8855. return this;
  8856. },
  8857. isValid: function(date){
  8858. if (!date) date = this;
  8859. return typeOf(date) == 'date' && !isNaN(date.valueOf());
  8860. },
  8861. format: function(format){
  8862. if (!this.isValid()) return 'invalid date';
  8863. if (!format) format = '%x %X';
  8864. if (typeof format == 'string') format = formats[format.toLowerCase()] || format;
  8865. if (typeof format == 'function') return format(this);
  8866. var d = this;
  8867. return format.replace(/%([a-z%])/gi,
  8868. function($0, $1){
  8869. switch ($1){
  8870. case 'a': return Date.getMsg('days_abbr')[d.get('day')];
  8871. case 'A': return Date.getMsg('days')[d.get('day')];
  8872. case 'b': return Date.getMsg('months_abbr')[d.get('month')];
  8873. case 'B': return Date.getMsg('months')[d.get('month')];
  8874. case 'c': return d.format('%a %b %d %H:%M:%S %Y');
  8875. case 'd': return pad(d.get('date'), 2);
  8876. case 'e': return pad(d.get('date'), 2, ' ');
  8877. case 'H': return pad(d.get('hr'), 2);
  8878. case 'I': return pad((d.get('hr') % 12) || 12, 2);
  8879. case 'j': return pad(d.get('dayofyear'), 3);
  8880. case 'k': return pad(d.get('hr'), 2, ' ');
  8881. case 'l': return pad((d.get('hr') % 12) || 12, 2, ' ');
  8882. case 'L': return pad(d.get('ms'), 3);
  8883. case 'm': return pad((d.get('mo') + 1), 2);
  8884. case 'M': return pad(d.get('min'), 2);
  8885. case 'o': return d.get('ordinal');
  8886. case 'p': return Date.getMsg(d.get('ampm'));
  8887. case 's': return Math.round(d / 1000);
  8888. case 'S': return pad(d.get('seconds'), 2);
  8889. case 'T': return d.format('%H:%M:%S');
  8890. case 'U': return pad(d.get('week'), 2);
  8891. case 'w': return d.get('day');
  8892. case 'x': return d.format(Date.getMsg('shortDate'));
  8893. case 'X': return d.format(Date.getMsg('shortTime'));
  8894. case 'y': return d.get('year').toString().substr(2);
  8895. case 'Y': return d.get('year');
  8896. case 'z': return d.get('GMTOffset');
  8897. case 'Z': return d.get('Timezone');
  8898. }
  8899. return $1;
  8900. }
  8901. );
  8902. },
  8903. toISOString: function(){
  8904. return this.format('iso8601');
  8905. }
  8906. }).alias({
  8907. toJSON: 'toISOString',
  8908. compare: 'diff',
  8909. strftime: 'format'
  8910. });
  8911. // The day and month abbreviations are standardized, so we cannot use simply %a and %b because they will get localized
  8912. var rfcDayAbbr = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8913. rfcMonthAbbr = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
  8914. var formats = {
  8915. db: '%Y-%m-%d %H:%M:%S',
  8916. compact: '%Y%m%dT%H%M%S',
  8917. 'short': '%d %b %H:%M',
  8918. 'long': '%B %d, %Y %H:%M',
  8919. rfc822: function(date){
  8920. return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %Z');
  8921. },
  8922. rfc2822: function(date){
  8923. return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %z');
  8924. },
  8925. iso8601: function(date){
  8926. return (
  8927. date.getUTCFullYear() + '-' +
  8928. pad(date.getUTCMonth() + 1, 2) + '-' +
  8929. pad(date.getUTCDate(), 2) + 'T' +
  8930. pad(date.getUTCHours(), 2) + ':' +
  8931. pad(date.getUTCMinutes(), 2) + ':' +
  8932. pad(date.getUTCSeconds(), 2) + '.' +
  8933. pad(date.getUTCMilliseconds(), 3) + 'Z'
  8934. );
  8935. }
  8936. };
  8937. var parsePatterns = [],
  8938. nativeParse = Date.parse;
  8939. var parseWord = function(type, word, num){
  8940. var ret = -1,
  8941. translated = Date.getMsg(type + 's');
  8942. switch (typeOf(word)){
  8943. case 'object':
  8944. ret = translated[word.get(type)];
  8945. break;
  8946. case 'number':
  8947. ret = translated[word];
  8948. if (!ret) throw new Error('Invalid ' + type + ' index: ' + word);
  8949. break;
  8950. case 'string':
  8951. var match = translated.filter(function(name){
  8952. return this.test(name);
  8953. }, new RegExp('^' + word, 'i'));
  8954. if (!match.length) throw new Error('Invalid ' + type + ' string');
  8955. if (match.length > 1) throw new Error('Ambiguous ' + type);
  8956. ret = match[0];
  8957. }
  8958. return (num) ? translated.indexOf(ret) : ret;
  8959. };
  8960. var startCentury = 1900,
  8961. startYear = 70;
  8962. Date.extend({
  8963. getMsg: function(key, args){
  8964. return Locale.get('Date.' + key, args);
  8965. },
  8966. units: {
  8967. ms: Function.convert(1),
  8968. second: Function.convert(1000),
  8969. minute: Function.convert(60000),
  8970. hour: Function.convert(3600000),
  8971. day: Function.convert(86400000),
  8972. week: Function.convert(608400000),
  8973. month: function(month, year){
  8974. var d = new Date;
  8975. return Date.daysInMonth(month != null ? month : d.get('mo'), year != null ? year : d.get('year')) * 86400000;
  8976. },
  8977. year: function(year){
  8978. year = year || new Date().get('year');
  8979. return Date.isLeapYear(year) ? 31622400000 : 31536000000;
  8980. }
  8981. },
  8982. daysInMonth: function(month, year){
  8983. return [31, Date.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
  8984. },
  8985. isLeapYear: function(year){
  8986. return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);
  8987. },
  8988. parse: function(from){
  8989. var t = typeOf(from);
  8990. if (t == 'number') return new Date(from);
  8991. if (t != 'string') return from;
  8992. from = from.clean();
  8993. if (!from.length) return null;
  8994. var parsed;
  8995. parsePatterns.some(function(pattern){
  8996. var bits = pattern.re.exec(from);
  8997. return (bits) ? (parsed = pattern.handler(bits)) : false;
  8998. });
  8999. if (!(parsed && parsed.isValid())){
  9000. parsed = new Date(nativeParse(from));
  9001. if (!(parsed && parsed.isValid())) parsed = new Date(from.toInt());
  9002. }
  9003. return parsed;
  9004. },
  9005. parseDay: function(day, num){
  9006. return parseWord('day', day, num);
  9007. },
  9008. parseMonth: function(month, num){
  9009. return parseWord('month', month, num);
  9010. },
  9011. parseUTC: function(value){
  9012. var localDate = new Date(value);
  9013. var utcSeconds = Date.UTC(
  9014. localDate.get('year'),
  9015. localDate.get('mo'),
  9016. localDate.get('date'),
  9017. localDate.get('hr'),
  9018. localDate.get('min'),
  9019. localDate.get('sec'),
  9020. localDate.get('ms')
  9021. );
  9022. return new Date(utcSeconds);
  9023. },
  9024. orderIndex: function(unit){
  9025. return Date.getMsg('dateOrder').indexOf(unit) + 1;
  9026. },
  9027. defineFormat: function(name, format){
  9028. formats[name] = format;
  9029. return this;
  9030. },
  9031. //<1.2compat>
  9032. parsePatterns: parsePatterns,
  9033. //</1.2compat>
  9034. defineParser: function(pattern){
  9035. parsePatterns.push((pattern.re && pattern.handler) ? pattern : build(pattern));
  9036. return this;
  9037. },
  9038. defineParsers: function(){
  9039. Array.flatten(arguments).each(Date.defineParser);
  9040. return this;
  9041. },
  9042. define2DigitYearStart: function(year){
  9043. startYear = year % 100;
  9044. startCentury = year - startYear;
  9045. return this;
  9046. }
  9047. }).extend({
  9048. defineFormats: Date.defineFormat.overloadSetter()
  9049. });
  9050. var regexOf = function(type){
  9051. return new RegExp('(?:' + Date.getMsg(type).map(function(name){
  9052. return name.substr(0, 3);
  9053. }).join('|') + ')[a-z]*');
  9054. };
  9055. var replacers = function(key){
  9056. switch (key){
  9057. case 'T':
  9058. return '%H:%M:%S';
  9059. case 'x': // iso8601 covers yyyy-mm-dd, so just check if month is first
  9060. return ((Date.orderIndex('month') == 1) ? '%m[-./]%d' : '%d[-./]%m') + '([-./]%y)?';
  9061. case 'X':
  9062. return '%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%z?';
  9063. }
  9064. return null;
  9065. };
  9066. var keys = {
  9067. d: /[0-2]?[0-9]|3[01]/,
  9068. H: /[01]?[0-9]|2[0-3]/,
  9069. I: /0?[1-9]|1[0-2]/,
  9070. M: /[0-5]?\d/,
  9071. s: /\d+/,
  9072. o: /[a-z]*/,
  9073. p: /[ap]\.?m\.?/,
  9074. y: /\d{2}|\d{4}/,
  9075. Y: /\d{4}/,
  9076. z: /Z|[+-]\d{2}(?::?\d{2})?/
  9077. };
  9078. keys.m = keys.I;
  9079. keys.S = keys.M;
  9080. var currentLanguage;
  9081. var recompile = function(language){
  9082. currentLanguage = language;
  9083. keys.a = keys.A = regexOf('days');
  9084. keys.b = keys.B = regexOf('months');
  9085. parsePatterns.each(function(pattern, i){
  9086. if (pattern.format) parsePatterns[i] = build(pattern.format);
  9087. });
  9088. };
  9089. var build = function(format){
  9090. if (!currentLanguage) return {format: format};
  9091. var parsed = [];
  9092. var re = (format.source || format) // allow format to be regex
  9093. .replace(/%([a-z])/gi,
  9094. function($0, $1){
  9095. return replacers($1) || $0;
  9096. }
  9097. ).replace(/\((?!\?)/g, '(?:') // make all groups non-capturing
  9098. .replace(/ (?!\?|\*)/g, ',? ') // be forgiving with spaces and commas
  9099. .replace(/%([a-z%])/gi,
  9100. function($0, $1){
  9101. var p = keys[$1];
  9102. if (!p) return $1;
  9103. parsed.push($1);
  9104. return '(' + p.source + ')';
  9105. }
  9106. ).replace(/\[a-z\]/gi, '[a-z\\u00c0-\\uffff;\&]'); // handle unicode words
  9107. return {
  9108. format: format,
  9109. re: new RegExp('^' + re + '$', 'i'),
  9110. handler: function(bits){
  9111. bits = bits.slice(1).associate(parsed);
  9112. var date = new Date().clearTime(),
  9113. year = bits.y || bits.Y;
  9114. if (year != null) handle.call(date, 'y', year); // need to start in the right year
  9115. if ('d' in bits) handle.call(date, 'd', 1);
  9116. if ('m' in bits || bits.b || bits.B) handle.call(date, 'm', 1);
  9117. for (var key in bits) handle.call(date, key, bits[key]);
  9118. return date;
  9119. }
  9120. };
  9121. };
  9122. var handle = function(key, value){
  9123. if (!value) return this;
  9124. switch (key){
  9125. case 'a': case 'A': return this.set('day', Date.parseDay(value, true));
  9126. case 'b': case 'B': return this.set('mo', Date.parseMonth(value, true));
  9127. case 'd': return this.set('date', value);
  9128. case 'H': case 'I': return this.set('hr', value);
  9129. case 'm': return this.set('mo', value - 1);
  9130. case 'M': return this.set('min', value);
  9131. case 'p': return this.set('ampm', value.replace(/\./g, ''));
  9132. case 'S': return this.set('sec', value);
  9133. case 's': return this.set('ms', ('0.' + value) * 1000);
  9134. case 'w': return this.set('day', value);
  9135. case 'Y': return this.set('year', value);
  9136. case 'y':
  9137. value = +value;
  9138. if (value < 100) value += startCentury + (value < startYear ? 100 : 0);
  9139. return this.set('year', value);
  9140. case 'z':
  9141. if (value == 'Z') value = '+00';
  9142. var offset = value.match(/([+-])(\d{2}):?(\d{2})?/);
  9143. offset = (offset[1] + '1') * (offset[2] * 60 + (+offset[3] || 0)) + this.getTimezoneOffset();
  9144. return this.set('time', this - offset * 60000);
  9145. }
  9146. return this;
  9147. };
  9148. Date.defineParsers(
  9149. '%Y([-./]%m([-./]%d((T| )%X)?)?)?', // "1999-12-31", "1999-12-31 11:59pm", "1999-12-31 23:59:59", ISO8601
  9150. '%Y%m%d(T%H(%M%S?)?)?', // "19991231", "19991231T1159", compact
  9151. '%x( %X)?', // "12/31", "12.31.99", "12-31-1999", "12/31/2008 11:59 PM"
  9152. '%d%o( %b( %Y)?)?( %X)?', // "31st", "31st December", "31 Dec 1999", "31 Dec 1999 11:59pm"
  9153. '%b( %d%o)?( %Y)?( %X)?', // Same as above with month and day switched
  9154. '%Y %b( %d%o( %X)?)?', // Same as above with year coming first
  9155. '%o %b %d %X %z %Y', // "Thu Oct 22 08:11:23 +0000 2009"
  9156. '%T', // %H:%M:%S
  9157. '%H:%M( ?%p)?' // "11:05pm", "11:05 am" and "11:05"
  9158. );
  9159. Locale.addEvent('change', function(language){
  9160. if (Locale.get('Date')) recompile(language);
  9161. }).fireEvent('change', Locale.getCurrent());
  9162. })();
  9163. /*
  9164. ---
  9165. name: Locale.en-US.Form.Validator
  9166. description: Form Validator messages for English.
  9167. license: MIT-style license
  9168. authors:
  9169. - Aaron Newton
  9170. requires:
  9171. - Locale
  9172. provides: [Locale.en-US.Form.Validator]
  9173. ...
  9174. */
  9175. Locale.define('en-US', 'FormValidator', {
  9176. required: 'This field is required.',
  9177. length: 'Please enter {length} characters (you entered {elLength} characters)',
  9178. minLength: 'Please enter at least {minLength} characters (you entered {length} characters).',
  9179. maxLength: 'Please enter no more than {maxLength} characters (you entered {length} characters).',
  9180. integer: 'Please enter an integer in this field. Numbers with decimals (e.g. 1.25) are not permitted.',
  9181. numeric: 'Please enter only numeric values in this field (i.e. "1" or "1.1" or "-1" or "-1.1").',
  9182. digits: 'Please use numbers and punctuation only in this field (for example, a phone number with dashes or dots is permitted).',
  9183. alpha: 'Please use only letters (a-z) within this field. No spaces or other characters are allowed.',
  9184. alphanum: 'Please use only letters (a-z) or numbers (0-9) in this field. No spaces or other characters are allowed.',
  9185. dateSuchAs: 'Please enter a valid date such as {date}',
  9186. dateInFormatMDY: 'Please enter a valid date such as MM/DD/YYYY (i.e. "12/31/1999")',
  9187. email: 'Please enter a valid email address. For example "fred@domain.com".',
  9188. url: 'Please enter a valid URL such as http://www.example.com.',
  9189. currencyDollar: 'Please enter a valid $ amount. For example $100.00 .',
  9190. oneRequired: 'Please enter something for at least one of these inputs.',
  9191. errorPrefix: 'Error: ',
  9192. warningPrefix: 'Warning: ',
  9193. // Form.Validator.Extras
  9194. noSpace: 'There can be no spaces in this input.',
  9195. reqChkByNode: 'No items are selected.',
  9196. requiredChk: 'This field is required.',
  9197. reqChkByName: 'Please select a {label}.',
  9198. match: 'This field needs to match the {matchName} field',
  9199. startDate: 'the start date',
  9200. endDate: 'the end date',
  9201. currentDate: 'the current date',
  9202. afterDate: 'The date should be the same or after {label}.',
  9203. beforeDate: 'The date should be the same or before {label}.',
  9204. startMonth: 'Please select a start month',
  9205. sameMonth: 'These two dates must be in the same month - you must change one or the other.',
  9206. creditcard: 'The credit card number entered is invalid. Please check the number and try again. {length} digits entered.'
  9207. });
  9208. /*
  9209. ---
  9210. script: Form.Validator.js
  9211. name: Form.Validator
  9212. description: A css-class based form validation system.
  9213. license: MIT-style license
  9214. authors:
  9215. - Aaron Newton
  9216. requires:
  9217. - Core/Options
  9218. - Core/Events
  9219. - Core/Element.Delegation
  9220. - Core/Slick.Finder
  9221. - Core/Element.Event
  9222. - Core/Element.Style
  9223. - Core/JSON
  9224. - Locale
  9225. - Class.Binds
  9226. - Date
  9227. - Element.Forms
  9228. - Locale.en-US.Form.Validator
  9229. - Element.Shortcuts
  9230. provides: [Form.Validator, InputValidator, FormValidator.BaseValidators]
  9231. ...
  9232. */
  9233. if (!window.Form) window.Form = {};
  9234. var InputValidator = this.InputValidator = new Class({
  9235. Implements: [Options],
  9236. options: {
  9237. errorMsg: 'Validation failed.',
  9238. test: Function.convert(true)
  9239. },
  9240. initialize: function(className, options){
  9241. this.setOptions(options);
  9242. this.className = className;
  9243. },
  9244. test: function(field, props){
  9245. field = document.id(field);
  9246. return (field) ? this.options.test(field, props || this.getProps(field)) : false;
  9247. },
  9248. getError: function(field, props){
  9249. field = document.id(field);
  9250. var err = this.options.errorMsg;
  9251. if (typeOf(err) == 'function') err = err(field, props || this.getProps(field));
  9252. return err;
  9253. },
  9254. getProps: function(field){
  9255. field = document.id(field);
  9256. return (field) ? field.get('validatorProps') : {};
  9257. }
  9258. });
  9259. Element.Properties.validators = {
  9260. get: function(){
  9261. return (this.get('data-validators') || this.className).clean().replace(/'(\\.|[^'])*'|"(\\.|[^"])*"/g, function(match){
  9262. return match.replace(' ', '\\x20');
  9263. }).split(' ');
  9264. }
  9265. };
  9266. Element.Properties.validatorProps = {
  9267. set: function(props){
  9268. return this.eliminate('$moo:validatorProps').store('$moo:validatorProps', props);
  9269. },
  9270. get: function(props){
  9271. if (props) this.set(props);
  9272. if (this.retrieve('$moo:validatorProps')) return this.retrieve('$moo:validatorProps');
  9273. if (this.getProperty('data-validator-properties') || this.getProperty('validatorProps')){
  9274. try {
  9275. this.store('$moo:validatorProps', JSON.decode(this.getProperty('validatorProps') || this.getProperty('data-validator-properties'), false));
  9276. } catch (e){
  9277. return {};
  9278. }
  9279. } else {
  9280. var vals = this.get('validators').filter(function(cls){
  9281. return cls.test(':');
  9282. });
  9283. if (!vals.length){
  9284. this.store('$moo:validatorProps', {});
  9285. } else {
  9286. props = {};
  9287. vals.each(function(cls){
  9288. var split = cls.split(':');
  9289. if (split[1]){
  9290. try {
  9291. props[split[0]] = JSON.decode(split[1], false);
  9292. } catch (e){}
  9293. }
  9294. });
  9295. this.store('$moo:validatorProps', props);
  9296. }
  9297. }
  9298. return this.retrieve('$moo:validatorProps');
  9299. }
  9300. };
  9301. Form.Validator = new Class({
  9302. Implements: [Options, Events],
  9303. options: {/*
  9304. onFormValidate: function(isValid, form, event){},
  9305. onElementValidate: function(isValid, field, className, warn){},
  9306. onElementPass: function(field){},
  9307. onElementFail: function(field, validatorsFailed){}, */
  9308. fieldSelectors: 'input, select, textarea',
  9309. ignoreHidden: true,
  9310. ignoreDisabled: true,
  9311. useTitles: false,
  9312. evaluateOnSubmit: true,
  9313. evaluateFieldsOnBlur: true,
  9314. evaluateFieldsOnChange: true,
  9315. serial: true,
  9316. stopOnFailure: true,
  9317. warningPrefix: function(){
  9318. return Form.Validator.getMsg('warningPrefix') || 'Warning: ';
  9319. },
  9320. errorPrefix: function(){
  9321. return Form.Validator.getMsg('errorPrefix') || 'Error: ';
  9322. }
  9323. },
  9324. initialize: function(form, options){
  9325. this.setOptions(options);
  9326. this.element = document.id(form);
  9327. this.warningPrefix = Function.convert(this.options.warningPrefix)();
  9328. this.errorPrefix = Function.convert(this.options.errorPrefix)();
  9329. this._bound = {
  9330. onSubmit: this.onSubmit.bind(this),
  9331. blurOrChange: function(event, field){
  9332. this.validationMonitor(field, true);
  9333. }.bind(this)
  9334. };
  9335. this.enable();
  9336. },
  9337. toElement: function(){
  9338. return this.element;
  9339. },
  9340. getFields: function(){
  9341. return (this.fields = this.element.getElements(this.options.fieldSelectors));
  9342. },
  9343. enable: function(){
  9344. this.element.store('validator', this);
  9345. if (this.options.evaluateOnSubmit) this.element.addEvent('submit', this._bound.onSubmit);
  9346. if (this.options.evaluateFieldsOnBlur){
  9347. this.element.addEvent('blur:relay(input,select,textarea)', this._bound.blurOrChange);
  9348. }
  9349. if (this.options.evaluateFieldsOnChange){
  9350. this.element.addEvent('change:relay(input,select,textarea)', this._bound.blurOrChange);
  9351. }
  9352. },
  9353. disable: function(){
  9354. this.element.eliminate('validator');
  9355. this.element.removeEvents({
  9356. submit: this._bound.onSubmit,
  9357. 'blur:relay(input,select,textarea)': this._bound.blurOrChange,
  9358. 'change:relay(input,select,textarea)': this._bound.blurOrChange
  9359. });
  9360. },
  9361. validationMonitor: function(){
  9362. clearTimeout(this.timer);
  9363. this.timer = this.validateField.delay(50, this, arguments);
  9364. },
  9365. onSubmit: function(event){
  9366. if (this.validate(event)) this.reset();
  9367. },
  9368. reset: function(){
  9369. this.getFields().each(this.resetField, this);
  9370. return this;
  9371. },
  9372. validate: function(event){
  9373. var result = this.getFields().map(function(field){
  9374. return this.validateField(field, true);
  9375. }, this).every(function(v){
  9376. return v;
  9377. });
  9378. this.fireEvent('formValidate', [result, this.element, event]);
  9379. if (this.options.stopOnFailure && !result && event) event.preventDefault();
  9380. return result;
  9381. },
  9382. validateField: function(field, force){
  9383. if (this.paused) return true;
  9384. field = document.id(field);
  9385. var passed = !field.hasClass('validation-failed');
  9386. var failed, warned;
  9387. if (this.options.serial && !force){
  9388. failed = this.element.getElement('.validation-failed');
  9389. warned = this.element.getElement('.warning');
  9390. }
  9391. if (field && (!failed || force || field.hasClass('validation-failed') || (failed && !this.options.serial))){
  9392. var validationTypes = field.get('validators');
  9393. var validators = validationTypes.some(function(cn){
  9394. return this.getValidator(cn);
  9395. }, this);
  9396. var validatorsFailed = [];
  9397. validationTypes.each(function(className){
  9398. if (className && !this.test(className, field)) validatorsFailed.include(className);
  9399. }, this);
  9400. passed = validatorsFailed.length === 0;
  9401. if (validators && !this.hasValidator(field, 'warnOnly')){
  9402. if (passed){
  9403. field.addClass('validation-passed').removeClass('validation-failed');
  9404. this.fireEvent('elementPass', [field]);
  9405. } else {
  9406. field.addClass('validation-failed').removeClass('validation-passed');
  9407. this.fireEvent('elementFail', [field, validatorsFailed]);
  9408. }
  9409. }
  9410. if (!warned){
  9411. var warnings = validationTypes.some(function(cn){
  9412. if (cn.test('^warn'))
  9413. return this.getValidator(cn.replace(/^warn-/,''));
  9414. else return null;
  9415. }, this);
  9416. field.removeClass('warning');
  9417. var warnResult = validationTypes.map(function(cn){
  9418. if (cn.test('^warn'))
  9419. return this.test(cn.replace(/^warn-/,''), field, true);
  9420. else return null;
  9421. }, this);
  9422. }
  9423. }
  9424. return passed;
  9425. },
  9426. test: function(className, field, warn){
  9427. field = document.id(field);
  9428. if ((this.options.ignoreHidden && !field.isVisible()) || (this.options.ignoreDisabled && field.get('disabled'))) return true;
  9429. var validator = this.getValidator(className);
  9430. if (warn != null) warn = false;
  9431. if (this.hasValidator(field, 'warnOnly')) warn = true;
  9432. var isValid = field.hasClass('ignoreValidation') || (validator ? validator.test(field) : true);
  9433. if (validator) this.fireEvent('elementValidate', [isValid, field, className, warn]);
  9434. if (warn) return true;
  9435. return isValid;
  9436. },
  9437. hasValidator: function(field, value){
  9438. return field.get('validators').contains(value);
  9439. },
  9440. resetField: function(field){
  9441. field = document.id(field);
  9442. if (field){
  9443. field.get('validators').each(function(className){
  9444. if (className.test('^warn-')) className = className.replace(/^warn-/, '');
  9445. field.removeClass('validation-failed');
  9446. field.removeClass('warning');
  9447. field.removeClass('validation-passed');
  9448. }, this);
  9449. }
  9450. return this;
  9451. },
  9452. stop: function(){
  9453. this.paused = true;
  9454. return this;
  9455. },
  9456. start: function(){
  9457. this.paused = false;
  9458. return this;
  9459. },
  9460. ignoreField: function(field, warn){
  9461. field = document.id(field);
  9462. if (field){
  9463. this.enforceField(field);
  9464. if (warn) field.addClass('warnOnly');
  9465. else field.addClass('ignoreValidation');
  9466. }
  9467. return this;
  9468. },
  9469. enforceField: function(field){
  9470. field = document.id(field);
  9471. if (field) field.removeClass('warnOnly').removeClass('ignoreValidation');
  9472. return this;
  9473. }
  9474. });
  9475. Form.Validator.getMsg = function(key){
  9476. return Locale.get('FormValidator.' + key);
  9477. };
  9478. Form.Validator.adders = {
  9479. validators:{},
  9480. add : function(className, options){
  9481. this.validators[className] = new InputValidator(className, options);
  9482. //if this is a class (this method is used by instances of Form.Validator and the Form.Validator namespace)
  9483. //extend these validators into it
  9484. //this allows validators to be global and/or per instance
  9485. if (!this.initialize){
  9486. this.implement({
  9487. validators: this.validators
  9488. });
  9489. }
  9490. },
  9491. addAllThese : function(validators){
  9492. Array.convert(validators).each(function(validator){
  9493. this.add(validator[0], validator[1]);
  9494. }, this);
  9495. },
  9496. getValidator: function(className){
  9497. return this.validators[className.split(':')[0]];
  9498. }
  9499. };
  9500. Object.append(Form.Validator, Form.Validator.adders);
  9501. Form.Validator.implement(Form.Validator.adders);
  9502. Form.Validator.add('IsEmpty', {
  9503. errorMsg: false,
  9504. test: function(element){
  9505. if (element.type == 'select-one' || element.type == 'select')
  9506. return !(element.selectedIndex >= 0 && element.options[element.selectedIndex].value != '');
  9507. else
  9508. return ((element.get('value') == null) || (element.get('value').length == 0));
  9509. }
  9510. });
  9511. Form.Validator.addAllThese([
  9512. ['required', {
  9513. errorMsg: function(){
  9514. return Form.Validator.getMsg('required');
  9515. },
  9516. test: function(element){
  9517. return !Form.Validator.getValidator('IsEmpty').test(element);
  9518. }
  9519. }],
  9520. ['length', {
  9521. errorMsg: function(element, props){
  9522. if (typeOf(props.length) != 'null')
  9523. return Form.Validator.getMsg('length').substitute({length: props.length, elLength: element.get('value').length});
  9524. else return '';
  9525. },
  9526. test: function(element, props){
  9527. if (typeOf(props.length) != 'null') return (element.get('value').length == props.length || element.get('value').length == 0);
  9528. else return true;
  9529. }
  9530. }],
  9531. ['minLength', {
  9532. errorMsg: function(element, props){
  9533. if (typeOf(props.minLength) != 'null')
  9534. return Form.Validator.getMsg('minLength').substitute({minLength: props.minLength, length: element.get('value').length});
  9535. else return '';
  9536. },
  9537. test: function(element, props){
  9538. if (typeOf(props.minLength) != 'null') return (element.get('value').length >= (props.minLength || 0));
  9539. else return true;
  9540. }
  9541. }],
  9542. ['maxLength', {
  9543. errorMsg: function(element, props){
  9544. //props is {maxLength:10}
  9545. if (typeOf(props.maxLength) != 'null')
  9546. return Form.Validator.getMsg('maxLength').substitute({maxLength: props.maxLength, length: element.get('value').length});
  9547. else return '';
  9548. },
  9549. test: function(element, props){
  9550. return element.get('value').length <= (props.maxLength || 10000);
  9551. }
  9552. }],
  9553. ['validate-integer', {
  9554. errorMsg: Form.Validator.getMsg.pass('integer'),
  9555. test: function(element){
  9556. return Form.Validator.getValidator('IsEmpty').test(element) || (/^(-?[1-9]\d*|0)$/).test(element.get('value'));
  9557. }
  9558. }],
  9559. ['validate-numeric', {
  9560. errorMsg: Form.Validator.getMsg.pass('numeric'),
  9561. test: function(element){
  9562. return Form.Validator.getValidator('IsEmpty').test(element) ||
  9563. (/^-?(?:0$0(?=\d*\.)|[1-9]|0)\d*(\.\d+)?$/).test(element.get('value'));
  9564. }
  9565. }],
  9566. ['validate-digits', {
  9567. errorMsg: Form.Validator.getMsg.pass('digits'),
  9568. test: function(element){
  9569. return Form.Validator.getValidator('IsEmpty').test(element) || (/^[\d() .:\-\+#]+$/.test(element.get('value')));
  9570. }
  9571. }],
  9572. ['validate-alpha', {
  9573. errorMsg: Form.Validator.getMsg.pass('alpha'),
  9574. test: function(element){
  9575. return Form.Validator.getValidator('IsEmpty').test(element) || (/^[a-zA-Z]+$/).test(element.get('value'));
  9576. }
  9577. }],
  9578. ['validate-alphanum', {
  9579. errorMsg: Form.Validator.getMsg.pass('alphanum'),
  9580. test: function(element){
  9581. return Form.Validator.getValidator('IsEmpty').test(element) || !(/\W/).test(element.get('value'));
  9582. }
  9583. }],
  9584. ['validate-date', {
  9585. errorMsg: function(element, props){
  9586. if (Date.parse){
  9587. var format = props.dateFormat || '%x';
  9588. return Form.Validator.getMsg('dateSuchAs').substitute({date: new Date().format(format)});
  9589. } else {
  9590. return Form.Validator.getMsg('dateInFormatMDY');
  9591. }
  9592. },
  9593. test: function(element, props){
  9594. if (Form.Validator.getValidator('IsEmpty').test(element)) return true;
  9595. var dateLocale = Locale.get('Date'),
  9596. dateNouns = new RegExp([dateLocale.days, dateLocale.days_abbr, dateLocale.months, dateLocale.months_abbr, dateLocale.AM, dateLocale.PM].flatten().join('|'), 'i'),
  9597. value = element.get('value'),
  9598. wordsInValue = value.match(/[a-z]+/gi);
  9599. if (wordsInValue && !wordsInValue.every(dateNouns.exec, dateNouns)) return false;
  9600. var date = Date.parse(value);
  9601. if (!date) return false;
  9602. var format = props.dateFormat || '%x',
  9603. formatted = date.format(format);
  9604. if (formatted != 'invalid date') element.set('value', formatted);
  9605. return date.isValid();
  9606. }
  9607. }],
  9608. ['validate-email', {
  9609. errorMsg: Form.Validator.getMsg.pass('email'),
  9610. test: function(element){
  9611. /*
  9612. var chars = "[a-z0-9!#$%&'*+/=?^_`{|}~-]",
  9613. local = '(?:' + chars + '\\.?){0,63}' + chars,
  9614. label = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?',
  9615. hostname = '(?:' + label + '\\.)*' + label;
  9616. octet = '(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',
  9617. ipv4 = '\\[(?:' + octet + '\\.){3}' + octet + '\\]',
  9618. domain = '(?:' + hostname + '|' + ipv4 + ')';
  9619. var regex = new RegExp('^' + local + '@' + domain + '$', 'i');
  9620. */
  9621. 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'));
  9622. }
  9623. }],
  9624. ['validate-url', {
  9625. errorMsg: Form.Validator.getMsg.pass('url'),
  9626. test: function(element){
  9627. 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'));
  9628. }
  9629. }],
  9630. ['validate-currency-dollar', {
  9631. errorMsg: Form.Validator.getMsg.pass('currencyDollar'),
  9632. test: function(element){
  9633. 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'));
  9634. }
  9635. }],
  9636. ['validate-one-required', {
  9637. errorMsg: Form.Validator.getMsg.pass('oneRequired'),
  9638. test: function(element, props){
  9639. var p = document.id(props['validate-one-required']) || element.getParent(props['validate-one-required']);
  9640. return p.getElements('input').some(function(el){
  9641. if (['checkbox', 'radio'].contains(el.get('type'))) return el.get('checked');
  9642. return el.get('value');
  9643. });
  9644. }
  9645. }]
  9646. ]);
  9647. Element.Properties.validator = {
  9648. set: function(options){
  9649. this.get('validator').setOptions(options);
  9650. },
  9651. get: function(){
  9652. var validator = this.retrieve('validator');
  9653. if (!validator){
  9654. validator = new Form.Validator(this);
  9655. this.store('validator', validator);
  9656. }
  9657. return validator;
  9658. }
  9659. };
  9660. Element.implement({
  9661. validate: function(options){
  9662. if (options) this.set('validator', options);
  9663. return this.get('validator').validate();
  9664. }
  9665. });
  9666. //<1.2compat>
  9667. //legacy
  9668. var FormValidator = Form.Validator;
  9669. //</1.2compat>
  9670. /*
  9671. ---
  9672. script: Form.Validator.Extras.js
  9673. name: Form.Validator.Extras
  9674. description: Additional validators for the Form.Validator class.
  9675. license: MIT-style license
  9676. authors:
  9677. - Aaron Newton
  9678. requires:
  9679. - Form.Validator
  9680. provides: [Form.Validator.Extras]
  9681. ...
  9682. */
  9683. (function(){
  9684. function getItems(props, preference, children, cssSelector){
  9685. if (preference && props[preference]) return props[preference];
  9686. var el = document.id(props[children]);
  9687. if (!el) return [];
  9688. return el.getElements(cssSelector);
  9689. }
  9690. Form.Validator.addAllThese([
  9691. ['validate-enforce-oncheck', {
  9692. test: function(element, props){
  9693. var fv = element.getParent('form').retrieve('validator');
  9694. if (!fv) return true;
  9695. getItems(props, 'toEnforce', 'enforceChildrenOf', 'input, select, textarea').each(function(item){
  9696. if (element.checked){
  9697. fv.enforceField(item);
  9698. } else {
  9699. fv.ignoreField(item);
  9700. fv.resetField(item);
  9701. }
  9702. });
  9703. return true;
  9704. }
  9705. }],
  9706. ['validate-ignore-oncheck', {
  9707. test: function(element, props){
  9708. var fv = element.getParent('form').retrieve('validator');
  9709. if (!fv) return true;
  9710. getItems(props, 'toIgnore', 'ignoreChildrenOf', 'input, select, textarea').each(function(item){
  9711. if (element.checked){
  9712. fv.ignoreField(item);
  9713. fv.resetField(item);
  9714. } else {
  9715. fv.enforceField(item);
  9716. }
  9717. });
  9718. return true;
  9719. }
  9720. }],
  9721. ['validate-enforce-onselect-value', {
  9722. test: function(element, props){
  9723. if (!props.value) return true;
  9724. var fv = element.getParent('form').retrieve('validator');
  9725. if (!fv) return true;
  9726. getItems(props, 'toEnforce', 'enforceChildrenOf', 'input, select, textarea').each(function(item){
  9727. if (props.value == element.value){
  9728. fv.enforceField(item);
  9729. } else {
  9730. fv.ignoreField(item);
  9731. fv.resetField(item);
  9732. }
  9733. });
  9734. return true;
  9735. }
  9736. }],
  9737. ['validate-nospace', {
  9738. errorMsg: function(){
  9739. return Form.Validator.getMsg('noSpace');
  9740. },
  9741. test: function(element, props){
  9742. return !element.get('value').test(/\s/);
  9743. }
  9744. }],
  9745. ['validate-toggle-oncheck', {
  9746. test: function(element, props){
  9747. var fv = element.getParent('form').retrieve('validator');
  9748. if (!fv) return true;
  9749. var eleArr = getItems(props, 'toToggle', 'toToggleChildrenOf', 'input, select, textarea');
  9750. if (!element.checked){
  9751. eleArr.each(function(item){
  9752. fv.ignoreField(item);
  9753. fv.resetField(item);
  9754. });
  9755. } else {
  9756. eleArr.each(function(item){
  9757. fv.enforceField(item);
  9758. });
  9759. }
  9760. return true;
  9761. }
  9762. }],
  9763. ['validate-reqchk-bynode', {
  9764. errorMsg: function(){
  9765. return Form.Validator.getMsg('reqChkByNode');
  9766. },
  9767. test: function(element, props){
  9768. return getItems(props, false, 'nodeId', props.selector || 'input[type=checkbox], input[type=radio]').some(function(item){
  9769. return item.checked;
  9770. });
  9771. }
  9772. }],
  9773. ['validate-required-check', {
  9774. errorMsg: function(element, props){
  9775. return props.useTitle ? element.get('title') : Form.Validator.getMsg('requiredChk');
  9776. },
  9777. test: function(element, props){
  9778. return !!element.checked;
  9779. }
  9780. }],
  9781. ['validate-reqchk-byname', {
  9782. errorMsg: function(element, props){
  9783. return Form.Validator.getMsg('reqChkByName').substitute({label: props.label || element.get('type')});
  9784. },
  9785. test: function(element, props){
  9786. var grpName = props.groupName || element.get('name');
  9787. var grpNameEls = $$('[name=' + grpName +']');
  9788. var oneCheckedItem = grpNameEls.some(function(item, index){
  9789. return item.checked;
  9790. });
  9791. var fv = element.getParent('form').retrieve('validator');
  9792. if (oneCheckedItem && fv){
  9793. grpNameEls.each(function(item, index){ fv.resetField(item); });
  9794. }
  9795. return oneCheckedItem;
  9796. }
  9797. }],
  9798. ['validate-match', {
  9799. errorMsg: function(element, props){
  9800. return Form.Validator.getMsg('match').substitute({matchName: decodeURIComponent((props.matchName+'').replace(/\+/g, '%20')) || document.id(props.matchInput).get('name')});
  9801. },
  9802. test: function(element, props){
  9803. var eleVal = element.get('value');
  9804. var matchVal = document.id(props.matchInput) && document.id(props.matchInput).get('value');
  9805. return eleVal && matchVal ? eleVal == matchVal : true;
  9806. }
  9807. }],
  9808. ['validate-after-date', {
  9809. errorMsg: function(element, props){
  9810. return Form.Validator.getMsg('afterDate').substitute({
  9811. label: props.afterLabel || (props.afterElement ? Form.Validator.getMsg('startDate') : Form.Validator.getMsg('currentDate'))
  9812. });
  9813. },
  9814. test: function(element, props){
  9815. var start = document.id(props.afterElement) ? Date.parse(document.id(props.afterElement).get('value')) : new Date();
  9816. var end = Date.parse(element.get('value'));
  9817. return end && start ? end >= start : true;
  9818. }
  9819. }],
  9820. ['validate-before-date', {
  9821. errorMsg: function(element, props){
  9822. return Form.Validator.getMsg('beforeDate').substitute({
  9823. label: props.beforeLabel || (props.beforeElement ? Form.Validator.getMsg('endDate') : Form.Validator.getMsg('currentDate'))
  9824. });
  9825. },
  9826. test: function(element, props){
  9827. var start = Date.parse(element.get('value'));
  9828. var end = document.id(props.beforeElement) ? Date.parse(document.id(props.beforeElement).get('value')) : new Date();
  9829. return end && start ? end >= start : true;
  9830. }
  9831. }],
  9832. ['validate-custom-required', {
  9833. errorMsg: function(){
  9834. return Form.Validator.getMsg('required');
  9835. },
  9836. test: function(element, props){
  9837. return element.get('value') != props.emptyValue;
  9838. }
  9839. }],
  9840. ['validate-same-month', {
  9841. errorMsg: function(element, props){
  9842. var startMo = document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value');
  9843. var eleVal = element.get('value');
  9844. if (eleVal != '') return Form.Validator.getMsg(startMo ? 'sameMonth' : 'startMonth');
  9845. },
  9846. test: function(element, props){
  9847. var d1 = Date.parse(element.get('value'));
  9848. var d2 = Date.parse(document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value'));
  9849. return d1 && d2 ? d1.format('%B') == d2.format('%B') : true;
  9850. }
  9851. }],
  9852. ['validate-cc-num', {
  9853. errorMsg: function(element){
  9854. var ccNum = element.get('value').replace(/[^0-9]/g, '');
  9855. return Form.Validator.getMsg('creditcard').substitute({length: ccNum.length});
  9856. },
  9857. test: function(element){
  9858. // required is a different test
  9859. if (Form.Validator.getValidator('IsEmpty').test(element)) return true;
  9860. // Clean number value
  9861. var ccNum = element.get('value');
  9862. ccNum = ccNum.replace(/[^0-9]/g, '');
  9863. var validType = false;
  9864. if (ccNum.test(/^4[0-9]{12}([0-9]{3})?$/)) validType = 'Visa';
  9865. else if (ccNum.test(/^5[1-5]([0-9]{14})$/)) validType = 'Master Card';
  9866. else if (ccNum.test(/^3[47][0-9]{13}$/)) validType = 'American Express';
  9867. else if (ccNum.test(/^6(?:011|5[0-9]{2})[0-9]{12}$/)) validType = 'Discover';
  9868. else if (ccNum.test(/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/)) validType = 'Diners Club';
  9869. if (validType){
  9870. var sum = 0;
  9871. var cur = 0;
  9872. for (var i=ccNum.length-1; i>=0; --i){
  9873. cur = ccNum.charAt(i).toInt();
  9874. if (cur == 0) continue;
  9875. if ((ccNum.length-i) % 2 == 0) cur += cur;
  9876. if (cur > 9){
  9877. cur = cur.toString().charAt(0).toInt() + cur.toString().charAt(1).toInt();
  9878. }
  9879. sum += cur;
  9880. }
  9881. if ((sum % 10) == 0) return true;
  9882. }
  9883. var chunks = '';
  9884. while (ccNum != ''){
  9885. chunks += ' ' + ccNum.substr(0,4);
  9886. ccNum = ccNum.substr(4);
  9887. }
  9888. element.getParent('form').retrieve('validator').ignoreField(element);
  9889. element.set('value', chunks.clean());
  9890. element.getParent('form').retrieve('validator').enforceField(element);
  9891. return false;
  9892. }
  9893. }]
  9894. ]);
  9895. })();
  9896. /*
  9897. ---
  9898. script: Form.Validator.Inline.js
  9899. name: Form.Validator.Inline
  9900. description: Extends Form.Validator to add inline messages.
  9901. license: MIT-style license
  9902. authors:
  9903. - Aaron Newton
  9904. requires:
  9905. - Form.Validator
  9906. provides: [Form.Validator.Inline]
  9907. ...
  9908. */
  9909. Form.Validator.Inline = new Class({
  9910. Extends: Form.Validator,
  9911. options: {
  9912. showError: function(errorElement){
  9913. if (errorElement.reveal) errorElement.reveal();
  9914. else errorElement.setStyle('display', 'block');
  9915. },
  9916. hideError: function(errorElement){
  9917. if (errorElement.dissolve) errorElement.dissolve();
  9918. else errorElement.setStyle('display', 'none');
  9919. },
  9920. scrollToErrorsOnSubmit: true,
  9921. scrollToErrorsOnBlur: false,
  9922. scrollToErrorsOnChange: false,
  9923. scrollFxOptions: {
  9924. transition: 'quad:out',
  9925. offset: {
  9926. y: -20
  9927. }
  9928. }
  9929. },
  9930. initialize: function(form, options){
  9931. this.parent(form, options);
  9932. this.addEvent('onElementValidate', function(isValid, field, className, warn){
  9933. var validator = this.getValidator(className);
  9934. if (!isValid && validator.getError(field)){
  9935. if (warn) field.addClass('warning');
  9936. var advice = this.makeAdvice(className, field, validator.getError(field), warn);
  9937. this.insertAdvice(advice, field);
  9938. this.showAdvice(className, field);
  9939. } else {
  9940. this.hideAdvice(className, field);
  9941. }
  9942. });
  9943. },
  9944. makeAdvice: function(className, field, error, warn){
  9945. var errorMsg = (warn) ? this.warningPrefix : this.errorPrefix;
  9946. errorMsg += (this.options.useTitles) ? field.title || error:error;
  9947. var cssClass = (warn) ? 'warning-advice' : 'validation-advice';
  9948. var advice = this.getAdvice(className, field);
  9949. if (advice){
  9950. advice = advice.set('html', errorMsg);
  9951. } else {
  9952. advice = new Element('div', {
  9953. html: errorMsg,
  9954. styles: { display: 'none' },
  9955. id: 'advice-' + className.split(':')[0] + '-' + this.getFieldId(field)
  9956. }).addClass(cssClass);
  9957. }
  9958. field.store('$moo:advice-' + className, advice);
  9959. return advice;
  9960. },
  9961. getFieldId : function(field){
  9962. return field.id ? field.id : field.id = 'input_' + field.name;
  9963. },
  9964. showAdvice: function(className, field){
  9965. var advice = this.getAdvice(className, field);
  9966. if (
  9967. advice &&
  9968. !field.retrieve('$moo:' + this.getPropName(className)) &&
  9969. (
  9970. advice.getStyle('display') == 'none' ||
  9971. advice.getStyle('visibility') == 'hidden' ||
  9972. advice.getStyle('opacity') == 0
  9973. )
  9974. ){
  9975. field.store('$moo:' + this.getPropName(className), true);
  9976. this.options.showError(advice);
  9977. this.fireEvent('showAdvice', [field, advice, className]);
  9978. }
  9979. },
  9980. hideAdvice: function(className, field){
  9981. var advice = this.getAdvice(className, field);
  9982. if (advice && field.retrieve('$moo:' + this.getPropName(className))){
  9983. field.store('$moo:' + this.getPropName(className), false);
  9984. this.options.hideError(advice);
  9985. this.fireEvent('hideAdvice', [field, advice, className]);
  9986. }
  9987. },
  9988. getPropName: function(className){
  9989. return 'advice' + className;
  9990. },
  9991. resetField: function(field){
  9992. field = document.id(field);
  9993. if (!field) return this;
  9994. this.parent(field);
  9995. field.get('validators').each(function(className){
  9996. this.hideAdvice(className, field);
  9997. }, this);
  9998. return this;
  9999. },
  10000. getAllAdviceMessages: function(field, force){
  10001. var advice = [];
  10002. if (field.hasClass('ignoreValidation') && !force) return advice;
  10003. var validators = field.get('validators').some(function(cn){
  10004. var warner = cn.test('^warn-') || field.hasClass('warnOnly');
  10005. if (warner) cn = cn.replace(/^warn-/, '');
  10006. var validator = this.getValidator(cn);
  10007. if (!validator) return;
  10008. advice.push({
  10009. message: validator.getError(field),
  10010. warnOnly: warner,
  10011. passed: validator.test(),
  10012. validator: validator
  10013. });
  10014. }, this);
  10015. return advice;
  10016. },
  10017. getAdvice: function(className, field){
  10018. return field.retrieve('$moo:advice-' + className);
  10019. },
  10020. insertAdvice: function(advice, field){
  10021. //Check for error position prop
  10022. var props = field.get('validatorProps');
  10023. //Build advice
  10024. if (!props.msgPos || !document.id(props.msgPos)){
  10025. if (field.type && field.type.toLowerCase() == 'radio') field.getParent().adopt(advice);
  10026. else advice.inject(document.id(field), 'after');
  10027. } else {
  10028. document.id(props.msgPos).grab(advice);
  10029. }
  10030. },
  10031. validateField: function(field, force, scroll){
  10032. var result = this.parent(field, force);
  10033. if (((this.options.scrollToErrorsOnSubmit && scroll == null) || scroll) && !result){
  10034. var failed = document.id(this).getElement('.validation-failed');
  10035. var par = document.id(this).getParent();
  10036. while (par != document.body && par.getScrollSize().y == par.getSize().y){
  10037. par = par.getParent();
  10038. }
  10039. var fx = par.retrieve('$moo:fvScroller');
  10040. if (!fx && window.Fx && Fx.Scroll){
  10041. fx = new Fx.Scroll(par, this.options.scrollFxOptions);
  10042. par.store('$moo:fvScroller', fx);
  10043. }
  10044. if (failed){
  10045. if (fx) fx.toElement(failed);
  10046. else par.scrollTo(par.getScroll().x, failed.getPosition(par).y - 20);
  10047. }
  10048. }
  10049. return result;
  10050. },
  10051. watchFields: function(fields){
  10052. fields.each(function(el){
  10053. if (this.options.evaluateFieldsOnBlur){
  10054. el.addEvent('blur', this.validationMonitor.pass([el, false, this.options.scrollToErrorsOnBlur], this));
  10055. }
  10056. if (this.options.evaluateFieldsOnChange){
  10057. el.addEvent('change', this.validationMonitor.pass([el, true, this.options.scrollToErrorsOnChange], this));
  10058. }
  10059. }, this);
  10060. }
  10061. });
  10062. /*
  10063. ---
  10064. script: OverText.js
  10065. name: OverText
  10066. description: Shows text over an input that disappears when the user clicks into it. The text remains hidden if the user adds a value.
  10067. license: MIT-style license
  10068. authors:
  10069. - Aaron Newton
  10070. requires:
  10071. - Core/Options
  10072. - Core/Events
  10073. - Core/Element.Event
  10074. - Class.Binds
  10075. - Class.Occlude
  10076. - Element.Position
  10077. - Element.Shortcuts
  10078. provides: [OverText]
  10079. ...
  10080. */
  10081. (function(){
  10082. var OverText = this.OverText = new Class({
  10083. Implements: [Options, Events, Class.Occlude],
  10084. Binds: ['reposition', 'assert', 'focus', 'hide'],
  10085. options: {/*
  10086. textOverride: null,
  10087. onFocus: function(){},
  10088. onTextHide: function(textEl, inputEl){},
  10089. onTextShow: function(textEl, inputEl){}, */
  10090. element: 'label',
  10091. labelClass: 'overTxtLabel',
  10092. positionOptions: {
  10093. position: 'upperLeft',
  10094. edge: 'upperLeft',
  10095. offset: {
  10096. x: 4,
  10097. y: 2
  10098. }
  10099. },
  10100. poll: false,
  10101. pollInterval: 250,
  10102. wrap: false
  10103. },
  10104. property: 'OverText',
  10105. initialize: function(element, options){
  10106. element = this.element = document.id(element);
  10107. if (this.occlude()) return this.occluded;
  10108. this.setOptions(options);
  10109. this.attach(element);
  10110. OverText.instances.push(this);
  10111. if (this.options.poll) this.poll();
  10112. },
  10113. toElement: function(){
  10114. return this.element;
  10115. },
  10116. attach: function(){
  10117. var element = this.element,
  10118. options = this.options,
  10119. value = options.textOverride || element.get('alt') || element.get('title');
  10120. if (!value) return this;
  10121. var text = this.text = new Element(options.element, {
  10122. 'class': options.labelClass,
  10123. styles: {
  10124. lineHeight: 'normal',
  10125. position: 'absolute',
  10126. cursor: 'text'
  10127. },
  10128. html: value,
  10129. events: {
  10130. click: this.hide.pass(options.element == 'label', this)
  10131. }
  10132. }).inject(element, 'after');
  10133. if (options.element == 'label'){
  10134. if (!element.get('id')) element.set('id', 'input_' + String.uniqueID());
  10135. text.set('for', element.get('id'));
  10136. }
  10137. if (options.wrap){
  10138. this.textHolder = new Element('div.overTxtWrapper', {
  10139. styles: {
  10140. lineHeight: 'normal',
  10141. position: 'relative'
  10142. }
  10143. }).grab(text).inject(element, 'before');
  10144. }
  10145. return this.enable();
  10146. },
  10147. destroy: function(){
  10148. this.element.eliminate(this.property); // Class.Occlude storage
  10149. this.disable();
  10150. if (this.text) this.text.destroy();
  10151. if (this.textHolder) this.textHolder.destroy();
  10152. return this;
  10153. },
  10154. disable: function(){
  10155. this.element.removeEvents({
  10156. focus: this.focus,
  10157. blur: this.assert,
  10158. change: this.assert
  10159. });
  10160. window.removeEvent('resize', this.reposition);
  10161. this.hide(true, true);
  10162. return this;
  10163. },
  10164. enable: function(){
  10165. this.element.addEvents({
  10166. focus: this.focus,
  10167. blur: this.assert,
  10168. change: this.assert
  10169. });
  10170. window.addEvent('resize', this.reposition);
  10171. this.reposition();
  10172. return this;
  10173. },
  10174. wrap: function(){
  10175. if (this.options.element == 'label'){
  10176. if (!this.element.get('id')) this.element.set('id', 'input_' + String.uniqueID());
  10177. this.text.set('for', this.element.get('id'));
  10178. }
  10179. },
  10180. startPolling: function(){
  10181. this.pollingPaused = false;
  10182. return this.poll();
  10183. },
  10184. poll: function(stop){
  10185. //start immediately
  10186. //pause on focus
  10187. //resumeon blur
  10188. if (this.poller && !stop) return this;
  10189. if (stop){
  10190. clearInterval(this.poller);
  10191. } else {
  10192. this.poller = (function(){
  10193. if (!this.pollingPaused) this.assert(true);
  10194. }).periodical(this.options.pollInterval, this);
  10195. }
  10196. return this;
  10197. },
  10198. stopPolling: function(){
  10199. this.pollingPaused = true;
  10200. return this.poll(true);
  10201. },
  10202. focus: function(){
  10203. if (this.text && (!this.text.isDisplayed() || this.element.get('disabled'))) return this;
  10204. return this.hide();
  10205. },
  10206. hide: function(suppressFocus, force){
  10207. if (this.text && (this.text.isDisplayed() && (!this.element.get('disabled') || force))){
  10208. this.text.hide();
  10209. this.fireEvent('textHide', [this.text, this.element]);
  10210. this.pollingPaused = true;
  10211. if (!suppressFocus){
  10212. try {
  10213. this.element.fireEvent('focus');
  10214. this.element.focus();
  10215. } catch (e){} //IE barfs if you call focus on hidden elements
  10216. }
  10217. }
  10218. return this;
  10219. },
  10220. show: function(){
  10221. if (document.id(this.text) && !this.text.isDisplayed()){
  10222. this.text.show();
  10223. this.reposition();
  10224. this.fireEvent('textShow', [this.text, this.element]);
  10225. this.pollingPaused = false;
  10226. }
  10227. return this;
  10228. },
  10229. test: function(){
  10230. return !this.element.get('value');
  10231. },
  10232. assert: function(suppressFocus){
  10233. return this[this.test() ? 'show' : 'hide'](suppressFocus);
  10234. },
  10235. reposition: function(){
  10236. this.assert(true);
  10237. if (!this.element.isVisible()) return this.stopPolling().hide();
  10238. if (this.text && this.test()){
  10239. this.text.position(Object.merge(this.options.positionOptions, {
  10240. relativeTo: this.element
  10241. }));
  10242. }
  10243. return this;
  10244. }
  10245. });
  10246. })();
  10247. OverText.instances = [];
  10248. Object.append(OverText, {
  10249. each: function(fn){
  10250. return OverText.instances.each(function(ot, i){
  10251. if (ot.element && ot.text) fn.call(OverText, ot, i);
  10252. });
  10253. },
  10254. update: function(){
  10255. return OverText.each(function(ot){
  10256. return ot.reposition();
  10257. });
  10258. },
  10259. hideAll: function(){
  10260. return OverText.each(function(ot){
  10261. return ot.hide(true, true);
  10262. });
  10263. },
  10264. showAll: function(){
  10265. return OverText.each(function(ot){
  10266. return ot.show();
  10267. });
  10268. }
  10269. });
  10270. /*
  10271. ---
  10272. script: Fx.Elements.js
  10273. name: Fx.Elements
  10274. description: Effect to change any number of CSS properties of any number of Elements.
  10275. license: MIT-style license
  10276. authors:
  10277. - Valerio Proietti
  10278. requires:
  10279. - Core/Fx.CSS
  10280. - MooTools.More
  10281. provides: [Fx.Elements]
  10282. ...
  10283. */
  10284. Fx.Elements = new Class({
  10285. Extends: Fx.CSS,
  10286. initialize: function(elements, options){
  10287. this.elements = this.subject = $$(elements);
  10288. this.parent(options);
  10289. },
  10290. compute: function(from, to, delta){
  10291. var now = {};
  10292. for (var i in from){
  10293. var iFrom = from[i], iTo = to[i], iNow = now[i] = {};
  10294. for (var p in iFrom) iNow[p] = this.parent(iFrom[p], iTo[p], delta);
  10295. }
  10296. return now;
  10297. },
  10298. set: function(now){
  10299. for (var i in now){
  10300. if (!this.elements[i]) continue;
  10301. var iNow = now[i];
  10302. for (var p in iNow) this.render(this.elements[i], p, iNow[p], this.options.unit);
  10303. }
  10304. return this;
  10305. },
  10306. start: function(obj){
  10307. if (!this.check(obj)) return this;
  10308. var from = {}, to = {};
  10309. for (var i in obj){
  10310. if (!this.elements[i]) continue;
  10311. var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {};
  10312. for (var p in iProps){
  10313. var parsed = this.prepare(this.elements[i], p, iProps[p]);
  10314. iFrom[p] = parsed.from;
  10315. iTo[p] = parsed.to;
  10316. }
  10317. }
  10318. return this.parent(from, to);
  10319. }
  10320. });
  10321. /*
  10322. ---
  10323. script: Fx.Accordion.js
  10324. name: Fx.Accordion
  10325. description: An Fx.Elements extension which allows you to easily create accordion type controls.
  10326. license: MIT-style license
  10327. authors:
  10328. - Valerio Proietti
  10329. requires:
  10330. - Core/Element.Event
  10331. - Fx.Elements
  10332. provides: [Fx.Accordion]
  10333. ...
  10334. */
  10335. Fx.Accordion = new Class({
  10336. Extends: Fx.Elements,
  10337. options: {/*
  10338. onActive: function(toggler, section){},
  10339. onBackground: function(toggler, section){},*/
  10340. fixedHeight: false,
  10341. fixedWidth: false,
  10342. display: 0,
  10343. show: false,
  10344. height: true,
  10345. width: false,
  10346. opacity: true,
  10347. alwaysHide: false,
  10348. trigger: 'click',
  10349. initialDisplayFx: true,
  10350. resetHeight: true,
  10351. keepOpen: false
  10352. },
  10353. initialize: function(){
  10354. var defined = function(obj){
  10355. return obj != null;
  10356. };
  10357. var params = Array.link(arguments, {
  10358. 'container': Type.isElement, //deprecated
  10359. 'options': Type.isObject,
  10360. 'togglers': defined,
  10361. 'elements': defined
  10362. });
  10363. this.parent(params.elements, params.options);
  10364. var options = this.options,
  10365. togglers = this.togglers = $$(params.togglers);
  10366. this.previous = -1;
  10367. this.internalChain = new Chain();
  10368. if (options.alwaysHide) this.options.link = 'chain';
  10369. if (options.show || this.options.show === 0){
  10370. options.display = false;
  10371. this.previous = options.show;
  10372. }
  10373. if (options.start){
  10374. options.display = false;
  10375. options.show = false;
  10376. }
  10377. var effects = this.effects = {};
  10378. if (options.opacity) effects.opacity = 'fullOpacity';
  10379. if (options.width) effects.width = options.fixedWidth ? 'fullWidth' : 'offsetWidth';
  10380. if (options.height) effects.height = options.fixedHeight ? 'fullHeight' : 'scrollHeight';
  10381. for (var i = 0, l = togglers.length; i < l; i++) this.addSection(togglers[i], this.elements[i]);
  10382. this.elements.each(function(el, i){
  10383. if (options.show === i){
  10384. this.fireEvent('active', [togglers[i], el]);
  10385. } else {
  10386. for (var fx in effects) el.setStyle(fx, 0);
  10387. }
  10388. }, this);
  10389. if (options.display || options.display === 0 || options.initialDisplayFx === false){
  10390. this.display(options.display, options.initialDisplayFx);
  10391. }
  10392. if (options.fixedHeight !== false) options.resetHeight = false;
  10393. this.addEvent('complete', this.internalChain.callChain.bind(this.internalChain));
  10394. },
  10395. addSection: function(toggler, element){
  10396. toggler = document.id(toggler);
  10397. element = document.id(element);
  10398. this.togglers.include(toggler);
  10399. this.elements.include(element);
  10400. var togglers = this.togglers,
  10401. options = this.options,
  10402. test = togglers.contains(toggler),
  10403. idx = togglers.indexOf(toggler),
  10404. displayer = this.display.pass(idx, this);
  10405. toggler.store('accordion:display', displayer)
  10406. .addEvent(options.trigger, displayer);
  10407. if (options.height) element.setStyles({'padding-top': 0, 'border-top': 'none', 'padding-bottom': 0, 'border-bottom': 'none'});
  10408. if (options.width) element.setStyles({'padding-left': 0, 'border-left': 'none', 'padding-right': 0, 'border-right': 'none'});
  10409. element.fullOpacity = 1;
  10410. if (options.fixedWidth) element.fullWidth = options.fixedWidth;
  10411. if (options.fixedHeight) element.fullHeight = options.fixedHeight;
  10412. element.setStyle('overflow', 'hidden');
  10413. if (!test) for (var fx in this.effects){
  10414. element.setStyle(fx, 0);
  10415. }
  10416. return this;
  10417. },
  10418. removeSection: function(toggler, displayIndex){
  10419. var togglers = this.togglers,
  10420. idx = togglers.indexOf(toggler),
  10421. element = this.elements[idx];
  10422. var remover = function(){
  10423. togglers.erase(toggler);
  10424. this.elements.erase(element);
  10425. this.detach(toggler);
  10426. }.bind(this);
  10427. if (this.now == idx || displayIndex != null){
  10428. this.display(displayIndex != null ? displayIndex : (idx - 1 >= 0 ? idx - 1 : 0)).chain(remover);
  10429. } else {
  10430. remover();
  10431. }
  10432. return this;
  10433. },
  10434. detach: function(toggler){
  10435. var remove = function(toggler){
  10436. toggler.removeEvent(this.options.trigger, toggler.retrieve('accordion:display'));
  10437. }.bind(this);
  10438. if (!toggler) this.togglers.each(remove);
  10439. else remove(toggler);
  10440. return this;
  10441. },
  10442. display: function(index, useFx){
  10443. if (!this.check(index, useFx)) return this;
  10444. var obj = {},
  10445. elements = this.elements,
  10446. options = this.options,
  10447. effects = this.effects,
  10448. keepOpen = options.keepOpen,
  10449. alwaysHide = options.alwaysHide;
  10450. if (useFx == null) useFx = true;
  10451. if (typeOf(index) == 'element') index = elements.indexOf(index);
  10452. if (index == this.current && !alwaysHide && !keepOpen) return this;
  10453. if (options.resetHeight){
  10454. var prev = elements[this.current];
  10455. if (prev && !this.selfHidden){
  10456. for (var fx in effects) prev.setStyle(fx, prev[effects[fx]]);
  10457. }
  10458. }
  10459. if (this.timer && options.link == 'chain') return this;
  10460. if (this.current != null) this.previous = this.current;
  10461. this.current = index;
  10462. this.selfHidden = false;
  10463. elements.each(function(el, i){
  10464. obj[i] = {};
  10465. var hide, isOpen;
  10466. if (!keepOpen || i == index){
  10467. if (i == index) isOpen = (el.offsetHeight > 0 && options.height) || (el.offsetWidth > 0 && options.width);
  10468. if (i != index){
  10469. hide = true;
  10470. } else if ((alwaysHide || keepOpen) && isOpen){
  10471. hide = true;
  10472. this.selfHidden = true;
  10473. }
  10474. this.fireEvent(hide ? 'background' : 'active', [this.togglers[i], el]);
  10475. for (var fx in effects) obj[i][fx] = hide ? 0 : el[effects[fx]];
  10476. if (!useFx && !hide && options.resetHeight) obj[i].height = 'auto';
  10477. }
  10478. }, this);
  10479. this.internalChain.clearChain();
  10480. this.internalChain.chain(function(){
  10481. if (options.resetHeight && !this.selfHidden){
  10482. var el = elements[index];
  10483. if (el) el.setStyle('height', 'auto');
  10484. }
  10485. }.bind(this));
  10486. return useFx ? this.start(obj) : this.set(obj).internalChain.callChain();
  10487. }
  10488. });
  10489. /*<1.2compat>*/
  10490. /*
  10491. Compatibility with 1.2.0
  10492. */
  10493. var Accordion = new Class({
  10494. Extends: Fx.Accordion,
  10495. initialize: function(){
  10496. this.parent.apply(this, arguments);
  10497. var params = Array.link(arguments, {'container': Type.isElement});
  10498. this.container = params.container;
  10499. },
  10500. addSection: function(toggler, element, pos){
  10501. toggler = document.id(toggler);
  10502. element = document.id(element);
  10503. var test = this.togglers.contains(toggler);
  10504. var len = this.togglers.length;
  10505. if (len && (!test || pos)){
  10506. pos = pos != null ? pos : len - 1;
  10507. toggler.inject(this.togglers[pos], 'before');
  10508. element.inject(toggler, 'after');
  10509. } else if (this.container && !test){
  10510. toggler.inject(this.container);
  10511. element.inject(this.container);
  10512. }
  10513. return this.parent.apply(this, arguments);
  10514. }
  10515. });
  10516. /*</1.2compat>*/
  10517. /*
  10518. ---
  10519. script: Fx.Move.js
  10520. name: Fx.Move
  10521. description: Defines Fx.Move, a class that works with Element.Position.js to transition an element from one location to another.
  10522. license: MIT-style license
  10523. authors:
  10524. - Aaron Newton
  10525. requires:
  10526. - Core/Fx.Morph
  10527. - Element.Position
  10528. provides: [Fx.Move]
  10529. ...
  10530. */
  10531. Fx.Move = new Class({
  10532. Extends: Fx.Morph,
  10533. options: {
  10534. relativeTo: document.body,
  10535. position: 'center',
  10536. edge: false,
  10537. offset: {x: 0, y: 0}
  10538. },
  10539. start: function(destination){
  10540. var element = this.element,
  10541. topLeft = element.getStyles('top', 'left');
  10542. if (topLeft.top == 'auto' || topLeft.left == 'auto'){
  10543. element.setPosition(element.getPosition(element.getOffsetParent()));
  10544. }
  10545. return this.parent(element.position(Object.merge({}, this.options, destination, {returnPos: true})));
  10546. }
  10547. });
  10548. Element.Properties.move = {
  10549. set: function(options){
  10550. this.get('move').cancel().setOptions(options);
  10551. return this;
  10552. },
  10553. get: function(){
  10554. var move = this.retrieve('move');
  10555. if (!move){
  10556. move = new Fx.Move(this, {link: 'cancel'});
  10557. this.store('move', move);
  10558. }
  10559. return move;
  10560. }
  10561. };
  10562. Element.implement({
  10563. move: function(options){
  10564. this.get('move').start(options);
  10565. return this;
  10566. }
  10567. });
  10568. /*
  10569. ---
  10570. script: Fx.Scroll.js
  10571. name: Fx.Scroll
  10572. description: Effect to smoothly scroll any element, including the window.
  10573. license: MIT-style license
  10574. authors:
  10575. - Valerio Proietti
  10576. requires:
  10577. - Core/Fx
  10578. - Core/Element.Event
  10579. - Core/Element.Dimensions
  10580. - MooTools.More
  10581. provides: [Fx.Scroll]
  10582. ...
  10583. */
  10584. (function(){
  10585. Fx.Scroll = new Class({
  10586. Extends: Fx,
  10587. options: {
  10588. offset: {x: 0, y: 0},
  10589. wheelStops: true
  10590. },
  10591. initialize: function(element, options){
  10592. this.element = this.subject = document.id(element);
  10593. this.parent(options);
  10594. if (typeOf(this.element) != 'element') this.element = document.id(this.element.getDocument().body);
  10595. if (this.options.wheelStops){
  10596. var stopper = this.element,
  10597. cancel = this.cancel.pass(false, this);
  10598. this.addEvent('start', function(){
  10599. stopper.addEvent('mousewheel', cancel);
  10600. }, true);
  10601. this.addEvent('complete', function(){
  10602. stopper.removeEvent('mousewheel', cancel);
  10603. }, true);
  10604. }
  10605. },
  10606. set: function(){
  10607. var now = Array.flatten(arguments);
  10608. this.element.scrollTo(now[0], now[1]);
  10609. return this;
  10610. },
  10611. compute: function(from, to, delta){
  10612. return [0, 1].map(function(i){
  10613. return Fx.compute(from[i], to[i], delta);
  10614. });
  10615. },
  10616. start: function(x, y){
  10617. if (!this.check(x, y)) return this;
  10618. var scroll = this.element.getScroll();
  10619. return this.parent([scroll.x, scroll.y], [x, y]);
  10620. },
  10621. calculateScroll: function(x, y){
  10622. var element = this.element,
  10623. scrollSize = element.getScrollSize(),
  10624. scroll = element.getScroll(),
  10625. size = element.getSize(),
  10626. offset = this.options.offset,
  10627. values = {x: x, y: y};
  10628. for (var z in values){
  10629. if (!values[z] && values[z] !== 0) values[z] = scroll[z];
  10630. if (typeOf(values[z]) != 'number') values[z] = scrollSize[z] - size[z];
  10631. values[z] += offset[z];
  10632. }
  10633. return [values.x, values.y];
  10634. },
  10635. toTop: function(){
  10636. return this.start.apply(this, this.calculateScroll(false, 0));
  10637. },
  10638. toLeft: function(){
  10639. return this.start.apply(this, this.calculateScroll(0, false));
  10640. },
  10641. toRight: function(){
  10642. return this.start.apply(this, this.calculateScroll('right', false));
  10643. },
  10644. toBottom: function(){
  10645. return this.start.apply(this, this.calculateScroll(false, 'bottom'));
  10646. },
  10647. toElement: function(el, axes){
  10648. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10649. var scroll = isBody(this.element) ? {x: 0, y: 0} : this.element.getScroll();
  10650. var position = Object.map(document.id(el).getPosition(this.element), function(value, axis){
  10651. return axes.contains(axis) ? value + scroll[axis] : false;
  10652. });
  10653. return this.start.apply(this, this.calculateScroll(position.x, position.y));
  10654. },
  10655. toElementEdge: function(el, axes, offset){
  10656. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10657. el = document.id(el);
  10658. var to = {},
  10659. position = el.getPosition(this.element),
  10660. size = el.getSize(),
  10661. scroll = this.element.getScroll(),
  10662. containerSize = this.element.getSize(),
  10663. edge = {
  10664. x: position.x + size.x,
  10665. y: position.y + size.y
  10666. };
  10667. ['x', 'y'].each(function(axis){
  10668. if (axes.contains(axis)){
  10669. if (edge[axis] > scroll[axis] + containerSize[axis]) to[axis] = edge[axis] - containerSize[axis];
  10670. if (position[axis] < scroll[axis]) to[axis] = position[axis];
  10671. }
  10672. if (to[axis] == null) to[axis] = scroll[axis];
  10673. if (offset && offset[axis]) to[axis] = to[axis] + offset[axis];
  10674. }, this);
  10675. if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y);
  10676. return this;
  10677. },
  10678. toElementCenter: function(el, axes, offset){
  10679. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10680. el = document.id(el);
  10681. var to = {},
  10682. position = el.getPosition(this.element),
  10683. size = el.getSize(),
  10684. scroll = this.element.getScroll(),
  10685. containerSize = this.element.getSize();
  10686. ['x', 'y'].each(function(axis){
  10687. if (axes.contains(axis)){
  10688. to[axis] = position[axis] - (containerSize[axis] - size[axis]) / 2;
  10689. }
  10690. if (to[axis] == null) to[axis] = scroll[axis];
  10691. if (offset && offset[axis]) to[axis] = to[axis] + offset[axis];
  10692. }, this);
  10693. if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y);
  10694. return this;
  10695. }
  10696. });
  10697. //<1.2compat>
  10698. Fx.Scroll.implement({
  10699. scrollToCenter: function(){
  10700. return this.toElementCenter.apply(this, arguments);
  10701. },
  10702. scrollIntoView: function(){
  10703. return this.toElementEdge.apply(this, arguments);
  10704. }
  10705. });
  10706. //</1.2compat>
  10707. function isBody(element){
  10708. return (/^(?:body|html)$/i).test(element.tagName);
  10709. }
  10710. })();
  10711. /*
  10712. ---
  10713. script: Fx.Slide.js
  10714. name: Fx.Slide
  10715. description: Effect to slide an element in and out of view.
  10716. license: MIT-style license
  10717. authors:
  10718. - Valerio Proietti
  10719. requires:
  10720. - Core/Fx
  10721. - Core/Element.Style
  10722. - MooTools.More
  10723. provides: [Fx.Slide]
  10724. ...
  10725. */
  10726. Fx.Slide = new Class({
  10727. Extends: Fx,
  10728. options: {
  10729. mode: 'vertical',
  10730. wrapper: false,
  10731. hideOverflow: true,
  10732. resetHeight: false
  10733. },
  10734. initialize: function(element, options){
  10735. element = this.element = this.subject = document.id(element);
  10736. this.parent(options);
  10737. options = this.options;
  10738. var wrapper = element.retrieve('wrapper'),
  10739. styles = element.getStyles('margin', 'position', 'overflow');
  10740. if (options.hideOverflow) styles = Object.append(styles, {overflow: 'hidden'});
  10741. if (options.wrapper) wrapper = document.id(options.wrapper).setStyles(styles);
  10742. if (!wrapper) wrapper = new Element('div', {
  10743. styles: styles
  10744. }).wraps(element);
  10745. element.store('wrapper', wrapper).setStyle('margin', 0);
  10746. if (element.getStyle('overflow') == 'visible') element.setStyle('overflow', 'hidden');
  10747. this.now = [];
  10748. this.open = true;
  10749. this.wrapper = wrapper;
  10750. this.addEvent('complete', function(){
  10751. this.open = (wrapper['offset' + this.layout.capitalize()] != 0);
  10752. if (this.open && this.options.resetHeight) wrapper.setStyle('height', '');
  10753. }, true);
  10754. },
  10755. vertical: function(){
  10756. this.margin = 'margin-top';
  10757. this.layout = 'height';
  10758. this.offset = this.element.offsetHeight;
  10759. },
  10760. horizontal: function(){
  10761. this.margin = 'margin-left';
  10762. this.layout = 'width';
  10763. this.offset = this.element.offsetWidth;
  10764. },
  10765. set: function(now){
  10766. this.element.setStyle(this.margin, now[0]);
  10767. this.wrapper.setStyle(this.layout, now[1]);
  10768. return this;
  10769. },
  10770. compute: function(from, to, delta){
  10771. return [0, 1].map(function(i){
  10772. return Fx.compute(from[i], to[i], delta);
  10773. });
  10774. },
  10775. start: function(how, mode){
  10776. if (!this.check(how, mode)) return this;
  10777. this[mode || this.options.mode]();
  10778. var margin = this.element.getStyle(this.margin).toInt(),
  10779. layout = this.wrapper.getStyle(this.layout).toInt(),
  10780. caseIn = [[margin, layout], [0, this.offset]],
  10781. caseOut = [[margin, layout], [-this.offset, 0]],
  10782. start;
  10783. switch (how){
  10784. case 'in': start = caseIn; break;
  10785. case 'out': start = caseOut; break;
  10786. case 'toggle': start = (layout == 0) ? caseIn : caseOut;
  10787. }
  10788. return this.parent(start[0], start[1]);
  10789. },
  10790. slideIn: function(mode){
  10791. return this.start('in', mode);
  10792. },
  10793. slideOut: function(mode){
  10794. return this.start('out', mode);
  10795. },
  10796. hide: function(mode){
  10797. this[mode || this.options.mode]();
  10798. this.open = false;
  10799. return this.set([-this.offset, 0]);
  10800. },
  10801. show: function(mode){
  10802. this[mode || this.options.mode]();
  10803. this.open = true;
  10804. return this.set([0, this.offset]);
  10805. },
  10806. toggle: function(mode){
  10807. return this.start('toggle', mode);
  10808. }
  10809. });
  10810. Element.Properties.slide = {
  10811. set: function(options){
  10812. this.get('slide').cancel().setOptions(options);
  10813. return this;
  10814. },
  10815. get: function(){
  10816. var slide = this.retrieve('slide');
  10817. if (!slide){
  10818. slide = new Fx.Slide(this, {link: 'cancel'});
  10819. this.store('slide', slide);
  10820. }
  10821. return slide;
  10822. }
  10823. };
  10824. Element.implement({
  10825. slide: function(how, mode){
  10826. how = how || 'toggle';
  10827. var slide = this.get('slide'), toggle;
  10828. switch (how){
  10829. case 'hide': slide.hide(mode); break;
  10830. case 'show': slide.show(mode); break;
  10831. case 'toggle':
  10832. var flag = this.retrieve('slide:flag', slide.open);
  10833. slide[flag ? 'slideOut' : 'slideIn'](mode);
  10834. this.store('slide:flag', !flag);
  10835. toggle = true;
  10836. break;
  10837. default: slide.start(how, mode);
  10838. }
  10839. if (!toggle) this.eliminate('slide:flag');
  10840. return this;
  10841. }
  10842. });
  10843. /*
  10844. ---
  10845. script: Fx.SmoothScroll.js
  10846. name: Fx.SmoothScroll
  10847. description: Class for creating a smooth scrolling effect to all internal links on the page.
  10848. license: MIT-style license
  10849. authors:
  10850. - Valerio Proietti
  10851. requires:
  10852. - Core/Slick.Finder
  10853. - Fx.Scroll
  10854. provides: [Fx.SmoothScroll]
  10855. ...
  10856. */
  10857. /*<1.2compat>*/var SmoothScroll = /*</1.2compat>*/Fx.SmoothScroll = new Class({
  10858. Extends: Fx.Scroll,
  10859. options: {
  10860. axes: ['x', 'y']
  10861. },
  10862. initialize: function(options, context){
  10863. context = context || document;
  10864. this.doc = context.getDocument();
  10865. this.parent(this.doc, options);
  10866. var win = context.getWindow(),
  10867. location = win.location.href.match(/^[^#]*/)[0] + '#',
  10868. links = $$(this.options.links || this.doc.links);
  10869. links.each(function(link){
  10870. if (link.href.indexOf(location) != 0) return;
  10871. var anchor = link.href.substr(location.length);
  10872. if (anchor) this.useLink(link, anchor);
  10873. }, this);
  10874. this.addEvent('complete', function(){
  10875. win.location.hash = this.anchor;
  10876. this.element.scrollTo(this.to[0], this.to[1]);
  10877. }, true);
  10878. },
  10879. useLink: function(link, anchor){
  10880. link.addEvent('click', function(event){
  10881. var el = document.id(anchor) || this.doc.getElement('a[name=' + anchor + ']');
  10882. if (!el) return;
  10883. event.preventDefault();
  10884. this.toElement(el, this.options.axes).chain(function(){
  10885. this.fireEvent('scrolledTo', [link, el]);
  10886. }.bind(this));
  10887. this.anchor = anchor;
  10888. }.bind(this));
  10889. return this;
  10890. }
  10891. });
  10892. /*
  10893. ---
  10894. script: Fx.Sort.js
  10895. name: Fx.Sort
  10896. description: Defines Fx.Sort, a class that reorders lists with a transition.
  10897. license: MIT-style license
  10898. authors:
  10899. - Aaron Newton
  10900. requires:
  10901. - Core/Element.Dimensions
  10902. - Fx.Elements
  10903. - Element.Measure
  10904. provides: [Fx.Sort]
  10905. ...
  10906. */
  10907. Fx.Sort = new Class({
  10908. Extends: Fx.Elements,
  10909. options: {
  10910. mode: 'vertical'
  10911. },
  10912. initialize: function(elements, options){
  10913. this.parent(elements, options);
  10914. this.elements.each(function(el){
  10915. if (el.getStyle('position') == 'static') el.setStyle('position', 'relative');
  10916. });
  10917. this.setDefaultOrder();
  10918. },
  10919. setDefaultOrder: function(){
  10920. this.currentOrder = this.elements.map(function(el, index){
  10921. return index;
  10922. });
  10923. },
  10924. sort: function(){
  10925. if (!this.check(arguments)) return this;
  10926. var newOrder = Array.flatten(arguments);
  10927. var top = 0,
  10928. left = 0,
  10929. next = {},
  10930. zero = {},
  10931. vert = this.options.mode == 'vertical';
  10932. var current = this.elements.map(function(el, index){
  10933. var size = el.getComputedSize({styles: ['border', 'padding', 'margin']});
  10934. var val;
  10935. if (vert){
  10936. val = {
  10937. top: top,
  10938. margin: size['margin-top'],
  10939. height: size.totalHeight
  10940. };
  10941. top += val.height - size['margin-top'];
  10942. } else {
  10943. val = {
  10944. left: left,
  10945. margin: size['margin-left'],
  10946. width: size.totalWidth
  10947. };
  10948. left += val.width;
  10949. }
  10950. var plane = vert ? 'top' : 'left';
  10951. zero[index] = {};
  10952. var start = el.getStyle(plane).toInt();
  10953. zero[index][plane] = start || 0;
  10954. return val;
  10955. }, this);
  10956. this.set(zero);
  10957. newOrder = newOrder.map(function(i){ return i.toInt(); });
  10958. if (newOrder.length != this.elements.length){
  10959. this.currentOrder.each(function(index){
  10960. if (!newOrder.contains(index)) newOrder.push(index);
  10961. });
  10962. if (newOrder.length > this.elements.length)
  10963. newOrder.splice(this.elements.length-1, newOrder.length - this.elements.length);
  10964. }
  10965. var margin = 0;
  10966. top = left = 0;
  10967. newOrder.each(function(item){
  10968. var newPos = {};
  10969. if (vert){
  10970. newPos.top = top - current[item].top - margin;
  10971. top += current[item].height;
  10972. } else {
  10973. newPos.left = left - current[item].left;
  10974. left += current[item].width;
  10975. }
  10976. margin = margin + current[item].margin;
  10977. next[item]=newPos;
  10978. }, this);
  10979. var mapped = {};
  10980. Array.clone(newOrder).sort().each(function(index){
  10981. mapped[index] = next[index];
  10982. });
  10983. this.start(mapped);
  10984. this.currentOrder = newOrder;
  10985. return this;
  10986. },
  10987. rearrangeDOM: function(newOrder){
  10988. newOrder = newOrder || this.currentOrder;
  10989. var parent = this.elements[0].getParent();
  10990. var rearranged = [];
  10991. this.elements.setStyle('opacity', 0);
  10992. //move each element and store the new default order
  10993. newOrder.each(function(index){
  10994. rearranged.push(this.elements[index].inject(parent).setStyles({
  10995. top: 0,
  10996. left: 0
  10997. }));
  10998. }, this);
  10999. this.elements.setStyle('opacity', 1);
  11000. this.elements = $$(rearranged);
  11001. this.setDefaultOrder();
  11002. return this;
  11003. },
  11004. getDefaultOrder: function(){
  11005. return this.elements.map(function(el, index){
  11006. return index;
  11007. });
  11008. },
  11009. getCurrentOrder: function(){
  11010. return this.currentOrder;
  11011. },
  11012. forward: function(){
  11013. return this.sort(this.getDefaultOrder());
  11014. },
  11015. backward: function(){
  11016. return this.sort(this.getDefaultOrder().reverse());
  11017. },
  11018. reverse: function(){
  11019. return this.sort(this.currentOrder.reverse());
  11020. },
  11021. sortByElements: function(elements){
  11022. return this.sort(elements.map(function(el){
  11023. return this.elements.indexOf(el);
  11024. }, this));
  11025. },
  11026. swap: function(one, two){
  11027. if (typeOf(one) == 'element') one = this.elements.indexOf(one);
  11028. if (typeOf(two) == 'element') two = this.elements.indexOf(two);
  11029. var newOrder = Array.clone(this.currentOrder);
  11030. newOrder[this.currentOrder.indexOf(one)] = two;
  11031. newOrder[this.currentOrder.indexOf(two)] = one;
  11032. return this.sort(newOrder);
  11033. }
  11034. });
  11035. /*
  11036. ---
  11037. script: Keyboard.js
  11038. name: Keyboard
  11039. 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.
  11040. license: MIT-style license
  11041. authors:
  11042. - Perrin Westrich
  11043. - Aaron Newton
  11044. - Scott Kyle
  11045. requires:
  11046. - Core/Events
  11047. - Core/Options
  11048. - Core/Element.Event
  11049. - Element.Event.Pseudos.Keys
  11050. provides: [Keyboard]
  11051. ...
  11052. */
  11053. (function(){
  11054. var Keyboard = this.Keyboard = new Class({
  11055. Extends: Events,
  11056. Implements: [Options],
  11057. options: {/*
  11058. onActivate: function(){},
  11059. onDeactivate: function(){},*/
  11060. defaultEventType: 'keydown',
  11061. active: false,
  11062. manager: null,
  11063. events: {},
  11064. nonParsedEvents: ['activate', 'deactivate', 'onactivate', 'ondeactivate', 'changed', 'onchanged']
  11065. },
  11066. initialize: function(options){
  11067. if (options && options.manager){
  11068. this._manager = options.manager;
  11069. delete options.manager;
  11070. }
  11071. this.setOptions(options);
  11072. this._setup();
  11073. },
  11074. addEvent: function(type, fn, internal){
  11075. return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn, internal);
  11076. },
  11077. removeEvent: function(type, fn){
  11078. return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn);
  11079. },
  11080. toggleActive: function(){
  11081. return this[this.isActive() ? 'deactivate' : 'activate']();
  11082. },
  11083. activate: function(instance){
  11084. if (instance){
  11085. if (instance.isActive()) return this;
  11086. //if we're stealing focus, store the last keyboard to have it so the relinquish command works
  11087. if (this._activeKB && instance != this._activeKB){
  11088. this.previous = this._activeKB;
  11089. this.previous.fireEvent('deactivate');
  11090. }
  11091. //if we're enabling a child, assign it so that events are now passed to it
  11092. this._activeKB = instance.fireEvent('activate');
  11093. Keyboard.manager.fireEvent('changed');
  11094. } else if (this._manager){
  11095. //else we're enabling ourselves, we must ask our parent to do it for us
  11096. this._manager.activate(this);
  11097. }
  11098. return this;
  11099. },
  11100. isActive: function(){
  11101. return this._manager ? (this._manager._activeKB == this) : (Keyboard.manager == this);
  11102. },
  11103. deactivate: function(instance){
  11104. if (instance){
  11105. if (instance === this._activeKB){
  11106. this._activeKB = null;
  11107. instance.fireEvent('deactivate');
  11108. Keyboard.manager.fireEvent('changed');
  11109. }
  11110. } else if (this._manager){
  11111. this._manager.deactivate(this);
  11112. }
  11113. return this;
  11114. },
  11115. relinquish: function(){
  11116. if (this.isActive() && this._manager && this._manager.previous) this._manager.activate(this._manager.previous);
  11117. else this.deactivate();
  11118. return this;
  11119. },
  11120. //management logic
  11121. manage: function(instance){
  11122. if (instance._manager) instance._manager.drop(instance);
  11123. this._instances.push(instance);
  11124. instance._manager = this;
  11125. if (!this._activeKB) this.activate(instance);
  11126. return this;
  11127. },
  11128. drop: function(instance){
  11129. instance.relinquish();
  11130. this._instances.erase(instance);
  11131. if (this._activeKB == instance){
  11132. if (this.previous && this._instances.contains(this.previous)) this.activate(this.previous);
  11133. else this._activeKB = this._instances[0];
  11134. }
  11135. return this;
  11136. },
  11137. trace: function(){
  11138. Keyboard.trace(this);
  11139. },
  11140. each: function(fn){
  11141. Keyboard.each(this, fn);
  11142. },
  11143. /*
  11144. PRIVATE METHODS
  11145. */
  11146. _instances: [],
  11147. _disable: function(instance){
  11148. if (this._activeKB == instance) this._activeKB = null;
  11149. },
  11150. _setup: function(){
  11151. this.addEvents(this.options.events);
  11152. //if this is the root manager, nothing manages it
  11153. if (Keyboard.manager && !this._manager) Keyboard.manager.manage(this);
  11154. if (this.options.active) this.activate();
  11155. else this.relinquish();
  11156. },
  11157. _handle: function(event, type){
  11158. //Keyboard.stop(event) prevents key propagation
  11159. if (event.preventKeyboardPropagation) return;
  11160. var bubbles = !!this._manager;
  11161. if (bubbles && this._activeKB){
  11162. this._activeKB._handle(event, type);
  11163. if (event.preventKeyboardPropagation) return;
  11164. }
  11165. this.fireEvent(type, event);
  11166. if (!bubbles && this._activeKB) this._activeKB._handle(event, type);
  11167. }
  11168. });
  11169. var parsed = {};
  11170. var modifiers = ['shift', 'control', 'alt', 'meta'];
  11171. var regex = /^(?:shift|control|ctrl|alt|meta)$/;
  11172. Keyboard.parse = function(type, eventType, ignore){
  11173. if (ignore && ignore.contains(type.toLowerCase())) return type;
  11174. type = type.toLowerCase().replace(/^(keyup|keydown):/, function($0, $1){
  11175. eventType = $1;
  11176. return '';
  11177. });
  11178. if (!parsed[type]){
  11179. if (type != '+'){
  11180. var key, mods = {};
  11181. type.split('+').each(function(part){
  11182. if (regex.test(part)) mods[part] = true;
  11183. else key = part;
  11184. });
  11185. mods.control = mods.control || mods.ctrl; // allow both control and ctrl
  11186. var keys = [];
  11187. modifiers.each(function(mod){
  11188. if (mods[mod]) keys.push(mod);
  11189. });
  11190. if (key) keys.push(key);
  11191. parsed[type] = keys.join('+');
  11192. } else {
  11193. parsed[type] = type;
  11194. }
  11195. }
  11196. return eventType + ':keys(' + parsed[type] + ')';
  11197. };
  11198. Keyboard.each = function(keyboard, fn){
  11199. var current = keyboard || Keyboard.manager;
  11200. while (current){
  11201. fn(current);
  11202. current = current._activeKB;
  11203. }
  11204. };
  11205. Keyboard.stop = function(event){
  11206. event.preventKeyboardPropagation = true;
  11207. };
  11208. Keyboard.manager = new Keyboard({
  11209. active: true
  11210. });
  11211. Keyboard.trace = function(keyboard){
  11212. keyboard = keyboard || Keyboard.manager;
  11213. var hasConsole = window.console && console.log;
  11214. if (hasConsole) console.log('the following items have focus: ');
  11215. Keyboard.each(keyboard, function(current){
  11216. if (hasConsole) console.log(document.id(current.widget) || current.wiget || current);
  11217. });
  11218. };
  11219. var handler = function(event){
  11220. var keys = [];
  11221. modifiers.each(function(mod){
  11222. if (event[mod]) keys.push(mod);
  11223. });
  11224. if (!regex.test(event.key)) keys.push(event.key);
  11225. Keyboard.manager._handle(event, event.type + ':keys(' + keys.join('+') + ')');
  11226. };
  11227. document.addEvents({
  11228. 'keyup': handler,
  11229. 'keydown': handler
  11230. });
  11231. })();
  11232. /*
  11233. ---
  11234. script: Keyboard.Extras.js
  11235. name: Keyboard.Extras
  11236. 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.
  11237. license: MIT-style license
  11238. authors:
  11239. - Perrin Westrich
  11240. requires:
  11241. - Keyboard
  11242. - MooTools.More
  11243. provides: [Keyboard.Extras]
  11244. ...
  11245. */
  11246. Keyboard.prototype.options.nonParsedEvents.combine(['rebound', 'onrebound']);
  11247. Keyboard.implement({
  11248. /*
  11249. shortcut should be in the format of:
  11250. {
  11251. 'keys': 'shift+s', // the default to add as an event.
  11252. 'description': 'blah blah blah', // a brief description of the functionality.
  11253. 'handler': function(){} // the event handler to run when keys are pressed.
  11254. }
  11255. */
  11256. addShortcut: function(name, shortcut){
  11257. this._shortcuts = this._shortcuts || [];
  11258. this._shortcutIndex = this._shortcutIndex || {};
  11259. shortcut.getKeyboard = Function.convert(this);
  11260. shortcut.name = name;
  11261. this._shortcutIndex[name] = shortcut;
  11262. this._shortcuts.push(shortcut);
  11263. if (shortcut.keys) this.addEvent(shortcut.keys, shortcut.handler);
  11264. return this;
  11265. },
  11266. addShortcuts: function(obj){
  11267. for (var name in obj) this.addShortcut(name, obj[name]);
  11268. return this;
  11269. },
  11270. removeShortcut: function(name){
  11271. var shortcut = this.getShortcut(name);
  11272. if (shortcut && shortcut.keys){
  11273. this.removeEvent(shortcut.keys, shortcut.handler);
  11274. delete this._shortcutIndex[name];
  11275. this._shortcuts.erase(shortcut);
  11276. }
  11277. return this;
  11278. },
  11279. removeShortcuts: function(names){
  11280. names.each(this.removeShortcut, this);
  11281. return this;
  11282. },
  11283. getShortcuts: function(){
  11284. return this._shortcuts || [];
  11285. },
  11286. getShortcut: function(name){
  11287. return (this._shortcutIndex || {})[name];
  11288. }
  11289. });
  11290. Keyboard.rebind = function(newKeys, shortcuts){
  11291. Array.convert(shortcuts).each(function(shortcut){
  11292. shortcut.getKeyboard().removeEvent(shortcut.keys, shortcut.handler);
  11293. shortcut.getKeyboard().addEvent(newKeys, shortcut.handler);
  11294. shortcut.keys = newKeys;
  11295. shortcut.getKeyboard().fireEvent('rebound');
  11296. });
  11297. };
  11298. Keyboard.getActiveShortcuts = function(keyboard){
  11299. var activeKBS = [], activeSCS = [];
  11300. Keyboard.each(keyboard, [].push.bind(activeKBS));
  11301. activeKBS.each(function(kb){ activeSCS.extend(kb.getShortcuts()); });
  11302. return activeSCS;
  11303. };
  11304. Keyboard.getShortcut = function(name, keyboard, opts){
  11305. opts = opts || {};
  11306. var shortcuts = opts.many ? [] : null,
  11307. set = opts.many ? function(kb){
  11308. var shortcut = kb.getShortcut(name);
  11309. if (shortcut) shortcuts.push(shortcut);
  11310. } : function(kb){
  11311. if (!shortcuts) shortcuts = kb.getShortcut(name);
  11312. };
  11313. Keyboard.each(keyboard, set);
  11314. return shortcuts;
  11315. };
  11316. Keyboard.getShortcuts = function(name, keyboard){
  11317. return Keyboard.getShortcut(name, keyboard, { many: true });
  11318. };
  11319. /*
  11320. ---
  11321. script: HtmlTable.js
  11322. name: HtmlTable
  11323. description: Builds table elements with methods to add rows.
  11324. license: MIT-style license
  11325. authors:
  11326. - Aaron Newton
  11327. requires:
  11328. - Core/Options
  11329. - Core/Events
  11330. - Class.Occlude
  11331. provides: [HtmlTable]
  11332. ...
  11333. */
  11334. (function(){
  11335. var HtmlTable = this.HtmlTable = new Class({
  11336. Implements: [Options, Events, Class.Occlude],
  11337. options: {
  11338. properties: {
  11339. cellpadding: 0,
  11340. cellspacing: 0,
  11341. border: 0
  11342. },
  11343. rows: [],
  11344. headers: [],
  11345. footers: []
  11346. },
  11347. property: 'HtmlTable',
  11348. initialize: function(){
  11349. var params = Array.link(arguments, {options: Type.isObject, table: Type.isElement, id: Type.isString});
  11350. this.setOptions(params.options);
  11351. if (!params.table && params.id) params.table = document.id(params.id);
  11352. this.element = params.table || new Element('table', this.options.properties);
  11353. if (this.occlude()) return this.occluded;
  11354. this.build();
  11355. },
  11356. build: function(){
  11357. this.element.store('HtmlTable', this);
  11358. this.body = document.id(this.element.tBodies[0]) || new Element('tbody').inject(this.element);
  11359. $$(this.body.rows);
  11360. if (this.options.headers.length) this.setHeaders(this.options.headers);
  11361. else this.thead = document.id(this.element.tHead);
  11362. if (this.thead) this.head = this.getHead();
  11363. if (this.options.footers.length) this.setFooters(this.options.footers);
  11364. this.tfoot = document.id(this.element.tFoot);
  11365. if (this.tfoot) this.foot = document.id(this.tfoot.rows[0]);
  11366. this.options.rows.each(function(row){
  11367. this.push(row);
  11368. }, this);
  11369. },
  11370. toElement: function(){
  11371. return this.element;
  11372. },
  11373. empty: function(){
  11374. this.body.empty();
  11375. return this;
  11376. },
  11377. set: function(what, items){
  11378. var target = (what == 'headers') ? 'tHead' : 'tFoot',
  11379. lower = target.toLowerCase();
  11380. this[lower] = (document.id(this.element[target]) || new Element(lower).inject(this.element, 'top')).empty();
  11381. var data = this.push(items, {}, this[lower], what == 'headers' ? 'th' : 'td');
  11382. if (what == 'headers') this.head = this.getHead();
  11383. else this.foot = this.getHead();
  11384. return data;
  11385. },
  11386. getHead: function(){
  11387. var rows = this.thead.rows;
  11388. return rows.length > 1 ? $$(rows) : rows.length ? document.id(rows[0]) : false;
  11389. },
  11390. setHeaders: function(headers){
  11391. this.set('headers', headers);
  11392. return this;
  11393. },
  11394. setFooters: function(footers){
  11395. this.set('footers', footers);
  11396. return this;
  11397. },
  11398. update: function(tr, row, tag){
  11399. var tds = tr.getChildren(tag || 'td'), last = tds.length - 1;
  11400. row.each(function(data, index){
  11401. var td = tds[index] || new Element(tag || 'td').inject(tr),
  11402. content = ((data && Object.prototype.hasOwnProperty.call(data, 'content')) ? data.content : '') || data,
  11403. type = typeOf(content);
  11404. if (data && Object.prototype.hasOwnProperty.call(data, 'properties')) td.set(data.properties);
  11405. if (/(element(s?)|array|collection)/.test(type)) td.empty().adopt(content);
  11406. else td.set('html', content);
  11407. if (index > last) tds.push(td);
  11408. else tds[index] = td;
  11409. });
  11410. return {
  11411. tr: tr,
  11412. tds: tds
  11413. };
  11414. },
  11415. push: function(row, rowProperties, target, tag, where){
  11416. if (typeOf(row) == 'element' && row.get('tag') == 'tr'){
  11417. row.inject(target || this.body, where);
  11418. return {
  11419. tr: row,
  11420. tds: row.getChildren('td')
  11421. };
  11422. }
  11423. return this.update(new Element('tr', rowProperties).inject(target || this.body, where), row, tag);
  11424. },
  11425. pushMany: function(rows, rowProperties, target, tag, where){
  11426. return rows.map(function(row){
  11427. return this.push(row, rowProperties, target, tag, where);
  11428. }, this);
  11429. }
  11430. });
  11431. })();
  11432. ['adopt', 'inject', 'wraps', 'grab', 'replaces', 'dispose'].each(function(method){
  11433. HtmlTable.implement(method, function(){
  11434. this.element[method].apply(this.element, arguments);
  11435. return this;
  11436. });
  11437. });
  11438. /*
  11439. ---
  11440. script: HtmlTable.Select.js
  11441. name: HtmlTable.Select
  11442. description: Builds a stripy, sortable table with methods to add rows. Rows can be selected with the mouse or keyboard navigation.
  11443. license: MIT-style license
  11444. authors:
  11445. - Harald Kirschner
  11446. - Aaron Newton
  11447. requires:
  11448. - Keyboard
  11449. - Keyboard.Extras
  11450. - HtmlTable
  11451. - Class.refactor
  11452. - Element.Delegation.Pseudo
  11453. - Element.Shortcuts
  11454. provides: [HtmlTable.Select]
  11455. ...
  11456. */
  11457. HtmlTable = Class.refactor(HtmlTable, {
  11458. options: {
  11459. /*onRowFocus: function(){},
  11460. onRowUnfocus: function(){},*/
  11461. useKeyboard: true,
  11462. classRowSelected: 'table-tr-selected',
  11463. classRowHovered: 'table-tr-hovered',
  11464. classSelectable: 'table-selectable',
  11465. shiftForMultiSelect: true,
  11466. allowMultiSelect: true,
  11467. selectable: false,
  11468. selectHiddenRows: false
  11469. },
  11470. initialize: function(){
  11471. this.previous.apply(this, arguments);
  11472. if (this.occluded) return this.occluded;
  11473. this.selectedRows = new Elements();
  11474. if (!this.bound) this.bound = {};
  11475. this.bound.mouseleave = this.mouseleave.bind(this);
  11476. this.bound.clickRow = this.clickRow.bind(this);
  11477. this.bound.activateKeyboard = function(){
  11478. if (this.keyboard && this.selectEnabled) this.keyboard.activate();
  11479. }.bind(this);
  11480. if (this.options.selectable) this.enableSelect();
  11481. },
  11482. empty: function(){
  11483. if (this.body.rows.length) this.selectNone();
  11484. return this.previous();
  11485. },
  11486. enableSelect: function(){
  11487. this.selectEnabled = true;
  11488. this.attachSelects();
  11489. this.element.addClass(this.options.classSelectable);
  11490. return this;
  11491. },
  11492. disableSelect: function(){
  11493. this.selectEnabled = false;
  11494. this.attachSelects(false);
  11495. this.element.removeClass(this.options.classSelectable);
  11496. return this;
  11497. },
  11498. push: function(){
  11499. var ret = this.previous.apply(this, arguments);
  11500. this.updateSelects();
  11501. return ret;
  11502. },
  11503. toggleRow: function(row){
  11504. return this[(this.isSelected(row) ? 'de' : '') + 'selectRow'](row);
  11505. },
  11506. selectRow: function(row, _nocheck){
  11507. //private variable _nocheck: boolean whether or not to confirm the row is in the table body
  11508. //added here for optimization when selecting ranges
  11509. if (this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
  11510. if (!this.options.allowMultiSelect) this.selectNone();
  11511. if (!this.isSelected(row)){
  11512. this.selectedRows.push(row);
  11513. row.addClass(this.options.classRowSelected);
  11514. this.fireEvent('rowFocus', [row, this.selectedRows]);
  11515. this.fireEvent('stateChanged');
  11516. }
  11517. this.focused = row;
  11518. document.clearSelection();
  11519. return this;
  11520. },
  11521. isSelected: function(row){
  11522. return this.selectedRows.contains(row);
  11523. },
  11524. getSelected: function(){
  11525. return this.selectedRows;
  11526. },
  11527. serialize: function(){
  11528. var previousSerialization = this.previous.apply(this, arguments) || {};
  11529. if (this.options.selectable){
  11530. previousSerialization.selectedRows = this.selectedRows.map(function(row){
  11531. return Array.indexOf(this.body.rows, row);
  11532. }.bind(this));
  11533. }
  11534. return previousSerialization;
  11535. },
  11536. restore: function(tableState){
  11537. if (this.options.selectable && tableState.selectedRows){
  11538. tableState.selectedRows.each(function(index){
  11539. this.selectRow(this.body.rows[index]);
  11540. }.bind(this));
  11541. }
  11542. this.previous.apply(this, arguments);
  11543. },
  11544. deselectRow: function(row, _nocheck){
  11545. if (!this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
  11546. this.selectedRows = new Elements(Array.convert(this.selectedRows).erase(row));
  11547. row.removeClass(this.options.classRowSelected);
  11548. this.fireEvent('rowUnfocus', [row, this.selectedRows]);
  11549. this.fireEvent('stateChanged');
  11550. return this;
  11551. },
  11552. selectAll: function(selectNone){
  11553. if (!selectNone && !this.options.allowMultiSelect) return;
  11554. this.selectRange(0, this.body.rows.length, selectNone);
  11555. return this;
  11556. },
  11557. selectNone: function(){
  11558. return this.selectAll(true);
  11559. },
  11560. selectRange: function(startRow, endRow, _deselect){
  11561. if (!this.options.allowMultiSelect && !_deselect) return;
  11562. var method = _deselect ? 'deselectRow' : 'selectRow',
  11563. rows = Array.clone(this.body.rows);
  11564. if (typeOf(startRow) == 'element') startRow = rows.indexOf(startRow);
  11565. if (typeOf(endRow) == 'element') endRow = rows.indexOf(endRow);
  11566. endRow = endRow < rows.length - 1 ? endRow : rows.length - 1;
  11567. if (endRow < startRow){
  11568. var tmp = startRow;
  11569. startRow = endRow;
  11570. endRow = tmp;
  11571. }
  11572. for (var i = startRow; i <= endRow; i++){
  11573. if (this.options.selectHiddenRows || rows[i].isDisplayed()) this[method](rows[i], true);
  11574. }
  11575. return this;
  11576. },
  11577. deselectRange: function(startRow, endRow){
  11578. this.selectRange(startRow, endRow, true);
  11579. },
  11580. /*
  11581. Private methods:
  11582. */
  11583. enterRow: function(row){
  11584. if (this.hovered) this.hovered = this.leaveRow(this.hovered);
  11585. this.hovered = row.addClass(this.options.classRowHovered);
  11586. },
  11587. leaveRow: function(row){
  11588. row.removeClass(this.options.classRowHovered);
  11589. },
  11590. updateSelects: function(){
  11591. Array.each(this.body.rows, function(row){
  11592. var binders = row.retrieve('binders');
  11593. if (!binders && !this.selectEnabled) return;
  11594. if (!binders){
  11595. binders = {
  11596. mouseenter: this.enterRow.pass([row], this),
  11597. mouseleave: this.leaveRow.pass([row], this)
  11598. };
  11599. row.store('binders', binders);
  11600. }
  11601. if (this.selectEnabled) row.addEvents(binders);
  11602. else row.removeEvents(binders);
  11603. }, this);
  11604. },
  11605. shiftFocus: function(offset, event){
  11606. if (!this.focused) return this.selectRow(this.body.rows[0], event);
  11607. var to = this.getRowByOffset(offset, this.options.selectHiddenRows);
  11608. if (to === null || this.focused == this.body.rows[to]) return this;
  11609. this.toggleRow(this.body.rows[to], event);
  11610. },
  11611. clickRow: function(event, row){
  11612. var selecting = (event.shift || event.meta || event.control) && this.options.shiftForMultiSelect;
  11613. if (!selecting && !(event.rightClick && this.isSelected(row) && this.options.allowMultiSelect)) this.selectNone();
  11614. if (event.rightClick) this.selectRow(row);
  11615. else this.toggleRow(row);
  11616. if (event.shift){
  11617. this.selectRange(this.rangeStart || this.body.rows[0], row, this.rangeStart ? !this.isSelected(row) : true);
  11618. this.focused = row;
  11619. }
  11620. this.rangeStart = row;
  11621. },
  11622. getRowByOffset: function(offset, includeHiddenRows){
  11623. if (!this.focused) return 0;
  11624. var index = Array.indexOf(this.body.rows, this.focused);
  11625. if ((index == 0 && offset < 0) || (index == this.body.rows.length -1 && offset > 0)) return null;
  11626. if (includeHiddenRows){
  11627. index += offset;
  11628. } else {
  11629. var limit = 0,
  11630. count = 0;
  11631. if (offset > 0){
  11632. while (count < offset && index < this.body.rows.length -1){
  11633. if (this.body.rows[++index].isDisplayed()) count++;
  11634. }
  11635. } else {
  11636. while (count > offset && index > 0){
  11637. if (this.body.rows[--index].isDisplayed()) count--;
  11638. }
  11639. }
  11640. }
  11641. return index;
  11642. },
  11643. attachSelects: function(attach){
  11644. attach = attach != null ? attach : true;
  11645. var method = attach ? 'addEvents' : 'removeEvents';
  11646. this.element[method]({
  11647. mouseleave: this.bound.mouseleave,
  11648. click: this.bound.activateKeyboard
  11649. });
  11650. this.body[method]({
  11651. 'click:relay(tr)': this.bound.clickRow,
  11652. 'contextmenu:relay(tr)': this.bound.clickRow
  11653. });
  11654. if (this.options.useKeyboard || this.keyboard){
  11655. if (!this.keyboard) this.keyboard = new Keyboard();
  11656. if (!this.selectKeysDefined){
  11657. this.selectKeysDefined = true;
  11658. var timer, held;
  11659. var move = function(offset){
  11660. var mover = function(e){
  11661. clearTimeout(timer);
  11662. e.preventDefault();
  11663. var to = this.body.rows[this.getRowByOffset(offset, this.options.selectHiddenRows)];
  11664. if (e.shift && to && this.isSelected(to)){
  11665. this.deselectRow(this.focused);
  11666. this.focused = to;
  11667. } else {
  11668. if (to && (!this.options.allowMultiSelect || !e.shift)){
  11669. this.selectNone();
  11670. }
  11671. this.shiftFocus(offset, e);
  11672. }
  11673. if (held){
  11674. timer = mover.delay(100, this, e);
  11675. } else {
  11676. timer = (function(){
  11677. held = true;
  11678. mover(e);
  11679. }).delay(400);
  11680. }
  11681. }.bind(this);
  11682. return mover;
  11683. }.bind(this);
  11684. var clear = function(){
  11685. clearTimeout(timer);
  11686. held = false;
  11687. };
  11688. this.keyboard.addEvents({
  11689. 'keydown:shift+up': move(-1),
  11690. 'keydown:shift+down': move(1),
  11691. 'keyup:shift+up': clear,
  11692. 'keyup:shift+down': clear,
  11693. 'keyup:up': clear,
  11694. 'keyup:down': clear
  11695. });
  11696. var shiftHint = '';
  11697. if (this.options.allowMultiSelect && this.options.shiftForMultiSelect && this.options.useKeyboard){
  11698. shiftHint = ' (Shift multi-selects).';
  11699. }
  11700. this.keyboard.addShortcuts({
  11701. 'Select Previous Row': {
  11702. keys: 'up',
  11703. shortcut: 'up arrow',
  11704. handler: move(-1),
  11705. description: 'Select the previous row in the table.' + shiftHint
  11706. },
  11707. 'Select Next Row': {
  11708. keys: 'down',
  11709. shortcut: 'down arrow',
  11710. handler: move(1),
  11711. description: 'Select the next row in the table.' + shiftHint
  11712. }
  11713. });
  11714. }
  11715. this.keyboard[attach ? 'activate' : 'deactivate']();
  11716. }
  11717. this.updateSelects();
  11718. },
  11719. mouseleave: function(){
  11720. if (this.hovered) this.leaveRow(this.hovered);
  11721. }
  11722. });
  11723. /*
  11724. ---
  11725. script: HtmlTable.Sort.js
  11726. name: HtmlTable.Sort
  11727. description: Builds a stripy, sortable table with methods to add rows.
  11728. license: MIT-style license
  11729. authors:
  11730. - Harald Kirschner
  11731. - Aaron Newton
  11732. - Jacob Thornton
  11733. requires:
  11734. - Core/Hash
  11735. - HtmlTable
  11736. - Class.refactor
  11737. - Element.Delegation.Pseudo
  11738. - String.Extras
  11739. - Date
  11740. provides: [HtmlTable.Sort]
  11741. ...
  11742. */
  11743. (function(){
  11744. var readOnlyNess = document.createElement('table');
  11745. try {
  11746. readOnlyNess.innerHTML = '<tr><td></td></tr>';
  11747. readOnlyNess = readOnlyNess.childNodes.length === 0;
  11748. } catch (e){
  11749. readOnlyNess = true;
  11750. }
  11751. HtmlTable = Class.refactor(HtmlTable, {
  11752. options: {/*
  11753. onSort: function(){}, */
  11754. sortIndex: 0,
  11755. sortReverse: false,
  11756. parsers: [],
  11757. defaultParser: 'string',
  11758. classSortable: 'table-sortable',
  11759. classHeadSort: 'table-th-sort',
  11760. classHeadSortRev: 'table-th-sort-rev',
  11761. classNoSort: 'table-th-nosort',
  11762. classGroupHead: 'table-tr-group-head',
  11763. classGroup: 'table-tr-group',
  11764. classCellSort: 'table-td-sort',
  11765. classSortSpan: 'table-th-sort-span',
  11766. sortable: false,
  11767. thSelector: 'th'
  11768. },
  11769. initialize: function(){
  11770. this.previous.apply(this, arguments);
  11771. if (this.occluded) return this.occluded;
  11772. this.sorted = {index: null, dir: 1};
  11773. if (!this.bound) this.bound = {};
  11774. this.bound.headClick = this.headClick.bind(this);
  11775. this.sortSpans = new Elements();
  11776. if (this.options.sortable){
  11777. this.enableSort();
  11778. if (this.options.sortIndex != null) this.sort(this.options.sortIndex, this.options.sortReverse);
  11779. }
  11780. },
  11781. attachSorts: function(attach){
  11782. this.detachSorts();
  11783. if (attach !== false) this.element.addEvent('click:relay(' + this.options.thSelector + ')', this.bound.headClick);
  11784. },
  11785. detachSorts: function(){
  11786. this.element.removeEvents('click:relay(' + this.options.thSelector + ')');
  11787. },
  11788. setHeaders: function(){
  11789. this.previous.apply(this, arguments);
  11790. if (this.sortable) this.setParsers();
  11791. },
  11792. setParsers: function(){
  11793. this.parsers = this.detectParsers();
  11794. },
  11795. detectParsers: function(){
  11796. return this.head && this.head.getElements(this.options.thSelector).flatten().map(this.detectParser, this);
  11797. },
  11798. detectParser: function(cell, index){
  11799. if (cell.hasClass(this.options.classNoSort) || cell.retrieve('htmltable-parser')) return cell.retrieve('htmltable-parser');
  11800. var thDiv = new Element('div');
  11801. thDiv.adopt(cell.childNodes).inject(cell);
  11802. var sortSpan = new Element('span', {'class': this.options.classSortSpan}).inject(thDiv, 'top');
  11803. this.sortSpans.push(sortSpan);
  11804. var parser = this.options.parsers[index],
  11805. rows = this.body.rows,
  11806. cancel;
  11807. switch (typeOf(parser)){
  11808. case 'function': parser = {convert: parser}; cancel = true; break;
  11809. case 'string': parser = parser; cancel = true; break;
  11810. }
  11811. if (!cancel){
  11812. HtmlTable.ParserPriority.some(function(parserName){
  11813. var current = HtmlTable.Parsers[parserName],
  11814. match = current.match;
  11815. if (!match) return false;
  11816. for (var i = 0, j = rows.length; i < j; i++){
  11817. var cell = document.id(rows[i].cells[index]),
  11818. text = cell ? cell.get('html').clean() : '';
  11819. if (text && match.test(text)){
  11820. parser = current;
  11821. return true;
  11822. }
  11823. }
  11824. });
  11825. }
  11826. if (!parser) parser = this.options.defaultParser;
  11827. cell.store('htmltable-parser', parser);
  11828. return parser;
  11829. },
  11830. headClick: function(event, el){
  11831. if (!this.head || el.hasClass(this.options.classNoSort)) return;
  11832. return this.sort(Array.indexOf(this.head.getElements(this.options.thSelector).flatten(), el) % this.body.rows[0].cells.length);
  11833. },
  11834. serialize: function(){
  11835. var previousSerialization = this.previous.apply(this, arguments) || {};
  11836. if (this.options.sortable){
  11837. previousSerialization.sortIndex = this.sorted.index;
  11838. previousSerialization.sortReverse = this.sorted.reverse;
  11839. }
  11840. return previousSerialization;
  11841. },
  11842. restore: function(tableState){
  11843. if (this.options.sortable && tableState.sortIndex){
  11844. this.sort(tableState.sortIndex, tableState.sortReverse);
  11845. }
  11846. this.previous.apply(this, arguments);
  11847. },
  11848. setSortedState: function(index, reverse){
  11849. if (reverse != null) this.sorted.reverse = reverse;
  11850. else if (this.sorted.index == index) this.sorted.reverse = !this.sorted.reverse;
  11851. else this.sorted.reverse = this.sorted.index == null;
  11852. if (index != null) this.sorted.index = index;
  11853. },
  11854. setHeadSort: function(sorted){
  11855. var head = $$(!this.head.length ? this.head.cells[this.sorted.index] : this.head.map(function(row){
  11856. return row.getElements(this.options.thSelector)[this.sorted.index];
  11857. }, this).clean());
  11858. if (!head.length) return;
  11859. if (sorted){
  11860. head.addClass(this.options.classHeadSort);
  11861. if (this.sorted.reverse) head.addClass(this.options.classHeadSortRev);
  11862. else head.removeClass(this.options.classHeadSortRev);
  11863. } else {
  11864. head.removeClass(this.options.classHeadSort).removeClass(this.options.classHeadSortRev);
  11865. }
  11866. },
  11867. setRowSort: function(data, pre){
  11868. var count = data.length,
  11869. body = this.body,
  11870. group,
  11871. rowIndex;
  11872. while (count){
  11873. var item = data[--count],
  11874. position = item.position,
  11875. row = body.rows[position];
  11876. if (row.disabled) continue;
  11877. if (!pre){
  11878. group = this.setGroupSort(group, row, item);
  11879. this.setRowStyle(row, count);
  11880. }
  11881. body.appendChild(row);
  11882. for (rowIndex = 0; rowIndex < count; rowIndex++){
  11883. if (data[rowIndex].position > position) data[rowIndex].position--;
  11884. }
  11885. }
  11886. },
  11887. setRowStyle: function(row, i){
  11888. this.previous(row, i);
  11889. row.cells[this.sorted.index].addClass(this.options.classCellSort);
  11890. },
  11891. setGroupSort: function(group, row, item){
  11892. if (group == item.value) row.removeClass(this.options.classGroupHead).addClass(this.options.classGroup);
  11893. else row.removeClass(this.options.classGroup).addClass(this.options.classGroupHead);
  11894. return item.value;
  11895. },
  11896. getParser: function(){
  11897. var parser = this.parsers[this.sorted.index];
  11898. return typeOf(parser) == 'string' ? HtmlTable.Parsers[parser] : parser;
  11899. },
  11900. sort: function(index, reverse, pre, sortFunction){
  11901. if (!this.head) return;
  11902. if (!pre){
  11903. this.clearSort();
  11904. this.setSortedState(index, reverse);
  11905. this.setHeadSort(true);
  11906. }
  11907. var parser = this.getParser();
  11908. if (!parser) return;
  11909. var rel;
  11910. if (!readOnlyNess){
  11911. rel = this.body.getParent();
  11912. this.body.dispose();
  11913. }
  11914. var data = this.parseData(parser).sort(sortFunction ? sortFunction : function(a, b){
  11915. if (a.value === b.value) return 0;
  11916. return a.value > b.value ? 1 : -1;
  11917. });
  11918. var reversed = this.sorted.reverse == (parser == HtmlTable.Parsers['input-checked']);
  11919. if (reversed) data.reverse(true);
  11920. this.setRowSort(data, pre);
  11921. if (rel) rel.grab(this.body);
  11922. this.fireEvent('stateChanged');
  11923. return this.fireEvent('sort', [this.body, this.sorted.index, reversed ? 'asc' : 'desc']);
  11924. },
  11925. parseData: function(parser){
  11926. return Array.map(this.body.rows, function(row, i){
  11927. var value = parser.convert.call(document.id(row.cells[this.sorted.index]));
  11928. return {
  11929. position: i,
  11930. value: value
  11931. };
  11932. }, this);
  11933. },
  11934. clearSort: function(){
  11935. this.setHeadSort(false);
  11936. this.body.getElements('td').removeClass(this.options.classCellSort);
  11937. },
  11938. reSort: function(){
  11939. if (this.sortable) this.sort.call(this, this.sorted.index, this.sorted.reverse);
  11940. return this;
  11941. },
  11942. enableSort: function(){
  11943. this.element.addClass(this.options.classSortable);
  11944. this.attachSorts(true);
  11945. this.setParsers();
  11946. this.sortable = true;
  11947. return this;
  11948. },
  11949. disableSort: function(){
  11950. this.element.removeClass(this.options.classSortable);
  11951. this.attachSorts(false);
  11952. this.sortSpans.each(function(span){
  11953. span.destroy();
  11954. });
  11955. this.sortSpans.empty();
  11956. this.sortable = false;
  11957. return this;
  11958. }
  11959. });
  11960. HtmlTable.ParserPriority = ['date', 'input-checked', 'input-value', 'float', 'number'];
  11961. HtmlTable.Parsers = {
  11962. 'date': {
  11963. match: /^\d{2}[-\/ ]\d{2}[-\/ ]\d{2,4}$/,
  11964. convert: function(){
  11965. var d = Date.parse(this.get('text').stripTags());
  11966. return (typeOf(d) == 'date') ? d.format('db') : '';
  11967. },
  11968. type: 'date'
  11969. },
  11970. 'input-checked': {
  11971. match: / type="(radio|checkbox)"/,
  11972. convert: function(){
  11973. return this.getElement('input').checked;
  11974. }
  11975. },
  11976. 'input-value': {
  11977. match: /<input/,
  11978. convert: function(){
  11979. return this.getElement('input').value;
  11980. }
  11981. },
  11982. 'number': {
  11983. match: /^\d+[^\d.,]*$/,
  11984. convert: function(){
  11985. return this.get('text').stripTags().toInt();
  11986. },
  11987. number: true
  11988. },
  11989. 'numberLax': {
  11990. match: /^[^\d]+\d+$/,
  11991. convert: function(){
  11992. return this.get('text').replace(/[^-?^0-9]/, '').stripTags().toInt();
  11993. },
  11994. number: true
  11995. },
  11996. 'float': {
  11997. match: /^[\d]+\.[\d]+/,
  11998. convert: function(){
  11999. return this.get('text').replace(/[^-?^\d.e]/, '').stripTags().toFloat();
  12000. },
  12001. number: true
  12002. },
  12003. 'floatLax': {
  12004. match: /^[^\d]+[\d]+\.[\d]+$/,
  12005. convert: function(){
  12006. return this.get('text').replace(/[^-?^\d.]/, '').stripTags().toFloat();
  12007. },
  12008. number: true
  12009. },
  12010. 'string': {
  12011. match: null,
  12012. convert: function(){
  12013. return this.get('text').stripTags().toLowerCase();
  12014. }
  12015. },
  12016. 'title': {
  12017. match: null,
  12018. convert: function(){
  12019. return this.title;
  12020. }
  12021. }
  12022. };
  12023. //<1.2compat>
  12024. HtmlTable.Parsers = new Hash(HtmlTable.Parsers);
  12025. //</1.2compat>
  12026. HtmlTable.defineParsers = function(parsers){
  12027. HtmlTable.Parsers = Object.append(HtmlTable.Parsers, parsers);
  12028. for (var parser in parsers){
  12029. HtmlTable.ParserPriority.unshift(parser);
  12030. }
  12031. };
  12032. })();
  12033. /*
  12034. ---
  12035. script: HtmlTable.Zebra.js
  12036. name: HtmlTable.Zebra
  12037. description: Builds a stripy table with methods to add rows.
  12038. license: MIT-style license
  12039. authors:
  12040. - Harald Kirschner
  12041. - Aaron Newton
  12042. requires:
  12043. - HtmlTable
  12044. - Element.Shortcuts
  12045. - Class.refactor
  12046. provides: [HtmlTable.Zebra]
  12047. ...
  12048. */
  12049. HtmlTable = Class.refactor(HtmlTable, {
  12050. options: {
  12051. classZebra: 'table-tr-odd',
  12052. zebra: true,
  12053. zebraOnlyVisibleRows: true
  12054. },
  12055. initialize: function(){
  12056. this.previous.apply(this, arguments);
  12057. if (this.occluded) return this.occluded;
  12058. if (this.options.zebra) this.updateZebras();
  12059. },
  12060. updateZebras: function(){
  12061. var index = 0;
  12062. Array.each(this.body.rows, function(row){
  12063. if (!this.options.zebraOnlyVisibleRows || row.isDisplayed()){
  12064. this.zebra(row, index++);
  12065. }
  12066. }, this);
  12067. },
  12068. setRowStyle: function(row, i){
  12069. if (this.previous) this.previous(row, i);
  12070. this.zebra(row, i);
  12071. },
  12072. zebra: function(row, i){
  12073. return row[((i % 2) ? 'remove' : 'add')+'Class'](this.options.classZebra);
  12074. },
  12075. push: function(){
  12076. var pushed = this.previous.apply(this, arguments);
  12077. if (this.options.zebra) this.updateZebras();
  12078. return pushed;
  12079. }
  12080. });
  12081. /*
  12082. ---
  12083. script: Scroller.js
  12084. name: Scroller
  12085. description: Class which scrolls the contents of any Element (including the window) when the mouse reaches the Element's boundaries.
  12086. license: MIT-style license
  12087. authors:
  12088. - Valerio Proietti
  12089. requires:
  12090. - Core/Events
  12091. - Core/Options
  12092. - Core/Element.Event
  12093. - Core/Element.Dimensions
  12094. - MooTools.More
  12095. provides: [Scroller]
  12096. ...
  12097. */
  12098. (function(){
  12099. var Scroller = this.Scroller = new Class({
  12100. Implements: [Events, Options],
  12101. options: {
  12102. area: 20,
  12103. velocity: 1,
  12104. onChange: function(x, y){
  12105. this.element.scrollTo(x, y);
  12106. },
  12107. fps: 50
  12108. },
  12109. initialize: function(element, options){
  12110. this.setOptions(options);
  12111. this.element = document.id(element);
  12112. this.docBody = document.id(this.element.getDocument().body);
  12113. this.listener = (typeOf(this.element) != 'element') ? this.docBody : this.element;
  12114. this.timer = null;
  12115. this.bound = {
  12116. attach: this.attach.bind(this),
  12117. detach: this.detach.bind(this),
  12118. getCoords: this.getCoords.bind(this)
  12119. };
  12120. },
  12121. start: function(){
  12122. this.listener.addEvents({
  12123. mouseover: this.bound.attach,
  12124. mouseleave: this.bound.detach
  12125. });
  12126. return this;
  12127. },
  12128. stop: function(){
  12129. this.listener.removeEvents({
  12130. mouseover: this.bound.attach,
  12131. mouseleave: this.bound.detach
  12132. });
  12133. this.detach();
  12134. this.timer = clearInterval(this.timer);
  12135. return this;
  12136. },
  12137. attach: function(){
  12138. this.listener.addEvent('mousemove', this.bound.getCoords);
  12139. },
  12140. detach: function(){
  12141. this.listener.removeEvent('mousemove', this.bound.getCoords);
  12142. this.timer = clearInterval(this.timer);
  12143. },
  12144. getCoords: function(event){
  12145. this.page = (this.listener.get('tag') == 'body') ? event.client : event.page;
  12146. if (!this.timer) this.timer = this.scroll.periodical(Math.round(1000 / this.options.fps), this);
  12147. },
  12148. scroll: function(){
  12149. var size = this.element.getSize(),
  12150. scroll = this.element.getScroll(),
  12151. pos = ((this.element != this.docBody) && (this.element != window)) ? this.element.getOffsets() : {x: 0, y: 0},
  12152. scrollSize = this.element.getScrollSize(),
  12153. change = {x: 0, y: 0},
  12154. top = this.options.area.top || this.options.area,
  12155. bottom = this.options.area.bottom || this.options.area;
  12156. for (var z in this.page){
  12157. if (this.page[z] < (top + pos[z]) && scroll[z] != 0){
  12158. change[z] = (this.page[z] - top - pos[z]) * this.options.velocity;
  12159. } else if (this.page[z] + bottom > (size[z] + pos[z]) && scroll[z] + size[z] != scrollSize[z]){
  12160. change[z] = (this.page[z] - size[z] + bottom - pos[z]) * this.options.velocity;
  12161. }
  12162. change[z] = change[z].round();
  12163. }
  12164. if (change.y || change.x) this.fireEvent('change', [scroll.x + change.x, scroll.y + change.y]);
  12165. }
  12166. });
  12167. })();
  12168. /*
  12169. ---
  12170. script: Tips.js
  12171. name: Tips
  12172. description: Class for creating nice tips that follow the mouse cursor when hovering an element.
  12173. license: MIT-style license
  12174. authors:
  12175. - Valerio Proietti
  12176. - Christoph Pojer
  12177. - Luis Merino
  12178. requires:
  12179. - Core/Options
  12180. - Core/Events
  12181. - Core/Element.Event
  12182. - Core/Element.Style
  12183. - Core/Element.Dimensions
  12184. - MooTools.More
  12185. provides: [Tips]
  12186. ...
  12187. */
  12188. (function(){
  12189. var read = function(option, element){
  12190. return (option) ? (typeOf(option) == 'function' ? option(element) : element.get(option)) : '';
  12191. };
  12192. var Tips = this.Tips = new Class({
  12193. Implements: [Events, Options],
  12194. options: {/*
  12195. id: null,
  12196. onAttach: function(element){},
  12197. onDetach: function(element){},
  12198. onBound: function(coords){},*/
  12199. onShow: function(){
  12200. this.tip.setStyle('display', 'block');
  12201. },
  12202. onHide: function(){
  12203. this.tip.setStyle('display', 'none');
  12204. },
  12205. title: 'title',
  12206. text: function(element){
  12207. return element.get('rel') || element.get('href');
  12208. },
  12209. showDelay: 100,
  12210. hideDelay: 100,
  12211. className: 'tip-wrap',
  12212. offset: {x: 16, y: 16},
  12213. windowPadding: {x:0, y:0},
  12214. fixed: false,
  12215. waiAria: true,
  12216. hideEmpty: false
  12217. },
  12218. initialize: function(){
  12219. var params = Array.link(arguments, {
  12220. options: Type.isObject,
  12221. elements: function(obj){
  12222. return obj != null;
  12223. }
  12224. });
  12225. this.setOptions(params.options);
  12226. if (params.elements) this.attach(params.elements);
  12227. this.container = new Element('div', {'class': 'tip'});
  12228. if (this.options.id){
  12229. this.container.set('id', this.options.id);
  12230. if (this.options.waiAria) this.attachWaiAria();
  12231. }
  12232. },
  12233. toElement: function(){
  12234. if (this.tip) return this.tip;
  12235. this.tip = new Element('div', {
  12236. 'class': this.options.className,
  12237. styles: {
  12238. position: 'absolute',
  12239. top: 0,
  12240. left: 0,
  12241. display: 'none'
  12242. }
  12243. }).adopt(
  12244. new Element('div', {'class': 'tip-top'}),
  12245. this.container,
  12246. new Element('div', {'class': 'tip-bottom'})
  12247. );
  12248. return this.tip;
  12249. },
  12250. attachWaiAria: function(){
  12251. var id = this.options.id;
  12252. this.container.set('role', 'tooltip');
  12253. if (!this.waiAria){
  12254. this.waiAria = {
  12255. show: function(element){
  12256. if (id) element.set('aria-describedby', id);
  12257. this.container.set('aria-hidden', 'false');
  12258. },
  12259. hide: function(element){
  12260. if (id) element.erase('aria-describedby');
  12261. this.container.set('aria-hidden', 'true');
  12262. }
  12263. };
  12264. }
  12265. this.addEvents(this.waiAria);
  12266. },
  12267. detachWaiAria: function(){
  12268. if (this.waiAria){
  12269. this.container.erase('role');
  12270. this.container.erase('aria-hidden');
  12271. this.removeEvents(this.waiAria);
  12272. }
  12273. },
  12274. attach: function(elements){
  12275. $$(elements).each(function(element){
  12276. var title = read(this.options.title, element),
  12277. text = read(this.options.text, element);
  12278. element.set('title', '').store('tip:native', title).retrieve('tip:title', title);
  12279. element.retrieve('tip:text', text);
  12280. this.fireEvent('attach', [element]);
  12281. var events = ['enter', 'leave'];
  12282. if (!this.options.fixed) events.push('move');
  12283. events.each(function(value){
  12284. var event = element.retrieve('tip:' + value);
  12285. if (!event) event = function(event){
  12286. this['element' + value.capitalize()].apply(this, [event, element]);
  12287. }.bind(this);
  12288. element.store('tip:' + value, event).addEvent('mouse' + value, event);
  12289. }, this);
  12290. }, this);
  12291. return this;
  12292. },
  12293. detach: function(elements){
  12294. $$(elements).each(function(element){
  12295. ['enter', 'leave', 'move'].each(function(value){
  12296. element.removeEvent('mouse' + value, element.retrieve('tip:' + value)).eliminate('tip:' + value);
  12297. });
  12298. this.fireEvent('detach', [element]);
  12299. if (this.options.title == 'title'){ // This is necessary to check if we can revert the title
  12300. var original = element.retrieve('tip:native');
  12301. if (original) element.set('title', original);
  12302. }
  12303. }, this);
  12304. return this;
  12305. },
  12306. elementEnter: function(event, element){
  12307. clearTimeout(this.timer);
  12308. this.timer = (function(){
  12309. this.container.empty();
  12310. var showTip = !this.options.hideEmpty;
  12311. ['title', 'text'].each(function(value){
  12312. var content = element.retrieve('tip:' + value);
  12313. var div = this['_' + value + 'Element'] = new Element('div', {
  12314. 'class': 'tip-' + value
  12315. }).inject(this.container);
  12316. if (content){
  12317. this.fill(div, content);
  12318. showTip = true;
  12319. }
  12320. }, this);
  12321. if (showTip){
  12322. this.show(element);
  12323. } else {
  12324. this.hide(element);
  12325. }
  12326. this.position((this.options.fixed) ? {page: element.getPosition()} : event);
  12327. }).delay(this.options.showDelay, this);
  12328. },
  12329. elementLeave: function(event, element){
  12330. clearTimeout(this.timer);
  12331. this.timer = this.hide.delay(this.options.hideDelay, this, element);
  12332. this.fireForParent(event, element);
  12333. },
  12334. setTitle: function(title){
  12335. if (this._titleElement){
  12336. this._titleElement.empty();
  12337. this.fill(this._titleElement, title);
  12338. }
  12339. return this;
  12340. },
  12341. setText: function(text){
  12342. if (this._textElement){
  12343. this._textElement.empty();
  12344. this.fill(this._textElement, text);
  12345. }
  12346. return this;
  12347. },
  12348. fireForParent: function(event, element){
  12349. element = element.getParent();
  12350. if (!element || element == document.body) return;
  12351. if (element.retrieve('tip:enter')) element.fireEvent('mouseenter', event);
  12352. else this.fireForParent(event, element);
  12353. },
  12354. elementMove: function(event, element){
  12355. this.position(event);
  12356. },
  12357. position: function(event){
  12358. if (!this.tip) document.id(this);
  12359. var size = window.getSize(), scroll = window.getScroll(),
  12360. tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight},
  12361. props = {x: 'left', y: 'top'},
  12362. bounds = {y: false, x2: false, y2: false, x: false},
  12363. obj = {};
  12364. for (var z in props){
  12365. obj[props[z]] = event.page[z] + this.options.offset[z];
  12366. if (obj[props[z]] < 0) bounds[z] = true;
  12367. if ((obj[props[z]] + tip[z] - scroll[z]) > size[z] - this.options.windowPadding[z]){
  12368. obj[props[z]] = event.page[z] - this.options.offset[z] - tip[z];
  12369. bounds[z+'2'] = true;
  12370. }
  12371. }
  12372. this.fireEvent('bound', bounds);
  12373. this.tip.setStyles(obj);
  12374. },
  12375. fill: function(element, contents){
  12376. if (typeof contents == 'string') element.set('html', contents);
  12377. else element.adopt(contents);
  12378. },
  12379. show: function(element){
  12380. if (!this.tip) document.id(this);
  12381. if (!this.tip.getParent()) this.tip.inject(document.body);
  12382. this.fireEvent('show', [this.tip, element]);
  12383. },
  12384. hide: function(element){
  12385. if (!this.tip) document.id(this);
  12386. this.fireEvent('hide', [this.tip, element]);
  12387. }
  12388. });
  12389. })();
  12390. /*
  12391. ---
  12392. name: Locale.CH.Number
  12393. description: Number messages for Switzerland.
  12394. license: MIT-style license
  12395. authors:
  12396. - Kim D. Jeker
  12397. requires:
  12398. - Locale
  12399. provides: [Locale.CH.Number]
  12400. ...
  12401. */
  12402. Locale.define('CH', 'Number', {
  12403. decimal: ',',
  12404. group: '\'',
  12405. currency: {
  12406. decimal: '.',
  12407. suffix: ' CHF'
  12408. }
  12409. });
  12410. /*
  12411. ---
  12412. name: Locale.EU.Number
  12413. description: Number messages for Europe.
  12414. license: MIT-style license
  12415. authors:
  12416. - Arian Stolwijk
  12417. requires:
  12418. - Locale
  12419. provides: [Locale.EU.Number]
  12420. ...
  12421. */
  12422. Locale.define('EU', 'Number', {
  12423. decimal: ',',
  12424. group: '.',
  12425. currency: {
  12426. prefix: '€ '
  12427. }
  12428. });
  12429. /*
  12430. ---
  12431. script: Locale.Set.From.js
  12432. name: Locale.Set.From
  12433. description: Provides an alternative way to create Locale.Set objects.
  12434. license: MIT-style license
  12435. authors:
  12436. - Tim Wienk
  12437. requires:
  12438. - Core/JSON
  12439. - Locale
  12440. provides: Locale.Set.From
  12441. ...
  12442. */
  12443. (function(){
  12444. var parsers = {
  12445. 'json': JSON.decode
  12446. };
  12447. Locale.Set.defineParser = function(name, fn){
  12448. parsers[name] = fn;
  12449. };
  12450. Locale.Set.from = function(set, type){
  12451. if (instanceOf(set, Locale.Set)) return set;
  12452. if (!type && typeOf(set) == 'string') type = 'json';
  12453. if (parsers[type]) set = parsers[type](set);
  12454. var locale = new Locale.Set;
  12455. locale.sets = set.sets || {};
  12456. if (set.inherits){
  12457. locale.inherits.locales = Array.convert(set.inherits.locales);
  12458. locale.inherits.sets = set.inherits.sets || {};
  12459. }
  12460. return locale;
  12461. };
  12462. })();
  12463. /*
  12464. ---
  12465. name: Locale.ZA.Number
  12466. description: Number messages for ZA.
  12467. license: MIT-style license
  12468. authors:
  12469. - Werner Mollentze
  12470. requires:
  12471. - Locale
  12472. provides: [Locale.ZA.Number]
  12473. ...
  12474. */
  12475. Locale.define('ZA', 'Number', {
  12476. decimal: '.',
  12477. group: ',',
  12478. currency: {
  12479. prefix: 'R '
  12480. }
  12481. });
  12482. /*
  12483. ---
  12484. name: Locale.af-ZA.Date
  12485. description: Date messages for ZA Afrikaans.
  12486. license: MIT-style license
  12487. authors:
  12488. - Werner Mollentze
  12489. requires:
  12490. - Locale
  12491. provides: [Locale.af-ZA.Date]
  12492. ...
  12493. */
  12494. Locale.define('af-ZA', 'Date', {
  12495. months: ['Januarie', 'Februarie', 'Maart', 'April', 'Mei', 'Junie', 'Julie', 'Augustus', 'September', 'Oktober', 'November', 'Desember'],
  12496. months_abbr: ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
  12497. days: ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'],
  12498. days_abbr: ['Son', 'Maa', 'Din', 'Woe', 'Don', 'Vry', 'Sat'],
  12499. // Culture's date order: MM/DD/YYYY
  12500. dateOrder: ['date', 'month', 'year'],
  12501. shortDate: '%d-%m-%Y',
  12502. shortTime: '%H:%M',
  12503. AM: 'VM',
  12504. PM: 'NM',
  12505. firstDayOfWeek: 1,
  12506. // Date.Extras
  12507. ordinal: function(dayOfMonth){
  12508. return ((dayOfMonth > 1 && dayOfMonth < 20 && dayOfMonth != 8) || (dayOfMonth > 100 && dayOfMonth.toString().substr(-2, 1) == '1')) ? 'de' : 'ste';
  12509. },
  12510. lessThanMinuteAgo: 'minder as \'n minuut gelede',
  12511. minuteAgo: 'ongeveer \'n minuut gelede',
  12512. minutesAgo: '{delta} minute gelede',
  12513. hourAgo: 'omtret \'n uur gelede',
  12514. hoursAgo: 'ongeveer {delta} ure gelede',
  12515. dayAgo: '1 dag gelede',
  12516. daysAgo: '{delta} dae gelede',
  12517. weekAgo: '1 week gelede',
  12518. weeksAgo: '{delta} weke gelede',
  12519. monthAgo: '1 maand gelede',
  12520. monthsAgo: '{delta} maande gelede',
  12521. yearAgo: '1 jaar gelede',
  12522. yearsAgo: '{delta} jare gelede',
  12523. lessThanMinuteUntil: 'oor minder as \'n minuut',
  12524. minuteUntil: 'oor ongeveer \'n minuut',
  12525. minutesUntil: 'oor {delta} minute',
  12526. hourUntil: 'oor ongeveer \'n uur',
  12527. hoursUntil: 'oor {delta} uur',
  12528. dayUntil: 'oor ongeveer \'n dag',
  12529. daysUntil: 'oor {delta} dae',
  12530. weekUntil: 'oor \'n week',
  12531. weeksUntil: 'oor {delta} weke',
  12532. monthUntil: 'oor \'n maand',
  12533. monthsUntil: 'oor {delta} maande',
  12534. yearUntil: 'oor \'n jaar',
  12535. yearsUntil: 'oor {delta} jaar'
  12536. });
  12537. /*
  12538. ---
  12539. name: Locale.af-ZA.Form.Validator
  12540. description: Form Validator messages for Afrikaans.
  12541. license: MIT-style license
  12542. authors:
  12543. - Werner Mollentze
  12544. requires:
  12545. - Locale
  12546. provides: [Locale.af-ZA.Form.Validator]
  12547. ...
  12548. */
  12549. Locale.define('af-ZA', 'FormValidator', {
  12550. required: 'Hierdie veld word vereis.',
  12551. length: 'Voer asseblief {length} karakters in (u het {elLength} karakters ingevoer)',
  12552. minLength: 'Voer asseblief ten minste {minLength} karakters in (u het {length} karakters ingevoer).',
  12553. maxLength: 'Moet asseblief nie meer as {maxLength} karakters invoer nie (u het {length} karakters ingevoer).',
  12554. integer: 'Voer asseblief \'n heelgetal in hierdie veld in. Getalle met desimale (bv. 1.25) word nie toegelaat nie.',
  12555. numeric: 'Voer asseblief slegs numeriese waardes in hierdie veld in (bv. "1" of "1.1" of "-1" of "-1.1").',
  12556. digits: 'Gebruik asseblief slegs nommers en punktuasie in hierdie veld. (by voorbeeld, \'n telefoon nommer wat koppeltekens en punte bevat is toelaatbaar).',
  12557. alpha: 'Gebruik asseblief slegs letters (a-z) binne-in hierdie veld. Geen spasies of ander karakters word toegelaat nie.',
  12558. alphanum: 'Gebruik asseblief slegs letters (a-z) en nommers (0-9) binne-in hierdie veld. Geen spasies of ander karakters word toegelaat nie.',
  12559. dateSuchAs: 'Voer asseblief \'n geldige datum soos {date} in',
  12560. dateInFormatMDY: 'Voer asseblief \'n geldige datum soos MM/DD/YYYY in (bv. "12/31/1999")',
  12561. email: 'Voer asseblief \'n geldige e-pos adres in. Byvoorbeeld "fred@domain.com".',
  12562. url: 'Voer asseblief \'n geldige bronadres (URL) soos http://www.example.com in.',
  12563. currencyDollar: 'Voer asseblief \'n geldige $ bedrag in. Byvoorbeeld $100.00 .',
  12564. oneRequired: 'Voer asseblief iets in vir ten minste een van hierdie velde.',
  12565. errorPrefix: 'Fout: ',
  12566. warningPrefix: 'Waarskuwing: ',
  12567. // Form.Validator.Extras
  12568. noSpace: 'Daar mag geen spasies in hierdie toevoer wees nie.',
  12569. reqChkByNode: 'Geen items is gekies nie.',
  12570. requiredChk: 'Hierdie veld word vereis.',
  12571. reqChkByName: 'Kies asseblief \'n {label}.',
  12572. match: 'Hierdie veld moet by die {matchName} veld pas',
  12573. startDate: 'die begin datum',
  12574. endDate: 'die eind datum',
  12575. currentDate: 'die huidige datum',
  12576. afterDate: 'Die datum moet dieselfde of na {label} wees.',
  12577. beforeDate: 'Die datum moet dieselfde of voor {label} wees.',
  12578. startMonth: 'Kies asseblief \'n begin maand',
  12579. sameMonth: 'Hierdie twee datums moet in dieselfde maand wees - u moet een of beide verander.',
  12580. creditcard: 'Die ingevoerde kredietkaart nommer is ongeldig. Bevestig asseblief die nommer en probeer weer. {length} syfers is ingevoer.'
  12581. });
  12582. /*
  12583. ---
  12584. name: Locale.af-ZA.Number
  12585. description: Number messages for ZA Afrikaans.
  12586. license: MIT-style license
  12587. authors:
  12588. - Werner Mollentze
  12589. requires:
  12590. - Locale
  12591. - Locale.ZA.Number
  12592. provides: [Locale.af-ZA.Number]
  12593. ...
  12594. */
  12595. Locale.define('af-ZA').inherit('ZA', 'Number');
  12596. /*
  12597. ---
  12598. name: Locale.ar.Date
  12599. description: Date messages for Arabic.
  12600. license: MIT-style license
  12601. authors:
  12602. - Chafik Barbar
  12603. requires:
  12604. - Locale
  12605. provides: [Locale.ar.Date]
  12606. ...
  12607. */
  12608. Locale.define('ar', 'Date', {
  12609. // Culture's date order: DD/MM/YYYY
  12610. dateOrder: ['date', 'month', 'year'],
  12611. shortDate: '%d/%m/%Y',
  12612. shortTime: '%H:%M'
  12613. });
  12614. /*
  12615. ---
  12616. name: Locale.ar.Form.Validator
  12617. description: Form Validator messages for Arabic.
  12618. license: MIT-style license
  12619. authors:
  12620. - Chafik Barbar
  12621. requires:
  12622. - Locale
  12623. provides: [Locale.ar.Form.Validator]
  12624. ...
  12625. */
  12626. Locale.define('ar', 'FormValidator', {
  12627. required: 'هذا الحقل مطلوب.',
  12628. minLength: 'رجاءً إدخال {minLength} أحرف على الأقل (تم إدخال {length} أحرف).',
  12629. maxLength: 'الرجاء عدم إدخال أكثر من {maxLength} أحرف (تم إدخال {length} أحرف).',
  12630. integer: 'الرجاء إدخال عدد صحيح في هذا الحقل. أي رقم ذو كسر عشري أو مئوي (مثال 1.25 ) غير مسموح.',
  12631. numeric: 'الرجاء إدخال قيم رقمية في هذا الحقل (مثال "1" أو "1.1" أو "-1" أو "-1.1").',
  12632. digits: 'الرجاء أستخدام قيم رقمية وعلامات ترقيمية فقط في هذا الحقل (مثال, رقم هاتف مع نقطة أو شحطة)',
  12633. alpha: 'الرجاء أستخدام أحرف فقط (ا-ي) في هذا الحقل. أي فراغات أو علامات غير مسموحة.',
  12634. alphanum: 'الرجاء أستخدام أحرف فقط (ا-ي) أو أرقام (0-9) فقط في هذا الحقل. أي فراغات أو علامات غير مسموحة.',
  12635. dateSuchAs: 'الرجاء إدخال تاريخ صحيح كالتالي {date}',
  12636. dateInFormatMDY: 'الرجاء إدخال تاريخ صحيح (مثال, 31-12-1999)',
  12637. email: 'الرجاء إدخال بريد إلكتروني صحيح.',
  12638. url: 'الرجاء إدخال عنوان إلكتروني صحيح مثل http://www.example.com',
  12639. currencyDollar: 'الرجاء إدخال قيمة $ صحيحة. مثال, 100.00$',
  12640. oneRequired: 'الرجاء إدخال قيمة في أحد هذه الحقول على الأقل.',
  12641. errorPrefix: 'خطأ: ',
  12642. warningPrefix: 'تحذير: '
  12643. });
  12644. /*
  12645. ---
  12646. name: Locale.ca-CA.Date
  12647. description: Date messages for Catalan.
  12648. license: MIT-style license
  12649. authors:
  12650. - Ãlfons Sanchez
  12651. requires:
  12652. - Locale
  12653. provides: [Locale.ca-CA.Date]
  12654. ...
  12655. */
  12656. Locale.define('ca-CA', 'Date', {
  12657. months: ['Gener', 'Febrer', 'Març', 'Abril', 'Maig', 'Juny', 'Juli', 'Agost', 'Setembre', 'Octubre', 'Novembre', 'Desembre'],
  12658. months_abbr: ['gen.', 'febr.', 'març', 'abr.', 'maig', 'juny', 'jul.', 'ag.', 'set.', 'oct.', 'nov.', 'des.'],
  12659. days: ['Diumenge', 'Dilluns', 'Dimarts', 'Dimecres', 'Dijous', 'Divendres', 'Dissabte'],
  12660. days_abbr: ['dg', 'dl', 'dt', 'dc', 'dj', 'dv', 'ds'],
  12661. // Culture's date order: DD/MM/YYYY
  12662. dateOrder: ['date', 'month', 'year'],
  12663. shortDate: '%d/%m/%Y',
  12664. shortTime: '%H:%M',
  12665. AM: 'AM',
  12666. PM: 'PM',
  12667. firstDayOfWeek: 0,
  12668. // Date.Extras
  12669. ordinal: '',
  12670. lessThanMinuteAgo: 'fa menys d`un minut',
  12671. minuteAgo: 'fa un minut',
  12672. minutesAgo: 'fa {delta} minuts',
  12673. hourAgo: 'fa un hora',
  12674. hoursAgo: 'fa unes {delta} hores',
  12675. dayAgo: 'fa un dia',
  12676. daysAgo: 'fa {delta} dies',
  12677. lessThanMinuteUntil: 'menys d`un minut des d`ara',
  12678. minuteUntil: 'un minut des d`ara',
  12679. minutesUntil: '{delta} minuts des d`ara',
  12680. hourUntil: 'un hora des d`ara',
  12681. hoursUntil: 'unes {delta} hores des d`ara',
  12682. dayUntil: '1 dia des d`ara',
  12683. daysUntil: '{delta} dies des d`ara'
  12684. });
  12685. /*
  12686. ---
  12687. name: Locale.ca-CA.Form.Validator
  12688. description: Form Validator messages for Catalan.
  12689. license: MIT-style license
  12690. authors:
  12691. - Miquel Hudin
  12692. - Ãlfons Sanchez
  12693. requires:
  12694. - Locale
  12695. provides: [Locale.ca-CA.Form.Validator]
  12696. ...
  12697. */
  12698. Locale.define('ca-CA', 'FormValidator', {
  12699. required: 'Aquest camp es obligatori.',
  12700. minLength: 'Per favor introdueix al menys {minLength} caracters (has introduit {length} caracters).',
  12701. maxLength: 'Per favor introdueix no mes de {maxLength} caracters (has introduit {length} caracters).',
  12702. integer: 'Per favor introdueix un nombre enter en aquest camp. Nombres amb decimals (p.e. 1,25) no estan permesos.',
  12703. numeric: 'Per favor introdueix sols valors numerics en aquest camp (p.e. "1" o "1,1" o "-1" o "-1,1").',
  12704. digits: 'Per favor usa sols numeros i puntuacio en aquest camp (per exemple, un nombre de telefon amb guions i punts no esta permes).',
  12705. alpha: 'Per favor utilitza lletres nomes (a-z) en aquest camp. No s´admiteixen espais ni altres caracters.',
  12706. alphanum: 'Per favor, utilitza nomes lletres (a-z) o numeros (0-9) en aquest camp. No s´admiteixen espais ni altres caracters.',
  12707. dateSuchAs: 'Per favor introdueix una data valida com {date}',
  12708. dateInFormatMDY: 'Per favor introdueix una data valida com DD/MM/YYYY (p.e. "31/12/1999")',
  12709. email: 'Per favor, introdueix una adreça de correu electronic valida. Per exemple, "fred@domain.com".',
  12710. url: 'Per favor introdueix una URL valida com http://www.example.com.',
  12711. currencyDollar: 'Per favor introdueix una quantitat valida de €. Per exemple €100,00 .',
  12712. oneRequired: 'Per favor introdueix alguna cosa per al menys una d´aquestes entrades.',
  12713. errorPrefix: 'Error: ',
  12714. warningPrefix: 'Avis: ',
  12715. // Form.Validator.Extras
  12716. noSpace: 'No poden haver espais en aquesta entrada.',
  12717. reqChkByNode: 'No hi han elements seleccionats.',
  12718. requiredChk: 'Aquest camp es obligatori.',
  12719. reqChkByName: 'Per favor selecciona una {label}.',
  12720. match: 'Aquest camp necessita coincidir amb el camp {matchName}',
  12721. startDate: 'la data de inici',
  12722. endDate: 'la data de fi',
  12723. currentDate: 'la data actual',
  12724. afterDate: 'La data deu ser igual o posterior a {label}.',
  12725. beforeDate: 'La data deu ser igual o anterior a {label}.',
  12726. startMonth: 'Per favor selecciona un mes d´orige',
  12727. sameMonth: 'Aquestes dos dates deuen estar dins del mateix mes - deus canviar una o altra.'
  12728. });
  12729. /*
  12730. ---
  12731. name: Locale.cs-CZ.Date
  12732. description: Date messages for Czech.
  12733. license: MIT-style license
  12734. authors:
  12735. - Jan Černý chemiX
  12736. - Christopher Zukowski
  12737. requires:
  12738. - Locale
  12739. provides: [Locale.cs-CZ.Date]
  12740. ...
  12741. */
  12742. (function(){
  12743. // Czech language pluralization rules, see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  12744. // one -> n is 1; 1
  12745. // few -> n in 2..4; 2-4
  12746. // other -> everything else 0, 5-999, 1.31, 2.31, 5.31...
  12747. var pluralize = function(n, one, few, other){
  12748. if (n == 1) return one;
  12749. else if (n == 2 || n == 3 || n == 4) return few;
  12750. else return other;
  12751. };
  12752. Locale.define('cs-CZ', 'Date', {
  12753. months: ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'],
  12754. months_abbr: ['ledna', 'února', 'března', 'dubna', 'května', 'června', 'července', 'srpna', 'září', 'října', 'listopadu', 'prosince'],
  12755. days: ['Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'],
  12756. days_abbr: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
  12757. // Culture's date order: DD.MM.YYYY
  12758. dateOrder: ['date', 'month', 'year'],
  12759. shortDate: '%d.%m.%Y',
  12760. shortTime: '%H:%M',
  12761. AM: 'dop.',
  12762. PM: 'odp.',
  12763. firstDayOfWeek: 1,
  12764. // Date.Extras
  12765. ordinal: '.',
  12766. lessThanMinuteAgo: 'před chvílí',
  12767. minuteAgo: 'přibližně před minutou',
  12768. minutesAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'minutou', 'minutami', 'minutami'); },
  12769. hourAgo: 'přibližně před hodinou',
  12770. hoursAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'hodinou', 'hodinami', 'hodinami'); },
  12771. dayAgo: 'před dnem',
  12772. daysAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'dnem', 'dny', 'dny'); },
  12773. weekAgo: 'před týdnem',
  12774. weeksAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'týdnem', 'týdny', 'týdny'); },
  12775. monthAgo: 'před měsícem',
  12776. monthsAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'měsícem', 'měsíci', 'měsíci'); },
  12777. yearAgo: 'před rokem',
  12778. yearsAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'rokem', 'lety', 'lety'); },
  12779. lessThanMinuteUntil: 'za chvíli',
  12780. minuteUntil: 'přibližně za minutu',
  12781. minutesUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'minutu', 'minuty', 'minut'); },
  12782. hourUntil: 'přibližně za hodinu',
  12783. hoursUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'hodinu', 'hodiny', 'hodin'); },
  12784. dayUntil: 'za den',
  12785. daysUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'den', 'dny', 'dnů'); },
  12786. weekUntil: 'za týden',
  12787. weeksUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'týden', 'týdny', 'týdnů'); },
  12788. monthUntil: 'za měsíc',
  12789. monthsUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'měsíc', 'měsíce', 'měsíců'); },
  12790. yearUntil: 'za rok',
  12791. yearsUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'rok', 'roky', 'let'); }
  12792. });
  12793. })();
  12794. /*
  12795. ---
  12796. name: Locale.cs-CZ.Form.Validator
  12797. description: Form Validator messages for Czech.
  12798. license: MIT-style license
  12799. authors:
  12800. - Jan Černý chemiX
  12801. requires:
  12802. - Locale
  12803. provides: [Locale.cs-CZ.Form.Validator]
  12804. ...
  12805. */
  12806. Locale.define('cs-CZ', 'FormValidator', {
  12807. required: 'Tato položka je povinná.',
  12808. minLength: 'Zadejte prosím alespoň {minLength} znaků (napsáno {length} znaků).',
  12809. maxLength: 'Zadejte prosím méně než {maxLength} znaků (nápsáno {length} znaků).',
  12810. integer: 'Zadejte prosím celé číslo. Desetinná čísla (např. 1.25) nejsou povolena.',
  12811. numeric: 'Zadejte jen číselné hodnoty (tj. "1" nebo "1.1" nebo "-1" nebo "-1.1").',
  12812. digits: 'Zadejte prosím pouze čísla a interpunkční znaménka(například telefonní číslo s pomlčkami nebo tečkami je povoleno).',
  12813. alpha: 'Zadejte prosím pouze písmena (a-z). Mezery nebo jiné znaky nejsou povoleny.',
  12814. alphanum: 'Zadejte prosím pouze písmena (a-z) nebo číslice (0-9). Mezery nebo jiné znaky nejsou povoleny.',
  12815. dateSuchAs: 'Zadejte prosím platné datum jako {date}',
  12816. dateInFormatMDY: 'Zadejte prosím platné datum jako MM / DD / RRRR (tj. "12/31/1999")',
  12817. email: 'Zadejte prosím platnou e-mailovou adresu. Například "fred@domain.com".',
  12818. url: 'Zadejte prosím platnou URL adresu jako http://www.example.com.',
  12819. currencyDollar: 'Zadejte prosím platnou částku. Například $100.00.',
  12820. oneRequired: 'Zadejte prosím alespoň jednu hodnotu pro tyto položky.',
  12821. errorPrefix: 'Chyba: ',
  12822. warningPrefix: 'Upozornění: ',
  12823. // Form.Validator.Extras
  12824. noSpace: 'V této položce nejsou povoleny mezery',
  12825. reqChkByNode: 'Nejsou vybrány žádné položky.',
  12826. requiredChk: 'Tato položka je vyžadována.',
  12827. reqChkByName: 'Prosím vyberte {label}.',
  12828. match: 'Tato položka se musí shodovat s položkou {matchName}',
  12829. startDate: 'datum zahájení',
  12830. endDate: 'datum ukončení',
  12831. currentDate: 'aktuální datum',
  12832. afterDate: 'Datum by mělo být stejné nebo větší než {label}.',
  12833. beforeDate: 'Datum by mělo být stejné nebo menší než {label}.',
  12834. startMonth: 'Vyberte počáteční měsíc.',
  12835. sameMonth: 'Tyto dva datumy musí být ve stejném měsíci - změňte jeden z nich.',
  12836. creditcard: 'Zadané číslo kreditní karty je neplatné. Prosím opravte ho. Bylo zadáno {length} čísel.'
  12837. });
  12838. /*
  12839. ---
  12840. name: Locale.da-DK.Date
  12841. description: Date messages for Danish.
  12842. license: MIT-style license
  12843. authors:
  12844. - Martin Overgaard
  12845. - Henrik Hansen
  12846. requires:
  12847. - Locale
  12848. provides: [Locale.da-DK.Date]
  12849. ...
  12850. */
  12851. Locale.define('da-DK', 'Date', {
  12852. months: ['Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December'],
  12853. months_abbr: ['jan.', 'feb.', 'mar.', 'apr.', 'maj.', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
  12854. days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
  12855. days_abbr: ['søn', 'man', 'tir', 'ons', 'tor', 'fre', 'lør'],
  12856. // Culture's date order: DD-MM-YYYY
  12857. dateOrder: ['date', 'month', 'year'],
  12858. shortDate: '%d-%m-%Y',
  12859. shortTime: '%H:%M',
  12860. AM: 'AM',
  12861. PM: 'PM',
  12862. firstDayOfWeek: 1,
  12863. // Date.Extras
  12864. ordinal: '.',
  12865. lessThanMinuteAgo: 'mindre end et minut siden',
  12866. minuteAgo: 'omkring et minut siden',
  12867. minutesAgo: '{delta} minutter siden',
  12868. hourAgo: 'omkring en time siden',
  12869. hoursAgo: 'omkring {delta} timer siden',
  12870. dayAgo: '1 dag siden',
  12871. daysAgo: '{delta} dage siden',
  12872. weekAgo: '1 uge siden',
  12873. weeksAgo: '{delta} uger siden',
  12874. monthAgo: '1 måned siden',
  12875. monthsAgo: '{delta} måneder siden',
  12876. yearAgo: '1 år siden',
  12877. yearsAgo: '{delta} år siden',
  12878. lessThanMinuteUntil: 'mindre end et minut fra nu',
  12879. minuteUntil: 'omkring et minut fra nu',
  12880. minutesUntil: '{delta} minutter fra nu',
  12881. hourUntil: 'omkring en time fra nu',
  12882. hoursUntil: 'omkring {delta} timer fra nu',
  12883. dayUntil: '1 dag fra nu',
  12884. daysUntil: '{delta} dage fra nu',
  12885. weekUntil: '1 uge fra nu',
  12886. weeksUntil: '{delta} uger fra nu',
  12887. monthUntil: '1 måned fra nu',
  12888. monthsUntil: '{delta} måneder fra nu',
  12889. yearUntil: '1 år fra nu',
  12890. yearsUntil: '{delta} år fra nu'
  12891. });
  12892. /*
  12893. ---
  12894. name: Locale.da-DK.Form.Validator
  12895. description: Form Validator messages for Danish.
  12896. license: MIT-style license
  12897. authors:
  12898. - Martin Overgaard
  12899. requires:
  12900. - Locale
  12901. provides: [Locale.da-DK.Form.Validator]
  12902. ...
  12903. */
  12904. Locale.define('da-DK', 'FormValidator', {
  12905. required: 'Feltet skal udfyldes.',
  12906. minLength: 'Skriv mindst {minLength} tegn (du skrev {length} tegn).',
  12907. maxLength: 'Skriv maksimalt {maxLength} tegn (du skrev {length} tegn).',
  12908. integer: 'Skriv et tal i dette felt. Decimal tal (f.eks. 1.25) er ikke tilladt.',
  12909. numeric: 'Skriv kun tal i dette felt (i.e. "1" eller "1.1" eller "-1" eller "-1.1").',
  12910. digits: 'Skriv kun tal og tegnsætning i dette felt (eksempel, et telefon nummer med bindestreg eller punktum er tilladt).',
  12911. alpha: 'Skriv kun bogstaver (a-z) i dette felt. Mellemrum og andre tegn er ikke tilladt.',
  12912. alphanum: 'Skriv kun bogstaver (a-z) eller tal (0-9) i dette felt. Mellemrum og andre tegn er ikke tilladt.',
  12913. dateSuchAs: 'Skriv en gyldig dato som {date}',
  12914. dateInFormatMDY: 'Skriv dato i formatet DD-MM-YYYY (f.eks. "31-12-1999")',
  12915. email: 'Skriv en gyldig e-mail adresse. F.eks "fred@domain.com".',
  12916. url: 'Skriv en gyldig URL adresse. F.eks "http://www.example.com".',
  12917. currencyDollar: 'Skriv et gldigt beløb. F.eks Kr.100.00 .',
  12918. oneRequired: 'Et eller flere af felterne i denne formular skal udfyldes.',
  12919. errorPrefix: 'Fejl: ',
  12920. warningPrefix: 'Advarsel: ',
  12921. // Form.Validator.Extras
  12922. noSpace: 'Der må ikke benyttes mellemrum i dette felt.',
  12923. reqChkByNode: 'Foretag et valg.',
  12924. requiredChk: 'Dette felt skal udfyldes.',
  12925. reqChkByName: 'Vælg en {label}.',
  12926. match: 'Dette felt skal matche {matchName} feltet',
  12927. startDate: 'start dato',
  12928. endDate: 'slut dato',
  12929. currentDate: 'dags dato',
  12930. afterDate: 'Datoen skal være større end eller lig med {label}.',
  12931. beforeDate: 'Datoen skal være mindre end eller lig med {label}.',
  12932. startMonth: 'Vælg en start måned',
  12933. sameMonth: 'De valgte datoer skal være i samme måned - skift en af dem.'
  12934. });
  12935. /*
  12936. ---
  12937. name: Locale.de-DE.Date
  12938. description: Date messages for German.
  12939. license: MIT-style license
  12940. authors:
  12941. - Christoph Pojer
  12942. - Frank Rossi
  12943. - Ulrich Petri
  12944. - Fabian Beiner
  12945. requires:
  12946. - Locale
  12947. provides: [Locale.de-DE.Date]
  12948. ...
  12949. */
  12950. Locale.define('de-DE', 'Date', {
  12951. months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
  12952. months_abbr: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
  12953. days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
  12954. days_abbr: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
  12955. // Culture's date order: DD.MM.YYYY
  12956. dateOrder: ['date', 'month', 'year'],
  12957. shortDate: '%d.%m.%Y',
  12958. shortTime: '%H:%M',
  12959. AM: 'vormittags',
  12960. PM: 'nachmittags',
  12961. firstDayOfWeek: 1,
  12962. // Date.Extras
  12963. ordinal: '.',
  12964. lessThanMinuteAgo: 'vor weniger als einer Minute',
  12965. minuteAgo: 'vor einer Minute',
  12966. minutesAgo: 'vor {delta} Minuten',
  12967. hourAgo: 'vor einer Stunde',
  12968. hoursAgo: 'vor {delta} Stunden',
  12969. dayAgo: 'vor einem Tag',
  12970. daysAgo: 'vor {delta} Tagen',
  12971. weekAgo: 'vor einer Woche',
  12972. weeksAgo: 'vor {delta} Wochen',
  12973. monthAgo: 'vor einem Monat',
  12974. monthsAgo: 'vor {delta} Monaten',
  12975. yearAgo: 'vor einem Jahr',
  12976. yearsAgo: 'vor {delta} Jahren',
  12977. lessThanMinuteUntil: 'in weniger als einer Minute',
  12978. minuteUntil: 'in einer Minute',
  12979. minutesUntil: 'in {delta} Minuten',
  12980. hourUntil: 'in ca. einer Stunde',
  12981. hoursUntil: 'in ca. {delta} Stunden',
  12982. dayUntil: 'in einem Tag',
  12983. daysUntil: 'in {delta} Tagen',
  12984. weekUntil: 'in einer Woche',
  12985. weeksUntil: 'in {delta} Wochen',
  12986. monthUntil: 'in einem Monat',
  12987. monthsUntil: 'in {delta} Monaten',
  12988. yearUntil: 'in einem Jahr',
  12989. yearsUntil: 'in {delta} Jahren'
  12990. });
  12991. /*
  12992. ---
  12993. name: Locale.de-CH.Date
  12994. description: Date messages for German (Switzerland).
  12995. license: MIT-style license
  12996. authors:
  12997. - Michael van der Weg
  12998. requires:
  12999. - Locale
  13000. - Locale.de-DE.Date
  13001. provides: [Locale.de-CH.Date]
  13002. ...
  13003. */
  13004. Locale.define('de-CH').inherit('de-DE', 'Date');
  13005. /*
  13006. ---
  13007. name: Locale.de-CH.Form.Validator
  13008. description: Form Validator messages for German (Switzerland).
  13009. license: MIT-style license
  13010. authors:
  13011. - Michael van der Weg
  13012. requires:
  13013. - Locale
  13014. provides: [Locale.de-CH.Form.Validator]
  13015. ...
  13016. */
  13017. Locale.define('de-CH', 'FormValidator', {
  13018. required: 'Dieses Feld ist obligatorisch.',
  13019. minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13020. maxLength: 'Bitte geben Sie nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13021. integer: 'Geben Sie bitte eine ganze Zahl ein. Dezimalzahlen (z.B. 1.25) sind nicht erlaubt.',
  13022. 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;).',
  13023. digits: 'Benutzen Sie bitte nur Zahlen und Satzzeichen in diesem Eingabefeld (erlaubt ist z.B. eine Telefonnummer mit Bindestrichen und Punkten).',
  13024. alpha: 'Benutzen Sie bitte nur Buchstaben (a-z) in diesem Feld. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13025. alphanum: 'Benutzen Sie bitte nur Buchstaben (a-z) und Zahlen (0-9) in diesem Eingabefeld. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13026. dateSuchAs: 'Geben Sie bitte ein g&uuml;ltiges Datum ein. Wie zum Beispiel {date}',
  13027. dateInFormatMDY: 'Geben Sie bitte ein g&uuml;ltiges Datum ein. Wie zum Beispiel TT.MM.JJJJ (z.B. &quot;31.12.1999&quot;)',
  13028. email: 'Geben Sie bitte eine g&uuml;ltige E-Mail Adresse ein. Wie zum Beispiel &quot;maria@bernasconi.ch&quot;.',
  13029. url: 'Geben Sie bitte eine g&uuml;ltige URL ein. Wie zum Beispiel http://www.example.com.',
  13030. currencyDollar: 'Geben Sie bitte einen g&uuml;ltigen Betrag in Schweizer Franken ein. Wie zum Beispiel 100.00 CHF .',
  13031. oneRequired: 'Machen Sie f&uuml;r mindestens eines der Eingabefelder einen Eintrag.',
  13032. errorPrefix: 'Fehler: ',
  13033. warningPrefix: 'Warnung: ',
  13034. // Form.Validator.Extras
  13035. noSpace: 'In diesem Eingabefeld darf kein Leerzeichen sein.',
  13036. reqChkByNode: 'Es wurden keine Elemente gew&auml;hlt.',
  13037. requiredChk: 'Dieses Feld ist obligatorisch.',
  13038. reqChkByName: 'Bitte w&auml;hlen Sie ein {label}.',
  13039. match: 'Dieses Eingabefeld muss mit dem Feld {matchName} &uuml;bereinstimmen.',
  13040. startDate: 'Das Anfangsdatum',
  13041. endDate: 'Das Enddatum',
  13042. currentDate: 'Das aktuelle Datum',
  13043. afterDate: 'Das Datum sollte zur gleichen Zeit oder sp&auml;ter sein {label}.',
  13044. beforeDate: 'Das Datum sollte zur gleichen Zeit oder fr&uuml;her sein {label}.',
  13045. startMonth: 'W&auml;hlen Sie bitte einen Anfangsmonat',
  13046. sameMonth: 'Diese zwei Datumsangaben m&uuml;ssen im selben Monat sein - Sie m&uuml;ssen eine von beiden ver&auml;ndern.',
  13047. creditcard: 'Die eingegebene Kreditkartennummer ist ung&uuml;ltig. Bitte &uuml;berpr&uuml;fen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.'
  13048. });
  13049. /*
  13050. ---
  13051. name: Locale.de-CH.Number
  13052. description: Number messages for Switzerland.
  13053. license: MIT-style license
  13054. authors:
  13055. - Kim D. Jeker
  13056. requires:
  13057. - Locale
  13058. - Locale.CH.Number
  13059. provides: [Locale.de-CH.Number]
  13060. ...
  13061. */
  13062. Locale.define('de-CH').inherit('CH', 'Number');
  13063. /*
  13064. ---
  13065. name: Locale.de-DE.Form.Validator
  13066. description: Form Validator messages for German.
  13067. license: MIT-style license
  13068. authors:
  13069. - Frank Rossi
  13070. - Ulrich Petri
  13071. - Fabian Beiner
  13072. requires:
  13073. - Locale
  13074. provides: [Locale.de-DE.Form.Validator]
  13075. ...
  13076. */
  13077. Locale.define('de-DE', 'FormValidator', {
  13078. required: 'Dieses Eingabefeld muss ausgefüllt werden.',
  13079. minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben nur {length} Zeichen eingegeben).',
  13080. maxLength: 'Geben Sie bitte nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13081. integer: 'Geben Sie in diesem Eingabefeld bitte eine ganze Zahl ein. Dezimalzahlen (z.B. "1.25") sind nicht erlaubt.',
  13082. numeric: 'Geben Sie in diesem Eingabefeld bitte nur Zahlenwerte (z.B. "1", "1.1", "-1" oder "-1.1") ein.',
  13083. digits: 'Geben Sie in diesem Eingabefeld bitte nur Zahlen und Satzzeichen ein (z.B. eine Telefonnummer mit Bindestrichen und Punkten ist erlaubt).',
  13084. alpha: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) ein. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13085. alphanum: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) und Zahlen (0-9) ein. Leerzeichen oder andere Zeichen sind nicht erlaubt.',
  13086. dateSuchAs: 'Geben Sie bitte ein gültiges Datum ein (z.B. "{date}").',
  13087. dateInFormatMDY: 'Geben Sie bitte ein gültiges Datum im Format TT.MM.JJJJ ein (z.B. "31.12.1999").',
  13088. email: 'Geben Sie bitte eine gültige E-Mail-Adresse ein (z.B. "max@mustermann.de").',
  13089. url: 'Geben Sie bitte eine gültige URL ein (z.B. "http://www.example.com").',
  13090. currencyDollar: 'Geben Sie bitte einen gültigen Betrag in EURO ein (z.B. 100.00€).',
  13091. oneRequired: 'Bitte füllen Sie mindestens ein Eingabefeld aus.',
  13092. errorPrefix: 'Fehler: ',
  13093. warningPrefix: 'Warnung: ',
  13094. // Form.Validator.Extras
  13095. noSpace: 'Es darf kein Leerzeichen in diesem Eingabefeld sein.',
  13096. reqChkByNode: 'Es wurden keine Elemente gewählt.',
  13097. requiredChk: 'Dieses Feld muss ausgefüllt werden.',
  13098. reqChkByName: 'Bitte wählen Sie ein {label}.',
  13099. match: 'Dieses Eingabefeld muss mit dem {matchName} Eingabefeld übereinstimmen.',
  13100. startDate: 'Das Anfangsdatum',
  13101. endDate: 'Das Enddatum',
  13102. currentDate: 'Das aktuelle Datum',
  13103. afterDate: 'Das Datum sollte zur gleichen Zeit oder später sein als {label}.',
  13104. beforeDate: 'Das Datum sollte zur gleichen Zeit oder früher sein als {label}.',
  13105. startMonth: 'Wählen Sie bitte einen Anfangsmonat',
  13106. sameMonth: 'Diese zwei Datumsangaben müssen im selben Monat sein - Sie müssen eines von beiden verändern.',
  13107. creditcard: 'Die eingegebene Kreditkartennummer ist ungültig. Bitte überprüfen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.'
  13108. });
  13109. /*
  13110. ---
  13111. name: Locale.de-DE.Number
  13112. description: Number messages for German.
  13113. license: MIT-style license
  13114. authors:
  13115. - Christoph Pojer
  13116. requires:
  13117. - Locale
  13118. - Locale.EU.Number
  13119. provides: [Locale.de-DE.Number]
  13120. ...
  13121. */
  13122. Locale.define('de-DE').inherit('EU', 'Number');
  13123. /*
  13124. ---
  13125. name: Locale.el-GR.Date
  13126. description: Date messages for Greek language.
  13127. license: MIT-style license
  13128. authors:
  13129. - Periklis Argiriadis
  13130. requires:
  13131. - Locale
  13132. provides: [Locale.el-GR.Date]
  13133. ...
  13134. */
  13135. Locale.define('el-GR', 'Date', {
  13136. months: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
  13137. months_abbr: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μάι', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
  13138. days: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
  13139. days_abbr: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'],
  13140. // Culture's date order: DD/MM/YYYY
  13141. dateOrder: ['date', 'month', 'year'],
  13142. shortDate: '%d/%m/%Y',
  13143. shortTime: '%I:%M%p',
  13144. AM: 'πμ',
  13145. PM: 'μμ',
  13146. firstDayOfWeek: 1,
  13147. // Date.Extras
  13148. ordinal: function(dayOfMonth){
  13149. // 1st, 2nd, 3rd, etc.
  13150. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ος' : ['ος'][Math.min(dayOfMonth % 10, 4)];
  13151. },
  13152. lessThanMinuteAgo: 'λιγότερο από ένα λεπτό πριν',
  13153. minuteAgo: 'περίπου ένα λεπτό πριν',
  13154. minutesAgo: '{delta} λεπτά πριν',
  13155. hourAgo: 'περίπου μια ώρα πριν',
  13156. hoursAgo: 'περίπου {delta} ώρες πριν',
  13157. dayAgo: '1 ημέρα πριν',
  13158. daysAgo: '{delta} ημέρες πριν',
  13159. weekAgo: '1 εβδομάδα πριν',
  13160. weeksAgo: '{delta} εβδομάδες πριν',
  13161. monthAgo: '1 μήνα πριν',
  13162. monthsAgo: '{delta} μήνες πριν',
  13163. yearAgo: '1 χρόνο πριν',
  13164. yearsAgo: '{delta} χρόνια πριν',
  13165. lessThanMinuteUntil: 'λιγότερο από λεπτό από τώρα',
  13166. minuteUntil: 'περίπου ένα λεπτό από τώρα',
  13167. minutesUntil: '{delta} λεπτά από τώρα',
  13168. hourUntil: 'περίπου μια ώρα από τώρα',
  13169. hoursUntil: 'περίπου {delta} ώρες από τώρα',
  13170. dayUntil: '1 ημέρα από τώρα',
  13171. daysUntil: '{delta} ημέρες από τώρα',
  13172. weekUntil: '1 εβδομάδα από τώρα',
  13173. weeksUntil: '{delta} εβδομάδες από τώρα',
  13174. monthUntil: '1 μήνας από τώρα',
  13175. monthsUntil: '{delta} μήνες από τώρα',
  13176. yearUntil: '1 χρόνος από τώρα',
  13177. yearsUntil: '{delta} χρόνια από τώρα'
  13178. });
  13179. /*
  13180. ---
  13181. name: Locale.el-GR.Form.Validator
  13182. description: Form Validator messages for Greek language.
  13183. license: MIT-style license
  13184. authors:
  13185. - Dimitris Tsironis
  13186. requires:
  13187. - Locale
  13188. provides: [Locale.el-GR.Form.Validator]
  13189. ...
  13190. */
  13191. Locale.define('el-GR', 'FormValidator', {
  13192. required: 'Αυτό το πεδίο είναι απαραίτητο.',
  13193. length: 'Παρακαλούμε, εισάγετε {length} χαρακτήρες (έχετε ήδη εισάγει {elLength} χαρακτήρες).',
  13194. minLength: 'Παρακαλούμε, εισάγετε τουλάχιστον {minLength} χαρακτήρες (έχετε ήδη εισάγε {length} χαρακτήρες).',
  13195. maxlength: 'Παρακαλούμε, εισάγετε εώς {maxlength} χαρακτήρες (έχετε ήδη εισάγε {length} χαρακτήρες).',
  13196. integer: 'Παρακαλούμε, εισάγετε έναν ακέραιο αριθμό σε αυτό το πεδίο. Οι αριθμοί με δεκαδικά ψηφία (π.χ. 1.25) δεν επιτρέπονται.',
  13197. numeric: 'Παρακαλούμε, εισάγετε μόνο αριθμητικές τιμές σε αυτό το πεδίο (π.χ." 1 " ή " 1.1 " ή " -1 " ή " -1.1 " ).',
  13198. digits: 'Παρακαλούμε, χρησιμοποιήστε μόνο αριθμούς και σημεία στίξης σε αυτόν τον τομέα (π.χ. επιτρέπεται αριθμός τηλεφώνου με παύλες ή τελείες).',
  13199. alpha: 'Παρακαλούμε, χρησιμοποιήστε μόνο γράμματα (a-z) σε αυτό το πεδίο. Δεν επιτρέπονται κενά ή άλλοι χαρακτήρες.',
  13200. alphanum: 'Παρακαλούμε, χρησιμοποιήστε μόνο γράμματα (a-z) ή αριθμούς (0-9) σε αυτόν τον τομέα. Δεν επιτρέπονται κενά ή άλλοι χαρακτήρες.',
  13201. dateSuchAs: 'Παρακαλούμε, εισάγετε μια έγκυρη ημερομηνία, όπως {date}',
  13202. dateInFormatMDY: 'Παρακαλώ εισάγετε μια έγκυρη ημερομηνία, όπως ΜΜ/ΗΗ/ΕΕΕΕ (π.χ. "12/31/1999").',
  13203. email: 'Παρακαλούμε, εισάγετε μια έγκυρη διεύθυνση ηλεκτρονικού ταχυδρομείου (π.χ. "fred@domain.com").',
  13204. url: 'Παρακαλούμε, εισάγετε μια έγκυρη URL διεύθυνση, όπως http://www.example.com',
  13205. currencyDollar: 'Παρακαλούμε, εισάγετε ένα έγκυρο ποσό σε δολλάρια (π.χ. $100.00).',
  13206. oneRequired: 'Παρακαλούμε, εισάγετε κάτι για τουλάχιστον ένα από αυτά τα πεδία.',
  13207. errorPrefix: 'Σφάλμα: ',
  13208. warningPrefix: 'Προσοχή: ',
  13209. // Form.Validator.Extras
  13210. noSpace: 'Δεν επιτρέπονται τα κενά σε αυτό το πεδίο.',
  13211. reqChkByNode: 'Δεν έχει επιλεγεί κάποιο αντικείμενο',
  13212. requiredChk: 'Αυτό το πεδίο είναι απαραίτητο.',
  13213. reqChkByName: 'Παρακαλούμε, επιλέξτε μια ετικέτα {label}.',
  13214. match: 'Αυτό το πεδίο πρέπει να ταιριάζει με το πεδίο {matchName}.',
  13215. startDate: 'η ημερομηνία έναρξης',
  13216. endDate: 'η ημερομηνία λήξης',
  13217. currentDate: 'η τρέχουσα ημερομηνία',
  13218. afterDate: 'Η ημερομηνία πρέπει να είναι η ίδια ή μετά από την {label}.',
  13219. beforeDate: 'Η ημερομηνία πρέπει να είναι η ίδια ή πριν από την {label}.',
  13220. startMonth: 'Παρακαλώ επιλέξτε ένα μήνα αρχής.',
  13221. sameMonth: 'Αυτές οι δύο ημερομηνίες πρέπει να έχουν τον ίδιο μήνα - θα πρέπει να αλλάξετε ή το ένα ή το άλλο',
  13222. creditcard: 'Ο αριθμός της πιστωτικής κάρτας δεν είναι έγκυρος. Παρακαλούμε ελέγξτε τον αριθμό και δοκιμάστε ξανά. {length} μήκος ψηφίων.'
  13223. });
  13224. /*
  13225. ---
  13226. name: Locale.en-GB.Date
  13227. description: Date messages for British English.
  13228. license: MIT-style license
  13229. authors:
  13230. - Aaron Newton
  13231. requires:
  13232. - Locale
  13233. - Locale.en-US.Date
  13234. provides: [Locale.en-GB.Date]
  13235. ...
  13236. */
  13237. Locale.define('en-GB', 'Date', {
  13238. // Culture's date order: DD/MM/YYYY
  13239. dateOrder: ['date', 'month', 'year'],
  13240. shortDate: '%d/%m/%Y',
  13241. shortTime: '%H:%M'
  13242. }).inherit('en-US', 'Date');
  13243. /*
  13244. ---
  13245. name: Locale.en-US.Number
  13246. description: Number messages for US English.
  13247. license: MIT-style license
  13248. authors:
  13249. - Arian Stolwijk
  13250. requires:
  13251. - Locale
  13252. provides: [Locale.en-US.Number]
  13253. ...
  13254. */
  13255. Locale.define('en-US', 'Number', {
  13256. decimal: '.',
  13257. group: ',',
  13258. /* Commented properties are the defaults for Number.format
  13259. decimals: 0,
  13260. precision: 0,
  13261. scientific: null,
  13262. prefix: null,
  13263. suffic: null,
  13264. // Negative/Currency/percentage will mixin Number
  13265. negative: {
  13266. prefix: '-'
  13267. },*/
  13268. currency: {
  13269. // decimals: 2,
  13270. prefix: '$ '
  13271. }/*,
  13272. percentage: {
  13273. decimals: 2,
  13274. suffix: '%'
  13275. }*/
  13276. });
  13277. /*
  13278. ---
  13279. name: Locale.es-ES.Date
  13280. description: Date messages for Spanish.
  13281. license: MIT-style license
  13282. authors:
  13283. - Ãlfons Sanchez
  13284. requires:
  13285. - Locale
  13286. provides: [Locale.es-ES.Date]
  13287. ...
  13288. */
  13289. Locale.define('es-ES', 'Date', {
  13290. months: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
  13291. months_abbr: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'],
  13292. days: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
  13293. days_abbr: ['dom', 'lun', 'mar', 'mié', 'juv', 'vie', 'sáb'],
  13294. // Culture's date order: DD/MM/YYYY
  13295. dateOrder: ['date', 'month', 'year'],
  13296. shortDate: '%d/%m/%Y',
  13297. shortTime: '%H:%M',
  13298. AM: 'AM',
  13299. PM: 'PM',
  13300. firstDayOfWeek: 1,
  13301. // Date.Extras
  13302. ordinal: '',
  13303. lessThanMinuteAgo: 'hace menos de un minuto',
  13304. minuteAgo: 'hace un minuto',
  13305. minutesAgo: 'hace {delta} minutos',
  13306. hourAgo: 'hace una hora',
  13307. hoursAgo: 'hace unas {delta} horas',
  13308. dayAgo: 'hace un día',
  13309. daysAgo: 'hace {delta} días',
  13310. weekAgo: 'hace una semana',
  13311. weeksAgo: 'hace unas {delta} semanas',
  13312. monthAgo: 'hace un mes',
  13313. monthsAgo: 'hace {delta} meses',
  13314. yearAgo: 'hace un año',
  13315. yearsAgo: 'hace {delta} años',
  13316. lessThanMinuteUntil: 'menos de un minuto desde ahora',
  13317. minuteUntil: 'un minuto desde ahora',
  13318. minutesUntil: '{delta} minutos desde ahora',
  13319. hourUntil: 'una hora desde ahora',
  13320. hoursUntil: 'unas {delta} horas desde ahora',
  13321. dayUntil: 'un día desde ahora',
  13322. daysUntil: '{delta} días desde ahora',
  13323. weekUntil: 'una semana desde ahora',
  13324. weeksUntil: 'unas {delta} semanas desde ahora',
  13325. monthUntil: 'un mes desde ahora',
  13326. monthsUntil: '{delta} meses desde ahora',
  13327. yearUntil: 'un año desde ahora',
  13328. yearsUntil: '{delta} años desde ahora'
  13329. });
  13330. /*
  13331. ---
  13332. name: Locale.es-AR.Date
  13333. description: Date messages for Spanish (Argentina).
  13334. license: MIT-style license
  13335. authors:
  13336. - Ãlfons Sanchez
  13337. - Diego Massanti
  13338. requires:
  13339. - Locale
  13340. - Locale.es-ES.Date
  13341. provides: [Locale.es-AR.Date]
  13342. ...
  13343. */
  13344. Locale.define('es-AR').inherit('es-ES', 'Date');
  13345. /*
  13346. ---
  13347. name: Locale.es-AR.Form.Validator
  13348. description: Form Validator messages for Spanish (Argentina).
  13349. license: MIT-style license
  13350. authors:
  13351. - Diego Massanti
  13352. requires:
  13353. - Locale
  13354. provides: [Locale.es-AR.Form.Validator]
  13355. ...
  13356. */
  13357. Locale.define('es-AR', 'FormValidator', {
  13358. required: 'Este campo es obligatorio.',
  13359. minLength: 'Por favor ingrese al menos {minLength} caracteres (ha ingresado {length} caracteres).',
  13360. maxLength: 'Por favor no ingrese más de {maxLength} caracteres (ha ingresado {length} caracteres).',
  13361. integer: 'Por favor ingrese un número entero en este campo. Números con decimales (p.e. 1,25) no se permiten.',
  13362. numeric: 'Por favor ingrese solo valores numéricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',
  13363. 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).',
  13364. alpha: 'Por favor use sólo letras (a-z) en este campo. No se permiten espacios ni otros caracteres.',
  13365. alphanum: 'Por favor, usa sólo letras (a-z) o números (0-9) en este campo. No se permiten espacios u otros caracteres.',
  13366. dateSuchAs: 'Por favor ingrese una fecha válida como {date}',
  13367. dateInFormatMDY: 'Por favor ingrese una fecha válida, utulizando el formato DD/MM/YYYY (p.e. "31/12/1999")',
  13368. email: 'Por favor, ingrese una dirección de e-mail válida. Por ejemplo, "fred@dominio.com".',
  13369. url: 'Por favor ingrese una URL válida como http://www.example.com.',
  13370. currencyDollar: 'Por favor ingrese una cantidad válida de pesos. Por ejemplo $100,00 .',
  13371. oneRequired: 'Por favor ingrese algo para por lo menos una de estas entradas.',
  13372. errorPrefix: 'Error: ',
  13373. warningPrefix: 'Advertencia: ',
  13374. // Form.Validator.Extras
  13375. noSpace: 'No se permiten espacios en este campo.',
  13376. reqChkByNode: 'No hay elementos seleccionados.',
  13377. requiredChk: 'Este campo es obligatorio.',
  13378. reqChkByName: 'Por favor selecciona una {label}.',
  13379. match: 'Este campo necesita coincidir con el campo {matchName}',
  13380. startDate: 'la fecha de inicio',
  13381. endDate: 'la fecha de fin',
  13382. currentDate: 'la fecha actual',
  13383. afterDate: 'La fecha debe ser igual o posterior a {label}.',
  13384. beforeDate: 'La fecha debe ser igual o anterior a {label}.',
  13385. startMonth: 'Por favor selecciona un mes de origen',
  13386. sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.'
  13387. });
  13388. /*
  13389. ---
  13390. name: Locale.es-AR.Number
  13391. description: Number messages for es Argentina.
  13392. license: MIT-style license
  13393. authors:
  13394. - Oscar Kuchuk
  13395. requires:
  13396. - Locale
  13397. provides: [Locale.es-AR.Number]
  13398. ...
  13399. */
  13400. Locale.define('es-AR', 'Number', {
  13401. decimal: ',',
  13402. group: '.',
  13403. /* Commented properties are the defaults for Number.format
  13404. decimals: 0,
  13405. precision: 0,
  13406. scientific: null,
  13407. prefix: null,
  13408. suffic: null,
  13409. // Negative/Currency/percentage will mixin Number
  13410. negative: {
  13411. prefix: '-'
  13412. },*/
  13413. currency: {
  13414. decimals: 2,
  13415. prefix: '$ '
  13416. }/*,
  13417. percentage: {
  13418. decimals: 2,
  13419. suffix: '%'
  13420. }*/
  13421. });
  13422. /*
  13423. ---
  13424. name: Locale.es-ES.Form.Validator
  13425. description: Form Validator messages for Spanish.
  13426. license: MIT-style license
  13427. authors:
  13428. - Ãlfons Sanchez
  13429. requires:
  13430. - Locale
  13431. provides: [Locale.es-ES.Form.Validator]
  13432. ...
  13433. */
  13434. Locale.define('es-ES', 'FormValidator', {
  13435. required: 'Este campo es obligatorio.',
  13436. minLength: 'Por favor introduce al menos {minLength} caracteres (has introducido {length} caracteres).',
  13437. maxLength: 'Por favor introduce no m&aacute;s de {maxLength} caracteres (has introducido {length} caracteres).',
  13438. integer: 'Por favor introduce un n&uacute;mero entero en este campo. N&uacute;meros con decimales (p.e. 1,25) no se permiten.',
  13439. numeric: 'Por favor introduce solo valores num&eacute;ricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',
  13440. 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).',
  13441. alpha: 'Por favor usa letras solo (a-z) en este campo. No se admiten espacios ni otros caracteres.',
  13442. alphanum: 'Por favor, usa solo letras (a-z) o n&uacute;meros (0-9) en este campo. No se admiten espacios ni otros caracteres.',
  13443. dateSuchAs: 'Por favor introduce una fecha v&aacute;lida como {date}',
  13444. dateInFormatMDY: 'Por favor introduce una fecha v&aacute;lida como DD/MM/YYYY (p.e. "31/12/1999")',
  13445. email: 'Por favor, introduce una direcci&oacute;n de email v&aacute;lida. Por ejemplo, "fred@domain.com".',
  13446. url: 'Por favor introduce una URL v&aacute;lida como http://www.example.com.',
  13447. currencyDollar: 'Por favor introduce una cantidad v&aacute;lida de €. Por ejemplo €100,00 .',
  13448. oneRequired: 'Por favor introduce algo para por lo menos una de estas entradas.',
  13449. errorPrefix: 'Error: ',
  13450. warningPrefix: 'Aviso: ',
  13451. // Form.Validator.Extras
  13452. noSpace: 'No pueden haber espacios en esta entrada.',
  13453. reqChkByNode: 'No hay elementos seleccionados.',
  13454. requiredChk: 'Este campo es obligatorio.',
  13455. reqChkByName: 'Por favor selecciona una {label}.',
  13456. match: 'Este campo necesita coincidir con el campo {matchName}',
  13457. startDate: 'la fecha de inicio',
  13458. endDate: 'la fecha de fin',
  13459. currentDate: 'la fecha actual',
  13460. afterDate: 'La fecha debe ser igual o posterior a {label}.',
  13461. beforeDate: 'La fecha debe ser igual o anterior a {label}.',
  13462. startMonth: 'Por favor selecciona un mes de origen',
  13463. sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.'
  13464. });
  13465. /*
  13466. ---
  13467. name: Locale.es-VE.Date
  13468. description: Date messages for Spanish (Venezuela).
  13469. license: MIT-style license
  13470. authors:
  13471. - Daniel Barreto
  13472. requires:
  13473. - Locale
  13474. - Locale.es-ES.Date
  13475. provides: [Locale.es-VE.Date]
  13476. ...
  13477. */
  13478. Locale.define('es-VE').inherit('es-ES', 'Date');
  13479. /*
  13480. ---
  13481. name: Locale.es-VE.Form.Validator
  13482. description: Form Validator messages for Spanish (Venezuela).
  13483. license: MIT-style license
  13484. authors:
  13485. - Daniel Barreto
  13486. requires:
  13487. - Locale
  13488. - Locale.es-ES.Form.Validator
  13489. provides: [Locale.es-VE.Form.Validator]
  13490. ...
  13491. */
  13492. Locale.define('es-VE', 'FormValidator', {
  13493. 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.',
  13494. alpha: 'Por favor usa solo letras (a-z) en este campo. No se admiten espacios ni otros caracteres.',
  13495. currencyDollar: 'Por favor introduce una cantidad v&aacute;lida de Bs. Por ejemplo Bs. 100,00 .',
  13496. oneRequired: 'Por favor introduce un valor para por lo menos una de estas entradas.',
  13497. // Form.Validator.Extras
  13498. startDate: 'La fecha de inicio',
  13499. endDate: 'La fecha de fin',
  13500. currentDate: 'La fecha actual'
  13501. }).inherit('es-ES', 'FormValidator');
  13502. /*
  13503. ---
  13504. name: Locale.es-VE.Number
  13505. description: Number messages for Spanish (Venezuela).
  13506. license: MIT-style license
  13507. authors:
  13508. - Daniel Barreto
  13509. requires:
  13510. - Locale
  13511. provides: [Locale.es-VE.Number]
  13512. ...
  13513. */
  13514. Locale.define('es-VE', 'Number', {
  13515. decimal: ',',
  13516. group: '.',
  13517. /*
  13518. decimals: 0,
  13519. precision: 0,
  13520. */
  13521. // Negative/Currency/percentage will mixin Number
  13522. negative: {
  13523. prefix: '-'
  13524. },
  13525. currency: {
  13526. decimals: 2,
  13527. prefix: 'Bs. '
  13528. },
  13529. percentage: {
  13530. decimals: 2,
  13531. suffix: '%'
  13532. }
  13533. });
  13534. /*
  13535. ---
  13536. name: Locale.et-EE.Date
  13537. description: Date messages for Estonian.
  13538. license: MIT-style license
  13539. authors:
  13540. - Kevin Valdek
  13541. requires:
  13542. - Locale
  13543. provides: [Locale.et-EE.Date]
  13544. ...
  13545. */
  13546. Locale.define('et-EE', 'Date', {
  13547. months: ['jaanuar', 'veebruar', 'märts', 'aprill', 'mai', 'juuni', 'juuli', 'august', 'september', 'oktoober', 'november', 'detsember'],
  13548. months_abbr: ['jaan', 'veebr', 'märts', 'apr', 'mai', 'juuni', 'juuli', 'aug', 'sept', 'okt', 'nov', 'dets'],
  13549. days: ['pühapäev', 'esmaspäev', 'teisipäev', 'kolmapäev', 'neljapäev', 'reede', 'laupäev'],
  13550. days_abbr: ['pühap', 'esmasp', 'teisip', 'kolmap', 'neljap', 'reede', 'laup'],
  13551. // Culture's date order: MM.DD.YYYY
  13552. dateOrder: ['month', 'date', 'year'],
  13553. shortDate: '%m.%d.%Y',
  13554. shortTime: '%H:%M',
  13555. AM: 'AM',
  13556. PM: 'PM',
  13557. firstDayOfWeek: 1,
  13558. // Date.Extras
  13559. ordinal: '',
  13560. lessThanMinuteAgo: 'vähem kui minut aega tagasi',
  13561. minuteAgo: 'umbes minut aega tagasi',
  13562. minutesAgo: '{delta} minutit tagasi',
  13563. hourAgo: 'umbes tund aega tagasi',
  13564. hoursAgo: 'umbes {delta} tundi tagasi',
  13565. dayAgo: '1 päev tagasi',
  13566. daysAgo: '{delta} päeva tagasi',
  13567. weekAgo: '1 nädal tagasi',
  13568. weeksAgo: '{delta} nädalat tagasi',
  13569. monthAgo: '1 kuu tagasi',
  13570. monthsAgo: '{delta} kuud tagasi',
  13571. yearAgo: '1 aasta tagasi',
  13572. yearsAgo: '{delta} aastat tagasi',
  13573. lessThanMinuteUntil: 'vähem kui minuti aja pärast',
  13574. minuteUntil: 'umbes minuti aja pärast',
  13575. minutesUntil: '{delta} minuti pärast',
  13576. hourUntil: 'umbes tunni aja pärast',
  13577. hoursUntil: 'umbes {delta} tunni pärast',
  13578. dayUntil: '1 päeva pärast',
  13579. daysUntil: '{delta} päeva pärast',
  13580. weekUntil: '1 nädala pärast',
  13581. weeksUntil: '{delta} nädala pärast',
  13582. monthUntil: '1 kuu pärast',
  13583. monthsUntil: '{delta} kuu pärast',
  13584. yearUntil: '1 aasta pärast',
  13585. yearsUntil: '{delta} aasta pärast'
  13586. });
  13587. /*
  13588. ---
  13589. name: Locale.et-EE.Form.Validator
  13590. description: Form Validator messages for Estonian.
  13591. license: MIT-style license
  13592. authors:
  13593. - Kevin Valdek
  13594. requires:
  13595. - Locale
  13596. provides: [Locale.et-EE.Form.Validator]
  13597. ...
  13598. */
  13599. Locale.define('et-EE', 'FormValidator', {
  13600. required: 'Väli peab olema täidetud.',
  13601. minLength: 'Palun sisestage vähemalt {minLength} tähte (te sisestasite {length} tähte).',
  13602. maxLength: 'Palun ärge sisestage rohkem kui {maxLength} tähte (te sisestasite {length} tähte).',
  13603. integer: 'Palun sisestage väljale täisarv. Kümnendarvud (näiteks 1.25) ei ole lubatud.',
  13604. numeric: 'Palun sisestage ainult numbreid väljale (näiteks "1", "1.1", "-1" või "-1.1").',
  13605. digits: 'Palun kasutage ainult numbreid ja kirjavahemärke (telefoninumbri sisestamisel on lubatud kasutada kriipse ja punkte).',
  13606. alpha: 'Palun kasutage ainult tähti (a-z). Tühikud ja teised sümbolid on keelatud.',
  13607. alphanum: 'Palun kasutage ainult tähti (a-z) või numbreid (0-9). Tühikud ja teised sümbolid on keelatud.',
  13608. dateSuchAs: 'Palun sisestage kehtiv kuupäev kujul {date}',
  13609. dateInFormatMDY: 'Palun sisestage kehtiv kuupäev kujul MM.DD.YYYY (näiteks: "12.31.1999").',
  13610. email: 'Palun sisestage kehtiv e-maili aadress (näiteks: "fred@domain.com").',
  13611. url: 'Palun sisestage kehtiv URL (näiteks: http://www.example.com).',
  13612. currencyDollar: 'Palun sisestage kehtiv $ summa (näiteks: $100.00).',
  13613. oneRequired: 'Palun sisestage midagi vähemalt ühele antud väljadest.',
  13614. errorPrefix: 'Viga: ',
  13615. warningPrefix: 'Hoiatus: ',
  13616. // Form.Validator.Extras
  13617. noSpace: 'Väli ei tohi sisaldada tühikuid.',
  13618. reqChkByNode: 'Ükski väljadest pole valitud.',
  13619. requiredChk: 'Välja täitmine on vajalik.',
  13620. reqChkByName: 'Palun valige üks {label}.',
  13621. match: 'Väli peab sobima {matchName} väljaga',
  13622. startDate: 'algkuupäev',
  13623. endDate: 'lõppkuupäev',
  13624. currentDate: 'praegune kuupäev',
  13625. afterDate: 'Kuupäev peab olema võrdne või pärast {label}.',
  13626. beforeDate: 'Kuupäev peab olema võrdne või enne {label}.',
  13627. startMonth: 'Palun valige algkuupäev.',
  13628. sameMonth: 'Antud kaks kuupäeva peavad olema samas kuus - peate muutma ühte kuupäeva.'
  13629. });
  13630. /*
  13631. ---
  13632. name: Locale.fa.Date
  13633. description: Date messages for Persian.
  13634. license: MIT-style license
  13635. authors:
  13636. - Amir Hossein Hodjaty Pour
  13637. requires:
  13638. - Locale
  13639. provides: [Locale.fa.Date]
  13640. ...
  13641. */
  13642. Locale.define('fa', 'Date', {
  13643. months: ['ژانویه', 'فوریه', 'مارس', 'آپریل', 'مه', 'ژوئن', 'ژوئیه', 'آگوست', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
  13644. months_abbr: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
  13645. days: ['یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
  13646. days_abbr: ['ي', 'د', 'س', 'چ', 'پ', 'ج', 'ش'],
  13647. // Culture's date order: MM/DD/YYYY
  13648. dateOrder: ['month', 'date', 'year'],
  13649. shortDate: '%m/%d/%Y',
  13650. shortTime: '%I:%M%p',
  13651. AM: 'ق.ظ',
  13652. PM: 'ب.ظ',
  13653. // Date.Extras
  13654. ordinal: 'ام',
  13655. lessThanMinuteAgo: 'کمتر از یک دقیقه پیش',
  13656. minuteAgo: 'حدود یک دقیقه پیش',
  13657. minutesAgo: '{delta} دقیقه پیش',
  13658. hourAgo: 'حدود یک ساعت پیش',
  13659. hoursAgo: 'حدود {delta} ساعت پیش',
  13660. dayAgo: '1 روز پیش',
  13661. daysAgo: '{delta} روز پیش',
  13662. weekAgo: '1 هفته پیش',
  13663. weeksAgo: '{delta} هفته پیش',
  13664. monthAgo: '1 ماه پیش',
  13665. monthsAgo: '{delta} ماه پیش',
  13666. yearAgo: '1 سال پیش',
  13667. yearsAgo: '{delta} سال پیش',
  13668. lessThanMinuteUntil: 'کمتر از یک دقیقه از حالا',
  13669. minuteUntil: 'حدود یک دقیقه از حالا',
  13670. minutesUntil: '{delta} دقیقه از حالا',
  13671. hourUntil: 'حدود یک ساعت از حالا',
  13672. hoursUntil: 'حدود {delta} ساعت از حالا',
  13673. dayUntil: '1 روز از حالا',
  13674. daysUntil: '{delta} روز از حالا',
  13675. weekUntil: '1 هفته از حالا',
  13676. weeksUntil: '{delta} هفته از حالا',
  13677. monthUntil: '1 ماه از حالا',
  13678. monthsUntil: '{delta} ماه از حالا',
  13679. yearUntil: '1 سال از حالا',
  13680. yearsUntil: '{delta} سال از حالا'
  13681. });
  13682. /*
  13683. ---
  13684. name: Locale.fa.Form.Validator
  13685. description: Form Validator messages for Persian.
  13686. license: MIT-style license
  13687. authors:
  13688. - Amir Hossein Hodjaty Pour
  13689. requires:
  13690. - Locale
  13691. provides: [Locale.fa.Form.Validator]
  13692. ...
  13693. */
  13694. Locale.define('fa', 'FormValidator', {
  13695. required: 'این فیلد الزامی است.',
  13696. minLength: 'شما باید حداقل {minLength} حرف وارد کنید ({length} حرف وارد کرده اید).',
  13697. maxLength: 'لطفا حداکثر {maxLength} حرف وارد کنید (شما {length} حرف وارد کرده اید).',
  13698. integer: 'لطفا از عدد صحیح استفاده کنید. اعداد اعشاری (مانند 1.25) مجاز نیستند.',
  13699. numeric: 'لطفا فقط داده عددی وارد کنید (مانند "1" یا "1.1" یا "1-" یا "1.1-").',
  13700. digits: 'لطفا فقط از اعداد و علامتها در این فیلد استفاده کنید (برای مثال شماره تلفن با خط تیره و نقطه قابل قبول است).',
  13701. alpha: 'لطفا فقط از حروف الفباء برای این بخش استفاده کنید. کاراکترهای دیگر و فاصله مجاز نیستند.',
  13702. alphanum: 'لطفا فقط از حروف الفباء و اعداد در این بخش استفاده کنید. کاراکترهای دیگر و فاصله مجاز نیستند.',
  13703. dateSuchAs: 'لطفا یک تاریخ معتبر مانند {date} وارد کنید.',
  13704. dateInFormatMDY: 'لطفا یک تاریخ معتبر به شکل MM/DD/YYYY وارد کنید (مانند "12/31/1999").',
  13705. email: 'لطفا یک آدرس ایمیل معتبر وارد کنید. برای مثال "fred@domain.com".',
  13706. url: 'لطفا یک URL معتبر مانند http://www.example.com وارد کنید.',
  13707. currencyDollar: 'لطفا یک محدوده معتبر برای این بخش وارد کنید مانند 100.00$ .',
  13708. oneRequired: 'لطفا حداقل یکی از فیلدها را پر کنید.',
  13709. errorPrefix: 'خطا: ',
  13710. warningPrefix: 'هشدار: ',
  13711. // Form.Validator.Extras
  13712. noSpace: 'استفاده از فاصله در این بخش مجاز نیست.',
  13713. reqChkByNode: 'موردی انتخاب نشده است.',
  13714. requiredChk: 'این فیلد الزامی است.',
  13715. reqChkByName: 'لطفا یک {label} را انتخاب کنید.',
  13716. match: 'این فیلد باید با فیلد {matchName} مطابقت داشته باشد.',
  13717. startDate: 'تاریخ شروع',
  13718. endDate: 'تاریخ پایان',
  13719. currentDate: 'تاریخ کنونی',
  13720. afterDate: 'تاریخ میبایست برابر یا بعد از {label} باشد',
  13721. beforeDate: 'تاریخ میبایست برابر یا قبل از {label} باشد',
  13722. startMonth: 'لطفا ماه شروع را انتخاب کنید',
  13723. sameMonth: 'این دو تاریخ باید در یک ماه باشند - شما باید یکی یا هر دو را تغییر دهید.',
  13724. creditcard: 'شماره کارت اعتباری که وارد کرده اید معتبر نیست. لطفا شماره را بررسی کنید و مجددا تلاش کنید. {length} رقم وارد شده است.'
  13725. });
  13726. /*
  13727. ---
  13728. name: Locale.fi-FI.Date
  13729. description: Date messages for Finnish.
  13730. license: MIT-style license
  13731. authors:
  13732. - ksel
  13733. requires:
  13734. - Locale
  13735. provides: [Locale.fi-FI.Date]
  13736. ...
  13737. */
  13738. Locale.define('fi-FI', 'Date', {
  13739. // NOTE: months and days are not capitalized in finnish
  13740. months: ['tammikuu', 'helmikuu', 'maaliskuu', 'huhtikuu', 'toukokuu', 'kesäkuu', 'heinäkuu', 'elokuu', 'syyskuu', 'lokakuu', 'marraskuu', 'joulukuu'],
  13741. // these abbreviations are really not much used in finnish because they obviously won't abbreviate very much. ;)
  13742. // NOTE: sometimes one can see forms such as "tammi", "helmi", etc. but that is not proper finnish.
  13743. months_abbr: ['tammik.', 'helmik.', 'maalisk.', 'huhtik.', 'toukok.', 'kesäk.', 'heinäk.', 'elok.', 'syysk.', 'lokak.', 'marrask.', 'jouluk.'],
  13744. days: ['sunnuntai', 'maanantai', 'tiistai', 'keskiviikko', 'torstai', 'perjantai', 'lauantai'],
  13745. days_abbr: ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'],
  13746. // Culture's date order: DD/MM/YYYY
  13747. dateOrder: ['date', 'month', 'year'],
  13748. shortDate: '%d.%m.%Y',
  13749. shortTime: '%H:%M',
  13750. AM: 'AM',
  13751. PM: 'PM',
  13752. firstDayOfWeek: 1,
  13753. // Date.Extras
  13754. ordinal: '.',
  13755. lessThanMinuteAgo: 'vajaa minuutti sitten',
  13756. minuteAgo: 'noin minuutti sitten',
  13757. minutesAgo: '{delta} minuuttia sitten',
  13758. hourAgo: 'noin tunti sitten',
  13759. hoursAgo: 'noin {delta} tuntia sitten',
  13760. dayAgo: 'päivä sitten',
  13761. daysAgo: '{delta} päivää sitten',
  13762. weekAgo: 'viikko sitten',
  13763. weeksAgo: '{delta} viikkoa sitten',
  13764. monthAgo: 'kuukausi sitten',
  13765. monthsAgo: '{delta} kuukautta sitten',
  13766. yearAgo: 'vuosi sitten',
  13767. yearsAgo: '{delta} vuotta sitten',
  13768. lessThanMinuteUntil: 'vajaan minuutin kuluttua',
  13769. minuteUntil: 'noin minuutin kuluttua',
  13770. minutesUntil: '{delta} minuutin kuluttua',
  13771. hourUntil: 'noin tunnin kuluttua',
  13772. hoursUntil: 'noin {delta} tunnin kuluttua',
  13773. dayUntil: 'päivän kuluttua',
  13774. daysUntil: '{delta} päivän kuluttua',
  13775. weekUntil: 'viikon kuluttua',
  13776. weeksUntil: '{delta} viikon kuluttua',
  13777. monthUntil: 'kuukauden kuluttua',
  13778. monthsUntil: '{delta} kuukauden kuluttua',
  13779. yearUntil: 'vuoden kuluttua',
  13780. yearsUntil: '{delta} vuoden kuluttua'
  13781. });
  13782. /*
  13783. ---
  13784. name: Locale.fi-FI.Form.Validator
  13785. description: Form Validator messages for Finnish.
  13786. license: MIT-style license
  13787. authors:
  13788. - ksel
  13789. requires:
  13790. - Locale
  13791. provides: [Locale.fi-FI.Form.Validator]
  13792. ...
  13793. */
  13794. Locale.define('fi-FI', 'FormValidator', {
  13795. required: 'Tämä kenttä on pakollinen.',
  13796. minLength: 'Ole hyvä ja anna vähintään {minLength} merkkiä (annoit {length} merkkiä).',
  13797. maxLength: 'Älä anna enempää kuin {maxLength} merkkiä (annoit {length} merkkiä).',
  13798. integer: 'Ole hyvä ja anna kokonaisluku. Luvut, joissa on desimaaleja (esim. 1.25) eivät ole sallittuja.',
  13799. numeric: 'Anna tähän kenttään lukuarvo (kuten "1" tai "1.1" tai "-1" tai "-1.1").',
  13800. 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).',
  13801. alpha: 'Anna tähän kenttään vain kirjaimia (a-z). Välilyönnit tai muut merkit eivät ole sallittuja.',
  13802. 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.',
  13803. dateSuchAs: 'Ole hyvä ja anna kelvollinen päivmäärä, kuten esimerkiksi {date}',
  13804. dateInFormatMDY: 'Ole hyvä ja anna kelvollinen päivämäärä muodossa pp/kk/vvvv (kuten "12/31/1999")',
  13805. email: 'Ole hyvä ja anna kelvollinen sähköpostiosoite (kuten esimerkiksi "matti@meikalainen.com").',
  13806. url: 'Ole hyvä ja anna kelvollinen URL, kuten esimerkiksi http://www.example.com.',
  13807. currencyDollar: 'Ole hyvä ja anna kelvollinen eurosumma (kuten esimerkiksi 100,00 EUR) .',
  13808. oneRequired: 'Ole hyvä ja syötä jotakin ainakin johonkin näistä kentistä.',
  13809. errorPrefix: 'Virhe: ',
  13810. warningPrefix: 'Varoitus: ',
  13811. // Form.Validator.Extras
  13812. noSpace: 'Tässä syötteessä ei voi olla välilyöntejä',
  13813. reqChkByNode: 'Ei valintoja.',
  13814. requiredChk: 'Tämä kenttä on pakollinen.',
  13815. reqChkByName: 'Ole hyvä ja valitse {label}.',
  13816. match: 'Tämän kentän tulee vastata kenttää {matchName}',
  13817. startDate: 'alkupäivämäärä',
  13818. endDate: 'loppupäivämäärä',
  13819. currentDate: 'nykyinen päivämäärä',
  13820. afterDate: 'Päivämäärän tulisi olla sama tai myöhäisempi ajankohta kuin {label}.',
  13821. beforeDate: 'Päivämäärän tulisi olla sama tai aikaisempi ajankohta kuin {label}.',
  13822. startMonth: 'Ole hyvä ja valitse aloituskuukausi',
  13823. sameMonth: 'Näiden kahden päivämäärän tulee olla saman kuun sisällä -- sinun pitää muuttaa jompaa kumpaa.',
  13824. creditcard: 'Annettu luottokortin numero ei kelpaa. Ole hyvä ja tarkista numero sekä yritä uudelleen. {length} numeroa syötetty.'
  13825. });
  13826. /*
  13827. ---
  13828. name: Locale.fi-FI.Number
  13829. description: Finnish number messages
  13830. license: MIT-style license
  13831. authors:
  13832. - ksel
  13833. requires:
  13834. - Locale
  13835. - Locale.EU.Number
  13836. provides: [Locale.fi-FI.Number]
  13837. ...
  13838. */
  13839. Locale.define('fi-FI', 'Number', {
  13840. group: ' ' // grouped by space
  13841. }).inherit('EU', 'Number');
  13842. /*
  13843. ---
  13844. name: Locale.fr-FR.Date
  13845. description: Date messages for French.
  13846. license: MIT-style license
  13847. authors:
  13848. - Nicolas Sorosac
  13849. - Antoine Abt
  13850. requires:
  13851. - Locale
  13852. provides: [Locale.fr-FR.Date]
  13853. ...
  13854. */
  13855. Locale.define('fr-FR', 'Date', {
  13856. months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
  13857. months_abbr: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
  13858. days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
  13859. days_abbr: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
  13860. // Culture's date order: DD/MM/YYYY
  13861. dateOrder: ['date', 'month', 'year'],
  13862. shortDate: '%d/%m/%Y',
  13863. shortTime: '%H:%M',
  13864. AM: 'AM',
  13865. PM: 'PM',
  13866. firstDayOfWeek: 1,
  13867. // Date.Extras
  13868. ordinal: function(dayOfMonth){
  13869. return (dayOfMonth > 1) ? '' : 'er';
  13870. },
  13871. lessThanMinuteAgo: "il y a moins d'une minute",
  13872. minuteAgo: 'il y a une minute',
  13873. minutesAgo: 'il y a {delta} minutes',
  13874. hourAgo: 'il y a une heure',
  13875. hoursAgo: 'il y a {delta} heures',
  13876. dayAgo: 'il y a un jour',
  13877. daysAgo: 'il y a {delta} jours',
  13878. weekAgo: 'il y a une semaine',
  13879. weeksAgo: 'il y a {delta} semaines',
  13880. monthAgo: 'il y a 1 mois',
  13881. monthsAgo: 'il y a {delta} mois',
  13882. yearthAgo: 'il y a 1 an',
  13883. yearsAgo: 'il y a {delta} ans',
  13884. lessThanMinuteUntil: "dans moins d'une minute",
  13885. minuteUntil: 'dans une minute',
  13886. minutesUntil: 'dans {delta} minutes',
  13887. hourUntil: 'dans une heure',
  13888. hoursUntil: 'dans {delta} heures',
  13889. dayUntil: 'dans un jour',
  13890. daysUntil: 'dans {delta} jours',
  13891. weekUntil: 'dans 1 semaine',
  13892. weeksUntil: 'dans {delta} semaines',
  13893. monthUntil: 'dans 1 mois',
  13894. monthsUntil: 'dans {delta} mois',
  13895. yearUntil: 'dans 1 an',
  13896. yearsUntil: 'dans {delta} ans'
  13897. });
  13898. /*
  13899. ---
  13900. name: Locale.fr-FR.Form.Validator
  13901. description: Form Validator messages for French.
  13902. license: MIT-style license
  13903. authors:
  13904. - Miquel Hudin
  13905. - Nicolas Sorosac
  13906. requires:
  13907. - Locale
  13908. provides: [Locale.fr-FR.Form.Validator]
  13909. ...
  13910. */
  13911. /*eslint mootools-whitespace:0*/
  13912. Locale.define('fr-FR', 'FormValidator', {
  13913. required: 'Ce champ est obligatoire.',
  13914. length: 'Veuillez saisir {length} caract&egrave;re(s) (vous avez saisi {elLength} caract&egrave;re(s)',
  13915. minLength: 'Veuillez saisir un minimum de {minLength} caract&egrave;re(s) (vous avez saisi {length} caract&egrave;re(s)).',
  13916. maxLength: 'Veuillez saisir un maximum de {maxLength} caract&egrave;re(s) (vous avez saisi {length} caract&egrave;re(s)).',
  13917. integer: 'Veuillez saisir un nombre entier dans ce champ. Les nombres d&eacute;cimaux (ex : "1,25") ne sont pas autoris&eacute;s.',
  13918. numeric: 'Veuillez saisir uniquement des chiffres dans ce champ (ex : "1" ou "1,1" ou "-1" ou "-1,1").',
  13919. 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;).",
  13920. alpha: 'Veuillez saisir uniquement des lettres (a-z) dans ce champ. Les espaces ou autres caract&egrave;res ne sont pas autoris&eacute;s.',
  13921. 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.',
  13922. dateSuchAs: 'Veuillez saisir une date correcte comme {date}',
  13923. dateInFormatMDY: 'Veuillez saisir une date correcte, au format JJ/MM/AAAA (ex : "31/11/1999").',
  13924. email: 'Veuillez saisir une adresse de courrier &eacute;lectronique. Par exemple "fred@domaine.com".',
  13925. url: 'Veuillez saisir une URL, comme http://www.exemple.com.',
  13926. currencyDollar: 'Veuillez saisir une quantit&eacute; correcte. Par exemple 100,00&euro;.',
  13927. oneRequired: 'Veuillez s&eacute;lectionner au moins une de ces options.',
  13928. errorPrefix: 'Erreur : ',
  13929. warningPrefix: 'Attention : ',
  13930. // Form.Validator.Extras
  13931. noSpace: "Ce champ n'accepte pas les espaces.",
  13932. reqChkByNode: "Aucun &eacute;l&eacute;ment n'est s&eacute;lectionn&eacute;.",
  13933. requiredChk: 'Ce champ est obligatoire.',
  13934. reqChkByName: 'Veuillez s&eacute;lectionner un(e) {label}.',
  13935. match: 'Ce champ doit correspondre avec le champ {matchName}.',
  13936. startDate: 'date de d&eacute;but',
  13937. endDate: 'date de fin',
  13938. currentDate: 'date actuelle',
  13939. afterDate: 'La date doit &ecirc;tre identique ou post&eacute;rieure &agrave; {label}.',
  13940. beforeDate: 'La date doit &ecirc;tre identique ou ant&eacute;rieure &agrave; {label}.',
  13941. startMonth: 'Veuillez s&eacute;lectionner un mois de d&eacute;but.',
  13942. sameMonth: 'Ces deux dates doivent &ecirc;tre dans le m&ecirc;me mois - vous devez en modifier une.',
  13943. 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).'
  13944. });
  13945. /*
  13946. ---
  13947. name: Locale.fr-FR.Number
  13948. description: Number messages for French.
  13949. license: MIT-style license
  13950. authors:
  13951. - Arian Stolwijk
  13952. - sv1l
  13953. requires:
  13954. - Locale
  13955. - Locale.EU.Number
  13956. provides: [Locale.fr-FR.Number]
  13957. ...
  13958. */
  13959. Locale.define('fr-FR', 'Number', {
  13960. group: ' ' // In fr-FR localization, group character is a blank space
  13961. }).inherit('EU', 'Number');
  13962. /*
  13963. ---
  13964. name: Locale.he-IL.Date
  13965. description: Date messages for Hebrew.
  13966. license: MIT-style license
  13967. authors:
  13968. - Elad Ossadon
  13969. requires:
  13970. - Locale
  13971. provides: [Locale.he-IL.Date]
  13972. ...
  13973. */
  13974. Locale.define('he-IL', 'Date', {
  13975. months: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
  13976. months_abbr: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
  13977. days: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'],
  13978. days_abbr: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'],
  13979. // Culture's date order: MM/DD/YYYY
  13980. dateOrder: ['date', 'month', 'year'],
  13981. shortDate: '%d/%m/%Y',
  13982. shortTime: '%H:%M',
  13983. AM: 'AM',
  13984. PM: 'PM',
  13985. firstDayOfWeek: 0,
  13986. // Date.Extras
  13987. ordinal: '',
  13988. lessThanMinuteAgo: 'לפני פחות מדקה',
  13989. minuteAgo: 'לפני כדקה',
  13990. minutesAgo: 'לפני {delta} דקות',
  13991. hourAgo: 'לפני כשעה',
  13992. hoursAgo: 'לפני {delta} שעות',
  13993. dayAgo: 'לפני יום',
  13994. daysAgo: 'לפני {delta} ימים',
  13995. weekAgo: 'לפני שבוע',
  13996. weeksAgo: 'לפני {delta} שבועות',
  13997. monthAgo: 'לפני חודש',
  13998. monthsAgo: 'לפני {delta} חודשים',
  13999. yearAgo: 'לפני שנה',
  14000. yearsAgo: 'לפני {delta} שנים',
  14001. lessThanMinuteUntil: 'בעוד פחות מדקה',
  14002. minuteUntil: 'בעוד כדקה',
  14003. minutesUntil: 'בעוד {delta} דקות',
  14004. hourUntil: 'בעוד כשעה',
  14005. hoursUntil: 'בעוד {delta} שעות',
  14006. dayUntil: 'בעוד יום',
  14007. daysUntil: 'בעוד {delta} ימים',
  14008. weekUntil: 'בעוד שבוע',
  14009. weeksUntil: 'בעוד {delta} שבועות',
  14010. monthUntil: 'בעוד חודש',
  14011. monthsUntil: 'בעוד {delta} חודשים',
  14012. yearUntil: 'בעוד שנה',
  14013. yearsUntil: 'בעוד {delta} שנים'
  14014. });
  14015. /*
  14016. ---
  14017. name: Locale.he-IL.Form.Validator
  14018. description: Form Validator messages for Hebrew.
  14019. license: MIT-style license
  14020. authors:
  14021. - Elad Ossadon
  14022. requires:
  14023. - Locale
  14024. provides: [Locale.he-IL.Form.Validator]
  14025. ...
  14026. */
  14027. Locale.define('he-IL', 'FormValidator', {
  14028. required: 'נא למלא שדה זה.',
  14029. minLength: 'נא להזין לפחות {minLength} תווים (הזנת {length} תווים).',
  14030. maxLength: 'נא להזין עד {maxLength} תווים (הזנת {length} תווים).',
  14031. integer: 'נא להזין מספר שלם לשדה זה. מספרים עשרוניים (כמו 1.25) אינם חוקיים.',
  14032. numeric: 'נא להזין ערך מספרי בלבד בשדה זה (כמו "1", "1.1", "-1" או "-1.1").',
  14033. digits: 'נא להזין רק ספרות וסימני הפרדה בשדה זה (למשל, מספר טלפון עם מקפים או נקודות הוא חוקי).',
  14034. alpha: 'נא להזין רק אותיות באנגלית (a-z) בשדה זה. רווחים או תווים אחרים אינם חוקיים.',
  14035. alphanum: 'נא להזין רק אותריות באנגלית (a-z) או ספרות (0-9) בשדה זה. אווחרים או תווים אחרים אינם חוקיים.',
  14036. dateSuchAs: 'נא להזין תאריך חוקי, כמו {date}',
  14037. dateInFormatMDY: 'נא להזין תאריך חוקי בפורמט MM/DD/YYYY (כמו "12/31/1999")',
  14038. email: 'נא להזין כתובת אימייל חוקית. לדוגמה: "fred@domain.com".',
  14039. url: 'נא להזין כתובת אתר חוקית, כמו http://www.example.com.',
  14040. currencyDollar: 'נא להזין סכום דולרי חוקי. לדוגמה $100.00.',
  14041. oneRequired: 'נא לבחור לפחות בשדה אחד.',
  14042. errorPrefix: 'שגיאה: ',
  14043. warningPrefix: 'אזהרה: ',
  14044. // Form.Validator.Extras
  14045. noSpace: 'אין להזין רווחים בשדה זה.',
  14046. reqChkByNode: 'נא לבחור אחת מהאפשרויות.',
  14047. requiredChk: 'שדה זה נדרש.',
  14048. reqChkByName: 'נא לבחור {label}.',
  14049. match: 'שדה זה צריך להתאים לשדה {matchName}',
  14050. startDate: 'תאריך ההתחלה',
  14051. endDate: 'תאריך הסיום',
  14052. currentDate: 'התאריך הנוכחי',
  14053. afterDate: 'התאריך צריך להיות זהה או אחרי {label}.',
  14054. beforeDate: 'התאריך צריך להיות זהה או לפני {label}.',
  14055. startMonth: 'נא לבחור חודש התחלה',
  14056. sameMonth: 'שני תאריכים אלה צריכים להיות באותו חודש - נא לשנות אחד התאריכים.',
  14057. creditcard: 'מספר כרטיס האשראי שהוזן אינו חוקי. נא לבדוק שנית. הוזנו {length} ספרות.'
  14058. });
  14059. /*
  14060. ---
  14061. name: Locale.he-IL.Number
  14062. description: Number messages for Hebrew.
  14063. license: MIT-style license
  14064. authors:
  14065. - Elad Ossadon
  14066. requires:
  14067. - Locale
  14068. provides: [Locale.he-IL.Number]
  14069. ...
  14070. */
  14071. Locale.define('he-IL', 'Number', {
  14072. decimal: '.',
  14073. group: ',',
  14074. currency: {
  14075. suffix: ' ₪'
  14076. }
  14077. });
  14078. /*
  14079. ---
  14080. name: Locale.hu-HU.Date
  14081. description: Date messages for Hungarian.
  14082. license: MIT-style license
  14083. authors:
  14084. - Zsolt Szegheő
  14085. requires:
  14086. - Locale
  14087. provides: [Locale.hu-HU.Date]
  14088. ...
  14089. */
  14090. Locale.define('hu-HU', 'Date', {
  14091. months: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június', 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],
  14092. months_abbr: ['jan.', 'febr.', 'márc.', 'ápr.', 'máj.', 'jún.', 'júl.', 'aug.', 'szept.', 'okt.', 'nov.', 'dec.'],
  14093. days: ['Vasárnap', 'Hétfő', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
  14094. days_abbr: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
  14095. // Culture's date order: YYYY.MM.DD.
  14096. dateOrder: ['year', 'month', 'date'],
  14097. shortDate: '%Y.%m.%d.',
  14098. shortTime: '%I:%M',
  14099. AM: 'de.',
  14100. PM: 'du.',
  14101. firstDayOfWeek: 1,
  14102. // Date.Extras
  14103. ordinal: '.',
  14104. lessThanMinuteAgo: 'alig egy perce',
  14105. minuteAgo: 'egy perce',
  14106. minutesAgo: '{delta} perce',
  14107. hourAgo: 'egy órája',
  14108. hoursAgo: '{delta} órája',
  14109. dayAgo: '1 napja',
  14110. daysAgo: '{delta} napja',
  14111. weekAgo: '1 hete',
  14112. weeksAgo: '{delta} hete',
  14113. monthAgo: '1 hónapja',
  14114. monthsAgo: '{delta} hónapja',
  14115. yearAgo: '1 éve',
  14116. yearsAgo: '{delta} éve',
  14117. lessThanMinuteUntil: 'alig egy perc múlva',
  14118. minuteUntil: 'egy perc múlva',
  14119. minutesUntil: '{delta} perc múlva',
  14120. hourUntil: 'egy óra múlva',
  14121. hoursUntil: '{delta} óra múlva',
  14122. dayUntil: '1 nap múlva',
  14123. daysUntil: '{delta} nap múlva',
  14124. weekUntil: '1 hét múlva',
  14125. weeksUntil: '{delta} hét múlva',
  14126. monthUntil: '1 hónap múlva',
  14127. monthsUntil: '{delta} hónap múlva',
  14128. yearUntil: '1 év múlva',
  14129. yearsUntil: '{delta} év múlva'
  14130. });
  14131. /*
  14132. ---
  14133. name: Locale.hu-HU.Form.Validator
  14134. description: Form Validator messages for Hungarian.
  14135. license: MIT-style license
  14136. authors:
  14137. - Zsolt Szegheő
  14138. requires:
  14139. - Locale
  14140. provides: [Locale.hu-HU.Form.Validator]
  14141. ...
  14142. */
  14143. /*eslint mootools-whitespace:0*/
  14144. Locale.define('hu-HU', 'FormValidator', {
  14145. required: 'A mező kitöltése kötelező.',
  14146. minLength: 'Legalább {minLength} karakter megadása szükséges (megadva {length} karakter).',
  14147. maxLength: 'Legfeljebb {maxLength} karakter megadása lehetséges (megadva {length} karakter).',
  14148. integer: 'Egész szám megadása szükséges. A tizedesjegyek (pl. 1.25) nem engedélyezettek.',
  14149. numeric: 'Szám megadása szükséges (pl. "1" vagy "1.1" vagy "-1" vagy "-1.1").',
  14150. digits: 'Csak számok és írásjelek megadása lehetséges (pl. telefonszám kötőjelek és/vagy perjelekkel).',
  14151. alpha: 'Csak betűk (a-z) megadása lehetséges. Szóköz és egyéb karakterek nem engedélyezettek.',
  14152. 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.',
  14153. dateSuchAs: 'Valós dátum megadása szükséges (pl. {date}).',
  14154. dateInFormatMDY: 'Valós dátum megadása szükséges ÉÉÉÉ.HH.NN. formában. (pl. "1999.12.31.")',
  14155. email: 'Valós e-mail cím megadása szükséges (pl. "fred@domain.hu").',
  14156. url: 'Valós URL megadása szükséges (pl. http://www.example.com).',
  14157. currencyDollar: 'Valós pénzösszeg megadása szükséges (pl. 100.00 Ft.).',
  14158. oneRequired: 'Az alábbi mezők legalább egyikének kitöltése kötelező.',
  14159. errorPrefix: 'Hiba: ',
  14160. warningPrefix: 'Figyelem: ',
  14161. // Form.Validator.Extras
  14162. noSpace: 'A mező nem tartalmazhat szóközöket.',
  14163. reqChkByNode: 'Nincs egyetlen kijelölt elem sem.',
  14164. requiredChk: 'A mező kitöltése kötelező.',
  14165. reqChkByName: 'Egy {label} kiválasztása szükséges.',
  14166. match: 'A mezőnek egyeznie kell a(z) {matchName} mezővel.',
  14167. startDate: 'a kezdet dátuma',
  14168. endDate: 'a vég dátuma',
  14169. currentDate: 'jelenlegi dátum',
  14170. afterDate: 'A dátum nem lehet kisebb, mint {label}.',
  14171. beforeDate: 'A dátum nem lehet nagyobb, mint {label}.',
  14172. startMonth: 'Kezdeti hónap megadása szükséges.',
  14173. sameMonth: 'A két dátumnak ugyanazon hónapban kell lennie.',
  14174. creditcard: 'A megadott bankkártyaszám nem valódi (megadva {length} számjegy).'
  14175. });
  14176. /*
  14177. ---
  14178. name: Locale.it-IT.Date
  14179. description: Date messages for Italian.
  14180. license: MIT-style license.
  14181. authors:
  14182. - Andrea Novero
  14183. - Valerio Proietti
  14184. requires:
  14185. - Locale
  14186. provides: [Locale.it-IT.Date]
  14187. ...
  14188. */
  14189. Locale.define('it-IT', 'Date', {
  14190. months: ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'],
  14191. months_abbr: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
  14192. days: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
  14193. days_abbr: ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'],
  14194. // Culture's date order: DD/MM/YYYY
  14195. dateOrder: ['date', 'month', 'year'],
  14196. shortDate: '%d/%m/%Y',
  14197. shortTime: '%H.%M',
  14198. AM: 'AM',
  14199. PM: 'PM',
  14200. firstDayOfWeek: 1,
  14201. // Date.Extras
  14202. ordinal: 'º',
  14203. lessThanMinuteAgo: 'meno di un minuto fa',
  14204. minuteAgo: 'circa un minuto fa',
  14205. minutesAgo: 'circa {delta} minuti fa',
  14206. hourAgo: "circa un'ora fa",
  14207. hoursAgo: 'circa {delta} ore fa',
  14208. dayAgo: 'circa 1 giorno fa',
  14209. daysAgo: 'circa {delta} giorni fa',
  14210. weekAgo: 'una settimana fa',
  14211. weeksAgo: '{delta} settimane fa',
  14212. monthAgo: 'un mese fa',
  14213. monthsAgo: '{delta} mesi fa',
  14214. yearAgo: 'un anno fa',
  14215. yearsAgo: '{delta} anni fa',
  14216. lessThanMinuteUntil: 'tra meno di un minuto',
  14217. minuteUntil: 'tra circa un minuto',
  14218. minutesUntil: 'tra circa {delta} minuti',
  14219. hourUntil: "tra circa un'ora",
  14220. hoursUntil: 'tra circa {delta} ore',
  14221. dayUntil: 'tra circa un giorno',
  14222. daysUntil: 'tra circa {delta} giorni',
  14223. weekUntil: 'tra una settimana',
  14224. weeksUntil: 'tra {delta} settimane',
  14225. monthUntil: 'tra un mese',
  14226. monthsUntil: 'tra {delta} mesi',
  14227. yearUntil: 'tra un anno',
  14228. yearsUntil: 'tra {delta} anni'
  14229. });
  14230. /*
  14231. ---
  14232. name: Locale.it-IT.Form.Validator
  14233. description: Form Validator messages for Italian.
  14234. license: MIT-style license
  14235. authors:
  14236. - Leonardo Laureti
  14237. - Andrea Novero
  14238. requires:
  14239. - Locale
  14240. provides: [Locale.it-IT.Form.Validator]
  14241. ...
  14242. */
  14243. /*eslint mootools-whitespace:0*/
  14244. Locale.define('it-IT', 'FormValidator', {
  14245. required: 'Il campo &egrave; obbligatorio.',
  14246. minLength: 'Inserire almeno {minLength} caratteri (ne sono stati inseriti {length}).',
  14247. maxLength: 'Inserire al massimo {maxLength} caratteri (ne sono stati inseriti {length}).',
  14248. integer: 'Inserire un numero intero. Non sono consentiti decimali (es.: 1.25).',
  14249. numeric: 'Inserire solo valori numerici (es.: "1" oppure "1.1" oppure "-1" oppure "-1.1").',
  14250. digits: 'Inserire solo numeri e caratteri di punteggiatura. Per esempio &egrave; consentito un numero telefonico con trattini o punti.',
  14251. alpha: 'Inserire solo lettere (a-z). Non sono consentiti spazi o altri caratteri.',
  14252. alphanum: 'Inserire solo lettere (a-z) o numeri (0-9). Non sono consentiti spazi o altri caratteri.',
  14253. dateSuchAs: 'Inserire una data valida del tipo {date}',
  14254. dateInFormatMDY: 'Inserire una data valida nel formato MM/GG/AAAA (es.: "12/31/1999")',
  14255. email: 'Inserire un indirizzo email valido. Per esempio "nome@dominio.com".',
  14256. url: 'Inserire un indirizzo valido. Per esempio "http://www.example.com".',
  14257. currencyDollar: 'Inserire un importo valido. Per esempio "$100.00".',
  14258. oneRequired: 'Completare almeno uno dei campi richiesti.',
  14259. errorPrefix: 'Errore: ',
  14260. warningPrefix: 'Attenzione: ',
  14261. // Form.Validator.Extras
  14262. noSpace: 'Non sono consentiti spazi.',
  14263. reqChkByNode: 'Nessuna voce selezionata.',
  14264. requiredChk: 'Il campo &egrave; obbligatorio.',
  14265. reqChkByName: 'Selezionare un(a) {label}.',
  14266. match: 'Il valore deve corrispondere al campo {matchName}',
  14267. startDate: "data d'inizio",
  14268. endDate: 'data di fine',
  14269. currentDate: 'data attuale',
  14270. afterDate: 'La data deve corrispondere o essere successiva al {label}.',
  14271. beforeDate: 'La data deve corrispondere o essere precedente al {label}.',
  14272. startMonth: "Selezionare un mese d'inizio",
  14273. sameMonth: 'Le due date devono essere dello stesso mese - occorre modificarne una.'
  14274. });
  14275. /*
  14276. ---
  14277. name: Locale.ja-JP.Date
  14278. description: Date messages for Japanese.
  14279. license: MIT-style license
  14280. authors:
  14281. - Noritaka Horio
  14282. requires:
  14283. - Locale
  14284. provides: [Locale.ja-JP.Date]
  14285. ...
  14286. */
  14287. Locale.define('ja-JP', 'Date', {
  14288. months: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  14289. months_abbr: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  14290. days: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
  14291. days_abbr: ['日', '月', '火', '水', '木', '金', '土'],
  14292. // Culture's date order: YYYY/MM/DD
  14293. dateOrder: ['year', 'month', 'date'],
  14294. shortDate: '%Y/%m/%d',
  14295. shortTime: '%H:%M',
  14296. AM: '午前',
  14297. PM: '午後',
  14298. firstDayOfWeek: 0,
  14299. // Date.Extras
  14300. ordinal: '',
  14301. lessThanMinuteAgo: '1分以内前',
  14302. minuteAgo: '約1分前',
  14303. minutesAgo: '約{delta}分前',
  14304. hourAgo: '約1時間前',
  14305. hoursAgo: '約{delta}時間前',
  14306. dayAgo: '1日前',
  14307. daysAgo: '{delta}日前',
  14308. weekAgo: '1週間前',
  14309. weeksAgo: '{delta}週間前',
  14310. monthAgo: '1ヶ月前',
  14311. monthsAgo: '{delta}ヶ月前',
  14312. yearAgo: '1年前',
  14313. yearsAgo: '{delta}年前',
  14314. lessThanMinuteUntil: '今から約1分以内',
  14315. minuteUntil: '今から約1分',
  14316. minutesUntil: '今から約{delta}分',
  14317. hourUntil: '今から約1時間',
  14318. hoursUntil: '今から約{delta}時間',
  14319. dayUntil: '今から1日間',
  14320. daysUntil: '今から{delta}日間',
  14321. weekUntil: '今から1週間',
  14322. weeksUntil: '今から{delta}週間',
  14323. monthUntil: '今から1ヶ月',
  14324. monthsUntil: '今から{delta}ヶ月',
  14325. yearUntil: '今から1年',
  14326. yearsUntil: '今から{delta}年'
  14327. });
  14328. /*
  14329. ---
  14330. name: Locale.ja-JP.Form.Validator
  14331. description: Form Validator messages for Japanese.
  14332. license: MIT-style license
  14333. authors:
  14334. - Noritaka Horio
  14335. requires:
  14336. - Locale
  14337. provides: [Locale.ja-JP.Form.Validator]
  14338. ...
  14339. */
  14340. Locale.define('ja-JP', 'FormValidator', {
  14341. required: '入力は必須です。',
  14342. minLength: '入力文字数は{minLength}以上にしてください。({length}文字)',
  14343. maxLength: '入力文字数は{maxLength}以下にしてください。({length}文字)',
  14344. integer: '整数を入力してください。',
  14345. numeric: '入力できるのは数値だけです。(例: "1", "1.1", "-1", "-1.1"....)',
  14346. digits: '入力できるのは数値と句読記号です。 (例: -や+を含む電話番号など).',
  14347. alpha: '入力できるのは半角英字だけです。それ以外の文字は入力できません。',
  14348. alphanum: '入力できるのは半角英数字だけです。それ以外の文字は入力できません。',
  14349. dateSuchAs: '有効な日付を入力してください。{date}',
  14350. dateInFormatMDY: '日付の書式に誤りがあります。YYYY/MM/DD (i.e. "1999/12/31")',
  14351. email: 'メールアドレスに誤りがあります。',
  14352. url: 'URLアドレスに誤りがあります。',
  14353. currencyDollar: '金額に誤りがあります。',
  14354. oneRequired: 'ひとつ以上入力してください。',
  14355. errorPrefix: 'エラー: ',
  14356. warningPrefix: '警告: ',
  14357. // FormValidator.Extras
  14358. noSpace: 'スペースは入力できません。',
  14359. reqChkByNode: '選択されていません。',
  14360. requiredChk: 'この項目は必須です。',
  14361. reqChkByName: '{label}を選択してください。',
  14362. match: '{matchName}が入力されている場合必須です。',
  14363. startDate: '開始日',
  14364. endDate: '終了日',
  14365. currentDate: '今日',
  14366. afterDate: '{label}以降の日付にしてください。',
  14367. beforeDate: '{label}以前の日付にしてください。',
  14368. startMonth: '開始月を選択してください。',
  14369. sameMonth: '日付が同一です。どちらかを変更してください。'
  14370. });
  14371. /*
  14372. ---
  14373. name: Locale.ja-JP.Number
  14374. description: Number messages for Japanese.
  14375. license: MIT-style license
  14376. authors:
  14377. - Noritaka Horio
  14378. requires:
  14379. - Locale
  14380. provides: [Locale.ja-JP.Number]
  14381. ...
  14382. */
  14383. Locale.define('ja-JP', 'Number', {
  14384. decimal: '.',
  14385. group: ',',
  14386. currency: {
  14387. decimals: 0,
  14388. prefix: '\\'
  14389. }
  14390. });
  14391. /*
  14392. ---
  14393. name: Locale.nl-NL.Date
  14394. description: Date messages for Dutch.
  14395. license: MIT-style license
  14396. authors:
  14397. - Lennart Pilon
  14398. - Tim Wienk
  14399. requires:
  14400. - Locale
  14401. provides: [Locale.nl-NL.Date]
  14402. ...
  14403. */
  14404. Locale.define('nl-NL', 'Date', {
  14405. months: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
  14406. months_abbr: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
  14407. days: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
  14408. days_abbr: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
  14409. // Culture's date order: DD-MM-YYYY
  14410. dateOrder: ['date', 'month', 'year'],
  14411. shortDate: '%d-%m-%Y',
  14412. shortTime: '%H:%M',
  14413. AM: 'AM',
  14414. PM: 'PM',
  14415. firstDayOfWeek: 1,
  14416. // Date.Extras
  14417. ordinal: 'e',
  14418. lessThanMinuteAgo: 'minder dan een minuut geleden',
  14419. minuteAgo: 'ongeveer een minuut geleden',
  14420. minutesAgo: '{delta} minuten geleden',
  14421. hourAgo: 'ongeveer een uur geleden',
  14422. hoursAgo: 'ongeveer {delta} uur geleden',
  14423. dayAgo: 'een dag geleden',
  14424. daysAgo: '{delta} dagen geleden',
  14425. weekAgo: 'een week geleden',
  14426. weeksAgo: '{delta} weken geleden',
  14427. monthAgo: 'een maand geleden',
  14428. monthsAgo: '{delta} maanden geleden',
  14429. yearAgo: 'een jaar geleden',
  14430. yearsAgo: '{delta} jaar geleden',
  14431. lessThanMinuteUntil: 'over minder dan een minuut',
  14432. minuteUntil: 'over ongeveer een minuut',
  14433. minutesUntil: 'over {delta} minuten',
  14434. hourUntil: 'over ongeveer een uur',
  14435. hoursUntil: 'over {delta} uur',
  14436. dayUntil: 'over ongeveer een dag',
  14437. daysUntil: 'over {delta} dagen',
  14438. weekUntil: 'over een week',
  14439. weeksUntil: 'over {delta} weken',
  14440. monthUntil: 'over een maand',
  14441. monthsUntil: 'over {delta} maanden',
  14442. yearUntil: 'over een jaar',
  14443. yearsUntil: 'over {delta} jaar'
  14444. });
  14445. /*
  14446. ---
  14447. name: Locale.nl-NL.Form.Validator
  14448. description: Form Validator messages for Dutch.
  14449. license: MIT-style license
  14450. authors:
  14451. - Lennart Pilon
  14452. - Arian Stolwijk
  14453. - Tim Wienk
  14454. requires:
  14455. - Locale
  14456. provides: [Locale.nl-NL.Form.Validator]
  14457. ...
  14458. */
  14459. Locale.define('nl-NL', 'FormValidator', {
  14460. required: 'Dit veld is verplicht.',
  14461. length: 'Vul precies {length} karakters in (je hebt {elLength} karakters ingevoerd).',
  14462. minLength: 'Vul minimaal {minLength} karakters in (je hebt {length} karakters ingevoerd).',
  14463. maxLength: 'Vul niet meer dan {maxLength} karakters in (je hebt {length} karakters ingevoerd).',
  14464. integer: 'Vul een getal in. Getallen met decimalen (bijvoorbeeld 1.25) zijn niet toegestaan.',
  14465. numeric: 'Vul alleen numerieke waarden in (bijvoorbeeld "1" of "1.1" of "-1" of "-1.1").',
  14466. digits: 'Vul alleen nummers en leestekens in (bijvoorbeeld een telefoonnummer met streepjes is toegestaan).',
  14467. alpha: 'Vul alleen letters in (a-z). Spaties en andere karakters zijn niet toegestaan.',
  14468. alphanum: 'Vul alleen letters (a-z) of nummers (0-9) in. Spaties en andere karakters zijn niet toegestaan.',
  14469. dateSuchAs: 'Vul een geldige datum in, zoals {date}',
  14470. dateInFormatMDY: 'Vul een geldige datum, in het formaat MM/DD/YYYY (bijvoorbeeld "12/31/1999")',
  14471. email: 'Vul een geldig e-mailadres in. Bijvoorbeeld "fred@domein.nl".',
  14472. url: 'Vul een geldige URL in, zoals http://www.example.com.',
  14473. currencyDollar: 'Vul een geldig $ bedrag in. Bijvoorbeeld $100.00 .',
  14474. oneRequired: 'Vul iets in bij in ieder geval een van deze velden.',
  14475. warningPrefix: 'Waarschuwing: ',
  14476. errorPrefix: 'Fout: ',
  14477. // Form.Validator.Extras
  14478. noSpace: 'Spaties zijn niet toegestaan in dit veld.',
  14479. reqChkByNode: 'Er zijn geen items geselecteerd.',
  14480. requiredChk: 'Dit veld is verplicht.',
  14481. reqChkByName: 'Selecteer een {label}.',
  14482. match: 'Dit veld moet overeen komen met het {matchName} veld',
  14483. startDate: 'de begin datum',
  14484. endDate: 'de eind datum',
  14485. currentDate: 'de huidige datum',
  14486. afterDate: 'De datum moet hetzelfde of na {label} zijn.',
  14487. beforeDate: 'De datum moet hetzelfde of voor {label} zijn.',
  14488. startMonth: 'Selecteer een begin maand',
  14489. sameMonth: 'Deze twee data moeten in dezelfde maand zijn - u moet een van beide aanpassen.',
  14490. creditcard: 'Het ingevulde creditcardnummer is niet geldig. Controleer het nummer en probeer opnieuw. {length} getallen ingevuld.'
  14491. });
  14492. /*
  14493. ---
  14494. name: Locale.nl-NL.Number
  14495. description: Number messages for Dutch.
  14496. license: MIT-style license
  14497. authors:
  14498. - Arian Stolwijk
  14499. requires:
  14500. - Locale
  14501. - Locale.EU.Number
  14502. provides: [Locale.nl-NL.Number]
  14503. ...
  14504. */
  14505. Locale.define('nl-NL').inherit('EU', 'Number');
  14506. /*
  14507. ---
  14508. name: Locale.no-NO.Date
  14509. description: Date messages for Norwegian.
  14510. license: MIT-style license
  14511. authors:
  14512. - Espen 'Rexxars' Hovlandsdal
  14513. - Ole Tøsse Kolvik
  14514. requires:
  14515. - Locale
  14516. provides: [Locale.no-NO.Date]
  14517. ...
  14518. */
  14519. Locale.define('no-NO', 'Date', {
  14520. months: ['Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'],
  14521. months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
  14522. days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
  14523. days_abbr: ['Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'],
  14524. // Culture's date order: DD.MM.YYYY
  14525. dateOrder: ['date', 'month', 'year'],
  14526. shortDate: '%d.%m.%Y',
  14527. shortTime: '%H:%M',
  14528. AM: 'AM',
  14529. PM: 'PM',
  14530. firstDayOfWeek: 1,
  14531. lessThanMinuteAgo: 'mindre enn et minutt siden',
  14532. minuteAgo: 'omtrent et minutt siden',
  14533. minutesAgo: '{delta} minutter siden',
  14534. hourAgo: 'omtrent en time siden',
  14535. hoursAgo: 'omtrent {delta} timer siden',
  14536. dayAgo: '{delta} dag siden',
  14537. daysAgo: '{delta} dager siden',
  14538. weekAgo: 'en uke siden',
  14539. weeksAgo: '{delta} uker siden',
  14540. monthAgo: 'en måned siden',
  14541. monthsAgo: '{delta} måneder siden',
  14542. yearAgo: 'ett år siden',
  14543. yearsAgo: '{delta} år siden',
  14544. lessThanMinuteUntil: 'mindre enn et minutt til',
  14545. minuteUntil: 'omtrent et minutt til',
  14546. minutesUntil: '{delta} minutter til',
  14547. hourUntil: 'omtrent en time til',
  14548. hoursUntil: 'omtrent {delta} timer til',
  14549. dayUntil: 'en dag til',
  14550. daysUntil: '{delta} dager til',
  14551. weekUntil: 'en uke til',
  14552. weeksUntil: '{delta} uker til',
  14553. monthUntil: 'en måned til',
  14554. monthsUntil: '{delta} måneder til',
  14555. yearUntil: 'et år til',
  14556. yearsUntil: '{delta} år til'
  14557. });
  14558. /*
  14559. ---
  14560. name: Locale.no-NO.Form.Validator
  14561. description: Form Validator messages for Norwegian.
  14562. license: MIT-style license
  14563. authors:
  14564. - Aaron Newton
  14565. - Espen 'Rexxars' Hovlandsdal
  14566. - Ole Tøsse Kolvik
  14567. requires:
  14568. - Locale
  14569. provides: [Locale.no-NO.Form.Validator]
  14570. ...
  14571. */
  14572. Locale.define('no-NO', 'FormValidator', {
  14573. required: 'Dette feltet er påkrevd.',
  14574. length: 'Skriv inn {length} tegn (du skrev {elLength} tegn)',
  14575. minLength: 'Skriv inn minst {minLength} tegn (du skrev {length} tegn).',
  14576. maxLength: 'Ikke skriv mer enn {maxLength} tegn (du skrev {length} tegn).',
  14577. integer: 'Skriv inn et tall i dette feltet. Tall med desimaler (f.eks. 1,25) er ikke tillat.',
  14578. numeric: 'Skriv kun inn numeriske verdier i dette feltet (f.eks. "1", "1.1", "-1" eller "-1.1").',
  14579. digits: 'Skriv kun nummer og skilletegn i dette feltet.',
  14580. alpha: 'Skriv kun bokstaver (a-å) i dette feltet. Ingen mellomrom eller andre tegn er tillat.',
  14581. alphanum: 'Skriv kun bokstaver (a-å) eller nummer (0-9) i dette feltet. Ingen mellomrom eller andre tegn er tillat.',
  14582. dateSuchAs: 'Skriv inn en gyldig dato, som f.eks. {date}',
  14583. dateInFormatMDY: 'Skriv inn en gyldig dato, f.eks. DD/MM/YYYY ("31/12/1999")',
  14584. email: 'Skriv inn en gyldig epost-adresse. F.eks. "ola.nordmann@example.com".',
  14585. url: 'Skriv inn en gyldig URL, f.eks. http://www.example.com.',
  14586. currencyDollar: 'Skriv inn et gyldig beløp. F.eks. 100,00.',
  14587. oneRequired: 'Minst ett av disse feltene må fylles ut.',
  14588. errorPrefix: 'Feil: ',
  14589. warningPrefix: 'Advarsel: ',
  14590. // Form.Validator.Extras
  14591. noSpace: 'Mellomrom er ikke tillatt i dette feltet.',
  14592. reqChkByNode: 'Ingen objekter er valgt.',
  14593. requiredChk: 'Dette feltet er påkrevd.',
  14594. reqChkByName: 'Velg en {label}.',
  14595. match: 'Dette feltet må være lik {matchName}',
  14596. startDate: 'startdato',
  14597. endDate: 'sluttdato',
  14598. currentDate: 'dagens dato',
  14599. afterDate: 'Datoen må være den samme som eller etter {label}.',
  14600. beforeDate: 'Datoen må være den samme som eller før {label}.',
  14601. startMonth: 'Velg en startmåned',
  14602. sameMonth: 'Datoene må være i den samme måneden - velg den ene eller den andre.',
  14603. creditcard: 'Kortnummeret du skrev inn er ikke gyldig. Prøv igjen. Du skrev {length} siffer.'
  14604. });
  14605. /*
  14606. ---
  14607. name: Locale.no-NO.Number
  14608. description: Number messages for Norwegian.
  14609. license: MIT-style license
  14610. authors:
  14611. - Arian Stolwijk
  14612. - Martin Lundgren
  14613. - Ole T�sse Kolvik
  14614. requires:
  14615. - Locale
  14616. - Locale.EU.Number
  14617. provides: [Locale.no-NO.Number]
  14618. ...
  14619. */
  14620. Locale.define('no-NO', 'Number', {
  14621. currency: {
  14622. prefix: 'NOK '
  14623. }
  14624. }).inherit('EU', 'Number');
  14625. /*
  14626. ---
  14627. name: Locale.pl-PL.Date
  14628. description: Date messages for Polish.
  14629. license: MIT-style license
  14630. authors:
  14631. - Oskar Krawczyk
  14632. requires:
  14633. - Locale
  14634. provides: [Locale.pl-PL.Date]
  14635. ...
  14636. */
  14637. Locale.define('pl-PL', 'Date', {
  14638. months: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'],
  14639. months_abbr: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
  14640. days: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],
  14641. days_abbr: ['niedz.', 'pon.', 'wt.', 'śr.', 'czw.', 'pt.', 'sob.'],
  14642. // Culture's date order: YYYY-MM-DD
  14643. dateOrder: ['year', 'month', 'date'],
  14644. shortDate: '%Y-%m-%d',
  14645. shortTime: '%H:%M',
  14646. AM: 'nad ranem',
  14647. PM: 'po południu',
  14648. firstDayOfWeek: 1,
  14649. // Date.Extras
  14650. ordinal: function(dayOfMonth){
  14651. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ty' : ['ty', 'szy', 'gi', 'ci', 'ty'][Math.min(dayOfMonth % 10, 4)];
  14652. },
  14653. lessThanMinuteAgo: 'mniej niż minute temu',
  14654. minuteAgo: 'około minutę temu',
  14655. minutesAgo: '{delta} minut temu',
  14656. hourAgo: 'około godzinę temu',
  14657. hoursAgo: 'około {delta} godzin temu',
  14658. dayAgo: 'Wczoraj',
  14659. daysAgo: '{delta} dni temu',
  14660. lessThanMinuteUntil: 'za niecałą minutę',
  14661. minuteUntil: 'za około minutę',
  14662. minutesUntil: 'za {delta} minut',
  14663. hourUntil: 'za około godzinę',
  14664. hoursUntil: 'za około {delta} godzin',
  14665. dayUntil: 'za 1 dzień',
  14666. daysUntil: 'za {delta} dni'
  14667. });
  14668. /*
  14669. ---
  14670. name: Locale.pl-PL.Form.Validator
  14671. description: Form Validator messages for Polish.
  14672. license: MIT-style license
  14673. authors:
  14674. - Oskar Krawczyk
  14675. requires:
  14676. - Locale
  14677. provides: [Locale.pl-PL.Form.Validator]
  14678. ...
  14679. */
  14680. Locale.define('pl-PL', 'FormValidator', {
  14681. required: 'To pole jest wymagane.',
  14682. minLength: 'Wymagane jest przynajmniej {minLength} znaków (wpisanych zostało tylko {length}).',
  14683. maxLength: 'Dozwolone jest nie więcej niż {maxLength} znaków (wpisanych zostało {length})',
  14684. integer: 'To pole wymaga liczb całych. Liczby dziesiętne (np. 1.25) są niedozwolone.',
  14685. numeric: 'Prosimy używać tylko numerycznych wartości w tym polu (np. "1", "1.1", "-1" lub "-1.1").',
  14686. digits: 'Prosimy używać liczb oraz zankow punktuacyjnych w typ polu (dla przykładu, przy numerze telefonu myślniki i kropki są dozwolone).',
  14687. alpha: 'Prosimy używać tylko liter (a-z) w tym polu. Spacje oraz inne znaki są niedozwolone.',
  14688. alphanum: 'Prosimy używać tylko liter (a-z) lub liczb (0-9) w tym polu. Spacje oraz inne znaki są niedozwolone.',
  14689. dateSuchAs: 'Prosimy podać prawidłową datę w formacie: {date}',
  14690. dateInFormatMDY: 'Prosimy podać poprawną date w formacie DD.MM.RRRR (i.e. "12.01.2009")',
  14691. email: 'Prosimy podać prawidłowy adres e-mail, np. "jan@domena.pl".',
  14692. url: 'Prosimy podać prawidłowy adres URL, np. http://www.example.com.',
  14693. currencyDollar: 'Prosimy podać prawidłową sumę w PLN. Dla przykładu: 100.00 PLN.',
  14694. oneRequired: 'Prosimy wypełnić chociaż jedno z pól.',
  14695. errorPrefix: 'Błąd: ',
  14696. warningPrefix: 'Uwaga: ',
  14697. // Form.Validator.Extras
  14698. noSpace: 'W tym polu nie mogą znajdować się spacje.',
  14699. reqChkByNode: 'Brak zaznaczonych elementów.',
  14700. requiredChk: 'To pole jest wymagane.',
  14701. reqChkByName: 'Prosimy wybrać z {label}.',
  14702. match: 'To pole musi być takie samo jak {matchName}',
  14703. startDate: 'data początkowa',
  14704. endDate: 'data końcowa',
  14705. currentDate: 'aktualna data',
  14706. afterDate: 'Podana data poinna być taka sama lub po {label}.',
  14707. beforeDate: 'Podana data poinna być taka sama lub przed {label}.',
  14708. startMonth: 'Prosimy wybrać początkowy miesiąc.',
  14709. sameMonth: 'Te dwie daty muszą być w zakresie tego samego miesiąca - wymagana jest zmiana któregoś z pól.'
  14710. });
  14711. /*
  14712. ---
  14713. name: Locale.pt-PT.Date
  14714. description: Date messages for Portuguese.
  14715. license: MIT-style license
  14716. authors:
  14717. - Fabio Miranda Costa
  14718. requires:
  14719. - Locale
  14720. provides: [Locale.pt-PT.Date]
  14721. ...
  14722. */
  14723. Locale.define('pt-PT', 'Date', {
  14724. months: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
  14725. months_abbr: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
  14726. days: ['Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'],
  14727. days_abbr: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
  14728. // Culture's date order: DD-MM-YYYY
  14729. dateOrder: ['date', 'month', 'year'],
  14730. shortDate: '%d-%m-%Y',
  14731. shortTime: '%H:%M',
  14732. AM: 'AM',
  14733. PM: 'PM',
  14734. firstDayOfWeek: 1,
  14735. // Date.Extras
  14736. ordinal: 'º',
  14737. lessThanMinuteAgo: 'há menos de um minuto',
  14738. minuteAgo: 'há cerca de um minuto',
  14739. minutesAgo: 'há {delta} minutos',
  14740. hourAgo: 'há cerca de uma hora',
  14741. hoursAgo: 'há cerca de {delta} horas',
  14742. dayAgo: 'há um dia',
  14743. daysAgo: 'há {delta} dias',
  14744. weekAgo: 'há uma semana',
  14745. weeksAgo: 'há {delta} semanas',
  14746. monthAgo: 'há um mês',
  14747. monthsAgo: 'há {delta} meses',
  14748. yearAgo: 'há um ano',
  14749. yearsAgo: 'há {delta} anos',
  14750. lessThanMinuteUntil: 'em menos de um minuto',
  14751. minuteUntil: 'em um minuto',
  14752. minutesUntil: 'em {delta} minutos',
  14753. hourUntil: 'em uma hora',
  14754. hoursUntil: 'em {delta} horas',
  14755. dayUntil: 'em um dia',
  14756. daysUntil: 'em {delta} dias',
  14757. weekUntil: 'em uma semana',
  14758. weeksUntil: 'em {delta} semanas',
  14759. monthUntil: 'em um mês',
  14760. monthsUntil: 'em {delta} meses',
  14761. yearUntil: 'em um ano',
  14762. yearsUntil: 'em {delta} anos'
  14763. });
  14764. /*
  14765. ---
  14766. name: Locale.pt-BR.Date
  14767. description: Date messages for Portuguese (Brazil).
  14768. license: MIT-style license
  14769. authors:
  14770. - Fabio Miranda Costa
  14771. requires:
  14772. - Locale
  14773. - Locale.pt-PT.Date
  14774. provides: [Locale.pt-BR.Date]
  14775. ...
  14776. */
  14777. Locale.define('pt-BR', 'Date', {
  14778. // Culture's date order: DD/MM/YYYY
  14779. shortDate: '%d/%m/%Y'
  14780. }).inherit('pt-PT', 'Date');
  14781. /*
  14782. ---
  14783. name: Locale.pt-BR.Form.Validator
  14784. description: Form Validator messages for Portuguese (Brazil).
  14785. license: MIT-style license
  14786. authors:
  14787. - Fábio Miranda Costa
  14788. requires:
  14789. - Locale
  14790. provides: [Locale.pt-BR.Form.Validator]
  14791. ...
  14792. */
  14793. Locale.define('pt-BR', 'FormValidator', {
  14794. required: 'Este campo é obrigatório.',
  14795. minLength: 'Digite pelo menos {minLength} caracteres (tamanho atual: {length}).',
  14796. maxLength: 'Não digite mais de {maxLength} caracteres (tamanho atual: {length}).',
  14797. integer: 'Por favor digite apenas um número inteiro neste campo. Não são permitidos números decimais (por exemplo, 1,25).',
  14798. numeric: 'Por favor digite apenas valores numéricos neste campo (por exemplo, "1" ou "1.1" ou "-1" ou "-1,1").',
  14799. 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).',
  14800. alpha: 'Por favor use somente letras (a-z). Espaço e outros caracteres não são permitidos.',
  14801. alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Espaço e outros caracteres não são permitidos.',
  14802. dateSuchAs: 'Digite uma data válida, como {date}',
  14803. dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (por exemplo, "31/12/1999")',
  14804. email: 'Digite um endereço de email válido. Por exemplo "nome@dominio.com".',
  14805. url: 'Digite uma URL válida. Exemplo: http://www.example.com.',
  14806. currencyDollar: 'Digite um valor em dinheiro válido. Exemplo: R$100,00 .',
  14807. oneRequired: 'Digite algo para pelo menos um desses campos.',
  14808. errorPrefix: 'Erro: ',
  14809. warningPrefix: 'Aviso: ',
  14810. // Form.Validator.Extras
  14811. noSpace: 'Não é possível digitar espaços neste campo.',
  14812. reqChkByNode: 'Não foi selecionado nenhum item.',
  14813. requiredChk: 'Este campo é obrigatório.',
  14814. reqChkByName: 'Por favor digite um {label}.',
  14815. match: 'Este campo deve ser igual ao campo {matchName}.',
  14816. startDate: 'a data inicial',
  14817. endDate: 'a data final',
  14818. currentDate: 'a data atual',
  14819. afterDate: 'A data deve ser igual ou posterior a {label}.',
  14820. beforeDate: 'A data deve ser igual ou anterior a {label}.',
  14821. startMonth: 'Por favor selecione uma data inicial.',
  14822. sameMonth: 'Estas duas datas devem ter o mesmo mês - você deve modificar uma das duas.',
  14823. 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.'
  14824. });
  14825. /*
  14826. ---
  14827. name: Locale.pt-BR.Number
  14828. description: Number messages for PT Brazilian.
  14829. license: MIT-style license
  14830. authors:
  14831. - Arian Stolwijk
  14832. - Danillo César
  14833. requires:
  14834. - Locale
  14835. provides: [Locale.pt-BR.Number]
  14836. ...
  14837. */
  14838. Locale.define('pt-BR', 'Number', {
  14839. decimal: ',',
  14840. group: '.',
  14841. currency: {
  14842. prefix: 'R$ '
  14843. }
  14844. });
  14845. /*
  14846. ---
  14847. name: Locale.pt-PT.Form.Validator
  14848. description: Form Validator messages for Portuguese.
  14849. license: MIT-style license
  14850. authors:
  14851. - Miquel Hudin
  14852. requires:
  14853. - Locale
  14854. provides: [Locale.pt-PT.Form.Validator]
  14855. ...
  14856. */
  14857. Locale.define('pt-PT', 'FormValidator', {
  14858. required: 'Este campo é necessário.',
  14859. minLength: 'Digite pelo menos{minLength} caracteres (comprimento {length} caracteres).',
  14860. maxLength: 'Não insira mais de {maxLength} caracteres (comprimento {length} caracteres).',
  14861. integer: 'Digite um número inteiro neste domínio. Com números decimais (por exemplo, 1,25), não são permitidas.',
  14862. numeric: 'Digite apenas valores numéricos neste domínio (p.ex., "1" ou "1.1" ou "-1" ou "-1,1").',
  14863. 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).',
  14864. alpha: 'Por favor use somente letras (a-z), com nesta área. Não utilize espaços nem outros caracteres são permitidos.',
  14865. alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Não utilize espaços nem outros caracteres são permitidos.',
  14866. dateSuchAs: 'Digite uma data válida, como {date}',
  14867. dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (p.ex. "31/12/1999")',
  14868. email: 'Digite um endereço de email válido. Por exemplo "fred@domain.com".',
  14869. url: 'Digite uma URL válida, como http://www.example.com.',
  14870. currencyDollar: 'Digite um valor válido $. Por exemplo $ 100,00. ',
  14871. oneRequired: 'Digite algo para pelo menos um desses insumos.',
  14872. errorPrefix: 'Erro: ',
  14873. warningPrefix: 'Aviso: '
  14874. });
  14875. /*
  14876. ---
  14877. name: Locale.ru-RU-unicode.Date
  14878. description: Date messages for Russian (utf-8).
  14879. license: MIT-style license
  14880. authors:
  14881. - Evstigneev Pavel
  14882. - Kuryanovich Egor
  14883. requires:
  14884. - Locale
  14885. provides: [Locale.ru-RU.Date]
  14886. ...
  14887. */
  14888. (function(){
  14889. // Russian language pluralization rules, taken from CLDR project, http://unicode.org/cldr/
  14890. // one -> n mod 10 is 1 and n mod 100 is not 11;
  14891. // few -> n mod 10 in 2..4 and n mod 100 not in 12..14;
  14892. // many -> n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14;
  14893. // other -> everything else (example 3.14)
  14894. var pluralize = function(n, one, few, many, other){
  14895. var modulo10 = n % 10,
  14896. modulo100 = n % 100;
  14897. if (modulo10 == 1 && modulo100 != 11){
  14898. return one;
  14899. } else if ((modulo10 == 2 || modulo10 == 3 || modulo10 == 4) && !(modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){
  14900. return few;
  14901. } else if (modulo10 == 0 || (modulo10 == 5 || modulo10 == 6 || modulo10 == 7 || modulo10 == 8 || modulo10 == 9) || (modulo100 == 11 || modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){
  14902. return many;
  14903. } else {
  14904. return other;
  14905. }
  14906. };
  14907. Locale.define('ru-RU', 'Date', {
  14908. months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],
  14909. months_abbr: ['янв', 'февр', 'март', 'апр', 'май','июнь','июль','авг','сент','окт','нояб','дек'],
  14910. days: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
  14911. days_abbr: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
  14912. // Culture's date order: DD.MM.YYYY
  14913. dateOrder: ['date', 'month', 'year'],
  14914. shortDate: '%d.%m.%Y',
  14915. shortTime: '%H:%M',
  14916. AM: 'AM',
  14917. PM: 'PM',
  14918. firstDayOfWeek: 1,
  14919. // Date.Extras
  14920. ordinal: '',
  14921. lessThanMinuteAgo: 'меньше минуты назад',
  14922. minuteAgo: 'минуту назад',
  14923. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'минуту', 'минуты', 'минут') + ' назад'; },
  14924. hourAgo: 'час назад',
  14925. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'час', 'часа', 'часов') + ' назад'; },
  14926. dayAgo: 'вчера',
  14927. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'день', 'дня', 'дней') + ' назад'; },
  14928. weekAgo: 'неделю назад',
  14929. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'неделя', 'недели', 'недель') + ' назад'; },
  14930. monthAgo: 'месяц назад',
  14931. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'месяц', 'месяца', 'месяцев') + ' назад'; },
  14932. yearAgo: 'год назад',
  14933. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'год', 'года', 'лет') + ' назад'; },
  14934. lessThanMinuteUntil: 'меньше чем через минуту',
  14935. minuteUntil: 'через минуту',
  14936. minutesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'минуту', 'минуты', 'минут') + ''; },
  14937. hourUntil: 'через час',
  14938. hoursUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'час', 'часа', 'часов') + ''; },
  14939. dayUntil: 'завтра',
  14940. daysUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'день', 'дня', 'дней') + ''; },
  14941. weekUntil: 'через неделю',
  14942. weeksUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'неделю', 'недели', 'недель') + ''; },
  14943. monthUntil: 'через месяц',
  14944. monthsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'месяц', 'месяца', 'месяцев') + ''; },
  14945. yearUntil: 'через',
  14946. yearsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'год', 'года', 'лет') + ''; }
  14947. });
  14948. //<1.2compat>
  14949. Locale.define('ru-RU-unicode').inherit('ru-RU', 'Date');
  14950. //</1.2compat>
  14951. })();
  14952. /*
  14953. ---
  14954. name: Locale.ru-RU-unicode.Form.Validator
  14955. description: Form Validator messages for Russian (utf-8).
  14956. license: MIT-style license
  14957. authors:
  14958. - Chernodarov Egor
  14959. requires:
  14960. - Locale
  14961. provides: [Locale.ru-RU.Form.Validator]
  14962. ...
  14963. */
  14964. Locale.define('ru-RU', 'FormValidator', {
  14965. required: 'Это поле обязательно к заполнению.',
  14966. minLength: 'Пожалуйста, введите хотя бы {minLength} символов (Вы ввели {length}).',
  14967. maxLength: 'Пожалуйста, введите не больше {maxLength} символов (Вы ввели {length}).',
  14968. integer: 'Пожалуйста, введите в это поле число. Дробные числа (например 1.25) тут не разрешены.',
  14969. numeric: 'Пожалуйста, введите в это поле число (например "1" или "1.1", или "-1", или "-1.1").',
  14970. digits: 'В этом поле Вы можете использовать только цифры и знаки пунктуации (например, телефонный номер со знаками дефиса или с точками).',
  14971. alpha: 'В этом поле можно использовать только латинские буквы (a-z). Пробелы и другие символы запрещены.',
  14972. alphanum: 'В этом поле можно использовать только латинские буквы (a-z) и цифры (0-9). Пробелы и другие символы запрещены.',
  14973. dateSuchAs: 'Пожалуйста, введите корректную дату {date}',
  14974. dateInFormatMDY: 'Пожалуйста, введите дату в формате ММ/ДД/ГГГГ (например "12/31/1999")',
  14975. email: 'Пожалуйста, введите корректный емейл-адрес. Для примера "fred@domain.com".',
  14976. url: 'Пожалуйста, введите правильную ссылку вида http://www.example.com.',
  14977. currencyDollar: 'Пожалуйста, введите сумму в долларах. Например: $100.00 .',
  14978. oneRequired: 'Пожалуйста, выберите хоть что-нибудь в одном из этих полей.',
  14979. errorPrefix: 'Ошибка: ',
  14980. warningPrefix: 'Внимание: '
  14981. });
  14982. //<1.2compat>
  14983. Locale.define('ru-RU-unicode').inherit('ru-RU', 'FormValidator');
  14984. //</1.2compat>
  14985. /*
  14986. ---
  14987. name: Locale.sk-SK.Date
  14988. description: Date messages for Slovak.
  14989. license: MIT-style license
  14990. authors:
  14991. - Ivan Masár
  14992. requires:
  14993. - Locale
  14994. provides: [Locale.sk-SK.Date]
  14995. ...
  14996. */
  14997. (function(){
  14998. // Slovak language pluralization rules, see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  14999. // one -> n is 1; 1
  15000. // few -> n in 2..4; 2-4
  15001. // other -> everything else 0, 5-999, 1.31, 2.31, 5.31...
  15002. var pluralize = function(n, one, few, other){
  15003. if (n == 1) return one;
  15004. else if (n == 2 || n == 3 || n == 4) return few;
  15005. else return other;
  15006. };
  15007. Locale.define('sk-SK', 'Date', {
  15008. months: ['Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'December'],
  15009. months_abbr: ['januára', 'februára', 'marca', 'apríla', 'mája', 'júna', 'júla', 'augusta', 'septembra', 'októbra', 'novembra', 'decembra'],
  15010. days: ['Nedele', 'Pondelí', 'Úterý', 'Streda', 'Čtvrtek', 'Pátek', 'Sobota'],
  15011. days_abbr: ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so'],
  15012. // Culture's date order: DD.MM.YYYY
  15013. dateOrder: ['date', 'month', 'year'],
  15014. shortDate: '%d.%m.%Y',
  15015. shortTime: '%H:%M',
  15016. AM: 'dop.',
  15017. PM: 'pop.',
  15018. firstDayOfWeek: 1,
  15019. // Date.Extras
  15020. ordinal: '.',
  15021. lessThanMinuteAgo: 'pred chvíľou',
  15022. minuteAgo: 'približne pred minútou',
  15023. minutesAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'minútou', 'minútami', 'minútami'); },
  15024. hourAgo: 'približne pred hodinou',
  15025. hoursAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'hodinou', 'hodinami', 'hodinami'); },
  15026. dayAgo: 'pred dňom',
  15027. daysAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'dňom', 'dňami', 'dňami'); },
  15028. weekAgo: 'pred týždňom',
  15029. weeksAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'týždňom', 'týždňami', 'týždňami'); },
  15030. monthAgo: 'pred mesiacom',
  15031. monthsAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'mesiacom', 'mesiacmi', 'mesiacmi'); },
  15032. yearAgo: 'pred rokom',
  15033. yearsAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'rokom', 'rokmi', 'rokmi'); },
  15034. lessThanMinuteUntil: 'o chvíľu',
  15035. minuteUntil: 'približne o minútu',
  15036. minutesUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'minútu', 'minúty', 'minúty'); },
  15037. hourUntil: 'približne o hodinu',
  15038. hoursUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'hodinu', 'hodiny', 'hodín'); },
  15039. dayUntil: 'o deň',
  15040. daysUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'deň', 'dni', 'dní'); },
  15041. weekUntil: 'o týždeň',
  15042. weeksUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'týždeň', 'týždne', 'týždňov'); },
  15043. monthUntil: 'o mesiac',
  15044. monthsUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'mesiac', 'mesiace', 'mesiacov'); },
  15045. yearUntil: 'o rok',
  15046. yearsUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'rok', 'roky', 'rokov'); }
  15047. });
  15048. })();
  15049. /*
  15050. ---
  15051. name: Locale.sk-SK.Form.Validator
  15052. description: Form Validator messages for Czech.
  15053. license: MIT-style license
  15054. authors:
  15055. - Ivan Masár
  15056. requires:
  15057. - Locale
  15058. provides: [Locale.sk-SK.Form.Validator]
  15059. ...
  15060. */
  15061. Locale.define('sk-SK', 'FormValidator', {
  15062. required: 'Táto položka je povinná.',
  15063. minLength: 'Zadajte prosím aspoň {minLength} znakov (momentálne {length} znakov).',
  15064. maxLength: 'Zadajte prosím menej ako {maxLength} znakov (momentálne {length} znakov).',
  15065. integer: 'Zadajte prosím celé číslo. Desetinné čísla (napr. 1.25) nie sú povolené.',
  15066. numeric: 'Zadajte len číselné hodnoty (t.j. „1“ alebo „1.1“ alebo „-1“ alebo „-1.1“).',
  15067. digits: 'Zadajte prosím len čísla a interpunkčné znamienka (napríklad telefónne číslo s pomlčkami albo bodkami je povolené).',
  15068. alpha: 'Zadajte prosím len písmená (a-z). Medzery alebo iné znaky nie sú povolené.',
  15069. alphanum: 'Zadajte prosím len písmená (a-z) alebo číslice (0-9). Medzery alebo iné znaky nie sú povolené.',
  15070. dateSuchAs: 'Zadajte prosím platný dátum v tvare {date}',
  15071. dateInFormatMDY: 'Zadajte prosím platný datum v tvare MM / DD / RRRR (t.j. „12/31/1999“)',
  15072. email: 'Zadajte prosím platnú emailovú adresu. Napríklad „fred@domain.com“.',
  15073. url: 'Zadajte prosím platnoú adresu URL v tvare http://www.example.com.',
  15074. currencyDollar: 'Zadajte prosím platnú čiastku. Napríklad $100.00.',
  15075. oneRequired: 'Zadajte prosím aspoň jednu hodnotu z týchto položiek.',
  15076. errorPrefix: 'Chyba: ',
  15077. warningPrefix: 'Upozornenie: ',
  15078. // Form.Validator.Extras
  15079. noSpace: 'V tejto položle nie sú povolené medzery',
  15080. reqChkByNode: 'Nie sú vybrané žiadne položky.',
  15081. requiredChk: 'Táto položka je povinná.',
  15082. reqChkByName: 'Prosím vyberte {label}.',
  15083. match: 'Táto položka sa musí zhodovať s položkou {matchName}',
  15084. startDate: 'dátum začiatku',
  15085. endDate: 'dátum ukončenia',
  15086. currendDate: 'aktuálny dátum',
  15087. afterDate: 'Dátum by mal býť rovnaký alebo väčší ako {label}.',
  15088. beforeDate: 'Dátum by mal byť rovnaký alebo menší ako {label}.',
  15089. startMonth: 'Vyberte počiatočný mesiac.',
  15090. sameMonth: 'Tieto dva dátumy musia býť v rovnakom mesiaci - zmeňte jeden z nich.',
  15091. creditcard: 'Zadané číslo kreditnej karty je neplatné. Prosím, opravte ho. Bolo zadaných {length} číslic.'
  15092. });
  15093. /*
  15094. ---
  15095. name: Locale.si-SI.Date
  15096. description: Date messages for Slovenian.
  15097. license: MIT-style license
  15098. authors:
  15099. - Radovan Lozej
  15100. requires:
  15101. - Locale
  15102. provides: [Locale.si-SI.Date]
  15103. ...
  15104. */
  15105. (function(){
  15106. var pluralize = function(n, one, two, three, other){
  15107. return (n >= 1 && n <= 3) ? arguments[n] : other;
  15108. };
  15109. Locale.define('sl-SI', 'Date', {
  15110. months: ['januar', 'februar', 'marec', 'april', 'maj', 'junij', 'julij', 'avgust', 'september', 'oktober', 'november', 'december'],
  15111. months_abbr: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'avg', 'sep', 'okt', 'nov', 'dec'],
  15112. days: ['nedelja', 'ponedeljek', 'torek', 'sreda', 'četrtek', 'petek', 'sobota'],
  15113. days_abbr: ['ned', 'pon', 'tor', 'sre', 'čet', 'pet', 'sob'],
  15114. // Culture's date order: DD.MM.YYYY
  15115. dateOrder: ['date', 'month', 'year'],
  15116. shortDate: '%d.%m.%Y',
  15117. shortTime: '%H.%M',
  15118. AM: 'AM',
  15119. PM: 'PM',
  15120. firstDayOfWeek: 1,
  15121. // Date.Extras
  15122. ordinal: '.',
  15123. lessThanMinuteAgo: 'manj kot minuto nazaj',
  15124. minuteAgo: 'minuto nazaj',
  15125. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'minuto', 'minuti', 'minute', 'minut') + ' nazaj'; },
  15126. hourAgo: 'uro nazaj',
  15127. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'uro', 'uri', 'ure', 'ur') + ' nazaj'; },
  15128. dayAgo: 'dan nazaj',
  15129. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'dan', 'dneva', 'dni', 'dni') + ' nazaj'; },
  15130. weekAgo: 'teden nazaj',
  15131. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'teden', 'tedna', 'tedne', 'tednov') + ' nazaj'; },
  15132. monthAgo: 'mesec nazaj',
  15133. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'mesec', 'meseca', 'mesece', 'mesecov') + ' nazaj'; },
  15134. yearthAgo: 'leto nazaj',
  15135. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'leto', 'leti', 'leta', 'let') + ' nazaj'; },
  15136. lessThanMinuteUntil: 'še manj kot minuto',
  15137. minuteUntil: 'še minuta',
  15138. minutesUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'minuta', 'minuti', 'minute', 'minut'); },
  15139. hourUntil: 'še ura',
  15140. hoursUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'ura', 'uri', 'ure', 'ur'); },
  15141. dayUntil: 'še dan',
  15142. daysUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'dan', 'dneva', 'dnevi', 'dni'); },
  15143. weekUntil: 'še tedn',
  15144. weeksUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'teden', 'tedna', 'tedni', 'tednov'); },
  15145. monthUntil: 'še mesec',
  15146. monthsUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'mesec', 'meseca', 'meseci', 'mesecov'); },
  15147. yearUntil: 'še leto',
  15148. yearsUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'leto', 'leti', 'leta', 'let'); }
  15149. });
  15150. })();
  15151. /*
  15152. ---
  15153. name: Locale.si-SI.Form.Validator
  15154. description: Form Validator messages for Slovenian.
  15155. license: MIT-style license
  15156. authors:
  15157. - Radovan Lozej
  15158. requires:
  15159. - Locale
  15160. provides: [Locale.si-SI.Form.Validator]
  15161. ...
  15162. */
  15163. Locale.define('sl-SI', 'FormValidator', {
  15164. required: 'To polje je obvezno',
  15165. minLength: 'Prosim, vnesite vsaj {minLength} znakov (vnesli ste {length} znakov).',
  15166. maxLength: 'Prosim, ne vnesite več kot {maxLength} znakov (vnesli ste {length} znakov).',
  15167. integer: 'Prosim, vnesite celo število. Decimalna števila (kot 1,25) niso dovoljena.',
  15168. numeric: 'Prosim, vnesite samo numerične vrednosti (kot "1" ali "1.1" ali "-1" ali "-1.1").',
  15169. digits: 'Prosim, uporabite številke in ločila le na tem polju (na primer, dovoljena je telefonska številka z pomišlaji ali pikami).',
  15170. alpha: 'Prosim, uporabite le črke v tem plju. Presledki in drugi znaki niso dovoljeni.',
  15171. alphanum: 'Prosim, uporabite samo črke ali številke v tem polju. Presledki in drugi znaki niso dovoljeni.',
  15172. dateSuchAs: 'Prosim, vnesite pravilen datum kot {date}',
  15173. dateInFormatMDY: 'Prosim, vnesite pravilen datum kot MM.DD.YYYY (primer "12.31.1999")',
  15174. email: 'Prosim, vnesite pravilen email naslov. Na primer "fred@domain.com".',
  15175. url: 'Prosim, vnesite pravilen URL kot http://www.example.com.',
  15176. currencyDollar: 'Prosim, vnesit epravilno vrednost €. Primer 100,00€ .',
  15177. oneRequired: 'Prosimo, vnesite nekaj za vsaj eno izmed teh polj.',
  15178. errorPrefix: 'Napaka: ',
  15179. warningPrefix: 'Opozorilo: ',
  15180. // Form.Validator.Extras
  15181. noSpace: 'To vnosno polje ne dopušča presledkov.',
  15182. reqChkByNode: 'Nič niste izbrali.',
  15183. requiredChk: 'To polje je obvezno',
  15184. reqChkByName: 'Prosim, izberite {label}.',
  15185. match: 'To polje se mora ujemati z poljem {matchName}',
  15186. startDate: 'datum začetka',
  15187. endDate: 'datum konca',
  15188. currentDate: 'trenuten datum',
  15189. afterDate: 'Datum bi moral biti isti ali po {label}.',
  15190. beforeDate: 'Datum bi moral biti isti ali pred {label}.',
  15191. startMonth: 'Prosim, vnesite začetni datum',
  15192. sameMonth: 'Ta dva datuma morata biti v istem mesecu - premeniti morate eno ali drugo.',
  15193. creditcard: 'Številka kreditne kartice ni pravilna. Preverite številko ali poskusite še enkrat. Vnešenih {length} znakov.'
  15194. });
  15195. /*
  15196. ---
  15197. name: Locale.sv-SE.Date
  15198. description: Date messages for Swedish.
  15199. license: MIT-style license
  15200. authors:
  15201. - Martin Lundgren
  15202. requires:
  15203. - Locale
  15204. provides: [Locale.sv-SE.Date]
  15205. ...
  15206. */
  15207. Locale.define('sv-SE', 'Date', {
  15208. months: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'],
  15209. months_abbr: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
  15210. days: ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'],
  15211. days_abbr: ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör'],
  15212. // Culture's date order: YYYY-MM-DD
  15213. dateOrder: ['year', 'month', 'date'],
  15214. shortDate: '%Y-%m-%d',
  15215. shortTime: '%H:%M',
  15216. AM: '',
  15217. PM: '',
  15218. firstDayOfWeek: 1,
  15219. // Date.Extras
  15220. ordinal: '',
  15221. lessThanMinuteAgo: 'mindre än en minut sedan',
  15222. minuteAgo: 'ungefär en minut sedan',
  15223. minutesAgo: '{delta} minuter sedan',
  15224. hourAgo: 'ungefär en timme sedan',
  15225. hoursAgo: 'ungefär {delta} timmar sedan',
  15226. dayAgo: '1 dag sedan',
  15227. daysAgo: '{delta} dagar sedan',
  15228. lessThanMinuteUntil: 'mindre än en minut sedan',
  15229. minuteUntil: 'ungefär en minut sedan',
  15230. minutesUntil: '{delta} minuter sedan',
  15231. hourUntil: 'ungefär en timme sedan',
  15232. hoursUntil: 'ungefär {delta} timmar sedan',
  15233. dayUntil: '1 dag sedan',
  15234. daysUntil: '{delta} dagar sedan'
  15235. });
  15236. /*
  15237. ---
  15238. name: Locale.sv-SE.Form.Validator
  15239. description: Form Validator messages for Swedish.
  15240. license: MIT-style license
  15241. authors:
  15242. - Martin Lundgren
  15243. requires:
  15244. - Locale
  15245. provides: [Locale.sv-SE.Form.Validator]
  15246. ...
  15247. */
  15248. Locale.define('sv-SE', 'FormValidator', {
  15249. required: 'Fältet är obligatoriskt.',
  15250. minLength: 'Ange minst {minLength} tecken (du angav {length} tecken).',
  15251. maxLength: 'Ange högst {maxLength} tecken (du angav {length} tecken). ',
  15252. integer: 'Ange ett heltal i fältet. Tal med decimaler (t.ex. 1,25) är inte tillåtna.',
  15253. numeric: 'Ange endast numeriska värden i detta fält (t.ex. "1" eller "1.1" eller "-1" eller "-1,1").',
  15254. digits: 'Använd endast siffror och skiljetecken i detta fält (till exempel ett telefonnummer med bindestreck tillåtet).',
  15255. alpha: 'Använd endast bokstäver (a-ö) i detta fält. Inga mellanslag eller andra tecken är tillåtna.',
  15256. alphanum: 'Använd endast bokstäver (a-ö) och siffror (0-9) i detta fält. Inga mellanslag eller andra tecken är tillåtna.',
  15257. dateSuchAs: 'Ange ett giltigt datum som t.ex. {date}',
  15258. dateInFormatMDY: 'Ange ett giltigt datum som t.ex. YYYY-MM-DD (i.e. "1999-12-31")',
  15259. email: 'Ange en giltig e-postadress. Till exempel "erik@domain.com".',
  15260. url: 'Ange en giltig webbadress som http://www.example.com.',
  15261. currencyDollar: 'Ange en giltig belopp. Exempelvis 100,00.',
  15262. oneRequired: 'Vänligen ange minst ett av dessa alternativ.',
  15263. errorPrefix: 'Fel: ',
  15264. warningPrefix: 'Varning: ',
  15265. // Form.Validator.Extras
  15266. noSpace: 'Det får inte finnas några mellanslag i detta fält.',
  15267. reqChkByNode: 'Inga objekt är valda.',
  15268. requiredChk: 'Detta är ett obligatoriskt fält.',
  15269. reqChkByName: 'Välj en {label}.',
  15270. match: 'Detta fält måste matcha {matchName}',
  15271. startDate: 'startdatumet',
  15272. endDate: 'slutdatum',
  15273. currentDate: 'dagens datum',
  15274. afterDate: 'Datumet bör vara samma eller senare än {label}.',
  15275. beforeDate: 'Datumet bör vara samma eller tidigare än {label}.',
  15276. startMonth: 'Välj en start månad',
  15277. sameMonth: 'Dessa två datum måste vara i samma månad - du måste ändra det ena eller det andra.'
  15278. });
  15279. /*
  15280. ---
  15281. name: Locale.sv-SE.Number
  15282. description: Number messages for Swedish.
  15283. license: MIT-style license
  15284. authors:
  15285. - Arian Stolwijk
  15286. - Martin Lundgren
  15287. requires:
  15288. - Locale
  15289. - Locale.EU.Number
  15290. provides: [Locale.sv-SE.Number]
  15291. ...
  15292. */
  15293. Locale.define('sv-SE', 'Number', {
  15294. currency: {
  15295. prefix: 'SEK '
  15296. }
  15297. }).inherit('EU', 'Number');
  15298. /*
  15299. ---
  15300. name: Locale.tr-TR.Date
  15301. description: Date messages for Turkish.
  15302. license: MIT-style license
  15303. authors:
  15304. - Faruk Can Bilir
  15305. requires:
  15306. - Locale
  15307. provides: [Locale.tr-TR.Date]
  15308. ...
  15309. */
  15310. Locale.define('tr-TR', 'Date', {
  15311. months: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
  15312. months_abbr: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
  15313. days: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],
  15314. days_abbr: ['Pa', 'Pzt', 'Sa', 'Ça', 'Pe', 'Cu', 'Cmt'],
  15315. // Culture's date order: MM/DD/YYYY
  15316. dateOrder: ['date', 'month', 'year'],
  15317. shortDate: '%d/%m/%Y',
  15318. shortTime: '%H.%M',
  15319. AM: 'AM',
  15320. PM: 'PM',
  15321. firstDayOfWeek: 1,
  15322. // Date.Extras
  15323. ordinal: '',
  15324. lessThanMinuteAgo: 'bir dakikadan önce',
  15325. minuteAgo: 'yaklaşık bir dakika önce',
  15326. minutesAgo: '{delta} dakika önce',
  15327. hourAgo: 'bir saat kadar önce',
  15328. hoursAgo: '{delta} saat kadar önce',
  15329. dayAgo: 'bir gün önce',
  15330. daysAgo: '{delta} gün önce',
  15331. weekAgo: 'bir hafta önce',
  15332. weeksAgo: '{delta} hafta önce',
  15333. monthAgo: 'bir ay önce',
  15334. monthsAgo: '{delta} ay önce',
  15335. yearAgo: 'bir yıl önce',
  15336. yearsAgo: '{delta} yıl önce',
  15337. lessThanMinuteUntil: 'bir dakikadan az sonra',
  15338. minuteUntil: 'bir dakika kadar sonra',
  15339. minutesUntil: '{delta} dakika sonra',
  15340. hourUntil: 'bir saat kadar sonra',
  15341. hoursUntil: '{delta} saat kadar sonra',
  15342. dayUntil: 'bir gün sonra',
  15343. daysUntil: '{delta} gün sonra',
  15344. weekUntil: 'bir hafta sonra',
  15345. weeksUntil: '{delta} hafta sonra',
  15346. monthUntil: 'bir ay sonra',
  15347. monthsUntil: '{delta} ay sonra',
  15348. yearUntil: 'bir yıl sonra',
  15349. yearsUntil: '{delta} yıl sonra'
  15350. });
  15351. /*
  15352. ---
  15353. name: Locale.tr-TR.Form.Validator
  15354. description: Form Validator messages for Turkish.
  15355. license: MIT-style license
  15356. authors:
  15357. - Faruk Can Bilir
  15358. requires:
  15359. - Locale
  15360. provides: [Locale.tr-TR.Form.Validator]
  15361. ...
  15362. */
  15363. Locale.define('tr-TR', 'FormValidator', {
  15364. required: 'Bu alan zorunlu.',
  15365. minLength: 'Lütfen en az {minLength} karakter girin (siz {length} karakter girdiniz).',
  15366. maxLength: 'Lütfen en fazla {maxLength} karakter girin (siz {length} karakter girdiniz).',
  15367. integer: 'Lütfen bu alana sadece tamsayı girin. Ondalıklı sayılar (ör: 1.25) kullanılamaz.',
  15368. numeric: 'Lütfen bu alana sadece sayısal değer girin (ör: "1", "1.1", "-1" ya da "-1.1").',
  15369. 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).',
  15370. alpha: 'Lütfen bu alanda yalnızca harf kullanın. Boşluk ve diğer karakterler kullanılamaz.',
  15371. alphanum: 'Lütfen bu alanda sadece harf ve rakam kullanın. Boşluk ve diğer karakterler kullanılamaz.',
  15372. dateSuchAs: 'Lütfen geçerli bir tarih girin (Ör: {date})',
  15373. dateInFormatMDY: 'Lütfen geçerli bir tarih girin (GG/AA/YYYY, ör: "31/12/1999")',
  15374. email: 'Lütfen geçerli bir email adresi girin. Ör: "kemal@etikan.com".',
  15375. url: 'Lütfen geçerli bir URL girin. Ör: http://www.example.com.',
  15376. currencyDollar: 'Lütfen geçerli bir TL miktarı girin. Ör: 100,00 TL .',
  15377. oneRequired: 'Lütfen en az bir tanesini doldurun.',
  15378. errorPrefix: 'Hata: ',
  15379. warningPrefix: 'Uyarı: ',
  15380. // Form.Validator.Extras
  15381. noSpace: 'Bu alanda boşluk kullanılamaz.',
  15382. reqChkByNode: 'Hiçbir öğe seçilmemiş.',
  15383. requiredChk: 'Bu alan zorunlu.',
  15384. reqChkByName: 'Lütfen bir {label} girin.',
  15385. match: 'Bu alan, {matchName} alanıyla uyuşmalı',
  15386. startDate: 'başlangıç tarihi',
  15387. endDate: 'bitiş tarihi',
  15388. currentDate: 'bugünün tarihi',
  15389. afterDate: 'Tarih, {label} tarihiyle aynı gün ya da ondan sonra olmalıdır.',
  15390. beforeDate: 'Tarih, {label} tarihiyle aynı gün ya da ondan önce olmalıdır.',
  15391. startMonth: 'Lütfen bir başlangıç ayı seçin',
  15392. sameMonth: 'Bu iki tarih aynı ayda olmalı - bir tanesini değiştirmeniz gerekiyor.',
  15393. creditcard: 'Girdiğiniz kredi kartı numarası geçersiz. Lütfen kontrol edip tekrar deneyin. {length} hane girildi.'
  15394. });
  15395. /*
  15396. ---
  15397. name: Locale.tr-TR.Number
  15398. description: Number messages for Turkish.
  15399. license: MIT-style license
  15400. authors:
  15401. - Faruk Can Bilir
  15402. requires:
  15403. - Locale
  15404. - Locale.EU.Number
  15405. provides: [Locale.tr-TR.Number]
  15406. ...
  15407. */
  15408. Locale.define('tr-TR', 'Number', {
  15409. currency: {
  15410. decimals: 0,
  15411. suffix: ' TL'
  15412. }
  15413. }).inherit('EU', 'Number');
  15414. /*
  15415. ---
  15416. name: Locale.uk-UA.Date
  15417. description: Date messages for Ukrainian (utf-8).
  15418. license: MIT-style license
  15419. authors:
  15420. - Slik
  15421. requires:
  15422. - Locale
  15423. provides: [Locale.uk-UA.Date]
  15424. ...
  15425. */
  15426. (function(){
  15427. var pluralize = function(n, one, few, many, other){
  15428. var d = (n / 10).toInt(),
  15429. z = n % 10,
  15430. s = (n / 100).toInt();
  15431. if (d == 1 && n > 10) return many;
  15432. if (z == 1) return one;
  15433. if (z > 0 && z < 5) return few;
  15434. return many;
  15435. };
  15436. Locale.define('uk-UA', 'Date', {
  15437. months: ['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'],
  15438. months_abbr: ['Січ', 'Лют', 'Бер', 'Квіт', 'Трав', 'Черв', 'Лип', 'Серп', 'Вер', 'Жовт', 'Лист', 'Груд' ],
  15439. days: ['Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', "П'ятниця", 'Субота'],
  15440. days_abbr: ['Нд', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
  15441. // Culture's date order: DD/MM/YYYY
  15442. dateOrder: ['date', 'month', 'year'],
  15443. shortDate: '%d/%m/%Y',
  15444. shortTime: '%H:%M',
  15445. AM: 'до полудня',
  15446. PM: 'по полудню',
  15447. firstDayOfWeek: 1,
  15448. // Date.Extras
  15449. ordinal: '',
  15450. lessThanMinuteAgo: 'меньше хвилини тому',
  15451. minuteAgo: 'хвилину тому',
  15452. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'хвилину', 'хвилини', 'хвилин') + ' тому'; },
  15453. hourAgo: 'годину тому',
  15454. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'годину', 'години', 'годин') + ' тому'; },
  15455. dayAgo: 'вчора',
  15456. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'день', 'дня', 'днів') + ' тому'; },
  15457. weekAgo: 'тиждень тому',
  15458. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'тиждень', 'тижні', 'тижнів') + ' тому'; },
  15459. monthAgo: 'місяць тому',
  15460. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'місяць', 'місяці', 'місяців') + ' тому'; },
  15461. yearAgo: 'рік тому',
  15462. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'рік', 'роки', 'років') + ' тому'; },
  15463. lessThanMinuteUntil: 'за мить',
  15464. minuteUntil: 'через хвилину',
  15465. minutesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'хвилину', 'хвилини', 'хвилин'); },
  15466. hourUntil: 'через годину',
  15467. hoursUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'годину', 'години', 'годин'); },
  15468. dayUntil: 'завтра',
  15469. daysUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'день', 'дня', 'днів'); },
  15470. weekUntil: 'через тиждень',
  15471. weeksUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'тиждень', 'тижні', 'тижнів'); },
  15472. monthUntil: 'через місяць',
  15473. monthesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'місяць', 'місяці', 'місяців'); },
  15474. yearUntil: 'через рік',
  15475. yearsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'рік', 'роки', 'років'); }
  15476. });
  15477. })();
  15478. /*
  15479. ---
  15480. name: Locale.uk-UA.Form.Validator
  15481. description: Form Validator messages for Ukrainian (utf-8).
  15482. license: MIT-style license
  15483. authors:
  15484. - Slik
  15485. requires:
  15486. - Locale
  15487. provides: [Locale.uk-UA.Form.Validator]
  15488. ...
  15489. */
  15490. Locale.define('uk-UA', 'FormValidator', {
  15491. required: 'Це поле повинне бути заповненим.',
  15492. minLength: 'Введіть хоча б {minLength} символів (Ви ввели {length}).',
  15493. maxLength: 'Кількість символів не може бути більше {maxLength} (Ви ввели {length}).',
  15494. integer: 'Введіть в це поле число. Дробові числа (наприклад 1.25) не дозволені.',
  15495. numeric: 'Введіть в це поле число (наприклад "1" або "1.1", або "-1", або "-1.1").',
  15496. digits: 'В цьому полі ви можете використовувати лише цифри і знаки пунктіації (наприклад, телефонний номер з знаками дефізу або з крапками).',
  15497. alpha: 'В цьому полі можна використовувати лише латинські літери (a-z). Пробіли і інші символи заборонені.',
  15498. alphanum: 'В цьому полі можна використовувати лише латинські літери (a-z) і цифри (0-9). Пробіли і інші символи заборонені.',
  15499. dateSuchAs: 'Введіть коректну дату {date}.',
  15500. dateInFormatMDY: 'Введіть дату в форматі ММ/ДД/РРРР (наприклад "12/31/2009").',
  15501. email: 'Введіть коректну адресу електронної пошти (наприклад "name@domain.com").',
  15502. url: 'Введіть коректне інтернет-посилання (наприклад http://www.example.com).',
  15503. currencyDollar: 'Введіть суму в доларах (наприклад "$100.00").',
  15504. oneRequired: 'Заповніть одне з полів.',
  15505. errorPrefix: 'Помилка: ',
  15506. warningPrefix: 'Увага: ',
  15507. noSpace: 'Пробіли заборонені.',
  15508. reqChkByNode: 'Не відмічено жодного варіанту.',
  15509. requiredChk: 'Це поле повинне бути віміченим.',
  15510. reqChkByName: 'Будь ласка, відмітьте {label}.',
  15511. match: 'Це поле повинно відповідати {matchName}',
  15512. startDate: 'початкова дата',
  15513. endDate: 'кінцева дата',
  15514. currentDate: 'сьогоднішня дата',
  15515. afterDate: 'Ця дата повинна бути такою ж, або пізнішою за {label}.',
  15516. beforeDate: 'Ця дата повинна бути такою ж, або ранішою за {label}.',
  15517. startMonth: 'Будь ласка, виберіть початковий місяць',
  15518. sameMonth: 'Ці дати повинні відноситись одного і того ж місяця. Будь ласка, змініть одну з них.',
  15519. creditcard: 'Номер кредитної карти введений неправильно. Будь ласка, перевірте його. Введено {length} символів.'
  15520. });
  15521. /*
  15522. ---
  15523. name: Locale.zh-CH.Date
  15524. description: Date messages for Chinese (simplified and traditional).
  15525. license: MIT-style license
  15526. authors:
  15527. - YMind Chan
  15528. requires:
  15529. - Locale
  15530. provides: [Locale.zh-CH.Date]
  15531. ...
  15532. */
  15533. // Simplified Chinese
  15534. Locale.define('zh-CHS', 'Date', {
  15535. months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  15536. months_abbr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  15537. days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  15538. days_abbr: ['日', '一', '二', '三', '四', '五', '六'],
  15539. // Culture's date order: YYYY-MM-DD
  15540. dateOrder: ['year', 'month', 'date'],
  15541. shortDate: '%Y-%m-%d',
  15542. shortTime: '%I:%M%p',
  15543. AM: 'AM',
  15544. PM: 'PM',
  15545. firstDayOfWeek: 1,
  15546. // Date.Extras
  15547. ordinal: '',
  15548. lessThanMinuteAgo: '不到1分钟前',
  15549. minuteAgo: '大约1分钟前',
  15550. minutesAgo: '{delta}分钟之前',
  15551. hourAgo: '大约1小时前',
  15552. hoursAgo: '大约{delta}小时前',
  15553. dayAgo: '1天前',
  15554. daysAgo: '{delta}天前',
  15555. weekAgo: '1星期前',
  15556. weeksAgo: '{delta}星期前',
  15557. monthAgo: '1个月前',
  15558. monthsAgo: '{delta}个月前',
  15559. yearAgo: '1年前',
  15560. yearsAgo: '{delta}年前',
  15561. lessThanMinuteUntil: '从现在开始不到1分钟',
  15562. minuteUntil: '从现在开始約1分钟',
  15563. minutesUntil: '从现在开始约{delta}分钟',
  15564. hourUntil: '从现在开始1小时',
  15565. hoursUntil: '从现在开始约{delta}小时',
  15566. dayUntil: '从现在开始1天',
  15567. daysUntil: '从现在开始{delta}天',
  15568. weekUntil: '从现在开始1星期',
  15569. weeksUntil: '从现在开始{delta}星期',
  15570. monthUntil: '从现在开始一个月',
  15571. monthsUntil: '从现在开始{delta}个月',
  15572. yearUntil: '从现在开始1年',
  15573. yearsUntil: '从现在开始{delta}年'
  15574. });
  15575. // Traditional Chinese
  15576. Locale.define('zh-CHT', 'Date', {
  15577. months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  15578. months_abbr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  15579. days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  15580. days_abbr: ['日', '一', '二', '三', '四', '五', '六'],
  15581. // Culture's date order: YYYY-MM-DD
  15582. dateOrder: ['year', 'month', 'date'],
  15583. shortDate: '%Y-%m-%d',
  15584. shortTime: '%I:%M%p',
  15585. AM: 'AM',
  15586. PM: 'PM',
  15587. firstDayOfWeek: 1,
  15588. // Date.Extras
  15589. ordinal: '',
  15590. lessThanMinuteAgo: '不到1分鐘前',
  15591. minuteAgo: '大約1分鐘前',
  15592. minutesAgo: '{delta}分鐘之前',
  15593. hourAgo: '大約1小時前',
  15594. hoursAgo: '大約{delta}小時前',
  15595. dayAgo: '1天前',
  15596. daysAgo: '{delta}天前',
  15597. weekAgo: '1星期前',
  15598. weeksAgo: '{delta}星期前',
  15599. monthAgo: '1个月前',
  15600. monthsAgo: '{delta}个月前',
  15601. yearAgo: '1年前',
  15602. yearsAgo: '{delta}年前',
  15603. lessThanMinuteUntil: '從現在開始不到1分鐘',
  15604. minuteUntil: '從現在開始約1分鐘',
  15605. minutesUntil: '從現在開始約{delta}分鐘',
  15606. hourUntil: '從現在開始1小時',
  15607. hoursUntil: '從現在開始約{delta}小時',
  15608. dayUntil: '從現在開始1天',
  15609. daysUntil: '從現在開始{delta}天',
  15610. weekUntil: '從現在開始1星期',
  15611. weeksUntil: '從現在開始{delta}星期',
  15612. monthUntil: '從現在開始一個月',
  15613. monthsUntil: '從現在開始{delta}個月',
  15614. yearUntil: '從現在開始1年',
  15615. yearsUntil: '從現在開始{delta}年'
  15616. });
  15617. /*
  15618. ---
  15619. name: Locale.zh-CH.Form.Validator
  15620. description: Form Validator messages for Chinese (simplified and traditional).
  15621. license: MIT-style license
  15622. authors:
  15623. - YMind Chan
  15624. requires:
  15625. - Locale
  15626. - Form.Validator
  15627. provides: [Form.zh-CH.Form.Validator, Form.Validator.CurrencyYuanValidator]
  15628. ...
  15629. */
  15630. // Simplified Chinese
  15631. Locale.define('zh-CHS', 'FormValidator', {
  15632. required: '此项必填。',
  15633. minLength: '请至少输入 {minLength} 个字符 (已输入 {length} 个)。',
  15634. maxLength: '最多只能输入 {maxLength} 个字符 (已输入 {length} 个)。',
  15635. integer: '请输入一个整数,不能包含小数点。例如:"1", "200"。',
  15636. numeric: '请输入一个数字,例如:"1", "1.1", "-1", "-1.1"。',
  15637. digits: '请输入由数字和标点符号组成的内容。例如电话号码。',
  15638. alpha: '请输入 A-Z 的 26 个字母,不能包含空格或任何其他字符。',
  15639. alphanum: '请输入 A-Z 的 26 个字母或 0-9 的 10 个数字,不能包含空格或任何其他字符。',
  15640. dateSuchAs: '请输入合法的日期格式,如:{date}。',
  15641. dateInFormatMDY: '请输入合法的日期格式,例如:YYYY-MM-DD ("2010-12-31")。',
  15642. email: '请输入合法的电子信箱地址,例如:"fred@domain.com"。',
  15643. url: '请输入合法的 Url 地址,例如:http://www.example.com。',
  15644. currencyDollar: '请输入合法的货币符号,例如:¥100.0',
  15645. oneRequired: '请至少选择一项。',
  15646. errorPrefix: '错误:',
  15647. warningPrefix: '警告:',
  15648. // Form.Validator.Extras
  15649. noSpace: '不能包含空格。',
  15650. reqChkByNode: '未选择任何内容。',
  15651. requiredChk: '此项必填。',
  15652. reqChkByName: '请选择 {label}.',
  15653. match: '必须与{matchName}相匹配',
  15654. startDate: '起始日期',
  15655. endDate: '结束日期',
  15656. currentDate: '当前日期',
  15657. afterDate: '日期必须等于或晚于 {label}.',
  15658. beforeDate: '日期必须早于或等于 {label}.',
  15659. startMonth: '请选择起始月份',
  15660. sameMonth: '您必须修改两个日期中的一个,以确保它们在同一月份。',
  15661. creditcard: '您输入的信用卡号码不正确。当前已输入{length}个字符。'
  15662. });
  15663. // Traditional Chinese
  15664. Locale.define('zh-CHT', 'FormValidator', {
  15665. required: '此項必填。 ',
  15666. minLength: '請至少輸入{minLength} 個字符(已輸入{length} 個)。 ',
  15667. maxLength: '最多只能輸入{maxLength} 個字符(已輸入{length} 個)。 ',
  15668. integer: '請輸入一個整數,不能包含小數點。例如:"1", "200"。 ',
  15669. numeric: '請輸入一個數字,例如:"1", "1.1", "-1", "-1.1"。 ',
  15670. digits: '請輸入由數字和標點符號組成的內容。例如電話號碼。 ',
  15671. alpha: '請輸入AZ 的26 個字母,不能包含空格或任何其他字符。 ',
  15672. alphanum: '請輸入AZ 的26 個字母或0-9 的10 個數字,不能包含空格或任何其他字符。 ',
  15673. dateSuchAs: '請輸入合法的日期格式,如:{date}。 ',
  15674. dateInFormatMDY: '請輸入合法的日期格式,例如:YYYY-MM-DD ("2010-12-31")。 ',
  15675. email: '請輸入合法的電子信箱地址,例如:"fred@domain.com"。 ',
  15676. url: '請輸入合法的Url 地址,例如:http://www.example.com。 ',
  15677. currencyDollar: '請輸入合法的貨幣符號,例如:¥100.0',
  15678. oneRequired: '請至少選擇一項。 ',
  15679. errorPrefix: '錯誤:',
  15680. warningPrefix: '警告:',
  15681. // Form.Validator.Extras
  15682. noSpace: '不能包含空格。 ',
  15683. reqChkByNode: '未選擇任何內容。 ',
  15684. requiredChk: '此項必填。 ',
  15685. reqChkByName: '請選擇 {label}.',
  15686. match: '必須與{matchName}相匹配',
  15687. startDate: '起始日期',
  15688. endDate: '結束日期',
  15689. currentDate: '當前日期',
  15690. afterDate: '日期必須等於或晚於{label}.',
  15691. beforeDate: '日期必須早於或等於{label}.',
  15692. startMonth: '請選擇起始月份',
  15693. sameMonth: '您必須修改兩個日期中的一個,以確保它們在同一月份。 ',
  15694. creditcard: '您輸入的信用卡號碼不正確。當前已輸入{length}個字符。 '
  15695. });
  15696. Form.Validator.add('validate-currency-yuan', {
  15697. errorMsg: function(){
  15698. return Form.Validator.getMsg('currencyYuan');
  15699. },
  15700. test: function(element){
  15701. // [¥]1[##][,###]+[.##]
  15702. // [¥]1###+[.##]
  15703. // [¥]0.##
  15704. // [¥].##
  15705. 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'));
  15706. }
  15707. });
  15708. /*
  15709. ---
  15710. name: Locale.zh-CH.Number
  15711. description: Number messages for for Chinese (simplified and traditional).
  15712. license: MIT-style license
  15713. authors:
  15714. - YMind Chan
  15715. requires:
  15716. - Locale
  15717. - Locale.en-US.Number
  15718. provides: [Locale.zh-CH.Number]
  15719. ...
  15720. */
  15721. // Simplified Chinese
  15722. Locale.define('zh-CHS', 'Number', {
  15723. currency: {
  15724. prefix: '¥ '
  15725. }
  15726. }).inherit('en-US', 'Number');
  15727. // Traditional Chinese
  15728. Locale.define('zh-CHT').inherit('zh-CHS', 'Number');
  15729. /*
  15730. ---
  15731. script: Request.JSONP.js
  15732. name: Request.JSONP
  15733. description: Defines Request.JSONP, a class for cross domain javascript via script injection.
  15734. license: MIT-style license
  15735. authors:
  15736. - Aaron Newton
  15737. - Guillermo Rauch
  15738. - Arian Stolwijk
  15739. requires:
  15740. - Core/Element
  15741. - Core/Request
  15742. - MooTools.More
  15743. provides: [Request.JSONP]
  15744. ...
  15745. */
  15746. Request.JSONP = new Class({
  15747. Implements: [Chain, Events, Options],
  15748. options: {/*
  15749. onRequest: function(src, scriptElement){},
  15750. onComplete: function(data){},
  15751. onSuccess: function(data){},
  15752. onCancel: function(){},
  15753. onTimeout: function(){},
  15754. onError: function(){}, */
  15755. onRequest: function(src){
  15756. if (this.options.log && window.console && console.log){
  15757. console.log('JSONP retrieving script with url:' + src);
  15758. }
  15759. },
  15760. onError: function(src){
  15761. if (this.options.log && window.console && console.warn){
  15762. console.warn('JSONP '+ src +' will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs');
  15763. }
  15764. },
  15765. url: '',
  15766. callbackKey: 'callback',
  15767. injectScript: document.head,
  15768. data: '',
  15769. link: 'ignore',
  15770. timeout: 0,
  15771. log: false
  15772. },
  15773. initialize: function(options){
  15774. this.setOptions(options);
  15775. },
  15776. send: function(options){
  15777. if (!Request.prototype.check.call(this, options)) return this;
  15778. this.running = true;
  15779. var type = typeOf(options);
  15780. if (type == 'string' || type == 'element') options = {data: options};
  15781. options = Object.merge(this.options, options || {});
  15782. var data = options.data;
  15783. switch (typeOf(data)){
  15784. case 'element': data = document.id(data).toQueryString(); break;
  15785. case 'object': case 'hash': data = Object.toQueryString(data);
  15786. }
  15787. var index = this.index = Request.JSONP.counter++,
  15788. key = 'request_' + index;
  15789. var src = options.url +
  15790. (options.url.test('\\?') ? '&' :'?') +
  15791. (options.callbackKey) +
  15792. '=Request.JSONP.request_map.request_'+ index +
  15793. (data ? '&' + data : '');
  15794. if (src.length > 2083) this.fireEvent('error', src);
  15795. Request.JSONP.request_map[key] = function(){
  15796. delete Request.JSONP.request_map[key];
  15797. this.success(arguments, index);
  15798. }.bind(this);
  15799. var script = this.getScript(src).inject(options.injectScript);
  15800. this.fireEvent('request', [src, script]);
  15801. if (options.timeout) this.timeout.delay(options.timeout, this);
  15802. return this;
  15803. },
  15804. getScript: function(src){
  15805. if (!this.script) this.script = new Element('script', {
  15806. type: 'text/javascript',
  15807. async: true,
  15808. src: src
  15809. });
  15810. return this.script;
  15811. },
  15812. success: function(args){
  15813. if (!this.running) return;
  15814. this.clear()
  15815. .fireEvent('complete', args).fireEvent('success', args)
  15816. .callChain();
  15817. },
  15818. cancel: function(){
  15819. if (this.running) this.clear().fireEvent('cancel');
  15820. return this;
  15821. },
  15822. isRunning: function(){
  15823. return !!this.running;
  15824. },
  15825. clear: function(){
  15826. this.running = false;
  15827. if (this.script){
  15828. this.script.destroy();
  15829. this.script = null;
  15830. }
  15831. return this;
  15832. },
  15833. timeout: function(){
  15834. if (this.running){
  15835. this.running = false;
  15836. this.fireEvent('timeout', [this.script.get('src'), this.script]).fireEvent('failure').cancel();
  15837. }
  15838. return this;
  15839. }
  15840. });
  15841. Request.JSONP.counter = 0;
  15842. Request.JSONP.request_map = {};
  15843. /*
  15844. ---
  15845. script: Request.Periodical.js
  15846. name: Request.Periodical
  15847. description: Requests the same URL to pull data from a server but increases the intervals if no data is returned to reduce the load
  15848. license: MIT-style license
  15849. authors:
  15850. - Christoph Pojer
  15851. requires:
  15852. - Core/Request
  15853. - MooTools.More
  15854. provides: [Request.Periodical]
  15855. ...
  15856. */
  15857. Request.implement({
  15858. options: {
  15859. initialDelay: 5000,
  15860. delay: 5000,
  15861. limit: 60000
  15862. },
  15863. startTimer: function(data){
  15864. var fn = function(){
  15865. if (!this.running) this.send({data: data});
  15866. };
  15867. this.lastDelay = this.options.initialDelay;
  15868. this.timer = fn.delay(this.lastDelay, this);
  15869. this.completeCheck = function(response){
  15870. clearTimeout(this.timer);
  15871. this.lastDelay = (response) ? this.options.delay : (this.lastDelay + this.options.delay).min(this.options.limit);
  15872. this.timer = fn.delay(this.lastDelay, this);
  15873. };
  15874. return this.addEvent('complete', this.completeCheck);
  15875. },
  15876. stopTimer: function(){
  15877. clearTimeout(this.timer);
  15878. return this.removeEvent('complete', this.completeCheck);
  15879. }
  15880. });
  15881. /*
  15882. ---
  15883. script: Request.Queue.js
  15884. name: Request.Queue
  15885. description: Controls several instances of Request and its variants to run only one request at a time.
  15886. license: MIT-style license
  15887. authors:
  15888. - Aaron Newton
  15889. requires:
  15890. - Core/Element
  15891. - Core/Request
  15892. - Class.Binds
  15893. provides: [Request.Queue]
  15894. ...
  15895. */
  15896. Request.Queue = new Class({
  15897. Implements: [Options, Events],
  15898. Binds: ['attach', 'request', 'complete', 'cancel', 'success', 'failure', 'exception'],
  15899. options: {/*
  15900. onRequest: function(argsPassedToOnRequest){},
  15901. onSuccess: function(argsPassedToOnSuccess){},
  15902. onComplete: function(argsPassedToOnComplete){},
  15903. onCancel: function(argsPassedToOnCancel){},
  15904. onException: function(argsPassedToOnException){},
  15905. onFailure: function(argsPassedToOnFailure){},
  15906. onEnd: function(){},
  15907. */
  15908. stopOnFailure: true,
  15909. autoAdvance: true,
  15910. concurrent: 1,
  15911. requests: {}
  15912. },
  15913. initialize: function(options){
  15914. var requests;
  15915. if (options){
  15916. requests = options.requests;
  15917. delete options.requests;
  15918. }
  15919. this.setOptions(options);
  15920. this.requests = {};
  15921. this.queue = [];
  15922. this.reqBinders = {};
  15923. if (requests) this.addRequests(requests);
  15924. },
  15925. addRequest: function(name, request){
  15926. this.requests[name] = request;
  15927. this.attach(name, request);
  15928. return this;
  15929. },
  15930. addRequests: function(obj){
  15931. Object.each(obj, function(req, name){
  15932. this.addRequest(name, req);
  15933. }, this);
  15934. return this;
  15935. },
  15936. getName: function(req){
  15937. return Object.keyOf(this.requests, req);
  15938. },
  15939. attach: function(name, req){
  15940. if (req._groupSend) return this;
  15941. ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){
  15942. if (!this.reqBinders[name]) this.reqBinders[name] = {};
  15943. this.reqBinders[name][evt] = function(){
  15944. this['on' + evt.capitalize()].apply(this, [name, req].append(arguments));
  15945. }.bind(this);
  15946. req.addEvent(evt, this.reqBinders[name][evt]);
  15947. }, this);
  15948. req._groupSend = req.send;
  15949. req.send = function(options){
  15950. this.send(name, options);
  15951. return req;
  15952. }.bind(this);
  15953. return this;
  15954. },
  15955. removeRequest: function(req){
  15956. var name = typeOf(req) == 'object' ? this.getName(req) : req;
  15957. if (!name && typeOf(name) != 'string') return this;
  15958. req = this.requests[name];
  15959. if (!req) return this;
  15960. ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){
  15961. req.removeEvent(evt, this.reqBinders[name][evt]);
  15962. }, this);
  15963. req.send = req._groupSend;
  15964. delete req._groupSend;
  15965. return this;
  15966. },
  15967. getRunning: function(){
  15968. return Object.filter(this.requests, function(r){
  15969. return r.running;
  15970. });
  15971. },
  15972. isRunning: function(){
  15973. return !!(Object.keys(this.getRunning()).length);
  15974. },
  15975. send: function(name, options){
  15976. var q = function(){
  15977. this.requests[name]._groupSend(options);
  15978. this.queue.erase(q);
  15979. }.bind(this);
  15980. q.name = name;
  15981. if (Object.keys(this.getRunning()).length >= this.options.concurrent || (this.error && this.options.stopOnFailure)) this.queue.push(q);
  15982. else q();
  15983. return this;
  15984. },
  15985. hasNext: function(name){
  15986. return (!name) ? !!this.queue.length : !!this.queue.filter(function(q){ return q.name == name; }).length;
  15987. },
  15988. resume: function(){
  15989. this.error = false;
  15990. (this.options.concurrent - Object.keys(this.getRunning()).length).times(this.runNext, this);
  15991. return this;
  15992. },
  15993. runNext: function(name){
  15994. if (!this.queue.length) return this;
  15995. if (!name){
  15996. this.queue[0]();
  15997. } else {
  15998. var found;
  15999. this.queue.each(function(q){
  16000. if (!found && q.name == name){
  16001. found = true;
  16002. q();
  16003. }
  16004. });
  16005. }
  16006. return this;
  16007. },
  16008. runAll: function(){
  16009. this.queue.each(function(q){
  16010. q();
  16011. });
  16012. return this;
  16013. },
  16014. clear: function(name){
  16015. if (!name){
  16016. this.queue.empty();
  16017. } else {
  16018. this.queue = this.queue.map(function(q){
  16019. if (q.name != name) return q;
  16020. else return false;
  16021. }).filter(function(q){
  16022. return q;
  16023. });
  16024. }
  16025. return this;
  16026. },
  16027. cancel: function(name){
  16028. this.requests[name].cancel();
  16029. return this;
  16030. },
  16031. onRequest: function(){
  16032. this.fireEvent('request', arguments);
  16033. },
  16034. onComplete: function(){
  16035. this.fireEvent('complete', arguments);
  16036. if (!this.queue.length) this.fireEvent('end');
  16037. },
  16038. onCancel: function(){
  16039. if (this.options.autoAdvance && !this.error) this.runNext();
  16040. this.fireEvent('cancel', arguments);
  16041. },
  16042. onSuccess: function(){
  16043. if (this.options.autoAdvance && !this.error) this.runNext();
  16044. this.fireEvent('success', arguments);
  16045. },
  16046. onFailure: function(){
  16047. this.error = true;
  16048. if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext();
  16049. this.fireEvent('failure', arguments);
  16050. },
  16051. onException: function(){
  16052. this.error = true;
  16053. if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext();
  16054. this.fireEvent('exception', arguments);
  16055. }
  16056. });
  16057. /*
  16058. ---
  16059. script: Array.Extras.js
  16060. name: Array.Extras
  16061. description: Extends the Array native object to include useful methods to work with arrays.
  16062. license: MIT-style license
  16063. authors:
  16064. - Christoph Pojer
  16065. - Sebastian Markbåge
  16066. requires:
  16067. - Core/Array
  16068. - MooTools.More
  16069. provides: [Array.Extras]
  16070. ...
  16071. */
  16072. (function(nil){
  16073. Array.implement({
  16074. min: function(){
  16075. return Math.min.apply(null, this);
  16076. },
  16077. max: function(){
  16078. return Math.max.apply(null, this);
  16079. },
  16080. average: function(){
  16081. return this.length ? this.sum() / this.length : 0;
  16082. },
  16083. sum: function(){
  16084. var result = 0, l = this.length;
  16085. if (l){
  16086. while (l--){
  16087. if (this[l] != null) result += parseFloat(this[l]);
  16088. }
  16089. }
  16090. return result;
  16091. },
  16092. unique: function(){
  16093. return [].combine(this);
  16094. },
  16095. shuffle: function(){
  16096. for (var i = this.length; i && --i;){
  16097. var temp = this[i], r = Math.floor(Math.random() * ( i + 1 ));
  16098. this[i] = this[r];
  16099. this[r] = temp;
  16100. }
  16101. return this;
  16102. },
  16103. reduce: function(fn, value){
  16104. for (var i = 0, l = this.length; i < l; i++){
  16105. if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this);
  16106. }
  16107. return value;
  16108. },
  16109. reduceRight: function(fn, value){
  16110. var i = this.length;
  16111. while (i--){
  16112. if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this);
  16113. }
  16114. return value;
  16115. },
  16116. pluck: function(prop){
  16117. return this.map(function(item){
  16118. return item[prop];
  16119. });
  16120. }
  16121. });
  16122. })();
  16123. /*
  16124. ---
  16125. script: Date.Extras.js
  16126. name: Date.Extras
  16127. description: Extends the Date native object to include extra methods (on top of those in Date.js).
  16128. license: MIT-style license
  16129. authors:
  16130. - Aaron Newton
  16131. - Scott Kyle
  16132. requires:
  16133. - Date
  16134. provides: [Date.Extras]
  16135. ...
  16136. */
  16137. Date.implement({
  16138. timeDiffInWords: function(to){
  16139. return Date.distanceOfTimeInWords(this, to || new Date);
  16140. },
  16141. timeDiff: function(to, separator){
  16142. if (to == null) to = new Date;
  16143. var delta = ((to - this) / 1000).floor().abs();
  16144. var vals = [],
  16145. durations = [60, 60, 24, 365, 0],
  16146. names = ['s', 'm', 'h', 'd', 'y'],
  16147. value, duration;
  16148. for (var item = 0; item < durations.length; item++){
  16149. if (item && !delta) break;
  16150. value = delta;
  16151. if ((duration = durations[item])){
  16152. value = (delta % duration);
  16153. delta = (delta / duration).floor();
  16154. }
  16155. vals.unshift(value + (names[item] || ''));
  16156. }
  16157. return vals.join(separator || ':');
  16158. }
  16159. }).extend({
  16160. distanceOfTimeInWords: function(from, to){
  16161. return Date.getTimePhrase(((to - from) / 1000).toInt());
  16162. },
  16163. getTimePhrase: function(delta){
  16164. var suffix = (delta < 0) ? 'Until' : 'Ago';
  16165. if (delta < 0) delta *= -1;
  16166. var units = {
  16167. minute: 60,
  16168. hour: 60,
  16169. day: 24,
  16170. week: 7,
  16171. month: 52 / 12,
  16172. year: 12,
  16173. eon: Infinity
  16174. };
  16175. var msg = 'lessThanMinute';
  16176. for (var unit in units){
  16177. var interval = units[unit];
  16178. if (delta < 1.5 * interval){
  16179. if (delta > 0.75 * interval) msg = unit;
  16180. break;
  16181. }
  16182. delta /= interval;
  16183. msg = unit + 's';
  16184. }
  16185. delta = delta.round();
  16186. return Date.getMsg(msg + suffix, delta).substitute({delta: delta});
  16187. }
  16188. }).defineParsers(
  16189. {
  16190. // "today", "tomorrow", "yesterday"
  16191. re: /^(?:tod|tom|yes)/i,
  16192. handler: function(bits){
  16193. var d = new Date().clearTime();
  16194. switch (bits[0]){
  16195. case 'tom': return d.increment();
  16196. case 'yes': return d.decrement();
  16197. default: return d;
  16198. }
  16199. }
  16200. },
  16201. {
  16202. // "next Wednesday", "last Thursday"
  16203. re: /^(next|last) ([a-z]+)$/i,
  16204. handler: function(bits){
  16205. var d = new Date().clearTime();
  16206. var day = d.getDay();
  16207. var newDay = Date.parseDay(bits[2], true);
  16208. var addDays = newDay - day;
  16209. if (newDay <= day) addDays += 7;
  16210. if (bits[1] == 'last') addDays -= 7;
  16211. return d.set('date', d.getDate() + addDays);
  16212. }
  16213. }
  16214. ).alias('timeAgoInWords', 'timeDiffInWords');
  16215. /*
  16216. ---
  16217. name: Hash
  16218. description: Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects.
  16219. license: MIT-style license.
  16220. requires:
  16221. - Core/Object
  16222. - MooTools.More
  16223. provides: [Hash]
  16224. ...
  16225. */
  16226. (function(){
  16227. if (this.Hash) return;
  16228. var Hash = this.Hash = new Type('Hash', function(object){
  16229. if (typeOf(object) == 'hash') object = Object.clone(object.getClean());
  16230. for (var key in object) this[key] = object[key];
  16231. return this;
  16232. });
  16233. this.$H = function(object){
  16234. return new Hash(object);
  16235. };
  16236. Hash.implement({
  16237. forEach: function(fn, bind){
  16238. Object.forEach(this, fn, bind);
  16239. },
  16240. getClean: function(){
  16241. var clean = {};
  16242. for (var key in this){
  16243. if (this.hasOwnProperty(key)) clean[key] = this[key];
  16244. }
  16245. return clean;
  16246. },
  16247. getLength: function(){
  16248. var length = 0;
  16249. for (var key in this){
  16250. if (this.hasOwnProperty(key)) length++;
  16251. }
  16252. return length;
  16253. }
  16254. });
  16255. Hash.alias('each', 'forEach');
  16256. Hash.implement({
  16257. has: Object.prototype.hasOwnProperty,
  16258. keyOf: function(value){
  16259. return Object.keyOf(this, value);
  16260. },
  16261. hasValue: function(value){
  16262. return Object.contains(this, value);
  16263. },
  16264. extend: function(properties){
  16265. Hash.each(properties || {}, function(value, key){
  16266. Hash.set(this, key, value);
  16267. }, this);
  16268. return this;
  16269. },
  16270. combine: function(properties){
  16271. Hash.each(properties || {}, function(value, key){
  16272. Hash.include(this, key, value);
  16273. }, this);
  16274. return this;
  16275. },
  16276. erase: function(key){
  16277. if (this.hasOwnProperty(key)) delete this[key];
  16278. return this;
  16279. },
  16280. get: function(key){
  16281. return (this.hasOwnProperty(key)) ? this[key] : null;
  16282. },
  16283. set: function(key, value){
  16284. if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
  16285. return this;
  16286. },
  16287. empty: function(){
  16288. Hash.each(this, function(value, key){
  16289. delete this[key];
  16290. }, this);
  16291. return this;
  16292. },
  16293. include: function(key, value){
  16294. if (this[key] == undefined) this[key] = value;
  16295. return this;
  16296. },
  16297. map: function(fn, bind){
  16298. return new Hash(Object.map(this, fn, bind));
  16299. },
  16300. filter: function(fn, bind){
  16301. return new Hash(Object.filter(this, fn, bind));
  16302. },
  16303. every: function(fn, bind){
  16304. return Object.every(this, fn, bind);
  16305. },
  16306. some: function(fn, bind){
  16307. return Object.some(this, fn, bind);
  16308. },
  16309. getKeys: function(){
  16310. return Object.keys(this);
  16311. },
  16312. getValues: function(){
  16313. return Object.values(this);
  16314. },
  16315. toQueryString: function(base){
  16316. return Object.toQueryString(this, base);
  16317. }
  16318. });
  16319. Hash.alias({indexOf: 'keyOf', contains: 'hasValue'});
  16320. })();
  16321. /*
  16322. ---
  16323. script: Hash.Extras.js
  16324. name: Hash.Extras
  16325. description: Extends the Hash Type to include getFromPath which allows a path notation to child elements.
  16326. license: MIT-style license
  16327. authors:
  16328. - Aaron Newton
  16329. requires:
  16330. - Hash
  16331. - Object.Extras
  16332. provides: [Hash.Extras]
  16333. ...
  16334. */
  16335. Hash.implement({
  16336. getFromPath: function(notation){
  16337. return Object.getFromPath(this, notation);
  16338. },
  16339. cleanValues: function(method){
  16340. return new Hash(Object.cleanValues(this, method));
  16341. },
  16342. run: function(){
  16343. Object.run(arguments);
  16344. }
  16345. });
  16346. /*
  16347. ---
  16348. name: Number.Format
  16349. description: Extends the Number Type object to include a number formatting method.
  16350. license: MIT-style license
  16351. authors: [Arian Stolwijk]
  16352. requires: [Core/Number, Locale.en-US.Number]
  16353. # Number.Extras is for compatibility
  16354. provides: [Number.Format, Number.Extras]
  16355. ...
  16356. */
  16357. Number.implement({
  16358. format: function(options){
  16359. // Thanks dojo and YUI for some inspiration
  16360. var value = this;
  16361. options = options ? Object.clone(options) : {};
  16362. var getOption = function(key){
  16363. if (options[key] != null) return options[key];
  16364. return Locale.get('Number.' + key);
  16365. };
  16366. var negative = value < 0,
  16367. decimal = getOption('decimal'),
  16368. precision = getOption('precision'),
  16369. group = getOption('group'),
  16370. decimals = getOption('decimals');
  16371. if (negative){
  16372. var negativeLocale = getOption('negative') || {};
  16373. if (negativeLocale.prefix == null && negativeLocale.suffix == null) negativeLocale.prefix = '-';
  16374. ['prefix', 'suffix'].each(function(key){
  16375. if (negativeLocale[key]) options[key] = getOption(key) + negativeLocale[key];
  16376. });
  16377. value = -value;
  16378. }
  16379. var prefix = getOption('prefix'),
  16380. suffix = getOption('suffix');
  16381. if (decimals !== '' && decimals >= 0 && decimals <= 20) value = value.toFixed(decimals);
  16382. if (precision >= 1 && precision <= 21) value = (+value).toPrecision(precision);
  16383. value += '';
  16384. var index;
  16385. if (getOption('scientific') === false && value.indexOf('e') > -1){
  16386. var match = value.split('e'),
  16387. zeros = +match[1];
  16388. value = match[0].replace('.', '');
  16389. if (zeros < 0){
  16390. zeros = -zeros - 1;
  16391. index = match[0].indexOf('.');
  16392. if (index > -1) zeros -= index - 1;
  16393. while (zeros--) value = '0' + value;
  16394. value = '0.' + value;
  16395. } else {
  16396. index = match[0].lastIndexOf('.');
  16397. if (index > -1) zeros -= match[0].length - index - 1;
  16398. while (zeros--) value += '0';
  16399. }
  16400. }
  16401. if (decimal != '.') value = value.replace('.', decimal);
  16402. if (group){
  16403. index = value.lastIndexOf(decimal);
  16404. index = (index > -1) ? index : value.length;
  16405. var newOutput = value.substring(index),
  16406. i = index;
  16407. while (i--){
  16408. if ((index - i - 1) % 3 == 0 && i != (index - 1)) newOutput = group + newOutput;
  16409. newOutput = value.charAt(i) + newOutput;
  16410. }
  16411. value = newOutput;
  16412. }
  16413. if (prefix) value = prefix + value;
  16414. if (suffix) value += suffix;
  16415. return value;
  16416. },
  16417. formatCurrency: function(decimals){
  16418. var locale = Locale.get('Number.currency') || {};
  16419. if (locale.scientific == null) locale.scientific = false;
  16420. locale.decimals = decimals != null ? decimals
  16421. : (locale.decimals == null ? 2 : locale.decimals);
  16422. return this.format(locale);
  16423. },
  16424. formatPercentage: function(decimals){
  16425. var locale = Locale.get('Number.percentage') || {};
  16426. if (locale.suffix == null) locale.suffix = '%';
  16427. locale.decimals = decimals != null ? decimals
  16428. : (locale.decimals == null ? 2 : locale.decimals);
  16429. return this.format(locale);
  16430. }
  16431. });
  16432. /*
  16433. ---
  16434. script: URI.js
  16435. name: URI
  16436. description: Provides methods useful in managing the window location and uris.
  16437. license: MIT-style license
  16438. authors:
  16439. - Sebastian Markbåge
  16440. - Aaron Newton
  16441. requires:
  16442. - Core/Object
  16443. - Core/Class
  16444. - Core/Class.Extras
  16445. - Core/Element
  16446. - String.QueryString
  16447. provides: [URI]
  16448. ...
  16449. */
  16450. (function(){
  16451. var toString = function(){
  16452. return this.get('value');
  16453. };
  16454. var URI = this.URI = new Class({
  16455. Implements: Options,
  16456. options: {
  16457. /*base: false*/
  16458. },
  16459. regex: /^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[A-Fa-f0-9:]+\]|[^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,
  16460. parts: ['scheme', 'user', 'password', 'host', 'port', 'directory', 'file', 'query', 'fragment'],
  16461. schemes: {http: 80, https: 443, ftp: 21, rtsp: 554, mms: 1755, file: 0},
  16462. initialize: function(uri, options){
  16463. this.setOptions(options);
  16464. var base = this.options.base || URI.base;
  16465. if (!uri) uri = base;
  16466. if (uri && uri.parsed) this.parsed = Object.clone(uri.parsed);
  16467. else this.set('value', uri.href || uri.toString(), base ? new URI(base) : false);
  16468. },
  16469. parse: function(value, base){
  16470. var bits = value.match(this.regex);
  16471. if (!bits) return false;
  16472. bits.shift();
  16473. return this.merge(bits.associate(this.parts), base);
  16474. },
  16475. merge: function(bits, base){
  16476. if ((!bits || !bits.scheme) && (!base || !base.scheme)) return false;
  16477. if (base){
  16478. this.parts.every(function(part){
  16479. if (bits[part]) return false;
  16480. bits[part] = base[part] || '';
  16481. return true;
  16482. });
  16483. }
  16484. bits.port = bits.port || this.schemes[bits.scheme.toLowerCase()];
  16485. bits.directory = bits.directory ? this.parseDirectory(bits.directory, base ? base.directory : '') : '/';
  16486. return bits;
  16487. },
  16488. parseDirectory: function(directory, baseDirectory){
  16489. directory = (directory.substr(0, 1) == '/' ? '' : (baseDirectory || '/')) + directory;
  16490. if (!directory.test(URI.regs.directoryDot)) return directory;
  16491. var result = [];
  16492. directory.replace(URI.regs.endSlash, '').split('/').each(function(dir){
  16493. if (dir == '..' && result.length > 0) result.pop();
  16494. else if (dir != '.') result.push(dir);
  16495. });
  16496. return result.join('/') + '/';
  16497. },
  16498. combine: function(bits){
  16499. return bits.value || bits.scheme + '://' +
  16500. (bits.user ? bits.user + (bits.password ? ':' + bits.password : '') + '@' : '') +
  16501. (bits.host || '') + (bits.port && bits.port != this.schemes[bits.scheme] ? ':' + bits.port : '') +
  16502. (bits.directory || '/') + (bits.file || '') +
  16503. (bits.query ? '?' + bits.query : '') +
  16504. (bits.fragment ? '#' + bits.fragment : '');
  16505. },
  16506. set: function(part, value, base){
  16507. if (part == 'value'){
  16508. var scheme = value.match(URI.regs.scheme);
  16509. if (scheme) scheme = scheme[1];
  16510. if (scheme && this.schemes[scheme.toLowerCase()] == null) this.parsed = { scheme: scheme, value: value };
  16511. else this.parsed = this.parse(value, (base || this).parsed) || (scheme ? { scheme: scheme, value: value } : { value: value });
  16512. } else if (part == 'data'){
  16513. this.setData(value);
  16514. } else {
  16515. this.parsed[part] = value;
  16516. }
  16517. return this;
  16518. },
  16519. get: function(part, base){
  16520. switch (part){
  16521. case 'value': return this.combine(this.parsed, base ? base.parsed : false);
  16522. case 'data' : return this.getData();
  16523. }
  16524. return this.parsed[part] || '';
  16525. },
  16526. go: function(){
  16527. document.location.href = this.toString();
  16528. },
  16529. toURI: function(){
  16530. return this;
  16531. },
  16532. getData: function(key, part){
  16533. var qs = this.get(part || 'query');
  16534. if (!(qs || qs === 0)) return key ? null : {};
  16535. var obj = qs.parseQueryString();
  16536. return key ? obj[key] : obj;
  16537. },
  16538. setData: function(values, merge, part){
  16539. if (typeof values == 'string'){
  16540. var data = this.getData();
  16541. data[arguments[0]] = arguments[1];
  16542. values = data;
  16543. } else if (merge){
  16544. values = Object.merge(this.getData(null, part), values);
  16545. }
  16546. return this.set(part || 'query', Object.toQueryString(values));
  16547. },
  16548. clearData: function(part){
  16549. return this.set(part || 'query', '');
  16550. },
  16551. toString: toString,
  16552. valueOf: toString
  16553. });
  16554. URI.regs = {
  16555. endSlash: /\/$/,
  16556. scheme: /^(\w+):/,
  16557. directoryDot: /\.\/|\.$/
  16558. };
  16559. URI.base = new URI(Array.convert(document.getElements('base[href]', true)).getLast(), {base: document.location});
  16560. String.implement({
  16561. toURI: function(options){
  16562. return new URI(this, options);
  16563. }
  16564. });
  16565. })();
  16566. /*
  16567. ---
  16568. script: URI.Relative.js
  16569. name: URI.Relative
  16570. description: Extends the URI class to add methods for computing relative and absolute urls.
  16571. license: MIT-style license
  16572. authors:
  16573. - Sebastian Markbåge
  16574. requires:
  16575. - Class.refactor
  16576. - URI
  16577. provides: [URI.Relative]
  16578. ...
  16579. */
  16580. URI = Class.refactor(URI, {
  16581. combine: function(bits, base){
  16582. if (!base || bits.scheme != base.scheme || bits.host != base.host || bits.port != base.port)
  16583. return this.previous.apply(this, arguments);
  16584. var end = bits.file + (bits.query ? '?' + bits.query : '') + (bits.fragment ? '#' + bits.fragment : '');
  16585. if (!base.directory) return (bits.directory || (bits.file ? '' : './')) + end;
  16586. var baseDir = base.directory.split('/'),
  16587. relDir = bits.directory.split('/'),
  16588. path = '',
  16589. offset;
  16590. var i = 0;
  16591. for (offset = 0; offset < baseDir.length && offset < relDir.length && baseDir[offset] == relDir[offset]; offset++);
  16592. for (i = 0; i < baseDir.length - offset - 1; i++) path += '../';
  16593. for (i = offset; i < relDir.length - 1; i++) path += relDir[i] + '/';
  16594. return (path || (bits.file ? '' : './')) + end;
  16595. },
  16596. toAbsolute: function(base){
  16597. base = new URI(base);
  16598. if (base) base.set('directory', '').set('file', '');
  16599. return this.toRelative(base);
  16600. },
  16601. toRelative: function(base){
  16602. return this.get('value', new URI(base));
  16603. }
  16604. });
  16605. /*
  16606. ---
  16607. script: Assets.js
  16608. name: Assets
  16609. description: Provides methods to dynamically load JavaScript, CSS, and Image files into the document.
  16610. license: MIT-style license
  16611. authors:
  16612. - Valerio Proietti
  16613. requires:
  16614. - Core/Element.Event
  16615. - MooTools.More
  16616. provides: [Assets, Asset.javascript, Asset.css, Asset.image, Asset.images]
  16617. ...
  16618. */
  16619. ;(function(){
  16620. var Asset = this.Asset = {
  16621. javascript: function(source, properties){
  16622. if (!properties) properties = {};
  16623. var script = new Element('script', {src: source, type: 'text/javascript'}),
  16624. doc = properties.document || document,
  16625. load = properties.onload || properties.onLoad;
  16626. delete properties.onload;
  16627. delete properties.onLoad;
  16628. delete properties.document;
  16629. if (load){
  16630. if (!script.addEventListener){
  16631. script.addEvent('readystatechange', function(){
  16632. if (['loaded', 'complete'].contains(this.readyState)) load.call(this);
  16633. });
  16634. } else {
  16635. script.addEvent('load', load);
  16636. }
  16637. }
  16638. return script.set(properties).inject(doc.head);
  16639. },
  16640. css: function(source, properties){
  16641. if (!properties) properties = {};
  16642. var load = properties.onload || properties.onLoad,
  16643. doc = properties.document || document,
  16644. timeout = properties.timeout || 3000;
  16645. ['onload', 'onLoad', 'document'].each(function(prop){
  16646. delete properties[prop];
  16647. });
  16648. var link = new Element('link', {
  16649. type: 'text/css',
  16650. rel: 'stylesheet',
  16651. media: 'screen',
  16652. href: source
  16653. }).setProperties(properties).inject(doc.head);
  16654. if (load){
  16655. // based on article at http://www.yearofmoo.com/2011/03/cross-browser-stylesheet-preloading.html
  16656. var loaded = false, retries = 0;
  16657. var check = function(){
  16658. var stylesheets = document.styleSheets;
  16659. for (var i = 0; i < stylesheets.length; i++){
  16660. var file = stylesheets[i];
  16661. var owner = file.ownerNode ? file.ownerNode : file.owningElement;
  16662. if (owner && owner == link){
  16663. loaded = true;
  16664. return load.call(link);
  16665. }
  16666. }
  16667. retries++;
  16668. if (!loaded && retries < timeout / 50) return setTimeout(check, 50);
  16669. };
  16670. setTimeout(check, 0);
  16671. }
  16672. return link;
  16673. },
  16674. image: function(source, properties){
  16675. if (!properties) properties = {};
  16676. var image = new Image(),
  16677. element = document.id(image) || new Element('img');
  16678. ['load', 'abort', 'error'].each(function(name){
  16679. var type = 'on' + name,
  16680. cap = 'on' + name.capitalize(),
  16681. event = properties[type] || properties[cap] || function(){};
  16682. delete properties[cap];
  16683. delete properties[type];
  16684. image[type] = function(){
  16685. if (!image) return;
  16686. if (!element.parentNode){
  16687. element.width = image.width;
  16688. element.height = image.height;
  16689. }
  16690. image = image.onload = image.onabort = image.onerror = null;
  16691. event.delay(1, element, element);
  16692. element.fireEvent(name, element, 1);
  16693. };
  16694. });
  16695. image.src = element.src = source;
  16696. if (image && image.complete) image.onload.delay(1);
  16697. return element.set(properties);
  16698. },
  16699. images: function(sources, options){
  16700. sources = Array.convert(sources);
  16701. var fn = function(){},
  16702. counter = 0;
  16703. options = Object.merge({
  16704. onComplete: fn,
  16705. onProgress: fn,
  16706. onError: fn,
  16707. properties: {}
  16708. }, options);
  16709. return new Elements(sources.map(function(source, index){
  16710. return Asset.image(source, Object.append(options.properties, {
  16711. onload: function(){
  16712. counter++;
  16713. options.onProgress.call(this, counter, index, source);
  16714. if (counter == sources.length) options.onComplete();
  16715. },
  16716. onerror: function(){
  16717. counter++;
  16718. options.onError.call(this, counter, index, source);
  16719. if (counter == sources.length) options.onComplete();
  16720. }
  16721. }));
  16722. }));
  16723. }
  16724. };
  16725. })();
  16726. /*
  16727. ---
  16728. script: Color.js
  16729. name: Color
  16730. description: Class for creating and manipulating colors in JavaScript. Supports HSB -> RGB Conversions and vice versa.
  16731. license: MIT-style license
  16732. authors:
  16733. - Valerio Proietti
  16734. requires:
  16735. - Core/Array
  16736. - Core/String
  16737. - Core/Number
  16738. - Core/Hash
  16739. - Core/Function
  16740. - MooTools.More
  16741. provides: [Color]
  16742. ...
  16743. */
  16744. (function(){
  16745. var Color = this.Color = new Type('Color', function(color, type){
  16746. if (arguments.length >= 3){
  16747. type = 'rgb'; color = Array.slice(arguments, 0, 3);
  16748. } else if (typeof color == 'string'){
  16749. if (color.match(/rgb/)) color = color.rgbToHex().hexToRgb(true);
  16750. else if (color.match(/hsb/)) color = color.hsbToRgb();
  16751. else color = color.hexToRgb(true);
  16752. }
  16753. type = type || 'rgb';
  16754. switch (type){
  16755. case 'hsb':
  16756. var old = color;
  16757. color = color.hsbToRgb();
  16758. color.hsb = old;
  16759. break;
  16760. case 'hex': color = color.hexToRgb(true); break;
  16761. }
  16762. color.rgb = color.slice(0, 3);
  16763. color.hsb = color.hsb || color.rgbToHsb();
  16764. color.hex = color.rgbToHex();
  16765. return Object.append(color, this);
  16766. });
  16767. Color.implement({
  16768. mix: function(){
  16769. var colors = Array.slice(arguments);
  16770. var alpha = (typeOf(colors.getLast()) == 'number') ? colors.pop() : 50;
  16771. var rgb = this.slice();
  16772. colors.each(function(color){
  16773. color = new Color(color);
  16774. for (var i = 0; i < 3; i++) rgb[i] = Math.round((rgb[i] / 100 * (100 - alpha)) + (color[i] / 100 * alpha));
  16775. });
  16776. return new Color(rgb, 'rgb');
  16777. },
  16778. invert: function(){
  16779. return new Color(this.map(function(value){
  16780. return 255 - value;
  16781. }));
  16782. },
  16783. setHue: function(value){
  16784. return new Color([value, this.hsb[1], this.hsb[2]], 'hsb');
  16785. },
  16786. setSaturation: function(percent){
  16787. return new Color([this.hsb[0], percent, this.hsb[2]], 'hsb');
  16788. },
  16789. setBrightness: function(percent){
  16790. return new Color([this.hsb[0], this.hsb[1], percent], 'hsb');
  16791. }
  16792. });
  16793. this.$RGB = function(r, g, b){
  16794. return new Color([r, g, b], 'rgb');
  16795. };
  16796. this.$HSB = function(h, s, b){
  16797. return new Color([h, s, b], 'hsb');
  16798. };
  16799. this.$HEX = function(hex){
  16800. return new Color(hex, 'hex');
  16801. };
  16802. Array.implement({
  16803. rgbToHsb: function(){
  16804. var red = this[0],
  16805. green = this[1],
  16806. blue = this[2],
  16807. hue = 0,
  16808. max = Math.max(red, green, blue),
  16809. min = Math.min(red, green, blue),
  16810. delta = max - min,
  16811. brightness = max / 255,
  16812. saturation = (max != 0) ? delta / max : 0;
  16813. if (saturation != 0){
  16814. var rr = (max - red) / delta;
  16815. var gr = (max - green) / delta;
  16816. var br = (max - blue) / delta;
  16817. if (red == max) hue = br - gr;
  16818. else if (green == max) hue = 2 + rr - br;
  16819. else hue = 4 + gr - rr;
  16820. hue /= 6;
  16821. if (hue < 0) hue++;
  16822. }
  16823. return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)];
  16824. },
  16825. hsbToRgb: function(){
  16826. var br = Math.round(this[2] / 100 * 255);
  16827. if (this[1] == 0){
  16828. return [br, br, br];
  16829. } else {
  16830. var hue = this[0] % 360;
  16831. var f = hue % 60;
  16832. var p = Math.round((this[2] * (100 - this[1])) / 10000 * 255);
  16833. var q = Math.round((this[2] * (6000 - this[1] * f)) / 600000 * 255);
  16834. var t = Math.round((this[2] * (6000 - this[1] * (60 - f))) / 600000 * 255);
  16835. switch (Math.floor(hue / 60)){
  16836. case 0: return [br, t, p];
  16837. case 1: return [q, br, p];
  16838. case 2: return [p, br, t];
  16839. case 3: return [p, q, br];
  16840. case 4: return [t, p, br];
  16841. case 5: return [br, p, q];
  16842. }
  16843. }
  16844. return false;
  16845. }
  16846. });
  16847. String.implement({
  16848. rgbToHsb: function(){
  16849. var rgb = this.match(/\d{1,3}/g);
  16850. return (rgb) ? rgb.rgbToHsb() : null;
  16851. },
  16852. hsbToRgb: function(){
  16853. var hsb = this.match(/\d{1,3}/g);
  16854. return (hsb) ? hsb.hsbToRgb() : null;
  16855. }
  16856. });
  16857. })();
  16858. /*
  16859. ---
  16860. script: Group.js
  16861. name: Group
  16862. description: Class for monitoring collections of events
  16863. license: MIT-style license
  16864. authors:
  16865. - Valerio Proietti
  16866. requires:
  16867. - Core/Events
  16868. - MooTools.More
  16869. provides: [Group]
  16870. ...
  16871. */
  16872. (function(){
  16873. var Group = this.Group = new Class({
  16874. initialize: function(){
  16875. this.instances = Array.flatten(arguments);
  16876. },
  16877. addEvent: function(type, fn){
  16878. var instances = this.instances,
  16879. len = instances.length,
  16880. togo = len,
  16881. args = new Array(len),
  16882. self = this;
  16883. instances.each(function(instance, i){
  16884. instance.addEvent(type, function(){
  16885. if (!args[i]) togo--;
  16886. args[i] = arguments;
  16887. if (!togo){
  16888. fn.call(self, instances, instance, args);
  16889. togo = len;
  16890. args = new Array(len);
  16891. }
  16892. });
  16893. });
  16894. }
  16895. });
  16896. })();
  16897. /*
  16898. ---
  16899. script: Hash.Cookie.js
  16900. name: Hash.Cookie
  16901. description: Class for creating, reading, and deleting Cookies in JSON format.
  16902. license: MIT-style license
  16903. authors:
  16904. - Valerio Proietti
  16905. - Aaron Newton
  16906. requires:
  16907. - Core/Cookie
  16908. - Core/JSON
  16909. - MooTools.More
  16910. - Hash
  16911. provides: [Hash.Cookie]
  16912. ...
  16913. */
  16914. Hash.Cookie = new Class({
  16915. Extends: Cookie,
  16916. options: {
  16917. autoSave: true
  16918. },
  16919. initialize: function(name, options){
  16920. this.parent(name, options);
  16921. this.load();
  16922. },
  16923. save: function(){
  16924. var value = JSON.encode(this.hash);
  16925. if (!value || value.length > 4096) return false; //cookie would be truncated!
  16926. if (value == '{}') this.dispose();
  16927. else this.write(value);
  16928. return true;
  16929. },
  16930. load: function(){
  16931. this.hash = new Hash(JSON.decode(this.read(), true));
  16932. return this;
  16933. }
  16934. });
  16935. Hash.each(Hash.prototype, function(method, name){
  16936. if (typeof method == 'function') Hash.Cookie.implement(name, function(){
  16937. var value = method.apply(this.hash, arguments);
  16938. if (this.options.autoSave) this.save();
  16939. return value;
  16940. });
  16941. });
  16942. /*
  16943. ---
  16944. name: Swiff
  16945. description: Wrapper for embedding SWF movies. Supports External Interface Communication.
  16946. license: MIT-style license.
  16947. credits:
  16948. - Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject.
  16949. requires: [Core/Options, Core/Object, Core/Element]
  16950. provides: Swiff
  16951. ...
  16952. */
  16953. (function(){
  16954. var Swiff = this.Swiff = new Class({
  16955. Implements: Options,
  16956. options: {
  16957. id: null,
  16958. height: 1,
  16959. width: 1,
  16960. container: null,
  16961. properties: {},
  16962. params: {
  16963. quality: 'high',
  16964. allowScriptAccess: 'always',
  16965. wMode: 'window',
  16966. swLiveConnect: true
  16967. },
  16968. callBacks: {},
  16969. vars: {}
  16970. },
  16971. toElement: function(){
  16972. return this.object;
  16973. },
  16974. initialize: function(path, options){
  16975. this.instance = 'Swiff_' + String.uniqueID();
  16976. this.setOptions(options);
  16977. options = this.options;
  16978. var id = this.id = options.id || this.instance;
  16979. var container = document.id(options.container);
  16980. Swiff.CallBacks[this.instance] = {};
  16981. var params = options.params, vars = options.vars, callBacks = options.callBacks;
  16982. var properties = Object.append({height: options.height, width: options.width}, options.properties);
  16983. var self = this;
  16984. for (var callBack in callBacks){
  16985. Swiff.CallBacks[this.instance][callBack] = (function(option){
  16986. return function(){
  16987. return option.apply(self.object, arguments);
  16988. };
  16989. })(callBacks[callBack]);
  16990. vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack;
  16991. }
  16992. params.flashVars = Object.toQueryString(vars);
  16993. if ('ActiveXObject' in window){
  16994. properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
  16995. params.movie = path;
  16996. } else {
  16997. properties.type = 'application/x-shockwave-flash';
  16998. }
  16999. properties.data = path;
  17000. var build = '<object id="' + id + '"';
  17001. for (var property in properties) build += ' ' + property + '="' + properties[property] + '"';
  17002. build += '>';
  17003. for (var param in params){
  17004. if (params[param]) build += '<param name="' + param + '" value="' + params[param] + '" />';
  17005. }
  17006. build += '</object>';
  17007. this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild;
  17008. },
  17009. replaces: function(element){
  17010. element = document.id(element, true);
  17011. element.parentNode.replaceChild(this.toElement(), element);
  17012. return this;
  17013. },
  17014. inject: function(element){
  17015. document.id(element, true).appendChild(this.toElement());
  17016. return this;
  17017. },
  17018. remote: function(){
  17019. return Swiff.remote.apply(Swiff, [this.toElement()].append(arguments));
  17020. }
  17021. });
  17022. Swiff.CallBacks = {};
  17023. Swiff.remote = function(obj, fn){
  17024. var rs = obj.CallFunction('<invoke name="' + fn + '" returntype="javascript">' + __flash__argumentsToXML(arguments, 2) + '</invoke>');
  17025. return eval(rs);
  17026. };
  17027. })();
  17028. /*
  17029. ---
  17030. name: Table
  17031. description: LUA-Style table implementation.
  17032. license: MIT-style license
  17033. authors:
  17034. - Valerio Proietti
  17035. requires: [Core/Array]
  17036. provides: [Table]
  17037. ...
  17038. */
  17039. (function(){
  17040. var Table = this.Table = function(){
  17041. this.length = 0;
  17042. var keys = [],
  17043. values = [];
  17044. this.set = function(key, value){
  17045. var index = keys.indexOf(key);
  17046. if (index == -1){
  17047. var length = keys.length;
  17048. keys[length] = key;
  17049. values[length] = value;
  17050. this.length++;
  17051. } else {
  17052. values[index] = value;
  17053. }
  17054. return this;
  17055. };
  17056. this.get = function(key){
  17057. var index = keys.indexOf(key);
  17058. return (index == -1) ? null : values[index];
  17059. };
  17060. this.erase = function(key){
  17061. var index = keys.indexOf(key);
  17062. if (index != -1){
  17063. this.length--;
  17064. keys.splice(index, 1);
  17065. return values.splice(index, 1)[0];
  17066. }
  17067. return null;
  17068. };
  17069. this.each = this.forEach = function(fn, bind){
  17070. for (var i = 0, l = this.length; i < l; i++) fn.call(bind, keys[i], values[i], this);
  17071. };
  17072. };
  17073. if (this.Type) new Type('Table', Table);
  17074. })();