mootools-1.6.0_all.js 550 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706
  1. /* MooTools: the javascript framework. license: MIT-style license. copyright: Copyright (c) 2006-2016 [Valerio Proietti](http://mad4milk.net/).*/
  2. /*!
  3. Web Build: http://mootools.net/more/builder/444dd8f9b276db91102332672b694443
  4. */
  5. /*
  6. ---
  7. name: Core
  8. description: The heart of MooTools.
  9. license: MIT-style license.
  10. copyright: Copyright (c) 2006-2015 [Valerio Proietti](http://mad4milk.net/).
  11. authors: The MooTools production team (http://mootools.net/developers/)
  12. inspiration:
  13. - Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php)
  14. - Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php)
  15. provides: [Core, MooTools, Type, typeOf, instanceOf, Native]
  16. ...
  17. */
  18. /*! MooTools: the javascript framework. license: MIT-style license. copyright: Copyright (c) 2006-2015 [Valerio Proietti](http://mad4milk.net/).*/
  19. (function(){
  20. this.MooTools = {
  21. version: '1.6.0',
  22. build: '529422872adfff401b901b8b6c7ca5114ee95e2b'
  23. };
  24. // typeOf, instanceOf
  25. var typeOf = this.typeOf = function(item){
  26. if (item == null) return 'null';
  27. if (item.$family != null) return item.$family();
  28. if (item.nodeName){
  29. if (item.nodeType == 1) return 'element';
  30. if (item.nodeType == 3) return (/\S/).test(item.nodeValue) ? 'textnode' : 'whitespace';
  31. } else if (typeof item.length == 'number'){
  32. if ('callee' in item) return 'arguments';
  33. if ('item' in item) return 'collection';
  34. }
  35. return typeof item;
  36. };
  37. var instanceOf = this.instanceOf = function(item, object){
  38. if (item == null) return false;
  39. var constructor = item.$constructor || item.constructor;
  40. while (constructor){
  41. if (constructor === object) return true;
  42. constructor = constructor.parent;
  43. }
  44. /*<ltIE8>*/
  45. if (!item.hasOwnProperty) return false;
  46. /*</ltIE8>*/
  47. return item instanceof object;
  48. };
  49. var hasOwnProperty = Object.prototype.hasOwnProperty;
  50. /*<ltIE8>*/
  51. var enumerables = true;
  52. for (var i in {toString: 1}) enumerables = null;
  53. if (enumerables) enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor'];
  54. function forEachObjectEnumberableKey(object, fn, bind){
  55. if (enumerables) for (var i = enumerables.length; i--;){
  56. var k = enumerables[i];
  57. // signature has key-value, so overloadSetter can directly pass the
  58. // method function, without swapping arguments.
  59. if (hasOwnProperty.call(object, k)) fn.call(bind, k, object[k]);
  60. }
  61. }
  62. /*</ltIE8>*/
  63. // Function overloading
  64. var Function = this.Function;
  65. Function.prototype.overloadSetter = function(usePlural){
  66. var self = this;
  67. return function(a, b){
  68. if (a == null) return this;
  69. if (usePlural || typeof a != 'string'){
  70. for (var k in a) self.call(this, k, a[k]);
  71. /*<ltIE8>*/
  72. forEachObjectEnumberableKey(a, self, this);
  73. /*</ltIE8>*/
  74. } else {
  75. self.call(this, a, b);
  76. }
  77. return this;
  78. };
  79. };
  80. Function.prototype.overloadGetter = function(usePlural){
  81. var self = this;
  82. return function(a){
  83. var args, result;
  84. if (typeof a != 'string') args = a;
  85. else if (arguments.length > 1) args = arguments;
  86. else if (usePlural) args = [a];
  87. if (args){
  88. result = {};
  89. for (var i = 0; i < args.length; i++) result[args[i]] = self.call(this, args[i]);
  90. } else {
  91. result = self.call(this, a);
  92. }
  93. return result;
  94. };
  95. };
  96. Function.prototype.extend = function(key, value){
  97. this[key] = value;
  98. }.overloadSetter();
  99. Function.prototype.implement = function(key, value){
  100. this.prototype[key] = value;
  101. }.overloadSetter();
  102. // From
  103. var slice = Array.prototype.slice;
  104. Array.convert = function(item){
  105. if (item == null) return [];
  106. return (Type.isEnumerable(item) && typeof item != 'string') ? (typeOf(item) == 'array') ? item : slice.call(item) : [item];
  107. };
  108. Function.convert = function(item){
  109. return (typeOf(item) == 'function') ? item : function(){
  110. return item;
  111. };
  112. };
  113. Number.convert = function(item){
  114. var number = parseFloat(item);
  115. return isFinite(number) ? number : null;
  116. };
  117. String.convert = function(item){
  118. return item + '';
  119. };
  120. /*<1.5compat>*/
  121. Array.from = Array.convert;
  122. /*</1.5compat>*/
  123. Function.from = Function.convert;
  124. Number.from = Number.convert;
  125. String.from = String.convert;
  126. // hide, protect
  127. Function.implement({
  128. hide: function(){
  129. this.$hidden = true;
  130. return this;
  131. },
  132. protect: function(){
  133. this.$protected = true;
  134. return this;
  135. }
  136. });
  137. // Type
  138. var Type = this.Type = function(name, object){
  139. if (name){
  140. var lower = name.toLowerCase();
  141. var typeCheck = function(item){
  142. return (typeOf(item) == lower);
  143. };
  144. Type['is' + name] = typeCheck;
  145. if (object != null){
  146. object.prototype.$family = (function(){
  147. return lower;
  148. }).hide();
  149. //<1.2compat>
  150. object.type = typeCheck;
  151. //</1.2compat>
  152. }
  153. }
  154. if (object == null) return null;
  155. object.extend(this);
  156. object.$constructor = Type;
  157. object.prototype.$constructor = object;
  158. return object;
  159. };
  160. var toString = Object.prototype.toString;
  161. Type.isEnumerable = function(item){
  162. return (item != null && typeof item.length == 'number' && toString.call(item) != '[object Function]' );
  163. };
  164. var hooks = {};
  165. var hooksOf = function(object){
  166. var type = typeOf(object.prototype);
  167. return hooks[type] || (hooks[type] = []);
  168. };
  169. var implement = function(name, method){
  170. if (method && method.$hidden) return;
  171. var hooks = hooksOf(this);
  172. for (var i = 0; i < hooks.length; i++){
  173. var hook = hooks[i];
  174. if (typeOf(hook) == 'type') implement.call(hook, name, method);
  175. else hook.call(this, name, method);
  176. }
  177. var previous = this.prototype[name];
  178. if (previous == null || !previous.$protected) this.prototype[name] = method;
  179. if (this[name] == null && typeOf(method) == 'function') extend.call(this, name, function(item){
  180. return method.apply(item, slice.call(arguments, 1));
  181. });
  182. };
  183. var extend = function(name, method){
  184. if (method && method.$hidden) return;
  185. var previous = this[name];
  186. if (previous == null || !previous.$protected) this[name] = method;
  187. };
  188. Type.implement({
  189. implement: implement.overloadSetter(),
  190. extend: extend.overloadSetter(),
  191. alias: function(name, existing){
  192. implement.call(this, name, this.prototype[existing]);
  193. }.overloadSetter(),
  194. mirror: function(hook){
  195. hooksOf(this).push(hook);
  196. return this;
  197. }
  198. });
  199. new Type('Type', Type);
  200. // Default Types
  201. var force = function(name, object, methods){
  202. var isType = (object != Object),
  203. prototype = object.prototype;
  204. if (isType) object = new Type(name, object);
  205. for (var i = 0, l = methods.length; i < l; i++){
  206. var key = methods[i],
  207. generic = object[key],
  208. proto = prototype[key];
  209. if (generic) generic.protect();
  210. if (isType && proto) object.implement(key, proto.protect());
  211. }
  212. if (isType){
  213. var methodsEnumerable = prototype.propertyIsEnumerable(methods[0]);
  214. object.forEachMethod = function(fn){
  215. if (!methodsEnumerable) for (var i = 0, l = methods.length; i < l; i++){
  216. fn.call(prototype, prototype[methods[i]], methods[i]);
  217. }
  218. for (var key in prototype) fn.call(prototype, prototype[key], key);
  219. };
  220. }
  221. return force;
  222. };
  223. force('String', String, [
  224. 'charAt', 'charCodeAt', 'concat', 'contains', 'indexOf', 'lastIndexOf', 'match', 'quote', 'replace', 'search',
  225. 'slice', 'split', 'substr', 'substring', 'trim', 'toLowerCase', 'toUpperCase'
  226. ])('Array', Array, [
  227. 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice',
  228. 'indexOf', 'lastIndexOf', 'filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight', 'contains'
  229. ])('Number', Number, [
  230. 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision'
  231. ])('Function', Function, [
  232. 'apply', 'call', 'bind'
  233. ])('RegExp', RegExp, [
  234. 'exec', 'test'
  235. ])('Object', Object, [
  236. 'create', 'defineProperty', 'defineProperties', 'keys',
  237. 'getPrototypeOf', 'getOwnPropertyDescriptor', 'getOwnPropertyNames',
  238. 'preventExtensions', 'isExtensible', 'seal', 'isSealed', 'freeze', 'isFrozen'
  239. ])('Date', Date, ['now']);
  240. Object.extend = extend.overloadSetter();
  241. Date.extend('now', function(){
  242. return +(new Date);
  243. });
  244. new Type('Boolean', Boolean);
  245. // fixes NaN returning as Number
  246. Number.prototype.$family = function(){
  247. return isFinite(this) ? 'number' : 'null';
  248. }.hide();
  249. // Number.random
  250. Number.extend('random', function(min, max){
  251. return Math.floor(Math.random() * (max - min + 1) + min);
  252. });
  253. // forEach, each, keys
  254. Array.implement({
  255. /*<!ES5>*/
  256. forEach: function(fn, bind){
  257. for (var i = 0, l = this.length; i < l; i++){
  258. if (i in this) fn.call(bind, this[i], i, this);
  259. }
  260. },
  261. /*</!ES5>*/
  262. each: function(fn, bind){
  263. Array.forEach(this, fn, bind);
  264. return this;
  265. }
  266. });
  267. Object.extend({
  268. keys: function(object){
  269. var keys = [];
  270. for (var k in object){
  271. if (hasOwnProperty.call(object, k)) keys.push(k);
  272. }
  273. /*<ltIE8>*/
  274. forEachObjectEnumberableKey(object, function(k){
  275. keys.push(k);
  276. });
  277. /*</ltIE8>*/
  278. return keys;
  279. },
  280. forEach: function(object, fn, bind){
  281. if (object) Object.keys(object).forEach(function(key){
  282. fn.call(bind, object[key], key, object);
  283. });
  284. }
  285. });
  286. Object.each = Object.forEach;
  287. // Array & Object cloning, Object merging and appending
  288. var cloneOf = function(item){
  289. switch (typeOf(item)){
  290. case 'array': return item.clone();
  291. case 'object': return Object.clone(item);
  292. default: return item;
  293. }
  294. };
  295. Array.implement('clone', function(){
  296. var i = this.length, clone = new Array(i);
  297. while (i--) clone[i] = cloneOf(this[i]);
  298. return clone;
  299. });
  300. var mergeOne = function(source, key, current){
  301. switch (typeOf(current)){
  302. case 'object':
  303. if (typeOf(source[key]) == 'object') Object.merge(source[key], current);
  304. else source[key] = Object.clone(current);
  305. break;
  306. case 'array': source[key] = current.clone(); break;
  307. default: source[key] = current;
  308. }
  309. return source;
  310. };
  311. Object.extend({
  312. merge: function(source, k, v){
  313. if (typeOf(k) == 'string') return mergeOne(source, k, v);
  314. for (var i = 1, l = arguments.length; i < l; i++){
  315. var object = arguments[i];
  316. for (var key in object) mergeOne(source, key, object[key]);
  317. }
  318. return source;
  319. },
  320. clone: function(object){
  321. var clone = {};
  322. for (var key in object) clone[key] = cloneOf(object[key]);
  323. return clone;
  324. },
  325. append: function(original){
  326. for (var i = 1, l = arguments.length; i < l; i++){
  327. var extended = arguments[i] || {};
  328. for (var key in extended) original[key] = extended[key];
  329. }
  330. return original;
  331. }
  332. });
  333. // Object-less types
  334. ['Object', 'WhiteSpace', 'TextNode', 'Collection', 'Arguments'].each(function(name){
  335. new Type(name);
  336. });
  337. // Unique ID
  338. var UID = Date.now();
  339. String.extend('uniqueID', function(){
  340. return (UID++).toString(36);
  341. });
  342. //<1.2compat>
  343. var Hash = this.Hash = new Type('Hash', function(object){
  344. if (typeOf(object) == 'hash') object = Object.clone(object.getClean());
  345. for (var key in object) this[key] = object[key];
  346. return this;
  347. });
  348. Hash.implement({
  349. forEach: function(fn, bind){
  350. Object.forEach(this, fn, bind);
  351. },
  352. getClean: function(){
  353. var clean = {};
  354. for (var key in this){
  355. if (this.hasOwnProperty(key)) clean[key] = this[key];
  356. }
  357. return clean;
  358. },
  359. getLength: function(){
  360. var length = 0;
  361. for (var key in this){
  362. if (this.hasOwnProperty(key)) length++;
  363. }
  364. return length;
  365. }
  366. });
  367. Hash.alias('each', 'forEach');
  368. Object.type = Type.isObject;
  369. var Native = this.Native = function(properties){
  370. return new Type(properties.name, properties.initialize);
  371. };
  372. Native.type = Type.type;
  373. Native.implement = function(objects, methods){
  374. for (var i = 0; i < objects.length; i++) objects[i].implement(methods);
  375. return Native;
  376. };
  377. var arrayType = Array.type;
  378. Array.type = function(item){
  379. return instanceOf(item, Array) || arrayType(item);
  380. };
  381. this.$A = function(item){
  382. return Array.convert(item).slice();
  383. };
  384. this.$arguments = function(i){
  385. return function(){
  386. return arguments[i];
  387. };
  388. };
  389. this.$chk = function(obj){
  390. return !!(obj || obj === 0);
  391. };
  392. this.$clear = function(timer){
  393. clearTimeout(timer);
  394. clearInterval(timer);
  395. return null;
  396. };
  397. this.$defined = function(obj){
  398. return (obj != null);
  399. };
  400. this.$each = function(iterable, fn, bind){
  401. var type = typeOf(iterable);
  402. ((type == 'arguments' || type == 'collection' || type == 'array' || type == 'elements') ? Array : Object).each(iterable, fn, bind);
  403. };
  404. this.$empty = function(){};
  405. this.$extend = function(original, extended){
  406. return Object.append(original, extended);
  407. };
  408. this.$H = function(object){
  409. return new Hash(object);
  410. };
  411. this.$merge = function(){
  412. var args = Array.slice(arguments);
  413. args.unshift({});
  414. return Object.merge.apply(null, args);
  415. };
  416. this.$lambda = Function.convert;
  417. this.$mixin = Object.merge;
  418. this.$random = Number.random;
  419. this.$splat = Array.convert;
  420. this.$time = Date.now;
  421. this.$type = function(object){
  422. var type = typeOf(object);
  423. if (type == 'elements') return 'array';
  424. return (type == 'null') ? false : type;
  425. };
  426. this.$unlink = function(object){
  427. switch (typeOf(object)){
  428. case 'object': return Object.clone(object);
  429. case 'array': return Array.clone(object);
  430. case 'hash': return new Hash(object);
  431. default: return object;
  432. }
  433. };
  434. //</1.2compat>
  435. })();
  436. /*
  437. ---
  438. name: Array
  439. description: Contains Array Prototypes like each, contains, and erase.
  440. license: MIT-style license.
  441. requires: [Type]
  442. provides: Array
  443. ...
  444. */
  445. Array.implement({
  446. /*<!ES5>*/
  447. every: function(fn, bind){
  448. for (var i = 0, l = this.length >>> 0; i < l; i++){
  449. if ((i in this) && !fn.call(bind, this[i], i, this)) return false;
  450. }
  451. return true;
  452. },
  453. filter: function(fn, bind){
  454. var results = [];
  455. for (var value, i = 0, l = this.length >>> 0; i < l; i++) if (i in this){
  456. value = this[i];
  457. if (fn.call(bind, value, i, this)) results.push(value);
  458. }
  459. return results;
  460. },
  461. indexOf: function(item, from){
  462. var length = this.length >>> 0;
  463. for (var i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++){
  464. if (this[i] === item) return i;
  465. }
  466. return -1;
  467. },
  468. map: function(fn, bind){
  469. var length = this.length >>> 0, results = Array(length);
  470. for (var i = 0; i < length; i++){
  471. if (i in this) results[i] = fn.call(bind, this[i], i, this);
  472. }
  473. return results;
  474. },
  475. some: function(fn, bind){
  476. for (var i = 0, l = this.length >>> 0; i < l; i++){
  477. if ((i in this) && fn.call(bind, this[i], i, this)) return true;
  478. }
  479. return false;
  480. },
  481. /*</!ES5>*/
  482. clean: function(){
  483. return this.filter(function(item){
  484. return item != null;
  485. });
  486. },
  487. invoke: function(methodName){
  488. var args = Array.slice(arguments, 1);
  489. return this.map(function(item){
  490. return item[methodName].apply(item, args);
  491. });
  492. },
  493. associate: function(keys){
  494. var obj = {}, length = Math.min(this.length, keys.length);
  495. for (var i = 0; i < length; i++) obj[keys[i]] = this[i];
  496. return obj;
  497. },
  498. link: function(object){
  499. var result = {};
  500. for (var i = 0, l = this.length; i < l; i++){
  501. for (var key in object){
  502. if (object[key](this[i])){
  503. result[key] = this[i];
  504. delete object[key];
  505. break;
  506. }
  507. }
  508. }
  509. return result;
  510. },
  511. contains: function(item, from){
  512. return this.indexOf(item, from) != -1;
  513. },
  514. append: function(array){
  515. this.push.apply(this, array);
  516. return this;
  517. },
  518. getLast: function(){
  519. return (this.length) ? this[this.length - 1] : null;
  520. },
  521. getRandom: function(){
  522. return (this.length) ? this[Number.random(0, this.length - 1)] : null;
  523. },
  524. include: function(item){
  525. if (!this.contains(item)) this.push(item);
  526. return this;
  527. },
  528. combine: function(array){
  529. for (var i = 0, l = array.length; i < l; i++) this.include(array[i]);
  530. return this;
  531. },
  532. erase: function(item){
  533. for (var i = this.length; i--;){
  534. if (this[i] === item) this.splice(i, 1);
  535. }
  536. return this;
  537. },
  538. empty: function(){
  539. this.length = 0;
  540. return this;
  541. },
  542. flatten: function(){
  543. var array = [];
  544. for (var i = 0, l = this.length; i < l; i++){
  545. var type = typeOf(this[i]);
  546. if (type == 'null') continue;
  547. array = array.concat((type == 'array' || type == 'collection' || type == 'arguments' || instanceOf(this[i], Array)) ? Array.flatten(this[i]) : this[i]);
  548. }
  549. return array;
  550. },
  551. pick: function(){
  552. for (var i = 0, l = this.length; i < l; i++){
  553. if (this[i] != null) return this[i];
  554. }
  555. return null;
  556. },
  557. hexToRgb: function(array){
  558. if (this.length != 3) return null;
  559. var rgb = this.map(function(value){
  560. if (value.length == 1) value += value;
  561. return parseInt(value, 16);
  562. });
  563. return (array) ? rgb : 'rgb(' + rgb + ')';
  564. },
  565. rgbToHex: function(array){
  566. if (this.length < 3) return null;
  567. if (this.length == 4 && this[3] == 0 && !array) return 'transparent';
  568. var hex = [];
  569. for (var i = 0; i < 3; i++){
  570. var bit = (this[i] - 0).toString(16);
  571. hex.push((bit.length == 1) ? '0' + bit : bit);
  572. }
  573. return (array) ? hex : '#' + hex.join('');
  574. }
  575. });
  576. //<1.2compat>
  577. Array.alias('extend', 'append');
  578. var $pick = this.$pick = function(){
  579. return Array.convert(arguments).pick();
  580. };
  581. //</1.2compat>
  582. /*
  583. ---
  584. name: Function
  585. description: Contains Function Prototypes like create, bind, pass, and delay.
  586. license: MIT-style license.
  587. requires: Type
  588. provides: Function
  589. ...
  590. */
  591. Function.extend({
  592. attempt: function(){
  593. for (var i = 0, l = arguments.length; i < l; i++){
  594. try {
  595. return arguments[i]();
  596. } catch (e){}
  597. }
  598. return null;
  599. }
  600. });
  601. Function.implement({
  602. attempt: function(args, bind){
  603. try {
  604. return this.apply(bind, Array.convert(args));
  605. } catch (e){}
  606. return null;
  607. },
  608. /*<!ES5-bind>*/
  609. bind: function(that){
  610. var self = this,
  611. args = arguments.length > 1 ? Array.slice(arguments, 1) : null,
  612. F = function(){};
  613. var bound = function(){
  614. var context = that, length = arguments.length;
  615. if (this instanceof bound){
  616. F.prototype = self.prototype;
  617. context = new F;
  618. }
  619. var result = (!args && !length)
  620. ? self.call(context)
  621. : self.apply(context, args && length ? args.concat(Array.slice(arguments)) : args || arguments);
  622. return context == that ? result : context;
  623. };
  624. return bound;
  625. },
  626. /*</!ES5-bind>*/
  627. pass: function(args, bind){
  628. var self = this;
  629. if (args != null) args = Array.convert(args);
  630. return function(){
  631. return self.apply(bind, args || arguments);
  632. };
  633. },
  634. delay: function(delay, bind, args){
  635. return setTimeout(this.pass((args == null ? [] : args), bind), delay);
  636. },
  637. periodical: function(periodical, bind, args){
  638. return setInterval(this.pass((args == null ? [] : args), bind), periodical);
  639. }
  640. });
  641. //<1.2compat>
  642. //delete Function.prototype.bind;
  643. Function.implement({
  644. create: function(options){
  645. var self = this;
  646. options = options || {};
  647. return function(event){
  648. var args = options.arguments;
  649. args = (args != null) ? Array.convert(args) : Array.slice(arguments, (options.event) ? 1 : 0);
  650. if (options.event) args.unshift(event || window.event);
  651. var returns = function(){
  652. return self.apply(options.bind || null, args);
  653. };
  654. if (options.delay) return setTimeout(returns, options.delay);
  655. if (options.periodical) return setInterval(returns, options.periodical);
  656. if (options.attempt) return Function.attempt(returns);
  657. return returns();
  658. };
  659. },
  660. // bind: function(bind, args){
  661. // var self = this;
  662. // if (args != null) args = Array.convert(args);
  663. // return function(){
  664. // return self.apply(bind, args || arguments);
  665. // };
  666. // },
  667. bindWithEvent: function(bind, args){
  668. var self = this;
  669. if (args != null) args = Array.convert(args);
  670. return function(event){
  671. return self.apply(bind, (args == null) ? arguments : [event].concat(args));
  672. };
  673. },
  674. run: function(args, bind){
  675. return this.apply(bind, Array.convert(args));
  676. }
  677. });
  678. if (Object.create == Function.prototype.create) Object.create = null;
  679. var $try = Function.attempt;
  680. //</1.2compat>
  681. /*
  682. ---
  683. name: Number
  684. description: Contains Number Prototypes like limit, round, times, and ceil.
  685. license: MIT-style license.
  686. requires: Type
  687. provides: Number
  688. ...
  689. */
  690. Number.implement({
  691. limit: function(min, max){
  692. return Math.min(max, Math.max(min, this));
  693. },
  694. round: function(precision){
  695. precision = Math.pow(10, precision || 0).toFixed(precision < 0 ? -precision : 0);
  696. return Math.round(this * precision) / precision;
  697. },
  698. times: function(fn, bind){
  699. for (var i = 0; i < this; i++) fn.call(bind, i, this);
  700. },
  701. toFloat: function(){
  702. return parseFloat(this);
  703. },
  704. toInt: function(base){
  705. return parseInt(this, base || 10);
  706. }
  707. });
  708. Number.alias('each', 'times');
  709. (function(math){
  710. var methods = {};
  711. math.each(function(name){
  712. if (!Number[name]) methods[name] = function(){
  713. return Math[name].apply(null, [this].concat(Array.convert(arguments)));
  714. };
  715. });
  716. Number.implement(methods);
  717. })(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']);
  718. /*
  719. ---
  720. name: String
  721. description: Contains String Prototypes like camelCase, capitalize, test, and toInt.
  722. license: MIT-style license.
  723. requires: [Type, Array]
  724. provides: String
  725. ...
  726. */
  727. String.implement({
  728. //<!ES6>
  729. contains: function(string, index){
  730. return (index ? String(this).slice(index) : String(this)).indexOf(string) > -1;
  731. },
  732. //</!ES6>
  733. test: function(regex, params){
  734. return ((typeOf(regex) == 'regexp') ? regex : new RegExp('' + regex, params)).test(this);
  735. },
  736. trim: function(){
  737. return String(this).replace(/^\s+|\s+$/g, '');
  738. },
  739. clean: function(){
  740. return String(this).replace(/\s+/g, ' ').trim();
  741. },
  742. camelCase: function(){
  743. return String(this).replace(/-\D/g, function(match){
  744. return match.charAt(1).toUpperCase();
  745. });
  746. },
  747. hyphenate: function(){
  748. return String(this).replace(/[A-Z]/g, function(match){
  749. return ('-' + match.charAt(0).toLowerCase());
  750. });
  751. },
  752. capitalize: function(){
  753. return String(this).replace(/\b[a-z]/g, function(match){
  754. return match.toUpperCase();
  755. });
  756. },
  757. escapeRegExp: function(){
  758. return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1');
  759. },
  760. toInt: function(base){
  761. return parseInt(this, base || 10);
  762. },
  763. toFloat: function(){
  764. return parseFloat(this);
  765. },
  766. hexToRgb: function(array){
  767. var hex = String(this).match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
  768. return (hex) ? hex.slice(1).hexToRgb(array) : null;
  769. },
  770. rgbToHex: function(array){
  771. var rgb = String(this).match(/\d{1,3}/g);
  772. return (rgb) ? rgb.rgbToHex(array) : null;
  773. },
  774. substitute: function(object, regexp){
  775. return String(this).replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){
  776. if (match.charAt(0) == '\\') return match.slice(1);
  777. return (object[name] != null) ? object[name] : '';
  778. });
  779. }
  780. });
  781. //<1.4compat>
  782. String.prototype.contains = function(string, separator){
  783. return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : String(this).indexOf(string) > -1;
  784. };
  785. //</1.4compat>
  786. /*
  787. ---
  788. name: Browser
  789. description: The Browser Object. Contains Browser initialization, Window and Document, and the Browser Hash.
  790. license: MIT-style license.
  791. requires: [Array, Function, Number, String]
  792. provides: [Browser, Window, Document]
  793. ...
  794. */
  795. (function(){
  796. var document = this.document;
  797. var window = document.window = this;
  798. var parse = function(ua, platform){
  799. ua = ua.toLowerCase();
  800. platform = (platform ? platform.toLowerCase() : '');
  801. // chrome is included in the edge UA, so need to check for edge first,
  802. // before checking if it's chrome.
  803. var UA = ua.match(/(edge)[\s\/:]([\w\d\.]+)/);
  804. if (!UA){
  805. UA = ua.match(/(opera|ie|firefox|chrome|trident|crios|version)[\s\/:]([\w\d\.]+)?.*?(safari|(?:rv[\s\/:]|version[\s\/:])([\w\d\.]+)|$)/) || [null, 'unknown', 0];
  806. }
  807. if (UA[1] == 'trident'){
  808. UA[1] = 'ie';
  809. if (UA[4]) UA[2] = UA[4];
  810. } else if (UA[1] == 'crios'){
  811. UA[1] = 'chrome';
  812. }
  813. platform = ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android)/) || ua.match(/mac|win|linux/) || ['other'])[0];
  814. if (platform == 'win') platform = 'windows';
  815. return {
  816. extend: Function.prototype.extend,
  817. name: (UA[1] == 'version') ? UA[3] : UA[1],
  818. version: parseFloat((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]),
  819. platform: platform
  820. };
  821. };
  822. var Browser = this.Browser = parse(navigator.userAgent, navigator.platform);
  823. if (Browser.name == 'ie' && document.documentMode){
  824. Browser.version = document.documentMode;
  825. }
  826. Browser.extend({
  827. Features: {
  828. xpath: !!(document.evaluate),
  829. air: !!(window.runtime),
  830. query: !!(document.querySelector),
  831. json: !!(window.JSON)
  832. },
  833. parseUA: parse
  834. });
  835. //<1.4compat>
  836. Browser[Browser.name] = true;
  837. Browser[Browser.name + parseInt(Browser.version, 10)] = true;
  838. if (Browser.name == 'ie' && Browser.version >= '11'){
  839. delete Browser.ie;
  840. }
  841. var platform = Browser.platform;
  842. if (platform == 'windows'){
  843. platform = 'win';
  844. }
  845. Browser.Platform = {
  846. name: platform
  847. };
  848. Browser.Platform[platform] = true;
  849. //</1.4compat>
  850. // Request
  851. Browser.Request = (function(){
  852. var XMLHTTP = function(){
  853. return new XMLHttpRequest();
  854. };
  855. var MSXML2 = function(){
  856. return new ActiveXObject('MSXML2.XMLHTTP');
  857. };
  858. var MSXML = function(){
  859. return new ActiveXObject('Microsoft.XMLHTTP');
  860. };
  861. return Function.attempt(function(){
  862. XMLHTTP();
  863. return XMLHTTP;
  864. }, function(){
  865. MSXML2();
  866. return MSXML2;
  867. }, function(){
  868. MSXML();
  869. return MSXML;
  870. });
  871. })();
  872. Browser.Features.xhr = !!(Browser.Request);
  873. //<1.4compat>
  874. // Flash detection
  875. var version = (Function.attempt(function(){
  876. return navigator.plugins['Shockwave Flash'].description;
  877. }, function(){
  878. return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
  879. }) || '0 r0').match(/\d+/g);
  880. Browser.Plugins = {
  881. Flash: {
  882. version: Number(version[0] || '0.' + version[1]) || 0,
  883. build: Number(version[2]) || 0
  884. }
  885. };
  886. //</1.4compat>
  887. // String scripts
  888. Browser.exec = function(text){
  889. if (!text) return text;
  890. if (window.execScript){
  891. window.execScript(text);
  892. } else {
  893. var script = document.createElement('script');
  894. script.setAttribute('type', 'text/javascript');
  895. script.text = text;
  896. document.head.appendChild(script);
  897. document.head.removeChild(script);
  898. }
  899. return text;
  900. };
  901. String.implement('stripScripts', function(exec){
  902. var scripts = '';
  903. var text = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(all, code){
  904. scripts += code + '\n';
  905. return '';
  906. });
  907. if (exec === true) Browser.exec(scripts);
  908. else if (typeOf(exec) == 'function') exec(scripts, text);
  909. return text;
  910. });
  911. // Window, Document
  912. Browser.extend({
  913. Document: this.Document,
  914. Window: this.Window,
  915. Element: this.Element,
  916. Event: this.Event
  917. });
  918. this.Window = this.$constructor = new Type('Window', function(){});
  919. this.$family = Function.convert('window').hide();
  920. Window.mirror(function(name, method){
  921. window[name] = method;
  922. });
  923. this.Document = document.$constructor = new Type('Document', function(){});
  924. document.$family = Function.convert('document').hide();
  925. Document.mirror(function(name, method){
  926. document[name] = method;
  927. });
  928. document.html = document.documentElement;
  929. if (!document.head) document.head = document.getElementsByTagName('head')[0];
  930. if (document.execCommand) try {
  931. document.execCommand('BackgroundImageCache', false, true);
  932. } catch (e){}
  933. /*<ltIE9>*/
  934. if (this.attachEvent && !this.addEventListener){
  935. var unloadEvent = function(){
  936. this.detachEvent('onunload', unloadEvent);
  937. document.head = document.html = document.window = null;
  938. window = this.Window = document = null;
  939. };
  940. this.attachEvent('onunload', unloadEvent);
  941. }
  942. // IE fails on collections and <select>.options (refers to <select>)
  943. var arrayFrom = Array.convert;
  944. try {
  945. arrayFrom(document.html.childNodes);
  946. } catch (e){
  947. Array.convert = function(item){
  948. if (typeof item != 'string' && Type.isEnumerable(item) && typeOf(item) != 'array'){
  949. var i = item.length, array = new Array(i);
  950. while (i--) array[i] = item[i];
  951. return array;
  952. }
  953. return arrayFrom(item);
  954. };
  955. var prototype = Array.prototype,
  956. slice = prototype.slice;
  957. ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice'].each(function(name){
  958. var method = prototype[name];
  959. Array[name] = function(item){
  960. return method.apply(Array.convert(item), slice.call(arguments, 1));
  961. };
  962. });
  963. }
  964. /*</ltIE9>*/
  965. //<1.2compat>
  966. if (Browser.Platform.ios) Browser.Platform.ipod = true;
  967. Browser.Engine = {};
  968. var setEngine = function(name, version){
  969. Browser.Engine.name = name;
  970. Browser.Engine[name + version] = true;
  971. Browser.Engine.version = version;
  972. };
  973. if (Browser.ie){
  974. Browser.Engine.trident = true;
  975. switch (Browser.version){
  976. case 6: setEngine('trident', 4); break;
  977. case 7: setEngine('trident', 5); break;
  978. case 8: setEngine('trident', 6);
  979. }
  980. }
  981. if (Browser.firefox){
  982. Browser.Engine.gecko = true;
  983. if (Browser.version >= 3) setEngine('gecko', 19);
  984. else setEngine('gecko', 18);
  985. }
  986. if (Browser.safari || Browser.chrome){
  987. Browser.Engine.webkit = true;
  988. switch (Browser.version){
  989. case 2: setEngine('webkit', 419); break;
  990. case 3: setEngine('webkit', 420); break;
  991. case 4: setEngine('webkit', 525);
  992. }
  993. }
  994. if (Browser.opera){
  995. Browser.Engine.presto = true;
  996. if (Browser.version >= 9.6) setEngine('presto', 960);
  997. else if (Browser.version >= 9.5) setEngine('presto', 950);
  998. else setEngine('presto', 925);
  999. }
  1000. if (Browser.name == 'unknown'){
  1001. switch ((navigator.userAgent.toLowerCase().match(/(?:webkit|khtml|gecko)/) || [])[0]){
  1002. case 'webkit':
  1003. case 'khtml':
  1004. Browser.Engine.webkit = true;
  1005. break;
  1006. case 'gecko':
  1007. Browser.Engine.gecko = true;
  1008. }
  1009. }
  1010. this.$exec = Browser.exec;
  1011. //</1.2compat>
  1012. })();
  1013. /*
  1014. ---
  1015. name: Class
  1016. description: Contains the Class Function for easily creating, extending, and implementing reusable Classes.
  1017. license: MIT-style license.
  1018. requires: [Array, String, Function, Number]
  1019. provides: Class
  1020. ...
  1021. */
  1022. (function(){
  1023. var Class = this.Class = new Type('Class', function(params){
  1024. if (instanceOf(params, Function)) params = {initialize: params};
  1025. var newClass = function(){
  1026. reset(this);
  1027. if (newClass.$prototyping) return this;
  1028. this.$caller = null;
  1029. this.$family = null;
  1030. var value = (this.initialize) ? this.initialize.apply(this, arguments) : this;
  1031. this.$caller = this.caller = null;
  1032. return value;
  1033. }.extend(this).implement(params);
  1034. newClass.$constructor = Class;
  1035. newClass.prototype.$constructor = newClass;
  1036. newClass.prototype.parent = parent;
  1037. return newClass;
  1038. });
  1039. var parent = function(){
  1040. if (!this.$caller) throw new Error('The method "parent" cannot be called.');
  1041. var name = this.$caller.$name,
  1042. parent = this.$caller.$owner.parent,
  1043. previous = (parent) ? parent.prototype[name] : null;
  1044. if (!previous) throw new Error('The method "' + name + '" has no parent.');
  1045. return previous.apply(this, arguments);
  1046. };
  1047. var reset = function(object){
  1048. for (var key in object){
  1049. var value = object[key];
  1050. switch (typeOf(value)){
  1051. case 'object':
  1052. var F = function(){};
  1053. F.prototype = value;
  1054. object[key] = reset(new F);
  1055. break;
  1056. case 'array': object[key] = value.clone(); break;
  1057. }
  1058. }
  1059. return object;
  1060. };
  1061. var wrap = function(self, key, method){
  1062. if (method.$origin) method = method.$origin;
  1063. var wrapper = function(){
  1064. if (method.$protected && this.$caller == null) throw new Error('The method "' + key + '" cannot be called.');
  1065. var caller = this.caller, current = this.$caller;
  1066. this.caller = current; this.$caller = wrapper;
  1067. var result = method.apply(this, arguments);
  1068. this.$caller = current; this.caller = caller;
  1069. return result;
  1070. }.extend({$owner: self, $origin: method, $name: key});
  1071. return wrapper;
  1072. };
  1073. var implement = function(key, value, retain){
  1074. if (Class.Mutators.hasOwnProperty(key)){
  1075. value = Class.Mutators[key].call(this, value);
  1076. if (value == null) return this;
  1077. }
  1078. if (typeOf(value) == 'function'){
  1079. if (value.$hidden) return this;
  1080. this.prototype[key] = (retain) ? value : wrap(this, key, value);
  1081. } else {
  1082. Object.merge(this.prototype, key, value);
  1083. }
  1084. return this;
  1085. };
  1086. var getInstance = function(klass){
  1087. klass.$prototyping = true;
  1088. var proto = new klass;
  1089. delete klass.$prototyping;
  1090. return proto;
  1091. };
  1092. Class.implement('implement', implement.overloadSetter());
  1093. Class.Mutators = {
  1094. Extends: function(parent){
  1095. this.parent = parent;
  1096. this.prototype = getInstance(parent);
  1097. },
  1098. Implements: function(items){
  1099. Array.convert(items).each(function(item){
  1100. var instance = new item;
  1101. for (var key in instance) implement.call(this, key, instance[key], true);
  1102. }, this);
  1103. }
  1104. };
  1105. })();
  1106. /*
  1107. ---
  1108. name: Class.Extras
  1109. description: Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks.
  1110. license: MIT-style license.
  1111. requires: Class
  1112. provides: [Class.Extras, Chain, Events, Options]
  1113. ...
  1114. */
  1115. (function(){
  1116. this.Chain = new Class({
  1117. $chain: [],
  1118. chain: function(){
  1119. this.$chain.append(Array.flatten(arguments));
  1120. return this;
  1121. },
  1122. callChain: function(){
  1123. return (this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false;
  1124. },
  1125. clearChain: function(){
  1126. this.$chain.empty();
  1127. return this;
  1128. }
  1129. });
  1130. var removeOn = function(string){
  1131. return string.replace(/^on([A-Z])/, function(full, first){
  1132. return first.toLowerCase();
  1133. });
  1134. };
  1135. this.Events = new Class({
  1136. $events: {},
  1137. addEvent: function(type, fn, internal){
  1138. type = removeOn(type);
  1139. /*<1.2compat>*/
  1140. if (fn == $empty) return this;
  1141. /*</1.2compat>*/
  1142. this.$events[type] = (this.$events[type] || []).include(fn);
  1143. if (internal) fn.internal = true;
  1144. return this;
  1145. },
  1146. addEvents: function(events){
  1147. for (var type in events) this.addEvent(type, events[type]);
  1148. return this;
  1149. },
  1150. fireEvent: function(type, args, delay){
  1151. type = removeOn(type);
  1152. var events = this.$events[type];
  1153. if (!events) return this;
  1154. args = Array.convert(args);
  1155. events.each(function(fn){
  1156. if (delay) fn.delay(delay, this, args);
  1157. else fn.apply(this, args);
  1158. }, this);
  1159. return this;
  1160. },
  1161. removeEvent: function(type, fn){
  1162. type = removeOn(type);
  1163. var events = this.$events[type];
  1164. if (events && !fn.internal){
  1165. var index = events.indexOf(fn);
  1166. if (index != -1) delete events[index];
  1167. }
  1168. return this;
  1169. },
  1170. removeEvents: function(events){
  1171. var type;
  1172. if (typeOf(events) == 'object'){
  1173. for (type in events) this.removeEvent(type, events[type]);
  1174. return this;
  1175. }
  1176. if (events) events = removeOn(events);
  1177. for (type in this.$events){
  1178. if (events && events != type) continue;
  1179. var fns = this.$events[type];
  1180. for (var i = fns.length; i--;) if (i in fns){
  1181. this.removeEvent(type, fns[i]);
  1182. }
  1183. }
  1184. return this;
  1185. }
  1186. });
  1187. this.Options = new Class({
  1188. setOptions: function(){
  1189. var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments));
  1190. if (this.addEvent) for (var option in options){
  1191. if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue;
  1192. this.addEvent(option, options[option]);
  1193. delete options[option];
  1194. }
  1195. return this;
  1196. }
  1197. });
  1198. })();
  1199. /*
  1200. ---
  1201. name: Class.Thenable
  1202. description: Contains a Utility Class that can be implemented into your own Classes to make them "thenable".
  1203. license: MIT-style license.
  1204. requires: Class
  1205. provides: [Class.Thenable]
  1206. ...
  1207. */
  1208. (function(){
  1209. var STATE_PENDING = 0,
  1210. STATE_FULFILLED = 1,
  1211. STATE_REJECTED = 2;
  1212. var Thenable = Class.Thenable = new Class({
  1213. $thenableState: STATE_PENDING,
  1214. $thenableResult: null,
  1215. $thenableReactions: [],
  1216. resolve: function(value){
  1217. resolve(this, value);
  1218. return this;
  1219. },
  1220. reject: function(reason){
  1221. reject(this, reason);
  1222. return this;
  1223. },
  1224. getThenableState: function(){
  1225. switch (this.$thenableState){
  1226. case STATE_PENDING:
  1227. return 'pending';
  1228. case STATE_FULFILLED:
  1229. return 'fulfilled';
  1230. case STATE_REJECTED:
  1231. return 'rejected';
  1232. }
  1233. },
  1234. resetThenable: function(reason){
  1235. reject(this, reason);
  1236. reset(this);
  1237. return this;
  1238. },
  1239. then: function(onFulfilled, onRejected){
  1240. if (typeof onFulfilled !== 'function') onFulfilled = 'Identity';
  1241. if (typeof onRejected !== 'function') onRejected = 'Thrower';
  1242. var thenable = new Thenable();
  1243. this.$thenableReactions.push({
  1244. thenable: thenable,
  1245. fulfillHandler: onFulfilled,
  1246. rejectHandler: onRejected
  1247. });
  1248. if (this.$thenableState !== STATE_PENDING){
  1249. react(this);
  1250. }
  1251. return thenable;
  1252. },
  1253. 'catch': function(onRejected){
  1254. return this.then(null, onRejected);
  1255. }
  1256. });
  1257. Thenable.extend({
  1258. resolve: function(value){
  1259. var thenable;
  1260. if (value instanceof Thenable){
  1261. thenable = value;
  1262. } else {
  1263. thenable = new Thenable();
  1264. resolve(thenable, value);
  1265. }
  1266. return thenable;
  1267. },
  1268. reject: function(reason){
  1269. var thenable = new Thenable();
  1270. reject(thenable, reason);
  1271. return thenable;
  1272. }
  1273. });
  1274. // Private functions
  1275. function resolve(thenable, value){
  1276. if (thenable.$thenableState === STATE_PENDING){
  1277. if (thenable === value){
  1278. reject(thenable, new TypeError('Tried to resolve a thenable with itself.'));
  1279. } else if (value && (typeof value === 'object' || typeof value === 'function')){
  1280. var then;
  1281. try {
  1282. then = value.then;
  1283. } catch (exception){
  1284. reject(thenable, exception);
  1285. }
  1286. if (typeof then === 'function'){
  1287. var resolved = false;
  1288. defer(function(){
  1289. try {
  1290. then.call(
  1291. value,
  1292. function(nextValue){
  1293. if (!resolved){
  1294. resolved = true;
  1295. resolve(thenable, nextValue);
  1296. }
  1297. },
  1298. function(reason){
  1299. if (!resolved){
  1300. resolved = true;
  1301. reject(thenable, reason);
  1302. }
  1303. }
  1304. );
  1305. } catch (exception){
  1306. if (!resolved){
  1307. resolved = true;
  1308. reject(thenable, exception);
  1309. }
  1310. }
  1311. });
  1312. } else {
  1313. fulfill(thenable, value);
  1314. }
  1315. } else {
  1316. fulfill(thenable, value);
  1317. }
  1318. }
  1319. }
  1320. function fulfill(thenable, value){
  1321. if (thenable.$thenableState === STATE_PENDING){
  1322. thenable.$thenableResult = value;
  1323. thenable.$thenableState = STATE_FULFILLED;
  1324. react(thenable);
  1325. }
  1326. }
  1327. function reject(thenable, reason){
  1328. if (thenable.$thenableState === STATE_PENDING){
  1329. thenable.$thenableResult = reason;
  1330. thenable.$thenableState = STATE_REJECTED;
  1331. react(thenable);
  1332. }
  1333. }
  1334. function reset(thenable){
  1335. if (thenable.$thenableState !== STATE_PENDING){
  1336. thenable.$thenableResult = null;
  1337. thenable.$thenableState = STATE_PENDING;
  1338. }
  1339. }
  1340. function react(thenable){
  1341. var state = thenable.$thenableState,
  1342. result = thenable.$thenableResult,
  1343. reactions = thenable.$thenableReactions,
  1344. type;
  1345. if (state === STATE_FULFILLED){
  1346. thenable.$thenableReactions = [];
  1347. type = 'fulfillHandler';
  1348. } else if (state == STATE_REJECTED){
  1349. thenable.$thenableReactions = [];
  1350. type = 'rejectHandler';
  1351. }
  1352. if (type){
  1353. defer(handle.pass([result, reactions, type]));
  1354. }
  1355. }
  1356. function handle(result, reactions, type){
  1357. for (var i = 0, l = reactions.length; i < l; ++i){
  1358. var reaction = reactions[i],
  1359. handler = reaction[type];
  1360. if (handler === 'Identity'){
  1361. resolve(reaction.thenable, result);
  1362. } else if (handler === 'Thrower'){
  1363. reject(reaction.thenable, result);
  1364. } else {
  1365. try {
  1366. resolve(reaction.thenable, handler(result));
  1367. } catch (exception){
  1368. reject(reaction.thenable, exception);
  1369. }
  1370. }
  1371. }
  1372. }
  1373. var defer;
  1374. if (typeof process !== 'undefined' && typeof process.nextTick === 'function'){
  1375. defer = process.nextTick;
  1376. } else if (typeof setImmediate !== 'undefined'){
  1377. defer = setImmediate;
  1378. } else {
  1379. defer = function(fn){
  1380. setTimeout(fn, 0);
  1381. };
  1382. }
  1383. })();
  1384. /*
  1385. ---
  1386. name: Object
  1387. description: Object generic methods
  1388. license: MIT-style license.
  1389. requires: Type
  1390. provides: [Object, Hash]
  1391. ...
  1392. */
  1393. (function(){
  1394. Object.extend({
  1395. subset: function(object, keys){
  1396. var results = {};
  1397. for (var i = 0, l = keys.length; i < l; i++){
  1398. var k = keys[i];
  1399. if (k in object) results[k] = object[k];
  1400. }
  1401. return results;
  1402. },
  1403. map: function(object, fn, bind){
  1404. var results = {};
  1405. var keys = Object.keys(object);
  1406. for (var i = 0; i < keys.length; i++){
  1407. var key = keys[i];
  1408. results[key] = fn.call(bind, object[key], key, object);
  1409. }
  1410. return results;
  1411. },
  1412. filter: function(object, fn, bind){
  1413. var results = {};
  1414. var keys = Object.keys(object);
  1415. for (var i = 0; i < keys.length; i++){
  1416. var key = keys[i], value = object[key];
  1417. if (fn.call(bind, value, key, object)) results[key] = value;
  1418. }
  1419. return results;
  1420. },
  1421. every: function(object, fn, bind){
  1422. var keys = Object.keys(object);
  1423. for (var i = 0; i < keys.length; i++){
  1424. var key = keys[i];
  1425. if (!fn.call(bind, object[key], key)) return false;
  1426. }
  1427. return true;
  1428. },
  1429. some: function(object, fn, bind){
  1430. var keys = Object.keys(object);
  1431. for (var i = 0; i < keys.length; i++){
  1432. var key = keys[i];
  1433. if (fn.call(bind, object[key], key)) return true;
  1434. }
  1435. return false;
  1436. },
  1437. values: function(object){
  1438. var values = [];
  1439. var keys = Object.keys(object);
  1440. for (var i = 0; i < keys.length; i++){
  1441. var k = keys[i];
  1442. values.push(object[k]);
  1443. }
  1444. return values;
  1445. },
  1446. getLength: function(object){
  1447. return Object.keys(object).length;
  1448. },
  1449. keyOf: function(object, value){
  1450. var keys = Object.keys(object);
  1451. for (var i = 0; i < keys.length; i++){
  1452. var key = keys[i];
  1453. if (object[key] === value) return key;
  1454. }
  1455. return null;
  1456. },
  1457. contains: function(object, value){
  1458. return Object.keyOf(object, value) != null;
  1459. },
  1460. toQueryString: function(object, base){
  1461. var queryString = [];
  1462. Object.each(object, function(value, key){
  1463. if (base) key = base + '[' + key + ']';
  1464. var result;
  1465. switch (typeOf(value)){
  1466. case 'object': result = Object.toQueryString(value, key); break;
  1467. case 'array':
  1468. var qs = {};
  1469. value.each(function(val, i){
  1470. qs[i] = val;
  1471. });
  1472. result = Object.toQueryString(qs, key);
  1473. break;
  1474. default: result = key + '=' + encodeURIComponent(value);
  1475. }
  1476. if (value != null) queryString.push(result);
  1477. });
  1478. return queryString.join('&');
  1479. }
  1480. });
  1481. })();
  1482. //<1.2compat>
  1483. Hash.implement({
  1484. has: Object.prototype.hasOwnProperty,
  1485. keyOf: function(value){
  1486. return Object.keyOf(this, value);
  1487. },
  1488. hasValue: function(value){
  1489. return Object.contains(this, value);
  1490. },
  1491. extend: function(properties){
  1492. Hash.each(properties || {}, function(value, key){
  1493. Hash.set(this, key, value);
  1494. }, this);
  1495. return this;
  1496. },
  1497. combine: function(properties){
  1498. Hash.each(properties || {}, function(value, key){
  1499. Hash.include(this, key, value);
  1500. }, this);
  1501. return this;
  1502. },
  1503. erase: function(key){
  1504. if (this.hasOwnProperty(key)) delete this[key];
  1505. return this;
  1506. },
  1507. get: function(key){
  1508. return (this.hasOwnProperty(key)) ? this[key] : null;
  1509. },
  1510. set: function(key, value){
  1511. if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
  1512. return this;
  1513. },
  1514. empty: function(){
  1515. Hash.each(this, function(value, key){
  1516. delete this[key];
  1517. }, this);
  1518. return this;
  1519. },
  1520. include: function(key, value){
  1521. if (this[key] == null) this[key] = value;
  1522. return this;
  1523. },
  1524. map: function(fn, bind){
  1525. return new Hash(Object.map(this, fn, bind));
  1526. },
  1527. filter: function(fn, bind){
  1528. return new Hash(Object.filter(this, fn, bind));
  1529. },
  1530. every: function(fn, bind){
  1531. return Object.every(this, fn, bind);
  1532. },
  1533. some: function(fn, bind){
  1534. return Object.some(this, fn, bind);
  1535. },
  1536. getKeys: function(){
  1537. return Object.keys(this);
  1538. },
  1539. getValues: function(){
  1540. return Object.values(this);
  1541. },
  1542. toQueryString: function(base){
  1543. return Object.toQueryString(this, base);
  1544. }
  1545. });
  1546. Hash.extend = Object.append;
  1547. Hash.alias({indexOf: 'keyOf', contains: 'hasValue'});
  1548. //</1.2compat>
  1549. /*
  1550. ---
  1551. name: Slick.Parser
  1552. description: Standalone CSS3 Selector parser
  1553. provides: Slick.Parser
  1554. ...
  1555. */
  1556. ;(function(){
  1557. var parsed,
  1558. separatorIndex,
  1559. combinatorIndex,
  1560. reversed,
  1561. cache = {},
  1562. reverseCache = {},
  1563. reUnescape = /\\/g;
  1564. var parse = function(expression, isReversed){
  1565. if (expression == null) return null;
  1566. if (expression.Slick === true) return expression;
  1567. expression = ('' + expression).replace(/^\s+|\s+$/g, '');
  1568. reversed = !!isReversed;
  1569. var currentCache = (reversed) ? reverseCache : cache;
  1570. if (currentCache[expression]) return currentCache[expression];
  1571. parsed = {
  1572. Slick: true,
  1573. expressions: [],
  1574. raw: expression,
  1575. reverse: function(){
  1576. return parse(this.raw, true);
  1577. }
  1578. };
  1579. separatorIndex = -1;
  1580. while (expression != (expression = expression.replace(regexp, parser)));
  1581. parsed.length = parsed.expressions.length;
  1582. return currentCache[parsed.raw] = (reversed) ? reverse(parsed) : parsed;
  1583. };
  1584. var reverseCombinator = function(combinator){
  1585. if (combinator === '!') return ' ';
  1586. else if (combinator === ' ') return '!';
  1587. else if ((/^!/).test(combinator)) return combinator.replace(/^!/, '');
  1588. else return '!' + combinator;
  1589. };
  1590. var reverse = function(expression){
  1591. var expressions = expression.expressions;
  1592. for (var i = 0; i < expressions.length; i++){
  1593. var exp = expressions[i];
  1594. var last = {parts: [], tag: '*', combinator: reverseCombinator(exp[0].combinator)};
  1595. for (var j = 0; j < exp.length; j++){
  1596. var cexp = exp[j];
  1597. if (!cexp.reverseCombinator) cexp.reverseCombinator = ' ';
  1598. cexp.combinator = cexp.reverseCombinator;
  1599. delete cexp.reverseCombinator;
  1600. }
  1601. exp.reverse().push(last);
  1602. }
  1603. return expression;
  1604. };
  1605. var escapeRegExp = function(string){// Credit: XRegExp 0.6.1 (c) 2007-2008 Steven Levithan <http://stevenlevithan.com/regex/xregexp/> MIT License
  1606. return string.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, function(match){
  1607. return '\\' + match;
  1608. });
  1609. };
  1610. var regexp = new RegExp(
  1611. /*
  1612. #!/usr/bin/env ruby
  1613. puts "\t\t" + DATA.read.gsub(/\(\?x\)|\s+#.*$|\s+|\\$|\\n/,'')
  1614. __END__
  1615. "(?x)^(?:\
  1616. \\s* ( , ) \\s* # Separator \n\
  1617. | \\s* ( <combinator>+ ) \\s* # Combinator \n\
  1618. | ( \\s+ ) # CombinatorChildren \n\
  1619. | ( <unicode>+ | \\* ) # Tag \n\
  1620. | \\# ( <unicode>+ ) # ID \n\
  1621. | \\. ( <unicode>+ ) # ClassName \n\
  1622. | # Attribute \n\
  1623. \\[ \
  1624. \\s* (<unicode1>+) (?: \
  1625. \\s* ([*^$!~|]?=) (?: \
  1626. \\s* (?:\
  1627. ([\"']?)(.*?)\\9 \
  1628. )\
  1629. ) \
  1630. )? \\s* \
  1631. \\](?!\\]) \n\
  1632. | :+ ( <unicode>+ )(?:\
  1633. \\( (?:\
  1634. (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\
  1635. ) \\)\
  1636. )?\
  1637. )"
  1638. */
  1639. "^(?:\\s*(,)\\s*|\\s*(<combinator>+)\\s*|(\\s+)|(<unicode>+|\\*)|\\#(<unicode>+)|\\.(<unicode>+)|\\[\\s*(<unicode1>+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(<unicode>+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)"
  1640. .replace(/<combinator>/, '[' + escapeRegExp('>+~`!@$%^&={}\\;</') + ']')
  1641. .replace(/<unicode>/g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])')
  1642. .replace(/<unicode1>/g, '(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])')
  1643. );
  1644. function parser(
  1645. rawMatch,
  1646. separator,
  1647. combinator,
  1648. combinatorChildren,
  1649. tagName,
  1650. id,
  1651. className,
  1652. attributeKey,
  1653. attributeOperator,
  1654. attributeQuote,
  1655. attributeValue,
  1656. pseudoMarker,
  1657. pseudoClass,
  1658. pseudoQuote,
  1659. pseudoClassQuotedValue,
  1660. pseudoClassValue
  1661. ){
  1662. if (separator || separatorIndex === -1){
  1663. parsed.expressions[++separatorIndex] = [];
  1664. combinatorIndex = -1;
  1665. if (separator) return '';
  1666. }
  1667. if (combinator || combinatorChildren || combinatorIndex === -1){
  1668. combinator = combinator || ' ';
  1669. var currentSeparator = parsed.expressions[separatorIndex];
  1670. if (reversed && currentSeparator[combinatorIndex])
  1671. currentSeparator[combinatorIndex].reverseCombinator = reverseCombinator(combinator);
  1672. currentSeparator[++combinatorIndex] = {combinator: combinator, tag: '*'};
  1673. }
  1674. var currentParsed = parsed.expressions[separatorIndex][combinatorIndex];
  1675. if (tagName){
  1676. currentParsed.tag = tagName.replace(reUnescape, '');
  1677. } else if (id){
  1678. currentParsed.id = id.replace(reUnescape, '');
  1679. } else if (className){
  1680. className = className.replace(reUnescape, '');
  1681. if (!currentParsed.classList) currentParsed.classList = [];
  1682. if (!currentParsed.classes) currentParsed.classes = [];
  1683. currentParsed.classList.push(className);
  1684. currentParsed.classes.push({
  1685. value: className,
  1686. regexp: new RegExp('(^|\\s)' + escapeRegExp(className) + '(\\s|$)')
  1687. });
  1688. } else if (pseudoClass){
  1689. pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue;
  1690. pseudoClassValue = pseudoClassValue ? pseudoClassValue.replace(reUnescape, '') : null;
  1691. if (!currentParsed.pseudos) currentParsed.pseudos = [];
  1692. currentParsed.pseudos.push({
  1693. key: pseudoClass.replace(reUnescape, ''),
  1694. value: pseudoClassValue,
  1695. type: pseudoMarker.length == 1 ? 'class' : 'element'
  1696. });
  1697. } else if (attributeKey){
  1698. attributeKey = attributeKey.replace(reUnescape, '');
  1699. attributeValue = (attributeValue || '').replace(reUnescape, '');
  1700. var test, regexp;
  1701. switch (attributeOperator){
  1702. case '^=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) ); break;
  1703. case '$=' : regexp = new RegExp( escapeRegExp(attributeValue) +'$' ); break;
  1704. case '~=' : regexp = new RegExp( '(^|\\s)'+ escapeRegExp(attributeValue) +'(\\s|$)' ); break;
  1705. case '|=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) +'(-|$)' ); break;
  1706. case '=' : test = function(value){
  1707. return attributeValue == value;
  1708. }; break;
  1709. case '*=' : test = function(value){
  1710. return value && value.indexOf(attributeValue) > -1;
  1711. }; break;
  1712. case '!=' : test = function(value){
  1713. return attributeValue != value;
  1714. }; break;
  1715. default : test = function(value){
  1716. return !!value;
  1717. };
  1718. }
  1719. if (attributeValue == '' && (/^[*$^]=$/).test(attributeOperator)) test = function(){
  1720. return false;
  1721. };
  1722. if (!test) test = function(value){
  1723. return value && regexp.test(value);
  1724. };
  1725. if (!currentParsed.attributes) currentParsed.attributes = [];
  1726. currentParsed.attributes.push({
  1727. key: attributeKey,
  1728. operator: attributeOperator,
  1729. value: attributeValue,
  1730. test: test
  1731. });
  1732. }
  1733. return '';
  1734. };
  1735. // Slick NS
  1736. var Slick = (this.Slick || {});
  1737. Slick.parse = function(expression){
  1738. return parse(expression);
  1739. };
  1740. Slick.escapeRegExp = escapeRegExp;
  1741. if (!this.Slick) this.Slick = Slick;
  1742. }).apply(/*<CommonJS>*/(typeof exports != 'undefined') ? exports : /*</CommonJS>*/this);
  1743. /*
  1744. ---
  1745. name: Slick.Finder
  1746. description: The new, superfast css selector engine.
  1747. provides: Slick.Finder
  1748. requires: Slick.Parser
  1749. ...
  1750. */
  1751. ;(function(){
  1752. var local = {},
  1753. featuresCache = {},
  1754. toString = Object.prototype.toString;
  1755. // Feature / Bug detection
  1756. local.isNativeCode = function(fn){
  1757. return (/\{\s*\[native code\]\s*\}/).test('' + fn);
  1758. };
  1759. local.isXML = function(document){
  1760. return (!!document.xmlVersion) || (!!document.xml) || (toString.call(document) == '[object XMLDocument]') ||
  1761. (document.nodeType == 9 && document.documentElement.nodeName != 'HTML');
  1762. };
  1763. local.setDocument = function(document){
  1764. // convert elements / window arguments to document. if document cannot be extrapolated, the function returns.
  1765. var nodeType = document.nodeType;
  1766. if (nodeType == 9); // document
  1767. else if (nodeType) document = document.ownerDocument; // node
  1768. else if (document.navigator) document = document.document; // window
  1769. else return;
  1770. // check if it's the old document
  1771. if (this.document === document) return;
  1772. this.document = document;
  1773. // check if we have done feature detection on this document before
  1774. var root = document.documentElement,
  1775. rootUid = this.getUIDXML(root),
  1776. features = featuresCache[rootUid],
  1777. feature;
  1778. if (features){
  1779. for (feature in features){
  1780. this[feature] = features[feature];
  1781. }
  1782. return;
  1783. }
  1784. features = featuresCache[rootUid] = {};
  1785. features.root = root;
  1786. features.isXMLDocument = this.isXML(document);
  1787. features.brokenStarGEBTN
  1788. = features.starSelectsClosedQSA
  1789. = features.idGetsName
  1790. = features.brokenMixedCaseQSA
  1791. = features.brokenGEBCN
  1792. = features.brokenCheckedQSA
  1793. = features.brokenEmptyAttributeQSA
  1794. = features.isHTMLDocument
  1795. = features.nativeMatchesSelector
  1796. = false;
  1797. var starSelectsClosed, starSelectsComments,
  1798. brokenSecondClassNameGEBCN, cachedGetElementsByClassName,
  1799. brokenFormAttributeGetter;
  1800. var selected, id = 'slick_uniqueid';
  1801. var testNode = document.createElement('div');
  1802. var testRoot = document.body || document.getElementsByTagName('body')[0] || root;
  1803. testRoot.appendChild(testNode);
  1804. // on non-HTML documents innerHTML and getElementsById doesnt work properly
  1805. try {
  1806. testNode.innerHTML = '<a id="'+id+'"></a>';
  1807. features.isHTMLDocument = !!document.getElementById(id);
  1808. } catch (e){}
  1809. if (features.isHTMLDocument){
  1810. testNode.style.display = 'none';
  1811. // IE returns comment nodes for getElementsByTagName('*') for some documents
  1812. testNode.appendChild(document.createComment(''));
  1813. starSelectsComments = (testNode.getElementsByTagName('*').length > 1);
  1814. // IE returns closed nodes (EG:"</foo>") for getElementsByTagName('*') for some documents
  1815. try {
  1816. testNode.innerHTML = 'foo</foo>';
  1817. selected = testNode.getElementsByTagName('*');
  1818. starSelectsClosed = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/');
  1819. } catch (e){};
  1820. features.brokenStarGEBTN = starSelectsComments || starSelectsClosed;
  1821. // IE returns elements with the name instead of just id for getElementsById for some documents
  1822. try {
  1823. testNode.innerHTML = '<a name="'+ id +'"></a><b id="'+ id +'"></b>';
  1824. features.idGetsName = document.getElementById(id) === testNode.firstChild;
  1825. } catch (e){}
  1826. if (testNode.getElementsByClassName){
  1827. // Safari 3.2 getElementsByClassName caches results
  1828. try {
  1829. testNode.innerHTML = '<a class="f"></a><a class="b"></a>';
  1830. testNode.getElementsByClassName('b').length;
  1831. testNode.firstChild.className = 'b';
  1832. cachedGetElementsByClassName = (testNode.getElementsByClassName('b').length != 2);
  1833. } catch (e){};
  1834. // Opera 9.6 getElementsByClassName doesnt detects the class if its not the first one
  1835. try {
  1836. testNode.innerHTML = '<a class="a"></a><a class="f b a"></a>';
  1837. brokenSecondClassNameGEBCN = (testNode.getElementsByClassName('a').length != 2);
  1838. } catch (e){}
  1839. features.brokenGEBCN = cachedGetElementsByClassName || brokenSecondClassNameGEBCN;
  1840. }
  1841. if (testNode.querySelectorAll){
  1842. // IE 8 returns closed nodes (EG:"</foo>") for querySelectorAll('*') for some documents
  1843. try {
  1844. testNode.innerHTML = 'foo</foo>';
  1845. selected = testNode.querySelectorAll('*');
  1846. features.starSelectsClosedQSA = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/');
  1847. } catch (e){}
  1848. // Safari 3.2 querySelectorAll doesnt work with mixedcase on quirksmode
  1849. try {
  1850. testNode.innerHTML = '<a class="MiX"></a>';
  1851. features.brokenMixedCaseQSA = !testNode.querySelectorAll('.MiX').length;
  1852. } catch (e){}
  1853. // Webkit and Opera dont return selected options on querySelectorAll
  1854. try {
  1855. testNode.innerHTML = '<select><option selected="selected">a</option></select>';
  1856. features.brokenCheckedQSA = (testNode.querySelectorAll(':checked').length == 0);
  1857. } catch (e){};
  1858. // IE returns incorrect results for attr[*^$]="" selectors on querySelectorAll
  1859. try {
  1860. testNode.innerHTML = '<a class=""></a>';
  1861. features.brokenEmptyAttributeQSA = (testNode.querySelectorAll('[class*=""]').length != 0);
  1862. } catch (e){}
  1863. }
  1864. // IE6-7, if a form has an input of id x, form.getAttribute(x) returns a reference to the input
  1865. try {
  1866. testNode.innerHTML = '<form action="s"><input id="action"/></form>';
  1867. brokenFormAttributeGetter = (testNode.firstChild.getAttribute('action') != 's');
  1868. } catch (e){}
  1869. // native matchesSelector function
  1870. features.nativeMatchesSelector = root.matches || /*root.msMatchesSelector ||*/ root.mozMatchesSelector || root.webkitMatchesSelector;
  1871. if (features.nativeMatchesSelector) try {
  1872. // if matchesSelector trows errors on incorrect sintaxes we can use it
  1873. features.nativeMatchesSelector.call(root, ':slick');
  1874. features.nativeMatchesSelector = null;
  1875. } catch (e){}
  1876. }
  1877. try {
  1878. root.slick_expando = 1;
  1879. delete root.slick_expando;
  1880. features.getUID = this.getUIDHTML;
  1881. } catch (e){
  1882. features.getUID = this.getUIDXML;
  1883. }
  1884. testRoot.removeChild(testNode);
  1885. testNode = selected = testRoot = null;
  1886. // getAttribute
  1887. features.getAttribute = (features.isHTMLDocument && brokenFormAttributeGetter) ? function(node, name){
  1888. var method = this.attributeGetters[name];
  1889. if (method) return method.call(node);
  1890. var attributeNode = node.getAttributeNode(name);
  1891. return (attributeNode) ? attributeNode.nodeValue : null;
  1892. } : function(node, name){
  1893. var method = this.attributeGetters[name];
  1894. return (method) ? method.call(node) : node.getAttribute(name);
  1895. };
  1896. // hasAttribute
  1897. features.hasAttribute = (root && this.isNativeCode(root.hasAttribute)) ? function(node, attribute){
  1898. return node.hasAttribute(attribute);
  1899. } : function(node, attribute){
  1900. node = node.getAttributeNode(attribute);
  1901. return !!(node && (node.specified || node.nodeValue));
  1902. };
  1903. // contains
  1904. // FIXME: Add specs: local.contains should be different for xml and html documents?
  1905. var nativeRootContains = root && this.isNativeCode(root.contains),
  1906. nativeDocumentContains = document && this.isNativeCode(document.contains);
  1907. features.contains = (nativeRootContains && nativeDocumentContains) ? function(context, node){
  1908. return context.contains(node);
  1909. } : (nativeRootContains && !nativeDocumentContains) ? function(context, node){
  1910. // IE8 does not have .contains on document.
  1911. return context === node || ((context === document) ? document.documentElement : context).contains(node);
  1912. } : (root && root.compareDocumentPosition) ? function(context, node){
  1913. return context === node || !!(context.compareDocumentPosition(node) & 16);
  1914. } : function(context, node){
  1915. if (node) do {
  1916. if (node === context) return true;
  1917. } while ((node = node.parentNode));
  1918. return false;
  1919. };
  1920. // document order sorting
  1921. // credits to Sizzle (http://sizzlejs.com/)
  1922. features.documentSorter = (root.compareDocumentPosition) ? function(a, b){
  1923. if (!a.compareDocumentPosition || !b.compareDocumentPosition) return 0;
  1924. return a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
  1925. } : ('sourceIndex' in root) ? function(a, b){
  1926. if (!a.sourceIndex || !b.sourceIndex) return 0;
  1927. return a.sourceIndex - b.sourceIndex;
  1928. } : (document.createRange) ? function(a, b){
  1929. if (!a.ownerDocument || !b.ownerDocument) return 0;
  1930. var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
  1931. aRange.setStart(a, 0);
  1932. aRange.setEnd(a, 0);
  1933. bRange.setStart(b, 0);
  1934. bRange.setEnd(b, 0);
  1935. return aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
  1936. } : null;
  1937. root = null;
  1938. for (feature in features){
  1939. this[feature] = features[feature];
  1940. }
  1941. };
  1942. // Main Method
  1943. var reSimpleSelector = /^([#.]?)((?:[\w-]+|\*))$/,
  1944. reEmptyAttribute = /\[.+[*$^]=(?:""|'')?\]/,
  1945. qsaFailExpCache = {};
  1946. local.search = function(context, expression, append, first){
  1947. var found = this.found = (first) ? null : (append || []);
  1948. if (!context) return found;
  1949. else if (context.navigator) context = context.document; // Convert the node from a window to a document
  1950. else if (!context.nodeType) return found;
  1951. // setup
  1952. var parsed, i, node, nodes,
  1953. uniques = this.uniques = {},
  1954. hasOthers = !!(append && append.length),
  1955. contextIsDocument = (context.nodeType == 9);
  1956. if (this.document !== (contextIsDocument ? context : context.ownerDocument)) this.setDocument(context);
  1957. // avoid duplicating items already in the append array
  1958. if (hasOthers) for (i = found.length; i--;) uniques[this.getUID(found[i])] = true;
  1959. // expression checks
  1960. if (typeof expression == 'string'){ // expression is a string
  1961. /*<simple-selectors-override>*/
  1962. var simpleSelector = expression.match(reSimpleSelector);
  1963. simpleSelectors: if (simpleSelector){
  1964. var symbol = simpleSelector[1],
  1965. name = simpleSelector[2];
  1966. if (!symbol){
  1967. if (name == '*' && this.brokenStarGEBTN) break simpleSelectors;
  1968. nodes = context.getElementsByTagName(name);
  1969. if (first) return nodes[0] || null;
  1970. for (i = 0; node = nodes[i++];){
  1971. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1972. }
  1973. } else if (symbol == '#'){
  1974. if (!this.isHTMLDocument || !contextIsDocument) break simpleSelectors;
  1975. node = context.getElementById(name);
  1976. if (!node) return found;
  1977. if (this.idGetsName && node.getAttributeNode('id').nodeValue != name) break simpleSelectors;
  1978. if (first) return node || null;
  1979. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1980. } else if (symbol == '.'){
  1981. if (!this.isHTMLDocument || ((!context.getElementsByClassName || this.brokenGEBCN) && context.querySelectorAll)) break simpleSelectors;
  1982. if (context.getElementsByClassName && !this.brokenGEBCN){
  1983. nodes = context.getElementsByClassName(name);
  1984. if (first) return nodes[0] || null;
  1985. for (i = 0; node = nodes[i++];){
  1986. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1987. }
  1988. } else {
  1989. var matchClass = new RegExp('(^|\\s)'+ Slick.escapeRegExp(name) +'(\\s|$)');
  1990. nodes = context.getElementsByTagName('*');
  1991. for (i = 0; node = nodes[i++];){
  1992. className = node.className;
  1993. if (!(className && matchClass.test(className))) continue;
  1994. if (first) return node;
  1995. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1996. }
  1997. }
  1998. }
  1999. if (hasOthers) this.sort(found);
  2000. return (first) ? null : found;
  2001. }
  2002. /*</simple-selectors-override>*/
  2003. /*<query-selector-override>*/
  2004. querySelector: if (context.querySelectorAll){
  2005. if (!this.isHTMLDocument
  2006. || qsaFailExpCache[expression]
  2007. //TODO: only skip when expression is actually mixed case
  2008. || this.brokenMixedCaseQSA
  2009. || (this.brokenCheckedQSA && expression.indexOf(':checked') > -1)
  2010. || (this.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression))
  2011. || (!contextIsDocument //Abort when !contextIsDocument and...
  2012. // there are multiple expressions in the selector
  2013. // since we currently only fix non-document rooted QSA for single expression selectors
  2014. && expression.indexOf(',') > -1
  2015. )
  2016. || Slick.disableQSA
  2017. ) break querySelector;
  2018. var _expression = expression, _context = context, currentId;
  2019. if (!contextIsDocument){
  2020. // non-document rooted QSA
  2021. // credits to Andrew Dupont
  2022. currentId = _context.getAttribute('id'), slickid = 'slickid__';
  2023. _context.setAttribute('id', slickid);
  2024. _expression = '#' + slickid + ' ' + _expression;
  2025. context = _context.parentNode;
  2026. }
  2027. try {
  2028. if (first) return context.querySelector(_expression) || null;
  2029. else nodes = context.querySelectorAll(_expression);
  2030. } catch (e){
  2031. qsaFailExpCache[expression] = 1;
  2032. break querySelector;
  2033. } finally {
  2034. if (!contextIsDocument){
  2035. if (currentId) _context.setAttribute('id', currentId);
  2036. else _context.removeAttribute('id');
  2037. context = _context;
  2038. }
  2039. }
  2040. if (this.starSelectsClosedQSA) for (i = 0; node = nodes[i++];){
  2041. if (node.nodeName > '@' && !(hasOthers && uniques[this.getUID(node)])) found.push(node);
  2042. } else for (i = 0; node = nodes[i++];){
  2043. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  2044. }
  2045. if (hasOthers) this.sort(found);
  2046. return found;
  2047. }
  2048. /*</query-selector-override>*/
  2049. parsed = this.Slick.parse(expression);
  2050. if (!parsed.length) return found;
  2051. } else if (expression == null){ // there is no expression
  2052. return found;
  2053. } else if (expression.Slick){ // expression is a parsed Slick object
  2054. parsed = expression;
  2055. } else if (this.contains(context.documentElement || context, expression)){ // expression is a node
  2056. (found) ? found.push(expression) : found = expression;
  2057. return found;
  2058. } else { // other junk
  2059. return found;
  2060. }
  2061. /*<pseudo-selectors>*//*<nth-pseudo-selectors>*/
  2062. // cache elements for the nth selectors
  2063. this.posNTH = {};
  2064. this.posNTHLast = {};
  2065. this.posNTHType = {};
  2066. this.posNTHTypeLast = {};
  2067. /*</nth-pseudo-selectors>*//*</pseudo-selectors>*/
  2068. // if append is null and there is only a single selector with one expression use pushArray, else use pushUID
  2069. this.push = (!hasOthers && (first || (parsed.length == 1 && parsed.expressions[0].length == 1))) ? this.pushArray : this.pushUID;
  2070. if (found == null) found = [];
  2071. // default engine
  2072. var j, m, n;
  2073. var combinator, tag, id, classList, classes, attributes, pseudos;
  2074. var currentItems, currentExpression, currentBit, lastBit, expressions = parsed.expressions;
  2075. search: for (i = 0; (currentExpression = expressions[i]); i++) for (j = 0; (currentBit = currentExpression[j]); j++){
  2076. combinator = 'combinator:' + currentBit.combinator;
  2077. if (!this[combinator]) continue search;
  2078. tag = (this.isXMLDocument) ? currentBit.tag : currentBit.tag.toUpperCase();
  2079. id = currentBit.id;
  2080. classList = currentBit.classList;
  2081. classes = currentBit.classes;
  2082. attributes = currentBit.attributes;
  2083. pseudos = currentBit.pseudos;
  2084. lastBit = (j === (currentExpression.length - 1));
  2085. this.bitUniques = {};
  2086. if (lastBit){
  2087. this.uniques = uniques;
  2088. this.found = found;
  2089. } else {
  2090. this.uniques = {};
  2091. this.found = [];
  2092. }
  2093. if (j === 0){
  2094. this[combinator](context, tag, id, classes, attributes, pseudos, classList);
  2095. if (first && lastBit && found.length) break search;
  2096. } else {
  2097. if (first && lastBit) for (m = 0, n = currentItems.length; m < n; m++){
  2098. this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList);
  2099. if (found.length) break search;
  2100. } else for (m = 0, n = currentItems.length; m < n; m++) this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList);
  2101. }
  2102. currentItems = this.found;
  2103. }
  2104. // should sort if there are nodes in append and if you pass multiple expressions.
  2105. if (hasOthers || (parsed.expressions.length > 1)) this.sort(found);
  2106. return (first) ? (found[0] || null) : found;
  2107. };
  2108. // Utils
  2109. local.uidx = 1;
  2110. local.uidk = 'slick-uniqueid';
  2111. local.getUIDXML = function(node){
  2112. var uid = node.getAttribute(this.uidk);
  2113. if (!uid){
  2114. uid = this.uidx++;
  2115. node.setAttribute(this.uidk, uid);
  2116. }
  2117. return uid;
  2118. };
  2119. local.getUIDHTML = function(node){
  2120. return node.uniqueNumber || (node.uniqueNumber = this.uidx++);
  2121. };
  2122. // sort based on the setDocument documentSorter method.
  2123. local.sort = function(results){
  2124. if (!this.documentSorter) return results;
  2125. results.sort(this.documentSorter);
  2126. return results;
  2127. };
  2128. /*<pseudo-selectors>*//*<nth-pseudo-selectors>*/
  2129. local.cacheNTH = {};
  2130. local.matchNTH = /^([+-]?\d*)?([a-z]+)?([+-]\d+)?$/;
  2131. local.parseNTHArgument = function(argument){
  2132. var parsed = argument.match(this.matchNTH);
  2133. if (!parsed) return false;
  2134. var special = parsed[2] || false;
  2135. var a = parsed[1] || 1;
  2136. if (a == '-') a = -1;
  2137. var b = +parsed[3] || 0;
  2138. parsed =
  2139. (special == 'n') ? {a: a, b: b} :
  2140. (special == 'odd') ? {a: 2, b: 1} :
  2141. (special == 'even') ? {a: 2, b: 0} : {a: 0, b: a};
  2142. return (this.cacheNTH[argument] = parsed);
  2143. };
  2144. local.createNTHPseudo = function(child, sibling, positions, ofType){
  2145. return function(node, argument){
  2146. var uid = this.getUID(node);
  2147. if (!this[positions][uid]){
  2148. var parent = node.parentNode;
  2149. if (!parent) return false;
  2150. var el = parent[child], count = 1;
  2151. if (ofType){
  2152. var nodeName = node.nodeName;
  2153. do {
  2154. if (el.nodeName != nodeName) continue;
  2155. this[positions][this.getUID(el)] = count++;
  2156. } while ((el = el[sibling]));
  2157. } else {
  2158. do {
  2159. if (el.nodeType != 1) continue;
  2160. this[positions][this.getUID(el)] = count++;
  2161. } while ((el = el[sibling]));
  2162. }
  2163. }
  2164. argument = argument || 'n';
  2165. var parsed = this.cacheNTH[argument] || this.parseNTHArgument(argument);
  2166. if (!parsed) return false;
  2167. var a = parsed.a, b = parsed.b, pos = this[positions][uid];
  2168. if (a == 0) return b == pos;
  2169. if (a > 0){
  2170. if (pos < b) return false;
  2171. } else {
  2172. if (b < pos) return false;
  2173. }
  2174. return ((pos - b) % a) == 0;
  2175. };
  2176. };
  2177. /*</nth-pseudo-selectors>*//*</pseudo-selectors>*/
  2178. local.pushArray = function(node, tag, id, classes, attributes, pseudos){
  2179. if (this.matchSelector(node, tag, id, classes, attributes, pseudos)) this.found.push(node);
  2180. };
  2181. local.pushUID = function(node, tag, id, classes, attributes, pseudos){
  2182. var uid = this.getUID(node);
  2183. if (!this.uniques[uid] && this.matchSelector(node, tag, id, classes, attributes, pseudos)){
  2184. this.uniques[uid] = true;
  2185. this.found.push(node);
  2186. }
  2187. };
  2188. local.matchNode = function(node, selector){
  2189. if (this.isHTMLDocument && this.nativeMatchesSelector){
  2190. try {
  2191. return this.nativeMatchesSelector.call(node, selector.replace(/\[([^=]+)=\s*([^'"\]]+?)\s*\]/g, '[$1="$2"]'));
  2192. } catch (matchError){}
  2193. }
  2194. var parsed = this.Slick.parse(selector);
  2195. if (!parsed) return true;
  2196. // simple (single) selectors
  2197. var expressions = parsed.expressions, simpleExpCounter = 0, i, currentExpression;
  2198. for (i = 0; (currentExpression = expressions[i]); i++){
  2199. if (currentExpression.length == 1){
  2200. var exp = currentExpression[0];
  2201. if (this.matchSelector(node, (this.isXMLDocument) ? exp.tag : exp.tag.toUpperCase(), exp.id, exp.classes, exp.attributes, exp.pseudos)) return true;
  2202. simpleExpCounter++;
  2203. }
  2204. }
  2205. if (simpleExpCounter == parsed.length) return false;
  2206. var nodes = this.search(this.document, parsed), item;
  2207. for (i = 0; item = nodes[i++];){
  2208. if (item === node) return true;
  2209. }
  2210. return false;
  2211. };
  2212. local.matchPseudo = function(node, name, argument){
  2213. var pseudoName = 'pseudo:' + name;
  2214. if (this[pseudoName]) return this[pseudoName](node, argument);
  2215. var attribute = this.getAttribute(node, name);
  2216. return (argument) ? argument == attribute : !!attribute;
  2217. };
  2218. local.matchSelector = function(node, tag, id, classes, attributes, pseudos){
  2219. if (tag){
  2220. var nodeName = (this.isXMLDocument) ? node.nodeName : node.nodeName.toUpperCase();
  2221. if (tag == '*'){
  2222. if (nodeName < '@') return false; // Fix for comment nodes and closed nodes
  2223. } else {
  2224. if (nodeName != tag) return false;
  2225. }
  2226. }
  2227. if (id && node.getAttribute('id') != id) return false;
  2228. var i, part, cls;
  2229. if (classes) for (i = classes.length; i--;){
  2230. cls = this.getAttribute(node, 'class');
  2231. if (!(cls && classes[i].regexp.test(cls))) return false;
  2232. }
  2233. if (attributes) for (i = attributes.length; i--;){
  2234. part = attributes[i];
  2235. if (part.operator ? !part.test(this.getAttribute(node, part.key)) : !this.hasAttribute(node, part.key)) return false;
  2236. }
  2237. if (pseudos) for (i = pseudos.length; i--;){
  2238. part = pseudos[i];
  2239. if (!this.matchPseudo(node, part.key, part.value)) return false;
  2240. }
  2241. return true;
  2242. };
  2243. var combinators = {
  2244. ' ': function(node, tag, id, classes, attributes, pseudos, classList){ // all child nodes, any level
  2245. var i, item, children;
  2246. if (this.isHTMLDocument){
  2247. getById: if (id){
  2248. item = this.document.getElementById(id);
  2249. if ((!item && node.all) || (this.idGetsName && item && item.getAttributeNode('id').nodeValue != id)){
  2250. // all[id] returns all the elements with that name or id inside node
  2251. // if theres just one it will return the element, else it will be a collection
  2252. children = node.all[id];
  2253. if (!children) return;
  2254. if (!children[0]) children = [children];
  2255. for (i = 0; item = children[i++];){
  2256. var idNode = item.getAttributeNode('id');
  2257. if (idNode && idNode.nodeValue == id){
  2258. this.push(item, tag, null, classes, attributes, pseudos);
  2259. break;
  2260. }
  2261. }
  2262. return;
  2263. }
  2264. if (!item){
  2265. // if the context is in the dom we return, else we will try GEBTN, breaking the getById label
  2266. if (this.contains(this.root, node)) return;
  2267. else break getById;
  2268. } else if (this.document !== node && !this.contains(node, item)) return;
  2269. this.push(item, tag, null, classes, attributes, pseudos);
  2270. return;
  2271. }
  2272. getByClass: if (classes && node.getElementsByClassName && !this.brokenGEBCN){
  2273. children = node.getElementsByClassName(classList.join(' '));
  2274. if (!(children && children.length)) break getByClass;
  2275. for (i = 0; item = children[i++];) this.push(item, tag, id, null, attributes, pseudos);
  2276. return;
  2277. }
  2278. }
  2279. getByTag: {
  2280. children = node.getElementsByTagName(tag);
  2281. if (!(children && children.length)) break getByTag;
  2282. if (!this.brokenStarGEBTN) tag = null;
  2283. for (i = 0; item = children[i++];) this.push(item, tag, id, classes, attributes, pseudos);
  2284. }
  2285. },
  2286. '>': function(node, tag, id, classes, attributes, pseudos){ // direct children
  2287. if ((node = node.firstChild)) do {
  2288. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2289. } while ((node = node.nextSibling));
  2290. },
  2291. '+': function(node, tag, id, classes, attributes, pseudos){ // next sibling
  2292. while ((node = node.nextSibling)) if (node.nodeType == 1){
  2293. this.push(node, tag, id, classes, attributes, pseudos);
  2294. break;
  2295. }
  2296. },
  2297. '^': function(node, tag, id, classes, attributes, pseudos){ // first child
  2298. node = node.firstChild;
  2299. if (node){
  2300. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2301. else this['combinator:+'](node, tag, id, classes, attributes, pseudos);
  2302. }
  2303. },
  2304. '~': function(node, tag, id, classes, attributes, pseudos){ // next siblings
  2305. while ((node = node.nextSibling)){
  2306. if (node.nodeType != 1) continue;
  2307. var uid = this.getUID(node);
  2308. if (this.bitUniques[uid]) break;
  2309. this.bitUniques[uid] = true;
  2310. this.push(node, tag, id, classes, attributes, pseudos);
  2311. }
  2312. },
  2313. '++': function(node, tag, id, classes, attributes, pseudos){ // next sibling and previous sibling
  2314. this['combinator:+'](node, tag, id, classes, attributes, pseudos);
  2315. this['combinator:!+'](node, tag, id, classes, attributes, pseudos);
  2316. },
  2317. '~~': function(node, tag, id, classes, attributes, pseudos){ // next siblings and previous siblings
  2318. this['combinator:~'](node, tag, id, classes, attributes, pseudos);
  2319. this['combinator:!~'](node, tag, id, classes, attributes, pseudos);
  2320. },
  2321. '!': function(node, tag, id, classes, attributes, pseudos){ // all parent nodes up to document
  2322. while ((node = node.parentNode)) if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos);
  2323. },
  2324. '!>': function(node, tag, id, classes, attributes, pseudos){ // direct parent (one level)
  2325. node = node.parentNode;
  2326. if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos);
  2327. },
  2328. '!+': function(node, tag, id, classes, attributes, pseudos){ // previous sibling
  2329. while ((node = node.previousSibling)) if (node.nodeType == 1){
  2330. this.push(node, tag, id, classes, attributes, pseudos);
  2331. break;
  2332. }
  2333. },
  2334. '!^': function(node, tag, id, classes, attributes, pseudos){ // last child
  2335. node = node.lastChild;
  2336. if (node){
  2337. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2338. else this['combinator:!+'](node, tag, id, classes, attributes, pseudos);
  2339. }
  2340. },
  2341. '!~': function(node, tag, id, classes, attributes, pseudos){ // previous siblings
  2342. while ((node = node.previousSibling)){
  2343. if (node.nodeType != 1) continue;
  2344. var uid = this.getUID(node);
  2345. if (this.bitUniques[uid]) break;
  2346. this.bitUniques[uid] = true;
  2347. this.push(node, tag, id, classes, attributes, pseudos);
  2348. }
  2349. }
  2350. };
  2351. for (var c in combinators) local['combinator:' + c] = combinators[c];
  2352. var pseudos = {
  2353. /*<pseudo-selectors>*/
  2354. 'empty': function(node){
  2355. var child = node.firstChild;
  2356. return !(child && child.nodeType == 1) && !(node.innerText || node.textContent || '').length;
  2357. },
  2358. 'not': function(node, expression){
  2359. return !this.matchNode(node, expression);
  2360. },
  2361. 'contains': function(node, text){
  2362. return (node.innerText || node.textContent || '').indexOf(text) > -1;
  2363. },
  2364. 'first-child': function(node){
  2365. while ((node = node.previousSibling)) if (node.nodeType == 1) return false;
  2366. return true;
  2367. },
  2368. 'last-child': function(node){
  2369. while ((node = node.nextSibling)) if (node.nodeType == 1) return false;
  2370. return true;
  2371. },
  2372. 'only-child': function(node){
  2373. var prev = node;
  2374. while ((prev = prev.previousSibling)) if (prev.nodeType == 1) return false;
  2375. var next = node;
  2376. while ((next = next.nextSibling)) if (next.nodeType == 1) return false;
  2377. return true;
  2378. },
  2379. /*<nth-pseudo-selectors>*/
  2380. 'nth-child': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTH'),
  2381. 'nth-last-child': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHLast'),
  2382. 'nth-of-type': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTHType', true),
  2383. 'nth-last-of-type': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHTypeLast', true),
  2384. 'index': function(node, index){
  2385. return this['pseudo:nth-child'](node, '' + (index + 1));
  2386. },
  2387. 'even': function(node){
  2388. return this['pseudo:nth-child'](node, '2n');
  2389. },
  2390. 'odd': function(node){
  2391. return this['pseudo:nth-child'](node, '2n+1');
  2392. },
  2393. /*</nth-pseudo-selectors>*/
  2394. /*<of-type-pseudo-selectors>*/
  2395. 'first-of-type': function(node){
  2396. var nodeName = node.nodeName;
  2397. while ((node = node.previousSibling)) if (node.nodeName == nodeName) return false;
  2398. return true;
  2399. },
  2400. 'last-of-type': function(node){
  2401. var nodeName = node.nodeName;
  2402. while ((node = node.nextSibling)) if (node.nodeName == nodeName) return false;
  2403. return true;
  2404. },
  2405. 'only-of-type': function(node){
  2406. var prev = node, nodeName = node.nodeName;
  2407. while ((prev = prev.previousSibling)) if (prev.nodeName == nodeName) return false;
  2408. var next = node;
  2409. while ((next = next.nextSibling)) if (next.nodeName == nodeName) return false;
  2410. return true;
  2411. },
  2412. /*</of-type-pseudo-selectors>*/
  2413. // custom pseudos
  2414. 'enabled': function(node){
  2415. return !node.disabled;
  2416. },
  2417. 'disabled': function(node){
  2418. return node.disabled;
  2419. },
  2420. 'checked': function(node){
  2421. return node.checked || node.selected;
  2422. },
  2423. 'focus': function(node){
  2424. return this.isHTMLDocument && this.document.activeElement === node && (node.href || node.type || this.hasAttribute(node, 'tabindex'));
  2425. },
  2426. 'root': function(node){
  2427. return (node === this.root);
  2428. },
  2429. 'selected': function(node){
  2430. return node.selected;
  2431. }
  2432. /*</pseudo-selectors>*/
  2433. };
  2434. for (var p in pseudos) local['pseudo:' + p] = pseudos[p];
  2435. // attributes methods
  2436. var attributeGetters = local.attributeGetters = {
  2437. 'for': function(){
  2438. return ('htmlFor' in this) ? this.htmlFor : this.getAttribute('for');
  2439. },
  2440. 'href': function(){
  2441. return ('href' in this) ? this.getAttribute('href', 2) : this.getAttribute('href');
  2442. },
  2443. 'style': function(){
  2444. return (this.style) ? this.style.cssText : this.getAttribute('style');
  2445. },
  2446. 'tabindex': function(){
  2447. var attributeNode = this.getAttributeNode('tabindex');
  2448. return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null;
  2449. },
  2450. 'type': function(){
  2451. return this.getAttribute('type');
  2452. },
  2453. 'maxlength': function(){
  2454. var attributeNode = this.getAttributeNode('maxLength');
  2455. return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null;
  2456. }
  2457. };
  2458. attributeGetters.MAXLENGTH = attributeGetters.maxLength = attributeGetters.maxlength;
  2459. // Slick
  2460. var Slick = local.Slick = (this.Slick || {});
  2461. Slick.version = '1.1.7';
  2462. // Slick finder
  2463. Slick.search = function(context, expression, append){
  2464. return local.search(context, expression, append);
  2465. };
  2466. Slick.find = function(context, expression){
  2467. return local.search(context, expression, null, true);
  2468. };
  2469. // Slick containment checker
  2470. Slick.contains = function(container, node){
  2471. local.setDocument(container);
  2472. return local.contains(container, node);
  2473. };
  2474. // Slick attribute getter
  2475. Slick.getAttribute = function(node, name){
  2476. local.setDocument(node);
  2477. return local.getAttribute(node, name);
  2478. };
  2479. Slick.hasAttribute = function(node, name){
  2480. local.setDocument(node);
  2481. return local.hasAttribute(node, name);
  2482. };
  2483. // Slick matcher
  2484. Slick.match = function(node, selector){
  2485. if (!(node && selector)) return false;
  2486. if (!selector || selector === node) return true;
  2487. local.setDocument(node);
  2488. return local.matchNode(node, selector);
  2489. };
  2490. // Slick attribute accessor
  2491. Slick.defineAttributeGetter = function(name, fn){
  2492. local.attributeGetters[name] = fn;
  2493. return this;
  2494. };
  2495. Slick.lookupAttributeGetter = function(name){
  2496. return local.attributeGetters[name];
  2497. };
  2498. // Slick pseudo accessor
  2499. Slick.definePseudo = function(name, fn){
  2500. local['pseudo:' + name] = function(node, argument){
  2501. return fn.call(node, argument);
  2502. };
  2503. return this;
  2504. };
  2505. Slick.lookupPseudo = function(name){
  2506. var pseudo = local['pseudo:' + name];
  2507. if (pseudo) return function(argument){
  2508. return pseudo.call(this, argument);
  2509. };
  2510. return null;
  2511. };
  2512. // Slick overrides accessor
  2513. Slick.override = function(regexp, fn){
  2514. local.override(regexp, fn);
  2515. return this;
  2516. };
  2517. Slick.isXML = local.isXML;
  2518. Slick.uidOf = function(node){
  2519. return local.getUIDHTML(node);
  2520. };
  2521. if (!this.Slick) this.Slick = Slick;
  2522. }).apply(/*<CommonJS>*/(typeof exports != 'undefined') ? exports : /*</CommonJS>*/this);
  2523. /*
  2524. ---
  2525. name: Element
  2526. description: One of the most important items in MooTools. Contains the dollar function, the dollars function, and an handful of cross-browser, time-saver methods to let you easily work with HTML Elements.
  2527. license: MIT-style license.
  2528. requires: [Window, Document, Array, String, Function, Object, Number, Slick.Parser, Slick.Finder]
  2529. provides: [Element, Elements, $, $$, IFrame, Selectors]
  2530. ...
  2531. */
  2532. var Element = this.Element = function(tag, props){
  2533. var konstructor = Element.Constructors[tag];
  2534. if (konstructor) return konstructor(props);
  2535. if (typeof tag != 'string') return document.id(tag).set(props);
  2536. if (!props) props = {};
  2537. if (!(/^[\w-]+$/).test(tag)){
  2538. var parsed = Slick.parse(tag).expressions[0][0];
  2539. tag = (parsed.tag == '*') ? 'div' : parsed.tag;
  2540. if (parsed.id && props.id == null) props.id = parsed.id;
  2541. var attributes = parsed.attributes;
  2542. if (attributes) for (var attr, i = 0, l = attributes.length; i < l; i++){
  2543. attr = attributes[i];
  2544. if (props[attr.key] != null) continue;
  2545. if (attr.value != null && attr.operator == '=') props[attr.key] = attr.value;
  2546. else if (!attr.value && !attr.operator) props[attr.key] = true;
  2547. }
  2548. if (parsed.classList && props['class'] == null) props['class'] = parsed.classList.join(' ');
  2549. }
  2550. return document.newElement(tag, props);
  2551. };
  2552. if (Browser.Element){
  2553. Element.prototype = Browser.Element.prototype;
  2554. // IE8 and IE9 require the wrapping.
  2555. Element.prototype._fireEvent = (function(fireEvent){
  2556. return function(type, event){
  2557. return fireEvent.call(this, type, event);
  2558. };
  2559. })(Element.prototype.fireEvent);
  2560. }
  2561. new Type('Element', Element).mirror(function(name){
  2562. if (Array.prototype[name]) return;
  2563. var obj = {};
  2564. obj[name] = function(){
  2565. var results = [], args = arguments, elements = true;
  2566. for (var i = 0, l = this.length; i < l; i++){
  2567. var element = this[i], result = results[i] = element[name].apply(element, args);
  2568. elements = (elements && typeOf(result) == 'element');
  2569. }
  2570. return (elements) ? new Elements(results) : results;
  2571. };
  2572. Elements.implement(obj);
  2573. });
  2574. if (!Browser.Element){
  2575. Element.parent = Object;
  2576. Element.Prototype = {
  2577. '$constructor': Element,
  2578. '$family': Function.convert('element').hide()
  2579. };
  2580. Element.mirror(function(name, method){
  2581. Element.Prototype[name] = method;
  2582. });
  2583. }
  2584. Element.Constructors = {};
  2585. //<1.2compat>
  2586. Element.Constructors = new Hash;
  2587. //</1.2compat>
  2588. var IFrame = new Type('IFrame', function(){
  2589. var params = Array.link(arguments, {
  2590. properties: Type.isObject,
  2591. iframe: function(obj){
  2592. return (obj != null);
  2593. }
  2594. });
  2595. var props = params.properties || {}, iframe;
  2596. if (params.iframe) iframe = document.id(params.iframe);
  2597. var onload = props.onload || function(){};
  2598. delete props.onload;
  2599. props.id = props.name = [props.id, props.name, iframe ? (iframe.id || iframe.name) : 'IFrame_' + String.uniqueID()].pick();
  2600. iframe = new Element(iframe || 'iframe', props);
  2601. var onLoad = function(){
  2602. onload.call(iframe.contentWindow);
  2603. };
  2604. if (window.frames[props.id]) onLoad();
  2605. else iframe.addListener('load', onLoad);
  2606. return iframe;
  2607. });
  2608. var Elements = this.Elements = function(nodes){
  2609. if (nodes && nodes.length){
  2610. var uniques = {}, node;
  2611. for (var i = 0; node = nodes[i++];){
  2612. var uid = Slick.uidOf(node);
  2613. if (!uniques[uid]){
  2614. uniques[uid] = true;
  2615. this.push(node);
  2616. }
  2617. }
  2618. }
  2619. };
  2620. Elements.prototype = {length: 0};
  2621. Elements.parent = Array;
  2622. new Type('Elements', Elements).implement({
  2623. filter: function(filter, bind){
  2624. if (!filter) return this;
  2625. return new Elements(Array.filter(this, (typeOf(filter) == 'string') ? function(item){
  2626. return item.match(filter);
  2627. } : filter, bind));
  2628. }.protect(),
  2629. push: function(){
  2630. var length = this.length;
  2631. for (var i = 0, l = arguments.length; i < l; i++){
  2632. var item = document.id(arguments[i]);
  2633. if (item) this[length++] = item;
  2634. }
  2635. return (this.length = length);
  2636. }.protect(),
  2637. unshift: function(){
  2638. var items = [];
  2639. for (var i = 0, l = arguments.length; i < l; i++){
  2640. var item = document.id(arguments[i]);
  2641. if (item) items.push(item);
  2642. }
  2643. return Array.prototype.unshift.apply(this, items);
  2644. }.protect(),
  2645. concat: function(){
  2646. var newElements = new Elements(this);
  2647. for (var i = 0, l = arguments.length; i < l; i++){
  2648. var item = arguments[i];
  2649. if (Type.isEnumerable(item)) newElements.append(item);
  2650. else newElements.push(item);
  2651. }
  2652. return newElements;
  2653. }.protect(),
  2654. append: function(collection){
  2655. for (var i = 0, l = collection.length; i < l; i++) this.push(collection[i]);
  2656. return this;
  2657. }.protect(),
  2658. empty: function(){
  2659. while (this.length) delete this[--this.length];
  2660. return this;
  2661. }.protect()
  2662. });
  2663. //<1.2compat>
  2664. Elements.alias('extend', 'append');
  2665. //</1.2compat>
  2666. (function(){
  2667. // FF, IE
  2668. var splice = Array.prototype.splice, object = {'0': 0, '1': 1, length: 2};
  2669. splice.call(object, 1, 1);
  2670. if (object[1] == 1) Elements.implement('splice', function(){
  2671. var length = this.length;
  2672. var result = splice.apply(this, arguments);
  2673. while (length >= this.length) delete this[length--];
  2674. return result;
  2675. }.protect());
  2676. Array.forEachMethod(function(method, name){
  2677. Elements.implement(name, method);
  2678. });
  2679. Array.mirror(Elements);
  2680. /*<ltIE8>*/
  2681. var createElementAcceptsHTML;
  2682. try {
  2683. createElementAcceptsHTML = (document.createElement('<input name=x>').name == 'x');
  2684. } catch (e){}
  2685. var escapeQuotes = function(html){
  2686. return ('' + html).replace(/&/g, '&amp;').replace(/"/g, '&quot;');
  2687. };
  2688. /*</ltIE8>*/
  2689. /*<ltIE9>*/
  2690. // #2479 - IE8 Cannot set HTML of style element
  2691. var canChangeStyleHTML = (function(){
  2692. var div = document.createElement('style'),
  2693. flag = false;
  2694. try {
  2695. div.innerHTML = '#justTesing{margin: 0px;}';
  2696. flag = !!div.innerHTML;
  2697. } catch (e){}
  2698. return flag;
  2699. })();
  2700. /*</ltIE9>*/
  2701. Document.implement({
  2702. newElement: function(tag, props){
  2703. if (props){
  2704. if (props.checked != null) props.defaultChecked = props.checked;
  2705. if ((props.type == 'checkbox' || props.type == 'radio') && props.value == null) props.value = 'on';
  2706. /*<ltIE9>*/ // IE needs the type to be set before changing content of style element
  2707. if (!canChangeStyleHTML && tag == 'style'){
  2708. var styleElement = document.createElement('style');
  2709. styleElement.setAttribute('type', 'text/css');
  2710. if (props.type) delete props.type;
  2711. return this.id(styleElement).set(props);
  2712. }
  2713. /*</ltIE9>*/
  2714. /*<ltIE8>*/// Fix for readonly name and type properties in IE < 8
  2715. if (createElementAcceptsHTML){
  2716. tag = '<' + tag;
  2717. if (props.name) tag += ' name="' + escapeQuotes(props.name) + '"';
  2718. if (props.type) tag += ' type="' + escapeQuotes(props.type) + '"';
  2719. tag += '>';
  2720. delete props.name;
  2721. delete props.type;
  2722. }
  2723. /*</ltIE8>*/
  2724. }
  2725. return this.id(this.createElement(tag)).set(props);
  2726. }
  2727. });
  2728. })();
  2729. (function(){
  2730. Slick.uidOf(window);
  2731. Slick.uidOf(document);
  2732. Document.implement({
  2733. newTextNode: function(text){
  2734. return this.createTextNode(text);
  2735. },
  2736. getDocument: function(){
  2737. return this;
  2738. },
  2739. getWindow: function(){
  2740. return this.window;
  2741. },
  2742. id: (function(){
  2743. var types = {
  2744. string: function(id, nocash, doc){
  2745. id = Slick.find(doc, '#' + id.replace(/(\W)/g, '\\$1'));
  2746. return (id) ? types.element(id, nocash) : null;
  2747. },
  2748. element: function(el, nocash){
  2749. Slick.uidOf(el);
  2750. if (!nocash && !el.$family && !(/^(?:object|embed)$/i).test(el.tagName)){
  2751. var fireEvent = el.fireEvent;
  2752. // wrapping needed in IE7, or else crash
  2753. el._fireEvent = function(type, event){
  2754. return fireEvent(type, event);
  2755. };
  2756. Object.append(el, Element.Prototype);
  2757. }
  2758. return el;
  2759. },
  2760. object: function(obj, nocash, doc){
  2761. if (obj.toElement) return types.element(obj.toElement(doc), nocash);
  2762. return null;
  2763. }
  2764. };
  2765. types.textnode = types.whitespace = types.window = types.document = function(zero){
  2766. return zero;
  2767. };
  2768. return function(el, nocash, doc){
  2769. if (el && el.$family && el.uniqueNumber) return el;
  2770. var type = typeOf(el);
  2771. return (types[type]) ? types[type](el, nocash, doc || document) : null;
  2772. };
  2773. })()
  2774. });
  2775. if (window.$ == null) Window.implement('$', function(el, nc){
  2776. return document.id(el, nc, this.document);
  2777. });
  2778. Window.implement({
  2779. getDocument: function(){
  2780. return this.document;
  2781. },
  2782. getWindow: function(){
  2783. return this;
  2784. }
  2785. });
  2786. [Document, Element].invoke('implement', {
  2787. getElements: function(expression){
  2788. return Slick.search(this, expression, new Elements);
  2789. },
  2790. getElement: function(expression){
  2791. return document.id(Slick.find(this, expression));
  2792. }
  2793. });
  2794. var contains = {contains: function(element){
  2795. return Slick.contains(this, element);
  2796. }};
  2797. if (!document.contains) Document.implement(contains);
  2798. if (!document.createElement('div').contains) Element.implement(contains);
  2799. //<1.2compat>
  2800. Element.implement('hasChild', function(element){
  2801. return this !== element && this.contains(element);
  2802. });
  2803. (function(search, find, match){
  2804. this.Selectors = {};
  2805. var pseudos = this.Selectors.Pseudo = new Hash();
  2806. var addSlickPseudos = function(){
  2807. for (var name in pseudos) if (pseudos.hasOwnProperty(name)){
  2808. Slick.definePseudo(name, pseudos[name]);
  2809. delete pseudos[name];
  2810. }
  2811. };
  2812. Slick.search = function(context, expression, append){
  2813. addSlickPseudos();
  2814. return search.call(this, context, expression, append);
  2815. };
  2816. Slick.find = function(context, expression){
  2817. addSlickPseudos();
  2818. return find.call(this, context, expression);
  2819. };
  2820. Slick.match = function(node, selector){
  2821. addSlickPseudos();
  2822. return match.call(this, node, selector);
  2823. };
  2824. })(Slick.search, Slick.find, Slick.match);
  2825. //</1.2compat>
  2826. // tree walking
  2827. var injectCombinator = function(expression, combinator){
  2828. if (!expression) return combinator;
  2829. expression = Object.clone(Slick.parse(expression));
  2830. var expressions = expression.expressions;
  2831. for (var i = expressions.length; i--;)
  2832. expressions[i][0].combinator = combinator;
  2833. return expression;
  2834. };
  2835. Object.forEach({
  2836. getNext: '~',
  2837. getPrevious: '!~',
  2838. getParent: '!'
  2839. }, function(combinator, method){
  2840. Element.implement(method, function(expression){
  2841. return this.getElement(injectCombinator(expression, combinator));
  2842. });
  2843. });
  2844. Object.forEach({
  2845. getAllNext: '~',
  2846. getAllPrevious: '!~',
  2847. getSiblings: '~~',
  2848. getChildren: '>',
  2849. getParents: '!'
  2850. }, function(combinator, method){
  2851. Element.implement(method, function(expression){
  2852. return this.getElements(injectCombinator(expression, combinator));
  2853. });
  2854. });
  2855. Element.implement({
  2856. getFirst: function(expression){
  2857. return document.id(Slick.search(this, injectCombinator(expression, '>'))[0]);
  2858. },
  2859. getLast: function(expression){
  2860. return document.id(Slick.search(this, injectCombinator(expression, '>')).getLast());
  2861. },
  2862. getWindow: function(){
  2863. return this.ownerDocument.window;
  2864. },
  2865. getDocument: function(){
  2866. return this.ownerDocument;
  2867. },
  2868. getElementById: function(id){
  2869. return document.id(Slick.find(this, '#' + ('' + id).replace(/(\W)/g, '\\$1')));
  2870. },
  2871. match: function(expression){
  2872. return !expression || Slick.match(this, expression);
  2873. }
  2874. });
  2875. //<1.2compat>
  2876. if (window.$$ == null) Window.implement('$$', function(selector){
  2877. var elements = new Elements;
  2878. if (arguments.length == 1 && typeof selector == 'string') return Slick.search(this.document, selector, elements);
  2879. var args = Array.flatten(arguments);
  2880. for (var i = 0, l = args.length; i < l; i++){
  2881. var item = args[i];
  2882. switch (typeOf(item)){
  2883. case 'element': elements.push(item); break;
  2884. case 'string': Slick.search(this.document, item, elements);
  2885. }
  2886. }
  2887. return elements;
  2888. });
  2889. //</1.2compat>
  2890. if (window.$$ == null) Window.implement('$$', function(selector){
  2891. if (arguments.length == 1){
  2892. if (typeof selector == 'string') return Slick.search(this.document, selector, new Elements);
  2893. else if (Type.isEnumerable(selector)) return new Elements(selector);
  2894. }
  2895. return new Elements(arguments);
  2896. });
  2897. // Inserters
  2898. var inserters = {
  2899. before: function(context, element){
  2900. var parent = element.parentNode;
  2901. if (parent) parent.insertBefore(context, element);
  2902. },
  2903. after: function(context, element){
  2904. var parent = element.parentNode;
  2905. if (parent) parent.insertBefore(context, element.nextSibling);
  2906. },
  2907. bottom: function(context, element){
  2908. element.appendChild(context);
  2909. },
  2910. top: function(context, element){
  2911. element.insertBefore(context, element.firstChild);
  2912. }
  2913. };
  2914. inserters.inside = inserters.bottom;
  2915. //<1.2compat>
  2916. Object.each(inserters, function(inserter, where){
  2917. where = where.capitalize();
  2918. var methods = {};
  2919. methods['inject' + where] = function(el){
  2920. inserter(this, document.id(el, true));
  2921. return this;
  2922. };
  2923. methods['grab' + where] = function(el){
  2924. inserter(document.id(el, true), this);
  2925. return this;
  2926. };
  2927. Element.implement(methods);
  2928. });
  2929. //</1.2compat>
  2930. // getProperty / setProperty
  2931. var propertyGetters = {}, propertySetters = {};
  2932. // properties
  2933. var properties = {};
  2934. Array.forEach([
  2935. 'type', 'value', 'defaultValue', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan',
  2936. 'frameBorder', 'rowSpan', 'tabIndex', 'useMap'
  2937. ], function(property){
  2938. properties[property.toLowerCase()] = property;
  2939. });
  2940. properties.html = 'innerHTML';
  2941. properties.text = (document.createElement('div').textContent == null) ? 'innerText': 'textContent';
  2942. Object.forEach(properties, function(real, key){
  2943. propertySetters[key] = function(node, value){
  2944. node[real] = value;
  2945. };
  2946. propertyGetters[key] = function(node){
  2947. return node[real];
  2948. };
  2949. });
  2950. /*<ltIE9>*/
  2951. propertySetters.text = (function(){
  2952. return function(node, value){
  2953. if (node.get('tag') == 'style') node.set('html', value);
  2954. else node[properties.text] = value;
  2955. };
  2956. })(propertySetters.text);
  2957. propertyGetters.text = (function(getter){
  2958. return function(node){
  2959. return (node.get('tag') == 'style') ? node.innerHTML : getter(node);
  2960. };
  2961. })(propertyGetters.text);
  2962. /*</ltIE9>*/
  2963. // Booleans
  2964. var bools = [
  2965. 'compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked',
  2966. 'disabled', 'readOnly', 'multiple', 'selected', 'noresize',
  2967. 'defer', 'defaultChecked', 'autofocus', 'controls', 'autoplay',
  2968. 'loop'
  2969. ];
  2970. var booleans = {};
  2971. Array.forEach(bools, function(bool){
  2972. var lower = bool.toLowerCase();
  2973. booleans[lower] = bool;
  2974. propertySetters[lower] = function(node, value){
  2975. node[bool] = !!value;
  2976. };
  2977. propertyGetters[lower] = function(node){
  2978. return !!node[bool];
  2979. };
  2980. });
  2981. // Special cases
  2982. Object.append(propertySetters, {
  2983. 'class': function(node, value){
  2984. ('className' in node) ? node.className = (value || '') : node.setAttribute('class', value);
  2985. },
  2986. 'for': function(node, value){
  2987. ('htmlFor' in node) ? node.htmlFor = value : node.setAttribute('for', value);
  2988. },
  2989. 'style': function(node, value){
  2990. (node.style) ? node.style.cssText = value : node.setAttribute('style', value);
  2991. },
  2992. 'value': function(node, value){
  2993. node.value = (value != null) ? value : '';
  2994. }
  2995. });
  2996. propertyGetters['class'] = function(node){
  2997. return ('className' in node) ? node.className || null : node.getAttribute('class');
  2998. };
  2999. /* <webkit> */
  3000. var el = document.createElement('button');
  3001. // IE sets type as readonly and throws
  3002. try { el.type = 'button'; } catch (e){}
  3003. if (el.type != 'button') propertySetters.type = function(node, value){
  3004. node.setAttribute('type', value);
  3005. };
  3006. el = null;
  3007. /* </webkit> */
  3008. /*<IE>*/
  3009. /*<ltIE9>*/
  3010. // #2479 - IE8 Cannot set HTML of style element
  3011. var canChangeStyleHTML = (function(){
  3012. var div = document.createElement('style'),
  3013. flag = false;
  3014. try {
  3015. div.innerHTML = '#justTesing{margin: 0px;}';
  3016. flag = !!div.innerHTML;
  3017. } catch (e){}
  3018. return flag;
  3019. })();
  3020. /*</ltIE9>*/
  3021. var input = document.createElement('input'), volatileInputValue, html5InputSupport;
  3022. // #2178
  3023. input.value = 't';
  3024. input.type = 'submit';
  3025. volatileInputValue = input.value != 't';
  3026. // #2443 - IE throws "Invalid Argument" when trying to use html5 input types
  3027. try {
  3028. input.value = '';
  3029. input.type = 'email';
  3030. html5InputSupport = input.type == 'email';
  3031. } catch (e){}
  3032. input = null;
  3033. if (volatileInputValue || !html5InputSupport) propertySetters.type = function(node, type){
  3034. try {
  3035. var value = node.value;
  3036. node.type = type;
  3037. node.value = value;
  3038. } catch (e){}
  3039. };
  3040. /*</IE>*/
  3041. /* getProperty, setProperty */
  3042. /* <ltIE9> */
  3043. var pollutesGetAttribute = (function(div){
  3044. div.random = 'attribute';
  3045. return (div.getAttribute('random') == 'attribute');
  3046. })(document.createElement('div'));
  3047. var hasCloneBug = (function(test){
  3048. test.innerHTML = '<object><param name="should_fix" value="the unknown" /></object>';
  3049. return test.cloneNode(true).firstChild.childNodes.length != 1;
  3050. })(document.createElement('div'));
  3051. /* </ltIE9> */
  3052. var hasClassList = !!document.createElement('div').classList;
  3053. var classes = function(className){
  3054. var classNames = (className || '').clean().split(' '), uniques = {};
  3055. return classNames.filter(function(className){
  3056. if (className !== '' && !uniques[className]) return uniques[className] = className;
  3057. });
  3058. };
  3059. var addToClassList = function(name){
  3060. this.classList.add(name);
  3061. };
  3062. var removeFromClassList = function(name){
  3063. this.classList.remove(name);
  3064. };
  3065. Element.implement({
  3066. setProperty: function(name, value){
  3067. var setter = propertySetters[name.toLowerCase()];
  3068. if (setter){
  3069. setter(this, value);
  3070. } else {
  3071. /* <ltIE9> */
  3072. var attributeWhiteList;
  3073. if (pollutesGetAttribute) attributeWhiteList = this.retrieve('$attributeWhiteList', {});
  3074. /* </ltIE9> */
  3075. if (value == null){
  3076. this.removeAttribute(name);
  3077. /* <ltIE9> */
  3078. if (pollutesGetAttribute) delete attributeWhiteList[name];
  3079. /* </ltIE9> */
  3080. } else {
  3081. this.setAttribute(name, '' + value);
  3082. /* <ltIE9> */
  3083. if (pollutesGetAttribute) attributeWhiteList[name] = true;
  3084. /* </ltIE9> */
  3085. }
  3086. }
  3087. return this;
  3088. },
  3089. setProperties: function(attributes){
  3090. for (var attribute in attributes) this.setProperty(attribute, attributes[attribute]);
  3091. return this;
  3092. },
  3093. getProperty: function(name){
  3094. var getter = propertyGetters[name.toLowerCase()];
  3095. if (getter) return getter(this);
  3096. /* <ltIE9> */
  3097. if (pollutesGetAttribute){
  3098. var attr = this.getAttributeNode(name), attributeWhiteList = this.retrieve('$attributeWhiteList', {});
  3099. if (!attr) return null;
  3100. if (attr.expando && !attributeWhiteList[name]){
  3101. var outer = this.outerHTML;
  3102. // segment by the opening tag and find mention of attribute name
  3103. if (outer.substr(0, outer.search(/\/?['"]?>(?![^<]*<['"])/)).indexOf(name) < 0) return null;
  3104. attributeWhiteList[name] = true;
  3105. }
  3106. }
  3107. /* </ltIE9> */
  3108. var result = Slick.getAttribute(this, name);
  3109. return (!result && !Slick.hasAttribute(this, name)) ? null : result;
  3110. },
  3111. getProperties: function(){
  3112. var args = Array.convert(arguments);
  3113. return args.map(this.getProperty, this).associate(args);
  3114. },
  3115. removeProperty: function(name){
  3116. return this.setProperty(name, null);
  3117. },
  3118. removeProperties: function(){
  3119. Array.each(arguments, this.removeProperty, this);
  3120. return this;
  3121. },
  3122. set: function(prop, value){
  3123. var property = Element.Properties[prop];
  3124. (property && property.set) ? property.set.call(this, value) : this.setProperty(prop, value);
  3125. }.overloadSetter(),
  3126. get: function(prop){
  3127. var property = Element.Properties[prop];
  3128. return (property && property.get) ? property.get.apply(this) : this.getProperty(prop);
  3129. }.overloadGetter(),
  3130. erase: function(prop){
  3131. var property = Element.Properties[prop];
  3132. (property && property.erase) ? property.erase.apply(this) : this.removeProperty(prop);
  3133. return this;
  3134. },
  3135. hasClass: hasClassList ? function(className){
  3136. return this.classList.contains(className);
  3137. } : function(className){
  3138. return classes(this.className).contains(className);
  3139. },
  3140. addClass: hasClassList ? function(className){
  3141. classes(className).forEach(addToClassList, this);
  3142. return this;
  3143. } : function(className){
  3144. this.className = classes(className + ' ' + this.className).join(' ');
  3145. return this;
  3146. },
  3147. removeClass: hasClassList ? function(className){
  3148. classes(className).forEach(removeFromClassList, this);
  3149. return this;
  3150. } : function(className){
  3151. var classNames = classes(this.className);
  3152. classes(className).forEach(classNames.erase, classNames);
  3153. this.className = classNames.join(' ');
  3154. return this;
  3155. },
  3156. toggleClass: function(className, force){
  3157. if (force == null) force = !this.hasClass(className);
  3158. return (force) ? this.addClass(className) : this.removeClass(className);
  3159. },
  3160. adopt: function(){
  3161. var parent = this, fragment, elements = Array.flatten(arguments), length = elements.length;
  3162. if (length > 1) parent = fragment = document.createDocumentFragment();
  3163. for (var i = 0; i < length; i++){
  3164. var element = document.id(elements[i], true);
  3165. if (element) parent.appendChild(element);
  3166. }
  3167. if (fragment) this.appendChild(fragment);
  3168. return this;
  3169. },
  3170. appendText: function(text, where){
  3171. return this.grab(this.getDocument().newTextNode(text), where);
  3172. },
  3173. grab: function(el, where){
  3174. inserters[where || 'bottom'](document.id(el, true), this);
  3175. return this;
  3176. },
  3177. inject: function(el, where){
  3178. inserters[where || 'bottom'](this, document.id(el, true));
  3179. return this;
  3180. },
  3181. replaces: function(el){
  3182. el = document.id(el, true);
  3183. el.parentNode.replaceChild(this, el);
  3184. return this;
  3185. },
  3186. wraps: function(el, where){
  3187. el = document.id(el, true);
  3188. return this.replaces(el).grab(el, where);
  3189. },
  3190. getSelected: function(){
  3191. this.selectedIndex; // Safari 3.2.1
  3192. return new Elements(Array.convert(this.options).filter(function(option){
  3193. return option.selected;
  3194. }));
  3195. },
  3196. toQueryString: function(){
  3197. var queryString = [];
  3198. this.getElements('input, select, textarea').each(function(el){
  3199. var type = el.type;
  3200. if (!el.name || el.disabled || type == 'submit' || type == 'reset' || type == 'file' || type == 'image') return;
  3201. var value = (el.get('tag') == 'select') ? el.getSelected().map(function(opt){
  3202. // IE
  3203. return document.id(opt).get('value');
  3204. }) : ((type == 'radio' || type == 'checkbox') && !el.checked) ? null : el.get('value');
  3205. Array.convert(value).each(function(val){
  3206. if (typeof val != 'undefined') queryString.push(encodeURIComponent(el.name) + '=' + encodeURIComponent(val));
  3207. });
  3208. });
  3209. return queryString.join('&');
  3210. }
  3211. });
  3212. // appendHTML
  3213. var appendInserters = {
  3214. before: 'beforeBegin',
  3215. after: 'afterEnd',
  3216. bottom: 'beforeEnd',
  3217. top: 'afterBegin',
  3218. inside: 'beforeEnd'
  3219. };
  3220. Element.implement('appendHTML', ('insertAdjacentHTML' in document.createElement('div')) ? function(html, where){
  3221. this.insertAdjacentHTML(appendInserters[where || 'bottom'], html);
  3222. return this;
  3223. } : function(html, where){
  3224. var temp = new Element('div', {html: html}),
  3225. children = temp.childNodes,
  3226. fragment = temp.firstChild;
  3227. if (!fragment) return this;
  3228. if (children.length > 1){
  3229. fragment = document.createDocumentFragment();
  3230. for (var i = 0, l = children.length; i < l; i++){
  3231. fragment.appendChild(children[i]);
  3232. }
  3233. }
  3234. inserters[where || 'bottom'](fragment, this);
  3235. return this;
  3236. });
  3237. var collected = {}, storage = {};
  3238. var get = function(uid){
  3239. return (storage[uid] || (storage[uid] = {}));
  3240. };
  3241. var clean = function(item){
  3242. var uid = item.uniqueNumber;
  3243. if (item.removeEvents) item.removeEvents();
  3244. if (item.clearAttributes) item.clearAttributes();
  3245. if (uid != null){
  3246. delete collected[uid];
  3247. delete storage[uid];
  3248. }
  3249. return item;
  3250. };
  3251. var formProps = {input: 'checked', option: 'selected', textarea: 'value'};
  3252. Element.implement({
  3253. destroy: function(){
  3254. var children = clean(this).getElementsByTagName('*');
  3255. Array.each(children, clean);
  3256. Element.dispose(this);
  3257. return null;
  3258. },
  3259. empty: function(){
  3260. Array.convert(this.childNodes).each(Element.dispose);
  3261. return this;
  3262. },
  3263. dispose: function(){
  3264. return (this.parentNode) ? this.parentNode.removeChild(this) : this;
  3265. },
  3266. clone: function(contents, keepid){
  3267. contents = contents !== false;
  3268. var clone = this.cloneNode(contents), ce = [clone], te = [this], i;
  3269. if (contents){
  3270. ce.append(Array.convert(clone.getElementsByTagName('*')));
  3271. te.append(Array.convert(this.getElementsByTagName('*')));
  3272. }
  3273. for (i = ce.length; i--;){
  3274. var node = ce[i], element = te[i];
  3275. if (!keepid) node.removeAttribute('id');
  3276. /*<ltIE9>*/
  3277. if (node.clearAttributes){
  3278. node.clearAttributes();
  3279. node.mergeAttributes(element);
  3280. node.removeAttribute('uniqueNumber');
  3281. if (node.options){
  3282. var no = node.options, eo = element.options;
  3283. for (var j = no.length; j--;) no[j].selected = eo[j].selected;
  3284. }
  3285. }
  3286. /*</ltIE9>*/
  3287. var prop = formProps[element.tagName.toLowerCase()];
  3288. if (prop && element[prop]) node[prop] = element[prop];
  3289. }
  3290. /*<ltIE9>*/
  3291. if (hasCloneBug){
  3292. var co = clone.getElementsByTagName('object'), to = this.getElementsByTagName('object');
  3293. for (i = co.length; i--;) co[i].outerHTML = to[i].outerHTML;
  3294. }
  3295. /*</ltIE9>*/
  3296. return document.id(clone);
  3297. }
  3298. });
  3299. [Element, Window, Document].invoke('implement', {
  3300. addListener: function(type, fn){
  3301. if (window.attachEvent && !window.addEventListener){
  3302. collected[Slick.uidOf(this)] = this;
  3303. }
  3304. if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]);
  3305. else this.attachEvent('on' + type, fn);
  3306. return this;
  3307. },
  3308. removeListener: function(type, fn){
  3309. if (this.removeEventListener) this.removeEventListener(type, fn, !!arguments[2]);
  3310. else this.detachEvent('on' + type, fn);
  3311. return this;
  3312. },
  3313. retrieve: function(property, dflt){
  3314. var storage = get(Slick.uidOf(this)), prop = storage[property];
  3315. if (dflt != null && prop == null) prop = storage[property] = dflt;
  3316. return prop != null ? prop : null;
  3317. },
  3318. store: function(property, value){
  3319. var storage = get(Slick.uidOf(this));
  3320. storage[property] = value;
  3321. return this;
  3322. },
  3323. eliminate: function(property){
  3324. var storage = get(Slick.uidOf(this));
  3325. delete storage[property];
  3326. return this;
  3327. }
  3328. });
  3329. /*<ltIE9>*/
  3330. if (window.attachEvent && !window.addEventListener){
  3331. var gc = function(){
  3332. Object.each(collected, clean);
  3333. if (window.CollectGarbage) CollectGarbage();
  3334. window.removeListener('unload', gc);
  3335. };
  3336. window.addListener('unload', gc);
  3337. }
  3338. /*</ltIE9>*/
  3339. Element.Properties = {};
  3340. //<1.2compat>
  3341. Element.Properties = new Hash;
  3342. //</1.2compat>
  3343. Element.Properties.style = {
  3344. set: function(style){
  3345. this.style.cssText = style;
  3346. },
  3347. get: function(){
  3348. return this.style.cssText;
  3349. },
  3350. erase: function(){
  3351. this.style.cssText = '';
  3352. }
  3353. };
  3354. Element.Properties.tag = {
  3355. get: function(){
  3356. return this.tagName.toLowerCase();
  3357. }
  3358. };
  3359. Element.Properties.html = {
  3360. set: function(html){
  3361. if (html == null) html = '';
  3362. else if (typeOf(html) == 'array') html = html.join('');
  3363. /*<ltIE9>*/
  3364. if (this.styleSheet && !canChangeStyleHTML) this.styleSheet.cssText = html;
  3365. else /*</ltIE9>*/this.innerHTML = html;
  3366. },
  3367. erase: function(){
  3368. this.set('html', '');
  3369. }
  3370. };
  3371. var supportsHTML5Elements = true, supportsTableInnerHTML = true, supportsTRInnerHTML = true;
  3372. /*<ltIE9>*/
  3373. // technique by jdbarlett - http://jdbartlett.com/innershiv/
  3374. var div = document.createElement('div');
  3375. var fragment;
  3376. div.innerHTML = '<nav></nav>';
  3377. supportsHTML5Elements = (div.childNodes.length == 1);
  3378. if (!supportsHTML5Elements){
  3379. var tags = 'abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' ');
  3380. fragment = document.createDocumentFragment(), l = tags.length;
  3381. while (l--) fragment.createElement(tags[l]);
  3382. }
  3383. div = null;
  3384. /*</ltIE9>*/
  3385. /*<IE>*/
  3386. supportsTableInnerHTML = Function.attempt(function(){
  3387. var table = document.createElement('table');
  3388. table.innerHTML = '<tr><td></td></tr>';
  3389. return true;
  3390. });
  3391. /*<ltFF4>*/
  3392. var tr = document.createElement('tr'), html = '<td></td>';
  3393. tr.innerHTML = html;
  3394. supportsTRInnerHTML = (tr.innerHTML == html);
  3395. tr = null;
  3396. /*</ltFF4>*/
  3397. if (!supportsTableInnerHTML || !supportsTRInnerHTML || !supportsHTML5Elements){
  3398. Element.Properties.html.set = (function(set){
  3399. var translations = {
  3400. table: [1, '<table>', '</table>'],
  3401. select: [1, '<select>', '</select>'],
  3402. tbody: [2, '<table><tbody>', '</tbody></table>'],
  3403. tr: [3, '<table><tbody><tr>', '</tr></tbody></table>']
  3404. };
  3405. translations.thead = translations.tfoot = translations.tbody;
  3406. return function(html){
  3407. /*<ltIE9>*/
  3408. if (this.styleSheet) return set.call(this, html);
  3409. /*</ltIE9>*/
  3410. var wrap = translations[this.get('tag')];
  3411. if (!wrap && !supportsHTML5Elements) wrap = [0, '', ''];
  3412. if (!wrap) return set.call(this, html);
  3413. var level = wrap[0], wrapper = document.createElement('div'), target = wrapper;
  3414. if (!supportsHTML5Elements) fragment.appendChild(wrapper);
  3415. wrapper.innerHTML = [wrap[1], html, wrap[2]].flatten().join('');
  3416. while (level--) target = target.firstChild;
  3417. this.empty().adopt(target.childNodes);
  3418. if (!supportsHTML5Elements) fragment.removeChild(wrapper);
  3419. wrapper = null;
  3420. };
  3421. })(Element.Properties.html.set);
  3422. }
  3423. /*</IE>*/
  3424. /*<ltIE9>*/
  3425. var testForm = document.createElement('form');
  3426. testForm.innerHTML = '<select><option>s</option></select>';
  3427. if (testForm.firstChild.value != 's') Element.Properties.value = {
  3428. set: function(value){
  3429. var tag = this.get('tag');
  3430. if (tag != 'select') return this.setProperty('value', value);
  3431. var options = this.getElements('option');
  3432. value = String(value);
  3433. for (var i = 0; i < options.length; i++){
  3434. var option = options[i],
  3435. attr = option.getAttributeNode('value'),
  3436. optionValue = (attr && attr.specified) ? option.value : option.get('text');
  3437. if (optionValue === value) return option.selected = true;
  3438. }
  3439. },
  3440. get: function(){
  3441. var option = this, tag = option.get('tag');
  3442. if (tag != 'select' && tag != 'option') return this.getProperty('value');
  3443. if (tag == 'select' && !(option = option.getSelected()[0])) return '';
  3444. var attr = option.getAttributeNode('value');
  3445. return (attr && attr.specified) ? option.value : option.get('text');
  3446. }
  3447. };
  3448. testForm = null;
  3449. /*</ltIE9>*/
  3450. /*<IE>*/
  3451. if (document.createElement('div').getAttributeNode('id')) Element.Properties.id = {
  3452. set: function(id){
  3453. this.id = this.getAttributeNode('id').value = id;
  3454. },
  3455. get: function(){
  3456. return this.id || null;
  3457. },
  3458. erase: function(){
  3459. this.id = this.getAttributeNode('id').value = '';
  3460. }
  3461. };
  3462. /*</IE>*/
  3463. })();
  3464. /*
  3465. ---
  3466. name: Event
  3467. description: Contains the Event Type, to make the event object cross-browser.
  3468. license: MIT-style license.
  3469. requires: [Window, Document, Array, Function, String, Object]
  3470. provides: Event
  3471. ...
  3472. */
  3473. (function(){
  3474. var _keys = {};
  3475. var normalizeWheelSpeed = function(event){
  3476. var normalized;
  3477. if (event.wheelDelta){
  3478. normalized = event.wheelDelta % 120 == 0 ? event.wheelDelta / 120 : event.wheelDelta / 12;
  3479. } else {
  3480. var rawAmount = event.deltaY || event.detail || 0;
  3481. normalized = -(rawAmount % 3 == 0 ? rawAmount / 3 : rawAmount * 10);
  3482. }
  3483. return normalized;
  3484. };
  3485. var DOMEvent = this.DOMEvent = new Type('DOMEvent', function(event, win){
  3486. if (!win) win = window;
  3487. event = event || win.event;
  3488. if (event.$extended) return event;
  3489. this.event = event;
  3490. this.$extended = true;
  3491. this.shift = event.shiftKey;
  3492. this.control = event.ctrlKey;
  3493. this.alt = event.altKey;
  3494. this.meta = event.metaKey;
  3495. var type = this.type = event.type;
  3496. var target = event.target || event.srcElement;
  3497. while (target && target.nodeType == 3) target = target.parentNode;
  3498. this.target = document.id(target);
  3499. if (type.indexOf('key') == 0){
  3500. var code = this.code = (event.which || event.keyCode);
  3501. if (!this.shift || type != 'keypress') this.key = _keys[code]/*<1.3compat>*/ || Object.keyOf(Event.Keys, code)/*</1.3compat>*/;
  3502. if (type == 'keydown' || type == 'keyup'){
  3503. if (code > 111 && code < 124) this.key = 'f' + (code - 111);
  3504. else if (code > 95 && code < 106) this.key = code - 96;
  3505. }
  3506. if (this.key == null) this.key = String.fromCharCode(code).toLowerCase();
  3507. } else if (type == 'click' || type == 'dblclick' || type == 'contextmenu' || type == 'wheel' || type == 'DOMMouseScroll' || type.indexOf('mouse') == 0){
  3508. var doc = win.document;
  3509. doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
  3510. this.page = {
  3511. x: (event.pageX != null) ? event.pageX : event.clientX + doc.scrollLeft,
  3512. y: (event.pageY != null) ? event.pageY : event.clientY + doc.scrollTop
  3513. };
  3514. this.client = {
  3515. x: (event.pageX != null) ? event.pageX - win.pageXOffset : event.clientX,
  3516. y: (event.pageY != null) ? event.pageY - win.pageYOffset : event.clientY
  3517. };
  3518. if (type == 'DOMMouseScroll' || type == 'wheel' || type == 'mousewheel') this.wheel = normalizeWheelSpeed(event);
  3519. this.rightClick = (event.which == 3 || event.button == 2);
  3520. if (type == 'mouseover' || type == 'mouseout' || type == 'mouseenter' || type == 'mouseleave'){
  3521. var overTarget = type == 'mouseover' || type == 'mouseenter';
  3522. var related = event.relatedTarget || event[(overTarget ? 'from' : 'to') + 'Element'];
  3523. while (related && related.nodeType == 3) related = related.parentNode;
  3524. this.relatedTarget = document.id(related);
  3525. }
  3526. } else if (type.indexOf('touch') == 0 || type.indexOf('gesture') == 0){
  3527. this.rotation = event.rotation;
  3528. this.scale = event.scale;
  3529. this.targetTouches = event.targetTouches;
  3530. this.changedTouches = event.changedTouches;
  3531. var touches = this.touches = event.touches;
  3532. if (touches && touches[0]){
  3533. var touch = touches[0];
  3534. this.page = {x: touch.pageX, y: touch.pageY};
  3535. this.client = {x: touch.clientX, y: touch.clientY};
  3536. }
  3537. }
  3538. if (!this.client) this.client = {};
  3539. if (!this.page) this.page = {};
  3540. });
  3541. DOMEvent.implement({
  3542. stop: function(){
  3543. return this.preventDefault().stopPropagation();
  3544. },
  3545. stopPropagation: function(){
  3546. if (this.event.stopPropagation) this.event.stopPropagation();
  3547. else this.event.cancelBubble = true;
  3548. return this;
  3549. },
  3550. preventDefault: function(){
  3551. if (this.event.preventDefault) this.event.preventDefault();
  3552. else this.event.returnValue = false;
  3553. return this;
  3554. }
  3555. });
  3556. DOMEvent.defineKey = function(code, key){
  3557. _keys[code] = key;
  3558. return this;
  3559. };
  3560. DOMEvent.defineKeys = DOMEvent.defineKey.overloadSetter(true);
  3561. DOMEvent.defineKeys({
  3562. '38': 'up', '40': 'down', '37': 'left', '39': 'right',
  3563. '27': 'esc', '32': 'space', '8': 'backspace', '9': 'tab',
  3564. '46': 'delete', '13': 'enter'
  3565. });
  3566. })();
  3567. /*<1.3compat>*/
  3568. var Event = this.Event = DOMEvent;
  3569. Event.Keys = {};
  3570. /*</1.3compat>*/
  3571. /*<1.2compat>*/
  3572. Event.Keys = new Hash(Event.Keys);
  3573. /*</1.2compat>*/
  3574. /*
  3575. ---
  3576. name: Element.Event
  3577. description: Contains Element methods for dealing with events. This file also includes mouseenter and mouseleave custom Element Events, if necessary.
  3578. license: MIT-style license.
  3579. requires: [Element, Event]
  3580. provides: Element.Event
  3581. ...
  3582. */
  3583. (function(){
  3584. Element.Properties.events = {set: function(events){
  3585. this.addEvents(events);
  3586. }};
  3587. [Element, Window, Document].invoke('implement', {
  3588. addEvent: function(type, fn){
  3589. var events = this.retrieve('events', {});
  3590. if (!events[type]) events[type] = {keys: [], values: []};
  3591. if (events[type].keys.contains(fn)) return this;
  3592. events[type].keys.push(fn);
  3593. var realType = type,
  3594. custom = Element.Events[type],
  3595. condition = fn,
  3596. self = this;
  3597. if (custom){
  3598. if (custom.onAdd) custom.onAdd.call(this, fn, type);
  3599. if (custom.condition){
  3600. condition = function(event){
  3601. if (custom.condition.call(this, event, type)) return fn.call(this, event);
  3602. return true;
  3603. };
  3604. }
  3605. if (custom.base) realType = Function.convert(custom.base).call(this, type);
  3606. }
  3607. var defn = function(){
  3608. return fn.call(self);
  3609. };
  3610. var nativeEvent = Element.NativeEvents[realType];
  3611. if (nativeEvent){
  3612. if (nativeEvent == 2){
  3613. defn = function(event){
  3614. event = new DOMEvent(event, self.getWindow());
  3615. if (condition.call(self, event) === false) event.stop();
  3616. };
  3617. }
  3618. this.addListener(realType, defn, arguments[2]);
  3619. }
  3620. events[type].values.push(defn);
  3621. return this;
  3622. },
  3623. removeEvent: function(type, fn){
  3624. var events = this.retrieve('events');
  3625. if (!events || !events[type]) return this;
  3626. var list = events[type];
  3627. var index = list.keys.indexOf(fn);
  3628. if (index == -1) return this;
  3629. var value = list.values[index];
  3630. delete list.keys[index];
  3631. delete list.values[index];
  3632. var custom = Element.Events[type];
  3633. if (custom){
  3634. if (custom.onRemove) custom.onRemove.call(this, fn, type);
  3635. if (custom.base) type = Function.convert(custom.base).call(this, type);
  3636. }
  3637. return (Element.NativeEvents[type]) ? this.removeListener(type, value, arguments[2]) : this;
  3638. },
  3639. addEvents: function(events){
  3640. for (var event in events) this.addEvent(event, events[event]);
  3641. return this;
  3642. },
  3643. removeEvents: function(events){
  3644. var type;
  3645. if (typeOf(events) == 'object'){
  3646. for (type in events) this.removeEvent(type, events[type]);
  3647. return this;
  3648. }
  3649. var attached = this.retrieve('events');
  3650. if (!attached) return this;
  3651. if (!events){
  3652. for (type in attached) this.removeEvents(type);
  3653. this.eliminate('events');
  3654. } else if (attached[events]){
  3655. attached[events].keys.each(function(fn){
  3656. this.removeEvent(events, fn);
  3657. }, this);
  3658. delete attached[events];
  3659. }
  3660. return this;
  3661. },
  3662. fireEvent: function(type, args, delay){
  3663. var events = this.retrieve('events');
  3664. if (!events || !events[type]) return this;
  3665. args = Array.convert(args);
  3666. events[type].keys.each(function(fn){
  3667. if (delay) fn.delay(delay, this, args);
  3668. else fn.apply(this, args);
  3669. }, this);
  3670. return this;
  3671. },
  3672. cloneEvents: function(from, type){
  3673. from = document.id(from);
  3674. var events = from.retrieve('events');
  3675. if (!events) return this;
  3676. if (!type){
  3677. for (var eventType in events) this.cloneEvents(from, eventType);
  3678. } else if (events[type]){
  3679. events[type].keys.each(function(fn){
  3680. this.addEvent(type, fn);
  3681. }, this);
  3682. }
  3683. return this;
  3684. }
  3685. });
  3686. Element.NativeEvents = {
  3687. click: 2, dblclick: 2, mouseup: 2, mousedown: 2, contextmenu: 2, //mouse buttons
  3688. wheel: 2, mousewheel: 2, DOMMouseScroll: 2, //mouse wheel
  3689. mouseover: 2, mouseout: 2, mousemove: 2, selectstart: 2, selectend: 2, //mouse movement
  3690. keydown: 2, keypress: 2, keyup: 2, //keyboard
  3691. orientationchange: 2, // mobile
  3692. touchstart: 2, touchmove: 2, touchend: 2, touchcancel: 2, // touch
  3693. gesturestart: 2, gesturechange: 2, gestureend: 2, // gesture
  3694. focus: 2, blur: 2, change: 2, reset: 2, select: 2, submit: 2, paste: 2, input: 2, //form elements
  3695. load: 2, unload: 1, beforeunload: 2, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window
  3696. hashchange: 1, popstate: 2, pageshow: 2, pagehide: 2, // history
  3697. error: 1, abort: 1, scroll: 1, message: 2 //misc
  3698. };
  3699. Element.Events = {
  3700. mousewheel: {
  3701. base: 'onwheel' in document ? 'wheel' : 'onmousewheel' in document ? 'mousewheel' : 'DOMMouseScroll'
  3702. }
  3703. };
  3704. var check = function(event){
  3705. var related = event.relatedTarget;
  3706. if (related == null) return true;
  3707. if (!related) return false;
  3708. return (related != this && related.prefix != 'xul' && typeOf(this) != 'document' && !this.contains(related));
  3709. };
  3710. if ('onmouseenter' in document.documentElement){
  3711. Element.NativeEvents.mouseenter = Element.NativeEvents.mouseleave = 2;
  3712. Element.MouseenterCheck = check;
  3713. } else {
  3714. Element.Events.mouseenter = {
  3715. base: 'mouseover',
  3716. condition: check
  3717. };
  3718. Element.Events.mouseleave = {
  3719. base: 'mouseout',
  3720. condition: check
  3721. };
  3722. }
  3723. /*<ltIE9>*/
  3724. if (!window.addEventListener){
  3725. Element.NativeEvents.propertychange = 2;
  3726. Element.Events.change = {
  3727. base: function(){
  3728. var type = this.type;
  3729. return (this.get('tag') == 'input' && (type == 'radio' || type == 'checkbox')) ? 'propertychange' : 'change';
  3730. },
  3731. condition: function(event){
  3732. return event.type != 'propertychange' || event.event.propertyName == 'checked';
  3733. }
  3734. };
  3735. }
  3736. /*</ltIE9>*/
  3737. //<1.2compat>
  3738. Element.Events = new Hash(Element.Events);
  3739. //</1.2compat>
  3740. })();
  3741. /*
  3742. ---
  3743. name: Element.Delegation
  3744. description: Extends the Element native object to include the delegate method for more efficient event management.
  3745. license: MIT-style license.
  3746. requires: [Element.Event]
  3747. provides: [Element.Delegation]
  3748. ...
  3749. */
  3750. (function(){
  3751. var eventListenerSupport = !!window.addEventListener;
  3752. Element.NativeEvents.focusin = Element.NativeEvents.focusout = 2;
  3753. var bubbleUp = function(self, match, fn, event, target){
  3754. while (target && target != self){
  3755. if (match(target, event)) return fn.call(target, event, target);
  3756. target = document.id(target.parentNode);
  3757. }
  3758. };
  3759. var map = {
  3760. mouseenter: {
  3761. base: 'mouseover',
  3762. condition: Element.MouseenterCheck
  3763. },
  3764. mouseleave: {
  3765. base: 'mouseout',
  3766. condition: Element.MouseenterCheck
  3767. },
  3768. focus: {
  3769. base: 'focus' + (eventListenerSupport ? '' : 'in'),
  3770. capture: true
  3771. },
  3772. blur: {
  3773. base: eventListenerSupport ? 'blur' : 'focusout',
  3774. capture: true
  3775. }
  3776. };
  3777. /*<ltIE9>*/
  3778. var _key = '$delegation:';
  3779. var formObserver = function(type){
  3780. return {
  3781. base: 'focusin',
  3782. remove: function(self, uid){
  3783. var list = self.retrieve(_key + type + 'listeners', {})[uid];
  3784. if (list && list.forms) for (var i = list.forms.length; i--;){
  3785. // the form may have been destroyed, so it won't have the
  3786. // removeEvent method anymore. In that case the event was
  3787. // removed as well.
  3788. if (list.forms[i].removeEvent) list.forms[i].removeEvent(type, list.fns[i]);
  3789. }
  3790. },
  3791. listen: function(self, match, fn, event, target, uid){
  3792. var form = (target.get('tag') == 'form') ? target : event.target.getParent('form');
  3793. if (!form) return;
  3794. var listeners = self.retrieve(_key + type + 'listeners', {}),
  3795. listener = listeners[uid] || {forms: [], fns: []},
  3796. forms = listener.forms, fns = listener.fns;
  3797. if (forms.indexOf(form) != -1) return;
  3798. forms.push(form);
  3799. var _fn = function(event){
  3800. bubbleUp(self, match, fn, event, target);
  3801. };
  3802. form.addEvent(type, _fn);
  3803. fns.push(_fn);
  3804. listeners[uid] = listener;
  3805. self.store(_key + type + 'listeners', listeners);
  3806. }
  3807. };
  3808. };
  3809. var inputObserver = function(type){
  3810. return {
  3811. base: 'focusin',
  3812. listen: function(self, match, fn, event, target){
  3813. var events = {blur: function(){
  3814. this.removeEvents(events);
  3815. }};
  3816. events[type] = function(event){
  3817. bubbleUp(self, match, fn, event, target);
  3818. };
  3819. event.target.addEvents(events);
  3820. }
  3821. };
  3822. };
  3823. if (!eventListenerSupport) Object.append(map, {
  3824. submit: formObserver('submit'),
  3825. reset: formObserver('reset'),
  3826. change: inputObserver('change'),
  3827. select: inputObserver('select')
  3828. });
  3829. /*</ltIE9>*/
  3830. var proto = Element.prototype,
  3831. addEvent = proto.addEvent,
  3832. removeEvent = proto.removeEvent;
  3833. var relay = function(old, method){
  3834. return function(type, fn, useCapture){
  3835. if (type.indexOf(':relay') == -1) return old.call(this, type, fn, useCapture);
  3836. var parsed = Slick.parse(type).expressions[0][0];
  3837. if (parsed.pseudos[0].key != 'relay') return old.call(this, type, fn, useCapture);
  3838. var newType = parsed.tag;
  3839. parsed.pseudos.slice(1).each(function(pseudo){
  3840. newType += ':' + pseudo.key + (pseudo.value ? '(' + pseudo.value + ')' : '');
  3841. });
  3842. old.call(this, type, fn);
  3843. return method.call(this, newType, parsed.pseudos[0].value, fn);
  3844. };
  3845. };
  3846. var delegation = {
  3847. addEvent: function(type, match, fn){
  3848. var storage = this.retrieve('$delegates', {}), stored = storage[type];
  3849. if (stored) for (var _uid in stored){
  3850. if (stored[_uid].fn == fn && stored[_uid].match == match) return this;
  3851. }
  3852. var _type = type, _match = match, _fn = fn, _map = map[type] || {};
  3853. type = _map.base || _type;
  3854. match = function(target){
  3855. return Slick.match(target, _match);
  3856. };
  3857. var elementEvent = Element.Events[_type];
  3858. if (_map.condition || elementEvent && elementEvent.condition){
  3859. var __match = match, condition = _map.condition || elementEvent.condition;
  3860. match = function(target, event){
  3861. return __match(target, event) && condition.call(target, event, type);
  3862. };
  3863. }
  3864. var self = this, uid = String.uniqueID();
  3865. var delegator = _map.listen ? function(event, target){
  3866. if (!target && event && event.target) target = event.target;
  3867. if (target) _map.listen(self, match, fn, event, target, uid);
  3868. } : function(event, target){
  3869. if (!target && event && event.target) target = event.target;
  3870. if (target) bubbleUp(self, match, fn, event, target);
  3871. };
  3872. if (!stored) stored = {};
  3873. stored[uid] = {
  3874. match: _match,
  3875. fn: _fn,
  3876. delegator: delegator
  3877. };
  3878. storage[_type] = stored;
  3879. return addEvent.call(this, type, delegator, _map.capture);
  3880. },
  3881. removeEvent: function(type, match, fn, _uid){
  3882. var storage = this.retrieve('$delegates', {}), stored = storage[type];
  3883. if (!stored) return this;
  3884. if (_uid){
  3885. var _type = type, delegator = stored[_uid].delegator, _map = map[type] || {};
  3886. type = _map.base || _type;
  3887. if (_map.remove) _map.remove(this, _uid);
  3888. delete stored[_uid];
  3889. storage[_type] = stored;
  3890. return removeEvent.call(this, type, delegator, _map.capture);
  3891. }
  3892. var __uid, s;
  3893. if (fn) for (__uid in stored){
  3894. s = stored[__uid];
  3895. if (s.match == match && s.fn == fn) return delegation.removeEvent.call(this, type, match, fn, __uid);
  3896. } else for (__uid in stored){
  3897. s = stored[__uid];
  3898. if (s.match == match) delegation.removeEvent.call(this, type, match, s.fn, __uid);
  3899. }
  3900. return this;
  3901. }
  3902. };
  3903. [Element, Window, Document].invoke('implement', {
  3904. addEvent: relay(addEvent, delegation.addEvent),
  3905. removeEvent: relay(removeEvent, delegation.removeEvent)
  3906. });
  3907. })();
  3908. /*
  3909. ---
  3910. name: Element.Style
  3911. description: Contains methods for interacting with the styles of Elements in a fashionable way.
  3912. license: MIT-style license.
  3913. requires: Element
  3914. provides: Element.Style
  3915. ...
  3916. */
  3917. (function(){
  3918. var html = document.html, el;
  3919. //<ltIE9>
  3920. // Check for oldIE, which does not remove styles when they're set to null
  3921. el = document.createElement('div');
  3922. el.style.color = 'red';
  3923. el.style.color = null;
  3924. var doesNotRemoveStyles = el.style.color == 'red';
  3925. // check for oldIE, which returns border* shorthand styles in the wrong order (color-width-style instead of width-style-color)
  3926. var border = '1px solid #123abc';
  3927. el.style.border = border;
  3928. var returnsBordersInWrongOrder = el.style.border != border;
  3929. el = null;
  3930. //</ltIE9>
  3931. var hasGetComputedStyle = !!window.getComputedStyle,
  3932. supportBorderRadius = document.createElement('div').style.borderRadius != null;
  3933. Element.Properties.styles = {set: function(styles){
  3934. this.setStyles(styles);
  3935. }};
  3936. var hasOpacity = (html.style.opacity != null),
  3937. hasFilter = (html.style.filter != null),
  3938. reAlpha = /alpha\(opacity=([\d.]+)\)/i;
  3939. var setVisibility = function(element, opacity){
  3940. element.store('$opacity', opacity);
  3941. element.style.visibility = opacity > 0 || opacity == null ? 'visible' : 'hidden';
  3942. };
  3943. //<ltIE9>
  3944. var setFilter = function(element, regexp, value){
  3945. var style = element.style,
  3946. filter = style.filter || element.getComputedStyle('filter') || '';
  3947. style.filter = (regexp.test(filter) ? filter.replace(regexp, value) : filter + ' ' + value).trim();
  3948. if (!style.filter) style.removeAttribute('filter');
  3949. };
  3950. //</ltIE9>
  3951. var setOpacity = (hasOpacity ? function(element, opacity){
  3952. element.style.opacity = opacity;
  3953. } : (hasFilter ? function(element, opacity){
  3954. if (!element.currentStyle || !element.currentStyle.hasLayout) element.style.zoom = 1;
  3955. if (opacity == null || opacity == 1){
  3956. setFilter(element, reAlpha, '');
  3957. if (opacity == 1 && getOpacity(element) != 1) setFilter(element, reAlpha, 'alpha(opacity=100)');
  3958. } else {
  3959. setFilter(element, reAlpha, 'alpha(opacity=' + (opacity * 100).limit(0, 100).round() + ')');
  3960. }
  3961. } : setVisibility));
  3962. var getOpacity = (hasOpacity ? function(element){
  3963. var opacity = element.style.opacity || element.getComputedStyle('opacity');
  3964. return (opacity == '') ? 1 : opacity.toFloat();
  3965. } : (hasFilter ? function(element){
  3966. var filter = (element.style.filter || element.getComputedStyle('filter')),
  3967. opacity;
  3968. if (filter) opacity = filter.match(reAlpha);
  3969. return (opacity == null || filter == null) ? 1 : (opacity[1] / 100);
  3970. } : function(element){
  3971. var opacity = element.retrieve('$opacity');
  3972. if (opacity == null) opacity = (element.style.visibility == 'hidden' ? 0 : 1);
  3973. return opacity;
  3974. }));
  3975. var floatName = (html.style.cssFloat == null) ? 'styleFloat' : 'cssFloat',
  3976. namedPositions = {left: '0%', top: '0%', center: '50%', right: '100%', bottom: '100%'},
  3977. hasBackgroundPositionXY = (html.style.backgroundPositionX != null),
  3978. prefixPattern = /^-(ms)-/;
  3979. var camelCase = function(property){
  3980. return property.replace(prefixPattern, '$1-').camelCase();
  3981. };
  3982. //<ltIE9>
  3983. var removeStyle = function(style, property){
  3984. if (property == 'backgroundPosition'){
  3985. style.removeAttribute(property + 'X');
  3986. property += 'Y';
  3987. }
  3988. style.removeAttribute(property);
  3989. };
  3990. //</ltIE9>
  3991. Element.implement({
  3992. getComputedStyle: function(property){
  3993. if (!hasGetComputedStyle && this.currentStyle) return this.currentStyle[camelCase(property)];
  3994. var defaultView = Element.getDocument(this).defaultView,
  3995. computed = defaultView ? defaultView.getComputedStyle(this, null) : null;
  3996. return (computed) ? computed.getPropertyValue((property == floatName) ? 'float' : property.hyphenate()) : '';
  3997. },
  3998. setStyle: function(property, value){
  3999. if (property == 'opacity'){
  4000. if (value != null) value = parseFloat(value);
  4001. setOpacity(this, value);
  4002. return this;
  4003. }
  4004. property = camelCase(property == 'float' ? floatName : property);
  4005. if (typeOf(value) != 'string'){
  4006. var map = (Element.Styles[property] || '@').split(' ');
  4007. value = Array.convert(value).map(function(val, i){
  4008. if (!map[i]) return '';
  4009. return (typeOf(val) == 'number') ? map[i].replace('@', Math.round(val)) : val;
  4010. }).join(' ');
  4011. } else if (value == String(Number(value))){
  4012. value = Math.round(value);
  4013. }
  4014. this.style[property] = value;
  4015. //<ltIE9>
  4016. if ((value == '' || value == null) && doesNotRemoveStyles && this.style.removeAttribute){
  4017. removeStyle(this.style, property);
  4018. }
  4019. //</ltIE9>
  4020. return this;
  4021. },
  4022. getStyle: function(property){
  4023. if (property == 'opacity') return getOpacity(this);
  4024. property = camelCase(property == 'float' ? floatName : property);
  4025. if (supportBorderRadius && property.indexOf('borderRadius') != -1){
  4026. return ['borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomRightRadius', 'borderBottomLeftRadius'].map(function(corner){
  4027. return this.style[corner] || '0px';
  4028. }, this).join(' ');
  4029. }
  4030. var result = this.style[property];
  4031. if (!result || property == 'zIndex'){
  4032. if (Element.ShortStyles.hasOwnProperty(property)){
  4033. result = [];
  4034. for (var s in Element.ShortStyles[property]) result.push(this.getStyle(s));
  4035. return result.join(' ');
  4036. }
  4037. result = this.getComputedStyle(property);
  4038. }
  4039. if (hasBackgroundPositionXY && /^backgroundPosition[XY]?$/.test(property)){
  4040. return result.replace(/(top|right|bottom|left)/g, function(position){
  4041. return namedPositions[position];
  4042. }) || '0px';
  4043. }
  4044. if (!result && property == 'backgroundPosition') return '0px 0px';
  4045. if (result){
  4046. result = String(result);
  4047. var color = result.match(/rgba?\([\d\s,]+\)/);
  4048. if (color) result = result.replace(color[0], color[0].rgbToHex());
  4049. }
  4050. if (!hasGetComputedStyle && !this.style[property]){
  4051. if ((/^(height|width)$/).test(property) && !(/px$/.test(result))){
  4052. var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0;
  4053. values.each(function(value){
  4054. size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt();
  4055. }, this);
  4056. return this['offset' + property.capitalize()] - size + 'px';
  4057. }
  4058. if ((/^border(.+)Width|margin|padding/).test(property) && isNaN(parseFloat(result))){
  4059. return '0px';
  4060. }
  4061. }
  4062. //<ltIE9>
  4063. if (returnsBordersInWrongOrder && /^border(Top|Right|Bottom|Left)?$/.test(property) && /^#/.test(result)){
  4064. return result.replace(/^(.+)\s(.+)\s(.+)$/, '$2 $3 $1');
  4065. }
  4066. //</ltIE9>
  4067. return result;
  4068. },
  4069. setStyles: function(styles){
  4070. for (var style in styles) this.setStyle(style, styles[style]);
  4071. return this;
  4072. },
  4073. getStyles: function(){
  4074. var result = {};
  4075. Array.flatten(arguments).each(function(key){
  4076. result[key] = this.getStyle(key);
  4077. }, this);
  4078. return result;
  4079. }
  4080. });
  4081. Element.Styles = {
  4082. left: '@px', top: '@px', bottom: '@px', right: '@px',
  4083. width: '@px', height: '@px', maxWidth: '@px', maxHeight: '@px', minWidth: '@px', minHeight: '@px',
  4084. backgroundColor: 'rgb(@, @, @)', backgroundSize: '@px', backgroundPosition: '@px @px', color: 'rgb(@, @, @)',
  4085. fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)',
  4086. margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)',
  4087. borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)',
  4088. zIndex: '@', 'zoom': '@', fontWeight: '@', textIndent: '@px', opacity: '@', borderRadius: '@px @px @px @px'
  4089. };
  4090. //<1.3compat>
  4091. Element.implement({
  4092. setOpacity: function(value){
  4093. setOpacity(this, value);
  4094. return this;
  4095. },
  4096. getOpacity: function(){
  4097. return getOpacity(this);
  4098. }
  4099. });
  4100. Element.Properties.opacity = {
  4101. set: function(opacity){
  4102. setOpacity(this, opacity);
  4103. setVisibility(this, opacity);
  4104. },
  4105. get: function(){
  4106. return getOpacity(this);
  4107. }
  4108. };
  4109. //</1.3compat>
  4110. //<1.2compat>
  4111. Element.Styles = new Hash(Element.Styles);
  4112. //</1.2compat>
  4113. Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, borderStyle: {}, borderColor: {}};
  4114. ['Top', 'Right', 'Bottom', 'Left'].each(function(direction){
  4115. var Short = Element.ShortStyles;
  4116. var All = Element.Styles;
  4117. ['margin', 'padding'].each(function(style){
  4118. var sd = style + direction;
  4119. Short[style][sd] = All[sd] = '@px';
  4120. });
  4121. var bd = 'border' + direction;
  4122. Short.border[bd] = All[bd] = '@px @ rgb(@, @, @)';
  4123. var bdw = bd + 'Width', bds = bd + 'Style', bdc = bd + 'Color';
  4124. Short[bd] = {};
  4125. Short.borderWidth[bdw] = Short[bd][bdw] = All[bdw] = '@px';
  4126. Short.borderStyle[bds] = Short[bd][bds] = All[bds] = '@';
  4127. Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)';
  4128. });
  4129. if (hasBackgroundPositionXY) Element.ShortStyles.backgroundPosition = {backgroundPositionX: '@', backgroundPositionY: '@'};
  4130. })();
  4131. /*
  4132. ---
  4133. name: Element.Dimensions
  4134. description: Contains methods to work with size, scroll, or positioning of Elements and the window object.
  4135. license: MIT-style license.
  4136. credits:
  4137. - Element positioning based on the [qooxdoo](http://qooxdoo.org/) code and smart browser fixes, [LGPL License](http://www.gnu.org/licenses/lgpl.html).
  4138. - Viewport dimensions based on [YUI](http://developer.yahoo.com/yui/) code, [BSD License](http://developer.yahoo.com/yui/license.html).
  4139. requires: [Element, Element.Style]
  4140. provides: [Element.Dimensions]
  4141. ...
  4142. */
  4143. (function(){
  4144. var element = document.createElement('div'),
  4145. child = document.createElement('div');
  4146. element.style.height = '0';
  4147. element.appendChild(child);
  4148. var brokenOffsetParent = (child.offsetParent === element);
  4149. element = child = null;
  4150. var heightComponents = ['height', 'paddingTop', 'paddingBottom', 'borderTopWidth', 'borderBottomWidth'],
  4151. widthComponents = ['width', 'paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'];
  4152. var svgCalculateSize = function(el){
  4153. var gCS = window.getComputedStyle(el),
  4154. bounds = {x: 0, y: 0};
  4155. heightComponents.each(function(css){
  4156. bounds.y += parseFloat(gCS[css]);
  4157. });
  4158. widthComponents.each(function(css){
  4159. bounds.x += parseFloat(gCS[css]);
  4160. });
  4161. return bounds;
  4162. };
  4163. var isOffset = function(el){
  4164. return styleString(el, 'position') != 'static' || isBody(el);
  4165. };
  4166. var isOffsetStatic = function(el){
  4167. return isOffset(el) || (/^(?:table|td|th)$/i).test(el.tagName);
  4168. };
  4169. Element.implement({
  4170. scrollTo: function(x, y){
  4171. if (isBody(this)){
  4172. this.getWindow().scrollTo(x, y);
  4173. } else {
  4174. this.scrollLeft = x;
  4175. this.scrollTop = y;
  4176. }
  4177. return this;
  4178. },
  4179. getSize: function(){
  4180. if (isBody(this)) return this.getWindow().getSize();
  4181. //<ltIE9>
  4182. // This if clause is because IE8- cannot calculate getBoundingClientRect of elements with visibility hidden.
  4183. if (!window.getComputedStyle) return {x: this.offsetWidth, y: this.offsetHeight};
  4184. //</ltIE9>
  4185. // This svg section under, calling `svgCalculateSize()`, can be removed when FF fixed the svg size bug.
  4186. // Bug info: https://bugzilla.mozilla.org/show_bug.cgi?id=530985
  4187. if (this.get('tag') == 'svg') return svgCalculateSize(this);
  4188. try {
  4189. var bounds = this.getBoundingClientRect();
  4190. return {x: bounds.width, y: bounds.height};
  4191. } catch (e){
  4192. return {x: 0, y: 0};
  4193. }
  4194. },
  4195. getScrollSize: function(){
  4196. if (isBody(this)) return this.getWindow().getScrollSize();
  4197. return {x: this.scrollWidth, y: this.scrollHeight};
  4198. },
  4199. getScroll: function(){
  4200. if (isBody(this)) return this.getWindow().getScroll();
  4201. return {x: this.scrollLeft, y: this.scrollTop};
  4202. },
  4203. getScrolls: function(){
  4204. var element = this.parentNode, position = {x: 0, y: 0};
  4205. while (element && !isBody(element)){
  4206. position.x += element.scrollLeft;
  4207. position.y += element.scrollTop;
  4208. element = element.parentNode;
  4209. }
  4210. return position;
  4211. },
  4212. getOffsetParent: brokenOffsetParent ? function(){
  4213. var element = this;
  4214. if (isBody(element) || styleString(element, 'position') == 'fixed') return null;
  4215. var isOffsetCheck = (styleString(element, 'position') == 'static') ? isOffsetStatic : isOffset;
  4216. while ((element = element.parentNode)){
  4217. if (isOffsetCheck(element)) return element;
  4218. }
  4219. return null;
  4220. } : function(){
  4221. var element = this;
  4222. if (isBody(element) || styleString(element, 'position') == 'fixed') return null;
  4223. try {
  4224. return element.offsetParent;
  4225. } catch (e){}
  4226. return null;
  4227. },
  4228. getOffsets: function(){
  4229. var hasGetBoundingClientRect = this.getBoundingClientRect;
  4230. //<1.4compat>
  4231. hasGetBoundingClientRect = hasGetBoundingClientRect && !Browser.Platform.ios;
  4232. //</1.4compat>
  4233. if (hasGetBoundingClientRect){
  4234. var bound = this.getBoundingClientRect(),
  4235. html = document.id(this.getDocument().documentElement),
  4236. htmlScroll = html.getScroll(),
  4237. elemScrolls = this.getScrolls(),
  4238. isFixed = (styleString(this, 'position') == 'fixed');
  4239. return {
  4240. x: bound.left.toFloat() + elemScrolls.x + ((isFixed) ? 0 : htmlScroll.x) - html.clientLeft,
  4241. y: bound.top.toFloat() + elemScrolls.y + ((isFixed) ? 0 : htmlScroll.y) - html.clientTop
  4242. };
  4243. }
  4244. var element = this, position = {x: 0, y: 0};
  4245. if (isBody(this)) return position;
  4246. while (element && !isBody(element)){
  4247. position.x += element.offsetLeft;
  4248. position.y += element.offsetTop;
  4249. //<1.4compat>
  4250. if (Browser.firefox){
  4251. if (!borderBox(element)){
  4252. position.x += leftBorder(element);
  4253. position.y += topBorder(element);
  4254. }
  4255. var parent = element.parentNode;
  4256. if (parent && styleString(parent, 'overflow') != 'visible'){
  4257. position.x += leftBorder(parent);
  4258. position.y += topBorder(parent);
  4259. }
  4260. } else if (element != this && Browser.safari){
  4261. position.x += leftBorder(element);
  4262. position.y += topBorder(element);
  4263. }
  4264. //</1.4compat>
  4265. element = element.offsetParent;
  4266. }
  4267. //<1.4compat>
  4268. if (Browser.firefox && !borderBox(this)){
  4269. position.x -= leftBorder(this);
  4270. position.y -= topBorder(this);
  4271. }
  4272. //</1.4compat>
  4273. return position;
  4274. },
  4275. getPosition: function(relative){
  4276. var offset = this.getOffsets(),
  4277. scroll = this.getScrolls();
  4278. var position = {
  4279. x: offset.x - scroll.x,
  4280. y: offset.y - scroll.y
  4281. };
  4282. if (relative && (relative = document.id(relative))){
  4283. var relativePosition = relative.getPosition();
  4284. return {x: position.x - relativePosition.x - leftBorder(relative), y: position.y - relativePosition.y - topBorder(relative)};
  4285. }
  4286. return position;
  4287. },
  4288. getCoordinates: function(element){
  4289. if (isBody(this)) return this.getWindow().getCoordinates();
  4290. var position = this.getPosition(element),
  4291. size = this.getSize();
  4292. var obj = {
  4293. left: position.x,
  4294. top: position.y,
  4295. width: size.x,
  4296. height: size.y
  4297. };
  4298. obj.right = obj.left + obj.width;
  4299. obj.bottom = obj.top + obj.height;
  4300. return obj;
  4301. },
  4302. computePosition: function(obj){
  4303. return {
  4304. left: obj.x - styleNumber(this, 'margin-left'),
  4305. top: obj.y - styleNumber(this, 'margin-top')
  4306. };
  4307. },
  4308. setPosition: function(obj){
  4309. return this.setStyles(this.computePosition(obj));
  4310. }
  4311. });
  4312. [Document, Window].invoke('implement', {
  4313. getSize: function(){
  4314. var doc = getCompatElement(this);
  4315. return {x: doc.clientWidth, y: doc.clientHeight};
  4316. },
  4317. getScroll: function(){
  4318. var win = this.getWindow(), doc = getCompatElement(this);
  4319. return {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop};
  4320. },
  4321. getScrollSize: function(){
  4322. var doc = getCompatElement(this),
  4323. min = this.getSize(),
  4324. body = this.getDocument().body;
  4325. return {x: Math.max(doc.scrollWidth, body.scrollWidth, min.x), y: Math.max(doc.scrollHeight, body.scrollHeight, min.y)};
  4326. },
  4327. getPosition: function(){
  4328. return {x: 0, y: 0};
  4329. },
  4330. getCoordinates: function(){
  4331. var size = this.getSize();
  4332. return {top: 0, left: 0, bottom: size.y, right: size.x, height: size.y, width: size.x};
  4333. }
  4334. });
  4335. // private methods
  4336. var styleString = Element.getComputedStyle;
  4337. function styleNumber(element, style){
  4338. return styleString(element, style).toInt() || 0;
  4339. }
  4340. //<1.4compat>
  4341. function borderBox(element){
  4342. return styleString(element, '-moz-box-sizing') == 'border-box';
  4343. }
  4344. //</1.4compat>
  4345. function topBorder(element){
  4346. return styleNumber(element, 'border-top-width');
  4347. }
  4348. function leftBorder(element){
  4349. return styleNumber(element, 'border-left-width');
  4350. }
  4351. function isBody(element){
  4352. return (/^(?:body|html)$/i).test(element.tagName);
  4353. }
  4354. function getCompatElement(element){
  4355. var doc = element.getDocument();
  4356. return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
  4357. }
  4358. })();
  4359. //aliases
  4360. Element.alias({position: 'setPosition'}); //compatability
  4361. [Window, Document, Element].invoke('implement', {
  4362. getHeight: function(){
  4363. return this.getSize().y;
  4364. },
  4365. getWidth: function(){
  4366. return this.getSize().x;
  4367. },
  4368. getScrollTop: function(){
  4369. return this.getScroll().y;
  4370. },
  4371. getScrollLeft: function(){
  4372. return this.getScroll().x;
  4373. },
  4374. getScrollHeight: function(){
  4375. return this.getScrollSize().y;
  4376. },
  4377. getScrollWidth: function(){
  4378. return this.getScrollSize().x;
  4379. },
  4380. getTop: function(){
  4381. return this.getPosition().y;
  4382. },
  4383. getLeft: function(){
  4384. return this.getPosition().x;
  4385. }
  4386. });
  4387. /*
  4388. ---
  4389. name: Fx
  4390. description: Contains the basic animation logic to be extended by all other Fx Classes.
  4391. license: MIT-style license.
  4392. requires: [Chain, Events, Options, Class.Thenable]
  4393. provides: Fx
  4394. ...
  4395. */
  4396. (function(){
  4397. var Fx = this.Fx = new Class({
  4398. Implements: [Chain, Events, Options, Class.Thenable],
  4399. options: {
  4400. /*
  4401. onStart: nil,
  4402. onCancel: nil,
  4403. onComplete: nil,
  4404. */
  4405. fps: 60,
  4406. unit: false,
  4407. duration: 500,
  4408. frames: null,
  4409. frameSkip: true,
  4410. link: 'ignore'
  4411. },
  4412. initialize: function(options){
  4413. this.subject = this.subject || this;
  4414. this.setOptions(options);
  4415. },
  4416. getTransition: function(){
  4417. return function(p){
  4418. return -(Math.cos(Math.PI * p) - 1) / 2;
  4419. };
  4420. },
  4421. step: function(now){
  4422. if (this.options.frameSkip){
  4423. var diff = (this.time != null) ? (now - this.time) : 0, frames = diff / this.frameInterval;
  4424. this.time = now;
  4425. this.frame += frames;
  4426. } else {
  4427. this.frame++;
  4428. }
  4429. if (this.frame < this.frames){
  4430. var delta = this.transition(this.frame / this.frames);
  4431. this.set(this.compute(this.from, this.to, delta));
  4432. } else {
  4433. this.frame = this.frames;
  4434. this.set(this.compute(this.from, this.to, 1));
  4435. this.stop();
  4436. }
  4437. },
  4438. set: function(now){
  4439. return now;
  4440. },
  4441. compute: function(from, to, delta){
  4442. return Fx.compute(from, to, delta);
  4443. },
  4444. check: function(){
  4445. if (!this.isRunning()) return true;
  4446. switch (this.options.link){
  4447. case 'cancel': this.cancel(); return true;
  4448. case 'chain': this.chain(this.caller.pass(arguments, this)); return false;
  4449. }
  4450. return false;
  4451. },
  4452. start: function(from, to){
  4453. if (!this.check(from, to)) return this;
  4454. this.from = from;
  4455. this.to = to;
  4456. this.frame = (this.options.frameSkip) ? 0 : -1;
  4457. this.time = null;
  4458. this.transition = this.getTransition();
  4459. var frames = this.options.frames, fps = this.options.fps, duration = this.options.duration;
  4460. this.duration = Fx.Durations[duration] || duration.toInt();
  4461. this.frameInterval = 1000 / fps;
  4462. this.frames = frames || Math.round(this.duration / this.frameInterval);
  4463. if (this.getThenableState() !== 'pending'){
  4464. this.resetThenable(this.subject);
  4465. }
  4466. this.fireEvent('start', this.subject);
  4467. pushInstance.call(this, fps);
  4468. return this;
  4469. },
  4470. stop: function(){
  4471. if (this.isRunning()){
  4472. this.time = null;
  4473. pullInstance.call(this, this.options.fps);
  4474. if (this.frames == this.frame){
  4475. this.fireEvent('complete', this.subject);
  4476. if (!this.callChain()) this.fireEvent('chainComplete', this.subject);
  4477. } else {
  4478. this.fireEvent('stop', this.subject);
  4479. }
  4480. this.resolve(this.subject === this ? null : this.subject);
  4481. }
  4482. return this;
  4483. },
  4484. cancel: function(){
  4485. if (this.isRunning()){
  4486. this.time = null;
  4487. pullInstance.call(this, this.options.fps);
  4488. this.frame = this.frames;
  4489. this.fireEvent('cancel', this.subject).clearChain();
  4490. this.reject(this.subject);
  4491. }
  4492. return this;
  4493. },
  4494. pause: function(){
  4495. if (this.isRunning()){
  4496. this.time = null;
  4497. pullInstance.call(this, this.options.fps);
  4498. }
  4499. return this;
  4500. },
  4501. resume: function(){
  4502. if (this.isPaused()) pushInstance.call(this, this.options.fps);
  4503. return this;
  4504. },
  4505. isRunning: function(){
  4506. var list = instances[this.options.fps];
  4507. return list && list.contains(this);
  4508. },
  4509. isPaused: function(){
  4510. return (this.frame < this.frames) && !this.isRunning();
  4511. }
  4512. });
  4513. Fx.compute = function(from, to, delta){
  4514. return (to - from) * delta + from;
  4515. };
  4516. Fx.Durations = {'short': 250, 'normal': 500, 'long': 1000};
  4517. // global timers
  4518. var instances = {}, timers = {};
  4519. var loop = function(){
  4520. var now = Date.now();
  4521. for (var i = this.length; i--;){
  4522. var instance = this[i];
  4523. if (instance) instance.step(now);
  4524. }
  4525. };
  4526. var pushInstance = function(fps){
  4527. var list = instances[fps] || (instances[fps] = []);
  4528. list.push(this);
  4529. if (!timers[fps]) timers[fps] = loop.periodical(Math.round(1000 / fps), list);
  4530. };
  4531. var pullInstance = function(fps){
  4532. var list = instances[fps];
  4533. if (list){
  4534. list.erase(this);
  4535. if (!list.length && timers[fps]){
  4536. delete instances[fps];
  4537. timers[fps] = clearInterval(timers[fps]);
  4538. }
  4539. }
  4540. };
  4541. })();
  4542. /*
  4543. ---
  4544. name: Fx.CSS
  4545. description: Contains the CSS animation logic. Used by Fx.Tween, Fx.Morph, Fx.Elements.
  4546. license: MIT-style license.
  4547. requires: [Fx, Element.Style]
  4548. provides: Fx.CSS
  4549. ...
  4550. */
  4551. Fx.CSS = new Class({
  4552. Extends: Fx,
  4553. //prepares the base from/to object
  4554. prepare: function(element, property, values){
  4555. values = Array.convert(values);
  4556. var from = values[0], to = values[1];
  4557. if (to == null){
  4558. to = from;
  4559. from = element.getStyle(property);
  4560. var unit = this.options.unit;
  4561. // adapted from: https://github.com/ryanmorr/fx/blob/master/fx.js#L299
  4562. if (unit && from && typeof from == 'string' && from.slice(-unit.length) != unit && parseFloat(from) != 0){
  4563. element.setStyle(property, to + unit);
  4564. var value = element.getComputedStyle(property);
  4565. // IE and Opera support pixelLeft or pixelWidth
  4566. if (!(/px$/.test(value))){
  4567. value = element.style[('pixel-' + property).camelCase()];
  4568. if (value == null){
  4569. // adapted from Dean Edwards' http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  4570. var left = element.style.left;
  4571. element.style.left = to + unit;
  4572. value = element.style.pixelLeft;
  4573. element.style.left = left;
  4574. }
  4575. }
  4576. from = (to || 1) / (parseFloat(value) || 1) * (parseFloat(from) || 0);
  4577. element.setStyle(property, from + unit);
  4578. }
  4579. }
  4580. return {from: this.parse(from), to: this.parse(to)};
  4581. },
  4582. //parses a value into an array
  4583. parse: function(value){
  4584. value = Function.convert(value)();
  4585. value = (typeof value == 'string') ? value.split(' ') : Array.convert(value);
  4586. return value.map(function(val){
  4587. val = String(val);
  4588. var found = false;
  4589. Object.each(Fx.CSS.Parsers, function(parser){
  4590. if (found) return;
  4591. var parsed = parser.parse(val);
  4592. if (parsed || parsed === 0) found = {value: parsed, parser: parser};
  4593. });
  4594. found = found || {value: val, parser: Fx.CSS.Parsers.String};
  4595. return found;
  4596. });
  4597. },
  4598. //computes by a from and to prepared objects, using their parsers.
  4599. compute: function(from, to, delta){
  4600. var computed = [];
  4601. (Math.min(from.length, to.length)).times(function(i){
  4602. computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser});
  4603. });
  4604. computed.$family = Function.convert('fx:css:value');
  4605. return computed;
  4606. },
  4607. //serves the value as settable
  4608. serve: function(value, unit){
  4609. if (typeOf(value) != 'fx:css:value') value = this.parse(value);
  4610. var returned = [];
  4611. value.each(function(bit){
  4612. returned = returned.concat(bit.parser.serve(bit.value, unit));
  4613. });
  4614. return returned;
  4615. },
  4616. //renders the change to an element
  4617. render: function(element, property, value, unit){
  4618. element.setStyle(property, this.serve(value, unit));
  4619. },
  4620. //searches inside the page css to find the values for a selector
  4621. search: function(selector){
  4622. if (Fx.CSS.Cache[selector]) return Fx.CSS.Cache[selector];
  4623. var to = {}, selectorTest = new RegExp('^' + selector.escapeRegExp() + '$');
  4624. var searchStyles = function(rules){
  4625. Array.each(rules, function(rule){
  4626. if (rule.media){
  4627. searchStyles(rule.rules || rule.cssRules);
  4628. return;
  4629. }
  4630. if (!rule.style) return;
  4631. var selectorText = (rule.selectorText) ? rule.selectorText.replace(/^\w+/, function(m){
  4632. return m.toLowerCase();
  4633. }) : null;
  4634. if (!selectorText || !selectorTest.test(selectorText)) return;
  4635. Object.each(Element.Styles, function(value, style){
  4636. if (!rule.style[style] || Element.ShortStyles[style]) return;
  4637. value = String(rule.style[style]);
  4638. to[style] = ((/^rgb/).test(value)) ? value.rgbToHex() : value;
  4639. });
  4640. });
  4641. };
  4642. Array.each(document.styleSheets, function(sheet){
  4643. var href = sheet.href;
  4644. if (href && href.indexOf('://') > -1 && href.indexOf(document.domain) == -1) return;
  4645. var rules = sheet.rules || sheet.cssRules;
  4646. searchStyles(rules);
  4647. });
  4648. return Fx.CSS.Cache[selector] = to;
  4649. }
  4650. });
  4651. Fx.CSS.Cache = {};
  4652. Fx.CSS.Parsers = {
  4653. Color: {
  4654. parse: function(value){
  4655. if (value.match(/^#[0-9a-f]{3,6}$/i)) return value.hexToRgb(true);
  4656. return ((value = value.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [value[1], value[2], value[3]] : false;
  4657. },
  4658. compute: function(from, to, delta){
  4659. return from.map(function(value, i){
  4660. return Math.round(Fx.compute(from[i], to[i], delta));
  4661. });
  4662. },
  4663. serve: function(value){
  4664. return value.map(Number);
  4665. }
  4666. },
  4667. Number: {
  4668. parse: parseFloat,
  4669. compute: Fx.compute,
  4670. serve: function(value, unit){
  4671. return (unit) ? value + unit : value;
  4672. }
  4673. },
  4674. String: {
  4675. parse: Function.convert(false),
  4676. compute: function(zero, one){
  4677. return one;
  4678. },
  4679. serve: function(zero){
  4680. return zero;
  4681. }
  4682. }
  4683. };
  4684. //<1.2compat>
  4685. Fx.CSS.Parsers = new Hash(Fx.CSS.Parsers);
  4686. //</1.2compat>
  4687. /*
  4688. ---
  4689. name: Fx.Morph
  4690. description: Formerly Fx.Styles, effect to transition any number of CSS properties for an element using an object of rules, or CSS based selector rules.
  4691. license: MIT-style license.
  4692. requires: Fx.CSS
  4693. provides: Fx.Morph
  4694. ...
  4695. */
  4696. Fx.Morph = new Class({
  4697. Extends: Fx.CSS,
  4698. initialize: function(element, options){
  4699. this.element = this.subject = document.id(element);
  4700. this.parent(options);
  4701. },
  4702. set: function(now){
  4703. if (typeof now == 'string') now = this.search(now);
  4704. for (var p in now) this.render(this.element, p, now[p], this.options.unit);
  4705. return this;
  4706. },
  4707. compute: function(from, to, delta){
  4708. var now = {};
  4709. for (var p in from) now[p] = this.parent(from[p], to[p], delta);
  4710. return now;
  4711. },
  4712. start: function(properties){
  4713. if (!this.check(properties)) return this;
  4714. if (typeof properties == 'string') properties = this.search(properties);
  4715. var from = {}, to = {};
  4716. for (var p in properties){
  4717. var parsed = this.prepare(this.element, p, properties[p]);
  4718. from[p] = parsed.from;
  4719. to[p] = parsed.to;
  4720. }
  4721. return this.parent(from, to);
  4722. }
  4723. });
  4724. Element.Properties.morph = {
  4725. set: function(options){
  4726. this.get('morph').cancel().setOptions(options);
  4727. return this;
  4728. },
  4729. get: function(){
  4730. var morph = this.retrieve('morph');
  4731. if (!morph){
  4732. morph = new Fx.Morph(this, {link: 'cancel'});
  4733. this.store('morph', morph);
  4734. }
  4735. return morph;
  4736. }
  4737. };
  4738. Element.implement({
  4739. morph: function(props){
  4740. this.get('morph').start(props);
  4741. return this;
  4742. }
  4743. });
  4744. /*
  4745. ---
  4746. name: Fx.Transitions
  4747. description: Contains a set of advanced transitions to be used with any of the Fx Classes.
  4748. license: MIT-style license.
  4749. credits:
  4750. - Easing Equations by Robert Penner, <http://www.robertpenner.com/easing/>, modified and optimized to be used with MooTools.
  4751. requires: Fx
  4752. provides: Fx.Transitions
  4753. ...
  4754. */
  4755. Fx.implement({
  4756. getTransition: function(){
  4757. var trans = this.options.transition || Fx.Transitions.Sine.easeInOut;
  4758. if (typeof trans == 'string'){
  4759. var data = trans.split(':');
  4760. trans = Fx.Transitions;
  4761. trans = trans[data[0]] || trans[data[0].capitalize()];
  4762. if (data[1]) trans = trans['ease' + data[1].capitalize() + (data[2] ? data[2].capitalize() : '')];
  4763. }
  4764. return trans;
  4765. }
  4766. });
  4767. Fx.Transition = function(transition, params){
  4768. params = Array.convert(params);
  4769. var easeIn = function(pos){
  4770. return transition(pos, params);
  4771. };
  4772. return Object.append(easeIn, {
  4773. easeIn: easeIn,
  4774. easeOut: function(pos){
  4775. return 1 - transition(1 - pos, params);
  4776. },
  4777. easeInOut: function(pos){
  4778. return (pos <= 0.5 ? transition(2 * pos, params) : (2 - transition(2 * (1 - pos), params))) / 2;
  4779. }
  4780. });
  4781. };
  4782. Fx.Transitions = {
  4783. linear: function(zero){
  4784. return zero;
  4785. }
  4786. };
  4787. //<1.2compat>
  4788. Fx.Transitions = new Hash(Fx.Transitions);
  4789. //</1.2compat>
  4790. Fx.Transitions.extend = function(transitions){
  4791. for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]);
  4792. };
  4793. Fx.Transitions.extend({
  4794. Pow: function(p, x){
  4795. return Math.pow(p, x && x[0] || 6);
  4796. },
  4797. Expo: function(p){
  4798. return Math.pow(2, 8 * (p - 1));
  4799. },
  4800. Circ: function(p){
  4801. return 1 - Math.sin(Math.acos(p));
  4802. },
  4803. Sine: function(p){
  4804. return 1 - Math.cos(p * Math.PI / 2);
  4805. },
  4806. Back: function(p, x){
  4807. x = x && x[0] || 1.618;
  4808. return Math.pow(p, 2) * ((x + 1) * p - x);
  4809. },
  4810. Bounce: function(p){
  4811. var value;
  4812. for (var a = 0, b = 1; 1; a += b, b /= 2){
  4813. if (p >= (7 - 4 * a) / 11){
  4814. value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2);
  4815. break;
  4816. }
  4817. }
  4818. return value;
  4819. },
  4820. Elastic: function(p, x){
  4821. return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x && x[0] || 1) / 3);
  4822. }
  4823. });
  4824. ['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){
  4825. Fx.Transitions[transition] = new Fx.Transition(function(p){
  4826. return Math.pow(p, i + 2);
  4827. });
  4828. });
  4829. /*
  4830. ---
  4831. name: Fx.Tween
  4832. description: Formerly Fx.Style, effect to transition any CSS property for an element.
  4833. license: MIT-style license.
  4834. requires: Fx.CSS
  4835. provides: [Fx.Tween, Element.fade, Element.highlight]
  4836. ...
  4837. */
  4838. Fx.Tween = new Class({
  4839. Extends: Fx.CSS,
  4840. initialize: function(element, options){
  4841. this.element = this.subject = document.id(element);
  4842. this.parent(options);
  4843. },
  4844. set: function(property, now){
  4845. if (arguments.length == 1){
  4846. now = property;
  4847. property = this.property || this.options.property;
  4848. }
  4849. this.render(this.element, property, now, this.options.unit);
  4850. return this;
  4851. },
  4852. start: function(property, from, to){
  4853. if (!this.check(property, from, to)) return this;
  4854. var args = Array.flatten(arguments);
  4855. this.property = this.options.property || args.shift();
  4856. var parsed = this.prepare(this.element, this.property, args);
  4857. return this.parent(parsed.from, parsed.to);
  4858. }
  4859. });
  4860. Element.Properties.tween = {
  4861. set: function(options){
  4862. this.get('tween').cancel().setOptions(options);
  4863. return this;
  4864. },
  4865. get: function(){
  4866. var tween = this.retrieve('tween');
  4867. if (!tween){
  4868. tween = new Fx.Tween(this, {link: 'cancel'});
  4869. this.store('tween', tween);
  4870. }
  4871. return tween;
  4872. }
  4873. };
  4874. Element.implement({
  4875. tween: function(property, from, to){
  4876. this.get('tween').start(property, from, to);
  4877. return this;
  4878. },
  4879. fade: function(){
  4880. var fade = this.get('tween'), method, args = ['opacity'].append(arguments), toggle;
  4881. if (args[1] == null) args[1] = 'toggle';
  4882. switch (args[1]){
  4883. case 'in': method = 'start'; args[1] = 1; break;
  4884. case 'out': method = 'start'; args[1] = 0; break;
  4885. case 'show': method = 'set'; args[1] = 1; break;
  4886. case 'hide': method = 'set'; args[1] = 0; break;
  4887. case 'toggle':
  4888. var flag = this.retrieve('fade:flag', this.getStyle('opacity') == 1);
  4889. method = 'start';
  4890. args[1] = flag ? 0 : 1;
  4891. this.store('fade:flag', !flag);
  4892. toggle = true;
  4893. break;
  4894. default: method = 'start';
  4895. }
  4896. if (!toggle) this.eliminate('fade:flag');
  4897. fade[method].apply(fade, args);
  4898. var to = args[args.length - 1];
  4899. if (method == 'set'){
  4900. this.setStyle('visibility', to == 0 ? 'hidden' : 'visible');
  4901. } else if (to != 0){
  4902. if (fade.$chain.length){
  4903. fade.chain(function(){
  4904. this.element.setStyle('visibility', 'visible');
  4905. this.callChain();
  4906. });
  4907. } else {
  4908. this.setStyle('visibility', 'visible');
  4909. }
  4910. } else {
  4911. fade.chain(function(){
  4912. if (this.element.getStyle('opacity')) return;
  4913. this.element.setStyle('visibility', 'hidden');
  4914. this.callChain();
  4915. });
  4916. }
  4917. return this;
  4918. },
  4919. highlight: function(start, end){
  4920. if (!end){
  4921. end = this.retrieve('highlight:original', this.getStyle('background-color'));
  4922. end = (end == 'transparent') ? '#fff' : end;
  4923. }
  4924. var tween = this.get('tween');
  4925. tween.start('background-color', start || '#ffff88', end).chain(function(){
  4926. this.setStyle('background-color', this.retrieve('highlight:original'));
  4927. tween.callChain();
  4928. }.bind(this));
  4929. return this;
  4930. }
  4931. });
  4932. /*
  4933. ---
  4934. name: Request
  4935. description: Powerful all purpose Request Class. Uses XMLHTTPRequest.
  4936. license: MIT-style license.
  4937. requires: [Object, Element, Chain, Events, Options, Class.Thenable, Browser]
  4938. provides: Request
  4939. ...
  4940. */
  4941. (function(){
  4942. var empty = function(){},
  4943. progressSupport = ('onprogress' in new Browser.Request);
  4944. var Request = this.Request = new Class({
  4945. Implements: [Chain, Events, Options, Class.Thenable],
  4946. options: {/*
  4947. onRequest: function(){},
  4948. onLoadstart: function(event, xhr){},
  4949. onProgress: function(event, xhr){},
  4950. onComplete: function(){},
  4951. onCancel: function(){},
  4952. onSuccess: function(responseText, responseXML){},
  4953. onFailure: function(xhr){},
  4954. onException: function(headerName, value){},
  4955. onTimeout: function(){},
  4956. user: '',
  4957. password: '',
  4958. withCredentials: false,*/
  4959. url: '',
  4960. data: '',
  4961. headers: {
  4962. 'X-Requested-With': 'XMLHttpRequest',
  4963. 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
  4964. },
  4965. async: true,
  4966. format: false,
  4967. method: 'post',
  4968. link: 'ignore',
  4969. isSuccess: null,
  4970. emulation: true,
  4971. urlEncoded: true,
  4972. encoding: 'utf-8',
  4973. evalScripts: false,
  4974. evalResponse: false,
  4975. timeout: 0,
  4976. noCache: false
  4977. },
  4978. initialize: function(options){
  4979. this.xhr = new Browser.Request();
  4980. this.setOptions(options);
  4981. this.headers = this.options.headers;
  4982. },
  4983. onStateChange: function(){
  4984. var xhr = this.xhr;
  4985. if (xhr.readyState != 4 || !this.running) return;
  4986. this.running = false;
  4987. this.status = 0;
  4988. Function.attempt(function(){
  4989. var status = xhr.status;
  4990. this.status = (status == 1223) ? 204 : status;
  4991. }.bind(this));
  4992. xhr.onreadystatechange = empty;
  4993. if (progressSupport) xhr.onprogress = xhr.onloadstart = empty;
  4994. if (this.timer){
  4995. clearTimeout(this.timer);
  4996. delete this.timer;
  4997. }
  4998. this.response = {text: this.xhr.responseText || '', xml: this.xhr.responseXML};
  4999. if (this.options.isSuccess.call(this, this.status))
  5000. this.success(this.response.text, this.response.xml);
  5001. else
  5002. this.failure();
  5003. },
  5004. isSuccess: function(){
  5005. var status = this.status;
  5006. return (status >= 200 && status < 300);
  5007. },
  5008. isRunning: function(){
  5009. return !!this.running;
  5010. },
  5011. processScripts: function(text){
  5012. if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return Browser.exec(text);
  5013. return text.stripScripts(this.options.evalScripts);
  5014. },
  5015. success: function(text, xml){
  5016. this.onSuccess(this.processScripts(text), xml);
  5017. this.resolve({text: text, xml: xml});
  5018. },
  5019. onSuccess: function(){
  5020. this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain();
  5021. },
  5022. failure: function(){
  5023. this.onFailure();
  5024. this.reject({reason: 'failure', xhr: this.xhr});
  5025. },
  5026. onFailure: function(){
  5027. this.fireEvent('complete').fireEvent('failure', this.xhr);
  5028. },
  5029. loadstart: function(event){
  5030. this.fireEvent('loadstart', [event, this.xhr]);
  5031. },
  5032. progress: function(event){
  5033. this.fireEvent('progress', [event, this.xhr]);
  5034. },
  5035. timeout: function(){
  5036. this.fireEvent('timeout', this.xhr);
  5037. this.reject({reason: 'timeout', xhr: this.xhr});
  5038. },
  5039. setHeader: function(name, value){
  5040. this.headers[name] = value;
  5041. return this;
  5042. },
  5043. getHeader: function(name){
  5044. return Function.attempt(function(){
  5045. return this.xhr.getResponseHeader(name);
  5046. }.bind(this));
  5047. },
  5048. check: function(){
  5049. if (!this.running) return true;
  5050. switch (this.options.link){
  5051. case 'cancel': this.cancel(); return true;
  5052. case 'chain': this.chain(this.caller.pass(arguments, this)); return false;
  5053. }
  5054. return false;
  5055. },
  5056. send: function(options){
  5057. if (!this.check(options)) return this;
  5058. this.options.isSuccess = this.options.isSuccess || this.isSuccess;
  5059. this.running = true;
  5060. var type = typeOf(options);
  5061. if (type == 'string' || type == 'element') options = {data: options};
  5062. var old = this.options;
  5063. options = Object.append({data: old.data, url: old.url, method: old.method}, options);
  5064. var data = options.data, url = String(options.url), method = options.method.toLowerCase();
  5065. switch (typeOf(data)){
  5066. case 'element': data = document.id(data).toQueryString(); break;
  5067. case 'object': case 'hash': data = Object.toQueryString(data);
  5068. }
  5069. if (this.options.format){
  5070. var format = 'format=' + this.options.format;
  5071. data = (data) ? format + '&' + data : format;
  5072. }
  5073. if (this.options.emulation && !['get', 'post'].contains(method)){
  5074. var _method = '_method=' + method;
  5075. data = (data) ? _method + '&' + data : _method;
  5076. method = 'post';
  5077. }
  5078. if (this.options.urlEncoded && ['post', 'put'].contains(method)){
  5079. var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : '';
  5080. //this.headers['Content-type'] = 'application/x-www-form-urlencoded' + encoding; //mootools1.6.0
  5081. if (!this.headers['Content-Type']) this.headers['Content-type'] = 'application/x-www-form-urlencoded' + encoding; //modify by tommy
  5082. }
  5083. if (!url) url = document.location.pathname;
  5084. var trimPosition = url.lastIndexOf('/');
  5085. if (trimPosition > -1 && (trimPosition = url.indexOf('#')) > -1) url = url.substr(0, trimPosition);
  5086. if (this.options.noCache)
  5087. url += (url.indexOf('?') > -1 ? '&' : '?') + String.uniqueID();
  5088. if (data && (method == 'get' || method == 'delete')){
  5089. url += (url.indexOf('?') > -1 ? '&' : '?') + data;
  5090. data = null;
  5091. }
  5092. var xhr = this.xhr;
  5093. if (progressSupport){
  5094. xhr.onloadstart = this.loadstart.bind(this);
  5095. xhr.onprogress = this.progress.bind(this);
  5096. }
  5097. //modify by Tommy--
  5098. var isWithCredentials = ((this.options.withCredentials && 'withCredentials' in xhr) || (this.options.user && 'withCredentials' in xhr) && (method.toUpperCase()=="POST" || method.toUpperCase()=="PUT"));
  5099. var isWithCredentialsSync = isWithCredentials && !this.options.async;
  5100. //-----------------
  5101. xhr.open(method.toUpperCase(), url, this.options.async, this.options.user, this.options.password);
  5102. if ((/*<1.4compat>*/this.options.user || /*</1.4compat>*/this.options.withCredentials) && 'withCredentials' in xhr) xhr.withCredentials = true;
  5103. //modify by Tommy--
  5104. if (Browser.name=="firefox"){
  5105. if (this.options.async){
  5106. if (isWithCredentials) xhr.withCredentials = true;
  5107. }else{
  5108. xhr.setRequestHeader("x-token", Cookie.read("x-token"));
  5109. }
  5110. }else{
  5111. if (isWithCredentials) xhr.withCredentials = true;
  5112. }
  5113. //-----------------
  5114. xhr.onreadystatechange = this.onStateChange.bind(this);
  5115. Object.each(this.headers, function(value, key){
  5116. try {
  5117. xhr.setRequestHeader(key, value);
  5118. } catch (e){
  5119. this.fireEvent('exception', [key, value]);
  5120. this.reject({reason: 'exception', xhr: xhr, exception: e});
  5121. }
  5122. }, this);
  5123. if (this.getThenableState() !== 'pending'){
  5124. this.resetThenable({reason: 'send'});
  5125. }
  5126. if (url.indexOf("v=4.0")!=-1){
  5127. debugger;
  5128. }
  5129. this.fireEvent('request');
  5130. xhr.send(data);
  5131. if (!this.options.async) this.onStateChange();
  5132. else if (this.options.timeout) this.timer = this.timeout.delay(this.options.timeout, this);
  5133. return this;
  5134. },
  5135. cancel: function(){
  5136. if (!this.running) return this;
  5137. this.running = false;
  5138. var xhr = this.xhr;
  5139. xhr.abort();
  5140. if (this.timer){
  5141. clearTimeout(this.timer);
  5142. delete this.timer;
  5143. }
  5144. xhr.onreadystatechange = empty;
  5145. if (progressSupport) xhr.onprogress = xhr.onloadstart = empty;
  5146. this.xhr = new Browser.Request();
  5147. this.fireEvent('cancel');
  5148. this.reject({reason: 'cancel', xhr: xhr});
  5149. return this;
  5150. }
  5151. });
  5152. var methods = {};
  5153. ['get', 'post', 'put', 'delete', 'patch', 'head', 'GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'].each(function(method){
  5154. methods[method] = function(data){
  5155. var object = {
  5156. method: method
  5157. };
  5158. if (data != null) object.data = data;
  5159. return this.send(object);
  5160. };
  5161. });
  5162. Request.implement(methods);
  5163. Element.Properties.send = {
  5164. set: function(options){
  5165. var send = this.get('send').cancel();
  5166. send.setOptions(options);
  5167. return this;
  5168. },
  5169. get: function(){
  5170. var send = this.retrieve('send');
  5171. if (!send){
  5172. send = new Request({
  5173. data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action')
  5174. });
  5175. this.store('send', send);
  5176. }
  5177. return send;
  5178. }
  5179. };
  5180. Element.implement({
  5181. send: function(url){
  5182. var sender = this.get('send');
  5183. sender.send({data: this, url: url || sender.options.url});
  5184. return this;
  5185. }
  5186. });
  5187. })();
  5188. /*
  5189. ---
  5190. name: Request.HTML
  5191. description: Extends the basic Request Class with additional methods for interacting with HTML responses.
  5192. license: MIT-style license.
  5193. requires: [Element, Request]
  5194. provides: Request.HTML
  5195. ...
  5196. */
  5197. Request.HTML = new Class({
  5198. Extends: Request,
  5199. options: {
  5200. update: false,
  5201. append: false,
  5202. evalScripts: true,
  5203. filter: false,
  5204. headers: {
  5205. Accept: 'text/html, application/xml, text/xml, */*'
  5206. }
  5207. },
  5208. success: function(text){
  5209. var options = this.options, response = this.response;
  5210. response.html = text.stripScripts(function(script){
  5211. response.javascript = script;
  5212. });
  5213. var match = response.html.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
  5214. if (match) response.html = match[1];
  5215. var temp = new Element('div').set('html', response.html);
  5216. response.tree = temp.childNodes;
  5217. response.elements = temp.getElements(options.filter || '*');
  5218. if (options.filter) response.tree = response.elements;
  5219. if (options.update){
  5220. var update = document.id(options.update).empty();
  5221. if (options.filter) update.adopt(response.elements);
  5222. else update.set('html', response.html);
  5223. } else if (options.append){
  5224. var append = document.id(options.append);
  5225. if (options.filter) response.elements.reverse().inject(append);
  5226. else append.adopt(temp.getChildren());
  5227. }
  5228. if (options.evalScripts) Browser.exec(response.javascript);
  5229. this.onSuccess(response.tree, response.elements, response.html, response.javascript);
  5230. this.resolve({tree: response.tree, elements: response.elements, html: response.html, javascript: response.javascript});
  5231. }
  5232. });
  5233. Element.Properties.load = {
  5234. set: function(options){
  5235. var load = this.get('load').cancel();
  5236. load.setOptions(options);
  5237. return this;
  5238. },
  5239. get: function(){
  5240. var load = this.retrieve('load');
  5241. if (!load){
  5242. load = new Request.HTML({data: this, link: 'cancel', update: this, method: 'get'});
  5243. this.store('load', load);
  5244. }
  5245. return load;
  5246. }
  5247. };
  5248. Element.implement({
  5249. load: function(){
  5250. this.get('load').send(Array.link(arguments, {data: Type.isObject, url: Type.isString}));
  5251. return this;
  5252. }
  5253. });
  5254. /*
  5255. ---
  5256. name: JSON
  5257. description: JSON encoder and decoder.
  5258. license: MIT-style license.
  5259. SeeAlso: <http://www.json.org/>
  5260. requires: [Array, String, Number, Function]
  5261. provides: JSON
  5262. ...
  5263. */
  5264. if (typeof JSON == 'undefined') this.JSON = {};
  5265. //<1.2compat>
  5266. JSON = new Hash({
  5267. stringify: JSON.stringify,
  5268. parse: JSON.parse
  5269. });
  5270. //</1.2compat>
  5271. (function(){
  5272. var special = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'};
  5273. var escape = function(chr){
  5274. return special[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16)).slice(-4);
  5275. };
  5276. JSON.validate = function(string){
  5277. string = string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
  5278. replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
  5279. replace(/(?:^|:|,)(?:\s*\[)+/g, '');
  5280. return (/^[\],:{}\s]*$/).test(string);
  5281. };
  5282. JSON.encode = JSON.stringify ? function(obj){
  5283. return JSON.stringify(obj);
  5284. } : function(obj){
  5285. if (obj && obj.toJSON) obj = obj.toJSON();
  5286. switch (typeOf(obj)){
  5287. case 'string':
  5288. return '"' + obj.replace(/[\x00-\x1f\\"]/g, escape) + '"';
  5289. case 'array':
  5290. return '[' + obj.map(JSON.encode).clean() + ']';
  5291. case 'object': case 'hash':
  5292. var string = [];
  5293. Object.each(obj, function(value, key){
  5294. var json = JSON.encode(value);
  5295. if (json) string.push(JSON.encode(key) + ':' + json);
  5296. });
  5297. return '{' + string + '}';
  5298. case 'number': case 'boolean': return '' + obj;
  5299. case 'null': return 'null';
  5300. }
  5301. return null;
  5302. };
  5303. JSON.secure = true;
  5304. //<1.4compat>
  5305. JSON.secure = false;
  5306. //</1.4compat>
  5307. JSON.decode = function(string, secure){
  5308. if (!string || typeOf(string) != 'string') return null;
  5309. if (secure == null) secure = JSON.secure;
  5310. if (secure){
  5311. if (JSON.parse) return JSON.parse(string);
  5312. if (!JSON.validate(string)) throw new Error('JSON could not decode the input; security is enabled and the value is not secure.');
  5313. }
  5314. return eval('(' + string + ')');
  5315. };
  5316. })();
  5317. /*
  5318. ---
  5319. name: Request.JSON
  5320. description: Extends the basic Request Class with additional methods for sending and receiving JSON data.
  5321. license: MIT-style license.
  5322. requires: [Request, JSON]
  5323. provides: Request.JSON
  5324. ...
  5325. */
  5326. Request.JSON = new Class({
  5327. Extends: Request,
  5328. options: {
  5329. /*onError: function(text, error){},*/
  5330. secure: true
  5331. },
  5332. initialize: function(options){
  5333. this.parent(options);
  5334. Object.append(this.headers, {
  5335. 'Accept': 'application/json',
  5336. // 'X-Request': 'JSON'
  5337. });
  5338. },
  5339. success: function(text){
  5340. var json;
  5341. try {
  5342. json = this.response.json = JSON.decode(text, this.options.secure);
  5343. } catch (error){
  5344. this.fireEvent('error', [text, error]);
  5345. return;
  5346. }
  5347. if (json == null){
  5348. this.failure();
  5349. } else {
  5350. this.onSuccess(json, text);
  5351. this.resolve({json: json, text: text});
  5352. }
  5353. }
  5354. });
  5355. /*
  5356. ---
  5357. name: Cookie
  5358. description: Class for creating, reading, and deleting browser Cookies.
  5359. license: MIT-style license.
  5360. credits:
  5361. - Based on the functions by Peter-Paul Koch (http://quirksmode.org).
  5362. requires: [Options, Browser]
  5363. provides: Cookie
  5364. ...
  5365. */
  5366. var Cookie = new Class({
  5367. Implements: Options,
  5368. options: {
  5369. path: '/',
  5370. domain: false,
  5371. duration: false,
  5372. secure: false,
  5373. document: document,
  5374. encode: true,
  5375. httpOnly: false
  5376. },
  5377. initialize: function(key, options){
  5378. this.key = key;
  5379. this.setOptions(options);
  5380. },
  5381. write: function(value){
  5382. if (this.options.encode) value = encodeURIComponent(value);
  5383. if (this.options.domain) value += '; domain=' + this.options.domain;
  5384. if (this.options.path) value += '; path=' + this.options.path;
  5385. if (this.options.duration){
  5386. var date = new Date();
  5387. date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000);
  5388. value += '; expires=' + date.toGMTString();
  5389. }
  5390. if (this.options.secure) value += '; secure';
  5391. if (this.options.httpOnly) value += '; HttpOnly';
  5392. this.options.document.cookie = this.key + '=' + value;
  5393. return this;
  5394. },
  5395. read: function(){
  5396. var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)');
  5397. return (value) ? decodeURIComponent(value[1]) : null;
  5398. },
  5399. dispose: function(){
  5400. new Cookie(this.key, Object.merge({}, this.options, {duration: -1})).write('');
  5401. return this;
  5402. }
  5403. });
  5404. Cookie.write = function(key, value, options){
  5405. return new Cookie(key, options).write(value);
  5406. };
  5407. Cookie.read = function(key){
  5408. return new Cookie(key).read();
  5409. };
  5410. Cookie.dispose = function(key, options){
  5411. return new Cookie(key, options).dispose();
  5412. };
  5413. /*
  5414. ---
  5415. name: DOMReady
  5416. description: Contains the custom event domready.
  5417. license: MIT-style license.
  5418. requires: [Browser, Element, Element.Event]
  5419. provides: [DOMReady, DomReady]
  5420. ...
  5421. */
  5422. (function(window, document){
  5423. var ready,
  5424. loaded,
  5425. checks = [],
  5426. shouldPoll,
  5427. timer,
  5428. testElement = document.createElement('div');
  5429. var domready = function(){
  5430. clearTimeout(timer);
  5431. if (!ready){
  5432. Browser.loaded = ready = true;
  5433. document.removeListener('DOMContentLoaded', domready).removeListener('readystatechange', check);
  5434. document.fireEvent('domready');
  5435. window.fireEvent('domready');
  5436. }
  5437. // cleanup scope vars
  5438. document = window = testElement = null;
  5439. };
  5440. var check = function(){
  5441. for (var i = checks.length; i--;) if (checks[i]()){
  5442. domready();
  5443. return true;
  5444. }
  5445. return false;
  5446. };
  5447. var poll = function(){
  5448. clearTimeout(timer);
  5449. if (!check()) timer = setTimeout(poll, 10);
  5450. };
  5451. document.addListener('DOMContentLoaded', domready);
  5452. /*<ltIE8>*/
  5453. // doScroll technique by Diego Perini http://javascript.nwbox.com/IEContentLoaded/
  5454. // testElement.doScroll() throws when the DOM is not ready, only in the top window
  5455. var doScrollWorks = function(){
  5456. try {
  5457. testElement.doScroll();
  5458. return true;
  5459. } catch (e){}
  5460. return false;
  5461. };
  5462. // If doScroll works already, it can't be used to determine domready
  5463. // e.g. in an iframe
  5464. if (testElement.doScroll && !doScrollWorks()){
  5465. checks.push(doScrollWorks);
  5466. shouldPoll = true;
  5467. }
  5468. /*</ltIE8>*/
  5469. if (document.readyState) checks.push(function(){
  5470. var state = document.readyState;
  5471. return (state == 'loaded' || state == 'complete');
  5472. });
  5473. if ('onreadystatechange' in document) document.addListener('readystatechange', check);
  5474. else shouldPoll = true;
  5475. if (shouldPoll) poll();
  5476. Element.Events.domready = {
  5477. onAdd: function(fn){
  5478. if (ready) fn.call(this);
  5479. }
  5480. };
  5481. // Make sure that domready fires before load
  5482. Element.Events.load = {
  5483. base: 'load',
  5484. onAdd: function(fn){
  5485. if (loaded && this == window) fn.call(this);
  5486. },
  5487. condition: function(){
  5488. if (this == window){
  5489. domready();
  5490. delete Element.Events.load;
  5491. }
  5492. return true;
  5493. }
  5494. };
  5495. // This is based on the custom load event
  5496. window.addEvent('load', function(){
  5497. loaded = true;
  5498. });
  5499. })(window, document);
  5500. /*
  5501. ---
  5502. script: More.js
  5503. name: More
  5504. description: MooTools More
  5505. license: MIT-style license
  5506. authors:
  5507. - Guillermo Rauch
  5508. - Thomas Aylott
  5509. - Scott Kyle
  5510. - Arian Stolwijk
  5511. - Tim Wienk
  5512. - Christoph Pojer
  5513. - Aaron Newton
  5514. - Jacob Thornton
  5515. requires:
  5516. - Core/MooTools
  5517. provides: [MooTools.More]
  5518. ...
  5519. */
  5520. MooTools.More = {
  5521. version: '1.6.0',
  5522. build: '45b71db70f879781a7e0b0d3fb3bb1307c2521eb'
  5523. };
  5524. /*
  5525. ---
  5526. script: Chain.Wait.js
  5527. name: Chain.Wait
  5528. description: value, Adds a method to inject pauses between chained events.
  5529. license: MIT-style license.
  5530. authors:
  5531. - Aaron Newton
  5532. requires:
  5533. - Core/Chain
  5534. - Core/Element
  5535. - Core/Fx
  5536. - MooTools.More
  5537. provides: [Chain.Wait]
  5538. ...
  5539. */
  5540. (function(){
  5541. var wait = {
  5542. wait: function(duration){
  5543. return this.chain(function(){
  5544. this.callChain.delay(duration == null ? 500 : duration, this);
  5545. return this;
  5546. }.bind(this));
  5547. }
  5548. };
  5549. Chain.implement(wait);
  5550. if (this.Fx) Fx.implement(wait);
  5551. if (this.Element && Element.implement && this.Fx){
  5552. Element.implement({
  5553. chains: function(effects){
  5554. Array.convert(effects || ['tween', 'morph', 'reveal']).each(function(effect){
  5555. effect = this.get(effect);
  5556. if (!effect) return;
  5557. effect.setOptions({
  5558. link:'chain'
  5559. });
  5560. }, this);
  5561. return this;
  5562. },
  5563. pauseFx: function(duration, effect){
  5564. this.chains(effect).get(effect || 'tween').wait(duration);
  5565. return this;
  5566. }
  5567. });
  5568. }
  5569. })();
  5570. /*
  5571. ---
  5572. script: Class.Binds.js
  5573. name: Class.Binds
  5574. description: Automagically binds specified methods in a class to the instance of the class.
  5575. license: MIT-style license
  5576. authors:
  5577. - Aaron Newton
  5578. requires:
  5579. - Core/Class
  5580. - MooTools.More
  5581. provides: [Class.Binds]
  5582. ...
  5583. */
  5584. Class.Mutators.Binds = function(binds){
  5585. if (!this.prototype.initialize) this.implement('initialize', function(){});
  5586. return Array.convert(binds).concat(this.prototype.Binds || []);
  5587. };
  5588. Class.Mutators.initialize = function(initialize){
  5589. return function(){
  5590. Array.convert(this.Binds).each(function(name){
  5591. var original = this[name];
  5592. if (original) this[name] = original.bind(this);
  5593. }, this);
  5594. return initialize.apply(this, arguments);
  5595. };
  5596. };
  5597. /*
  5598. ---
  5599. script: Class.Occlude.js
  5600. name: Class.Occlude
  5601. description: Prevents a class from being applied to a DOM element twice.
  5602. license: MIT-style license.
  5603. authors:
  5604. - Aaron Newton
  5605. requires:
  5606. - Core/Class
  5607. - Core/Element
  5608. - MooTools.More
  5609. provides: [Class.Occlude]
  5610. ...
  5611. */
  5612. Class.Occlude = new Class({
  5613. occlude: function(property, element){
  5614. element = document.id(element || this.element);
  5615. var instance = element.retrieve(property || this.property);
  5616. if (instance && !this.occluded)
  5617. return (this.occluded = instance);
  5618. this.occluded = false;
  5619. element.store(property || this.property, this);
  5620. return this.occluded;
  5621. }
  5622. });
  5623. /*
  5624. ---
  5625. script: Class.Refactor.js
  5626. name: Class.Refactor
  5627. description: Extends a class onto itself with new property, preserving any items attached to the class's namespace.
  5628. license: MIT-style license
  5629. authors:
  5630. - Aaron Newton
  5631. requires:
  5632. - Core/Class
  5633. - MooTools.More
  5634. # Some modules declare themselves dependent on Class.Refactor
  5635. provides: [Class.refactor, Class.Refactor]
  5636. ...
  5637. */
  5638. Class.refactor = function(original, refactors){
  5639. Object.each(refactors, function(item, name){
  5640. var origin = original.prototype[name];
  5641. origin = (origin && origin.$origin) || origin || function(){};
  5642. original.implement(name, (typeof item == 'function') ? function(){
  5643. var old = this.previous;
  5644. this.previous = origin;
  5645. var value = item.apply(this, arguments);
  5646. this.previous = old;
  5647. return value;
  5648. } : item);
  5649. });
  5650. return original;
  5651. };
  5652. /*
  5653. ---
  5654. script: Class.Singleton.js
  5655. name: Class.Singleton
  5656. description: Always provides a single instance of a class
  5657. license: MIT-style license.
  5658. authors:
  5659. - Hristo Chakarov
  5660. requires:
  5661. - Core/Class
  5662. provides: [Class.Singleton]
  5663. ...
  5664. */
  5665. Class.Singleton = new Class({
  5666. initialize : function(descriptor){
  5667. // here we keep reference of the single instance
  5668. var singleton;
  5669. // create a regular Class
  5670. var constructor = new Class(descriptor);
  5671. // We return another constructor, because we need to make sure that we
  5672. // always return the same one and only instance.
  5673. return function(){
  5674. if (singleton){
  5675. return singleton;
  5676. }
  5677. // Obviously we instantiate that class for the first time.
  5678. // Create brand new object & extend it with the prototype of the
  5679. // original `constructor`.
  5680. singleton = Object.append({}, constructor.prototype);
  5681. singleton.constructor = constructor;
  5682. // We also need to call the constructor as a function, passing the
  5683. // arguments object.
  5684. var returnValue = constructor.apply(singleton, arguments);
  5685. // In case the `constructor` returns something other than `this` -
  5686. // return that value; otherwise return the `singleton`.
  5687. singleton = typeof returnValue == 'object' ? returnValue : singleton;
  5688. return singleton;
  5689. };
  5690. }
  5691. });
  5692. /*
  5693. ---
  5694. name: Events.Pseudos
  5695. description: Adds the functionality to add pseudo events
  5696. license: MIT-style license
  5697. authors:
  5698. - Arian Stolwijk
  5699. requires: [Core/Class.Extras, Core/Slick.Parser, MooTools.More]
  5700. provides: [Events.Pseudos]
  5701. ...
  5702. */
  5703. (function(){
  5704. Events.Pseudos = function(pseudos, addEvent, removeEvent){
  5705. var storeKey = '_monitorEvents:';
  5706. var storageOf = function(object){
  5707. return {
  5708. store: object.store ? function(key, value){
  5709. object.store(storeKey + key, value);
  5710. } : function(key, value){
  5711. (object._monitorEvents || (object._monitorEvents = {}))[key] = value;
  5712. },
  5713. retrieve: object.retrieve ? function(key, dflt){
  5714. return object.retrieve(storeKey + key, dflt);
  5715. } : function(key, dflt){
  5716. if (!object._monitorEvents) return dflt;
  5717. return object._monitorEvents[key] || dflt;
  5718. }
  5719. };
  5720. };
  5721. var splitType = function(type){
  5722. if (type.indexOf(':') == -1 || !pseudos) return null;
  5723. var parsed = Slick.parse(type).expressions[0][0],
  5724. parsedPseudos = parsed.pseudos,
  5725. l = parsedPseudos.length,
  5726. splits = [];
  5727. while (l--){
  5728. var pseudo = parsedPseudos[l].key,
  5729. listener = pseudos[pseudo];
  5730. if (listener != null) splits.push({
  5731. event: parsed.tag,
  5732. value: parsedPseudos[l].value,
  5733. pseudo: pseudo,
  5734. original: type,
  5735. listener: listener
  5736. });
  5737. }
  5738. return splits.length ? splits : null;
  5739. };
  5740. return {
  5741. addEvent: function(type, fn, internal){
  5742. var split = splitType(type);
  5743. if (!split) return addEvent.call(this, type, fn, internal);
  5744. var storage = storageOf(this),
  5745. events = storage.retrieve(type, []),
  5746. eventType = split[0].event,
  5747. args = Array.slice(arguments, 2),
  5748. stack = fn,
  5749. self = this;
  5750. split.each(function(item){
  5751. var listener = item.listener,
  5752. stackFn = stack;
  5753. if (listener == false) eventType += ':' + item.pseudo + '(' + item.value + ')';
  5754. else stack = function(){
  5755. listener.call(self, item, stackFn, arguments, stack);
  5756. };
  5757. });
  5758. events.include({type: eventType, event: fn, monitor: stack});
  5759. storage.store(type, events);
  5760. if (type != eventType) addEvent.apply(this, [type, fn].concat(args));
  5761. return addEvent.apply(this, [eventType, stack].concat(args));
  5762. },
  5763. removeEvent: function(type, fn){
  5764. var split = splitType(type);
  5765. if (!split) return removeEvent.call(this, type, fn);
  5766. var storage = storageOf(this),
  5767. events = storage.retrieve(type);
  5768. if (!events) return this;
  5769. var args = Array.slice(arguments, 2);
  5770. removeEvent.apply(this, [type, fn].concat(args));
  5771. events.each(function(monitor, i){
  5772. if (!fn || monitor.event == fn) removeEvent.apply(this, [monitor.type, monitor.monitor].concat(args));
  5773. delete events[i];
  5774. }, this);
  5775. storage.store(type, events);
  5776. return this;
  5777. }
  5778. };
  5779. };
  5780. var pseudos = {
  5781. once: function(split, fn, args, monitor){
  5782. fn.apply(this, args);
  5783. this.removeEvent(split.event, monitor)
  5784. .removeEvent(split.original, fn);
  5785. },
  5786. throttle: function(split, fn, args){
  5787. if (!fn._throttled){
  5788. fn.apply(this, args);
  5789. fn._throttled = setTimeout(function(){
  5790. fn._throttled = false;
  5791. }, split.value || 250);
  5792. }
  5793. },
  5794. pause: function(split, fn, args){
  5795. clearTimeout(fn._pause);
  5796. fn._pause = fn.delay(split.value || 250, this, args);
  5797. }
  5798. };
  5799. Events.definePseudo = function(key, listener){
  5800. pseudos[key] = listener;
  5801. return this;
  5802. };
  5803. Events.lookupPseudo = function(key){
  5804. return pseudos[key];
  5805. };
  5806. var proto = Events.prototype;
  5807. Events.implement(Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
  5808. ['Request', 'Fx'].each(function(klass){
  5809. if (this[klass]) this[klass].implement(Events.prototype);
  5810. });
  5811. })();
  5812. /*
  5813. ---
  5814. script: Drag.js
  5815. name: Drag
  5816. description: The base Drag Class. Can be used to drag and resize Elements using mouse events.
  5817. license: MIT-style license
  5818. authors:
  5819. - Valerio Proietti
  5820. - Tom Occhinno
  5821. - Jan Kassens
  5822. requires:
  5823. - Core/Events
  5824. - Core/Options
  5825. - Core/Element.Event
  5826. - Core/Element.Style
  5827. - Core/Element.Dimensions
  5828. - MooTools.More
  5829. provides: [Drag]
  5830. ...
  5831. */
  5832. (function(){
  5833. var Drag = this.Drag = new Class({
  5834. Implements: [Events, Options],
  5835. options: {/*
  5836. onBeforeStart: function(thisElement){},
  5837. onStart: function(thisElement, event){},
  5838. onSnap: function(thisElement){},
  5839. onDrag: function(thisElement, event){},
  5840. onCancel: function(thisElement){},
  5841. onComplete: function(thisElement, event){},*/
  5842. snap: 6,
  5843. unit: 'px',
  5844. grid: false,
  5845. style: true,
  5846. limit: false,
  5847. handle: false,
  5848. invert: false,
  5849. unDraggableTags: ['button', 'input', 'a', 'textarea', 'select', 'option'],
  5850. preventDefault: false,
  5851. stopPropagation: false,
  5852. compensateScroll: false,
  5853. modifiers: {x: 'left', y: 'top'}
  5854. },
  5855. initialize: function(){
  5856. var params = Array.link(arguments, {
  5857. 'options': Type.isObject,
  5858. 'element': function(obj){
  5859. return obj != null;
  5860. }
  5861. });
  5862. this.element = document.id(params.element);
  5863. this.document = this.element.getDocument();
  5864. this.setOptions(params.options || {});
  5865. var htype = typeOf(this.options.handle);
  5866. this.handles = ((htype == 'array' || htype == 'collection') ? $$(this.options.handle) : document.id(this.options.handle)) || this.element;
  5867. this.mouse = {'now': {}, 'pos': {}};
  5868. this.value = {'start': {}, 'now': {}};
  5869. this.offsetParent = (function(el){
  5870. var offsetParent = el.getOffsetParent();
  5871. var isBody = !offsetParent || (/^(?:body|html)$/i).test(offsetParent.tagName);
  5872. return isBody ? window : document.id(offsetParent);
  5873. })(this.element);
  5874. this.selection = 'selectstart' in document ? 'selectstart' : 'mousedown';
  5875. this.compensateScroll = {start: {}, diff: {}, last: {}};
  5876. if ('ondragstart' in document && !('FileReader' in window) && !Drag.ondragstartFixed){
  5877. document.ondragstart = Function.convert(false);
  5878. Drag.ondragstartFixed = true;
  5879. }
  5880. this.bound = {
  5881. start: this.start.bind(this),
  5882. check: this.check.bind(this),
  5883. drag: this.drag.bind(this),
  5884. stop: this.stop.bind(this),
  5885. cancel: this.cancel.bind(this),
  5886. eventStop: Function.convert(false),
  5887. scrollListener: this.scrollListener.bind(this)
  5888. };
  5889. this.attach();
  5890. },
  5891. attach: function(){
  5892. this.handles.addEvent('mousedown', this.bound.start);
  5893. this.handles.addEvent('touchstart', this.bound.start);
  5894. if (this.options.compensateScroll) this.offsetParent.addEvent('scroll', this.bound.scrollListener);
  5895. return this;
  5896. },
  5897. detach: function(){
  5898. this.handles.removeEvent('mousedown', this.bound.start);
  5899. this.handles.removeEvent('touchstart', this.bound.start);
  5900. if (this.options.compensateScroll) this.offsetParent.removeEvent('scroll', this.bound.scrollListener);
  5901. return this;
  5902. },
  5903. scrollListener: function(){
  5904. if (!this.mouse.start) return;
  5905. var newScrollValue = this.offsetParent.getScroll();
  5906. if (this.element.getStyle('position') == 'absolute'){
  5907. var scrollDiff = this.sumValues(newScrollValue, this.compensateScroll.last, -1);
  5908. this.mouse.now = this.sumValues(this.mouse.now, scrollDiff, 1);
  5909. } else {
  5910. this.compensateScroll.diff = this.sumValues(newScrollValue, this.compensateScroll.start, -1);
  5911. }
  5912. if (this.offsetParent != window) this.compensateScroll.diff = this.sumValues(this.compensateScroll.start, newScrollValue, -1);
  5913. this.compensateScroll.last = newScrollValue;
  5914. this.render(this.options);
  5915. },
  5916. sumValues: function(alpha, beta, op){
  5917. var sum = {}, options = this.options;
  5918. for (var z in options.modifiers){
  5919. if (!options.modifiers[z]) continue;
  5920. sum[z] = alpha[z] + beta[z] * op;
  5921. }
  5922. return sum;
  5923. },
  5924. start: function(event){
  5925. if (this.options.unDraggableTags.contains(event.target.get('tag'))) return;
  5926. var options = this.options;
  5927. if (event.rightClick) return;
  5928. if (options.preventDefault) event.preventDefault();
  5929. if (options.stopPropagation) event.stopPropagation();
  5930. this.compensateScroll.start = this.compensateScroll.last = this.offsetParent.getScroll();
  5931. this.compensateScroll.diff = {x: 0, y: 0};
  5932. this.mouse.start = event.page;
  5933. this.fireEvent('beforeStart', this.element);
  5934. var limit = options.limit;
  5935. this.limit = {x: [], y: []};
  5936. var z, coordinates, offsetParent = this.offsetParent == window ? null : this.offsetParent;
  5937. for (z in options.modifiers){
  5938. if (!options.modifiers[z]) continue;
  5939. var style = this.element.getStyle(options.modifiers[z]);
  5940. // Some browsers (IE and Opera) don't always return pixels.
  5941. if (style && !style.match(/px$/)){
  5942. if (!coordinates) coordinates = this.element.getCoordinates(offsetParent);
  5943. style = coordinates[options.modifiers[z]];
  5944. }
  5945. if (options.style) this.value.now[z] = (style || 0).toInt();
  5946. else this.value.now[z] = this.element[options.modifiers[z]];
  5947. if (options.invert) this.value.now[z] *= -1;
  5948. this.mouse.pos[z] = event.page[z] - this.value.now[z];
  5949. if (limit && limit[z]){
  5950. var i = 2;
  5951. while (i--){
  5952. var limitZI = limit[z][i];
  5953. if (limitZI || limitZI === 0) this.limit[z][i] = (typeof limitZI == 'function') ? limitZI() : limitZI;
  5954. }
  5955. }
  5956. }
  5957. if (typeOf(this.options.grid) == 'number') this.options.grid = {
  5958. x: this.options.grid,
  5959. y: this.options.grid
  5960. };
  5961. var events = {
  5962. mousemove: this.bound.check,
  5963. mouseup: this.bound.cancel,
  5964. touchmove: this.bound.check,
  5965. touchend: this.bound.cancel
  5966. };
  5967. events[this.selection] = this.bound.eventStop;
  5968. this.document.addEvents(events);
  5969. },
  5970. check: function(event){
  5971. if (this.options.preventDefault) event.preventDefault();
  5972. var distance = Math.round(Math.sqrt(Math.pow(event.page.x - this.mouse.start.x, 2) + Math.pow(event.page.y - this.mouse.start.y, 2)));
  5973. if (distance > this.options.snap){
  5974. this.cancel();
  5975. this.document.addEvents({
  5976. mousemove: this.bound.drag,
  5977. mouseup: this.bound.stop,
  5978. touchmove: this.bound.drag,
  5979. touchend: this.bound.stop
  5980. });
  5981. this.fireEvent('start', [this.element, event]).fireEvent('snap', this.element);
  5982. }
  5983. },
  5984. drag: function(event){
  5985. var options = this.options;
  5986. if (options.preventDefault) event.preventDefault();
  5987. this.mouse.now = this.sumValues(event.page, this.compensateScroll.diff, -1);
  5988. this.render(options);
  5989. this.fireEvent('drag', [this.element, event]);
  5990. },
  5991. render: function(options){
  5992. for (var z in options.modifiers){
  5993. if (!options.modifiers[z]) continue;
  5994. this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z];
  5995. if (options.invert) this.value.now[z] *= -1;
  5996. if (options.limit && this.limit[z]){
  5997. if ((this.limit[z][1] || this.limit[z][1] === 0) && (this.value.now[z] > this.limit[z][1])){
  5998. this.value.now[z] = this.limit[z][1];
  5999. } else if ((this.limit[z][0] || this.limit[z][0] === 0) && (this.value.now[z] < this.limit[z][0])){
  6000. this.value.now[z] = this.limit[z][0];
  6001. }
  6002. }
  6003. if (options.grid[z]) this.value.now[z] -= ((this.value.now[z] - (this.limit[z][0]||0)) % options.grid[z]);
  6004. if (options.style) this.element.setStyle(options.modifiers[z], this.value.now[z] + options.unit);
  6005. else this.element[options.modifiers[z]] = this.value.now[z];
  6006. }
  6007. },
  6008. cancel: function(event){
  6009. this.document.removeEvents({
  6010. mousemove: this.bound.check,
  6011. mouseup: this.bound.cancel,
  6012. touchmove: this.bound.check,
  6013. touchend: this.bound.cancel
  6014. });
  6015. if (event){
  6016. this.document.removeEvent(this.selection, this.bound.eventStop);
  6017. this.fireEvent('cancel', this.element);
  6018. }
  6019. },
  6020. stop: function(event){
  6021. var events = {
  6022. mousemove: this.bound.drag,
  6023. mouseup: this.bound.stop,
  6024. touchmove: this.bound.drag,
  6025. touchend: this.bound.stop
  6026. };
  6027. events[this.selection] = this.bound.eventStop;
  6028. this.document.removeEvents(events);
  6029. this.mouse.start = null;
  6030. if (event) this.fireEvent('complete', [this.element, event]);
  6031. }
  6032. });
  6033. })();
  6034. Element.implement({
  6035. makeResizable: function(options){
  6036. var drag = new Drag(this, Object.merge({
  6037. modifiers: {
  6038. x: 'width',
  6039. y: 'height'
  6040. }
  6041. }, options));
  6042. this.store('resizer', drag);
  6043. return drag.addEvent('drag', function(){
  6044. this.fireEvent('resize', drag);
  6045. }.bind(this));
  6046. }
  6047. });
  6048. /*
  6049. ---
  6050. script: Drag.Move.js
  6051. name: Drag.Move
  6052. description: A Drag extension that provides support for the constraining of draggables to containers and droppables.
  6053. license: MIT-style license
  6054. authors:
  6055. - Valerio Proietti
  6056. - Tom Occhinno
  6057. - Jan Kassens
  6058. - Aaron Newton
  6059. - Scott Kyle
  6060. requires:
  6061. - Core/Element.Dimensions
  6062. - Drag
  6063. provides: [Drag.Move]
  6064. ...
  6065. */
  6066. Drag.Move = new Class({
  6067. Extends: Drag,
  6068. options: {/*
  6069. onEnter: function(thisElement, overed){},
  6070. onLeave: function(thisElement, overed){},
  6071. onDrop: function(thisElement, overed, event){},*/
  6072. droppables: [],
  6073. container: false,
  6074. precalculate: false,
  6075. includeMargins: true,
  6076. checkDroppables: true
  6077. },
  6078. initialize: function(element, options){
  6079. this.parent(element, options);
  6080. element = this.element;
  6081. this.droppables = $$(this.options.droppables);
  6082. this.setContainer(this.options.container);
  6083. if (this.options.style){
  6084. if (this.options.modifiers.x == 'left' && this.options.modifiers.y == 'top'){
  6085. var parent = element.getOffsetParent(),
  6086. styles = element.getStyles('left', 'top');
  6087. if (parent && (styles.left == 'auto' || styles.top == 'auto')){
  6088. element.setPosition(element.getPosition(parent));
  6089. }
  6090. }
  6091. if (element.getStyle('position') == 'static') element.setStyle('position', 'absolute');
  6092. }
  6093. this.addEvent('start', this.checkDroppables, true);
  6094. this.overed = null;
  6095. },
  6096. setContainer: function(container){
  6097. this.container = document.id(container);
  6098. if (this.container && typeOf(this.container) != 'element'){
  6099. this.container = document.id(this.container.getDocument().body);
  6100. }
  6101. },
  6102. start: function(event){
  6103. if (this.container) this.options.limit = this.calculateLimit();
  6104. if (this.options.precalculate){
  6105. this.positions = this.droppables.map(function(el){
  6106. return el.getCoordinates();
  6107. });
  6108. }
  6109. this.parent(event);
  6110. },
  6111. calculateLimit: function(){
  6112. var element = this.element,
  6113. container = this.container,
  6114. offsetParent = document.id(element.getOffsetParent()) || document.body,
  6115. containerCoordinates = container.getCoordinates(offsetParent),
  6116. elementMargin = {},
  6117. elementBorder = {},
  6118. containerMargin = {},
  6119. containerBorder = {},
  6120. offsetParentPadding = {},
  6121. offsetScroll = offsetParent.getScroll();
  6122. ['top', 'right', 'bottom', 'left'].each(function(pad){
  6123. elementMargin[pad] = element.getStyle('margin-' + pad).toInt();
  6124. elementBorder[pad] = element.getStyle('border-' + pad).toInt();
  6125. containerMargin[pad] = container.getStyle('margin-' + pad).toInt();
  6126. containerBorder[pad] = container.getStyle('border-' + pad).toInt();
  6127. offsetParentPadding[pad] = offsetParent.getStyle('padding-' + pad).toInt();
  6128. }, this);
  6129. var width = element.offsetWidth + elementMargin.left + elementMargin.right,
  6130. height = element.offsetHeight + elementMargin.top + elementMargin.bottom,
  6131. left = 0 + offsetScroll.x,
  6132. top = 0 + offsetScroll.y,
  6133. right = containerCoordinates.right - containerBorder.right - width + offsetScroll.x,
  6134. bottom = containerCoordinates.bottom - containerBorder.bottom - height + offsetScroll.y;
  6135. if (this.options.includeMargins){
  6136. left += elementMargin.left;
  6137. top += elementMargin.top;
  6138. } else {
  6139. right += elementMargin.right;
  6140. bottom += elementMargin.bottom;
  6141. }
  6142. if (element.getStyle('position') == 'relative'){
  6143. var coords = element.getCoordinates(offsetParent);
  6144. coords.left -= element.getStyle('left').toInt();
  6145. coords.top -= element.getStyle('top').toInt();
  6146. left -= coords.left;
  6147. top -= coords.top;
  6148. if (container.getStyle('position') != 'relative'){
  6149. left += containerBorder.left;
  6150. top += containerBorder.top;
  6151. }
  6152. right += elementMargin.left - coords.left;
  6153. bottom += elementMargin.top - coords.top;
  6154. if (container != offsetParent){
  6155. left += containerMargin.left + offsetParentPadding.left;
  6156. if (!offsetParentPadding.left && left < 0) left = 0;
  6157. top += offsetParent == document.body ? 0 : containerMargin.top + offsetParentPadding.top;
  6158. if (!offsetParentPadding.top && top < 0) top = 0;
  6159. }
  6160. } else {
  6161. left -= elementMargin.left;
  6162. top -= elementMargin.top;
  6163. if (container != offsetParent){
  6164. left += containerCoordinates.left + containerBorder.left;
  6165. top += containerCoordinates.top + containerBorder.top;
  6166. }
  6167. }
  6168. return {
  6169. x: [left, right],
  6170. y: [top, bottom]
  6171. };
  6172. },
  6173. getDroppableCoordinates: function(element){
  6174. var position = element.getCoordinates();
  6175. if (element.getStyle('position') == 'fixed'){
  6176. var scroll = window.getScroll();
  6177. position.left += scroll.x;
  6178. position.right += scroll.x;
  6179. position.top += scroll.y;
  6180. position.bottom += scroll.y;
  6181. }
  6182. return position;
  6183. },
  6184. //modify by Tommy
  6185. checkDroppables:function(){
  6186. var overedList = this.droppables.filter(function(el, i){
  6187. el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el);
  6188. var now = this.mouse.now;
  6189. return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
  6190. }, this);
  6191. var overed = overedList.getLast();
  6192. if (overed) for (var x=0;x<overedList.length-1;x++) if(overed.contains(overedList[x])) overed=overedList[x];
  6193. if(this.overed!=overed){
  6194. if(this.overed) this.fireEvent("leave",[this.element,this.overed]);
  6195. if(overed) this.fireEvent("enter",[this.element,overed]);
  6196. this.overed=overed;
  6197. }
  6198. },
  6199. //mootools....
  6200. //checkDroppables: function(){
  6201. // var overed = this.droppables.filter(function(el, i){
  6202. // el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el);
  6203. // var now = this.mouse.now;
  6204. // return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
  6205. // }, this).getLast();
  6206. //
  6207. // if (this.overed != overed){
  6208. // if (this.overed) this.fireEvent('leave', [this.element, this.overed]);
  6209. // if (overed) this.fireEvent('enter', [this.element, overed]);
  6210. // this.overed = overed;
  6211. // }
  6212. //},
  6213. drag: function(event){
  6214. this.parent(event);
  6215. if (this.options.checkDroppables && this.droppables.length) this.checkDroppables();
  6216. },
  6217. stop: function(event){
  6218. this.checkDroppables();
  6219. this.fireEvent('drop', [this.element, this.overed, event]);
  6220. this.overed = null;
  6221. return this.parent(event);
  6222. }
  6223. });
  6224. Element.implement({
  6225. makeDraggable: function(options){
  6226. var drag = new Drag.Move(this, options);
  6227. this.store('dragger', drag);
  6228. return drag;
  6229. }
  6230. });
  6231. /*
  6232. ---
  6233. script: Element.Measure.js
  6234. name: Element.Measure
  6235. description: Extends the Element native object to include methods useful in measuring dimensions.
  6236. credits: "Element.measure / .expose methods by Daniel Steigerwald License: MIT-style license. Copyright: Copyright (c) 2008 Daniel Steigerwald, daniel.steigerwald.cz"
  6237. license: MIT-style license
  6238. authors:
  6239. - Aaron Newton
  6240. requires:
  6241. - Core/Element.Style
  6242. - Core/Element.Dimensions
  6243. - MooTools.More
  6244. provides: [Element.Measure]
  6245. ...
  6246. */
  6247. (function(){
  6248. var getStylesList = function(styles, planes){
  6249. var list = [];
  6250. Object.each(planes, function(directions){
  6251. Object.each(directions, function(edge){
  6252. styles.each(function(style){
  6253. list.push(style + '-' + edge + (style == 'border' ? '-width' : ''));
  6254. });
  6255. });
  6256. });
  6257. return list;
  6258. };
  6259. var calculateEdgeSize = function(edge, styles){
  6260. var total = 0;
  6261. Object.each(styles, function(value, style){
  6262. if (style.test(edge)) total = total + value.toInt();
  6263. });
  6264. return total;
  6265. };
  6266. var isVisible = function(el){
  6267. return !!(!el || el.offsetHeight || el.offsetWidth);
  6268. };
  6269. Element.implement({
  6270. measure: function(fn){
  6271. if (isVisible(this)) return fn.call(this);
  6272. var parent = this.getParent(),
  6273. toMeasure = [];
  6274. while (!isVisible(parent) && parent != document.body){
  6275. toMeasure.push(parent.expose());
  6276. parent = parent.getParent();
  6277. }
  6278. var restore = this.expose(),
  6279. result = fn.call(this);
  6280. restore();
  6281. toMeasure.each(function(restore){
  6282. restore();
  6283. });
  6284. return result;
  6285. },
  6286. expose: function(){
  6287. if (this.getStyle('display') != 'none') return function(){};
  6288. var before = this.style.cssText;
  6289. this.setStyles({
  6290. display: 'block',
  6291. position: 'absolute',
  6292. visibility: 'hidden'
  6293. });
  6294. return function(){
  6295. this.style.cssText = before;
  6296. }.bind(this);
  6297. },
  6298. getDimensions: function(options){
  6299. options = Object.merge({computeSize: false}, options);
  6300. var dim = {x: 0, y: 0};
  6301. var getSize = function(el, options){
  6302. return (options.computeSize) ? el.getComputedSize(options) : el.getSize();
  6303. };
  6304. var parent = this.getParent('body');
  6305. if (parent && this.getStyle('display') == 'none'){
  6306. dim = this.measure(function(){
  6307. return getSize(this, options);
  6308. });
  6309. } else if (parent){
  6310. try { //safari sometimes crashes here, so catch it
  6311. dim = getSize(this, options);
  6312. } catch (e){}
  6313. }
  6314. return Object.append(dim, (dim.x || dim.x === 0) ? {
  6315. width: dim.x,
  6316. height: dim.y
  6317. } : {
  6318. x: dim.width,
  6319. y: dim.height
  6320. });
  6321. },
  6322. getComputedSize: function(options){
  6323. //<1.2compat>
  6324. //legacy support for my stupid spelling error
  6325. if (options && options.plains) options.planes = options.plains;
  6326. //</1.2compat>
  6327. options = Object.merge({
  6328. styles: ['padding','border'],
  6329. planes: {
  6330. height: ['top','bottom'],
  6331. width: ['left','right']
  6332. },
  6333. mode: 'both'
  6334. }, options);
  6335. var styles = {},
  6336. size = {width: 0, height: 0},
  6337. dimensions;
  6338. if (options.mode == 'vertical'){
  6339. delete size.width;
  6340. delete options.planes.width;
  6341. } else if (options.mode == 'horizontal'){
  6342. delete size.height;
  6343. delete options.planes.height;
  6344. }
  6345. getStylesList(options.styles, options.planes).each(function(style){
  6346. styles[style] = this.getStyle(style).toInt();
  6347. }, this);
  6348. Object.each(options.planes, function(edges, plane){
  6349. var capitalized = plane.capitalize(),
  6350. style = this.getStyle(plane);
  6351. if (style == 'auto' && !dimensions) dimensions = this.getDimensions();
  6352. style = styles[plane] = (style == 'auto') ? dimensions[plane] : style.toInt();
  6353. size['total' + capitalized] = style;
  6354. edges.each(function(edge){
  6355. var edgesize = calculateEdgeSize(edge, styles);
  6356. size['computed' + edge.capitalize()] = edgesize;
  6357. size['total' + capitalized] += edgesize;
  6358. });
  6359. }, this);
  6360. return Object.append(size, styles);
  6361. }
  6362. });
  6363. })();
  6364. /*
  6365. ---
  6366. script: Slider.js
  6367. name: Slider
  6368. description: Class for creating horizontal and vertical slider controls.
  6369. license: MIT-style license
  6370. authors:
  6371. - Valerio Proietti
  6372. requires:
  6373. - Core/Element.Dimensions
  6374. - Core/Number
  6375. - Class.Binds
  6376. - Drag
  6377. - Element.Measure
  6378. provides: [Slider]
  6379. ...
  6380. */
  6381. (function(){
  6382. var Slider = this.Slider = new Class({
  6383. Implements: [Events, Options],
  6384. Binds: ['clickedElement', 'draggedKnob', 'scrolledElement'],
  6385. options: {/*
  6386. onTick: function(intPosition){},
  6387. onMove: function(){},
  6388. onChange: function(intStep){},
  6389. onComplete: function(strStep){},*/
  6390. onTick: function(position){
  6391. this.setKnobPosition(position);
  6392. },
  6393. initialStep: 0,
  6394. snap: false,
  6395. offset: 0,
  6396. range: false,
  6397. wheel: false,
  6398. steps: 100,
  6399. mode: 'horizontal'
  6400. },
  6401. initialize: function(element, knob, options){
  6402. this.setOptions(options);
  6403. options = this.options;
  6404. this.element = document.id(element);
  6405. knob = this.knob = document.id(knob);
  6406. this.previousChange = this.previousEnd = this.step = options.initialStep ? options.initialStep : options.range ? options.range[0] : 0;
  6407. var limit = {},
  6408. modifiers = {x: false, y: false};
  6409. switch (options.mode){
  6410. case 'vertical':
  6411. this.axis = 'y';
  6412. this.property = 'top';
  6413. this.offset = 'offsetHeight';
  6414. break;
  6415. case 'horizontal':
  6416. this.axis = 'x';
  6417. this.property = 'left';
  6418. this.offset = 'offsetWidth';
  6419. }
  6420. this.setSliderDimensions();
  6421. this.setRange(options.range, null, true);
  6422. if (knob.getStyle('position') == 'static') knob.setStyle('position', 'relative');
  6423. knob.setStyle(this.property, -options.offset);
  6424. modifiers[this.axis] = this.property;
  6425. limit[this.axis] = [-options.offset, this.full - options.offset];
  6426. var dragOptions = {
  6427. snap: 0,
  6428. limit: limit,
  6429. modifiers: modifiers,
  6430. onDrag: this.draggedKnob,
  6431. onStart: this.draggedKnob,
  6432. onBeforeStart: (function(){
  6433. this.isDragging = true;
  6434. }).bind(this),
  6435. onCancel: function(){
  6436. this.isDragging = false;
  6437. }.bind(this),
  6438. onComplete: function(){
  6439. this.isDragging = false;
  6440. this.draggedKnob();
  6441. this.end();
  6442. }.bind(this)
  6443. };
  6444. if (options.snap) this.setSnap(dragOptions);
  6445. this.drag = new Drag(knob, dragOptions);
  6446. if (options.initialStep != null) this.set(options.initialStep, true);
  6447. this.attach();
  6448. },
  6449. attach: function(){
  6450. this.element.addEvent('mousedown', this.clickedElement);
  6451. if (this.options.wheel) this.element.addEvent('mousewheel', this.scrolledElement);
  6452. this.drag.attach();
  6453. return this;
  6454. },
  6455. detach: function(){
  6456. this.element.removeEvent('mousedown', this.clickedElement)
  6457. .removeEvent('mousewheel', this.scrolledElement);
  6458. this.drag.detach();
  6459. return this;
  6460. },
  6461. autosize: function(){
  6462. this.setSliderDimensions()
  6463. .setKnobPosition(this.toPosition(this.step));
  6464. this.drag.options.limit[this.axis] = [-this.options.offset, this.full - this.options.offset];
  6465. if (this.options.snap) this.setSnap();
  6466. return this;
  6467. },
  6468. setSnap: function(options){
  6469. if (!options) options = this.drag.options;
  6470. options.grid = Math.ceil(this.stepWidth);
  6471. options.limit[this.axis][1] = this.element[this.offset];
  6472. return this;
  6473. },
  6474. setKnobPosition: function(position){
  6475. if (this.options.snap) position = this.toPosition(this.step);
  6476. this.knob.setStyle(this.property, position);
  6477. return this;
  6478. },
  6479. setSliderDimensions: function(){
  6480. this.full = this.element.measure(function(){
  6481. this.half = this.knob[this.offset] / 2;
  6482. return this.element[this.offset] - this.knob[this.offset] + (this.options.offset * 2);
  6483. }.bind(this));
  6484. return this;
  6485. },
  6486. set: function(step, silently){
  6487. if (!((this.range > 0) ^ (step < this.min))) step = this.min;
  6488. if (!((this.range > 0) ^ (step > this.max))) step = this.max;
  6489. this.step = (step).round(this.modulus.decimalLength);
  6490. if (silently) this.checkStep().setKnobPosition(this.toPosition(this.step));
  6491. else this.checkStep().fireEvent('tick', this.toPosition(this.step)).fireEvent('move').end();
  6492. return this;
  6493. },
  6494. setRange: function(range, pos, silently){
  6495. this.min = Array.pick([range[0], 0]);
  6496. this.max = Array.pick([range[1], this.options.steps]);
  6497. this.range = this.max - this.min;
  6498. this.steps = this.options.steps || this.full;
  6499. var stepSize = this.stepSize = Math.abs(this.range) / this.steps;
  6500. this.stepWidth = this.stepSize * this.full / Math.abs(this.range);
  6501. this.setModulus();
  6502. if (range) this.set(Array.pick([pos, this.step]).limit(this.min,this.max), silently);
  6503. return this;
  6504. },
  6505. setModulus: function(){
  6506. var decimals = ((this.stepSize + '').split('.')[1] || []).length,
  6507. modulus = 1 + '';
  6508. while (decimals--) modulus += '0';
  6509. this.modulus = {multiplier: (modulus).toInt(10), decimalLength: modulus.length - 1};
  6510. },
  6511. clickedElement: function(event){
  6512. if (this.isDragging || event.target == this.knob) return;
  6513. var dir = this.range < 0 ? -1 : 1,
  6514. position = event.page[this.axis] - this.element.getPosition()[this.axis] - this.half;
  6515. position = position.limit(-this.options.offset, this.full - this.options.offset);
  6516. this.step = (this.min + dir * this.toStep(position)).round(this.modulus.decimalLength);
  6517. this.checkStep()
  6518. .fireEvent('tick', position)
  6519. .fireEvent('move')
  6520. .end();
  6521. },
  6522. scrolledElement: function(event){
  6523. var mode = (this.options.mode == 'horizontal') ? (event.wheel < 0) : (event.wheel > 0);
  6524. this.set(this.step + (mode ? -1 : 1) * this.stepSize);
  6525. event.stop();
  6526. },
  6527. draggedKnob: function(){
  6528. var dir = this.range < 0 ? -1 : 1,
  6529. position = this.drag.value.now[this.axis];
  6530. position = position.limit(-this.options.offset, this.full -this.options.offset);
  6531. this.step = (this.min + dir * this.toStep(position)).round(this.modulus.decimalLength);
  6532. this.checkStep();
  6533. this.fireEvent('move');
  6534. },
  6535. checkStep: function(){
  6536. var step = this.step;
  6537. if (this.previousChange != step){
  6538. this.previousChange = step;
  6539. this.fireEvent('change', step);
  6540. }
  6541. return this;
  6542. },
  6543. end: function(){
  6544. var step = this.step;
  6545. if (this.previousEnd !== step){
  6546. this.previousEnd = step;
  6547. this.fireEvent('complete', step + '');
  6548. }
  6549. return this;
  6550. },
  6551. toStep: function(position){
  6552. var step = (position + this.options.offset) * this.stepSize / this.full * this.steps;
  6553. return this.options.steps ? (step - (step * this.modulus.multiplier) % (this.stepSize * this.modulus.multiplier) / this.modulus.multiplier).round(this.modulus.decimalLength) : step;
  6554. },
  6555. toPosition: function(step){
  6556. return (this.full * Math.abs(this.min - step)) / (this.steps * this.stepSize) - this.options.offset || 0;
  6557. }
  6558. });
  6559. })();
  6560. /*
  6561. ---
  6562. script: Sortables.js
  6563. name: Sortables
  6564. description: Class for creating a drag and drop sorting interface for lists of items.
  6565. license: MIT-style license
  6566. authors:
  6567. - Tom Occhino
  6568. requires:
  6569. - Core/Fx.Morph
  6570. - Drag.Move
  6571. provides: [Sortables]
  6572. ...
  6573. */
  6574. (function(){
  6575. var Sortables = this.Sortables = new Class({
  6576. Implements: [Events, Options],
  6577. options: {/*
  6578. onSort: function(element, clone){},
  6579. onStart: function(element, clone){},
  6580. onComplete: function(element){},*/
  6581. opacity: 1,
  6582. clone: false,
  6583. revert: false,
  6584. handle: false,
  6585. dragOptions: {},
  6586. unDraggableTags: ['button', 'input', 'a', 'textarea', 'select', 'option']/*<1.2compat>*/,
  6587. snap: 4,
  6588. constrain: false,
  6589. preventDefault: false
  6590. /*</1.2compat>*/
  6591. },
  6592. initialize: function(lists, options){
  6593. this.setOptions(options);
  6594. this.elements = [];
  6595. this.lists = [];
  6596. this.idle = true;
  6597. this.addLists($$(document.id(lists) || lists));
  6598. if (!this.options.clone) this.options.revert = false;
  6599. if (this.options.revert) this.effect = new Fx.Morph(null, Object.merge({
  6600. duration: 250,
  6601. link: 'cancel'
  6602. }, this.options.revert));
  6603. },
  6604. attach: function(){
  6605. this.addLists(this.lists);
  6606. return this;
  6607. },
  6608. detach: function(){
  6609. this.lists = this.removeLists(this.lists);
  6610. return this;
  6611. },
  6612. addItems: function(){
  6613. Array.flatten(arguments).each(function(element){
  6614. this.elements.push(element);
  6615. var start = element.retrieve('sortables:start', function(event){
  6616. this.start.call(this, event, element);
  6617. }.bind(this));
  6618. (this.options.handle ? element.getElement(this.options.handle) || element : element).addEvent('mousedown', start);
  6619. }, this);
  6620. return this;
  6621. },
  6622. addLists: function(){
  6623. Array.flatten(arguments).each(function(list){
  6624. this.lists.include(list);
  6625. this.addItems(list.getChildren());
  6626. }, this);
  6627. return this;
  6628. },
  6629. removeItems: function(){
  6630. return $$(Array.flatten(arguments).map(function(element){
  6631. this.elements.erase(element);
  6632. var start = element.retrieve('sortables:start');
  6633. (this.options.handle ? element.getElement(this.options.handle) || element : element).removeEvent('mousedown', start);
  6634. return element;
  6635. }, this));
  6636. },
  6637. removeLists: function(){
  6638. return $$(Array.flatten(arguments).map(function(list){
  6639. this.lists.erase(list);
  6640. this.removeItems(list.getChildren());
  6641. return list;
  6642. }, this));
  6643. },
  6644. getDroppableCoordinates: function(element){
  6645. var offsetParent = element.getOffsetParent();
  6646. var position = element.getPosition(offsetParent);
  6647. var scroll = {
  6648. w: window.getScroll(),
  6649. offsetParent: offsetParent.getScroll()
  6650. };
  6651. position.x += scroll.offsetParent.x;
  6652. position.y += scroll.offsetParent.y;
  6653. if (offsetParent.getStyle('position') == 'fixed'){
  6654. position.x -= scroll.w.x;
  6655. position.y -= scroll.w.y;
  6656. }
  6657. return position;
  6658. },
  6659. getClone: function(event, element){
  6660. if (!this.options.clone) return new Element(element.tagName).inject(document.body);
  6661. if (typeOf(this.options.clone) == 'function') return this.options.clone.call(this, event, element, this.list);
  6662. var clone = element.clone(true).setStyles({
  6663. margin: 0,
  6664. position: 'absolute',
  6665. visibility: 'hidden',
  6666. width: element.getStyle('width')
  6667. }).addEvent('mousedown', function(event){
  6668. element.fireEvent('mousedown', event);
  6669. });
  6670. //prevent the duplicated radio inputs from unchecking the real one
  6671. if (clone.get('html').test('radio')){
  6672. clone.getElements('input[type=radio]').each(function(input, i){
  6673. input.set('name', 'clone_' + i);
  6674. if (input.get('checked')) element.getElements('input[type=radio]')[i].set('checked', true);
  6675. });
  6676. }
  6677. return clone.inject(this.list).setPosition(this.getDroppableCoordinates(this.element));
  6678. },
  6679. getDroppables: function(){
  6680. var droppables = this.list.getChildren().erase(this.clone).erase(this.element);
  6681. if (!this.options.constrain) droppables.append(this.lists).erase(this.list);
  6682. return droppables;
  6683. },
  6684. insert: function(dragging, element){
  6685. var where = 'inside';
  6686. if (this.lists.contains(element)){
  6687. this.list = element;
  6688. this.drag.droppables = this.getDroppables();
  6689. } else {
  6690. where = this.element.getAllPrevious().contains(element) ? 'before' : 'after';
  6691. }
  6692. this.element.inject(element, where);
  6693. this.fireEvent('sort', [this.element, this.clone]);
  6694. },
  6695. start: function(event, element){
  6696. if (
  6697. !this.idle ||
  6698. event.rightClick ||
  6699. (!this.options.handle && this.options.unDraggableTags.contains(event.target.get('tag')))
  6700. ) return;
  6701. this.idle = false;
  6702. this.element = element;
  6703. this.opacity = element.getStyle('opacity');
  6704. this.list = element.getParent();
  6705. this.clone = this.getClone(event, element);
  6706. this.drag = new Drag.Move(this.clone, Object.merge({
  6707. /*<1.2compat>*/
  6708. preventDefault: this.options.preventDefault,
  6709. snap: this.options.snap,
  6710. container: this.options.constrain && this.element.getParent(),
  6711. /*</1.2compat>*/
  6712. droppables: this.getDroppables()
  6713. }, this.options.dragOptions)).addEvents({
  6714. onSnap: function(){
  6715. event.stop();
  6716. this.clone.setStyle('visibility', 'visible');
  6717. this.element.setStyle('opacity', this.options.opacity || 0);
  6718. this.fireEvent('start', [this.element, this.clone]);
  6719. }.bind(this),
  6720. onEnter: this.insert.bind(this),
  6721. onCancel: this.end.bind(this),
  6722. onComplete: this.end.bind(this)
  6723. });
  6724. this.clone.inject(this.element, 'before');
  6725. this.drag.start(event);
  6726. },
  6727. end: function(){
  6728. this.drag.detach();
  6729. this.element.setStyle('opacity', this.opacity);
  6730. var self = this;
  6731. if (this.effect){
  6732. var dim = this.element.getStyles('width', 'height'),
  6733. clone = this.clone,
  6734. pos = clone.computePosition(this.getDroppableCoordinates(clone));
  6735. var destroy = function(){
  6736. this.removeEvent('cancel', destroy);
  6737. clone.destroy();
  6738. self.reset();
  6739. };
  6740. this.effect.element = clone;
  6741. this.effect.start({
  6742. top: pos.top,
  6743. left: pos.left,
  6744. width: dim.width,
  6745. height: dim.height,
  6746. opacity: 0.25
  6747. }).addEvent('cancel', destroy).chain(destroy);
  6748. } else {
  6749. this.clone.destroy();
  6750. self.reset();
  6751. }
  6752. },
  6753. reset: function(){
  6754. this.idle = true;
  6755. this.fireEvent('complete', this.element);
  6756. },
  6757. serialize: function(){
  6758. var params = Array.link(arguments, {
  6759. modifier: Type.isFunction,
  6760. index: function(obj){
  6761. return obj != null;
  6762. }
  6763. });
  6764. var serial = this.lists.map(function(list){
  6765. return list.getChildren().map(params.modifier || function(element){
  6766. return element.get('id');
  6767. }, this);
  6768. }, this);
  6769. var index = params.index;
  6770. if (this.lists.length == 1) index = 0;
  6771. return (index || index === 0) && index >= 0 && index < this.lists.length ? serial[index] : serial;
  6772. }
  6773. });
  6774. })();
  6775. /*
  6776. ---
  6777. name: Element.Event.Pseudos
  6778. description: Adds the functionality to add pseudo events for Elements
  6779. license: MIT-style license
  6780. authors:
  6781. - Arian Stolwijk
  6782. requires: [Core/Element.Event, Core/Element.Delegation, Events.Pseudos]
  6783. provides: [Element.Event.Pseudos, Element.Delegation.Pseudo]
  6784. ...
  6785. */
  6786. (function(){
  6787. var pseudos = {relay: false},
  6788. copyFromEvents = ['once', 'throttle', 'pause'],
  6789. count = copyFromEvents.length;
  6790. while (count--) pseudos[copyFromEvents[count]] = Events.lookupPseudo(copyFromEvents[count]);
  6791. DOMEvent.definePseudo = function(key, listener){
  6792. pseudos[key] = listener;
  6793. return this;
  6794. };
  6795. var proto = Element.prototype;
  6796. [Element, Window, Document].invoke('implement', Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
  6797. })();
  6798. /*
  6799. ---
  6800. name: Element.Event.Pseudos.Keys
  6801. description: Adds functionality fire events if certain keycombinations are pressed
  6802. license: MIT-style license
  6803. authors:
  6804. - Arian Stolwijk
  6805. requires: [Element.Event.Pseudos]
  6806. provides: [Element.Event.Pseudos.Keys]
  6807. ...
  6808. */
  6809. (function(){
  6810. var keysStoreKey = '$moo:keys-pressed',
  6811. keysKeyupStoreKey = '$moo:keys-keyup';
  6812. DOMEvent.definePseudo('keys', function(split, fn, args){
  6813. var event = args[0],
  6814. keys = [],
  6815. pressed = this.retrieve(keysStoreKey, []),
  6816. value = split.value;
  6817. if (value != '+') keys.append(value.replace('++', function(){
  6818. keys.push('+'); // shift++ and shift+++a
  6819. return '';
  6820. }).split('+'));
  6821. else keys = ['+'];
  6822. pressed.include(event.key);
  6823. if (keys.every(function(key){
  6824. return pressed.contains(key);
  6825. })) fn.apply(this, args);
  6826. this.store(keysStoreKey, pressed);
  6827. if (!this.retrieve(keysKeyupStoreKey)){
  6828. var keyup = function(event){
  6829. (function(){
  6830. pressed = this.retrieve(keysStoreKey, []).erase(event.key);
  6831. this.store(keysStoreKey, pressed);
  6832. }).delay(0, this); // Fix for IE
  6833. };
  6834. this.store(keysKeyupStoreKey, keyup).addEvent('keyup', keyup);
  6835. }
  6836. });
  6837. DOMEvent.defineKeys({
  6838. '16': 'shift',
  6839. '17': 'control',
  6840. '18': 'alt',
  6841. '20': 'capslock',
  6842. '33': 'pageup',
  6843. '34': 'pagedown',
  6844. '35': 'end',
  6845. '36': 'home',
  6846. '144': 'numlock',
  6847. '145': 'scrolllock',
  6848. '186': ';',
  6849. '187': '=',
  6850. '188': ',',
  6851. '190': '.',
  6852. '191': '/',
  6853. '192': '`',
  6854. '219': '[',
  6855. '220': '\\',
  6856. '221': ']',
  6857. '222': "'",
  6858. '107': '+',
  6859. '109': '-', // subtract
  6860. '189': '-' // dash
  6861. });
  6862. })();
  6863. /*
  6864. ---
  6865. script: String.Extras.js
  6866. name: String.Extras
  6867. description: Extends the String native object to include methods useful in managing various kinds of strings (query strings, urls, html, etc).
  6868. license: MIT-style license
  6869. authors:
  6870. - Aaron Newton
  6871. - Guillermo Rauch
  6872. - Christopher Pitt
  6873. requires:
  6874. - Core/String
  6875. - Core/Array
  6876. - MooTools.More
  6877. provides: [String.Extras]
  6878. ...
  6879. */
  6880. (function(){
  6881. var special = {
  6882. 'a': /[àáâãäåăą]/g,
  6883. 'A': /[ÀÁÂÃÄÅĂĄ]/g,
  6884. 'c': /[ćčç]/g,
  6885. 'C': /[ĆČÇ]/g,
  6886. 'd': /[ďđ]/g,
  6887. 'D': /[ĎÐ]/g,
  6888. 'e': /[èéêëěę]/g,
  6889. 'E': /[ÈÉÊËĚĘ]/g,
  6890. 'g': /[ğ]/g,
  6891. 'G': /[Ğ]/g,
  6892. 'i': /[ìíîï]/g,
  6893. 'I': /[ÌÍÎÏ]/g,
  6894. 'l': /[ĺľł]/g,
  6895. 'L': /[ĹĽŁ]/g,
  6896. 'n': /[ñňń]/g,
  6897. 'N': /[ÑŇŃ]/g,
  6898. 'o': /[òóôõöøő]/g,
  6899. 'O': /[ÒÓÔÕÖØ]/g,
  6900. 'r': /[řŕ]/g,
  6901. 'R': /[ŘŔ]/g,
  6902. 's': /[ššş]/g,
  6903. 'S': /[ŠŞŚ]/g,
  6904. 't': /[ťţ]/g,
  6905. 'T': /[ŤŢ]/g,
  6906. 'u': /[ùúûůüµ]/g,
  6907. 'U': /[ÙÚÛŮÜ]/g,
  6908. 'y': /[ÿý]/g,
  6909. 'Y': /[ŸÝ]/g,
  6910. 'z': /[žźż]/g,
  6911. 'Z': /[ŽŹŻ]/g,
  6912. 'th': /[þ]/g,
  6913. 'TH': /[Þ]/g,
  6914. 'dh': /[ð]/g,
  6915. 'DH': /[Ð]/g,
  6916. 'ss': /[ß]/g,
  6917. 'oe': /[œ]/g,
  6918. 'OE': /[Œ]/g,
  6919. 'ae': /[æ]/g,
  6920. 'AE': /[Æ]/g
  6921. },
  6922. tidy = {
  6923. ' ': /[\xa0\u2002\u2003\u2009]/g,
  6924. '*': /[\xb7]/g,
  6925. '\'': /[\u2018\u2019]/g,
  6926. '"': /[\u201c\u201d]/g,
  6927. '...': /[\u2026]/g,
  6928. '-': /[\u2013]/g,
  6929. // '--': /[\u2014]/g,
  6930. '&raquo;': /[\uFFFD]/g
  6931. },
  6932. conversions = {
  6933. ms: 1,
  6934. s: 1000,
  6935. m: 6e4,
  6936. h: 36e5
  6937. },
  6938. findUnits = /(\d*.?\d+)([msh]+)/;
  6939. var walk = function(string, replacements){
  6940. var result = string, key;
  6941. for (key in replacements) result = result.replace(replacements[key], key);
  6942. return result;
  6943. };
  6944. var getRegexForTag = function(tag, contents){
  6945. tag = tag || (contents ? '' : '\\w+');
  6946. var regstr = contents ? '<' + tag + '(?!\\w)[^>]*>([\\s\\S]*?)<\/' + tag + '(?!\\w)>' : '<\/?' + tag + '\/?>|<' + tag + '[\\s|\/][^>]*>';
  6947. return new RegExp(regstr, 'gi');
  6948. };
  6949. String.implement({
  6950. standardize: function(){
  6951. return walk(this, special);
  6952. },
  6953. repeat: function(times){
  6954. return new Array(times + 1).join(this);
  6955. },
  6956. pad: function(length, str, direction){
  6957. if (this.length >= length) return this;
  6958. var pad = (str == null ? ' ' : '' + str)
  6959. .repeat(length - this.length)
  6960. .substr(0, length - this.length);
  6961. if (!direction || direction == 'right') return this + pad;
  6962. if (direction == 'left') return pad + this;
  6963. return pad.substr(0, (pad.length / 2).floor()) + this + pad.substr(0, (pad.length / 2).ceil());
  6964. },
  6965. getTags: function(tag, contents){
  6966. return this.match(getRegexForTag(tag, contents)) || [];
  6967. },
  6968. stripTags: function(tag, contents){
  6969. return this.replace(getRegexForTag(tag, contents), '');
  6970. },
  6971. tidy: function(){
  6972. return walk(this, tidy);
  6973. },
  6974. truncate: function(max, trail, atChar){
  6975. var string = this;
  6976. if (trail == null && arguments.length == 1) trail = '…';
  6977. if (string.length > max){
  6978. string = string.substring(0, max);
  6979. if (atChar){
  6980. var index = string.lastIndexOf(atChar);
  6981. if (index != -1) string = string.substr(0, index);
  6982. }
  6983. if (trail) string += trail;
  6984. }
  6985. return string;
  6986. },
  6987. ms: function(){
  6988. // "Borrowed" from https://gist.github.com/1503944
  6989. var units = findUnits.exec(this);
  6990. if (units == null) return Number(this);
  6991. return Number(units[1]) * conversions[units[2]];
  6992. }
  6993. });
  6994. })();
  6995. /*
  6996. ---
  6997. script: Element.Forms.js
  6998. name: Element.Forms
  6999. description: Extends the Element native object to include methods useful in managing inputs.
  7000. license: MIT-style license
  7001. authors:
  7002. - Aaron Newton
  7003. requires:
  7004. - Core/Element
  7005. - String.Extras
  7006. - MooTools.More
  7007. provides: [Element.Forms]
  7008. ...
  7009. */
  7010. Element.implement({
  7011. tidy: function(){
  7012. this.set('value', this.get('value').tidy());
  7013. },
  7014. getTextInRange: function(start, end){
  7015. return this.get('value').substring(start, end);
  7016. },
  7017. getSelectedText: function(){
  7018. if (this.setSelectionRange) return this.getTextInRange(this.getSelectionStart(), this.getSelectionEnd());
  7019. return document.selection.createRange().text;
  7020. },
  7021. getSelectedRange: function(){
  7022. if (this.selectionStart != null){
  7023. return {
  7024. start: this.selectionStart,
  7025. end: this.selectionEnd
  7026. };
  7027. }
  7028. var pos = {
  7029. start: 0,
  7030. end: 0
  7031. };
  7032. var range = this.getDocument().selection.createRange();
  7033. if (!range || range.parentElement() != this) return pos;
  7034. var duplicate = range.duplicate();
  7035. if (this.type == 'text'){
  7036. pos.start = 0 - duplicate.moveStart('character', -100000);
  7037. pos.end = pos.start + range.text.length;
  7038. } else {
  7039. var value = this.get('value');
  7040. var offset = value.length;
  7041. duplicate.moveToElementText(this);
  7042. duplicate.setEndPoint('StartToEnd', range);
  7043. if (duplicate.text.length) offset -= value.match(/[\n\r]*$/)[0].length;
  7044. pos.end = offset - duplicate.text.length;
  7045. duplicate.setEndPoint('StartToStart', range);
  7046. pos.start = offset - duplicate.text.length;
  7047. }
  7048. return pos;
  7049. },
  7050. getSelectionStart: function(){
  7051. return this.getSelectedRange().start;
  7052. },
  7053. getSelectionEnd: function(){
  7054. return this.getSelectedRange().end;
  7055. },
  7056. setCaretPosition: function(pos){
  7057. if (pos == 'end') pos = this.get('value').length;
  7058. this.selectRange(pos, pos);
  7059. return this;
  7060. },
  7061. getCaretPosition: function(){
  7062. return this.getSelectedRange().start;
  7063. },
  7064. selectRange: function(start, end){
  7065. if (this.setSelectionRange){
  7066. this.focus();
  7067. this.setSelectionRange(start, end);
  7068. } else {
  7069. var value = this.get('value');
  7070. var diff = value.substr(start, end - start).replace(/\r/g, '').length;
  7071. start = value.substr(0, start).replace(/\r/g, '').length;
  7072. var range = this.createTextRange();
  7073. range.collapse(true);
  7074. range.moveEnd('character', start + diff);
  7075. range.moveStart('character', start);
  7076. range.select();
  7077. }
  7078. return this;
  7079. },
  7080. insertAtCursor: function(value, select){
  7081. var pos = this.getSelectedRange();
  7082. var text = this.get('value');
  7083. this.set('value', text.substring(0, pos.start) + value + text.substring(pos.end, text.length));
  7084. if (select !== false) this.selectRange(pos.start, pos.start + value.length);
  7085. else this.setCaretPosition(pos.start + value.length);
  7086. return this;
  7087. },
  7088. insertAroundCursor: function(options, select){
  7089. options = Object.append({
  7090. before: '',
  7091. defaultMiddle: '',
  7092. after: ''
  7093. }, options);
  7094. var value = this.getSelectedText() || options.defaultMiddle;
  7095. var pos = this.getSelectedRange();
  7096. var text = this.get('value');
  7097. if (pos.start == pos.end){
  7098. this.set('value', text.substring(0, pos.start) + options.before + value + options.after + text.substring(pos.end, text.length));
  7099. this.selectRange(pos.start + options.before.length, pos.end + options.before.length + value.length);
  7100. } else {
  7101. var current = text.substring(pos.start, pos.end);
  7102. this.set('value', text.substring(0, pos.start) + options.before + current + options.after + text.substring(pos.end, text.length));
  7103. var selStart = pos.start + options.before.length;
  7104. if (select !== false) this.selectRange(selStart, selStart + current.length);
  7105. else this.setCaretPosition(selStart + text.length);
  7106. }
  7107. return this;
  7108. }
  7109. });
  7110. /*
  7111. ---
  7112. script: Element.Pin.js
  7113. name: Element.Pin
  7114. description: Extends the Element native object to include the pin method useful for fixed positioning for elements.
  7115. license: MIT-style license
  7116. authors:
  7117. - Aaron Newton
  7118. requires:
  7119. - Core/Element.Event
  7120. - Core/Element.Dimensions
  7121. - Core/Element.Style
  7122. - MooTools.More
  7123. provides: [Element.Pin]
  7124. ...
  7125. */
  7126. (function(){
  7127. var supportsPositionFixed = false,
  7128. supportTested = false;
  7129. var testPositionFixed = function(){
  7130. var test = new Element('div').setStyles({
  7131. position: 'fixed',
  7132. top: 0,
  7133. right: 0
  7134. }).inject(document.body);
  7135. supportsPositionFixed = (test.offsetTop === 0);
  7136. test.dispose();
  7137. supportTested = true;
  7138. };
  7139. Element.implement({
  7140. pin: function(enable, forceScroll){
  7141. if (!supportTested) testPositionFixed();
  7142. if (this.getStyle('display') == 'none') return this;
  7143. var pinnedPosition,
  7144. scroll = window.getScroll(),
  7145. parent,
  7146. scrollFixer;
  7147. if (enable !== false){
  7148. pinnedPosition = this.getPosition();
  7149. if (!this.retrieve('pin:_pinned')){
  7150. var currentPosition = {
  7151. top: pinnedPosition.y - scroll.y,
  7152. left: pinnedPosition.x - scroll.x,
  7153. margin: '0px',
  7154. padding: '0px'
  7155. };
  7156. if (supportsPositionFixed && !forceScroll){
  7157. this.setStyle('position', 'fixed').setStyles(currentPosition);
  7158. } else {
  7159. parent = this.getOffsetParent();
  7160. var position = this.getPosition(parent),
  7161. styles = this.getStyles('left', 'top');
  7162. if (parent && styles.left == 'auto' || styles.top == 'auto') this.setPosition(position);
  7163. if (this.getStyle('position') == 'static') this.setStyle('position', 'absolute');
  7164. position = {
  7165. x: styles.left.toInt() - scroll.x,
  7166. y: styles.top.toInt() - scroll.y
  7167. };
  7168. scrollFixer = function(){
  7169. if (!this.retrieve('pin:_pinned')) return;
  7170. var scroll = window.getScroll();
  7171. this.setStyles({
  7172. left: position.x + scroll.x,
  7173. top: position.y + scroll.y
  7174. });
  7175. }.bind(this);
  7176. this.store('pin:_scrollFixer', scrollFixer);
  7177. window.addEvent('scroll', scrollFixer);
  7178. }
  7179. this.store('pin:_pinned', true);
  7180. }
  7181. } else {
  7182. if (!this.retrieve('pin:_pinned')) return this;
  7183. parent = this.getParent();
  7184. var offsetParent = (parent.getComputedStyle('position') != 'static' ? parent : parent.getOffsetParent());
  7185. pinnedPosition = this.getPosition();
  7186. this.store('pin:_pinned', false);
  7187. scrollFixer = this.retrieve('pin:_scrollFixer');
  7188. if (!scrollFixer){
  7189. this.setStyles({
  7190. position: 'absolute',
  7191. top: pinnedPosition.y + scroll.y,
  7192. left: pinnedPosition.x + scroll.x
  7193. });
  7194. } else {
  7195. this.store('pin:_scrollFixer', null);
  7196. window.removeEvent('scroll', scrollFixer);
  7197. }
  7198. this.removeClass('isPinned');
  7199. }
  7200. return this;
  7201. },
  7202. unpin: function(){
  7203. return this.pin(false);
  7204. },
  7205. togglePin: function(){
  7206. return this.pin(!this.retrieve('pin:_pinned'));
  7207. }
  7208. });
  7209. //<1.2compat>
  7210. Element.alias('togglepin', 'togglePin');
  7211. //</1.2compat>
  7212. })();
  7213. /*
  7214. ---
  7215. script: Element.Position.js
  7216. name: Element.Position
  7217. description: Extends the Element native object to include methods useful positioning elements relative to others.
  7218. license: MIT-style license
  7219. authors:
  7220. - Aaron Newton
  7221. - Jacob Thornton
  7222. requires:
  7223. - Core/Options
  7224. - Core/Element.Dimensions
  7225. - Element.Measure
  7226. provides: [Element.Position]
  7227. ...
  7228. */
  7229. (function(original){
  7230. var local = Element.Position = {
  7231. options: {/*
  7232. edge: false,
  7233. returnPos: false,
  7234. minimum: {x: 0, y: 0},
  7235. maximum: {x: 0, y: 0},
  7236. relFixedPosition: false,
  7237. ignoreMargins: false,
  7238. ignoreScroll: false,
  7239. allowNegative: false,*/
  7240. relativeTo: document.body,
  7241. position: {
  7242. x: 'center', //left, center, right
  7243. y: 'center' //top, center, bottom
  7244. },
  7245. offset: {x: 0, y: 0}
  7246. },
  7247. getOptions: function(element, options){
  7248. options = Object.merge({}, local.options, options);
  7249. local.setPositionOption(options);
  7250. local.setEdgeOption(options);
  7251. local.setOffsetOption(element, options);
  7252. local.setDimensionsOption(element, options);
  7253. return options;
  7254. },
  7255. setPositionOption: function(options){
  7256. options.position = local.getCoordinateFromValue(options.position);
  7257. },
  7258. setEdgeOption: function(options){
  7259. var edgeOption = local.getCoordinateFromValue(options.edge);
  7260. options.edge = edgeOption ? edgeOption :
  7261. (options.position.x == 'center' && options.position.y == 'center') ? {x: 'center', y: 'center'} :
  7262. {x: 'left', y: 'top'};
  7263. },
  7264. setOffsetOption: function(element, options){
  7265. var parentOffset = {x: 0, y: 0};
  7266. var parentScroll = {x: 0, y: 0};
  7267. var offsetParent = element.measure(function(){
  7268. return document.id(this.getOffsetParent());
  7269. });
  7270. if (!offsetParent || offsetParent == element.getDocument().body) return;
  7271. parentScroll = offsetParent.getScroll();
  7272. parentOffset = offsetParent.measure(function(){
  7273. var position = this.getPosition();
  7274. if (this.getStyle('position') == 'fixed'){
  7275. var scroll = window.getScroll();
  7276. position.x += scroll.x;
  7277. position.y += scroll.y;
  7278. }
  7279. return position;
  7280. });
  7281. options.offset = {
  7282. parentPositioned: offsetParent != document.id(options.relativeTo),
  7283. x: options.offset.x - parentOffset.x + parentScroll.x,
  7284. y: options.offset.y - parentOffset.y + parentScroll.y
  7285. };
  7286. },
  7287. setDimensionsOption: function(element, options){
  7288. options.dimensions = element.getDimensions({
  7289. computeSize: true,
  7290. styles: ['padding', 'border', 'margin']
  7291. });
  7292. },
  7293. getPosition: function(element, options){
  7294. var position = {};
  7295. options = local.getOptions(element, options);
  7296. var relativeTo = document.id(options.relativeTo) || document.body;
  7297. local.setPositionCoordinates(options, position, relativeTo);
  7298. if (options.edge) local.toEdge(position, options);
  7299. var offset = options.offset;
  7300. position.left = ((position.x >= 0 || offset.parentPositioned || options.allowNegative) ? position.x : 0).toInt();
  7301. position.top = ((position.y >= 0 || offset.parentPositioned || options.allowNegative) ? position.y : 0).toInt();
  7302. local.toMinMax(position, options);
  7303. if (options.relFixedPosition || relativeTo.getStyle('position') == 'fixed') local.toRelFixedPosition(relativeTo, position);
  7304. if (options.ignoreScroll) local.toIgnoreScroll(relativeTo, position);
  7305. if (options.ignoreMargins) local.toIgnoreMargins(position, options);
  7306. position.left = Math.ceil(position.left);
  7307. position.top = Math.ceil(position.top);
  7308. delete position.x;
  7309. delete position.y;
  7310. return position;
  7311. },
  7312. setPositionCoordinates: function(options, position, relativeTo){
  7313. var offsetY = options.offset.y,
  7314. offsetX = options.offset.x,
  7315. calc = (relativeTo == document.body) ? window.getScroll() : relativeTo.getPosition(),
  7316. top = calc.y,
  7317. left = calc.x,
  7318. winSize = window.getSize();
  7319. switch (options.position.x){
  7320. case 'left': position.x = left + offsetX; break;
  7321. case 'right': position.x = left + offsetX + relativeTo.offsetWidth; break;
  7322. default: position.x = left + ((relativeTo == document.body ? winSize.x : relativeTo.offsetWidth) / 2) + offsetX; break;
  7323. }
  7324. switch (options.position.y){
  7325. case 'top': position.y = top + offsetY; break;
  7326. case 'bottom': position.y = top + offsetY + relativeTo.offsetHeight; break;
  7327. default: position.y = top + ((relativeTo == document.body ? winSize.y : relativeTo.offsetHeight) / 2) + offsetY; break;
  7328. }
  7329. },
  7330. toMinMax: function(position, options){
  7331. var xy = {left: 'x', top: 'y'}, value;
  7332. ['minimum', 'maximum'].each(function(minmax){
  7333. ['left', 'top'].each(function(lr){
  7334. value = options[minmax] ? options[minmax][xy[lr]] : null;
  7335. if (value != null && ((minmax == 'minimum') ? position[lr] < value : position[lr] > value)) position[lr] = value;
  7336. });
  7337. });
  7338. },
  7339. toRelFixedPosition: function(relativeTo, position){
  7340. var winScroll = window.getScroll();
  7341. position.top += winScroll.y;
  7342. position.left += winScroll.x;
  7343. },
  7344. toIgnoreScroll: function(relativeTo, position){
  7345. var relScroll = relativeTo.getScroll();
  7346. position.top -= relScroll.y;
  7347. position.left -= relScroll.x;
  7348. },
  7349. toIgnoreMargins: function(position, options){
  7350. position.left += options.edge.x == 'right'
  7351. ? options.dimensions['margin-right']
  7352. : (options.edge.x != 'center'
  7353. ? -options.dimensions['margin-left']
  7354. : -options.dimensions['margin-left'] + ((options.dimensions['margin-right'] + options.dimensions['margin-left']) / 2));
  7355. position.top += options.edge.y == 'bottom'
  7356. ? options.dimensions['margin-bottom']
  7357. : (options.edge.y != 'center'
  7358. ? -options.dimensions['margin-top']
  7359. : -options.dimensions['margin-top'] + ((options.dimensions['margin-bottom'] + options.dimensions['margin-top']) / 2));
  7360. },
  7361. toEdge: function(position, options){
  7362. var edgeOffset = {},
  7363. dimensions = options.dimensions,
  7364. edge = options.edge;
  7365. switch (edge.x){
  7366. case 'left': edgeOffset.x = 0; break;
  7367. case 'right': edgeOffset.x = -dimensions.x - dimensions.computedRight - dimensions.computedLeft; break;
  7368. // center
  7369. default: edgeOffset.x = -(Math.round(dimensions.totalWidth / 2)); break;
  7370. }
  7371. switch (edge.y){
  7372. case 'top': edgeOffset.y = 0; break;
  7373. case 'bottom': edgeOffset.y = -dimensions.y - dimensions.computedTop - dimensions.computedBottom; break;
  7374. // center
  7375. default: edgeOffset.y = -(Math.round(dimensions.totalHeight / 2)); break;
  7376. }
  7377. position.x += edgeOffset.x;
  7378. position.y += edgeOffset.y;
  7379. },
  7380. getCoordinateFromValue: function(option){
  7381. if (typeOf(option) != 'string') return option;
  7382. option = option.toLowerCase();
  7383. return {
  7384. x: option.test('left') ? 'left'
  7385. : (option.test('right') ? 'right' : 'center'),
  7386. y: option.test(/upper|top/) ? 'top'
  7387. : (option.test('bottom') ? 'bottom' : 'center')
  7388. };
  7389. }
  7390. };
  7391. Element.implement({
  7392. position: function(options){
  7393. if (options && (options.x != null || options.y != null)){
  7394. return (original ? original.apply(this, arguments) : this);
  7395. }
  7396. var position = this.setStyle('position', 'absolute').calculatePosition(options);
  7397. return (options && options.returnPos) ? position : this.setStyles(position);
  7398. },
  7399. calculatePosition: function(options){
  7400. return local.getPosition(this, options);
  7401. }
  7402. });
  7403. })(Element.prototype.position);
  7404. /*
  7405. ---
  7406. script: Element.Shortcuts.js
  7407. name: Element.Shortcuts
  7408. description: Extends the Element native object to include some shortcut methods.
  7409. license: MIT-style license
  7410. authors:
  7411. - Aaron Newton
  7412. requires:
  7413. - Core/Element.Style
  7414. - MooTools.More
  7415. provides: [Element.Shortcuts]
  7416. ...
  7417. */
  7418. Element.implement({
  7419. isDisplayed: function(){
  7420. return this.getStyle('display') != 'none';
  7421. },
  7422. isVisible: function(){
  7423. var w = this.offsetWidth,
  7424. h = this.offsetHeight;
  7425. return (w == 0 && h == 0) ? false : (w > 0 && h > 0) ? true : this.style.display != 'none';
  7426. },
  7427. toggle: function(){
  7428. return this[this.isDisplayed() ? 'hide' : 'show']();
  7429. },
  7430. hide: function(){
  7431. var d;
  7432. try {
  7433. //IE fails here if the element is not in the dom
  7434. d = this.getStyle('display');
  7435. } catch (e){}
  7436. if (d == 'none') return this;
  7437. return this.store('element:_originalDisplay', d || '').setStyle('display', 'none');
  7438. },
  7439. show: function(display){
  7440. if (!display && this.isDisplayed()) return this;
  7441. display = display || this.retrieve('element:_originalDisplay') || 'block';
  7442. return this.setStyle('display', (display == 'none') ? 'block' : display);
  7443. },
  7444. swapClass: function(remove, add){
  7445. return this.removeClass(remove).addClass(add);
  7446. }
  7447. });
  7448. Document.implement({
  7449. clearSelection: function(){
  7450. if (window.getSelection){
  7451. var selection = window.getSelection();
  7452. if (selection && selection.removeAllRanges) selection.removeAllRanges();
  7453. } else if (document.selection && document.selection.empty){
  7454. try {
  7455. //IE fails here if selected element is not in dom
  7456. document.selection.empty();
  7457. } catch (e){}
  7458. }
  7459. }
  7460. });
  7461. /*
  7462. ---
  7463. script: Elements.From.js
  7464. name: Elements.From
  7465. description: Returns a collection of elements from a string of html.
  7466. license: MIT-style license
  7467. authors:
  7468. - Aaron Newton
  7469. requires:
  7470. - Core/String
  7471. - Core/Element
  7472. - MooTools.More
  7473. provides: [Elements.from, Elements.From]
  7474. ...
  7475. */
  7476. Elements.from = function(text, excludeScripts){
  7477. if (excludeScripts || excludeScripts == null) text = text.stripScripts();
  7478. var container, match = text.match(/^\s*(?:<!--.*?-->\s*)*<(t[dhr]|tbody|tfoot|thead)/i);
  7479. if (match){
  7480. container = new Element('table');
  7481. var tag = match[1].toLowerCase();
  7482. if (['td', 'th', 'tr'].contains(tag)){
  7483. container = new Element('tbody').inject(container);
  7484. if (tag != 'tr') container = new Element('tr').inject(container);
  7485. }
  7486. }
  7487. return (container || new Element('div')).set('html', text).getChildren();
  7488. };
  7489. /*
  7490. ---
  7491. script: IframeShim.js
  7492. name: IframeShim
  7493. description: Defines IframeShim, a class for obscuring select lists and flash objects in IE.
  7494. license: MIT-style license
  7495. authors:
  7496. - Aaron Newton
  7497. requires:
  7498. - Core/Element.Event
  7499. - Core/Element.Style
  7500. - Core/Options
  7501. - Core/Events
  7502. - Element.Position
  7503. - Class.Occlude
  7504. provides: [IframeShim]
  7505. ...
  7506. */
  7507. (function(){
  7508. var browsers = false;
  7509. //<1.4compat>
  7510. browsers = Browser.ie6 || (Browser.firefox && Browser.version < 3 && Browser.Platform.mac);
  7511. //</1.4compat>
  7512. var IframeShim = this.IframeShim = new Class({
  7513. Implements: [Options, Events, Class.Occlude],
  7514. options: {
  7515. className: 'iframeShim',
  7516. src: 'javascript:false;document.write("");',
  7517. display: false,
  7518. zIndex: null,
  7519. margin: 0,
  7520. offset: {x: 0, y: 0},
  7521. browsers: browsers
  7522. },
  7523. property: 'IframeShim',
  7524. initialize: function(element, options){
  7525. this.element = document.id(element);
  7526. if (this.occlude()) return this.occluded;
  7527. this.setOptions(options);
  7528. this.makeShim();
  7529. return this;
  7530. },
  7531. makeShim: function(){
  7532. if (this.options.browsers){
  7533. var zIndex = this.element.getStyle('zIndex').toInt();
  7534. if (!zIndex){
  7535. zIndex = 1;
  7536. var pos = this.element.getStyle('position');
  7537. if (pos == 'static' || !pos) this.element.setStyle('position', 'relative');
  7538. this.element.setStyle('zIndex', zIndex);
  7539. }
  7540. zIndex = ((this.options.zIndex != null || this.options.zIndex === 0) && zIndex > this.options.zIndex) ? this.options.zIndex : zIndex - 1;
  7541. if (zIndex < 0) zIndex = 1;
  7542. this.shim = new Element('iframe', {
  7543. src: this.options.src,
  7544. scrolling: 'no',
  7545. frameborder: 0,
  7546. styles: {
  7547. zIndex: zIndex,
  7548. position: 'absolute',
  7549. border: 'none',
  7550. filter: 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'
  7551. },
  7552. 'class': this.options.className
  7553. }).store('IframeShim', this);
  7554. var inject = (function(){
  7555. this.shim.inject(this.element, 'after');
  7556. this[this.options.display ? 'show' : 'hide']();
  7557. this.fireEvent('inject');
  7558. }).bind(this);
  7559. if (!IframeShim.ready) window.addEvent('load', inject);
  7560. else inject();
  7561. } else {
  7562. this.position = this.hide = this.show = this.dispose = Function.convert(this);
  7563. }
  7564. },
  7565. position: function(){
  7566. if (!IframeShim.ready || !this.shim) return this;
  7567. var size = this.element.measure(function(){
  7568. return this.getSize();
  7569. });
  7570. if (this.options.margin != undefined){
  7571. size.x = size.x - (this.options.margin * 2);
  7572. size.y = size.y - (this.options.margin * 2);
  7573. this.options.offset.x += this.options.margin;
  7574. this.options.offset.y += this.options.margin;
  7575. }
  7576. this.shim.set({width: size.x, height: size.y}).position({
  7577. relativeTo: this.element,
  7578. offset: this.options.offset
  7579. });
  7580. return this;
  7581. },
  7582. hide: function(){
  7583. if (this.shim) this.shim.setStyle('display', 'none');
  7584. return this;
  7585. },
  7586. show: function(){
  7587. if (this.shim) this.shim.setStyle('display', 'block');
  7588. return this.position();
  7589. },
  7590. dispose: function(){
  7591. if (this.shim) this.shim.dispose();
  7592. return this;
  7593. },
  7594. destroy: function(){
  7595. if (this.shim) this.shim.destroy();
  7596. return this;
  7597. }
  7598. });
  7599. })();
  7600. window.addEvent('load', function(){
  7601. IframeShim.ready = true;
  7602. });
  7603. /*
  7604. ---
  7605. script: Mask.js
  7606. name: Mask
  7607. description: Creates a mask element to cover another.
  7608. license: MIT-style license
  7609. authors:
  7610. - Aaron Newton
  7611. requires:
  7612. - Core/Options
  7613. - Core/Events
  7614. - Core/Element.Event
  7615. - Class.Binds
  7616. - Element.Position
  7617. - IframeShim
  7618. provides: [Mask]
  7619. ...
  7620. */
  7621. (function(){
  7622. var Mask = this.Mask = new Class({
  7623. Implements: [Options, Events],
  7624. Binds: ['position'],
  7625. options: {/*
  7626. onShow: function(){},
  7627. onHide: function(){},
  7628. onDestroy: function(){},
  7629. onClick: function(event){},
  7630. inject: {
  7631. where: 'after',
  7632. target: null,
  7633. },
  7634. hideOnClick: false,
  7635. id: null,
  7636. destroyOnHide: false,*/
  7637. style: {},
  7638. 'class': 'mask',
  7639. maskMargins: false,
  7640. useIframeShim: true,
  7641. iframeShimOptions: {}
  7642. },
  7643. initialize: function(target, options){
  7644. this.target = document.id(target) || document.id(document.body);
  7645. this.target.store('mask', this);
  7646. this.setOptions(options);
  7647. this.render();
  7648. this.inject();
  7649. },
  7650. render: function(){
  7651. this.element = new Element('div', {
  7652. 'class': this.options['class'],
  7653. id: this.options.id || 'mask-' + String.uniqueID(),
  7654. styles: Object.merge({}, this.options.style, {
  7655. display: 'none'
  7656. }),
  7657. events: {
  7658. click: function(event){
  7659. this.fireEvent('click', event);
  7660. if (this.options.hideOnClick) this.hide();
  7661. }.bind(this)
  7662. }
  7663. });
  7664. this.hidden = true;
  7665. },
  7666. toElement: function(){
  7667. return this.element;
  7668. },
  7669. inject: function(target, where){
  7670. where = where || (this.options.inject ? this.options.inject.where : '') || (this.target == document.body ? 'inside' : 'after');
  7671. target = target || (this.options.inject && this.options.inject.target) || this.target;
  7672. this.element.inject(target, where);
  7673. if (this.options.useIframeShim){
  7674. this.shim = new IframeShim(this.element, this.options.iframeShimOptions);
  7675. this.addEvents({
  7676. show: this.shim.show.bind(this.shim),
  7677. hide: this.shim.hide.bind(this.shim),
  7678. destroy: this.shim.destroy.bind(this.shim)
  7679. });
  7680. }
  7681. },
  7682. position: function(){
  7683. this.resize(this.options.width, this.options.height);
  7684. this.element.position({
  7685. relativeTo: this.target,
  7686. position: 'topLeft',
  7687. ignoreMargins: !this.options.maskMargins,
  7688. ignoreScroll: this.target == document.body
  7689. });
  7690. return this;
  7691. },
  7692. resize: function(x, y){
  7693. var opt = {
  7694. styles: ['padding', 'border']
  7695. };
  7696. if (this.options.maskMargins) opt.styles.push('margin');
  7697. var dim = this.target.getComputedSize(opt);
  7698. var s = this.target.getSize();
  7699. if (dim.totalHeight<s.y) dim.totalHeight = s.y;
  7700. if (this.target == document.body){
  7701. this.element.setStyles({width: 0, height: 0});
  7702. var win = window.getScrollSize();
  7703. if (dim.totalHeight < win.y) dim.totalHeight = win.y;
  7704. if (dim.totalWidth < win.x) dim.totalWidth = win.x;
  7705. }
  7706. this.element.setStyles({
  7707. width: Array.pick([x, dim.totalWidth, dim.x]),
  7708. height: Array.pick([y, dim.totalHeight, dim.y])
  7709. });
  7710. return this;
  7711. },
  7712. show: function(){
  7713. if (!this.hidden) return this;
  7714. window.addEvent('resize', this.position);
  7715. this.position();
  7716. this.showMask.apply(this, arguments);
  7717. return this;
  7718. },
  7719. showMask: function(){
  7720. this.element.setStyle('display', 'block');
  7721. this.hidden = false;
  7722. this.fireEvent('show');
  7723. },
  7724. hide: function(){
  7725. if (this.hidden) return this;
  7726. window.removeEvent('resize', this.position);
  7727. this.hideMask.apply(this, arguments);
  7728. if (this.options.destroyOnHide) return this.destroy();
  7729. return this;
  7730. },
  7731. hideMask: function(){
  7732. this.element.setStyle('display', 'none');
  7733. this.hidden = true;
  7734. this.fireEvent('hide');
  7735. },
  7736. toggle: function(){
  7737. this[this.hidden ? 'show' : 'hide']();
  7738. },
  7739. destroy: function(){
  7740. this.hide();
  7741. this.element.destroy();
  7742. this.fireEvent('destroy');
  7743. this.target.eliminate('mask');
  7744. }
  7745. });
  7746. })();
  7747. Element.Properties.mask = {
  7748. set: function(options){
  7749. var mask = this.retrieve('mask');
  7750. if (mask) mask.destroy();
  7751. return this.eliminate('mask').store('mask:options', options);
  7752. },
  7753. get: function(){
  7754. var mask = this.retrieve('mask');
  7755. if (!mask){
  7756. mask = new Mask(this, this.retrieve('mask:options'));
  7757. this.store('mask', mask);
  7758. }
  7759. return mask;
  7760. }
  7761. };
  7762. Element.implement({
  7763. mask: function(options){
  7764. if (options) this.set('mask', options);
  7765. this.get('mask').show();
  7766. return this;
  7767. },
  7768. unmask: function(){
  7769. this.get('mask').hide();
  7770. return this;
  7771. }
  7772. });
  7773. /*
  7774. ---
  7775. script: Spinner.js
  7776. name: Spinner
  7777. description: Adds a semi-transparent overlay over a dom element with a spinnin ajax icon.
  7778. license: MIT-style license
  7779. authors:
  7780. - Aaron Newton
  7781. requires:
  7782. - Core/Fx.Tween
  7783. - Core/Request
  7784. - Class.refactor
  7785. - Mask
  7786. provides: [Spinner]
  7787. ...
  7788. */
  7789. (function(){
  7790. var Spinner = this.Spinner = new Class({
  7791. Extends: this.Mask,
  7792. Implements: Chain,
  7793. options: {/*
  7794. message: false,*/
  7795. 'class': 'spinner',
  7796. containerPosition: {},
  7797. content: {
  7798. 'class': 'spinner-content'
  7799. },
  7800. messageContainer: {
  7801. 'class': 'spinner-msg'
  7802. },
  7803. img: {
  7804. 'class': 'spinner-img'
  7805. },
  7806. fxOptions: {
  7807. link: 'chain'
  7808. }
  7809. },
  7810. initialize: function(target, options){
  7811. this.target = document.id(target) || document.id(document.body);
  7812. this.target.store('spinner', this);
  7813. this.setOptions(options);
  7814. this.render();
  7815. this.inject();
  7816. // Add this to events for when noFx is true; parent methods handle hide/show.
  7817. var deactivate = function(){ this.active = false; }.bind(this);
  7818. this.addEvents({
  7819. hide: deactivate,
  7820. show: deactivate
  7821. });
  7822. },
  7823. render: function(){
  7824. this.parent();
  7825. this.element.set('id', this.options.id || 'spinner-' + String.uniqueID());
  7826. this.content = document.id(this.options.content) || new Element('div', this.options.content);
  7827. this.content.inject(this.element);
  7828. if (this.options.message){
  7829. this.msg = document.id(this.options.message) || new Element('p', this.options.messageContainer).appendText(this.options.message);
  7830. this.msg.inject(this.content);
  7831. }
  7832. if (this.options.img){
  7833. this.img = document.id(this.options.img) || new Element('div', this.options.img);
  7834. this.img.inject(this.content);
  7835. }
  7836. this.element.set('tween', this.options.fxOptions);
  7837. },
  7838. show: function(noFx){
  7839. if (this.active) return this.chain(this.show.bind(this));
  7840. if (!this.hidden){
  7841. this.callChain.delay(20, this);
  7842. return this;
  7843. }
  7844. this.target.set('aria-busy', 'true');
  7845. this.active = true;
  7846. return this.parent(noFx);
  7847. },
  7848. showMask: function(noFx){
  7849. var pos = function(){
  7850. this.content.position(Object.merge({
  7851. relativeTo: this.element
  7852. }, this.options.containerPosition));
  7853. }.bind(this);
  7854. if (noFx){
  7855. this.parent();
  7856. pos();
  7857. } else {
  7858. if (!this.options.style.opacity) this.options.style.opacity = this.element.getStyle('opacity').toFloat();
  7859. this.element.setStyles({
  7860. display: 'block',
  7861. opacity: 0
  7862. }).tween('opacity', this.options.style.opacity);
  7863. pos();
  7864. this.hidden = false;
  7865. this.fireEvent('show');
  7866. this.callChain();
  7867. }
  7868. },
  7869. hide: function(noFx){
  7870. if (this.active) return this.chain(this.hide.bind(this));
  7871. if (this.hidden){
  7872. this.callChain.delay(20, this);
  7873. return this;
  7874. }
  7875. this.target.set('aria-busy', 'false');
  7876. this.active = true;
  7877. return this.parent(noFx);
  7878. },
  7879. hideMask: function(noFx){
  7880. if (noFx) return this.parent();
  7881. this.element.tween('opacity', 0).get('tween').chain(function(){
  7882. this.element.setStyle('display', 'none');
  7883. this.hidden = true;
  7884. this.fireEvent('hide');
  7885. this.callChain();
  7886. }.bind(this));
  7887. },
  7888. destroy: function(){
  7889. this.content.destroy();
  7890. this.parent();
  7891. this.target.eliminate('spinner');
  7892. }
  7893. });
  7894. })();
  7895. Request = Class.refactor(Request, {
  7896. options: {
  7897. useSpinner: false,
  7898. spinnerOptions: {},
  7899. spinnerTarget: false
  7900. },
  7901. initialize: function(options){
  7902. this._send = this.send;
  7903. this.send = function(options){
  7904. var spinner = this.getSpinner();
  7905. if (spinner) spinner.chain(this._send.pass(options, this)).show();
  7906. else this._send(options);
  7907. return this;
  7908. };
  7909. this.previous(options);
  7910. },
  7911. getSpinner: function(){
  7912. if (!this.spinner){
  7913. var update = document.id(this.options.spinnerTarget) || document.id(this.options.update);
  7914. if (this.options.useSpinner && update){
  7915. update.set('spinner', this.options.spinnerOptions);
  7916. var spinner = this.spinner = update.get('spinner');
  7917. ['complete', 'exception', 'cancel'].each(function(event){
  7918. this.addEvent(event, spinner.hide.bind(spinner));
  7919. }, this);
  7920. }
  7921. }
  7922. return this.spinner;
  7923. }
  7924. });
  7925. Element.Properties.spinner = {
  7926. set: function(options){
  7927. var spinner = this.retrieve('spinner');
  7928. if (spinner) spinner.destroy();
  7929. return this.eliminate('spinner').store('spinner:options', options);
  7930. },
  7931. get: function(){
  7932. var spinner = this.retrieve('spinner');
  7933. if (!spinner){
  7934. spinner = new Spinner(this, this.retrieve('spinner:options'));
  7935. this.store('spinner', spinner);
  7936. }
  7937. return spinner;
  7938. }
  7939. };
  7940. Element.implement({
  7941. spin: function(options){
  7942. if (options) this.set('spinner', options);
  7943. this.get('spinner').show();
  7944. return this;
  7945. },
  7946. unspin: function(){
  7947. this.get('spinner').hide();
  7948. return this;
  7949. }
  7950. });
  7951. /*
  7952. ---
  7953. script: String.QueryString.js
  7954. name: String.QueryString
  7955. description: Methods for dealing with URI query strings.
  7956. license: MIT-style license
  7957. authors:
  7958. - Sebastian Markbåge
  7959. - Aaron Newton
  7960. - Lennart Pilon
  7961. - Valerio Proietti
  7962. requires:
  7963. - Core/Array
  7964. - Core/String
  7965. - MooTools.More
  7966. provides: [String.QueryString]
  7967. ...
  7968. */
  7969. (function(){
  7970. /**
  7971. * decodeURIComponent doesn't do the correct thing with query parameter keys or
  7972. * values. Specifically, it leaves '+' as '+' when it should be converting them
  7973. * to spaces as that's the specification. When browsers submit HTML forms via
  7974. * GET, the values are encoded using 'application/x-www-form-urlencoded'
  7975. * which converts spaces to '+'.
  7976. *
  7977. * See: http://unixpapa.com/js/querystring.html for a description of the
  7978. * problem.
  7979. */
  7980. var decodeComponent = function(str){
  7981. return decodeURIComponent(str.replace(/\+/g, ' '));
  7982. };
  7983. String.implement({
  7984. parseQueryString: function(decodeKeys, decodeValues){
  7985. if (decodeKeys == null) decodeKeys = true;
  7986. if (decodeValues == null) decodeValues = true;
  7987. var vars = this.split(/[&;]/),
  7988. object = {};
  7989. if (!vars.length) return object;
  7990. vars.each(function(val){
  7991. var index = val.indexOf('=') + 1,
  7992. value = index ? val.substr(index) : '',
  7993. keys = index ? val.substr(0, index - 1).match(/([^\]\[]+|(\B)(?=\]))/g) : [val],
  7994. obj = object;
  7995. if (!keys) return;
  7996. if (decodeValues) value = decodeComponent(value);
  7997. keys.each(function(key, i){
  7998. if (decodeKeys) key = decodeComponent(key);
  7999. var current = obj[key];
  8000. if (i < keys.length - 1) obj = obj[key] = current || {};
  8001. else if (typeOf(current) == 'array') current.push(value);
  8002. else obj[key] = current != null ? [current, value] : value;
  8003. });
  8004. });
  8005. return object;
  8006. },
  8007. cleanQueryString: function(method){
  8008. return this.split('&').filter(function(val){
  8009. var index = val.indexOf('='),
  8010. key = index < 0 ? '' : val.substr(0, index),
  8011. value = val.substr(index + 1);
  8012. return method ? method.call(null, key, value) : (value || value === 0);
  8013. }).join('&');
  8014. }
  8015. });
  8016. })();
  8017. /*
  8018. ---
  8019. script: Form.Request.js
  8020. name: Form.Request
  8021. description: Handles the basic functionality of submitting a form and updating a dom element with the result.
  8022. license: MIT-style license
  8023. authors:
  8024. - Aaron Newton
  8025. requires:
  8026. - Core/Request.HTML
  8027. - Class.Binds
  8028. - Class.Occlude
  8029. - Spinner
  8030. - String.QueryString
  8031. - Element.Delegation.Pseudo
  8032. provides: [Form.Request]
  8033. ...
  8034. */
  8035. if (!window.Form) window.Form = {};
  8036. (function(){
  8037. Form.Request = new Class({
  8038. Binds: ['onSubmit', 'onFormValidate'],
  8039. Implements: [Options, Events, Class.Occlude],
  8040. options: {/*
  8041. onFailure: function(){},
  8042. onSuccess: function(){}, // aliased to onComplete,
  8043. onSend: function(){}*/
  8044. requestOptions: {
  8045. evalScripts: true,
  8046. useSpinner: true,
  8047. emulation: false,
  8048. link: 'ignore'
  8049. },
  8050. sendButtonClicked: true,
  8051. extraData: {},
  8052. resetForm: true
  8053. },
  8054. property: 'form.request',
  8055. initialize: function(form, target, options){
  8056. this.element = document.id(form);
  8057. if (this.occlude()) return this.occluded;
  8058. this.setOptions(options)
  8059. .setTarget(target)
  8060. .attach();
  8061. },
  8062. setTarget: function(target){
  8063. this.target = document.id(target);
  8064. if (!this.request){
  8065. this.makeRequest();
  8066. } else {
  8067. this.request.setOptions({
  8068. update: this.target
  8069. });
  8070. }
  8071. return this;
  8072. },
  8073. toElement: function(){
  8074. return this.element;
  8075. },
  8076. makeRequest: function(){
  8077. var self = this;
  8078. this.request = new Request.HTML(Object.merge({
  8079. update: this.target,
  8080. emulation: false,
  8081. spinnerTarget: this.element,
  8082. method: this.element.get('method') || 'post'
  8083. }, this.options.requestOptions)).addEvents({
  8084. success: function(tree, elements, html, javascript){
  8085. ['complete', 'success'].each(function(evt){
  8086. self.fireEvent(evt, [self.target, tree, elements, html, javascript]);
  8087. });
  8088. },
  8089. failure: function(){
  8090. self.fireEvent('complete', arguments).fireEvent('failure', arguments);
  8091. },
  8092. exception: function(){
  8093. self.fireEvent('failure', arguments);
  8094. }
  8095. });
  8096. return this.attachReset();
  8097. },
  8098. attachReset: function(){
  8099. if (!this.options.resetForm) return this;
  8100. this.request.addEvent('success', function(){
  8101. Function.attempt(function(){
  8102. this.element.reset();
  8103. }.bind(this));
  8104. if (window.OverText) OverText.update();
  8105. }.bind(this));
  8106. return this;
  8107. },
  8108. attach: function(attach){
  8109. var method = (attach != false) ? 'addEvent' : 'removeEvent';
  8110. this.element[method]('click:relay(button, input[type=submit])', this.saveClickedButton.bind(this));
  8111. var fv = this.element.retrieve('validator');
  8112. if (fv) fv[method]('onFormValidate', this.onFormValidate);
  8113. else this.element[method]('submit', this.onSubmit);
  8114. return this;
  8115. },
  8116. detach: function(){
  8117. return this.attach(false);
  8118. },
  8119. //public method
  8120. enable: function(){
  8121. return this.attach();
  8122. },
  8123. //public method
  8124. disable: function(){
  8125. return this.detach();
  8126. },
  8127. onFormValidate: function(valid, form, event){
  8128. //if there's no event, then this wasn't a submit event
  8129. if (!event) return;
  8130. var fv = this.element.retrieve('validator');
  8131. if (valid || (fv && !fv.options.stopOnFailure)){
  8132. event.stop();
  8133. this.send();
  8134. }
  8135. },
  8136. onSubmit: function(event){
  8137. var fv = this.element.retrieve('validator');
  8138. if (fv){
  8139. //form validator was created after Form.Request
  8140. this.element.removeEvent('submit', this.onSubmit);
  8141. fv.addEvent('onFormValidate', this.onFormValidate);
  8142. fv.validate(event);
  8143. return;
  8144. }
  8145. if (event) event.stop();
  8146. this.send();
  8147. },
  8148. saveClickedButton: function(event, target){
  8149. var targetName = target.get('name');
  8150. if (!targetName || !this.options.sendButtonClicked) return;
  8151. this.options.extraData[targetName] = target.get('value') || true;
  8152. this.clickedCleaner = function(){
  8153. delete this.options.extraData[targetName];
  8154. this.clickedCleaner = function(){};
  8155. }.bind(this);
  8156. },
  8157. clickedCleaner: function(){},
  8158. send: function(){
  8159. var str = this.element.toQueryString().trim(),
  8160. data = Object.toQueryString(this.options.extraData);
  8161. if (str) str += '&' + data;
  8162. else str = data;
  8163. this.fireEvent('send', [this.element, str.parseQueryString()]);
  8164. this.request.send({
  8165. data: str,
  8166. url: this.options.requestOptions.url || this.element.get('action')
  8167. });
  8168. this.clickedCleaner();
  8169. return this;
  8170. }
  8171. });
  8172. Element.implement('formUpdate', function(update, options){
  8173. var fq = this.retrieve('form.request');
  8174. if (!fq){
  8175. fq = new Form.Request(this, update, options);
  8176. } else {
  8177. if (update) fq.setTarget(update);
  8178. if (options) fq.setOptions(options).makeRequest();
  8179. }
  8180. fq.send();
  8181. return this;
  8182. });
  8183. })();
  8184. /*
  8185. ---
  8186. script: Fx.Reveal.js
  8187. name: Fx.Reveal
  8188. description: Defines Fx.Reveal, a class that shows and hides elements with a transition.
  8189. license: MIT-style license
  8190. authors:
  8191. - Aaron Newton
  8192. requires:
  8193. - Core/Fx.Morph
  8194. - Element.Shortcuts
  8195. - Element.Measure
  8196. provides: [Fx.Reveal]
  8197. ...
  8198. */
  8199. (function(){
  8200. var hideTheseOf = function(object){
  8201. var hideThese = object.options.hideInputs;
  8202. if (window.OverText){
  8203. var otClasses = [null];
  8204. OverText.each(function(ot){
  8205. otClasses.include('.' + ot.options.labelClass);
  8206. });
  8207. if (otClasses) hideThese += otClasses.join(', ');
  8208. }
  8209. return (hideThese) ? object.element.getElements(hideThese) : null;
  8210. };
  8211. Fx.Reveal = new Class({
  8212. Extends: Fx.Morph,
  8213. options: {/*
  8214. onShow: function(thisElement){},
  8215. onHide: function(thisElement){},
  8216. onComplete: function(thisElement){},
  8217. heightOverride: null,
  8218. widthOverride: null,*/
  8219. link: 'cancel',
  8220. styles: ['padding', 'border', 'margin'],
  8221. transitionOpacity: 'opacity' in document.documentElement,
  8222. mode: 'vertical',
  8223. display: function(){
  8224. return this.element.get('tag') != 'tr' ? 'block' : 'table-row';
  8225. },
  8226. opacity: 1,
  8227. hideInputs: !('opacity' in document.documentElement) ? 'select, input, textarea, object, embed' : null
  8228. },
  8229. dissolve: function(){
  8230. if (!this.hiding && !this.showing){
  8231. if (this.element.getStyle('display') != 'none'){
  8232. this.hiding = true;
  8233. this.showing = false;
  8234. this.hidden = true;
  8235. this.cssText = this.element.style.cssText;
  8236. var startStyles = this.element.getComputedSize({
  8237. styles: this.options.styles,
  8238. mode: this.options.mode
  8239. });
  8240. if (this.options.transitionOpacity) startStyles.opacity = this.options.opacity;
  8241. var zero = {};
  8242. Object.each(startStyles, function(style, name){
  8243. zero[name] = [style, 0];
  8244. });
  8245. this.element.setStyles({
  8246. display: Function.convert(this.options.display).call(this),
  8247. overflow: 'hidden'
  8248. });
  8249. var hideThese = hideTheseOf(this);
  8250. if (hideThese) hideThese.setStyle('visibility', 'hidden');
  8251. this.$chain.unshift(function(){
  8252. if (this.hidden){
  8253. this.hiding = false;
  8254. this.element.style.cssText = this.cssText;
  8255. this.element.setStyle('display', 'none');
  8256. if (hideThese) hideThese.setStyle('visibility', 'visible');
  8257. }
  8258. this.fireEvent('hide', this.element);
  8259. this.callChain();
  8260. }.bind(this));
  8261. this.start(zero);
  8262. } else {
  8263. this.callChain.delay(10, this);
  8264. this.fireEvent('complete', this.element);
  8265. this.fireEvent('hide', this.element);
  8266. }
  8267. } else if (this.options.link == 'chain'){
  8268. this.chain(this.dissolve.bind(this));
  8269. } else if (this.options.link == 'cancel' && !this.hiding){
  8270. this.cancel();
  8271. this.dissolve();
  8272. }
  8273. return this;
  8274. },
  8275. reveal: function(){
  8276. if (!this.showing && !this.hiding){
  8277. if (this.element.getStyle('display') == 'none'){
  8278. this.hiding = false;
  8279. this.showing = true;
  8280. this.hidden = false;
  8281. this.cssText = this.element.style.cssText;
  8282. var startStyles;
  8283. this.element.measure(function(){
  8284. startStyles = this.element.getComputedSize({
  8285. styles: this.options.styles,
  8286. mode: this.options.mode
  8287. });
  8288. }.bind(this));
  8289. if (this.options.heightOverride != null) startStyles.height = this.options.heightOverride.toInt();
  8290. if (this.options.widthOverride != null) startStyles.width = this.options.widthOverride.toInt();
  8291. if (this.options.transitionOpacity){
  8292. this.element.setStyle('opacity', 0);
  8293. startStyles.opacity = this.options.opacity;
  8294. }
  8295. var zero = {
  8296. height: 0,
  8297. display: Function.convert(this.options.display).call(this)
  8298. };
  8299. Object.each(startStyles, function(style, name){
  8300. zero[name] = 0;
  8301. });
  8302. zero.overflow = 'hidden';
  8303. this.element.setStyles(zero);
  8304. var hideThese = hideTheseOf(this);
  8305. if (hideThese) hideThese.setStyle('visibility', 'hidden');
  8306. this.$chain.unshift(function(){
  8307. this.element.style.cssText = this.cssText;
  8308. this.element.setStyle('display', Function.convert(this.options.display).call(this));
  8309. if (!this.hidden) this.showing = false;
  8310. if (hideThese) hideThese.setStyle('visibility', 'visible');
  8311. this.callChain();
  8312. this.fireEvent('show', this.element);
  8313. }.bind(this));
  8314. this.start(startStyles);
  8315. } else {
  8316. this.callChain();
  8317. this.fireEvent('complete', this.element);
  8318. this.fireEvent('show', this.element);
  8319. }
  8320. } else if (this.options.link == 'chain'){
  8321. this.chain(this.reveal.bind(this));
  8322. } else if (this.options.link == 'cancel' && !this.showing){
  8323. this.cancel();
  8324. this.reveal();
  8325. }
  8326. return this;
  8327. },
  8328. toggle: function(){
  8329. if (this.element.getStyle('display') == 'none'){
  8330. this.reveal();
  8331. } else {
  8332. this.dissolve();
  8333. }
  8334. return this;
  8335. },
  8336. cancel: function(){
  8337. this.parent.apply(this, arguments);
  8338. if (this.cssText != null) this.element.style.cssText = this.cssText;
  8339. this.hiding = false;
  8340. this.showing = false;
  8341. return this;
  8342. }
  8343. });
  8344. Element.Properties.reveal = {
  8345. set: function(options){
  8346. this.get('reveal').cancel().setOptions(options);
  8347. return this;
  8348. },
  8349. get: function(){
  8350. var reveal = this.retrieve('reveal');
  8351. if (!reveal){
  8352. reveal = new Fx.Reveal(this);
  8353. this.store('reveal', reveal);
  8354. }
  8355. return reveal;
  8356. }
  8357. };
  8358. Element.Properties.dissolve = Element.Properties.reveal;
  8359. Element.implement({
  8360. reveal: function(options){
  8361. this.get('reveal').setOptions(options).reveal();
  8362. return this;
  8363. },
  8364. dissolve: function(options){
  8365. this.get('reveal').setOptions(options).dissolve();
  8366. return this;
  8367. },
  8368. nix: function(options){
  8369. var params = Array.link(arguments, {destroy: Type.isBoolean, options: Type.isObject});
  8370. this.get('reveal').setOptions(options).dissolve().chain(function(){
  8371. this[params.destroy ? 'destroy' : 'dispose']();
  8372. }.bind(this));
  8373. return this;
  8374. },
  8375. wink: function(){
  8376. var params = Array.link(arguments, {duration: Type.isNumber, options: Type.isObject});
  8377. var reveal = this.get('reveal').setOptions(params.options);
  8378. reveal.reveal().chain(function(){
  8379. (function(){
  8380. reveal.dissolve();
  8381. }).delay(params.duration || 2000);
  8382. });
  8383. }
  8384. });
  8385. })();
  8386. /*
  8387. ---
  8388. script: Form.Request.Append.js
  8389. name: Form.Request.Append
  8390. 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.
  8391. license: MIT-style license
  8392. authors:
  8393. - Aaron Newton
  8394. requires:
  8395. - Form.Request
  8396. - Fx.Reveal
  8397. - Elements.from
  8398. provides: [Form.Request.Append]
  8399. ...
  8400. */
  8401. Form.Request.Append = new Class({
  8402. Extends: Form.Request,
  8403. options: {
  8404. //onBeforeEffect: function(){},
  8405. useReveal: true,
  8406. revealOptions: {},
  8407. inject: 'bottom'
  8408. },
  8409. makeRequest: function(){
  8410. this.request = new Request.HTML(Object.merge({
  8411. url: this.element.get('action'),
  8412. method: this.element.get('method') || 'post',
  8413. spinnerTarget: this.element
  8414. }, this.options.requestOptions, {
  8415. evalScripts: false
  8416. })).addEvents({
  8417. success: function(tree, elements, html, javascript){
  8418. var container;
  8419. var kids = Elements.from(html);
  8420. if (kids.length == 1){
  8421. container = kids[0];
  8422. } else {
  8423. container = new Element('div', {
  8424. styles: {
  8425. display: 'none'
  8426. }
  8427. }).adopt(kids);
  8428. }
  8429. container.inject(this.target, this.options.inject);
  8430. if (this.options.requestOptions.evalScripts) Browser.exec(javascript);
  8431. this.fireEvent('beforeEffect', container);
  8432. var finish = function(){
  8433. this.fireEvent('success', [container, this.target, tree, elements, html, javascript]);
  8434. }.bind(this);
  8435. if (this.options.useReveal){
  8436. container.set('reveal', this.options.revealOptions).get('reveal').chain(finish);
  8437. container.reveal();
  8438. } else {
  8439. finish();
  8440. }
  8441. }.bind(this),
  8442. failure: function(xhr){
  8443. this.fireEvent('failure', xhr);
  8444. }.bind(this)
  8445. });
  8446. this.attachReset();
  8447. }
  8448. });
  8449. /*
  8450. ---
  8451. script: Object.Extras.js
  8452. name: Object.Extras
  8453. description: Extra Object generics, like getFromPath which allows a path notation to child elements.
  8454. license: MIT-style license
  8455. authors:
  8456. - Aaron Newton
  8457. requires:
  8458. - Core/Object
  8459. - MooTools.More
  8460. provides: [Object.Extras]
  8461. ...
  8462. */
  8463. (function(){
  8464. var defined = function(value){
  8465. return value != null;
  8466. };
  8467. var hasOwnProperty = Object.prototype.hasOwnProperty;
  8468. Object.extend({
  8469. getFromPath: function(source, parts){
  8470. if (typeof parts == 'string') parts = parts.split('.');
  8471. for (var i = 0, l = parts.length; i < l; i++){
  8472. if (hasOwnProperty.call(source, parts[i])) source = source[parts[i]];
  8473. else return null;
  8474. }
  8475. return source;
  8476. },
  8477. cleanValues: function(object, method){
  8478. method = method || defined;
  8479. for (var key in object) if (!method(object[key])){
  8480. delete object[key];
  8481. }
  8482. return object;
  8483. },
  8484. erase: function(object, key){
  8485. if (hasOwnProperty.call(object, key)) delete object[key];
  8486. return object;
  8487. },
  8488. run: function(object){
  8489. var args = Array.slice(arguments, 1);
  8490. for (var key in object) if (object[key].apply){
  8491. object[key].apply(object, args);
  8492. }
  8493. return object;
  8494. }
  8495. });
  8496. })();
  8497. /*
  8498. ---
  8499. script: Locale.js
  8500. name: Locale
  8501. description: Provides methods for localization.
  8502. license: MIT-style license
  8503. authors:
  8504. - Aaron Newton
  8505. - Arian Stolwijk
  8506. requires:
  8507. - Core/Events
  8508. - Object.Extras
  8509. - MooTools.More
  8510. provides: [Locale, Lang]
  8511. ...
  8512. */
  8513. (function(){
  8514. var current = null,
  8515. locales = {},
  8516. inherits = {};
  8517. var getSet = function(set){
  8518. if (instanceOf(set, Locale.Set)) return set;
  8519. else return locales[set];
  8520. };
  8521. var Locale = this.Locale = {
  8522. define: function(locale, set, key, value){
  8523. var name;
  8524. if (instanceOf(locale, Locale.Set)){
  8525. name = locale.name;
  8526. if (name) locales[name] = locale;
  8527. } else {
  8528. name = locale;
  8529. if (!locales[name]) locales[name] = new Locale.Set(name);
  8530. locale = locales[name];
  8531. }
  8532. if (set) locale.define(set, key, value);
  8533. /*<1.2compat>*/
  8534. if (set == 'cascade') return Locale.inherit(name, key);
  8535. /*</1.2compat>*/
  8536. if (!current) current = locale;
  8537. return locale;
  8538. },
  8539. use: function(locale){
  8540. locale = getSet(locale);
  8541. if (locale){
  8542. current = locale;
  8543. this.fireEvent('change', locale);
  8544. /*<1.2compat>*/
  8545. this.fireEvent('langChange', locale.name);
  8546. /*</1.2compat>*/
  8547. }
  8548. return this;
  8549. },
  8550. getCurrent: function(){
  8551. return current;
  8552. },
  8553. get: function(key, args){
  8554. return (current) ? current.get(key, args) : '';
  8555. },
  8556. inherit: function(locale, inherits, set){
  8557. locale = getSet(locale);
  8558. if (locale) locale.inherit(inherits, set);
  8559. return this;
  8560. },
  8561. list: function(){
  8562. return Object.keys(locales);
  8563. }
  8564. };
  8565. Object.append(Locale, new Events);
  8566. Locale.Set = new Class({
  8567. sets: {},
  8568. inherits: {
  8569. locales: [],
  8570. sets: {}
  8571. },
  8572. initialize: function(name){
  8573. this.name = name || '';
  8574. },
  8575. define: function(set, key, value){
  8576. var defineData = this.sets[set];
  8577. if (!defineData) defineData = {};
  8578. if (key){
  8579. if (typeOf(key) == 'object') defineData = Object.merge(defineData, key);
  8580. else defineData[key] = value;
  8581. }
  8582. this.sets[set] = defineData;
  8583. return this;
  8584. },
  8585. get: function(key, args, _base){
  8586. var value = Object.getFromPath(this.sets, key);
  8587. if (value != null){
  8588. var type = typeOf(value);
  8589. if (type == 'function') value = value.apply(null, Array.convert(args));
  8590. else if (type == 'object') value = Object.clone(value);
  8591. return value;
  8592. }
  8593. // get value of inherited locales
  8594. var index = key.indexOf('.'),
  8595. set = index < 0 ? key : key.substr(0, index),
  8596. names = (this.inherits.sets[set] || []).combine(this.inherits.locales).include('en-US');
  8597. if (!_base) _base = [];
  8598. for (var i = 0, l = names.length; i < l; i++){
  8599. if (_base.contains(names[i])) continue;
  8600. _base.include(names[i]);
  8601. var locale = locales[names[i]];
  8602. if (!locale) continue;
  8603. value = locale.get(key, args, _base);
  8604. if (value != null) return value;
  8605. }
  8606. return '';
  8607. },
  8608. inherit: function(names, set){
  8609. names = Array.convert(names);
  8610. if (set && !this.inherits.sets[set]) this.inherits.sets[set] = [];
  8611. var l = names.length;
  8612. while (l--) (set ? this.inherits.sets[set] : this.inherits.locales).unshift(names[l]);
  8613. return this;
  8614. }
  8615. });
  8616. /*<1.2compat>*/
  8617. var lang = MooTools.lang = {};
  8618. Object.append(lang, Locale, {
  8619. setLanguage: Locale.use,
  8620. getCurrentLanguage: function(){
  8621. var current = Locale.getCurrent();
  8622. return (current) ? current.name : null;
  8623. },
  8624. set: function(){
  8625. Locale.define.apply(this, arguments);
  8626. return this;
  8627. },
  8628. get: function(set, key, args){
  8629. if (key) set += '.' + key;
  8630. return Locale.get(set, args);
  8631. }
  8632. });
  8633. /*</1.2compat>*/
  8634. })();
  8635. /*
  8636. ---
  8637. name: Locale.en-US.Date
  8638. description: Date messages for US English.
  8639. license: MIT-style license
  8640. authors:
  8641. - Aaron Newton
  8642. requires:
  8643. - Locale
  8644. provides: [Locale.en-US.Date]
  8645. ...
  8646. */
  8647. Locale.define('en-US', 'Date', {
  8648. months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
  8649. months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  8650. days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  8651. days_abbr: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8652. // Culture's date order: MM/DD/YYYY
  8653. dateOrder: ['month', 'date', 'year'],
  8654. shortDate: '%m/%d/%Y',
  8655. shortTime: '%I:%M%p',
  8656. AM: 'AM',
  8657. PM: 'PM',
  8658. firstDayOfWeek: 0,
  8659. // Date.Extras
  8660. ordinal: function(dayOfMonth){
  8661. // 1st, 2nd, 3rd, etc.
  8662. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'th' : ['th', 'st', 'nd', 'rd', 'th'][Math.min(dayOfMonth % 10, 4)];
  8663. },
  8664. lessThanMinuteAgo: 'less than a minute ago',
  8665. minuteAgo: 'about a minute ago',
  8666. minutesAgo: '{delta} minutes ago',
  8667. hourAgo: 'about an hour ago',
  8668. hoursAgo: 'about {delta} hours ago',
  8669. dayAgo: '1 day ago',
  8670. daysAgo: '{delta} days ago',
  8671. weekAgo: '1 week ago',
  8672. weeksAgo: '{delta} weeks ago',
  8673. monthAgo: '1 month ago',
  8674. monthsAgo: '{delta} months ago',
  8675. yearAgo: '1 year ago',
  8676. yearsAgo: '{delta} years ago',
  8677. lessThanMinuteUntil: 'less than a minute from now',
  8678. minuteUntil: 'about a minute from now',
  8679. minutesUntil: '{delta} minutes from now',
  8680. hourUntil: 'about an hour from now',
  8681. hoursUntil: 'about {delta} hours from now',
  8682. dayUntil: '1 day from now',
  8683. daysUntil: '{delta} days from now',
  8684. weekUntil: '1 week from now',
  8685. weeksUntil: '{delta} weeks from now',
  8686. monthUntil: '1 month from now',
  8687. monthsUntil: '{delta} months from now',
  8688. yearUntil: '1 year from now',
  8689. yearsUntil: '{delta} years from now'
  8690. });
  8691. /*
  8692. ---
  8693. script: Date.js
  8694. name: Date
  8695. description: Extends the Date native object to include methods useful in managing dates.
  8696. license: MIT-style license
  8697. authors:
  8698. - Aaron Newton
  8699. - Nicholas Barthelemy - https://svn.nbarthelemy.com/date-js/
  8700. - Harald Kirshner - mail [at] digitarald.de; http://digitarald.de
  8701. - Scott Kyle - scott [at] appden.com; http://appden.com
  8702. requires:
  8703. - Core/Array
  8704. - Core/String
  8705. - Core/Number
  8706. - MooTools.More
  8707. - Locale
  8708. - Locale.en-US.Date
  8709. provides: [Date]
  8710. ...
  8711. */
  8712. (function(){
  8713. var Date = this.Date;
  8714. var DateMethods = Date.Methods = {
  8715. ms: 'Milliseconds',
  8716. year: 'FullYear',
  8717. min: 'Minutes',
  8718. mo: 'Month',
  8719. sec: 'Seconds',
  8720. hr: 'Hours'
  8721. };
  8722. [
  8723. 'Date', 'Day', 'FullYear', 'Hours', 'Milliseconds', 'Minutes', 'Month', 'Seconds', 'Time', 'TimezoneOffset',
  8724. 'Week', 'Timezone', 'GMTOffset', 'DayOfYear', 'LastMonth', 'LastDayOfMonth', 'UTCDate', 'UTCDay', 'UTCFullYear',
  8725. 'AMPM', 'Ordinal', 'UTCHours', 'UTCMilliseconds', 'UTCMinutes', 'UTCMonth', 'UTCSeconds', 'UTCMilliseconds'
  8726. ].each(function(method){
  8727. Date.Methods[method.toLowerCase()] = method;
  8728. });
  8729. var pad = function(n, digits, string){
  8730. if (digits == 1) return n;
  8731. return n < Math.pow(10, digits - 1) ? (string || '0') + pad(n, digits - 1, string) : n;
  8732. };
  8733. Date.implement({
  8734. set: function(prop, value){
  8735. prop = prop.toLowerCase();
  8736. var method = DateMethods[prop] && 'set' + DateMethods[prop];
  8737. if (method && this[method]) this[method](value);
  8738. return this;
  8739. }.overloadSetter(),
  8740. get: function(prop){
  8741. prop = prop.toLowerCase();
  8742. var method = DateMethods[prop] && 'get' + DateMethods[prop];
  8743. if (method && this[method]) return this[method]();
  8744. return null;
  8745. }.overloadGetter(),
  8746. clone: function(){
  8747. return new Date(this.get('time'));
  8748. },
  8749. increment: function(interval, times){
  8750. interval = interval || 'day';
  8751. times = times != null ? times : 1;
  8752. switch (interval){
  8753. case 'year':
  8754. return this.increment('month', times * 12);
  8755. case 'month':
  8756. var d = this.get('date');
  8757. this.set('date', 1).set('mo', this.get('mo') + times);
  8758. return this.set('date', d.min(this.get('lastdayofmonth')));
  8759. case 'week':
  8760. return this.increment('day', times * 7);
  8761. case 'day':
  8762. return this.set('date', this.get('date') + times);
  8763. }
  8764. if (!Date.units[interval]) throw new Error(interval + ' is not a supported interval');
  8765. return this.set('time', this.get('time') + times * Date.units[interval]());
  8766. },
  8767. decrement: function(interval, times){
  8768. return this.increment(interval, -1 * (times != null ? times : 1));
  8769. },
  8770. isLeapYear: function(){
  8771. return Date.isLeapYear(this.get('year'));
  8772. },
  8773. clearTime: function(){
  8774. return this.set({hr: 0, min: 0, sec: 0, ms: 0});
  8775. },
  8776. diff: function(date, resolution){
  8777. if (typeOf(date) == 'string') date = Date.parse(date);
  8778. return ((date - this) / Date.units[resolution || 'day'](3, 3)).round(); // non-leap year, 30-day month
  8779. },
  8780. getLastDayOfMonth: function(){
  8781. return Date.daysInMonth(this.get('mo'), this.get('year'));
  8782. },
  8783. getDayOfYear: function(){
  8784. return (Date.UTC(this.get('year'), this.get('mo'), this.get('date') + 1)
  8785. - Date.UTC(this.get('year'), 0, 1)) / Date.units.day();
  8786. },
  8787. setDay: function(day, firstDayOfWeek){
  8788. if (firstDayOfWeek == null){
  8789. firstDayOfWeek = Date.getMsg('firstDayOfWeek');
  8790. if (firstDayOfWeek === '') firstDayOfWeek = 1;
  8791. }
  8792. day = (7 + Date.parseDay(day, true) - firstDayOfWeek) % 7;
  8793. var currentDay = (7 + this.get('day') - firstDayOfWeek) % 7;
  8794. return this.increment('day', day - currentDay);
  8795. },
  8796. getWeek: function(firstDayOfWeek){
  8797. if (firstDayOfWeek == null){
  8798. firstDayOfWeek = Date.getMsg('firstDayOfWeek');
  8799. if (firstDayOfWeek === '') firstDayOfWeek = 1;
  8800. }
  8801. var date = this,
  8802. dayOfWeek = (7 + date.get('day') - firstDayOfWeek) % 7,
  8803. dividend = 0,
  8804. firstDayOfYear;
  8805. if (firstDayOfWeek == 1){
  8806. // ISO-8601, week belongs to year that has the most days of the week (i.e. has the thursday of the week)
  8807. var month = date.get('month'),
  8808. startOfWeek = date.get('date') - dayOfWeek;
  8809. if (month == 11 && startOfWeek > 28) return 1; // Week 1 of next year
  8810. if (month == 0 && startOfWeek < -2){
  8811. // Use a date from last year to determine the week
  8812. date = new Date(date).decrement('day', dayOfWeek);
  8813. dayOfWeek = 0;
  8814. }
  8815. firstDayOfYear = new Date(date.get('year'), 0, 1).get('day') || 7;
  8816. if (firstDayOfYear > 4) dividend = -7; // First week of the year is not week 1
  8817. } else {
  8818. // In other cultures the first week of the year is always week 1 and the last week always 53 or 54.
  8819. // Days in the same week can have a different weeknumber if the week spreads across two years.
  8820. firstDayOfYear = new Date(date.get('year'), 0, 1).get('day');
  8821. }
  8822. dividend += date.get('dayofyear');
  8823. dividend += 6 - dayOfWeek; // Add days so we calculate the current date's week as a full week
  8824. dividend += (7 + firstDayOfYear - firstDayOfWeek) % 7; // Make up for first week of the year not being a full week
  8825. return (dividend / 7);
  8826. },
  8827. getOrdinal: function(day){
  8828. return Date.getMsg('ordinal', day || this.get('date'));
  8829. },
  8830. getTimezone: function(){
  8831. return this.toString()
  8832. .replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/, '$1')
  8833. .replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, '$1$2$3');
  8834. },
  8835. getGMTOffset: function(){
  8836. var off = this.get('timezoneOffset');
  8837. return ((off > 0) ? '-' : '+') + pad((off.abs() / 60).floor(), 2) + pad(off % 60, 2);
  8838. },
  8839. setAMPM: function(ampm){
  8840. ampm = ampm.toUpperCase();
  8841. var hr = this.get('hr');
  8842. if (hr > 11 && ampm == 'AM') return this.decrement('hour', 12);
  8843. else if (hr < 12 && ampm == 'PM') return this.increment('hour', 12);
  8844. return this;
  8845. },
  8846. getAMPM: function(){
  8847. return (this.get('hr') < 12) ? 'AM' : 'PM';
  8848. },
  8849. parse: function(str){
  8850. this.set('time', Date.parse(str));
  8851. return this;
  8852. },
  8853. isValid: function(date){
  8854. if (!date) date = this;
  8855. return typeOf(date) == 'date' && !isNaN(date.valueOf());
  8856. },
  8857. format: function(format){
  8858. if (!this.isValid()) return 'invalid date';
  8859. if (!format) format = '%x %X';
  8860. if (typeof format == 'string') format = formats[format.toLowerCase()] || format;
  8861. if (typeof format == 'function') return format(this);
  8862. var d = this;
  8863. return format.replace(/%([a-z%])/gi,
  8864. function($0, $1){
  8865. switch ($1){
  8866. case 'a': return Date.getMsg('days_abbr')[d.get('day')];
  8867. case 'A': return Date.getMsg('days')[d.get('day')];
  8868. case 'b': return Date.getMsg('months_abbr')[d.get('month')];
  8869. case 'B': return Date.getMsg('months')[d.get('month')];
  8870. case 'c': return d.format('%a %b %d %H:%M:%S %Y');
  8871. case 'd': return pad(d.get('date'), 2);
  8872. case 'e': return pad(d.get('date'), 2, ' ');
  8873. case 'H': return pad(d.get('hr'), 2);
  8874. case 'I': return pad((d.get('hr') % 12) || 12, 2);
  8875. case 'j': return pad(d.get('dayofyear'), 3);
  8876. case 'k': return pad(d.get('hr'), 2, ' ');
  8877. case 'l': return pad((d.get('hr') % 12) || 12, 2, ' ');
  8878. case 'L': return pad(d.get('ms'), 3);
  8879. case 'm': return pad((d.get('mo') + 1), 2);
  8880. case 'M': return pad(d.get('min'), 2);
  8881. case 'o': return d.get('ordinal');
  8882. case 'p': return Date.getMsg(d.get('ampm'));
  8883. case 's': return Math.round(d / 1000);
  8884. case 'S': return pad(d.get('seconds'), 2);
  8885. case 'T': return d.format('%H:%M:%S');
  8886. case 'U': return pad(d.get('week'), 2);
  8887. case 'w': return d.get('day');
  8888. case 'x': return d.format(Date.getMsg('shortDate'));
  8889. case 'X': return d.format(Date.getMsg('shortTime'));
  8890. case 'y': return d.get('year').toString().substr(2);
  8891. case 'Y': return d.get('year');
  8892. case 'z': return d.get('GMTOffset');
  8893. case 'Z': return d.get('Timezone');
  8894. }
  8895. return $1;
  8896. }
  8897. );
  8898. },
  8899. toISOString: function(){
  8900. return this.format('iso8601');
  8901. }
  8902. }).alias({
  8903. toJSON: 'toISOString',
  8904. compare: 'diff',
  8905. strftime: 'format'
  8906. });
  8907. // The day and month abbreviations are standardized, so we cannot use simply %a and %b because they will get localized
  8908. var rfcDayAbbr = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8909. rfcMonthAbbr = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
  8910. var formats = {
  8911. db: '%Y-%m-%d %H:%M:%S',
  8912. compact: '%Y%m%dT%H%M%S',
  8913. 'short': '%d %b %H:%M',
  8914. 'long': '%B %d, %Y %H:%M',
  8915. rfc822: function(date){
  8916. return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %Z');
  8917. },
  8918. rfc2822: function(date){
  8919. return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %z');
  8920. },
  8921. iso8601: function(date){
  8922. return (
  8923. date.getUTCFullYear() + '-' +
  8924. pad(date.getUTCMonth() + 1, 2) + '-' +
  8925. pad(date.getUTCDate(), 2) + 'T' +
  8926. pad(date.getUTCHours(), 2) + ':' +
  8927. pad(date.getUTCMinutes(), 2) + ':' +
  8928. pad(date.getUTCSeconds(), 2) + '.' +
  8929. pad(date.getUTCMilliseconds(), 3) + 'Z'
  8930. );
  8931. }
  8932. };
  8933. var parsePatterns = [],
  8934. nativeParse = Date.parse;
  8935. var parseWord = function(type, word, num){
  8936. var ret = -1,
  8937. translated = Date.getMsg(type + 's');
  8938. switch (typeOf(word)){
  8939. case 'object':
  8940. ret = translated[word.get(type)];
  8941. break;
  8942. case 'number':
  8943. ret = translated[word];
  8944. if (!ret) throw new Error('Invalid ' + type + ' index: ' + word);
  8945. break;
  8946. case 'string':
  8947. var match = translated.filter(function(name){
  8948. return this.test(name);
  8949. }, new RegExp('^' + word, 'i'));
  8950. if (!match.length) throw new Error('Invalid ' + type + ' string');
  8951. if (match.length > 1) throw new Error('Ambiguous ' + type);
  8952. ret = match[0];
  8953. }
  8954. return (num) ? translated.indexOf(ret) : ret;
  8955. };
  8956. var startCentury = 1900,
  8957. startYear = 70;
  8958. Date.extend({
  8959. getMsg: function(key, args){
  8960. return Locale.get('Date.' + key, args);
  8961. },
  8962. units: {
  8963. ms: Function.convert(1),
  8964. second: Function.convert(1000),
  8965. minute: Function.convert(60000),
  8966. hour: Function.convert(3600000),
  8967. day: Function.convert(86400000),
  8968. week: Function.convert(608400000),
  8969. month: function(month, year){
  8970. var d = new Date;
  8971. return Date.daysInMonth(month != null ? month : d.get('mo'), year != null ? year : d.get('year')) * 86400000;
  8972. },
  8973. year: function(year){
  8974. year = year || new Date().get('year');
  8975. return Date.isLeapYear(year) ? 31622400000 : 31536000000;
  8976. }
  8977. },
  8978. daysInMonth: function(month, year){
  8979. return [31, Date.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
  8980. },
  8981. isLeapYear: function(year){
  8982. return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);
  8983. },
  8984. parse: function(from){
  8985. var t = typeOf(from);
  8986. if (t == 'number') return new Date(from);
  8987. if (t != 'string') return from;
  8988. from = from.clean();
  8989. if (!from.length) return null;
  8990. var parsed;
  8991. parsePatterns.some(function(pattern){
  8992. var bits = pattern.re.exec(from);
  8993. return (bits) ? (parsed = pattern.handler(bits)) : false;
  8994. });
  8995. if (!(parsed && parsed.isValid())){
  8996. parsed = new Date(nativeParse(from));
  8997. if (!(parsed && parsed.isValid())) parsed = new Date(from.toInt());
  8998. }
  8999. return parsed;
  9000. },
  9001. parseDay: function(day, num){
  9002. return parseWord('day', day, num);
  9003. },
  9004. parseMonth: function(month, num){
  9005. return parseWord('month', month, num);
  9006. },
  9007. parseUTC: function(value){
  9008. var localDate = new Date(value);
  9009. var utcSeconds = Date.UTC(
  9010. localDate.get('year'),
  9011. localDate.get('mo'),
  9012. localDate.get('date'),
  9013. localDate.get('hr'),
  9014. localDate.get('min'),
  9015. localDate.get('sec'),
  9016. localDate.get('ms')
  9017. );
  9018. return new Date(utcSeconds);
  9019. },
  9020. orderIndex: function(unit){
  9021. return Date.getMsg('dateOrder').indexOf(unit) + 1;
  9022. },
  9023. defineFormat: function(name, format){
  9024. formats[name] = format;
  9025. return this;
  9026. },
  9027. //<1.2compat>
  9028. parsePatterns: parsePatterns,
  9029. //</1.2compat>
  9030. defineParser: function(pattern){
  9031. parsePatterns.push((pattern.re && pattern.handler) ? pattern : build(pattern));
  9032. return this;
  9033. },
  9034. defineParsers: function(){
  9035. Array.flatten(arguments).each(Date.defineParser);
  9036. return this;
  9037. },
  9038. define2DigitYearStart: function(year){
  9039. startYear = year % 100;
  9040. startCentury = year - startYear;
  9041. return this;
  9042. }
  9043. }).extend({
  9044. defineFormats: Date.defineFormat.overloadSetter()
  9045. });
  9046. var regexOf = function(type){
  9047. return new RegExp('(?:' + Date.getMsg(type).map(function(name){
  9048. return name.substr(0, 3);
  9049. }).join('|') + ')[a-z]*');
  9050. };
  9051. var replacers = function(key){
  9052. switch (key){
  9053. case 'T':
  9054. return '%H:%M:%S';
  9055. case 'x': // iso8601 covers yyyy-mm-dd, so just check if month is first
  9056. return ((Date.orderIndex('month') == 1) ? '%m[-./]%d' : '%d[-./]%m') + '([-./]%y)?';
  9057. case 'X':
  9058. return '%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%z?';
  9059. }
  9060. return null;
  9061. };
  9062. var keys = {
  9063. d: /[0-2]?[0-9]|3[01]/,
  9064. H: /[01]?[0-9]|2[0-3]/,
  9065. I: /0?[1-9]|1[0-2]/,
  9066. M: /[0-5]?\d/,
  9067. s: /\d+/,
  9068. o: /[a-z]*/,
  9069. p: /[ap]\.?m\.?/,
  9070. y: /\d{2}|\d{4}/,
  9071. Y: /\d{4}/,
  9072. z: /Z|[+-]\d{2}(?::?\d{2})?/
  9073. };
  9074. keys.m = keys.I;
  9075. keys.S = keys.M;
  9076. var currentLanguage;
  9077. var recompile = function(language){
  9078. currentLanguage = language;
  9079. keys.a = keys.A = regexOf('days');
  9080. keys.b = keys.B = regexOf('months');
  9081. parsePatterns.each(function(pattern, i){
  9082. if (pattern.format) parsePatterns[i] = build(pattern.format);
  9083. });
  9084. };
  9085. var build = function(format){
  9086. if (!currentLanguage) return {format: format};
  9087. var parsed = [];
  9088. var re = (format.source || format) // allow format to be regex
  9089. .replace(/%([a-z])/gi,
  9090. function($0, $1){
  9091. return replacers($1) || $0;
  9092. }
  9093. ).replace(/\((?!\?)/g, '(?:') // make all groups non-capturing
  9094. .replace(/ (?!\?|\*)/g, ',? ') // be forgiving with spaces and commas
  9095. .replace(/%([a-z%])/gi,
  9096. function($0, $1){
  9097. var p = keys[$1];
  9098. if (!p) return $1;
  9099. parsed.push($1);
  9100. return '(' + p.source + ')';
  9101. }
  9102. ).replace(/\[a-z\]/gi, '[a-z\\u00c0-\\uffff;\&]'); // handle unicode words
  9103. return {
  9104. format: format,
  9105. re: new RegExp('^' + re + '$', 'i'),
  9106. handler: function(bits){
  9107. bits = bits.slice(1).associate(parsed);
  9108. var date = new Date().clearTime(),
  9109. year = bits.y || bits.Y;
  9110. if (year != null) handle.call(date, 'y', year); // need to start in the right year
  9111. if ('d' in bits) handle.call(date, 'd', 1);
  9112. if ('m' in bits || bits.b || bits.B) handle.call(date, 'm', 1);
  9113. for (var key in bits) handle.call(date, key, bits[key]);
  9114. return date;
  9115. }
  9116. };
  9117. };
  9118. var handle = function(key, value){
  9119. if (!value) return this;
  9120. switch (key){
  9121. case 'a': case 'A': return this.set('day', Date.parseDay(value, true));
  9122. case 'b': case 'B': return this.set('mo', Date.parseMonth(value, true));
  9123. case 'd': return this.set('date', value);
  9124. case 'H': case 'I': return this.set('hr', value);
  9125. case 'm': return this.set('mo', value - 1);
  9126. case 'M': return this.set('min', value);
  9127. case 'p': return this.set('ampm', value.replace(/\./g, ''));
  9128. case 'S': return this.set('sec', value);
  9129. case 's': return this.set('ms', ('0.' + value) * 1000);
  9130. case 'w': return this.set('day', value);
  9131. case 'Y': return this.set('year', value);
  9132. case 'y':
  9133. value = +value;
  9134. if (value < 100) value += startCentury + (value < startYear ? 100 : 0);
  9135. return this.set('year', value);
  9136. case 'z':
  9137. if (value == 'Z') value = '+00';
  9138. var offset = value.match(/([+-])(\d{2}):?(\d{2})?/);
  9139. offset = (offset[1] + '1') * (offset[2] * 60 + (+offset[3] || 0)) + this.getTimezoneOffset();
  9140. return this.set('time', this - offset * 60000);
  9141. }
  9142. return this;
  9143. };
  9144. Date.defineParsers(
  9145. '%Y([-./]%m([-./]%d((T| )%X)?)?)?', // "1999-12-31", "1999-12-31 11:59pm", "1999-12-31 23:59:59", ISO8601
  9146. '%Y%m%d(T%H(%M%S?)?)?', // "19991231", "19991231T1159", compact
  9147. '%x( %X)?', // "12/31", "12.31.99", "12-31-1999", "12/31/2008 11:59 PM"
  9148. '%d%o( %b( %Y)?)?( %X)?', // "31st", "31st December", "31 Dec 1999", "31 Dec 1999 11:59pm"
  9149. '%b( %d%o)?( %Y)?( %X)?', // Same as above with month and day switched
  9150. '%Y %b( %d%o( %X)?)?', // Same as above with year coming first
  9151. '%o %b %d %X %z %Y', // "Thu Oct 22 08:11:23 +0000 2009"
  9152. '%T', // %H:%M:%S
  9153. '%H:%M( ?%p)?' // "11:05pm", "11:05 am" and "11:05"
  9154. );
  9155. Locale.addEvent('change', function(language){
  9156. if (Locale.get('Date')) recompile(language);
  9157. }).fireEvent('change', Locale.getCurrent());
  9158. })();
  9159. /*
  9160. ---
  9161. name: Locale.en-US.Form.Validator
  9162. description: Form Validator messages for English.
  9163. license: MIT-style license
  9164. authors:
  9165. - Aaron Newton
  9166. requires:
  9167. - Locale
  9168. provides: [Locale.en-US.Form.Validator]
  9169. ...
  9170. */
  9171. Locale.define('en-US', 'FormValidator', {
  9172. required: 'This field is required.',
  9173. length: 'Please enter {length} characters (you entered {elLength} characters)',
  9174. minLength: 'Please enter at least {minLength} characters (you entered {length} characters).',
  9175. maxLength: 'Please enter no more than {maxLength} characters (you entered {length} characters).',
  9176. integer: 'Please enter an integer in this field. Numbers with decimals (e.g. 1.25) are not permitted.',
  9177. numeric: 'Please enter only numeric values in this field (i.e. "1" or "1.1" or "-1" or "-1.1").',
  9178. digits: 'Please use numbers and punctuation only in this field (for example, a phone number with dashes or dots is permitted).',
  9179. alpha: 'Please use only letters (a-z) within this field. No spaces or other characters are allowed.',
  9180. alphanum: 'Please use only letters (a-z) or numbers (0-9) in this field. No spaces or other characters are allowed.',
  9181. dateSuchAs: 'Please enter a valid date such as {date}',
  9182. dateInFormatMDY: 'Please enter a valid date such as MM/DD/YYYY (i.e. "12/31/1999")',
  9183. email: 'Please enter a valid email address. For example "fred@domain.com".',
  9184. url: 'Please enter a valid URL such as http://www.example.com.',
  9185. currencyDollar: 'Please enter a valid $ amount. For example $100.00 .',
  9186. oneRequired: 'Please enter something for at least one of these inputs.',
  9187. errorPrefix: 'Error: ',
  9188. warningPrefix: 'Warning: ',
  9189. // Form.Validator.Extras
  9190. noSpace: 'There can be no spaces in this input.',
  9191. reqChkByNode: 'No items are selected.',
  9192. requiredChk: 'This field is required.',
  9193. reqChkByName: 'Please select a {label}.',
  9194. match: 'This field needs to match the {matchName} field',
  9195. startDate: 'the start date',
  9196. endDate: 'the end date',
  9197. currentDate: 'the current date',
  9198. afterDate: 'The date should be the same or after {label}.',
  9199. beforeDate: 'The date should be the same or before {label}.',
  9200. startMonth: 'Please select a start month',
  9201. sameMonth: 'These two dates must be in the same month - you must change one or the other.',
  9202. creditcard: 'The credit card number entered is invalid. Please check the number and try again. {length} digits entered.'
  9203. });
  9204. /*
  9205. ---
  9206. script: Form.Validator.js
  9207. name: Form.Validator
  9208. description: A css-class based form validation system.
  9209. license: MIT-style license
  9210. authors:
  9211. - Aaron Newton
  9212. requires:
  9213. - Core/Options
  9214. - Core/Events
  9215. - Core/Element.Delegation
  9216. - Core/Slick.Finder
  9217. - Core/Element.Event
  9218. - Core/Element.Style
  9219. - Core/JSON
  9220. - Locale
  9221. - Class.Binds
  9222. - Date
  9223. - Element.Forms
  9224. - Locale.en-US.Form.Validator
  9225. - Element.Shortcuts
  9226. provides: [Form.Validator, InputValidator, FormValidator.BaseValidators]
  9227. ...
  9228. */
  9229. if (!window.Form) window.Form = {};
  9230. var InputValidator = this.InputValidator = new Class({
  9231. Implements: [Options],
  9232. options: {
  9233. errorMsg: 'Validation failed.',
  9234. test: Function.convert(true)
  9235. },
  9236. initialize: function(className, options){
  9237. this.setOptions(options);
  9238. this.className = className;
  9239. },
  9240. test: function(field, props){
  9241. field = document.id(field);
  9242. return (field) ? this.options.test(field, props || this.getProps(field)) : false;
  9243. },
  9244. getError: function(field, props){
  9245. field = document.id(field);
  9246. var err = this.options.errorMsg;
  9247. if (typeOf(err) == 'function') err = err(field, props || this.getProps(field));
  9248. return err;
  9249. },
  9250. getProps: function(field){
  9251. field = document.id(field);
  9252. return (field) ? field.get('validatorProps') : {};
  9253. }
  9254. });
  9255. Element.Properties.validators = {
  9256. get: function(){
  9257. return (this.get('data-validators') || this.className).clean().replace(/'(\\.|[^'])*'|"(\\.|[^"])*"/g, function(match){
  9258. return match.replace(' ', '\\x20');
  9259. }).split(' ');
  9260. }
  9261. };
  9262. Element.Properties.validatorProps = {
  9263. set: function(props){
  9264. return this.eliminate('$moo:validatorProps').store('$moo:validatorProps', props);
  9265. },
  9266. get: function(props){
  9267. if (props) this.set(props);
  9268. if (this.retrieve('$moo:validatorProps')) return this.retrieve('$moo:validatorProps');
  9269. if (this.getProperty('data-validator-properties') || this.getProperty('validatorProps')){
  9270. try {
  9271. this.store('$moo:validatorProps', JSON.decode(this.getProperty('validatorProps') || this.getProperty('data-validator-properties'), false));
  9272. } catch (e){
  9273. return {};
  9274. }
  9275. } else {
  9276. var vals = this.get('validators').filter(function(cls){
  9277. return cls.test(':');
  9278. });
  9279. if (!vals.length){
  9280. this.store('$moo:validatorProps', {});
  9281. } else {
  9282. props = {};
  9283. vals.each(function(cls){
  9284. var split = cls.split(':');
  9285. if (split[1]){
  9286. try {
  9287. props[split[0]] = JSON.decode(split[1], false);
  9288. } catch (e){}
  9289. }
  9290. });
  9291. this.store('$moo:validatorProps', props);
  9292. }
  9293. }
  9294. return this.retrieve('$moo:validatorProps');
  9295. }
  9296. };
  9297. Form.Validator = new Class({
  9298. Implements: [Options, Events],
  9299. options: {/*
  9300. onFormValidate: function(isValid, form, event){},
  9301. onElementValidate: function(isValid, field, className, warn){},
  9302. onElementPass: function(field){},
  9303. onElementFail: function(field, validatorsFailed){}, */
  9304. fieldSelectors: 'input, select, textarea',
  9305. ignoreHidden: true,
  9306. ignoreDisabled: true,
  9307. useTitles: false,
  9308. evaluateOnSubmit: true,
  9309. evaluateFieldsOnBlur: true,
  9310. evaluateFieldsOnChange: true,
  9311. serial: true,
  9312. stopOnFailure: true,
  9313. warningPrefix: function(){
  9314. return Form.Validator.getMsg('warningPrefix') || 'Warning: ';
  9315. },
  9316. errorPrefix: function(){
  9317. return Form.Validator.getMsg('errorPrefix') || 'Error: ';
  9318. }
  9319. },
  9320. initialize: function(form, options){
  9321. this.setOptions(options);
  9322. this.element = document.id(form);
  9323. this.warningPrefix = Function.convert(this.options.warningPrefix)();
  9324. this.errorPrefix = Function.convert(this.options.errorPrefix)();
  9325. this._bound = {
  9326. onSubmit: this.onSubmit.bind(this),
  9327. blurOrChange: function(event, field){
  9328. this.validationMonitor(field, true);
  9329. }.bind(this)
  9330. };
  9331. this.enable();
  9332. },
  9333. toElement: function(){
  9334. return this.element;
  9335. },
  9336. getFields: function(){
  9337. return (this.fields = this.element.getElements(this.options.fieldSelectors));
  9338. },
  9339. enable: function(){
  9340. this.element.store('validator', this);
  9341. if (this.options.evaluateOnSubmit) this.element.addEvent('submit', this._bound.onSubmit);
  9342. if (this.options.evaluateFieldsOnBlur){
  9343. this.element.addEvent('blur:relay(input,select,textarea)', this._bound.blurOrChange);
  9344. }
  9345. if (this.options.evaluateFieldsOnChange){
  9346. this.element.addEvent('change:relay(input,select,textarea)', this._bound.blurOrChange);
  9347. }
  9348. },
  9349. disable: function(){
  9350. this.element.eliminate('validator');
  9351. this.element.removeEvents({
  9352. submit: this._bound.onSubmit,
  9353. 'blur:relay(input,select,textarea)': this._bound.blurOrChange,
  9354. 'change:relay(input,select,textarea)': this._bound.blurOrChange
  9355. });
  9356. },
  9357. validationMonitor: function(){
  9358. clearTimeout(this.timer);
  9359. this.timer = this.validateField.delay(50, this, arguments);
  9360. },
  9361. onSubmit: function(event){
  9362. if (this.validate(event)) this.reset();
  9363. },
  9364. reset: function(){
  9365. this.getFields().each(this.resetField, this);
  9366. return this;
  9367. },
  9368. validate: function(event){
  9369. var result = this.getFields().map(function(field){
  9370. return this.validateField(field, true);
  9371. }, this).every(function(v){
  9372. return v;
  9373. });
  9374. this.fireEvent('formValidate', [result, this.element, event]);
  9375. if (this.options.stopOnFailure && !result && event) event.preventDefault();
  9376. return result;
  9377. },
  9378. validateField: function(field, force){
  9379. if (this.paused) return true;
  9380. field = document.id(field);
  9381. var passed = !field.hasClass('validation-failed');
  9382. var failed, warned;
  9383. if (this.options.serial && !force){
  9384. failed = this.element.getElement('.validation-failed');
  9385. warned = this.element.getElement('.warning');
  9386. }
  9387. if (field && (!failed || force || field.hasClass('validation-failed') || (failed && !this.options.serial))){
  9388. var validationTypes = field.get('validators');
  9389. var validators = validationTypes.some(function(cn){
  9390. return this.getValidator(cn);
  9391. }, this);
  9392. var validatorsFailed = [];
  9393. validationTypes.each(function(className){
  9394. if (className && !this.test(className, field)) validatorsFailed.include(className);
  9395. }, this);
  9396. passed = validatorsFailed.length === 0;
  9397. if (validators && !this.hasValidator(field, 'warnOnly')){
  9398. if (passed){
  9399. field.addClass('validation-passed').removeClass('validation-failed');
  9400. this.fireEvent('elementPass', [field]);
  9401. } else {
  9402. field.addClass('validation-failed').removeClass('validation-passed');
  9403. this.fireEvent('elementFail', [field, validatorsFailed]);
  9404. }
  9405. }
  9406. if (!warned){
  9407. var warnings = validationTypes.some(function(cn){
  9408. if (cn.test('^warn'))
  9409. return this.getValidator(cn.replace(/^warn-/,''));
  9410. else return null;
  9411. }, this);
  9412. field.removeClass('warning');
  9413. var warnResult = validationTypes.map(function(cn){
  9414. if (cn.test('^warn'))
  9415. return this.test(cn.replace(/^warn-/,''), field, true);
  9416. else return null;
  9417. }, this);
  9418. }
  9419. }
  9420. return passed;
  9421. },
  9422. test: function(className, field, warn){
  9423. field = document.id(field);
  9424. if ((this.options.ignoreHidden && !field.isVisible()) || (this.options.ignoreDisabled && field.get('disabled'))) return true;
  9425. var validator = this.getValidator(className);
  9426. if (warn != null) warn = false;
  9427. if (this.hasValidator(field, 'warnOnly')) warn = true;
  9428. var isValid = field.hasClass('ignoreValidation') || (validator ? validator.test(field) : true);
  9429. if (validator) this.fireEvent('elementValidate', [isValid, field, className, warn]);
  9430. if (warn) return true;
  9431. return isValid;
  9432. },
  9433. hasValidator: function(field, value){
  9434. return field.get('validators').contains(value);
  9435. },
  9436. resetField: function(field){
  9437. field = document.id(field);
  9438. if (field){
  9439. field.get('validators').each(function(className){
  9440. if (className.test('^warn-')) className = className.replace(/^warn-/, '');
  9441. field.removeClass('validation-failed');
  9442. field.removeClass('warning');
  9443. field.removeClass('validation-passed');
  9444. }, this);
  9445. }
  9446. return this;
  9447. },
  9448. stop: function(){
  9449. this.paused = true;
  9450. return this;
  9451. },
  9452. start: function(){
  9453. this.paused = false;
  9454. return this;
  9455. },
  9456. ignoreField: function(field, warn){
  9457. field = document.id(field);
  9458. if (field){
  9459. this.enforceField(field);
  9460. if (warn) field.addClass('warnOnly');
  9461. else field.addClass('ignoreValidation');
  9462. }
  9463. return this;
  9464. },
  9465. enforceField: function(field){
  9466. field = document.id(field);
  9467. if (field) field.removeClass('warnOnly').removeClass('ignoreValidation');
  9468. return this;
  9469. }
  9470. });
  9471. Form.Validator.getMsg = function(key){
  9472. return Locale.get('FormValidator.' + key);
  9473. };
  9474. Form.Validator.adders = {
  9475. validators:{},
  9476. add : function(className, options){
  9477. this.validators[className] = new InputValidator(className, options);
  9478. //if this is a class (this method is used by instances of Form.Validator and the Form.Validator namespace)
  9479. //extend these validators into it
  9480. //this allows validators to be global and/or per instance
  9481. if (!this.initialize){
  9482. this.implement({
  9483. validators: this.validators
  9484. });
  9485. }
  9486. },
  9487. addAllThese : function(validators){
  9488. Array.convert(validators).each(function(validator){
  9489. this.add(validator[0], validator[1]);
  9490. }, this);
  9491. },
  9492. getValidator: function(className){
  9493. return this.validators[className.split(':')[0]];
  9494. }
  9495. };
  9496. Object.append(Form.Validator, Form.Validator.adders);
  9497. Form.Validator.implement(Form.Validator.adders);
  9498. Form.Validator.add('IsEmpty', {
  9499. errorMsg: false,
  9500. test: function(element){
  9501. if (element.type == 'select-one' || element.type == 'select')
  9502. return !(element.selectedIndex >= 0 && element.options[element.selectedIndex].value != '');
  9503. else
  9504. return ((element.get('value') == null) || (element.get('value').length == 0));
  9505. }
  9506. });
  9507. Form.Validator.addAllThese([
  9508. ['required', {
  9509. errorMsg: function(){
  9510. return Form.Validator.getMsg('required');
  9511. },
  9512. test: function(element){
  9513. return !Form.Validator.getValidator('IsEmpty').test(element);
  9514. }
  9515. }],
  9516. ['length', {
  9517. errorMsg: function(element, props){
  9518. if (typeOf(props.length) != 'null')
  9519. return Form.Validator.getMsg('length').substitute({length: props.length, elLength: element.get('value').length});
  9520. else return '';
  9521. },
  9522. test: function(element, props){
  9523. if (typeOf(props.length) != 'null') return (element.get('value').length == props.length || element.get('value').length == 0);
  9524. else return true;
  9525. }
  9526. }],
  9527. ['minLength', {
  9528. errorMsg: function(element, props){
  9529. if (typeOf(props.minLength) != 'null')
  9530. return Form.Validator.getMsg('minLength').substitute({minLength: props.minLength, length: element.get('value').length});
  9531. else return '';
  9532. },
  9533. test: function(element, props){
  9534. if (typeOf(props.minLength) != 'null') return (element.get('value').length >= (props.minLength || 0));
  9535. else return true;
  9536. }
  9537. }],
  9538. ['maxLength', {
  9539. errorMsg: function(element, props){
  9540. //props is {maxLength:10}
  9541. if (typeOf(props.maxLength) != 'null')
  9542. return Form.Validator.getMsg('maxLength').substitute({maxLength: props.maxLength, length: element.get('value').length});
  9543. else return '';
  9544. },
  9545. test: function(element, props){
  9546. return element.get('value').length <= (props.maxLength || 10000);
  9547. }
  9548. }],
  9549. ['validate-integer', {
  9550. errorMsg: Form.Validator.getMsg.pass('integer'),
  9551. test: function(element){
  9552. return Form.Validator.getValidator('IsEmpty').test(element) || (/^(-?[1-9]\d*|0)$/).test(element.get('value'));
  9553. }
  9554. }],
  9555. ['validate-numeric', {
  9556. errorMsg: Form.Validator.getMsg.pass('numeric'),
  9557. test: function(element){
  9558. return Form.Validator.getValidator('IsEmpty').test(element) ||
  9559. (/^-?(?:0$0(?=\d*\.)|[1-9]|0)\d*(\.\d+)?$/).test(element.get('value'));
  9560. }
  9561. }],
  9562. ['validate-digits', {
  9563. errorMsg: Form.Validator.getMsg.pass('digits'),
  9564. test: function(element){
  9565. return Form.Validator.getValidator('IsEmpty').test(element) || (/^[\d() .:\-\+#]+$/.test(element.get('value')));
  9566. }
  9567. }],
  9568. ['validate-alpha', {
  9569. errorMsg: Form.Validator.getMsg.pass('alpha'),
  9570. test: function(element){
  9571. return Form.Validator.getValidator('IsEmpty').test(element) || (/^[a-zA-Z]+$/).test(element.get('value'));
  9572. }
  9573. }],
  9574. ['validate-alphanum', {
  9575. errorMsg: Form.Validator.getMsg.pass('alphanum'),
  9576. test: function(element){
  9577. return Form.Validator.getValidator('IsEmpty').test(element) || !(/\W/).test(element.get('value'));
  9578. }
  9579. }],
  9580. ['validate-date', {
  9581. errorMsg: function(element, props){
  9582. if (Date.parse){
  9583. var format = props.dateFormat || '%x';
  9584. return Form.Validator.getMsg('dateSuchAs').substitute({date: new Date().format(format)});
  9585. } else {
  9586. return Form.Validator.getMsg('dateInFormatMDY');
  9587. }
  9588. },
  9589. test: function(element, props){
  9590. if (Form.Validator.getValidator('IsEmpty').test(element)) return true;
  9591. var dateLocale = Locale.get('Date'),
  9592. dateNouns = new RegExp([dateLocale.days, dateLocale.days_abbr, dateLocale.months, dateLocale.months_abbr, dateLocale.AM, dateLocale.PM].flatten().join('|'), 'i'),
  9593. value = element.get('value'),
  9594. wordsInValue = value.match(/[a-z]+/gi);
  9595. if (wordsInValue && !wordsInValue.every(dateNouns.exec, dateNouns)) return false;
  9596. var date = Date.parse(value);
  9597. if (!date) return false;
  9598. var format = props.dateFormat || '%x',
  9599. formatted = date.format(format);
  9600. if (formatted != 'invalid date') element.set('value', formatted);
  9601. return date.isValid();
  9602. }
  9603. }],
  9604. ['validate-email', {
  9605. errorMsg: Form.Validator.getMsg.pass('email'),
  9606. test: function(element){
  9607. /*
  9608. var chars = "[a-z0-9!#$%&'*+/=?^_`{|}~-]",
  9609. local = '(?:' + chars + '\\.?){0,63}' + chars,
  9610. label = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?',
  9611. hostname = '(?:' + label + '\\.)*' + label;
  9612. octet = '(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',
  9613. ipv4 = '\\[(?:' + octet + '\\.){3}' + octet + '\\]',
  9614. domain = '(?:' + hostname + '|' + ipv4 + ')';
  9615. var regex = new RegExp('^' + local + '@' + domain + '$', 'i');
  9616. */
  9617. 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'));
  9618. }
  9619. }],
  9620. ['validate-url', {
  9621. errorMsg: Form.Validator.getMsg.pass('url'),
  9622. test: function(element){
  9623. 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'));
  9624. }
  9625. }],
  9626. ['validate-currency-dollar', {
  9627. errorMsg: Form.Validator.getMsg.pass('currencyDollar'),
  9628. test: function(element){
  9629. 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'));
  9630. }
  9631. }],
  9632. ['validate-one-required', {
  9633. errorMsg: Form.Validator.getMsg.pass('oneRequired'),
  9634. test: function(element, props){
  9635. var p = document.id(props['validate-one-required']) || element.getParent(props['validate-one-required']);
  9636. return p.getElements('input').some(function(el){
  9637. if (['checkbox', 'radio'].contains(el.get('type'))) return el.get('checked');
  9638. return el.get('value');
  9639. });
  9640. }
  9641. }]
  9642. ]);
  9643. Element.Properties.validator = {
  9644. set: function(options){
  9645. this.get('validator').setOptions(options);
  9646. },
  9647. get: function(){
  9648. var validator = this.retrieve('validator');
  9649. if (!validator){
  9650. validator = new Form.Validator(this);
  9651. this.store('validator', validator);
  9652. }
  9653. return validator;
  9654. }
  9655. };
  9656. Element.implement({
  9657. validate: function(options){
  9658. if (options) this.set('validator', options);
  9659. return this.get('validator').validate();
  9660. }
  9661. });
  9662. //<1.2compat>
  9663. //legacy
  9664. var FormValidator = Form.Validator;
  9665. //</1.2compat>
  9666. /*
  9667. ---
  9668. script: Form.Validator.Extras.js
  9669. name: Form.Validator.Extras
  9670. description: Additional validators for the Form.Validator class.
  9671. license: MIT-style license
  9672. authors:
  9673. - Aaron Newton
  9674. requires:
  9675. - Form.Validator
  9676. provides: [Form.Validator.Extras]
  9677. ...
  9678. */
  9679. (function(){
  9680. function getItems(props, preference, children, cssSelector){
  9681. if (preference && props[preference]) return props[preference];
  9682. var el = document.id(props[children]);
  9683. if (!el) return [];
  9684. return el.getElements(cssSelector);
  9685. }
  9686. Form.Validator.addAllThese([
  9687. ['validate-enforce-oncheck', {
  9688. test: function(element, props){
  9689. var fv = element.getParent('form').retrieve('validator');
  9690. if (!fv) return true;
  9691. getItems(props, 'toEnforce', 'enforceChildrenOf', 'input, select, textarea').each(function(item){
  9692. if (element.checked){
  9693. fv.enforceField(item);
  9694. } else {
  9695. fv.ignoreField(item);
  9696. fv.resetField(item);
  9697. }
  9698. });
  9699. return true;
  9700. }
  9701. }],
  9702. ['validate-ignore-oncheck', {
  9703. test: function(element, props){
  9704. var fv = element.getParent('form').retrieve('validator');
  9705. if (!fv) return true;
  9706. getItems(props, 'toIgnore', 'ignoreChildrenOf', 'input, select, textarea').each(function(item){
  9707. if (element.checked){
  9708. fv.ignoreField(item);
  9709. fv.resetField(item);
  9710. } else {
  9711. fv.enforceField(item);
  9712. }
  9713. });
  9714. return true;
  9715. }
  9716. }],
  9717. ['validate-enforce-onselect-value', {
  9718. test: function(element, props){
  9719. if (!props.value) return true;
  9720. var fv = element.getParent('form').retrieve('validator');
  9721. if (!fv) return true;
  9722. getItems(props, 'toEnforce', 'enforceChildrenOf', 'input, select, textarea').each(function(item){
  9723. if (props.value == element.value){
  9724. fv.enforceField(item);
  9725. } else {
  9726. fv.ignoreField(item);
  9727. fv.resetField(item);
  9728. }
  9729. });
  9730. return true;
  9731. }
  9732. }],
  9733. ['validate-nospace', {
  9734. errorMsg: function(){
  9735. return Form.Validator.getMsg('noSpace');
  9736. },
  9737. test: function(element, props){
  9738. return !element.get('value').test(/\s/);
  9739. }
  9740. }],
  9741. ['validate-toggle-oncheck', {
  9742. test: function(element, props){
  9743. var fv = element.getParent('form').retrieve('validator');
  9744. if (!fv) return true;
  9745. var eleArr = getItems(props, 'toToggle', 'toToggleChildrenOf', 'input, select, textarea');
  9746. if (!element.checked){
  9747. eleArr.each(function(item){
  9748. fv.ignoreField(item);
  9749. fv.resetField(item);
  9750. });
  9751. } else {
  9752. eleArr.each(function(item){
  9753. fv.enforceField(item);
  9754. });
  9755. }
  9756. return true;
  9757. }
  9758. }],
  9759. ['validate-reqchk-bynode', {
  9760. errorMsg: function(){
  9761. return Form.Validator.getMsg('reqChkByNode');
  9762. },
  9763. test: function(element, props){
  9764. return getItems(props, false, 'nodeId', props.selector || 'input[type=checkbox], input[type=radio]').some(function(item){
  9765. return item.checked;
  9766. });
  9767. }
  9768. }],
  9769. ['validate-required-check', {
  9770. errorMsg: function(element, props){
  9771. return props.useTitle ? element.get('title') : Form.Validator.getMsg('requiredChk');
  9772. },
  9773. test: function(element, props){
  9774. return !!element.checked;
  9775. }
  9776. }],
  9777. ['validate-reqchk-byname', {
  9778. errorMsg: function(element, props){
  9779. return Form.Validator.getMsg('reqChkByName').substitute({label: props.label || element.get('type')});
  9780. },
  9781. test: function(element, props){
  9782. var grpName = props.groupName || element.get('name');
  9783. var grpNameEls = $$('[name=' + grpName +']');
  9784. var oneCheckedItem = grpNameEls.some(function(item, index){
  9785. return item.checked;
  9786. });
  9787. var fv = element.getParent('form').retrieve('validator');
  9788. if (oneCheckedItem && fv){
  9789. grpNameEls.each(function(item, index){ fv.resetField(item); });
  9790. }
  9791. return oneCheckedItem;
  9792. }
  9793. }],
  9794. ['validate-match', {
  9795. errorMsg: function(element, props){
  9796. return Form.Validator.getMsg('match').substitute({matchName: decodeURIComponent((props.matchName+'').replace(/\+/g, '%20')) || document.id(props.matchInput).get('name')});
  9797. },
  9798. test: function(element, props){
  9799. var eleVal = element.get('value');
  9800. var matchVal = document.id(props.matchInput) && document.id(props.matchInput).get('value');
  9801. return eleVal && matchVal ? eleVal == matchVal : true;
  9802. }
  9803. }],
  9804. ['validate-after-date', {
  9805. errorMsg: function(element, props){
  9806. return Form.Validator.getMsg('afterDate').substitute({
  9807. label: props.afterLabel || (props.afterElement ? Form.Validator.getMsg('startDate') : Form.Validator.getMsg('currentDate'))
  9808. });
  9809. },
  9810. test: function(element, props){
  9811. var start = document.id(props.afterElement) ? Date.parse(document.id(props.afterElement).get('value')) : new Date();
  9812. var end = Date.parse(element.get('value'));
  9813. return end && start ? end >= start : true;
  9814. }
  9815. }],
  9816. ['validate-before-date', {
  9817. errorMsg: function(element, props){
  9818. return Form.Validator.getMsg('beforeDate').substitute({
  9819. label: props.beforeLabel || (props.beforeElement ? Form.Validator.getMsg('endDate') : Form.Validator.getMsg('currentDate'))
  9820. });
  9821. },
  9822. test: function(element, props){
  9823. var start = Date.parse(element.get('value'));
  9824. var end = document.id(props.beforeElement) ? Date.parse(document.id(props.beforeElement).get('value')) : new Date();
  9825. return end && start ? end >= start : true;
  9826. }
  9827. }],
  9828. ['validate-custom-required', {
  9829. errorMsg: function(){
  9830. return Form.Validator.getMsg('required');
  9831. },
  9832. test: function(element, props){
  9833. return element.get('value') != props.emptyValue;
  9834. }
  9835. }],
  9836. ['validate-same-month', {
  9837. errorMsg: function(element, props){
  9838. var startMo = document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value');
  9839. var eleVal = element.get('value');
  9840. if (eleVal != '') return Form.Validator.getMsg(startMo ? 'sameMonth' : 'startMonth');
  9841. },
  9842. test: function(element, props){
  9843. var d1 = Date.parse(element.get('value'));
  9844. var d2 = Date.parse(document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value'));
  9845. return d1 && d2 ? d1.format('%B') == d2.format('%B') : true;
  9846. }
  9847. }],
  9848. ['validate-cc-num', {
  9849. errorMsg: function(element){
  9850. var ccNum = element.get('value').replace(/[^0-9]/g, '');
  9851. return Form.Validator.getMsg('creditcard').substitute({length: ccNum.length});
  9852. },
  9853. test: function(element){
  9854. // required is a different test
  9855. if (Form.Validator.getValidator('IsEmpty').test(element)) return true;
  9856. // Clean number value
  9857. var ccNum = element.get('value');
  9858. ccNum = ccNum.replace(/[^0-9]/g, '');
  9859. var validType = false;
  9860. if (ccNum.test(/^4[0-9]{12}([0-9]{3})?$/)) validType = 'Visa';
  9861. else if (ccNum.test(/^5[1-5]([0-9]{14})$/)) validType = 'Master Card';
  9862. else if (ccNum.test(/^3[47][0-9]{13}$/)) validType = 'American Express';
  9863. else if (ccNum.test(/^6(?:011|5[0-9]{2})[0-9]{12}$/)) validType = 'Discover';
  9864. else if (ccNum.test(/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/)) validType = 'Diners Club';
  9865. if (validType){
  9866. var sum = 0;
  9867. var cur = 0;
  9868. for (var i=ccNum.length-1; i>=0; --i){
  9869. cur = ccNum.charAt(i).toInt();
  9870. if (cur == 0) continue;
  9871. if ((ccNum.length-i) % 2 == 0) cur += cur;
  9872. if (cur > 9){
  9873. cur = cur.toString().charAt(0).toInt() + cur.toString().charAt(1).toInt();
  9874. }
  9875. sum += cur;
  9876. }
  9877. if ((sum % 10) == 0) return true;
  9878. }
  9879. var chunks = '';
  9880. while (ccNum != ''){
  9881. chunks += ' ' + ccNum.substr(0,4);
  9882. ccNum = ccNum.substr(4);
  9883. }
  9884. element.getParent('form').retrieve('validator').ignoreField(element);
  9885. element.set('value', chunks.clean());
  9886. element.getParent('form').retrieve('validator').enforceField(element);
  9887. return false;
  9888. }
  9889. }]
  9890. ]);
  9891. })();
  9892. /*
  9893. ---
  9894. script: Form.Validator.Inline.js
  9895. name: Form.Validator.Inline
  9896. description: Extends Form.Validator to add inline messages.
  9897. license: MIT-style license
  9898. authors:
  9899. - Aaron Newton
  9900. requires:
  9901. - Form.Validator
  9902. provides: [Form.Validator.Inline]
  9903. ...
  9904. */
  9905. Form.Validator.Inline = new Class({
  9906. Extends: Form.Validator,
  9907. options: {
  9908. showError: function(errorElement){
  9909. if (errorElement.reveal) errorElement.reveal();
  9910. else errorElement.setStyle('display', 'block');
  9911. },
  9912. hideError: function(errorElement){
  9913. if (errorElement.dissolve) errorElement.dissolve();
  9914. else errorElement.setStyle('display', 'none');
  9915. },
  9916. scrollToErrorsOnSubmit: true,
  9917. scrollToErrorsOnBlur: false,
  9918. scrollToErrorsOnChange: false,
  9919. scrollFxOptions: {
  9920. transition: 'quad:out',
  9921. offset: {
  9922. y: -20
  9923. }
  9924. }
  9925. },
  9926. initialize: function(form, options){
  9927. this.parent(form, options);
  9928. this.addEvent('onElementValidate', function(isValid, field, className, warn){
  9929. var validator = this.getValidator(className);
  9930. if (!isValid && validator.getError(field)){
  9931. if (warn) field.addClass('warning');
  9932. var advice = this.makeAdvice(className, field, validator.getError(field), warn);
  9933. this.insertAdvice(advice, field);
  9934. this.showAdvice(className, field);
  9935. } else {
  9936. this.hideAdvice(className, field);
  9937. }
  9938. });
  9939. },
  9940. makeAdvice: function(className, field, error, warn){
  9941. var errorMsg = (warn) ? this.warningPrefix : this.errorPrefix;
  9942. errorMsg += (this.options.useTitles) ? field.title || error:error;
  9943. var cssClass = (warn) ? 'warning-advice' : 'validation-advice';
  9944. var advice = this.getAdvice(className, field);
  9945. if (advice){
  9946. advice = advice.set('html', errorMsg);
  9947. } else {
  9948. advice = new Element('div', {
  9949. html: errorMsg,
  9950. styles: { display: 'none' },
  9951. id: 'advice-' + className.split(':')[0] + '-' + this.getFieldId(field)
  9952. }).addClass(cssClass);
  9953. }
  9954. field.store('$moo:advice-' + className, advice);
  9955. return advice;
  9956. },
  9957. getFieldId : function(field){
  9958. return field.id ? field.id : field.id = 'input_' + field.name;
  9959. },
  9960. showAdvice: function(className, field){
  9961. var advice = this.getAdvice(className, field);
  9962. if (
  9963. advice &&
  9964. !field.retrieve('$moo:' + this.getPropName(className)) &&
  9965. (
  9966. advice.getStyle('display') == 'none' ||
  9967. advice.getStyle('visibility') == 'hidden' ||
  9968. advice.getStyle('opacity') == 0
  9969. )
  9970. ){
  9971. field.store('$moo:' + this.getPropName(className), true);
  9972. this.options.showError(advice);
  9973. this.fireEvent('showAdvice', [field, advice, className]);
  9974. }
  9975. },
  9976. hideAdvice: function(className, field){
  9977. var advice = this.getAdvice(className, field);
  9978. if (advice && field.retrieve('$moo:' + this.getPropName(className))){
  9979. field.store('$moo:' + this.getPropName(className), false);
  9980. this.options.hideError(advice);
  9981. this.fireEvent('hideAdvice', [field, advice, className]);
  9982. }
  9983. },
  9984. getPropName: function(className){
  9985. return 'advice' + className;
  9986. },
  9987. resetField: function(field){
  9988. field = document.id(field);
  9989. if (!field) return this;
  9990. this.parent(field);
  9991. field.get('validators').each(function(className){
  9992. this.hideAdvice(className, field);
  9993. }, this);
  9994. return this;
  9995. },
  9996. getAllAdviceMessages: function(field, force){
  9997. var advice = [];
  9998. if (field.hasClass('ignoreValidation') && !force) return advice;
  9999. var validators = field.get('validators').some(function(cn){
  10000. var warner = cn.test('^warn-') || field.hasClass('warnOnly');
  10001. if (warner) cn = cn.replace(/^warn-/, '');
  10002. var validator = this.getValidator(cn);
  10003. if (!validator) return;
  10004. advice.push({
  10005. message: validator.getError(field),
  10006. warnOnly: warner,
  10007. passed: validator.test(),
  10008. validator: validator
  10009. });
  10010. }, this);
  10011. return advice;
  10012. },
  10013. getAdvice: function(className, field){
  10014. return field.retrieve('$moo:advice-' + className);
  10015. },
  10016. insertAdvice: function(advice, field){
  10017. //Check for error position prop
  10018. var props = field.get('validatorProps');
  10019. //Build advice
  10020. if (!props.msgPos || !document.id(props.msgPos)){
  10021. if (field.type && field.type.toLowerCase() == 'radio') field.getParent().adopt(advice);
  10022. else advice.inject(document.id(field), 'after');
  10023. } else {
  10024. document.id(props.msgPos).grab(advice);
  10025. }
  10026. },
  10027. validateField: function(field, force, scroll){
  10028. var result = this.parent(field, force);
  10029. if (((this.options.scrollToErrorsOnSubmit && scroll == null) || scroll) && !result){
  10030. var failed = document.id(this).getElement('.validation-failed');
  10031. var par = document.id(this).getParent();
  10032. while (par != document.body && par.getScrollSize().y == par.getSize().y){
  10033. par = par.getParent();
  10034. }
  10035. var fx = par.retrieve('$moo:fvScroller');
  10036. if (!fx && window.Fx && Fx.Scroll){
  10037. fx = new Fx.Scroll(par, this.options.scrollFxOptions);
  10038. par.store('$moo:fvScroller', fx);
  10039. }
  10040. if (failed){
  10041. if (fx) fx.toElement(failed);
  10042. else par.scrollTo(par.getScroll().x, failed.getPosition(par).y - 20);
  10043. }
  10044. }
  10045. return result;
  10046. },
  10047. watchFields: function(fields){
  10048. fields.each(function(el){
  10049. if (this.options.evaluateFieldsOnBlur){
  10050. el.addEvent('blur', this.validationMonitor.pass([el, false, this.options.scrollToErrorsOnBlur], this));
  10051. }
  10052. if (this.options.evaluateFieldsOnChange){
  10053. el.addEvent('change', this.validationMonitor.pass([el, true, this.options.scrollToErrorsOnChange], this));
  10054. }
  10055. }, this);
  10056. }
  10057. });
  10058. /*
  10059. ---
  10060. script: OverText.js
  10061. name: OverText
  10062. description: Shows text over an input that disappears when the user clicks into it. The text remains hidden if the user adds a value.
  10063. license: MIT-style license
  10064. authors:
  10065. - Aaron Newton
  10066. requires:
  10067. - Core/Options
  10068. - Core/Events
  10069. - Core/Element.Event
  10070. - Class.Binds
  10071. - Class.Occlude
  10072. - Element.Position
  10073. - Element.Shortcuts
  10074. provides: [OverText]
  10075. ...
  10076. */
  10077. (function(){
  10078. var OverText = this.OverText = new Class({
  10079. Implements: [Options, Events, Class.Occlude],
  10080. Binds: ['reposition', 'assert', 'focus', 'hide'],
  10081. options: {/*
  10082. textOverride: null,
  10083. onFocus: function(){},
  10084. onTextHide: function(textEl, inputEl){},
  10085. onTextShow: function(textEl, inputEl){}, */
  10086. element: 'label',
  10087. labelClass: 'overTxtLabel',
  10088. positionOptions: {
  10089. position: 'upperLeft',
  10090. edge: 'upperLeft',
  10091. offset: {
  10092. x: 4,
  10093. y: 2
  10094. }
  10095. },
  10096. poll: false,
  10097. pollInterval: 250,
  10098. wrap: false
  10099. },
  10100. property: 'OverText',
  10101. initialize: function(element, options){
  10102. element = this.element = document.id(element);
  10103. if (this.occlude()) return this.occluded;
  10104. this.setOptions(options);
  10105. this.attach(element);
  10106. OverText.instances.push(this);
  10107. if (this.options.poll) this.poll();
  10108. },
  10109. toElement: function(){
  10110. return this.element;
  10111. },
  10112. attach: function(){
  10113. var element = this.element,
  10114. options = this.options,
  10115. value = options.textOverride || element.get('alt') || element.get('title');
  10116. if (!value) return this;
  10117. var text = this.text = new Element(options.element, {
  10118. 'class': options.labelClass,
  10119. styles: {
  10120. lineHeight: 'normal',
  10121. position: 'absolute',
  10122. cursor: 'text'
  10123. },
  10124. html: value,
  10125. events: {
  10126. click: this.hide.pass(options.element == 'label', this)
  10127. }
  10128. }).inject(element, 'after');
  10129. if (options.element == 'label'){
  10130. if (!element.get('id')) element.set('id', 'input_' + String.uniqueID());
  10131. text.set('for', element.get('id'));
  10132. }
  10133. if (options.wrap){
  10134. this.textHolder = new Element('div.overTxtWrapper', {
  10135. styles: {
  10136. lineHeight: 'normal',
  10137. position: 'relative'
  10138. }
  10139. }).grab(text).inject(element, 'before');
  10140. }
  10141. return this.enable();
  10142. },
  10143. destroy: function(){
  10144. this.element.eliminate(this.property); // Class.Occlude storage
  10145. this.disable();
  10146. if (this.text) this.text.destroy();
  10147. if (this.textHolder) this.textHolder.destroy();
  10148. return this;
  10149. },
  10150. disable: function(){
  10151. this.element.removeEvents({
  10152. focus: this.focus,
  10153. blur: this.assert,
  10154. change: this.assert
  10155. });
  10156. window.removeEvent('resize', this.reposition);
  10157. this.hide(true, true);
  10158. return this;
  10159. },
  10160. enable: function(){
  10161. this.element.addEvents({
  10162. focus: this.focus,
  10163. blur: this.assert,
  10164. change: this.assert
  10165. });
  10166. window.addEvent('resize', this.reposition);
  10167. this.reposition();
  10168. return this;
  10169. },
  10170. wrap: function(){
  10171. if (this.options.element == 'label'){
  10172. if (!this.element.get('id')) this.element.set('id', 'input_' + String.uniqueID());
  10173. this.text.set('for', this.element.get('id'));
  10174. }
  10175. },
  10176. startPolling: function(){
  10177. this.pollingPaused = false;
  10178. return this.poll();
  10179. },
  10180. poll: function(stop){
  10181. //start immediately
  10182. //pause on focus
  10183. //resumeon blur
  10184. if (this.poller && !stop) return this;
  10185. if (stop){
  10186. clearInterval(this.poller);
  10187. } else {
  10188. this.poller = (function(){
  10189. if (!this.pollingPaused) this.assert(true);
  10190. }).periodical(this.options.pollInterval, this);
  10191. }
  10192. return this;
  10193. },
  10194. stopPolling: function(){
  10195. this.pollingPaused = true;
  10196. return this.poll(true);
  10197. },
  10198. focus: function(){
  10199. if (this.text && (!this.text.isDisplayed() || this.element.get('disabled'))) return this;
  10200. return this.hide();
  10201. },
  10202. hide: function(suppressFocus, force){
  10203. if (this.text && (this.text.isDisplayed() && (!this.element.get('disabled') || force))){
  10204. this.text.hide();
  10205. this.fireEvent('textHide', [this.text, this.element]);
  10206. this.pollingPaused = true;
  10207. if (!suppressFocus){
  10208. try {
  10209. this.element.fireEvent('focus');
  10210. this.element.focus();
  10211. } catch (e){} //IE barfs if you call focus on hidden elements
  10212. }
  10213. }
  10214. return this;
  10215. },
  10216. show: function(){
  10217. if (document.id(this.text) && !this.text.isDisplayed()){
  10218. this.text.show();
  10219. this.reposition();
  10220. this.fireEvent('textShow', [this.text, this.element]);
  10221. this.pollingPaused = false;
  10222. }
  10223. return this;
  10224. },
  10225. test: function(){
  10226. return !this.element.get('value');
  10227. },
  10228. assert: function(suppressFocus){
  10229. return this[this.test() ? 'show' : 'hide'](suppressFocus);
  10230. },
  10231. reposition: function(){
  10232. this.assert(true);
  10233. if (!this.element.isVisible()) return this.stopPolling().hide();
  10234. if (this.text && this.test()){
  10235. this.text.position(Object.merge(this.options.positionOptions, {
  10236. relativeTo: this.element
  10237. }));
  10238. }
  10239. return this;
  10240. }
  10241. });
  10242. })();
  10243. OverText.instances = [];
  10244. Object.append(OverText, {
  10245. each: function(fn){
  10246. return OverText.instances.each(function(ot, i){
  10247. if (ot.element && ot.text) fn.call(OverText, ot, i);
  10248. });
  10249. },
  10250. update: function(){
  10251. return OverText.each(function(ot){
  10252. return ot.reposition();
  10253. });
  10254. },
  10255. hideAll: function(){
  10256. return OverText.each(function(ot){
  10257. return ot.hide(true, true);
  10258. });
  10259. },
  10260. showAll: function(){
  10261. return OverText.each(function(ot){
  10262. return ot.show();
  10263. });
  10264. }
  10265. });
  10266. /*
  10267. ---
  10268. script: Fx.Elements.js
  10269. name: Fx.Elements
  10270. description: Effect to change any number of CSS properties of any number of Elements.
  10271. license: MIT-style license
  10272. authors:
  10273. - Valerio Proietti
  10274. requires:
  10275. - Core/Fx.CSS
  10276. - MooTools.More
  10277. provides: [Fx.Elements]
  10278. ...
  10279. */
  10280. Fx.Elements = new Class({
  10281. Extends: Fx.CSS,
  10282. initialize: function(elements, options){
  10283. this.elements = this.subject = $$(elements);
  10284. this.parent(options);
  10285. },
  10286. compute: function(from, to, delta){
  10287. var now = {};
  10288. for (var i in from){
  10289. var iFrom = from[i], iTo = to[i], iNow = now[i] = {};
  10290. for (var p in iFrom) iNow[p] = this.parent(iFrom[p], iTo[p], delta);
  10291. }
  10292. return now;
  10293. },
  10294. set: function(now){
  10295. for (var i in now){
  10296. if (!this.elements[i]) continue;
  10297. var iNow = now[i];
  10298. for (var p in iNow) this.render(this.elements[i], p, iNow[p], this.options.unit);
  10299. }
  10300. return this;
  10301. },
  10302. start: function(obj){
  10303. if (!this.check(obj)) return this;
  10304. var from = {}, to = {};
  10305. for (var i in obj){
  10306. if (!this.elements[i]) continue;
  10307. var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {};
  10308. for (var p in iProps){
  10309. var parsed = this.prepare(this.elements[i], p, iProps[p]);
  10310. iFrom[p] = parsed.from;
  10311. iTo[p] = parsed.to;
  10312. }
  10313. }
  10314. return this.parent(from, to);
  10315. }
  10316. });
  10317. /*
  10318. ---
  10319. script: Fx.Accordion.js
  10320. name: Fx.Accordion
  10321. description: An Fx.Elements extension which allows you to easily create accordion type controls.
  10322. license: MIT-style license
  10323. authors:
  10324. - Valerio Proietti
  10325. requires:
  10326. - Core/Element.Event
  10327. - Fx.Elements
  10328. provides: [Fx.Accordion]
  10329. ...
  10330. */
  10331. Fx.Accordion = new Class({
  10332. Extends: Fx.Elements,
  10333. options: {/*
  10334. onActive: function(toggler, section){},
  10335. onBackground: function(toggler, section){},*/
  10336. fixedHeight: false,
  10337. fixedWidth: false,
  10338. display: 0,
  10339. show: false,
  10340. height: true,
  10341. width: false,
  10342. opacity: true,
  10343. alwaysHide: false,
  10344. trigger: 'click',
  10345. initialDisplayFx: true,
  10346. resetHeight: true,
  10347. keepOpen: false
  10348. },
  10349. initialize: function(){
  10350. var defined = function(obj){
  10351. return obj != null;
  10352. };
  10353. var params = Array.link(arguments, {
  10354. 'container': Type.isElement, //deprecated
  10355. 'options': Type.isObject,
  10356. 'togglers': defined,
  10357. 'elements': defined
  10358. });
  10359. this.parent(params.elements, params.options);
  10360. var options = this.options,
  10361. togglers = this.togglers = $$(params.togglers);
  10362. this.previous = -1;
  10363. this.internalChain = new Chain();
  10364. if (options.alwaysHide) this.options.link = 'chain';
  10365. if (options.show || this.options.show === 0){
  10366. options.display = false;
  10367. this.previous = options.show;
  10368. }
  10369. if (options.start){
  10370. options.display = false;
  10371. options.show = false;
  10372. }
  10373. var effects = this.effects = {};
  10374. if (options.opacity) effects.opacity = 'fullOpacity';
  10375. if (options.width) effects.width = options.fixedWidth ? 'fullWidth' : 'offsetWidth';
  10376. if (options.height) effects.height = options.fixedHeight ? 'fullHeight' : 'scrollHeight';
  10377. for (var i = 0, l = togglers.length; i < l; i++) this.addSection(togglers[i], this.elements[i]);
  10378. this.elements.each(function(el, i){
  10379. if (options.show === i){
  10380. this.fireEvent('active', [togglers[i], el]);
  10381. } else {
  10382. for (var fx in effects) el.setStyle(fx, 0);
  10383. }
  10384. }, this);
  10385. if (options.display || options.display === 0 || options.initialDisplayFx === false){
  10386. this.display(options.display, options.initialDisplayFx);
  10387. }
  10388. if (options.fixedHeight !== false) options.resetHeight = false;
  10389. this.addEvent('complete', this.internalChain.callChain.bind(this.internalChain));
  10390. },
  10391. addSection: function(toggler, element){
  10392. toggler = document.id(toggler);
  10393. element = document.id(element);
  10394. this.togglers.include(toggler);
  10395. this.elements.include(element);
  10396. var togglers = this.togglers,
  10397. options = this.options,
  10398. test = togglers.contains(toggler),
  10399. idx = togglers.indexOf(toggler),
  10400. displayer = this.display.pass(idx, this);
  10401. toggler.store('accordion:display', displayer)
  10402. .addEvent(options.trigger, displayer);
  10403. if (options.height) element.setStyles({'padding-top': 0, 'border-top': 'none', 'padding-bottom': 0, 'border-bottom': 'none'});
  10404. if (options.width) element.setStyles({'padding-left': 0, 'border-left': 'none', 'padding-right': 0, 'border-right': 'none'});
  10405. element.fullOpacity = 1;
  10406. if (options.fixedWidth) element.fullWidth = options.fixedWidth;
  10407. if (options.fixedHeight) element.fullHeight = options.fixedHeight;
  10408. element.setStyle('overflow', 'hidden');
  10409. if (!test) for (var fx in this.effects){
  10410. element.setStyle(fx, 0);
  10411. }
  10412. return this;
  10413. },
  10414. removeSection: function(toggler, displayIndex){
  10415. var togglers = this.togglers,
  10416. idx = togglers.indexOf(toggler),
  10417. element = this.elements[idx];
  10418. var remover = function(){
  10419. togglers.erase(toggler);
  10420. this.elements.erase(element);
  10421. this.detach(toggler);
  10422. }.bind(this);
  10423. if (this.now == idx || displayIndex != null){
  10424. this.display(displayIndex != null ? displayIndex : (idx - 1 >= 0 ? idx - 1 : 0)).chain(remover);
  10425. } else {
  10426. remover();
  10427. }
  10428. return this;
  10429. },
  10430. detach: function(toggler){
  10431. var remove = function(toggler){
  10432. toggler.removeEvent(this.options.trigger, toggler.retrieve('accordion:display'));
  10433. }.bind(this);
  10434. if (!toggler) this.togglers.each(remove);
  10435. else remove(toggler);
  10436. return this;
  10437. },
  10438. display: function(index, useFx){
  10439. if (!this.check(index, useFx)) return this;
  10440. var obj = {},
  10441. elements = this.elements,
  10442. options = this.options,
  10443. effects = this.effects,
  10444. keepOpen = options.keepOpen,
  10445. alwaysHide = options.alwaysHide;
  10446. if (useFx == null) useFx = true;
  10447. if (typeOf(index) == 'element') index = elements.indexOf(index);
  10448. if (index == this.current && !alwaysHide && !keepOpen) return this;
  10449. if (options.resetHeight){
  10450. var prev = elements[this.current];
  10451. if (prev && !this.selfHidden){
  10452. for (var fx in effects) prev.setStyle(fx, prev[effects[fx]]);
  10453. }
  10454. }
  10455. if (this.timer && options.link == 'chain') return this;
  10456. if (this.current != null) this.previous = this.current;
  10457. this.current = index;
  10458. this.selfHidden = false;
  10459. elements.each(function(el, i){
  10460. obj[i] = {};
  10461. var hide, isOpen;
  10462. if (!keepOpen || i == index){
  10463. if (i == index) isOpen = (el.offsetHeight > 0 && options.height) || (el.offsetWidth > 0 && options.width);
  10464. if (i != index){
  10465. hide = true;
  10466. } else if ((alwaysHide || keepOpen) && isOpen){
  10467. hide = true;
  10468. this.selfHidden = true;
  10469. }
  10470. this.fireEvent(hide ? 'background' : 'active', [this.togglers[i], el]);
  10471. for (var fx in effects) obj[i][fx] = hide ? 0 : el[effects[fx]];
  10472. if (!useFx && !hide && options.resetHeight) obj[i].height = 'auto';
  10473. }
  10474. }, this);
  10475. this.internalChain.clearChain();
  10476. this.internalChain.chain(function(){
  10477. if (options.resetHeight && !this.selfHidden){
  10478. var el = elements[index];
  10479. if (el) el.setStyle('height', 'auto');
  10480. }
  10481. }.bind(this));
  10482. return useFx ? this.start(obj) : this.set(obj).internalChain.callChain();
  10483. }
  10484. });
  10485. /*<1.2compat>*/
  10486. /*
  10487. Compatibility with 1.2.0
  10488. */
  10489. var Accordion = new Class({
  10490. Extends: Fx.Accordion,
  10491. initialize: function(){
  10492. this.parent.apply(this, arguments);
  10493. var params = Array.link(arguments, {'container': Type.isElement});
  10494. this.container = params.container;
  10495. },
  10496. addSection: function(toggler, element, pos){
  10497. toggler = document.id(toggler);
  10498. element = document.id(element);
  10499. var test = this.togglers.contains(toggler);
  10500. var len = this.togglers.length;
  10501. if (len && (!test || pos)){
  10502. pos = pos != null ? pos : len - 1;
  10503. toggler.inject(this.togglers[pos], 'before');
  10504. element.inject(toggler, 'after');
  10505. } else if (this.container && !test){
  10506. toggler.inject(this.container);
  10507. element.inject(this.container);
  10508. }
  10509. return this.parent.apply(this, arguments);
  10510. }
  10511. });
  10512. /*</1.2compat>*/
  10513. /*
  10514. ---
  10515. script: Fx.Move.js
  10516. name: Fx.Move
  10517. description: Defines Fx.Move, a class that works with Element.Position.js to transition an element from one location to another.
  10518. license: MIT-style license
  10519. authors:
  10520. - Aaron Newton
  10521. requires:
  10522. - Core/Fx.Morph
  10523. - Element.Position
  10524. provides: [Fx.Move]
  10525. ...
  10526. */
  10527. Fx.Move = new Class({
  10528. Extends: Fx.Morph,
  10529. options: {
  10530. relativeTo: document.body,
  10531. position: 'center',
  10532. edge: false,
  10533. offset: {x: 0, y: 0}
  10534. },
  10535. start: function(destination){
  10536. var element = this.element,
  10537. topLeft = element.getStyles('top', 'left');
  10538. if (topLeft.top == 'auto' || topLeft.left == 'auto'){
  10539. element.setPosition(element.getPosition(element.getOffsetParent()));
  10540. }
  10541. return this.parent(element.position(Object.merge({}, this.options, destination, {returnPos: true})));
  10542. }
  10543. });
  10544. Element.Properties.move = {
  10545. set: function(options){
  10546. this.get('move').cancel().setOptions(options);
  10547. return this;
  10548. },
  10549. get: function(){
  10550. var move = this.retrieve('move');
  10551. if (!move){
  10552. move = new Fx.Move(this, {link: 'cancel'});
  10553. this.store('move', move);
  10554. }
  10555. return move;
  10556. }
  10557. };
  10558. Element.implement({
  10559. move: function(options){
  10560. this.get('move').start(options);
  10561. return this;
  10562. }
  10563. });
  10564. /*
  10565. ---
  10566. script: Fx.Scroll.js
  10567. name: Fx.Scroll
  10568. description: Effect to smoothly scroll any element, including the window.
  10569. license: MIT-style license
  10570. authors:
  10571. - Valerio Proietti
  10572. requires:
  10573. - Core/Fx
  10574. - Core/Element.Event
  10575. - Core/Element.Dimensions
  10576. - MooTools.More
  10577. provides: [Fx.Scroll]
  10578. ...
  10579. */
  10580. (function(){
  10581. Fx.Scroll = new Class({
  10582. Extends: Fx,
  10583. options: {
  10584. offset: {x: 0, y: 0},
  10585. wheelStops: true
  10586. },
  10587. initialize: function(element, options){
  10588. this.element = this.subject = document.id(element);
  10589. this.parent(options);
  10590. if (typeOf(this.element) != 'element') this.element = document.id(this.element.getDocument().body);
  10591. if (this.options.wheelStops){
  10592. var stopper = this.element,
  10593. cancel = this.cancel.pass(false, this);
  10594. this.addEvent('start', function(){
  10595. stopper.addEvent('mousewheel', cancel);
  10596. }, true);
  10597. this.addEvent('complete', function(){
  10598. stopper.removeEvent('mousewheel', cancel);
  10599. }, true);
  10600. }
  10601. },
  10602. set: function(){
  10603. var now = Array.flatten(arguments);
  10604. this.element.scrollTo(now[0], now[1]);
  10605. return this;
  10606. },
  10607. compute: function(from, to, delta){
  10608. return [0, 1].map(function(i){
  10609. return Fx.compute(from[i], to[i], delta);
  10610. });
  10611. },
  10612. start: function(x, y){
  10613. if (!this.check(x, y)) return this;
  10614. var scroll = this.element.getScroll();
  10615. return this.parent([scroll.x, scroll.y], [x, y]);
  10616. },
  10617. calculateScroll: function(x, y){
  10618. var element = this.element,
  10619. scrollSize = element.getScrollSize(),
  10620. scroll = element.getScroll(),
  10621. size = element.getSize(),
  10622. offset = this.options.offset,
  10623. values = {x: x, y: y};
  10624. for (var z in values){
  10625. if (!values[z] && values[z] !== 0) values[z] = scroll[z];
  10626. if (typeOf(values[z]) != 'number') values[z] = scrollSize[z] - size[z];
  10627. values[z] += offset[z];
  10628. }
  10629. return [values.x, values.y];
  10630. },
  10631. toTop: function(){
  10632. return this.start.apply(this, this.calculateScroll(false, 0));
  10633. },
  10634. toLeft: function(){
  10635. return this.start.apply(this, this.calculateScroll(0, false));
  10636. },
  10637. toRight: function(){
  10638. return this.start.apply(this, this.calculateScroll('right', false));
  10639. },
  10640. toBottom: function(){
  10641. return this.start.apply(this, this.calculateScroll(false, 'bottom'));
  10642. },
  10643. toElement: function(el, axes){
  10644. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10645. var scroll = isBody(this.element) ? {x: 0, y: 0} : this.element.getScroll();
  10646. var position = Object.map(document.id(el).getPosition(this.element), function(value, axis){
  10647. return axes.contains(axis) ? value + scroll[axis] : false;
  10648. });
  10649. return this.start.apply(this, this.calculateScroll(position.x, position.y));
  10650. },
  10651. toElementEdge: function(el, axes, offset){
  10652. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10653. el = document.id(el);
  10654. var to = {},
  10655. position = el.getPosition(this.element),
  10656. size = el.getSize(),
  10657. scroll = this.element.getScroll(),
  10658. containerSize = this.element.getSize(),
  10659. edge = {
  10660. x: position.x + size.x,
  10661. y: position.y + size.y
  10662. };
  10663. ['x', 'y'].each(function(axis){
  10664. if (axes.contains(axis)){
  10665. if (edge[axis] > scroll[axis] + containerSize[axis]) to[axis] = edge[axis] - containerSize[axis];
  10666. if (position[axis] < scroll[axis]) to[axis] = position[axis];
  10667. }
  10668. if (to[axis] == null) to[axis] = scroll[axis];
  10669. if (offset && offset[axis]) to[axis] = to[axis] + offset[axis];
  10670. }, this);
  10671. if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y);
  10672. return this;
  10673. },
  10674. toElementCenter: function(el, axes, offset){
  10675. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10676. el = document.id(el);
  10677. var to = {},
  10678. position = el.getPosition(this.element),
  10679. size = el.getSize(),
  10680. scroll = this.element.getScroll(),
  10681. containerSize = this.element.getSize();
  10682. ['x', 'y'].each(function(axis){
  10683. if (axes.contains(axis)){
  10684. to[axis] = position[axis] - (containerSize[axis] - size[axis]) / 2;
  10685. }
  10686. if (to[axis] == null) to[axis] = scroll[axis];
  10687. if (offset && offset[axis]) to[axis] = to[axis] + offset[axis];
  10688. }, this);
  10689. if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y);
  10690. return this;
  10691. }
  10692. });
  10693. //<1.2compat>
  10694. Fx.Scroll.implement({
  10695. scrollToCenter: function(){
  10696. return this.toElementCenter.apply(this, arguments);
  10697. },
  10698. scrollIntoView: function(){
  10699. return this.toElementEdge.apply(this, arguments);
  10700. }
  10701. });
  10702. //</1.2compat>
  10703. function isBody(element){
  10704. return (/^(?:body|html)$/i).test(element.tagName);
  10705. }
  10706. })();
  10707. /*
  10708. ---
  10709. script: Fx.Slide.js
  10710. name: Fx.Slide
  10711. description: Effect to slide an element in and out of view.
  10712. license: MIT-style license
  10713. authors:
  10714. - Valerio Proietti
  10715. requires:
  10716. - Core/Fx
  10717. - Core/Element.Style
  10718. - MooTools.More
  10719. provides: [Fx.Slide]
  10720. ...
  10721. */
  10722. Fx.Slide = new Class({
  10723. Extends: Fx,
  10724. options: {
  10725. mode: 'vertical',
  10726. wrapper: false,
  10727. hideOverflow: true,
  10728. resetHeight: false
  10729. },
  10730. initialize: function(element, options){
  10731. element = this.element = this.subject = document.id(element);
  10732. this.parent(options);
  10733. options = this.options;
  10734. var wrapper = element.retrieve('wrapper'),
  10735. styles = element.getStyles('margin', 'position', 'overflow');
  10736. if (options.hideOverflow) styles = Object.append(styles, {overflow: 'hidden'});
  10737. if (options.wrapper) wrapper = document.id(options.wrapper).setStyles(styles);
  10738. if (!wrapper) wrapper = new Element('div', {
  10739. styles: styles
  10740. }).wraps(element);
  10741. element.store('wrapper', wrapper).setStyle('margin', 0);
  10742. if (element.getStyle('overflow') == 'visible') element.setStyle('overflow', 'hidden');
  10743. this.now = [];
  10744. this.open = true;
  10745. this.wrapper = wrapper;
  10746. this.addEvent('complete', function(){
  10747. this.open = (wrapper['offset' + this.layout.capitalize()] != 0);
  10748. if (this.open && this.options.resetHeight) wrapper.setStyle('height', '');
  10749. }, true);
  10750. },
  10751. vertical: function(){
  10752. this.margin = 'margin-top';
  10753. this.layout = 'height';
  10754. this.offset = this.element.offsetHeight;
  10755. },
  10756. horizontal: function(){
  10757. this.margin = 'margin-left';
  10758. this.layout = 'width';
  10759. this.offset = this.element.offsetWidth;
  10760. },
  10761. set: function(now){
  10762. this.element.setStyle(this.margin, now[0]);
  10763. this.wrapper.setStyle(this.layout, now[1]);
  10764. return this;
  10765. },
  10766. compute: function(from, to, delta){
  10767. return [0, 1].map(function(i){
  10768. return Fx.compute(from[i], to[i], delta);
  10769. });
  10770. },
  10771. start: function(how, mode){
  10772. if (!this.check(how, mode)) return this;
  10773. this[mode || this.options.mode]();
  10774. var margin = this.element.getStyle(this.margin).toInt(),
  10775. layout = this.wrapper.getStyle(this.layout).toInt(),
  10776. caseIn = [[margin, layout], [0, this.offset]],
  10777. caseOut = [[margin, layout], [-this.offset, 0]],
  10778. start;
  10779. switch (how){
  10780. case 'in': start = caseIn; break;
  10781. case 'out': start = caseOut; break;
  10782. case 'toggle': start = (layout == 0) ? caseIn : caseOut;
  10783. }
  10784. return this.parent(start[0], start[1]);
  10785. },
  10786. slideIn: function(mode){
  10787. return this.start('in', mode);
  10788. },
  10789. slideOut: function(mode){
  10790. return this.start('out', mode);
  10791. },
  10792. hide: function(mode){
  10793. this[mode || this.options.mode]();
  10794. this.open = false;
  10795. return this.set([-this.offset, 0]);
  10796. },
  10797. show: function(mode){
  10798. this[mode || this.options.mode]();
  10799. this.open = true;
  10800. return this.set([0, this.offset]);
  10801. },
  10802. toggle: function(mode){
  10803. return this.start('toggle', mode);
  10804. }
  10805. });
  10806. Element.Properties.slide = {
  10807. set: function(options){
  10808. this.get('slide').cancel().setOptions(options);
  10809. return this;
  10810. },
  10811. get: function(){
  10812. var slide = this.retrieve('slide');
  10813. if (!slide){
  10814. slide = new Fx.Slide(this, {link: 'cancel'});
  10815. this.store('slide', slide);
  10816. }
  10817. return slide;
  10818. }
  10819. };
  10820. Element.implement({
  10821. slide: function(how, mode){
  10822. how = how || 'toggle';
  10823. var slide = this.get('slide'), toggle;
  10824. switch (how){
  10825. case 'hide': slide.hide(mode); break;
  10826. case 'show': slide.show(mode); break;
  10827. case 'toggle':
  10828. var flag = this.retrieve('slide:flag', slide.open);
  10829. slide[flag ? 'slideOut' : 'slideIn'](mode);
  10830. this.store('slide:flag', !flag);
  10831. toggle = true;
  10832. break;
  10833. default: slide.start(how, mode);
  10834. }
  10835. if (!toggle) this.eliminate('slide:flag');
  10836. return this;
  10837. }
  10838. });
  10839. /*
  10840. ---
  10841. script: Fx.SmoothScroll.js
  10842. name: Fx.SmoothScroll
  10843. description: Class for creating a smooth scrolling effect to all internal links on the page.
  10844. license: MIT-style license
  10845. authors:
  10846. - Valerio Proietti
  10847. requires:
  10848. - Core/Slick.Finder
  10849. - Fx.Scroll
  10850. provides: [Fx.SmoothScroll]
  10851. ...
  10852. */
  10853. /*<1.2compat>*/var SmoothScroll = /*</1.2compat>*/Fx.SmoothScroll = new Class({
  10854. Extends: Fx.Scroll,
  10855. options: {
  10856. axes: ['x', 'y']
  10857. },
  10858. initialize: function(options, context){
  10859. context = context || document;
  10860. this.doc = context.getDocument();
  10861. this.parent(this.doc, options);
  10862. var win = context.getWindow(),
  10863. location = win.location.href.match(/^[^#]*/)[0] + '#',
  10864. links = $$(this.options.links || this.doc.links);
  10865. links.each(function(link){
  10866. if (link.href.indexOf(location) != 0) return;
  10867. var anchor = link.href.substr(location.length);
  10868. if (anchor) this.useLink(link, anchor);
  10869. }, this);
  10870. this.addEvent('complete', function(){
  10871. win.location.hash = this.anchor;
  10872. this.element.scrollTo(this.to[0], this.to[1]);
  10873. }, true);
  10874. },
  10875. useLink: function(link, anchor){
  10876. link.addEvent('click', function(event){
  10877. var el = document.id(anchor) || this.doc.getElement('a[name=' + anchor + ']');
  10878. if (!el) return;
  10879. event.preventDefault();
  10880. this.toElement(el, this.options.axes).chain(function(){
  10881. this.fireEvent('scrolledTo', [link, el]);
  10882. }.bind(this));
  10883. this.anchor = anchor;
  10884. }.bind(this));
  10885. return this;
  10886. }
  10887. });
  10888. /*
  10889. ---
  10890. script: Fx.Sort.js
  10891. name: Fx.Sort
  10892. description: Defines Fx.Sort, a class that reorders lists with a transition.
  10893. license: MIT-style license
  10894. authors:
  10895. - Aaron Newton
  10896. requires:
  10897. - Core/Element.Dimensions
  10898. - Fx.Elements
  10899. - Element.Measure
  10900. provides: [Fx.Sort]
  10901. ...
  10902. */
  10903. Fx.Sort = new Class({
  10904. Extends: Fx.Elements,
  10905. options: {
  10906. mode: 'vertical'
  10907. },
  10908. initialize: function(elements, options){
  10909. this.parent(elements, options);
  10910. this.elements.each(function(el){
  10911. if (el.getStyle('position') == 'static') el.setStyle('position', 'relative');
  10912. });
  10913. this.setDefaultOrder();
  10914. },
  10915. setDefaultOrder: function(){
  10916. this.currentOrder = this.elements.map(function(el, index){
  10917. return index;
  10918. });
  10919. },
  10920. sort: function(){
  10921. if (!this.check(arguments)) return this;
  10922. var newOrder = Array.flatten(arguments);
  10923. var top = 0,
  10924. left = 0,
  10925. next = {},
  10926. zero = {},
  10927. vert = this.options.mode == 'vertical';
  10928. var current = this.elements.map(function(el, index){
  10929. var size = el.getComputedSize({styles: ['border', 'padding', 'margin']});
  10930. var val;
  10931. if (vert){
  10932. val = {
  10933. top: top,
  10934. margin: size['margin-top'],
  10935. height: size.totalHeight
  10936. };
  10937. top += val.height - size['margin-top'];
  10938. } else {
  10939. val = {
  10940. left: left,
  10941. margin: size['margin-left'],
  10942. width: size.totalWidth
  10943. };
  10944. left += val.width;
  10945. }
  10946. var plane = vert ? 'top' : 'left';
  10947. zero[index] = {};
  10948. var start = el.getStyle(plane).toInt();
  10949. zero[index][plane] = start || 0;
  10950. return val;
  10951. }, this);
  10952. this.set(zero);
  10953. newOrder = newOrder.map(function(i){ return i.toInt(); });
  10954. if (newOrder.length != this.elements.length){
  10955. this.currentOrder.each(function(index){
  10956. if (!newOrder.contains(index)) newOrder.push(index);
  10957. });
  10958. if (newOrder.length > this.elements.length)
  10959. newOrder.splice(this.elements.length-1, newOrder.length - this.elements.length);
  10960. }
  10961. var margin = 0;
  10962. top = left = 0;
  10963. newOrder.each(function(item){
  10964. var newPos = {};
  10965. if (vert){
  10966. newPos.top = top - current[item].top - margin;
  10967. top += current[item].height;
  10968. } else {
  10969. newPos.left = left - current[item].left;
  10970. left += current[item].width;
  10971. }
  10972. margin = margin + current[item].margin;
  10973. next[item]=newPos;
  10974. }, this);
  10975. var mapped = {};
  10976. Array.clone(newOrder).sort().each(function(index){
  10977. mapped[index] = next[index];
  10978. });
  10979. this.start(mapped);
  10980. this.currentOrder = newOrder;
  10981. return this;
  10982. },
  10983. rearrangeDOM: function(newOrder){
  10984. newOrder = newOrder || this.currentOrder;
  10985. var parent = this.elements[0].getParent();
  10986. var rearranged = [];
  10987. this.elements.setStyle('opacity', 0);
  10988. //move each element and store the new default order
  10989. newOrder.each(function(index){
  10990. rearranged.push(this.elements[index].inject(parent).setStyles({
  10991. top: 0,
  10992. left: 0
  10993. }));
  10994. }, this);
  10995. this.elements.setStyle('opacity', 1);
  10996. this.elements = $$(rearranged);
  10997. this.setDefaultOrder();
  10998. return this;
  10999. },
  11000. getDefaultOrder: function(){
  11001. return this.elements.map(function(el, index){
  11002. return index;
  11003. });
  11004. },
  11005. getCurrentOrder: function(){
  11006. return this.currentOrder;
  11007. },
  11008. forward: function(){
  11009. return this.sort(this.getDefaultOrder());
  11010. },
  11011. backward: function(){
  11012. return this.sort(this.getDefaultOrder().reverse());
  11013. },
  11014. reverse: function(){
  11015. return this.sort(this.currentOrder.reverse());
  11016. },
  11017. sortByElements: function(elements){
  11018. return this.sort(elements.map(function(el){
  11019. return this.elements.indexOf(el);
  11020. }, this));
  11021. },
  11022. swap: function(one, two){
  11023. if (typeOf(one) == 'element') one = this.elements.indexOf(one);
  11024. if (typeOf(two) == 'element') two = this.elements.indexOf(two);
  11025. var newOrder = Array.clone(this.currentOrder);
  11026. newOrder[this.currentOrder.indexOf(one)] = two;
  11027. newOrder[this.currentOrder.indexOf(two)] = one;
  11028. return this.sort(newOrder);
  11029. }
  11030. });
  11031. /*
  11032. ---
  11033. script: Keyboard.js
  11034. name: Keyboard
  11035. 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.
  11036. license: MIT-style license
  11037. authors:
  11038. - Perrin Westrich
  11039. - Aaron Newton
  11040. - Scott Kyle
  11041. requires:
  11042. - Core/Events
  11043. - Core/Options
  11044. - Core/Element.Event
  11045. - Element.Event.Pseudos.Keys
  11046. provides: [Keyboard]
  11047. ...
  11048. */
  11049. (function(){
  11050. var Keyboard = this.Keyboard = new Class({
  11051. Extends: Events,
  11052. Implements: [Options],
  11053. options: {/*
  11054. onActivate: function(){},
  11055. onDeactivate: function(){},*/
  11056. defaultEventType: 'keydown',
  11057. active: false,
  11058. manager: null,
  11059. events: {},
  11060. nonParsedEvents: ['activate', 'deactivate', 'onactivate', 'ondeactivate', 'changed', 'onchanged']
  11061. },
  11062. initialize: function(options){
  11063. if (options && options.manager){
  11064. this._manager = options.manager;
  11065. delete options.manager;
  11066. }
  11067. this.setOptions(options);
  11068. this._setup();
  11069. },
  11070. addEvent: function(type, fn, internal){
  11071. return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn, internal);
  11072. },
  11073. removeEvent: function(type, fn){
  11074. return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn);
  11075. },
  11076. toggleActive: function(){
  11077. return this[this.isActive() ? 'deactivate' : 'activate']();
  11078. },
  11079. activate: function(instance){
  11080. if (instance){
  11081. if (instance.isActive()) return this;
  11082. //if we're stealing focus, store the last keyboard to have it so the relinquish command works
  11083. if (this._activeKB && instance != this._activeKB){
  11084. this.previous = this._activeKB;
  11085. this.previous.fireEvent('deactivate');
  11086. }
  11087. //if we're enabling a child, assign it so that events are now passed to it
  11088. this._activeKB = instance.fireEvent('activate');
  11089. Keyboard.manager.fireEvent('changed');
  11090. } else if (this._manager){
  11091. //else we're enabling ourselves, we must ask our parent to do it for us
  11092. this._manager.activate(this);
  11093. }
  11094. return this;
  11095. },
  11096. isActive: function(){
  11097. return this._manager ? (this._manager._activeKB == this) : (Keyboard.manager == this);
  11098. },
  11099. deactivate: function(instance){
  11100. if (instance){
  11101. if (instance === this._activeKB){
  11102. this._activeKB = null;
  11103. instance.fireEvent('deactivate');
  11104. Keyboard.manager.fireEvent('changed');
  11105. }
  11106. } else if (this._manager){
  11107. this._manager.deactivate(this);
  11108. }
  11109. return this;
  11110. },
  11111. relinquish: function(){
  11112. if (this.isActive() && this._manager && this._manager.previous) this._manager.activate(this._manager.previous);
  11113. else this.deactivate();
  11114. return this;
  11115. },
  11116. //management logic
  11117. manage: function(instance){
  11118. if (instance._manager) instance._manager.drop(instance);
  11119. this._instances.push(instance);
  11120. instance._manager = this;
  11121. if (!this._activeKB) this.activate(instance);
  11122. return this;
  11123. },
  11124. drop: function(instance){
  11125. instance.relinquish();
  11126. this._instances.erase(instance);
  11127. if (this._activeKB == instance){
  11128. if (this.previous && this._instances.contains(this.previous)) this.activate(this.previous);
  11129. else this._activeKB = this._instances[0];
  11130. }
  11131. return this;
  11132. },
  11133. trace: function(){
  11134. Keyboard.trace(this);
  11135. },
  11136. each: function(fn){
  11137. Keyboard.each(this, fn);
  11138. },
  11139. /*
  11140. PRIVATE METHODS
  11141. */
  11142. _instances: [],
  11143. _disable: function(instance){
  11144. if (this._activeKB == instance) this._activeKB = null;
  11145. },
  11146. _setup: function(){
  11147. this.addEvents(this.options.events);
  11148. //if this is the root manager, nothing manages it
  11149. if (Keyboard.manager && !this._manager) Keyboard.manager.manage(this);
  11150. if (this.options.active) this.activate();
  11151. else this.relinquish();
  11152. },
  11153. _handle: function(event, type){
  11154. //Keyboard.stop(event) prevents key propagation
  11155. if (event.preventKeyboardPropagation) return;
  11156. var bubbles = !!this._manager;
  11157. if (bubbles && this._activeKB){
  11158. this._activeKB._handle(event, type);
  11159. if (event.preventKeyboardPropagation) return;
  11160. }
  11161. this.fireEvent(type, event);
  11162. if (!bubbles && this._activeKB) this._activeKB._handle(event, type);
  11163. }
  11164. });
  11165. var parsed = {};
  11166. var modifiers = ['shift', 'control', 'alt', 'meta'];
  11167. var regex = /^(?:shift|control|ctrl|alt|meta)$/;
  11168. Keyboard.parse = function(type, eventType, ignore){
  11169. if (ignore && ignore.contains(type.toLowerCase())) return type;
  11170. type = type.toLowerCase().replace(/^(keyup|keydown):/, function($0, $1){
  11171. eventType = $1;
  11172. return '';
  11173. });
  11174. if (!parsed[type]){
  11175. if (type != '+'){
  11176. var key, mods = {};
  11177. type.split('+').each(function(part){
  11178. if (regex.test(part)) mods[part] = true;
  11179. else key = part;
  11180. });
  11181. mods.control = mods.control || mods.ctrl; // allow both control and ctrl
  11182. var keys = [];
  11183. modifiers.each(function(mod){
  11184. if (mods[mod]) keys.push(mod);
  11185. });
  11186. if (key) keys.push(key);
  11187. parsed[type] = keys.join('+');
  11188. } else {
  11189. parsed[type] = type;
  11190. }
  11191. }
  11192. return eventType + ':keys(' + parsed[type] + ')';
  11193. };
  11194. Keyboard.each = function(keyboard, fn){
  11195. var current = keyboard || Keyboard.manager;
  11196. while (current){
  11197. fn(current);
  11198. current = current._activeKB;
  11199. }
  11200. };
  11201. Keyboard.stop = function(event){
  11202. event.preventKeyboardPropagation = true;
  11203. };
  11204. Keyboard.manager = new Keyboard({
  11205. active: true
  11206. });
  11207. Keyboard.trace = function(keyboard){
  11208. keyboard = keyboard || Keyboard.manager;
  11209. var hasConsole = window.console && console.log;
  11210. if (hasConsole) console.log('the following items have focus: ');
  11211. Keyboard.each(keyboard, function(current){
  11212. if (hasConsole) console.log(document.id(current.widget) || current.wiget || current);
  11213. });
  11214. };
  11215. var handler = function(event){
  11216. var keys = [];
  11217. modifiers.each(function(mod){
  11218. if (event[mod]) keys.push(mod);
  11219. });
  11220. if (!regex.test(event.key)) keys.push(event.key);
  11221. Keyboard.manager._handle(event, event.type + ':keys(' + keys.join('+') + ')');
  11222. };
  11223. document.addEvents({
  11224. 'keyup': handler,
  11225. 'keydown': handler
  11226. });
  11227. })();
  11228. /*
  11229. ---
  11230. script: Keyboard.Extras.js
  11231. name: Keyboard.Extras
  11232. 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.
  11233. license: MIT-style license
  11234. authors:
  11235. - Perrin Westrich
  11236. requires:
  11237. - Keyboard
  11238. - MooTools.More
  11239. provides: [Keyboard.Extras]
  11240. ...
  11241. */
  11242. Keyboard.prototype.options.nonParsedEvents.combine(['rebound', 'onrebound']);
  11243. Keyboard.implement({
  11244. /*
  11245. shortcut should be in the format of:
  11246. {
  11247. 'keys': 'shift+s', // the default to add as an event.
  11248. 'description': 'blah blah blah', // a brief description of the functionality.
  11249. 'handler': function(){} // the event handler to run when keys are pressed.
  11250. }
  11251. */
  11252. addShortcut: function(name, shortcut){
  11253. this._shortcuts = this._shortcuts || [];
  11254. this._shortcutIndex = this._shortcutIndex || {};
  11255. shortcut.getKeyboard = Function.convert(this);
  11256. shortcut.name = name;
  11257. this._shortcutIndex[name] = shortcut;
  11258. this._shortcuts.push(shortcut);
  11259. if (shortcut.keys) this.addEvent(shortcut.keys, shortcut.handler);
  11260. return this;
  11261. },
  11262. addShortcuts: function(obj){
  11263. for (var name in obj) this.addShortcut(name, obj[name]);
  11264. return this;
  11265. },
  11266. removeShortcut: function(name){
  11267. var shortcut = this.getShortcut(name);
  11268. if (shortcut && shortcut.keys){
  11269. this.removeEvent(shortcut.keys, shortcut.handler);
  11270. delete this._shortcutIndex[name];
  11271. this._shortcuts.erase(shortcut);
  11272. }
  11273. return this;
  11274. },
  11275. removeShortcuts: function(names){
  11276. names.each(this.removeShortcut, this);
  11277. return this;
  11278. },
  11279. getShortcuts: function(){
  11280. return this._shortcuts || [];
  11281. },
  11282. getShortcut: function(name){
  11283. return (this._shortcutIndex || {})[name];
  11284. }
  11285. });
  11286. Keyboard.rebind = function(newKeys, shortcuts){
  11287. Array.convert(shortcuts).each(function(shortcut){
  11288. shortcut.getKeyboard().removeEvent(shortcut.keys, shortcut.handler);
  11289. shortcut.getKeyboard().addEvent(newKeys, shortcut.handler);
  11290. shortcut.keys = newKeys;
  11291. shortcut.getKeyboard().fireEvent('rebound');
  11292. });
  11293. };
  11294. Keyboard.getActiveShortcuts = function(keyboard){
  11295. var activeKBS = [], activeSCS = [];
  11296. Keyboard.each(keyboard, [].push.bind(activeKBS));
  11297. activeKBS.each(function(kb){ activeSCS.extend(kb.getShortcuts()); });
  11298. return activeSCS;
  11299. };
  11300. Keyboard.getShortcut = function(name, keyboard, opts){
  11301. opts = opts || {};
  11302. var shortcuts = opts.many ? [] : null,
  11303. set = opts.many ? function(kb){
  11304. var shortcut = kb.getShortcut(name);
  11305. if (shortcut) shortcuts.push(shortcut);
  11306. } : function(kb){
  11307. if (!shortcuts) shortcuts = kb.getShortcut(name);
  11308. };
  11309. Keyboard.each(keyboard, set);
  11310. return shortcuts;
  11311. };
  11312. Keyboard.getShortcuts = function(name, keyboard){
  11313. return Keyboard.getShortcut(name, keyboard, { many: true });
  11314. };
  11315. /*
  11316. ---
  11317. script: HtmlTable.js
  11318. name: HtmlTable
  11319. description: Builds table elements with methods to add rows.
  11320. license: MIT-style license
  11321. authors:
  11322. - Aaron Newton
  11323. requires:
  11324. - Core/Options
  11325. - Core/Events
  11326. - Class.Occlude
  11327. provides: [HtmlTable]
  11328. ...
  11329. */
  11330. (function(){
  11331. var HtmlTable = this.HtmlTable = new Class({
  11332. Implements: [Options, Events, Class.Occlude],
  11333. options: {
  11334. properties: {
  11335. cellpadding: 0,
  11336. cellspacing: 0,
  11337. border: 0
  11338. },
  11339. rows: [],
  11340. headers: [],
  11341. footers: []
  11342. },
  11343. property: 'HtmlTable',
  11344. initialize: function(){
  11345. var params = Array.link(arguments, {options: Type.isObject, table: Type.isElement, id: Type.isString});
  11346. this.setOptions(params.options);
  11347. if (!params.table && params.id) params.table = document.id(params.id);
  11348. this.element = params.table || new Element('table', this.options.properties);
  11349. if (this.occlude()) return this.occluded;
  11350. this.build();
  11351. },
  11352. build: function(){
  11353. this.element.store('HtmlTable', this);
  11354. this.body = document.id(this.element.tBodies[0]) || new Element('tbody').inject(this.element);
  11355. $$(this.body.rows);
  11356. if (this.options.headers.length) this.setHeaders(this.options.headers);
  11357. else this.thead = document.id(this.element.tHead);
  11358. if (this.thead) this.head = this.getHead();
  11359. if (this.options.footers.length) this.setFooters(this.options.footers);
  11360. this.tfoot = document.id(this.element.tFoot);
  11361. if (this.tfoot) this.foot = document.id(this.tfoot.rows[0]);
  11362. this.options.rows.each(function(row){
  11363. this.push(row);
  11364. }, this);
  11365. },
  11366. toElement: function(){
  11367. return this.element;
  11368. },
  11369. empty: function(){
  11370. this.body.empty();
  11371. return this;
  11372. },
  11373. set: function(what, items){
  11374. var target = (what == 'headers') ? 'tHead' : 'tFoot',
  11375. lower = target.toLowerCase();
  11376. this[lower] = (document.id(this.element[target]) || new Element(lower).inject(this.element, 'top')).empty();
  11377. var data = this.push(items, {}, this[lower], what == 'headers' ? 'th' : 'td');
  11378. if (what == 'headers') this.head = this.getHead();
  11379. else this.foot = this.getHead();
  11380. return data;
  11381. },
  11382. getHead: function(){
  11383. var rows = this.thead.rows;
  11384. return rows.length > 1 ? $$(rows) : rows.length ? document.id(rows[0]) : false;
  11385. },
  11386. setHeaders: function(headers){
  11387. this.set('headers', headers);
  11388. return this;
  11389. },
  11390. setFooters: function(footers){
  11391. this.set('footers', footers);
  11392. return this;
  11393. },
  11394. update: function(tr, row, tag){
  11395. var tds = tr.getChildren(tag || 'td'), last = tds.length - 1;
  11396. row.each(function(data, index){
  11397. var td = tds[index] || new Element(tag || 'td').inject(tr),
  11398. content = ((data && Object.prototype.hasOwnProperty.call(data, 'content')) ? data.content : '') || data,
  11399. type = typeOf(content);
  11400. if (data && Object.prototype.hasOwnProperty.call(data, 'properties')) td.set(data.properties);
  11401. if (/(element(s?)|array|collection)/.test(type)) td.empty().adopt(content);
  11402. else td.set('html', content);
  11403. if (index > last) tds.push(td);
  11404. else tds[index] = td;
  11405. });
  11406. return {
  11407. tr: tr,
  11408. tds: tds
  11409. };
  11410. },
  11411. push: function(row, rowProperties, target, tag, where){
  11412. if (typeOf(row) == 'element' && row.get('tag') == 'tr'){
  11413. row.inject(target || this.body, where);
  11414. return {
  11415. tr: row,
  11416. tds: row.getChildren('td')
  11417. };
  11418. }
  11419. return this.update(new Element('tr', rowProperties).inject(target || this.body, where), row, tag);
  11420. },
  11421. pushMany: function(rows, rowProperties, target, tag, where){
  11422. return rows.map(function(row){
  11423. return this.push(row, rowProperties, target, tag, where);
  11424. }, this);
  11425. }
  11426. });
  11427. })();
  11428. ['adopt', 'inject', 'wraps', 'grab', 'replaces', 'dispose'].each(function(method){
  11429. HtmlTable.implement(method, function(){
  11430. this.element[method].apply(this.element, arguments);
  11431. return this;
  11432. });
  11433. });
  11434. /*
  11435. ---
  11436. script: HtmlTable.Select.js
  11437. name: HtmlTable.Select
  11438. description: Builds a stripy, sortable table with methods to add rows. Rows can be selected with the mouse or keyboard navigation.
  11439. license: MIT-style license
  11440. authors:
  11441. - Harald Kirschner
  11442. - Aaron Newton
  11443. requires:
  11444. - Keyboard
  11445. - Keyboard.Extras
  11446. - HtmlTable
  11447. - Class.refactor
  11448. - Element.Delegation.Pseudo
  11449. - Element.Shortcuts
  11450. provides: [HtmlTable.Select]
  11451. ...
  11452. */
  11453. HtmlTable = Class.refactor(HtmlTable, {
  11454. options: {
  11455. /*onRowFocus: function(){},
  11456. onRowUnfocus: function(){},*/
  11457. useKeyboard: true,
  11458. classRowSelected: 'table-tr-selected',
  11459. classRowHovered: 'table-tr-hovered',
  11460. classSelectable: 'table-selectable',
  11461. shiftForMultiSelect: true,
  11462. allowMultiSelect: true,
  11463. selectable: false,
  11464. selectHiddenRows: false
  11465. },
  11466. initialize: function(){
  11467. this.previous.apply(this, arguments);
  11468. if (this.occluded) return this.occluded;
  11469. this.selectedRows = new Elements();
  11470. if (!this.bound) this.bound = {};
  11471. this.bound.mouseleave = this.mouseleave.bind(this);
  11472. this.bound.clickRow = this.clickRow.bind(this);
  11473. this.bound.activateKeyboard = function(){
  11474. if (this.keyboard && this.selectEnabled) this.keyboard.activate();
  11475. }.bind(this);
  11476. if (this.options.selectable) this.enableSelect();
  11477. },
  11478. empty: function(){
  11479. if (this.body.rows.length) this.selectNone();
  11480. return this.previous();
  11481. },
  11482. enableSelect: function(){
  11483. this.selectEnabled = true;
  11484. this.attachSelects();
  11485. this.element.addClass(this.options.classSelectable);
  11486. return this;
  11487. },
  11488. disableSelect: function(){
  11489. this.selectEnabled = false;
  11490. this.attachSelects(false);
  11491. this.element.removeClass(this.options.classSelectable);
  11492. return this;
  11493. },
  11494. push: function(){
  11495. var ret = this.previous.apply(this, arguments);
  11496. this.updateSelects();
  11497. return ret;
  11498. },
  11499. toggleRow: function(row){
  11500. return this[(this.isSelected(row) ? 'de' : '') + 'selectRow'](row);
  11501. },
  11502. selectRow: function(row, _nocheck){
  11503. //private variable _nocheck: boolean whether or not to confirm the row is in the table body
  11504. //added here for optimization when selecting ranges
  11505. if (this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
  11506. if (!this.options.allowMultiSelect) this.selectNone();
  11507. if (!this.isSelected(row)){
  11508. this.selectedRows.push(row);
  11509. row.addClass(this.options.classRowSelected);
  11510. this.fireEvent('rowFocus', [row, this.selectedRows]);
  11511. this.fireEvent('stateChanged');
  11512. }
  11513. this.focused = row;
  11514. document.clearSelection();
  11515. return this;
  11516. },
  11517. isSelected: function(row){
  11518. return this.selectedRows.contains(row);
  11519. },
  11520. getSelected: function(){
  11521. return this.selectedRows;
  11522. },
  11523. serialize: function(){
  11524. var previousSerialization = this.previous.apply(this, arguments) || {};
  11525. if (this.options.selectable){
  11526. previousSerialization.selectedRows = this.selectedRows.map(function(row){
  11527. return Array.indexOf(this.body.rows, row);
  11528. }.bind(this));
  11529. }
  11530. return previousSerialization;
  11531. },
  11532. restore: function(tableState){
  11533. if (this.options.selectable && tableState.selectedRows){
  11534. tableState.selectedRows.each(function(index){
  11535. this.selectRow(this.body.rows[index]);
  11536. }.bind(this));
  11537. }
  11538. this.previous.apply(this, arguments);
  11539. },
  11540. deselectRow: function(row, _nocheck){
  11541. if (!this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
  11542. this.selectedRows = new Elements(Array.convert(this.selectedRows).erase(row));
  11543. row.removeClass(this.options.classRowSelected);
  11544. this.fireEvent('rowUnfocus', [row, this.selectedRows]);
  11545. this.fireEvent('stateChanged');
  11546. return this;
  11547. },
  11548. selectAll: function(selectNone){
  11549. if (!selectNone && !this.options.allowMultiSelect) return;
  11550. this.selectRange(0, this.body.rows.length, selectNone);
  11551. return this;
  11552. },
  11553. selectNone: function(){
  11554. return this.selectAll(true);
  11555. },
  11556. selectRange: function(startRow, endRow, _deselect){
  11557. if (!this.options.allowMultiSelect && !_deselect) return;
  11558. var method = _deselect ? 'deselectRow' : 'selectRow',
  11559. rows = Array.clone(this.body.rows);
  11560. if (typeOf(startRow) == 'element') startRow = rows.indexOf(startRow);
  11561. if (typeOf(endRow) == 'element') endRow = rows.indexOf(endRow);
  11562. endRow = endRow < rows.length - 1 ? endRow : rows.length - 1;
  11563. if (endRow < startRow){
  11564. var tmp = startRow;
  11565. startRow = endRow;
  11566. endRow = tmp;
  11567. }
  11568. for (var i = startRow; i <= endRow; i++){
  11569. if (this.options.selectHiddenRows || rows[i].isDisplayed()) this[method](rows[i], true);
  11570. }
  11571. return this;
  11572. },
  11573. deselectRange: function(startRow, endRow){
  11574. this.selectRange(startRow, endRow, true);
  11575. },
  11576. /*
  11577. Private methods:
  11578. */
  11579. enterRow: function(row){
  11580. if (this.hovered) this.hovered = this.leaveRow(this.hovered);
  11581. this.hovered = row.addClass(this.options.classRowHovered);
  11582. },
  11583. leaveRow: function(row){
  11584. row.removeClass(this.options.classRowHovered);
  11585. },
  11586. updateSelects: function(){
  11587. Array.each(this.body.rows, function(row){
  11588. var binders = row.retrieve('binders');
  11589. if (!binders && !this.selectEnabled) return;
  11590. if (!binders){
  11591. binders = {
  11592. mouseenter: this.enterRow.pass([row], this),
  11593. mouseleave: this.leaveRow.pass([row], this)
  11594. };
  11595. row.store('binders', binders);
  11596. }
  11597. if (this.selectEnabled) row.addEvents(binders);
  11598. else row.removeEvents(binders);
  11599. }, this);
  11600. },
  11601. shiftFocus: function(offset, event){
  11602. if (!this.focused) return this.selectRow(this.body.rows[0], event);
  11603. var to = this.getRowByOffset(offset, this.options.selectHiddenRows);
  11604. if (to === null || this.focused == this.body.rows[to]) return this;
  11605. this.toggleRow(this.body.rows[to], event);
  11606. },
  11607. clickRow: function(event, row){
  11608. var selecting = (event.shift || event.meta || event.control) && this.options.shiftForMultiSelect;
  11609. if (!selecting && !(event.rightClick && this.isSelected(row) && this.options.allowMultiSelect)) this.selectNone();
  11610. if (event.rightClick) this.selectRow(row);
  11611. else this.toggleRow(row);
  11612. if (event.shift){
  11613. this.selectRange(this.rangeStart || this.body.rows[0], row, this.rangeStart ? !this.isSelected(row) : true);
  11614. this.focused = row;
  11615. }
  11616. this.rangeStart = row;
  11617. },
  11618. getRowByOffset: function(offset, includeHiddenRows){
  11619. if (!this.focused) return 0;
  11620. var index = Array.indexOf(this.body.rows, this.focused);
  11621. if ((index == 0 && offset < 0) || (index == this.body.rows.length -1 && offset > 0)) return null;
  11622. if (includeHiddenRows){
  11623. index += offset;
  11624. } else {
  11625. var limit = 0,
  11626. count = 0;
  11627. if (offset > 0){
  11628. while (count < offset && index < this.body.rows.length -1){
  11629. if (this.body.rows[++index].isDisplayed()) count++;
  11630. }
  11631. } else {
  11632. while (count > offset && index > 0){
  11633. if (this.body.rows[--index].isDisplayed()) count--;
  11634. }
  11635. }
  11636. }
  11637. return index;
  11638. },
  11639. attachSelects: function(attach){
  11640. attach = attach != null ? attach : true;
  11641. var method = attach ? 'addEvents' : 'removeEvents';
  11642. this.element[method]({
  11643. mouseleave: this.bound.mouseleave,
  11644. click: this.bound.activateKeyboard
  11645. });
  11646. this.body[method]({
  11647. 'click:relay(tr)': this.bound.clickRow,
  11648. 'contextmenu:relay(tr)': this.bound.clickRow
  11649. });
  11650. if (this.options.useKeyboard || this.keyboard){
  11651. if (!this.keyboard) this.keyboard = new Keyboard();
  11652. if (!this.selectKeysDefined){
  11653. this.selectKeysDefined = true;
  11654. var timer, held;
  11655. var move = function(offset){
  11656. var mover = function(e){
  11657. clearTimeout(timer);
  11658. e.preventDefault();
  11659. var to = this.body.rows[this.getRowByOffset(offset, this.options.selectHiddenRows)];
  11660. if (e.shift && to && this.isSelected(to)){
  11661. this.deselectRow(this.focused);
  11662. this.focused = to;
  11663. } else {
  11664. if (to && (!this.options.allowMultiSelect || !e.shift)){
  11665. this.selectNone();
  11666. }
  11667. this.shiftFocus(offset, e);
  11668. }
  11669. if (held){
  11670. timer = mover.delay(100, this, e);
  11671. } else {
  11672. timer = (function(){
  11673. held = true;
  11674. mover(e);
  11675. }).delay(400);
  11676. }
  11677. }.bind(this);
  11678. return mover;
  11679. }.bind(this);
  11680. var clear = function(){
  11681. clearTimeout(timer);
  11682. held = false;
  11683. };
  11684. this.keyboard.addEvents({
  11685. 'keydown:shift+up': move(-1),
  11686. 'keydown:shift+down': move(1),
  11687. 'keyup:shift+up': clear,
  11688. 'keyup:shift+down': clear,
  11689. 'keyup:up': clear,
  11690. 'keyup:down': clear
  11691. });
  11692. var shiftHint = '';
  11693. if (this.options.allowMultiSelect && this.options.shiftForMultiSelect && this.options.useKeyboard){
  11694. shiftHint = ' (Shift multi-selects).';
  11695. }
  11696. this.keyboard.addShortcuts({
  11697. 'Select Previous Row': {
  11698. keys: 'up',
  11699. shortcut: 'up arrow',
  11700. handler: move(-1),
  11701. description: 'Select the previous row in the table.' + shiftHint
  11702. },
  11703. 'Select Next Row': {
  11704. keys: 'down',
  11705. shortcut: 'down arrow',
  11706. handler: move(1),
  11707. description: 'Select the next row in the table.' + shiftHint
  11708. }
  11709. });
  11710. }
  11711. this.keyboard[attach ? 'activate' : 'deactivate']();
  11712. }
  11713. this.updateSelects();
  11714. },
  11715. mouseleave: function(){
  11716. if (this.hovered) this.leaveRow(this.hovered);
  11717. }
  11718. });
  11719. /*
  11720. ---
  11721. script: HtmlTable.Sort.js
  11722. name: HtmlTable.Sort
  11723. description: Builds a stripy, sortable table with methods to add rows.
  11724. license: MIT-style license
  11725. authors:
  11726. - Harald Kirschner
  11727. - Aaron Newton
  11728. - Jacob Thornton
  11729. requires:
  11730. - Core/Hash
  11731. - HtmlTable
  11732. - Class.refactor
  11733. - Element.Delegation.Pseudo
  11734. - String.Extras
  11735. - Date
  11736. provides: [HtmlTable.Sort]
  11737. ...
  11738. */
  11739. (function(){
  11740. var readOnlyNess = document.createElement('table');
  11741. try {
  11742. readOnlyNess.innerHTML = '<tr><td></td></tr>';
  11743. readOnlyNess = readOnlyNess.childNodes.length === 0;
  11744. } catch (e){
  11745. readOnlyNess = true;
  11746. }
  11747. HtmlTable = Class.refactor(HtmlTable, {
  11748. options: {/*
  11749. onSort: function(){}, */
  11750. sortIndex: 0,
  11751. sortReverse: false,
  11752. parsers: [],
  11753. defaultParser: 'string',
  11754. classSortable: 'table-sortable',
  11755. classHeadSort: 'table-th-sort',
  11756. classHeadSortRev: 'table-th-sort-rev',
  11757. classNoSort: 'table-th-nosort',
  11758. classGroupHead: 'table-tr-group-head',
  11759. classGroup: 'table-tr-group',
  11760. classCellSort: 'table-td-sort',
  11761. classSortSpan: 'table-th-sort-span',
  11762. sortable: false,
  11763. thSelector: 'th'
  11764. },
  11765. initialize: function(){
  11766. this.previous.apply(this, arguments);
  11767. if (this.occluded) return this.occluded;
  11768. this.sorted = {index: null, dir: 1};
  11769. if (!this.bound) this.bound = {};
  11770. this.bound.headClick = this.headClick.bind(this);
  11771. this.sortSpans = new Elements();
  11772. if (this.options.sortable){
  11773. this.enableSort();
  11774. if (this.options.sortIndex != null) this.sort(this.options.sortIndex, this.options.sortReverse);
  11775. }
  11776. },
  11777. attachSorts: function(attach){
  11778. this.detachSorts();
  11779. if (attach !== false) this.element.addEvent('click:relay(' + this.options.thSelector + ')', this.bound.headClick);
  11780. },
  11781. detachSorts: function(){
  11782. this.element.removeEvents('click:relay(' + this.options.thSelector + ')');
  11783. },
  11784. setHeaders: function(){
  11785. this.previous.apply(this, arguments);
  11786. if (this.sortable) this.setParsers();
  11787. },
  11788. setParsers: function(){
  11789. this.parsers = this.detectParsers();
  11790. },
  11791. detectParsers: function(){
  11792. return this.head && this.head.getElements(this.options.thSelector).flatten().map(this.detectParser, this);
  11793. },
  11794. detectParser: function(cell, index){
  11795. if (cell.hasClass(this.options.classNoSort) || cell.retrieve('htmltable-parser')) return cell.retrieve('htmltable-parser');
  11796. var thDiv = new Element('div');
  11797. thDiv.adopt(cell.childNodes).inject(cell);
  11798. var sortSpan = new Element('span', {'class': this.options.classSortSpan}).inject(thDiv, 'top');
  11799. this.sortSpans.push(sortSpan);
  11800. var parser = this.options.parsers[index],
  11801. rows = this.body.rows,
  11802. cancel;
  11803. switch (typeOf(parser)){
  11804. case 'function': parser = {convert: parser}; cancel = true; break;
  11805. case 'string': parser = parser; cancel = true; break;
  11806. }
  11807. if (!cancel){
  11808. HtmlTable.ParserPriority.some(function(parserName){
  11809. var current = HtmlTable.Parsers[parserName],
  11810. match = current.match;
  11811. if (!match) return false;
  11812. for (var i = 0, j = rows.length; i < j; i++){
  11813. var cell = document.id(rows[i].cells[index]),
  11814. text = cell ? cell.get('html').clean() : '';
  11815. if (text && match.test(text)){
  11816. parser = current;
  11817. return true;
  11818. }
  11819. }
  11820. });
  11821. }
  11822. if (!parser) parser = this.options.defaultParser;
  11823. cell.store('htmltable-parser', parser);
  11824. return parser;
  11825. },
  11826. headClick: function(event, el){
  11827. if (!this.head || el.hasClass(this.options.classNoSort)) return;
  11828. return this.sort(Array.indexOf(this.head.getElements(this.options.thSelector).flatten(), el) % this.body.rows[0].cells.length);
  11829. },
  11830. serialize: function(){
  11831. var previousSerialization = this.previous.apply(this, arguments) || {};
  11832. if (this.options.sortable){
  11833. previousSerialization.sortIndex = this.sorted.index;
  11834. previousSerialization.sortReverse = this.sorted.reverse;
  11835. }
  11836. return previousSerialization;
  11837. },
  11838. restore: function(tableState){
  11839. if (this.options.sortable && tableState.sortIndex){
  11840. this.sort(tableState.sortIndex, tableState.sortReverse);
  11841. }
  11842. this.previous.apply(this, arguments);
  11843. },
  11844. setSortedState: function(index, reverse){
  11845. if (reverse != null) this.sorted.reverse = reverse;
  11846. else if (this.sorted.index == index) this.sorted.reverse = !this.sorted.reverse;
  11847. else this.sorted.reverse = this.sorted.index == null;
  11848. if (index != null) this.sorted.index = index;
  11849. },
  11850. setHeadSort: function(sorted){
  11851. var head = $$(!this.head.length ? this.head.cells[this.sorted.index] : this.head.map(function(row){
  11852. return row.getElements(this.options.thSelector)[this.sorted.index];
  11853. }, this).clean());
  11854. if (!head.length) return;
  11855. if (sorted){
  11856. head.addClass(this.options.classHeadSort);
  11857. if (this.sorted.reverse) head.addClass(this.options.classHeadSortRev);
  11858. else head.removeClass(this.options.classHeadSortRev);
  11859. } else {
  11860. head.removeClass(this.options.classHeadSort).removeClass(this.options.classHeadSortRev);
  11861. }
  11862. },
  11863. setRowSort: function(data, pre){
  11864. var count = data.length,
  11865. body = this.body,
  11866. group,
  11867. rowIndex;
  11868. while (count){
  11869. var item = data[--count],
  11870. position = item.position,
  11871. row = body.rows[position];
  11872. if (row.disabled) continue;
  11873. if (!pre){
  11874. group = this.setGroupSort(group, row, item);
  11875. this.setRowStyle(row, count);
  11876. }
  11877. body.appendChild(row);
  11878. for (rowIndex = 0; rowIndex < count; rowIndex++){
  11879. if (data[rowIndex].position > position) data[rowIndex].position--;
  11880. }
  11881. }
  11882. },
  11883. setRowStyle: function(row, i){
  11884. this.previous(row, i);
  11885. row.cells[this.sorted.index].addClass(this.options.classCellSort);
  11886. },
  11887. setGroupSort: function(group, row, item){
  11888. if (group == item.value) row.removeClass(this.options.classGroupHead).addClass(this.options.classGroup);
  11889. else row.removeClass(this.options.classGroup).addClass(this.options.classGroupHead);
  11890. return item.value;
  11891. },
  11892. getParser: function(){
  11893. var parser = this.parsers[this.sorted.index];
  11894. return typeOf(parser) == 'string' ? HtmlTable.Parsers[parser] : parser;
  11895. },
  11896. sort: function(index, reverse, pre, sortFunction){
  11897. if (!this.head) return;
  11898. if (!pre){
  11899. this.clearSort();
  11900. this.setSortedState(index, reverse);
  11901. this.setHeadSort(true);
  11902. }
  11903. var parser = this.getParser();
  11904. if (!parser) return;
  11905. var rel;
  11906. if (!readOnlyNess){
  11907. rel = this.body.getParent();
  11908. this.body.dispose();
  11909. }
  11910. var data = this.parseData(parser).sort(sortFunction ? sortFunction : function(a, b){
  11911. if (a.value === b.value) return 0;
  11912. return a.value > b.value ? 1 : -1;
  11913. });
  11914. var reversed = this.sorted.reverse == (parser == HtmlTable.Parsers['input-checked']);
  11915. if (reversed) data.reverse(true);
  11916. this.setRowSort(data, pre);
  11917. if (rel) rel.grab(this.body);
  11918. this.fireEvent('stateChanged');
  11919. return this.fireEvent('sort', [this.body, this.sorted.index, reversed ? 'asc' : 'desc']);
  11920. },
  11921. parseData: function(parser){
  11922. return Array.map(this.body.rows, function(row, i){
  11923. var value = parser.convert.call(document.id(row.cells[this.sorted.index]));
  11924. return {
  11925. position: i,
  11926. value: value
  11927. };
  11928. }, this);
  11929. },
  11930. clearSort: function(){
  11931. this.setHeadSort(false);
  11932. this.body.getElements('td').removeClass(this.options.classCellSort);
  11933. },
  11934. reSort: function(){
  11935. if (this.sortable) this.sort.call(this, this.sorted.index, this.sorted.reverse);
  11936. return this;
  11937. },
  11938. enableSort: function(){
  11939. this.element.addClass(this.options.classSortable);
  11940. this.attachSorts(true);
  11941. this.setParsers();
  11942. this.sortable = true;
  11943. return this;
  11944. },
  11945. disableSort: function(){
  11946. this.element.removeClass(this.options.classSortable);
  11947. this.attachSorts(false);
  11948. this.sortSpans.each(function(span){
  11949. span.destroy();
  11950. });
  11951. this.sortSpans.empty();
  11952. this.sortable = false;
  11953. return this;
  11954. }
  11955. });
  11956. HtmlTable.ParserPriority = ['date', 'input-checked', 'input-value', 'float', 'number'];
  11957. HtmlTable.Parsers = {
  11958. 'date': {
  11959. match: /^\d{2}[-\/ ]\d{2}[-\/ ]\d{2,4}$/,
  11960. convert: function(){
  11961. var d = Date.parse(this.get('text').stripTags());
  11962. return (typeOf(d) == 'date') ? d.format('db') : '';
  11963. },
  11964. type: 'date'
  11965. },
  11966. 'input-checked': {
  11967. match: / type="(radio|checkbox)"/,
  11968. convert: function(){
  11969. return this.getElement('input').checked;
  11970. }
  11971. },
  11972. 'input-value': {
  11973. match: /<input/,
  11974. convert: function(){
  11975. return this.getElement('input').value;
  11976. }
  11977. },
  11978. 'number': {
  11979. match: /^\d+[^\d.,]*$/,
  11980. convert: function(){
  11981. return this.get('text').stripTags().toInt();
  11982. },
  11983. number: true
  11984. },
  11985. 'numberLax': {
  11986. match: /^[^\d]+\d+$/,
  11987. convert: function(){
  11988. return this.get('text').replace(/[^-?^0-9]/, '').stripTags().toInt();
  11989. },
  11990. number: true
  11991. },
  11992. 'float': {
  11993. match: /^[\d]+\.[\d]+/,
  11994. convert: function(){
  11995. return this.get('text').replace(/[^-?^\d.e]/, '').stripTags().toFloat();
  11996. },
  11997. number: true
  11998. },
  11999. 'floatLax': {
  12000. match: /^[^\d]+[\d]+\.[\d]+$/,
  12001. convert: function(){
  12002. return this.get('text').replace(/[^-?^\d.]/, '').stripTags().toFloat();
  12003. },
  12004. number: true
  12005. },
  12006. 'string': {
  12007. match: null,
  12008. convert: function(){
  12009. return this.get('text').stripTags().toLowerCase();
  12010. }
  12011. },
  12012. 'title': {
  12013. match: null,
  12014. convert: function(){
  12015. return this.title;
  12016. }
  12017. }
  12018. };
  12019. //<1.2compat>
  12020. HtmlTable.Parsers = new Hash(HtmlTable.Parsers);
  12021. //</1.2compat>
  12022. HtmlTable.defineParsers = function(parsers){
  12023. HtmlTable.Parsers = Object.append(HtmlTable.Parsers, parsers);
  12024. for (var parser in parsers){
  12025. HtmlTable.ParserPriority.unshift(parser);
  12026. }
  12027. };
  12028. })();
  12029. /*
  12030. ---
  12031. script: HtmlTable.Zebra.js
  12032. name: HtmlTable.Zebra
  12033. description: Builds a stripy table with methods to add rows.
  12034. license: MIT-style license
  12035. authors:
  12036. - Harald Kirschner
  12037. - Aaron Newton
  12038. requires:
  12039. - HtmlTable
  12040. - Element.Shortcuts
  12041. - Class.refactor
  12042. provides: [HtmlTable.Zebra]
  12043. ...
  12044. */
  12045. HtmlTable = Class.refactor(HtmlTable, {
  12046. options: {
  12047. classZebra: 'table-tr-odd',
  12048. zebra: true,
  12049. zebraOnlyVisibleRows: true
  12050. },
  12051. initialize: function(){
  12052. this.previous.apply(this, arguments);
  12053. if (this.occluded) return this.occluded;
  12054. if (this.options.zebra) this.updateZebras();
  12055. },
  12056. updateZebras: function(){
  12057. var index = 0;
  12058. Array.each(this.body.rows, function(row){
  12059. if (!this.options.zebraOnlyVisibleRows || row.isDisplayed()){
  12060. this.zebra(row, index++);
  12061. }
  12062. }, this);
  12063. },
  12064. setRowStyle: function(row, i){
  12065. if (this.previous) this.previous(row, i);
  12066. this.zebra(row, i);
  12067. },
  12068. zebra: function(row, i){
  12069. return row[((i % 2) ? 'remove' : 'add')+'Class'](this.options.classZebra);
  12070. },
  12071. push: function(){
  12072. var pushed = this.previous.apply(this, arguments);
  12073. if (this.options.zebra) this.updateZebras();
  12074. return pushed;
  12075. }
  12076. });
  12077. /*
  12078. ---
  12079. script: Scroller.js
  12080. name: Scroller
  12081. description: Class which scrolls the contents of any Element (including the window) when the mouse reaches the Element's boundaries.
  12082. license: MIT-style license
  12083. authors:
  12084. - Valerio Proietti
  12085. requires:
  12086. - Core/Events
  12087. - Core/Options
  12088. - Core/Element.Event
  12089. - Core/Element.Dimensions
  12090. - MooTools.More
  12091. provides: [Scroller]
  12092. ...
  12093. */
  12094. (function(){
  12095. var Scroller = this.Scroller = new Class({
  12096. Implements: [Events, Options],
  12097. options: {
  12098. area: 20,
  12099. velocity: 1,
  12100. onChange: function(x, y){
  12101. this.element.scrollTo(x, y);
  12102. },
  12103. fps: 50
  12104. },
  12105. initialize: function(element, options){
  12106. this.setOptions(options);
  12107. this.element = document.id(element);
  12108. this.docBody = document.id(this.element.getDocument().body);
  12109. this.listener = (typeOf(this.element) != 'element') ? this.docBody : this.element;
  12110. this.timer = null;
  12111. this.bound = {
  12112. attach: this.attach.bind(this),
  12113. detach: this.detach.bind(this),
  12114. getCoords: this.getCoords.bind(this)
  12115. };
  12116. },
  12117. start: function(){
  12118. this.listener.addEvents({
  12119. mouseover: this.bound.attach,
  12120. mouseleave: this.bound.detach
  12121. });
  12122. return this;
  12123. },
  12124. stop: function(){
  12125. this.listener.removeEvents({
  12126. mouseover: this.bound.attach,
  12127. mouseleave: this.bound.detach
  12128. });
  12129. this.detach();
  12130. this.timer = clearInterval(this.timer);
  12131. return this;
  12132. },
  12133. attach: function(){
  12134. this.listener.addEvent('mousemove', this.bound.getCoords);
  12135. },
  12136. detach: function(){
  12137. this.listener.removeEvent('mousemove', this.bound.getCoords);
  12138. this.timer = clearInterval(this.timer);
  12139. },
  12140. getCoords: function(event){
  12141. this.page = (this.listener.get('tag') == 'body') ? event.client : event.page;
  12142. if (!this.timer) this.timer = this.scroll.periodical(Math.round(1000 / this.options.fps), this);
  12143. },
  12144. scroll: function(){
  12145. var size = this.element.getSize(),
  12146. scroll = this.element.getScroll(),
  12147. pos = ((this.element != this.docBody) && (this.element != window)) ? this.element.getOffsets() : {x: 0, y: 0},
  12148. scrollSize = this.element.getScrollSize(),
  12149. change = {x: 0, y: 0},
  12150. top = this.options.area.top || this.options.area,
  12151. bottom = this.options.area.bottom || this.options.area;
  12152. for (var z in this.page){
  12153. if (this.page[z] < (top + pos[z]) && scroll[z] != 0){
  12154. change[z] = (this.page[z] - top - pos[z]) * this.options.velocity;
  12155. } else if (this.page[z] + bottom > (size[z] + pos[z]) && scroll[z] + size[z] != scrollSize[z]){
  12156. change[z] = (this.page[z] - size[z] + bottom - pos[z]) * this.options.velocity;
  12157. }
  12158. change[z] = change[z].round();
  12159. }
  12160. if (change.y || change.x) this.fireEvent('change', [scroll.x + change.x, scroll.y + change.y]);
  12161. }
  12162. });
  12163. })();
  12164. /*
  12165. ---
  12166. script: Tips.js
  12167. name: Tips
  12168. description: Class for creating nice tips that follow the mouse cursor when hovering an element.
  12169. license: MIT-style license
  12170. authors:
  12171. - Valerio Proietti
  12172. - Christoph Pojer
  12173. - Luis Merino
  12174. requires:
  12175. - Core/Options
  12176. - Core/Events
  12177. - Core/Element.Event
  12178. - Core/Element.Style
  12179. - Core/Element.Dimensions
  12180. - MooTools.More
  12181. provides: [Tips]
  12182. ...
  12183. */
  12184. (function(){
  12185. var read = function(option, element){
  12186. return (option) ? (typeOf(option) == 'function' ? option(element) : element.get(option)) : '';
  12187. };
  12188. var Tips = this.Tips = new Class({
  12189. Implements: [Events, Options],
  12190. options: {/*
  12191. id: null,
  12192. onAttach: function(element){},
  12193. onDetach: function(element){},
  12194. onBound: function(coords){},*/
  12195. onShow: function(){
  12196. this.tip.setStyle('display', 'block');
  12197. },
  12198. onHide: function(){
  12199. this.tip.setStyle('display', 'none');
  12200. },
  12201. title: 'title',
  12202. text: function(element){
  12203. return element.get('rel') || element.get('href');
  12204. },
  12205. showDelay: 100,
  12206. hideDelay: 100,
  12207. className: 'tip-wrap',
  12208. offset: {x: 16, y: 16},
  12209. windowPadding: {x:0, y:0},
  12210. fixed: false,
  12211. waiAria: true,
  12212. hideEmpty: false
  12213. },
  12214. initialize: function(){
  12215. var params = Array.link(arguments, {
  12216. options: Type.isObject,
  12217. elements: function(obj){
  12218. return obj != null;
  12219. }
  12220. });
  12221. this.setOptions(params.options);
  12222. if (params.elements) this.attach(params.elements);
  12223. this.container = new Element('div', {'class': 'tip'});
  12224. if (this.options.id){
  12225. this.container.set('id', this.options.id);
  12226. if (this.options.waiAria) this.attachWaiAria();
  12227. }
  12228. },
  12229. toElement: function(){
  12230. if (this.tip) return this.tip;
  12231. this.tip = new Element('div', {
  12232. 'class': this.options.className,
  12233. styles: {
  12234. position: 'absolute',
  12235. top: 0,
  12236. left: 0,
  12237. display: 'none'
  12238. }
  12239. }).adopt(
  12240. new Element('div', {'class': 'tip-top'}),
  12241. this.container,
  12242. new Element('div', {'class': 'tip-bottom'})
  12243. );
  12244. return this.tip;
  12245. },
  12246. attachWaiAria: function(){
  12247. var id = this.options.id;
  12248. this.container.set('role', 'tooltip');
  12249. if (!this.waiAria){
  12250. this.waiAria = {
  12251. show: function(element){
  12252. if (id) element.set('aria-describedby', id);
  12253. this.container.set('aria-hidden', 'false');
  12254. },
  12255. hide: function(element){
  12256. if (id) element.erase('aria-describedby');
  12257. this.container.set('aria-hidden', 'true');
  12258. }
  12259. };
  12260. }
  12261. this.addEvents(this.waiAria);
  12262. },
  12263. detachWaiAria: function(){
  12264. if (this.waiAria){
  12265. this.container.erase('role');
  12266. this.container.erase('aria-hidden');
  12267. this.removeEvents(this.waiAria);
  12268. }
  12269. },
  12270. attach: function(elements){
  12271. $$(elements).each(function(element){
  12272. var title = read(this.options.title, element),
  12273. text = read(this.options.text, element);
  12274. element.set('title', '').store('tip:native', title).retrieve('tip:title', title);
  12275. element.retrieve('tip:text', text);
  12276. this.fireEvent('attach', [element]);
  12277. var events = ['enter', 'leave'];
  12278. if (!this.options.fixed) events.push('move');
  12279. events.each(function(value){
  12280. var event = element.retrieve('tip:' + value);
  12281. if (!event) event = function(event){
  12282. this['element' + value.capitalize()].apply(this, [event, element]);
  12283. }.bind(this);
  12284. element.store('tip:' + value, event).addEvent('mouse' + value, event);
  12285. }, this);
  12286. }, this);
  12287. return this;
  12288. },
  12289. detach: function(elements){
  12290. $$(elements).each(function(element){
  12291. ['enter', 'leave', 'move'].each(function(value){
  12292. element.removeEvent('mouse' + value, element.retrieve('tip:' + value)).eliminate('tip:' + value);
  12293. });
  12294. this.fireEvent('detach', [element]);
  12295. if (this.options.title == 'title'){ // This is necessary to check if we can revert the title
  12296. var original = element.retrieve('tip:native');
  12297. if (original) element.set('title', original);
  12298. }
  12299. }, this);
  12300. return this;
  12301. },
  12302. elementEnter: function(event, element){
  12303. clearTimeout(this.timer);
  12304. this.timer = (function(){
  12305. this.container.empty();
  12306. var showTip = !this.options.hideEmpty;
  12307. ['title', 'text'].each(function(value){
  12308. var content = element.retrieve('tip:' + value);
  12309. var div = this['_' + value + 'Element'] = new Element('div', {
  12310. 'class': 'tip-' + value
  12311. }).inject(this.container);
  12312. if (content){
  12313. this.fill(div, content);
  12314. showTip = true;
  12315. }
  12316. }, this);
  12317. if (showTip){
  12318. this.show(element);
  12319. } else {
  12320. this.hide(element);
  12321. }
  12322. this.position((this.options.fixed) ? {page: element.getPosition()} : event);
  12323. }).delay(this.options.showDelay, this);
  12324. },
  12325. elementLeave: function(event, element){
  12326. clearTimeout(this.timer);
  12327. this.timer = this.hide.delay(this.options.hideDelay, this, element);
  12328. this.fireForParent(event, element);
  12329. },
  12330. setTitle: function(title){
  12331. if (this._titleElement){
  12332. this._titleElement.empty();
  12333. this.fill(this._titleElement, title);
  12334. }
  12335. return this;
  12336. },
  12337. setText: function(text){
  12338. if (this._textElement){
  12339. this._textElement.empty();
  12340. this.fill(this._textElement, text);
  12341. }
  12342. return this;
  12343. },
  12344. fireForParent: function(event, element){
  12345. element = element.getParent();
  12346. if (!element || element == document.body) return;
  12347. if (element.retrieve('tip:enter')) element.fireEvent('mouseenter', event);
  12348. else this.fireForParent(event, element);
  12349. },
  12350. elementMove: function(event, element){
  12351. this.position(event);
  12352. },
  12353. position: function(event){
  12354. if (!this.tip) document.id(this);
  12355. var size = window.getSize(), scroll = window.getScroll(),
  12356. tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight},
  12357. props = {x: 'left', y: 'top'},
  12358. bounds = {y: false, x2: false, y2: false, x: false},
  12359. obj = {};
  12360. for (var z in props){
  12361. obj[props[z]] = event.page[z] + this.options.offset[z];
  12362. if (obj[props[z]] < 0) bounds[z] = true;
  12363. if ((obj[props[z]] + tip[z] - scroll[z]) > size[z] - this.options.windowPadding[z]){
  12364. obj[props[z]] = event.page[z] - this.options.offset[z] - tip[z];
  12365. bounds[z+'2'] = true;
  12366. }
  12367. }
  12368. this.fireEvent('bound', bounds);
  12369. this.tip.setStyles(obj);
  12370. },
  12371. fill: function(element, contents){
  12372. if (typeof contents == 'string') element.set('html', contents);
  12373. else element.adopt(contents);
  12374. },
  12375. show: function(element){
  12376. if (!this.tip) document.id(this);
  12377. if (!this.tip.getParent()) this.tip.inject(document.body);
  12378. this.fireEvent('show', [this.tip, element]);
  12379. },
  12380. hide: function(element){
  12381. if (!this.tip) document.id(this);
  12382. this.fireEvent('hide', [this.tip, element]);
  12383. }
  12384. });
  12385. })();
  12386. /*
  12387. ---
  12388. name: Locale.CH.Number
  12389. description: Number messages for Switzerland.
  12390. license: MIT-style license
  12391. authors:
  12392. - Kim D. Jeker
  12393. requires:
  12394. - Locale
  12395. provides: [Locale.CH.Number]
  12396. ...
  12397. */
  12398. Locale.define('CH', 'Number', {
  12399. decimal: ',',
  12400. group: '\'',
  12401. currency: {
  12402. decimal: '.',
  12403. suffix: ' CHF'
  12404. }
  12405. });
  12406. /*
  12407. ---
  12408. name: Locale.EU.Number
  12409. description: Number messages for Europe.
  12410. license: MIT-style license
  12411. authors:
  12412. - Arian Stolwijk
  12413. requires:
  12414. - Locale
  12415. provides: [Locale.EU.Number]
  12416. ...
  12417. */
  12418. Locale.define('EU', 'Number', {
  12419. decimal: ',',
  12420. group: '.',
  12421. currency: {
  12422. prefix: '€ '
  12423. }
  12424. });
  12425. /*
  12426. ---
  12427. script: Locale.Set.From.js
  12428. name: Locale.Set.From
  12429. description: Provides an alternative way to create Locale.Set objects.
  12430. license: MIT-style license
  12431. authors:
  12432. - Tim Wienk
  12433. requires:
  12434. - Core/JSON
  12435. - Locale
  12436. provides: Locale.Set.From
  12437. ...
  12438. */
  12439. (function(){
  12440. var parsers = {
  12441. 'json': JSON.decode
  12442. };
  12443. Locale.Set.defineParser = function(name, fn){
  12444. parsers[name] = fn;
  12445. };
  12446. Locale.Set.from = function(set, type){
  12447. if (instanceOf(set, Locale.Set)) return set;
  12448. if (!type && typeOf(set) == 'string') type = 'json';
  12449. if (parsers[type]) set = parsers[type](set);
  12450. var locale = new Locale.Set;
  12451. locale.sets = set.sets || {};
  12452. if (set.inherits){
  12453. locale.inherits.locales = Array.convert(set.inherits.locales);
  12454. locale.inherits.sets = set.inherits.sets || {};
  12455. }
  12456. return locale;
  12457. };
  12458. })();
  12459. /*
  12460. ---
  12461. name: Locale.ZA.Number
  12462. description: Number messages for ZA.
  12463. license: MIT-style license
  12464. authors:
  12465. - Werner Mollentze
  12466. requires:
  12467. - Locale
  12468. provides: [Locale.ZA.Number]
  12469. ...
  12470. */
  12471. Locale.define('ZA', 'Number', {
  12472. decimal: '.',
  12473. group: ',',
  12474. currency: {
  12475. prefix: 'R '
  12476. }
  12477. });
  12478. /*
  12479. ---
  12480. name: Locale.af-ZA.Date
  12481. description: Date messages for ZA Afrikaans.
  12482. license: MIT-style license
  12483. authors:
  12484. - Werner Mollentze
  12485. requires:
  12486. - Locale
  12487. provides: [Locale.af-ZA.Date]
  12488. ...
  12489. */
  12490. Locale.define('af-ZA', 'Date', {
  12491. months: ['Januarie', 'Februarie', 'Maart', 'April', 'Mei', 'Junie', 'Julie', 'Augustus', 'September', 'Oktober', 'November', 'Desember'],
  12492. months_abbr: ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
  12493. days: ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'],
  12494. days_abbr: ['Son', 'Maa', 'Din', 'Woe', 'Don', 'Vry', 'Sat'],
  12495. // Culture's date order: MM/DD/YYYY
  12496. dateOrder: ['date', 'month', 'year'],
  12497. shortDate: '%d-%m-%Y',
  12498. shortTime: '%H:%M',
  12499. AM: 'VM',
  12500. PM: 'NM',
  12501. firstDayOfWeek: 1,
  12502. // Date.Extras
  12503. ordinal: function(dayOfMonth){
  12504. return ((dayOfMonth > 1 && dayOfMonth < 20 && dayOfMonth != 8) || (dayOfMonth > 100 && dayOfMonth.toString().substr(-2, 1) == '1')) ? 'de' : 'ste';
  12505. },
  12506. lessThanMinuteAgo: 'minder as \'n minuut gelede',
  12507. minuteAgo: 'ongeveer \'n minuut gelede',
  12508. minutesAgo: '{delta} minute gelede',
  12509. hourAgo: 'omtret \'n uur gelede',
  12510. hoursAgo: 'ongeveer {delta} ure gelede',
  12511. dayAgo: '1 dag gelede',
  12512. daysAgo: '{delta} dae gelede',
  12513. weekAgo: '1 week gelede',
  12514. weeksAgo: '{delta} weke gelede',
  12515. monthAgo: '1 maand gelede',
  12516. monthsAgo: '{delta} maande gelede',
  12517. yearAgo: '1 jaar gelede',
  12518. yearsAgo: '{delta} jare gelede',
  12519. lessThanMinuteUntil: 'oor minder as \'n minuut',
  12520. minuteUntil: 'oor ongeveer \'n minuut',
  12521. minutesUntil: 'oor {delta} minute',
  12522. hourUntil: 'oor ongeveer \'n uur',
  12523. hoursUntil: 'oor {delta} uur',
  12524. dayUntil: 'oor ongeveer \'n dag',
  12525. daysUntil: 'oor {delta} dae',
  12526. weekUntil: 'oor \'n week',
  12527. weeksUntil: 'oor {delta} weke',
  12528. monthUntil: 'oor \'n maand',
  12529. monthsUntil: 'oor {delta} maande',
  12530. yearUntil: 'oor \'n jaar',
  12531. yearsUntil: 'oor {delta} jaar'
  12532. });
  12533. /*
  12534. ---
  12535. name: Locale.af-ZA.Form.Validator
  12536. description: Form Validator messages for Afrikaans.
  12537. license: MIT-style license
  12538. authors:
  12539. - Werner Mollentze
  12540. requires:
  12541. - Locale
  12542. provides: [Locale.af-ZA.Form.Validator]
  12543. ...
  12544. */
  12545. Locale.define('af-ZA', 'FormValidator', {
  12546. required: 'Hierdie veld word vereis.',
  12547. length: 'Voer asseblief {length} karakters in (u het {elLength} karakters ingevoer)',
  12548. minLength: 'Voer asseblief ten minste {minLength} karakters in (u het {length} karakters ingevoer).',
  12549. maxLength: 'Moet asseblief nie meer as {maxLength} karakters invoer nie (u het {length} karakters ingevoer).',
  12550. integer: 'Voer asseblief \'n heelgetal in hierdie veld in. Getalle met desimale (bv. 1.25) word nie toegelaat nie.',
  12551. numeric: 'Voer asseblief slegs numeriese waardes in hierdie veld in (bv. "1" of "1.1" of "-1" of "-1.1").',
  12552. digits: 'Gebruik asseblief slegs nommers en punktuasie in hierdie veld. (by voorbeeld, \'n telefoon nommer wat koppeltekens en punte bevat is toelaatbaar).',
  12553. alpha: 'Gebruik asseblief slegs letters (a-z) binne-in hierdie veld. Geen spasies of ander karakters word toegelaat nie.',
  12554. alphanum: 'Gebruik asseblief slegs letters (a-z) en nommers (0-9) binne-in hierdie veld. Geen spasies of ander karakters word toegelaat nie.',
  12555. dateSuchAs: 'Voer asseblief \'n geldige datum soos {date} in',
  12556. dateInFormatMDY: 'Voer asseblief \'n geldige datum soos MM/DD/YYYY in (bv. "12/31/1999")',
  12557. email: 'Voer asseblief \'n geldige e-pos adres in. Byvoorbeeld "fred@domain.com".',
  12558. url: 'Voer asseblief \'n geldige bronadres (URL) soos http://www.example.com in.',
  12559. currencyDollar: 'Voer asseblief \'n geldige $ bedrag in. Byvoorbeeld $100.00 .',
  12560. oneRequired: 'Voer asseblief iets in vir ten minste een van hierdie velde.',
  12561. errorPrefix: 'Fout: ',
  12562. warningPrefix: 'Waarskuwing: ',
  12563. // Form.Validator.Extras
  12564. noSpace: 'Daar mag geen spasies in hierdie toevoer wees nie.',
  12565. reqChkByNode: 'Geen items is gekies nie.',
  12566. requiredChk: 'Hierdie veld word vereis.',
  12567. reqChkByName: 'Kies asseblief \'n {label}.',
  12568. match: 'Hierdie veld moet by die {matchName} veld pas',
  12569. startDate: 'die begin datum',
  12570. endDate: 'die eind datum',
  12571. currentDate: 'die huidige datum',
  12572. afterDate: 'Die datum moet dieselfde of na {label} wees.',
  12573. beforeDate: 'Die datum moet dieselfde of voor {label} wees.',
  12574. startMonth: 'Kies asseblief \'n begin maand',
  12575. sameMonth: 'Hierdie twee datums moet in dieselfde maand wees - u moet een of beide verander.',
  12576. creditcard: 'Die ingevoerde kredietkaart nommer is ongeldig. Bevestig asseblief die nommer en probeer weer. {length} syfers is ingevoer.'
  12577. });
  12578. /*
  12579. ---
  12580. name: Locale.af-ZA.Number
  12581. description: Number messages for ZA Afrikaans.
  12582. license: MIT-style license
  12583. authors:
  12584. - Werner Mollentze
  12585. requires:
  12586. - Locale
  12587. - Locale.ZA.Number
  12588. provides: [Locale.af-ZA.Number]
  12589. ...
  12590. */
  12591. Locale.define('af-ZA').inherit('ZA', 'Number');
  12592. /*
  12593. ---
  12594. name: Locale.ar.Date
  12595. description: Date messages for Arabic.
  12596. license: MIT-style license
  12597. authors:
  12598. - Chafik Barbar
  12599. requires:
  12600. - Locale
  12601. provides: [Locale.ar.Date]
  12602. ...
  12603. */
  12604. Locale.define('ar', 'Date', {
  12605. // Culture's date order: DD/MM/YYYY
  12606. dateOrder: ['date', 'month', 'year'],
  12607. shortDate: '%d/%m/%Y',
  12608. shortTime: '%H:%M'
  12609. });
  12610. /*
  12611. ---
  12612. name: Locale.ar.Form.Validator
  12613. description: Form Validator messages for Arabic.
  12614. license: MIT-style license
  12615. authors:
  12616. - Chafik Barbar
  12617. requires:
  12618. - Locale
  12619. provides: [Locale.ar.Form.Validator]
  12620. ...
  12621. */
  12622. Locale.define('ar', 'FormValidator', {
  12623. required: 'هذا الحقل مطلوب.',
  12624. minLength: 'رجاءً إدخال {minLength} أحرف على الأقل (تم إدخال {length} أحرف).',
  12625. maxLength: 'الرجاء عدم إدخال أكثر من {maxLength} أحرف (تم إدخال {length} أحرف).',
  12626. integer: 'الرجاء إدخال عدد صحيح في هذا الحقل. أي رقم ذو كسر عشري أو مئوي (مثال 1.25 ) غير مسموح.',
  12627. numeric: 'الرجاء إدخال قيم رقمية في هذا الحقل (مثال "1" أو "1.1" أو "-1" أو "-1.1").',
  12628. digits: 'الرجاء أستخدام قيم رقمية وعلامات ترقيمية فقط في هذا الحقل (مثال, رقم هاتف مع نقطة أو شحطة)',
  12629. alpha: 'الرجاء أستخدام أحرف فقط (ا-ي) في هذا الحقل. أي فراغات أو علامات غير مسموحة.',
  12630. alphanum: 'الرجاء أستخدام أحرف فقط (ا-ي) أو أرقام (0-9) فقط في هذا الحقل. أي فراغات أو علامات غير مسموحة.',
  12631. dateSuchAs: 'الرجاء إدخال تاريخ صحيح كالتالي {date}',
  12632. dateInFormatMDY: 'الرجاء إدخال تاريخ صحيح (مثال, 31-12-1999)',
  12633. email: 'الرجاء إدخال بريد إلكتروني صحيح.',
  12634. url: 'الرجاء إدخال عنوان إلكتروني صحيح مثل http://www.example.com',
  12635. currencyDollar: 'الرجاء إدخال قيمة $ صحيحة. مثال, 100.00$',
  12636. oneRequired: 'الرجاء إدخال قيمة في أحد هذه الحقول على الأقل.',
  12637. errorPrefix: 'خطأ: ',
  12638. warningPrefix: 'تحذير: '
  12639. });
  12640. /*
  12641. ---
  12642. name: Locale.ca-CA.Date
  12643. description: Date messages for Catalan.
  12644. license: MIT-style license
  12645. authors:
  12646. - Ãlfons Sanchez
  12647. requires:
  12648. - Locale
  12649. provides: [Locale.ca-CA.Date]
  12650. ...
  12651. */
  12652. Locale.define('ca-CA', 'Date', {
  12653. months: ['Gener', 'Febrer', 'Març', 'Abril', 'Maig', 'Juny', 'Juli', 'Agost', 'Setembre', 'Octubre', 'Novembre', 'Desembre'],
  12654. months_abbr: ['gen.', 'febr.', 'març', 'abr.', 'maig', 'juny', 'jul.', 'ag.', 'set.', 'oct.', 'nov.', 'des.'],
  12655. days: ['Diumenge', 'Dilluns', 'Dimarts', 'Dimecres', 'Dijous', 'Divendres', 'Dissabte'],
  12656. days_abbr: ['dg', 'dl', 'dt', 'dc', 'dj', 'dv', 'ds'],
  12657. // Culture's date order: DD/MM/YYYY
  12658. dateOrder: ['date', 'month', 'year'],
  12659. shortDate: '%d/%m/%Y',
  12660. shortTime: '%H:%M',
  12661. AM: 'AM',
  12662. PM: 'PM',
  12663. firstDayOfWeek: 0,
  12664. // Date.Extras
  12665. ordinal: '',
  12666. lessThanMinuteAgo: 'fa menys d`un minut',
  12667. minuteAgo: 'fa un minut',
  12668. minutesAgo: 'fa {delta} minuts',
  12669. hourAgo: 'fa un hora',
  12670. hoursAgo: 'fa unes {delta} hores',
  12671. dayAgo: 'fa un dia',
  12672. daysAgo: 'fa {delta} dies',
  12673. lessThanMinuteUntil: 'menys d`un minut des d`ara',
  12674. minuteUntil: 'un minut des d`ara',
  12675. minutesUntil: '{delta} minuts des d`ara',
  12676. hourUntil: 'un hora des d`ara',
  12677. hoursUntil: 'unes {delta} hores des d`ara',
  12678. dayUntil: '1 dia des d`ara',
  12679. daysUntil: '{delta} dies des d`ara'
  12680. });
  12681. /*
  12682. ---
  12683. name: Locale.ca-CA.Form.Validator
  12684. description: Form Validator messages for Catalan.
  12685. license: MIT-style license
  12686. authors:
  12687. - Miquel Hudin
  12688. - Ãlfons Sanchez
  12689. requires:
  12690. - Locale
  12691. provides: [Locale.ca-CA.Form.Validator]
  12692. ...
  12693. */
  12694. Locale.define('ca-CA', 'FormValidator', {
  12695. required: 'Aquest camp es obligatori.',
  12696. minLength: 'Per favor introdueix al menys {minLength} caracters (has introduit {length} caracters).',
  12697. maxLength: 'Per favor introdueix no mes de {maxLength} caracters (has introduit {length} caracters).',
  12698. integer: 'Per favor introdueix un nombre enter en aquest camp. Nombres amb decimals (p.e. 1,25) no estan permesos.',
  12699. numeric: 'Per favor introdueix sols valors numerics en aquest camp (p.e. "1" o "1,1" o "-1" o "-1,1").',
  12700. digits: 'Per favor usa sols numeros i puntuacio en aquest camp (per exemple, un nombre de telefon amb guions i punts no esta permes).',
  12701. alpha: 'Per favor utilitza lletres nomes (a-z) en aquest camp. No s´admiteixen espais ni altres caracters.',
  12702. alphanum: 'Per favor, utilitza nomes lletres (a-z) o numeros (0-9) en aquest camp. No s´admiteixen espais ni altres caracters.',
  12703. dateSuchAs: 'Per favor introdueix una data valida com {date}',
  12704. dateInFormatMDY: 'Per favor introdueix una data valida com DD/MM/YYYY (p.e. "31/12/1999")',
  12705. email: 'Per favor, introdueix una adreça de correu electronic valida. Per exemple, "fred@domain.com".',
  12706. url: 'Per favor introdueix una URL valida com http://www.example.com.',
  12707. currencyDollar: 'Per favor introdueix una quantitat valida de €. Per exemple €100,00 .',
  12708. oneRequired: 'Per favor introdueix alguna cosa per al menys una d´aquestes entrades.',
  12709. errorPrefix: 'Error: ',
  12710. warningPrefix: 'Avis: ',
  12711. // Form.Validator.Extras
  12712. noSpace: 'No poden haver espais en aquesta entrada.',
  12713. reqChkByNode: 'No hi han elements seleccionats.',
  12714. requiredChk: 'Aquest camp es obligatori.',
  12715. reqChkByName: 'Per favor selecciona una {label}.',
  12716. match: 'Aquest camp necessita coincidir amb el camp {matchName}',
  12717. startDate: 'la data de inici',
  12718. endDate: 'la data de fi',
  12719. currentDate: 'la data actual',
  12720. afterDate: 'La data deu ser igual o posterior a {label}.',
  12721. beforeDate: 'La data deu ser igual o anterior a {label}.',
  12722. startMonth: 'Per favor selecciona un mes d´orige',
  12723. sameMonth: 'Aquestes dos dates deuen estar dins del mateix mes - deus canviar una o altra.'
  12724. });
  12725. /*
  12726. ---
  12727. name: Locale.cs-CZ.Date
  12728. description: Date messages for Czech.
  12729. license: MIT-style license
  12730. authors:
  12731. - Jan Černý chemiX
  12732. - Christopher Zukowski
  12733. requires:
  12734. - Locale
  12735. provides: [Locale.cs-CZ.Date]
  12736. ...
  12737. */
  12738. (function(){
  12739. // Czech language pluralization rules, see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  12740. // one -> n is 1; 1
  12741. // few -> n in 2..4; 2-4
  12742. // other -> everything else 0, 5-999, 1.31, 2.31, 5.31...
  12743. var pluralize = function(n, one, few, other){
  12744. if (n == 1) return one;
  12745. else if (n == 2 || n == 3 || n == 4) return few;
  12746. else return other;
  12747. };
  12748. Locale.define('cs-CZ', 'Date', {
  12749. months: ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'],
  12750. months_abbr: ['ledna', 'února', 'března', 'dubna', 'května', 'června', 'července', 'srpna', 'září', 'října', 'listopadu', 'prosince'],
  12751. days: ['Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'],
  12752. days_abbr: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
  12753. // Culture's date order: DD.MM.YYYY
  12754. dateOrder: ['date', 'month', 'year'],
  12755. shortDate: '%d.%m.%Y',
  12756. shortTime: '%H:%M',
  12757. AM: 'dop.',
  12758. PM: 'odp.',
  12759. firstDayOfWeek: 1,
  12760. // Date.Extras
  12761. ordinal: '.',
  12762. lessThanMinuteAgo: 'před chvílí',
  12763. minuteAgo: 'přibližně před minutou',
  12764. minutesAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'minutou', 'minutami', 'minutami'); },
  12765. hourAgo: 'přibližně před hodinou',
  12766. hoursAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'hodinou', 'hodinami', 'hodinami'); },
  12767. dayAgo: 'před dnem',
  12768. daysAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'dnem', 'dny', 'dny'); },
  12769. weekAgo: 'před týdnem',
  12770. weeksAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'týdnem', 'týdny', 'týdny'); },
  12771. monthAgo: 'před měsícem',
  12772. monthsAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'měsícem', 'měsíci', 'měsíci'); },
  12773. yearAgo: 'před rokem',
  12774. yearsAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'rokem', 'lety', 'lety'); },
  12775. lessThanMinuteUntil: 'za chvíli',
  12776. minuteUntil: 'přibližně za minutu',
  12777. minutesUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'minutu', 'minuty', 'minut'); },
  12778. hourUntil: 'přibližně za hodinu',
  12779. hoursUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'hodinu', 'hodiny', 'hodin'); },
  12780. dayUntil: 'za den',
  12781. daysUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'den', 'dny', 'dnů'); },
  12782. weekUntil: 'za týden',
  12783. weeksUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'týden', 'týdny', 'týdnů'); },
  12784. monthUntil: 'za měsíc',
  12785. monthsUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'měsíc', 'měsíce', 'měsíců'); },
  12786. yearUntil: 'za rok',
  12787. yearsUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'rok', 'roky', 'let'); }
  12788. });
  12789. })();
  12790. /*
  12791. ---
  12792. name: Locale.cs-CZ.Form.Validator
  12793. description: Form Validator messages for Czech.
  12794. license: MIT-style license
  12795. authors:
  12796. - Jan Černý chemiX
  12797. requires:
  12798. - Locale
  12799. provides: [Locale.cs-CZ.Form.Validator]
  12800. ...
  12801. */
  12802. Locale.define('cs-CZ', 'FormValidator', {
  12803. required: 'Tato položka je povinná.',
  12804. minLength: 'Zadejte prosím alespoň {minLength} znaků (napsáno {length} znaků).',
  12805. maxLength: 'Zadejte prosím méně než {maxLength} znaků (nápsáno {length} znaků).',
  12806. integer: 'Zadejte prosím celé číslo. Desetinná čísla (např. 1.25) nejsou povolena.',
  12807. numeric: 'Zadejte jen číselné hodnoty (tj. "1" nebo "1.1" nebo "-1" nebo "-1.1").',
  12808. digits: 'Zadejte prosím pouze čísla a interpunkční znaménka(například telefonní číslo s pomlčkami nebo tečkami je povoleno).',
  12809. alpha: 'Zadejte prosím pouze písmena (a-z). Mezery nebo jiné znaky nejsou povoleny.',
  12810. alphanum: 'Zadejte prosím pouze písmena (a-z) nebo číslice (0-9). Mezery nebo jiné znaky nejsou povoleny.',
  12811. dateSuchAs: 'Zadejte prosím platné datum jako {date}',
  12812. dateInFormatMDY: 'Zadejte prosím platné datum jako MM / DD / RRRR (tj. "12/31/1999")',
  12813. email: 'Zadejte prosím platnou e-mailovou adresu. Například "fred@domain.com".',
  12814. url: 'Zadejte prosím platnou URL adresu jako http://www.example.com.',
  12815. currencyDollar: 'Zadejte prosím platnou částku. Například $100.00.',
  12816. oneRequired: 'Zadejte prosím alespoň jednu hodnotu pro tyto položky.',
  12817. errorPrefix: 'Chyba: ',
  12818. warningPrefix: 'Upozornění: ',
  12819. // Form.Validator.Extras
  12820. noSpace: 'V této položce nejsou povoleny mezery',
  12821. reqChkByNode: 'Nejsou vybrány žádné položky.',
  12822. requiredChk: 'Tato položka je vyžadována.',
  12823. reqChkByName: 'Prosím vyberte {label}.',
  12824. match: 'Tato položka se musí shodovat s položkou {matchName}',
  12825. startDate: 'datum zahájení',
  12826. endDate: 'datum ukončení',
  12827. currentDate: 'aktuální datum',
  12828. afterDate: 'Datum by mělo být stejné nebo větší než {label}.',
  12829. beforeDate: 'Datum by mělo být stejné nebo menší než {label}.',
  12830. startMonth: 'Vyberte počáteční měsíc.',
  12831. sameMonth: 'Tyto dva datumy musí být ve stejném měsíci - změňte jeden z nich.',
  12832. creditcard: 'Zadané číslo kreditní karty je neplatné. Prosím opravte ho. Bylo zadáno {length} čísel.'
  12833. });
  12834. /*
  12835. ---
  12836. name: Locale.da-DK.Date
  12837. description: Date messages for Danish.
  12838. license: MIT-style license
  12839. authors:
  12840. - Martin Overgaard
  12841. - Henrik Hansen
  12842. requires:
  12843. - Locale
  12844. provides: [Locale.da-DK.Date]
  12845. ...
  12846. */
  12847. Locale.define('da-DK', 'Date', {
  12848. months: ['Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December'],
  12849. months_abbr: ['jan.', 'feb.', 'mar.', 'apr.', 'maj.', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
  12850. days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
  12851. days_abbr: ['søn', 'man', 'tir', 'ons', 'tor', 'fre', 'lør'],
  12852. // Culture's date order: DD-MM-YYYY
  12853. dateOrder: ['date', 'month', 'year'],
  12854. shortDate: '%d-%m-%Y',
  12855. shortTime: '%H:%M',
  12856. AM: 'AM',
  12857. PM: 'PM',
  12858. firstDayOfWeek: 1,
  12859. // Date.Extras
  12860. ordinal: '.',
  12861. lessThanMinuteAgo: 'mindre end et minut siden',
  12862. minuteAgo: 'omkring et minut siden',
  12863. minutesAgo: '{delta} minutter siden',
  12864. hourAgo: 'omkring en time siden',
  12865. hoursAgo: 'omkring {delta} timer siden',
  12866. dayAgo: '1 dag siden',
  12867. daysAgo: '{delta} dage siden',
  12868. weekAgo: '1 uge siden',
  12869. weeksAgo: '{delta} uger siden',
  12870. monthAgo: '1 måned siden',
  12871. monthsAgo: '{delta} måneder siden',
  12872. yearAgo: '1 år siden',
  12873. yearsAgo: '{delta} år siden',
  12874. lessThanMinuteUntil: 'mindre end et minut fra nu',
  12875. minuteUntil: 'omkring et minut fra nu',
  12876. minutesUntil: '{delta} minutter fra nu',
  12877. hourUntil: 'omkring en time fra nu',
  12878. hoursUntil: 'omkring {delta} timer fra nu',
  12879. dayUntil: '1 dag fra nu',
  12880. daysUntil: '{delta} dage fra nu',
  12881. weekUntil: '1 uge fra nu',
  12882. weeksUntil: '{delta} uger fra nu',
  12883. monthUntil: '1 måned fra nu',
  12884. monthsUntil: '{delta} måneder fra nu',
  12885. yearUntil: '1 år fra nu',
  12886. yearsUntil: '{delta} år fra nu'
  12887. });
  12888. /*
  12889. ---
  12890. name: Locale.da-DK.Form.Validator
  12891. description: Form Validator messages for Danish.
  12892. license: MIT-style license
  12893. authors:
  12894. - Martin Overgaard
  12895. requires:
  12896. - Locale
  12897. provides: [Locale.da-DK.Form.Validator]
  12898. ...
  12899. */
  12900. Locale.define('da-DK', 'FormValidator', {
  12901. required: 'Feltet skal udfyldes.',
  12902. minLength: 'Skriv mindst {minLength} tegn (du skrev {length} tegn).',
  12903. maxLength: 'Skriv maksimalt {maxLength} tegn (du skrev {length} tegn).',
  12904. integer: 'Skriv et tal i dette felt. Decimal tal (f.eks. 1.25) er ikke tilladt.',
  12905. numeric: 'Skriv kun tal i dette felt (i.e. "1" eller "1.1" eller "-1" eller "-1.1").',
  12906. digits: 'Skriv kun tal og tegnsætning i dette felt (eksempel, et telefon nummer med bindestreg eller punktum er tilladt).',
  12907. alpha: 'Skriv kun bogstaver (a-z) i dette felt. Mellemrum og andre tegn er ikke tilladt.',
  12908. alphanum: 'Skriv kun bogstaver (a-z) eller tal (0-9) i dette felt. Mellemrum og andre tegn er ikke tilladt.',
  12909. dateSuchAs: 'Skriv en gyldig dato som {date}',
  12910. dateInFormatMDY: 'Skriv dato i formatet DD-MM-YYYY (f.eks. "31-12-1999")',
  12911. email: 'Skriv en gyldig e-mail adresse. F.eks "fred@domain.com".',
  12912. url: 'Skriv en gyldig URL adresse. F.eks "http://www.example.com".',
  12913. currencyDollar: 'Skriv et gldigt beløb. F.eks Kr.100.00 .',
  12914. oneRequired: 'Et eller flere af felterne i denne formular skal udfyldes.',
  12915. errorPrefix: 'Fejl: ',
  12916. warningPrefix: 'Advarsel: ',
  12917. // Form.Validator.Extras
  12918. noSpace: 'Der må ikke benyttes mellemrum i dette felt.',
  12919. reqChkByNode: 'Foretag et valg.',
  12920. requiredChk: 'Dette felt skal udfyldes.',
  12921. reqChkByName: 'Vælg en {label}.',
  12922. match: 'Dette felt skal matche {matchName} feltet',
  12923. startDate: 'start dato',
  12924. endDate: 'slut dato',
  12925. currentDate: 'dags dato',
  12926. afterDate: 'Datoen skal være større end eller lig med {label}.',
  12927. beforeDate: 'Datoen skal være mindre end eller lig med {label}.',
  12928. startMonth: 'Vælg en start måned',
  12929. sameMonth: 'De valgte datoer skal være i samme måned - skift en af dem.'
  12930. });
  12931. /*
  12932. ---
  12933. name: Locale.de-DE.Date
  12934. description: Date messages for German.
  12935. license: MIT-style license
  12936. authors:
  12937. - Christoph Pojer
  12938. - Frank Rossi
  12939. - Ulrich Petri
  12940. - Fabian Beiner
  12941. requires:
  12942. - Locale
  12943. provides: [Locale.de-DE.Date]
  12944. ...
  12945. */
  12946. Locale.define('de-DE', 'Date', {
  12947. months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
  12948. months_abbr: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
  12949. days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
  12950. days_abbr: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
  12951. // Culture's date order: DD.MM.YYYY
  12952. dateOrder: ['date', 'month', 'year'],
  12953. shortDate: '%d.%m.%Y',
  12954. shortTime: '%H:%M',
  12955. AM: 'vormittags',
  12956. PM: 'nachmittags',
  12957. firstDayOfWeek: 1,
  12958. // Date.Extras
  12959. ordinal: '.',
  12960. lessThanMinuteAgo: 'vor weniger als einer Minute',
  12961. minuteAgo: 'vor einer Minute',
  12962. minutesAgo: 'vor {delta} Minuten',
  12963. hourAgo: 'vor einer Stunde',
  12964. hoursAgo: 'vor {delta} Stunden',
  12965. dayAgo: 'vor einem Tag',
  12966. daysAgo: 'vor {delta} Tagen',
  12967. weekAgo: 'vor einer Woche',
  12968. weeksAgo: 'vor {delta} Wochen',
  12969. monthAgo: 'vor einem Monat',
  12970. monthsAgo: 'vor {delta} Monaten',
  12971. yearAgo: 'vor einem Jahr',
  12972. yearsAgo: 'vor {delta} Jahren',
  12973. lessThanMinuteUntil: 'in weniger als einer Minute',
  12974. minuteUntil: 'in einer Minute',
  12975. minutesUntil: 'in {delta} Minuten',
  12976. hourUntil: 'in ca. einer Stunde',
  12977. hoursUntil: 'in ca. {delta} Stunden',
  12978. dayUntil: 'in einem Tag',
  12979. daysUntil: 'in {delta} Tagen',
  12980. weekUntil: 'in einer Woche',
  12981. weeksUntil: 'in {delta} Wochen',
  12982. monthUntil: 'in einem Monat',
  12983. monthsUntil: 'in {delta} Monaten',
  12984. yearUntil: 'in einem Jahr',
  12985. yearsUntil: 'in {delta} Jahren'
  12986. });
  12987. /*
  12988. ---
  12989. name: Locale.de-CH.Date
  12990. description: Date messages for German (Switzerland).
  12991. license: MIT-style license
  12992. authors:
  12993. - Michael van der Weg
  12994. requires:
  12995. - Locale
  12996. - Locale.de-DE.Date
  12997. provides: [Locale.de-CH.Date]
  12998. ...
  12999. */
  13000. Locale.define('de-CH').inherit('de-DE', 'Date');
  13001. /*
  13002. ---
  13003. name: Locale.de-CH.Form.Validator
  13004. description: Form Validator messages for German (Switzerland).
  13005. license: MIT-style license
  13006. authors:
  13007. - Michael van der Weg
  13008. requires:
  13009. - Locale
  13010. provides: [Locale.de-CH.Form.Validator]
  13011. ...
  13012. */
  13013. Locale.define('de-CH', 'FormValidator', {
  13014. required: 'Dieses Feld ist obligatorisch.',
  13015. minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13016. maxLength: 'Bitte geben Sie nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13017. integer: 'Geben Sie bitte eine ganze Zahl ein. Dezimalzahlen (z.B. 1.25) sind nicht erlaubt.',
  13018. 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;).',
  13019. digits: 'Benutzen Sie bitte nur Zahlen und Satzzeichen in diesem Eingabefeld (erlaubt ist z.B. eine Telefonnummer mit Bindestrichen und Punkten).',
  13020. alpha: 'Benutzen Sie bitte nur Buchstaben (a-z) in diesem Feld. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13021. alphanum: 'Benutzen Sie bitte nur Buchstaben (a-z) und Zahlen (0-9) in diesem Eingabefeld. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13022. dateSuchAs: 'Geben Sie bitte ein g&uuml;ltiges Datum ein. Wie zum Beispiel {date}',
  13023. dateInFormatMDY: 'Geben Sie bitte ein g&uuml;ltiges Datum ein. Wie zum Beispiel TT.MM.JJJJ (z.B. &quot;31.12.1999&quot;)',
  13024. email: 'Geben Sie bitte eine g&uuml;ltige E-Mail Adresse ein. Wie zum Beispiel &quot;maria@bernasconi.ch&quot;.',
  13025. url: 'Geben Sie bitte eine g&uuml;ltige URL ein. Wie zum Beispiel http://www.example.com.',
  13026. currencyDollar: 'Geben Sie bitte einen g&uuml;ltigen Betrag in Schweizer Franken ein. Wie zum Beispiel 100.00 CHF .',
  13027. oneRequired: 'Machen Sie f&uuml;r mindestens eines der Eingabefelder einen Eintrag.',
  13028. errorPrefix: 'Fehler: ',
  13029. warningPrefix: 'Warnung: ',
  13030. // Form.Validator.Extras
  13031. noSpace: 'In diesem Eingabefeld darf kein Leerzeichen sein.',
  13032. reqChkByNode: 'Es wurden keine Elemente gew&auml;hlt.',
  13033. requiredChk: 'Dieses Feld ist obligatorisch.',
  13034. reqChkByName: 'Bitte w&auml;hlen Sie ein {label}.',
  13035. match: 'Dieses Eingabefeld muss mit dem Feld {matchName} &uuml;bereinstimmen.',
  13036. startDate: 'Das Anfangsdatum',
  13037. endDate: 'Das Enddatum',
  13038. currentDate: 'Das aktuelle Datum',
  13039. afterDate: 'Das Datum sollte zur gleichen Zeit oder sp&auml;ter sein {label}.',
  13040. beforeDate: 'Das Datum sollte zur gleichen Zeit oder fr&uuml;her sein {label}.',
  13041. startMonth: 'W&auml;hlen Sie bitte einen Anfangsmonat',
  13042. sameMonth: 'Diese zwei Datumsangaben m&uuml;ssen im selben Monat sein - Sie m&uuml;ssen eine von beiden ver&auml;ndern.',
  13043. creditcard: 'Die eingegebene Kreditkartennummer ist ung&uuml;ltig. Bitte &uuml;berpr&uuml;fen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.'
  13044. });
  13045. /*
  13046. ---
  13047. name: Locale.de-CH.Number
  13048. description: Number messages for Switzerland.
  13049. license: MIT-style license
  13050. authors:
  13051. - Kim D. Jeker
  13052. requires:
  13053. - Locale
  13054. - Locale.CH.Number
  13055. provides: [Locale.de-CH.Number]
  13056. ...
  13057. */
  13058. Locale.define('de-CH').inherit('CH', 'Number');
  13059. /*
  13060. ---
  13061. name: Locale.de-DE.Form.Validator
  13062. description: Form Validator messages for German.
  13063. license: MIT-style license
  13064. authors:
  13065. - Frank Rossi
  13066. - Ulrich Petri
  13067. - Fabian Beiner
  13068. requires:
  13069. - Locale
  13070. provides: [Locale.de-DE.Form.Validator]
  13071. ...
  13072. */
  13073. Locale.define('de-DE', 'FormValidator', {
  13074. required: 'Dieses Eingabefeld muss ausgefüllt werden.',
  13075. minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben nur {length} Zeichen eingegeben).',
  13076. maxLength: 'Geben Sie bitte nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13077. integer: 'Geben Sie in diesem Eingabefeld bitte eine ganze Zahl ein. Dezimalzahlen (z.B. "1.25") sind nicht erlaubt.',
  13078. numeric: 'Geben Sie in diesem Eingabefeld bitte nur Zahlenwerte (z.B. "1", "1.1", "-1" oder "-1.1") ein.',
  13079. digits: 'Geben Sie in diesem Eingabefeld bitte nur Zahlen und Satzzeichen ein (z.B. eine Telefonnummer mit Bindestrichen und Punkten ist erlaubt).',
  13080. alpha: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) ein. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13081. alphanum: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) und Zahlen (0-9) ein. Leerzeichen oder andere Zeichen sind nicht erlaubt.',
  13082. dateSuchAs: 'Geben Sie bitte ein gültiges Datum ein (z.B. "{date}").',
  13083. dateInFormatMDY: 'Geben Sie bitte ein gültiges Datum im Format TT.MM.JJJJ ein (z.B. "31.12.1999").',
  13084. email: 'Geben Sie bitte eine gültige E-Mail-Adresse ein (z.B. "max@mustermann.de").',
  13085. url: 'Geben Sie bitte eine gültige URL ein (z.B. "http://www.example.com").',
  13086. currencyDollar: 'Geben Sie bitte einen gültigen Betrag in EURO ein (z.B. 100.00€).',
  13087. oneRequired: 'Bitte füllen Sie mindestens ein Eingabefeld aus.',
  13088. errorPrefix: 'Fehler: ',
  13089. warningPrefix: 'Warnung: ',
  13090. // Form.Validator.Extras
  13091. noSpace: 'Es darf kein Leerzeichen in diesem Eingabefeld sein.',
  13092. reqChkByNode: 'Es wurden keine Elemente gewählt.',
  13093. requiredChk: 'Dieses Feld muss ausgefüllt werden.',
  13094. reqChkByName: 'Bitte wählen Sie ein {label}.',
  13095. match: 'Dieses Eingabefeld muss mit dem {matchName} Eingabefeld übereinstimmen.',
  13096. startDate: 'Das Anfangsdatum',
  13097. endDate: 'Das Enddatum',
  13098. currentDate: 'Das aktuelle Datum',
  13099. afterDate: 'Das Datum sollte zur gleichen Zeit oder später sein als {label}.',
  13100. beforeDate: 'Das Datum sollte zur gleichen Zeit oder früher sein als {label}.',
  13101. startMonth: 'Wählen Sie bitte einen Anfangsmonat',
  13102. sameMonth: 'Diese zwei Datumsangaben müssen im selben Monat sein - Sie müssen eines von beiden verändern.',
  13103. creditcard: 'Die eingegebene Kreditkartennummer ist ungültig. Bitte überprüfen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.'
  13104. });
  13105. /*
  13106. ---
  13107. name: Locale.de-DE.Number
  13108. description: Number messages for German.
  13109. license: MIT-style license
  13110. authors:
  13111. - Christoph Pojer
  13112. requires:
  13113. - Locale
  13114. - Locale.EU.Number
  13115. provides: [Locale.de-DE.Number]
  13116. ...
  13117. */
  13118. Locale.define('de-DE').inherit('EU', 'Number');
  13119. /*
  13120. ---
  13121. name: Locale.el-GR.Date
  13122. description: Date messages for Greek language.
  13123. license: MIT-style license
  13124. authors:
  13125. - Periklis Argiriadis
  13126. requires:
  13127. - Locale
  13128. provides: [Locale.el-GR.Date]
  13129. ...
  13130. */
  13131. Locale.define('el-GR', 'Date', {
  13132. months: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
  13133. months_abbr: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μάι', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
  13134. days: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
  13135. days_abbr: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'],
  13136. // Culture's date order: DD/MM/YYYY
  13137. dateOrder: ['date', 'month', 'year'],
  13138. shortDate: '%d/%m/%Y',
  13139. shortTime: '%I:%M%p',
  13140. AM: 'πμ',
  13141. PM: 'μμ',
  13142. firstDayOfWeek: 1,
  13143. // Date.Extras
  13144. ordinal: function(dayOfMonth){
  13145. // 1st, 2nd, 3rd, etc.
  13146. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ος' : ['ος'][Math.min(dayOfMonth % 10, 4)];
  13147. },
  13148. lessThanMinuteAgo: 'λιγότερο από ένα λεπτό πριν',
  13149. minuteAgo: 'περίπου ένα λεπτό πριν',
  13150. minutesAgo: '{delta} λεπτά πριν',
  13151. hourAgo: 'περίπου μια ώρα πριν',
  13152. hoursAgo: 'περίπου {delta} ώρες πριν',
  13153. dayAgo: '1 ημέρα πριν',
  13154. daysAgo: '{delta} ημέρες πριν',
  13155. weekAgo: '1 εβδομάδα πριν',
  13156. weeksAgo: '{delta} εβδομάδες πριν',
  13157. monthAgo: '1 μήνα πριν',
  13158. monthsAgo: '{delta} μήνες πριν',
  13159. yearAgo: '1 χρόνο πριν',
  13160. yearsAgo: '{delta} χρόνια πριν',
  13161. lessThanMinuteUntil: 'λιγότερο από λεπτό από τώρα',
  13162. minuteUntil: 'περίπου ένα λεπτό από τώρα',
  13163. minutesUntil: '{delta} λεπτά από τώρα',
  13164. hourUntil: 'περίπου μια ώρα από τώρα',
  13165. hoursUntil: 'περίπου {delta} ώρες από τώρα',
  13166. dayUntil: '1 ημέρα από τώρα',
  13167. daysUntil: '{delta} ημέρες από τώρα',
  13168. weekUntil: '1 εβδομάδα από τώρα',
  13169. weeksUntil: '{delta} εβδομάδες από τώρα',
  13170. monthUntil: '1 μήνας από τώρα',
  13171. monthsUntil: '{delta} μήνες από τώρα',
  13172. yearUntil: '1 χρόνος από τώρα',
  13173. yearsUntil: '{delta} χρόνια από τώρα'
  13174. });
  13175. /*
  13176. ---
  13177. name: Locale.el-GR.Form.Validator
  13178. description: Form Validator messages for Greek language.
  13179. license: MIT-style license
  13180. authors:
  13181. - Dimitris Tsironis
  13182. requires:
  13183. - Locale
  13184. provides: [Locale.el-GR.Form.Validator]
  13185. ...
  13186. */
  13187. Locale.define('el-GR', 'FormValidator', {
  13188. required: 'Αυτό το πεδίο είναι απαραίτητο.',
  13189. length: 'Παρακαλούμε, εισάγετε {length} χαρακτήρες (έχετε ήδη εισάγει {elLength} χαρακτήρες).',
  13190. minLength: 'Παρακαλούμε, εισάγετε τουλάχιστον {minLength} χαρακτήρες (έχετε ήδη εισάγε {length} χαρακτήρες).',
  13191. maxlength: 'Παρακαλούμε, εισάγετε εώς {maxlength} χαρακτήρες (έχετε ήδη εισάγε {length} χαρακτήρες).',
  13192. integer: 'Παρακαλούμε, εισάγετε έναν ακέραιο αριθμό σε αυτό το πεδίο. Οι αριθμοί με δεκαδικά ψηφία (π.χ. 1.25) δεν επιτρέπονται.',
  13193. numeric: 'Παρακαλούμε, εισάγετε μόνο αριθμητικές τιμές σε αυτό το πεδίο (π.χ." 1 " ή " 1.1 " ή " -1 " ή " -1.1 " ).',
  13194. digits: 'Παρακαλούμε, χρησιμοποιήστε μόνο αριθμούς και σημεία στίξης σε αυτόν τον τομέα (π.χ. επιτρέπεται αριθμός τηλεφώνου με παύλες ή τελείες).',
  13195. alpha: 'Παρακαλούμε, χρησιμοποιήστε μόνο γράμματα (a-z) σε αυτό το πεδίο. Δεν επιτρέπονται κενά ή άλλοι χαρακτήρες.',
  13196. alphanum: 'Παρακαλούμε, χρησιμοποιήστε μόνο γράμματα (a-z) ή αριθμούς (0-9) σε αυτόν τον τομέα. Δεν επιτρέπονται κενά ή άλλοι χαρακτήρες.',
  13197. dateSuchAs: 'Παρακαλούμε, εισάγετε μια έγκυρη ημερομηνία, όπως {date}',
  13198. dateInFormatMDY: 'Παρακαλώ εισάγετε μια έγκυρη ημερομηνία, όπως ΜΜ/ΗΗ/ΕΕΕΕ (π.χ. "12/31/1999").',
  13199. email: 'Παρακαλούμε, εισάγετε μια έγκυρη διεύθυνση ηλεκτρονικού ταχυδρομείου (π.χ. "fred@domain.com").',
  13200. url: 'Παρακαλούμε, εισάγετε μια έγκυρη URL διεύθυνση, όπως http://www.example.com',
  13201. currencyDollar: 'Παρακαλούμε, εισάγετε ένα έγκυρο ποσό σε δολλάρια (π.χ. $100.00).',
  13202. oneRequired: 'Παρακαλούμε, εισάγετε κάτι για τουλάχιστον ένα από αυτά τα πεδία.',
  13203. errorPrefix: 'Σφάλμα: ',
  13204. warningPrefix: 'Προσοχή: ',
  13205. // Form.Validator.Extras
  13206. noSpace: 'Δεν επιτρέπονται τα κενά σε αυτό το πεδίο.',
  13207. reqChkByNode: 'Δεν έχει επιλεγεί κάποιο αντικείμενο',
  13208. requiredChk: 'Αυτό το πεδίο είναι απαραίτητο.',
  13209. reqChkByName: 'Παρακαλούμε, επιλέξτε μια ετικέτα {label}.',
  13210. match: 'Αυτό το πεδίο πρέπει να ταιριάζει με το πεδίο {matchName}.',
  13211. startDate: 'η ημερομηνία έναρξης',
  13212. endDate: 'η ημερομηνία λήξης',
  13213. currentDate: 'η τρέχουσα ημερομηνία',
  13214. afterDate: 'Η ημερομηνία πρέπει να είναι η ίδια ή μετά από την {label}.',
  13215. beforeDate: 'Η ημερομηνία πρέπει να είναι η ίδια ή πριν από την {label}.',
  13216. startMonth: 'Παρακαλώ επιλέξτε ένα μήνα αρχής.',
  13217. sameMonth: 'Αυτές οι δύο ημερομηνίες πρέπει να έχουν τον ίδιο μήνα - θα πρέπει να αλλάξετε ή το ένα ή το άλλο',
  13218. creditcard: 'Ο αριθμός της πιστωτικής κάρτας δεν είναι έγκυρος. Παρακαλούμε ελέγξτε τον αριθμό και δοκιμάστε ξανά. {length} μήκος ψηφίων.'
  13219. });
  13220. /*
  13221. ---
  13222. name: Locale.en-GB.Date
  13223. description: Date messages for British English.
  13224. license: MIT-style license
  13225. authors:
  13226. - Aaron Newton
  13227. requires:
  13228. - Locale
  13229. - Locale.en-US.Date
  13230. provides: [Locale.en-GB.Date]
  13231. ...
  13232. */
  13233. Locale.define('en-GB', 'Date', {
  13234. // Culture's date order: DD/MM/YYYY
  13235. dateOrder: ['date', 'month', 'year'],
  13236. shortDate: '%d/%m/%Y',
  13237. shortTime: '%H:%M'
  13238. }).inherit('en-US', 'Date');
  13239. /*
  13240. ---
  13241. name: Locale.en-US.Number
  13242. description: Number messages for US English.
  13243. license: MIT-style license
  13244. authors:
  13245. - Arian Stolwijk
  13246. requires:
  13247. - Locale
  13248. provides: [Locale.en-US.Number]
  13249. ...
  13250. */
  13251. Locale.define('en-US', 'Number', {
  13252. decimal: '.',
  13253. group: ',',
  13254. /* Commented properties are the defaults for Number.format
  13255. decimals: 0,
  13256. precision: 0,
  13257. scientific: null,
  13258. prefix: null,
  13259. suffic: null,
  13260. // Negative/Currency/percentage will mixin Number
  13261. negative: {
  13262. prefix: '-'
  13263. },*/
  13264. currency: {
  13265. // decimals: 2,
  13266. prefix: '$ '
  13267. }/*,
  13268. percentage: {
  13269. decimals: 2,
  13270. suffix: '%'
  13271. }*/
  13272. });
  13273. /*
  13274. ---
  13275. name: Locale.es-ES.Date
  13276. description: Date messages for Spanish.
  13277. license: MIT-style license
  13278. authors:
  13279. - Ãlfons Sanchez
  13280. requires:
  13281. - Locale
  13282. provides: [Locale.es-ES.Date]
  13283. ...
  13284. */
  13285. Locale.define('es-ES', 'Date', {
  13286. months: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
  13287. months_abbr: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'],
  13288. days: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
  13289. days_abbr: ['dom', 'lun', 'mar', 'mié', 'juv', 'vie', 'sáb'],
  13290. // Culture's date order: DD/MM/YYYY
  13291. dateOrder: ['date', 'month', 'year'],
  13292. shortDate: '%d/%m/%Y',
  13293. shortTime: '%H:%M',
  13294. AM: 'AM',
  13295. PM: 'PM',
  13296. firstDayOfWeek: 1,
  13297. // Date.Extras
  13298. ordinal: '',
  13299. lessThanMinuteAgo: 'hace menos de un minuto',
  13300. minuteAgo: 'hace un minuto',
  13301. minutesAgo: 'hace {delta} minutos',
  13302. hourAgo: 'hace una hora',
  13303. hoursAgo: 'hace unas {delta} horas',
  13304. dayAgo: 'hace un día',
  13305. daysAgo: 'hace {delta} días',
  13306. weekAgo: 'hace una semana',
  13307. weeksAgo: 'hace unas {delta} semanas',
  13308. monthAgo: 'hace un mes',
  13309. monthsAgo: 'hace {delta} meses',
  13310. yearAgo: 'hace un año',
  13311. yearsAgo: 'hace {delta} años',
  13312. lessThanMinuteUntil: 'menos de un minuto desde ahora',
  13313. minuteUntil: 'un minuto desde ahora',
  13314. minutesUntil: '{delta} minutos desde ahora',
  13315. hourUntil: 'una hora desde ahora',
  13316. hoursUntil: 'unas {delta} horas desde ahora',
  13317. dayUntil: 'un día desde ahora',
  13318. daysUntil: '{delta} días desde ahora',
  13319. weekUntil: 'una semana desde ahora',
  13320. weeksUntil: 'unas {delta} semanas desde ahora',
  13321. monthUntil: 'un mes desde ahora',
  13322. monthsUntil: '{delta} meses desde ahora',
  13323. yearUntil: 'un año desde ahora',
  13324. yearsUntil: '{delta} años desde ahora'
  13325. });
  13326. /*
  13327. ---
  13328. name: Locale.es-AR.Date
  13329. description: Date messages for Spanish (Argentina).
  13330. license: MIT-style license
  13331. authors:
  13332. - Ãlfons Sanchez
  13333. - Diego Massanti
  13334. requires:
  13335. - Locale
  13336. - Locale.es-ES.Date
  13337. provides: [Locale.es-AR.Date]
  13338. ...
  13339. */
  13340. Locale.define('es-AR').inherit('es-ES', 'Date');
  13341. /*
  13342. ---
  13343. name: Locale.es-AR.Form.Validator
  13344. description: Form Validator messages for Spanish (Argentina).
  13345. license: MIT-style license
  13346. authors:
  13347. - Diego Massanti
  13348. requires:
  13349. - Locale
  13350. provides: [Locale.es-AR.Form.Validator]
  13351. ...
  13352. */
  13353. Locale.define('es-AR', 'FormValidator', {
  13354. required: 'Este campo es obligatorio.',
  13355. minLength: 'Por favor ingrese al menos {minLength} caracteres (ha ingresado {length} caracteres).',
  13356. maxLength: 'Por favor no ingrese más de {maxLength} caracteres (ha ingresado {length} caracteres).',
  13357. integer: 'Por favor ingrese un número entero en este campo. Números con decimales (p.e. 1,25) no se permiten.',
  13358. numeric: 'Por favor ingrese solo valores numéricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',
  13359. 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).',
  13360. alpha: 'Por favor use sólo letras (a-z) en este campo. No se permiten espacios ni otros caracteres.',
  13361. alphanum: 'Por favor, usa sólo letras (a-z) o números (0-9) en este campo. No se permiten espacios u otros caracteres.',
  13362. dateSuchAs: 'Por favor ingrese una fecha válida como {date}',
  13363. dateInFormatMDY: 'Por favor ingrese una fecha válida, utulizando el formato DD/MM/YYYY (p.e. "31/12/1999")',
  13364. email: 'Por favor, ingrese una dirección de e-mail válida. Por ejemplo, "fred@dominio.com".',
  13365. url: 'Por favor ingrese una URL válida como http://www.example.com.',
  13366. currencyDollar: 'Por favor ingrese una cantidad válida de pesos. Por ejemplo $100,00 .',
  13367. oneRequired: 'Por favor ingrese algo para por lo menos una de estas entradas.',
  13368. errorPrefix: 'Error: ',
  13369. warningPrefix: 'Advertencia: ',
  13370. // Form.Validator.Extras
  13371. noSpace: 'No se permiten espacios en este campo.',
  13372. reqChkByNode: 'No hay elementos seleccionados.',
  13373. requiredChk: 'Este campo es obligatorio.',
  13374. reqChkByName: 'Por favor selecciona una {label}.',
  13375. match: 'Este campo necesita coincidir con el campo {matchName}',
  13376. startDate: 'la fecha de inicio',
  13377. endDate: 'la fecha de fin',
  13378. currentDate: 'la fecha actual',
  13379. afterDate: 'La fecha debe ser igual o posterior a {label}.',
  13380. beforeDate: 'La fecha debe ser igual o anterior a {label}.',
  13381. startMonth: 'Por favor selecciona un mes de origen',
  13382. sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.'
  13383. });
  13384. /*
  13385. ---
  13386. name: Locale.es-AR.Number
  13387. description: Number messages for es Argentina.
  13388. license: MIT-style license
  13389. authors:
  13390. - Oscar Kuchuk
  13391. requires:
  13392. - Locale
  13393. provides: [Locale.es-AR.Number]
  13394. ...
  13395. */
  13396. Locale.define('es-AR', 'Number', {
  13397. decimal: ',',
  13398. group: '.',
  13399. /* Commented properties are the defaults for Number.format
  13400. decimals: 0,
  13401. precision: 0,
  13402. scientific: null,
  13403. prefix: null,
  13404. suffic: null,
  13405. // Negative/Currency/percentage will mixin Number
  13406. negative: {
  13407. prefix: '-'
  13408. },*/
  13409. currency: {
  13410. decimals: 2,
  13411. prefix: '$ '
  13412. }/*,
  13413. percentage: {
  13414. decimals: 2,
  13415. suffix: '%'
  13416. }*/
  13417. });
  13418. /*
  13419. ---
  13420. name: Locale.es-ES.Form.Validator
  13421. description: Form Validator messages for Spanish.
  13422. license: MIT-style license
  13423. authors:
  13424. - Ãlfons Sanchez
  13425. requires:
  13426. - Locale
  13427. provides: [Locale.es-ES.Form.Validator]
  13428. ...
  13429. */
  13430. Locale.define('es-ES', 'FormValidator', {
  13431. required: 'Este campo es obligatorio.',
  13432. minLength: 'Por favor introduce al menos {minLength} caracteres (has introducido {length} caracteres).',
  13433. maxLength: 'Por favor introduce no m&aacute;s de {maxLength} caracteres (has introducido {length} caracteres).',
  13434. integer: 'Por favor introduce un n&uacute;mero entero en este campo. N&uacute;meros con decimales (p.e. 1,25) no se permiten.',
  13435. numeric: 'Por favor introduce solo valores num&eacute;ricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',
  13436. 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).',
  13437. alpha: 'Por favor usa letras solo (a-z) en este campo. No se admiten espacios ni otros caracteres.',
  13438. alphanum: 'Por favor, usa solo letras (a-z) o n&uacute;meros (0-9) en este campo. No se admiten espacios ni otros caracteres.',
  13439. dateSuchAs: 'Por favor introduce una fecha v&aacute;lida como {date}',
  13440. dateInFormatMDY: 'Por favor introduce una fecha v&aacute;lida como DD/MM/YYYY (p.e. "31/12/1999")',
  13441. email: 'Por favor, introduce una direcci&oacute;n de email v&aacute;lida. Por ejemplo, "fred@domain.com".',
  13442. url: 'Por favor introduce una URL v&aacute;lida como http://www.example.com.',
  13443. currencyDollar: 'Por favor introduce una cantidad v&aacute;lida de €. Por ejemplo €100,00 .',
  13444. oneRequired: 'Por favor introduce algo para por lo menos una de estas entradas.',
  13445. errorPrefix: 'Error: ',
  13446. warningPrefix: 'Aviso: ',
  13447. // Form.Validator.Extras
  13448. noSpace: 'No pueden haber espacios en esta entrada.',
  13449. reqChkByNode: 'No hay elementos seleccionados.',
  13450. requiredChk: 'Este campo es obligatorio.',
  13451. reqChkByName: 'Por favor selecciona una {label}.',
  13452. match: 'Este campo necesita coincidir con el campo {matchName}',
  13453. startDate: 'la fecha de inicio',
  13454. endDate: 'la fecha de fin',
  13455. currentDate: 'la fecha actual',
  13456. afterDate: 'La fecha debe ser igual o posterior a {label}.',
  13457. beforeDate: 'La fecha debe ser igual o anterior a {label}.',
  13458. startMonth: 'Por favor selecciona un mes de origen',
  13459. sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.'
  13460. });
  13461. /*
  13462. ---
  13463. name: Locale.es-VE.Date
  13464. description: Date messages for Spanish (Venezuela).
  13465. license: MIT-style license
  13466. authors:
  13467. - Daniel Barreto
  13468. requires:
  13469. - Locale
  13470. - Locale.es-ES.Date
  13471. provides: [Locale.es-VE.Date]
  13472. ...
  13473. */
  13474. Locale.define('es-VE').inherit('es-ES', 'Date');
  13475. /*
  13476. ---
  13477. name: Locale.es-VE.Form.Validator
  13478. description: Form Validator messages for Spanish (Venezuela).
  13479. license: MIT-style license
  13480. authors:
  13481. - Daniel Barreto
  13482. requires:
  13483. - Locale
  13484. - Locale.es-ES.Form.Validator
  13485. provides: [Locale.es-VE.Form.Validator]
  13486. ...
  13487. */
  13488. Locale.define('es-VE', 'FormValidator', {
  13489. 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.',
  13490. alpha: 'Por favor usa solo letras (a-z) en este campo. No se admiten espacios ni otros caracteres.',
  13491. currencyDollar: 'Por favor introduce una cantidad v&aacute;lida de Bs. Por ejemplo Bs. 100,00 .',
  13492. oneRequired: 'Por favor introduce un valor para por lo menos una de estas entradas.',
  13493. // Form.Validator.Extras
  13494. startDate: 'La fecha de inicio',
  13495. endDate: 'La fecha de fin',
  13496. currentDate: 'La fecha actual'
  13497. }).inherit('es-ES', 'FormValidator');
  13498. /*
  13499. ---
  13500. name: Locale.es-VE.Number
  13501. description: Number messages for Spanish (Venezuela).
  13502. license: MIT-style license
  13503. authors:
  13504. - Daniel Barreto
  13505. requires:
  13506. - Locale
  13507. provides: [Locale.es-VE.Number]
  13508. ...
  13509. */
  13510. Locale.define('es-VE', 'Number', {
  13511. decimal: ',',
  13512. group: '.',
  13513. /*
  13514. decimals: 0,
  13515. precision: 0,
  13516. */
  13517. // Negative/Currency/percentage will mixin Number
  13518. negative: {
  13519. prefix: '-'
  13520. },
  13521. currency: {
  13522. decimals: 2,
  13523. prefix: 'Bs. '
  13524. },
  13525. percentage: {
  13526. decimals: 2,
  13527. suffix: '%'
  13528. }
  13529. });
  13530. /*
  13531. ---
  13532. name: Locale.et-EE.Date
  13533. description: Date messages for Estonian.
  13534. license: MIT-style license
  13535. authors:
  13536. - Kevin Valdek
  13537. requires:
  13538. - Locale
  13539. provides: [Locale.et-EE.Date]
  13540. ...
  13541. */
  13542. Locale.define('et-EE', 'Date', {
  13543. months: ['jaanuar', 'veebruar', 'märts', 'aprill', 'mai', 'juuni', 'juuli', 'august', 'september', 'oktoober', 'november', 'detsember'],
  13544. months_abbr: ['jaan', 'veebr', 'märts', 'apr', 'mai', 'juuni', 'juuli', 'aug', 'sept', 'okt', 'nov', 'dets'],
  13545. days: ['pühapäev', 'esmaspäev', 'teisipäev', 'kolmapäev', 'neljapäev', 'reede', 'laupäev'],
  13546. days_abbr: ['pühap', 'esmasp', 'teisip', 'kolmap', 'neljap', 'reede', 'laup'],
  13547. // Culture's date order: MM.DD.YYYY
  13548. dateOrder: ['month', 'date', 'year'],
  13549. shortDate: '%m.%d.%Y',
  13550. shortTime: '%H:%M',
  13551. AM: 'AM',
  13552. PM: 'PM',
  13553. firstDayOfWeek: 1,
  13554. // Date.Extras
  13555. ordinal: '',
  13556. lessThanMinuteAgo: 'vähem kui minut aega tagasi',
  13557. minuteAgo: 'umbes minut aega tagasi',
  13558. minutesAgo: '{delta} minutit tagasi',
  13559. hourAgo: 'umbes tund aega tagasi',
  13560. hoursAgo: 'umbes {delta} tundi tagasi',
  13561. dayAgo: '1 päev tagasi',
  13562. daysAgo: '{delta} päeva tagasi',
  13563. weekAgo: '1 nädal tagasi',
  13564. weeksAgo: '{delta} nädalat tagasi',
  13565. monthAgo: '1 kuu tagasi',
  13566. monthsAgo: '{delta} kuud tagasi',
  13567. yearAgo: '1 aasta tagasi',
  13568. yearsAgo: '{delta} aastat tagasi',
  13569. lessThanMinuteUntil: 'vähem kui minuti aja pärast',
  13570. minuteUntil: 'umbes minuti aja pärast',
  13571. minutesUntil: '{delta} minuti pärast',
  13572. hourUntil: 'umbes tunni aja pärast',
  13573. hoursUntil: 'umbes {delta} tunni pärast',
  13574. dayUntil: '1 päeva pärast',
  13575. daysUntil: '{delta} päeva pärast',
  13576. weekUntil: '1 nädala pärast',
  13577. weeksUntil: '{delta} nädala pärast',
  13578. monthUntil: '1 kuu pärast',
  13579. monthsUntil: '{delta} kuu pärast',
  13580. yearUntil: '1 aasta pärast',
  13581. yearsUntil: '{delta} aasta pärast'
  13582. });
  13583. /*
  13584. ---
  13585. name: Locale.et-EE.Form.Validator
  13586. description: Form Validator messages for Estonian.
  13587. license: MIT-style license
  13588. authors:
  13589. - Kevin Valdek
  13590. requires:
  13591. - Locale
  13592. provides: [Locale.et-EE.Form.Validator]
  13593. ...
  13594. */
  13595. Locale.define('et-EE', 'FormValidator', {
  13596. required: 'Väli peab olema täidetud.',
  13597. minLength: 'Palun sisestage vähemalt {minLength} tähte (te sisestasite {length} tähte).',
  13598. maxLength: 'Palun ärge sisestage rohkem kui {maxLength} tähte (te sisestasite {length} tähte).',
  13599. integer: 'Palun sisestage väljale täisarv. Kümnendarvud (näiteks 1.25) ei ole lubatud.',
  13600. numeric: 'Palun sisestage ainult numbreid väljale (näiteks "1", "1.1", "-1" või "-1.1").',
  13601. digits: 'Palun kasutage ainult numbreid ja kirjavahemärke (telefoninumbri sisestamisel on lubatud kasutada kriipse ja punkte).',
  13602. alpha: 'Palun kasutage ainult tähti (a-z). Tühikud ja teised sümbolid on keelatud.',
  13603. alphanum: 'Palun kasutage ainult tähti (a-z) või numbreid (0-9). Tühikud ja teised sümbolid on keelatud.',
  13604. dateSuchAs: 'Palun sisestage kehtiv kuupäev kujul {date}',
  13605. dateInFormatMDY: 'Palun sisestage kehtiv kuupäev kujul MM.DD.YYYY (näiteks: "12.31.1999").',
  13606. email: 'Palun sisestage kehtiv e-maili aadress (näiteks: "fred@domain.com").',
  13607. url: 'Palun sisestage kehtiv URL (näiteks: http://www.example.com).',
  13608. currencyDollar: 'Palun sisestage kehtiv $ summa (näiteks: $100.00).',
  13609. oneRequired: 'Palun sisestage midagi vähemalt ühele antud väljadest.',
  13610. errorPrefix: 'Viga: ',
  13611. warningPrefix: 'Hoiatus: ',
  13612. // Form.Validator.Extras
  13613. noSpace: 'Väli ei tohi sisaldada tühikuid.',
  13614. reqChkByNode: 'Ükski väljadest pole valitud.',
  13615. requiredChk: 'Välja täitmine on vajalik.',
  13616. reqChkByName: 'Palun valige üks {label}.',
  13617. match: 'Väli peab sobima {matchName} väljaga',
  13618. startDate: 'algkuupäev',
  13619. endDate: 'lõppkuupäev',
  13620. currentDate: 'praegune kuupäev',
  13621. afterDate: 'Kuupäev peab olema võrdne või pärast {label}.',
  13622. beforeDate: 'Kuupäev peab olema võrdne või enne {label}.',
  13623. startMonth: 'Palun valige algkuupäev.',
  13624. sameMonth: 'Antud kaks kuupäeva peavad olema samas kuus - peate muutma ühte kuupäeva.'
  13625. });
  13626. /*
  13627. ---
  13628. name: Locale.fa.Date
  13629. description: Date messages for Persian.
  13630. license: MIT-style license
  13631. authors:
  13632. - Amir Hossein Hodjaty Pour
  13633. requires:
  13634. - Locale
  13635. provides: [Locale.fa.Date]
  13636. ...
  13637. */
  13638. Locale.define('fa', 'Date', {
  13639. months: ['ژانویه', 'فوریه', 'مارس', 'آپریل', 'مه', 'ژوئن', 'ژوئیه', 'آگوست', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
  13640. months_abbr: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
  13641. days: ['یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
  13642. days_abbr: ['ي', 'د', 'س', 'چ', 'پ', 'ج', 'ش'],
  13643. // Culture's date order: MM/DD/YYYY
  13644. dateOrder: ['month', 'date', 'year'],
  13645. shortDate: '%m/%d/%Y',
  13646. shortTime: '%I:%M%p',
  13647. AM: 'ق.ظ',
  13648. PM: 'ب.ظ',
  13649. // Date.Extras
  13650. ordinal: 'ام',
  13651. lessThanMinuteAgo: 'کمتر از یک دقیقه پیش',
  13652. minuteAgo: 'حدود یک دقیقه پیش',
  13653. minutesAgo: '{delta} دقیقه پیش',
  13654. hourAgo: 'حدود یک ساعت پیش',
  13655. hoursAgo: 'حدود {delta} ساعت پیش',
  13656. dayAgo: '1 روز پیش',
  13657. daysAgo: '{delta} روز پیش',
  13658. weekAgo: '1 هفته پیش',
  13659. weeksAgo: '{delta} هفته پیش',
  13660. monthAgo: '1 ماه پیش',
  13661. monthsAgo: '{delta} ماه پیش',
  13662. yearAgo: '1 سال پیش',
  13663. yearsAgo: '{delta} سال پیش',
  13664. lessThanMinuteUntil: 'کمتر از یک دقیقه از حالا',
  13665. minuteUntil: 'حدود یک دقیقه از حالا',
  13666. minutesUntil: '{delta} دقیقه از حالا',
  13667. hourUntil: 'حدود یک ساعت از حالا',
  13668. hoursUntil: 'حدود {delta} ساعت از حالا',
  13669. dayUntil: '1 روز از حالا',
  13670. daysUntil: '{delta} روز از حالا',
  13671. weekUntil: '1 هفته از حالا',
  13672. weeksUntil: '{delta} هفته از حالا',
  13673. monthUntil: '1 ماه از حالا',
  13674. monthsUntil: '{delta} ماه از حالا',
  13675. yearUntil: '1 سال از حالا',
  13676. yearsUntil: '{delta} سال از حالا'
  13677. });
  13678. /*
  13679. ---
  13680. name: Locale.fa.Form.Validator
  13681. description: Form Validator messages for Persian.
  13682. license: MIT-style license
  13683. authors:
  13684. - Amir Hossein Hodjaty Pour
  13685. requires:
  13686. - Locale
  13687. provides: [Locale.fa.Form.Validator]
  13688. ...
  13689. */
  13690. Locale.define('fa', 'FormValidator', {
  13691. required: 'این فیلد الزامی است.',
  13692. minLength: 'شما باید حداقل {minLength} حرف وارد کنید ({length} حرف وارد کرده اید).',
  13693. maxLength: 'لطفا حداکثر {maxLength} حرف وارد کنید (شما {length} حرف وارد کرده اید).',
  13694. integer: 'لطفا از عدد صحیح استفاده کنید. اعداد اعشاری (مانند 1.25) مجاز نیستند.',
  13695. numeric: 'لطفا فقط داده عددی وارد کنید (مانند "1" یا "1.1" یا "1-" یا "1.1-").',
  13696. digits: 'لطفا فقط از اعداد و علامتها در این فیلد استفاده کنید (برای مثال شماره تلفن با خط تیره و نقطه قابل قبول است).',
  13697. alpha: 'لطفا فقط از حروف الفباء برای این بخش استفاده کنید. کاراکترهای دیگر و فاصله مجاز نیستند.',
  13698. alphanum: 'لطفا فقط از حروف الفباء و اعداد در این بخش استفاده کنید. کاراکترهای دیگر و فاصله مجاز نیستند.',
  13699. dateSuchAs: 'لطفا یک تاریخ معتبر مانند {date} وارد کنید.',
  13700. dateInFormatMDY: 'لطفا یک تاریخ معتبر به شکل MM/DD/YYYY وارد کنید (مانند "12/31/1999").',
  13701. email: 'لطفا یک آدرس ایمیل معتبر وارد کنید. برای مثال "fred@domain.com".',
  13702. url: 'لطفا یک URL معتبر مانند http://www.example.com وارد کنید.',
  13703. currencyDollar: 'لطفا یک محدوده معتبر برای این بخش وارد کنید مانند 100.00$ .',
  13704. oneRequired: 'لطفا حداقل یکی از فیلدها را پر کنید.',
  13705. errorPrefix: 'خطا: ',
  13706. warningPrefix: 'هشدار: ',
  13707. // Form.Validator.Extras
  13708. noSpace: 'استفاده از فاصله در این بخش مجاز نیست.',
  13709. reqChkByNode: 'موردی انتخاب نشده است.',
  13710. requiredChk: 'این فیلد الزامی است.',
  13711. reqChkByName: 'لطفا یک {label} را انتخاب کنید.',
  13712. match: 'این فیلد باید با فیلد {matchName} مطابقت داشته باشد.',
  13713. startDate: 'تاریخ شروع',
  13714. endDate: 'تاریخ پایان',
  13715. currentDate: 'تاریخ کنونی',
  13716. afterDate: 'تاریخ میبایست برابر یا بعد از {label} باشد',
  13717. beforeDate: 'تاریخ میبایست برابر یا قبل از {label} باشد',
  13718. startMonth: 'لطفا ماه شروع را انتخاب کنید',
  13719. sameMonth: 'این دو تاریخ باید در یک ماه باشند - شما باید یکی یا هر دو را تغییر دهید.',
  13720. creditcard: 'شماره کارت اعتباری که وارد کرده اید معتبر نیست. لطفا شماره را بررسی کنید و مجددا تلاش کنید. {length} رقم وارد شده است.'
  13721. });
  13722. /*
  13723. ---
  13724. name: Locale.fi-FI.Date
  13725. description: Date messages for Finnish.
  13726. license: MIT-style license
  13727. authors:
  13728. - ksel
  13729. requires:
  13730. - Locale
  13731. provides: [Locale.fi-FI.Date]
  13732. ...
  13733. */
  13734. Locale.define('fi-FI', 'Date', {
  13735. // NOTE: months and days are not capitalized in finnish
  13736. months: ['tammikuu', 'helmikuu', 'maaliskuu', 'huhtikuu', 'toukokuu', 'kesäkuu', 'heinäkuu', 'elokuu', 'syyskuu', 'lokakuu', 'marraskuu', 'joulukuu'],
  13737. // these abbreviations are really not much used in finnish because they obviously won't abbreviate very much. ;)
  13738. // NOTE: sometimes one can see forms such as "tammi", "helmi", etc. but that is not proper finnish.
  13739. months_abbr: ['tammik.', 'helmik.', 'maalisk.', 'huhtik.', 'toukok.', 'kesäk.', 'heinäk.', 'elok.', 'syysk.', 'lokak.', 'marrask.', 'jouluk.'],
  13740. days: ['sunnuntai', 'maanantai', 'tiistai', 'keskiviikko', 'torstai', 'perjantai', 'lauantai'],
  13741. days_abbr: ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'],
  13742. // Culture's date order: DD/MM/YYYY
  13743. dateOrder: ['date', 'month', 'year'],
  13744. shortDate: '%d.%m.%Y',
  13745. shortTime: '%H:%M',
  13746. AM: 'AM',
  13747. PM: 'PM',
  13748. firstDayOfWeek: 1,
  13749. // Date.Extras
  13750. ordinal: '.',
  13751. lessThanMinuteAgo: 'vajaa minuutti sitten',
  13752. minuteAgo: 'noin minuutti sitten',
  13753. minutesAgo: '{delta} minuuttia sitten',
  13754. hourAgo: 'noin tunti sitten',
  13755. hoursAgo: 'noin {delta} tuntia sitten',
  13756. dayAgo: 'päivä sitten',
  13757. daysAgo: '{delta} päivää sitten',
  13758. weekAgo: 'viikko sitten',
  13759. weeksAgo: '{delta} viikkoa sitten',
  13760. monthAgo: 'kuukausi sitten',
  13761. monthsAgo: '{delta} kuukautta sitten',
  13762. yearAgo: 'vuosi sitten',
  13763. yearsAgo: '{delta} vuotta sitten',
  13764. lessThanMinuteUntil: 'vajaan minuutin kuluttua',
  13765. minuteUntil: 'noin minuutin kuluttua',
  13766. minutesUntil: '{delta} minuutin kuluttua',
  13767. hourUntil: 'noin tunnin kuluttua',
  13768. hoursUntil: 'noin {delta} tunnin kuluttua',
  13769. dayUntil: 'päivän kuluttua',
  13770. daysUntil: '{delta} päivän kuluttua',
  13771. weekUntil: 'viikon kuluttua',
  13772. weeksUntil: '{delta} viikon kuluttua',
  13773. monthUntil: 'kuukauden kuluttua',
  13774. monthsUntil: '{delta} kuukauden kuluttua',
  13775. yearUntil: 'vuoden kuluttua',
  13776. yearsUntil: '{delta} vuoden kuluttua'
  13777. });
  13778. /*
  13779. ---
  13780. name: Locale.fi-FI.Form.Validator
  13781. description: Form Validator messages for Finnish.
  13782. license: MIT-style license
  13783. authors:
  13784. - ksel
  13785. requires:
  13786. - Locale
  13787. provides: [Locale.fi-FI.Form.Validator]
  13788. ...
  13789. */
  13790. Locale.define('fi-FI', 'FormValidator', {
  13791. required: 'Tämä kenttä on pakollinen.',
  13792. minLength: 'Ole hyvä ja anna vähintään {minLength} merkkiä (annoit {length} merkkiä).',
  13793. maxLength: 'Älä anna enempää kuin {maxLength} merkkiä (annoit {length} merkkiä).',
  13794. integer: 'Ole hyvä ja anna kokonaisluku. Luvut, joissa on desimaaleja (esim. 1.25) eivät ole sallittuja.',
  13795. numeric: 'Anna tähän kenttään lukuarvo (kuten "1" tai "1.1" tai "-1" tai "-1.1").',
  13796. 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).',
  13797. alpha: 'Anna tähän kenttään vain kirjaimia (a-z). Välilyönnit tai muut merkit eivät ole sallittuja.',
  13798. 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.',
  13799. dateSuchAs: 'Ole hyvä ja anna kelvollinen päivmäärä, kuten esimerkiksi {date}',
  13800. dateInFormatMDY: 'Ole hyvä ja anna kelvollinen päivämäärä muodossa pp/kk/vvvv (kuten "12/31/1999")',
  13801. email: 'Ole hyvä ja anna kelvollinen sähköpostiosoite (kuten esimerkiksi "matti@meikalainen.com").',
  13802. url: 'Ole hyvä ja anna kelvollinen URL, kuten esimerkiksi http://www.example.com.',
  13803. currencyDollar: 'Ole hyvä ja anna kelvollinen eurosumma (kuten esimerkiksi 100,00 EUR) .',
  13804. oneRequired: 'Ole hyvä ja syötä jotakin ainakin johonkin näistä kentistä.',
  13805. errorPrefix: 'Virhe: ',
  13806. warningPrefix: 'Varoitus: ',
  13807. // Form.Validator.Extras
  13808. noSpace: 'Tässä syötteessä ei voi olla välilyöntejä',
  13809. reqChkByNode: 'Ei valintoja.',
  13810. requiredChk: 'Tämä kenttä on pakollinen.',
  13811. reqChkByName: 'Ole hyvä ja valitse {label}.',
  13812. match: 'Tämän kentän tulee vastata kenttää {matchName}',
  13813. startDate: 'alkupäivämäärä',
  13814. endDate: 'loppupäivämäärä',
  13815. currentDate: 'nykyinen päivämäärä',
  13816. afterDate: 'Päivämäärän tulisi olla sama tai myöhäisempi ajankohta kuin {label}.',
  13817. beforeDate: 'Päivämäärän tulisi olla sama tai aikaisempi ajankohta kuin {label}.',
  13818. startMonth: 'Ole hyvä ja valitse aloituskuukausi',
  13819. sameMonth: 'Näiden kahden päivämäärän tulee olla saman kuun sisällä -- sinun pitää muuttaa jompaa kumpaa.',
  13820. creditcard: 'Annettu luottokortin numero ei kelpaa. Ole hyvä ja tarkista numero sekä yritä uudelleen. {length} numeroa syötetty.'
  13821. });
  13822. /*
  13823. ---
  13824. name: Locale.fi-FI.Number
  13825. description: Finnish number messages
  13826. license: MIT-style license
  13827. authors:
  13828. - ksel
  13829. requires:
  13830. - Locale
  13831. - Locale.EU.Number
  13832. provides: [Locale.fi-FI.Number]
  13833. ...
  13834. */
  13835. Locale.define('fi-FI', 'Number', {
  13836. group: ' ' // grouped by space
  13837. }).inherit('EU', 'Number');
  13838. /*
  13839. ---
  13840. name: Locale.fr-FR.Date
  13841. description: Date messages for French.
  13842. license: MIT-style license
  13843. authors:
  13844. - Nicolas Sorosac
  13845. - Antoine Abt
  13846. requires:
  13847. - Locale
  13848. provides: [Locale.fr-FR.Date]
  13849. ...
  13850. */
  13851. Locale.define('fr-FR', 'Date', {
  13852. months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
  13853. months_abbr: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
  13854. days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
  13855. days_abbr: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
  13856. // Culture's date order: DD/MM/YYYY
  13857. dateOrder: ['date', 'month', 'year'],
  13858. shortDate: '%d/%m/%Y',
  13859. shortTime: '%H:%M',
  13860. AM: 'AM',
  13861. PM: 'PM',
  13862. firstDayOfWeek: 1,
  13863. // Date.Extras
  13864. ordinal: function(dayOfMonth){
  13865. return (dayOfMonth > 1) ? '' : 'er';
  13866. },
  13867. lessThanMinuteAgo: "il y a moins d'une minute",
  13868. minuteAgo: 'il y a une minute',
  13869. minutesAgo: 'il y a {delta} minutes',
  13870. hourAgo: 'il y a une heure',
  13871. hoursAgo: 'il y a {delta} heures',
  13872. dayAgo: 'il y a un jour',
  13873. daysAgo: 'il y a {delta} jours',
  13874. weekAgo: 'il y a une semaine',
  13875. weeksAgo: 'il y a {delta} semaines',
  13876. monthAgo: 'il y a 1 mois',
  13877. monthsAgo: 'il y a {delta} mois',
  13878. yearthAgo: 'il y a 1 an',
  13879. yearsAgo: 'il y a {delta} ans',
  13880. lessThanMinuteUntil: "dans moins d'une minute",
  13881. minuteUntil: 'dans une minute',
  13882. minutesUntil: 'dans {delta} minutes',
  13883. hourUntil: 'dans une heure',
  13884. hoursUntil: 'dans {delta} heures',
  13885. dayUntil: 'dans un jour',
  13886. daysUntil: 'dans {delta} jours',
  13887. weekUntil: 'dans 1 semaine',
  13888. weeksUntil: 'dans {delta} semaines',
  13889. monthUntil: 'dans 1 mois',
  13890. monthsUntil: 'dans {delta} mois',
  13891. yearUntil: 'dans 1 an',
  13892. yearsUntil: 'dans {delta} ans'
  13893. });
  13894. /*
  13895. ---
  13896. name: Locale.fr-FR.Form.Validator
  13897. description: Form Validator messages for French.
  13898. license: MIT-style license
  13899. authors:
  13900. - Miquel Hudin
  13901. - Nicolas Sorosac
  13902. requires:
  13903. - Locale
  13904. provides: [Locale.fr-FR.Form.Validator]
  13905. ...
  13906. */
  13907. /*eslint mootools-whitespace:0*/
  13908. Locale.define('fr-FR', 'FormValidator', {
  13909. required: 'Ce champ est obligatoire.',
  13910. length: 'Veuillez saisir {length} caract&egrave;re(s) (vous avez saisi {elLength} caract&egrave;re(s)',
  13911. minLength: 'Veuillez saisir un minimum de {minLength} caract&egrave;re(s) (vous avez saisi {length} caract&egrave;re(s)).',
  13912. maxLength: 'Veuillez saisir un maximum de {maxLength} caract&egrave;re(s) (vous avez saisi {length} caract&egrave;re(s)).',
  13913. integer: 'Veuillez saisir un nombre entier dans ce champ. Les nombres d&eacute;cimaux (ex : "1,25") ne sont pas autoris&eacute;s.',
  13914. numeric: 'Veuillez saisir uniquement des chiffres dans ce champ (ex : "1" ou "1,1" ou "-1" ou "-1,1").',
  13915. 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;).",
  13916. alpha: 'Veuillez saisir uniquement des lettres (a-z) dans ce champ. Les espaces ou autres caract&egrave;res ne sont pas autoris&eacute;s.',
  13917. 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.',
  13918. dateSuchAs: 'Veuillez saisir une date correcte comme {date}',
  13919. dateInFormatMDY: 'Veuillez saisir une date correcte, au format JJ/MM/AAAA (ex : "31/11/1999").',
  13920. email: 'Veuillez saisir une adresse de courrier &eacute;lectronique. Par exemple "fred@domaine.com".',
  13921. url: 'Veuillez saisir une URL, comme http://www.exemple.com.',
  13922. currencyDollar: 'Veuillez saisir une quantit&eacute; correcte. Par exemple 100,00&euro;.',
  13923. oneRequired: 'Veuillez s&eacute;lectionner au moins une de ces options.',
  13924. errorPrefix: 'Erreur : ',
  13925. warningPrefix: 'Attention : ',
  13926. // Form.Validator.Extras
  13927. noSpace: "Ce champ n'accepte pas les espaces.",
  13928. reqChkByNode: "Aucun &eacute;l&eacute;ment n'est s&eacute;lectionn&eacute;.",
  13929. requiredChk: 'Ce champ est obligatoire.',
  13930. reqChkByName: 'Veuillez s&eacute;lectionner un(e) {label}.',
  13931. match: 'Ce champ doit correspondre avec le champ {matchName}.',
  13932. startDate: 'date de d&eacute;but',
  13933. endDate: 'date de fin',
  13934. currentDate: 'date actuelle',
  13935. afterDate: 'La date doit &ecirc;tre identique ou post&eacute;rieure &agrave; {label}.',
  13936. beforeDate: 'La date doit &ecirc;tre identique ou ant&eacute;rieure &agrave; {label}.',
  13937. startMonth: 'Veuillez s&eacute;lectionner un mois de d&eacute;but.',
  13938. sameMonth: 'Ces deux dates doivent &ecirc;tre dans le m&ecirc;me mois - vous devez en modifier une.',
  13939. 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).'
  13940. });
  13941. /*
  13942. ---
  13943. name: Locale.fr-FR.Number
  13944. description: Number messages for French.
  13945. license: MIT-style license
  13946. authors:
  13947. - Arian Stolwijk
  13948. - sv1l
  13949. requires:
  13950. - Locale
  13951. - Locale.EU.Number
  13952. provides: [Locale.fr-FR.Number]
  13953. ...
  13954. */
  13955. Locale.define('fr-FR', 'Number', {
  13956. group: ' ' // In fr-FR localization, group character is a blank space
  13957. }).inherit('EU', 'Number');
  13958. /*
  13959. ---
  13960. name: Locale.he-IL.Date
  13961. description: Date messages for Hebrew.
  13962. license: MIT-style license
  13963. authors:
  13964. - Elad Ossadon
  13965. requires:
  13966. - Locale
  13967. provides: [Locale.he-IL.Date]
  13968. ...
  13969. */
  13970. Locale.define('he-IL', 'Date', {
  13971. months: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
  13972. months_abbr: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
  13973. days: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'],
  13974. days_abbr: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'],
  13975. // Culture's date order: MM/DD/YYYY
  13976. dateOrder: ['date', 'month', 'year'],
  13977. shortDate: '%d/%m/%Y',
  13978. shortTime: '%H:%M',
  13979. AM: 'AM',
  13980. PM: 'PM',
  13981. firstDayOfWeek: 0,
  13982. // Date.Extras
  13983. ordinal: '',
  13984. lessThanMinuteAgo: 'לפני פחות מדקה',
  13985. minuteAgo: 'לפני כדקה',
  13986. minutesAgo: 'לפני {delta} דקות',
  13987. hourAgo: 'לפני כשעה',
  13988. hoursAgo: 'לפני {delta} שעות',
  13989. dayAgo: 'לפני יום',
  13990. daysAgo: 'לפני {delta} ימים',
  13991. weekAgo: 'לפני שבוע',
  13992. weeksAgo: 'לפני {delta} שבועות',
  13993. monthAgo: 'לפני חודש',
  13994. monthsAgo: 'לפני {delta} חודשים',
  13995. yearAgo: 'לפני שנה',
  13996. yearsAgo: 'לפני {delta} שנים',
  13997. lessThanMinuteUntil: 'בעוד פחות מדקה',
  13998. minuteUntil: 'בעוד כדקה',
  13999. minutesUntil: 'בעוד {delta} דקות',
  14000. hourUntil: 'בעוד כשעה',
  14001. hoursUntil: 'בעוד {delta} שעות',
  14002. dayUntil: 'בעוד יום',
  14003. daysUntil: 'בעוד {delta} ימים',
  14004. weekUntil: 'בעוד שבוע',
  14005. weeksUntil: 'בעוד {delta} שבועות',
  14006. monthUntil: 'בעוד חודש',
  14007. monthsUntil: 'בעוד {delta} חודשים',
  14008. yearUntil: 'בעוד שנה',
  14009. yearsUntil: 'בעוד {delta} שנים'
  14010. });
  14011. /*
  14012. ---
  14013. name: Locale.he-IL.Form.Validator
  14014. description: Form Validator messages for Hebrew.
  14015. license: MIT-style license
  14016. authors:
  14017. - Elad Ossadon
  14018. requires:
  14019. - Locale
  14020. provides: [Locale.he-IL.Form.Validator]
  14021. ...
  14022. */
  14023. Locale.define('he-IL', 'FormValidator', {
  14024. required: 'נא למלא שדה זה.',
  14025. minLength: 'נא להזין לפחות {minLength} תווים (הזנת {length} תווים).',
  14026. maxLength: 'נא להזין עד {maxLength} תווים (הזנת {length} תווים).',
  14027. integer: 'נא להזין מספר שלם לשדה זה. מספרים עשרוניים (כמו 1.25) אינם חוקיים.',
  14028. numeric: 'נא להזין ערך מספרי בלבד בשדה זה (כמו "1", "1.1", "-1" או "-1.1").',
  14029. digits: 'נא להזין רק ספרות וסימני הפרדה בשדה זה (למשל, מספר טלפון עם מקפים או נקודות הוא חוקי).',
  14030. alpha: 'נא להזין רק אותיות באנגלית (a-z) בשדה זה. רווחים או תווים אחרים אינם חוקיים.',
  14031. alphanum: 'נא להזין רק אותריות באנגלית (a-z) או ספרות (0-9) בשדה זה. אווחרים או תווים אחרים אינם חוקיים.',
  14032. dateSuchAs: 'נא להזין תאריך חוקי, כמו {date}',
  14033. dateInFormatMDY: 'נא להזין תאריך חוקי בפורמט MM/DD/YYYY (כמו "12/31/1999")',
  14034. email: 'נא להזין כתובת אימייל חוקית. לדוגמה: "fred@domain.com".',
  14035. url: 'נא להזין כתובת אתר חוקית, כמו http://www.example.com.',
  14036. currencyDollar: 'נא להזין סכום דולרי חוקי. לדוגמה $100.00.',
  14037. oneRequired: 'נא לבחור לפחות בשדה אחד.',
  14038. errorPrefix: 'שגיאה: ',
  14039. warningPrefix: 'אזהרה: ',
  14040. // Form.Validator.Extras
  14041. noSpace: 'אין להזין רווחים בשדה זה.',
  14042. reqChkByNode: 'נא לבחור אחת מהאפשרויות.',
  14043. requiredChk: 'שדה זה נדרש.',
  14044. reqChkByName: 'נא לבחור {label}.',
  14045. match: 'שדה זה צריך להתאים לשדה {matchName}',
  14046. startDate: 'תאריך ההתחלה',
  14047. endDate: 'תאריך הסיום',
  14048. currentDate: 'התאריך הנוכחי',
  14049. afterDate: 'התאריך צריך להיות זהה או אחרי {label}.',
  14050. beforeDate: 'התאריך צריך להיות זהה או לפני {label}.',
  14051. startMonth: 'נא לבחור חודש התחלה',
  14052. sameMonth: 'שני תאריכים אלה צריכים להיות באותו חודש - נא לשנות אחד התאריכים.',
  14053. creditcard: 'מספר כרטיס האשראי שהוזן אינו חוקי. נא לבדוק שנית. הוזנו {length} ספרות.'
  14054. });
  14055. /*
  14056. ---
  14057. name: Locale.he-IL.Number
  14058. description: Number messages for Hebrew.
  14059. license: MIT-style license
  14060. authors:
  14061. - Elad Ossadon
  14062. requires:
  14063. - Locale
  14064. provides: [Locale.he-IL.Number]
  14065. ...
  14066. */
  14067. Locale.define('he-IL', 'Number', {
  14068. decimal: '.',
  14069. group: ',',
  14070. currency: {
  14071. suffix: ' ₪'
  14072. }
  14073. });
  14074. /*
  14075. ---
  14076. name: Locale.hu-HU.Date
  14077. description: Date messages for Hungarian.
  14078. license: MIT-style license
  14079. authors:
  14080. - Zsolt Szegheő
  14081. requires:
  14082. - Locale
  14083. provides: [Locale.hu-HU.Date]
  14084. ...
  14085. */
  14086. Locale.define('hu-HU', 'Date', {
  14087. months: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június', 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],
  14088. months_abbr: ['jan.', 'febr.', 'márc.', 'ápr.', 'máj.', 'jún.', 'júl.', 'aug.', 'szept.', 'okt.', 'nov.', 'dec.'],
  14089. days: ['Vasárnap', 'Hétfő', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
  14090. days_abbr: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
  14091. // Culture's date order: YYYY.MM.DD.
  14092. dateOrder: ['year', 'month', 'date'],
  14093. shortDate: '%Y.%m.%d.',
  14094. shortTime: '%I:%M',
  14095. AM: 'de.',
  14096. PM: 'du.',
  14097. firstDayOfWeek: 1,
  14098. // Date.Extras
  14099. ordinal: '.',
  14100. lessThanMinuteAgo: 'alig egy perce',
  14101. minuteAgo: 'egy perce',
  14102. minutesAgo: '{delta} perce',
  14103. hourAgo: 'egy órája',
  14104. hoursAgo: '{delta} órája',
  14105. dayAgo: '1 napja',
  14106. daysAgo: '{delta} napja',
  14107. weekAgo: '1 hete',
  14108. weeksAgo: '{delta} hete',
  14109. monthAgo: '1 hónapja',
  14110. monthsAgo: '{delta} hónapja',
  14111. yearAgo: '1 éve',
  14112. yearsAgo: '{delta} éve',
  14113. lessThanMinuteUntil: 'alig egy perc múlva',
  14114. minuteUntil: 'egy perc múlva',
  14115. minutesUntil: '{delta} perc múlva',
  14116. hourUntil: 'egy óra múlva',
  14117. hoursUntil: '{delta} óra múlva',
  14118. dayUntil: '1 nap múlva',
  14119. daysUntil: '{delta} nap múlva',
  14120. weekUntil: '1 hét múlva',
  14121. weeksUntil: '{delta} hét múlva',
  14122. monthUntil: '1 hónap múlva',
  14123. monthsUntil: '{delta} hónap múlva',
  14124. yearUntil: '1 év múlva',
  14125. yearsUntil: '{delta} év múlva'
  14126. });
  14127. /*
  14128. ---
  14129. name: Locale.hu-HU.Form.Validator
  14130. description: Form Validator messages for Hungarian.
  14131. license: MIT-style license
  14132. authors:
  14133. - Zsolt Szegheő
  14134. requires:
  14135. - Locale
  14136. provides: [Locale.hu-HU.Form.Validator]
  14137. ...
  14138. */
  14139. /*eslint mootools-whitespace:0*/
  14140. Locale.define('hu-HU', 'FormValidator', {
  14141. required: 'A mező kitöltése kötelező.',
  14142. minLength: 'Legalább {minLength} karakter megadása szükséges (megadva {length} karakter).',
  14143. maxLength: 'Legfeljebb {maxLength} karakter megadása lehetséges (megadva {length} karakter).',
  14144. integer: 'Egész szám megadása szükséges. A tizedesjegyek (pl. 1.25) nem engedélyezettek.',
  14145. numeric: 'Szám megadása szükséges (pl. "1" vagy "1.1" vagy "-1" vagy "-1.1").',
  14146. digits: 'Csak számok és írásjelek megadása lehetséges (pl. telefonszám kötőjelek és/vagy perjelekkel).',
  14147. alpha: 'Csak betűk (a-z) megadása lehetséges. Szóköz és egyéb karakterek nem engedélyezettek.',
  14148. 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.',
  14149. dateSuchAs: 'Valós dátum megadása szükséges (pl. {date}).',
  14150. dateInFormatMDY: 'Valós dátum megadása szükséges ÉÉÉÉ.HH.NN. formában. (pl. "1999.12.31.")',
  14151. email: 'Valós e-mail cím megadása szükséges (pl. "fred@domain.hu").',
  14152. url: 'Valós URL megadása szükséges (pl. http://www.example.com).',
  14153. currencyDollar: 'Valós pénzösszeg megadása szükséges (pl. 100.00 Ft.).',
  14154. oneRequired: 'Az alábbi mezők legalább egyikének kitöltése kötelező.',
  14155. errorPrefix: 'Hiba: ',
  14156. warningPrefix: 'Figyelem: ',
  14157. // Form.Validator.Extras
  14158. noSpace: 'A mező nem tartalmazhat szóközöket.',
  14159. reqChkByNode: 'Nincs egyetlen kijelölt elem sem.',
  14160. requiredChk: 'A mező kitöltése kötelező.',
  14161. reqChkByName: 'Egy {label} kiválasztása szükséges.',
  14162. match: 'A mezőnek egyeznie kell a(z) {matchName} mezővel.',
  14163. startDate: 'a kezdet dátuma',
  14164. endDate: 'a vég dátuma',
  14165. currentDate: 'jelenlegi dátum',
  14166. afterDate: 'A dátum nem lehet kisebb, mint {label}.',
  14167. beforeDate: 'A dátum nem lehet nagyobb, mint {label}.',
  14168. startMonth: 'Kezdeti hónap megadása szükséges.',
  14169. sameMonth: 'A két dátumnak ugyanazon hónapban kell lennie.',
  14170. creditcard: 'A megadott bankkártyaszám nem valódi (megadva {length} számjegy).'
  14171. });
  14172. /*
  14173. ---
  14174. name: Locale.it-IT.Date
  14175. description: Date messages for Italian.
  14176. license: MIT-style license.
  14177. authors:
  14178. - Andrea Novero
  14179. - Valerio Proietti
  14180. requires:
  14181. - Locale
  14182. provides: [Locale.it-IT.Date]
  14183. ...
  14184. */
  14185. Locale.define('it-IT', 'Date', {
  14186. months: ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'],
  14187. months_abbr: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
  14188. days: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
  14189. days_abbr: ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'],
  14190. // Culture's date order: DD/MM/YYYY
  14191. dateOrder: ['date', 'month', 'year'],
  14192. shortDate: '%d/%m/%Y',
  14193. shortTime: '%H.%M',
  14194. AM: 'AM',
  14195. PM: 'PM',
  14196. firstDayOfWeek: 1,
  14197. // Date.Extras
  14198. ordinal: 'º',
  14199. lessThanMinuteAgo: 'meno di un minuto fa',
  14200. minuteAgo: 'circa un minuto fa',
  14201. minutesAgo: 'circa {delta} minuti fa',
  14202. hourAgo: "circa un'ora fa",
  14203. hoursAgo: 'circa {delta} ore fa',
  14204. dayAgo: 'circa 1 giorno fa',
  14205. daysAgo: 'circa {delta} giorni fa',
  14206. weekAgo: 'una settimana fa',
  14207. weeksAgo: '{delta} settimane fa',
  14208. monthAgo: 'un mese fa',
  14209. monthsAgo: '{delta} mesi fa',
  14210. yearAgo: 'un anno fa',
  14211. yearsAgo: '{delta} anni fa',
  14212. lessThanMinuteUntil: 'tra meno di un minuto',
  14213. minuteUntil: 'tra circa un minuto',
  14214. minutesUntil: 'tra circa {delta} minuti',
  14215. hourUntil: "tra circa un'ora",
  14216. hoursUntil: 'tra circa {delta} ore',
  14217. dayUntil: 'tra circa un giorno',
  14218. daysUntil: 'tra circa {delta} giorni',
  14219. weekUntil: 'tra una settimana',
  14220. weeksUntil: 'tra {delta} settimane',
  14221. monthUntil: 'tra un mese',
  14222. monthsUntil: 'tra {delta} mesi',
  14223. yearUntil: 'tra un anno',
  14224. yearsUntil: 'tra {delta} anni'
  14225. });
  14226. /*
  14227. ---
  14228. name: Locale.it-IT.Form.Validator
  14229. description: Form Validator messages for Italian.
  14230. license: MIT-style license
  14231. authors:
  14232. - Leonardo Laureti
  14233. - Andrea Novero
  14234. requires:
  14235. - Locale
  14236. provides: [Locale.it-IT.Form.Validator]
  14237. ...
  14238. */
  14239. /*eslint mootools-whitespace:0*/
  14240. Locale.define('it-IT', 'FormValidator', {
  14241. required: 'Il campo &egrave; obbligatorio.',
  14242. minLength: 'Inserire almeno {minLength} caratteri (ne sono stati inseriti {length}).',
  14243. maxLength: 'Inserire al massimo {maxLength} caratteri (ne sono stati inseriti {length}).',
  14244. integer: 'Inserire un numero intero. Non sono consentiti decimali (es.: 1.25).',
  14245. numeric: 'Inserire solo valori numerici (es.: "1" oppure "1.1" oppure "-1" oppure "-1.1").',
  14246. digits: 'Inserire solo numeri e caratteri di punteggiatura. Per esempio &egrave; consentito un numero telefonico con trattini o punti.',
  14247. alpha: 'Inserire solo lettere (a-z). Non sono consentiti spazi o altri caratteri.',
  14248. alphanum: 'Inserire solo lettere (a-z) o numeri (0-9). Non sono consentiti spazi o altri caratteri.',
  14249. dateSuchAs: 'Inserire una data valida del tipo {date}',
  14250. dateInFormatMDY: 'Inserire una data valida nel formato MM/GG/AAAA (es.: "12/31/1999")',
  14251. email: 'Inserire un indirizzo email valido. Per esempio "nome@dominio.com".',
  14252. url: 'Inserire un indirizzo valido. Per esempio "http://www.example.com".',
  14253. currencyDollar: 'Inserire un importo valido. Per esempio "$100.00".',
  14254. oneRequired: 'Completare almeno uno dei campi richiesti.',
  14255. errorPrefix: 'Errore: ',
  14256. warningPrefix: 'Attenzione: ',
  14257. // Form.Validator.Extras
  14258. noSpace: 'Non sono consentiti spazi.',
  14259. reqChkByNode: 'Nessuna voce selezionata.',
  14260. requiredChk: 'Il campo &egrave; obbligatorio.',
  14261. reqChkByName: 'Selezionare un(a) {label}.',
  14262. match: 'Il valore deve corrispondere al campo {matchName}',
  14263. startDate: "data d'inizio",
  14264. endDate: 'data di fine',
  14265. currentDate: 'data attuale',
  14266. afterDate: 'La data deve corrispondere o essere successiva al {label}.',
  14267. beforeDate: 'La data deve corrispondere o essere precedente al {label}.',
  14268. startMonth: "Selezionare un mese d'inizio",
  14269. sameMonth: 'Le due date devono essere dello stesso mese - occorre modificarne una.'
  14270. });
  14271. /*
  14272. ---
  14273. name: Locale.ja-JP.Date
  14274. description: Date messages for Japanese.
  14275. license: MIT-style license
  14276. authors:
  14277. - Noritaka Horio
  14278. requires:
  14279. - Locale
  14280. provides: [Locale.ja-JP.Date]
  14281. ...
  14282. */
  14283. Locale.define('ja-JP', 'Date', {
  14284. months: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  14285. months_abbr: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  14286. days: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
  14287. days_abbr: ['日', '月', '火', '水', '木', '金', '土'],
  14288. // Culture's date order: YYYY/MM/DD
  14289. dateOrder: ['year', 'month', 'date'],
  14290. shortDate: '%Y/%m/%d',
  14291. shortTime: '%H:%M',
  14292. AM: '午前',
  14293. PM: '午後',
  14294. firstDayOfWeek: 0,
  14295. // Date.Extras
  14296. ordinal: '',
  14297. lessThanMinuteAgo: '1分以内前',
  14298. minuteAgo: '約1分前',
  14299. minutesAgo: '約{delta}分前',
  14300. hourAgo: '約1時間前',
  14301. hoursAgo: '約{delta}時間前',
  14302. dayAgo: '1日前',
  14303. daysAgo: '{delta}日前',
  14304. weekAgo: '1週間前',
  14305. weeksAgo: '{delta}週間前',
  14306. monthAgo: '1ヶ月前',
  14307. monthsAgo: '{delta}ヶ月前',
  14308. yearAgo: '1年前',
  14309. yearsAgo: '{delta}年前',
  14310. lessThanMinuteUntil: '今から約1分以内',
  14311. minuteUntil: '今から約1分',
  14312. minutesUntil: '今から約{delta}分',
  14313. hourUntil: '今から約1時間',
  14314. hoursUntil: '今から約{delta}時間',
  14315. dayUntil: '今から1日間',
  14316. daysUntil: '今から{delta}日間',
  14317. weekUntil: '今から1週間',
  14318. weeksUntil: '今から{delta}週間',
  14319. monthUntil: '今から1ヶ月',
  14320. monthsUntil: '今から{delta}ヶ月',
  14321. yearUntil: '今から1年',
  14322. yearsUntil: '今から{delta}年'
  14323. });
  14324. /*
  14325. ---
  14326. name: Locale.ja-JP.Form.Validator
  14327. description: Form Validator messages for Japanese.
  14328. license: MIT-style license
  14329. authors:
  14330. - Noritaka Horio
  14331. requires:
  14332. - Locale
  14333. provides: [Locale.ja-JP.Form.Validator]
  14334. ...
  14335. */
  14336. Locale.define('ja-JP', 'FormValidator', {
  14337. required: '入力は必須です。',
  14338. minLength: '入力文字数は{minLength}以上にしてください。({length}文字)',
  14339. maxLength: '入力文字数は{maxLength}以下にしてください。({length}文字)',
  14340. integer: '整数を入力してください。',
  14341. numeric: '入力できるのは数値だけです。(例: "1", "1.1", "-1", "-1.1"....)',
  14342. digits: '入力できるのは数値と句読記号です。 (例: -や+を含む電話番号など).',
  14343. alpha: '入力できるのは半角英字だけです。それ以外の文字は入力できません。',
  14344. alphanum: '入力できるのは半角英数字だけです。それ以外の文字は入力できません。',
  14345. dateSuchAs: '有効な日付を入力してください。{date}',
  14346. dateInFormatMDY: '日付の書式に誤りがあります。YYYY/MM/DD (i.e. "1999/12/31")',
  14347. email: 'メールアドレスに誤りがあります。',
  14348. url: 'URLアドレスに誤りがあります。',
  14349. currencyDollar: '金額に誤りがあります。',
  14350. oneRequired: 'ひとつ以上入力してください。',
  14351. errorPrefix: 'エラー: ',
  14352. warningPrefix: '警告: ',
  14353. // FormValidator.Extras
  14354. noSpace: 'スペースは入力できません。',
  14355. reqChkByNode: '選択されていません。',
  14356. requiredChk: 'この項目は必須です。',
  14357. reqChkByName: '{label}を選択してください。',
  14358. match: '{matchName}が入力されている場合必須です。',
  14359. startDate: '開始日',
  14360. endDate: '終了日',
  14361. currentDate: '今日',
  14362. afterDate: '{label}以降の日付にしてください。',
  14363. beforeDate: '{label}以前の日付にしてください。',
  14364. startMonth: '開始月を選択してください。',
  14365. sameMonth: '日付が同一です。どちらかを変更してください。'
  14366. });
  14367. /*
  14368. ---
  14369. name: Locale.ja-JP.Number
  14370. description: Number messages for Japanese.
  14371. license: MIT-style license
  14372. authors:
  14373. - Noritaka Horio
  14374. requires:
  14375. - Locale
  14376. provides: [Locale.ja-JP.Number]
  14377. ...
  14378. */
  14379. Locale.define('ja-JP', 'Number', {
  14380. decimal: '.',
  14381. group: ',',
  14382. currency: {
  14383. decimals: 0,
  14384. prefix: '\\'
  14385. }
  14386. });
  14387. /*
  14388. ---
  14389. name: Locale.nl-NL.Date
  14390. description: Date messages for Dutch.
  14391. license: MIT-style license
  14392. authors:
  14393. - Lennart Pilon
  14394. - Tim Wienk
  14395. requires:
  14396. - Locale
  14397. provides: [Locale.nl-NL.Date]
  14398. ...
  14399. */
  14400. Locale.define('nl-NL', 'Date', {
  14401. months: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
  14402. months_abbr: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
  14403. days: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
  14404. days_abbr: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
  14405. // Culture's date order: DD-MM-YYYY
  14406. dateOrder: ['date', 'month', 'year'],
  14407. shortDate: '%d-%m-%Y',
  14408. shortTime: '%H:%M',
  14409. AM: 'AM',
  14410. PM: 'PM',
  14411. firstDayOfWeek: 1,
  14412. // Date.Extras
  14413. ordinal: 'e',
  14414. lessThanMinuteAgo: 'minder dan een minuut geleden',
  14415. minuteAgo: 'ongeveer een minuut geleden',
  14416. minutesAgo: '{delta} minuten geleden',
  14417. hourAgo: 'ongeveer een uur geleden',
  14418. hoursAgo: 'ongeveer {delta} uur geleden',
  14419. dayAgo: 'een dag geleden',
  14420. daysAgo: '{delta} dagen geleden',
  14421. weekAgo: 'een week geleden',
  14422. weeksAgo: '{delta} weken geleden',
  14423. monthAgo: 'een maand geleden',
  14424. monthsAgo: '{delta} maanden geleden',
  14425. yearAgo: 'een jaar geleden',
  14426. yearsAgo: '{delta} jaar geleden',
  14427. lessThanMinuteUntil: 'over minder dan een minuut',
  14428. minuteUntil: 'over ongeveer een minuut',
  14429. minutesUntil: 'over {delta} minuten',
  14430. hourUntil: 'over ongeveer een uur',
  14431. hoursUntil: 'over {delta} uur',
  14432. dayUntil: 'over ongeveer een dag',
  14433. daysUntil: 'over {delta} dagen',
  14434. weekUntil: 'over een week',
  14435. weeksUntil: 'over {delta} weken',
  14436. monthUntil: 'over een maand',
  14437. monthsUntil: 'over {delta} maanden',
  14438. yearUntil: 'over een jaar',
  14439. yearsUntil: 'over {delta} jaar'
  14440. });
  14441. /*
  14442. ---
  14443. name: Locale.nl-NL.Form.Validator
  14444. description: Form Validator messages for Dutch.
  14445. license: MIT-style license
  14446. authors:
  14447. - Lennart Pilon
  14448. - Arian Stolwijk
  14449. - Tim Wienk
  14450. requires:
  14451. - Locale
  14452. provides: [Locale.nl-NL.Form.Validator]
  14453. ...
  14454. */
  14455. Locale.define('nl-NL', 'FormValidator', {
  14456. required: 'Dit veld is verplicht.',
  14457. length: 'Vul precies {length} karakters in (je hebt {elLength} karakters ingevoerd).',
  14458. minLength: 'Vul minimaal {minLength} karakters in (je hebt {length} karakters ingevoerd).',
  14459. maxLength: 'Vul niet meer dan {maxLength} karakters in (je hebt {length} karakters ingevoerd).',
  14460. integer: 'Vul een getal in. Getallen met decimalen (bijvoorbeeld 1.25) zijn niet toegestaan.',
  14461. numeric: 'Vul alleen numerieke waarden in (bijvoorbeeld "1" of "1.1" of "-1" of "-1.1").',
  14462. digits: 'Vul alleen nummers en leestekens in (bijvoorbeeld een telefoonnummer met streepjes is toegestaan).',
  14463. alpha: 'Vul alleen letters in (a-z). Spaties en andere karakters zijn niet toegestaan.',
  14464. alphanum: 'Vul alleen letters (a-z) of nummers (0-9) in. Spaties en andere karakters zijn niet toegestaan.',
  14465. dateSuchAs: 'Vul een geldige datum in, zoals {date}',
  14466. dateInFormatMDY: 'Vul een geldige datum, in het formaat MM/DD/YYYY (bijvoorbeeld "12/31/1999")',
  14467. email: 'Vul een geldig e-mailadres in. Bijvoorbeeld "fred@domein.nl".',
  14468. url: 'Vul een geldige URL in, zoals http://www.example.com.',
  14469. currencyDollar: 'Vul een geldig $ bedrag in. Bijvoorbeeld $100.00 .',
  14470. oneRequired: 'Vul iets in bij in ieder geval een van deze velden.',
  14471. warningPrefix: 'Waarschuwing: ',
  14472. errorPrefix: 'Fout: ',
  14473. // Form.Validator.Extras
  14474. noSpace: 'Spaties zijn niet toegestaan in dit veld.',
  14475. reqChkByNode: 'Er zijn geen items geselecteerd.',
  14476. requiredChk: 'Dit veld is verplicht.',
  14477. reqChkByName: 'Selecteer een {label}.',
  14478. match: 'Dit veld moet overeen komen met het {matchName} veld',
  14479. startDate: 'de begin datum',
  14480. endDate: 'de eind datum',
  14481. currentDate: 'de huidige datum',
  14482. afterDate: 'De datum moet hetzelfde of na {label} zijn.',
  14483. beforeDate: 'De datum moet hetzelfde of voor {label} zijn.',
  14484. startMonth: 'Selecteer een begin maand',
  14485. sameMonth: 'Deze twee data moeten in dezelfde maand zijn - u moet een van beide aanpassen.',
  14486. creditcard: 'Het ingevulde creditcardnummer is niet geldig. Controleer het nummer en probeer opnieuw. {length} getallen ingevuld.'
  14487. });
  14488. /*
  14489. ---
  14490. name: Locale.nl-NL.Number
  14491. description: Number messages for Dutch.
  14492. license: MIT-style license
  14493. authors:
  14494. - Arian Stolwijk
  14495. requires:
  14496. - Locale
  14497. - Locale.EU.Number
  14498. provides: [Locale.nl-NL.Number]
  14499. ...
  14500. */
  14501. Locale.define('nl-NL').inherit('EU', 'Number');
  14502. /*
  14503. ---
  14504. name: Locale.no-NO.Date
  14505. description: Date messages for Norwegian.
  14506. license: MIT-style license
  14507. authors:
  14508. - Espen 'Rexxars' Hovlandsdal
  14509. - Ole Tøsse Kolvik
  14510. requires:
  14511. - Locale
  14512. provides: [Locale.no-NO.Date]
  14513. ...
  14514. */
  14515. Locale.define('no-NO', 'Date', {
  14516. months: ['Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'],
  14517. months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
  14518. days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
  14519. days_abbr: ['Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'],
  14520. // Culture's date order: DD.MM.YYYY
  14521. dateOrder: ['date', 'month', 'year'],
  14522. shortDate: '%d.%m.%Y',
  14523. shortTime: '%H:%M',
  14524. AM: 'AM',
  14525. PM: 'PM',
  14526. firstDayOfWeek: 1,
  14527. lessThanMinuteAgo: 'mindre enn et minutt siden',
  14528. minuteAgo: 'omtrent et minutt siden',
  14529. minutesAgo: '{delta} minutter siden',
  14530. hourAgo: 'omtrent en time siden',
  14531. hoursAgo: 'omtrent {delta} timer siden',
  14532. dayAgo: '{delta} dag siden',
  14533. daysAgo: '{delta} dager siden',
  14534. weekAgo: 'en uke siden',
  14535. weeksAgo: '{delta} uker siden',
  14536. monthAgo: 'en måned siden',
  14537. monthsAgo: '{delta} måneder siden',
  14538. yearAgo: 'ett år siden',
  14539. yearsAgo: '{delta} år siden',
  14540. lessThanMinuteUntil: 'mindre enn et minutt til',
  14541. minuteUntil: 'omtrent et minutt til',
  14542. minutesUntil: '{delta} minutter til',
  14543. hourUntil: 'omtrent en time til',
  14544. hoursUntil: 'omtrent {delta} timer til',
  14545. dayUntil: 'en dag til',
  14546. daysUntil: '{delta} dager til',
  14547. weekUntil: 'en uke til',
  14548. weeksUntil: '{delta} uker til',
  14549. monthUntil: 'en måned til',
  14550. monthsUntil: '{delta} måneder til',
  14551. yearUntil: 'et år til',
  14552. yearsUntil: '{delta} år til'
  14553. });
  14554. /*
  14555. ---
  14556. name: Locale.no-NO.Form.Validator
  14557. description: Form Validator messages for Norwegian.
  14558. license: MIT-style license
  14559. authors:
  14560. - Aaron Newton
  14561. - Espen 'Rexxars' Hovlandsdal
  14562. - Ole Tøsse Kolvik
  14563. requires:
  14564. - Locale
  14565. provides: [Locale.no-NO.Form.Validator]
  14566. ...
  14567. */
  14568. Locale.define('no-NO', 'FormValidator', {
  14569. required: 'Dette feltet er påkrevd.',
  14570. length: 'Skriv inn {length} tegn (du skrev {elLength} tegn)',
  14571. minLength: 'Skriv inn minst {minLength} tegn (du skrev {length} tegn).',
  14572. maxLength: 'Ikke skriv mer enn {maxLength} tegn (du skrev {length} tegn).',
  14573. integer: 'Skriv inn et tall i dette feltet. Tall med desimaler (f.eks. 1,25) er ikke tillat.',
  14574. numeric: 'Skriv kun inn numeriske verdier i dette feltet (f.eks. "1", "1.1", "-1" eller "-1.1").',
  14575. digits: 'Skriv kun nummer og skilletegn i dette feltet.',
  14576. alpha: 'Skriv kun bokstaver (a-å) i dette feltet. Ingen mellomrom eller andre tegn er tillat.',
  14577. alphanum: 'Skriv kun bokstaver (a-å) eller nummer (0-9) i dette feltet. Ingen mellomrom eller andre tegn er tillat.',
  14578. dateSuchAs: 'Skriv inn en gyldig dato, som f.eks. {date}',
  14579. dateInFormatMDY: 'Skriv inn en gyldig dato, f.eks. DD/MM/YYYY ("31/12/1999")',
  14580. email: 'Skriv inn en gyldig epost-adresse. F.eks. "ola.nordmann@example.com".',
  14581. url: 'Skriv inn en gyldig URL, f.eks. http://www.example.com.',
  14582. currencyDollar: 'Skriv inn et gyldig beløp. F.eks. 100,00.',
  14583. oneRequired: 'Minst ett av disse feltene må fylles ut.',
  14584. errorPrefix: 'Feil: ',
  14585. warningPrefix: 'Advarsel: ',
  14586. // Form.Validator.Extras
  14587. noSpace: 'Mellomrom er ikke tillatt i dette feltet.',
  14588. reqChkByNode: 'Ingen objekter er valgt.',
  14589. requiredChk: 'Dette feltet er påkrevd.',
  14590. reqChkByName: 'Velg en {label}.',
  14591. match: 'Dette feltet må være lik {matchName}',
  14592. startDate: 'startdato',
  14593. endDate: 'sluttdato',
  14594. currentDate: 'dagens dato',
  14595. afterDate: 'Datoen må være den samme som eller etter {label}.',
  14596. beforeDate: 'Datoen må være den samme som eller før {label}.',
  14597. startMonth: 'Velg en startmåned',
  14598. sameMonth: 'Datoene må være i den samme måneden - velg den ene eller den andre.',
  14599. creditcard: 'Kortnummeret du skrev inn er ikke gyldig. Prøv igjen. Du skrev {length} siffer.'
  14600. });
  14601. /*
  14602. ---
  14603. name: Locale.no-NO.Number
  14604. description: Number messages for Norwegian.
  14605. license: MIT-style license
  14606. authors:
  14607. - Arian Stolwijk
  14608. - Martin Lundgren
  14609. - Ole T�sse Kolvik
  14610. requires:
  14611. - Locale
  14612. - Locale.EU.Number
  14613. provides: [Locale.no-NO.Number]
  14614. ...
  14615. */
  14616. Locale.define('no-NO', 'Number', {
  14617. currency: {
  14618. prefix: 'NOK '
  14619. }
  14620. }).inherit('EU', 'Number');
  14621. /*
  14622. ---
  14623. name: Locale.pl-PL.Date
  14624. description: Date messages for Polish.
  14625. license: MIT-style license
  14626. authors:
  14627. - Oskar Krawczyk
  14628. requires:
  14629. - Locale
  14630. provides: [Locale.pl-PL.Date]
  14631. ...
  14632. */
  14633. Locale.define('pl-PL', 'Date', {
  14634. months: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'],
  14635. months_abbr: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
  14636. days: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],
  14637. days_abbr: ['niedz.', 'pon.', 'wt.', 'śr.', 'czw.', 'pt.', 'sob.'],
  14638. // Culture's date order: YYYY-MM-DD
  14639. dateOrder: ['year', 'month', 'date'],
  14640. shortDate: '%Y-%m-%d',
  14641. shortTime: '%H:%M',
  14642. AM: 'nad ranem',
  14643. PM: 'po południu',
  14644. firstDayOfWeek: 1,
  14645. // Date.Extras
  14646. ordinal: function(dayOfMonth){
  14647. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ty' : ['ty', 'szy', 'gi', 'ci', 'ty'][Math.min(dayOfMonth % 10, 4)];
  14648. },
  14649. lessThanMinuteAgo: 'mniej niż minute temu',
  14650. minuteAgo: 'około minutę temu',
  14651. minutesAgo: '{delta} minut temu',
  14652. hourAgo: 'około godzinę temu',
  14653. hoursAgo: 'około {delta} godzin temu',
  14654. dayAgo: 'Wczoraj',
  14655. daysAgo: '{delta} dni temu',
  14656. lessThanMinuteUntil: 'za niecałą minutę',
  14657. minuteUntil: 'za około minutę',
  14658. minutesUntil: 'za {delta} minut',
  14659. hourUntil: 'za około godzinę',
  14660. hoursUntil: 'za około {delta} godzin',
  14661. dayUntil: 'za 1 dzień',
  14662. daysUntil: 'za {delta} dni'
  14663. });
  14664. /*
  14665. ---
  14666. name: Locale.pl-PL.Form.Validator
  14667. description: Form Validator messages for Polish.
  14668. license: MIT-style license
  14669. authors:
  14670. - Oskar Krawczyk
  14671. requires:
  14672. - Locale
  14673. provides: [Locale.pl-PL.Form.Validator]
  14674. ...
  14675. */
  14676. Locale.define('pl-PL', 'FormValidator', {
  14677. required: 'To pole jest wymagane.',
  14678. minLength: 'Wymagane jest przynajmniej {minLength} znaków (wpisanych zostało tylko {length}).',
  14679. maxLength: 'Dozwolone jest nie więcej niż {maxLength} znaków (wpisanych zostało {length})',
  14680. integer: 'To pole wymaga liczb całych. Liczby dziesiętne (np. 1.25) są niedozwolone.',
  14681. numeric: 'Prosimy używać tylko numerycznych wartości w tym polu (np. "1", "1.1", "-1" lub "-1.1").',
  14682. digits: 'Prosimy używać liczb oraz zankow punktuacyjnych w typ polu (dla przykładu, przy numerze telefonu myślniki i kropki są dozwolone).',
  14683. alpha: 'Prosimy używać tylko liter (a-z) w tym polu. Spacje oraz inne znaki są niedozwolone.',
  14684. alphanum: 'Prosimy używać tylko liter (a-z) lub liczb (0-9) w tym polu. Spacje oraz inne znaki są niedozwolone.',
  14685. dateSuchAs: 'Prosimy podać prawidłową datę w formacie: {date}',
  14686. dateInFormatMDY: 'Prosimy podać poprawną date w formacie DD.MM.RRRR (i.e. "12.01.2009")',
  14687. email: 'Prosimy podać prawidłowy adres e-mail, np. "jan@domena.pl".',
  14688. url: 'Prosimy podać prawidłowy adres URL, np. http://www.example.com.',
  14689. currencyDollar: 'Prosimy podać prawidłową sumę w PLN. Dla przykładu: 100.00 PLN.',
  14690. oneRequired: 'Prosimy wypełnić chociaż jedno z pól.',
  14691. errorPrefix: 'Błąd: ',
  14692. warningPrefix: 'Uwaga: ',
  14693. // Form.Validator.Extras
  14694. noSpace: 'W tym polu nie mogą znajdować się spacje.',
  14695. reqChkByNode: 'Brak zaznaczonych elementów.',
  14696. requiredChk: 'To pole jest wymagane.',
  14697. reqChkByName: 'Prosimy wybrać z {label}.',
  14698. match: 'To pole musi być takie samo jak {matchName}',
  14699. startDate: 'data początkowa',
  14700. endDate: 'data końcowa',
  14701. currentDate: 'aktualna data',
  14702. afterDate: 'Podana data poinna być taka sama lub po {label}.',
  14703. beforeDate: 'Podana data poinna być taka sama lub przed {label}.',
  14704. startMonth: 'Prosimy wybrać początkowy miesiąc.',
  14705. sameMonth: 'Te dwie daty muszą być w zakresie tego samego miesiąca - wymagana jest zmiana któregoś z pól.'
  14706. });
  14707. /*
  14708. ---
  14709. name: Locale.pt-PT.Date
  14710. description: Date messages for Portuguese.
  14711. license: MIT-style license
  14712. authors:
  14713. - Fabio Miranda Costa
  14714. requires:
  14715. - Locale
  14716. provides: [Locale.pt-PT.Date]
  14717. ...
  14718. */
  14719. Locale.define('pt-PT', 'Date', {
  14720. months: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
  14721. months_abbr: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
  14722. days: ['Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'],
  14723. days_abbr: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
  14724. // Culture's date order: DD-MM-YYYY
  14725. dateOrder: ['date', 'month', 'year'],
  14726. shortDate: '%d-%m-%Y',
  14727. shortTime: '%H:%M',
  14728. AM: 'AM',
  14729. PM: 'PM',
  14730. firstDayOfWeek: 1,
  14731. // Date.Extras
  14732. ordinal: 'º',
  14733. lessThanMinuteAgo: 'há menos de um minuto',
  14734. minuteAgo: 'há cerca de um minuto',
  14735. minutesAgo: 'há {delta} minutos',
  14736. hourAgo: 'há cerca de uma hora',
  14737. hoursAgo: 'há cerca de {delta} horas',
  14738. dayAgo: 'há um dia',
  14739. daysAgo: 'há {delta} dias',
  14740. weekAgo: 'há uma semana',
  14741. weeksAgo: 'há {delta} semanas',
  14742. monthAgo: 'há um mês',
  14743. monthsAgo: 'há {delta} meses',
  14744. yearAgo: 'há um ano',
  14745. yearsAgo: 'há {delta} anos',
  14746. lessThanMinuteUntil: 'em menos de um minuto',
  14747. minuteUntil: 'em um minuto',
  14748. minutesUntil: 'em {delta} minutos',
  14749. hourUntil: 'em uma hora',
  14750. hoursUntil: 'em {delta} horas',
  14751. dayUntil: 'em um dia',
  14752. daysUntil: 'em {delta} dias',
  14753. weekUntil: 'em uma semana',
  14754. weeksUntil: 'em {delta} semanas',
  14755. monthUntil: 'em um mês',
  14756. monthsUntil: 'em {delta} meses',
  14757. yearUntil: 'em um ano',
  14758. yearsUntil: 'em {delta} anos'
  14759. });
  14760. /*
  14761. ---
  14762. name: Locale.pt-BR.Date
  14763. description: Date messages for Portuguese (Brazil).
  14764. license: MIT-style license
  14765. authors:
  14766. - Fabio Miranda Costa
  14767. requires:
  14768. - Locale
  14769. - Locale.pt-PT.Date
  14770. provides: [Locale.pt-BR.Date]
  14771. ...
  14772. */
  14773. Locale.define('pt-BR', 'Date', {
  14774. // Culture's date order: DD/MM/YYYY
  14775. shortDate: '%d/%m/%Y'
  14776. }).inherit('pt-PT', 'Date');
  14777. /*
  14778. ---
  14779. name: Locale.pt-BR.Form.Validator
  14780. description: Form Validator messages for Portuguese (Brazil).
  14781. license: MIT-style license
  14782. authors:
  14783. - Fábio Miranda Costa
  14784. requires:
  14785. - Locale
  14786. provides: [Locale.pt-BR.Form.Validator]
  14787. ...
  14788. */
  14789. Locale.define('pt-BR', 'FormValidator', {
  14790. required: 'Este campo é obrigatório.',
  14791. minLength: 'Digite pelo menos {minLength} caracteres (tamanho atual: {length}).',
  14792. maxLength: 'Não digite mais de {maxLength} caracteres (tamanho atual: {length}).',
  14793. integer: 'Por favor digite apenas um número inteiro neste campo. Não são permitidos números decimais (por exemplo, 1,25).',
  14794. numeric: 'Por favor digite apenas valores numéricos neste campo (por exemplo, "1" ou "1.1" ou "-1" ou "-1,1").',
  14795. 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).',
  14796. alpha: 'Por favor use somente letras (a-z). Espaço e outros caracteres não são permitidos.',
  14797. alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Espaço e outros caracteres não são permitidos.',
  14798. dateSuchAs: 'Digite uma data válida, como {date}',
  14799. dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (por exemplo, "31/12/1999")',
  14800. email: 'Digite um endereço de email válido. Por exemplo "nome@dominio.com".',
  14801. url: 'Digite uma URL válida. Exemplo: http://www.example.com.',
  14802. currencyDollar: 'Digite um valor em dinheiro válido. Exemplo: R$100,00 .',
  14803. oneRequired: 'Digite algo para pelo menos um desses campos.',
  14804. errorPrefix: 'Erro: ',
  14805. warningPrefix: 'Aviso: ',
  14806. // Form.Validator.Extras
  14807. noSpace: 'Não é possível digitar espaços neste campo.',
  14808. reqChkByNode: 'Não foi selecionado nenhum item.',
  14809. requiredChk: 'Este campo é obrigatório.',
  14810. reqChkByName: 'Por favor digite um {label}.',
  14811. match: 'Este campo deve ser igual ao campo {matchName}.',
  14812. startDate: 'a data inicial',
  14813. endDate: 'a data final',
  14814. currentDate: 'a data atual',
  14815. afterDate: 'A data deve ser igual ou posterior a {label}.',
  14816. beforeDate: 'A data deve ser igual ou anterior a {label}.',
  14817. startMonth: 'Por favor selecione uma data inicial.',
  14818. sameMonth: 'Estas duas datas devem ter o mesmo mês - você deve modificar uma das duas.',
  14819. 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.'
  14820. });
  14821. /*
  14822. ---
  14823. name: Locale.pt-BR.Number
  14824. description: Number messages for PT Brazilian.
  14825. license: MIT-style license
  14826. authors:
  14827. - Arian Stolwijk
  14828. - Danillo César
  14829. requires:
  14830. - Locale
  14831. provides: [Locale.pt-BR.Number]
  14832. ...
  14833. */
  14834. Locale.define('pt-BR', 'Number', {
  14835. decimal: ',',
  14836. group: '.',
  14837. currency: {
  14838. prefix: 'R$ '
  14839. }
  14840. });
  14841. /*
  14842. ---
  14843. name: Locale.pt-PT.Form.Validator
  14844. description: Form Validator messages for Portuguese.
  14845. license: MIT-style license
  14846. authors:
  14847. - Miquel Hudin
  14848. requires:
  14849. - Locale
  14850. provides: [Locale.pt-PT.Form.Validator]
  14851. ...
  14852. */
  14853. Locale.define('pt-PT', 'FormValidator', {
  14854. required: 'Este campo é necessário.',
  14855. minLength: 'Digite pelo menos{minLength} caracteres (comprimento {length} caracteres).',
  14856. maxLength: 'Não insira mais de {maxLength} caracteres (comprimento {length} caracteres).',
  14857. integer: 'Digite um número inteiro neste domínio. Com números decimais (por exemplo, 1,25), não são permitidas.',
  14858. numeric: 'Digite apenas valores numéricos neste domínio (p.ex., "1" ou "1.1" ou "-1" ou "-1,1").',
  14859. 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).',
  14860. alpha: 'Por favor use somente letras (a-z), com nesta área. Não utilize espaços nem outros caracteres são permitidos.',
  14861. alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Não utilize espaços nem outros caracteres são permitidos.',
  14862. dateSuchAs: 'Digite uma data válida, como {date}',
  14863. dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (p.ex. "31/12/1999")',
  14864. email: 'Digite um endereço de email válido. Por exemplo "fred@domain.com".',
  14865. url: 'Digite uma URL válida, como http://www.example.com.',
  14866. currencyDollar: 'Digite um valor válido $. Por exemplo $ 100,00. ',
  14867. oneRequired: 'Digite algo para pelo menos um desses insumos.',
  14868. errorPrefix: 'Erro: ',
  14869. warningPrefix: 'Aviso: '
  14870. });
  14871. /*
  14872. ---
  14873. name: Locale.ru-RU-unicode.Date
  14874. description: Date messages for Russian (utf-8).
  14875. license: MIT-style license
  14876. authors:
  14877. - Evstigneev Pavel
  14878. - Kuryanovich Egor
  14879. requires:
  14880. - Locale
  14881. provides: [Locale.ru-RU.Date]
  14882. ...
  14883. */
  14884. (function(){
  14885. // Russian language pluralization rules, taken from CLDR project, http://unicode.org/cldr/
  14886. // one -> n mod 10 is 1 and n mod 100 is not 11;
  14887. // few -> n mod 10 in 2..4 and n mod 100 not in 12..14;
  14888. // many -> n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14;
  14889. // other -> everything else (example 3.14)
  14890. var pluralize = function(n, one, few, many, other){
  14891. var modulo10 = n % 10,
  14892. modulo100 = n % 100;
  14893. if (modulo10 == 1 && modulo100 != 11){
  14894. return one;
  14895. } else if ((modulo10 == 2 || modulo10 == 3 || modulo10 == 4) && !(modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){
  14896. return few;
  14897. } else if (modulo10 == 0 || (modulo10 == 5 || modulo10 == 6 || modulo10 == 7 || modulo10 == 8 || modulo10 == 9) || (modulo100 == 11 || modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){
  14898. return many;
  14899. } else {
  14900. return other;
  14901. }
  14902. };
  14903. Locale.define('ru-RU', 'Date', {
  14904. months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],
  14905. months_abbr: ['янв', 'февр', 'март', 'апр', 'май','июнь','июль','авг','сент','окт','нояб','дек'],
  14906. days: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
  14907. days_abbr: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
  14908. // Culture's date order: DD.MM.YYYY
  14909. dateOrder: ['date', 'month', 'year'],
  14910. shortDate: '%d.%m.%Y',
  14911. shortTime: '%H:%M',
  14912. AM: 'AM',
  14913. PM: 'PM',
  14914. firstDayOfWeek: 1,
  14915. // Date.Extras
  14916. ordinal: '',
  14917. lessThanMinuteAgo: 'меньше минуты назад',
  14918. minuteAgo: 'минуту назад',
  14919. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'минуту', 'минуты', 'минут') + ' назад'; },
  14920. hourAgo: 'час назад',
  14921. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'час', 'часа', 'часов') + ' назад'; },
  14922. dayAgo: 'вчера',
  14923. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'день', 'дня', 'дней') + ' назад'; },
  14924. weekAgo: 'неделю назад',
  14925. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'неделя', 'недели', 'недель') + ' назад'; },
  14926. monthAgo: 'месяц назад',
  14927. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'месяц', 'месяца', 'месяцев') + ' назад'; },
  14928. yearAgo: 'год назад',
  14929. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'год', 'года', 'лет') + ' назад'; },
  14930. lessThanMinuteUntil: 'меньше чем через минуту',
  14931. minuteUntil: 'через минуту',
  14932. minutesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'минуту', 'минуты', 'минут') + ''; },
  14933. hourUntil: 'через час',
  14934. hoursUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'час', 'часа', 'часов') + ''; },
  14935. dayUntil: 'завтра',
  14936. daysUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'день', 'дня', 'дней') + ''; },
  14937. weekUntil: 'через неделю',
  14938. weeksUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'неделю', 'недели', 'недель') + ''; },
  14939. monthUntil: 'через месяц',
  14940. monthsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'месяц', 'месяца', 'месяцев') + ''; },
  14941. yearUntil: 'через',
  14942. yearsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'год', 'года', 'лет') + ''; }
  14943. });
  14944. //<1.2compat>
  14945. Locale.define('ru-RU-unicode').inherit('ru-RU', 'Date');
  14946. //</1.2compat>
  14947. })();
  14948. /*
  14949. ---
  14950. name: Locale.ru-RU-unicode.Form.Validator
  14951. description: Form Validator messages for Russian (utf-8).
  14952. license: MIT-style license
  14953. authors:
  14954. - Chernodarov Egor
  14955. requires:
  14956. - Locale
  14957. provides: [Locale.ru-RU.Form.Validator]
  14958. ...
  14959. */
  14960. Locale.define('ru-RU', 'FormValidator', {
  14961. required: 'Это поле обязательно к заполнению.',
  14962. minLength: 'Пожалуйста, введите хотя бы {minLength} символов (Вы ввели {length}).',
  14963. maxLength: 'Пожалуйста, введите не больше {maxLength} символов (Вы ввели {length}).',
  14964. integer: 'Пожалуйста, введите в это поле число. Дробные числа (например 1.25) тут не разрешены.',
  14965. numeric: 'Пожалуйста, введите в это поле число (например "1" или "1.1", или "-1", или "-1.1").',
  14966. digits: 'В этом поле Вы можете использовать только цифры и знаки пунктуации (например, телефонный номер со знаками дефиса или с точками).',
  14967. alpha: 'В этом поле можно использовать только латинские буквы (a-z). Пробелы и другие символы запрещены.',
  14968. alphanum: 'В этом поле можно использовать только латинские буквы (a-z) и цифры (0-9). Пробелы и другие символы запрещены.',
  14969. dateSuchAs: 'Пожалуйста, введите корректную дату {date}',
  14970. dateInFormatMDY: 'Пожалуйста, введите дату в формате ММ/ДД/ГГГГ (например "12/31/1999")',
  14971. email: 'Пожалуйста, введите корректный емейл-адрес. Для примера "fred@domain.com".',
  14972. url: 'Пожалуйста, введите правильную ссылку вида http://www.example.com.',
  14973. currencyDollar: 'Пожалуйста, введите сумму в долларах. Например: $100.00 .',
  14974. oneRequired: 'Пожалуйста, выберите хоть что-нибудь в одном из этих полей.',
  14975. errorPrefix: 'Ошибка: ',
  14976. warningPrefix: 'Внимание: '
  14977. });
  14978. //<1.2compat>
  14979. Locale.define('ru-RU-unicode').inherit('ru-RU', 'FormValidator');
  14980. //</1.2compat>
  14981. /*
  14982. ---
  14983. name: Locale.sk-SK.Date
  14984. description: Date messages for Slovak.
  14985. license: MIT-style license
  14986. authors:
  14987. - Ivan Masár
  14988. requires:
  14989. - Locale
  14990. provides: [Locale.sk-SK.Date]
  14991. ...
  14992. */
  14993. (function(){
  14994. // Slovak language pluralization rules, see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  14995. // one -> n is 1; 1
  14996. // few -> n in 2..4; 2-4
  14997. // other -> everything else 0, 5-999, 1.31, 2.31, 5.31...
  14998. var pluralize = function(n, one, few, other){
  14999. if (n == 1) return one;
  15000. else if (n == 2 || n == 3 || n == 4) return few;
  15001. else return other;
  15002. };
  15003. Locale.define('sk-SK', 'Date', {
  15004. months: ['Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'December'],
  15005. months_abbr: ['januára', 'februára', 'marca', 'apríla', 'mája', 'júna', 'júla', 'augusta', 'septembra', 'októbra', 'novembra', 'decembra'],
  15006. days: ['Nedele', 'Pondelí', 'Úterý', 'Streda', 'Čtvrtek', 'Pátek', 'Sobota'],
  15007. days_abbr: ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so'],
  15008. // Culture's date order: DD.MM.YYYY
  15009. dateOrder: ['date', 'month', 'year'],
  15010. shortDate: '%d.%m.%Y',
  15011. shortTime: '%H:%M',
  15012. AM: 'dop.',
  15013. PM: 'pop.',
  15014. firstDayOfWeek: 1,
  15015. // Date.Extras
  15016. ordinal: '.',
  15017. lessThanMinuteAgo: 'pred chvíľou',
  15018. minuteAgo: 'približne pred minútou',
  15019. minutesAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'minútou', 'minútami', 'minútami'); },
  15020. hourAgo: 'približne pred hodinou',
  15021. hoursAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'hodinou', 'hodinami', 'hodinami'); },
  15022. dayAgo: 'pred dňom',
  15023. daysAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'dňom', 'dňami', 'dňami'); },
  15024. weekAgo: 'pred týždňom',
  15025. weeksAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'týždňom', 'týždňami', 'týždňami'); },
  15026. monthAgo: 'pred mesiacom',
  15027. monthsAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'mesiacom', 'mesiacmi', 'mesiacmi'); },
  15028. yearAgo: 'pred rokom',
  15029. yearsAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'rokom', 'rokmi', 'rokmi'); },
  15030. lessThanMinuteUntil: 'o chvíľu',
  15031. minuteUntil: 'približne o minútu',
  15032. minutesUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'minútu', 'minúty', 'minúty'); },
  15033. hourUntil: 'približne o hodinu',
  15034. hoursUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'hodinu', 'hodiny', 'hodín'); },
  15035. dayUntil: 'o deň',
  15036. daysUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'deň', 'dni', 'dní'); },
  15037. weekUntil: 'o týždeň',
  15038. weeksUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'týždeň', 'týždne', 'týždňov'); },
  15039. monthUntil: 'o mesiac',
  15040. monthsUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'mesiac', 'mesiace', 'mesiacov'); },
  15041. yearUntil: 'o rok',
  15042. yearsUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'rok', 'roky', 'rokov'); }
  15043. });
  15044. })();
  15045. /*
  15046. ---
  15047. name: Locale.sk-SK.Form.Validator
  15048. description: Form Validator messages for Czech.
  15049. license: MIT-style license
  15050. authors:
  15051. - Ivan Masár
  15052. requires:
  15053. - Locale
  15054. provides: [Locale.sk-SK.Form.Validator]
  15055. ...
  15056. */
  15057. Locale.define('sk-SK', 'FormValidator', {
  15058. required: 'Táto položka je povinná.',
  15059. minLength: 'Zadajte prosím aspoň {minLength} znakov (momentálne {length} znakov).',
  15060. maxLength: 'Zadajte prosím menej ako {maxLength} znakov (momentálne {length} znakov).',
  15061. integer: 'Zadajte prosím celé číslo. Desetinné čísla (napr. 1.25) nie sú povolené.',
  15062. numeric: 'Zadajte len číselné hodnoty (t.j. „1“ alebo „1.1“ alebo „-1“ alebo „-1.1“).',
  15063. digits: 'Zadajte prosím len čísla a interpunkčné znamienka (napríklad telefónne číslo s pomlčkami albo bodkami je povolené).',
  15064. alpha: 'Zadajte prosím len písmená (a-z). Medzery alebo iné znaky nie sú povolené.',
  15065. alphanum: 'Zadajte prosím len písmená (a-z) alebo číslice (0-9). Medzery alebo iné znaky nie sú povolené.',
  15066. dateSuchAs: 'Zadajte prosím platný dátum v tvare {date}',
  15067. dateInFormatMDY: 'Zadajte prosím platný datum v tvare MM / DD / RRRR (t.j. „12/31/1999“)',
  15068. email: 'Zadajte prosím platnú emailovú adresu. Napríklad „fred@domain.com“.',
  15069. url: 'Zadajte prosím platnoú adresu URL v tvare http://www.example.com.',
  15070. currencyDollar: 'Zadajte prosím platnú čiastku. Napríklad $100.00.',
  15071. oneRequired: 'Zadajte prosím aspoň jednu hodnotu z týchto položiek.',
  15072. errorPrefix: 'Chyba: ',
  15073. warningPrefix: 'Upozornenie: ',
  15074. // Form.Validator.Extras
  15075. noSpace: 'V tejto položle nie sú povolené medzery',
  15076. reqChkByNode: 'Nie sú vybrané žiadne položky.',
  15077. requiredChk: 'Táto položka je povinná.',
  15078. reqChkByName: 'Prosím vyberte {label}.',
  15079. match: 'Táto položka sa musí zhodovať s položkou {matchName}',
  15080. startDate: 'dátum začiatku',
  15081. endDate: 'dátum ukončenia',
  15082. currendDate: 'aktuálny dátum',
  15083. afterDate: 'Dátum by mal býť rovnaký alebo väčší ako {label}.',
  15084. beforeDate: 'Dátum by mal byť rovnaký alebo menší ako {label}.',
  15085. startMonth: 'Vyberte počiatočný mesiac.',
  15086. sameMonth: 'Tieto dva dátumy musia býť v rovnakom mesiaci - zmeňte jeden z nich.',
  15087. creditcard: 'Zadané číslo kreditnej karty je neplatné. Prosím, opravte ho. Bolo zadaných {length} číslic.'
  15088. });
  15089. /*
  15090. ---
  15091. name: Locale.si-SI.Date
  15092. description: Date messages for Slovenian.
  15093. license: MIT-style license
  15094. authors:
  15095. - Radovan Lozej
  15096. requires:
  15097. - Locale
  15098. provides: [Locale.si-SI.Date]
  15099. ...
  15100. */
  15101. (function(){
  15102. var pluralize = function(n, one, two, three, other){
  15103. return (n >= 1 && n <= 3) ? arguments[n] : other;
  15104. };
  15105. Locale.define('sl-SI', 'Date', {
  15106. months: ['januar', 'februar', 'marec', 'april', 'maj', 'junij', 'julij', 'avgust', 'september', 'oktober', 'november', 'december'],
  15107. months_abbr: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'avg', 'sep', 'okt', 'nov', 'dec'],
  15108. days: ['nedelja', 'ponedeljek', 'torek', 'sreda', 'četrtek', 'petek', 'sobota'],
  15109. days_abbr: ['ned', 'pon', 'tor', 'sre', 'čet', 'pet', 'sob'],
  15110. // Culture's date order: DD.MM.YYYY
  15111. dateOrder: ['date', 'month', 'year'],
  15112. shortDate: '%d.%m.%Y',
  15113. shortTime: '%H.%M',
  15114. AM: 'AM',
  15115. PM: 'PM',
  15116. firstDayOfWeek: 1,
  15117. // Date.Extras
  15118. ordinal: '.',
  15119. lessThanMinuteAgo: 'manj kot minuto nazaj',
  15120. minuteAgo: 'minuto nazaj',
  15121. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'minuto', 'minuti', 'minute', 'minut') + ' nazaj'; },
  15122. hourAgo: 'uro nazaj',
  15123. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'uro', 'uri', 'ure', 'ur') + ' nazaj'; },
  15124. dayAgo: 'dan nazaj',
  15125. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'dan', 'dneva', 'dni', 'dni') + ' nazaj'; },
  15126. weekAgo: 'teden nazaj',
  15127. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'teden', 'tedna', 'tedne', 'tednov') + ' nazaj'; },
  15128. monthAgo: 'mesec nazaj',
  15129. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'mesec', 'meseca', 'mesece', 'mesecov') + ' nazaj'; },
  15130. yearthAgo: 'leto nazaj',
  15131. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'leto', 'leti', 'leta', 'let') + ' nazaj'; },
  15132. lessThanMinuteUntil: 'še manj kot minuto',
  15133. minuteUntil: 'še minuta',
  15134. minutesUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'minuta', 'minuti', 'minute', 'minut'); },
  15135. hourUntil: 'še ura',
  15136. hoursUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'ura', 'uri', 'ure', 'ur'); },
  15137. dayUntil: 'še dan',
  15138. daysUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'dan', 'dneva', 'dnevi', 'dni'); },
  15139. weekUntil: 'še tedn',
  15140. weeksUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'teden', 'tedna', 'tedni', 'tednov'); },
  15141. monthUntil: 'še mesec',
  15142. monthsUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'mesec', 'meseca', 'meseci', 'mesecov'); },
  15143. yearUntil: 'še leto',
  15144. yearsUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'leto', 'leti', 'leta', 'let'); }
  15145. });
  15146. })();
  15147. /*
  15148. ---
  15149. name: Locale.si-SI.Form.Validator
  15150. description: Form Validator messages for Slovenian.
  15151. license: MIT-style license
  15152. authors:
  15153. - Radovan Lozej
  15154. requires:
  15155. - Locale
  15156. provides: [Locale.si-SI.Form.Validator]
  15157. ...
  15158. */
  15159. Locale.define('sl-SI', 'FormValidator', {
  15160. required: 'To polje je obvezno',
  15161. minLength: 'Prosim, vnesite vsaj {minLength} znakov (vnesli ste {length} znakov).',
  15162. maxLength: 'Prosim, ne vnesite več kot {maxLength} znakov (vnesli ste {length} znakov).',
  15163. integer: 'Prosim, vnesite celo število. Decimalna števila (kot 1,25) niso dovoljena.',
  15164. numeric: 'Prosim, vnesite samo numerične vrednosti (kot "1" ali "1.1" ali "-1" ali "-1.1").',
  15165. digits: 'Prosim, uporabite številke in ločila le na tem polju (na primer, dovoljena je telefonska številka z pomišlaji ali pikami).',
  15166. alpha: 'Prosim, uporabite le črke v tem plju. Presledki in drugi znaki niso dovoljeni.',
  15167. alphanum: 'Prosim, uporabite samo črke ali številke v tem polju. Presledki in drugi znaki niso dovoljeni.',
  15168. dateSuchAs: 'Prosim, vnesite pravilen datum kot {date}',
  15169. dateInFormatMDY: 'Prosim, vnesite pravilen datum kot MM.DD.YYYY (primer "12.31.1999")',
  15170. email: 'Prosim, vnesite pravilen email naslov. Na primer "fred@domain.com".',
  15171. url: 'Prosim, vnesite pravilen URL kot http://www.example.com.',
  15172. currencyDollar: 'Prosim, vnesit epravilno vrednost €. Primer 100,00€ .',
  15173. oneRequired: 'Prosimo, vnesite nekaj za vsaj eno izmed teh polj.',
  15174. errorPrefix: 'Napaka: ',
  15175. warningPrefix: 'Opozorilo: ',
  15176. // Form.Validator.Extras
  15177. noSpace: 'To vnosno polje ne dopušča presledkov.',
  15178. reqChkByNode: 'Nič niste izbrali.',
  15179. requiredChk: 'To polje je obvezno',
  15180. reqChkByName: 'Prosim, izberite {label}.',
  15181. match: 'To polje se mora ujemati z poljem {matchName}',
  15182. startDate: 'datum začetka',
  15183. endDate: 'datum konca',
  15184. currentDate: 'trenuten datum',
  15185. afterDate: 'Datum bi moral biti isti ali po {label}.',
  15186. beforeDate: 'Datum bi moral biti isti ali pred {label}.',
  15187. startMonth: 'Prosim, vnesite začetni datum',
  15188. sameMonth: 'Ta dva datuma morata biti v istem mesecu - premeniti morate eno ali drugo.',
  15189. creditcard: 'Številka kreditne kartice ni pravilna. Preverite številko ali poskusite še enkrat. Vnešenih {length} znakov.'
  15190. });
  15191. /*
  15192. ---
  15193. name: Locale.sv-SE.Date
  15194. description: Date messages for Swedish.
  15195. license: MIT-style license
  15196. authors:
  15197. - Martin Lundgren
  15198. requires:
  15199. - Locale
  15200. provides: [Locale.sv-SE.Date]
  15201. ...
  15202. */
  15203. Locale.define('sv-SE', 'Date', {
  15204. months: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'],
  15205. months_abbr: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
  15206. days: ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'],
  15207. days_abbr: ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör'],
  15208. // Culture's date order: YYYY-MM-DD
  15209. dateOrder: ['year', 'month', 'date'],
  15210. shortDate: '%Y-%m-%d',
  15211. shortTime: '%H:%M',
  15212. AM: '',
  15213. PM: '',
  15214. firstDayOfWeek: 1,
  15215. // Date.Extras
  15216. ordinal: '',
  15217. lessThanMinuteAgo: 'mindre än en minut sedan',
  15218. minuteAgo: 'ungefär en minut sedan',
  15219. minutesAgo: '{delta} minuter sedan',
  15220. hourAgo: 'ungefär en timme sedan',
  15221. hoursAgo: 'ungefär {delta} timmar sedan',
  15222. dayAgo: '1 dag sedan',
  15223. daysAgo: '{delta} dagar sedan',
  15224. lessThanMinuteUntil: 'mindre än en minut sedan',
  15225. minuteUntil: 'ungefär en minut sedan',
  15226. minutesUntil: '{delta} minuter sedan',
  15227. hourUntil: 'ungefär en timme sedan',
  15228. hoursUntil: 'ungefär {delta} timmar sedan',
  15229. dayUntil: '1 dag sedan',
  15230. daysUntil: '{delta} dagar sedan'
  15231. });
  15232. /*
  15233. ---
  15234. name: Locale.sv-SE.Form.Validator
  15235. description: Form Validator messages for Swedish.
  15236. license: MIT-style license
  15237. authors:
  15238. - Martin Lundgren
  15239. requires:
  15240. - Locale
  15241. provides: [Locale.sv-SE.Form.Validator]
  15242. ...
  15243. */
  15244. Locale.define('sv-SE', 'FormValidator', {
  15245. required: 'Fältet är obligatoriskt.',
  15246. minLength: 'Ange minst {minLength} tecken (du angav {length} tecken).',
  15247. maxLength: 'Ange högst {maxLength} tecken (du angav {length} tecken). ',
  15248. integer: 'Ange ett heltal i fältet. Tal med decimaler (t.ex. 1,25) är inte tillåtna.',
  15249. numeric: 'Ange endast numeriska värden i detta fält (t.ex. "1" eller "1.1" eller "-1" eller "-1,1").',
  15250. digits: 'Använd endast siffror och skiljetecken i detta fält (till exempel ett telefonnummer med bindestreck tillåtet).',
  15251. alpha: 'Använd endast bokstäver (a-ö) i detta fält. Inga mellanslag eller andra tecken är tillåtna.',
  15252. alphanum: 'Använd endast bokstäver (a-ö) och siffror (0-9) i detta fält. Inga mellanslag eller andra tecken är tillåtna.',
  15253. dateSuchAs: 'Ange ett giltigt datum som t.ex. {date}',
  15254. dateInFormatMDY: 'Ange ett giltigt datum som t.ex. YYYY-MM-DD (i.e. "1999-12-31")',
  15255. email: 'Ange en giltig e-postadress. Till exempel "erik@domain.com".',
  15256. url: 'Ange en giltig webbadress som http://www.example.com.',
  15257. currencyDollar: 'Ange en giltig belopp. Exempelvis 100,00.',
  15258. oneRequired: 'Vänligen ange minst ett av dessa alternativ.',
  15259. errorPrefix: 'Fel: ',
  15260. warningPrefix: 'Varning: ',
  15261. // Form.Validator.Extras
  15262. noSpace: 'Det får inte finnas några mellanslag i detta fält.',
  15263. reqChkByNode: 'Inga objekt är valda.',
  15264. requiredChk: 'Detta är ett obligatoriskt fält.',
  15265. reqChkByName: 'Välj en {label}.',
  15266. match: 'Detta fält måste matcha {matchName}',
  15267. startDate: 'startdatumet',
  15268. endDate: 'slutdatum',
  15269. currentDate: 'dagens datum',
  15270. afterDate: 'Datumet bör vara samma eller senare än {label}.',
  15271. beforeDate: 'Datumet bör vara samma eller tidigare än {label}.',
  15272. startMonth: 'Välj en start månad',
  15273. sameMonth: 'Dessa två datum måste vara i samma månad - du måste ändra det ena eller det andra.'
  15274. });
  15275. /*
  15276. ---
  15277. name: Locale.sv-SE.Number
  15278. description: Number messages for Swedish.
  15279. license: MIT-style license
  15280. authors:
  15281. - Arian Stolwijk
  15282. - Martin Lundgren
  15283. requires:
  15284. - Locale
  15285. - Locale.EU.Number
  15286. provides: [Locale.sv-SE.Number]
  15287. ...
  15288. */
  15289. Locale.define('sv-SE', 'Number', {
  15290. currency: {
  15291. prefix: 'SEK '
  15292. }
  15293. }).inherit('EU', 'Number');
  15294. /*
  15295. ---
  15296. name: Locale.tr-TR.Date
  15297. description: Date messages for Turkish.
  15298. license: MIT-style license
  15299. authors:
  15300. - Faruk Can Bilir
  15301. requires:
  15302. - Locale
  15303. provides: [Locale.tr-TR.Date]
  15304. ...
  15305. */
  15306. Locale.define('tr-TR', 'Date', {
  15307. months: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
  15308. months_abbr: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
  15309. days: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],
  15310. days_abbr: ['Pa', 'Pzt', 'Sa', 'Ça', 'Pe', 'Cu', 'Cmt'],
  15311. // Culture's date order: MM/DD/YYYY
  15312. dateOrder: ['date', 'month', 'year'],
  15313. shortDate: '%d/%m/%Y',
  15314. shortTime: '%H.%M',
  15315. AM: 'AM',
  15316. PM: 'PM',
  15317. firstDayOfWeek: 1,
  15318. // Date.Extras
  15319. ordinal: '',
  15320. lessThanMinuteAgo: 'bir dakikadan önce',
  15321. minuteAgo: 'yaklaşık bir dakika önce',
  15322. minutesAgo: '{delta} dakika önce',
  15323. hourAgo: 'bir saat kadar önce',
  15324. hoursAgo: '{delta} saat kadar önce',
  15325. dayAgo: 'bir gün önce',
  15326. daysAgo: '{delta} gün önce',
  15327. weekAgo: 'bir hafta önce',
  15328. weeksAgo: '{delta} hafta önce',
  15329. monthAgo: 'bir ay önce',
  15330. monthsAgo: '{delta} ay önce',
  15331. yearAgo: 'bir yıl önce',
  15332. yearsAgo: '{delta} yıl önce',
  15333. lessThanMinuteUntil: 'bir dakikadan az sonra',
  15334. minuteUntil: 'bir dakika kadar sonra',
  15335. minutesUntil: '{delta} dakika sonra',
  15336. hourUntil: 'bir saat kadar sonra',
  15337. hoursUntil: '{delta} saat kadar sonra',
  15338. dayUntil: 'bir gün sonra',
  15339. daysUntil: '{delta} gün sonra',
  15340. weekUntil: 'bir hafta sonra',
  15341. weeksUntil: '{delta} hafta sonra',
  15342. monthUntil: 'bir ay sonra',
  15343. monthsUntil: '{delta} ay sonra',
  15344. yearUntil: 'bir yıl sonra',
  15345. yearsUntil: '{delta} yıl sonra'
  15346. });
  15347. /*
  15348. ---
  15349. name: Locale.tr-TR.Form.Validator
  15350. description: Form Validator messages for Turkish.
  15351. license: MIT-style license
  15352. authors:
  15353. - Faruk Can Bilir
  15354. requires:
  15355. - Locale
  15356. provides: [Locale.tr-TR.Form.Validator]
  15357. ...
  15358. */
  15359. Locale.define('tr-TR', 'FormValidator', {
  15360. required: 'Bu alan zorunlu.',
  15361. minLength: 'Lütfen en az {minLength} karakter girin (siz {length} karakter girdiniz).',
  15362. maxLength: 'Lütfen en fazla {maxLength} karakter girin (siz {length} karakter girdiniz).',
  15363. integer: 'Lütfen bu alana sadece tamsayı girin. Ondalıklı sayılar (ör: 1.25) kullanılamaz.',
  15364. numeric: 'Lütfen bu alana sadece sayısal değer girin (ör: "1", "1.1", "-1" ya da "-1.1").',
  15365. 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).',
  15366. alpha: 'Lütfen bu alanda yalnızca harf kullanın. Boşluk ve diğer karakterler kullanılamaz.',
  15367. alphanum: 'Lütfen bu alanda sadece harf ve rakam kullanın. Boşluk ve diğer karakterler kullanılamaz.',
  15368. dateSuchAs: 'Lütfen geçerli bir tarih girin (Ör: {date})',
  15369. dateInFormatMDY: 'Lütfen geçerli bir tarih girin (GG/AA/YYYY, ör: "31/12/1999")',
  15370. email: 'Lütfen geçerli bir email adresi girin. Ör: "kemal@etikan.com".',
  15371. url: 'Lütfen geçerli bir URL girin. Ör: http://www.example.com.',
  15372. currencyDollar: 'Lütfen geçerli bir TL miktarı girin. Ör: 100,00 TL .',
  15373. oneRequired: 'Lütfen en az bir tanesini doldurun.',
  15374. errorPrefix: 'Hata: ',
  15375. warningPrefix: 'Uyarı: ',
  15376. // Form.Validator.Extras
  15377. noSpace: 'Bu alanda boşluk kullanılamaz.',
  15378. reqChkByNode: 'Hiçbir öğe seçilmemiş.',
  15379. requiredChk: 'Bu alan zorunlu.',
  15380. reqChkByName: 'Lütfen bir {label} girin.',
  15381. match: 'Bu alan, {matchName} alanıyla uyuşmalı',
  15382. startDate: 'başlangıç tarihi',
  15383. endDate: 'bitiş tarihi',
  15384. currentDate: 'bugünün tarihi',
  15385. afterDate: 'Tarih, {label} tarihiyle aynı gün ya da ondan sonra olmalıdır.',
  15386. beforeDate: 'Tarih, {label} tarihiyle aynı gün ya da ondan önce olmalıdır.',
  15387. startMonth: 'Lütfen bir başlangıç ayı seçin',
  15388. sameMonth: 'Bu iki tarih aynı ayda olmalı - bir tanesini değiştirmeniz gerekiyor.',
  15389. creditcard: 'Girdiğiniz kredi kartı numarası geçersiz. Lütfen kontrol edip tekrar deneyin. {length} hane girildi.'
  15390. });
  15391. /*
  15392. ---
  15393. name: Locale.tr-TR.Number
  15394. description: Number messages for Turkish.
  15395. license: MIT-style license
  15396. authors:
  15397. - Faruk Can Bilir
  15398. requires:
  15399. - Locale
  15400. - Locale.EU.Number
  15401. provides: [Locale.tr-TR.Number]
  15402. ...
  15403. */
  15404. Locale.define('tr-TR', 'Number', {
  15405. currency: {
  15406. decimals: 0,
  15407. suffix: ' TL'
  15408. }
  15409. }).inherit('EU', 'Number');
  15410. /*
  15411. ---
  15412. name: Locale.uk-UA.Date
  15413. description: Date messages for Ukrainian (utf-8).
  15414. license: MIT-style license
  15415. authors:
  15416. - Slik
  15417. requires:
  15418. - Locale
  15419. provides: [Locale.uk-UA.Date]
  15420. ...
  15421. */
  15422. (function(){
  15423. var pluralize = function(n, one, few, many, other){
  15424. var d = (n / 10).toInt(),
  15425. z = n % 10,
  15426. s = (n / 100).toInt();
  15427. if (d == 1 && n > 10) return many;
  15428. if (z == 1) return one;
  15429. if (z > 0 && z < 5) return few;
  15430. return many;
  15431. };
  15432. Locale.define('uk-UA', 'Date', {
  15433. months: ['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'],
  15434. months_abbr: ['Січ', 'Лют', 'Бер', 'Квіт', 'Трав', 'Черв', 'Лип', 'Серп', 'Вер', 'Жовт', 'Лист', 'Груд' ],
  15435. days: ['Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', "П'ятниця", 'Субота'],
  15436. days_abbr: ['Нд', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
  15437. // Culture's date order: DD/MM/YYYY
  15438. dateOrder: ['date', 'month', 'year'],
  15439. shortDate: '%d/%m/%Y',
  15440. shortTime: '%H:%M',
  15441. AM: 'до полудня',
  15442. PM: 'по полудню',
  15443. firstDayOfWeek: 1,
  15444. // Date.Extras
  15445. ordinal: '',
  15446. lessThanMinuteAgo: 'меньше хвилини тому',
  15447. minuteAgo: 'хвилину тому',
  15448. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'хвилину', 'хвилини', 'хвилин') + ' тому'; },
  15449. hourAgo: 'годину тому',
  15450. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'годину', 'години', 'годин') + ' тому'; },
  15451. dayAgo: 'вчора',
  15452. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'день', 'дня', 'днів') + ' тому'; },
  15453. weekAgo: 'тиждень тому',
  15454. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'тиждень', 'тижні', 'тижнів') + ' тому'; },
  15455. monthAgo: 'місяць тому',
  15456. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'місяць', 'місяці', 'місяців') + ' тому'; },
  15457. yearAgo: 'рік тому',
  15458. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'рік', 'роки', 'років') + ' тому'; },
  15459. lessThanMinuteUntil: 'за мить',
  15460. minuteUntil: 'через хвилину',
  15461. minutesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'хвилину', 'хвилини', 'хвилин'); },
  15462. hourUntil: 'через годину',
  15463. hoursUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'годину', 'години', 'годин'); },
  15464. dayUntil: 'завтра',
  15465. daysUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'день', 'дня', 'днів'); },
  15466. weekUntil: 'через тиждень',
  15467. weeksUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'тиждень', 'тижні', 'тижнів'); },
  15468. monthUntil: 'через місяць',
  15469. monthesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'місяць', 'місяці', 'місяців'); },
  15470. yearUntil: 'через рік',
  15471. yearsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'рік', 'роки', 'років'); }
  15472. });
  15473. })();
  15474. /*
  15475. ---
  15476. name: Locale.uk-UA.Form.Validator
  15477. description: Form Validator messages for Ukrainian (utf-8).
  15478. license: MIT-style license
  15479. authors:
  15480. - Slik
  15481. requires:
  15482. - Locale
  15483. provides: [Locale.uk-UA.Form.Validator]
  15484. ...
  15485. */
  15486. Locale.define('uk-UA', 'FormValidator', {
  15487. required: 'Це поле повинне бути заповненим.',
  15488. minLength: 'Введіть хоча б {minLength} символів (Ви ввели {length}).',
  15489. maxLength: 'Кількість символів не може бути більше {maxLength} (Ви ввели {length}).',
  15490. integer: 'Введіть в це поле число. Дробові числа (наприклад 1.25) не дозволені.',
  15491. numeric: 'Введіть в це поле число (наприклад "1" або "1.1", або "-1", або "-1.1").',
  15492. digits: 'В цьому полі ви можете використовувати лише цифри і знаки пунктіації (наприклад, телефонний номер з знаками дефізу або з крапками).',
  15493. alpha: 'В цьому полі можна використовувати лише латинські літери (a-z). Пробіли і інші символи заборонені.',
  15494. alphanum: 'В цьому полі можна використовувати лише латинські літери (a-z) і цифри (0-9). Пробіли і інші символи заборонені.',
  15495. dateSuchAs: 'Введіть коректну дату {date}.',
  15496. dateInFormatMDY: 'Введіть дату в форматі ММ/ДД/РРРР (наприклад "12/31/2009").',
  15497. email: 'Введіть коректну адресу електронної пошти (наприклад "name@domain.com").',
  15498. url: 'Введіть коректне інтернет-посилання (наприклад http://www.example.com).',
  15499. currencyDollar: 'Введіть суму в доларах (наприклад "$100.00").',
  15500. oneRequired: 'Заповніть одне з полів.',
  15501. errorPrefix: 'Помилка: ',
  15502. warningPrefix: 'Увага: ',
  15503. noSpace: 'Пробіли заборонені.',
  15504. reqChkByNode: 'Не відмічено жодного варіанту.',
  15505. requiredChk: 'Це поле повинне бути віміченим.',
  15506. reqChkByName: 'Будь ласка, відмітьте {label}.',
  15507. match: 'Це поле повинно відповідати {matchName}',
  15508. startDate: 'початкова дата',
  15509. endDate: 'кінцева дата',
  15510. currentDate: 'сьогоднішня дата',
  15511. afterDate: 'Ця дата повинна бути такою ж, або пізнішою за {label}.',
  15512. beforeDate: 'Ця дата повинна бути такою ж, або ранішою за {label}.',
  15513. startMonth: 'Будь ласка, виберіть початковий місяць',
  15514. sameMonth: 'Ці дати повинні відноситись одного і того ж місяця. Будь ласка, змініть одну з них.',
  15515. creditcard: 'Номер кредитної карти введений неправильно. Будь ласка, перевірте його. Введено {length} символів.'
  15516. });
  15517. /*
  15518. ---
  15519. name: Locale.zh-CH.Date
  15520. description: Date messages for Chinese (simplified and traditional).
  15521. license: MIT-style license
  15522. authors:
  15523. - YMind Chan
  15524. requires:
  15525. - Locale
  15526. provides: [Locale.zh-CH.Date]
  15527. ...
  15528. */
  15529. // Simplified Chinese
  15530. Locale.define('zh-CHS', 'Date', {
  15531. months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  15532. months_abbr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  15533. days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  15534. days_abbr: ['日', '一', '二', '三', '四', '五', '六'],
  15535. // Culture's date order: YYYY-MM-DD
  15536. dateOrder: ['year', 'month', 'date'],
  15537. shortDate: '%Y-%m-%d',
  15538. shortTime: '%I:%M%p',
  15539. AM: 'AM',
  15540. PM: 'PM',
  15541. firstDayOfWeek: 1,
  15542. // Date.Extras
  15543. ordinal: '',
  15544. lessThanMinuteAgo: '不到1分钟前',
  15545. minuteAgo: '大约1分钟前',
  15546. minutesAgo: '{delta}分钟之前',
  15547. hourAgo: '大约1小时前',
  15548. hoursAgo: '大约{delta}小时前',
  15549. dayAgo: '1天前',
  15550. daysAgo: '{delta}天前',
  15551. weekAgo: '1星期前',
  15552. weeksAgo: '{delta}星期前',
  15553. monthAgo: '1个月前',
  15554. monthsAgo: '{delta}个月前',
  15555. yearAgo: '1年前',
  15556. yearsAgo: '{delta}年前',
  15557. lessThanMinuteUntil: '从现在开始不到1分钟',
  15558. minuteUntil: '从现在开始約1分钟',
  15559. minutesUntil: '从现在开始约{delta}分钟',
  15560. hourUntil: '从现在开始1小时',
  15561. hoursUntil: '从现在开始约{delta}小时',
  15562. dayUntil: '从现在开始1天',
  15563. daysUntil: '从现在开始{delta}天',
  15564. weekUntil: '从现在开始1星期',
  15565. weeksUntil: '从现在开始{delta}星期',
  15566. monthUntil: '从现在开始一个月',
  15567. monthsUntil: '从现在开始{delta}个月',
  15568. yearUntil: '从现在开始1年',
  15569. yearsUntil: '从现在开始{delta}年'
  15570. });
  15571. // Traditional Chinese
  15572. Locale.define('zh-CHT', 'Date', {
  15573. months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  15574. months_abbr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  15575. days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  15576. days_abbr: ['日', '一', '二', '三', '四', '五', '六'],
  15577. // Culture's date order: YYYY-MM-DD
  15578. dateOrder: ['year', 'month', 'date'],
  15579. shortDate: '%Y-%m-%d',
  15580. shortTime: '%I:%M%p',
  15581. AM: 'AM',
  15582. PM: 'PM',
  15583. firstDayOfWeek: 1,
  15584. // Date.Extras
  15585. ordinal: '',
  15586. lessThanMinuteAgo: '不到1分鐘前',
  15587. minuteAgo: '大約1分鐘前',
  15588. minutesAgo: '{delta}分鐘之前',
  15589. hourAgo: '大約1小時前',
  15590. hoursAgo: '大約{delta}小時前',
  15591. dayAgo: '1天前',
  15592. daysAgo: '{delta}天前',
  15593. weekAgo: '1星期前',
  15594. weeksAgo: '{delta}星期前',
  15595. monthAgo: '1个月前',
  15596. monthsAgo: '{delta}个月前',
  15597. yearAgo: '1年前',
  15598. yearsAgo: '{delta}年前',
  15599. lessThanMinuteUntil: '從現在開始不到1分鐘',
  15600. minuteUntil: '從現在開始約1分鐘',
  15601. minutesUntil: '從現在開始約{delta}分鐘',
  15602. hourUntil: '從現在開始1小時',
  15603. hoursUntil: '從現在開始約{delta}小時',
  15604. dayUntil: '從現在開始1天',
  15605. daysUntil: '從現在開始{delta}天',
  15606. weekUntil: '從現在開始1星期',
  15607. weeksUntil: '從現在開始{delta}星期',
  15608. monthUntil: '從現在開始一個月',
  15609. monthsUntil: '從現在開始{delta}個月',
  15610. yearUntil: '從現在開始1年',
  15611. yearsUntil: '從現在開始{delta}年'
  15612. });
  15613. /*
  15614. ---
  15615. name: Locale.zh-CH.Form.Validator
  15616. description: Form Validator messages for Chinese (simplified and traditional).
  15617. license: MIT-style license
  15618. authors:
  15619. - YMind Chan
  15620. requires:
  15621. - Locale
  15622. - Form.Validator
  15623. provides: [Form.zh-CH.Form.Validator, Form.Validator.CurrencyYuanValidator]
  15624. ...
  15625. */
  15626. // Simplified Chinese
  15627. Locale.define('zh-CHS', 'FormValidator', {
  15628. required: '此项必填。',
  15629. minLength: '请至少输入 {minLength} 个字符 (已输入 {length} 个)。',
  15630. maxLength: '最多只能输入 {maxLength} 个字符 (已输入 {length} 个)。',
  15631. integer: '请输入一个整数,不能包含小数点。例如:"1", "200"。',
  15632. numeric: '请输入一个数字,例如:"1", "1.1", "-1", "-1.1"。',
  15633. digits: '请输入由数字和标点符号组成的内容。例如电话号码。',
  15634. alpha: '请输入 A-Z 的 26 个字母,不能包含空格或任何其他字符。',
  15635. alphanum: '请输入 A-Z 的 26 个字母或 0-9 的 10 个数字,不能包含空格或任何其他字符。',
  15636. dateSuchAs: '请输入合法的日期格式,如:{date}。',
  15637. dateInFormatMDY: '请输入合法的日期格式,例如:YYYY-MM-DD ("2010-12-31")。',
  15638. email: '请输入合法的电子信箱地址,例如:"fred@domain.com"。',
  15639. url: '请输入合法的 Url 地址,例如:http://www.example.com。',
  15640. currencyDollar: '请输入合法的货币符号,例如:¥100.0',
  15641. oneRequired: '请至少选择一项。',
  15642. errorPrefix: '错误:',
  15643. warningPrefix: '警告:',
  15644. // Form.Validator.Extras
  15645. noSpace: '不能包含空格。',
  15646. reqChkByNode: '未选择任何内容。',
  15647. requiredChk: '此项必填。',
  15648. reqChkByName: '请选择 {label}.',
  15649. match: '必须与{matchName}相匹配',
  15650. startDate: '起始日期',
  15651. endDate: '结束日期',
  15652. currentDate: '当前日期',
  15653. afterDate: '日期必须等于或晚于 {label}.',
  15654. beforeDate: '日期必须早于或等于 {label}.',
  15655. startMonth: '请选择起始月份',
  15656. sameMonth: '您必须修改两个日期中的一个,以确保它们在同一月份。',
  15657. creditcard: '您输入的信用卡号码不正确。当前已输入{length}个字符。'
  15658. });
  15659. // Traditional Chinese
  15660. Locale.define('zh-CHT', 'FormValidator', {
  15661. required: '此項必填。 ',
  15662. minLength: '請至少輸入{minLength} 個字符(已輸入{length} 個)。 ',
  15663. maxLength: '最多只能輸入{maxLength} 個字符(已輸入{length} 個)。 ',
  15664. integer: '請輸入一個整數,不能包含小數點。例如:"1", "200"。 ',
  15665. numeric: '請輸入一個數字,例如:"1", "1.1", "-1", "-1.1"。 ',
  15666. digits: '請輸入由數字和標點符號組成的內容。例如電話號碼。 ',
  15667. alpha: '請輸入AZ 的26 個字母,不能包含空格或任何其他字符。 ',
  15668. alphanum: '請輸入AZ 的26 個字母或0-9 的10 個數字,不能包含空格或任何其他字符。 ',
  15669. dateSuchAs: '請輸入合法的日期格式,如:{date}。 ',
  15670. dateInFormatMDY: '請輸入合法的日期格式,例如:YYYY-MM-DD ("2010-12-31")。 ',
  15671. email: '請輸入合法的電子信箱地址,例如:"fred@domain.com"。 ',
  15672. url: '請輸入合法的Url 地址,例如:http://www.example.com。 ',
  15673. currencyDollar: '請輸入合法的貨幣符號,例如:¥100.0',
  15674. oneRequired: '請至少選擇一項。 ',
  15675. errorPrefix: '錯誤:',
  15676. warningPrefix: '警告:',
  15677. // Form.Validator.Extras
  15678. noSpace: '不能包含空格。 ',
  15679. reqChkByNode: '未選擇任何內容。 ',
  15680. requiredChk: '此項必填。 ',
  15681. reqChkByName: '請選擇 {label}.',
  15682. match: '必須與{matchName}相匹配',
  15683. startDate: '起始日期',
  15684. endDate: '結束日期',
  15685. currentDate: '當前日期',
  15686. afterDate: '日期必須等於或晚於{label}.',
  15687. beforeDate: '日期必須早於或等於{label}.',
  15688. startMonth: '請選擇起始月份',
  15689. sameMonth: '您必須修改兩個日期中的一個,以確保它們在同一月份。 ',
  15690. creditcard: '您輸入的信用卡號碼不正確。當前已輸入{length}個字符。 '
  15691. });
  15692. Form.Validator.add('validate-currency-yuan', {
  15693. errorMsg: function(){
  15694. return Form.Validator.getMsg('currencyYuan');
  15695. },
  15696. test: function(element){
  15697. // [¥]1[##][,###]+[.##]
  15698. // [¥]1###+[.##]
  15699. // [¥]0.##
  15700. // [¥].##
  15701. 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'));
  15702. }
  15703. });
  15704. /*
  15705. ---
  15706. name: Locale.zh-CH.Number
  15707. description: Number messages for for Chinese (simplified and traditional).
  15708. license: MIT-style license
  15709. authors:
  15710. - YMind Chan
  15711. requires:
  15712. - Locale
  15713. - Locale.en-US.Number
  15714. provides: [Locale.zh-CH.Number]
  15715. ...
  15716. */
  15717. // Simplified Chinese
  15718. Locale.define('zh-CHS', 'Number', {
  15719. currency: {
  15720. prefix: '¥ '
  15721. }
  15722. }).inherit('en-US', 'Number');
  15723. // Traditional Chinese
  15724. Locale.define('zh-CHT').inherit('zh-CHS', 'Number');
  15725. /*
  15726. ---
  15727. script: Request.JSONP.js
  15728. name: Request.JSONP
  15729. description: Defines Request.JSONP, a class for cross domain javascript via script injection.
  15730. license: MIT-style license
  15731. authors:
  15732. - Aaron Newton
  15733. - Guillermo Rauch
  15734. - Arian Stolwijk
  15735. requires:
  15736. - Core/Element
  15737. - Core/Request
  15738. - MooTools.More
  15739. provides: [Request.JSONP]
  15740. ...
  15741. */
  15742. Request.JSONP = new Class({
  15743. Implements: [Chain, Events, Options],
  15744. options: {/*
  15745. onRequest: function(src, scriptElement){},
  15746. onComplete: function(data){},
  15747. onSuccess: function(data){},
  15748. onCancel: function(){},
  15749. onTimeout: function(){},
  15750. onError: function(){}, */
  15751. onRequest: function(src){
  15752. if (this.options.log && window.console && console.log){
  15753. console.log('JSONP retrieving script with url:' + src);
  15754. }
  15755. },
  15756. onError: function(src){
  15757. if (this.options.log && window.console && console.warn){
  15758. console.warn('JSONP '+ src +' will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs');
  15759. }
  15760. },
  15761. url: '',
  15762. callbackKey: 'callback',
  15763. injectScript: document.head,
  15764. data: '',
  15765. link: 'ignore',
  15766. timeout: 0,
  15767. log: false
  15768. },
  15769. initialize: function(options){
  15770. this.setOptions(options);
  15771. },
  15772. send: function(options){
  15773. if (!Request.prototype.check.call(this, options)) return this;
  15774. this.running = true;
  15775. var type = typeOf(options);
  15776. if (type == 'string' || type == 'element') options = {data: options};
  15777. options = Object.merge(this.options, options || {});
  15778. var data = options.data;
  15779. switch (typeOf(data)){
  15780. case 'element': data = document.id(data).toQueryString(); break;
  15781. case 'object': case 'hash': data = Object.toQueryString(data);
  15782. }
  15783. var index = this.index = Request.JSONP.counter++,
  15784. key = 'request_' + index;
  15785. var src = options.url +
  15786. (options.url.test('\\?') ? '&' :'?') +
  15787. (options.callbackKey) +
  15788. '=Request.JSONP.request_map.request_'+ index +
  15789. (data ? '&' + data : '');
  15790. if (src.length > 2083) this.fireEvent('error', src);
  15791. Request.JSONP.request_map[key] = function(){
  15792. delete Request.JSONP.request_map[key];
  15793. this.success(arguments, index);
  15794. }.bind(this);
  15795. var script = this.getScript(src).inject(options.injectScript);
  15796. this.fireEvent('request', [src, script]);
  15797. if (options.timeout) this.timeout.delay(options.timeout, this);
  15798. return this;
  15799. },
  15800. getScript: function(src){
  15801. if (!this.script) this.script = new Element('script', {
  15802. type: 'text/javascript',
  15803. async: true,
  15804. src: src
  15805. });
  15806. return this.script;
  15807. },
  15808. success: function(args){
  15809. if (!this.running) return;
  15810. this.clear()
  15811. .fireEvent('complete', args).fireEvent('success', args)
  15812. .callChain();
  15813. },
  15814. cancel: function(){
  15815. if (this.running) this.clear().fireEvent('cancel');
  15816. return this;
  15817. },
  15818. isRunning: function(){
  15819. return !!this.running;
  15820. },
  15821. clear: function(){
  15822. this.running = false;
  15823. if (this.script){
  15824. this.script.destroy();
  15825. this.script = null;
  15826. }
  15827. return this;
  15828. },
  15829. timeout: function(){
  15830. if (this.running){
  15831. this.running = false;
  15832. this.fireEvent('timeout', [this.script.get('src'), this.script]).fireEvent('failure').cancel();
  15833. }
  15834. return this;
  15835. }
  15836. });
  15837. Request.JSONP.counter = 0;
  15838. Request.JSONP.request_map = {};
  15839. /*
  15840. ---
  15841. script: Request.Periodical.js
  15842. name: Request.Periodical
  15843. description: Requests the same URL to pull data from a server but increases the intervals if no data is returned to reduce the load
  15844. license: MIT-style license
  15845. authors:
  15846. - Christoph Pojer
  15847. requires:
  15848. - Core/Request
  15849. - MooTools.More
  15850. provides: [Request.Periodical]
  15851. ...
  15852. */
  15853. Request.implement({
  15854. options: {
  15855. initialDelay: 5000,
  15856. delay: 5000,
  15857. limit: 60000
  15858. },
  15859. startTimer: function(data){
  15860. var fn = function(){
  15861. if (!this.running) this.send({data: data});
  15862. };
  15863. this.lastDelay = this.options.initialDelay;
  15864. this.timer = fn.delay(this.lastDelay, this);
  15865. this.completeCheck = function(response){
  15866. clearTimeout(this.timer);
  15867. this.lastDelay = (response) ? this.options.delay : (this.lastDelay + this.options.delay).min(this.options.limit);
  15868. this.timer = fn.delay(this.lastDelay, this);
  15869. };
  15870. return this.addEvent('complete', this.completeCheck);
  15871. },
  15872. stopTimer: function(){
  15873. clearTimeout(this.timer);
  15874. return this.removeEvent('complete', this.completeCheck);
  15875. }
  15876. });
  15877. /*
  15878. ---
  15879. script: Request.Queue.js
  15880. name: Request.Queue
  15881. description: Controls several instances of Request and its variants to run only one request at a time.
  15882. license: MIT-style license
  15883. authors:
  15884. - Aaron Newton
  15885. requires:
  15886. - Core/Element
  15887. - Core/Request
  15888. - Class.Binds
  15889. provides: [Request.Queue]
  15890. ...
  15891. */
  15892. Request.Queue = new Class({
  15893. Implements: [Options, Events],
  15894. Binds: ['attach', 'request', 'complete', 'cancel', 'success', 'failure', 'exception'],
  15895. options: {/*
  15896. onRequest: function(argsPassedToOnRequest){},
  15897. onSuccess: function(argsPassedToOnSuccess){},
  15898. onComplete: function(argsPassedToOnComplete){},
  15899. onCancel: function(argsPassedToOnCancel){},
  15900. onException: function(argsPassedToOnException){},
  15901. onFailure: function(argsPassedToOnFailure){},
  15902. onEnd: function(){},
  15903. */
  15904. stopOnFailure: true,
  15905. autoAdvance: true,
  15906. concurrent: 1,
  15907. requests: {}
  15908. },
  15909. initialize: function(options){
  15910. var requests;
  15911. if (options){
  15912. requests = options.requests;
  15913. delete options.requests;
  15914. }
  15915. this.setOptions(options);
  15916. this.requests = {};
  15917. this.queue = [];
  15918. this.reqBinders = {};
  15919. if (requests) this.addRequests(requests);
  15920. },
  15921. addRequest: function(name, request){
  15922. this.requests[name] = request;
  15923. this.attach(name, request);
  15924. return this;
  15925. },
  15926. addRequests: function(obj){
  15927. Object.each(obj, function(req, name){
  15928. this.addRequest(name, req);
  15929. }, this);
  15930. return this;
  15931. },
  15932. getName: function(req){
  15933. return Object.keyOf(this.requests, req);
  15934. },
  15935. attach: function(name, req){
  15936. if (req._groupSend) return this;
  15937. ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){
  15938. if (!this.reqBinders[name]) this.reqBinders[name] = {};
  15939. this.reqBinders[name][evt] = function(){
  15940. this['on' + evt.capitalize()].apply(this, [name, req].append(arguments));
  15941. }.bind(this);
  15942. req.addEvent(evt, this.reqBinders[name][evt]);
  15943. }, this);
  15944. req._groupSend = req.send;
  15945. req.send = function(options){
  15946. this.send(name, options);
  15947. return req;
  15948. }.bind(this);
  15949. return this;
  15950. },
  15951. removeRequest: function(req){
  15952. var name = typeOf(req) == 'object' ? this.getName(req) : req;
  15953. if (!name && typeOf(name) != 'string') return this;
  15954. req = this.requests[name];
  15955. if (!req) return this;
  15956. ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){
  15957. req.removeEvent(evt, this.reqBinders[name][evt]);
  15958. }, this);
  15959. req.send = req._groupSend;
  15960. delete req._groupSend;
  15961. return this;
  15962. },
  15963. getRunning: function(){
  15964. return Object.filter(this.requests, function(r){
  15965. return r.running;
  15966. });
  15967. },
  15968. isRunning: function(){
  15969. return !!(Object.keys(this.getRunning()).length);
  15970. },
  15971. send: function(name, options){
  15972. var q = function(){
  15973. this.requests[name]._groupSend(options);
  15974. this.queue.erase(q);
  15975. }.bind(this);
  15976. q.name = name;
  15977. if (Object.keys(this.getRunning()).length >= this.options.concurrent || (this.error && this.options.stopOnFailure)) this.queue.push(q);
  15978. else q();
  15979. return this;
  15980. },
  15981. hasNext: function(name){
  15982. return (!name) ? !!this.queue.length : !!this.queue.filter(function(q){ return q.name == name; }).length;
  15983. },
  15984. resume: function(){
  15985. this.error = false;
  15986. (this.options.concurrent - Object.keys(this.getRunning()).length).times(this.runNext, this);
  15987. return this;
  15988. },
  15989. runNext: function(name){
  15990. if (!this.queue.length) return this;
  15991. if (!name){
  15992. this.queue[0]();
  15993. } else {
  15994. var found;
  15995. this.queue.each(function(q){
  15996. if (!found && q.name == name){
  15997. found = true;
  15998. q();
  15999. }
  16000. });
  16001. }
  16002. return this;
  16003. },
  16004. runAll: function(){
  16005. this.queue.each(function(q){
  16006. q();
  16007. });
  16008. return this;
  16009. },
  16010. clear: function(name){
  16011. if (!name){
  16012. this.queue.empty();
  16013. } else {
  16014. this.queue = this.queue.map(function(q){
  16015. if (q.name != name) return q;
  16016. else return false;
  16017. }).filter(function(q){
  16018. return q;
  16019. });
  16020. }
  16021. return this;
  16022. },
  16023. cancel: function(name){
  16024. this.requests[name].cancel();
  16025. return this;
  16026. },
  16027. onRequest: function(){
  16028. this.fireEvent('request', arguments);
  16029. },
  16030. onComplete: function(){
  16031. this.fireEvent('complete', arguments);
  16032. if (!this.queue.length) this.fireEvent('end');
  16033. },
  16034. onCancel: function(){
  16035. if (this.options.autoAdvance && !this.error) this.runNext();
  16036. this.fireEvent('cancel', arguments);
  16037. },
  16038. onSuccess: function(){
  16039. if (this.options.autoAdvance && !this.error) this.runNext();
  16040. this.fireEvent('success', arguments);
  16041. },
  16042. onFailure: function(){
  16043. this.error = true;
  16044. if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext();
  16045. this.fireEvent('failure', arguments);
  16046. },
  16047. onException: function(){
  16048. this.error = true;
  16049. if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext();
  16050. this.fireEvent('exception', arguments);
  16051. }
  16052. });
  16053. /*
  16054. ---
  16055. script: Array.Extras.js
  16056. name: Array.Extras
  16057. description: Extends the Array native object to include useful methods to work with arrays.
  16058. license: MIT-style license
  16059. authors:
  16060. - Christoph Pojer
  16061. - Sebastian Markbåge
  16062. requires:
  16063. - Core/Array
  16064. - MooTools.More
  16065. provides: [Array.Extras]
  16066. ...
  16067. */
  16068. (function(nil){
  16069. Array.implement({
  16070. min: function(){
  16071. return Math.min.apply(null, this);
  16072. },
  16073. max: function(){
  16074. return Math.max.apply(null, this);
  16075. },
  16076. average: function(){
  16077. return this.length ? this.sum() / this.length : 0;
  16078. },
  16079. sum: function(){
  16080. var result = 0, l = this.length;
  16081. if (l){
  16082. while (l--){
  16083. if (this[l] != null) result += parseFloat(this[l]);
  16084. }
  16085. }
  16086. return result;
  16087. },
  16088. unique: function(){
  16089. return [].combine(this);
  16090. },
  16091. shuffle: function(){
  16092. for (var i = this.length; i && --i;){
  16093. var temp = this[i], r = Math.floor(Math.random() * ( i + 1 ));
  16094. this[i] = this[r];
  16095. this[r] = temp;
  16096. }
  16097. return this;
  16098. },
  16099. reduce: function(fn, value){
  16100. for (var i = 0, l = this.length; i < l; i++){
  16101. if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this);
  16102. }
  16103. return value;
  16104. },
  16105. reduceRight: function(fn, value){
  16106. var i = this.length;
  16107. while (i--){
  16108. if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this);
  16109. }
  16110. return value;
  16111. },
  16112. pluck: function(prop){
  16113. return this.map(function(item){
  16114. return item[prop];
  16115. });
  16116. }
  16117. });
  16118. })();
  16119. /*
  16120. ---
  16121. script: Date.Extras.js
  16122. name: Date.Extras
  16123. description: Extends the Date native object to include extra methods (on top of those in Date.js).
  16124. license: MIT-style license
  16125. authors:
  16126. - Aaron Newton
  16127. - Scott Kyle
  16128. requires:
  16129. - Date
  16130. provides: [Date.Extras]
  16131. ...
  16132. */
  16133. Date.implement({
  16134. timeDiffInWords: function(to){
  16135. return Date.distanceOfTimeInWords(this, to || new Date);
  16136. },
  16137. timeDiff: function(to, separator){
  16138. if (to == null) to = new Date;
  16139. var delta = ((to - this) / 1000).floor().abs();
  16140. var vals = [],
  16141. durations = [60, 60, 24, 365, 0],
  16142. names = ['s', 'm', 'h', 'd', 'y'],
  16143. value, duration;
  16144. for (var item = 0; item < durations.length; item++){
  16145. if (item && !delta) break;
  16146. value = delta;
  16147. if ((duration = durations[item])){
  16148. value = (delta % duration);
  16149. delta = (delta / duration).floor();
  16150. }
  16151. vals.unshift(value + (names[item] || ''));
  16152. }
  16153. return vals.join(separator || ':');
  16154. }
  16155. }).extend({
  16156. distanceOfTimeInWords: function(from, to){
  16157. return Date.getTimePhrase(((to - from) / 1000).toInt());
  16158. },
  16159. getTimePhrase: function(delta){
  16160. var suffix = (delta < 0) ? 'Until' : 'Ago';
  16161. if (delta < 0) delta *= -1;
  16162. var units = {
  16163. minute: 60,
  16164. hour: 60,
  16165. day: 24,
  16166. week: 7,
  16167. month: 52 / 12,
  16168. year: 12,
  16169. eon: Infinity
  16170. };
  16171. var msg = 'lessThanMinute';
  16172. for (var unit in units){
  16173. var interval = units[unit];
  16174. if (delta < 1.5 * interval){
  16175. if (delta > 0.75 * interval) msg = unit;
  16176. break;
  16177. }
  16178. delta /= interval;
  16179. msg = unit + 's';
  16180. }
  16181. delta = delta.round();
  16182. return Date.getMsg(msg + suffix, delta).substitute({delta: delta});
  16183. }
  16184. }).defineParsers(
  16185. {
  16186. // "today", "tomorrow", "yesterday"
  16187. re: /^(?:tod|tom|yes)/i,
  16188. handler: function(bits){
  16189. var d = new Date().clearTime();
  16190. switch (bits[0]){
  16191. case 'tom': return d.increment();
  16192. case 'yes': return d.decrement();
  16193. default: return d;
  16194. }
  16195. }
  16196. },
  16197. {
  16198. // "next Wednesday", "last Thursday"
  16199. re: /^(next|last) ([a-z]+)$/i,
  16200. handler: function(bits){
  16201. var d = new Date().clearTime();
  16202. var day = d.getDay();
  16203. var newDay = Date.parseDay(bits[2], true);
  16204. var addDays = newDay - day;
  16205. if (newDay <= day) addDays += 7;
  16206. if (bits[1] == 'last') addDays -= 7;
  16207. return d.set('date', d.getDate() + addDays);
  16208. }
  16209. }
  16210. ).alias('timeAgoInWords', 'timeDiffInWords');
  16211. /*
  16212. ---
  16213. name: Hash
  16214. description: Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects.
  16215. license: MIT-style license.
  16216. requires:
  16217. - Core/Object
  16218. - MooTools.More
  16219. provides: [Hash]
  16220. ...
  16221. */
  16222. (function(){
  16223. if (this.Hash) return;
  16224. var Hash = this.Hash = new Type('Hash', function(object){
  16225. if (typeOf(object) == 'hash') object = Object.clone(object.getClean());
  16226. for (var key in object) this[key] = object[key];
  16227. return this;
  16228. });
  16229. this.$H = function(object){
  16230. return new Hash(object);
  16231. };
  16232. Hash.implement({
  16233. forEach: function(fn, bind){
  16234. Object.forEach(this, fn, bind);
  16235. },
  16236. getClean: function(){
  16237. var clean = {};
  16238. for (var key in this){
  16239. if (this.hasOwnProperty(key)) clean[key] = this[key];
  16240. }
  16241. return clean;
  16242. },
  16243. getLength: function(){
  16244. var length = 0;
  16245. for (var key in this){
  16246. if (this.hasOwnProperty(key)) length++;
  16247. }
  16248. return length;
  16249. }
  16250. });
  16251. Hash.alias('each', 'forEach');
  16252. Hash.implement({
  16253. has: Object.prototype.hasOwnProperty,
  16254. keyOf: function(value){
  16255. return Object.keyOf(this, value);
  16256. },
  16257. hasValue: function(value){
  16258. return Object.contains(this, value);
  16259. },
  16260. extend: function(properties){
  16261. Hash.each(properties || {}, function(value, key){
  16262. Hash.set(this, key, value);
  16263. }, this);
  16264. return this;
  16265. },
  16266. combine: function(properties){
  16267. Hash.each(properties || {}, function(value, key){
  16268. Hash.include(this, key, value);
  16269. }, this);
  16270. return this;
  16271. },
  16272. erase: function(key){
  16273. if (this.hasOwnProperty(key)) delete this[key];
  16274. return this;
  16275. },
  16276. get: function(key){
  16277. return (this.hasOwnProperty(key)) ? this[key] : null;
  16278. },
  16279. set: function(key, value){
  16280. if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
  16281. return this;
  16282. },
  16283. empty: function(){
  16284. Hash.each(this, function(value, key){
  16285. delete this[key];
  16286. }, this);
  16287. return this;
  16288. },
  16289. include: function(key, value){
  16290. if (this[key] == undefined) this[key] = value;
  16291. return this;
  16292. },
  16293. map: function(fn, bind){
  16294. return new Hash(Object.map(this, fn, bind));
  16295. },
  16296. filter: function(fn, bind){
  16297. return new Hash(Object.filter(this, fn, bind));
  16298. },
  16299. every: function(fn, bind){
  16300. return Object.every(this, fn, bind);
  16301. },
  16302. some: function(fn, bind){
  16303. return Object.some(this, fn, bind);
  16304. },
  16305. getKeys: function(){
  16306. return Object.keys(this);
  16307. },
  16308. getValues: function(){
  16309. return Object.values(this);
  16310. },
  16311. toQueryString: function(base){
  16312. return Object.toQueryString(this, base);
  16313. }
  16314. });
  16315. Hash.alias({indexOf: 'keyOf', contains: 'hasValue'});
  16316. })();
  16317. /*
  16318. ---
  16319. script: Hash.Extras.js
  16320. name: Hash.Extras
  16321. description: Extends the Hash Type to include getFromPath which allows a path notation to child elements.
  16322. license: MIT-style license
  16323. authors:
  16324. - Aaron Newton
  16325. requires:
  16326. - Hash
  16327. - Object.Extras
  16328. provides: [Hash.Extras]
  16329. ...
  16330. */
  16331. Hash.implement({
  16332. getFromPath: function(notation){
  16333. return Object.getFromPath(this, notation);
  16334. },
  16335. cleanValues: function(method){
  16336. return new Hash(Object.cleanValues(this, method));
  16337. },
  16338. run: function(){
  16339. Object.run(arguments);
  16340. }
  16341. });
  16342. /*
  16343. ---
  16344. name: Number.Format
  16345. description: Extends the Number Type object to include a number formatting method.
  16346. license: MIT-style license
  16347. authors: [Arian Stolwijk]
  16348. requires: [Core/Number, Locale.en-US.Number]
  16349. # Number.Extras is for compatibility
  16350. provides: [Number.Format, Number.Extras]
  16351. ...
  16352. */
  16353. Number.implement({
  16354. format: function(options){
  16355. // Thanks dojo and YUI for some inspiration
  16356. var value = this;
  16357. options = options ? Object.clone(options) : {};
  16358. var getOption = function(key){
  16359. if (options[key] != null) return options[key];
  16360. return Locale.get('Number.' + key);
  16361. };
  16362. var negative = value < 0,
  16363. decimal = getOption('decimal'),
  16364. precision = getOption('precision'),
  16365. group = getOption('group'),
  16366. decimals = getOption('decimals');
  16367. if (negative){
  16368. var negativeLocale = getOption('negative') || {};
  16369. if (negativeLocale.prefix == null && negativeLocale.suffix == null) negativeLocale.prefix = '-';
  16370. ['prefix', 'suffix'].each(function(key){
  16371. if (negativeLocale[key]) options[key] = getOption(key) + negativeLocale[key];
  16372. });
  16373. value = -value;
  16374. }
  16375. var prefix = getOption('prefix'),
  16376. suffix = getOption('suffix');
  16377. if (decimals !== '' && decimals >= 0 && decimals <= 20) value = value.toFixed(decimals);
  16378. if (precision >= 1 && precision <= 21) value = (+value).toPrecision(precision);
  16379. value += '';
  16380. var index;
  16381. if (getOption('scientific') === false && value.indexOf('e') > -1){
  16382. var match = value.split('e'),
  16383. zeros = +match[1];
  16384. value = match[0].replace('.', '');
  16385. if (zeros < 0){
  16386. zeros = -zeros - 1;
  16387. index = match[0].indexOf('.');
  16388. if (index > -1) zeros -= index - 1;
  16389. while (zeros--) value = '0' + value;
  16390. value = '0.' + value;
  16391. } else {
  16392. index = match[0].lastIndexOf('.');
  16393. if (index > -1) zeros -= match[0].length - index - 1;
  16394. while (zeros--) value += '0';
  16395. }
  16396. }
  16397. if (decimal != '.') value = value.replace('.', decimal);
  16398. if (group){
  16399. index = value.lastIndexOf(decimal);
  16400. index = (index > -1) ? index : value.length;
  16401. var newOutput = value.substring(index),
  16402. i = index;
  16403. while (i--){
  16404. if ((index - i - 1) % 3 == 0 && i != (index - 1)) newOutput = group + newOutput;
  16405. newOutput = value.charAt(i) + newOutput;
  16406. }
  16407. value = newOutput;
  16408. }
  16409. if (prefix) value = prefix + value;
  16410. if (suffix) value += suffix;
  16411. return value;
  16412. },
  16413. formatCurrency: function(decimals){
  16414. var locale = Locale.get('Number.currency') || {};
  16415. if (locale.scientific == null) locale.scientific = false;
  16416. locale.decimals = decimals != null ? decimals
  16417. : (locale.decimals == null ? 2 : locale.decimals);
  16418. return this.format(locale);
  16419. },
  16420. formatPercentage: function(decimals){
  16421. var locale = Locale.get('Number.percentage') || {};
  16422. if (locale.suffix == null) locale.suffix = '%';
  16423. locale.decimals = decimals != null ? decimals
  16424. : (locale.decimals == null ? 2 : locale.decimals);
  16425. return this.format(locale);
  16426. }
  16427. });
  16428. /*
  16429. ---
  16430. script: URI.js
  16431. name: URI
  16432. description: Provides methods useful in managing the window location and uris.
  16433. license: MIT-style license
  16434. authors:
  16435. - Sebastian Markbåge
  16436. - Aaron Newton
  16437. requires:
  16438. - Core/Object
  16439. - Core/Class
  16440. - Core/Class.Extras
  16441. - Core/Element
  16442. - String.QueryString
  16443. provides: [URI]
  16444. ...
  16445. */
  16446. (function(){
  16447. var toString = function(){
  16448. return this.get('value');
  16449. };
  16450. var URI = this.URI = new Class({
  16451. Implements: Options,
  16452. options: {
  16453. /*base: false*/
  16454. },
  16455. regex: /^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[A-Fa-f0-9:]+\]|[^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,
  16456. parts: ['scheme', 'user', 'password', 'host', 'port', 'directory', 'file', 'query', 'fragment'],
  16457. schemes: {http: 80, https: 443, ftp: 21, rtsp: 554, mms: 1755, file: 0},
  16458. initialize: function(uri, options){
  16459. this.setOptions(options);
  16460. var base = this.options.base || URI.base;
  16461. if (!uri) uri = base;
  16462. if (uri && uri.parsed) this.parsed = Object.clone(uri.parsed);
  16463. else this.set('value', uri.href || uri.toString(), base ? new URI(base) : false);
  16464. },
  16465. parse: function(value, base){
  16466. var bits = value.match(this.regex);
  16467. if (!bits) return false;
  16468. bits.shift();
  16469. return this.merge(bits.associate(this.parts), base);
  16470. },
  16471. merge: function(bits, base){
  16472. if ((!bits || !bits.scheme) && (!base || !base.scheme)) return false;
  16473. if (base){
  16474. this.parts.every(function(part){
  16475. if (bits[part]) return false;
  16476. bits[part] = base[part] || '';
  16477. return true;
  16478. });
  16479. }
  16480. bits.port = bits.port || this.schemes[bits.scheme.toLowerCase()];
  16481. bits.directory = bits.directory ? this.parseDirectory(bits.directory, base ? base.directory : '') : '/';
  16482. return bits;
  16483. },
  16484. parseDirectory: function(directory, baseDirectory){
  16485. directory = (directory.substr(0, 1) == '/' ? '' : (baseDirectory || '/')) + directory;
  16486. if (!directory.test(URI.regs.directoryDot)) return directory;
  16487. var result = [];
  16488. directory.replace(URI.regs.endSlash, '').split('/').each(function(dir){
  16489. if (dir == '..' && result.length > 0) result.pop();
  16490. else if (dir != '.') result.push(dir);
  16491. });
  16492. return result.join('/') + '/';
  16493. },
  16494. combine: function(bits){
  16495. return bits.value || bits.scheme + '://' +
  16496. (bits.user ? bits.user + (bits.password ? ':' + bits.password : '') + '@' : '') +
  16497. (bits.host || '') + (bits.port && bits.port != this.schemes[bits.scheme] ? ':' + bits.port : '') +
  16498. (bits.directory || '/') + (bits.file || '') +
  16499. (bits.query ? '?' + bits.query : '') +
  16500. (bits.fragment ? '#' + bits.fragment : '');
  16501. },
  16502. set: function(part, value, base){
  16503. if (part == 'value'){
  16504. var scheme = value.match(URI.regs.scheme);
  16505. if (scheme) scheme = scheme[1];
  16506. if (scheme && this.schemes[scheme.toLowerCase()] == null) this.parsed = { scheme: scheme, value: value };
  16507. else this.parsed = this.parse(value, (base || this).parsed) || (scheme ? { scheme: scheme, value: value } : { value: value });
  16508. } else if (part == 'data'){
  16509. this.setData(value);
  16510. } else {
  16511. this.parsed[part] = value;
  16512. }
  16513. return this;
  16514. },
  16515. get: function(part, base){
  16516. switch (part){
  16517. case 'value': return this.combine(this.parsed, base ? base.parsed : false);
  16518. case 'data' : return this.getData();
  16519. }
  16520. return this.parsed[part] || '';
  16521. },
  16522. go: function(){
  16523. document.location.href = this.toString();
  16524. },
  16525. toURI: function(){
  16526. return this;
  16527. },
  16528. getData: function(key, part){
  16529. var qs = this.get(part || 'query');
  16530. if (!(qs || qs === 0)) return key ? null : {};
  16531. var obj = qs.parseQueryString();
  16532. return key ? obj[key] : obj;
  16533. },
  16534. setData: function(values, merge, part){
  16535. if (typeof values == 'string'){
  16536. var data = this.getData();
  16537. data[arguments[0]] = arguments[1];
  16538. values = data;
  16539. } else if (merge){
  16540. values = Object.merge(this.getData(null, part), values);
  16541. }
  16542. return this.set(part || 'query', Object.toQueryString(values));
  16543. },
  16544. clearData: function(part){
  16545. return this.set(part || 'query', '');
  16546. },
  16547. toString: toString,
  16548. valueOf: toString
  16549. });
  16550. URI.regs = {
  16551. endSlash: /\/$/,
  16552. scheme: /^(\w+):/,
  16553. directoryDot: /\.\/|\.$/
  16554. };
  16555. URI.base = new URI(Array.convert(document.getElements('base[href]', true)).getLast(), {base: document.location});
  16556. String.implement({
  16557. toURI: function(options){
  16558. return new URI(this, options);
  16559. }
  16560. });
  16561. })();
  16562. /*
  16563. ---
  16564. script: URI.Relative.js
  16565. name: URI.Relative
  16566. description: Extends the URI class to add methods for computing relative and absolute urls.
  16567. license: MIT-style license
  16568. authors:
  16569. - Sebastian Markbåge
  16570. requires:
  16571. - Class.refactor
  16572. - URI
  16573. provides: [URI.Relative]
  16574. ...
  16575. */
  16576. URI = Class.refactor(URI, {
  16577. combine: function(bits, base){
  16578. if (!base || bits.scheme != base.scheme || bits.host != base.host || bits.port != base.port)
  16579. return this.previous.apply(this, arguments);
  16580. var end = bits.file + (bits.query ? '?' + bits.query : '') + (bits.fragment ? '#' + bits.fragment : '');
  16581. if (!base.directory) return (bits.directory || (bits.file ? '' : './')) + end;
  16582. var baseDir = base.directory.split('/'),
  16583. relDir = bits.directory.split('/'),
  16584. path = '',
  16585. offset;
  16586. var i = 0;
  16587. for (offset = 0; offset < baseDir.length && offset < relDir.length && baseDir[offset] == relDir[offset]; offset++);
  16588. for (i = 0; i < baseDir.length - offset - 1; i++) path += '../';
  16589. for (i = offset; i < relDir.length - 1; i++) path += relDir[i] + '/';
  16590. return (path || (bits.file ? '' : './')) + end;
  16591. },
  16592. toAbsolute: function(base){
  16593. base = new URI(base);
  16594. if (base) base.set('directory', '').set('file', '');
  16595. return this.toRelative(base);
  16596. },
  16597. toRelative: function(base){
  16598. return this.get('value', new URI(base));
  16599. }
  16600. });
  16601. /*
  16602. ---
  16603. script: Assets.js
  16604. name: Assets
  16605. description: Provides methods to dynamically load JavaScript, CSS, and Image files into the document.
  16606. license: MIT-style license
  16607. authors:
  16608. - Valerio Proietti
  16609. requires:
  16610. - Core/Element.Event
  16611. - MooTools.More
  16612. provides: [Assets, Asset.javascript, Asset.css, Asset.image, Asset.images]
  16613. ...
  16614. */
  16615. ;(function(){
  16616. var Asset = this.Asset = {
  16617. javascript: function(source, properties){
  16618. if (!properties) properties = {};
  16619. var script = new Element('script', {src: source, type: 'text/javascript'}),
  16620. doc = properties.document || document,
  16621. load = properties.onload || properties.onLoad;
  16622. delete properties.onload;
  16623. delete properties.onLoad;
  16624. delete properties.document;
  16625. if (load){
  16626. if (!script.addEventListener){
  16627. script.addEvent('readystatechange', function(){
  16628. if (['loaded', 'complete'].contains(this.readyState)) load.call(this);
  16629. });
  16630. } else {
  16631. script.addEvent('load', load);
  16632. }
  16633. }
  16634. return script.set(properties).inject(doc.head);
  16635. },
  16636. css: function(source, properties){
  16637. if (!properties) properties = {};
  16638. var load = properties.onload || properties.onLoad,
  16639. doc = properties.document || document,
  16640. timeout = properties.timeout || 3000;
  16641. ['onload', 'onLoad', 'document'].each(function(prop){
  16642. delete properties[prop];
  16643. });
  16644. var link = new Element('link', {
  16645. type: 'text/css',
  16646. rel: 'stylesheet',
  16647. media: 'screen',
  16648. href: source
  16649. }).setProperties(properties).inject(doc.head);
  16650. if (load){
  16651. // based on article at http://www.yearofmoo.com/2011/03/cross-browser-stylesheet-preloading.html
  16652. var loaded = false, retries = 0;
  16653. var check = function(){
  16654. var stylesheets = document.styleSheets;
  16655. for (var i = 0; i < stylesheets.length; i++){
  16656. var file = stylesheets[i];
  16657. var owner = file.ownerNode ? file.ownerNode : file.owningElement;
  16658. if (owner && owner == link){
  16659. loaded = true;
  16660. return load.call(link);
  16661. }
  16662. }
  16663. retries++;
  16664. if (!loaded && retries < timeout / 50) return setTimeout(check, 50);
  16665. };
  16666. setTimeout(check, 0);
  16667. }
  16668. return link;
  16669. },
  16670. image: function(source, properties){
  16671. if (!properties) properties = {};
  16672. var image = new Image(),
  16673. element = document.id(image) || new Element('img');
  16674. ['load', 'abort', 'error'].each(function(name){
  16675. var type = 'on' + name,
  16676. cap = 'on' + name.capitalize(),
  16677. event = properties[type] || properties[cap] || function(){};
  16678. delete properties[cap];
  16679. delete properties[type];
  16680. image[type] = function(){
  16681. if (!image) return;
  16682. if (!element.parentNode){
  16683. element.width = image.width;
  16684. element.height = image.height;
  16685. }
  16686. image = image.onload = image.onabort = image.onerror = null;
  16687. event.delay(1, element, element);
  16688. element.fireEvent(name, element, 1);
  16689. };
  16690. });
  16691. image.src = element.src = source;
  16692. if (image && image.complete) image.onload.delay(1);
  16693. return element.set(properties);
  16694. },
  16695. images: function(sources, options){
  16696. sources = Array.convert(sources);
  16697. var fn = function(){},
  16698. counter = 0;
  16699. options = Object.merge({
  16700. onComplete: fn,
  16701. onProgress: fn,
  16702. onError: fn,
  16703. properties: {}
  16704. }, options);
  16705. return new Elements(sources.map(function(source, index){
  16706. return Asset.image(source, Object.append(options.properties, {
  16707. onload: function(){
  16708. counter++;
  16709. options.onProgress.call(this, counter, index, source);
  16710. if (counter == sources.length) options.onComplete();
  16711. },
  16712. onerror: function(){
  16713. counter++;
  16714. options.onError.call(this, counter, index, source);
  16715. if (counter == sources.length) options.onComplete();
  16716. }
  16717. }));
  16718. }));
  16719. }
  16720. };
  16721. })();
  16722. /*
  16723. ---
  16724. script: Color.js
  16725. name: Color
  16726. description: Class for creating and manipulating colors in JavaScript. Supports HSB -> RGB Conversions and vice versa.
  16727. license: MIT-style license
  16728. authors:
  16729. - Valerio Proietti
  16730. requires:
  16731. - Core/Array
  16732. - Core/String
  16733. - Core/Number
  16734. - Core/Hash
  16735. - Core/Function
  16736. - MooTools.More
  16737. provides: [Color]
  16738. ...
  16739. */
  16740. (function(){
  16741. var Color = this.Color = new Type('Color', function(color, type){
  16742. if (arguments.length >= 3){
  16743. type = 'rgb'; color = Array.slice(arguments, 0, 3);
  16744. } else if (typeof color == 'string'){
  16745. if (color.match(/rgb/)) color = color.rgbToHex().hexToRgb(true);
  16746. else if (color.match(/hsb/)) color = color.hsbToRgb();
  16747. else color = color.hexToRgb(true);
  16748. }
  16749. type = type || 'rgb';
  16750. switch (type){
  16751. case 'hsb':
  16752. var old = color;
  16753. color = color.hsbToRgb();
  16754. color.hsb = old;
  16755. break;
  16756. case 'hex': color = color.hexToRgb(true); break;
  16757. }
  16758. color.rgb = color.slice(0, 3);
  16759. color.hsb = color.hsb || color.rgbToHsb();
  16760. color.hex = color.rgbToHex();
  16761. return Object.append(color, this);
  16762. });
  16763. Color.implement({
  16764. mix: function(){
  16765. var colors = Array.slice(arguments);
  16766. var alpha = (typeOf(colors.getLast()) == 'number') ? colors.pop() : 50;
  16767. var rgb = this.slice();
  16768. colors.each(function(color){
  16769. color = new Color(color);
  16770. for (var i = 0; i < 3; i++) rgb[i] = Math.round((rgb[i] / 100 * (100 - alpha)) + (color[i] / 100 * alpha));
  16771. });
  16772. return new Color(rgb, 'rgb');
  16773. },
  16774. invert: function(){
  16775. return new Color(this.map(function(value){
  16776. return 255 - value;
  16777. }));
  16778. },
  16779. setHue: function(value){
  16780. return new Color([value, this.hsb[1], this.hsb[2]], 'hsb');
  16781. },
  16782. setSaturation: function(percent){
  16783. return new Color([this.hsb[0], percent, this.hsb[2]], 'hsb');
  16784. },
  16785. setBrightness: function(percent){
  16786. return new Color([this.hsb[0], this.hsb[1], percent], 'hsb');
  16787. }
  16788. });
  16789. this.$RGB = function(r, g, b){
  16790. return new Color([r, g, b], 'rgb');
  16791. };
  16792. this.$HSB = function(h, s, b){
  16793. return new Color([h, s, b], 'hsb');
  16794. };
  16795. this.$HEX = function(hex){
  16796. return new Color(hex, 'hex');
  16797. };
  16798. Array.implement({
  16799. rgbToHsb: function(){
  16800. var red = this[0],
  16801. green = this[1],
  16802. blue = this[2],
  16803. hue = 0,
  16804. max = Math.max(red, green, blue),
  16805. min = Math.min(red, green, blue),
  16806. delta = max - min,
  16807. brightness = max / 255,
  16808. saturation = (max != 0) ? delta / max : 0;
  16809. if (saturation != 0){
  16810. var rr = (max - red) / delta;
  16811. var gr = (max - green) / delta;
  16812. var br = (max - blue) / delta;
  16813. if (red == max) hue = br - gr;
  16814. else if (green == max) hue = 2 + rr - br;
  16815. else hue = 4 + gr - rr;
  16816. hue /= 6;
  16817. if (hue < 0) hue++;
  16818. }
  16819. return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)];
  16820. },
  16821. hsbToRgb: function(){
  16822. var br = Math.round(this[2] / 100 * 255);
  16823. if (this[1] == 0){
  16824. return [br, br, br];
  16825. } else {
  16826. var hue = this[0] % 360;
  16827. var f = hue % 60;
  16828. var p = Math.round((this[2] * (100 - this[1])) / 10000 * 255);
  16829. var q = Math.round((this[2] * (6000 - this[1] * f)) / 600000 * 255);
  16830. var t = Math.round((this[2] * (6000 - this[1] * (60 - f))) / 600000 * 255);
  16831. switch (Math.floor(hue / 60)){
  16832. case 0: return [br, t, p];
  16833. case 1: return [q, br, p];
  16834. case 2: return [p, br, t];
  16835. case 3: return [p, q, br];
  16836. case 4: return [t, p, br];
  16837. case 5: return [br, p, q];
  16838. }
  16839. }
  16840. return false;
  16841. }
  16842. });
  16843. String.implement({
  16844. rgbToHsb: function(){
  16845. var rgb = this.match(/\d{1,3}/g);
  16846. return (rgb) ? rgb.rgbToHsb() : null;
  16847. },
  16848. hsbToRgb: function(){
  16849. var hsb = this.match(/\d{1,3}/g);
  16850. return (hsb) ? hsb.hsbToRgb() : null;
  16851. }
  16852. });
  16853. })();
  16854. /*
  16855. ---
  16856. script: Group.js
  16857. name: Group
  16858. description: Class for monitoring collections of events
  16859. license: MIT-style license
  16860. authors:
  16861. - Valerio Proietti
  16862. requires:
  16863. - Core/Events
  16864. - MooTools.More
  16865. provides: [Group]
  16866. ...
  16867. */
  16868. (function(){
  16869. var Group = this.Group = new Class({
  16870. initialize: function(){
  16871. this.instances = Array.flatten(arguments);
  16872. },
  16873. addEvent: function(type, fn){
  16874. var instances = this.instances,
  16875. len = instances.length,
  16876. togo = len,
  16877. args = new Array(len),
  16878. self = this;
  16879. instances.each(function(instance, i){
  16880. instance.addEvent(type, function(){
  16881. if (!args[i]) togo--;
  16882. args[i] = arguments;
  16883. if (!togo){
  16884. fn.call(self, instances, instance, args);
  16885. togo = len;
  16886. args = new Array(len);
  16887. }
  16888. });
  16889. });
  16890. }
  16891. });
  16892. })();
  16893. /*
  16894. ---
  16895. script: Hash.Cookie.js
  16896. name: Hash.Cookie
  16897. description: Class for creating, reading, and deleting Cookies in JSON format.
  16898. license: MIT-style license
  16899. authors:
  16900. - Valerio Proietti
  16901. - Aaron Newton
  16902. requires:
  16903. - Core/Cookie
  16904. - Core/JSON
  16905. - MooTools.More
  16906. - Hash
  16907. provides: [Hash.Cookie]
  16908. ...
  16909. */
  16910. Hash.Cookie = new Class({
  16911. Extends: Cookie,
  16912. options: {
  16913. autoSave: true
  16914. },
  16915. initialize: function(name, options){
  16916. this.parent(name, options);
  16917. this.load();
  16918. },
  16919. save: function(){
  16920. var value = JSON.encode(this.hash);
  16921. if (!value || value.length > 4096) return false; //cookie would be truncated!
  16922. if (value == '{}') this.dispose();
  16923. else this.write(value);
  16924. return true;
  16925. },
  16926. load: function(){
  16927. this.hash = new Hash(JSON.decode(this.read(), true));
  16928. return this;
  16929. }
  16930. });
  16931. Hash.each(Hash.prototype, function(method, name){
  16932. if (typeof method == 'function') Hash.Cookie.implement(name, function(){
  16933. var value = method.apply(this.hash, arguments);
  16934. if (this.options.autoSave) this.save();
  16935. return value;
  16936. });
  16937. });
  16938. /*
  16939. ---
  16940. name: Swiff
  16941. description: Wrapper for embedding SWF movies. Supports External Interface Communication.
  16942. license: MIT-style license.
  16943. credits:
  16944. - Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject.
  16945. requires: [Core/Options, Core/Object, Core/Element]
  16946. provides: Swiff
  16947. ...
  16948. */
  16949. (function(){
  16950. var Swiff = this.Swiff = new Class({
  16951. Implements: Options,
  16952. options: {
  16953. id: null,
  16954. height: 1,
  16955. width: 1,
  16956. container: null,
  16957. properties: {},
  16958. params: {
  16959. quality: 'high',
  16960. allowScriptAccess: 'always',
  16961. wMode: 'window',
  16962. swLiveConnect: true
  16963. },
  16964. callBacks: {},
  16965. vars: {}
  16966. },
  16967. toElement: function(){
  16968. return this.object;
  16969. },
  16970. initialize: function(path, options){
  16971. this.instance = 'Swiff_' + String.uniqueID();
  16972. this.setOptions(options);
  16973. options = this.options;
  16974. var id = this.id = options.id || this.instance;
  16975. var container = document.id(options.container);
  16976. Swiff.CallBacks[this.instance] = {};
  16977. var params = options.params, vars = options.vars, callBacks = options.callBacks;
  16978. var properties = Object.append({height: options.height, width: options.width}, options.properties);
  16979. var self = this;
  16980. for (var callBack in callBacks){
  16981. Swiff.CallBacks[this.instance][callBack] = (function(option){
  16982. return function(){
  16983. return option.apply(self.object, arguments);
  16984. };
  16985. })(callBacks[callBack]);
  16986. vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack;
  16987. }
  16988. params.flashVars = Object.toQueryString(vars);
  16989. if ('ActiveXObject' in window){
  16990. properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
  16991. params.movie = path;
  16992. } else {
  16993. properties.type = 'application/x-shockwave-flash';
  16994. }
  16995. properties.data = path;
  16996. var build = '<object id="' + id + '"';
  16997. for (var property in properties) build += ' ' + property + '="' + properties[property] + '"';
  16998. build += '>';
  16999. for (var param in params){
  17000. if (params[param]) build += '<param name="' + param + '" value="' + params[param] + '" />';
  17001. }
  17002. build += '</object>';
  17003. this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild;
  17004. },
  17005. replaces: function(element){
  17006. element = document.id(element, true);
  17007. element.parentNode.replaceChild(this.toElement(), element);
  17008. return this;
  17009. },
  17010. inject: function(element){
  17011. document.id(element, true).appendChild(this.toElement());
  17012. return this;
  17013. },
  17014. remote: function(){
  17015. return Swiff.remote.apply(Swiff, [this.toElement()].append(arguments));
  17016. }
  17017. });
  17018. Swiff.CallBacks = {};
  17019. Swiff.remote = function(obj, fn){
  17020. var rs = obj.CallFunction('<invoke name="' + fn + '" returntype="javascript">' + __flash__argumentsToXML(arguments, 2) + '</invoke>');
  17021. return eval(rs);
  17022. };
  17023. })();
  17024. /*
  17025. ---
  17026. name: Table
  17027. description: LUA-Style table implementation.
  17028. license: MIT-style license
  17029. authors:
  17030. - Valerio Proietti
  17031. requires: [Core/Array]
  17032. provides: [Table]
  17033. ...
  17034. */
  17035. (function(){
  17036. var Table = this.Table = function(){
  17037. this.length = 0;
  17038. var keys = [],
  17039. values = [];
  17040. this.set = function(key, value){
  17041. var index = keys.indexOf(key);
  17042. if (index == -1){
  17043. var length = keys.length;
  17044. keys[length] = key;
  17045. values[length] = value;
  17046. this.length++;
  17047. } else {
  17048. values[index] = value;
  17049. }
  17050. return this;
  17051. };
  17052. this.get = function(key){
  17053. var index = keys.indexOf(key);
  17054. return (index == -1) ? null : values[index];
  17055. };
  17056. this.erase = function(key){
  17057. var index = keys.indexOf(key);
  17058. if (index != -1){
  17059. this.length--;
  17060. keys.splice(index, 1);
  17061. return values.splice(index, 1)[0];
  17062. }
  17063. return null;
  17064. };
  17065. this.each = this.forEach = function(fn, bind){
  17066. for (var i = 0, l = this.length; i < l; i++) fn.call(bind, keys[i], values[i], this);
  17067. };
  17068. };
  17069. if (this.Type) new Type('Table', Table);
  17070. })();