mootools-1.6.0_all.js 551 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728
  1. /* MooTools: the javascript framework. license: MIT-style license. copyright: Copyright (c) 2006-2016 [Valerio Proietti](http://mad4milk.net/).*/
  2. /*!
  3. Web Build: http://mootools.net/more/builder/444dd8f9b276db91102332672b694443
  4. */
  5. /*
  6. ---
  7. name: Core
  8. description: The heart of MooTools.
  9. license: MIT-style license.
  10. copyright: Copyright (c) 2006-2015 [Valerio Proietti](http://mad4milk.net/).
  11. authors: The MooTools production team (http://mootools.net/developers/)
  12. inspiration:
  13. - Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php)
  14. - Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php)
  15. provides: [Core, MooTools, Type, typeOf, instanceOf, Native]
  16. ...
  17. */
  18. if (window.Request){
  19. window.NativeRequest = window.Request;
  20. }
  21. /*! MooTools: the javascript framework. license: MIT-style license. copyright: Copyright (c) 2006-2015 [Valerio Proietti](http://mad4milk.net/).*/
  22. (function(){
  23. this.MooTools = {
  24. version: '1.6.0',
  25. build: '529422872adfff401b901b8b6c7ca5114ee95e2b'
  26. };
  27. // typeOf, instanceOf
  28. var typeOf = this.typeOf = function(item){
  29. if (item == null) return 'null';
  30. if (item.$family != null) return item.$family();
  31. if (item.nodeName){
  32. if (item.nodeType == 1) return 'element';
  33. if (item.nodeType == 3) return (/\S/).test(item.nodeValue) ? 'textnode' : 'whitespace';
  34. } else if (typeof item.length == 'number'){
  35. if ('callee' in item) return 'arguments';
  36. if ('item' in item) return 'collection';
  37. }
  38. return typeof item;
  39. };
  40. var instanceOf = this.instanceOf = function(item, object){
  41. if (item == null) return false;
  42. var constructor = item.$constructor || item.constructor;
  43. while (constructor){
  44. if (constructor === object) return true;
  45. constructor = constructor.parent;
  46. }
  47. /*<ltIE8>*/
  48. if (!item.hasOwnProperty) return false;
  49. /*</ltIE8>*/
  50. return item instanceof object;
  51. };
  52. var hasOwnProperty = Object.prototype.hasOwnProperty;
  53. /*<ltIE8>*/
  54. var enumerables = true;
  55. for (var i in {toString: 1}) enumerables = null;
  56. if (enumerables) enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor'];
  57. function forEachObjectEnumberableKey(object, fn, bind){
  58. if (enumerables) for (var i = enumerables.length; i--;){
  59. var k = enumerables[i];
  60. // signature has key-value, so overloadSetter can directly pass the
  61. // method function, without swapping arguments.
  62. if (hasOwnProperty.call(object, k)) fn.call(bind, k, object[k]);
  63. }
  64. }
  65. /*</ltIE8>*/
  66. // Function overloading
  67. var Function = this.Function;
  68. Function.prototype.overloadSetter = function(usePlural){
  69. var self = this;
  70. return function(a, b){
  71. if (a == null) return this;
  72. if (usePlural || typeof a != 'string'){
  73. for (var k in a) self.call(this, k, a[k]);
  74. /*<ltIE8>*/
  75. forEachObjectEnumberableKey(a, self, this);
  76. /*</ltIE8>*/
  77. } else {
  78. self.call(this, a, b);
  79. }
  80. return this;
  81. };
  82. };
  83. Function.prototype.overloadGetter = function(usePlural){
  84. var self = this;
  85. return function(a){
  86. var args, result;
  87. if (typeof a != 'string') args = a;
  88. else if (arguments.length > 1) args = arguments;
  89. else if (usePlural) args = [a];
  90. if (args){
  91. result = {};
  92. for (var i = 0; i < args.length; i++) result[args[i]] = self.call(this, args[i]);
  93. } else {
  94. result = self.call(this, a);
  95. }
  96. return result;
  97. };
  98. };
  99. Function.prototype.extend = function(key, value){
  100. this[key] = value;
  101. }.overloadSetter();
  102. Function.prototype.implement = function(key, value){
  103. this.prototype[key] = value;
  104. }.overloadSetter();
  105. // From
  106. var slice = Array.prototype.slice;
  107. Array.convert = function(item){
  108. if (item == null) return [];
  109. return (Type.isEnumerable(item) && typeof item != 'string') ? (typeOf(item) == 'array') ? item : slice.call(item) : [item];
  110. };
  111. Function.convert = function(item){
  112. return (typeOf(item) == 'function') ? item : function(){
  113. return item;
  114. };
  115. };
  116. Number.convert = function(item){
  117. var number = parseFloat(item);
  118. return isFinite(number) ? number : null;
  119. };
  120. String.convert = function(item){
  121. return item + '';
  122. };
  123. /*<1.5compat>*/
  124. if(!Array.from)Array.from = Array.convert;
  125. /*</1.5compat>*/
  126. Function.from = Function.convert;
  127. Number.from = Number.convert;
  128. String.from = String.convert;
  129. // hide, protect
  130. Function.implement({
  131. hide: function(){
  132. this.$hidden = true;
  133. return this;
  134. },
  135. protect: function(){
  136. this.$protected = true;
  137. return this;
  138. }
  139. });
  140. // Type
  141. var Type = this.Type = function(name, object){
  142. if (name){
  143. var lower = name.toLowerCase();
  144. var typeCheck = function(item){
  145. return (typeOf(item) == lower);
  146. };
  147. Type['is' + name] = typeCheck;
  148. if (object != null){
  149. object.prototype.$family = (function(){
  150. return lower;
  151. }).hide();
  152. //<1.2compat>
  153. object.type = typeCheck;
  154. //</1.2compat>
  155. }
  156. }
  157. if (object == null) return null;
  158. object.extend(this);
  159. object.$constructor = Type;
  160. object.prototype.$constructor = object;
  161. return object;
  162. };
  163. var toString = Object.prototype.toString;
  164. Type.isEnumerable = function(item){
  165. return (item != null && typeof item.length == 'number' && toString.call(item) != '[object Function]' );
  166. };
  167. var hooks = {};
  168. var hooksOf = function(object){
  169. var type = typeOf(object.prototype);
  170. return hooks[type] || (hooks[type] = []);
  171. };
  172. var implement = function(name, method){
  173. if (method && method.$hidden) return;
  174. var hooks = hooksOf(this);
  175. for (var i = 0; i < hooks.length; i++){
  176. var hook = hooks[i];
  177. if (typeOf(hook) == 'type') implement.call(hook, name, method);
  178. else hook.call(this, name, method);
  179. }
  180. var previous = this.prototype[name];
  181. if (previous == null || !previous.$protected) this.prototype[name] = method;
  182. if (this[name] == null && typeOf(method) == 'function') extend.call(this, name, function(item){
  183. return method.apply(item, slice.call(arguments, 1));
  184. });
  185. };
  186. var extend = function(name, method){
  187. if (method && method.$hidden) return;
  188. var previous = this[name];
  189. if (previous == null || !previous.$protected) this[name] = method;
  190. };
  191. Type.implement({
  192. implement: implement.overloadSetter(),
  193. extend: extend.overloadSetter(),
  194. alias: function(name, existing){
  195. implement.call(this, name, this.prototype[existing]);
  196. }.overloadSetter(),
  197. mirror: function(hook){
  198. hooksOf(this).push(hook);
  199. return this;
  200. }
  201. });
  202. new Type('Type', Type);
  203. // Default Types
  204. var force = function(name, object, methods){
  205. var isType = (object != Object),
  206. prototype = object.prototype;
  207. if (isType) object = new Type(name, object);
  208. for (var i = 0, l = methods.length; i < l; i++){
  209. var key = methods[i],
  210. generic = object[key],
  211. proto = prototype[key];
  212. if (generic) generic.protect();
  213. if (isType && proto) object.implement(key, proto.protect());
  214. }
  215. if (isType){
  216. var methodsEnumerable = prototype.propertyIsEnumerable(methods[0]);
  217. object.forEachMethod = function(fn){
  218. if (!methodsEnumerable) for (var i = 0, l = methods.length; i < l; i++){
  219. fn.call(prototype, prototype[methods[i]], methods[i]);
  220. }
  221. for (var key in prototype) fn.call(prototype, prototype[key], key);
  222. };
  223. }
  224. return force;
  225. };
  226. force('String', String, [
  227. 'charAt', 'charCodeAt', 'concat', 'contains', 'indexOf', 'lastIndexOf', 'match', 'quote', 'replace', 'search',
  228. 'slice', 'split', 'substr', 'substring', 'trim', 'toLowerCase', 'toUpperCase'
  229. ])('Array', Array, [
  230. 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice',
  231. 'indexOf', 'lastIndexOf', 'filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight', 'contains'
  232. ])('Number', Number, [
  233. 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision'
  234. ])('Function', Function, [
  235. 'apply', 'call', 'bind'
  236. ])('RegExp', RegExp, [
  237. 'exec', 'test'
  238. ])('Object', Object, [
  239. 'create', 'defineProperty', 'defineProperties', 'keys',
  240. 'getPrototypeOf', 'getOwnPropertyDescriptor', 'getOwnPropertyNames',
  241. 'preventExtensions', 'isExtensible', 'seal', 'isSealed', 'freeze', 'isFrozen'
  242. ])('Date', Date, ['now']);
  243. Object.extend = extend.overloadSetter();
  244. Date.extend('now', function(){
  245. return +(new Date);
  246. });
  247. new Type('Boolean', Boolean);
  248. // fixes NaN returning as Number
  249. Number.prototype.$family = function(){
  250. return isFinite(this) ? 'number' : 'null';
  251. }.hide();
  252. // Number.random
  253. Number.extend('random', function(min, max){
  254. return Math.floor(Math.random() * (max - min + 1) + min);
  255. });
  256. // forEach, each, keys
  257. Array.implement({
  258. /*<!ES5>*/
  259. forEach: function(fn, bind){
  260. for (var i = 0, l = this.length; i < l; i++){
  261. if (i in this) fn.call(bind, this[i], i, this);
  262. }
  263. },
  264. /*</!ES5>*/
  265. each: function(fn, bind){
  266. Array.forEach(this, fn, bind);
  267. return this;
  268. }
  269. });
  270. Object.extend({
  271. keys: function(object){
  272. var keys = [];
  273. for (var k in object){
  274. if (hasOwnProperty.call(object, k)) keys.push(k);
  275. }
  276. /*<ltIE8>*/
  277. forEachObjectEnumberableKey(object, function(k){
  278. keys.push(k);
  279. });
  280. /*</ltIE8>*/
  281. return keys;
  282. },
  283. forEach: function(object, fn, bind){
  284. if (object) Object.keys(object).forEach(function(key){
  285. fn.call(bind, object[key], key, object);
  286. });
  287. }
  288. });
  289. Object.each = Object.forEach;
  290. // Array & Object cloning, Object merging and appending
  291. var cloneOf = function(item){
  292. switch (typeOf(item)){
  293. case 'array': return item.clone();
  294. case 'object': return Object.clone(item);
  295. default: return item;
  296. }
  297. };
  298. Array.implement('clone', function(){
  299. var i = this.length, clone = new Array(i);
  300. while (i--) clone[i] = cloneOf(this[i]);
  301. return clone;
  302. });
  303. var mergeOne = function(source, key, current){
  304. switch (typeOf(current)){
  305. case 'object':
  306. if (typeOf(source[key]) == 'object') Object.merge(source[key], current);
  307. else source[key] = Object.clone(current);
  308. break;
  309. case 'array': source[key] = current.clone(); break;
  310. default: source[key] = current;
  311. }
  312. return source;
  313. };
  314. Object.extend({
  315. merge: function(source, k, v){
  316. if (typeOf(k) == 'string') return mergeOne(source, k, v);
  317. for (var i = 1, l = arguments.length; i < l; i++){
  318. var object = arguments[i];
  319. for (var key in object) mergeOne(source, key, object[key]);
  320. }
  321. return source;
  322. },
  323. clone: function(object){
  324. var clone = {};
  325. for (var key in object) clone[key] = cloneOf(object[key]);
  326. return clone;
  327. },
  328. append: function(original){
  329. for (var i = 1, l = arguments.length; i < l; i++){
  330. var extended = arguments[i] || {};
  331. for (var key in extended) original[key] = extended[key];
  332. }
  333. return original;
  334. }
  335. });
  336. // Object-less types
  337. ['Object', 'WhiteSpace', 'TextNode', 'Collection', 'Arguments'].each(function(name){
  338. new Type(name);
  339. });
  340. // Unique ID
  341. var UID = Date.now();
  342. String.extend('uniqueID', function(){
  343. return (UID++).toString(36);
  344. });
  345. //<1.2compat>
  346. var Hash = this.Hash = new Type('Hash', function(object){
  347. if (typeOf(object) == 'hash') object = Object.clone(object.getClean());
  348. for (var key in object) this[key] = object[key];
  349. return this;
  350. });
  351. Hash.implement({
  352. forEach: function(fn, bind){
  353. Object.forEach(this, fn, bind);
  354. },
  355. getClean: function(){
  356. var clean = {};
  357. for (var key in this){
  358. if (this.hasOwnProperty(key)) clean[key] = this[key];
  359. }
  360. return clean;
  361. },
  362. getLength: function(){
  363. var length = 0;
  364. for (var key in this){
  365. if (this.hasOwnProperty(key)) length++;
  366. }
  367. return length;
  368. }
  369. });
  370. Hash.alias('each', 'forEach');
  371. Object.type = Type.isObject;
  372. var Native = this.Native = function(properties){
  373. return new Type(properties.name, properties.initialize);
  374. };
  375. Native.type = Type.type;
  376. Native.implement = function(objects, methods){
  377. for (var i = 0; i < objects.length; i++) objects[i].implement(methods);
  378. return Native;
  379. };
  380. var arrayType = Array.type;
  381. Array.type = function(item){
  382. return instanceOf(item, Array) || arrayType(item);
  383. };
  384. this.$A = function(item){
  385. return Array.convert(item).slice();
  386. };
  387. this.$arguments = function(i){
  388. return function(){
  389. return arguments[i];
  390. };
  391. };
  392. this.$chk = function(obj){
  393. return !!(obj || obj === 0);
  394. };
  395. this.$clear = function(timer){
  396. clearTimeout(timer);
  397. clearInterval(timer);
  398. return null;
  399. };
  400. this.$defined = function(obj){
  401. return (obj != null);
  402. };
  403. this.$each = function(iterable, fn, bind){
  404. var type = typeOf(iterable);
  405. ((type == 'arguments' || type == 'collection' || type == 'array' || type == 'elements') ? Array : Object).each(iterable, fn, bind);
  406. };
  407. this.$empty = function(){};
  408. this.$extend = function(original, extended){
  409. return Object.append(original, extended);
  410. };
  411. this.$H = function(object){
  412. return new Hash(object);
  413. };
  414. this.$merge = function(){
  415. var args = Array.slice(arguments);
  416. args.unshift({});
  417. return Object.merge.apply(null, args);
  418. };
  419. this.$lambda = Function.convert;
  420. this.$mixin = Object.merge;
  421. this.$random = Number.random;
  422. this.$splat = Array.convert;
  423. this.$time = Date.now;
  424. this.$type = function(object){
  425. var type = typeOf(object);
  426. if (type == 'elements') return 'array';
  427. return (type == 'null') ? false : type;
  428. };
  429. this.$unlink = function(object){
  430. switch (typeOf(object)){
  431. case 'object': return Object.clone(object);
  432. case 'array': return Array.clone(object);
  433. case 'hash': return new Hash(object);
  434. default: return object;
  435. }
  436. };
  437. //</1.2compat>
  438. })();
  439. /*
  440. ---
  441. name: Array
  442. description: Contains Array Prototypes like each, contains, and erase.
  443. license: MIT-style license.
  444. requires: [Type]
  445. provides: Array
  446. ...
  447. */
  448. Array.implement({
  449. /*<!ES5>*/
  450. every: function(fn, bind){
  451. for (var i = 0, l = this.length >>> 0; i < l; i++){
  452. if ((i in this) && !fn.call(bind, this[i], i, this)) return false;
  453. }
  454. return true;
  455. },
  456. filter: function(fn, bind){
  457. var results = [];
  458. for (var value, i = 0, l = this.length >>> 0; i < l; i++) if (i in this){
  459. value = this[i];
  460. if (fn.call(bind, value, i, this)) results.push(value);
  461. }
  462. return results;
  463. },
  464. indexOf: function(item, from){
  465. var length = this.length >>> 0;
  466. for (var i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++){
  467. if (this[i] === item) return i;
  468. }
  469. return -1;
  470. },
  471. map: function(fn, bind){
  472. var length = this.length >>> 0, results = Array(length);
  473. for (var i = 0; i < length; i++){
  474. if (i in this) results[i] = fn.call(bind, this[i], i, this);
  475. }
  476. return results;
  477. },
  478. some: function(fn, bind){
  479. for (var i = 0, l = this.length >>> 0; i < l; i++){
  480. if ((i in this) && fn.call(bind, this[i], i, this)) return true;
  481. }
  482. return false;
  483. },
  484. /*</!ES5>*/
  485. clean: function(){
  486. return this.filter(function(item){
  487. return item != null;
  488. });
  489. },
  490. invoke: function(methodName){
  491. var args = Array.slice(arguments, 1);
  492. return this.map(function(item){
  493. return item[methodName].apply(item, args);
  494. });
  495. },
  496. associate: function(keys){
  497. var obj = {}, length = Math.min(this.length, keys.length);
  498. for (var i = 0; i < length; i++) obj[keys[i]] = this[i];
  499. return obj;
  500. },
  501. link: function(object){
  502. var result = {};
  503. for (var i = 0, l = this.length; i < l; i++){
  504. for (var key in object){
  505. if (object[key](this[i])){
  506. result[key] = this[i];
  507. delete object[key];
  508. break;
  509. }
  510. }
  511. }
  512. return result;
  513. },
  514. contains: function(item, from){
  515. return this.indexOf(item, from) != -1;
  516. },
  517. append: function(array){
  518. this.push.apply(this, array);
  519. return this;
  520. },
  521. getLast: function(){
  522. return (this.length) ? this[this.length - 1] : null;
  523. },
  524. getRandom: function(){
  525. return (this.length) ? this[Number.random(0, this.length - 1)] : null;
  526. },
  527. include: function(item){
  528. if (!this.contains(item)) this.push(item);
  529. return this;
  530. },
  531. combine: function(array){
  532. for (var i = 0, l = array.length; i < l; i++) this.include(array[i]);
  533. return this;
  534. },
  535. erase: function(item){
  536. for (var i = this.length; i--;){
  537. if (this[i] === item) this.splice(i, 1);
  538. }
  539. return this;
  540. },
  541. empty: function(){
  542. this.length = 0;
  543. return this;
  544. },
  545. flatten: function(){
  546. var array = [];
  547. for (var i = 0, l = this.length; i < l; i++){
  548. var type = typeOf(this[i]);
  549. if (type == 'null') continue;
  550. array = array.concat((type == 'array' || type == 'collection' || type == 'arguments' || instanceOf(this[i], Array)) ? Array.flatten(this[i]) : this[i]);
  551. }
  552. return array;
  553. },
  554. pick: function(){
  555. for (var i = 0, l = this.length; i < l; i++){
  556. if (this[i] != null) return this[i];
  557. }
  558. return null;
  559. },
  560. hexToRgb: function(array){
  561. if (this.length != 3) return null;
  562. var rgb = this.map(function(value){
  563. if (value.length == 1) value += value;
  564. return parseInt(value, 16);
  565. });
  566. return (array) ? rgb : 'rgb(' + rgb + ')';
  567. },
  568. rgbToHex: function(array){
  569. if (this.length < 3) return null;
  570. if (this.length == 4 && this[3] == 0 && !array) return 'transparent';
  571. var hex = [];
  572. for (var i = 0; i < 3; i++){
  573. var bit = (this[i] - 0).toString(16);
  574. hex.push((bit.length == 1) ? '0' + bit : bit);
  575. }
  576. return (array) ? hex : '#' + hex.join('');
  577. }
  578. });
  579. //<1.2compat>
  580. Array.alias('extend', 'append');
  581. var $pick = this.$pick = function(){
  582. return Array.convert(arguments).pick();
  583. };
  584. //</1.2compat>
  585. /*
  586. ---
  587. name: Function
  588. description: Contains Function Prototypes like create, bind, pass, and delay.
  589. license: MIT-style license.
  590. requires: Type
  591. provides: Function
  592. ...
  593. */
  594. Function.extend({
  595. attempt: function(){
  596. for (var i = 0, l = arguments.length; i < l; i++){
  597. try {
  598. return arguments[i]();
  599. } catch (e){}
  600. }
  601. return null;
  602. }
  603. });
  604. Function.implement({
  605. attempt: function(args, bind){
  606. try {
  607. return this.apply(bind, Array.convert(args));
  608. } catch (e){}
  609. return null;
  610. },
  611. /*<!ES5-bind>*/
  612. bind: function(that){
  613. var self = this,
  614. args = arguments.length > 1 ? Array.slice(arguments, 1) : null,
  615. F = function(){};
  616. var bound = function(){
  617. var context = that, length = arguments.length;
  618. if (this instanceof bound){
  619. F.prototype = self.prototype;
  620. context = new F;
  621. }
  622. var result = (!args && !length)
  623. ? self.call(context)
  624. : self.apply(context, args && length ? args.concat(Array.slice(arguments)) : args || arguments);
  625. return context == that ? result : context;
  626. };
  627. return bound;
  628. },
  629. /*</!ES5-bind>*/
  630. pass: function(args, bind){
  631. var self = this;
  632. if (args != null) args = Array.convert(args);
  633. return function(){
  634. return self.apply(bind, args || arguments);
  635. };
  636. },
  637. delay: function(delay, bind, args){
  638. return setTimeout(this.pass((args == null ? [] : args), bind), delay);
  639. },
  640. periodical: function(periodical, bind, args){
  641. return setInterval(this.pass((args == null ? [] : args), bind), periodical);
  642. }
  643. });
  644. //<1.2compat>
  645. //delete Function.prototype.bind;
  646. Function.implement({
  647. create: function(options){
  648. var self = this;
  649. options = options || {};
  650. return function(event){
  651. var args = options.arguments;
  652. args = (args != null) ? Array.convert(args) : Array.slice(arguments, (options.event) ? 1 : 0);
  653. if (options.event) args.unshift(event || window.event);
  654. var returns = function(){
  655. return self.apply(options.bind || null, args);
  656. };
  657. if (options.delay) return setTimeout(returns, options.delay);
  658. if (options.periodical) return setInterval(returns, options.periodical);
  659. if (options.attempt) return Function.attempt(returns);
  660. return returns();
  661. };
  662. },
  663. // bind: function(bind, args){
  664. // var self = this;
  665. // if (args != null) args = Array.convert(args);
  666. // return function(){
  667. // return self.apply(bind, args || arguments);
  668. // };
  669. // },
  670. bindWithEvent: function(bind, args){
  671. var self = this;
  672. if (args != null) args = Array.convert(args);
  673. return function(event){
  674. return self.apply(bind, (args == null) ? arguments : [event].concat(args));
  675. };
  676. },
  677. run: function(args, bind){
  678. return this.apply(bind, Array.convert(args));
  679. }
  680. });
  681. if (Object.create == Function.prototype.create) Object.create = null;
  682. var $try = Function.attempt;
  683. //</1.2compat>
  684. /*
  685. ---
  686. name: Number
  687. description: Contains Number Prototypes like limit, round, times, and ceil.
  688. license: MIT-style license.
  689. requires: Type
  690. provides: Number
  691. ...
  692. */
  693. Number.implement({
  694. limit: function(min, max){
  695. return Math.min(max, Math.max(min, this));
  696. },
  697. round: function(precision){
  698. precision = Math.pow(10, precision || 0).toFixed(precision < 0 ? -precision : 0);
  699. return Math.round(this * precision) / precision;
  700. },
  701. times: function(fn, bind){
  702. for (var i = 0; i < this; i++) fn.call(bind, i, this);
  703. },
  704. toFloat: function(){
  705. return parseFloat(this);
  706. },
  707. toInt: function(base){
  708. return parseInt(this, base || 10);
  709. }
  710. });
  711. Number.alias('each', 'times');
  712. (function(math){
  713. var methods = {};
  714. math.each(function(name){
  715. if (!Number[name]) methods[name] = function(){
  716. return Math[name].apply(null, [this].concat(Array.convert(arguments)));
  717. };
  718. });
  719. Number.implement(methods);
  720. })(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']);
  721. /*
  722. ---
  723. name: String
  724. description: Contains String Prototypes like camelCase, capitalize, test, and toInt.
  725. license: MIT-style license.
  726. requires: [Type, Array]
  727. provides: String
  728. ...
  729. */
  730. String.implement({
  731. //<!ES6>
  732. contains: function(string, index){
  733. return (index ? String(this).slice(index) : String(this)).indexOf(string) > -1;
  734. },
  735. //</!ES6>
  736. test: function(regex, params){
  737. return ((typeOf(regex) == 'regexp') ? regex : new RegExp('' + regex, params)).test(this);
  738. },
  739. trim: function(){
  740. return String(this).replace(/^\s+|\s+$/g, '');
  741. },
  742. clean: function(){
  743. return String(this).replace(/\s+/g, ' ').trim();
  744. },
  745. camelCase: function(){
  746. return String(this).replace(/-\D/g, function(match){
  747. return match.charAt(1).toUpperCase();
  748. });
  749. },
  750. hyphenate: function(){
  751. return String(this).replace(/[A-Z]/g, function(match){
  752. return ('-' + match.charAt(0).toLowerCase());
  753. });
  754. },
  755. capitalize: function(){
  756. return String(this).replace(/\b[a-z]/g, function(match){
  757. return match.toUpperCase();
  758. });
  759. },
  760. escapeRegExp: function(){
  761. return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1');
  762. },
  763. toInt: function(base){
  764. return parseInt(this, base || 10);
  765. },
  766. toFloat: function(){
  767. return parseFloat(this);
  768. },
  769. hexToRgb: function(array){
  770. var hex = String(this).match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
  771. return (hex) ? hex.slice(1).hexToRgb(array) : null;
  772. },
  773. rgbToHex: function(array){
  774. var rgb = String(this).match(/\d{1,3}/g);
  775. return (rgb) ? rgb.rgbToHex(array) : null;
  776. },
  777. substitute: function(object, regexp){
  778. return String(this).replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){
  779. if (match.charAt(0) == '\\') return match.slice(1);
  780. return (object[name] != null) ? object[name] : '';
  781. });
  782. }
  783. });
  784. //<1.4compat>
  785. String.prototype.contains = function(string, separator){
  786. return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : String(this).indexOf(string) > -1;
  787. };
  788. //</1.4compat>
  789. /*
  790. ---
  791. name: Browser
  792. description: The Browser Object. Contains Browser initialization, Window and Document, and the Browser Hash.
  793. license: MIT-style license.
  794. requires: [Array, Function, Number, String]
  795. provides: [Browser, Window, Document]
  796. ...
  797. */
  798. (function(){
  799. var document = this.document;
  800. var window = document.window = this;
  801. var parse = function(ua, platform){
  802. ua = ua.toLowerCase();
  803. platform = (platform ? platform.toLowerCase() : '');
  804. // chrome is included in the edge UA, so need to check for edge first,
  805. // before checking if it's chrome.
  806. var UA = ua.match(/(edge)[\s\/:]([\w\d\.]+)/);
  807. if (!UA){
  808. UA = ua.match(/(opera|ie|firefox|chrome|trident|crios|version)[\s\/:]([\w\d\.]+)?.*?(safari|(?:rv[\s\/:]|version[\s\/:])([\w\d\.]+)|$)/) || [null, 'unknown', 0];
  809. }
  810. if (UA[1] == 'trident'){
  811. UA[1] = 'ie';
  812. if (UA[4]) UA[2] = UA[4];
  813. } else if (UA[1] == 'crios'){
  814. UA[1] = 'chrome';
  815. }
  816. platform = ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android)/) || ua.match(/mac|win|linux/) || ['other'])[0];
  817. if (platform == 'win') platform = 'windows';
  818. return {
  819. extend: Function.prototype.extend,
  820. name: (UA[1] == 'version') ? UA[3] : UA[1],
  821. version: parseFloat((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]),
  822. platform: platform
  823. };
  824. };
  825. var Browser = this.Browser = parse(navigator.userAgent, navigator.platform);
  826. if (Browser.name == 'ie' && document.documentMode){
  827. Browser.version = document.documentMode;
  828. }
  829. Browser.extend({
  830. Features: {
  831. xpath: !!(document.evaluate),
  832. air: !!(window.runtime),
  833. query: !!(document.querySelector),
  834. json: !!(window.JSON)
  835. },
  836. parseUA: parse
  837. });
  838. //<1.4compat>
  839. Browser[Browser.name] = true;
  840. Browser[Browser.name + parseInt(Browser.version, 10)] = true;
  841. if (Browser.name == 'ie' && Browser.version >= '11'){
  842. delete Browser.ie;
  843. }
  844. var platform = Browser.platform;
  845. if (platform == 'windows'){
  846. platform = 'win';
  847. }
  848. Browser.Platform = {
  849. name: platform
  850. };
  851. Browser.Platform[platform] = true;
  852. //</1.4compat>
  853. // Request
  854. Browser.Request = (function(){
  855. var XMLHTTP = function(){
  856. return new XMLHttpRequest();
  857. };
  858. var MSXML2 = function(){
  859. return new ActiveXObject('MSXML2.XMLHTTP');
  860. };
  861. var MSXML = function(){
  862. return new ActiveXObject('Microsoft.XMLHTTP');
  863. };
  864. return Function.attempt(function(){
  865. XMLHTTP();
  866. return XMLHTTP;
  867. }, function(){
  868. MSXML2();
  869. return MSXML2;
  870. }, function(){
  871. MSXML();
  872. return MSXML;
  873. });
  874. })();
  875. Browser.Features.xhr = !!(Browser.Request);
  876. //<1.4compat>
  877. // Flash detection
  878. var version = (Function.attempt(function(){
  879. return navigator.plugins['Shockwave Flash'].description;
  880. }, function(){
  881. return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
  882. }) || '0 r0').match(/\d+/g);
  883. Browser.Plugins = {
  884. Flash: {
  885. version: Number(version[0] || '0.' + version[1]) || 0,
  886. build: Number(version[2]) || 0
  887. }
  888. };
  889. //</1.4compat>
  890. // String scripts
  891. Browser.exec = function(text){
  892. if (!text) return text;
  893. if (window.execScript){
  894. window.execScript(text);
  895. } else {
  896. var script = document.createElement('script');
  897. script.setAttribute('type', 'text/javascript');
  898. script.text = text;
  899. document.head.appendChild(script);
  900. document.head.removeChild(script);
  901. }
  902. return text;
  903. };
  904. String.implement('stripScripts', function(exec){
  905. var scripts = '';
  906. var text = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(all, code){
  907. scripts += code + '\n';
  908. return '';
  909. });
  910. if (exec === true) Browser.exec(scripts);
  911. else if (typeOf(exec) == 'function') exec(scripts, text);
  912. return text;
  913. });
  914. String.implement('stripScriptSrcs', function(exec){
  915. var scripts = '';
  916. var text = this.replace(/<script[^<]src\s*=\s*"([^"]*)[^\]]>/gi, function(all, code){
  917. scripts += code + '\n';
  918. return '';
  919. });
  920. if (exec === true) Browser.exec(scripts);
  921. else if (typeOf(exec) == 'function') exec(scripts, text);
  922. return text;
  923. });
  924. // Window, Document
  925. Browser.extend({
  926. Document: this.Document,
  927. Window: this.Window,
  928. Element: this.Element,
  929. Event: this.Event
  930. });
  931. this.Window = this.$constructor = new Type('Window', function(){});
  932. this.$family = Function.convert('window').hide();
  933. Window.mirror(function(name, method){
  934. window[name] = method;
  935. });
  936. this.Document = document.$constructor = new Type('Document', function(){});
  937. document.$family = Function.convert('document').hide();
  938. Document.mirror(function(name, method){
  939. document[name] = method;
  940. });
  941. document.html = document.documentElement;
  942. if (!document.head) document.head = document.getElementsByTagName('head')[0];
  943. if (document.execCommand) try {
  944. document.execCommand('BackgroundImageCache', false, true);
  945. } catch (e){}
  946. /*<ltIE9>*/
  947. if (this.attachEvent && !this.addEventListener){
  948. var unloadEvent = function(){
  949. this.detachEvent('onunload', unloadEvent);
  950. document.head = document.html = document.window = null;
  951. window = this.Window = document = null;
  952. };
  953. this.attachEvent('onunload', unloadEvent);
  954. }
  955. // IE fails on collections and <select>.options (refers to <select>)
  956. var arrayFrom = Array.convert;
  957. try {
  958. arrayFrom(document.html.childNodes);
  959. } catch (e){
  960. Array.convert = function(item){
  961. if (typeof item != 'string' && Type.isEnumerable(item) && typeOf(item) != 'array'){
  962. var i = item.length, array = new Array(i);
  963. while (i--) array[i] = item[i];
  964. return array;
  965. }
  966. return arrayFrom(item);
  967. };
  968. var prototype = Array.prototype,
  969. slice = prototype.slice;
  970. ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice'].each(function(name){
  971. var method = prototype[name];
  972. Array[name] = function(item){
  973. return method.apply(Array.convert(item), slice.call(arguments, 1));
  974. };
  975. });
  976. }
  977. /*</ltIE9>*/
  978. //<1.2compat>
  979. if (Browser.Platform.ios) Browser.Platform.ipod = true;
  980. Browser.Engine = {};
  981. var setEngine = function(name, version){
  982. Browser.Engine.name = name;
  983. Browser.Engine[name + version] = true;
  984. Browser.Engine.version = version;
  985. };
  986. if (Browser.ie){
  987. Browser.Engine.trident = true;
  988. switch (Browser.version){
  989. case 6: setEngine('trident', 4); break;
  990. case 7: setEngine('trident', 5); break;
  991. case 8: setEngine('trident', 6);
  992. }
  993. }
  994. if (Browser.firefox){
  995. Browser.Engine.gecko = true;
  996. if (Browser.version >= 3) setEngine('gecko', 19);
  997. else setEngine('gecko', 18);
  998. }
  999. if (Browser.safari || Browser.chrome){
  1000. Browser.Engine.webkit = true;
  1001. switch (Browser.version){
  1002. case 2: setEngine('webkit', 419); break;
  1003. case 3: setEngine('webkit', 420); break;
  1004. case 4: setEngine('webkit', 525);
  1005. }
  1006. }
  1007. if (Browser.opera){
  1008. Browser.Engine.presto = true;
  1009. if (Browser.version >= 9.6) setEngine('presto', 960);
  1010. else if (Browser.version >= 9.5) setEngine('presto', 950);
  1011. else setEngine('presto', 925);
  1012. }
  1013. if (Browser.name == 'unknown'){
  1014. switch ((navigator.userAgent.toLowerCase().match(/(?:webkit|khtml|gecko)/) || [])[0]){
  1015. case 'webkit':
  1016. case 'khtml':
  1017. Browser.Engine.webkit = true;
  1018. break;
  1019. case 'gecko':
  1020. Browser.Engine.gecko = true;
  1021. }
  1022. }
  1023. this.$exec = Browser.exec;
  1024. //</1.2compat>
  1025. })();
  1026. /*
  1027. ---
  1028. name: Class
  1029. description: Contains the Class Function for easily creating, extending, and implementing reusable Classes.
  1030. license: MIT-style license.
  1031. requires: [Array, String, Function, Number]
  1032. provides: Class
  1033. ...
  1034. */
  1035. (function(){
  1036. var Class = this.Class = new Type('Class', function(params){
  1037. if (instanceOf(params, Function)) params = {initialize: params};
  1038. var newClass = function(){
  1039. reset(this);
  1040. if (newClass.$prototyping) return this;
  1041. this.$caller = null;
  1042. this.$family = null;
  1043. var value = (this.initialize) ? this.initialize.apply(this, arguments) : this;
  1044. this.$caller = this.caller = null;
  1045. return value;
  1046. }.extend(this).implement(params);
  1047. newClass.$constructor = Class;
  1048. newClass.prototype.$constructor = newClass;
  1049. newClass.prototype.parent = parent;
  1050. return newClass;
  1051. });
  1052. var parent = function(){
  1053. if (!this.$caller) throw new Error('The method "parent" cannot be called.');
  1054. var name = this.$caller.$name,
  1055. parent = this.$caller.$owner.parent,
  1056. previous = (parent) ? parent.prototype[name] : null;
  1057. if (!previous) throw new Error('The method "' + name + '" has no parent.');
  1058. return previous.apply(this, arguments);
  1059. };
  1060. var reset = function(object){
  1061. for (var key in object){
  1062. var value = object[key];
  1063. switch (typeOf(value)){
  1064. case 'object':
  1065. var F = function(){};
  1066. F.prototype = value;
  1067. object[key] = reset(new F);
  1068. break;
  1069. case 'array': object[key] = value.clone(); break;
  1070. }
  1071. }
  1072. return object;
  1073. };
  1074. var wrap = function(self, key, method){
  1075. if (method.$origin) method = method.$origin;
  1076. var wrapper = function(){
  1077. if (method.$protected && this.$caller == null) throw new Error('The method "' + key + '" cannot be called.');
  1078. var caller = this.caller, current = this.$caller;
  1079. this.caller = current; this.$caller = wrapper;
  1080. var result = method.apply(this, arguments);
  1081. this.$caller = current; this.caller = caller;
  1082. return result;
  1083. }.extend({$owner: self, $origin: method, $name: key});
  1084. return wrapper;
  1085. };
  1086. var implement = function(key, value, retain){
  1087. if (Class.Mutators.hasOwnProperty(key)){
  1088. value = Class.Mutators[key].call(this, value);
  1089. if (value == null) return this;
  1090. }
  1091. if (typeOf(value) == 'function'){
  1092. if (value.$hidden) return this;
  1093. this.prototype[key] = (retain) ? value : wrap(this, key, value);
  1094. } else {
  1095. Object.merge(this.prototype, key, value);
  1096. }
  1097. return this;
  1098. };
  1099. var getInstance = function(klass){
  1100. klass.$prototyping = true;
  1101. var proto = new klass;
  1102. delete klass.$prototyping;
  1103. return proto;
  1104. };
  1105. Class.implement('implement', implement.overloadSetter());
  1106. Class.Mutators = {
  1107. Extends: function(parent){
  1108. this.parent = parent;
  1109. this.prototype = getInstance(parent);
  1110. },
  1111. Implements: function(items){
  1112. Array.convert(items).each(function(item){
  1113. var instance = new item;
  1114. for (var key in instance) implement.call(this, key, instance[key], true);
  1115. }, this);
  1116. }
  1117. };
  1118. })();
  1119. /*
  1120. ---
  1121. name: Class.Extras
  1122. description: Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks.
  1123. license: MIT-style license.
  1124. requires: Class
  1125. provides: [Class.Extras, Chain, Events, Options]
  1126. ...
  1127. */
  1128. (function(){
  1129. this.Chain = new Class({
  1130. $chain: [],
  1131. chain: function(){
  1132. this.$chain.append(Array.flatten(arguments));
  1133. return this;
  1134. },
  1135. callChain: function(){
  1136. return (this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false;
  1137. },
  1138. clearChain: function(){
  1139. this.$chain.empty();
  1140. return this;
  1141. }
  1142. });
  1143. var removeOn = function(string){
  1144. return string.replace(/^on([A-Z])/, function(full, first){
  1145. return first.toLowerCase();
  1146. });
  1147. };
  1148. this.Events = new Class({
  1149. $events: {},
  1150. addEvent: function(type, fn, internal){
  1151. type = removeOn(type);
  1152. /*<1.2compat>*/
  1153. if (fn == $empty) return this;
  1154. /*</1.2compat>*/
  1155. this.$events[type] = (this.$events[type] || []).include(fn);
  1156. if (internal) fn.internal = true;
  1157. return this;
  1158. },
  1159. addEvents: function(events){
  1160. for (var type in events) this.addEvent(type, events[type]);
  1161. return this;
  1162. },
  1163. fireEvent: function(type, args, delay){
  1164. type = removeOn(type);
  1165. var events = this.$events[type];
  1166. if (!events) return this;
  1167. args = Array.convert(args);
  1168. events.each(function(fn){
  1169. if (delay) fn.delay(delay, this, args);
  1170. else fn.apply(this, args);
  1171. }, this);
  1172. return this;
  1173. },
  1174. removeEvent: function(type, fn){
  1175. type = removeOn(type);
  1176. var events = this.$events[type];
  1177. if (events && !fn.internal){
  1178. var index = events.indexOf(fn);
  1179. if (index != -1) delete events[index];
  1180. }
  1181. return this;
  1182. },
  1183. removeEvents: function(events){
  1184. var type;
  1185. if (typeOf(events) == 'object'){
  1186. for (type in events) this.removeEvent(type, events[type]);
  1187. return this;
  1188. }
  1189. if (events) events = removeOn(events);
  1190. for (type in this.$events){
  1191. if (events && events != type) continue;
  1192. var fns = this.$events[type];
  1193. for (var i = fns.length; i--;) if (i in fns){
  1194. this.removeEvent(type, fns[i]);
  1195. }
  1196. }
  1197. return this;
  1198. }
  1199. });
  1200. this.Options = new Class({
  1201. setOptions: function(){
  1202. var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments));
  1203. if (this.addEvent) for (var option in options){
  1204. if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue;
  1205. this.addEvent(option, options[option]);
  1206. delete options[option];
  1207. }
  1208. return this;
  1209. }
  1210. });
  1211. })();
  1212. /*
  1213. ---
  1214. name: Class.Thenable
  1215. description: Contains a Utility Class that can be implemented into your own Classes to make them "thenable".
  1216. license: MIT-style license.
  1217. requires: Class
  1218. provides: [Class.Thenable]
  1219. ...
  1220. */
  1221. (function(){
  1222. var STATE_PENDING = 0,
  1223. STATE_FULFILLED = 1,
  1224. STATE_REJECTED = 2;
  1225. var Thenable = Class.Thenable = new Class({
  1226. $thenableState: STATE_PENDING,
  1227. $thenableResult: null,
  1228. $thenableReactions: [],
  1229. resolve: function(value){
  1230. resolve(this, value);
  1231. return this;
  1232. },
  1233. reject: function(reason){
  1234. reject(this, reason);
  1235. return this;
  1236. },
  1237. getThenableState: function(){
  1238. switch (this.$thenableState){
  1239. case STATE_PENDING:
  1240. return 'pending';
  1241. case STATE_FULFILLED:
  1242. return 'fulfilled';
  1243. case STATE_REJECTED:
  1244. return 'rejected';
  1245. }
  1246. },
  1247. resetThenable: function(reason){
  1248. reject(this, reason);
  1249. reset(this);
  1250. return this;
  1251. },
  1252. then: function(onFulfilled, onRejected){
  1253. if (typeof onFulfilled !== 'function') onFulfilled = 'Identity';
  1254. if (typeof onRejected !== 'function') onRejected = 'Thrower';
  1255. var thenable = new Thenable();
  1256. this.$thenableReactions.push({
  1257. thenable: thenable,
  1258. fulfillHandler: onFulfilled,
  1259. rejectHandler: onRejected
  1260. });
  1261. if (this.$thenableState !== STATE_PENDING){
  1262. react(this);
  1263. }
  1264. return thenable;
  1265. },
  1266. 'catch': function(onRejected){
  1267. return this.then(null, onRejected);
  1268. }
  1269. });
  1270. Thenable.extend({
  1271. resolve: function(value){
  1272. var thenable;
  1273. if (value instanceof Thenable){
  1274. thenable = value;
  1275. } else {
  1276. thenable = new Thenable();
  1277. resolve(thenable, value);
  1278. }
  1279. return thenable;
  1280. },
  1281. reject: function(reason){
  1282. var thenable = new Thenable();
  1283. reject(thenable, reason);
  1284. return thenable;
  1285. }
  1286. });
  1287. // Private functions
  1288. function resolve(thenable, value){
  1289. if (thenable.$thenableState === STATE_PENDING){
  1290. if (thenable === value){
  1291. reject(thenable, new TypeError('Tried to resolve a thenable with itself.'));
  1292. } else if (value && (typeof value === 'object' || typeof value === 'function')){
  1293. var then;
  1294. try {
  1295. then = value.then;
  1296. } catch (exception){
  1297. reject(thenable, exception);
  1298. }
  1299. if (typeof then === 'function'){
  1300. var resolved = false;
  1301. defer(function(){
  1302. try {
  1303. then.call(
  1304. value,
  1305. function(nextValue){
  1306. if (!resolved){
  1307. resolved = true;
  1308. resolve(thenable, nextValue);
  1309. }
  1310. },
  1311. function(reason){
  1312. if (!resolved){
  1313. resolved = true;
  1314. reject(thenable, reason);
  1315. }
  1316. }
  1317. );
  1318. } catch (exception){
  1319. if (!resolved){
  1320. resolved = true;
  1321. reject(thenable, exception);
  1322. }
  1323. }
  1324. });
  1325. } else {
  1326. fulfill(thenable, value);
  1327. }
  1328. } else {
  1329. fulfill(thenable, value);
  1330. }
  1331. }
  1332. }
  1333. function fulfill(thenable, value){
  1334. if (thenable.$thenableState === STATE_PENDING){
  1335. thenable.$thenableResult = value;
  1336. thenable.$thenableState = STATE_FULFILLED;
  1337. react(thenable);
  1338. }
  1339. }
  1340. function reject(thenable, reason){
  1341. if (thenable.$thenableState === STATE_PENDING){
  1342. thenable.$thenableResult = reason;
  1343. thenable.$thenableState = STATE_REJECTED;
  1344. react(thenable);
  1345. }
  1346. }
  1347. function reset(thenable){
  1348. if (thenable.$thenableState !== STATE_PENDING){
  1349. thenable.$thenableResult = null;
  1350. thenable.$thenableState = STATE_PENDING;
  1351. }
  1352. }
  1353. function react(thenable){
  1354. var state = thenable.$thenableState,
  1355. result = thenable.$thenableResult,
  1356. reactions = thenable.$thenableReactions,
  1357. type;
  1358. if (state === STATE_FULFILLED){
  1359. thenable.$thenableReactions = [];
  1360. type = 'fulfillHandler';
  1361. } else if (state == STATE_REJECTED){
  1362. thenable.$thenableReactions = [];
  1363. type = 'rejectHandler';
  1364. }
  1365. if (type){
  1366. defer(handle.pass([result, reactions, type]));
  1367. }
  1368. }
  1369. function handle(result, reactions, type){
  1370. for (var i = 0, l = reactions.length; i < l; ++i){
  1371. var reaction = reactions[i],
  1372. handler = reaction[type];
  1373. if (handler === 'Identity'){
  1374. resolve(reaction.thenable, result);
  1375. } else if (handler === 'Thrower'){
  1376. reject(reaction.thenable, result);
  1377. } else {
  1378. try {
  1379. resolve(reaction.thenable, handler(result));
  1380. } catch (exception){
  1381. reject(reaction.thenable, exception);
  1382. }
  1383. }
  1384. }
  1385. }
  1386. var defer;
  1387. if (typeof process !== 'undefined' && typeof process.nextTick === 'function'){
  1388. defer = process.nextTick;
  1389. } else if (typeof setImmediate !== 'undefined'){
  1390. defer = setImmediate;
  1391. } else {
  1392. defer = function(fn){
  1393. setTimeout(fn, 0);
  1394. };
  1395. }
  1396. })();
  1397. /*
  1398. ---
  1399. name: Object
  1400. description: Object generic methods
  1401. license: MIT-style license.
  1402. requires: Type
  1403. provides: [Object, Hash]
  1404. ...
  1405. */
  1406. (function(){
  1407. Object.extend({
  1408. subset: function(object, keys){
  1409. var results = {};
  1410. for (var i = 0, l = keys.length; i < l; i++){
  1411. var k = keys[i];
  1412. if (k in object) results[k] = object[k];
  1413. }
  1414. return results;
  1415. },
  1416. map: function(object, fn, bind){
  1417. var results = {};
  1418. var keys = Object.keys(object);
  1419. for (var i = 0; i < keys.length; i++){
  1420. var key = keys[i];
  1421. results[key] = fn.call(bind, object[key], key, object);
  1422. }
  1423. return results;
  1424. },
  1425. filter: function(object, fn, bind){
  1426. var results = {};
  1427. var keys = Object.keys(object);
  1428. for (var i = 0; i < keys.length; i++){
  1429. var key = keys[i], value = object[key];
  1430. if (fn.call(bind, value, key, object)) results[key] = value;
  1431. }
  1432. return results;
  1433. },
  1434. every: function(object, fn, bind){
  1435. var keys = Object.keys(object);
  1436. for (var i = 0; i < keys.length; i++){
  1437. var key = keys[i];
  1438. if (!fn.call(bind, object[key], key)) return false;
  1439. }
  1440. return true;
  1441. },
  1442. some: function(object, fn, bind){
  1443. var keys = Object.keys(object);
  1444. for (var i = 0; i < keys.length; i++){
  1445. var key = keys[i];
  1446. if (fn.call(bind, object[key], key)) return true;
  1447. }
  1448. return false;
  1449. },
  1450. values: function(object){
  1451. var values = [];
  1452. var keys = Object.keys(object);
  1453. for (var i = 0; i < keys.length; i++){
  1454. var k = keys[i];
  1455. values.push(object[k]);
  1456. }
  1457. return values;
  1458. },
  1459. getLength: function(object){
  1460. return Object.keys(object).length;
  1461. },
  1462. keyOf: function(object, value){
  1463. var keys = Object.keys(object);
  1464. for (var i = 0; i < keys.length; i++){
  1465. var key = keys[i];
  1466. if (object[key] === value) return key;
  1467. }
  1468. return null;
  1469. },
  1470. contains: function(object, value){
  1471. return Object.keyOf(object, value) != null;
  1472. },
  1473. toQueryString: function(object, base){
  1474. var queryString = [];
  1475. Object.each(object, function(value, key){
  1476. if (base) key = base + '[' + key + ']';
  1477. var result;
  1478. switch (typeOf(value)){
  1479. case 'object': result = Object.toQueryString(value, key); break;
  1480. case 'array':
  1481. var qs = {};
  1482. value.each(function(val, i){
  1483. qs[i] = val;
  1484. });
  1485. result = Object.toQueryString(qs, key);
  1486. break;
  1487. default: result = key + '=' + encodeURIComponent(value);
  1488. }
  1489. if (value != null) queryString.push(result);
  1490. });
  1491. return queryString.join('&');
  1492. }
  1493. });
  1494. })();
  1495. //<1.2compat>
  1496. Hash.implement({
  1497. has: Object.prototype.hasOwnProperty,
  1498. keyOf: function(value){
  1499. return Object.keyOf(this, value);
  1500. },
  1501. hasValue: function(value){
  1502. return Object.contains(this, value);
  1503. },
  1504. extend: function(properties){
  1505. Hash.each(properties || {}, function(value, key){
  1506. Hash.set(this, key, value);
  1507. }, this);
  1508. return this;
  1509. },
  1510. combine: function(properties){
  1511. Hash.each(properties || {}, function(value, key){
  1512. Hash.include(this, key, value);
  1513. }, this);
  1514. return this;
  1515. },
  1516. erase: function(key){
  1517. if (this.hasOwnProperty(key)) delete this[key];
  1518. return this;
  1519. },
  1520. get: function(key){
  1521. return (this.hasOwnProperty(key)) ? this[key] : null;
  1522. },
  1523. set: function(key, value){
  1524. if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
  1525. return this;
  1526. },
  1527. empty: function(){
  1528. Hash.each(this, function(value, key){
  1529. delete this[key];
  1530. }, this);
  1531. return this;
  1532. },
  1533. include: function(key, value){
  1534. if (this[key] == null) this[key] = value;
  1535. return this;
  1536. },
  1537. map: function(fn, bind){
  1538. return new Hash(Object.map(this, fn, bind));
  1539. },
  1540. filter: function(fn, bind){
  1541. return new Hash(Object.filter(this, fn, bind));
  1542. },
  1543. every: function(fn, bind){
  1544. return Object.every(this, fn, bind);
  1545. },
  1546. some: function(fn, bind){
  1547. return Object.some(this, fn, bind);
  1548. },
  1549. getKeys: function(){
  1550. return Object.keys(this);
  1551. },
  1552. getValues: function(){
  1553. return Object.values(this);
  1554. },
  1555. toQueryString: function(base){
  1556. return Object.toQueryString(this, base);
  1557. }
  1558. });
  1559. Hash.extend = Object.append;
  1560. Hash.alias({indexOf: 'keyOf', contains: 'hasValue'});
  1561. //</1.2compat>
  1562. /*
  1563. ---
  1564. name: Slick.Parser
  1565. description: Standalone CSS3 Selector parser
  1566. provides: Slick.Parser
  1567. ...
  1568. */
  1569. ;(function(){
  1570. var parsed,
  1571. separatorIndex,
  1572. combinatorIndex,
  1573. reversed,
  1574. cache = {},
  1575. reverseCache = {},
  1576. reUnescape = /\\/g;
  1577. var parse = function(expression, isReversed){
  1578. if (expression == null) return null;
  1579. if (expression.Slick === true) return expression;
  1580. expression = ('' + expression).replace(/^\s+|\s+$/g, '');
  1581. reversed = !!isReversed;
  1582. var currentCache = (reversed) ? reverseCache : cache;
  1583. if (currentCache[expression]) return currentCache[expression];
  1584. parsed = {
  1585. Slick: true,
  1586. expressions: [],
  1587. raw: expression,
  1588. reverse: function(){
  1589. return parse(this.raw, true);
  1590. }
  1591. };
  1592. separatorIndex = -1;
  1593. while (expression != (expression = expression.replace(regexp, parser)));
  1594. parsed.length = parsed.expressions.length;
  1595. return currentCache[parsed.raw] = (reversed) ? reverse(parsed) : parsed;
  1596. };
  1597. var reverseCombinator = function(combinator){
  1598. if (combinator === '!') return ' ';
  1599. else if (combinator === ' ') return '!';
  1600. else if ((/^!/).test(combinator)) return combinator.replace(/^!/, '');
  1601. else return '!' + combinator;
  1602. };
  1603. var reverse = function(expression){
  1604. var expressions = expression.expressions;
  1605. for (var i = 0; i < expressions.length; i++){
  1606. var exp = expressions[i];
  1607. var last = {parts: [], tag: '*', combinator: reverseCombinator(exp[0].combinator)};
  1608. for (var j = 0; j < exp.length; j++){
  1609. var cexp = exp[j];
  1610. if (!cexp.reverseCombinator) cexp.reverseCombinator = ' ';
  1611. cexp.combinator = cexp.reverseCombinator;
  1612. delete cexp.reverseCombinator;
  1613. }
  1614. exp.reverse().push(last);
  1615. }
  1616. return expression;
  1617. };
  1618. var escapeRegExp = function(string){// Credit: XRegExp 0.6.1 (c) 2007-2008 Steven Levithan <http://stevenlevithan.com/regex/xregexp/> MIT License
  1619. return string.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, function(match){
  1620. return '\\' + match;
  1621. });
  1622. };
  1623. var regexp = new RegExp(
  1624. /*
  1625. #!/usr/bin/env ruby
  1626. puts "\t\t" + DATA.read.gsub(/\(\?x\)|\s+#.*$|\s+|\\$|\\n/,'')
  1627. __END__
  1628. "(?x)^(?:\
  1629. \\s* ( , ) \\s* # Separator \n\
  1630. | \\s* ( <combinator>+ ) \\s* # Combinator \n\
  1631. | ( \\s+ ) # CombinatorChildren \n\
  1632. | ( <unicode>+ | \\* ) # Tag \n\
  1633. | \\# ( <unicode>+ ) # ID \n\
  1634. | \\. ( <unicode>+ ) # ClassName \n\
  1635. | # Attribute \n\
  1636. \\[ \
  1637. \\s* (<unicode1>+) (?: \
  1638. \\s* ([*^$!~|]?=) (?: \
  1639. \\s* (?:\
  1640. ([\"']?)(.*?)\\9 \
  1641. )\
  1642. ) \
  1643. )? \\s* \
  1644. \\](?!\\]) \n\
  1645. | :+ ( <unicode>+ )(?:\
  1646. \\( (?:\
  1647. (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\
  1648. ) \\)\
  1649. )?\
  1650. )"
  1651. */
  1652. "^(?:\\s*(,)\\s*|\\s*(<combinator>+)\\s*|(\\s+)|(<unicode>+|\\*)|\\#(<unicode>+)|\\.(<unicode>+)|\\[\\s*(<unicode1>+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(<unicode>+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)"
  1653. .replace(/<combinator>/, '[' + escapeRegExp('>+~`!@$%^&={}\\;</') + ']')
  1654. .replace(/<unicode>/g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])')
  1655. .replace(/<unicode1>/g, '(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])')
  1656. );
  1657. function parser(
  1658. rawMatch,
  1659. separator,
  1660. combinator,
  1661. combinatorChildren,
  1662. tagName,
  1663. id,
  1664. className,
  1665. attributeKey,
  1666. attributeOperator,
  1667. attributeQuote,
  1668. attributeValue,
  1669. pseudoMarker,
  1670. pseudoClass,
  1671. pseudoQuote,
  1672. pseudoClassQuotedValue,
  1673. pseudoClassValue
  1674. ){
  1675. if (separator || separatorIndex === -1){
  1676. parsed.expressions[++separatorIndex] = [];
  1677. combinatorIndex = -1;
  1678. if (separator) return '';
  1679. }
  1680. if (combinator || combinatorChildren || combinatorIndex === -1){
  1681. combinator = combinator || ' ';
  1682. var currentSeparator = parsed.expressions[separatorIndex];
  1683. if (reversed && currentSeparator[combinatorIndex])
  1684. currentSeparator[combinatorIndex].reverseCombinator = reverseCombinator(combinator);
  1685. currentSeparator[++combinatorIndex] = {combinator: combinator, tag: '*'};
  1686. }
  1687. var currentParsed = parsed.expressions[separatorIndex][combinatorIndex];
  1688. if (tagName){
  1689. currentParsed.tag = tagName.replace(reUnescape, '');
  1690. } else if (id){
  1691. currentParsed.id = id.replace(reUnescape, '');
  1692. } else if (className){
  1693. className = className.replace(reUnescape, '');
  1694. if (!currentParsed.classList) currentParsed.classList = [];
  1695. if (!currentParsed.classes) currentParsed.classes = [];
  1696. currentParsed.classList.push(className);
  1697. currentParsed.classes.push({
  1698. value: className,
  1699. regexp: new RegExp('(^|\\s)' + escapeRegExp(className) + '(\\s|$)')
  1700. });
  1701. } else if (pseudoClass){
  1702. pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue;
  1703. pseudoClassValue = pseudoClassValue ? pseudoClassValue.replace(reUnescape, '') : null;
  1704. if (!currentParsed.pseudos) currentParsed.pseudos = [];
  1705. currentParsed.pseudos.push({
  1706. key: pseudoClass.replace(reUnescape, ''),
  1707. value: pseudoClassValue,
  1708. type: pseudoMarker.length == 1 ? 'class' : 'element'
  1709. });
  1710. } else if (attributeKey){
  1711. attributeKey = attributeKey.replace(reUnescape, '');
  1712. attributeValue = (attributeValue || '').replace(reUnescape, '');
  1713. var test, regexp;
  1714. switch (attributeOperator){
  1715. case '^=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) ); break;
  1716. case '$=' : regexp = new RegExp( escapeRegExp(attributeValue) +'$' ); break;
  1717. case '~=' : regexp = new RegExp( '(^|\\s)'+ escapeRegExp(attributeValue) +'(\\s|$)' ); break;
  1718. case '|=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) +'(-|$)' ); break;
  1719. case '=' : test = function(value){
  1720. return attributeValue == value;
  1721. }; break;
  1722. case '*=' : test = function(value){
  1723. return value && value.indexOf(attributeValue) > -1;
  1724. }; break;
  1725. case '!=' : test = function(value){
  1726. return attributeValue != value;
  1727. }; break;
  1728. default : test = function(value){
  1729. return !!value;
  1730. };
  1731. }
  1732. if (attributeValue == '' && (/^[*$^]=$/).test(attributeOperator)) test = function(){
  1733. return false;
  1734. };
  1735. if (!test) test = function(value){
  1736. return value && regexp.test(value);
  1737. };
  1738. if (!currentParsed.attributes) currentParsed.attributes = [];
  1739. currentParsed.attributes.push({
  1740. key: attributeKey,
  1741. operator: attributeOperator,
  1742. value: attributeValue,
  1743. test: test
  1744. });
  1745. }
  1746. return '';
  1747. };
  1748. // Slick NS
  1749. var Slick = (this.Slick || {});
  1750. Slick.parse = function(expression){
  1751. return parse(expression);
  1752. };
  1753. Slick.escapeRegExp = escapeRegExp;
  1754. if (!this.Slick) this.Slick = Slick;
  1755. }).apply(/*<CommonJS>*/(typeof exports != 'undefined') ? exports : /*</CommonJS>*/this);
  1756. /*
  1757. ---
  1758. name: Slick.Finder
  1759. description: The new, superfast css selector engine.
  1760. provides: Slick.Finder
  1761. requires: Slick.Parser
  1762. ...
  1763. */
  1764. ;(function(){
  1765. var local = {},
  1766. featuresCache = {},
  1767. toString = Object.prototype.toString;
  1768. // Feature / Bug detection
  1769. local.isNativeCode = function(fn){
  1770. return (/\{\s*\[native code\]\s*\}/).test('' + fn);
  1771. };
  1772. local.isXML = function(document){
  1773. return (!!document.xmlVersion) || (!!document.xml) || (toString.call(document) == '[object XMLDocument]') ||
  1774. (document.nodeType == 9 && document.documentElement.nodeName != 'HTML');
  1775. };
  1776. local.setDocument = function(document){
  1777. // convert elements / window arguments to document. if document cannot be extrapolated, the function returns.
  1778. var nodeType = document.nodeType;
  1779. if (nodeType == 9); // document
  1780. else if (nodeType) document = document.ownerDocument; // node
  1781. else if (document.navigator) document = document.document; // window
  1782. else return;
  1783. // check if it's the old document
  1784. if (this.document === document) return;
  1785. this.document = document;
  1786. // check if we have done feature detection on this document before
  1787. var root = document.documentElement,
  1788. rootUid = this.getUIDXML(root),
  1789. features = featuresCache[rootUid],
  1790. feature;
  1791. if (features){
  1792. for (feature in features){
  1793. this[feature] = features[feature];
  1794. }
  1795. return;
  1796. }
  1797. features = featuresCache[rootUid] = {};
  1798. features.root = root;
  1799. features.isXMLDocument = this.isXML(document);
  1800. features.brokenStarGEBTN
  1801. = features.starSelectsClosedQSA
  1802. = features.idGetsName
  1803. = features.brokenMixedCaseQSA
  1804. = features.brokenGEBCN
  1805. = features.brokenCheckedQSA
  1806. = features.brokenEmptyAttributeQSA
  1807. = features.isHTMLDocument
  1808. = features.nativeMatchesSelector
  1809. = false;
  1810. var starSelectsClosed, starSelectsComments,
  1811. brokenSecondClassNameGEBCN, cachedGetElementsByClassName,
  1812. brokenFormAttributeGetter;
  1813. var selected, id = 'slick_uniqueid';
  1814. var testNode = document.createElement('div');
  1815. var testRoot = document.body || document.getElementsByTagName('body')[0] || root;
  1816. testRoot.appendChild(testNode);
  1817. // on non-HTML documents innerHTML and getElementsById doesnt work properly
  1818. try {
  1819. testNode.innerHTML = '<a id="'+id+'"></a>';
  1820. features.isHTMLDocument = !!document.getElementById(id);
  1821. } catch (e){}
  1822. if (features.isHTMLDocument){
  1823. testNode.style.display = 'none';
  1824. // IE returns comment nodes for getElementsByTagName('*') for some documents
  1825. testNode.appendChild(document.createComment(''));
  1826. starSelectsComments = (testNode.getElementsByTagName('*').length > 1);
  1827. // IE returns closed nodes (EG:"</foo>") for getElementsByTagName('*') for some documents
  1828. try {
  1829. testNode.innerHTML = 'foo</foo>';
  1830. selected = testNode.getElementsByTagName('*');
  1831. starSelectsClosed = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/');
  1832. } catch (e){};
  1833. features.brokenStarGEBTN = starSelectsComments || starSelectsClosed;
  1834. // IE returns elements with the name instead of just id for getElementsById for some documents
  1835. try {
  1836. testNode.innerHTML = '<a name="'+ id +'"></a><b id="'+ id +'"></b>';
  1837. features.idGetsName = document.getElementById(id) === testNode.firstChild;
  1838. } catch (e){}
  1839. if (testNode.getElementsByClassName){
  1840. // Safari 3.2 getElementsByClassName caches results
  1841. try {
  1842. testNode.innerHTML = '<a class="f"></a><a class="b"></a>';
  1843. testNode.getElementsByClassName('b').length;
  1844. testNode.firstChild.className = 'b';
  1845. cachedGetElementsByClassName = (testNode.getElementsByClassName('b').length != 2);
  1846. } catch (e){};
  1847. // Opera 9.6 getElementsByClassName doesnt detects the class if its not the first one
  1848. try {
  1849. testNode.innerHTML = '<a class="a"></a><a class="f b a"></a>';
  1850. brokenSecondClassNameGEBCN = (testNode.getElementsByClassName('a').length != 2);
  1851. } catch (e){}
  1852. features.brokenGEBCN = cachedGetElementsByClassName || brokenSecondClassNameGEBCN;
  1853. }
  1854. if (testNode.querySelectorAll){
  1855. // IE 8 returns closed nodes (EG:"</foo>") for querySelectorAll('*') for some documents
  1856. try {
  1857. testNode.innerHTML = 'foo</foo>';
  1858. selected = testNode.querySelectorAll('*');
  1859. features.starSelectsClosedQSA = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/');
  1860. } catch (e){}
  1861. // Safari 3.2 querySelectorAll doesnt work with mixedcase on quirksmode
  1862. try {
  1863. testNode.innerHTML = '<a class="MiX"></a>';
  1864. features.brokenMixedCaseQSA = !testNode.querySelectorAll('.MiX').length;
  1865. } catch (e){}
  1866. // Webkit and Opera dont return selected options on querySelectorAll
  1867. try {
  1868. testNode.innerHTML = '<select><option selected="selected">a</option></select>';
  1869. features.brokenCheckedQSA = (testNode.querySelectorAll(':checked').length == 0);
  1870. } catch (e){};
  1871. // IE returns incorrect results for attr[*^$]="" selectors on querySelectorAll
  1872. try {
  1873. testNode.innerHTML = '<a class=""></a>';
  1874. features.brokenEmptyAttributeQSA = (testNode.querySelectorAll('[class*=""]').length != 0);
  1875. } catch (e){}
  1876. }
  1877. // IE6-7, if a form has an input of id x, form.getAttribute(x) returns a reference to the input
  1878. try {
  1879. testNode.innerHTML = '<form action="s"><input id="action"/></form>';
  1880. brokenFormAttributeGetter = (testNode.firstChild.getAttribute('action') != 's');
  1881. } catch (e){}
  1882. // native matchesSelector function
  1883. features.nativeMatchesSelector = root.matches || /*root.msMatchesSelector ||*/ root.mozMatchesSelector || root.webkitMatchesSelector;
  1884. if (features.nativeMatchesSelector) try {
  1885. // if matchesSelector trows errors on incorrect sintaxes we can use it
  1886. features.nativeMatchesSelector.call(root, ':slick');
  1887. features.nativeMatchesSelector = null;
  1888. } catch (e){}
  1889. }
  1890. try {
  1891. root.slick_expando = 1;
  1892. delete root.slick_expando;
  1893. features.getUID = this.getUIDHTML;
  1894. } catch (e){
  1895. features.getUID = this.getUIDXML;
  1896. }
  1897. testRoot.removeChild(testNode);
  1898. testNode = selected = testRoot = null;
  1899. // getAttribute
  1900. features.getAttribute = (features.isHTMLDocument && brokenFormAttributeGetter) ? function(node, name){
  1901. var method = this.attributeGetters[name];
  1902. if (method) return method.call(node);
  1903. var attributeNode = node.getAttributeNode(name);
  1904. return (attributeNode) ? attributeNode.nodeValue : null;
  1905. } : function(node, name){
  1906. var method = this.attributeGetters[name];
  1907. return (method) ? method.call(node) : node.getAttribute(name);
  1908. };
  1909. // hasAttribute
  1910. features.hasAttribute = (root && this.isNativeCode(root.hasAttribute)) ? function(node, attribute){
  1911. return node.hasAttribute(attribute);
  1912. } : function(node, attribute){
  1913. node = node.getAttributeNode(attribute);
  1914. return !!(node && (node.specified || node.nodeValue));
  1915. };
  1916. // contains
  1917. // FIXME: Add specs: local.contains should be different for xml and html documents?
  1918. var nativeRootContains = root && this.isNativeCode(root.contains),
  1919. nativeDocumentContains = document && this.isNativeCode(document.contains);
  1920. features.contains = (nativeRootContains && nativeDocumentContains) ? function(context, node){
  1921. return context.contains(node);
  1922. } : (nativeRootContains && !nativeDocumentContains) ? function(context, node){
  1923. // IE8 does not have .contains on document.
  1924. return context === node || ((context === document) ? document.documentElement : context).contains(node);
  1925. } : (root && root.compareDocumentPosition) ? function(context, node){
  1926. return context === node || !!(context.compareDocumentPosition(node) & 16);
  1927. } : function(context, node){
  1928. if (node) do {
  1929. if (node === context) return true;
  1930. } while ((node = node.parentNode));
  1931. return false;
  1932. };
  1933. // document order sorting
  1934. // credits to Sizzle (http://sizzlejs.com/)
  1935. features.documentSorter = (root.compareDocumentPosition) ? function(a, b){
  1936. if (!a.compareDocumentPosition || !b.compareDocumentPosition) return 0;
  1937. return a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
  1938. } : ('sourceIndex' in root) ? function(a, b){
  1939. if (!a.sourceIndex || !b.sourceIndex) return 0;
  1940. return a.sourceIndex - b.sourceIndex;
  1941. } : (document.createRange) ? function(a, b){
  1942. if (!a.ownerDocument || !b.ownerDocument) return 0;
  1943. var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
  1944. aRange.setStart(a, 0);
  1945. aRange.setEnd(a, 0);
  1946. bRange.setStart(b, 0);
  1947. bRange.setEnd(b, 0);
  1948. return aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
  1949. } : null;
  1950. root = null;
  1951. for (feature in features){
  1952. this[feature] = features[feature];
  1953. }
  1954. };
  1955. // Main Method
  1956. var reSimpleSelector = /^([#.]?)((?:[\w-]+|\*))$/,
  1957. reEmptyAttribute = /\[.+[*$^]=(?:""|'')?\]/,
  1958. qsaFailExpCache = {};
  1959. local.search = function(context, expression, append, first){
  1960. var found = this.found = (first) ? null : (append || []);
  1961. if (!context) return found;
  1962. else if (context.navigator) context = context.document; // Convert the node from a window to a document
  1963. else if (!context.nodeType) return found;
  1964. // setup
  1965. var parsed, i, node, nodes,
  1966. uniques = this.uniques = {},
  1967. hasOthers = !!(append && append.length),
  1968. contextIsDocument = (context.nodeType == 9);
  1969. if (this.document !== (contextIsDocument ? context : context.ownerDocument)) this.setDocument(context);
  1970. // avoid duplicating items already in the append array
  1971. if (hasOthers) for (i = found.length; i--;) uniques[this.getUID(found[i])] = true;
  1972. // expression checks
  1973. if (typeof expression == 'string'){ // expression is a string
  1974. /*<simple-selectors-override>*/
  1975. var simpleSelector = expression.match(reSimpleSelector);
  1976. simpleSelectors: if (simpleSelector){
  1977. var symbol = simpleSelector[1],
  1978. name = simpleSelector[2];
  1979. if (!symbol){
  1980. if (name == '*' && this.brokenStarGEBTN) break simpleSelectors;
  1981. nodes = context.getElementsByTagName(name);
  1982. if (first) return nodes[0] || null;
  1983. for (i = 0; node = nodes[i++];){
  1984. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1985. }
  1986. } else if (symbol == '#'){
  1987. if (!this.isHTMLDocument || !contextIsDocument) break simpleSelectors;
  1988. node = context.getElementById(name);
  1989. if (!node) return found;
  1990. if (this.idGetsName && node.getAttributeNode('id').nodeValue != name) break simpleSelectors;
  1991. if (first) return node || null;
  1992. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  1993. } else if (symbol == '.'){
  1994. if (!this.isHTMLDocument || ((!context.getElementsByClassName || this.brokenGEBCN) && context.querySelectorAll)) break simpleSelectors;
  1995. if (context.getElementsByClassName && !this.brokenGEBCN){
  1996. nodes = context.getElementsByClassName(name);
  1997. if (first) return nodes[0] || null;
  1998. for (i = 0; node = nodes[i++];){
  1999. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  2000. }
  2001. } else {
  2002. var matchClass = new RegExp('(^|\\s)'+ Slick.escapeRegExp(name) +'(\\s|$)');
  2003. nodes = context.getElementsByTagName('*');
  2004. for (i = 0; node = nodes[i++];){
  2005. className = node.className;
  2006. if (!(className && matchClass.test(className))) continue;
  2007. if (first) return node;
  2008. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  2009. }
  2010. }
  2011. }
  2012. if (hasOthers) this.sort(found);
  2013. return (first) ? null : found;
  2014. }
  2015. /*</simple-selectors-override>*/
  2016. /*<query-selector-override>*/
  2017. querySelector: if (context.querySelectorAll){
  2018. if (!this.isHTMLDocument
  2019. || qsaFailExpCache[expression]
  2020. //TODO: only skip when expression is actually mixed case
  2021. || this.brokenMixedCaseQSA
  2022. || (this.brokenCheckedQSA && expression.indexOf(':checked') > -1)
  2023. || (this.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression))
  2024. || (!contextIsDocument //Abort when !contextIsDocument and...
  2025. // there are multiple expressions in the selector
  2026. // since we currently only fix non-document rooted QSA for single expression selectors
  2027. && expression.indexOf(',') > -1
  2028. )
  2029. || Slick.disableQSA
  2030. ) break querySelector;
  2031. var _expression = expression, _context = context, currentId;
  2032. if (!contextIsDocument){
  2033. // non-document rooted QSA
  2034. // credits to Andrew Dupont
  2035. currentId = _context.getAttribute('id'), slickid = 'slickid__';
  2036. _context.setAttribute('id', slickid);
  2037. _expression = '#' + slickid + ' ' + _expression;
  2038. context = _context.parentNode;
  2039. }
  2040. try {
  2041. if (first) return context.querySelector(_expression) || null;
  2042. else nodes = context.querySelectorAll(_expression);
  2043. } catch (e){
  2044. qsaFailExpCache[expression] = 1;
  2045. break querySelector;
  2046. } finally {
  2047. if (!contextIsDocument){
  2048. if (currentId) _context.setAttribute('id', currentId);
  2049. else _context.removeAttribute('id');
  2050. context = _context;
  2051. }
  2052. }
  2053. if (this.starSelectsClosedQSA) for (i = 0; node = nodes[i++];){
  2054. if (node.nodeName > '@' && !(hasOthers && uniques[this.getUID(node)])) found.push(node);
  2055. } else for (i = 0; node = nodes[i++];){
  2056. if (!(hasOthers && uniques[this.getUID(node)])) found.push(node);
  2057. }
  2058. if (hasOthers) this.sort(found);
  2059. return found;
  2060. }
  2061. /*</query-selector-override>*/
  2062. parsed = this.Slick.parse(expression);
  2063. if (!parsed.length) return found;
  2064. } else if (expression == null){ // there is no expression
  2065. return found;
  2066. } else if (expression.Slick){ // expression is a parsed Slick object
  2067. parsed = expression;
  2068. } else if (this.contains(context.documentElement || context, expression)){ // expression is a node
  2069. (found) ? found.push(expression) : found = expression;
  2070. return found;
  2071. } else { // other junk
  2072. return found;
  2073. }
  2074. /*<pseudo-selectors>*//*<nth-pseudo-selectors>*/
  2075. // cache elements for the nth selectors
  2076. this.posNTH = {};
  2077. this.posNTHLast = {};
  2078. this.posNTHType = {};
  2079. this.posNTHTypeLast = {};
  2080. /*</nth-pseudo-selectors>*//*</pseudo-selectors>*/
  2081. // if append is null and there is only a single selector with one expression use pushArray, else use pushUID
  2082. this.push = (!hasOthers && (first || (parsed.length == 1 && parsed.expressions[0].length == 1))) ? this.pushArray : this.pushUID;
  2083. if (found == null) found = [];
  2084. // default engine
  2085. var j, m, n;
  2086. var combinator, tag, id, classList, classes, attributes, pseudos;
  2087. var currentItems, currentExpression, currentBit, lastBit, expressions = parsed.expressions;
  2088. search: for (i = 0; (currentExpression = expressions[i]); i++) for (j = 0; (currentBit = currentExpression[j]); j++){
  2089. combinator = 'combinator:' + currentBit.combinator;
  2090. if (!this[combinator]) continue search;
  2091. tag = (this.isXMLDocument) ? currentBit.tag : currentBit.tag.toUpperCase();
  2092. id = currentBit.id;
  2093. classList = currentBit.classList;
  2094. classes = currentBit.classes;
  2095. attributes = currentBit.attributes;
  2096. pseudos = currentBit.pseudos;
  2097. lastBit = (j === (currentExpression.length - 1));
  2098. this.bitUniques = {};
  2099. if (lastBit){
  2100. this.uniques = uniques;
  2101. this.found = found;
  2102. } else {
  2103. this.uniques = {};
  2104. this.found = [];
  2105. }
  2106. if (j === 0){
  2107. this[combinator](context, tag, id, classes, attributes, pseudos, classList);
  2108. if (first && lastBit && found.length) break search;
  2109. } else {
  2110. if (first && lastBit) for (m = 0, n = currentItems.length; m < n; m++){
  2111. this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList);
  2112. if (found.length) break search;
  2113. } else for (m = 0, n = currentItems.length; m < n; m++) this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList);
  2114. }
  2115. currentItems = this.found;
  2116. }
  2117. // should sort if there are nodes in append and if you pass multiple expressions.
  2118. if (hasOthers || (parsed.expressions.length > 1)) this.sort(found);
  2119. return (first) ? (found[0] || null) : found;
  2120. };
  2121. // Utils
  2122. local.uidx = 1;
  2123. local.uidk = 'slick-uniqueid';
  2124. local.getUIDXML = function(node){
  2125. var uid = node.getAttribute(this.uidk);
  2126. if (!uid){
  2127. uid = this.uidx++;
  2128. node.setAttribute(this.uidk, uid);
  2129. }
  2130. return uid;
  2131. };
  2132. local.getUIDHTML = function(node){
  2133. return node.uniqueNumber || (node.uniqueNumber = this.uidx++);
  2134. };
  2135. // sort based on the setDocument documentSorter method.
  2136. local.sort = function(results){
  2137. if (!this.documentSorter) return results;
  2138. results.sort(this.documentSorter);
  2139. return results;
  2140. };
  2141. /*<pseudo-selectors>*//*<nth-pseudo-selectors>*/
  2142. local.cacheNTH = {};
  2143. local.matchNTH = /^([+-]?\d*)?([a-z]+)?([+-]\d+)?$/;
  2144. local.parseNTHArgument = function(argument){
  2145. var parsed = argument.match(this.matchNTH);
  2146. if (!parsed) return false;
  2147. var special = parsed[2] || false;
  2148. var a = parsed[1] || 1;
  2149. if (a == '-') a = -1;
  2150. var b = +parsed[3] || 0;
  2151. parsed =
  2152. (special == 'n') ? {a: a, b: b} :
  2153. (special == 'odd') ? {a: 2, b: 1} :
  2154. (special == 'even') ? {a: 2, b: 0} : {a: 0, b: a};
  2155. return (this.cacheNTH[argument] = parsed);
  2156. };
  2157. local.createNTHPseudo = function(child, sibling, positions, ofType){
  2158. return function(node, argument){
  2159. var uid = this.getUID(node);
  2160. if (!this[positions][uid]){
  2161. var parent = node.parentNode;
  2162. if (!parent) return false;
  2163. var el = parent[child], count = 1;
  2164. if (ofType){
  2165. var nodeName = node.nodeName;
  2166. do {
  2167. if (el.nodeName != nodeName) continue;
  2168. this[positions][this.getUID(el)] = count++;
  2169. } while ((el = el[sibling]));
  2170. } else {
  2171. do {
  2172. if (el.nodeType != 1) continue;
  2173. this[positions][this.getUID(el)] = count++;
  2174. } while ((el = el[sibling]));
  2175. }
  2176. }
  2177. argument = argument || 'n';
  2178. var parsed = this.cacheNTH[argument] || this.parseNTHArgument(argument);
  2179. if (!parsed) return false;
  2180. var a = parsed.a, b = parsed.b, pos = this[positions][uid];
  2181. if (a == 0) return b == pos;
  2182. if (a > 0){
  2183. if (pos < b) return false;
  2184. } else {
  2185. if (b < pos) return false;
  2186. }
  2187. return ((pos - b) % a) == 0;
  2188. };
  2189. };
  2190. /*</nth-pseudo-selectors>*//*</pseudo-selectors>*/
  2191. local.pushArray = function(node, tag, id, classes, attributes, pseudos){
  2192. if (this.matchSelector(node, tag, id, classes, attributes, pseudos)) this.found.push(node);
  2193. };
  2194. local.pushUID = function(node, tag, id, classes, attributes, pseudos){
  2195. var uid = this.getUID(node);
  2196. if (!this.uniques[uid] && this.matchSelector(node, tag, id, classes, attributes, pseudos)){
  2197. this.uniques[uid] = true;
  2198. this.found.push(node);
  2199. }
  2200. };
  2201. local.matchNode = function(node, selector){
  2202. if (this.isHTMLDocument && this.nativeMatchesSelector){
  2203. try {
  2204. return this.nativeMatchesSelector.call(node, selector.replace(/\[([^=]+)=\s*([^'"\]]+?)\s*\]/g, '[$1="$2"]'));
  2205. } catch (matchError){}
  2206. }
  2207. var parsed = this.Slick.parse(selector);
  2208. if (!parsed) return true;
  2209. // simple (single) selectors
  2210. var expressions = parsed.expressions, simpleExpCounter = 0, i, currentExpression;
  2211. for (i = 0; (currentExpression = expressions[i]); i++){
  2212. if (currentExpression.length == 1){
  2213. var exp = currentExpression[0];
  2214. if (this.matchSelector(node, (this.isXMLDocument) ? exp.tag : exp.tag.toUpperCase(), exp.id, exp.classes, exp.attributes, exp.pseudos)) return true;
  2215. simpleExpCounter++;
  2216. }
  2217. }
  2218. if (simpleExpCounter == parsed.length) return false;
  2219. var nodes = this.search(this.document, parsed), item;
  2220. for (i = 0; item = nodes[i++];){
  2221. if (item === node) return true;
  2222. }
  2223. return false;
  2224. };
  2225. local.matchPseudo = function(node, name, argument){
  2226. var pseudoName = 'pseudo:' + name;
  2227. if (this[pseudoName]) return this[pseudoName](node, argument);
  2228. var attribute = this.getAttribute(node, name);
  2229. return (argument) ? argument == attribute : !!attribute;
  2230. };
  2231. local.matchSelector = function(node, tag, id, classes, attributes, pseudos){
  2232. if (tag){
  2233. var nodeName = (this.isXMLDocument) ? node.nodeName : node.nodeName.toUpperCase();
  2234. if (tag == '*'){
  2235. if (nodeName < '@') return false; // Fix for comment nodes and closed nodes
  2236. } else {
  2237. if (nodeName != tag) return false;
  2238. }
  2239. }
  2240. if (id && node.getAttribute('id') != id) return false;
  2241. var i, part, cls;
  2242. if (classes) for (i = classes.length; i--;){
  2243. cls = this.getAttribute(node, 'class');
  2244. if (!(cls && classes[i].regexp.test(cls))) return false;
  2245. }
  2246. if (attributes) for (i = attributes.length; i--;){
  2247. part = attributes[i];
  2248. if (part.operator ? !part.test(this.getAttribute(node, part.key)) : !this.hasAttribute(node, part.key)) return false;
  2249. }
  2250. if (pseudos) for (i = pseudos.length; i--;){
  2251. part = pseudos[i];
  2252. if (!this.matchPseudo(node, part.key, part.value)) return false;
  2253. }
  2254. return true;
  2255. };
  2256. var combinators = {
  2257. ' ': function(node, tag, id, classes, attributes, pseudos, classList){ // all child nodes, any level
  2258. var i, item, children;
  2259. if (this.isHTMLDocument){
  2260. getById: if (id){
  2261. item = this.document.getElementById(id);
  2262. if ((!item && node.all) || (this.idGetsName && item && item.getAttributeNode('id').nodeValue != id)){
  2263. // all[id] returns all the elements with that name or id inside node
  2264. // if theres just one it will return the element, else it will be a collection
  2265. children = node.all[id];
  2266. if (!children) return;
  2267. if (!children[0]) children = [children];
  2268. for (i = 0; item = children[i++];){
  2269. var idNode = item.getAttributeNode('id');
  2270. if (idNode && idNode.nodeValue == id){
  2271. this.push(item, tag, null, classes, attributes, pseudos);
  2272. break;
  2273. }
  2274. }
  2275. return;
  2276. }
  2277. if (!item){
  2278. // if the context is in the dom we return, else we will try GEBTN, breaking the getById label
  2279. if (this.contains(this.root, node)) return;
  2280. else break getById;
  2281. } else if (this.document !== node && !this.contains(node, item)) return;
  2282. this.push(item, tag, null, classes, attributes, pseudos);
  2283. return;
  2284. }
  2285. getByClass: if (classes && node.getElementsByClassName && !this.brokenGEBCN){
  2286. children = node.getElementsByClassName(classList.join(' '));
  2287. if (!(children && children.length)) break getByClass;
  2288. for (i = 0; item = children[i++];) this.push(item, tag, id, null, attributes, pseudos);
  2289. return;
  2290. }
  2291. }
  2292. getByTag: {
  2293. children = node.getElementsByTagName(tag);
  2294. if (!(children && children.length)) break getByTag;
  2295. if (!this.brokenStarGEBTN) tag = null;
  2296. for (i = 0; item = children[i++];) this.push(item, tag, id, classes, attributes, pseudos);
  2297. }
  2298. },
  2299. '>': function(node, tag, id, classes, attributes, pseudos){ // direct children
  2300. if ((node = node.firstChild)) do {
  2301. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2302. } while ((node = node.nextSibling));
  2303. },
  2304. '+': function(node, tag, id, classes, attributes, pseudos){ // next sibling
  2305. while ((node = node.nextSibling)) if (node.nodeType == 1){
  2306. this.push(node, tag, id, classes, attributes, pseudos);
  2307. break;
  2308. }
  2309. },
  2310. '^': function(node, tag, id, classes, attributes, pseudos){ // first child
  2311. node = node.firstChild;
  2312. if (node){
  2313. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2314. else this['combinator:+'](node, tag, id, classes, attributes, pseudos);
  2315. }
  2316. },
  2317. '~': function(node, tag, id, classes, attributes, pseudos){ // next siblings
  2318. while ((node = node.nextSibling)){
  2319. if (node.nodeType != 1) continue;
  2320. var uid = this.getUID(node);
  2321. if (this.bitUniques[uid]) break;
  2322. this.bitUniques[uid] = true;
  2323. this.push(node, tag, id, classes, attributes, pseudos);
  2324. }
  2325. },
  2326. '++': function(node, tag, id, classes, attributes, pseudos){ // next sibling and previous sibling
  2327. this['combinator:+'](node, tag, id, classes, attributes, pseudos);
  2328. this['combinator:!+'](node, tag, id, classes, attributes, pseudos);
  2329. },
  2330. '~~': function(node, tag, id, classes, attributes, pseudos){ // next siblings and previous siblings
  2331. this['combinator:~'](node, tag, id, classes, attributes, pseudos);
  2332. this['combinator:!~'](node, tag, id, classes, attributes, pseudos);
  2333. },
  2334. '!': function(node, tag, id, classes, attributes, pseudos){ // all parent nodes up to document
  2335. while ((node = node.parentNode)) if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos);
  2336. },
  2337. '!>': function(node, tag, id, classes, attributes, pseudos){ // direct parent (one level)
  2338. node = node.parentNode;
  2339. if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos);
  2340. },
  2341. '!+': function(node, tag, id, classes, attributes, pseudos){ // previous sibling
  2342. while ((node = node.previousSibling)) if (node.nodeType == 1){
  2343. this.push(node, tag, id, classes, attributes, pseudos);
  2344. break;
  2345. }
  2346. },
  2347. '!^': function(node, tag, id, classes, attributes, pseudos){ // last child
  2348. node = node.lastChild;
  2349. if (node){
  2350. if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos);
  2351. else this['combinator:!+'](node, tag, id, classes, attributes, pseudos);
  2352. }
  2353. },
  2354. '!~': function(node, tag, id, classes, attributes, pseudos){ // previous siblings
  2355. while ((node = node.previousSibling)){
  2356. if (node.nodeType != 1) continue;
  2357. var uid = this.getUID(node);
  2358. if (this.bitUniques[uid]) break;
  2359. this.bitUniques[uid] = true;
  2360. this.push(node, tag, id, classes, attributes, pseudos);
  2361. }
  2362. }
  2363. };
  2364. for (var c in combinators) local['combinator:' + c] = combinators[c];
  2365. var pseudos = {
  2366. /*<pseudo-selectors>*/
  2367. 'empty': function(node){
  2368. var child = node.firstChild;
  2369. return !(child && child.nodeType == 1) && !(node.innerText || node.textContent || '').length;
  2370. },
  2371. 'not': function(node, expression){
  2372. return !this.matchNode(node, expression);
  2373. },
  2374. 'contains': function(node, text){
  2375. return (node.innerText || node.textContent || '').indexOf(text) > -1;
  2376. },
  2377. 'first-child': function(node){
  2378. while ((node = node.previousSibling)) if (node.nodeType == 1) return false;
  2379. return true;
  2380. },
  2381. 'last-child': function(node){
  2382. while ((node = node.nextSibling)) if (node.nodeType == 1) return false;
  2383. return true;
  2384. },
  2385. 'only-child': function(node){
  2386. var prev = node;
  2387. while ((prev = prev.previousSibling)) if (prev.nodeType == 1) return false;
  2388. var next = node;
  2389. while ((next = next.nextSibling)) if (next.nodeType == 1) return false;
  2390. return true;
  2391. },
  2392. /*<nth-pseudo-selectors>*/
  2393. 'nth-child': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTH'),
  2394. 'nth-last-child': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHLast'),
  2395. 'nth-of-type': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTHType', true),
  2396. 'nth-last-of-type': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHTypeLast', true),
  2397. 'index': function(node, index){
  2398. return this['pseudo:nth-child'](node, '' + (index + 1));
  2399. },
  2400. 'even': function(node){
  2401. return this['pseudo:nth-child'](node, '2n');
  2402. },
  2403. 'odd': function(node){
  2404. return this['pseudo:nth-child'](node, '2n+1');
  2405. },
  2406. /*</nth-pseudo-selectors>*/
  2407. /*<of-type-pseudo-selectors>*/
  2408. 'first-of-type': function(node){
  2409. var nodeName = node.nodeName;
  2410. while ((node = node.previousSibling)) if (node.nodeName == nodeName) return false;
  2411. return true;
  2412. },
  2413. 'last-of-type': function(node){
  2414. var nodeName = node.nodeName;
  2415. while ((node = node.nextSibling)) if (node.nodeName == nodeName) return false;
  2416. return true;
  2417. },
  2418. 'only-of-type': function(node){
  2419. var prev = node, nodeName = node.nodeName;
  2420. while ((prev = prev.previousSibling)) if (prev.nodeName == nodeName) return false;
  2421. var next = node;
  2422. while ((next = next.nextSibling)) if (next.nodeName == nodeName) return false;
  2423. return true;
  2424. },
  2425. /*</of-type-pseudo-selectors>*/
  2426. // custom pseudos
  2427. 'enabled': function(node){
  2428. return !node.disabled;
  2429. },
  2430. 'disabled': function(node){
  2431. return node.disabled;
  2432. },
  2433. 'checked': function(node){
  2434. return node.checked || node.selected;
  2435. },
  2436. 'focus': function(node){
  2437. return this.isHTMLDocument && this.document.activeElement === node && (node.href || node.type || this.hasAttribute(node, 'tabindex'));
  2438. },
  2439. 'root': function(node){
  2440. return (node === this.root);
  2441. },
  2442. 'selected': function(node){
  2443. return node.selected;
  2444. }
  2445. /*</pseudo-selectors>*/
  2446. };
  2447. for (var p in pseudos) local['pseudo:' + p] = pseudos[p];
  2448. // attributes methods
  2449. var attributeGetters = local.attributeGetters = {
  2450. 'for': function(){
  2451. return ('htmlFor' in this) ? this.htmlFor : this.getAttribute('for');
  2452. },
  2453. 'href': function(){
  2454. return ('href' in this) ? this.getAttribute('href', 2) : this.getAttribute('href');
  2455. },
  2456. 'style': function(){
  2457. return (this.style) ? this.style.cssText : this.getAttribute('style');
  2458. },
  2459. 'tabindex': function(){
  2460. var attributeNode = this.getAttributeNode('tabindex');
  2461. return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null;
  2462. },
  2463. 'type': function(){
  2464. return this.getAttribute('type');
  2465. },
  2466. 'maxlength': function(){
  2467. var attributeNode = this.getAttributeNode('maxLength');
  2468. return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null;
  2469. }
  2470. };
  2471. attributeGetters.MAXLENGTH = attributeGetters.maxLength = attributeGetters.maxlength;
  2472. // Slick
  2473. var Slick = local.Slick = (this.Slick || {});
  2474. Slick.version = '1.1.7';
  2475. // Slick finder
  2476. Slick.search = function(context, expression, append){
  2477. return local.search(context, expression, append);
  2478. };
  2479. Slick.find = function(context, expression){
  2480. return local.search(context, expression, null, true);
  2481. };
  2482. // Slick containment checker
  2483. Slick.contains = function(container, node){
  2484. local.setDocument(container);
  2485. return local.contains(container, node);
  2486. };
  2487. // Slick attribute getter
  2488. Slick.getAttribute = function(node, name){
  2489. local.setDocument(node);
  2490. return local.getAttribute(node, name);
  2491. };
  2492. Slick.hasAttribute = function(node, name){
  2493. local.setDocument(node);
  2494. return local.hasAttribute(node, name);
  2495. };
  2496. // Slick matcher
  2497. Slick.match = function(node, selector){
  2498. if (!(node && selector)) return false;
  2499. if (!selector || selector === node) return true;
  2500. local.setDocument(node);
  2501. return local.matchNode(node, selector);
  2502. };
  2503. // Slick attribute accessor
  2504. Slick.defineAttributeGetter = function(name, fn){
  2505. local.attributeGetters[name] = fn;
  2506. return this;
  2507. };
  2508. Slick.lookupAttributeGetter = function(name){
  2509. return local.attributeGetters[name];
  2510. };
  2511. // Slick pseudo accessor
  2512. Slick.definePseudo = function(name, fn){
  2513. local['pseudo:' + name] = function(node, argument){
  2514. return fn.call(node, argument);
  2515. };
  2516. return this;
  2517. };
  2518. Slick.lookupPseudo = function(name){
  2519. var pseudo = local['pseudo:' + name];
  2520. if (pseudo) return function(argument){
  2521. return pseudo.call(this, argument);
  2522. };
  2523. return null;
  2524. };
  2525. // Slick overrides accessor
  2526. Slick.override = function(regexp, fn){
  2527. local.override(regexp, fn);
  2528. return this;
  2529. };
  2530. Slick.isXML = local.isXML;
  2531. Slick.uidOf = function(node){
  2532. return local.getUIDHTML(node);
  2533. };
  2534. if (!this.Slick) this.Slick = Slick;
  2535. }).apply(/*<CommonJS>*/(typeof exports != 'undefined') ? exports : /*</CommonJS>*/this);
  2536. /*
  2537. ---
  2538. name: Element
  2539. 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.
  2540. license: MIT-style license.
  2541. requires: [Window, Document, Array, String, Function, Object, Number, Slick.Parser, Slick.Finder]
  2542. provides: [Element, Elements, $, $$, IFrame, Selectors]
  2543. ...
  2544. */
  2545. var Element = this.Element = function(tag, props){
  2546. var konstructor = Element.Constructors[tag];
  2547. if (konstructor) return konstructor(props);
  2548. if (typeof tag != 'string') return document.id(tag).set(props);
  2549. if (!props) props = {};
  2550. if (!(/^[\w-]+$/).test(tag)){
  2551. var parsed = Slick.parse(tag).expressions[0][0];
  2552. tag = (parsed.tag == '*') ? 'div' : parsed.tag;
  2553. if (parsed.id && props.id == null) props.id = parsed.id;
  2554. var attributes = parsed.attributes;
  2555. if (attributes) for (var attr, i = 0, l = attributes.length; i < l; i++){
  2556. attr = attributes[i];
  2557. if (props[attr.key] != null) continue;
  2558. if (attr.value != null && attr.operator == '=') props[attr.key] = attr.value;
  2559. else if (!attr.value && !attr.operator) props[attr.key] = true;
  2560. }
  2561. if (parsed.classList && props['class'] == null) props['class'] = parsed.classList.join(' ');
  2562. }
  2563. return document.newElement(tag, props);
  2564. };
  2565. if (Browser.Element){
  2566. Element.prototype = Browser.Element.prototype;
  2567. // IE8 and IE9 require the wrapping.
  2568. Element.prototype._fireEvent = (function(fireEvent){
  2569. return function(type, event){
  2570. return fireEvent.call(this, type, event);
  2571. };
  2572. })(Element.prototype.fireEvent);
  2573. }
  2574. new Type('Element', Element).mirror(function(name){
  2575. if (Array.prototype[name]) return;
  2576. var obj = {};
  2577. obj[name] = function(){
  2578. var results = [], args = arguments, elements = true;
  2579. for (var i = 0, l = this.length; i < l; i++){
  2580. var element = this[i], result = results[i] = element[name].apply(element, args);
  2581. elements = (elements && typeOf(result) == 'element');
  2582. }
  2583. return (elements) ? new Elements(results) : results;
  2584. };
  2585. Elements.implement(obj);
  2586. });
  2587. if (!Browser.Element){
  2588. Element.parent = Object;
  2589. Element.Prototype = {
  2590. '$constructor': Element,
  2591. '$family': Function.convert('element').hide()
  2592. };
  2593. Element.mirror(function(name, method){
  2594. Element.Prototype[name] = method;
  2595. });
  2596. }
  2597. Element.Constructors = {};
  2598. //<1.2compat>
  2599. Element.Constructors = new Hash;
  2600. //</1.2compat>
  2601. var IFrame = new Type('IFrame', function(){
  2602. var params = Array.link(arguments, {
  2603. properties: Type.isObject,
  2604. iframe: function(obj){
  2605. return (obj != null);
  2606. }
  2607. });
  2608. var props = params.properties || {}, iframe;
  2609. if (params.iframe) iframe = document.id(params.iframe);
  2610. var onload = props.onload || function(){};
  2611. delete props.onload;
  2612. props.id = props.name = [props.id, props.name, iframe ? (iframe.id || iframe.name) : 'IFrame_' + String.uniqueID()].pick();
  2613. iframe = new Element(iframe || 'iframe', props);
  2614. var onLoad = function(){
  2615. onload.call(iframe.contentWindow);
  2616. };
  2617. if (window.frames[props.id]) onLoad();
  2618. else iframe.addListener('load', onLoad);
  2619. return iframe;
  2620. });
  2621. var Elements = this.Elements = function(nodes){
  2622. if (nodes && nodes.length){
  2623. var uniques = {}, node;
  2624. for (var i = 0; node = nodes[i++];){
  2625. var uid = Slick.uidOf(node);
  2626. if (!uniques[uid]){
  2627. uniques[uid] = true;
  2628. this.push(node);
  2629. }
  2630. }
  2631. }
  2632. };
  2633. Elements.prototype = {length: 0};
  2634. Elements.parent = Array;
  2635. new Type('Elements', Elements).implement({
  2636. filter: function(filter, bind){
  2637. if (!filter) return this;
  2638. return new Elements(Array.filter(this, (typeOf(filter) == 'string') ? function(item){
  2639. return item.match(filter);
  2640. } : filter, bind));
  2641. }.protect(),
  2642. push: function(){
  2643. var length = this.length;
  2644. for (var i = 0, l = arguments.length; i < l; i++){
  2645. var item = document.id(arguments[i]);
  2646. if (item) this[length++] = item;
  2647. }
  2648. return (this.length = length);
  2649. }.protect(),
  2650. unshift: function(){
  2651. var items = [];
  2652. for (var i = 0, l = arguments.length; i < l; i++){
  2653. var item = document.id(arguments[i]);
  2654. if (item) items.push(item);
  2655. }
  2656. return Array.prototype.unshift.apply(this, items);
  2657. }.protect(),
  2658. concat: function(){
  2659. var newElements = new Elements(this);
  2660. for (var i = 0, l = arguments.length; i < l; i++){
  2661. var item = arguments[i];
  2662. if (Type.isEnumerable(item)) newElements.append(item);
  2663. else newElements.push(item);
  2664. }
  2665. return newElements;
  2666. }.protect(),
  2667. append: function(collection){
  2668. for (var i = 0, l = collection.length; i < l; i++) this.push(collection[i]);
  2669. return this;
  2670. }.protect(),
  2671. empty: function(){
  2672. while (this.length) delete this[--this.length];
  2673. return this;
  2674. }.protect()
  2675. });
  2676. //<1.2compat>
  2677. Elements.alias('extend', 'append');
  2678. //</1.2compat>
  2679. (function(){
  2680. // FF, IE
  2681. var splice = Array.prototype.splice, object = {'0': 0, '1': 1, length: 2};
  2682. splice.call(object, 1, 1);
  2683. if (object[1] == 1) Elements.implement('splice', function(){
  2684. var length = this.length;
  2685. var result = splice.apply(this, arguments);
  2686. while (length >= this.length) delete this[length--];
  2687. return result;
  2688. }.protect());
  2689. Array.forEachMethod(function(method, name){
  2690. Elements.implement(name, method);
  2691. });
  2692. Array.mirror(Elements);
  2693. /*<ltIE8>*/
  2694. var createElementAcceptsHTML;
  2695. try {
  2696. createElementAcceptsHTML = (document.createElement('<input name=x>').name == 'x');
  2697. } catch (e){}
  2698. var escapeQuotes = function(html){
  2699. return ('' + html).replace(/&/g, '&amp;').replace(/"/g, '&quot;');
  2700. };
  2701. /*</ltIE8>*/
  2702. /*<ltIE9>*/
  2703. // #2479 - IE8 Cannot set HTML of style element
  2704. var canChangeStyleHTML = (function(){
  2705. var div = document.createElement('style'),
  2706. flag = false;
  2707. try {
  2708. div.innerHTML = '#justTesing{margin: 0px;}';
  2709. flag = !!div.innerHTML;
  2710. } catch (e){}
  2711. return flag;
  2712. })();
  2713. /*</ltIE9>*/
  2714. Document.implement({
  2715. newElement: function(tag, props){
  2716. if (props){
  2717. if (props.checked != null) props.defaultChecked = props.checked;
  2718. if ((props.type == 'checkbox' || props.type == 'radio') && props.value == null) props.value = 'on';
  2719. /*<ltIE9>*/ // IE needs the type to be set before changing content of style element
  2720. if (!canChangeStyleHTML && tag == 'style'){
  2721. var styleElement = document.createElement('style');
  2722. styleElement.setAttribute('type', 'text/css');
  2723. if (props.type) delete props.type;
  2724. return this.id(styleElement).set(props);
  2725. }
  2726. /*</ltIE9>*/
  2727. /*<ltIE8>*/// Fix for readonly name and type properties in IE < 8
  2728. if (createElementAcceptsHTML){
  2729. tag = '<' + tag;
  2730. if (props.name) tag += ' name="' + escapeQuotes(props.name) + '"';
  2731. if (props.type) tag += ' type="' + escapeQuotes(props.type) + '"';
  2732. tag += '>';
  2733. delete props.name;
  2734. delete props.type;
  2735. }
  2736. /*</ltIE8>*/
  2737. }
  2738. return this.id(this.createElement(tag)).set(props);
  2739. }
  2740. });
  2741. })();
  2742. (function(){
  2743. Slick.uidOf(window);
  2744. Slick.uidOf(document);
  2745. Document.implement({
  2746. newTextNode: function(text){
  2747. return this.createTextNode(text);
  2748. },
  2749. getDocument: function(){
  2750. return this;
  2751. },
  2752. getWindow: function(){
  2753. return this.window;
  2754. },
  2755. id: (function(){
  2756. var types = {
  2757. string: function(id, nocash, doc){
  2758. id = Slick.find(doc, '#' + id.replace(/(\W)/g, '\\$1'));
  2759. return (id) ? types.element(id, nocash) : null;
  2760. },
  2761. element: function(el, nocash){
  2762. Slick.uidOf(el);
  2763. if (!nocash && !el.$family && !(/^(?:object|embed)$/i).test(el.tagName)){
  2764. var fireEvent = el.fireEvent;
  2765. // wrapping needed in IE7, or else crash
  2766. el._fireEvent = function(type, event){
  2767. return fireEvent(type, event);
  2768. };
  2769. Object.append(el, Element.Prototype);
  2770. }
  2771. return el;
  2772. },
  2773. object: function(obj, nocash, doc){
  2774. if (obj.toElement) return types.element(obj.toElement(doc), nocash);
  2775. return null;
  2776. }
  2777. };
  2778. types.textnode = types.whitespace = types.window = types.document = function(zero){
  2779. return zero;
  2780. };
  2781. return function(el, nocash, doc){
  2782. if (el && el.$family && el.uniqueNumber) return el;
  2783. var type = typeOf(el);
  2784. return (types[type]) ? types[type](el, nocash, doc || document) : null;
  2785. };
  2786. })()
  2787. });
  2788. if (window.$ == null) Window.implement('$', function(el, nc){
  2789. return document.id(el, nc, this.document);
  2790. });
  2791. Window.implement({
  2792. getDocument: function(){
  2793. return this.document;
  2794. },
  2795. getWindow: function(){
  2796. return this;
  2797. }
  2798. });
  2799. [Document, Element].invoke('implement', {
  2800. getElements: function(expression){
  2801. return Slick.search(this, expression, new Elements);
  2802. },
  2803. getElement: function(expression){
  2804. return document.id(Slick.find(this, expression));
  2805. }
  2806. });
  2807. var contains = {contains: function(element){
  2808. return Slick.contains(this, element);
  2809. }};
  2810. if (!document.contains) Document.implement(contains);
  2811. if (!document.createElement('div').contains) Element.implement(contains);
  2812. //<1.2compat>
  2813. Element.implement('hasChild', function(element){
  2814. return this !== element && this.contains(element);
  2815. });
  2816. (function(search, find, match){
  2817. this.Selectors = {};
  2818. var pseudos = this.Selectors.Pseudo = new Hash();
  2819. var addSlickPseudos = function(){
  2820. for (var name in pseudos) if (pseudos.hasOwnProperty(name)){
  2821. Slick.definePseudo(name, pseudos[name]);
  2822. delete pseudos[name];
  2823. }
  2824. };
  2825. Slick.search = function(context, expression, append){
  2826. addSlickPseudos();
  2827. return search.call(this, context, expression, append);
  2828. };
  2829. Slick.find = function(context, expression){
  2830. addSlickPseudos();
  2831. return find.call(this, context, expression);
  2832. };
  2833. Slick.match = function(node, selector){
  2834. addSlickPseudos();
  2835. return match.call(this, node, selector);
  2836. };
  2837. })(Slick.search, Slick.find, Slick.match);
  2838. //</1.2compat>
  2839. // tree walking
  2840. var injectCombinator = function(expression, combinator){
  2841. if (!expression) return combinator;
  2842. expression = Object.clone(Slick.parse(expression));
  2843. var expressions = expression.expressions;
  2844. for (var i = expressions.length; i--;)
  2845. expressions[i][0].combinator = combinator;
  2846. return expression;
  2847. };
  2848. Object.forEach({
  2849. getNext: '~',
  2850. getPrevious: '!~',
  2851. getParent: '!'
  2852. }, function(combinator, method){
  2853. Element.implement(method, function(expression){
  2854. return this.getElement(injectCombinator(expression, combinator));
  2855. });
  2856. });
  2857. Object.forEach({
  2858. getAllNext: '~',
  2859. getAllPrevious: '!~',
  2860. getSiblings: '~~',
  2861. getChildren: '>',
  2862. getParents: '!'
  2863. }, function(combinator, method){
  2864. Element.implement(method, function(expression){
  2865. return this.getElements(injectCombinator(expression, combinator));
  2866. });
  2867. });
  2868. Element.implement({
  2869. getFirst: function(expression){
  2870. return document.id(Slick.search(this, injectCombinator(expression, '>'))[0]);
  2871. },
  2872. getLast: function(expression){
  2873. return document.id(Slick.search(this, injectCombinator(expression, '>')).getLast());
  2874. },
  2875. getWindow: function(){
  2876. return this.ownerDocument.window;
  2877. },
  2878. getDocument: function(){
  2879. return this.ownerDocument;
  2880. },
  2881. getElementById: function(id){
  2882. return document.id(Slick.find(this, '#' + ('' + id).replace(/(\W)/g, '\\$1')));
  2883. },
  2884. match: function(expression){
  2885. return !expression || Slick.match(this, expression);
  2886. }
  2887. });
  2888. //<1.2compat>
  2889. if (window.$$ == null) Window.implement('$$', function(selector){
  2890. var elements = new Elements;
  2891. if (arguments.length == 1 && typeof selector == 'string') return Slick.search(this.document, selector, elements);
  2892. var args = Array.flatten(arguments);
  2893. for (var i = 0, l = args.length; i < l; i++){
  2894. var item = args[i];
  2895. switch (typeOf(item)){
  2896. case 'element': elements.push(item); break;
  2897. case 'string': Slick.search(this.document, item, elements);
  2898. }
  2899. }
  2900. return elements;
  2901. });
  2902. //</1.2compat>
  2903. if (window.$$ == null) Window.implement('$$', function(selector){
  2904. if (arguments.length == 1){
  2905. if (typeof selector == 'string') return Slick.search(this.document, selector, new Elements);
  2906. else if (Type.isEnumerable(selector)) return new Elements(selector);
  2907. }
  2908. return new Elements(arguments);
  2909. });
  2910. // Inserters
  2911. var inserters = {
  2912. before: function(context, element){
  2913. var parent = element.parentNode;
  2914. if (parent) parent.insertBefore(context, element);
  2915. },
  2916. after: function(context, element){
  2917. var parent = element.parentNode;
  2918. if (parent) parent.insertBefore(context, element.nextSibling);
  2919. },
  2920. bottom: function(context, element){
  2921. element.appendChild(context);
  2922. },
  2923. top: function(context, element){
  2924. element.insertBefore(context, element.firstChild);
  2925. }
  2926. };
  2927. inserters.inside = inserters.bottom;
  2928. //<1.2compat>
  2929. Object.each(inserters, function(inserter, where){
  2930. where = where.capitalize();
  2931. var methods = {};
  2932. methods['inject' + where] = function(el){
  2933. inserter(this, document.id(el, true));
  2934. return this;
  2935. };
  2936. methods['grab' + where] = function(el){
  2937. inserter(document.id(el, true), this);
  2938. return this;
  2939. };
  2940. Element.implement(methods);
  2941. });
  2942. //</1.2compat>
  2943. // getProperty / setProperty
  2944. var propertyGetters = {}, propertySetters = {};
  2945. // properties
  2946. var properties = {};
  2947. Array.forEach([
  2948. 'type', 'value', 'defaultValue', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan',
  2949. 'frameBorder', 'rowSpan', 'tabIndex', 'useMap'
  2950. ], function(property){
  2951. properties[property.toLowerCase()] = property;
  2952. });
  2953. properties.html = 'innerHTML';
  2954. properties.text = (document.createElement('div').textContent == null) ? 'innerText': 'textContent';
  2955. Object.forEach(properties, function(real, key){
  2956. propertySetters[key] = function(node, value){
  2957. node[real] = value;
  2958. };
  2959. propertyGetters[key] = function(node){
  2960. return node[real];
  2961. };
  2962. });
  2963. /*<ltIE9>*/
  2964. propertySetters.text = (function(){
  2965. return function(node, value){
  2966. if (node.get('tag') == 'style') node.set('html', value);
  2967. else node[properties.text] = value;
  2968. };
  2969. })(propertySetters.text);
  2970. propertyGetters.text = (function(getter){
  2971. return function(node){
  2972. return (node.get('tag') == 'style') ? node.innerHTML : getter(node);
  2973. };
  2974. })(propertyGetters.text);
  2975. /*</ltIE9>*/
  2976. // Booleans
  2977. var bools = [
  2978. 'compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked',
  2979. 'disabled', 'readOnly', 'multiple', 'selected', 'noresize',
  2980. 'defer', 'defaultChecked', 'autofocus', 'controls', 'autoplay',
  2981. 'loop'
  2982. ];
  2983. var booleans = {};
  2984. Array.forEach(bools, function(bool){
  2985. var lower = bool.toLowerCase();
  2986. booleans[lower] = bool;
  2987. propertySetters[lower] = function(node, value){
  2988. node[bool] = !!value;
  2989. };
  2990. propertyGetters[lower] = function(node){
  2991. return !!node[bool];
  2992. };
  2993. });
  2994. // Special cases
  2995. Object.append(propertySetters, {
  2996. 'class': function(node, value){
  2997. ('className' in node) ? node.className = (value || '') : node.setAttribute('class', value);
  2998. },
  2999. 'for': function(node, value){
  3000. ('htmlFor' in node) ? node.htmlFor = value : node.setAttribute('for', value);
  3001. },
  3002. 'style': function(node, value){
  3003. (node.style) ? node.style.cssText = value : node.setAttribute('style', value);
  3004. },
  3005. 'value': function(node, value){
  3006. node.value = (value != null) ? value : '';
  3007. }
  3008. });
  3009. propertyGetters['class'] = function(node){
  3010. return ('className' in node) ? node.className || null : node.getAttribute('class');
  3011. };
  3012. /* <webkit> */
  3013. var el = document.createElement('button');
  3014. // IE sets type as readonly and throws
  3015. try { el.type = 'button'; } catch (e){}
  3016. if (el.type != 'button') propertySetters.type = function(node, value){
  3017. node.setAttribute('type', value);
  3018. };
  3019. el = null;
  3020. /* </webkit> */
  3021. /*<IE>*/
  3022. /*<ltIE9>*/
  3023. // #2479 - IE8 Cannot set HTML of style element
  3024. var canChangeStyleHTML = (function(){
  3025. var div = document.createElement('style'),
  3026. flag = false;
  3027. try {
  3028. div.innerHTML = '#justTesing{margin: 0px;}';
  3029. flag = !!div.innerHTML;
  3030. } catch (e){}
  3031. return flag;
  3032. })();
  3033. /*</ltIE9>*/
  3034. var input = document.createElement('input'), volatileInputValue, html5InputSupport;
  3035. // #2178
  3036. input.value = 't';
  3037. input.type = 'submit';
  3038. volatileInputValue = input.value != 't';
  3039. // #2443 - IE throws "Invalid Argument" when trying to use html5 input types
  3040. try {
  3041. input.value = '';
  3042. input.type = 'email';
  3043. html5InputSupport = input.type == 'email';
  3044. } catch (e){}
  3045. input = null;
  3046. if (volatileInputValue || !html5InputSupport) propertySetters.type = function(node, type){
  3047. try {
  3048. var value = node.value;
  3049. node.type = type;
  3050. node.value = value;
  3051. } catch (e){}
  3052. };
  3053. /*</IE>*/
  3054. /* getProperty, setProperty */
  3055. /* <ltIE9> */
  3056. var pollutesGetAttribute = (function(div){
  3057. div.random = 'attribute';
  3058. return (div.getAttribute('random') == 'attribute');
  3059. })(document.createElement('div'));
  3060. var hasCloneBug = (function(test){
  3061. test.innerHTML = '<object><param name="should_fix" value="the unknown" /></object>';
  3062. return test.cloneNode(true).firstChild.childNodes.length != 1;
  3063. })(document.createElement('div'));
  3064. /* </ltIE9> */
  3065. var hasClassList = !!document.createElement('div').classList;
  3066. var classes = function(className){
  3067. var classNames = (className || '').clean().split(' '), uniques = {};
  3068. return classNames.filter(function(className){
  3069. if (className !== '' && !uniques[className]) return uniques[className] = className;
  3070. });
  3071. };
  3072. var addToClassList = function(name){
  3073. this.classList.add(name);
  3074. };
  3075. var removeFromClassList = function(name){
  3076. this.classList.remove(name);
  3077. };
  3078. Element.implement({
  3079. setProperty: function(name, value){
  3080. var setter = propertySetters[name.toLowerCase()];
  3081. if (setter){
  3082. setter(this, value);
  3083. } else {
  3084. /* <ltIE9> */
  3085. var attributeWhiteList;
  3086. if (pollutesGetAttribute) attributeWhiteList = this.retrieve('$attributeWhiteList', {});
  3087. /* </ltIE9> */
  3088. if (value == null){
  3089. this.removeAttribute(name);
  3090. /* <ltIE9> */
  3091. if (pollutesGetAttribute) delete attributeWhiteList[name];
  3092. /* </ltIE9> */
  3093. } else {
  3094. this.setAttribute(name, '' + value);
  3095. /* <ltIE9> */
  3096. if (pollutesGetAttribute) attributeWhiteList[name] = true;
  3097. /* </ltIE9> */
  3098. }
  3099. }
  3100. return this;
  3101. },
  3102. setProperties: function(attributes){
  3103. for (var attribute in attributes) this.setProperty(attribute, attributes[attribute]);
  3104. return this;
  3105. },
  3106. getProperty: function(name){
  3107. var getter = propertyGetters[name.toLowerCase()];
  3108. if (getter) return getter(this);
  3109. /* <ltIE9> */
  3110. if (pollutesGetAttribute){
  3111. var attr = this.getAttributeNode(name), attributeWhiteList = this.retrieve('$attributeWhiteList', {});
  3112. if (!attr) return null;
  3113. if (attr.expando && !attributeWhiteList[name]){
  3114. var outer = this.outerHTML;
  3115. // segment by the opening tag and find mention of attribute name
  3116. if (outer.substr(0, outer.search(/\/?['"]?>(?![^<]*<['"])/)).indexOf(name) < 0) return null;
  3117. attributeWhiteList[name] = true;
  3118. }
  3119. }
  3120. /* </ltIE9> */
  3121. var result = Slick.getAttribute(this, name);
  3122. return (!result && !Slick.hasAttribute(this, name)) ? null : result;
  3123. },
  3124. getProperties: function(){
  3125. var args = Array.convert(arguments);
  3126. return args.map(this.getProperty, this).associate(args);
  3127. },
  3128. removeProperty: function(name){
  3129. return this.setProperty(name, null);
  3130. },
  3131. removeProperties: function(){
  3132. Array.each(arguments, this.removeProperty, this);
  3133. return this;
  3134. },
  3135. set: function(prop, value){
  3136. var property = Element.Properties[prop];
  3137. (property && property.set) ? property.set.call(this, value) : this.setProperty(prop, value);
  3138. }.overloadSetter(),
  3139. get: function(prop){
  3140. var property = Element.Properties[prop];
  3141. return (property && property.get) ? property.get.apply(this) : this.getProperty(prop);
  3142. }.overloadGetter(),
  3143. erase: function(prop){
  3144. var property = Element.Properties[prop];
  3145. (property && property.erase) ? property.erase.apply(this) : this.removeProperty(prop);
  3146. return this;
  3147. },
  3148. hasClass: hasClassList ? function(className){
  3149. return this.classList.contains(className);
  3150. } : function(className){
  3151. return classes(this.className).contains(className);
  3152. },
  3153. addClass: hasClassList ? function(className){
  3154. classes(className).forEach(addToClassList, this);
  3155. return this;
  3156. } : function(className){
  3157. this.className = classes(className + ' ' + this.className).join(' ');
  3158. return this;
  3159. },
  3160. removeClass: hasClassList ? function(className){
  3161. classes(className).forEach(removeFromClassList, this);
  3162. return this;
  3163. } : function(className){
  3164. var classNames = classes(this.className);
  3165. classes(className).forEach(classNames.erase, classNames);
  3166. this.className = classNames.join(' ');
  3167. return this;
  3168. },
  3169. toggleClass: function(className, force){
  3170. if (force == null) force = !this.hasClass(className);
  3171. return (force) ? this.addClass(className) : this.removeClass(className);
  3172. },
  3173. adopt: function(){
  3174. var parent = this, fragment, elements = Array.flatten(arguments), length = elements.length;
  3175. if (length > 1) parent = fragment = document.createDocumentFragment();
  3176. for (var i = 0; i < length; i++){
  3177. var element = document.id(elements[i], true);
  3178. if (element) parent.appendChild(element);
  3179. }
  3180. if (fragment) this.appendChild(fragment);
  3181. return this;
  3182. },
  3183. appendText: function(text, where){
  3184. return this.grab(this.getDocument().newTextNode(text), where);
  3185. },
  3186. grab: function(el, where){
  3187. inserters[where || 'bottom'](document.id(el, true), this);
  3188. return this;
  3189. },
  3190. inject: function(el, where){
  3191. inserters[where || 'bottom'](this, document.id(el, true));
  3192. return this;
  3193. },
  3194. replaces: function(el){
  3195. el = document.id(el, true);
  3196. el.parentNode.replaceChild(this, el);
  3197. return this;
  3198. },
  3199. wraps: function(el, where){
  3200. el = document.id(el, true);
  3201. return this.replaces(el).grab(el, where);
  3202. },
  3203. getSelected: function(){
  3204. this.selectedIndex; // Safari 3.2.1
  3205. return new Elements(Array.convert(this.options).filter(function(option){
  3206. return option.selected;
  3207. }));
  3208. },
  3209. toQueryString: function(){
  3210. var queryString = [];
  3211. this.getElements('input, select, textarea').each(function(el){
  3212. var type = el.type;
  3213. if (!el.name || el.disabled || type == 'submit' || type == 'reset' || type == 'file' || type == 'image') return;
  3214. var value = (el.get('tag') == 'select') ? el.getSelected().map(function(opt){
  3215. // IE
  3216. return document.id(opt).get('value');
  3217. }) : ((type == 'radio' || type == 'checkbox') && !el.checked) ? null : el.get('value');
  3218. Array.convert(value).each(function(val){
  3219. if (typeof val != 'undefined') queryString.push(encodeURIComponent(el.name) + '=' + encodeURIComponent(val));
  3220. });
  3221. });
  3222. return queryString.join('&');
  3223. }
  3224. });
  3225. // appendHTML
  3226. var appendInserters = {
  3227. before: 'beforeBegin',
  3228. after: 'afterEnd',
  3229. bottom: 'beforeEnd',
  3230. top: 'afterBegin',
  3231. inside: 'beforeEnd'
  3232. };
  3233. Element.implement('appendHTML', ('insertAdjacentHTML' in document.createElement('div')) ? function(html, where){
  3234. this.insertAdjacentHTML(appendInserters[where || 'bottom'], html);
  3235. return this;
  3236. } : function(html, where){
  3237. var temp = new Element('div', {html: html}),
  3238. children = temp.childNodes,
  3239. fragment = temp.firstChild;
  3240. if (!fragment) return this;
  3241. if (children.length > 1){
  3242. fragment = document.createDocumentFragment();
  3243. for (var i = 0, l = children.length; i < l; i++){
  3244. fragment.appendChild(children[i]);
  3245. }
  3246. }
  3247. inserters[where || 'bottom'](fragment, this);
  3248. return this;
  3249. });
  3250. var collected = {}, storage = {};
  3251. var get = function(uid){
  3252. return (storage[uid] || (storage[uid] = {}));
  3253. };
  3254. var clean = function(item){
  3255. var uid = item.uniqueNumber;
  3256. if (item.removeEvents) item.removeEvents();
  3257. if (item.clearAttributes) item.clearAttributes();
  3258. if (uid != null){
  3259. delete collected[uid];
  3260. delete storage[uid];
  3261. }
  3262. return item;
  3263. };
  3264. var formProps = {input: 'checked', option: 'selected', textarea: 'value'};
  3265. Element.implement({
  3266. destroy: function(){
  3267. var children = clean(this).getElementsByTagName('*');
  3268. Array.each(children, clean);
  3269. Element.dispose(this);
  3270. return null;
  3271. },
  3272. empty: function(){
  3273. Array.convert(this.childNodes).each(Element.dispose);
  3274. return this;
  3275. },
  3276. dispose: function(){
  3277. return (this.parentNode) ? this.parentNode.removeChild(this) : this;
  3278. },
  3279. clone: function(contents, keepid){
  3280. contents = contents !== false;
  3281. var clone = this.cloneNode(contents), ce = [clone], te = [this], i;
  3282. if (contents){
  3283. ce.append(Array.convert(clone.getElementsByTagName('*')));
  3284. te.append(Array.convert(this.getElementsByTagName('*')));
  3285. }
  3286. for (i = ce.length; i--;){
  3287. var node = ce[i], element = te[i];
  3288. if (!keepid) node.removeAttribute('id');
  3289. /*<ltIE9>*/
  3290. if (node.clearAttributes){
  3291. node.clearAttributes();
  3292. node.mergeAttributes(element);
  3293. node.removeAttribute('uniqueNumber');
  3294. if (node.options){
  3295. var no = node.options, eo = element.options;
  3296. for (var j = no.length; j--;) no[j].selected = eo[j].selected;
  3297. }
  3298. }
  3299. /*</ltIE9>*/
  3300. var prop = formProps[element.tagName.toLowerCase()];
  3301. if (prop && element[prop]) node[prop] = element[prop];
  3302. }
  3303. /*<ltIE9>*/
  3304. if (hasCloneBug){
  3305. var co = clone.getElementsByTagName('object'), to = this.getElementsByTagName('object');
  3306. for (i = co.length; i--;) co[i].outerHTML = to[i].outerHTML;
  3307. }
  3308. /*</ltIE9>*/
  3309. return document.id(clone);
  3310. }
  3311. });
  3312. [Element, Window, Document].invoke('implement', {
  3313. addListener: function(type, fn){
  3314. if (window.attachEvent && !window.addEventListener){
  3315. collected[Slick.uidOf(this)] = this;
  3316. }
  3317. if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]);
  3318. else this.attachEvent('on' + type, fn);
  3319. return this;
  3320. },
  3321. removeListener: function(type, fn){
  3322. if (this.removeEventListener) this.removeEventListener(type, fn, !!arguments[2]);
  3323. else this.detachEvent('on' + type, fn);
  3324. return this;
  3325. },
  3326. retrieve: function(property, dflt){
  3327. var storage = get(Slick.uidOf(this)), prop = storage[property];
  3328. if (dflt != null && prop == null) prop = storage[property] = dflt;
  3329. return prop != null ? prop : null;
  3330. },
  3331. store: function(property, value){
  3332. var storage = get(Slick.uidOf(this));
  3333. storage[property] = value;
  3334. return this;
  3335. },
  3336. eliminate: function(property){
  3337. var storage = get(Slick.uidOf(this));
  3338. delete storage[property];
  3339. return this;
  3340. }
  3341. });
  3342. /*<ltIE9>*/
  3343. if (window.attachEvent && !window.addEventListener){
  3344. var gc = function(){
  3345. Object.each(collected, clean);
  3346. if (window.CollectGarbage) CollectGarbage();
  3347. window.removeListener('unload', gc);
  3348. };
  3349. window.addListener('unload', gc);
  3350. }
  3351. /*</ltIE9>*/
  3352. Element.Properties = {};
  3353. //<1.2compat>
  3354. Element.Properties = new Hash;
  3355. //</1.2compat>
  3356. Element.Properties.style = {
  3357. set: function(style){
  3358. this.style.cssText = style;
  3359. },
  3360. get: function(){
  3361. return this.style.cssText;
  3362. },
  3363. erase: function(){
  3364. this.style.cssText = '';
  3365. }
  3366. };
  3367. Element.Properties.tag = {
  3368. get: function(){
  3369. return this.tagName.toLowerCase();
  3370. }
  3371. };
  3372. Element.Properties.html = {
  3373. set: function(html){
  3374. if (html == null) html = '';
  3375. else if (typeOf(html) == 'array') html = html.join('');
  3376. /*<ltIE9>*/
  3377. if (this.styleSheet && !canChangeStyleHTML) this.styleSheet.cssText = html;
  3378. else /*</ltIE9>*/this.innerHTML = html;
  3379. },
  3380. erase: function(){
  3381. this.set('html', '');
  3382. }
  3383. };
  3384. var supportsHTML5Elements = true, supportsTableInnerHTML = true, supportsTRInnerHTML = true;
  3385. /*<ltIE9>*/
  3386. // technique by jdbarlett - http://jdbartlett.com/innershiv/
  3387. var div = document.createElement('div');
  3388. var fragment;
  3389. div.innerHTML = '<nav></nav>';
  3390. supportsHTML5Elements = (div.childNodes.length == 1);
  3391. if (!supportsHTML5Elements){
  3392. var tags = 'abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' ');
  3393. fragment = document.createDocumentFragment(), l = tags.length;
  3394. while (l--) fragment.createElement(tags[l]);
  3395. }
  3396. div = null;
  3397. /*</ltIE9>*/
  3398. /*<IE>*/
  3399. supportsTableInnerHTML = Function.attempt(function(){
  3400. var table = document.createElement('table');
  3401. table.innerHTML = '<tr><td></td></tr>';
  3402. return true;
  3403. });
  3404. /*<ltFF4>*/
  3405. var tr = document.createElement('tr'), html = '<td></td>';
  3406. tr.innerHTML = html;
  3407. supportsTRInnerHTML = (tr.innerHTML == html);
  3408. tr = null;
  3409. /*</ltFF4>*/
  3410. if (!supportsTableInnerHTML || !supportsTRInnerHTML || !supportsHTML5Elements){
  3411. Element.Properties.html.set = (function(set){
  3412. var translations = {
  3413. table: [1, '<table>', '</table>'],
  3414. select: [1, '<select>', '</select>'],
  3415. tbody: [2, '<table><tbody>', '</tbody></table>'],
  3416. tr: [3, '<table><tbody><tr>', '</tr></tbody></table>']
  3417. };
  3418. translations.thead = translations.tfoot = translations.tbody;
  3419. return function(html){
  3420. /*<ltIE9>*/
  3421. if (this.styleSheet) return set.call(this, html);
  3422. /*</ltIE9>*/
  3423. var wrap = translations[this.get('tag')];
  3424. if (!wrap && !supportsHTML5Elements) wrap = [0, '', ''];
  3425. if (!wrap) return set.call(this, html);
  3426. var level = wrap[0], wrapper = document.createElement('div'), target = wrapper;
  3427. if (!supportsHTML5Elements) fragment.appendChild(wrapper);
  3428. wrapper.innerHTML = [wrap[1], html, wrap[2]].flatten().join('');
  3429. while (level--) target = target.firstChild;
  3430. this.empty().adopt(target.childNodes);
  3431. if (!supportsHTML5Elements) fragment.removeChild(wrapper);
  3432. wrapper = null;
  3433. };
  3434. })(Element.Properties.html.set);
  3435. }
  3436. /*</IE>*/
  3437. /*<ltIE9>*/
  3438. var testForm = document.createElement('form');
  3439. testForm.innerHTML = '<select><option>s</option></select>';
  3440. if (testForm.firstChild.value != 's') Element.Properties.value = {
  3441. set: function(value){
  3442. var tag = this.get('tag');
  3443. if (tag != 'select') return this.setProperty('value', value);
  3444. var options = this.getElements('option');
  3445. value = String(value);
  3446. for (var i = 0; i < options.length; i++){
  3447. var option = options[i],
  3448. attr = option.getAttributeNode('value'),
  3449. optionValue = (attr && attr.specified) ? option.value : option.get('text');
  3450. if (optionValue === value) return option.selected = true;
  3451. }
  3452. },
  3453. get: function(){
  3454. var option = this, tag = option.get('tag');
  3455. if (tag != 'select' && tag != 'option') return this.getProperty('value');
  3456. if (tag == 'select' && !(option = option.getSelected()[0])) return '';
  3457. var attr = option.getAttributeNode('value');
  3458. return (attr && attr.specified) ? option.value : option.get('text');
  3459. }
  3460. };
  3461. testForm = null;
  3462. /*</ltIE9>*/
  3463. /*<IE>*/
  3464. if (document.createElement('div').getAttributeNode('id')) Element.Properties.id = {
  3465. set: function(id){
  3466. this.id = this.getAttributeNode('id').value = id;
  3467. },
  3468. get: function(){
  3469. return this.id || null;
  3470. },
  3471. erase: function(){
  3472. this.id = this.getAttributeNode('id').value = '';
  3473. }
  3474. };
  3475. /*</IE>*/
  3476. })();
  3477. /*
  3478. ---
  3479. name: Event
  3480. description: Contains the Event Type, to make the event object cross-browser.
  3481. license: MIT-style license.
  3482. requires: [Window, Document, Array, Function, String, Object]
  3483. provides: Event
  3484. ...
  3485. */
  3486. (function(){
  3487. var _keys = {};
  3488. var normalizeWheelSpeed = function(event){
  3489. var normalized;
  3490. if (event.wheelDelta){
  3491. normalized = event.wheelDelta % 120 == 0 ? event.wheelDelta / 120 : event.wheelDelta / 12;
  3492. } else {
  3493. var rawAmount = event.deltaY || event.detail || 0;
  3494. normalized = -(rawAmount % 3 == 0 ? rawAmount / 3 : rawAmount * 10);
  3495. }
  3496. return normalized;
  3497. };
  3498. var DOMEvent = this.DOMEvent = new Type('DOMEvent', function(event, win){
  3499. if (!win) win = window;
  3500. event = event || win.event;
  3501. if (event.$extended) return event;
  3502. this.event = event;
  3503. this.$extended = true;
  3504. this.shift = event.shiftKey;
  3505. this.control = event.ctrlKey;
  3506. this.alt = event.altKey;
  3507. this.meta = event.metaKey;
  3508. var type = this.type = event.type;
  3509. var target = event.target || event.srcElement;
  3510. while (target && target.nodeType == 3) target = target.parentNode;
  3511. this.target = document.id(target);
  3512. if (type.indexOf('key') == 0){
  3513. var code = this.code = (event.which || event.keyCode);
  3514. if (!this.shift || type != 'keypress') this.key = _keys[code];
  3515. if (type == 'keydown' || type == 'keyup'){
  3516. if (code > 111 && code < 124) this.key = 'f' + (code - 111);
  3517. else if (code > 95 && code < 106) this.key = code - 96;
  3518. }
  3519. if (this.key == null) this.key = String.fromCharCode(code).toLowerCase();
  3520. } else if (type == 'click' || type == 'dblclick' || type == 'contextmenu' || type == 'wheel' || type == 'DOMMouseScroll' || type.indexOf('mouse') == 0){
  3521. var doc = win.document;
  3522. doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
  3523. this.page = {
  3524. x: (event.pageX != null) ? event.pageX : event.clientX + doc.scrollLeft,
  3525. y: (event.pageY != null) ? event.pageY : event.clientY + doc.scrollTop
  3526. };
  3527. this.client = {
  3528. x: (event.pageX != null) ? event.pageX - win.pageXOffset : event.clientX,
  3529. y: (event.pageY != null) ? event.pageY - win.pageYOffset : event.clientY
  3530. };
  3531. if (type == 'DOMMouseScroll' || type == 'wheel' || type == 'mousewheel') this.wheel = normalizeWheelSpeed(event);
  3532. this.rightClick = (event.which == 3 || event.button == 2);
  3533. if (type == 'mouseover' || type == 'mouseout' || type == 'mouseenter' || type == 'mouseleave'){
  3534. var overTarget = type == 'mouseover' || type == 'mouseenter';
  3535. var related = event.relatedTarget || event[(overTarget ? 'from' : 'to') + 'Element'];
  3536. while (related && related.nodeType == 3) related = related.parentNode;
  3537. this.relatedTarget = document.id(related);
  3538. }
  3539. } else if (type.indexOf('touch') == 0 || type.indexOf('gesture') == 0){
  3540. this.rotation = event.rotation;
  3541. this.scale = event.scale;
  3542. this.targetTouches = event.targetTouches;
  3543. this.changedTouches = event.changedTouches;
  3544. var touches = this.touches = event.touches;
  3545. if (touches && touches[0]){
  3546. var touch = touches[0];
  3547. this.page = {x: touch.pageX, y: touch.pageY};
  3548. this.client = {x: touch.clientX, y: touch.clientY};
  3549. }
  3550. }
  3551. if (!this.client) this.client = {};
  3552. if (!this.page) this.page = {};
  3553. });
  3554. DOMEvent.implement({
  3555. stop: function(){
  3556. return this.preventDefault().stopPropagation();
  3557. },
  3558. stopPropagation: function(){
  3559. if (this.event.stopPropagation) this.event.stopPropagation();
  3560. else this.event.cancelBubble = true;
  3561. return this;
  3562. },
  3563. preventDefault: function(){
  3564. if (this.event.preventDefault) this.event.preventDefault();
  3565. else this.event.returnValue = false;
  3566. return this;
  3567. }
  3568. });
  3569. DOMEvent.defineKey = function(code, key){
  3570. _keys[code] = key;
  3571. return this;
  3572. };
  3573. DOMEvent.defineKeys = DOMEvent.defineKey.overloadSetter(true);
  3574. DOMEvent.defineKeys({
  3575. '38': 'up', '40': 'down', '37': 'left', '39': 'right',
  3576. '27': 'esc', '32': 'space', '8': 'backspace', '9': 'tab',
  3577. '46': 'delete', '13': 'enter'
  3578. });
  3579. })();
  3580. // /*<1.3compat>*/
  3581. // var Event = this.Event = DOMEvent;
  3582. // Event.Keys = {};
  3583. // /*</1.3compat>*/
  3584. //
  3585. // /*<1.2compat>*/
  3586. //
  3587. // Event.Keys = new Hash(Event.Keys);
  3588. //
  3589. // /*</1.2compat>*/
  3590. /*
  3591. ---
  3592. name: Element.Event
  3593. description: Contains Element methods for dealing with events. This file also includes mouseenter and mouseleave custom Element Events, if necessary.
  3594. license: MIT-style license.
  3595. requires: [Element, Event]
  3596. provides: Element.Event
  3597. ...
  3598. */
  3599. (function(){
  3600. Element.Properties.events = {set: function(events){
  3601. this.addEvents(events);
  3602. }};
  3603. [Element, Window, Document].invoke('implement', {
  3604. addEvent: function(type, fn){
  3605. var events = this.retrieve('events', {});
  3606. if (!events[type]) events[type] = {keys: [], values: []};
  3607. if (events[type].keys.contains(fn)) return this;
  3608. events[type].keys.push(fn);
  3609. var realType = type,
  3610. custom = Element.Events[type],
  3611. condition = fn,
  3612. self = this;
  3613. if (custom){
  3614. if (custom.onAdd) custom.onAdd.call(this, fn, type);
  3615. if (custom.condition){
  3616. condition = function(event){
  3617. if (custom.condition.call(this, event, type)) return fn.call(this, event);
  3618. return true;
  3619. };
  3620. }
  3621. if (custom.base) realType = Function.convert(custom.base).call(this, type);
  3622. }
  3623. var defn = function(){
  3624. return fn.call(self);
  3625. };
  3626. var nativeEvent = Element.NativeEvents[realType];
  3627. if (nativeEvent){
  3628. if (nativeEvent == 2){
  3629. defn = function(event){
  3630. event = new DOMEvent(event, self.getWindow());
  3631. if (condition.call(self, event) === false) event.stop();
  3632. };
  3633. }
  3634. this.addListener(realType, defn, arguments[2]);
  3635. }
  3636. events[type].values.push(defn);
  3637. return this;
  3638. },
  3639. removeEvent: function(type, fn){
  3640. var events = this.retrieve('events');
  3641. if (!events || !events[type]) return this;
  3642. var list = events[type];
  3643. var index = list.keys.indexOf(fn);
  3644. if (index == -1) return this;
  3645. var value = list.values[index];
  3646. delete list.keys[index];
  3647. delete list.values[index];
  3648. var custom = Element.Events[type];
  3649. if (custom){
  3650. if (custom.onRemove) custom.onRemove.call(this, fn, type);
  3651. if (custom.base) type = Function.convert(custom.base).call(this, type);
  3652. }
  3653. return (Element.NativeEvents[type]) ? this.removeListener(type, value, arguments[2]) : this;
  3654. },
  3655. addEvents: function(events){
  3656. for (var event in events) this.addEvent(event, events[event]);
  3657. return this;
  3658. },
  3659. removeEvents: function(events){
  3660. var type;
  3661. if (typeOf(events) == 'object'){
  3662. for (type in events) this.removeEvent(type, events[type]);
  3663. return this;
  3664. }
  3665. var attached = this.retrieve('events');
  3666. if (!attached) return this;
  3667. if (!events){
  3668. for (type in attached) this.removeEvents(type);
  3669. this.eliminate('events');
  3670. } else if (attached[events]){
  3671. attached[events].keys.each(function(fn){
  3672. this.removeEvent(events, fn);
  3673. }, this);
  3674. delete attached[events];
  3675. }
  3676. return this;
  3677. },
  3678. fireEvent: function(type, args, delay){
  3679. var events = this.retrieve('events');
  3680. if (!events || !events[type]) return this;
  3681. args = Array.convert(args);
  3682. events[type].keys.each(function(fn){
  3683. if (delay) fn.delay(delay, this, args);
  3684. else fn.apply(this, args);
  3685. }, this);
  3686. return this;
  3687. },
  3688. cloneEvents: function(from, type){
  3689. from = document.id(from);
  3690. var events = from.retrieve('events');
  3691. if (!events) return this;
  3692. if (!type){
  3693. for (var eventType in events) this.cloneEvents(from, eventType);
  3694. } else if (events[type]){
  3695. events[type].keys.each(function(fn){
  3696. this.addEvent(type, fn);
  3697. }, this);
  3698. }
  3699. return this;
  3700. }
  3701. });
  3702. Element.NativeEvents = {
  3703. click: 2, dblclick: 2, mouseup: 2, mousedown: 2, contextmenu: 2, //mouse buttons
  3704. wheel: 2, mousewheel: 2, DOMMouseScroll: 2, //mouse wheel
  3705. mouseover: 2, mouseout: 2, mousemove: 2, selectstart: 2, selectend: 2, //mouse movement
  3706. keydown: 2, keypress: 2, keyup: 2, //keyboard
  3707. orientationchange: 2, // mobile
  3708. touchstart: 2, touchmove: 2, touchend: 2, touchcancel: 2, // touch
  3709. gesturestart: 2, gesturechange: 2, gestureend: 2, // gesture
  3710. focus: 2, blur: 2, change: 2, reset: 2, select: 2, submit: 2, paste: 2, input: 2, //form elements
  3711. load: 2, unload: 1, beforeunload: 2, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window
  3712. hashchange: 1, popstate: 2, pageshow: 2, pagehide: 2, // history
  3713. error: 1, abort: 1, scroll: 1, message: 2 //misc
  3714. };
  3715. Element.Events = {
  3716. mousewheel: {
  3717. base: 'onwheel' in document ? 'wheel' : 'onmousewheel' in document ? 'mousewheel' : 'DOMMouseScroll'
  3718. }
  3719. };
  3720. var check = function(event){
  3721. var related = event.relatedTarget;
  3722. if (related == null) return true;
  3723. if (!related) return false;
  3724. return (related != this && related.prefix != 'xul' && typeOf(this) != 'document' && !this.contains(related));
  3725. };
  3726. if ('onmouseenter' in document.documentElement){
  3727. Element.NativeEvents.mouseenter = Element.NativeEvents.mouseleave = 2;
  3728. Element.MouseenterCheck = check;
  3729. } else {
  3730. Element.Events.mouseenter = {
  3731. base: 'mouseover',
  3732. condition: check
  3733. };
  3734. Element.Events.mouseleave = {
  3735. base: 'mouseout',
  3736. condition: check
  3737. };
  3738. }
  3739. /*<ltIE9>*/
  3740. if (!window.addEventListener){
  3741. Element.NativeEvents.propertychange = 2;
  3742. Element.Events.change = {
  3743. base: function(){
  3744. var type = this.type;
  3745. return (this.get('tag') == 'input' && (type == 'radio' || type == 'checkbox')) ? 'propertychange' : 'change';
  3746. },
  3747. condition: function(event){
  3748. return event.type != 'propertychange' || event.event.propertyName == 'checked';
  3749. }
  3750. };
  3751. }
  3752. /*</ltIE9>*/
  3753. //<1.2compat>
  3754. Element.Events = new Hash(Element.Events);
  3755. //</1.2compat>
  3756. })();
  3757. /*
  3758. ---
  3759. name: Element.Delegation
  3760. description: Extends the Element native object to include the delegate method for more efficient event management.
  3761. license: MIT-style license.
  3762. requires: [Element.Event]
  3763. provides: [Element.Delegation]
  3764. ...
  3765. */
  3766. (function(){
  3767. var eventListenerSupport = !!window.addEventListener;
  3768. Element.NativeEvents.focusin = Element.NativeEvents.focusout = 2;
  3769. var bubbleUp = function(self, match, fn, event, target){
  3770. while (target && target != self){
  3771. if (match(target, event)) return fn.call(target, event, target);
  3772. target = document.id(target.parentNode);
  3773. }
  3774. };
  3775. var map = {
  3776. mouseenter: {
  3777. base: 'mouseover',
  3778. condition: Element.MouseenterCheck
  3779. },
  3780. mouseleave: {
  3781. base: 'mouseout',
  3782. condition: Element.MouseenterCheck
  3783. },
  3784. focus: {
  3785. base: 'focus' + (eventListenerSupport ? '' : 'in'),
  3786. capture: true
  3787. },
  3788. blur: {
  3789. base: eventListenerSupport ? 'blur' : 'focusout',
  3790. capture: true
  3791. }
  3792. };
  3793. /*<ltIE9>*/
  3794. var _key = '$delegation:';
  3795. var formObserver = function(type){
  3796. return {
  3797. base: 'focusin',
  3798. remove: function(self, uid){
  3799. var list = self.retrieve(_key + type + 'listeners', {})[uid];
  3800. if (list && list.forms) for (var i = list.forms.length; i--;){
  3801. // the form may have been destroyed, so it won't have the
  3802. // removeEvent method anymore. In that case the event was
  3803. // removed as well.
  3804. if (list.forms[i].removeEvent) list.forms[i].removeEvent(type, list.fns[i]);
  3805. }
  3806. },
  3807. listen: function(self, match, fn, event, target, uid){
  3808. var form = (target.get('tag') == 'form') ? target : event.target.getParent('form');
  3809. if (!form) return;
  3810. var listeners = self.retrieve(_key + type + 'listeners', {}),
  3811. listener = listeners[uid] || {forms: [], fns: []},
  3812. forms = listener.forms, fns = listener.fns;
  3813. if (forms.indexOf(form) != -1) return;
  3814. forms.push(form);
  3815. var _fn = function(event){
  3816. bubbleUp(self, match, fn, event, target);
  3817. };
  3818. form.addEvent(type, _fn);
  3819. fns.push(_fn);
  3820. listeners[uid] = listener;
  3821. self.store(_key + type + 'listeners', listeners);
  3822. }
  3823. };
  3824. };
  3825. var inputObserver = function(type){
  3826. return {
  3827. base: 'focusin',
  3828. listen: function(self, match, fn, event, target){
  3829. var events = {blur: function(){
  3830. this.removeEvents(events);
  3831. }};
  3832. events[type] = function(event){
  3833. bubbleUp(self, match, fn, event, target);
  3834. };
  3835. event.target.addEvents(events);
  3836. }
  3837. };
  3838. };
  3839. if (!eventListenerSupport) Object.append(map, {
  3840. submit: formObserver('submit'),
  3841. reset: formObserver('reset'),
  3842. change: inputObserver('change'),
  3843. select: inputObserver('select')
  3844. });
  3845. /*</ltIE9>*/
  3846. var proto = Element.prototype,
  3847. addEvent = proto.addEvent,
  3848. removeEvent = proto.removeEvent;
  3849. var relay = function(old, method){
  3850. return function(type, fn, useCapture){
  3851. if (type.indexOf(':relay') == -1) return old.call(this, type, fn, useCapture);
  3852. var parsed = Slick.parse(type).expressions[0][0];
  3853. if (parsed.pseudos[0].key != 'relay') return old.call(this, type, fn, useCapture);
  3854. var newType = parsed.tag;
  3855. parsed.pseudos.slice(1).each(function(pseudo){
  3856. newType += ':' + pseudo.key + (pseudo.value ? '(' + pseudo.value + ')' : '');
  3857. });
  3858. old.call(this, type, fn);
  3859. return method.call(this, newType, parsed.pseudos[0].value, fn);
  3860. };
  3861. };
  3862. var delegation = {
  3863. addEvent: function(type, match, fn){
  3864. var storage = this.retrieve('$delegates', {}), stored = storage[type];
  3865. if (stored) for (var _uid in stored){
  3866. if (stored[_uid].fn == fn && stored[_uid].match == match) return this;
  3867. }
  3868. var _type = type, _match = match, _fn = fn, _map = map[type] || {};
  3869. type = _map.base || _type;
  3870. match = function(target){
  3871. return Slick.match(target, _match);
  3872. };
  3873. var elementEvent = Element.Events[_type];
  3874. if (_map.condition || elementEvent && elementEvent.condition){
  3875. var __match = match, condition = _map.condition || elementEvent.condition;
  3876. match = function(target, event){
  3877. return __match(target, event) && condition.call(target, event, type);
  3878. };
  3879. }
  3880. var self = this, uid = String.uniqueID();
  3881. var delegator = _map.listen ? function(event, target){
  3882. if (!target && event && event.target) target = event.target;
  3883. if (target) _map.listen(self, match, fn, event, target, uid);
  3884. } : function(event, target){
  3885. if (!target && event && event.target) target = event.target;
  3886. if (target) bubbleUp(self, match, fn, event, target);
  3887. };
  3888. if (!stored) stored = {};
  3889. stored[uid] = {
  3890. match: _match,
  3891. fn: _fn,
  3892. delegator: delegator
  3893. };
  3894. storage[_type] = stored;
  3895. return addEvent.call(this, type, delegator, _map.capture);
  3896. },
  3897. removeEvent: function(type, match, fn, _uid){
  3898. var storage = this.retrieve('$delegates', {}), stored = storage[type];
  3899. if (!stored) return this;
  3900. if (_uid){
  3901. var _type = type, delegator = stored[_uid].delegator, _map = map[type] || {};
  3902. type = _map.base || _type;
  3903. if (_map.remove) _map.remove(this, _uid);
  3904. delete stored[_uid];
  3905. storage[_type] = stored;
  3906. return removeEvent.call(this, type, delegator, _map.capture);
  3907. }
  3908. var __uid, s;
  3909. if (fn) for (__uid in stored){
  3910. s = stored[__uid];
  3911. if (s.match == match && s.fn == fn) return delegation.removeEvent.call(this, type, match, fn, __uid);
  3912. } else for (__uid in stored){
  3913. s = stored[__uid];
  3914. if (s.match == match) delegation.removeEvent.call(this, type, match, s.fn, __uid);
  3915. }
  3916. return this;
  3917. }
  3918. };
  3919. [Element, Window, Document].invoke('implement', {
  3920. addEvent: relay(addEvent, delegation.addEvent),
  3921. removeEvent: relay(removeEvent, delegation.removeEvent)
  3922. });
  3923. })();
  3924. /*
  3925. ---
  3926. name: Element.Style
  3927. description: Contains methods for interacting with the styles of Elements in a fashionable way.
  3928. license: MIT-style license.
  3929. requires: Element
  3930. provides: Element.Style
  3931. ...
  3932. */
  3933. (function(){
  3934. var html = document.html, el;
  3935. //<ltIE9>
  3936. // Check for oldIE, which does not remove styles when they're set to null
  3937. el = document.createElement('div');
  3938. el.style.color = 'red';
  3939. el.style.color = null;
  3940. var doesNotRemoveStyles = el.style.color == 'red';
  3941. // check for oldIE, which returns border* shorthand styles in the wrong order (color-width-style instead of width-style-color)
  3942. var border = '1px solid #123abc';
  3943. el.style.border = border;
  3944. var returnsBordersInWrongOrder = el.style.border != border;
  3945. el = null;
  3946. //</ltIE9>
  3947. var hasGetComputedStyle = !!window.getComputedStyle,
  3948. supportBorderRadius = document.createElement('div').style.borderRadius != null;
  3949. Element.Properties.styles = {set: function(styles){
  3950. this.setStyles(styles);
  3951. }};
  3952. var hasOpacity = (html.style.opacity != null),
  3953. hasFilter = (html.style.filter != null),
  3954. reAlpha = /alpha\(opacity=([\d.]+)\)/i;
  3955. var setVisibility = function(element, opacity){
  3956. element.store('$opacity', opacity);
  3957. element.style.visibility = opacity > 0 || opacity == null ? 'visible' : 'hidden';
  3958. };
  3959. //<ltIE9>
  3960. var setFilter = function(element, regexp, value){
  3961. var style = element.style,
  3962. filter = style.filter || element.getComputedStyle('filter') || '';
  3963. style.filter = (regexp.test(filter) ? filter.replace(regexp, value) : filter + ' ' + value).trim();
  3964. if (!style.filter) style.removeAttribute('filter');
  3965. };
  3966. //</ltIE9>
  3967. var setOpacity = (hasOpacity ? function(element, opacity){
  3968. element.style.opacity = opacity;
  3969. } : (hasFilter ? function(element, opacity){
  3970. if (!element.currentStyle || !element.currentStyle.hasLayout) element.style.zoom = 1;
  3971. if (opacity == null || opacity == 1){
  3972. setFilter(element, reAlpha, '');
  3973. if (opacity == 1 && getOpacity(element) != 1) setFilter(element, reAlpha, 'alpha(opacity=100)');
  3974. } else {
  3975. setFilter(element, reAlpha, 'alpha(opacity=' + (opacity * 100).limit(0, 100).round() + ')');
  3976. }
  3977. } : setVisibility));
  3978. var getOpacity = (hasOpacity ? function(element){
  3979. var opacity = element.style.opacity || element.getComputedStyle('opacity');
  3980. return (opacity == '') ? 1 : opacity.toFloat();
  3981. } : (hasFilter ? function(element){
  3982. var filter = (element.style.filter || element.getComputedStyle('filter')),
  3983. opacity;
  3984. if (filter) opacity = filter.match(reAlpha);
  3985. return (opacity == null || filter == null) ? 1 : (opacity[1] / 100);
  3986. } : function(element){
  3987. var opacity = element.retrieve('$opacity');
  3988. if (opacity == null) opacity = (element.style.visibility == 'hidden' ? 0 : 1);
  3989. return opacity;
  3990. }));
  3991. var floatName = (html.style.cssFloat == null) ? 'styleFloat' : 'cssFloat',
  3992. namedPositions = {left: '0%', top: '0%', center: '50%', right: '100%', bottom: '100%'},
  3993. hasBackgroundPositionXY = (html.style.backgroundPositionX != null),
  3994. prefixPattern = /^-(ms)-/;
  3995. var camelCase = function(property){
  3996. return property.replace(prefixPattern, '$1-').camelCase();
  3997. };
  3998. //<ltIE9>
  3999. var removeStyle = function(style, property){
  4000. if (property == 'backgroundPosition'){
  4001. style.removeAttribute(property + 'X');
  4002. property += 'Y';
  4003. }
  4004. style.removeAttribute(property);
  4005. };
  4006. //</ltIE9>
  4007. Element.implement({
  4008. getComputedStyle: function(property){
  4009. if (!hasGetComputedStyle && this.currentStyle) return this.currentStyle[camelCase(property)];
  4010. var defaultView = Element.getDocument(this).defaultView,
  4011. computed = defaultView ? defaultView.getComputedStyle(this, null) : null;
  4012. return (computed) ? computed.getPropertyValue((property == floatName) ? 'float' : property.hyphenate()) : '';
  4013. },
  4014. setStyle: function(property, value){
  4015. if (property == 'opacity'){
  4016. if (value != null) value = parseFloat(value);
  4017. setOpacity(this, value);
  4018. return this;
  4019. }
  4020. property = camelCase(property == 'float' ? floatName : property);
  4021. if (typeOf(value) != 'string'){
  4022. var map = (Element.Styles[property] || '@').split(' ');
  4023. value = Array.convert(value).map(function(val, i){
  4024. if (!map[i]) return '';
  4025. return (typeOf(val) == 'number') ? map[i].replace('@', Math.round(val)) : val;
  4026. }).join(' ');
  4027. } else if (value == String(Number(value))){
  4028. value = Math.round(value);
  4029. }
  4030. this.style[property] = value;
  4031. //<ltIE9>
  4032. if ((value == '' || value == null) && doesNotRemoveStyles && this.style.removeAttribute){
  4033. removeStyle(this.style, property);
  4034. }
  4035. //</ltIE9>
  4036. return this;
  4037. },
  4038. getStyle: function(property){
  4039. if (property == 'opacity') return getOpacity(this);
  4040. property = camelCase(property == 'float' ? floatName : property);
  4041. if (supportBorderRadius && property.indexOf('borderRadius') != -1){
  4042. return ['borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomRightRadius', 'borderBottomLeftRadius'].map(function(corner){
  4043. return this.style[corner] || '0px';
  4044. }, this).join(' ');
  4045. }
  4046. var result = this.style[property];
  4047. if (!result || property == 'zIndex'){
  4048. if (Element.ShortStyles.hasOwnProperty(property)){
  4049. result = [];
  4050. for (var s in Element.ShortStyles[property]) result.push(this.getStyle(s));
  4051. return result.join(' ');
  4052. }
  4053. result = this.getComputedStyle(property);
  4054. }
  4055. if (hasBackgroundPositionXY && /^backgroundPosition[XY]?$/.test(property)){
  4056. return result.replace(/(top|right|bottom|left)/g, function(position){
  4057. return namedPositions[position];
  4058. }) || '0px';
  4059. }
  4060. if (!result && property == 'backgroundPosition') return '0px 0px';
  4061. if (result){
  4062. result = String(result);
  4063. var color = result.match(/rgba?\([\d\s,]+\)/);
  4064. if (color) result = result.replace(color[0], color[0].rgbToHex());
  4065. }
  4066. if (!hasGetComputedStyle && !this.style[property]){
  4067. if ((/^(height|width)$/).test(property) && !(/px$/.test(result))){
  4068. var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0;
  4069. values.each(function(value){
  4070. size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt();
  4071. }, this);
  4072. return this['offset' + property.capitalize()] - size + 'px';
  4073. }
  4074. if ((/^border(.+)Width|margin|padding/).test(property) && isNaN(parseFloat(result))){
  4075. return '0px';
  4076. }
  4077. }
  4078. //<ltIE9>
  4079. if (returnsBordersInWrongOrder && /^border(Top|Right|Bottom|Left)?$/.test(property) && /^#/.test(result)){
  4080. return result.replace(/^(.+)\s(.+)\s(.+)$/, '$2 $3 $1');
  4081. }
  4082. //</ltIE9>
  4083. return result;
  4084. },
  4085. setStyles: function(styles){
  4086. for (var style in styles) this.setStyle(style, styles[style]);
  4087. return this;
  4088. },
  4089. getStyles: function(){
  4090. var result = {};
  4091. Array.flatten(arguments).each(function(key){
  4092. result[key] = this.getStyle(key);
  4093. }, this);
  4094. return result;
  4095. }
  4096. });
  4097. Element.Styles = {
  4098. left: '@px', top: '@px', bottom: '@px', right: '@px',
  4099. width: '@px', height: '@px', maxWidth: '@px', maxHeight: '@px', minWidth: '@px', minHeight: '@px',
  4100. backgroundColor: 'rgb(@, @, @)', backgroundSize: '@px', backgroundPosition: '@px @px', color: 'rgb(@, @, @)',
  4101. fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)',
  4102. margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)',
  4103. borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)',
  4104. zIndex: '@', 'zoom': '@', fontWeight: '@', textIndent: '@px', opacity: '@', borderRadius: '@px @px @px @px'
  4105. };
  4106. //<1.3compat>
  4107. Element.implement({
  4108. setOpacity: function(value){
  4109. setOpacity(this, value);
  4110. return this;
  4111. },
  4112. getOpacity: function(){
  4113. return getOpacity(this);
  4114. }
  4115. });
  4116. Element.Properties.opacity = {
  4117. set: function(opacity){
  4118. setOpacity(this, opacity);
  4119. setVisibility(this, opacity);
  4120. },
  4121. get: function(){
  4122. return getOpacity(this);
  4123. }
  4124. };
  4125. //</1.3compat>
  4126. //<1.2compat>
  4127. Element.Styles = new Hash(Element.Styles);
  4128. //</1.2compat>
  4129. Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, borderStyle: {}, borderColor: {}};
  4130. ['Top', 'Right', 'Bottom', 'Left'].each(function(direction){
  4131. var Short = Element.ShortStyles;
  4132. var All = Element.Styles;
  4133. ['margin', 'padding'].each(function(style){
  4134. var sd = style + direction;
  4135. Short[style][sd] = All[sd] = '@px';
  4136. });
  4137. var bd = 'border' + direction;
  4138. Short.border[bd] = All[bd] = '@px @ rgb(@, @, @)';
  4139. var bdw = bd + 'Width', bds = bd + 'Style', bdc = bd + 'Color';
  4140. Short[bd] = {};
  4141. Short.borderWidth[bdw] = Short[bd][bdw] = All[bdw] = '@px';
  4142. Short.borderStyle[bds] = Short[bd][bds] = All[bds] = '@';
  4143. Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)';
  4144. });
  4145. if (hasBackgroundPositionXY) Element.ShortStyles.backgroundPosition = {backgroundPositionX: '@', backgroundPositionY: '@'};
  4146. })();
  4147. /*
  4148. ---
  4149. name: Element.Dimensions
  4150. description: Contains methods to work with size, scroll, or positioning of Elements and the window object.
  4151. license: MIT-style license.
  4152. credits:
  4153. - Element positioning based on the [qooxdoo](http://qooxdoo.org/) code and smart browser fixes, [LGPL License](http://www.gnu.org/licenses/lgpl.html).
  4154. - Viewport dimensions based on [YUI](http://developer.yahoo.com/yui/) code, [BSD License](http://developer.yahoo.com/yui/license.html).
  4155. requires: [Element, Element.Style]
  4156. provides: [Element.Dimensions]
  4157. ...
  4158. */
  4159. (function(){
  4160. var element = document.createElement('div'),
  4161. child = document.createElement('div');
  4162. element.style.height = '0';
  4163. element.appendChild(child);
  4164. var brokenOffsetParent = (child.offsetParent === element);
  4165. element = child = null;
  4166. var heightComponents = ['height', 'paddingTop', 'paddingBottom', 'borderTopWidth', 'borderBottomWidth'],
  4167. widthComponents = ['width', 'paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'];
  4168. var svgCalculateSize = function(el){
  4169. var gCS = window.getComputedStyle(el),
  4170. bounds = {x: 0, y: 0};
  4171. heightComponents.each(function(css){
  4172. bounds.y += parseFloat(gCS[css]);
  4173. });
  4174. widthComponents.each(function(css){
  4175. bounds.x += parseFloat(gCS[css]);
  4176. });
  4177. return bounds;
  4178. };
  4179. var isOffset = function(el){
  4180. return styleString(el, 'position') != 'static' || isBody(el);
  4181. };
  4182. var isOffsetStatic = function(el){
  4183. return isOffset(el) || (/^(?:table|td|th)$/i).test(el.tagName);
  4184. };
  4185. Element.implement({
  4186. scrollTo: function(x, y){
  4187. if (isBody(this)){
  4188. this.getWindow().scrollTo(x, y);
  4189. } else {
  4190. this.scrollLeft = x;
  4191. this.scrollTop = y;
  4192. }
  4193. return this;
  4194. },
  4195. getSize: function(){
  4196. if (isBody(this)) return this.getWindow().getSize();
  4197. //<ltIE9>
  4198. // This if clause is because IE8- cannot calculate getBoundingClientRect of elements with visibility hidden.
  4199. if (!window.getComputedStyle) return {x: this.offsetWidth, y: this.offsetHeight};
  4200. //</ltIE9>
  4201. // This svg section under, calling `svgCalculateSize()`, can be removed when FF fixed the svg size bug.
  4202. // Bug info: https://bugzilla.mozilla.org/show_bug.cgi?id=530985
  4203. if (this.get('tag') == 'svg') return svgCalculateSize(this);
  4204. try {
  4205. var bounds = this.getBoundingClientRect();
  4206. return {x: bounds.width, y: bounds.height};
  4207. } catch (e){
  4208. return {x: 0, y: 0};
  4209. }
  4210. },
  4211. getScrollSize: function(){
  4212. if (isBody(this)) return this.getWindow().getScrollSize();
  4213. return {x: this.scrollWidth, y: this.scrollHeight};
  4214. },
  4215. getScroll: function(){
  4216. if (isBody(this)) return this.getWindow().getScroll();
  4217. return {x: this.scrollLeft, y: this.scrollTop};
  4218. },
  4219. getScrolls: function(){
  4220. var element = this.parentNode, position = {x: 0, y: 0};
  4221. while (element && !isBody(element)){
  4222. position.x += element.scrollLeft;
  4223. position.y += element.scrollTop;
  4224. element = element.parentNode;
  4225. }
  4226. return position;
  4227. },
  4228. getOffsetParent: brokenOffsetParent ? function(){
  4229. var element = this;
  4230. if (isBody(element) || styleString(element, 'position') == 'fixed') return null;
  4231. var isOffsetCheck = (styleString(element, 'position') == 'static') ? isOffsetStatic : isOffset;
  4232. while ((element = element.parentNode)){
  4233. if (isOffsetCheck(element)) return element;
  4234. }
  4235. return null;
  4236. } : function(){
  4237. var element = this;
  4238. if (isBody(element) || styleString(element, 'position') == 'fixed') return null;
  4239. try {
  4240. return element.offsetParent;
  4241. } catch (e){}
  4242. return null;
  4243. },
  4244. getOffsets: function(){
  4245. var hasGetBoundingClientRect = this.getBoundingClientRect;
  4246. //<1.4compat>
  4247. hasGetBoundingClientRect = hasGetBoundingClientRect && !Browser.Platform.ios;
  4248. //</1.4compat>
  4249. if (hasGetBoundingClientRect){
  4250. var bound = this.getBoundingClientRect(),
  4251. html = document.id(this.getDocument().documentElement),
  4252. htmlScroll = html.getScroll(),
  4253. elemScrolls = this.getScrolls(),
  4254. isFixed = (styleString(this, 'position') == 'fixed');
  4255. return {
  4256. x: bound.left.toFloat() + elemScrolls.x + ((isFixed) ? 0 : htmlScroll.x) - html.clientLeft,
  4257. y: bound.top.toFloat() + elemScrolls.y + ((isFixed) ? 0 : htmlScroll.y) - html.clientTop
  4258. };
  4259. }
  4260. var element = this, position = {x: 0, y: 0};
  4261. if (isBody(this)) return position;
  4262. while (element && !isBody(element)){
  4263. position.x += element.offsetLeft;
  4264. position.y += element.offsetTop;
  4265. //<1.4compat>
  4266. if (Browser.firefox){
  4267. if (!borderBox(element)){
  4268. position.x += leftBorder(element);
  4269. position.y += topBorder(element);
  4270. }
  4271. var parent = element.parentNode;
  4272. if (parent && styleString(parent, 'overflow') != 'visible'){
  4273. position.x += leftBorder(parent);
  4274. position.y += topBorder(parent);
  4275. }
  4276. } else if (element != this && Browser.safari){
  4277. position.x += leftBorder(element);
  4278. position.y += topBorder(element);
  4279. }
  4280. //</1.4compat>
  4281. element = element.offsetParent;
  4282. }
  4283. //<1.4compat>
  4284. if (Browser.firefox && !borderBox(this)){
  4285. position.x -= leftBorder(this);
  4286. position.y -= topBorder(this);
  4287. }
  4288. //</1.4compat>
  4289. return position;
  4290. },
  4291. getPosition: function(relative){
  4292. var offset = this.getOffsets(),
  4293. scroll = this.getScrolls();
  4294. var position = {
  4295. x: offset.x - scroll.x,
  4296. y: offset.y - scroll.y
  4297. };
  4298. if (relative && (relative = document.id(relative))){
  4299. var relativePosition = relative.getPosition();
  4300. return {x: position.x - relativePosition.x - leftBorder(relative), y: position.y - relativePosition.y - topBorder(relative)};
  4301. }
  4302. return position;
  4303. },
  4304. getCoordinates: function(element){
  4305. if (isBody(this)) return this.getWindow().getCoordinates();
  4306. var position = this.getPosition(element),
  4307. size = this.getSize();
  4308. var obj = {
  4309. left: position.x,
  4310. top: position.y,
  4311. width: size.x,
  4312. height: size.y
  4313. };
  4314. obj.right = obj.left + obj.width;
  4315. obj.bottom = obj.top + obj.height;
  4316. return obj;
  4317. },
  4318. computePosition: function(obj){
  4319. return {
  4320. left: obj.x - styleNumber(this, 'margin-left'),
  4321. top: obj.y - styleNumber(this, 'margin-top')
  4322. };
  4323. },
  4324. setPosition: function(obj){
  4325. return this.setStyles(this.computePosition(obj));
  4326. }
  4327. });
  4328. [Document, Window].invoke('implement', {
  4329. getSize: function(){
  4330. var doc = getCompatElement(this);
  4331. return {x: doc.clientWidth, y: doc.clientHeight};
  4332. },
  4333. getScroll: function(){
  4334. var win = this.getWindow(), doc = getCompatElement(this);
  4335. return {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop};
  4336. },
  4337. getScrollSize: function(){
  4338. var doc = getCompatElement(this),
  4339. min = this.getSize(),
  4340. body = this.getDocument().body;
  4341. return {x: Math.max(doc.scrollWidth, body.scrollWidth, min.x), y: Math.max(doc.scrollHeight, body.scrollHeight, min.y)};
  4342. },
  4343. getPosition: function(){
  4344. return {x: 0, y: 0};
  4345. },
  4346. getCoordinates: function(){
  4347. var size = this.getSize();
  4348. return {top: 0, left: 0, bottom: size.y, right: size.x, height: size.y, width: size.x};
  4349. }
  4350. });
  4351. // private methods
  4352. var styleString = Element.getComputedStyle;
  4353. function styleNumber(element, style){
  4354. return styleString(element, style).toInt() || 0;
  4355. }
  4356. //<1.4compat>
  4357. function borderBox(element){
  4358. return styleString(element, '-moz-box-sizing') == 'border-box';
  4359. }
  4360. //</1.4compat>
  4361. function topBorder(element){
  4362. return styleNumber(element, 'border-top-width');
  4363. }
  4364. function leftBorder(element){
  4365. return styleNumber(element, 'border-left-width');
  4366. }
  4367. function isBody(element){
  4368. return (/^(?:body|html)$/i).test(element.tagName);
  4369. }
  4370. function getCompatElement(element){
  4371. var doc = element.getDocument();
  4372. return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
  4373. }
  4374. })();
  4375. //aliases
  4376. Element.alias({position: 'setPosition'}); //compatability
  4377. [Window, Document, Element].invoke('implement', {
  4378. getHeight: function(){
  4379. return this.getSize().y;
  4380. },
  4381. getWidth: function(){
  4382. return this.getSize().x;
  4383. },
  4384. getScrollTop: function(){
  4385. return this.getScroll().y;
  4386. },
  4387. getScrollLeft: function(){
  4388. return this.getScroll().x;
  4389. },
  4390. getScrollHeight: function(){
  4391. return this.getScrollSize().y;
  4392. },
  4393. getScrollWidth: function(){
  4394. return this.getScrollSize().x;
  4395. },
  4396. getTop: function(){
  4397. return this.getPosition().y;
  4398. },
  4399. getLeft: function(){
  4400. return this.getPosition().x;
  4401. }
  4402. });
  4403. /*
  4404. ---
  4405. name: Fx
  4406. description: Contains the basic animation logic to be extended by all other Fx Classes.
  4407. license: MIT-style license.
  4408. requires: [Chain, Events, Options, Class.Thenable]
  4409. provides: Fx
  4410. ...
  4411. */
  4412. (function(){
  4413. var Fx = this.Fx = new Class({
  4414. Implements: [Chain, Events, Options, Class.Thenable],
  4415. options: {
  4416. /*
  4417. onStart: nil,
  4418. onCancel: nil,
  4419. onComplete: nil,
  4420. */
  4421. fps: 60,
  4422. unit: false,
  4423. duration: 500,
  4424. frames: null,
  4425. frameSkip: true,
  4426. link: 'ignore'
  4427. },
  4428. initialize: function(options){
  4429. this.subject = this.subject || this;
  4430. this.setOptions(options);
  4431. },
  4432. getTransition: function(){
  4433. return function(p){
  4434. return -(Math.cos(Math.PI * p) - 1) / 2;
  4435. };
  4436. },
  4437. step: function(now){
  4438. if (this.options.frameSkip){
  4439. var diff = (this.time != null) ? (now - this.time) : 0, frames = diff / this.frameInterval;
  4440. this.time = now;
  4441. this.frame += frames;
  4442. } else {
  4443. this.frame++;
  4444. }
  4445. if (this.frame < this.frames){
  4446. var delta = this.transition(this.frame / this.frames);
  4447. this.set(this.compute(this.from, this.to, delta));
  4448. } else {
  4449. this.frame = this.frames;
  4450. this.set(this.compute(this.from, this.to, 1));
  4451. this.stop();
  4452. }
  4453. },
  4454. set: function(now){
  4455. return now;
  4456. },
  4457. compute: function(from, to, delta){
  4458. return Fx.compute(from, to, delta);
  4459. },
  4460. check: function(){
  4461. if (!this.isRunning()) return true;
  4462. switch (this.options.link){
  4463. case 'cancel': this.cancel(); return true;
  4464. case 'chain': this.chain(this.caller.pass(arguments, this)); return false;
  4465. }
  4466. return false;
  4467. },
  4468. start: function(from, to){
  4469. if (!this.check(from, to)) return this;
  4470. this.from = from;
  4471. this.to = to;
  4472. this.frame = (this.options.frameSkip) ? 0 : -1;
  4473. this.time = null;
  4474. this.transition = this.getTransition();
  4475. var frames = this.options.frames, fps = this.options.fps, duration = this.options.duration;
  4476. this.duration = Fx.Durations[duration] || duration.toInt();
  4477. this.frameInterval = 1000 / fps;
  4478. this.frames = frames || Math.round(this.duration / this.frameInterval);
  4479. if (this.getThenableState() !== 'pending'){
  4480. this.resetThenable(this.subject);
  4481. }
  4482. this.fireEvent('start', this.subject);
  4483. pushInstance.call(this, fps);
  4484. return this;
  4485. },
  4486. stop: function(){
  4487. if (this.isRunning()){
  4488. this.time = null;
  4489. pullInstance.call(this, this.options.fps);
  4490. if (this.frames == this.frame){
  4491. this.fireEvent('complete', this.subject);
  4492. if (!this.callChain()) this.fireEvent('chainComplete', this.subject);
  4493. } else {
  4494. this.fireEvent('stop', this.subject);
  4495. }
  4496. this.resolve(this.subject === this ? null : this.subject);
  4497. }
  4498. return this;
  4499. },
  4500. cancel: function(){
  4501. if (this.isRunning()){
  4502. this.time = null;
  4503. pullInstance.call(this, this.options.fps);
  4504. this.frame = this.frames;
  4505. this.fireEvent('cancel', this.subject).clearChain();
  4506. this.reject(this.subject);
  4507. }
  4508. return this;
  4509. },
  4510. pause: function(){
  4511. if (this.isRunning()){
  4512. this.time = null;
  4513. pullInstance.call(this, this.options.fps);
  4514. }
  4515. return this;
  4516. },
  4517. resume: function(){
  4518. if (this.isPaused()) pushInstance.call(this, this.options.fps);
  4519. return this;
  4520. },
  4521. isRunning: function(){
  4522. var list = instances[this.options.fps];
  4523. return list && list.contains(this);
  4524. },
  4525. isPaused: function(){
  4526. return (this.frame < this.frames) && !this.isRunning();
  4527. }
  4528. });
  4529. Fx.compute = function(from, to, delta){
  4530. return (to - from) * delta + from;
  4531. };
  4532. Fx.Durations = {'short': 250, 'normal': 500, 'long': 1000};
  4533. // global timers
  4534. var instances = {}, timers = {};
  4535. var loop = function(){
  4536. var now = Date.now();
  4537. for (var i = this.length; i--;){
  4538. var instance = this[i];
  4539. if (instance) instance.step(now);
  4540. }
  4541. };
  4542. var pushInstance = function(fps){
  4543. var list = instances[fps] || (instances[fps] = []);
  4544. list.push(this);
  4545. if (!timers[fps]) timers[fps] = loop.periodical(Math.round(1000 / fps), list);
  4546. };
  4547. var pullInstance = function(fps){
  4548. var list = instances[fps];
  4549. if (list){
  4550. list.erase(this);
  4551. if (!list.length && timers[fps]){
  4552. delete instances[fps];
  4553. timers[fps] = clearInterval(timers[fps]);
  4554. }
  4555. }
  4556. };
  4557. })();
  4558. /*
  4559. ---
  4560. name: Fx.CSS
  4561. description: Contains the CSS animation logic. Used by Fx.Tween, Fx.Morph, Fx.Elements.
  4562. license: MIT-style license.
  4563. requires: [Fx, Element.Style]
  4564. provides: Fx.CSS
  4565. ...
  4566. */
  4567. Fx.CSS = new Class({
  4568. Extends: Fx,
  4569. //prepares the base from/to object
  4570. prepare: function(element, property, values){
  4571. values = Array.convert(values);
  4572. var from = values[0], to = values[1];
  4573. if (to == null){
  4574. to = from;
  4575. from = element.getStyle(property);
  4576. var unit = this.options.unit;
  4577. // adapted from: https://github.com/ryanmorr/fx/blob/master/fx.js#L299
  4578. if (unit && from && typeof from == 'string' && from.slice(-unit.length) != unit && parseFloat(from) != 0){
  4579. element.setStyle(property, to + unit);
  4580. var value = element.getComputedStyle(property);
  4581. // IE and Opera support pixelLeft or pixelWidth
  4582. if (!(/px$/.test(value))){
  4583. value = element.style[('pixel-' + property).camelCase()];
  4584. if (value == null){
  4585. // adapted from Dean Edwards' http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  4586. var left = element.style.left;
  4587. element.style.left = to + unit;
  4588. value = element.style.pixelLeft;
  4589. element.style.left = left;
  4590. }
  4591. }
  4592. from = (to || 1) / (parseFloat(value) || 1) * (parseFloat(from) || 0);
  4593. element.setStyle(property, from + unit);
  4594. }
  4595. }
  4596. return {from: this.parse(from), to: this.parse(to)};
  4597. },
  4598. //parses a value into an array
  4599. parse: function(value){
  4600. value = Function.convert(value)();
  4601. value = (typeof value == 'string') ? value.split(' ') : Array.convert(value);
  4602. return value.map(function(val){
  4603. val = String(val);
  4604. var found = false;
  4605. Object.each(Fx.CSS.Parsers, function(parser){
  4606. if (found) return;
  4607. var parsed = parser.parse(val);
  4608. if (parsed || parsed === 0) found = {value: parsed, parser: parser};
  4609. });
  4610. found = found || {value: val, parser: Fx.CSS.Parsers.String};
  4611. return found;
  4612. });
  4613. },
  4614. //computes by a from and to prepared objects, using their parsers.
  4615. compute: function(from, to, delta){
  4616. var computed = [];
  4617. (Math.min(from.length, to.length)).times(function(i){
  4618. computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser});
  4619. });
  4620. computed.$family = Function.convert('fx:css:value');
  4621. return computed;
  4622. },
  4623. //serves the value as settable
  4624. serve: function(value, unit){
  4625. if (typeOf(value) != 'fx:css:value') value = this.parse(value);
  4626. var returned = [];
  4627. value.each(function(bit){
  4628. returned = returned.concat(bit.parser.serve(bit.value, unit));
  4629. });
  4630. return returned;
  4631. },
  4632. //renders the change to an element
  4633. render: function(element, property, value, unit){
  4634. element.setStyle(property, this.serve(value, unit));
  4635. },
  4636. //searches inside the page css to find the values for a selector
  4637. search: function(selector){
  4638. if (Fx.CSS.Cache[selector]) return Fx.CSS.Cache[selector];
  4639. var to = {}, selectorTest = new RegExp('^' + selector.escapeRegExp() + '$');
  4640. var searchStyles = function(rules){
  4641. Array.each(rules, function(rule){
  4642. if (rule.media){
  4643. searchStyles(rule.rules || rule.cssRules);
  4644. return;
  4645. }
  4646. if (!rule.style) return;
  4647. var selectorText = (rule.selectorText) ? rule.selectorText.replace(/^\w+/, function(m){
  4648. return m.toLowerCase();
  4649. }) : null;
  4650. if (!selectorText || !selectorTest.test(selectorText)) return;
  4651. Object.each(Element.Styles, function(value, style){
  4652. if (!rule.style[style] || Element.ShortStyles[style]) return;
  4653. value = String(rule.style[style]);
  4654. to[style] = ((/^rgb/).test(value)) ? value.rgbToHex() : value;
  4655. });
  4656. });
  4657. };
  4658. Array.each(document.styleSheets, function(sheet){
  4659. var href = sheet.href;
  4660. if (href && href.indexOf('://') > -1 && href.indexOf(document.domain) == -1) return;
  4661. var rules = sheet.rules || sheet.cssRules;
  4662. searchStyles(rules);
  4663. });
  4664. return Fx.CSS.Cache[selector] = to;
  4665. }
  4666. });
  4667. Fx.CSS.Cache = {};
  4668. Fx.CSS.Parsers = {
  4669. Color: {
  4670. parse: function(value){
  4671. if (value.match(/^#[0-9a-f]{3,6}$/i)) return value.hexToRgb(true);
  4672. return ((value = value.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [value[1], value[2], value[3]] : false;
  4673. },
  4674. compute: function(from, to, delta){
  4675. return from.map(function(value, i){
  4676. return Math.round(Fx.compute(from[i], to[i], delta));
  4677. });
  4678. },
  4679. serve: function(value){
  4680. return value.map(Number);
  4681. }
  4682. },
  4683. Number: {
  4684. parse: parseFloat,
  4685. compute: Fx.compute,
  4686. serve: function(value, unit){
  4687. return (unit) ? value + unit : value;
  4688. }
  4689. },
  4690. String: {
  4691. parse: Function.convert(false),
  4692. compute: function(zero, one){
  4693. return one;
  4694. },
  4695. serve: function(zero){
  4696. return zero;
  4697. }
  4698. }
  4699. };
  4700. //<1.2compat>
  4701. Fx.CSS.Parsers = new Hash(Fx.CSS.Parsers);
  4702. //</1.2compat>
  4703. /*
  4704. ---
  4705. name: Fx.Morph
  4706. 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.
  4707. license: MIT-style license.
  4708. requires: Fx.CSS
  4709. provides: Fx.Morph
  4710. ...
  4711. */
  4712. Fx.Morph = new Class({
  4713. Extends: Fx.CSS,
  4714. initialize: function(element, options){
  4715. this.element = this.subject = document.id(element);
  4716. this.parent(options);
  4717. },
  4718. set: function(now){
  4719. if (typeof now == 'string') now = this.search(now);
  4720. for (var p in now) this.render(this.element, p, now[p], this.options.unit);
  4721. return this;
  4722. },
  4723. compute: function(from, to, delta){
  4724. var now = {};
  4725. for (var p in from) now[p] = this.parent(from[p], to[p], delta);
  4726. return now;
  4727. },
  4728. start: function(properties){
  4729. if (!this.check(properties)) return this;
  4730. if (typeof properties == 'string') properties = this.search(properties);
  4731. var from = {}, to = {};
  4732. for (var p in properties){
  4733. var parsed = this.prepare(this.element, p, properties[p]);
  4734. from[p] = parsed.from;
  4735. to[p] = parsed.to;
  4736. }
  4737. return this.parent(from, to);
  4738. }
  4739. });
  4740. Element.Properties.morph = {
  4741. set: function(options){
  4742. this.get('morph').cancel().setOptions(options);
  4743. return this;
  4744. },
  4745. get: function(){
  4746. var morph = this.retrieve('morph');
  4747. if (!morph){
  4748. morph = new Fx.Morph(this, {link: 'cancel'});
  4749. this.store('morph', morph);
  4750. }
  4751. return morph;
  4752. }
  4753. };
  4754. Element.implement({
  4755. morph: function(props){
  4756. this.get('morph').start(props);
  4757. return this;
  4758. }
  4759. });
  4760. /*
  4761. ---
  4762. name: Fx.Transitions
  4763. description: Contains a set of advanced transitions to be used with any of the Fx Classes.
  4764. license: MIT-style license.
  4765. credits:
  4766. - Easing Equations by Robert Penner, <http://www.robertpenner.com/easing/>, modified and optimized to be used with MooTools.
  4767. requires: Fx
  4768. provides: Fx.Transitions
  4769. ...
  4770. */
  4771. Fx.implement({
  4772. getTransition: function(){
  4773. var trans = this.options.transition || Fx.Transitions.Sine.easeInOut;
  4774. if (typeof trans == 'string'){
  4775. var data = trans.split(':');
  4776. trans = Fx.Transitions;
  4777. trans = trans[data[0]] || trans[data[0].capitalize()];
  4778. if (data[1]) trans = trans['ease' + data[1].capitalize() + (data[2] ? data[2].capitalize() : '')];
  4779. }
  4780. return trans;
  4781. }
  4782. });
  4783. Fx.Transition = function(transition, params){
  4784. params = Array.convert(params);
  4785. var easeIn = function(pos){
  4786. return transition(pos, params);
  4787. };
  4788. return Object.append(easeIn, {
  4789. easeIn: easeIn,
  4790. easeOut: function(pos){
  4791. return 1 - transition(1 - pos, params);
  4792. },
  4793. easeInOut: function(pos){
  4794. return (pos <= 0.5 ? transition(2 * pos, params) : (2 - transition(2 * (1 - pos), params))) / 2;
  4795. }
  4796. });
  4797. };
  4798. Fx.Transitions = {
  4799. linear: function(zero){
  4800. return zero;
  4801. }
  4802. };
  4803. //<1.2compat>
  4804. Fx.Transitions = new Hash(Fx.Transitions);
  4805. //</1.2compat>
  4806. Fx.Transitions.extend = function(transitions){
  4807. for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]);
  4808. };
  4809. Fx.Transitions.extend({
  4810. Pow: function(p, x){
  4811. return Math.pow(p, x && x[0] || 6);
  4812. },
  4813. Expo: function(p){
  4814. return Math.pow(2, 8 * (p - 1));
  4815. },
  4816. Circ: function(p){
  4817. return 1 - Math.sin(Math.acos(p));
  4818. },
  4819. Sine: function(p){
  4820. return 1 - Math.cos(p * Math.PI / 2);
  4821. },
  4822. Back: function(p, x){
  4823. x = x && x[0] || 1.618;
  4824. return Math.pow(p, 2) * ((x + 1) * p - x);
  4825. },
  4826. Bounce: function(p){
  4827. var value;
  4828. for (var a = 0, b = 1; 1; a += b, b /= 2){
  4829. if (p >= (7 - 4 * a) / 11){
  4830. value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2);
  4831. break;
  4832. }
  4833. }
  4834. return value;
  4835. },
  4836. Elastic: function(p, x){
  4837. return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x && x[0] || 1) / 3);
  4838. }
  4839. });
  4840. ['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){
  4841. Fx.Transitions[transition] = new Fx.Transition(function(p){
  4842. return Math.pow(p, i + 2);
  4843. });
  4844. });
  4845. /*
  4846. ---
  4847. name: Fx.Tween
  4848. description: Formerly Fx.Style, effect to transition any CSS property for an element.
  4849. license: MIT-style license.
  4850. requires: Fx.CSS
  4851. provides: [Fx.Tween, Element.fade, Element.highlight]
  4852. ...
  4853. */
  4854. Fx.Tween = new Class({
  4855. Extends: Fx.CSS,
  4856. initialize: function(element, options){
  4857. this.element = this.subject = document.id(element);
  4858. this.parent(options);
  4859. },
  4860. set: function(property, now){
  4861. if (arguments.length == 1){
  4862. now = property;
  4863. property = this.property || this.options.property;
  4864. }
  4865. this.render(this.element, property, now, this.options.unit);
  4866. return this;
  4867. },
  4868. start: function(property, from, to){
  4869. if (!this.check(property, from, to)) return this;
  4870. var args = Array.flatten(arguments);
  4871. this.property = this.options.property || args.shift();
  4872. var parsed = this.prepare(this.element, this.property, args);
  4873. return this.parent(parsed.from, parsed.to);
  4874. }
  4875. });
  4876. Element.Properties.tween = {
  4877. set: function(options){
  4878. this.get('tween').cancel().setOptions(options);
  4879. return this;
  4880. },
  4881. get: function(){
  4882. var tween = this.retrieve('tween');
  4883. if (!tween){
  4884. tween = new Fx.Tween(this, {link: 'cancel'});
  4885. this.store('tween', tween);
  4886. }
  4887. return tween;
  4888. }
  4889. };
  4890. Element.implement({
  4891. tween: function(property, from, to){
  4892. this.get('tween').start(property, from, to);
  4893. return this;
  4894. },
  4895. fade: function(){
  4896. var fade = this.get('tween'), method, args = ['opacity'].append(arguments), toggle;
  4897. if (args[1] == null) args[1] = 'toggle';
  4898. switch (args[1]){
  4899. case 'in': method = 'start'; args[1] = 1; break;
  4900. case 'out': method = 'start'; args[1] = 0; break;
  4901. case 'show': method = 'set'; args[1] = 1; break;
  4902. case 'hide': method = 'set'; args[1] = 0; break;
  4903. case 'toggle':
  4904. var flag = this.retrieve('fade:flag', this.getStyle('opacity') == 1);
  4905. method = 'start';
  4906. args[1] = flag ? 0 : 1;
  4907. this.store('fade:flag', !flag);
  4908. toggle = true;
  4909. break;
  4910. default: method = 'start';
  4911. }
  4912. if (!toggle) this.eliminate('fade:flag');
  4913. fade[method].apply(fade, args);
  4914. var to = args[args.length - 1];
  4915. if (method == 'set'){
  4916. this.setStyle('visibility', to == 0 ? 'hidden' : 'visible');
  4917. } else if (to != 0){
  4918. if (fade.$chain.length){
  4919. fade.chain(function(){
  4920. this.element.setStyle('visibility', 'visible');
  4921. this.callChain();
  4922. });
  4923. } else {
  4924. this.setStyle('visibility', 'visible');
  4925. }
  4926. } else {
  4927. fade.chain(function(){
  4928. if (this.element.getStyle('opacity')) return;
  4929. this.element.setStyle('visibility', 'hidden');
  4930. this.callChain();
  4931. });
  4932. }
  4933. return this;
  4934. },
  4935. highlight: function(start, end){
  4936. if (!end){
  4937. end = this.retrieve('highlight:original', this.getStyle('background-color'));
  4938. end = (end == 'transparent') ? '#fff' : end;
  4939. }
  4940. var tween = this.get('tween');
  4941. tween.start('background-color', start || '#ffff88', end).chain(function(){
  4942. this.setStyle('background-color', this.retrieve('highlight:original'));
  4943. tween.callChain();
  4944. }.bind(this));
  4945. return this;
  4946. }
  4947. });
  4948. /*
  4949. ---
  4950. name: Request
  4951. description: Powerful all purpose Request Class. Uses XMLHTTPRequest.
  4952. license: MIT-style license.
  4953. requires: [Object, Element, Chain, Events, Options, Class.Thenable, Browser]
  4954. provides: Request
  4955. ...
  4956. */
  4957. (function(){
  4958. var empty = function(){},
  4959. progressSupport = ('onprogress' in new Browser.Request);
  4960. var Request = this.Request = new Class({
  4961. Implements: [Chain, Events, Options, Class.Thenable],
  4962. options: {/*
  4963. onRequest: function(){},
  4964. onLoadstart: function(event, xhr){},
  4965. onProgress: function(event, xhr){},
  4966. onComplete: function(){},
  4967. onCancel: function(){},
  4968. onSuccess: function(responseText, responseXML){},
  4969. onFailure: function(xhr){},
  4970. onException: function(headerName, value){},
  4971. onTimeout: function(){},
  4972. user: '',
  4973. password: '',
  4974. withCredentials: false,*/
  4975. url: '',
  4976. data: '',
  4977. headers: {
  4978. //'X-Requested-With': 'XMLHttpRequest',
  4979. 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
  4980. },
  4981. async: true,
  4982. format: false,
  4983. method: 'post',
  4984. link: 'ignore',
  4985. isSuccess: null,
  4986. emulation: true,
  4987. urlEncoded: true,
  4988. encoding: 'utf-8',
  4989. evalScripts: false,
  4990. evalResponse: false,
  4991. timeout: 0,
  4992. noCache: false
  4993. },
  4994. initialize: function(options){
  4995. this.xhr = new Browser.Request();
  4996. this.setOptions(options);
  4997. this.headers = this.options.headers;
  4998. },
  4999. onStateChange: function(){
  5000. var xhr = this.xhr;
  5001. if (xhr.readyState != 4 || !this.running) return;
  5002. this.running = false;
  5003. this.status = 0;
  5004. Function.attempt(function(){
  5005. var status = xhr.status;
  5006. this.status = (status == 1223) ? 204 : status;
  5007. }.bind(this));
  5008. xhr.onreadystatechange = empty;
  5009. if (progressSupport) xhr.onprogress = xhr.onloadstart = empty;
  5010. if (this.timer){
  5011. clearTimeout(this.timer);
  5012. delete this.timer;
  5013. }
  5014. this.response = {text: this.xhr.responseText || '', xml: this.xhr.responseXML};
  5015. if (this.options.isSuccess.call(this, this.status))
  5016. this.success(this.response.text, this.response.xml);
  5017. else
  5018. this.failure();
  5019. },
  5020. isSuccess: function(){
  5021. var status = this.status;
  5022. return (status >= 200 && status < 300);
  5023. },
  5024. isRunning: function(){
  5025. return !!this.running;
  5026. },
  5027. processScripts: function(text){
  5028. if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return Browser.exec(text);
  5029. return text.stripScripts(this.options.evalScripts);
  5030. },
  5031. success: function(text, xml){
  5032. this.onSuccess(this.processScripts(text), xml);
  5033. this.resolve({text: text, xml: xml});
  5034. },
  5035. onSuccess: function(){
  5036. this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain();
  5037. },
  5038. failure: function(){
  5039. this.onFailure();
  5040. this.reject({reason: 'failure', xhr: this.xhr});
  5041. },
  5042. onFailure: function(){
  5043. this.fireEvent('complete').fireEvent('failure', this.xhr);
  5044. },
  5045. loadstart: function(event){
  5046. this.fireEvent('loadstart', [event, this.xhr]);
  5047. },
  5048. progress: function(event){
  5049. this.fireEvent('progress', [event, this.xhr]);
  5050. },
  5051. timeout: function(){
  5052. this.fireEvent('timeout', this.xhr);
  5053. this.reject({reason: 'timeout', xhr: this.xhr});
  5054. },
  5055. setHeader: function(name, value){
  5056. this.headers[name] = value;
  5057. return this;
  5058. },
  5059. getHeader: function(name){
  5060. return Function.attempt(function(){
  5061. return this.xhr.getResponseHeader(name);
  5062. }.bind(this));
  5063. },
  5064. check: function(){
  5065. if (!this.running) return true;
  5066. switch (this.options.link){
  5067. case 'cancel': this.cancel(); return true;
  5068. case 'chain': this.chain(this.caller.pass(arguments, this)); return false;
  5069. }
  5070. return false;
  5071. },
  5072. send: function(options){
  5073. if (!this.check(options)) return this;
  5074. this.options.isSuccess = this.options.isSuccess || this.isSuccess;
  5075. this.running = true;
  5076. var type = typeOf(options);
  5077. if (type == 'string' || type == 'element') options = {data: options};
  5078. var old = this.options;
  5079. options = Object.append({data: old.data, url: old.url, method: old.method}, options);
  5080. var data = options.data, url = String(options.url), method = options.method.toLowerCase();
  5081. switch (typeOf(data)){
  5082. case 'element': data = document.id(data).toQueryString(); break;
  5083. case 'object': case 'hash': data = Object.toQueryString(data);
  5084. }
  5085. if (this.options.format){
  5086. var format = 'format=' + this.options.format;
  5087. data = (data) ? format + '&' + data : format;
  5088. }
  5089. if (this.options.emulation && !['get', 'post'].contains(method)){
  5090. var _method = '_method=' + method;
  5091. data = (data) ? _method + '&' + data : _method;
  5092. method = 'post';
  5093. }
  5094. if (this.options.urlEncoded && ['post', 'put'].contains(method)){
  5095. var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : '';
  5096. //this.headers['Content-type'] = 'application/x-www-form-urlencoded' + encoding; //mootools1.6.0
  5097. if (!this.headers['Content-Type']) this.headers['Content-type'] = 'application/x-www-form-urlencoded' + encoding; //modify by tommy
  5098. }
  5099. if (!url) url = document.location.pathname;
  5100. var trimPosition = url.lastIndexOf('/');
  5101. if (trimPosition > -1 && (trimPosition = url.indexOf('#')) > -1) url = url.substr(0, trimPosition);
  5102. if (this.options.noCache)
  5103. url += (url.indexOf('?') > -1 ? '&' : '?') + String.uniqueID();
  5104. if (data && (method == 'get' || method == 'delete')){
  5105. url += (url.indexOf('?') > -1 ? '&' : '?') + data;
  5106. data = null;
  5107. }
  5108. var xhr = this.xhr;
  5109. if (progressSupport){
  5110. xhr.onloadstart = this.loadstart.bind(this);
  5111. xhr.onprogress = this.progress.bind(this);
  5112. }
  5113. //modify by Tommy--
  5114. var isWithCredentials = ((this.options.withCredentials && 'withCredentials' in xhr) || (this.options.user && 'withCredentials' in xhr) && (method.toUpperCase()=="POST" || method.toUpperCase()=="PUT"));
  5115. var isWithCredentialsSync = isWithCredentials && !this.options.async;
  5116. //-----------------
  5117. xhr.open(method.toUpperCase(), url, this.options.async, this.options.user, this.options.password);
  5118. if ((/*<1.4compat>*/this.options.user || /*</1.4compat>*/this.options.withCredentials) && 'withCredentials' in xhr) xhr.withCredentials = true;
  5119. //modify by Tommy--
  5120. // if (Browser.name=="firefox"){
  5121. // if (this.options.async){
  5122. // if (isWithCredentials) xhr.withCredentials = true;
  5123. // }else{
  5124. // xhr.setRequestHeader(o2.tokenName, Cookie.read(o2.tokenName));
  5125. // }
  5126. // }else{
  5127. if (isWithCredentials) xhr.withCredentials = true;
  5128. // }
  5129. //-----------------
  5130. xhr.onreadystatechange = this.onStateChange.bind(this);
  5131. Object.each(this.headers, function(value, key){
  5132. try {
  5133. xhr.setRequestHeader(key, value);
  5134. } catch (e){
  5135. this.fireEvent('exception', [key, value]);
  5136. this.reject({reason: 'exception', xhr: xhr, exception: e});
  5137. }
  5138. }, this);
  5139. if (this.getThenableState() !== 'pending'){
  5140. this.resetThenable({reason: 'send'});
  5141. }
  5142. if (url.indexOf("v=4.0")!=-1){
  5143. debugger;
  5144. }
  5145. this.fireEvent('request');
  5146. xhr.send(data);
  5147. if (!this.options.async) this.onStateChange();
  5148. else if (this.options.timeout) this.timer = this.timeout.delay(this.options.timeout, this);
  5149. return this;
  5150. },
  5151. cancel: function(){
  5152. if (!this.running) return this;
  5153. this.running = false;
  5154. var xhr = this.xhr;
  5155. xhr.abort();
  5156. if (this.timer){
  5157. clearTimeout(this.timer);
  5158. delete this.timer;
  5159. }
  5160. xhr.onreadystatechange = empty;
  5161. if (progressSupport) xhr.onprogress = xhr.onloadstart = empty;
  5162. this.xhr = new Browser.Request();
  5163. this.fireEvent('cancel');
  5164. this.reject({reason: 'cancel', xhr: xhr});
  5165. return this;
  5166. }
  5167. });
  5168. var methods = {};
  5169. ['get', 'post', 'put', 'delete', 'patch', 'head', 'GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'].each(function(method){
  5170. methods[method] = function(data){
  5171. var object = {
  5172. method: method
  5173. };
  5174. if (data != null) object.data = data;
  5175. return this.send(object);
  5176. };
  5177. });
  5178. Request.implement(methods);
  5179. Element.Properties.send = {
  5180. set: function(options){
  5181. var send = this.get('send').cancel();
  5182. send.setOptions(options);
  5183. return this;
  5184. },
  5185. get: function(){
  5186. var send = this.retrieve('send');
  5187. if (!send){
  5188. send = new Request({
  5189. data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action')
  5190. });
  5191. this.store('send', send);
  5192. }
  5193. return send;
  5194. }
  5195. };
  5196. Element.implement({
  5197. send: function(url){
  5198. var sender = this.get('send');
  5199. sender.send({data: this, url: url || sender.options.url});
  5200. return this;
  5201. }
  5202. });
  5203. })();
  5204. /*
  5205. ---
  5206. name: Request.HTML
  5207. description: Extends the basic Request Class with additional methods for interacting with HTML responses.
  5208. license: MIT-style license.
  5209. requires: [Element, Request]
  5210. provides: Request.HTML
  5211. ...
  5212. */
  5213. Request.HTML = new Class({
  5214. Extends: Request,
  5215. options: {
  5216. update: false,
  5217. append: false,
  5218. evalScripts: true,
  5219. filter: false,
  5220. headers: {
  5221. Accept: 'text/html, application/xml, text/xml, */*'
  5222. }
  5223. },
  5224. success: function(text){
  5225. var options = this.options, response = this.response;
  5226. response.html = text.stripScripts(function(script){
  5227. response.javascript = script;
  5228. });
  5229. var match = response.html.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
  5230. if (match) response.html = match[1];
  5231. var temp = new Element('div').set('html', response.html);
  5232. response.tree = temp.childNodes;
  5233. response.elements = temp.getElements(options.filter || '*');
  5234. if (options.filter) response.tree = response.elements;
  5235. if (options.update){
  5236. var update = document.id(options.update).empty();
  5237. if (options.filter) update.adopt(response.elements);
  5238. else update.set('html', response.html);
  5239. } else if (options.append){
  5240. var append = document.id(options.append);
  5241. if (options.filter) response.elements.reverse().inject(append);
  5242. else append.adopt(temp.getChildren());
  5243. }
  5244. if (options.evalScripts) Browser.exec(response.javascript);
  5245. this.onSuccess(response.tree, response.elements, response.html, response.javascript);
  5246. this.resolve({tree: response.tree, elements: response.elements, html: response.html, javascript: response.javascript});
  5247. }
  5248. });
  5249. Element.Properties.load = {
  5250. set: function(options){
  5251. var load = this.get('load').cancel();
  5252. load.setOptions(options);
  5253. return this;
  5254. },
  5255. get: function(){
  5256. var load = this.retrieve('load');
  5257. if (!load){
  5258. load = new Request.HTML({data: this, link: 'cancel', update: this, method: 'get'});
  5259. this.store('load', load);
  5260. }
  5261. return load;
  5262. }
  5263. };
  5264. Element.implement({
  5265. load: function(){
  5266. this.get('load').send(Array.link(arguments, {data: Type.isObject, url: Type.isString}));
  5267. return this;
  5268. }
  5269. });
  5270. /*
  5271. ---
  5272. name: JSON
  5273. description: JSON encoder and decoder.
  5274. license: MIT-style license.
  5275. SeeAlso: <http://www.json.org/>
  5276. requires: [Array, String, Number, Function]
  5277. provides: JSON
  5278. ...
  5279. */
  5280. if (typeof JSON == 'undefined') this.JSON = {};
  5281. //<1.2compat>
  5282. JSON = new Hash({
  5283. stringify: JSON.stringify,
  5284. parse: JSON.parse
  5285. });
  5286. //</1.2compat>
  5287. (function(){
  5288. var special = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'};
  5289. var escape = function(chr){
  5290. return special[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16)).slice(-4);
  5291. };
  5292. JSON.validate = function(string){
  5293. string = string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
  5294. replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
  5295. replace(/(?:^|:|,)(?:\s*\[)+/g, '');
  5296. return (/^[\],:{}\s]*$/).test(string);
  5297. };
  5298. JSON.encode = JSON.stringify ? function(obj){
  5299. return JSON.stringify(obj);
  5300. } : function(obj){
  5301. if (obj && obj.toJSON) obj = obj.toJSON();
  5302. switch (typeOf(obj)){
  5303. case 'string':
  5304. return '"' + obj.replace(/[\x00-\x1f\\"]/g, escape) + '"';
  5305. case 'array':
  5306. return '[' + obj.map(JSON.encode).clean() + ']';
  5307. case 'object': case 'hash':
  5308. var string = [];
  5309. Object.each(obj, function(value, key){
  5310. var json = JSON.encode(value);
  5311. if (json) string.push(JSON.encode(key) + ':' + json);
  5312. });
  5313. return '{' + string + '}';
  5314. case 'number': case 'boolean': return '' + obj;
  5315. case 'null': return 'null';
  5316. }
  5317. return null;
  5318. };
  5319. JSON.secure = true;
  5320. //<1.4compat>
  5321. JSON.secure = false;
  5322. //</1.4compat>
  5323. JSON.decode = function(string, secure){
  5324. if (!string || typeOf(string) != 'string') return null;
  5325. if (secure == null) secure = JSON.secure;
  5326. if (secure){
  5327. if (JSON.parse) return JSON.parse(string);
  5328. if (!JSON.validate(string)) throw new Error('JSON could not decode the input; security is enabled and the value is not secure.');
  5329. }
  5330. return eval('(' + string + ')');
  5331. };
  5332. })();
  5333. /*
  5334. ---
  5335. name: Request.JSON
  5336. description: Extends the basic Request Class with additional methods for sending and receiving JSON data.
  5337. license: MIT-style license.
  5338. requires: [Request, JSON]
  5339. provides: Request.JSON
  5340. ...
  5341. */
  5342. Request.JSON = new Class({
  5343. Extends: Request,
  5344. options: {
  5345. /*onError: function(text, error){},*/
  5346. secure: true
  5347. },
  5348. initialize: function(options){
  5349. this.parent(options);
  5350. Object.append(this.headers, {
  5351. 'Accept': 'application/json',
  5352. // 'X-Request': 'JSON'
  5353. });
  5354. },
  5355. success: function(text){
  5356. var json;
  5357. try {
  5358. json = this.response.json = JSON.decode(text, this.options.secure);
  5359. } catch (error){
  5360. this.fireEvent('error', [text, error]);
  5361. return;
  5362. }
  5363. if (json == null){
  5364. this.failure();
  5365. } else {
  5366. this.onSuccess(json, text);
  5367. this.resolve({json: json, text: text});
  5368. }
  5369. }
  5370. });
  5371. /*
  5372. ---
  5373. name: Cookie
  5374. description: Class for creating, reading, and deleting browser Cookies.
  5375. license: MIT-style license.
  5376. credits:
  5377. - Based on the functions by Peter-Paul Koch (http://quirksmode.org).
  5378. requires: [Options, Browser]
  5379. provides: Cookie
  5380. ...
  5381. */
  5382. var Cookie = new Class({
  5383. Implements: Options,
  5384. options: {
  5385. path: '/',
  5386. domain: false,
  5387. duration: false,
  5388. secure: false,
  5389. document: document,
  5390. encode: true,
  5391. httpOnly: false
  5392. },
  5393. initialize: function(key, options){
  5394. this.key = key;
  5395. this.setOptions(options);
  5396. },
  5397. write: function(value){
  5398. if (this.options.encode) value = encodeURIComponent(value);
  5399. if (this.options.domain) value += '; domain=' + this.options.domain;
  5400. if (this.options.path) value += '; path=' + this.options.path;
  5401. if (this.options.duration){
  5402. var date = new Date();
  5403. date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000);
  5404. value += '; expires=' + date.toGMTString();
  5405. }
  5406. if (this.options.secure) value += '; secure';
  5407. if (this.options.httpOnly) value += '; HttpOnly';
  5408. this.options.document.cookie = this.key + '=' + value;
  5409. return this;
  5410. },
  5411. read: function(){
  5412. var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)');
  5413. return (value) ? decodeURIComponent(value[1]) : null;
  5414. },
  5415. dispose: function(){
  5416. new Cookie(this.key, Object.merge({}, this.options, {duration: -1})).write('');
  5417. return this;
  5418. }
  5419. });
  5420. Cookie.write = function(key, value, options){
  5421. return new Cookie(key, options).write(value);
  5422. };
  5423. Cookie.read = function(key){
  5424. return new Cookie(key).read();
  5425. };
  5426. Cookie.dispose = function(key, options){
  5427. return new Cookie(key, options).dispose();
  5428. };
  5429. /*
  5430. ---
  5431. name: DOMReady
  5432. description: Contains the custom event domready.
  5433. license: MIT-style license.
  5434. requires: [Browser, Element, Element.Event]
  5435. provides: [DOMReady, DomReady]
  5436. ...
  5437. */
  5438. (function(window, document){
  5439. var ready,
  5440. loaded,
  5441. checks = [],
  5442. shouldPoll,
  5443. timer,
  5444. testElement = document.createElement('div');
  5445. var domready = function(){
  5446. clearTimeout(timer);
  5447. if (!ready){
  5448. Browser.loaded = ready = true;
  5449. document.removeListener('DOMContentLoaded', domready).removeListener('readystatechange', check);
  5450. document.fireEvent('domready');
  5451. window.fireEvent('domready');
  5452. }
  5453. // cleanup scope vars
  5454. document = window = testElement = null;
  5455. };
  5456. var check = function(){
  5457. for (var i = checks.length; i--;) if (checks[i]()){
  5458. domready();
  5459. return true;
  5460. }
  5461. return false;
  5462. };
  5463. var poll = function(){
  5464. clearTimeout(timer);
  5465. if (!check()) timer = setTimeout(poll, 10);
  5466. };
  5467. document.addListener('DOMContentLoaded', domready);
  5468. /*<ltIE8>*/
  5469. // doScroll technique by Diego Perini http://javascript.nwbox.com/IEContentLoaded/
  5470. // testElement.doScroll() throws when the DOM is not ready, only in the top window
  5471. var doScrollWorks = function(){
  5472. try {
  5473. testElement.doScroll();
  5474. return true;
  5475. } catch (e){}
  5476. return false;
  5477. };
  5478. // If doScroll works already, it can't be used to determine domready
  5479. // e.g. in an iframe
  5480. if (testElement.doScroll && !doScrollWorks()){
  5481. checks.push(doScrollWorks);
  5482. shouldPoll = true;
  5483. }
  5484. /*</ltIE8>*/
  5485. if (document.readyState) checks.push(function(){
  5486. var state = document.readyState;
  5487. return (state == 'loaded' || state == 'complete');
  5488. });
  5489. if ('onreadystatechange' in document) document.addListener('readystatechange', check);
  5490. else shouldPoll = true;
  5491. if (shouldPoll) poll();
  5492. Element.Events.domready = {
  5493. onAdd: function(fn){
  5494. if (ready) fn.call(this);
  5495. }
  5496. };
  5497. // Make sure that domready fires before load
  5498. Element.Events.load = {
  5499. base: 'load',
  5500. onAdd: function(fn){
  5501. if (loaded && this == window) fn.call(this);
  5502. },
  5503. condition: function(){
  5504. if (this == window){
  5505. domready();
  5506. delete Element.Events.load;
  5507. }
  5508. return true;
  5509. }
  5510. };
  5511. // This is based on the custom load event
  5512. if (window) window.addEvent('load', function(){
  5513. loaded = true;
  5514. });
  5515. })(window, document);
  5516. /*
  5517. ---
  5518. script: More.js
  5519. name: More
  5520. description: MooTools More
  5521. license: MIT-style license
  5522. authors:
  5523. - Guillermo Rauch
  5524. - Thomas Aylott
  5525. - Scott Kyle
  5526. - Arian Stolwijk
  5527. - Tim Wienk
  5528. - Christoph Pojer
  5529. - Aaron Newton
  5530. - Jacob Thornton
  5531. requires:
  5532. - Core/MooTools
  5533. provides: [MooTools.More]
  5534. ...
  5535. */
  5536. MooTools.More = {
  5537. version: '1.6.0',
  5538. build: '45b71db70f879781a7e0b0d3fb3bb1307c2521eb'
  5539. };
  5540. /*
  5541. ---
  5542. script: Chain.Wait.js
  5543. name: Chain.Wait
  5544. description: value, Adds a method to inject pauses between chained events.
  5545. license: MIT-style license.
  5546. authors:
  5547. - Aaron Newton
  5548. requires:
  5549. - Core/Chain
  5550. - Core/Element
  5551. - Core/Fx
  5552. - MooTools.More
  5553. provides: [Chain.Wait]
  5554. ...
  5555. */
  5556. (function(){
  5557. var wait = {
  5558. wait: function(duration){
  5559. return this.chain(function(){
  5560. this.callChain.delay(duration == null ? 500 : duration, this);
  5561. return this;
  5562. }.bind(this));
  5563. }
  5564. };
  5565. Chain.implement(wait);
  5566. if (this.Fx) Fx.implement(wait);
  5567. if (this.Element && Element.implement && this.Fx){
  5568. Element.implement({
  5569. chains: function(effects){
  5570. Array.convert(effects || ['tween', 'morph', 'reveal']).each(function(effect){
  5571. effect = this.get(effect);
  5572. if (!effect) return;
  5573. effect.setOptions({
  5574. link:'chain'
  5575. });
  5576. }, this);
  5577. return this;
  5578. },
  5579. pauseFx: function(duration, effect){
  5580. this.chains(effect).get(effect || 'tween').wait(duration);
  5581. return this;
  5582. }
  5583. });
  5584. }
  5585. })();
  5586. /*
  5587. ---
  5588. script: Class.Binds.js
  5589. name: Class.Binds
  5590. description: Automagically binds specified methods in a class to the instance of the class.
  5591. license: MIT-style license
  5592. authors:
  5593. - Aaron Newton
  5594. requires:
  5595. - Core/Class
  5596. - MooTools.More
  5597. provides: [Class.Binds]
  5598. ...
  5599. */
  5600. Class.Mutators.Binds = function(binds){
  5601. if (!this.prototype.initialize) this.implement('initialize', function(){});
  5602. return Array.convert(binds).concat(this.prototype.Binds || []);
  5603. };
  5604. Class.Mutators.initialize = function(initialize){
  5605. return function(){
  5606. Array.convert(this.Binds).each(function(name){
  5607. var original = this[name];
  5608. if (original) this[name] = original.bind(this);
  5609. }, this);
  5610. return initialize.apply(this, arguments);
  5611. };
  5612. };
  5613. /*
  5614. ---
  5615. script: Class.Occlude.js
  5616. name: Class.Occlude
  5617. description: Prevents a class from being applied to a DOM element twice.
  5618. license: MIT-style license.
  5619. authors:
  5620. - Aaron Newton
  5621. requires:
  5622. - Core/Class
  5623. - Core/Element
  5624. - MooTools.More
  5625. provides: [Class.Occlude]
  5626. ...
  5627. */
  5628. Class.Occlude = new Class({
  5629. occlude: function(property, element){
  5630. element = document.id(element || this.element);
  5631. var instance = element.retrieve(property || this.property);
  5632. if (instance && !this.occluded)
  5633. return (this.occluded = instance);
  5634. this.occluded = false;
  5635. element.store(property || this.property, this);
  5636. return this.occluded;
  5637. }
  5638. });
  5639. /*
  5640. ---
  5641. script: Class.Refactor.js
  5642. name: Class.Refactor
  5643. description: Extends a class onto itself with new property, preserving any items attached to the class's namespace.
  5644. license: MIT-style license
  5645. authors:
  5646. - Aaron Newton
  5647. requires:
  5648. - Core/Class
  5649. - MooTools.More
  5650. # Some modules declare themselves dependent on Class.Refactor
  5651. provides: [Class.refactor, Class.Refactor]
  5652. ...
  5653. */
  5654. Class.refactor = function(original, refactors){
  5655. Object.each(refactors, function(item, name){
  5656. var origin = original.prototype[name];
  5657. origin = (origin && origin.$origin) || origin || function(){};
  5658. original.implement(name, (typeof item == 'function') ? function(){
  5659. var old = this.previous;
  5660. this.previous = origin;
  5661. var value = item.apply(this, arguments);
  5662. this.previous = old;
  5663. return value;
  5664. } : item);
  5665. });
  5666. return original;
  5667. };
  5668. /*
  5669. ---
  5670. script: Class.Singleton.js
  5671. name: Class.Singleton
  5672. description: Always provides a single instance of a class
  5673. license: MIT-style license.
  5674. authors:
  5675. - Hristo Chakarov
  5676. requires:
  5677. - Core/Class
  5678. provides: [Class.Singleton]
  5679. ...
  5680. */
  5681. Class.Singleton = new Class({
  5682. initialize : function(descriptor){
  5683. // here we keep reference of the single instance
  5684. var singleton;
  5685. // create a regular Class
  5686. var constructor = new Class(descriptor);
  5687. // We return another constructor, because we need to make sure that we
  5688. // always return the same one and only instance.
  5689. return function(){
  5690. if (singleton){
  5691. return singleton;
  5692. }
  5693. // Obviously we instantiate that class for the first time.
  5694. // Create brand new object & extend it with the prototype of the
  5695. // original `constructor`.
  5696. singleton = Object.append({}, constructor.prototype);
  5697. singleton.constructor = constructor;
  5698. // We also need to call the constructor as a function, passing the
  5699. // arguments object.
  5700. var returnValue = constructor.apply(singleton, arguments);
  5701. // In case the `constructor` returns something other than `this` -
  5702. // return that value; otherwise return the `singleton`.
  5703. singleton = typeof returnValue == 'object' ? returnValue : singleton;
  5704. return singleton;
  5705. };
  5706. }
  5707. });
  5708. /*
  5709. ---
  5710. name: Events.Pseudos
  5711. description: Adds the functionality to add pseudo events
  5712. license: MIT-style license
  5713. authors:
  5714. - Arian Stolwijk
  5715. requires: [Core/Class.Extras, Core/Slick.Parser, MooTools.More]
  5716. provides: [Events.Pseudos]
  5717. ...
  5718. */
  5719. (function(){
  5720. Events.Pseudos = function(pseudos, addEvent, removeEvent){
  5721. var storeKey = '_monitorEvents:';
  5722. var storageOf = function(object){
  5723. return {
  5724. store: object.store ? function(key, value){
  5725. object.store(storeKey + key, value);
  5726. } : function(key, value){
  5727. (object._monitorEvents || (object._monitorEvents = {}))[key] = value;
  5728. },
  5729. retrieve: object.retrieve ? function(key, dflt){
  5730. return object.retrieve(storeKey + key, dflt);
  5731. } : function(key, dflt){
  5732. if (!object._monitorEvents) return dflt;
  5733. return object._monitorEvents[key] || dflt;
  5734. }
  5735. };
  5736. };
  5737. var splitType = function(type){
  5738. if (type.indexOf(':') == -1 || !pseudos) return null;
  5739. var parsed = Slick.parse(type).expressions[0][0],
  5740. parsedPseudos = parsed.pseudos,
  5741. l = parsedPseudos.length,
  5742. splits = [];
  5743. while (l--){
  5744. var pseudo = parsedPseudos[l].key,
  5745. listener = pseudos[pseudo];
  5746. if (listener != null) splits.push({
  5747. event: parsed.tag,
  5748. value: parsedPseudos[l].value,
  5749. pseudo: pseudo,
  5750. original: type,
  5751. listener: listener
  5752. });
  5753. }
  5754. return splits.length ? splits : null;
  5755. };
  5756. return {
  5757. addEvent: function(type, fn, internal){
  5758. var split = splitType(type);
  5759. if (!split) return addEvent.call(this, type, fn, internal);
  5760. var storage = storageOf(this),
  5761. events = storage.retrieve(type, []),
  5762. eventType = split[0].event,
  5763. args = Array.slice(arguments, 2),
  5764. stack = fn,
  5765. self = this;
  5766. split.each(function(item){
  5767. var listener = item.listener,
  5768. stackFn = stack;
  5769. if (listener == false) eventType += ':' + item.pseudo + '(' + item.value + ')';
  5770. else stack = function(){
  5771. listener.call(self, item, stackFn, arguments, stack);
  5772. };
  5773. });
  5774. events.include({type: eventType, event: fn, monitor: stack});
  5775. storage.store(type, events);
  5776. if (type != eventType) addEvent.apply(this, [type, fn].concat(args));
  5777. return addEvent.apply(this, [eventType, stack].concat(args));
  5778. },
  5779. removeEvent: function(type, fn){
  5780. var split = splitType(type);
  5781. if (!split) return removeEvent.call(this, type, fn);
  5782. var storage = storageOf(this),
  5783. events = storage.retrieve(type);
  5784. if (!events) return this;
  5785. var args = Array.slice(arguments, 2);
  5786. removeEvent.apply(this, [type, fn].concat(args));
  5787. events.each(function(monitor, i){
  5788. if (!fn || monitor.event == fn) removeEvent.apply(this, [monitor.type, monitor.monitor].concat(args));
  5789. delete events[i];
  5790. }, this);
  5791. storage.store(type, events);
  5792. return this;
  5793. }
  5794. };
  5795. };
  5796. var pseudos = {
  5797. once: function(split, fn, args, monitor){
  5798. fn.apply(this, args);
  5799. this.removeEvent(split.event, monitor)
  5800. .removeEvent(split.original, fn);
  5801. },
  5802. throttle: function(split, fn, args){
  5803. if (!fn._throttled){
  5804. fn.apply(this, args);
  5805. fn._throttled = setTimeout(function(){
  5806. fn._throttled = false;
  5807. }, split.value || 250);
  5808. }
  5809. },
  5810. pause: function(split, fn, args){
  5811. clearTimeout(fn._pause);
  5812. fn._pause = fn.delay(split.value || 250, this, args);
  5813. }
  5814. };
  5815. Events.definePseudo = function(key, listener){
  5816. pseudos[key] = listener;
  5817. return this;
  5818. };
  5819. Events.lookupPseudo = function(key){
  5820. return pseudos[key];
  5821. };
  5822. var proto = Events.prototype;
  5823. Events.implement(Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
  5824. ['Request', 'Fx'].each(function(klass){
  5825. if (this[klass]) this[klass].implement(Events.prototype);
  5826. });
  5827. })();
  5828. /*
  5829. ---
  5830. script: Drag.js
  5831. name: Drag
  5832. description: The base Drag Class. Can be used to drag and resize Elements using mouse events.
  5833. license: MIT-style license
  5834. authors:
  5835. - Valerio Proietti
  5836. - Tom Occhinno
  5837. - Jan Kassens
  5838. requires:
  5839. - Core/Events
  5840. - Core/Options
  5841. - Core/Element.Event
  5842. - Core/Element.Style
  5843. - Core/Element.Dimensions
  5844. - MooTools.More
  5845. provides: [Drag]
  5846. ...
  5847. */
  5848. (function(){
  5849. var Drag = this.Drag = new Class({
  5850. Implements: [Events, Options],
  5851. options: {/*
  5852. onBeforeStart: function(thisElement){},
  5853. onStart: function(thisElement, event){},
  5854. onSnap: function(thisElement){},
  5855. onDrag: function(thisElement, event){},
  5856. onCancel: function(thisElement){},
  5857. onComplete: function(thisElement, event){},*/
  5858. snap: 6,
  5859. unit: 'px',
  5860. grid: false,
  5861. style: true,
  5862. limit: false,
  5863. handle: false,
  5864. invert: false,
  5865. unDraggableTags: ['button', 'input', 'a', 'textarea', 'select', 'option'],
  5866. preventDefault: false,
  5867. stopPropagation: false,
  5868. compensateScroll: false,
  5869. modifiers: {x: 'left', y: 'top'}
  5870. },
  5871. initialize: function(){
  5872. var params = Array.link(arguments, {
  5873. 'options': Type.isObject,
  5874. 'element': function(obj){
  5875. return obj != null;
  5876. }
  5877. });
  5878. this.element = document.id(params.element);
  5879. this.document = this.element.getDocument();
  5880. this.setOptions(params.options || {});
  5881. var htype = typeOf(this.options.handle);
  5882. this.handles = ((htype == 'array' || htype == 'collection') ? $$(this.options.handle) : document.id(this.options.handle)) || this.element;
  5883. this.mouse = {'now': {}, 'pos': {}};
  5884. this.value = {'start': {}, 'now': {}};
  5885. this.offsetParent = (function(el){
  5886. var offsetParent = el.getOffsetParent();
  5887. var isBody = !offsetParent || (/^(?:body|html)$/i).test(offsetParent.tagName);
  5888. return isBody ? window : document.id(offsetParent);
  5889. })(this.element);
  5890. this.selection = 'selectstart' in document ? 'selectstart' : 'mousedown';
  5891. this.compensateScroll = {start: {}, diff: {}, last: {}};
  5892. if ('ondragstart' in document && !('FileReader' in window) && !Drag.ondragstartFixed){
  5893. document.ondragstart = Function.convert(false);
  5894. Drag.ondragstartFixed = true;
  5895. }
  5896. this.bound = {
  5897. start: this.start.bind(this),
  5898. check: this.check.bind(this),
  5899. drag: this.drag.bind(this),
  5900. stop: this.stop.bind(this),
  5901. cancel: this.cancel.bind(this),
  5902. eventStop: Function.convert(false),
  5903. scrollListener: this.scrollListener.bind(this)
  5904. };
  5905. this.attach();
  5906. },
  5907. attach: function(){
  5908. this.handles.addEvent('mousedown', this.bound.start);
  5909. this.handles.addEvent('touchstart', this.bound.start);
  5910. if (this.options.compensateScroll) this.offsetParent.addEvent('scroll', this.bound.scrollListener);
  5911. return this;
  5912. },
  5913. detach: function(){
  5914. this.handles.removeEvent('mousedown', this.bound.start);
  5915. this.handles.removeEvent('touchstart', this.bound.start);
  5916. if (this.options.compensateScroll) this.offsetParent.removeEvent('scroll', this.bound.scrollListener);
  5917. return this;
  5918. },
  5919. scrollListener: function(){
  5920. if (!this.mouse.start) return;
  5921. var newScrollValue = this.offsetParent.getScroll();
  5922. if (this.element.getStyle('position') == 'absolute'){
  5923. var scrollDiff = this.sumValues(newScrollValue, this.compensateScroll.last, -1);
  5924. this.mouse.now = this.sumValues(this.mouse.now, scrollDiff, 1);
  5925. } else {
  5926. this.compensateScroll.diff = this.sumValues(newScrollValue, this.compensateScroll.start, -1);
  5927. }
  5928. if (this.offsetParent != window) this.compensateScroll.diff = this.sumValues(this.compensateScroll.start, newScrollValue, -1);
  5929. this.compensateScroll.last = newScrollValue;
  5930. this.render(this.options);
  5931. },
  5932. sumValues: function(alpha, beta, op){
  5933. var sum = {}, options = this.options;
  5934. for (var z in options.modifiers){
  5935. if (!options.modifiers[z]) continue;
  5936. sum[z] = alpha[z] + beta[z] * op;
  5937. }
  5938. return sum;
  5939. },
  5940. start: function(event){
  5941. if (this.options.unDraggableTags.contains(event.target.get('tag'))) return;
  5942. var options = this.options;
  5943. if (event.rightClick) return;
  5944. if (options.preventDefault) event.preventDefault();
  5945. if (options.stopPropagation) event.stopPropagation();
  5946. this.compensateScroll.start = this.compensateScroll.last = this.offsetParent.getScroll();
  5947. this.compensateScroll.diff = {x: 0, y: 0};
  5948. this.mouse.start = event.page;
  5949. this.fireEvent('beforeStart', this.element);
  5950. var limit = options.limit;
  5951. this.limit = {x: [], y: []};
  5952. var z, coordinates, offsetParent = this.offsetParent == window ? null : this.offsetParent;
  5953. for (z in options.modifiers){
  5954. if (!options.modifiers[z]) continue;
  5955. var style = this.element.getStyle(options.modifiers[z]);
  5956. // Some browsers (IE and Opera) don't always return pixels.
  5957. if (style && !style.match(/px$/)){
  5958. if (!coordinates) coordinates = this.element.getCoordinates(offsetParent);
  5959. style = coordinates[options.modifiers[z]];
  5960. }
  5961. if (options.style) this.value.now[z] = (style || 0).toInt();
  5962. else this.value.now[z] = this.element[options.modifiers[z]];
  5963. if (options.invert) this.value.now[z] *= -1;
  5964. this.mouse.pos[z] = event.page[z] - this.value.now[z];
  5965. if (limit && limit[z]){
  5966. var i = 2;
  5967. while (i--){
  5968. var limitZI = limit[z][i];
  5969. if (limitZI || limitZI === 0) this.limit[z][i] = (typeof limitZI == 'function') ? limitZI() : limitZI;
  5970. }
  5971. }
  5972. }
  5973. if (typeOf(this.options.grid) == 'number') this.options.grid = {
  5974. x: this.options.grid,
  5975. y: this.options.grid
  5976. };
  5977. var events = {
  5978. mousemove: this.bound.check,
  5979. mouseup: this.bound.cancel,
  5980. touchmove: this.bound.check,
  5981. touchend: this.bound.cancel
  5982. };
  5983. events[this.selection] = this.bound.eventStop;
  5984. this.document.addEvents(events);
  5985. },
  5986. check: function(event){
  5987. if (this.options.preventDefault) event.preventDefault();
  5988. 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)));
  5989. if (distance > this.options.snap){
  5990. this.cancel();
  5991. this.document.addEvents({
  5992. mousemove: this.bound.drag,
  5993. mouseup: this.bound.stop,
  5994. touchmove: this.bound.drag,
  5995. touchend: this.bound.stop
  5996. });
  5997. this.fireEvent('start', [this.element, event]).fireEvent('snap', this.element);
  5998. }
  5999. },
  6000. drag: function(event){
  6001. var options = this.options;
  6002. if (options.preventDefault) event.preventDefault();
  6003. this.mouse.now = this.sumValues(event.page, this.compensateScroll.diff, -1);
  6004. this.render(options);
  6005. this.fireEvent('drag', [this.element, event]);
  6006. },
  6007. render: function(options){
  6008. for (var z in options.modifiers){
  6009. if (!options.modifiers[z]) continue;
  6010. this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z];
  6011. if (options.invert) this.value.now[z] *= -1;
  6012. if (options.limit && this.limit[z]){
  6013. if ((this.limit[z][1] || this.limit[z][1] === 0) && (this.value.now[z] > this.limit[z][1])){
  6014. this.value.now[z] = this.limit[z][1];
  6015. } else if ((this.limit[z][0] || this.limit[z][0] === 0) && (this.value.now[z] < this.limit[z][0])){
  6016. this.value.now[z] = this.limit[z][0];
  6017. }
  6018. }
  6019. if (options.grid[z]) this.value.now[z] -= ((this.value.now[z] - (this.limit[z][0]||0)) % options.grid[z]);
  6020. if (options.style) this.element.setStyle(options.modifiers[z], this.value.now[z] + options.unit);
  6021. else this.element[options.modifiers[z]] = this.value.now[z];
  6022. }
  6023. },
  6024. cancel: function(event){
  6025. this.document.removeEvents({
  6026. mousemove: this.bound.check,
  6027. mouseup: this.bound.cancel,
  6028. touchmove: this.bound.check,
  6029. touchend: this.bound.cancel
  6030. });
  6031. if (event){
  6032. this.document.removeEvent(this.selection, this.bound.eventStop);
  6033. this.fireEvent('cancel', this.element);
  6034. }
  6035. },
  6036. stop: function(event){
  6037. var events = {
  6038. mousemove: this.bound.drag,
  6039. mouseup: this.bound.stop,
  6040. touchmove: this.bound.drag,
  6041. touchend: this.bound.stop
  6042. };
  6043. events[this.selection] = this.bound.eventStop;
  6044. this.document.removeEvents(events);
  6045. this.mouse.start = null;
  6046. if (event) this.fireEvent('complete', [this.element, event]);
  6047. }
  6048. });
  6049. })();
  6050. Element.implement({
  6051. makeResizable: function(options){
  6052. var drag = new Drag(this, Object.merge({
  6053. modifiers: {
  6054. x: 'width',
  6055. y: 'height'
  6056. }
  6057. }, options));
  6058. this.store('resizer', drag);
  6059. return drag.addEvent('drag', function(){
  6060. this.fireEvent('resize', drag);
  6061. }.bind(this));
  6062. }
  6063. });
  6064. /*
  6065. ---
  6066. script: Drag.Move.js
  6067. name: Drag.Move
  6068. description: A Drag extension that provides support for the constraining of draggables to containers and droppables.
  6069. license: MIT-style license
  6070. authors:
  6071. - Valerio Proietti
  6072. - Tom Occhinno
  6073. - Jan Kassens
  6074. - Aaron Newton
  6075. - Scott Kyle
  6076. requires:
  6077. - Core/Element.Dimensions
  6078. - Drag
  6079. provides: [Drag.Move]
  6080. ...
  6081. */
  6082. Drag.Move = new Class({
  6083. Extends: Drag,
  6084. options: {/*
  6085. onEnter: function(thisElement, overed){},
  6086. onLeave: function(thisElement, overed){},
  6087. onDrop: function(thisElement, overed, event){},*/
  6088. droppables: [],
  6089. container: false,
  6090. precalculate: false,
  6091. includeMargins: true,
  6092. checkDroppables: true
  6093. },
  6094. initialize: function(element, options){
  6095. this.parent(element, options);
  6096. element = this.element;
  6097. this.droppables = $$(this.options.droppables);
  6098. this.setContainer(this.options.container);
  6099. if (this.options.style){
  6100. if (this.options.modifiers.x == 'left' && this.options.modifiers.y == 'top'){
  6101. var parent = element.getOffsetParent(),
  6102. styles = element.getStyles('left', 'top');
  6103. if (parent && (styles.left == 'auto' || styles.top == 'auto')){
  6104. element.setPosition(element.getPosition(parent));
  6105. }
  6106. }
  6107. if (element.getStyle('position') == 'static') element.setStyle('position', 'absolute');
  6108. }
  6109. this.addEvent('start', this.checkDroppables, true);
  6110. this.overed = null;
  6111. },
  6112. setContainer: function(container){
  6113. this.container = document.id(container);
  6114. if (this.container && typeOf(this.container) != 'element'){
  6115. this.container = document.id(this.container.getDocument().body);
  6116. }
  6117. },
  6118. start: function(event){
  6119. if (this.container) this.options.limit = this.calculateLimit();
  6120. if (this.options.precalculate){
  6121. this.positions = this.droppables.map(function(el){
  6122. return el.getCoordinates();
  6123. });
  6124. }
  6125. this.parent(event);
  6126. },
  6127. calculateLimit: function(){
  6128. var element = this.element,
  6129. container = this.container,
  6130. offsetParent = document.id(element.getOffsetParent()) || document.body,
  6131. containerCoordinates = container.getCoordinates(offsetParent),
  6132. elementMargin = {},
  6133. elementBorder = {},
  6134. containerMargin = {},
  6135. containerBorder = {},
  6136. offsetParentPadding = {},
  6137. offsetScroll = offsetParent.getScroll();
  6138. ['top', 'right', 'bottom', 'left'].each(function(pad){
  6139. elementMargin[pad] = element.getStyle('margin-' + pad).toInt();
  6140. elementBorder[pad] = element.getStyle('border-' + pad).toInt();
  6141. containerMargin[pad] = container.getStyle('margin-' + pad).toInt();
  6142. containerBorder[pad] = container.getStyle('border-' + pad).toInt();
  6143. offsetParentPadding[pad] = offsetParent.getStyle('padding-' + pad).toInt();
  6144. }, this);
  6145. var width = element.offsetWidth + elementMargin.left + elementMargin.right,
  6146. height = element.offsetHeight + elementMargin.top + elementMargin.bottom,
  6147. left = 0 + offsetScroll.x,
  6148. top = 0 + offsetScroll.y,
  6149. right = containerCoordinates.right - containerBorder.right - width + offsetScroll.x,
  6150. bottom = containerCoordinates.bottom - containerBorder.bottom - height + offsetScroll.y;
  6151. if (this.options.includeMargins){
  6152. left += elementMargin.left;
  6153. top += elementMargin.top;
  6154. } else {
  6155. right += elementMargin.right;
  6156. bottom += elementMargin.bottom;
  6157. }
  6158. if (element.getStyle('position') == 'relative'){
  6159. var coords = element.getCoordinates(offsetParent);
  6160. coords.left -= element.getStyle('left').toInt();
  6161. coords.top -= element.getStyle('top').toInt();
  6162. left -= coords.left;
  6163. top -= coords.top;
  6164. if (container.getStyle('position') != 'relative'){
  6165. left += containerBorder.left;
  6166. top += containerBorder.top;
  6167. }
  6168. right += elementMargin.left - coords.left;
  6169. bottom += elementMargin.top - coords.top;
  6170. if (container != offsetParent){
  6171. left += containerMargin.left + offsetParentPadding.left;
  6172. if (!offsetParentPadding.left && left < 0) left = 0;
  6173. top += offsetParent == document.body ? 0 : containerMargin.top + offsetParentPadding.top;
  6174. if (!offsetParentPadding.top && top < 0) top = 0;
  6175. }
  6176. } else {
  6177. left -= elementMargin.left;
  6178. top -= elementMargin.top;
  6179. if (container != offsetParent){
  6180. left += containerCoordinates.left + containerBorder.left;
  6181. top += containerCoordinates.top + containerBorder.top;
  6182. }
  6183. }
  6184. return {
  6185. x: [left, right],
  6186. y: [top, bottom]
  6187. };
  6188. },
  6189. getDroppableCoordinates: function(element){
  6190. var position = element.getCoordinates();
  6191. if (element.getStyle('position') == 'fixed'){
  6192. var scroll = window.getScroll();
  6193. position.left += scroll.x;
  6194. position.right += scroll.x;
  6195. position.top += scroll.y;
  6196. position.bottom += scroll.y;
  6197. }
  6198. return position;
  6199. },
  6200. //modify by Tommy
  6201. checkDroppables:function(){
  6202. var overedList = this.droppables.filter(function(el, i){
  6203. el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el);
  6204. var now = this.mouse.now;
  6205. return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
  6206. }, this);
  6207. var overed = overedList.getLast();
  6208. if (overed) for (var x=0;x<overedList.length-1;x++) if(overed.contains(overedList[x])) overed=overedList[x];
  6209. if(this.overed!=overed){
  6210. if(this.overed) this.fireEvent("leave",[this.element,this.overed]);
  6211. if(overed) this.fireEvent("enter",[this.element,overed]);
  6212. this.overed=overed;
  6213. }
  6214. },
  6215. //mootools....
  6216. //checkDroppables: function(){
  6217. // var overed = this.droppables.filter(function(el, i){
  6218. // el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el);
  6219. // var now = this.mouse.now;
  6220. // return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top);
  6221. // }, this).getLast();
  6222. //
  6223. // if (this.overed != overed){
  6224. // if (this.overed) this.fireEvent('leave', [this.element, this.overed]);
  6225. // if (overed) this.fireEvent('enter', [this.element, overed]);
  6226. // this.overed = overed;
  6227. // }
  6228. //},
  6229. drag: function(event){
  6230. this.parent(event);
  6231. if (this.options.checkDroppables && this.droppables.length) this.checkDroppables();
  6232. },
  6233. stop: function(event){
  6234. this.checkDroppables();
  6235. this.fireEvent('drop', [this.element, this.overed, event]);
  6236. this.overed = null;
  6237. return this.parent(event);
  6238. }
  6239. });
  6240. Element.implement({
  6241. makeDraggable: function(options){
  6242. var drag = new Drag.Move(this, options);
  6243. this.store('dragger', drag);
  6244. return drag;
  6245. }
  6246. });
  6247. /*
  6248. ---
  6249. script: Element.Measure.js
  6250. name: Element.Measure
  6251. description: Extends the Element native object to include methods useful in measuring dimensions.
  6252. credits: "Element.measure / .expose methods by Daniel Steigerwald License: MIT-style license. Copyright: Copyright (c) 2008 Daniel Steigerwald, daniel.steigerwald.cz"
  6253. license: MIT-style license
  6254. authors:
  6255. - Aaron Newton
  6256. requires:
  6257. - Core/Element.Style
  6258. - Core/Element.Dimensions
  6259. - MooTools.More
  6260. provides: [Element.Measure]
  6261. ...
  6262. */
  6263. (function(){
  6264. var getStylesList = function(styles, planes){
  6265. var list = [];
  6266. Object.each(planes, function(directions){
  6267. Object.each(directions, function(edge){
  6268. styles.each(function(style){
  6269. list.push(style + '-' + edge + (style == 'border' ? '-width' : ''));
  6270. });
  6271. });
  6272. });
  6273. return list;
  6274. };
  6275. var calculateEdgeSize = function(edge, styles){
  6276. var total = 0;
  6277. Object.each(styles, function(value, style){
  6278. if (style.test(edge)) total = total + value.toInt();
  6279. });
  6280. return total;
  6281. };
  6282. var isVisible = function(el){
  6283. return !!(!el || el.offsetHeight || el.offsetWidth);
  6284. };
  6285. Element.implement({
  6286. measure: function(fn){
  6287. if (isVisible(this)) return fn.call(this);
  6288. var parent = this.getParent(),
  6289. toMeasure = [];
  6290. while (!isVisible(parent) && parent != document.body){
  6291. toMeasure.push(parent.expose());
  6292. parent = parent.getParent();
  6293. }
  6294. var restore = this.expose(),
  6295. result = fn.call(this);
  6296. restore();
  6297. toMeasure.each(function(restore){
  6298. restore();
  6299. });
  6300. return result;
  6301. },
  6302. expose: function(){
  6303. if (this.getStyle('display') != 'none') return function(){};
  6304. var before = this.style.cssText;
  6305. this.setStyles({
  6306. display: 'block',
  6307. position: 'absolute',
  6308. visibility: 'hidden'
  6309. });
  6310. return function(){
  6311. this.style.cssText = before;
  6312. }.bind(this);
  6313. },
  6314. getDimensions: function(options){
  6315. options = Object.merge({computeSize: false}, options);
  6316. var dim = {x: 0, y: 0};
  6317. var getSize = function(el, options){
  6318. return (options.computeSize) ? el.getComputedSize(options) : el.getSize();
  6319. };
  6320. var parent = this.getParent('body');
  6321. if (parent && this.getStyle('display') == 'none'){
  6322. dim = this.measure(function(){
  6323. return getSize(this, options);
  6324. });
  6325. } else if (parent){
  6326. try { //safari sometimes crashes here, so catch it
  6327. dim = getSize(this, options);
  6328. } catch (e){}
  6329. }
  6330. return Object.append(dim, (dim.x || dim.x === 0) ? {
  6331. width: dim.x,
  6332. height: dim.y
  6333. } : {
  6334. x: dim.width,
  6335. y: dim.height
  6336. });
  6337. },
  6338. getComputedSize: function(options){
  6339. //<1.2compat>
  6340. //legacy support for my stupid spelling error
  6341. if (options && options.plains) options.planes = options.plains;
  6342. //</1.2compat>
  6343. options = Object.merge({
  6344. styles: ['padding','border'],
  6345. planes: {
  6346. height: ['top','bottom'],
  6347. width: ['left','right']
  6348. },
  6349. mode: 'both'
  6350. }, options);
  6351. var styles = {},
  6352. size = {width: 0, height: 0},
  6353. dimensions;
  6354. if (options.mode == 'vertical'){
  6355. delete size.width;
  6356. delete options.planes.width;
  6357. } else if (options.mode == 'horizontal'){
  6358. delete size.height;
  6359. delete options.planes.height;
  6360. }
  6361. getStylesList(options.styles, options.planes).each(function(style){
  6362. styles[style] = this.getStyle(style).toInt();
  6363. }, this);
  6364. Object.each(options.planes, function(edges, plane){
  6365. var capitalized = plane.capitalize(),
  6366. style = this.getStyle(plane);
  6367. if (style == 'auto' && !dimensions) dimensions = this.getDimensions();
  6368. style = styles[plane] = (style == 'auto') ? dimensions[plane] : style.toInt();
  6369. size['total' + capitalized] = style;
  6370. edges.each(function(edge){
  6371. var edgesize = calculateEdgeSize(edge, styles);
  6372. size['computed' + edge.capitalize()] = edgesize;
  6373. size['total' + capitalized] += edgesize;
  6374. });
  6375. }, this);
  6376. return Object.append(size, styles);
  6377. }
  6378. });
  6379. })();
  6380. /*
  6381. ---
  6382. script: Slider.js
  6383. name: Slider
  6384. description: Class for creating horizontal and vertical slider controls.
  6385. license: MIT-style license
  6386. authors:
  6387. - Valerio Proietti
  6388. requires:
  6389. - Core/Element.Dimensions
  6390. - Core/Number
  6391. - Class.Binds
  6392. - Drag
  6393. - Element.Measure
  6394. provides: [Slider]
  6395. ...
  6396. */
  6397. (function(){
  6398. var Slider = this.Slider = new Class({
  6399. Implements: [Events, Options],
  6400. Binds: ['clickedElement', 'draggedKnob', 'scrolledElement'],
  6401. options: {/*
  6402. onTick: function(intPosition){},
  6403. onMove: function(){},
  6404. onChange: function(intStep){},
  6405. onComplete: function(strStep){},*/
  6406. onTick: function(position){
  6407. this.setKnobPosition(position);
  6408. },
  6409. initialStep: 0,
  6410. snap: false,
  6411. offset: 0,
  6412. range: false,
  6413. wheel: false,
  6414. steps: 100,
  6415. mode: 'horizontal'
  6416. },
  6417. initialize: function(element, knob, options){
  6418. this.setOptions(options);
  6419. options = this.options;
  6420. this.element = document.id(element);
  6421. knob = this.knob = document.id(knob);
  6422. this.previousChange = this.previousEnd = this.step = options.initialStep ? options.initialStep : options.range ? options.range[0] : 0;
  6423. var limit = {},
  6424. modifiers = {x: false, y: false};
  6425. switch (options.mode){
  6426. case 'vertical':
  6427. this.axis = 'y';
  6428. this.property = 'top';
  6429. this.offset = 'offsetHeight';
  6430. break;
  6431. case 'horizontal':
  6432. this.axis = 'x';
  6433. this.property = 'left';
  6434. this.offset = 'offsetWidth';
  6435. }
  6436. this.setSliderDimensions();
  6437. this.setRange(options.range, null, true);
  6438. if (knob.getStyle('position') == 'static') knob.setStyle('position', 'relative');
  6439. knob.setStyle(this.property, -options.offset);
  6440. modifiers[this.axis] = this.property;
  6441. limit[this.axis] = [-options.offset, this.full - options.offset];
  6442. var dragOptions = {
  6443. snap: 0,
  6444. limit: limit,
  6445. modifiers: modifiers,
  6446. onDrag: this.draggedKnob,
  6447. onStart: this.draggedKnob,
  6448. onBeforeStart: (function(){
  6449. this.isDragging = true;
  6450. }).bind(this),
  6451. onCancel: function(){
  6452. this.isDragging = false;
  6453. }.bind(this),
  6454. onComplete: function(){
  6455. this.isDragging = false;
  6456. this.draggedKnob();
  6457. this.end();
  6458. }.bind(this)
  6459. };
  6460. if (options.snap) this.setSnap(dragOptions);
  6461. this.drag = new Drag(knob, dragOptions);
  6462. if (options.initialStep != null) this.set(options.initialStep, true);
  6463. this.attach();
  6464. },
  6465. attach: function(){
  6466. this.element.addEvent('mousedown', this.clickedElement);
  6467. if (this.options.wheel) this.element.addEvent('mousewheel', this.scrolledElement);
  6468. this.drag.attach();
  6469. return this;
  6470. },
  6471. detach: function(){
  6472. this.element.removeEvent('mousedown', this.clickedElement)
  6473. .removeEvent('mousewheel', this.scrolledElement);
  6474. this.drag.detach();
  6475. return this;
  6476. },
  6477. autosize: function(){
  6478. this.setSliderDimensions()
  6479. .setKnobPosition(this.toPosition(this.step));
  6480. this.drag.options.limit[this.axis] = [-this.options.offset, this.full - this.options.offset];
  6481. if (this.options.snap) this.setSnap();
  6482. return this;
  6483. },
  6484. setSnap: function(options){
  6485. if (!options) options = this.drag.options;
  6486. options.grid = Math.ceil(this.stepWidth);
  6487. options.limit[this.axis][1] = this.element[this.offset];
  6488. return this;
  6489. },
  6490. setKnobPosition: function(position){
  6491. if (this.options.snap) position = this.toPosition(this.step);
  6492. this.knob.setStyle(this.property, position);
  6493. return this;
  6494. },
  6495. setSliderDimensions: function(){
  6496. this.full = this.element.measure(function(){
  6497. this.half = this.knob[this.offset] / 2;
  6498. return this.element[this.offset] - this.knob[this.offset] + (this.options.offset * 2);
  6499. }.bind(this));
  6500. return this;
  6501. },
  6502. set: function(step, silently){
  6503. if (!((this.range > 0) ^ (step < this.min))) step = this.min;
  6504. if (!((this.range > 0) ^ (step > this.max))) step = this.max;
  6505. this.step = (step).round(this.modulus.decimalLength);
  6506. if (silently) this.checkStep().setKnobPosition(this.toPosition(this.step));
  6507. else this.checkStep().fireEvent('tick', this.toPosition(this.step)).fireEvent('move').end();
  6508. return this;
  6509. },
  6510. setRange: function(range, pos, silently){
  6511. this.min = Array.pick([range[0], 0]);
  6512. this.max = Array.pick([range[1], this.options.steps]);
  6513. this.range = this.max - this.min;
  6514. this.steps = this.options.steps || this.full;
  6515. var stepSize = this.stepSize = Math.abs(this.range) / this.steps;
  6516. this.stepWidth = this.stepSize * this.full / Math.abs(this.range);
  6517. this.setModulus();
  6518. if (range) this.set(Array.pick([pos, this.step]).limit(this.min,this.max), silently);
  6519. return this;
  6520. },
  6521. setModulus: function(){
  6522. var decimals = ((this.stepSize + '').split('.')[1] || []).length,
  6523. modulus = 1 + '';
  6524. while (decimals--) modulus += '0';
  6525. this.modulus = {multiplier: (modulus).toInt(10), decimalLength: modulus.length - 1};
  6526. },
  6527. clickedElement: function(event){
  6528. if (this.isDragging || event.target == this.knob) return;
  6529. var dir = this.range < 0 ? -1 : 1,
  6530. position = event.page[this.axis] - this.element.getPosition()[this.axis] - this.half;
  6531. position = position.limit(-this.options.offset, this.full - this.options.offset);
  6532. this.step = (this.min + dir * this.toStep(position)).round(this.modulus.decimalLength);
  6533. this.checkStep()
  6534. .fireEvent('tick', position)
  6535. .fireEvent('move')
  6536. .end();
  6537. },
  6538. scrolledElement: function(event){
  6539. var mode = (this.options.mode == 'horizontal') ? (event.wheel < 0) : (event.wheel > 0);
  6540. this.set(this.step + (mode ? -1 : 1) * this.stepSize);
  6541. event.stop();
  6542. },
  6543. draggedKnob: function(){
  6544. var dir = this.range < 0 ? -1 : 1,
  6545. position = this.drag.value.now[this.axis];
  6546. position = position.limit(-this.options.offset, this.full -this.options.offset);
  6547. this.step = (this.min + dir * this.toStep(position)).round(this.modulus.decimalLength);
  6548. this.checkStep();
  6549. this.fireEvent('move');
  6550. },
  6551. checkStep: function(){
  6552. var step = this.step;
  6553. if (this.previousChange != step){
  6554. this.previousChange = step;
  6555. this.fireEvent('change', step);
  6556. }
  6557. return this;
  6558. },
  6559. end: function(){
  6560. var step = this.step;
  6561. if (this.previousEnd !== step){
  6562. this.previousEnd = step;
  6563. this.fireEvent('complete', step + '');
  6564. }
  6565. return this;
  6566. },
  6567. toStep: function(position){
  6568. var step = (position + this.options.offset) * this.stepSize / this.full * this.steps;
  6569. return this.options.steps ? (step - (step * this.modulus.multiplier) % (this.stepSize * this.modulus.multiplier) / this.modulus.multiplier).round(this.modulus.decimalLength) : step;
  6570. },
  6571. toPosition: function(step){
  6572. return (this.full * Math.abs(this.min - step)) / (this.steps * this.stepSize) - this.options.offset || 0;
  6573. }
  6574. });
  6575. })();
  6576. /*
  6577. ---
  6578. script: Sortables.js
  6579. name: Sortables
  6580. description: Class for creating a drag and drop sorting interface for lists of items.
  6581. license: MIT-style license
  6582. authors:
  6583. - Tom Occhino
  6584. requires:
  6585. - Core/Fx.Morph
  6586. - Drag.Move
  6587. provides: [Sortables]
  6588. ...
  6589. */
  6590. (function(){
  6591. var Sortables = this.Sortables = new Class({
  6592. Implements: [Events, Options],
  6593. options: {/*
  6594. onSort: function(element, clone){},
  6595. onStart: function(element, clone){},
  6596. onComplete: function(element){},*/
  6597. opacity: 1,
  6598. clone: false,
  6599. revert: false,
  6600. handle: false,
  6601. dragOptions: {},
  6602. unDraggableTags: ['button', 'input', 'a', 'textarea', 'select', 'option']/*<1.2compat>*/,
  6603. snap: 4,
  6604. constrain: false,
  6605. preventDefault: false
  6606. /*</1.2compat>*/
  6607. },
  6608. initialize: function(lists, options){
  6609. this.setOptions(options);
  6610. this.elements = [];
  6611. this.lists = [];
  6612. this.idle = true;
  6613. this.addLists($$(document.id(lists) || lists));
  6614. if (!this.options.clone) this.options.revert = false;
  6615. if (this.options.revert) this.effect = new Fx.Morph(null, Object.merge({
  6616. duration: 250,
  6617. link: 'cancel'
  6618. }, this.options.revert));
  6619. },
  6620. attach: function(){
  6621. this.addLists(this.lists);
  6622. return this;
  6623. },
  6624. detach: function(){
  6625. this.lists = this.removeLists(this.lists);
  6626. return this;
  6627. },
  6628. addItems: function(){
  6629. Array.flatten(arguments).each(function(element){
  6630. this.elements.push(element);
  6631. var start = element.retrieve('sortables:start', function(event){
  6632. this.start.call(this, event, element);
  6633. }.bind(this));
  6634. (this.options.handle ? element.getElement(this.options.handle) || element : element).addEvent('mousedown', start);
  6635. }, this);
  6636. return this;
  6637. },
  6638. addLists: function(){
  6639. Array.flatten(arguments).each(function(list){
  6640. this.lists.include(list);
  6641. this.addItems(list.getChildren());
  6642. }, this);
  6643. return this;
  6644. },
  6645. removeItems: function(){
  6646. return $$(Array.flatten(arguments).map(function(element){
  6647. this.elements.erase(element);
  6648. var start = element.retrieve('sortables:start');
  6649. (this.options.handle ? element.getElement(this.options.handle) || element : element).removeEvent('mousedown', start);
  6650. return element;
  6651. }, this));
  6652. },
  6653. removeLists: function(){
  6654. return $$(Array.flatten(arguments).map(function(list){
  6655. this.lists.erase(list);
  6656. this.removeItems(list.getChildren());
  6657. return list;
  6658. }, this));
  6659. },
  6660. getDroppableCoordinates: function(element){
  6661. var offsetParent = element.getOffsetParent();
  6662. var position = element.getPosition(offsetParent);
  6663. var scroll = {
  6664. w: window.getScroll(),
  6665. offsetParent: offsetParent.getScroll()
  6666. };
  6667. position.x += scroll.offsetParent.x;
  6668. position.y += scroll.offsetParent.y;
  6669. if (offsetParent.getStyle('position') == 'fixed'){
  6670. position.x -= scroll.w.x;
  6671. position.y -= scroll.w.y;
  6672. }
  6673. return position;
  6674. },
  6675. getClone: function(event, element){
  6676. if (!this.options.clone) return new Element(element.tagName).inject(document.body);
  6677. if (typeOf(this.options.clone) == 'function') return this.options.clone.call(this, event, element, this.list);
  6678. var clone = element.clone(true).setStyles({
  6679. margin: 0,
  6680. position: 'absolute',
  6681. visibility: 'hidden',
  6682. width: element.getStyle('width')
  6683. }).addEvent('mousedown', function(event){
  6684. element.fireEvent('mousedown', event);
  6685. });
  6686. //prevent the duplicated radio inputs from unchecking the real one
  6687. if (clone.get('html').test('radio')){
  6688. clone.getElements('input[type=radio]').each(function(input, i){
  6689. input.set('name', 'clone_' + i);
  6690. if (input.get('checked')) element.getElements('input[type=radio]')[i].set('checked', true);
  6691. });
  6692. }
  6693. return clone.inject(this.list).setPosition(this.getDroppableCoordinates(this.element));
  6694. },
  6695. getDroppables: function(){
  6696. var droppables = this.list.getChildren().erase(this.clone).erase(this.element);
  6697. if (!this.options.constrain) droppables.append(this.lists).erase(this.list);
  6698. return droppables;
  6699. },
  6700. insert: function(dragging, element){
  6701. var where = 'inside';
  6702. if (this.lists.contains(element)){
  6703. this.list = element;
  6704. this.drag.droppables = this.getDroppables();
  6705. } else {
  6706. where = this.element.getAllPrevious().contains(element) ? 'before' : 'after';
  6707. }
  6708. this.element.inject(element, where);
  6709. this.fireEvent('sort', [this.element, this.clone]);
  6710. },
  6711. start: function(event, element){
  6712. if (
  6713. !this.idle ||
  6714. event.rightClick ||
  6715. (!this.options.handle && this.options.unDraggableTags.contains(event.target.get('tag')))
  6716. ) return;
  6717. this.idle = false;
  6718. this.element = element;
  6719. this.opacity = element.getStyle('opacity');
  6720. this.list = element.getParent();
  6721. this.clone = this.getClone(event, element);
  6722. this.drag = new Drag.Move(this.clone, Object.merge({
  6723. /*<1.2compat>*/
  6724. preventDefault: this.options.preventDefault,
  6725. snap: this.options.snap,
  6726. container: this.options.constrain && this.element.getParent(),
  6727. /*</1.2compat>*/
  6728. droppables: this.getDroppables()
  6729. }, this.options.dragOptions)).addEvents({
  6730. onSnap: function(){
  6731. event.stop();
  6732. this.clone.setStyle('visibility', 'visible');
  6733. this.element.setStyle('opacity', this.options.opacity || 0);
  6734. this.fireEvent('start', [this.element, this.clone]);
  6735. }.bind(this),
  6736. onEnter: this.insert.bind(this),
  6737. onCancel: this.end.bind(this),
  6738. onComplete: this.end.bind(this)
  6739. });
  6740. this.clone.inject(this.element, 'before');
  6741. this.drag.start(event);
  6742. },
  6743. end: function(){
  6744. this.drag.detach();
  6745. this.element.setStyle('opacity', this.opacity);
  6746. var self = this;
  6747. if (this.effect){
  6748. var dim = this.element.getStyles('width', 'height'),
  6749. clone = this.clone,
  6750. pos = clone.computePosition(this.getDroppableCoordinates(clone));
  6751. var destroy = function(){
  6752. this.removeEvent('cancel', destroy);
  6753. clone.destroy();
  6754. self.reset();
  6755. };
  6756. this.effect.element = clone;
  6757. this.effect.start({
  6758. top: pos.top,
  6759. left: pos.left,
  6760. width: dim.width,
  6761. height: dim.height,
  6762. opacity: 0.25
  6763. }).addEvent('cancel', destroy).chain(destroy);
  6764. } else {
  6765. this.clone.destroy();
  6766. self.reset();
  6767. }
  6768. },
  6769. reset: function(){
  6770. this.idle = true;
  6771. this.fireEvent('complete', this.element);
  6772. },
  6773. serialize: function(){
  6774. var params = Array.link(arguments, {
  6775. modifier: Type.isFunction,
  6776. index: function(obj){
  6777. return obj != null;
  6778. }
  6779. });
  6780. var serial = this.lists.map(function(list){
  6781. return list.getChildren().map(params.modifier || function(element){
  6782. return element.get('id');
  6783. }, this);
  6784. }, this);
  6785. var index = params.index;
  6786. if (this.lists.length == 1) index = 0;
  6787. return (index || index === 0) && index >= 0 && index < this.lists.length ? serial[index] : serial;
  6788. }
  6789. });
  6790. })();
  6791. /*
  6792. ---
  6793. name: Element.Event.Pseudos
  6794. description: Adds the functionality to add pseudo events for Elements
  6795. license: MIT-style license
  6796. authors:
  6797. - Arian Stolwijk
  6798. requires: [Core/Element.Event, Core/Element.Delegation, Events.Pseudos]
  6799. provides: [Element.Event.Pseudos, Element.Delegation.Pseudo]
  6800. ...
  6801. */
  6802. (function(){
  6803. var pseudos = {relay: false},
  6804. copyFromEvents = ['once', 'throttle', 'pause'],
  6805. count = copyFromEvents.length;
  6806. while (count--) pseudos[copyFromEvents[count]] = Events.lookupPseudo(copyFromEvents[count]);
  6807. DOMEvent.definePseudo = function(key, listener){
  6808. pseudos[key] = listener;
  6809. return this;
  6810. };
  6811. var proto = Element.prototype;
  6812. [Element, Window, Document].invoke('implement', Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
  6813. })();
  6814. /*
  6815. ---
  6816. name: Element.Event.Pseudos.Keys
  6817. description: Adds functionality fire events if certain keycombinations are pressed
  6818. license: MIT-style license
  6819. authors:
  6820. - Arian Stolwijk
  6821. requires: [Element.Event.Pseudos]
  6822. provides: [Element.Event.Pseudos.Keys]
  6823. ...
  6824. */
  6825. (function(){
  6826. var keysStoreKey = '$moo:keys-pressed',
  6827. keysKeyupStoreKey = '$moo:keys-keyup';
  6828. DOMEvent.definePseudo('keys', function(split, fn, args){
  6829. var event = args[0],
  6830. keys = [],
  6831. pressed = this.retrieve(keysStoreKey, []),
  6832. value = split.value;
  6833. if (value != '+') keys.append(value.replace('++', function(){
  6834. keys.push('+'); // shift++ and shift+++a
  6835. return '';
  6836. }).split('+'));
  6837. else keys = ['+'];
  6838. pressed.include(event.key);
  6839. if (keys.every(function(key){
  6840. return pressed.contains(key);
  6841. })) fn.apply(this, args);
  6842. this.store(keysStoreKey, pressed);
  6843. if (!this.retrieve(keysKeyupStoreKey)){
  6844. var keyup = function(event){
  6845. (function(){
  6846. pressed = this.retrieve(keysStoreKey, []).erase(event.key);
  6847. this.store(keysStoreKey, pressed);
  6848. }).delay(0, this); // Fix for IE
  6849. };
  6850. this.store(keysKeyupStoreKey, keyup).addEvent('keyup', keyup);
  6851. }
  6852. });
  6853. DOMEvent.defineKeys({
  6854. '16': 'shift',
  6855. '17': 'control',
  6856. '18': 'alt',
  6857. '20': 'capslock',
  6858. '33': 'pageup',
  6859. '34': 'pagedown',
  6860. '35': 'end',
  6861. '36': 'home',
  6862. '144': 'numlock',
  6863. '145': 'scrolllock',
  6864. '186': ';',
  6865. '187': '=',
  6866. '188': ',',
  6867. '190': '.',
  6868. '191': '/',
  6869. '192': '`',
  6870. '219': '[',
  6871. '220': '\\',
  6872. '221': ']',
  6873. '222': "'",
  6874. '107': '+',
  6875. '109': '-', // subtract
  6876. '189': '-' // dash
  6877. });
  6878. })();
  6879. /*
  6880. ---
  6881. script: String.Extras.js
  6882. name: String.Extras
  6883. description: Extends the String native object to include methods useful in managing various kinds of strings (query strings, urls, html, etc).
  6884. license: MIT-style license
  6885. authors:
  6886. - Aaron Newton
  6887. - Guillermo Rauch
  6888. - Christopher Pitt
  6889. requires:
  6890. - Core/String
  6891. - Core/Array
  6892. - MooTools.More
  6893. provides: [String.Extras]
  6894. ...
  6895. */
  6896. (function(){
  6897. var special = {
  6898. 'a': /[àáâãäåăą]/g,
  6899. 'A': /[ÀÁÂÃÄÅĂĄ]/g,
  6900. 'c': /[ćčç]/g,
  6901. 'C': /[ĆČÇ]/g,
  6902. 'd': /[ďđ]/g,
  6903. 'D': /[ĎÐ]/g,
  6904. 'e': /[èéêëěę]/g,
  6905. 'E': /[ÈÉÊËĚĘ]/g,
  6906. 'g': /[ğ]/g,
  6907. 'G': /[Ğ]/g,
  6908. 'i': /[ìíîï]/g,
  6909. 'I': /[ÌÍÎÏ]/g,
  6910. 'l': /[ĺľł]/g,
  6911. 'L': /[ĹĽŁ]/g,
  6912. 'n': /[ñňń]/g,
  6913. 'N': /[ÑŇŃ]/g,
  6914. 'o': /[òóôõöøő]/g,
  6915. 'O': /[ÒÓÔÕÖØ]/g,
  6916. 'r': /[řŕ]/g,
  6917. 'R': /[ŘŔ]/g,
  6918. 's': /[ššş]/g,
  6919. 'S': /[ŠŞŚ]/g,
  6920. 't': /[ťţ]/g,
  6921. 'T': /[ŤŢ]/g,
  6922. 'u': /[ùúûůüµ]/g,
  6923. 'U': /[ÙÚÛŮÜ]/g,
  6924. 'y': /[ÿý]/g,
  6925. 'Y': /[ŸÝ]/g,
  6926. 'z': /[žźż]/g,
  6927. 'Z': /[ŽŹŻ]/g,
  6928. 'th': /[þ]/g,
  6929. 'TH': /[Þ]/g,
  6930. 'dh': /[ð]/g,
  6931. 'DH': /[Ð]/g,
  6932. 'ss': /[ß]/g,
  6933. 'oe': /[œ]/g,
  6934. 'OE': /[Œ]/g,
  6935. 'ae': /[æ]/g,
  6936. 'AE': /[Æ]/g
  6937. },
  6938. tidy = {
  6939. ' ': /[\xa0\u2002\u2003\u2009]/g,
  6940. '*': /[\xb7]/g,
  6941. '\'': /[\u2018\u2019]/g,
  6942. '"': /[\u201c\u201d]/g,
  6943. '...': /[\u2026]/g,
  6944. '-': /[\u2013]/g,
  6945. // '--': /[\u2014]/g,
  6946. '&raquo;': /[\uFFFD]/g
  6947. },
  6948. conversions = {
  6949. ms: 1,
  6950. s: 1000,
  6951. m: 6e4,
  6952. h: 36e5
  6953. },
  6954. findUnits = /(\d*.?\d+)([msh]+)/;
  6955. var walk = function(string, replacements){
  6956. var result = string, key;
  6957. for (key in replacements) result = result.replace(replacements[key], key);
  6958. return result;
  6959. };
  6960. var getRegexForTag = function(tag, contents){
  6961. tag = tag || (contents ? '' : '\\w+');
  6962. var regstr = contents ? '<' + tag + '(?!\\w)[^>]*>([\\s\\S]*?)<\/' + tag + '(?!\\w)>' : '<\/?' + tag + '\/?>|<' + tag + '[\\s|\/][^>]*>';
  6963. return new RegExp(regstr, 'gi');
  6964. };
  6965. String.implement({
  6966. standardize: function(){
  6967. return walk(this, special);
  6968. },
  6969. repeat: function(times){
  6970. return new Array(times + 1).join(this);
  6971. },
  6972. pad: function(length, str, direction){
  6973. if (this.length >= length) return this;
  6974. var pad = (str == null ? ' ' : '' + str)
  6975. .repeat(length - this.length)
  6976. .substr(0, length - this.length);
  6977. if (!direction || direction == 'right') return this + pad;
  6978. if (direction == 'left') return pad + this;
  6979. return pad.substr(0, (pad.length / 2).floor()) + this + pad.substr(0, (pad.length / 2).ceil());
  6980. },
  6981. getTags: function(tag, contents){
  6982. return this.match(getRegexForTag(tag, contents)) || [];
  6983. },
  6984. stripTags: function(tag, contents){
  6985. return this.replace(getRegexForTag(tag, contents), '');
  6986. },
  6987. tidy: function(){
  6988. return walk(this, tidy);
  6989. },
  6990. truncate: function(max, trail, atChar){
  6991. var string = this;
  6992. if (trail == null && arguments.length == 1) trail = '…';
  6993. if (string.length > max){
  6994. string = string.substring(0, max);
  6995. if (atChar){
  6996. var index = string.lastIndexOf(atChar);
  6997. if (index != -1) string = string.substr(0, index);
  6998. }
  6999. if (trail) string += trail;
  7000. }
  7001. return string;
  7002. },
  7003. ms: function(){
  7004. // "Borrowed" from https://gist.github.com/1503944
  7005. var units = findUnits.exec(this);
  7006. if (units == null) return Number(this);
  7007. return Number(units[1]) * conversions[units[2]];
  7008. }
  7009. });
  7010. })();
  7011. /*
  7012. ---
  7013. script: Element.Forms.js
  7014. name: Element.Forms
  7015. description: Extends the Element native object to include methods useful in managing inputs.
  7016. license: MIT-style license
  7017. authors:
  7018. - Aaron Newton
  7019. requires:
  7020. - Core/Element
  7021. - String.Extras
  7022. - MooTools.More
  7023. provides: [Element.Forms]
  7024. ...
  7025. */
  7026. Element.implement({
  7027. tidy: function(){
  7028. this.set('value', this.get('value').tidy());
  7029. },
  7030. getTextInRange: function(start, end){
  7031. return this.get('value').substring(start, end);
  7032. },
  7033. getSelectedText: function(){
  7034. if (this.setSelectionRange) return this.getTextInRange(this.getSelectionStart(), this.getSelectionEnd());
  7035. return document.selection.createRange().text;
  7036. },
  7037. getSelectedRange: function(){
  7038. if (this.selectionStart != null){
  7039. return {
  7040. start: this.selectionStart,
  7041. end: this.selectionEnd
  7042. };
  7043. }
  7044. var pos = {
  7045. start: 0,
  7046. end: 0
  7047. };
  7048. var range = this.getDocument().selection.createRange();
  7049. if (!range || range.parentElement() != this) return pos;
  7050. var duplicate = range.duplicate();
  7051. if (this.type == 'text'){
  7052. pos.start = 0 - duplicate.moveStart('character', -100000);
  7053. pos.end = pos.start + range.text.length;
  7054. } else {
  7055. var value = this.get('value');
  7056. var offset = value.length;
  7057. duplicate.moveToElementText(this);
  7058. duplicate.setEndPoint('StartToEnd', range);
  7059. if (duplicate.text.length) offset -= value.match(/[\n\r]*$/)[0].length;
  7060. pos.end = offset - duplicate.text.length;
  7061. duplicate.setEndPoint('StartToStart', range);
  7062. pos.start = offset - duplicate.text.length;
  7063. }
  7064. return pos;
  7065. },
  7066. getSelectionStart: function(){
  7067. return this.getSelectedRange().start;
  7068. },
  7069. getSelectionEnd: function(){
  7070. return this.getSelectedRange().end;
  7071. },
  7072. setCaretPosition: function(pos){
  7073. if (pos == 'end') pos = this.get('value').length;
  7074. this.selectRange(pos, pos);
  7075. return this;
  7076. },
  7077. getCaretPosition: function(){
  7078. return this.getSelectedRange().start;
  7079. },
  7080. selectRange: function(start, end){
  7081. if (this.setSelectionRange){
  7082. this.focus();
  7083. this.setSelectionRange(start, end);
  7084. } else {
  7085. var value = this.get('value');
  7086. var diff = value.substr(start, end - start).replace(/\r/g, '').length;
  7087. start = value.substr(0, start).replace(/\r/g, '').length;
  7088. var range = this.createTextRange();
  7089. range.collapse(true);
  7090. range.moveEnd('character', start + diff);
  7091. range.moveStart('character', start);
  7092. range.select();
  7093. }
  7094. return this;
  7095. },
  7096. insertAtCursor: function(value, select){
  7097. var pos = this.getSelectedRange();
  7098. var text = this.get('value');
  7099. this.set('value', text.substring(0, pos.start) + value + text.substring(pos.end, text.length));
  7100. if (select !== false) this.selectRange(pos.start, pos.start + value.length);
  7101. else this.setCaretPosition(pos.start + value.length);
  7102. return this;
  7103. },
  7104. insertAroundCursor: function(options, select){
  7105. options = Object.append({
  7106. before: '',
  7107. defaultMiddle: '',
  7108. after: ''
  7109. }, options);
  7110. var value = this.getSelectedText() || options.defaultMiddle;
  7111. var pos = this.getSelectedRange();
  7112. var text = this.get('value');
  7113. if (pos.start == pos.end){
  7114. this.set('value', text.substring(0, pos.start) + options.before + value + options.after + text.substring(pos.end, text.length));
  7115. this.selectRange(pos.start + options.before.length, pos.end + options.before.length + value.length);
  7116. } else {
  7117. var current = text.substring(pos.start, pos.end);
  7118. this.set('value', text.substring(0, pos.start) + options.before + current + options.after + text.substring(pos.end, text.length));
  7119. var selStart = pos.start + options.before.length;
  7120. if (select !== false) this.selectRange(selStart, selStart + current.length);
  7121. else this.setCaretPosition(selStart + text.length);
  7122. }
  7123. return this;
  7124. }
  7125. });
  7126. /*
  7127. ---
  7128. script: Element.Pin.js
  7129. name: Element.Pin
  7130. description: Extends the Element native object to include the pin method useful for fixed positioning for elements.
  7131. license: MIT-style license
  7132. authors:
  7133. - Aaron Newton
  7134. requires:
  7135. - Core/Element.Event
  7136. - Core/Element.Dimensions
  7137. - Core/Element.Style
  7138. - MooTools.More
  7139. provides: [Element.Pin]
  7140. ...
  7141. */
  7142. (function(){
  7143. var supportsPositionFixed = false,
  7144. supportTested = false;
  7145. var testPositionFixed = function(){
  7146. var test = new Element('div').setStyles({
  7147. position: 'fixed',
  7148. top: 0,
  7149. right: 0
  7150. }).inject(document.body);
  7151. supportsPositionFixed = (test.offsetTop === 0);
  7152. test.dispose();
  7153. supportTested = true;
  7154. };
  7155. Element.implement({
  7156. pin: function(enable, forceScroll){
  7157. if (!supportTested) testPositionFixed();
  7158. if (this.getStyle('display') == 'none') return this;
  7159. var pinnedPosition,
  7160. scroll = window.getScroll(),
  7161. parent,
  7162. scrollFixer;
  7163. if (enable !== false){
  7164. pinnedPosition = this.getPosition();
  7165. if (!this.retrieve('pin:_pinned')){
  7166. var currentPosition = {
  7167. top: pinnedPosition.y - scroll.y,
  7168. left: pinnedPosition.x - scroll.x,
  7169. margin: '0px',
  7170. padding: '0px'
  7171. };
  7172. if (supportsPositionFixed && !forceScroll){
  7173. this.setStyle('position', 'fixed').setStyles(currentPosition);
  7174. } else {
  7175. parent = this.getOffsetParent();
  7176. var position = this.getPosition(parent),
  7177. styles = this.getStyles('left', 'top');
  7178. if (parent && styles.left == 'auto' || styles.top == 'auto') this.setPosition(position);
  7179. if (this.getStyle('position') == 'static') this.setStyle('position', 'absolute');
  7180. position = {
  7181. x: styles.left.toInt() - scroll.x,
  7182. y: styles.top.toInt() - scroll.y
  7183. };
  7184. scrollFixer = function(){
  7185. if (!this.retrieve('pin:_pinned')) return;
  7186. var scroll = window.getScroll();
  7187. this.setStyles({
  7188. left: position.x + scroll.x,
  7189. top: position.y + scroll.y
  7190. });
  7191. }.bind(this);
  7192. this.store('pin:_scrollFixer', scrollFixer);
  7193. window.addEvent('scroll', scrollFixer);
  7194. }
  7195. this.store('pin:_pinned', true);
  7196. }
  7197. } else {
  7198. if (!this.retrieve('pin:_pinned')) return this;
  7199. parent = this.getParent();
  7200. var offsetParent = (parent.getComputedStyle('position') != 'static' ? parent : parent.getOffsetParent());
  7201. pinnedPosition = this.getPosition();
  7202. this.store('pin:_pinned', false);
  7203. scrollFixer = this.retrieve('pin:_scrollFixer');
  7204. if (!scrollFixer){
  7205. this.setStyles({
  7206. position: 'absolute',
  7207. top: pinnedPosition.y + scroll.y,
  7208. left: pinnedPosition.x + scroll.x
  7209. });
  7210. } else {
  7211. this.store('pin:_scrollFixer', null);
  7212. window.removeEvent('scroll', scrollFixer);
  7213. }
  7214. this.removeClass('isPinned');
  7215. }
  7216. return this;
  7217. },
  7218. unpin: function(){
  7219. return this.pin(false);
  7220. },
  7221. togglePin: function(){
  7222. return this.pin(!this.retrieve('pin:_pinned'));
  7223. }
  7224. });
  7225. //<1.2compat>
  7226. Element.alias('togglepin', 'togglePin');
  7227. //</1.2compat>
  7228. })();
  7229. /*
  7230. ---
  7231. script: Element.Position.js
  7232. name: Element.Position
  7233. description: Extends the Element native object to include methods useful positioning elements relative to others.
  7234. license: MIT-style license
  7235. authors:
  7236. - Aaron Newton
  7237. - Jacob Thornton
  7238. requires:
  7239. - Core/Options
  7240. - Core/Element.Dimensions
  7241. - Element.Measure
  7242. provides: [Element.Position]
  7243. ...
  7244. */
  7245. (function(original){
  7246. var local = Element.Position = {
  7247. options: {/*
  7248. edge: false,
  7249. returnPos: false,
  7250. minimum: {x: 0, y: 0},
  7251. maximum: {x: 0, y: 0},
  7252. relFixedPosition: false,
  7253. ignoreMargins: false,
  7254. ignoreScroll: false,
  7255. allowNegative: false,*/
  7256. relativeTo: document.body,
  7257. position: {
  7258. x: 'center', //left, center, right
  7259. y: 'center' //top, center, bottom
  7260. },
  7261. offset: {x: 0, y: 0}
  7262. },
  7263. getOptions: function(element, options){
  7264. options = Object.merge({}, local.options, options);
  7265. local.setPositionOption(options);
  7266. local.setEdgeOption(options);
  7267. local.setOffsetOption(element, options);
  7268. local.setDimensionsOption(element, options);
  7269. return options;
  7270. },
  7271. setPositionOption: function(options){
  7272. options.position = local.getCoordinateFromValue(options.position);
  7273. },
  7274. setEdgeOption: function(options){
  7275. var edgeOption = local.getCoordinateFromValue(options.edge);
  7276. options.edge = edgeOption ? edgeOption :
  7277. (options.position.x == 'center' && options.position.y == 'center') ? {x: 'center', y: 'center'} :
  7278. {x: 'left', y: 'top'};
  7279. },
  7280. setOffsetOption: function(element, options){
  7281. var parentOffset = {x: 0, y: 0};
  7282. var parentScroll = {x: 0, y: 0};
  7283. var offsetParent = element.measure(function(){
  7284. return document.id(this.getOffsetParent());
  7285. });
  7286. if (!offsetParent || offsetParent == element.getDocument().body || offsetParent==document.documentElement) return;
  7287. parentScroll = offsetParent.getScroll();
  7288. parentOffset = offsetParent.measure(function(){
  7289. var position = this.getPosition();
  7290. if (this.getStyle('position') == 'fixed'){
  7291. var scroll = window.getScroll();
  7292. position.x += scroll.x;
  7293. position.y += scroll.y;
  7294. }
  7295. return position;
  7296. });
  7297. options.offset = {
  7298. parentPositioned: offsetParent != document.id(options.relativeTo),
  7299. x: options.offset.x - parentOffset.x + parentScroll.x,
  7300. y: options.offset.y - parentOffset.y + parentScroll.y
  7301. };
  7302. },
  7303. setDimensionsOption: function(element, options){
  7304. options.dimensions = element.getDimensions({
  7305. computeSize: true,
  7306. styles: ['padding', 'border', 'margin']
  7307. });
  7308. },
  7309. getPosition: function(element, options){
  7310. var position = {};
  7311. options = local.getOptions(element, options);
  7312. var relativeTo = document.id(options.relativeTo) || document.body;
  7313. local.setPositionCoordinates(options, position, relativeTo);
  7314. if (options.edge) local.toEdge(position, options);
  7315. var offset = options.offset;
  7316. position.left = ((position.x >= 0 || offset.parentPositioned || options.allowNegative) ? position.x : 0).toInt();
  7317. position.top = ((position.y >= 0 || offset.parentPositioned || options.allowNegative) ? position.y : 0).toInt();
  7318. local.toMinMax(position, options);
  7319. if (options.relFixedPosition || relativeTo.getStyle('position') == 'fixed') local.toRelFixedPosition(relativeTo, position);
  7320. if (options.ignoreScroll) local.toIgnoreScroll(relativeTo, position);
  7321. if (options.ignoreMargins) local.toIgnoreMargins(position, options);
  7322. position.left = Math.ceil(position.left);
  7323. position.top = Math.ceil(position.top);
  7324. delete position.x;
  7325. delete position.y;
  7326. return position;
  7327. },
  7328. setPositionCoordinates: function(options, position, relativeTo){
  7329. var offsetY = options.offset.y,
  7330. offsetX = options.offset.x,
  7331. calc = (relativeTo == document.body) ? window.getScroll() : relativeTo.getPosition(),
  7332. top = calc.y,
  7333. left = calc.x,
  7334. winSize = window.getSize();
  7335. switch (options.position.x){
  7336. case 'left': position.x = left + offsetX; break;
  7337. case 'right': position.x = left + offsetX + relativeTo.offsetWidth; break;
  7338. default: position.x = left + ((relativeTo == document.body ? winSize.x : relativeTo.offsetWidth) / 2) + offsetX; break;
  7339. }
  7340. switch (options.position.y){
  7341. case 'top': position.y = top + offsetY; break;
  7342. case 'bottom': position.y = top + offsetY + relativeTo.offsetHeight; break;
  7343. default: position.y = top + ((relativeTo == document.body ? winSize.y : relativeTo.offsetHeight) / 2) + offsetY; break;
  7344. }
  7345. },
  7346. toMinMax: function(position, options){
  7347. var xy = {left: 'x', top: 'y'}, value;
  7348. ['minimum', 'maximum'].each(function(minmax){
  7349. ['left', 'top'].each(function(lr){
  7350. value = options[minmax] ? options[minmax][xy[lr]] : null;
  7351. if (value != null && ((minmax == 'minimum') ? position[lr] < value : position[lr] > value)) position[lr] = value;
  7352. });
  7353. });
  7354. },
  7355. toRelFixedPosition: function(relativeTo, position){
  7356. var winScroll = window.getScroll();
  7357. position.top += winScroll.y;
  7358. position.left += winScroll.x;
  7359. },
  7360. toIgnoreScroll: function(relativeTo, position){
  7361. var relScroll = relativeTo.getScroll();
  7362. position.top -= relScroll.y;
  7363. position.left -= relScroll.x;
  7364. },
  7365. toIgnoreMargins: function(position, options){
  7366. position.left += options.edge.x == 'right'
  7367. ? options.dimensions['margin-right']
  7368. : (options.edge.x != 'center'
  7369. ? -options.dimensions['margin-left']
  7370. : -options.dimensions['margin-left'] + ((options.dimensions['margin-right'] + options.dimensions['margin-left']) / 2));
  7371. position.top += options.edge.y == 'bottom'
  7372. ? options.dimensions['margin-bottom']
  7373. : (options.edge.y != 'center'
  7374. ? -options.dimensions['margin-top']
  7375. : -options.dimensions['margin-top'] + ((options.dimensions['margin-bottom'] + options.dimensions['margin-top']) / 2));
  7376. },
  7377. toEdge: function(position, options){
  7378. var edgeOffset = {},
  7379. dimensions = options.dimensions,
  7380. edge = options.edge;
  7381. switch (edge.x){
  7382. case 'left': edgeOffset.x = 0; break;
  7383. case 'right': edgeOffset.x = -dimensions.x - dimensions.computedRight - dimensions.computedLeft; break;
  7384. // center
  7385. default: edgeOffset.x = -(Math.round(dimensions.totalWidth / 2)); break;
  7386. }
  7387. switch (edge.y){
  7388. case 'top': edgeOffset.y = 0; break;
  7389. case 'bottom': edgeOffset.y = -dimensions.y - dimensions.computedTop - dimensions.computedBottom; break;
  7390. // center
  7391. default: edgeOffset.y = -(Math.round(dimensions.totalHeight / 2)); break;
  7392. }
  7393. position.x += edgeOffset.x;
  7394. position.y += edgeOffset.y;
  7395. },
  7396. getCoordinateFromValue: function(option){
  7397. if (typeOf(option) != 'string') return option;
  7398. option = option.toLowerCase();
  7399. return {
  7400. x: option.test('left') ? 'left'
  7401. : (option.test('right') ? 'right' : 'center'),
  7402. y: option.test(/upper|top/) ? 'top'
  7403. : (option.test('bottom') ? 'bottom' : 'center')
  7404. };
  7405. }
  7406. };
  7407. Element.implement({
  7408. position: function(options){
  7409. if (options && (options.x != null || options.y != null)){
  7410. return (original ? original.apply(this, arguments) : this);
  7411. }
  7412. var position = this.setStyle('position', 'absolute').calculatePosition(options);
  7413. return (options && options.returnPos) ? position : this.setStyles(position);
  7414. },
  7415. calculatePosition: function(options){
  7416. return local.getPosition(this, options);
  7417. }
  7418. });
  7419. })(Element.prototype.position);
  7420. /*
  7421. ---
  7422. script: Element.Shortcuts.js
  7423. name: Element.Shortcuts
  7424. description: Extends the Element native object to include some shortcut methods.
  7425. license: MIT-style license
  7426. authors:
  7427. - Aaron Newton
  7428. requires:
  7429. - Core/Element.Style
  7430. - MooTools.More
  7431. provides: [Element.Shortcuts]
  7432. ...
  7433. */
  7434. Element.implement({
  7435. isDisplayed: function(){
  7436. return this.getStyle('display') != 'none';
  7437. },
  7438. isVisible: function(){
  7439. var w = this.offsetWidth,
  7440. h = this.offsetHeight;
  7441. return (w == 0 && h == 0) ? false : (w > 0 && h > 0) ? true : this.style.display != 'none';
  7442. },
  7443. toggle: function(){
  7444. return this[this.isDisplayed() ? 'hide' : 'show']();
  7445. },
  7446. hide: function(){
  7447. var d;
  7448. try {
  7449. //IE fails here if the element is not in the dom
  7450. d = this.getStyle('display');
  7451. } catch (e){}
  7452. if (d == 'none') return this;
  7453. return this.store('element:_originalDisplay', d || '').setStyle('display', 'none');
  7454. },
  7455. show: function(display){
  7456. if (!display && this.isDisplayed()) return this;
  7457. display = display || this.retrieve('element:_originalDisplay') || 'block';
  7458. return this.setStyle('display', (display == 'none') ? 'block' : display);
  7459. },
  7460. swapClass: function(remove, add){
  7461. return this.removeClass(remove).addClass(add);
  7462. }
  7463. });
  7464. Document.implement({
  7465. clearSelection: function(){
  7466. if (window.getSelection){
  7467. var selection = window.getSelection();
  7468. if (selection && selection.removeAllRanges) selection.removeAllRanges();
  7469. } else if (document.selection && document.selection.empty){
  7470. try {
  7471. //IE fails here if selected element is not in dom
  7472. document.selection.empty();
  7473. } catch (e){}
  7474. }
  7475. }
  7476. });
  7477. /*
  7478. ---
  7479. script: Elements.From.js
  7480. name: Elements.From
  7481. description: Returns a collection of elements from a string of html.
  7482. license: MIT-style license
  7483. authors:
  7484. - Aaron Newton
  7485. requires:
  7486. - Core/String
  7487. - Core/Element
  7488. - MooTools.More
  7489. provides: [Elements.from, Elements.From]
  7490. ...
  7491. */
  7492. Elements.from = function(text, excludeScripts){
  7493. if (excludeScripts || excludeScripts == null) text = text.stripScripts();
  7494. var container, match = text.match(/^\s*(?:<!--.*?-->\s*)*<(t[dhr]|tbody|tfoot|thead)/i);
  7495. if (match){
  7496. container = new Element('table');
  7497. var tag = match[1].toLowerCase();
  7498. if (['td', 'th', 'tr'].contains(tag)){
  7499. container = new Element('tbody').inject(container);
  7500. if (tag != 'tr') container = new Element('tr').inject(container);
  7501. }
  7502. }
  7503. return (container || new Element('div')).set('html', text).getChildren();
  7504. };
  7505. /*
  7506. ---
  7507. script: IframeShim.js
  7508. name: IframeShim
  7509. description: Defines IframeShim, a class for obscuring select lists and flash objects in IE.
  7510. license: MIT-style license
  7511. authors:
  7512. - Aaron Newton
  7513. requires:
  7514. - Core/Element.Event
  7515. - Core/Element.Style
  7516. - Core/Options
  7517. - Core/Events
  7518. - Element.Position
  7519. - Class.Occlude
  7520. provides: [IframeShim]
  7521. ...
  7522. */
  7523. (function(){
  7524. var browsers = false;
  7525. //<1.4compat>
  7526. browsers = Browser.ie6 || (Browser.firefox && Browser.version < 3 && Browser.Platform.mac);
  7527. //</1.4compat>
  7528. var IframeShim = this.IframeShim = new Class({
  7529. Implements: [Options, Events, Class.Occlude],
  7530. options: {
  7531. className: 'iframeShim',
  7532. src: 'javascript:false;document.write("");',
  7533. display: false,
  7534. zIndex: null,
  7535. margin: 0,
  7536. offset: {x: 0, y: 0},
  7537. browsers: browsers
  7538. },
  7539. property: 'IframeShim',
  7540. initialize: function(element, options){
  7541. this.element = document.id(element);
  7542. if (this.occlude()) return this.occluded;
  7543. this.setOptions(options);
  7544. this.makeShim();
  7545. return this;
  7546. },
  7547. makeShim: function(){
  7548. if (this.options.browsers){
  7549. var zIndex = this.element.getStyle('zIndex').toInt();
  7550. if (!zIndex){
  7551. zIndex = 1;
  7552. var pos = this.element.getStyle('position');
  7553. if (pos == 'static' || !pos) this.element.setStyle('position', 'relative');
  7554. this.element.setStyle('zIndex', zIndex);
  7555. }
  7556. zIndex = ((this.options.zIndex != null || this.options.zIndex === 0) && zIndex > this.options.zIndex) ? this.options.zIndex : zIndex - 1;
  7557. if (zIndex < 0) zIndex = 1;
  7558. this.shim = new Element('iframe', {
  7559. src: this.options.src,
  7560. scrolling: 'no',
  7561. frameborder: 0,
  7562. styles: {
  7563. zIndex: zIndex,
  7564. position: 'absolute',
  7565. border: 'none',
  7566. filter: 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'
  7567. },
  7568. 'class': this.options.className
  7569. }).store('IframeShim', this);
  7570. var inject = (function(){
  7571. this.shim.inject(this.element, 'after');
  7572. this[this.options.display ? 'show' : 'hide']();
  7573. this.fireEvent('inject');
  7574. }).bind(this);
  7575. if (!IframeShim.ready) window.addEvent('load', inject);
  7576. else inject();
  7577. } else {
  7578. this.position = this.hide = this.show = this.dispose = Function.convert(this);
  7579. }
  7580. },
  7581. position: function(){
  7582. if (!IframeShim.ready || !this.shim) return this;
  7583. var size = this.element.measure(function(){
  7584. return this.getSize();
  7585. });
  7586. if (this.options.margin != undefined){
  7587. size.x = size.x - (this.options.margin * 2);
  7588. size.y = size.y - (this.options.margin * 2);
  7589. this.options.offset.x += this.options.margin;
  7590. this.options.offset.y += this.options.margin;
  7591. }
  7592. this.shim.set({width: size.x, height: size.y}).position({
  7593. relativeTo: this.element,
  7594. offset: this.options.offset
  7595. });
  7596. return this;
  7597. },
  7598. hide: function(){
  7599. if (this.shim) this.shim.setStyle('display', 'none');
  7600. return this;
  7601. },
  7602. show: function(){
  7603. if (this.shim) this.shim.setStyle('display', 'block');
  7604. return this.position();
  7605. },
  7606. dispose: function(){
  7607. if (this.shim) this.shim.dispose();
  7608. return this;
  7609. },
  7610. destroy: function(){
  7611. if (this.shim) this.shim.destroy();
  7612. return this;
  7613. }
  7614. });
  7615. })();
  7616. window.addEvent('load', function(){
  7617. IframeShim.ready = true;
  7618. });
  7619. /*
  7620. ---
  7621. script: Mask.js
  7622. name: Mask
  7623. description: Creates a mask element to cover another.
  7624. license: MIT-style license
  7625. authors:
  7626. - Aaron Newton
  7627. requires:
  7628. - Core/Options
  7629. - Core/Events
  7630. - Core/Element.Event
  7631. - Class.Binds
  7632. - Element.Position
  7633. - IframeShim
  7634. provides: [Mask]
  7635. ...
  7636. */
  7637. (function(){
  7638. var Mask = this.Mask = new Class({
  7639. Implements: [Options, Events],
  7640. Binds: ['position'],
  7641. options: {/*
  7642. onShow: function(){},
  7643. onHide: function(){},
  7644. onDestroy: function(){},
  7645. onClick: function(event){},
  7646. inject: {
  7647. where: 'after',
  7648. target: null,
  7649. },
  7650. hideOnClick: false,
  7651. id: null,
  7652. destroyOnHide: false,*/
  7653. style: {},
  7654. 'class': 'mask',
  7655. maskMargins: false,
  7656. useIframeShim: true,
  7657. iframeShimOptions: {}
  7658. },
  7659. initialize: function(target, options){
  7660. this.target = document.id(target) || document.id(document.body);
  7661. this.target.store('mask', this);
  7662. this.setOptions(options);
  7663. this.render();
  7664. this.inject();
  7665. },
  7666. render: function(){
  7667. this.element = new Element('div', {
  7668. 'class': this.options['class'],
  7669. id: this.options.id || 'mask-' + String.uniqueID(),
  7670. styles: Object.merge({}, this.options.style, {
  7671. display: 'none'
  7672. }),
  7673. events: {
  7674. click: function(event){
  7675. this.fireEvent('click', event);
  7676. if (this.options.hideOnClick) this.hide();
  7677. }.bind(this)
  7678. }
  7679. });
  7680. this.hidden = true;
  7681. },
  7682. toElement: function(){
  7683. return this.element;
  7684. },
  7685. inject: function(target, where){
  7686. where = where || (this.options.inject ? this.options.inject.where : '') || (this.target == document.body ? 'inside' : 'after');
  7687. target = target || (this.options.inject && this.options.inject.target) || this.target;
  7688. this.element.inject(target, where);
  7689. if (this.options.useIframeShim){
  7690. this.shim = new IframeShim(this.element, this.options.iframeShimOptions);
  7691. this.addEvents({
  7692. show: this.shim.show.bind(this.shim),
  7693. hide: this.shim.hide.bind(this.shim),
  7694. destroy: this.shim.destroy.bind(this.shim)
  7695. });
  7696. }
  7697. },
  7698. position: function(){
  7699. this.resize(this.options.width, this.options.height);
  7700. this.element.position({
  7701. relativeTo: this.target,
  7702. position: 'topLeft',
  7703. ignoreMargins: !this.options.maskMargins,
  7704. ignoreScroll: this.target == document.body
  7705. });
  7706. return this;
  7707. },
  7708. resize: function(x, y){
  7709. var opt = {
  7710. styles: ['padding', 'border']
  7711. };
  7712. if (this.options.maskMargins) opt.styles.push('margin');
  7713. var dim = this.target.getComputedSize(opt);
  7714. var s = this.target.getSize();
  7715. if (dim.totalHeight<s.y) dim.totalHeight = s.y;
  7716. if (dim.totalWidth<s.x) dim.totalWidth = s.x;
  7717. if (this.target == document.body){
  7718. this.element.setStyles({width: 0, height: 0});
  7719. var win = window.getScrollSize();
  7720. if (dim.totalHeight < win.y) dim.totalHeight = win.y;
  7721. if (dim.totalWidth < win.x) dim.totalWidth = win.x;
  7722. }
  7723. this.element.setStyles({
  7724. width: Array.pick([x, dim.totalWidth, dim.x]),
  7725. height: Array.pick([y, dim.totalHeight, dim.y])
  7726. });
  7727. return this;
  7728. },
  7729. show: function(){
  7730. if (!this.hidden) return this;
  7731. window.addEvent('resize', this.position);
  7732. this.position();
  7733. this.showMask.apply(this, arguments);
  7734. return this;
  7735. },
  7736. showMask: function(){
  7737. this.element.setStyle('display', 'block');
  7738. this.hidden = false;
  7739. this.fireEvent('show');
  7740. },
  7741. hide: function(){
  7742. if (this.hidden) return this;
  7743. window.removeEvent('resize', this.position);
  7744. this.hideMask.apply(this, arguments);
  7745. if (this.options.destroyOnHide) return this.destroy();
  7746. return this;
  7747. },
  7748. hideMask: function(){
  7749. this.element.setStyle('display', 'none');
  7750. this.hidden = true;
  7751. this.fireEvent('hide');
  7752. },
  7753. toggle: function(){
  7754. this[this.hidden ? 'show' : 'hide']();
  7755. },
  7756. destroy: function(){
  7757. this.hide();
  7758. this.element.destroy();
  7759. this.fireEvent('destroy');
  7760. this.target.eliminate('mask');
  7761. }
  7762. });
  7763. })();
  7764. Element.Properties.mask = {
  7765. set: function(options){
  7766. var mask = this.retrieve('mask');
  7767. if (mask) mask.destroy();
  7768. return this.eliminate('mask').store('mask:options', options);
  7769. },
  7770. get: function(){
  7771. var mask = this.retrieve('mask');
  7772. if (!mask){
  7773. mask = new Mask(this, this.retrieve('mask:options'));
  7774. this.store('mask', mask);
  7775. }
  7776. return mask;
  7777. }
  7778. };
  7779. Element.implement({
  7780. mask: function(options){
  7781. if (options) this.set('mask', options);
  7782. this.get('mask').show();
  7783. return this;
  7784. },
  7785. unmask: function(){
  7786. this.get('mask').hide();
  7787. return this;
  7788. }
  7789. });
  7790. /*
  7791. ---
  7792. script: Spinner.js
  7793. name: Spinner
  7794. description: Adds a semi-transparent overlay over a dom element with a spinnin ajax icon.
  7795. license: MIT-style license
  7796. authors:
  7797. - Aaron Newton
  7798. requires:
  7799. - Core/Fx.Tween
  7800. - Core/Request
  7801. - Class.refactor
  7802. - Mask
  7803. provides: [Spinner]
  7804. ...
  7805. */
  7806. (function(){
  7807. var Spinner = this.Spinner = new Class({
  7808. Extends: this.Mask,
  7809. Implements: Chain,
  7810. options: {/*
  7811. message: false,*/
  7812. 'class': 'spinner',
  7813. containerPosition: {},
  7814. content: {
  7815. 'class': 'spinner-content'
  7816. },
  7817. messageContainer: {
  7818. 'class': 'spinner-msg'
  7819. },
  7820. img: {
  7821. 'class': 'spinner-img'
  7822. },
  7823. fxOptions: {
  7824. link: 'chain'
  7825. }
  7826. },
  7827. initialize: function(target, options){
  7828. this.target = document.id(target) || document.id(document.body);
  7829. this.target.store('spinner', this);
  7830. this.setOptions(options);
  7831. this.render();
  7832. this.inject();
  7833. // Add this to events for when noFx is true; parent methods handle hide/show.
  7834. var deactivate = function(){ this.active = false; }.bind(this);
  7835. this.addEvents({
  7836. hide: deactivate,
  7837. show: deactivate
  7838. });
  7839. },
  7840. render: function(){
  7841. this.parent();
  7842. this.element.set('id', this.options.id || 'spinner-' + String.uniqueID());
  7843. this.content = document.id(this.options.content) || new Element('div', this.options.content);
  7844. this.content.inject(this.element);
  7845. if (this.options.message){
  7846. this.msg = document.id(this.options.message) || new Element('p', this.options.messageContainer).appendText(this.options.message);
  7847. this.msg.inject(this.content);
  7848. }
  7849. if (this.options.img){
  7850. this.img = document.id(this.options.img) || new Element('div', this.options.img);
  7851. this.img.inject(this.content);
  7852. }
  7853. this.element.set('tween', this.options.fxOptions);
  7854. },
  7855. show: function(noFx){
  7856. if (this.active) return this.chain(this.show.bind(this));
  7857. if (!this.hidden){
  7858. this.callChain.delay(20, this);
  7859. return this;
  7860. }
  7861. this.target.set('aria-busy', 'true');
  7862. this.active = true;
  7863. return this.parent(noFx);
  7864. },
  7865. showMask: function(noFx){
  7866. var pos = function(){
  7867. this.content.position(Object.merge({
  7868. relativeTo: this.element
  7869. }, this.options.containerPosition));
  7870. }.bind(this);
  7871. if (noFx){
  7872. this.parent();
  7873. pos();
  7874. } else {
  7875. if (!this.options.style.opacity) this.options.style.opacity = this.element.getStyle('opacity').toFloat();
  7876. this.element.setStyles({
  7877. display: 'block',
  7878. opacity: 0
  7879. }).tween('opacity', this.options.style.opacity);
  7880. pos();
  7881. this.hidden = false;
  7882. this.fireEvent('show');
  7883. this.callChain();
  7884. }
  7885. },
  7886. hide: function(noFx){
  7887. if (this.active) return this.chain(this.hide.bind(this));
  7888. if (this.hidden){
  7889. this.callChain.delay(20, this);
  7890. return this;
  7891. }
  7892. this.target.set('aria-busy', 'false');
  7893. this.active = true;
  7894. return this.parent(noFx);
  7895. },
  7896. hideMask: function(noFx){
  7897. if (noFx) return this.parent();
  7898. this.element.tween('opacity', 0).get('tween').chain(function(){
  7899. this.element.setStyle('display', 'none');
  7900. this.hidden = true;
  7901. this.fireEvent('hide');
  7902. this.callChain();
  7903. }.bind(this));
  7904. },
  7905. destroy: function(){
  7906. this.content.destroy();
  7907. this.parent();
  7908. this.target.eliminate('spinner');
  7909. }
  7910. });
  7911. })();
  7912. Request = Class.refactor(Request, {
  7913. options: {
  7914. useSpinner: false,
  7915. spinnerOptions: {},
  7916. spinnerTarget: false
  7917. },
  7918. initialize: function(options){
  7919. this._send = this.send;
  7920. this.send = function(options){
  7921. var spinner = this.getSpinner();
  7922. if (spinner) spinner.chain(this._send.pass(options, this)).show();
  7923. else this._send(options);
  7924. return this;
  7925. };
  7926. this.previous(options);
  7927. },
  7928. getSpinner: function(){
  7929. if (!this.spinner){
  7930. var update = document.id(this.options.spinnerTarget) || document.id(this.options.update);
  7931. if (this.options.useSpinner && update){
  7932. update.set('spinner', this.options.spinnerOptions);
  7933. var spinner = this.spinner = update.get('spinner');
  7934. ['complete', 'exception', 'cancel'].each(function(event){
  7935. this.addEvent(event, spinner.hide.bind(spinner));
  7936. }, this);
  7937. }
  7938. }
  7939. return this.spinner;
  7940. }
  7941. });
  7942. Element.Properties.spinner = {
  7943. set: function(options){
  7944. var spinner = this.retrieve('spinner');
  7945. if (spinner) spinner.destroy();
  7946. return this.eliminate('spinner').store('spinner:options', options);
  7947. },
  7948. get: function(){
  7949. var spinner = this.retrieve('spinner');
  7950. if (!spinner){
  7951. spinner = new Spinner(this, this.retrieve('spinner:options'));
  7952. this.store('spinner', spinner);
  7953. }
  7954. return spinner;
  7955. }
  7956. };
  7957. Element.implement({
  7958. spin: function(options){
  7959. if (options) this.set('spinner', options);
  7960. this.get('spinner').show();
  7961. return this;
  7962. },
  7963. unspin: function(){
  7964. this.get('spinner').hide();
  7965. return this;
  7966. }
  7967. });
  7968. /*
  7969. ---
  7970. script: String.QueryString.js
  7971. name: String.QueryString
  7972. description: Methods for dealing with URI query strings.
  7973. license: MIT-style license
  7974. authors:
  7975. - Sebastian Markbåge
  7976. - Aaron Newton
  7977. - Lennart Pilon
  7978. - Valerio Proietti
  7979. requires:
  7980. - Core/Array
  7981. - Core/String
  7982. - MooTools.More
  7983. provides: [String.QueryString]
  7984. ...
  7985. */
  7986. (function(){
  7987. /**
  7988. * decodeURIComponent doesn't do the correct thing with query parameter keys or
  7989. * values. Specifically, it leaves '+' as '+' when it should be converting them
  7990. * to spaces as that's the specification. When browsers submit HTML forms via
  7991. * GET, the values are encoded using 'application/x-www-form-urlencoded'
  7992. * which converts spaces to '+'.
  7993. *
  7994. * See: http://unixpapa.com/js/querystring.html for a description of the
  7995. * problem.
  7996. */
  7997. var decodeComponent = function(str){
  7998. return decodeURIComponent(str.replace(/\+/g, ' '));
  7999. };
  8000. String.implement({
  8001. parseQueryString: function(decodeKeys, decodeValues){
  8002. if (decodeKeys == null) decodeKeys = true;
  8003. if (decodeValues == null) decodeValues = true;
  8004. var vars = this.split(/[&;]/),
  8005. object = {};
  8006. if (!vars.length) return object;
  8007. vars.each(function(val){
  8008. var index = val.indexOf('=') + 1,
  8009. value = index ? val.substr(index) : '',
  8010. keys = index ? val.substr(0, index - 1).match(/([^\]\[]+|(\B)(?=\]))/g) : [val],
  8011. obj = object;
  8012. if (!keys) return;
  8013. if (decodeValues) value = decodeComponent(value);
  8014. keys.each(function(key, i){
  8015. if (decodeKeys) key = decodeComponent(key);
  8016. var current = obj[key];
  8017. if (i < keys.length - 1) obj = obj[key] = current || {};
  8018. else if (typeOf(current) == 'array') current.push(value);
  8019. else obj[key] = current != null ? [current, value] : value;
  8020. });
  8021. });
  8022. return object;
  8023. },
  8024. cleanQueryString: function(method){
  8025. return this.split('&').filter(function(val){
  8026. var index = val.indexOf('='),
  8027. key = index < 0 ? '' : val.substr(0, index),
  8028. value = val.substr(index + 1);
  8029. return method ? method.call(null, key, value) : (value || value === 0);
  8030. }).join('&');
  8031. }
  8032. });
  8033. })();
  8034. /*
  8035. ---
  8036. script: Form.Request.js
  8037. name: Form.Request
  8038. description: Handles the basic functionality of submitting a form and updating a dom element with the result.
  8039. license: MIT-style license
  8040. authors:
  8041. - Aaron Newton
  8042. requires:
  8043. - Core/Request.HTML
  8044. - Class.Binds
  8045. - Class.Occlude
  8046. - Spinner
  8047. - String.QueryString
  8048. - Element.Delegation.Pseudo
  8049. provides: [Form.Request]
  8050. ...
  8051. */
  8052. if (!window.Form) window.Form = {};
  8053. (function(){
  8054. Form.Request = new Class({
  8055. Binds: ['onSubmit', 'onFormValidate'],
  8056. Implements: [Options, Events, Class.Occlude],
  8057. options: {/*
  8058. onFailure: function(){},
  8059. onSuccess: function(){}, // aliased to onComplete,
  8060. onSend: function(){}*/
  8061. requestOptions: {
  8062. evalScripts: true,
  8063. useSpinner: true,
  8064. emulation: false,
  8065. link: 'ignore'
  8066. },
  8067. sendButtonClicked: true,
  8068. extraData: {},
  8069. resetForm: true
  8070. },
  8071. property: 'form.request',
  8072. initialize: function(form, target, options){
  8073. this.element = document.id(form);
  8074. if (this.occlude()) return this.occluded;
  8075. this.setOptions(options)
  8076. .setTarget(target)
  8077. .attach();
  8078. },
  8079. setTarget: function(target){
  8080. this.target = document.id(target);
  8081. if (!this.request){
  8082. this.makeRequest();
  8083. } else {
  8084. this.request.setOptions({
  8085. update: this.target
  8086. });
  8087. }
  8088. return this;
  8089. },
  8090. toElement: function(){
  8091. return this.element;
  8092. },
  8093. makeRequest: function(){
  8094. var self = this;
  8095. this.request = new Request.HTML(Object.merge({
  8096. update: this.target,
  8097. emulation: false,
  8098. spinnerTarget: this.element,
  8099. method: this.element.get('method') || 'post'
  8100. }, this.options.requestOptions)).addEvents({
  8101. success: function(tree, elements, html, javascript){
  8102. ['complete', 'success'].each(function(evt){
  8103. self.fireEvent(evt, [self.target, tree, elements, html, javascript]);
  8104. });
  8105. },
  8106. failure: function(){
  8107. self.fireEvent('complete', arguments).fireEvent('failure', arguments);
  8108. },
  8109. exception: function(){
  8110. self.fireEvent('failure', arguments);
  8111. }
  8112. });
  8113. return this.attachReset();
  8114. },
  8115. attachReset: function(){
  8116. if (!this.options.resetForm) return this;
  8117. this.request.addEvent('success', function(){
  8118. Function.attempt(function(){
  8119. this.element.reset();
  8120. }.bind(this));
  8121. if (window.OverText) OverText.update();
  8122. }.bind(this));
  8123. return this;
  8124. },
  8125. attach: function(attach){
  8126. var method = (attach != false) ? 'addEvent' : 'removeEvent';
  8127. this.element[method]('click:relay(button, input[type=submit])', this.saveClickedButton.bind(this));
  8128. var fv = this.element.retrieve('validator');
  8129. if (fv) fv[method]('onFormValidate', this.onFormValidate);
  8130. else this.element[method]('submit', this.onSubmit);
  8131. return this;
  8132. },
  8133. detach: function(){
  8134. return this.attach(false);
  8135. },
  8136. //public method
  8137. enable: function(){
  8138. return this.attach();
  8139. },
  8140. //public method
  8141. disable: function(){
  8142. return this.detach();
  8143. },
  8144. onFormValidate: function(valid, form, event){
  8145. //if there's no event, then this wasn't a submit event
  8146. if (!event) return;
  8147. var fv = this.element.retrieve('validator');
  8148. if (valid || (fv && !fv.options.stopOnFailure)){
  8149. event.stop();
  8150. this.send();
  8151. }
  8152. },
  8153. onSubmit: function(event){
  8154. var fv = this.element.retrieve('validator');
  8155. if (fv){
  8156. //form validator was created after Form.Request
  8157. this.element.removeEvent('submit', this.onSubmit);
  8158. fv.addEvent('onFormValidate', this.onFormValidate);
  8159. fv.validate(event);
  8160. return;
  8161. }
  8162. if (event) event.stop();
  8163. this.send();
  8164. },
  8165. saveClickedButton: function(event, target){
  8166. var targetName = target.get('name');
  8167. if (!targetName || !this.options.sendButtonClicked) return;
  8168. this.options.extraData[targetName] = target.get('value') || true;
  8169. this.clickedCleaner = function(){
  8170. delete this.options.extraData[targetName];
  8171. this.clickedCleaner = function(){};
  8172. }.bind(this);
  8173. },
  8174. clickedCleaner: function(){},
  8175. send: function(){
  8176. var str = this.element.toQueryString().trim(),
  8177. data = Object.toQueryString(this.options.extraData);
  8178. if (str) str += '&' + data;
  8179. else str = data;
  8180. this.fireEvent('send', [this.element, str.parseQueryString()]);
  8181. this.request.send({
  8182. data: str,
  8183. url: this.options.requestOptions.url || this.element.get('action')
  8184. });
  8185. this.clickedCleaner();
  8186. return this;
  8187. }
  8188. });
  8189. Element.implement('formUpdate', function(update, options){
  8190. var fq = this.retrieve('form.request');
  8191. if (!fq){
  8192. fq = new Form.Request(this, update, options);
  8193. } else {
  8194. if (update) fq.setTarget(update);
  8195. if (options) fq.setOptions(options).makeRequest();
  8196. }
  8197. fq.send();
  8198. return this;
  8199. });
  8200. })();
  8201. /*
  8202. ---
  8203. script: Fx.Reveal.js
  8204. name: Fx.Reveal
  8205. description: Defines Fx.Reveal, a class that shows and hides elements with a transition.
  8206. license: MIT-style license
  8207. authors:
  8208. - Aaron Newton
  8209. requires:
  8210. - Core/Fx.Morph
  8211. - Element.Shortcuts
  8212. - Element.Measure
  8213. provides: [Fx.Reveal]
  8214. ...
  8215. */
  8216. (function(){
  8217. var hideTheseOf = function(object){
  8218. var hideThese = object.options.hideInputs;
  8219. if (window.OverText){
  8220. var otClasses = [null];
  8221. OverText.each(function(ot){
  8222. otClasses.include('.' + ot.options.labelClass);
  8223. });
  8224. if (otClasses) hideThese += otClasses.join(', ');
  8225. }
  8226. return (hideThese) ? object.element.getElements(hideThese) : null;
  8227. };
  8228. Fx.Reveal = new Class({
  8229. Extends: Fx.Morph,
  8230. options: {/*
  8231. onShow: function(thisElement){},
  8232. onHide: function(thisElement){},
  8233. onComplete: function(thisElement){},
  8234. heightOverride: null,
  8235. widthOverride: null,*/
  8236. link: 'cancel',
  8237. styles: ['padding', 'border', 'margin'],
  8238. transitionOpacity: 'opacity' in document.documentElement,
  8239. mode: 'vertical',
  8240. display: function(){
  8241. return this.element.get('tag') != 'tr' ? 'block' : 'table-row';
  8242. },
  8243. opacity: 1,
  8244. hideInputs: !('opacity' in document.documentElement) ? 'select, input, textarea, object, embed' : null
  8245. },
  8246. dissolve: function(){
  8247. if (!this.hiding && !this.showing){
  8248. if (this.element.getStyle('display') != 'none'){
  8249. this.hiding = true;
  8250. this.showing = false;
  8251. this.hidden = true;
  8252. this.cssText = this.element.style.cssText;
  8253. var startStyles = this.element.getComputedSize({
  8254. styles: this.options.styles,
  8255. mode: this.options.mode
  8256. });
  8257. if (this.options.transitionOpacity) startStyles.opacity = this.options.opacity;
  8258. var zero = {};
  8259. Object.each(startStyles, function(style, name){
  8260. zero[name] = [style, 0];
  8261. });
  8262. this.element.setStyles({
  8263. display: Function.convert(this.options.display).call(this),
  8264. overflow: 'hidden'
  8265. });
  8266. var hideThese = hideTheseOf(this);
  8267. if (hideThese) hideThese.setStyle('visibility', 'hidden');
  8268. this.$chain.unshift(function(){
  8269. if (this.hidden){
  8270. this.hiding = false;
  8271. this.element.style.cssText = this.cssText;
  8272. this.element.setStyle('display', 'none');
  8273. if (hideThese) hideThese.setStyle('visibility', 'visible');
  8274. }
  8275. this.fireEvent('hide', this.element);
  8276. this.callChain();
  8277. }.bind(this));
  8278. this.start(zero);
  8279. } else {
  8280. this.callChain.delay(10, this);
  8281. this.fireEvent('complete', this.element);
  8282. this.fireEvent('hide', this.element);
  8283. }
  8284. } else if (this.options.link == 'chain'){
  8285. this.chain(this.dissolve.bind(this));
  8286. } else if (this.options.link == 'cancel' && !this.hiding){
  8287. this.cancel();
  8288. this.dissolve();
  8289. }
  8290. return this;
  8291. },
  8292. reveal: function(){
  8293. if (!this.showing && !this.hiding){
  8294. if (this.element.getStyle('display') == 'none'){
  8295. this.hiding = false;
  8296. this.showing = true;
  8297. this.hidden = false;
  8298. this.cssText = this.element.style.cssText;
  8299. var startStyles;
  8300. this.element.measure(function(){
  8301. startStyles = this.element.getComputedSize({
  8302. styles: this.options.styles,
  8303. mode: this.options.mode
  8304. });
  8305. }.bind(this));
  8306. if (this.options.heightOverride != null) startStyles.height = this.options.heightOverride.toInt();
  8307. if (this.options.widthOverride != null) startStyles.width = this.options.widthOverride.toInt();
  8308. if (this.options.transitionOpacity){
  8309. this.element.setStyle('opacity', 0);
  8310. startStyles.opacity = this.options.opacity;
  8311. }
  8312. var zero = {
  8313. height: 0,
  8314. display: Function.convert(this.options.display).call(this)
  8315. };
  8316. Object.each(startStyles, function(style, name){
  8317. zero[name] = 0;
  8318. });
  8319. zero.overflow = 'hidden';
  8320. this.element.setStyles(zero);
  8321. var hideThese = hideTheseOf(this);
  8322. if (hideThese) hideThese.setStyle('visibility', 'hidden');
  8323. this.$chain.unshift(function(){
  8324. this.element.style.cssText = this.cssText;
  8325. this.element.setStyle('display', Function.convert(this.options.display).call(this));
  8326. if (!this.hidden) this.showing = false;
  8327. if (hideThese) hideThese.setStyle('visibility', 'visible');
  8328. this.callChain();
  8329. this.fireEvent('show', this.element);
  8330. }.bind(this));
  8331. this.start(startStyles);
  8332. } else {
  8333. this.callChain();
  8334. this.fireEvent('complete', this.element);
  8335. this.fireEvent('show', this.element);
  8336. }
  8337. } else if (this.options.link == 'chain'){
  8338. this.chain(this.reveal.bind(this));
  8339. } else if (this.options.link == 'cancel' && !this.showing){
  8340. this.cancel();
  8341. this.reveal();
  8342. }
  8343. return this;
  8344. },
  8345. toggle: function(){
  8346. if (this.element.getStyle('display') == 'none'){
  8347. this.reveal();
  8348. } else {
  8349. this.dissolve();
  8350. }
  8351. return this;
  8352. },
  8353. cancel: function(){
  8354. this.parent.apply(this, arguments);
  8355. if (this.cssText != null) this.element.style.cssText = this.cssText;
  8356. this.hiding = false;
  8357. this.showing = false;
  8358. return this;
  8359. }
  8360. });
  8361. Element.Properties.reveal = {
  8362. set: function(options){
  8363. this.get('reveal').cancel().setOptions(options);
  8364. return this;
  8365. },
  8366. get: function(){
  8367. var reveal = this.retrieve('reveal');
  8368. if (!reveal){
  8369. reveal = new Fx.Reveal(this);
  8370. this.store('reveal', reveal);
  8371. }
  8372. return reveal;
  8373. }
  8374. };
  8375. Element.Properties.dissolve = Element.Properties.reveal;
  8376. Element.implement({
  8377. reveal: function(options){
  8378. this.get('reveal').setOptions(options).reveal();
  8379. return this;
  8380. },
  8381. dissolve: function(options){
  8382. this.get('reveal').setOptions(options).dissolve();
  8383. return this;
  8384. },
  8385. nix: function(options){
  8386. var params = Array.link(arguments, {destroy: Type.isBoolean, options: Type.isObject});
  8387. this.get('reveal').setOptions(options).dissolve().chain(function(){
  8388. this[params.destroy ? 'destroy' : 'dispose']();
  8389. }.bind(this));
  8390. return this;
  8391. },
  8392. wink: function(){
  8393. var params = Array.link(arguments, {duration: Type.isNumber, options: Type.isObject});
  8394. var reveal = this.get('reveal').setOptions(params.options);
  8395. reveal.reveal().chain(function(){
  8396. (function(){
  8397. reveal.dissolve();
  8398. }).delay(params.duration || 2000);
  8399. });
  8400. }
  8401. });
  8402. })();
  8403. /*
  8404. ---
  8405. script: Form.Request.Append.js
  8406. name: Form.Request.Append
  8407. 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.
  8408. license: MIT-style license
  8409. authors:
  8410. - Aaron Newton
  8411. requires:
  8412. - Form.Request
  8413. - Fx.Reveal
  8414. - Elements.from
  8415. provides: [Form.Request.Append]
  8416. ...
  8417. */
  8418. Form.Request.Append = new Class({
  8419. Extends: Form.Request,
  8420. options: {
  8421. //onBeforeEffect: function(){},
  8422. useReveal: true,
  8423. revealOptions: {},
  8424. inject: 'bottom'
  8425. },
  8426. makeRequest: function(){
  8427. this.request = new Request.HTML(Object.merge({
  8428. url: this.element.get('action'),
  8429. method: this.element.get('method') || 'post',
  8430. spinnerTarget: this.element
  8431. }, this.options.requestOptions, {
  8432. evalScripts: false
  8433. })).addEvents({
  8434. success: function(tree, elements, html, javascript){
  8435. var container;
  8436. var kids = Elements.from(html);
  8437. if (kids.length == 1){
  8438. container = kids[0];
  8439. } else {
  8440. container = new Element('div', {
  8441. styles: {
  8442. display: 'none'
  8443. }
  8444. }).adopt(kids);
  8445. }
  8446. container.inject(this.target, this.options.inject);
  8447. if (this.options.requestOptions.evalScripts) Browser.exec(javascript);
  8448. this.fireEvent('beforeEffect', container);
  8449. var finish = function(){
  8450. this.fireEvent('success', [container, this.target, tree, elements, html, javascript]);
  8451. }.bind(this);
  8452. if (this.options.useReveal){
  8453. container.set('reveal', this.options.revealOptions).get('reveal').chain(finish);
  8454. container.reveal();
  8455. } else {
  8456. finish();
  8457. }
  8458. }.bind(this),
  8459. failure: function(xhr){
  8460. this.fireEvent('failure', xhr);
  8461. }.bind(this)
  8462. });
  8463. this.attachReset();
  8464. }
  8465. });
  8466. /*
  8467. ---
  8468. script: Object.Extras.js
  8469. name: Object.Extras
  8470. description: Extra Object generics, like getFromPath which allows a path notation to child elements.
  8471. license: MIT-style license
  8472. authors:
  8473. - Aaron Newton
  8474. requires:
  8475. - Core/Object
  8476. - MooTools.More
  8477. provides: [Object.Extras]
  8478. ...
  8479. */
  8480. (function(){
  8481. var defined = function(value){
  8482. return value != null;
  8483. };
  8484. var hasOwnProperty = Object.prototype.hasOwnProperty;
  8485. Object.extend({
  8486. getFromPath: function(source, parts){
  8487. if (typeof parts == 'string') parts = parts.split('.');
  8488. for (var i = 0, l = parts.length; i < l; i++){
  8489. if (hasOwnProperty.call(source, parts[i])) source = source[parts[i]];
  8490. else return null;
  8491. }
  8492. return source;
  8493. },
  8494. cleanValues: function(object, method){
  8495. method = method || defined;
  8496. for (var key in object) if (!method(object[key])){
  8497. delete object[key];
  8498. }
  8499. return object;
  8500. },
  8501. erase: function(object, key){
  8502. if (hasOwnProperty.call(object, key)) delete object[key];
  8503. return object;
  8504. },
  8505. run: function(object){
  8506. var args = Array.slice(arguments, 1);
  8507. for (var key in object) if (object[key].apply){
  8508. object[key].apply(object, args);
  8509. }
  8510. return object;
  8511. }
  8512. });
  8513. })();
  8514. /*
  8515. ---
  8516. script: Locale.js
  8517. name: Locale
  8518. description: Provides methods for localization.
  8519. license: MIT-style license
  8520. authors:
  8521. - Aaron Newton
  8522. - Arian Stolwijk
  8523. requires:
  8524. - Core/Events
  8525. - Object.Extras
  8526. - MooTools.More
  8527. provides: [Locale, Lang]
  8528. ...
  8529. */
  8530. (function(){
  8531. var current = null,
  8532. locales = {},
  8533. inherits = {};
  8534. var getSet = function(set){
  8535. if (instanceOf(set, Locale.Set)) return set;
  8536. else return locales[set];
  8537. };
  8538. var Locale = this.Locale = {
  8539. define: function(locale, set, key, value){
  8540. var name;
  8541. if (instanceOf(locale, Locale.Set)){
  8542. name = locale.name;
  8543. if (name) locales[name] = locale;
  8544. } else {
  8545. name = locale;
  8546. if (!locales[name]) locales[name] = new Locale.Set(name);
  8547. locale = locales[name];
  8548. }
  8549. if (set) locale.define(set, key, value);
  8550. /*<1.2compat>*/
  8551. if (set == 'cascade') return Locale.inherit(name, key);
  8552. /*</1.2compat>*/
  8553. if (!current) current = locale;
  8554. return locale;
  8555. },
  8556. use: function(locale){
  8557. locale = getSet(locale);
  8558. if (locale){
  8559. current = locale;
  8560. this.fireEvent('change', locale);
  8561. /*<1.2compat>*/
  8562. this.fireEvent('langChange', locale.name);
  8563. /*</1.2compat>*/
  8564. }
  8565. return this;
  8566. },
  8567. getCurrent: function(){
  8568. return current;
  8569. },
  8570. get: function(key, args){
  8571. return (current) ? current.get(key, args) : '';
  8572. },
  8573. inherit: function(locale, inherits, set){
  8574. locale = getSet(locale);
  8575. if (locale) locale.inherit(inherits, set);
  8576. return this;
  8577. },
  8578. list: function(){
  8579. return Object.keys(locales);
  8580. }
  8581. };
  8582. Object.append(Locale, new Events);
  8583. Locale.Set = new Class({
  8584. sets: {},
  8585. inherits: {
  8586. locales: [],
  8587. sets: {}
  8588. },
  8589. initialize: function(name){
  8590. this.name = name || '';
  8591. },
  8592. define: function(set, key, value){
  8593. var defineData = this.sets[set];
  8594. if (!defineData) defineData = {};
  8595. if (key){
  8596. if (typeOf(key) == 'object') defineData = Object.merge(defineData, key);
  8597. else defineData[key] = value;
  8598. }
  8599. this.sets[set] = defineData;
  8600. return this;
  8601. },
  8602. get: function(key, args, _base){
  8603. var value = Object.getFromPath(this.sets, key);
  8604. if (value != null){
  8605. var type = typeOf(value);
  8606. if (type == 'function') value = value.apply(null, Array.convert(args));
  8607. else if (type == 'object') value = Object.clone(value);
  8608. return value;
  8609. }
  8610. // get value of inherited locales
  8611. var index = key.indexOf('.'),
  8612. set = index < 0 ? key : key.substr(0, index),
  8613. names = (this.inherits.sets[set] || []).combine(this.inherits.locales).include('en-US');
  8614. if (!_base) _base = [];
  8615. for (var i = 0, l = names.length; i < l; i++){
  8616. if (_base.contains(names[i])) continue;
  8617. _base.include(names[i]);
  8618. var locale = locales[names[i]];
  8619. if (!locale) continue;
  8620. value = locale.get(key, args, _base);
  8621. if (value != null) return value;
  8622. }
  8623. return '';
  8624. },
  8625. inherit: function(names, set){
  8626. names = Array.convert(names);
  8627. if (set && !this.inherits.sets[set]) this.inherits.sets[set] = [];
  8628. var l = names.length;
  8629. while (l--) (set ? this.inherits.sets[set] : this.inherits.locales).unshift(names[l]);
  8630. return this;
  8631. }
  8632. });
  8633. /*<1.2compat>*/
  8634. var lang = MooTools.lang = {};
  8635. Object.append(lang, Locale, {
  8636. setLanguage: Locale.use,
  8637. getCurrentLanguage: function(){
  8638. var current = Locale.getCurrent();
  8639. return (current) ? current.name : null;
  8640. },
  8641. set: function(){
  8642. Locale.define.apply(this, arguments);
  8643. return this;
  8644. },
  8645. get: function(set, key, args){
  8646. if (key) set += '.' + key;
  8647. return Locale.get(set, args);
  8648. }
  8649. });
  8650. /*</1.2compat>*/
  8651. })();
  8652. /*
  8653. ---
  8654. name: Locale.en-US.Date
  8655. description: Date messages for US English.
  8656. license: MIT-style license
  8657. authors:
  8658. - Aaron Newton
  8659. requires:
  8660. - Locale
  8661. provides: [Locale.en-US.Date]
  8662. ...
  8663. */
  8664. Locale.define('en-US', 'Date', {
  8665. months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
  8666. months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  8667. days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  8668. days_abbr: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8669. // Culture's date order: MM/DD/YYYY
  8670. dateOrder: ['month', 'date', 'year'],
  8671. shortDate: '%m/%d/%Y',
  8672. shortTime: '%I:%M%p',
  8673. AM: 'AM',
  8674. PM: 'PM',
  8675. firstDayOfWeek: 0,
  8676. // Date.Extras
  8677. ordinal: function(dayOfMonth){
  8678. // 1st, 2nd, 3rd, etc.
  8679. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'th' : ['th', 'st', 'nd', 'rd', 'th'][Math.min(dayOfMonth % 10, 4)];
  8680. },
  8681. lessThanMinuteAgo: 'less than a minute ago',
  8682. minuteAgo: 'about a minute ago',
  8683. minutesAgo: '{delta} minutes ago',
  8684. hourAgo: 'about an hour ago',
  8685. hoursAgo: 'about {delta} hours ago',
  8686. dayAgo: '1 day ago',
  8687. daysAgo: '{delta} days ago',
  8688. weekAgo: '1 week ago',
  8689. weeksAgo: '{delta} weeks ago',
  8690. monthAgo: '1 month ago',
  8691. monthsAgo: '{delta} months ago',
  8692. yearAgo: '1 year ago',
  8693. yearsAgo: '{delta} years ago',
  8694. lessThanMinuteUntil: 'less than a minute from now',
  8695. minuteUntil: 'about a minute from now',
  8696. minutesUntil: '{delta} minutes from now',
  8697. hourUntil: 'about an hour from now',
  8698. hoursUntil: 'about {delta} hours from now',
  8699. dayUntil: '1 day from now',
  8700. daysUntil: '{delta} days from now',
  8701. weekUntil: '1 week from now',
  8702. weeksUntil: '{delta} weeks from now',
  8703. monthUntil: '1 month from now',
  8704. monthsUntil: '{delta} months from now',
  8705. yearUntil: '1 year from now',
  8706. yearsUntil: '{delta} years from now'
  8707. });
  8708. /*
  8709. ---
  8710. script: Date.js
  8711. name: Date
  8712. description: Extends the Date native object to include methods useful in managing dates.
  8713. license: MIT-style license
  8714. authors:
  8715. - Aaron Newton
  8716. - Nicholas Barthelemy - https://svn.nbarthelemy.com/date-js/
  8717. - Harald Kirshner - mail [at] digitarald.de; http://digitarald.de
  8718. - Scott Kyle - scott [at] appden.com; http://appden.com
  8719. requires:
  8720. - Core/Array
  8721. - Core/String
  8722. - Core/Number
  8723. - MooTools.More
  8724. - Locale
  8725. - Locale.en-US.Date
  8726. provides: [Date]
  8727. ...
  8728. */
  8729. (function(){
  8730. var Date = this.Date;
  8731. var DateMethods = Date.Methods = {
  8732. ms: 'Milliseconds',
  8733. year: 'FullYear',
  8734. min: 'Minutes',
  8735. mo: 'Month',
  8736. sec: 'Seconds',
  8737. hr: 'Hours'
  8738. };
  8739. [
  8740. 'Date', 'Day', 'FullYear', 'Hours', 'Milliseconds', 'Minutes', 'Month', 'Seconds', 'Time', 'TimezoneOffset',
  8741. 'Week', 'Timezone', 'GMTOffset', 'DayOfYear', 'LastMonth', 'LastDayOfMonth', 'UTCDate', 'UTCDay', 'UTCFullYear',
  8742. 'AMPM', 'Ordinal', 'UTCHours', 'UTCMilliseconds', 'UTCMinutes', 'UTCMonth', 'UTCSeconds', 'UTCMilliseconds'
  8743. ].each(function(method){
  8744. Date.Methods[method.toLowerCase()] = method;
  8745. });
  8746. var pad = function(n, digits, string){
  8747. if (digits == 1) return n;
  8748. return n < Math.pow(10, digits - 1) ? (string || '0') + pad(n, digits - 1, string) : n;
  8749. };
  8750. Date.implement({
  8751. set: function(prop, value){
  8752. prop = prop.toLowerCase();
  8753. var method = DateMethods[prop] && 'set' + DateMethods[prop];
  8754. if (method && this[method]) this[method](value);
  8755. return this;
  8756. }.overloadSetter(),
  8757. get: function(prop){
  8758. prop = prop.toLowerCase();
  8759. var method = DateMethods[prop] && 'get' + DateMethods[prop];
  8760. if (method && this[method]) return this[method]();
  8761. return null;
  8762. }.overloadGetter(),
  8763. clone: function(){
  8764. return new Date(this.get('time'));
  8765. },
  8766. increment: function(interval, times){
  8767. interval = interval || 'day';
  8768. times = times != null ? times : 1;
  8769. switch (interval){
  8770. case 'year':
  8771. return this.increment('month', times * 12);
  8772. case 'month':
  8773. var d = this.get('date');
  8774. this.set('date', 1).set('mo', this.get('mo') + times);
  8775. return this.set('date', d.min(this.get('lastdayofmonth')));
  8776. case 'week':
  8777. return this.increment('day', times * 7);
  8778. case 'day':
  8779. return this.set('date', this.get('date') + times);
  8780. }
  8781. if (!Date.units[interval]) throw new Error(interval + ' is not a supported interval');
  8782. return this.set('time', this.get('time') + times * Date.units[interval]());
  8783. },
  8784. decrement: function(interval, times){
  8785. return this.increment(interval, -1 * (times != null ? times : 1));
  8786. },
  8787. isLeapYear: function(){
  8788. return Date.isLeapYear(this.get('year'));
  8789. },
  8790. clearTime: function(){
  8791. return this.set({hr: 0, min: 0, sec: 0, ms: 0});
  8792. },
  8793. diff: function(date, resolution){
  8794. if (typeOf(date) == 'string') date = Date.parse(date);
  8795. return ((date - this) / Date.units[resolution || 'day'](3, 3)).round(); // non-leap year, 30-day month
  8796. },
  8797. getLastDayOfMonth: function(){
  8798. return Date.daysInMonth(this.get('mo'), this.get('year'));
  8799. },
  8800. getDayOfYear: function(){
  8801. return (Date.UTC(this.get('year'), this.get('mo'), this.get('date') + 1)
  8802. - Date.UTC(this.get('year'), 0, 1)) / Date.units.day();
  8803. },
  8804. setDay: function(day, firstDayOfWeek){
  8805. if (firstDayOfWeek == null){
  8806. firstDayOfWeek = Date.getMsg('firstDayOfWeek');
  8807. if (firstDayOfWeek === '') firstDayOfWeek = 1;
  8808. }
  8809. day = (7 + Date.parseDay(day, true) - firstDayOfWeek) % 7;
  8810. var currentDay = (7 + this.get('day') - firstDayOfWeek) % 7;
  8811. return this.increment('day', day - currentDay);
  8812. },
  8813. getWeek: function(firstDayOfWeek){
  8814. if (firstDayOfWeek == null){
  8815. firstDayOfWeek = Date.getMsg('firstDayOfWeek');
  8816. if (firstDayOfWeek === '') firstDayOfWeek = 1;
  8817. }
  8818. var date = this,
  8819. dayOfWeek = (7 + date.get('day') - firstDayOfWeek) % 7,
  8820. dividend = 0,
  8821. firstDayOfYear;
  8822. if (firstDayOfWeek == 1){
  8823. // ISO-8601, week belongs to year that has the most days of the week (i.e. has the thursday of the week)
  8824. var month = date.get('month'),
  8825. startOfWeek = date.get('date') - dayOfWeek;
  8826. if (month == 11 && startOfWeek > 28) return 1; // Week 1 of next year
  8827. if (month == 0 && startOfWeek < -2){
  8828. // Use a date from last year to determine the week
  8829. date = new Date(date).decrement('day', dayOfWeek);
  8830. dayOfWeek = 0;
  8831. }
  8832. firstDayOfYear = new Date(date.get('year'), 0, 1).get('day') || 7;
  8833. if (firstDayOfYear > 4) dividend = -7; // First week of the year is not week 1
  8834. } else {
  8835. // In other cultures the first week of the year is always week 1 and the last week always 53 or 54.
  8836. // Days in the same week can have a different weeknumber if the week spreads across two years.
  8837. firstDayOfYear = new Date(date.get('year'), 0, 1).get('day');
  8838. }
  8839. dividend += date.get('dayofyear');
  8840. dividend += 6 - dayOfWeek; // Add days so we calculate the current date's week as a full week
  8841. dividend += (7 + firstDayOfYear - firstDayOfWeek) % 7; // Make up for first week of the year not being a full week
  8842. return (dividend / 7);
  8843. },
  8844. getOrdinal: function(day){
  8845. return Date.getMsg('ordinal', day || this.get('date'));
  8846. },
  8847. getTimezone: function(){
  8848. return this.toString()
  8849. .replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/, '$1')
  8850. .replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, '$1$2$3');
  8851. },
  8852. getGMTOffset: function(){
  8853. var off = this.get('timezoneOffset');
  8854. return ((off > 0) ? '-' : '+') + pad((off.abs() / 60).floor(), 2) + pad(off % 60, 2);
  8855. },
  8856. setAMPM: function(ampm){
  8857. ampm = ampm.toUpperCase();
  8858. var hr = this.get('hr');
  8859. if (hr > 11 && ampm == 'AM') return this.decrement('hour', 12);
  8860. else if (hr < 12 && ampm == 'PM') return this.increment('hour', 12);
  8861. return this;
  8862. },
  8863. getAMPM: function(){
  8864. return (this.get('hr') < 12) ? 'AM' : 'PM';
  8865. },
  8866. parse: function(str){
  8867. this.set('time', Date.parse(str));
  8868. return this;
  8869. },
  8870. isValid: function(date){
  8871. if (!date) date = this;
  8872. return typeOf(date) == 'date' && !isNaN(date.valueOf());
  8873. },
  8874. format: function(format){
  8875. if (!this.isValid()) return 'invalid date';
  8876. if (!format) format = '%x %X';
  8877. if (typeof format == 'string') format = formats[format.toLowerCase()] || format;
  8878. if (typeof format == 'function') return format(this);
  8879. var d = this;
  8880. return format.replace(/%([a-z%])/gi,
  8881. function($0, $1){
  8882. switch ($1){
  8883. case 'a': return Date.getMsg('days_abbr')[d.get('day')];
  8884. case 'A': return Date.getMsg('days')[d.get('day')];
  8885. case 'b': return Date.getMsg('months_abbr')[d.get('month')];
  8886. case 'B': return Date.getMsg('months')[d.get('month')];
  8887. case 'c': return d.format('%a %b %d %H:%M:%S %Y');
  8888. case 'd': return pad(d.get('date'), 2);
  8889. case 'e': return pad(d.get('date'), 2, ' ');
  8890. case 'H': return pad(d.get('hr'), 2);
  8891. case 'I': return pad((d.get('hr') % 12) || 12, 2);
  8892. case 'j': return pad(d.get('dayofyear'), 3);
  8893. case 'k': return pad(d.get('hr'), 2, ' ');
  8894. case 'l': return pad((d.get('hr') % 12) || 12, 2, ' ');
  8895. case 'L': return pad(d.get('ms'), 3);
  8896. case 'm': return pad((d.get('mo') + 1), 2);
  8897. case 'M': return pad(d.get('min'), 2);
  8898. case 'o': return d.get('ordinal');
  8899. case 'p': return Date.getMsg(d.get('ampm'));
  8900. case 's': return Math.round(d / 1000);
  8901. case 'S': return pad(d.get('seconds'), 2);
  8902. case 'T': return d.format('%H:%M:%S');
  8903. case 'U': return pad(d.get('week'), 2);
  8904. case 'w': return d.get('day');
  8905. case 'x': return d.format(Date.getMsg('shortDate'));
  8906. case 'X': return d.format(Date.getMsg('shortTime'));
  8907. case 'y': return d.get('year').toString().substr(2);
  8908. case 'Y': return d.get('year');
  8909. case 'z': return d.get('GMTOffset');
  8910. case 'Z': return d.get('Timezone');
  8911. }
  8912. return $1;
  8913. }
  8914. );
  8915. },
  8916. toISOString: function(){
  8917. return this.format('iso8601');
  8918. }
  8919. }).alias({
  8920. toJSON: 'toISOString',
  8921. compare: 'diff',
  8922. strftime: 'format'
  8923. });
  8924. // The day and month abbreviations are standardized, so we cannot use simply %a and %b because they will get localized
  8925. var rfcDayAbbr = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  8926. rfcMonthAbbr = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
  8927. var formats = {
  8928. db: '%Y-%m-%d %H:%M:%S',
  8929. compact: '%Y%m%dT%H%M%S',
  8930. 'short': '%d %b %H:%M',
  8931. 'long': '%B %d, %Y %H:%M',
  8932. rfc822: function(date){
  8933. return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %Z');
  8934. },
  8935. rfc2822: function(date){
  8936. return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %z');
  8937. },
  8938. iso8601: function(date){
  8939. return (
  8940. date.getUTCFullYear() + '-' +
  8941. pad(date.getUTCMonth() + 1, 2) + '-' +
  8942. pad(date.getUTCDate(), 2) + 'T' +
  8943. pad(date.getUTCHours(), 2) + ':' +
  8944. pad(date.getUTCMinutes(), 2) + ':' +
  8945. pad(date.getUTCSeconds(), 2) + '.' +
  8946. pad(date.getUTCMilliseconds(), 3) + 'Z'
  8947. );
  8948. }
  8949. };
  8950. var parsePatterns = [],
  8951. nativeParse = Date.parse;
  8952. var parseWord = function(type, word, num){
  8953. var ret = -1,
  8954. translated = Date.getMsg(type + 's');
  8955. switch (typeOf(word)){
  8956. case 'object':
  8957. ret = translated[word.get(type)];
  8958. break;
  8959. case 'number':
  8960. ret = translated[word];
  8961. if (!ret) throw new Error('Invalid ' + type + ' index: ' + word);
  8962. break;
  8963. case 'string':
  8964. var match = translated.filter(function(name){
  8965. return this.test(name);
  8966. }, new RegExp('^' + word, 'i'));
  8967. if (!match.length) throw new Error('Invalid ' + type + ' string');
  8968. if (match.length > 1) throw new Error('Ambiguous ' + type);
  8969. ret = match[0];
  8970. }
  8971. return (num) ? translated.indexOf(ret) : ret;
  8972. };
  8973. var startCentury = 1900,
  8974. startYear = 70;
  8975. Date.extend({
  8976. getMsg: function(key, args){
  8977. return Locale.get('Date.' + key, args);
  8978. },
  8979. units: {
  8980. ms: Function.convert(1),
  8981. second: Function.convert(1000),
  8982. minute: Function.convert(60000),
  8983. hour: Function.convert(3600000),
  8984. day: Function.convert(86400000),
  8985. week: Function.convert(608400000),
  8986. month: function(month, year){
  8987. var d = new Date;
  8988. return Date.daysInMonth(month != null ? month : d.get('mo'), year != null ? year : d.get('year')) * 86400000;
  8989. },
  8990. year: function(year){
  8991. year = year || new Date().get('year');
  8992. return Date.isLeapYear(year) ? 31622400000 : 31536000000;
  8993. }
  8994. },
  8995. daysInMonth: function(month, year){
  8996. return [31, Date.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
  8997. },
  8998. isLeapYear: function(year){
  8999. return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);
  9000. },
  9001. parse: function(from){
  9002. var t = typeOf(from);
  9003. if (t == 'number') return new Date(from);
  9004. if (t != 'string') return from;
  9005. from = from.clean();
  9006. if (!from.length) return null;
  9007. var parsed;
  9008. parsePatterns.some(function(pattern){
  9009. var bits = pattern.re.exec(from);
  9010. return (bits) ? (parsed = pattern.handler(bits)) : false;
  9011. });
  9012. if (!(parsed && parsed.isValid())){
  9013. parsed = new Date(nativeParse(from));
  9014. if (!(parsed && parsed.isValid())) parsed = new Date(from.toInt());
  9015. }
  9016. return parsed;
  9017. },
  9018. parseDay: function(day, num){
  9019. return parseWord('day', day, num);
  9020. },
  9021. parseMonth: function(month, num){
  9022. return parseWord('month', month, num);
  9023. },
  9024. parseUTC: function(value){
  9025. var localDate = new Date(value);
  9026. var utcSeconds = Date.UTC(
  9027. localDate.get('year'),
  9028. localDate.get('mo'),
  9029. localDate.get('date'),
  9030. localDate.get('hr'),
  9031. localDate.get('min'),
  9032. localDate.get('sec'),
  9033. localDate.get('ms')
  9034. );
  9035. return new Date(utcSeconds);
  9036. },
  9037. orderIndex: function(unit){
  9038. return Date.getMsg('dateOrder').indexOf(unit) + 1;
  9039. },
  9040. defineFormat: function(name, format){
  9041. formats[name] = format;
  9042. return this;
  9043. },
  9044. //<1.2compat>
  9045. parsePatterns: parsePatterns,
  9046. //</1.2compat>
  9047. defineParser: function(pattern){
  9048. parsePatterns.push((pattern.re && pattern.handler) ? pattern : build(pattern));
  9049. return this;
  9050. },
  9051. defineParsers: function(){
  9052. Array.flatten(arguments).each(Date.defineParser);
  9053. return this;
  9054. },
  9055. define2DigitYearStart: function(year){
  9056. startYear = year % 100;
  9057. startCentury = year - startYear;
  9058. return this;
  9059. }
  9060. }).extend({
  9061. defineFormats: Date.defineFormat.overloadSetter()
  9062. });
  9063. var regexOf = function(type){
  9064. return new RegExp('(?:' + Date.getMsg(type).map(function(name){
  9065. return name.substr(0, 3);
  9066. }).join('|') + ')[a-z]*');
  9067. };
  9068. var replacers = function(key){
  9069. switch (key){
  9070. case 'T':
  9071. return '%H:%M:%S';
  9072. case 'x': // iso8601 covers yyyy-mm-dd, so just check if month is first
  9073. return ((Date.orderIndex('month') == 1) ? '%m[-./]%d' : '%d[-./]%m') + '([-./]%y)?';
  9074. case 'X':
  9075. return '%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%z?';
  9076. }
  9077. return null;
  9078. };
  9079. var keys = {
  9080. d: /[0-2]?[0-9]|3[01]/,
  9081. H: /[01]?[0-9]|2[0-3]/,
  9082. I: /0?[1-9]|1[0-2]/,
  9083. M: /[0-5]?\d/,
  9084. s: /\d+/,
  9085. o: /[a-z]*/,
  9086. p: /[ap]\.?m\.?/,
  9087. y: /\d{2}|\d{4}/,
  9088. Y: /\d{4}/,
  9089. z: /Z|[+-]\d{2}(?::?\d{2})?/
  9090. };
  9091. keys.m = keys.I;
  9092. keys.S = keys.M;
  9093. var currentLanguage;
  9094. var recompile = function(language){
  9095. currentLanguage = language;
  9096. keys.a = keys.A = regexOf('days');
  9097. keys.b = keys.B = regexOf('months');
  9098. parsePatterns.each(function(pattern, i){
  9099. if (pattern.format) parsePatterns[i] = build(pattern.format);
  9100. });
  9101. };
  9102. var build = function(format){
  9103. if (!currentLanguage) return {format: format};
  9104. var parsed = [];
  9105. var re = (format.source || format) // allow format to be regex
  9106. .replace(/%([a-z])/gi,
  9107. function($0, $1){
  9108. return replacers($1) || $0;
  9109. }
  9110. ).replace(/\((?!\?)/g, '(?:') // make all groups non-capturing
  9111. .replace(/ (?!\?|\*)/g, ',? ') // be forgiving with spaces and commas
  9112. .replace(/%([a-z%])/gi,
  9113. function($0, $1){
  9114. var p = keys[$1];
  9115. if (!p) return $1;
  9116. parsed.push($1);
  9117. return '(' + p.source + ')';
  9118. }
  9119. ).replace(/\[a-z\]/gi, '[a-z\\u00c0-\\uffff;\&]'); // handle unicode words
  9120. return {
  9121. format: format,
  9122. re: new RegExp('^' + re + '$', 'i'),
  9123. handler: function(bits){
  9124. bits = bits.slice(1).associate(parsed);
  9125. var date = new Date().clearTime(),
  9126. year = bits.y || bits.Y;
  9127. if (year != null) handle.call(date, 'y', year); // need to start in the right year
  9128. if ('d' in bits) handle.call(date, 'd', 1);
  9129. if ('m' in bits || bits.b || bits.B) handle.call(date, 'm', 1);
  9130. for (var key in bits) handle.call(date, key, bits[key]);
  9131. return date;
  9132. }
  9133. };
  9134. };
  9135. var handle = function(key, value){
  9136. if (!value) return this;
  9137. switch (key){
  9138. case 'a': case 'A': return this.set('day', Date.parseDay(value, true));
  9139. case 'b': case 'B': return this.set('mo', Date.parseMonth(value, true));
  9140. case 'd': return this.set('date', value);
  9141. case 'H': case 'I': return this.set('hr', value);
  9142. case 'm': return this.set('mo', value - 1);
  9143. case 'M': return this.set('min', value);
  9144. case 'p': return this.set('ampm', value.replace(/\./g, ''));
  9145. case 'S': return this.set('sec', value);
  9146. case 's': return this.set('ms', ('0.' + value) * 1000);
  9147. case 'w': return this.set('day', value);
  9148. case 'Y': return this.set('year', value);
  9149. case 'y':
  9150. value = +value;
  9151. if (value < 100) value += startCentury + (value < startYear ? 100 : 0);
  9152. return this.set('year', value);
  9153. case 'z':
  9154. if (value == 'Z') value = '+00';
  9155. var offset = value.match(/([+-])(\d{2}):?(\d{2})?/);
  9156. offset = (offset[1] + '1') * (offset[2] * 60 + (+offset[3] || 0)) + this.getTimezoneOffset();
  9157. return this.set('time', this - offset * 60000);
  9158. }
  9159. return this;
  9160. };
  9161. Date.defineParsers(
  9162. '%Y([-./]%m([-./]%d((T| )%X)?)?)?', // "1999-12-31", "1999-12-31 11:59pm", "1999-12-31 23:59:59", ISO8601
  9163. '%Y%m%d(T%H(%M%S?)?)?', // "19991231", "19991231T1159", compact
  9164. '%x( %X)?', // "12/31", "12.31.99", "12-31-1999", "12/31/2008 11:59 PM"
  9165. '%d%o( %b( %Y)?)?( %X)?', // "31st", "31st December", "31 Dec 1999", "31 Dec 1999 11:59pm"
  9166. '%b( %d%o)?( %Y)?( %X)?', // Same as above with month and day switched
  9167. '%Y %b( %d%o( %X)?)?', // Same as above with year coming first
  9168. '%o %b %d %X %z %Y', // "Thu Oct 22 08:11:23 +0000 2009"
  9169. '%T', // %H:%M:%S
  9170. '%H:%M( ?%p)?' // "11:05pm", "11:05 am" and "11:05"
  9171. );
  9172. Locale.addEvent('change', function(language){
  9173. if (Locale.get('Date')) recompile(language);
  9174. }).fireEvent('change', Locale.getCurrent());
  9175. })();
  9176. /*
  9177. ---
  9178. name: Locale.en-US.Form.Validator
  9179. description: Form Validator messages for English.
  9180. license: MIT-style license
  9181. authors:
  9182. - Aaron Newton
  9183. requires:
  9184. - Locale
  9185. provides: [Locale.en-US.Form.Validator]
  9186. ...
  9187. */
  9188. Locale.define('en-US', 'FormValidator', {
  9189. required: 'This field is required.',
  9190. length: 'Please enter {length} characters (you entered {elLength} characters)',
  9191. minLength: 'Please enter at least {minLength} characters (you entered {length} characters).',
  9192. maxLength: 'Please enter no more than {maxLength} characters (you entered {length} characters).',
  9193. integer: 'Please enter an integer in this field. Numbers with decimals (e.g. 1.25) are not permitted.',
  9194. numeric: 'Please enter only numeric values in this field (i.e. "1" or "1.1" or "-1" or "-1.1").',
  9195. digits: 'Please use numbers and punctuation only in this field (for example, a phone number with dashes or dots is permitted).',
  9196. alpha: 'Please use only letters (a-z) within this field. No spaces or other characters are allowed.',
  9197. alphanum: 'Please use only letters (a-z) or numbers (0-9) in this field. No spaces or other characters are allowed.',
  9198. dateSuchAs: 'Please enter a valid date such as {date}',
  9199. dateInFormatMDY: 'Please enter a valid date such as MM/DD/YYYY (i.e. "12/31/1999")',
  9200. email: 'Please enter a valid email address. For example "fred@domain.com".',
  9201. url: 'Please enter a valid URL such as http://www.example.com.',
  9202. currencyDollar: 'Please enter a valid $ amount. For example $100.00 .',
  9203. oneRequired: 'Please enter something for at least one of these inputs.',
  9204. errorPrefix: 'Error: ',
  9205. warningPrefix: 'Warning: ',
  9206. // Form.Validator.Extras
  9207. noSpace: 'There can be no spaces in this input.',
  9208. reqChkByNode: 'No items are selected.',
  9209. requiredChk: 'This field is required.',
  9210. reqChkByName: 'Please select a {label}.',
  9211. match: 'This field needs to match the {matchName} field',
  9212. startDate: 'the start date',
  9213. endDate: 'the end date',
  9214. currentDate: 'the current date',
  9215. afterDate: 'The date should be the same or after {label}.',
  9216. beforeDate: 'The date should be the same or before {label}.',
  9217. startMonth: 'Please select a start month',
  9218. sameMonth: 'These two dates must be in the same month - you must change one or the other.',
  9219. creditcard: 'The credit card number entered is invalid. Please check the number and try again. {length} digits entered.'
  9220. });
  9221. /*
  9222. ---
  9223. script: Form.Validator.js
  9224. name: Form.Validator
  9225. description: A css-class based form validation system.
  9226. license: MIT-style license
  9227. authors:
  9228. - Aaron Newton
  9229. requires:
  9230. - Core/Options
  9231. - Core/Events
  9232. - Core/Element.Delegation
  9233. - Core/Slick.Finder
  9234. - Core/Element.Event
  9235. - Core/Element.Style
  9236. - Core/JSON
  9237. - Locale
  9238. - Class.Binds
  9239. - Date
  9240. - Element.Forms
  9241. - Locale.en-US.Form.Validator
  9242. - Element.Shortcuts
  9243. provides: [Form.Validator, InputValidator, FormValidator.BaseValidators]
  9244. ...
  9245. */
  9246. if (!window.Form) window.Form = {};
  9247. var InputValidator = this.InputValidator = new Class({
  9248. Implements: [Options],
  9249. options: {
  9250. errorMsg: 'Validation failed.',
  9251. test: Function.convert(true)
  9252. },
  9253. initialize: function(className, options){
  9254. this.setOptions(options);
  9255. this.className = className;
  9256. },
  9257. test: function(field, props){
  9258. field = document.id(field);
  9259. return (field) ? this.options.test(field, props || this.getProps(field)) : false;
  9260. },
  9261. getError: function(field, props){
  9262. field = document.id(field);
  9263. var err = this.options.errorMsg;
  9264. if (typeOf(err) == 'function') err = err(field, props || this.getProps(field));
  9265. return err;
  9266. },
  9267. getProps: function(field){
  9268. field = document.id(field);
  9269. return (field) ? field.get('validatorProps') : {};
  9270. }
  9271. });
  9272. Element.Properties.validators = {
  9273. get: function(){
  9274. return (this.get('data-validators') || this.className).clean().replace(/'(\\.|[^'])*'|"(\\.|[^"])*"/g, function(match){
  9275. return match.replace(' ', '\\x20');
  9276. }).split(' ');
  9277. }
  9278. };
  9279. Element.Properties.validatorProps = {
  9280. set: function(props){
  9281. return this.eliminate('$moo:validatorProps').store('$moo:validatorProps', props);
  9282. },
  9283. get: function(props){
  9284. if (props) this.set(props);
  9285. if (this.retrieve('$moo:validatorProps')) return this.retrieve('$moo:validatorProps');
  9286. if (this.getProperty('data-validator-properties') || this.getProperty('validatorProps')){
  9287. try {
  9288. this.store('$moo:validatorProps', JSON.decode(this.getProperty('validatorProps') || this.getProperty('data-validator-properties'), false));
  9289. } catch (e){
  9290. return {};
  9291. }
  9292. } else {
  9293. var vals = this.get('validators').filter(function(cls){
  9294. return cls.test(':');
  9295. });
  9296. if (!vals.length){
  9297. this.store('$moo:validatorProps', {});
  9298. } else {
  9299. props = {};
  9300. vals.each(function(cls){
  9301. var split = cls.split(':');
  9302. if (split[1]){
  9303. try {
  9304. props[split[0]] = JSON.decode(split[1], false);
  9305. } catch (e){}
  9306. }
  9307. });
  9308. this.store('$moo:validatorProps', props);
  9309. }
  9310. }
  9311. return this.retrieve('$moo:validatorProps');
  9312. }
  9313. };
  9314. Form.Validator = new Class({
  9315. Implements: [Options, Events],
  9316. options: {/*
  9317. onFormValidate: function(isValid, form, event){},
  9318. onElementValidate: function(isValid, field, className, warn){},
  9319. onElementPass: function(field){},
  9320. onElementFail: function(field, validatorsFailed){}, */
  9321. fieldSelectors: 'input, select, textarea',
  9322. ignoreHidden: true,
  9323. ignoreDisabled: true,
  9324. useTitles: false,
  9325. evaluateOnSubmit: true,
  9326. evaluateFieldsOnBlur: true,
  9327. evaluateFieldsOnChange: true,
  9328. serial: true,
  9329. stopOnFailure: true,
  9330. warningPrefix: function(){
  9331. return Form.Validator.getMsg('warningPrefix') || 'Warning: ';
  9332. },
  9333. errorPrefix: function(){
  9334. return Form.Validator.getMsg('errorPrefix') || 'Error: ';
  9335. }
  9336. },
  9337. initialize: function(form, options){
  9338. this.setOptions(options);
  9339. this.element = document.id(form);
  9340. this.warningPrefix = Function.convert(this.options.warningPrefix)();
  9341. this.errorPrefix = Function.convert(this.options.errorPrefix)();
  9342. this._bound = {
  9343. onSubmit: this.onSubmit.bind(this),
  9344. blurOrChange: function(event, field){
  9345. this.validationMonitor(field, true);
  9346. }.bind(this)
  9347. };
  9348. this.enable();
  9349. },
  9350. toElement: function(){
  9351. return this.element;
  9352. },
  9353. getFields: function(){
  9354. return (this.fields = this.element.getElements(this.options.fieldSelectors));
  9355. },
  9356. enable: function(){
  9357. this.element.store('validator', this);
  9358. if (this.options.evaluateOnSubmit) this.element.addEvent('submit', this._bound.onSubmit);
  9359. if (this.options.evaluateFieldsOnBlur){
  9360. this.element.addEvent('blur:relay(input,select,textarea)', this._bound.blurOrChange);
  9361. }
  9362. if (this.options.evaluateFieldsOnChange){
  9363. this.element.addEvent('change:relay(input,select,textarea)', this._bound.blurOrChange);
  9364. }
  9365. },
  9366. disable: function(){
  9367. this.element.eliminate('validator');
  9368. this.element.removeEvents({
  9369. submit: this._bound.onSubmit,
  9370. 'blur:relay(input,select,textarea)': this._bound.blurOrChange,
  9371. 'change:relay(input,select,textarea)': this._bound.blurOrChange
  9372. });
  9373. },
  9374. validationMonitor: function(){
  9375. clearTimeout(this.timer);
  9376. this.timer = this.validateField.delay(50, this, arguments);
  9377. },
  9378. onSubmit: function(event){
  9379. if (this.validate(event)) this.reset();
  9380. },
  9381. reset: function(){
  9382. this.getFields().each(this.resetField, this);
  9383. return this;
  9384. },
  9385. validate: function(event){
  9386. var result = this.getFields().map(function(field){
  9387. return this.validateField(field, true);
  9388. }, this).every(function(v){
  9389. return v;
  9390. });
  9391. this.fireEvent('formValidate', [result, this.element, event]);
  9392. if (this.options.stopOnFailure && !result && event) event.preventDefault();
  9393. return result;
  9394. },
  9395. validateField: function(field, force){
  9396. if (this.paused) return true;
  9397. field = document.id(field);
  9398. var passed = !field.hasClass('validation-failed');
  9399. var failed, warned;
  9400. if (this.options.serial && !force){
  9401. failed = this.element.getElement('.validation-failed');
  9402. warned = this.element.getElement('.warning');
  9403. }
  9404. if (field && (!failed || force || field.hasClass('validation-failed') || (failed && !this.options.serial))){
  9405. var validationTypes = field.get('validators');
  9406. var validators = validationTypes.some(function(cn){
  9407. return this.getValidator(cn);
  9408. }, this);
  9409. var validatorsFailed = [];
  9410. validationTypes.each(function(className){
  9411. if (className && !this.test(className, field)) validatorsFailed.include(className);
  9412. }, this);
  9413. passed = validatorsFailed.length === 0;
  9414. if (validators && !this.hasValidator(field, 'warnOnly')){
  9415. if (passed){
  9416. field.addClass('validation-passed').removeClass('validation-failed');
  9417. this.fireEvent('elementPass', [field]);
  9418. } else {
  9419. field.addClass('validation-failed').removeClass('validation-passed');
  9420. this.fireEvent('elementFail', [field, validatorsFailed]);
  9421. }
  9422. }
  9423. if (!warned){
  9424. var warnings = validationTypes.some(function(cn){
  9425. if (cn.test('^warn'))
  9426. return this.getValidator(cn.replace(/^warn-/,''));
  9427. else return null;
  9428. }, this);
  9429. field.removeClass('warning');
  9430. var warnResult = validationTypes.map(function(cn){
  9431. if (cn.test('^warn'))
  9432. return this.test(cn.replace(/^warn-/,''), field, true);
  9433. else return null;
  9434. }, this);
  9435. }
  9436. }
  9437. return passed;
  9438. },
  9439. test: function(className, field, warn){
  9440. field = document.id(field);
  9441. if ((this.options.ignoreHidden && !field.isVisible()) || (this.options.ignoreDisabled && field.get('disabled'))) return true;
  9442. var validator = this.getValidator(className);
  9443. if (warn != null) warn = false;
  9444. if (this.hasValidator(field, 'warnOnly')) warn = true;
  9445. var isValid = field.hasClass('ignoreValidation') || (validator ? validator.test(field) : true);
  9446. if (validator) this.fireEvent('elementValidate', [isValid, field, className, warn]);
  9447. if (warn) return true;
  9448. return isValid;
  9449. },
  9450. hasValidator: function(field, value){
  9451. return field.get('validators').contains(value);
  9452. },
  9453. resetField: function(field){
  9454. field = document.id(field);
  9455. if (field){
  9456. field.get('validators').each(function(className){
  9457. if (className.test('^warn-')) className = className.replace(/^warn-/, '');
  9458. field.removeClass('validation-failed');
  9459. field.removeClass('warning');
  9460. field.removeClass('validation-passed');
  9461. }, this);
  9462. }
  9463. return this;
  9464. },
  9465. stop: function(){
  9466. this.paused = true;
  9467. return this;
  9468. },
  9469. start: function(){
  9470. this.paused = false;
  9471. return this;
  9472. },
  9473. ignoreField: function(field, warn){
  9474. field = document.id(field);
  9475. if (field){
  9476. this.enforceField(field);
  9477. if (warn) field.addClass('warnOnly');
  9478. else field.addClass('ignoreValidation');
  9479. }
  9480. return this;
  9481. },
  9482. enforceField: function(field){
  9483. field = document.id(field);
  9484. if (field) field.removeClass('warnOnly').removeClass('ignoreValidation');
  9485. return this;
  9486. }
  9487. });
  9488. Form.Validator.getMsg = function(key){
  9489. return Locale.get('FormValidator.' + key);
  9490. };
  9491. Form.Validator.adders = {
  9492. validators:{},
  9493. add : function(className, options){
  9494. this.validators[className] = new InputValidator(className, options);
  9495. //if this is a class (this method is used by instances of Form.Validator and the Form.Validator namespace)
  9496. //extend these validators into it
  9497. //this allows validators to be global and/or per instance
  9498. if (!this.initialize){
  9499. this.implement({
  9500. validators: this.validators
  9501. });
  9502. }
  9503. },
  9504. addAllThese : function(validators){
  9505. Array.convert(validators).each(function(validator){
  9506. this.add(validator[0], validator[1]);
  9507. }, this);
  9508. },
  9509. getValidator: function(className){
  9510. return this.validators[className.split(':')[0]];
  9511. }
  9512. };
  9513. Object.append(Form.Validator, Form.Validator.adders);
  9514. Form.Validator.implement(Form.Validator.adders);
  9515. Form.Validator.add('IsEmpty', {
  9516. errorMsg: false,
  9517. test: function(element){
  9518. if (element.type == 'select-one' || element.type == 'select')
  9519. return !(element.selectedIndex >= 0 && element.options[element.selectedIndex].value != '');
  9520. else
  9521. return ((element.get('value') == null) || (element.get('value').length == 0));
  9522. }
  9523. });
  9524. Form.Validator.addAllThese([
  9525. ['required', {
  9526. errorMsg: function(){
  9527. return Form.Validator.getMsg('required');
  9528. },
  9529. test: function(element){
  9530. return !Form.Validator.getValidator('IsEmpty').test(element);
  9531. }
  9532. }],
  9533. ['length', {
  9534. errorMsg: function(element, props){
  9535. if (typeOf(props.length) != 'null')
  9536. return Form.Validator.getMsg('length').substitute({length: props.length, elLength: element.get('value').length});
  9537. else return '';
  9538. },
  9539. test: function(element, props){
  9540. if (typeOf(props.length) != 'null') return (element.get('value').length == props.length || element.get('value').length == 0);
  9541. else return true;
  9542. }
  9543. }],
  9544. ['minLength', {
  9545. errorMsg: function(element, props){
  9546. if (typeOf(props.minLength) != 'null')
  9547. return Form.Validator.getMsg('minLength').substitute({minLength: props.minLength, length: element.get('value').length});
  9548. else return '';
  9549. },
  9550. test: function(element, props){
  9551. if (typeOf(props.minLength) != 'null') return (element.get('value').length >= (props.minLength || 0));
  9552. else return true;
  9553. }
  9554. }],
  9555. ['maxLength', {
  9556. errorMsg: function(element, props){
  9557. //props is {maxLength:10}
  9558. if (typeOf(props.maxLength) != 'null')
  9559. return Form.Validator.getMsg('maxLength').substitute({maxLength: props.maxLength, length: element.get('value').length});
  9560. else return '';
  9561. },
  9562. test: function(element, props){
  9563. return element.get('value').length <= (props.maxLength || 10000);
  9564. }
  9565. }],
  9566. ['validate-integer', {
  9567. errorMsg: Form.Validator.getMsg.pass('integer'),
  9568. test: function(element){
  9569. return Form.Validator.getValidator('IsEmpty').test(element) || (/^(-?[1-9]\d*|0)$/).test(element.get('value'));
  9570. }
  9571. }],
  9572. ['validate-numeric', {
  9573. errorMsg: Form.Validator.getMsg.pass('numeric'),
  9574. test: function(element){
  9575. return Form.Validator.getValidator('IsEmpty').test(element) ||
  9576. (/^-?(?:0$0(?=\d*\.)|[1-9]|0)\d*(\.\d+)?$/).test(element.get('value'));
  9577. }
  9578. }],
  9579. ['validate-digits', {
  9580. errorMsg: Form.Validator.getMsg.pass('digits'),
  9581. test: function(element){
  9582. return Form.Validator.getValidator('IsEmpty').test(element) || (/^[\d() .:\-\+#]+$/.test(element.get('value')));
  9583. }
  9584. }],
  9585. ['validate-alpha', {
  9586. errorMsg: Form.Validator.getMsg.pass('alpha'),
  9587. test: function(element){
  9588. return Form.Validator.getValidator('IsEmpty').test(element) || (/^[a-zA-Z]+$/).test(element.get('value'));
  9589. }
  9590. }],
  9591. ['validate-alphanum', {
  9592. errorMsg: Form.Validator.getMsg.pass('alphanum'),
  9593. test: function(element){
  9594. return Form.Validator.getValidator('IsEmpty').test(element) || !(/\W/).test(element.get('value'));
  9595. }
  9596. }],
  9597. ['validate-date', {
  9598. errorMsg: function(element, props){
  9599. if (Date.parse){
  9600. var format = props.dateFormat || '%x';
  9601. return Form.Validator.getMsg('dateSuchAs').substitute({date: new Date().format(format)});
  9602. } else {
  9603. return Form.Validator.getMsg('dateInFormatMDY');
  9604. }
  9605. },
  9606. test: function(element, props){
  9607. if (Form.Validator.getValidator('IsEmpty').test(element)) return true;
  9608. var dateLocale = Locale.get('Date'),
  9609. dateNouns = new RegExp([dateLocale.days, dateLocale.days_abbr, dateLocale.months, dateLocale.months_abbr, dateLocale.AM, dateLocale.PM].flatten().join('|'), 'i'),
  9610. value = element.get('value'),
  9611. wordsInValue = value.match(/[a-z]+/gi);
  9612. if (wordsInValue && !wordsInValue.every(dateNouns.exec, dateNouns)) return false;
  9613. var date = Date.parse(value);
  9614. if (!date) return false;
  9615. var format = props.dateFormat || '%x',
  9616. formatted = date.format(format);
  9617. if (formatted != 'invalid date') element.set('value', formatted);
  9618. return date.isValid();
  9619. }
  9620. }],
  9621. ['validate-email', {
  9622. errorMsg: Form.Validator.getMsg.pass('email'),
  9623. test: function(element){
  9624. /*
  9625. var chars = "[a-z0-9!#$%&'*+/=?^_`{|}~-]",
  9626. local = '(?:' + chars + '\\.?){0,63}' + chars,
  9627. label = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?',
  9628. hostname = '(?:' + label + '\\.)*' + label;
  9629. octet = '(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',
  9630. ipv4 = '\\[(?:' + octet + '\\.){3}' + octet + '\\]',
  9631. domain = '(?:' + hostname + '|' + ipv4 + ')';
  9632. var regex = new RegExp('^' + local + '@' + domain + '$', 'i');
  9633. */
  9634. 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'));
  9635. }
  9636. }],
  9637. ['validate-url', {
  9638. errorMsg: Form.Validator.getMsg.pass('url'),
  9639. test: function(element){
  9640. 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'));
  9641. }
  9642. }],
  9643. ['validate-currency-dollar', {
  9644. errorMsg: Form.Validator.getMsg.pass('currencyDollar'),
  9645. test: function(element){
  9646. 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'));
  9647. }
  9648. }],
  9649. ['validate-one-required', {
  9650. errorMsg: Form.Validator.getMsg.pass('oneRequired'),
  9651. test: function(element, props){
  9652. var p = document.id(props['validate-one-required']) || element.getParent(props['validate-one-required']);
  9653. return p.getElements('input').some(function(el){
  9654. if (['checkbox', 'radio'].contains(el.get('type'))) return el.get('checked');
  9655. return el.get('value');
  9656. });
  9657. }
  9658. }]
  9659. ]);
  9660. Element.Properties.validator = {
  9661. set: function(options){
  9662. this.get('validator').setOptions(options);
  9663. },
  9664. get: function(){
  9665. var validator = this.retrieve('validator');
  9666. if (!validator){
  9667. validator = new Form.Validator(this);
  9668. this.store('validator', validator);
  9669. }
  9670. return validator;
  9671. }
  9672. };
  9673. Element.implement({
  9674. validate: function(options){
  9675. if (options) this.set('validator', options);
  9676. return this.get('validator').validate();
  9677. }
  9678. });
  9679. //<1.2compat>
  9680. //legacy
  9681. var FormValidator = Form.Validator;
  9682. //</1.2compat>
  9683. /*
  9684. ---
  9685. script: Form.Validator.Extras.js
  9686. name: Form.Validator.Extras
  9687. description: Additional validators for the Form.Validator class.
  9688. license: MIT-style license
  9689. authors:
  9690. - Aaron Newton
  9691. requires:
  9692. - Form.Validator
  9693. provides: [Form.Validator.Extras]
  9694. ...
  9695. */
  9696. (function(){
  9697. function getItems(props, preference, children, cssSelector){
  9698. if (preference && props[preference]) return props[preference];
  9699. var el = document.id(props[children]);
  9700. if (!el) return [];
  9701. return el.getElements(cssSelector);
  9702. }
  9703. Form.Validator.addAllThese([
  9704. ['validate-enforce-oncheck', {
  9705. test: function(element, props){
  9706. var fv = element.getParent('form').retrieve('validator');
  9707. if (!fv) return true;
  9708. getItems(props, 'toEnforce', 'enforceChildrenOf', 'input, select, textarea').each(function(item){
  9709. if (element.checked){
  9710. fv.enforceField(item);
  9711. } else {
  9712. fv.ignoreField(item);
  9713. fv.resetField(item);
  9714. }
  9715. });
  9716. return true;
  9717. }
  9718. }],
  9719. ['validate-ignore-oncheck', {
  9720. test: function(element, props){
  9721. var fv = element.getParent('form').retrieve('validator');
  9722. if (!fv) return true;
  9723. getItems(props, 'toIgnore', 'ignoreChildrenOf', 'input, select, textarea').each(function(item){
  9724. if (element.checked){
  9725. fv.ignoreField(item);
  9726. fv.resetField(item);
  9727. } else {
  9728. fv.enforceField(item);
  9729. }
  9730. });
  9731. return true;
  9732. }
  9733. }],
  9734. ['validate-enforce-onselect-value', {
  9735. test: function(element, props){
  9736. if (!props.value) return true;
  9737. var fv = element.getParent('form').retrieve('validator');
  9738. if (!fv) return true;
  9739. getItems(props, 'toEnforce', 'enforceChildrenOf', 'input, select, textarea').each(function(item){
  9740. if (props.value == element.value){
  9741. fv.enforceField(item);
  9742. } else {
  9743. fv.ignoreField(item);
  9744. fv.resetField(item);
  9745. }
  9746. });
  9747. return true;
  9748. }
  9749. }],
  9750. ['validate-nospace', {
  9751. errorMsg: function(){
  9752. return Form.Validator.getMsg('noSpace');
  9753. },
  9754. test: function(element, props){
  9755. return !element.get('value').test(/\s/);
  9756. }
  9757. }],
  9758. ['validate-toggle-oncheck', {
  9759. test: function(element, props){
  9760. var fv = element.getParent('form').retrieve('validator');
  9761. if (!fv) return true;
  9762. var eleArr = getItems(props, 'toToggle', 'toToggleChildrenOf', 'input, select, textarea');
  9763. if (!element.checked){
  9764. eleArr.each(function(item){
  9765. fv.ignoreField(item);
  9766. fv.resetField(item);
  9767. });
  9768. } else {
  9769. eleArr.each(function(item){
  9770. fv.enforceField(item);
  9771. });
  9772. }
  9773. return true;
  9774. }
  9775. }],
  9776. ['validate-reqchk-bynode', {
  9777. errorMsg: function(){
  9778. return Form.Validator.getMsg('reqChkByNode');
  9779. },
  9780. test: function(element, props){
  9781. return getItems(props, false, 'nodeId', props.selector || 'input[type=checkbox], input[type=radio]').some(function(item){
  9782. return item.checked;
  9783. });
  9784. }
  9785. }],
  9786. ['validate-required-check', {
  9787. errorMsg: function(element, props){
  9788. return props.useTitle ? element.get('title') : Form.Validator.getMsg('requiredChk');
  9789. },
  9790. test: function(element, props){
  9791. return !!element.checked;
  9792. }
  9793. }],
  9794. ['validate-reqchk-byname', {
  9795. errorMsg: function(element, props){
  9796. return Form.Validator.getMsg('reqChkByName').substitute({label: props.label || element.get('type')});
  9797. },
  9798. test: function(element, props){
  9799. var grpName = props.groupName || element.get('name');
  9800. var grpNameEls = $$('[name=' + grpName +']');
  9801. var oneCheckedItem = grpNameEls.some(function(item, index){
  9802. return item.checked;
  9803. });
  9804. var fv = element.getParent('form').retrieve('validator');
  9805. if (oneCheckedItem && fv){
  9806. grpNameEls.each(function(item, index){ fv.resetField(item); });
  9807. }
  9808. return oneCheckedItem;
  9809. }
  9810. }],
  9811. ['validate-match', {
  9812. errorMsg: function(element, props){
  9813. return Form.Validator.getMsg('match').substitute({matchName: decodeURIComponent((props.matchName+'').replace(/\+/g, '%20')) || document.id(props.matchInput).get('name')});
  9814. },
  9815. test: function(element, props){
  9816. var eleVal = element.get('value');
  9817. var matchVal = document.id(props.matchInput) && document.id(props.matchInput).get('value');
  9818. return eleVal && matchVal ? eleVal == matchVal : true;
  9819. }
  9820. }],
  9821. ['validate-after-date', {
  9822. errorMsg: function(element, props){
  9823. return Form.Validator.getMsg('afterDate').substitute({
  9824. label: props.afterLabel || (props.afterElement ? Form.Validator.getMsg('startDate') : Form.Validator.getMsg('currentDate'))
  9825. });
  9826. },
  9827. test: function(element, props){
  9828. var start = document.id(props.afterElement) ? Date.parse(document.id(props.afterElement).get('value')) : new Date();
  9829. var end = Date.parse(element.get('value'));
  9830. return end && start ? end >= start : true;
  9831. }
  9832. }],
  9833. ['validate-before-date', {
  9834. errorMsg: function(element, props){
  9835. return Form.Validator.getMsg('beforeDate').substitute({
  9836. label: props.beforeLabel || (props.beforeElement ? Form.Validator.getMsg('endDate') : Form.Validator.getMsg('currentDate'))
  9837. });
  9838. },
  9839. test: function(element, props){
  9840. var start = Date.parse(element.get('value'));
  9841. var end = document.id(props.beforeElement) ? Date.parse(document.id(props.beforeElement).get('value')) : new Date();
  9842. return end && start ? end >= start : true;
  9843. }
  9844. }],
  9845. ['validate-custom-required', {
  9846. errorMsg: function(){
  9847. return Form.Validator.getMsg('required');
  9848. },
  9849. test: function(element, props){
  9850. return element.get('value') != props.emptyValue;
  9851. }
  9852. }],
  9853. ['validate-same-month', {
  9854. errorMsg: function(element, props){
  9855. var startMo = document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value');
  9856. var eleVal = element.get('value');
  9857. if (eleVal != '') return Form.Validator.getMsg(startMo ? 'sameMonth' : 'startMonth');
  9858. },
  9859. test: function(element, props){
  9860. var d1 = Date.parse(element.get('value'));
  9861. var d2 = Date.parse(document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value'));
  9862. return d1 && d2 ? d1.format('%B') == d2.format('%B') : true;
  9863. }
  9864. }],
  9865. ['validate-cc-num', {
  9866. errorMsg: function(element){
  9867. var ccNum = element.get('value').replace(/[^0-9]/g, '');
  9868. return Form.Validator.getMsg('creditcard').substitute({length: ccNum.length});
  9869. },
  9870. test: function(element){
  9871. // required is a different test
  9872. if (Form.Validator.getValidator('IsEmpty').test(element)) return true;
  9873. // Clean number value
  9874. var ccNum = element.get('value');
  9875. ccNum = ccNum.replace(/[^0-9]/g, '');
  9876. var validType = false;
  9877. if (ccNum.test(/^4[0-9]{12}([0-9]{3})?$/)) validType = 'Visa';
  9878. else if (ccNum.test(/^5[1-5]([0-9]{14})$/)) validType = 'Master Card';
  9879. else if (ccNum.test(/^3[47][0-9]{13}$/)) validType = 'American Express';
  9880. else if (ccNum.test(/^6(?:011|5[0-9]{2})[0-9]{12}$/)) validType = 'Discover';
  9881. else if (ccNum.test(/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/)) validType = 'Diners Club';
  9882. if (validType){
  9883. var sum = 0;
  9884. var cur = 0;
  9885. for (var i=ccNum.length-1; i>=0; --i){
  9886. cur = ccNum.charAt(i).toInt();
  9887. if (cur == 0) continue;
  9888. if ((ccNum.length-i) % 2 == 0) cur += cur;
  9889. if (cur > 9){
  9890. cur = cur.toString().charAt(0).toInt() + cur.toString().charAt(1).toInt();
  9891. }
  9892. sum += cur;
  9893. }
  9894. if ((sum % 10) == 0) return true;
  9895. }
  9896. var chunks = '';
  9897. while (ccNum != ''){
  9898. chunks += ' ' + ccNum.substr(0,4);
  9899. ccNum = ccNum.substr(4);
  9900. }
  9901. element.getParent('form').retrieve('validator').ignoreField(element);
  9902. element.set('value', chunks.clean());
  9903. element.getParent('form').retrieve('validator').enforceField(element);
  9904. return false;
  9905. }
  9906. }]
  9907. ]);
  9908. })();
  9909. /*
  9910. ---
  9911. script: Form.Validator.Inline.js
  9912. name: Form.Validator.Inline
  9913. description: Extends Form.Validator to add inline messages.
  9914. license: MIT-style license
  9915. authors:
  9916. - Aaron Newton
  9917. requires:
  9918. - Form.Validator
  9919. provides: [Form.Validator.Inline]
  9920. ...
  9921. */
  9922. Form.Validator.Inline = new Class({
  9923. Extends: Form.Validator,
  9924. options: {
  9925. showError: function(errorElement){
  9926. if (errorElement.reveal) errorElement.reveal();
  9927. else errorElement.setStyle('display', 'block');
  9928. },
  9929. hideError: function(errorElement){
  9930. if (errorElement.dissolve) errorElement.dissolve();
  9931. else errorElement.setStyle('display', 'none');
  9932. },
  9933. scrollToErrorsOnSubmit: true,
  9934. scrollToErrorsOnBlur: false,
  9935. scrollToErrorsOnChange: false,
  9936. scrollFxOptions: {
  9937. transition: 'quad:out',
  9938. offset: {
  9939. y: -20
  9940. }
  9941. }
  9942. },
  9943. initialize: function(form, options){
  9944. this.parent(form, options);
  9945. this.addEvent('onElementValidate', function(isValid, field, className, warn){
  9946. var validator = this.getValidator(className);
  9947. if (!isValid && validator.getError(field)){
  9948. if (warn) field.addClass('warning');
  9949. var advice = this.makeAdvice(className, field, validator.getError(field), warn);
  9950. this.insertAdvice(advice, field);
  9951. this.showAdvice(className, field);
  9952. } else {
  9953. this.hideAdvice(className, field);
  9954. }
  9955. });
  9956. },
  9957. makeAdvice: function(className, field, error, warn){
  9958. var errorMsg = (warn) ? this.warningPrefix : this.errorPrefix;
  9959. errorMsg += (this.options.useTitles) ? field.title || error:error;
  9960. var cssClass = (warn) ? 'warning-advice' : 'validation-advice';
  9961. var advice = this.getAdvice(className, field);
  9962. if (advice){
  9963. advice = advice.set('html', errorMsg);
  9964. } else {
  9965. advice = new Element('div', {
  9966. html: errorMsg,
  9967. styles: { display: 'none' },
  9968. id: 'advice-' + className.split(':')[0] + '-' + this.getFieldId(field)
  9969. }).addClass(cssClass);
  9970. }
  9971. field.store('$moo:advice-' + className, advice);
  9972. return advice;
  9973. },
  9974. getFieldId : function(field){
  9975. return field.id ? field.id : field.id = 'input_' + field.name;
  9976. },
  9977. showAdvice: function(className, field){
  9978. var advice = this.getAdvice(className, field);
  9979. if (
  9980. advice &&
  9981. !field.retrieve('$moo:' + this.getPropName(className)) &&
  9982. (
  9983. advice.getStyle('display') == 'none' ||
  9984. advice.getStyle('visibility') == 'hidden' ||
  9985. advice.getStyle('opacity') == 0
  9986. )
  9987. ){
  9988. field.store('$moo:' + this.getPropName(className), true);
  9989. this.options.showError(advice);
  9990. this.fireEvent('showAdvice', [field, advice, className]);
  9991. }
  9992. },
  9993. hideAdvice: function(className, field){
  9994. var advice = this.getAdvice(className, field);
  9995. if (advice && field.retrieve('$moo:' + this.getPropName(className))){
  9996. field.store('$moo:' + this.getPropName(className), false);
  9997. this.options.hideError(advice);
  9998. this.fireEvent('hideAdvice', [field, advice, className]);
  9999. }
  10000. },
  10001. getPropName: function(className){
  10002. return 'advice' + className;
  10003. },
  10004. resetField: function(field){
  10005. field = document.id(field);
  10006. if (!field) return this;
  10007. this.parent(field);
  10008. field.get('validators').each(function(className){
  10009. this.hideAdvice(className, field);
  10010. }, this);
  10011. return this;
  10012. },
  10013. getAllAdviceMessages: function(field, force){
  10014. var advice = [];
  10015. if (field.hasClass('ignoreValidation') && !force) return advice;
  10016. var validators = field.get('validators').some(function(cn){
  10017. var warner = cn.test('^warn-') || field.hasClass('warnOnly');
  10018. if (warner) cn = cn.replace(/^warn-/, '');
  10019. var validator = this.getValidator(cn);
  10020. if (!validator) return;
  10021. advice.push({
  10022. message: validator.getError(field),
  10023. warnOnly: warner,
  10024. passed: validator.test(),
  10025. validator: validator
  10026. });
  10027. }, this);
  10028. return advice;
  10029. },
  10030. getAdvice: function(className, field){
  10031. return field.retrieve('$moo:advice-' + className);
  10032. },
  10033. insertAdvice: function(advice, field){
  10034. //Check for error position prop
  10035. var props = field.get('validatorProps');
  10036. //Build advice
  10037. if (!props.msgPos || !document.id(props.msgPos)){
  10038. if (field.type && field.type.toLowerCase() == 'radio') field.getParent().adopt(advice);
  10039. else advice.inject(document.id(field), 'after');
  10040. } else {
  10041. document.id(props.msgPos).grab(advice);
  10042. }
  10043. },
  10044. validateField: function(field, force, scroll){
  10045. var result = this.parent(field, force);
  10046. if (((this.options.scrollToErrorsOnSubmit && scroll == null) || scroll) && !result){
  10047. var failed = document.id(this).getElement('.validation-failed');
  10048. var par = document.id(this).getParent();
  10049. while (par != document.body && par.getScrollSize().y == par.getSize().y){
  10050. par = par.getParent();
  10051. }
  10052. var fx = par.retrieve('$moo:fvScroller');
  10053. if (!fx && window.Fx && Fx.Scroll){
  10054. fx = new Fx.Scroll(par, this.options.scrollFxOptions);
  10055. par.store('$moo:fvScroller', fx);
  10056. }
  10057. if (failed){
  10058. if (fx) fx.toElement(failed);
  10059. else par.scrollTo(par.getScroll().x, failed.getPosition(par).y - 20);
  10060. }
  10061. }
  10062. return result;
  10063. },
  10064. watchFields: function(fields){
  10065. fields.each(function(el){
  10066. if (this.options.evaluateFieldsOnBlur){
  10067. el.addEvent('blur', this.validationMonitor.pass([el, false, this.options.scrollToErrorsOnBlur], this));
  10068. }
  10069. if (this.options.evaluateFieldsOnChange){
  10070. el.addEvent('change', this.validationMonitor.pass([el, true, this.options.scrollToErrorsOnChange], this));
  10071. }
  10072. }, this);
  10073. }
  10074. });
  10075. /*
  10076. ---
  10077. script: OverText.js
  10078. name: OverText
  10079. description: Shows text over an input that disappears when the user clicks into it. The text remains hidden if the user adds a value.
  10080. license: MIT-style license
  10081. authors:
  10082. - Aaron Newton
  10083. requires:
  10084. - Core/Options
  10085. - Core/Events
  10086. - Core/Element.Event
  10087. - Class.Binds
  10088. - Class.Occlude
  10089. - Element.Position
  10090. - Element.Shortcuts
  10091. provides: [OverText]
  10092. ...
  10093. */
  10094. (function(){
  10095. var OverText = this.OverText = new Class({
  10096. Implements: [Options, Events, Class.Occlude],
  10097. Binds: ['reposition', 'assert', 'focus', 'hide'],
  10098. options: {/*
  10099. textOverride: null,
  10100. onFocus: function(){},
  10101. onTextHide: function(textEl, inputEl){},
  10102. onTextShow: function(textEl, inputEl){}, */
  10103. element: 'label',
  10104. labelClass: 'overTxtLabel',
  10105. positionOptions: {
  10106. position: 'upperLeft',
  10107. edge: 'upperLeft',
  10108. offset: {
  10109. x: 4,
  10110. y: 2
  10111. }
  10112. },
  10113. poll: false,
  10114. pollInterval: 250,
  10115. wrap: false
  10116. },
  10117. property: 'OverText',
  10118. initialize: function(element, options){
  10119. element = this.element = document.id(element);
  10120. if (this.occlude()) return this.occluded;
  10121. this.setOptions(options);
  10122. this.attach(element);
  10123. OverText.instances.push(this);
  10124. if (this.options.poll) this.poll();
  10125. },
  10126. toElement: function(){
  10127. return this.element;
  10128. },
  10129. attach: function(){
  10130. var element = this.element,
  10131. options = this.options,
  10132. value = options.textOverride || element.get('alt') || element.get('title');
  10133. if (!value) return this;
  10134. var text = this.text = new Element(options.element, {
  10135. 'class': options.labelClass,
  10136. styles: {
  10137. lineHeight: 'normal',
  10138. position: 'absolute',
  10139. cursor: 'text'
  10140. },
  10141. html: value,
  10142. events: {
  10143. click: this.hide.pass(options.element == 'label', this)
  10144. }
  10145. }).inject(element, 'after');
  10146. if (options.element == 'label'){
  10147. if (!element.get('id')) element.set('id', 'input_' + String.uniqueID());
  10148. text.set('for', element.get('id'));
  10149. }
  10150. if (options.wrap){
  10151. this.textHolder = new Element('div.overTxtWrapper', {
  10152. styles: {
  10153. lineHeight: 'normal',
  10154. position: 'relative'
  10155. }
  10156. }).grab(text).inject(element, 'before');
  10157. }
  10158. return this.enable();
  10159. },
  10160. destroy: function(){
  10161. this.element.eliminate(this.property); // Class.Occlude storage
  10162. this.disable();
  10163. if (this.text) this.text.destroy();
  10164. if (this.textHolder) this.textHolder.destroy();
  10165. return this;
  10166. },
  10167. disable: function(){
  10168. this.element.removeEvents({
  10169. focus: this.focus,
  10170. blur: this.assert,
  10171. change: this.assert
  10172. });
  10173. window.removeEvent('resize', this.reposition);
  10174. this.hide(true, true);
  10175. return this;
  10176. },
  10177. enable: function(){
  10178. this.element.addEvents({
  10179. focus: this.focus,
  10180. blur: this.assert,
  10181. change: this.assert
  10182. });
  10183. window.addEvent('resize', this.reposition);
  10184. this.reposition();
  10185. return this;
  10186. },
  10187. wrap: function(){
  10188. if (this.options.element == 'label'){
  10189. if (!this.element.get('id')) this.element.set('id', 'input_' + String.uniqueID());
  10190. this.text.set('for', this.element.get('id'));
  10191. }
  10192. },
  10193. startPolling: function(){
  10194. this.pollingPaused = false;
  10195. return this.poll();
  10196. },
  10197. poll: function(stop){
  10198. //start immediately
  10199. //pause on focus
  10200. //resumeon blur
  10201. if (this.poller && !stop) return this;
  10202. if (stop){
  10203. clearInterval(this.poller);
  10204. } else {
  10205. this.poller = (function(){
  10206. if (!this.pollingPaused) this.assert(true);
  10207. }).periodical(this.options.pollInterval, this);
  10208. }
  10209. return this;
  10210. },
  10211. stopPolling: function(){
  10212. this.pollingPaused = true;
  10213. return this.poll(true);
  10214. },
  10215. focus: function(){
  10216. if (this.text && (!this.text.isDisplayed() || this.element.get('disabled'))) return this;
  10217. return this.hide();
  10218. },
  10219. hide: function(suppressFocus, force){
  10220. if (this.text && (this.text.isDisplayed() && (!this.element.get('disabled') || force))){
  10221. this.text.hide();
  10222. this.fireEvent('textHide', [this.text, this.element]);
  10223. this.pollingPaused = true;
  10224. if (!suppressFocus){
  10225. try {
  10226. this.element.fireEvent('focus');
  10227. this.element.focus();
  10228. } catch (e){} //IE barfs if you call focus on hidden elements
  10229. }
  10230. }
  10231. return this;
  10232. },
  10233. show: function(){
  10234. if (document.id(this.text) && !this.text.isDisplayed()){
  10235. this.text.show();
  10236. this.reposition();
  10237. this.fireEvent('textShow', [this.text, this.element]);
  10238. this.pollingPaused = false;
  10239. }
  10240. return this;
  10241. },
  10242. test: function(){
  10243. return !this.element.get('value');
  10244. },
  10245. assert: function(suppressFocus){
  10246. return this[this.test() ? 'show' : 'hide'](suppressFocus);
  10247. },
  10248. reposition: function(){
  10249. this.assert(true);
  10250. if (!this.element.isVisible()) return this.stopPolling().hide();
  10251. if (this.text && this.test()){
  10252. this.text.position(Object.merge(this.options.positionOptions, {
  10253. relativeTo: this.element
  10254. }));
  10255. }
  10256. return this;
  10257. }
  10258. });
  10259. })();
  10260. OverText.instances = [];
  10261. Object.append(OverText, {
  10262. each: function(fn){
  10263. return OverText.instances.each(function(ot, i){
  10264. if (ot.element && ot.text) fn.call(OverText, ot, i);
  10265. });
  10266. },
  10267. update: function(){
  10268. return OverText.each(function(ot){
  10269. return ot.reposition();
  10270. });
  10271. },
  10272. hideAll: function(){
  10273. return OverText.each(function(ot){
  10274. return ot.hide(true, true);
  10275. });
  10276. },
  10277. showAll: function(){
  10278. return OverText.each(function(ot){
  10279. return ot.show();
  10280. });
  10281. }
  10282. });
  10283. /*
  10284. ---
  10285. script: Fx.Elements.js
  10286. name: Fx.Elements
  10287. description: Effect to change any number of CSS properties of any number of Elements.
  10288. license: MIT-style license
  10289. authors:
  10290. - Valerio Proietti
  10291. requires:
  10292. - Core/Fx.CSS
  10293. - MooTools.More
  10294. provides: [Fx.Elements]
  10295. ...
  10296. */
  10297. Fx.Elements = new Class({
  10298. Extends: Fx.CSS,
  10299. initialize: function(elements, options){
  10300. this.elements = this.subject = $$(elements);
  10301. this.parent(options);
  10302. },
  10303. compute: function(from, to, delta){
  10304. var now = {};
  10305. for (var i in from){
  10306. var iFrom = from[i], iTo = to[i], iNow = now[i] = {};
  10307. for (var p in iFrom) iNow[p] = this.parent(iFrom[p], iTo[p], delta);
  10308. }
  10309. return now;
  10310. },
  10311. set: function(now){
  10312. for (var i in now){
  10313. if (!this.elements[i]) continue;
  10314. var iNow = now[i];
  10315. for (var p in iNow) this.render(this.elements[i], p, iNow[p], this.options.unit);
  10316. }
  10317. return this;
  10318. },
  10319. start: function(obj){
  10320. if (!this.check(obj)) return this;
  10321. var from = {}, to = {};
  10322. for (var i in obj){
  10323. if (!this.elements[i]) continue;
  10324. var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {};
  10325. for (var p in iProps){
  10326. var parsed = this.prepare(this.elements[i], p, iProps[p]);
  10327. iFrom[p] = parsed.from;
  10328. iTo[p] = parsed.to;
  10329. }
  10330. }
  10331. return this.parent(from, to);
  10332. }
  10333. });
  10334. /*
  10335. ---
  10336. script: Fx.Accordion.js
  10337. name: Fx.Accordion
  10338. description: An Fx.Elements extension which allows you to easily create accordion type controls.
  10339. license: MIT-style license
  10340. authors:
  10341. - Valerio Proietti
  10342. requires:
  10343. - Core/Element.Event
  10344. - Fx.Elements
  10345. provides: [Fx.Accordion]
  10346. ...
  10347. */
  10348. Fx.Accordion = new Class({
  10349. Extends: Fx.Elements,
  10350. options: {/*
  10351. onActive: function(toggler, section){},
  10352. onBackground: function(toggler, section){},*/
  10353. fixedHeight: false,
  10354. fixedWidth: false,
  10355. display: 0,
  10356. show: false,
  10357. height: true,
  10358. width: false,
  10359. opacity: true,
  10360. alwaysHide: false,
  10361. trigger: 'click',
  10362. initialDisplayFx: true,
  10363. resetHeight: true,
  10364. keepOpen: false
  10365. },
  10366. initialize: function(){
  10367. var defined = function(obj){
  10368. return obj != null;
  10369. };
  10370. var params = Array.link(arguments, {
  10371. 'container': Type.isElement, //deprecated
  10372. 'options': Type.isObject,
  10373. 'togglers': defined,
  10374. 'elements': defined
  10375. });
  10376. this.parent(params.elements, params.options);
  10377. var options = this.options,
  10378. togglers = this.togglers = $$(params.togglers);
  10379. this.previous = -1;
  10380. this.internalChain = new Chain();
  10381. if (options.alwaysHide) this.options.link = 'chain';
  10382. if (options.show || this.options.show === 0){
  10383. options.display = false;
  10384. this.previous = options.show;
  10385. }
  10386. if (options.start){
  10387. options.display = false;
  10388. options.show = false;
  10389. }
  10390. var effects = this.effects = {};
  10391. if (options.opacity) effects.opacity = 'fullOpacity';
  10392. if (options.width) effects.width = options.fixedWidth ? 'fullWidth' : 'offsetWidth';
  10393. if (options.height) effects.height = options.fixedHeight ? 'fullHeight' : 'scrollHeight';
  10394. for (var i = 0, l = togglers.length; i < l; i++) this.addSection(togglers[i], this.elements[i]);
  10395. this.elements.each(function(el, i){
  10396. if (options.show === i){
  10397. this.fireEvent('active', [togglers[i], el]);
  10398. } else {
  10399. for (var fx in effects) el.setStyle(fx, 0);
  10400. }
  10401. }, this);
  10402. if (options.display || options.display === 0 || options.initialDisplayFx === false){
  10403. this.display(options.display, options.initialDisplayFx);
  10404. }
  10405. if (options.fixedHeight !== false) options.resetHeight = false;
  10406. this.addEvent('complete', this.internalChain.callChain.bind(this.internalChain));
  10407. },
  10408. addSection: function(toggler, element){
  10409. toggler = document.id(toggler);
  10410. element = document.id(element);
  10411. this.togglers.include(toggler);
  10412. this.elements.include(element);
  10413. var togglers = this.togglers,
  10414. options = this.options,
  10415. test = togglers.contains(toggler),
  10416. idx = togglers.indexOf(toggler),
  10417. displayer = this.display.pass(idx, this);
  10418. toggler.store('accordion:display', displayer)
  10419. .addEvent(options.trigger, displayer);
  10420. if (options.height) element.setStyles({'padding-top': 0, 'border-top': 'none', 'padding-bottom': 0, 'border-bottom': 'none'});
  10421. if (options.width) element.setStyles({'padding-left': 0, 'border-left': 'none', 'padding-right': 0, 'border-right': 'none'});
  10422. element.fullOpacity = 1;
  10423. if (options.fixedWidth) element.fullWidth = options.fixedWidth;
  10424. if (options.fixedHeight) element.fullHeight = options.fixedHeight;
  10425. element.setStyle('overflow', 'hidden');
  10426. if (!test) for (var fx in this.effects){
  10427. element.setStyle(fx, 0);
  10428. }
  10429. return this;
  10430. },
  10431. removeSection: function(toggler, displayIndex){
  10432. var togglers = this.togglers,
  10433. idx = togglers.indexOf(toggler),
  10434. element = this.elements[idx];
  10435. var remover = function(){
  10436. togglers.erase(toggler);
  10437. this.elements.erase(element);
  10438. this.detach(toggler);
  10439. }.bind(this);
  10440. if (this.now == idx || displayIndex != null){
  10441. this.display(displayIndex != null ? displayIndex : (idx - 1 >= 0 ? idx - 1 : 0)).chain(remover);
  10442. } else {
  10443. remover();
  10444. }
  10445. return this;
  10446. },
  10447. detach: function(toggler){
  10448. var remove = function(toggler){
  10449. toggler.removeEvent(this.options.trigger, toggler.retrieve('accordion:display'));
  10450. }.bind(this);
  10451. if (!toggler) this.togglers.each(remove);
  10452. else remove(toggler);
  10453. return this;
  10454. },
  10455. display: function(index, useFx){
  10456. if (!this.check(index, useFx)) return this;
  10457. var obj = {},
  10458. elements = this.elements,
  10459. options = this.options,
  10460. effects = this.effects,
  10461. keepOpen = options.keepOpen,
  10462. alwaysHide = options.alwaysHide;
  10463. if (useFx == null) useFx = true;
  10464. if (typeOf(index) == 'element') index = elements.indexOf(index);
  10465. if (index == this.current && !alwaysHide && !keepOpen) return this;
  10466. if (options.resetHeight){
  10467. var prev = elements[this.current];
  10468. if (prev && !this.selfHidden){
  10469. for (var fx in effects) prev.setStyle(fx, prev[effects[fx]]);
  10470. }
  10471. }
  10472. if (this.timer && options.link == 'chain') return this;
  10473. if (this.current != null) this.previous = this.current;
  10474. this.current = index;
  10475. this.selfHidden = false;
  10476. elements.each(function(el, i){
  10477. obj[i] = {};
  10478. var hide, isOpen;
  10479. if (!keepOpen || i == index){
  10480. if (i == index) isOpen = (el.offsetHeight > 0 && options.height) || (el.offsetWidth > 0 && options.width);
  10481. if (i != index){
  10482. hide = true;
  10483. } else if ((alwaysHide || keepOpen) && isOpen){
  10484. hide = true;
  10485. this.selfHidden = true;
  10486. }
  10487. this.fireEvent(hide ? 'background' : 'active', [this.togglers[i], el]);
  10488. for (var fx in effects) obj[i][fx] = hide ? 0 : el[effects[fx]];
  10489. if (!useFx && !hide && options.resetHeight) obj[i].height = 'auto';
  10490. }
  10491. }, this);
  10492. this.internalChain.clearChain();
  10493. this.internalChain.chain(function(){
  10494. if (options.resetHeight && !this.selfHidden){
  10495. var el = elements[index];
  10496. if (el) el.setStyle('height', 'auto');
  10497. }
  10498. }.bind(this));
  10499. return useFx ? this.start(obj) : this.set(obj).internalChain.callChain();
  10500. }
  10501. });
  10502. /*<1.2compat>*/
  10503. /*
  10504. Compatibility with 1.2.0
  10505. */
  10506. var Accordion = new Class({
  10507. Extends: Fx.Accordion,
  10508. initialize: function(){
  10509. this.parent.apply(this, arguments);
  10510. var params = Array.link(arguments, {'container': Type.isElement});
  10511. this.container = params.container;
  10512. },
  10513. addSection: function(toggler, element, pos){
  10514. toggler = document.id(toggler);
  10515. element = document.id(element);
  10516. var test = this.togglers.contains(toggler);
  10517. var len = this.togglers.length;
  10518. if (len && (!test || pos)){
  10519. pos = pos != null ? pos : len - 1;
  10520. toggler.inject(this.togglers[pos], 'before');
  10521. element.inject(toggler, 'after');
  10522. } else if (this.container && !test){
  10523. toggler.inject(this.container);
  10524. element.inject(this.container);
  10525. }
  10526. return this.parent.apply(this, arguments);
  10527. }
  10528. });
  10529. /*</1.2compat>*/
  10530. /*
  10531. ---
  10532. script: Fx.Move.js
  10533. name: Fx.Move
  10534. description: Defines Fx.Move, a class that works with Element.Position.js to transition an element from one location to another.
  10535. license: MIT-style license
  10536. authors:
  10537. - Aaron Newton
  10538. requires:
  10539. - Core/Fx.Morph
  10540. - Element.Position
  10541. provides: [Fx.Move]
  10542. ...
  10543. */
  10544. Fx.Move = new Class({
  10545. Extends: Fx.Morph,
  10546. options: {
  10547. relativeTo: document.body,
  10548. position: 'center',
  10549. edge: false,
  10550. offset: {x: 0, y: 0}
  10551. },
  10552. start: function(destination){
  10553. var element = this.element,
  10554. topLeft = element.getStyles('top', 'left');
  10555. if (topLeft.top == 'auto' || topLeft.left == 'auto'){
  10556. element.setPosition(element.getPosition(element.getOffsetParent()));
  10557. }
  10558. return this.parent(element.position(Object.merge({}, this.options, destination, {returnPos: true})));
  10559. }
  10560. });
  10561. Element.Properties.move = {
  10562. set: function(options){
  10563. this.get('move').cancel().setOptions(options);
  10564. return this;
  10565. },
  10566. get: function(){
  10567. var move = this.retrieve('move');
  10568. if (!move){
  10569. move = new Fx.Move(this, {link: 'cancel'});
  10570. this.store('move', move);
  10571. }
  10572. return move;
  10573. }
  10574. };
  10575. Element.implement({
  10576. move: function(options){
  10577. this.get('move').start(options);
  10578. return this;
  10579. }
  10580. });
  10581. /*
  10582. ---
  10583. script: Fx.Scroll.js
  10584. name: Fx.Scroll
  10585. description: Effect to smoothly scroll any element, including the window.
  10586. license: MIT-style license
  10587. authors:
  10588. - Valerio Proietti
  10589. requires:
  10590. - Core/Fx
  10591. - Core/Element.Event
  10592. - Core/Element.Dimensions
  10593. - MooTools.More
  10594. provides: [Fx.Scroll]
  10595. ...
  10596. */
  10597. (function(){
  10598. Fx.Scroll = new Class({
  10599. Extends: Fx,
  10600. options: {
  10601. offset: {x: 0, y: 0},
  10602. wheelStops: true
  10603. },
  10604. initialize: function(element, options){
  10605. this.element = this.subject = document.id(element);
  10606. this.parent(options);
  10607. if (typeOf(this.element) != 'element') this.element = document.id(this.element.getDocument().body);
  10608. if (this.options.wheelStops){
  10609. var stopper = this.element,
  10610. cancel = this.cancel.pass(false, this);
  10611. this.addEvent('start', function(){
  10612. stopper.addEvent('mousewheel', cancel);
  10613. }, true);
  10614. this.addEvent('complete', function(){
  10615. stopper.removeEvent('mousewheel', cancel);
  10616. }, true);
  10617. }
  10618. },
  10619. set: function(){
  10620. var now = Array.flatten(arguments);
  10621. this.element.scrollTo(now[0], now[1]);
  10622. return this;
  10623. },
  10624. compute: function(from, to, delta){
  10625. return [0, 1].map(function(i){
  10626. return Fx.compute(from[i], to[i], delta);
  10627. });
  10628. },
  10629. start: function(x, y){
  10630. if (!this.check(x, y)) return this;
  10631. var scroll = this.element.getScroll();
  10632. return this.parent([scroll.x, scroll.y], [x, y]);
  10633. },
  10634. calculateScroll: function(x, y){
  10635. var element = this.element,
  10636. scrollSize = element.getScrollSize(),
  10637. scroll = element.getScroll(),
  10638. size = element.getSize(),
  10639. offset = this.options.offset,
  10640. values = {x: x, y: y};
  10641. for (var z in values){
  10642. if (!values[z] && values[z] !== 0) values[z] = scroll[z];
  10643. if (typeOf(values[z]) != 'number') values[z] = scrollSize[z] - size[z];
  10644. values[z] += offset[z];
  10645. }
  10646. return [values.x, values.y];
  10647. },
  10648. toTop: function(){
  10649. return this.start.apply(this, this.calculateScroll(false, 0));
  10650. },
  10651. toLeft: function(){
  10652. return this.start.apply(this, this.calculateScroll(0, false));
  10653. },
  10654. toRight: function(){
  10655. return this.start.apply(this, this.calculateScroll('right', false));
  10656. },
  10657. toBottom: function(){
  10658. return this.start.apply(this, this.calculateScroll(false, 'bottom'));
  10659. },
  10660. toElement: function(el, axes){
  10661. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10662. var scroll = isBody(this.element) ? {x: 0, y: 0} : this.element.getScroll();
  10663. var position = Object.map(document.id(el).getPosition(this.element), function(value, axis){
  10664. return axes.contains(axis) ? value + scroll[axis] : false;
  10665. });
  10666. return this.start.apply(this, this.calculateScroll(position.x, position.y));
  10667. },
  10668. toElementEdge: function(el, axes, offset){
  10669. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10670. el = document.id(el);
  10671. var to = {},
  10672. position = el.getPosition(this.element),
  10673. size = el.getSize(),
  10674. scroll = this.element.getScroll(),
  10675. containerSize = this.element.getSize(),
  10676. edge = {
  10677. x: position.x + size.x,
  10678. y: position.y + size.y
  10679. };
  10680. ['x', 'y'].each(function(axis){
  10681. if (axes.contains(axis)){
  10682. if (edge[axis] > scroll[axis] + containerSize[axis]) to[axis] = edge[axis] - containerSize[axis];
  10683. if (position[axis] < scroll[axis]) to[axis] = position[axis];
  10684. }
  10685. if (to[axis] == null) to[axis] = scroll[axis];
  10686. if (offset && offset[axis]) to[axis] = to[axis] + offset[axis];
  10687. }, this);
  10688. if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y);
  10689. return this;
  10690. },
  10691. toElementCenter: function(el, axes, offset){
  10692. axes = axes ? Array.convert(axes) : ['x', 'y'];
  10693. el = document.id(el);
  10694. var to = {},
  10695. position = el.getPosition(this.element),
  10696. size = el.getSize(),
  10697. scroll = this.element.getScroll(),
  10698. containerSize = this.element.getSize();
  10699. ['x', 'y'].each(function(axis){
  10700. if (axes.contains(axis)){
  10701. to[axis] = position[axis] - (containerSize[axis] - size[axis]) / 2;
  10702. }
  10703. if (to[axis] == null) to[axis] = scroll[axis];
  10704. if (offset && offset[axis]) to[axis] = to[axis] + offset[axis];
  10705. }, this);
  10706. if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y);
  10707. return this;
  10708. }
  10709. });
  10710. //<1.2compat>
  10711. Fx.Scroll.implement({
  10712. scrollToCenter: function(){
  10713. return this.toElementCenter.apply(this, arguments);
  10714. },
  10715. scrollIntoView: function(){
  10716. return this.toElementEdge.apply(this, arguments);
  10717. }
  10718. });
  10719. //</1.2compat>
  10720. function isBody(element){
  10721. return (/^(?:body|html)$/i).test(element.tagName);
  10722. }
  10723. })();
  10724. /*
  10725. ---
  10726. script: Fx.Slide.js
  10727. name: Fx.Slide
  10728. description: Effect to slide an element in and out of view.
  10729. license: MIT-style license
  10730. authors:
  10731. - Valerio Proietti
  10732. requires:
  10733. - Core/Fx
  10734. - Core/Element.Style
  10735. - MooTools.More
  10736. provides: [Fx.Slide]
  10737. ...
  10738. */
  10739. Fx.Slide = new Class({
  10740. Extends: Fx,
  10741. options: {
  10742. mode: 'vertical',
  10743. wrapper: false,
  10744. hideOverflow: true,
  10745. resetHeight: false
  10746. },
  10747. initialize: function(element, options){
  10748. element = this.element = this.subject = document.id(element);
  10749. this.parent(options);
  10750. options = this.options;
  10751. var wrapper = element.retrieve('wrapper'),
  10752. styles = element.getStyles('margin', 'position', 'overflow');
  10753. if (options.hideOverflow) styles = Object.append(styles, {overflow: 'hidden'});
  10754. if (options.wrapper) wrapper = document.id(options.wrapper).setStyles(styles);
  10755. if (!wrapper) wrapper = new Element('div', {
  10756. styles: styles
  10757. }).wraps(element);
  10758. element.store('wrapper', wrapper).setStyle('margin', 0);
  10759. if (element.getStyle('overflow') == 'visible') element.setStyle('overflow', 'hidden');
  10760. this.now = [];
  10761. this.open = true;
  10762. this.wrapper = wrapper;
  10763. this.addEvent('complete', function(){
  10764. this.open = (wrapper['offset' + this.layout.capitalize()] != 0);
  10765. if (this.open && this.options.resetHeight) wrapper.setStyle('height', '');
  10766. }, true);
  10767. },
  10768. vertical: function(){
  10769. this.margin = 'margin-top';
  10770. this.layout = 'height';
  10771. this.offset = this.element.offsetHeight;
  10772. },
  10773. horizontal: function(){
  10774. this.margin = 'margin-left';
  10775. this.layout = 'width';
  10776. this.offset = this.element.offsetWidth;
  10777. },
  10778. set: function(now){
  10779. this.element.setStyle(this.margin, now[0]);
  10780. this.wrapper.setStyle(this.layout, now[1]);
  10781. return this;
  10782. },
  10783. compute: function(from, to, delta){
  10784. return [0, 1].map(function(i){
  10785. return Fx.compute(from[i], to[i], delta);
  10786. });
  10787. },
  10788. start: function(how, mode){
  10789. if (!this.check(how, mode)) return this;
  10790. this[mode || this.options.mode]();
  10791. var margin = this.element.getStyle(this.margin).toInt(),
  10792. layout = this.wrapper.getStyle(this.layout).toInt(),
  10793. caseIn = [[margin, layout], [0, this.offset]],
  10794. caseOut = [[margin, layout], [-this.offset, 0]],
  10795. start;
  10796. switch (how){
  10797. case 'in': start = caseIn; break;
  10798. case 'out': start = caseOut; break;
  10799. case 'toggle': start = (layout == 0) ? caseIn : caseOut;
  10800. }
  10801. return this.parent(start[0], start[1]);
  10802. },
  10803. slideIn: function(mode){
  10804. return this.start('in', mode);
  10805. },
  10806. slideOut: function(mode){
  10807. return this.start('out', mode);
  10808. },
  10809. hide: function(mode){
  10810. this[mode || this.options.mode]();
  10811. this.open = false;
  10812. return this.set([-this.offset, 0]);
  10813. },
  10814. show: function(mode){
  10815. this[mode || this.options.mode]();
  10816. this.open = true;
  10817. return this.set([0, this.offset]);
  10818. },
  10819. toggle: function(mode){
  10820. return this.start('toggle', mode);
  10821. }
  10822. });
  10823. Element.Properties.slide = {
  10824. set: function(options){
  10825. this.get('slide').cancel().setOptions(options);
  10826. return this;
  10827. },
  10828. get: function(){
  10829. var slide = this.retrieve('slide');
  10830. if (!slide){
  10831. slide = new Fx.Slide(this, {link: 'cancel'});
  10832. this.store('slide', slide);
  10833. }
  10834. return slide;
  10835. }
  10836. };
  10837. Element.implement({
  10838. slide: function(how, mode){
  10839. how = how || 'toggle';
  10840. var slide = this.get('slide'), toggle;
  10841. switch (how){
  10842. case 'hide': slide.hide(mode); break;
  10843. case 'show': slide.show(mode); break;
  10844. case 'toggle':
  10845. var flag = this.retrieve('slide:flag', slide.open);
  10846. slide[flag ? 'slideOut' : 'slideIn'](mode);
  10847. this.store('slide:flag', !flag);
  10848. toggle = true;
  10849. break;
  10850. default: slide.start(how, mode);
  10851. }
  10852. if (!toggle) this.eliminate('slide:flag');
  10853. return this;
  10854. }
  10855. });
  10856. /*
  10857. ---
  10858. script: Fx.SmoothScroll.js
  10859. name: Fx.SmoothScroll
  10860. description: Class for creating a smooth scrolling effect to all internal links on the page.
  10861. license: MIT-style license
  10862. authors:
  10863. - Valerio Proietti
  10864. requires:
  10865. - Core/Slick.Finder
  10866. - Fx.Scroll
  10867. provides: [Fx.SmoothScroll]
  10868. ...
  10869. */
  10870. /*<1.2compat>*/var SmoothScroll = /*</1.2compat>*/Fx.SmoothScroll = new Class({
  10871. Extends: Fx.Scroll,
  10872. options: {
  10873. axes: ['x', 'y']
  10874. },
  10875. initialize: function(options, context){
  10876. context = context || document;
  10877. this.doc = context.getDocument();
  10878. this.parent(this.doc, options);
  10879. var win = context.getWindow(),
  10880. location = win.location.href.match(/^[^#]*/)[0] + '#',
  10881. links = $$(this.options.links || this.doc.links);
  10882. links.each(function(link){
  10883. if (link.href.indexOf(location) != 0) return;
  10884. var anchor = link.href.substr(location.length);
  10885. if (anchor) this.useLink(link, anchor);
  10886. }, this);
  10887. this.addEvent('complete', function(){
  10888. win.location.hash = this.anchor;
  10889. this.element.scrollTo(this.to[0], this.to[1]);
  10890. }, true);
  10891. },
  10892. useLink: function(link, anchor){
  10893. link.addEvent('click', function(event){
  10894. var el = document.id(anchor) || this.doc.getElement('a[name=' + anchor + ']');
  10895. if (!el) return;
  10896. event.preventDefault();
  10897. this.toElement(el, this.options.axes).chain(function(){
  10898. this.fireEvent('scrolledTo', [link, el]);
  10899. }.bind(this));
  10900. this.anchor = anchor;
  10901. }.bind(this));
  10902. return this;
  10903. }
  10904. });
  10905. /*
  10906. ---
  10907. script: Fx.Sort.js
  10908. name: Fx.Sort
  10909. description: Defines Fx.Sort, a class that reorders lists with a transition.
  10910. license: MIT-style license
  10911. authors:
  10912. - Aaron Newton
  10913. requires:
  10914. - Core/Element.Dimensions
  10915. - Fx.Elements
  10916. - Element.Measure
  10917. provides: [Fx.Sort]
  10918. ...
  10919. */
  10920. Fx.Sort = new Class({
  10921. Extends: Fx.Elements,
  10922. options: {
  10923. mode: 'vertical'
  10924. },
  10925. initialize: function(elements, options){
  10926. this.parent(elements, options);
  10927. this.elements.each(function(el){
  10928. if (el.getStyle('position') == 'static') el.setStyle('position', 'relative');
  10929. });
  10930. this.setDefaultOrder();
  10931. },
  10932. setDefaultOrder: function(){
  10933. this.currentOrder = this.elements.map(function(el, index){
  10934. return index;
  10935. });
  10936. },
  10937. sort: function(){
  10938. if (!this.check(arguments)) return this;
  10939. var newOrder = Array.flatten(arguments);
  10940. var top = 0,
  10941. left = 0,
  10942. next = {},
  10943. zero = {},
  10944. vert = this.options.mode == 'vertical';
  10945. var current = this.elements.map(function(el, index){
  10946. var size = el.getComputedSize({styles: ['border', 'padding', 'margin']});
  10947. var val;
  10948. if (vert){
  10949. val = {
  10950. top: top,
  10951. margin: size['margin-top'],
  10952. height: size.totalHeight
  10953. };
  10954. top += val.height - size['margin-top'];
  10955. } else {
  10956. val = {
  10957. left: left,
  10958. margin: size['margin-left'],
  10959. width: size.totalWidth
  10960. };
  10961. left += val.width;
  10962. }
  10963. var plane = vert ? 'top' : 'left';
  10964. zero[index] = {};
  10965. var start = el.getStyle(plane).toInt();
  10966. zero[index][plane] = start || 0;
  10967. return val;
  10968. }, this);
  10969. this.set(zero);
  10970. newOrder = newOrder.map(function(i){ return i.toInt(); });
  10971. if (newOrder.length != this.elements.length){
  10972. this.currentOrder.each(function(index){
  10973. if (!newOrder.contains(index)) newOrder.push(index);
  10974. });
  10975. if (newOrder.length > this.elements.length)
  10976. newOrder.splice(this.elements.length-1, newOrder.length - this.elements.length);
  10977. }
  10978. var margin = 0;
  10979. top = left = 0;
  10980. newOrder.each(function(item){
  10981. var newPos = {};
  10982. if (vert){
  10983. newPos.top = top - current[item].top - margin;
  10984. top += current[item].height;
  10985. } else {
  10986. newPos.left = left - current[item].left;
  10987. left += current[item].width;
  10988. }
  10989. margin = margin + current[item].margin;
  10990. next[item]=newPos;
  10991. }, this);
  10992. var mapped = {};
  10993. Array.clone(newOrder).sort().each(function(index){
  10994. mapped[index] = next[index];
  10995. });
  10996. this.start(mapped);
  10997. this.currentOrder = newOrder;
  10998. return this;
  10999. },
  11000. rearrangeDOM: function(newOrder){
  11001. newOrder = newOrder || this.currentOrder;
  11002. var parent = this.elements[0].getParent();
  11003. var rearranged = [];
  11004. this.elements.setStyle('opacity', 0);
  11005. //move each element and store the new default order
  11006. newOrder.each(function(index){
  11007. rearranged.push(this.elements[index].inject(parent).setStyles({
  11008. top: 0,
  11009. left: 0
  11010. }));
  11011. }, this);
  11012. this.elements.setStyle('opacity', 1);
  11013. this.elements = $$(rearranged);
  11014. this.setDefaultOrder();
  11015. return this;
  11016. },
  11017. getDefaultOrder: function(){
  11018. return this.elements.map(function(el, index){
  11019. return index;
  11020. });
  11021. },
  11022. getCurrentOrder: function(){
  11023. return this.currentOrder;
  11024. },
  11025. forward: function(){
  11026. return this.sort(this.getDefaultOrder());
  11027. },
  11028. backward: function(){
  11029. return this.sort(this.getDefaultOrder().reverse());
  11030. },
  11031. reverse: function(){
  11032. return this.sort(this.currentOrder.reverse());
  11033. },
  11034. sortByElements: function(elements){
  11035. return this.sort(elements.map(function(el){
  11036. return this.elements.indexOf(el);
  11037. }, this));
  11038. },
  11039. swap: function(one, two){
  11040. if (typeOf(one) == 'element') one = this.elements.indexOf(one);
  11041. if (typeOf(two) == 'element') two = this.elements.indexOf(two);
  11042. var newOrder = Array.clone(this.currentOrder);
  11043. newOrder[this.currentOrder.indexOf(one)] = two;
  11044. newOrder[this.currentOrder.indexOf(two)] = one;
  11045. return this.sort(newOrder);
  11046. }
  11047. });
  11048. /*
  11049. ---
  11050. script: Keyboard.js
  11051. name: Keyboard
  11052. 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.
  11053. license: MIT-style license
  11054. authors:
  11055. - Perrin Westrich
  11056. - Aaron Newton
  11057. - Scott Kyle
  11058. requires:
  11059. - Core/Events
  11060. - Core/Options
  11061. - Core/Element.Event
  11062. - Element.Event.Pseudos.Keys
  11063. provides: [Keyboard]
  11064. ...
  11065. */
  11066. (function(){
  11067. var Keyboard = this.Keyboard = new Class({
  11068. Extends: Events,
  11069. Implements: [Options],
  11070. options: {/*
  11071. onActivate: function(){},
  11072. onDeactivate: function(){},*/
  11073. defaultEventType: 'keydown',
  11074. active: false,
  11075. manager: null,
  11076. events: {},
  11077. nonParsedEvents: ['activate', 'deactivate', 'onactivate', 'ondeactivate', 'changed', 'onchanged']
  11078. },
  11079. initialize: function(options){
  11080. if (options && options.manager){
  11081. this._manager = options.manager;
  11082. delete options.manager;
  11083. }
  11084. this.setOptions(options);
  11085. this._setup();
  11086. },
  11087. addEvent: function(type, fn, internal){
  11088. return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn, internal);
  11089. },
  11090. removeEvent: function(type, fn){
  11091. return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn);
  11092. },
  11093. toggleActive: function(){
  11094. return this[this.isActive() ? 'deactivate' : 'activate']();
  11095. },
  11096. activate: function(instance){
  11097. if (instance){
  11098. if (instance.isActive()) return this;
  11099. //if we're stealing focus, store the last keyboard to have it so the relinquish command works
  11100. if (this._activeKB && instance != this._activeKB){
  11101. this.previous = this._activeKB;
  11102. this.previous.fireEvent('deactivate');
  11103. }
  11104. //if we're enabling a child, assign it so that events are now passed to it
  11105. this._activeKB = instance.fireEvent('activate');
  11106. Keyboard.manager.fireEvent('changed');
  11107. } else if (this._manager){
  11108. //else we're enabling ourselves, we must ask our parent to do it for us
  11109. this._manager.activate(this);
  11110. }
  11111. return this;
  11112. },
  11113. isActive: function(){
  11114. return this._manager ? (this._manager._activeKB == this) : (Keyboard.manager == this);
  11115. },
  11116. deactivate: function(instance){
  11117. if (instance){
  11118. if (instance === this._activeKB){
  11119. this._activeKB = null;
  11120. instance.fireEvent('deactivate');
  11121. Keyboard.manager.fireEvent('changed');
  11122. }
  11123. } else if (this._manager){
  11124. this._manager.deactivate(this);
  11125. }
  11126. return this;
  11127. },
  11128. relinquish: function(){
  11129. if (this.isActive() && this._manager && this._manager.previous) this._manager.activate(this._manager.previous);
  11130. else this.deactivate();
  11131. return this;
  11132. },
  11133. //management logic
  11134. manage: function(instance){
  11135. if (instance._manager) instance._manager.drop(instance);
  11136. this._instances.push(instance);
  11137. instance._manager = this;
  11138. if (!this._activeKB) this.activate(instance);
  11139. return this;
  11140. },
  11141. drop: function(instance){
  11142. instance.relinquish();
  11143. this._instances.erase(instance);
  11144. if (this._activeKB == instance){
  11145. if (this.previous && this._instances.contains(this.previous)) this.activate(this.previous);
  11146. else this._activeKB = this._instances[0];
  11147. }
  11148. return this;
  11149. },
  11150. trace: function(){
  11151. Keyboard.trace(this);
  11152. },
  11153. each: function(fn){
  11154. Keyboard.each(this, fn);
  11155. },
  11156. /*
  11157. PRIVATE METHODS
  11158. */
  11159. _instances: [],
  11160. _disable: function(instance){
  11161. if (this._activeKB == instance) this._activeKB = null;
  11162. },
  11163. _setup: function(){
  11164. this.addEvents(this.options.events);
  11165. //if this is the root manager, nothing manages it
  11166. if (Keyboard.manager && !this._manager) Keyboard.manager.manage(this);
  11167. if (this.options.active) this.activate();
  11168. else this.relinquish();
  11169. },
  11170. _handle: function(event, type){
  11171. //Keyboard.stop(event) prevents key propagation
  11172. if (event.preventKeyboardPropagation) return;
  11173. var bubbles = !!this._manager;
  11174. if (bubbles && this._activeKB){
  11175. this._activeKB._handle(event, type);
  11176. if (event.preventKeyboardPropagation) return;
  11177. }
  11178. this.fireEvent(type, event);
  11179. if (!bubbles && this._activeKB) this._activeKB._handle(event, type);
  11180. }
  11181. });
  11182. var parsed = {};
  11183. var modifiers = ['shift', 'control', 'alt', 'meta'];
  11184. var regex = /^(?:shift|control|ctrl|alt|meta)$/;
  11185. Keyboard.parse = function(type, eventType, ignore){
  11186. if (ignore && ignore.contains(type.toLowerCase())) return type;
  11187. type = type.toLowerCase().replace(/^(keyup|keydown):/, function($0, $1){
  11188. eventType = $1;
  11189. return '';
  11190. });
  11191. if (!parsed[type]){
  11192. if (type != '+'){
  11193. var key, mods = {};
  11194. type.split('+').each(function(part){
  11195. if (regex.test(part)) mods[part] = true;
  11196. else key = part;
  11197. });
  11198. mods.control = mods.control || mods.ctrl; // allow both control and ctrl
  11199. var keys = [];
  11200. modifiers.each(function(mod){
  11201. if (mods[mod]) keys.push(mod);
  11202. });
  11203. if (key) keys.push(key);
  11204. parsed[type] = keys.join('+');
  11205. } else {
  11206. parsed[type] = type;
  11207. }
  11208. }
  11209. return eventType + ':keys(' + parsed[type] + ')';
  11210. };
  11211. Keyboard.each = function(keyboard, fn){
  11212. var current = keyboard || Keyboard.manager;
  11213. while (current){
  11214. fn(current);
  11215. current = current._activeKB;
  11216. }
  11217. };
  11218. Keyboard.stop = function(event){
  11219. event.preventKeyboardPropagation = true;
  11220. };
  11221. Keyboard.manager = new Keyboard({
  11222. active: true
  11223. });
  11224. Keyboard.trace = function(keyboard){
  11225. keyboard = keyboard || Keyboard.manager;
  11226. var hasConsole = window.console && console.log;
  11227. if (hasConsole) console.log('the following items have focus: ');
  11228. Keyboard.each(keyboard, function(current){
  11229. if (hasConsole) console.log(document.id(current.widget) || current.wiget || current);
  11230. });
  11231. };
  11232. var handler = function(event){
  11233. var keys = [];
  11234. modifiers.each(function(mod){
  11235. if (event[mod]) keys.push(mod);
  11236. });
  11237. if (!regex.test(event.key)) keys.push(event.key);
  11238. Keyboard.manager._handle(event, event.type + ':keys(' + keys.join('+') + ')');
  11239. };
  11240. document.addEvents({
  11241. 'keyup': handler,
  11242. 'keydown': handler
  11243. });
  11244. })();
  11245. /*
  11246. ---
  11247. script: Keyboard.Extras.js
  11248. name: Keyboard.Extras
  11249. 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.
  11250. license: MIT-style license
  11251. authors:
  11252. - Perrin Westrich
  11253. requires:
  11254. - Keyboard
  11255. - MooTools.More
  11256. provides: [Keyboard.Extras]
  11257. ...
  11258. */
  11259. Keyboard.prototype.options.nonParsedEvents.combine(['rebound', 'onrebound']);
  11260. Keyboard.implement({
  11261. /*
  11262. shortcut should be in the format of:
  11263. {
  11264. 'keys': 'shift+s', // the default to add as an event.
  11265. 'description': 'blah blah blah', // a brief description of the functionality.
  11266. 'handler': function(){} // the event handler to run when keys are pressed.
  11267. }
  11268. */
  11269. addShortcut: function(name, shortcut){
  11270. this._shortcuts = this._shortcuts || [];
  11271. this._shortcutIndex = this._shortcutIndex || {};
  11272. shortcut.getKeyboard = Function.convert(this);
  11273. shortcut.name = name;
  11274. this._shortcutIndex[name] = shortcut;
  11275. this._shortcuts.push(shortcut);
  11276. if (shortcut.keys) this.addEvent(shortcut.keys, shortcut.handler);
  11277. return this;
  11278. },
  11279. addShortcuts: function(obj){
  11280. for (var name in obj) this.addShortcut(name, obj[name]);
  11281. return this;
  11282. },
  11283. removeShortcut: function(name){
  11284. var shortcut = this.getShortcut(name);
  11285. if (shortcut && shortcut.keys){
  11286. this.removeEvent(shortcut.keys, shortcut.handler);
  11287. delete this._shortcutIndex[name];
  11288. this._shortcuts.erase(shortcut);
  11289. }
  11290. return this;
  11291. },
  11292. removeShortcuts: function(names){
  11293. names.each(this.removeShortcut, this);
  11294. return this;
  11295. },
  11296. getShortcuts: function(){
  11297. return this._shortcuts || [];
  11298. },
  11299. getShortcut: function(name){
  11300. return (this._shortcutIndex || {})[name];
  11301. }
  11302. });
  11303. Keyboard.rebind = function(newKeys, shortcuts){
  11304. Array.convert(shortcuts).each(function(shortcut){
  11305. shortcut.getKeyboard().removeEvent(shortcut.keys, shortcut.handler);
  11306. shortcut.getKeyboard().addEvent(newKeys, shortcut.handler);
  11307. shortcut.keys = newKeys;
  11308. shortcut.getKeyboard().fireEvent('rebound');
  11309. });
  11310. };
  11311. Keyboard.getActiveShortcuts = function(keyboard){
  11312. var activeKBS = [], activeSCS = [];
  11313. Keyboard.each(keyboard, [].push.bind(activeKBS));
  11314. activeKBS.each(function(kb){ activeSCS.extend(kb.getShortcuts()); });
  11315. return activeSCS;
  11316. };
  11317. Keyboard.getShortcut = function(name, keyboard, opts){
  11318. opts = opts || {};
  11319. var shortcuts = opts.many ? [] : null,
  11320. set = opts.many ? function(kb){
  11321. var shortcut = kb.getShortcut(name);
  11322. if (shortcut) shortcuts.push(shortcut);
  11323. } : function(kb){
  11324. if (!shortcuts) shortcuts = kb.getShortcut(name);
  11325. };
  11326. Keyboard.each(keyboard, set);
  11327. return shortcuts;
  11328. };
  11329. Keyboard.getShortcuts = function(name, keyboard){
  11330. return Keyboard.getShortcut(name, keyboard, { many: true });
  11331. };
  11332. /*
  11333. ---
  11334. script: HtmlTable.js
  11335. name: HtmlTable
  11336. description: Builds table elements with methods to add rows.
  11337. license: MIT-style license
  11338. authors:
  11339. - Aaron Newton
  11340. requires:
  11341. - Core/Options
  11342. - Core/Events
  11343. - Class.Occlude
  11344. provides: [HtmlTable]
  11345. ...
  11346. */
  11347. (function(){
  11348. var HtmlTable = this.HtmlTable = new Class({
  11349. Implements: [Options, Events, Class.Occlude],
  11350. options: {
  11351. properties: {
  11352. cellpadding: 0,
  11353. cellspacing: 0,
  11354. border: 0
  11355. },
  11356. rows: [],
  11357. headers: [],
  11358. footers: []
  11359. },
  11360. property: 'HtmlTable',
  11361. initialize: function(){
  11362. var params = Array.link(arguments, {options: Type.isObject, table: Type.isElement, id: Type.isString});
  11363. this.setOptions(params.options);
  11364. if (!params.table && params.id) params.table = document.id(params.id);
  11365. this.element = params.table || new Element('table', this.options.properties);
  11366. if (this.occlude()) return this.occluded;
  11367. this.build();
  11368. },
  11369. build: function(){
  11370. this.element.store('HtmlTable', this);
  11371. this.body = document.id(this.element.tBodies[0]) || new Element('tbody').inject(this.element);
  11372. $$(this.body.rows);
  11373. if (this.options.headers.length) this.setHeaders(this.options.headers);
  11374. else this.thead = document.id(this.element.tHead);
  11375. if (this.thead) this.head = this.getHead();
  11376. if (this.options.footers.length) this.setFooters(this.options.footers);
  11377. this.tfoot = document.id(this.element.tFoot);
  11378. if (this.tfoot) this.foot = document.id(this.tfoot.rows[0]);
  11379. this.options.rows.each(function(row){
  11380. this.push(row);
  11381. }, this);
  11382. },
  11383. toElement: function(){
  11384. return this.element;
  11385. },
  11386. empty: function(){
  11387. this.body.empty();
  11388. return this;
  11389. },
  11390. set: function(what, items){
  11391. var target = (what == 'headers') ? 'tHead' : 'tFoot',
  11392. lower = target.toLowerCase();
  11393. this[lower] = (document.id(this.element[target]) || new Element(lower).inject(this.element, 'top')).empty();
  11394. var data = this.push(items, {}, this[lower], what == 'headers' ? 'th' : 'td');
  11395. if (what == 'headers') this.head = this.getHead();
  11396. else this.foot = this.getHead();
  11397. return data;
  11398. },
  11399. getHead: function(){
  11400. var rows = this.thead.rows;
  11401. return rows.length > 1 ? $$(rows) : rows.length ? document.id(rows[0]) : false;
  11402. },
  11403. setHeaders: function(headers){
  11404. this.set('headers', headers);
  11405. return this;
  11406. },
  11407. setFooters: function(footers){
  11408. this.set('footers', footers);
  11409. return this;
  11410. },
  11411. update: function(tr, row, tag){
  11412. var tds = tr.getChildren(tag || 'td'), last = tds.length - 1;
  11413. row.each(function(data, index){
  11414. var td = tds[index] || new Element(tag || 'td').inject(tr),
  11415. content = ((data && Object.prototype.hasOwnProperty.call(data, 'content')) ? data.content : '') || data,
  11416. type = typeOf(content);
  11417. if (data && Object.prototype.hasOwnProperty.call(data, 'properties')) td.set(data.properties);
  11418. if (/(element(s?)|array|collection)/.test(type)) td.empty().adopt(content);
  11419. else td.set('html', content);
  11420. if (index > last) tds.push(td);
  11421. else tds[index] = td;
  11422. });
  11423. return {
  11424. tr: tr,
  11425. tds: tds
  11426. };
  11427. },
  11428. push: function(row, rowProperties, target, tag, where){
  11429. if (typeOf(row) == 'element' && row.get('tag') == 'tr'){
  11430. row.inject(target || this.body, where);
  11431. return {
  11432. tr: row,
  11433. tds: row.getChildren('td')
  11434. };
  11435. }
  11436. return this.update(new Element('tr', rowProperties).inject(target || this.body, where), row, tag);
  11437. },
  11438. pushMany: function(rows, rowProperties, target, tag, where){
  11439. return rows.map(function(row){
  11440. return this.push(row, rowProperties, target, tag, where);
  11441. }, this);
  11442. }
  11443. });
  11444. })();
  11445. ['adopt', 'inject', 'wraps', 'grab', 'replaces', 'dispose'].each(function(method){
  11446. HtmlTable.implement(method, function(){
  11447. this.element[method].apply(this.element, arguments);
  11448. return this;
  11449. });
  11450. });
  11451. /*
  11452. ---
  11453. script: HtmlTable.Select.js
  11454. name: HtmlTable.Select
  11455. description: Builds a stripy, sortable table with methods to add rows. Rows can be selected with the mouse or keyboard navigation.
  11456. license: MIT-style license
  11457. authors:
  11458. - Harald Kirschner
  11459. - Aaron Newton
  11460. requires:
  11461. - Keyboard
  11462. - Keyboard.Extras
  11463. - HtmlTable
  11464. - Class.refactor
  11465. - Element.Delegation.Pseudo
  11466. - Element.Shortcuts
  11467. provides: [HtmlTable.Select]
  11468. ...
  11469. */
  11470. HtmlTable = Class.refactor(HtmlTable, {
  11471. options: {
  11472. /*onRowFocus: function(){},
  11473. onRowUnfocus: function(){},*/
  11474. useKeyboard: true,
  11475. classRowSelected: 'table-tr-selected',
  11476. classRowHovered: 'table-tr-hovered',
  11477. classSelectable: 'table-selectable',
  11478. shiftForMultiSelect: true,
  11479. allowMultiSelect: true,
  11480. selectable: false,
  11481. selectHiddenRows: false
  11482. },
  11483. initialize: function(){
  11484. this.previous.apply(this, arguments);
  11485. if (this.occluded) return this.occluded;
  11486. this.selectedRows = new Elements();
  11487. if (!this.bound) this.bound = {};
  11488. this.bound.mouseleave = this.mouseleave.bind(this);
  11489. this.bound.clickRow = this.clickRow.bind(this);
  11490. this.bound.activateKeyboard = function(){
  11491. if (this.keyboard && this.selectEnabled) this.keyboard.activate();
  11492. }.bind(this);
  11493. if (this.options.selectable) this.enableSelect();
  11494. },
  11495. empty: function(){
  11496. if (this.body.rows.length) this.selectNone();
  11497. return this.previous();
  11498. },
  11499. enableSelect: function(){
  11500. this.selectEnabled = true;
  11501. this.attachSelects();
  11502. this.element.addClass(this.options.classSelectable);
  11503. return this;
  11504. },
  11505. disableSelect: function(){
  11506. this.selectEnabled = false;
  11507. this.attachSelects(false);
  11508. this.element.removeClass(this.options.classSelectable);
  11509. return this;
  11510. },
  11511. push: function(){
  11512. var ret = this.previous.apply(this, arguments);
  11513. this.updateSelects();
  11514. return ret;
  11515. },
  11516. toggleRow: function(row){
  11517. return this[(this.isSelected(row) ? 'de' : '') + 'selectRow'](row);
  11518. },
  11519. selectRow: function(row, _nocheck){
  11520. //private variable _nocheck: boolean whether or not to confirm the row is in the table body
  11521. //added here for optimization when selecting ranges
  11522. if (this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
  11523. if (!this.options.allowMultiSelect) this.selectNone();
  11524. if (!this.isSelected(row)){
  11525. this.selectedRows.push(row);
  11526. row.addClass(this.options.classRowSelected);
  11527. this.fireEvent('rowFocus', [row, this.selectedRows]);
  11528. this.fireEvent('stateChanged');
  11529. }
  11530. this.focused = row;
  11531. document.clearSelection();
  11532. return this;
  11533. },
  11534. isSelected: function(row){
  11535. return this.selectedRows.contains(row);
  11536. },
  11537. getSelected: function(){
  11538. return this.selectedRows;
  11539. },
  11540. serialize: function(){
  11541. var previousSerialization = this.previous.apply(this, arguments) || {};
  11542. if (this.options.selectable){
  11543. previousSerialization.selectedRows = this.selectedRows.map(function(row){
  11544. return Array.indexOf(this.body.rows, row);
  11545. }.bind(this));
  11546. }
  11547. return previousSerialization;
  11548. },
  11549. restore: function(tableState){
  11550. if (this.options.selectable && tableState.selectedRows){
  11551. tableState.selectedRows.each(function(index){
  11552. this.selectRow(this.body.rows[index]);
  11553. }.bind(this));
  11554. }
  11555. this.previous.apply(this, arguments);
  11556. },
  11557. deselectRow: function(row, _nocheck){
  11558. if (!this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return;
  11559. this.selectedRows = new Elements(Array.convert(this.selectedRows).erase(row));
  11560. row.removeClass(this.options.classRowSelected);
  11561. this.fireEvent('rowUnfocus', [row, this.selectedRows]);
  11562. this.fireEvent('stateChanged');
  11563. return this;
  11564. },
  11565. selectAll: function(selectNone){
  11566. if (!selectNone && !this.options.allowMultiSelect) return;
  11567. this.selectRange(0, this.body.rows.length, selectNone);
  11568. return this;
  11569. },
  11570. selectNone: function(){
  11571. return this.selectAll(true);
  11572. },
  11573. selectRange: function(startRow, endRow, _deselect){
  11574. if (!this.options.allowMultiSelect && !_deselect) return;
  11575. var method = _deselect ? 'deselectRow' : 'selectRow',
  11576. rows = Array.clone(this.body.rows);
  11577. if (typeOf(startRow) == 'element') startRow = rows.indexOf(startRow);
  11578. if (typeOf(endRow) == 'element') endRow = rows.indexOf(endRow);
  11579. endRow = endRow < rows.length - 1 ? endRow : rows.length - 1;
  11580. if (endRow < startRow){
  11581. var tmp = startRow;
  11582. startRow = endRow;
  11583. endRow = tmp;
  11584. }
  11585. for (var i = startRow; i <= endRow; i++){
  11586. if (this.options.selectHiddenRows || rows[i].isDisplayed()) this[method](rows[i], true);
  11587. }
  11588. return this;
  11589. },
  11590. deselectRange: function(startRow, endRow){
  11591. this.selectRange(startRow, endRow, true);
  11592. },
  11593. /*
  11594. Private methods:
  11595. */
  11596. enterRow: function(row){
  11597. if (this.hovered) this.hovered = this.leaveRow(this.hovered);
  11598. this.hovered = row.addClass(this.options.classRowHovered);
  11599. },
  11600. leaveRow: function(row){
  11601. row.removeClass(this.options.classRowHovered);
  11602. },
  11603. updateSelects: function(){
  11604. Array.each(this.body.rows, function(row){
  11605. var binders = row.retrieve('binders');
  11606. if (!binders && !this.selectEnabled) return;
  11607. if (!binders){
  11608. binders = {
  11609. mouseenter: this.enterRow.pass([row], this),
  11610. mouseleave: this.leaveRow.pass([row], this)
  11611. };
  11612. row.store('binders', binders);
  11613. }
  11614. if (this.selectEnabled) row.addEvents(binders);
  11615. else row.removeEvents(binders);
  11616. }, this);
  11617. },
  11618. shiftFocus: function(offset, event){
  11619. if (!this.focused) return this.selectRow(this.body.rows[0], event);
  11620. var to = this.getRowByOffset(offset, this.options.selectHiddenRows);
  11621. if (to === null || this.focused == this.body.rows[to]) return this;
  11622. this.toggleRow(this.body.rows[to], event);
  11623. },
  11624. clickRow: function(event, row){
  11625. var selecting = (event.shift || event.meta || event.control) && this.options.shiftForMultiSelect;
  11626. if (!selecting && !(event.rightClick && this.isSelected(row) && this.options.allowMultiSelect)) this.selectNone();
  11627. if (event.rightClick) this.selectRow(row);
  11628. else this.toggleRow(row);
  11629. if (event.shift){
  11630. this.selectRange(this.rangeStart || this.body.rows[0], row, this.rangeStart ? !this.isSelected(row) : true);
  11631. this.focused = row;
  11632. }
  11633. this.rangeStart = row;
  11634. },
  11635. getRowByOffset: function(offset, includeHiddenRows){
  11636. if (!this.focused) return 0;
  11637. var index = Array.indexOf(this.body.rows, this.focused);
  11638. if ((index == 0 && offset < 0) || (index == this.body.rows.length -1 && offset > 0)) return null;
  11639. if (includeHiddenRows){
  11640. index += offset;
  11641. } else {
  11642. var limit = 0,
  11643. count = 0;
  11644. if (offset > 0){
  11645. while (count < offset && index < this.body.rows.length -1){
  11646. if (this.body.rows[++index].isDisplayed()) count++;
  11647. }
  11648. } else {
  11649. while (count > offset && index > 0){
  11650. if (this.body.rows[--index].isDisplayed()) count--;
  11651. }
  11652. }
  11653. }
  11654. return index;
  11655. },
  11656. attachSelects: function(attach){
  11657. attach = attach != null ? attach : true;
  11658. var method = attach ? 'addEvents' : 'removeEvents';
  11659. this.element[method]({
  11660. mouseleave: this.bound.mouseleave,
  11661. click: this.bound.activateKeyboard
  11662. });
  11663. this.body[method]({
  11664. 'click:relay(tr)': this.bound.clickRow,
  11665. 'contextmenu:relay(tr)': this.bound.clickRow
  11666. });
  11667. if (this.options.useKeyboard || this.keyboard){
  11668. if (!this.keyboard) this.keyboard = new Keyboard();
  11669. if (!this.selectKeysDefined){
  11670. this.selectKeysDefined = true;
  11671. var timer, held;
  11672. var move = function(offset){
  11673. var mover = function(e){
  11674. clearTimeout(timer);
  11675. e.preventDefault();
  11676. var to = this.body.rows[this.getRowByOffset(offset, this.options.selectHiddenRows)];
  11677. if (e.shift && to && this.isSelected(to)){
  11678. this.deselectRow(this.focused);
  11679. this.focused = to;
  11680. } else {
  11681. if (to && (!this.options.allowMultiSelect || !e.shift)){
  11682. this.selectNone();
  11683. }
  11684. this.shiftFocus(offset, e);
  11685. }
  11686. if (held){
  11687. timer = mover.delay(100, this, e);
  11688. } else {
  11689. timer = (function(){
  11690. held = true;
  11691. mover(e);
  11692. }).delay(400);
  11693. }
  11694. }.bind(this);
  11695. return mover;
  11696. }.bind(this);
  11697. var clear = function(){
  11698. clearTimeout(timer);
  11699. held = false;
  11700. };
  11701. this.keyboard.addEvents({
  11702. 'keydown:shift+up': move(-1),
  11703. 'keydown:shift+down': move(1),
  11704. 'keyup:shift+up': clear,
  11705. 'keyup:shift+down': clear,
  11706. 'keyup:up': clear,
  11707. 'keyup:down': clear
  11708. });
  11709. var shiftHint = '';
  11710. if (this.options.allowMultiSelect && this.options.shiftForMultiSelect && this.options.useKeyboard){
  11711. shiftHint = ' (Shift multi-selects).';
  11712. }
  11713. this.keyboard.addShortcuts({
  11714. 'Select Previous Row': {
  11715. keys: 'up',
  11716. shortcut: 'up arrow',
  11717. handler: move(-1),
  11718. description: 'Select the previous row in the table.' + shiftHint
  11719. },
  11720. 'Select Next Row': {
  11721. keys: 'down',
  11722. shortcut: 'down arrow',
  11723. handler: move(1),
  11724. description: 'Select the next row in the table.' + shiftHint
  11725. }
  11726. });
  11727. }
  11728. this.keyboard[attach ? 'activate' : 'deactivate']();
  11729. }
  11730. this.updateSelects();
  11731. },
  11732. mouseleave: function(){
  11733. if (this.hovered) this.leaveRow(this.hovered);
  11734. }
  11735. });
  11736. /*
  11737. ---
  11738. script: HtmlTable.Sort.js
  11739. name: HtmlTable.Sort
  11740. description: Builds a stripy, sortable table with methods to add rows.
  11741. license: MIT-style license
  11742. authors:
  11743. - Harald Kirschner
  11744. - Aaron Newton
  11745. - Jacob Thornton
  11746. requires:
  11747. - Core/Hash
  11748. - HtmlTable
  11749. - Class.refactor
  11750. - Element.Delegation.Pseudo
  11751. - String.Extras
  11752. - Date
  11753. provides: [HtmlTable.Sort]
  11754. ...
  11755. */
  11756. (function(){
  11757. var readOnlyNess = document.createElement('table');
  11758. try {
  11759. readOnlyNess.innerHTML = '<tr><td></td></tr>';
  11760. readOnlyNess = readOnlyNess.childNodes.length === 0;
  11761. } catch (e){
  11762. readOnlyNess = true;
  11763. }
  11764. HtmlTable = Class.refactor(HtmlTable, {
  11765. options: {/*
  11766. onSort: function(){}, */
  11767. sortIndex: 0,
  11768. sortReverse: false,
  11769. parsers: [],
  11770. defaultParser: 'string',
  11771. classSortable: 'table-sortable',
  11772. classHeadSort: 'table-th-sort',
  11773. classHeadSortRev: 'table-th-sort-rev',
  11774. classNoSort: 'table-th-nosort',
  11775. classGroupHead: 'table-tr-group-head',
  11776. classGroup: 'table-tr-group',
  11777. classCellSort: 'table-td-sort',
  11778. classSortSpan: 'table-th-sort-span',
  11779. sortable: false,
  11780. thSelector: 'th'
  11781. },
  11782. initialize: function(){
  11783. this.previous.apply(this, arguments);
  11784. if (this.occluded) return this.occluded;
  11785. this.sorted = {index: null, dir: 1};
  11786. if (!this.bound) this.bound = {};
  11787. this.bound.headClick = this.headClick.bind(this);
  11788. this.sortSpans = new Elements();
  11789. if (this.options.sortable){
  11790. this.enableSort();
  11791. if (this.options.sortIndex != null) this.sort(this.options.sortIndex, this.options.sortReverse);
  11792. }
  11793. },
  11794. attachSorts: function(attach){
  11795. this.detachSorts();
  11796. if (attach !== false) this.element.addEvent('click:relay(' + this.options.thSelector + ')', this.bound.headClick);
  11797. },
  11798. detachSorts: function(){
  11799. this.element.removeEvents('click:relay(' + this.options.thSelector + ')');
  11800. },
  11801. setHeaders: function(){
  11802. this.previous.apply(this, arguments);
  11803. if (this.sortable) this.setParsers();
  11804. },
  11805. setParsers: function(){
  11806. this.parsers = this.detectParsers();
  11807. },
  11808. detectParsers: function(){
  11809. return this.head && this.head.getElements(this.options.thSelector).flatten().map(this.detectParser, this);
  11810. },
  11811. detectParser: function(cell, index){
  11812. if (cell.hasClass(this.options.classNoSort) || cell.retrieve('htmltable-parser')) return cell.retrieve('htmltable-parser');
  11813. var thDiv = new Element('div');
  11814. thDiv.adopt(cell.childNodes).inject(cell);
  11815. var sortSpan = new Element('span', {'class': this.options.classSortSpan}).inject(thDiv, 'top');
  11816. this.sortSpans.push(sortSpan);
  11817. var parser = this.options.parsers[index],
  11818. rows = this.body.rows,
  11819. cancel;
  11820. switch (typeOf(parser)){
  11821. case 'function': parser = {convert: parser}; cancel = true; break;
  11822. case 'string': parser = parser; cancel = true; break;
  11823. }
  11824. if (!cancel){
  11825. HtmlTable.ParserPriority.some(function(parserName){
  11826. var current = HtmlTable.Parsers[parserName],
  11827. match = current.match;
  11828. if (!match) return false;
  11829. for (var i = 0, j = rows.length; i < j; i++){
  11830. var cell = document.id(rows[i].cells[index]),
  11831. text = cell ? cell.get('html').clean() : '';
  11832. if (text && match.test(text)){
  11833. parser = current;
  11834. return true;
  11835. }
  11836. }
  11837. });
  11838. }
  11839. if (!parser) parser = this.options.defaultParser;
  11840. cell.store('htmltable-parser', parser);
  11841. return parser;
  11842. },
  11843. headClick: function(event, el){
  11844. if (!this.head || el.hasClass(this.options.classNoSort)) return;
  11845. return this.sort(Array.indexOf(this.head.getElements(this.options.thSelector).flatten(), el) % this.body.rows[0].cells.length);
  11846. },
  11847. serialize: function(){
  11848. var previousSerialization = this.previous.apply(this, arguments) || {};
  11849. if (this.options.sortable){
  11850. previousSerialization.sortIndex = this.sorted.index;
  11851. previousSerialization.sortReverse = this.sorted.reverse;
  11852. }
  11853. return previousSerialization;
  11854. },
  11855. restore: function(tableState){
  11856. if (this.options.sortable && tableState.sortIndex){
  11857. this.sort(tableState.sortIndex, tableState.sortReverse);
  11858. }
  11859. this.previous.apply(this, arguments);
  11860. },
  11861. setSortedState: function(index, reverse){
  11862. if (reverse != null) this.sorted.reverse = reverse;
  11863. else if (this.sorted.index == index) this.sorted.reverse = !this.sorted.reverse;
  11864. else this.sorted.reverse = this.sorted.index == null;
  11865. if (index != null) this.sorted.index = index;
  11866. },
  11867. setHeadSort: function(sorted){
  11868. var head = $$(!this.head.length ? this.head.cells[this.sorted.index] : this.head.map(function(row){
  11869. return row.getElements(this.options.thSelector)[this.sorted.index];
  11870. }, this).clean());
  11871. if (!head.length) return;
  11872. if (sorted){
  11873. head.addClass(this.options.classHeadSort);
  11874. if (this.sorted.reverse) head.addClass(this.options.classHeadSortRev);
  11875. else head.removeClass(this.options.classHeadSortRev);
  11876. } else {
  11877. head.removeClass(this.options.classHeadSort).removeClass(this.options.classHeadSortRev);
  11878. }
  11879. },
  11880. setRowSort: function(data, pre){
  11881. var count = data.length,
  11882. body = this.body,
  11883. group,
  11884. rowIndex;
  11885. while (count){
  11886. var item = data[--count],
  11887. position = item.position,
  11888. row = body.rows[position];
  11889. if (row.disabled) continue;
  11890. if (!pre){
  11891. group = this.setGroupSort(group, row, item);
  11892. this.setRowStyle(row, count);
  11893. }
  11894. body.appendChild(row);
  11895. for (rowIndex = 0; rowIndex < count; rowIndex++){
  11896. if (data[rowIndex].position > position) data[rowIndex].position--;
  11897. }
  11898. }
  11899. },
  11900. setRowStyle: function(row, i){
  11901. this.previous(row, i);
  11902. row.cells[this.sorted.index].addClass(this.options.classCellSort);
  11903. },
  11904. setGroupSort: function(group, row, item){
  11905. if (group == item.value) row.removeClass(this.options.classGroupHead).addClass(this.options.classGroup);
  11906. else row.removeClass(this.options.classGroup).addClass(this.options.classGroupHead);
  11907. return item.value;
  11908. },
  11909. getParser: function(){
  11910. var parser = this.parsers[this.sorted.index];
  11911. return typeOf(parser) == 'string' ? HtmlTable.Parsers[parser] : parser;
  11912. },
  11913. sort: function(index, reverse, pre, sortFunction){
  11914. if (!this.head) return;
  11915. if (!pre){
  11916. this.clearSort();
  11917. this.setSortedState(index, reverse);
  11918. this.setHeadSort(true);
  11919. }
  11920. var parser = this.getParser();
  11921. if (!parser) return;
  11922. var rel;
  11923. if (!readOnlyNess){
  11924. rel = this.body.getParent();
  11925. this.body.dispose();
  11926. }
  11927. var data = this.parseData(parser).sort(sortFunction ? sortFunction : function(a, b){
  11928. if (a.value === b.value) return 0;
  11929. return a.value > b.value ? 1 : -1;
  11930. });
  11931. var reversed = this.sorted.reverse == (parser == HtmlTable.Parsers['input-checked']);
  11932. if (reversed) data.reverse(true);
  11933. this.setRowSort(data, pre);
  11934. if (rel) rel.grab(this.body);
  11935. this.fireEvent('stateChanged');
  11936. return this.fireEvent('sort', [this.body, this.sorted.index, reversed ? 'asc' : 'desc']);
  11937. },
  11938. parseData: function(parser){
  11939. return Array.map(this.body.rows, function(row, i){
  11940. var value = parser.convert.call(document.id(row.cells[this.sorted.index]));
  11941. return {
  11942. position: i,
  11943. value: value
  11944. };
  11945. }, this);
  11946. },
  11947. clearSort: function(){
  11948. this.setHeadSort(false);
  11949. this.body.getElements('td').removeClass(this.options.classCellSort);
  11950. },
  11951. reSort: function(){
  11952. if (this.sortable) this.sort.call(this, this.sorted.index, this.sorted.reverse);
  11953. return this;
  11954. },
  11955. enableSort: function(){
  11956. this.element.addClass(this.options.classSortable);
  11957. this.attachSorts(true);
  11958. this.setParsers();
  11959. this.sortable = true;
  11960. return this;
  11961. },
  11962. disableSort: function(){
  11963. this.element.removeClass(this.options.classSortable);
  11964. this.attachSorts(false);
  11965. this.sortSpans.each(function(span){
  11966. span.destroy();
  11967. });
  11968. this.sortSpans.empty();
  11969. this.sortable = false;
  11970. return this;
  11971. }
  11972. });
  11973. HtmlTable.ParserPriority = ['date', 'input-checked', 'input-value', 'float', 'number'];
  11974. HtmlTable.Parsers = {
  11975. 'date': {
  11976. match: /^\d{2}[-\/ ]\d{2}[-\/ ]\d{2,4}$/,
  11977. convert: function(){
  11978. var d = Date.parse(this.get('text').stripTags());
  11979. return (typeOf(d) == 'date') ? d.format('db') : '';
  11980. },
  11981. type: 'date'
  11982. },
  11983. 'input-checked': {
  11984. match: / type="(radio|checkbox)"/,
  11985. convert: function(){
  11986. return this.getElement('input').checked;
  11987. }
  11988. },
  11989. 'input-value': {
  11990. match: /<input/,
  11991. convert: function(){
  11992. return this.getElement('input').value;
  11993. }
  11994. },
  11995. 'number': {
  11996. match: /^\d+[^\d.,]*$/,
  11997. convert: function(){
  11998. return this.get('text').stripTags().toInt();
  11999. },
  12000. number: true
  12001. },
  12002. 'numberLax': {
  12003. match: /^[^\d]+\d+$/,
  12004. convert: function(){
  12005. return this.get('text').replace(/[^-?^0-9]/, '').stripTags().toInt();
  12006. },
  12007. number: true
  12008. },
  12009. 'float': {
  12010. match: /^[\d]+\.[\d]+/,
  12011. convert: function(){
  12012. return this.get('text').replace(/[^-?^\d.e]/, '').stripTags().toFloat();
  12013. },
  12014. number: true
  12015. },
  12016. 'floatLax': {
  12017. match: /^[^\d]+[\d]+\.[\d]+$/,
  12018. convert: function(){
  12019. return this.get('text').replace(/[^-?^\d.]/, '').stripTags().toFloat();
  12020. },
  12021. number: true
  12022. },
  12023. 'string': {
  12024. match: null,
  12025. convert: function(){
  12026. return this.get('text').stripTags().toLowerCase();
  12027. }
  12028. },
  12029. 'title': {
  12030. match: null,
  12031. convert: function(){
  12032. return this.title;
  12033. }
  12034. }
  12035. };
  12036. //<1.2compat>
  12037. HtmlTable.Parsers = new Hash(HtmlTable.Parsers);
  12038. //</1.2compat>
  12039. HtmlTable.defineParsers = function(parsers){
  12040. HtmlTable.Parsers = Object.append(HtmlTable.Parsers, parsers);
  12041. for (var parser in parsers){
  12042. HtmlTable.ParserPriority.unshift(parser);
  12043. }
  12044. };
  12045. })();
  12046. /*
  12047. ---
  12048. script: HtmlTable.Zebra.js
  12049. name: HtmlTable.Zebra
  12050. description: Builds a stripy table with methods to add rows.
  12051. license: MIT-style license
  12052. authors:
  12053. - Harald Kirschner
  12054. - Aaron Newton
  12055. requires:
  12056. - HtmlTable
  12057. - Element.Shortcuts
  12058. - Class.refactor
  12059. provides: [HtmlTable.Zebra]
  12060. ...
  12061. */
  12062. HtmlTable = Class.refactor(HtmlTable, {
  12063. options: {
  12064. classZebra: 'table-tr-odd',
  12065. zebra: true,
  12066. zebraOnlyVisibleRows: true
  12067. },
  12068. initialize: function(){
  12069. this.previous.apply(this, arguments);
  12070. if (this.occluded) return this.occluded;
  12071. if (this.options.zebra) this.updateZebras();
  12072. },
  12073. updateZebras: function(){
  12074. var index = 0;
  12075. Array.each(this.body.rows, function(row){
  12076. if (!this.options.zebraOnlyVisibleRows || row.isDisplayed()){
  12077. this.zebra(row, index++);
  12078. }
  12079. }, this);
  12080. },
  12081. setRowStyle: function(row, i){
  12082. if (this.previous) this.previous(row, i);
  12083. this.zebra(row, i);
  12084. },
  12085. zebra: function(row, i){
  12086. return row[((i % 2) ? 'remove' : 'add')+'Class'](this.options.classZebra);
  12087. },
  12088. push: function(){
  12089. var pushed = this.previous.apply(this, arguments);
  12090. if (this.options.zebra) this.updateZebras();
  12091. return pushed;
  12092. }
  12093. });
  12094. /*
  12095. ---
  12096. script: Scroller.js
  12097. name: Scroller
  12098. description: Class which scrolls the contents of any Element (including the window) when the mouse reaches the Element's boundaries.
  12099. license: MIT-style license
  12100. authors:
  12101. - Valerio Proietti
  12102. requires:
  12103. - Core/Events
  12104. - Core/Options
  12105. - Core/Element.Event
  12106. - Core/Element.Dimensions
  12107. - MooTools.More
  12108. provides: [Scroller]
  12109. ...
  12110. */
  12111. (function(){
  12112. var Scroller = this.Scroller = new Class({
  12113. Implements: [Events, Options],
  12114. options: {
  12115. area: 20,
  12116. velocity: 1,
  12117. onChange: function(x, y){
  12118. this.element.scrollTo(x, y);
  12119. },
  12120. fps: 50
  12121. },
  12122. initialize: function(element, options){
  12123. this.setOptions(options);
  12124. this.element = document.id(element);
  12125. this.docBody = document.id(this.element.getDocument().body);
  12126. this.listener = (typeOf(this.element) != 'element') ? this.docBody : this.element;
  12127. this.timer = null;
  12128. this.bound = {
  12129. attach: this.attach.bind(this),
  12130. detach: this.detach.bind(this),
  12131. getCoords: this.getCoords.bind(this)
  12132. };
  12133. },
  12134. start: function(){
  12135. this.listener.addEvents({
  12136. mouseover: this.bound.attach,
  12137. mouseleave: this.bound.detach
  12138. });
  12139. return this;
  12140. },
  12141. stop: function(){
  12142. this.listener.removeEvents({
  12143. mouseover: this.bound.attach,
  12144. mouseleave: this.bound.detach
  12145. });
  12146. this.detach();
  12147. this.timer = clearInterval(this.timer);
  12148. return this;
  12149. },
  12150. attach: function(){
  12151. this.listener.addEvent('mousemove', this.bound.getCoords);
  12152. },
  12153. detach: function(){
  12154. this.listener.removeEvent('mousemove', this.bound.getCoords);
  12155. this.timer = clearInterval(this.timer);
  12156. },
  12157. getCoords: function(event){
  12158. this.page = (this.listener.get('tag') == 'body') ? event.client : event.page;
  12159. if (!this.timer) this.timer = this.scroll.periodical(Math.round(1000 / this.options.fps), this);
  12160. },
  12161. scroll: function(){
  12162. var size = this.element.getSize(),
  12163. scroll = this.element.getScroll(),
  12164. pos = ((this.element != this.docBody) && (this.element != window)) ? this.element.getOffsets() : {x: 0, y: 0},
  12165. scrollSize = this.element.getScrollSize(),
  12166. change = {x: 0, y: 0},
  12167. top = this.options.area.top || this.options.area,
  12168. bottom = this.options.area.bottom || this.options.area;
  12169. for (var z in this.page){
  12170. if (this.page[z] < (top + pos[z]) && scroll[z] != 0){
  12171. change[z] = (this.page[z] - top - pos[z]) * this.options.velocity;
  12172. } else if (this.page[z] + bottom > (size[z] + pos[z]) && scroll[z] + size[z] != scrollSize[z]){
  12173. change[z] = (this.page[z] - size[z] + bottom - pos[z]) * this.options.velocity;
  12174. }
  12175. change[z] = change[z].round();
  12176. }
  12177. if (change.y || change.x) this.fireEvent('change', [scroll.x + change.x, scroll.y + change.y]);
  12178. }
  12179. });
  12180. })();
  12181. /*
  12182. ---
  12183. script: Tips.js
  12184. name: Tips
  12185. description: Class for creating nice tips that follow the mouse cursor when hovering an element.
  12186. license: MIT-style license
  12187. authors:
  12188. - Valerio Proietti
  12189. - Christoph Pojer
  12190. - Luis Merino
  12191. requires:
  12192. - Core/Options
  12193. - Core/Events
  12194. - Core/Element.Event
  12195. - Core/Element.Style
  12196. - Core/Element.Dimensions
  12197. - MooTools.More
  12198. provides: [Tips]
  12199. ...
  12200. */
  12201. (function(){
  12202. var read = function(option, element){
  12203. return (option) ? (typeOf(option) == 'function' ? option(element) : element.get(option)) : '';
  12204. };
  12205. var Tips = this.Tips = new Class({
  12206. Implements: [Events, Options],
  12207. options: {/*
  12208. id: null,
  12209. onAttach: function(element){},
  12210. onDetach: function(element){},
  12211. onBound: function(coords){},*/
  12212. onShow: function(){
  12213. this.tip.setStyle('display', 'block');
  12214. },
  12215. onHide: function(){
  12216. this.tip.setStyle('display', 'none');
  12217. },
  12218. title: 'title',
  12219. text: function(element){
  12220. return element.get('rel') || element.get('href');
  12221. },
  12222. showDelay: 100,
  12223. hideDelay: 100,
  12224. className: 'tip-wrap',
  12225. offset: {x: 16, y: 16},
  12226. windowPadding: {x:0, y:0},
  12227. fixed: false,
  12228. waiAria: true,
  12229. hideEmpty: false
  12230. },
  12231. initialize: function(){
  12232. var params = Array.link(arguments, {
  12233. options: Type.isObject,
  12234. elements: function(obj){
  12235. return obj != null;
  12236. }
  12237. });
  12238. this.setOptions(params.options);
  12239. if (params.elements) this.attach(params.elements);
  12240. this.container = new Element('div', {'class': 'tip'});
  12241. if (this.options.id){
  12242. this.container.set('id', this.options.id);
  12243. if (this.options.waiAria) this.attachWaiAria();
  12244. }
  12245. },
  12246. toElement: function(){
  12247. if (this.tip) return this.tip;
  12248. this.tip = new Element('div', {
  12249. 'class': this.options.className,
  12250. styles: {
  12251. position: 'absolute',
  12252. top: 0,
  12253. left: 0,
  12254. display: 'none'
  12255. }
  12256. }).adopt(
  12257. new Element('div', {'class': 'tip-top'}),
  12258. this.container,
  12259. new Element('div', {'class': 'tip-bottom'})
  12260. );
  12261. return this.tip;
  12262. },
  12263. attachWaiAria: function(){
  12264. var id = this.options.id;
  12265. this.container.set('role', 'tooltip');
  12266. if (!this.waiAria){
  12267. this.waiAria = {
  12268. show: function(element){
  12269. if (id) element.set('aria-describedby', id);
  12270. this.container.set('aria-hidden', 'false');
  12271. },
  12272. hide: function(element){
  12273. if (id) element.erase('aria-describedby');
  12274. this.container.set('aria-hidden', 'true');
  12275. }
  12276. };
  12277. }
  12278. this.addEvents(this.waiAria);
  12279. },
  12280. detachWaiAria: function(){
  12281. if (this.waiAria){
  12282. this.container.erase('role');
  12283. this.container.erase('aria-hidden');
  12284. this.removeEvents(this.waiAria);
  12285. }
  12286. },
  12287. attach: function(elements){
  12288. $$(elements).each(function(element){
  12289. var title = read(this.options.title, element),
  12290. text = read(this.options.text, element);
  12291. element.set('title', '').store('tip:native', title).retrieve('tip:title', title);
  12292. element.retrieve('tip:text', text);
  12293. this.fireEvent('attach', [element]);
  12294. var events = ['enter', 'leave'];
  12295. if (!this.options.fixed) events.push('move');
  12296. events.each(function(value){
  12297. var event = element.retrieve('tip:' + value);
  12298. if (!event) event = function(event){
  12299. this['element' + value.capitalize()].apply(this, [event, element]);
  12300. }.bind(this);
  12301. element.store('tip:' + value, event).addEvent('mouse' + value, event);
  12302. }, this);
  12303. }, this);
  12304. return this;
  12305. },
  12306. detach: function(elements){
  12307. $$(elements).each(function(element){
  12308. ['enter', 'leave', 'move'].each(function(value){
  12309. element.removeEvent('mouse' + value, element.retrieve('tip:' + value)).eliminate('tip:' + value);
  12310. });
  12311. this.fireEvent('detach', [element]);
  12312. if (this.options.title == 'title'){ // This is necessary to check if we can revert the title
  12313. var original = element.retrieve('tip:native');
  12314. if (original) element.set('title', original);
  12315. }
  12316. }, this);
  12317. return this;
  12318. },
  12319. elementEnter: function(event, element){
  12320. clearTimeout(this.timer);
  12321. this.timer = (function(){
  12322. this.container.empty();
  12323. var showTip = !this.options.hideEmpty;
  12324. ['title', 'text'].each(function(value){
  12325. var content = element.retrieve('tip:' + value);
  12326. var div = this['_' + value + 'Element'] = new Element('div', {
  12327. 'class': 'tip-' + value
  12328. }).inject(this.container);
  12329. if (content){
  12330. this.fill(div, content);
  12331. showTip = true;
  12332. }
  12333. }, this);
  12334. if (showTip){
  12335. this.show(element);
  12336. } else {
  12337. this.hide(element);
  12338. }
  12339. this.position((this.options.fixed) ? {page: element.getPosition()} : event);
  12340. }).delay(this.options.showDelay, this);
  12341. },
  12342. elementLeave: function(event, element){
  12343. clearTimeout(this.timer);
  12344. this.timer = this.hide.delay(this.options.hideDelay, this, element);
  12345. this.fireForParent(event, element);
  12346. },
  12347. setTitle: function(title){
  12348. if (this._titleElement){
  12349. this._titleElement.empty();
  12350. this.fill(this._titleElement, title);
  12351. }
  12352. return this;
  12353. },
  12354. setText: function(text){
  12355. if (this._textElement){
  12356. this._textElement.empty();
  12357. this.fill(this._textElement, text);
  12358. }
  12359. return this;
  12360. },
  12361. fireForParent: function(event, element){
  12362. element = element.getParent();
  12363. if (!element || element == document.body) return;
  12364. if (element.retrieve('tip:enter')) element.fireEvent('mouseenter', event);
  12365. else this.fireForParent(event, element);
  12366. },
  12367. elementMove: function(event, element){
  12368. this.position(event);
  12369. },
  12370. position: function(event){
  12371. if (!this.tip) document.id(this);
  12372. var size = window.getSize(), scroll = window.getScroll(),
  12373. tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight},
  12374. props = {x: 'left', y: 'top'},
  12375. bounds = {y: false, x2: false, y2: false, x: false},
  12376. obj = {};
  12377. for (var z in props){
  12378. obj[props[z]] = event.page[z] + this.options.offset[z];
  12379. if (obj[props[z]] < 0) bounds[z] = true;
  12380. if ((obj[props[z]] + tip[z] - scroll[z]) > size[z] - this.options.windowPadding[z]){
  12381. obj[props[z]] = event.page[z] - this.options.offset[z] - tip[z];
  12382. bounds[z+'2'] = true;
  12383. }
  12384. }
  12385. this.fireEvent('bound', bounds);
  12386. this.tip.setStyles(obj);
  12387. },
  12388. fill: function(element, contents){
  12389. if (typeof contents == 'string') element.set('html', contents);
  12390. else element.adopt(contents);
  12391. },
  12392. show: function(element){
  12393. if (!this.tip) document.id(this);
  12394. if (!this.tip.getParent()) this.tip.inject(document.body);
  12395. this.fireEvent('show', [this.tip, element]);
  12396. },
  12397. hide: function(element){
  12398. if (!this.tip) document.id(this);
  12399. this.fireEvent('hide', [this.tip, element]);
  12400. }
  12401. });
  12402. })();
  12403. /*
  12404. ---
  12405. name: Locale.CH.Number
  12406. description: Number messages for Switzerland.
  12407. license: MIT-style license
  12408. authors:
  12409. - Kim D. Jeker
  12410. requires:
  12411. - Locale
  12412. provides: [Locale.CH.Number]
  12413. ...
  12414. */
  12415. Locale.define('CH', 'Number', {
  12416. decimal: ',',
  12417. group: '\'',
  12418. currency: {
  12419. decimal: '.',
  12420. suffix: ' CHF'
  12421. }
  12422. });
  12423. /*
  12424. ---
  12425. name: Locale.EU.Number
  12426. description: Number messages for Europe.
  12427. license: MIT-style license
  12428. authors:
  12429. - Arian Stolwijk
  12430. requires:
  12431. - Locale
  12432. provides: [Locale.EU.Number]
  12433. ...
  12434. */
  12435. Locale.define('EU', 'Number', {
  12436. decimal: ',',
  12437. group: '.',
  12438. currency: {
  12439. prefix: '€ '
  12440. }
  12441. });
  12442. /*
  12443. ---
  12444. script: Locale.Set.From.js
  12445. name: Locale.Set.From
  12446. description: Provides an alternative way to create Locale.Set objects.
  12447. license: MIT-style license
  12448. authors:
  12449. - Tim Wienk
  12450. requires:
  12451. - Core/JSON
  12452. - Locale
  12453. provides: Locale.Set.From
  12454. ...
  12455. */
  12456. (function(){
  12457. var parsers = {
  12458. 'json': JSON.decode
  12459. };
  12460. Locale.Set.defineParser = function(name, fn){
  12461. parsers[name] = fn;
  12462. };
  12463. Locale.Set.from = function(set, type){
  12464. if (instanceOf(set, Locale.Set)) return set;
  12465. if (!type && typeOf(set) == 'string') type = 'json';
  12466. if (parsers[type]) set = parsers[type](set);
  12467. var locale = new Locale.Set;
  12468. locale.sets = set.sets || {};
  12469. if (set.inherits){
  12470. locale.inherits.locales = Array.convert(set.inherits.locales);
  12471. locale.inherits.sets = set.inherits.sets || {};
  12472. }
  12473. return locale;
  12474. };
  12475. })();
  12476. /*
  12477. ---
  12478. name: Locale.ZA.Number
  12479. description: Number messages for ZA.
  12480. license: MIT-style license
  12481. authors:
  12482. - Werner Mollentze
  12483. requires:
  12484. - Locale
  12485. provides: [Locale.ZA.Number]
  12486. ...
  12487. */
  12488. Locale.define('ZA', 'Number', {
  12489. decimal: '.',
  12490. group: ',',
  12491. currency: {
  12492. prefix: 'R '
  12493. }
  12494. });
  12495. /*
  12496. ---
  12497. name: Locale.af-ZA.Date
  12498. description: Date messages for ZA Afrikaans.
  12499. license: MIT-style license
  12500. authors:
  12501. - Werner Mollentze
  12502. requires:
  12503. - Locale
  12504. provides: [Locale.af-ZA.Date]
  12505. ...
  12506. */
  12507. Locale.define('af-ZA', 'Date', {
  12508. months: ['Januarie', 'Februarie', 'Maart', 'April', 'Mei', 'Junie', 'Julie', 'Augustus', 'September', 'Oktober', 'November', 'Desember'],
  12509. months_abbr: ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
  12510. days: ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'],
  12511. days_abbr: ['Son', 'Maa', 'Din', 'Woe', 'Don', 'Vry', 'Sat'],
  12512. // Culture's date order: MM/DD/YYYY
  12513. dateOrder: ['date', 'month', 'year'],
  12514. shortDate: '%d-%m-%Y',
  12515. shortTime: '%H:%M',
  12516. AM: 'VM',
  12517. PM: 'NM',
  12518. firstDayOfWeek: 1,
  12519. // Date.Extras
  12520. ordinal: function(dayOfMonth){
  12521. return ((dayOfMonth > 1 && dayOfMonth < 20 && dayOfMonth != 8) || (dayOfMonth > 100 && dayOfMonth.toString().substr(-2, 1) == '1')) ? 'de' : 'ste';
  12522. },
  12523. lessThanMinuteAgo: 'minder as \'n minuut gelede',
  12524. minuteAgo: 'ongeveer \'n minuut gelede',
  12525. minutesAgo: '{delta} minute gelede',
  12526. hourAgo: 'omtret \'n uur gelede',
  12527. hoursAgo: 'ongeveer {delta} ure gelede',
  12528. dayAgo: '1 dag gelede',
  12529. daysAgo: '{delta} dae gelede',
  12530. weekAgo: '1 week gelede',
  12531. weeksAgo: '{delta} weke gelede',
  12532. monthAgo: '1 maand gelede',
  12533. monthsAgo: '{delta} maande gelede',
  12534. yearAgo: '1 jaar gelede',
  12535. yearsAgo: '{delta} jare gelede',
  12536. lessThanMinuteUntil: 'oor minder as \'n minuut',
  12537. minuteUntil: 'oor ongeveer \'n minuut',
  12538. minutesUntil: 'oor {delta} minute',
  12539. hourUntil: 'oor ongeveer \'n uur',
  12540. hoursUntil: 'oor {delta} uur',
  12541. dayUntil: 'oor ongeveer \'n dag',
  12542. daysUntil: 'oor {delta} dae',
  12543. weekUntil: 'oor \'n week',
  12544. weeksUntil: 'oor {delta} weke',
  12545. monthUntil: 'oor \'n maand',
  12546. monthsUntil: 'oor {delta} maande',
  12547. yearUntil: 'oor \'n jaar',
  12548. yearsUntil: 'oor {delta} jaar'
  12549. });
  12550. /*
  12551. ---
  12552. name: Locale.af-ZA.Form.Validator
  12553. description: Form Validator messages for Afrikaans.
  12554. license: MIT-style license
  12555. authors:
  12556. - Werner Mollentze
  12557. requires:
  12558. - Locale
  12559. provides: [Locale.af-ZA.Form.Validator]
  12560. ...
  12561. */
  12562. Locale.define('af-ZA', 'FormValidator', {
  12563. required: 'Hierdie veld word vereis.',
  12564. length: 'Voer asseblief {length} karakters in (u het {elLength} karakters ingevoer)',
  12565. minLength: 'Voer asseblief ten minste {minLength} karakters in (u het {length} karakters ingevoer).',
  12566. maxLength: 'Moet asseblief nie meer as {maxLength} karakters invoer nie (u het {length} karakters ingevoer).',
  12567. integer: 'Voer asseblief \'n heelgetal in hierdie veld in. Getalle met desimale (bv. 1.25) word nie toegelaat nie.',
  12568. numeric: 'Voer asseblief slegs numeriese waardes in hierdie veld in (bv. "1" of "1.1" of "-1" of "-1.1").',
  12569. digits: 'Gebruik asseblief slegs nommers en punktuasie in hierdie veld. (by voorbeeld, \'n telefoon nommer wat koppeltekens en punte bevat is toelaatbaar).',
  12570. alpha: 'Gebruik asseblief slegs letters (a-z) binne-in hierdie veld. Geen spasies of ander karakters word toegelaat nie.',
  12571. alphanum: 'Gebruik asseblief slegs letters (a-z) en nommers (0-9) binne-in hierdie veld. Geen spasies of ander karakters word toegelaat nie.',
  12572. dateSuchAs: 'Voer asseblief \'n geldige datum soos {date} in',
  12573. dateInFormatMDY: 'Voer asseblief \'n geldige datum soos MM/DD/YYYY in (bv. "12/31/1999")',
  12574. email: 'Voer asseblief \'n geldige e-pos adres in. Byvoorbeeld "fred@domain.com".',
  12575. url: 'Voer asseblief \'n geldige bronadres (URL) soos http://www.example.com in.',
  12576. currencyDollar: 'Voer asseblief \'n geldige $ bedrag in. Byvoorbeeld $100.00 .',
  12577. oneRequired: 'Voer asseblief iets in vir ten minste een van hierdie velde.',
  12578. errorPrefix: 'Fout: ',
  12579. warningPrefix: 'Waarskuwing: ',
  12580. // Form.Validator.Extras
  12581. noSpace: 'Daar mag geen spasies in hierdie toevoer wees nie.',
  12582. reqChkByNode: 'Geen items is gekies nie.',
  12583. requiredChk: 'Hierdie veld word vereis.',
  12584. reqChkByName: 'Kies asseblief \'n {label}.',
  12585. match: 'Hierdie veld moet by die {matchName} veld pas',
  12586. startDate: 'die begin datum',
  12587. endDate: 'die eind datum',
  12588. currentDate: 'die huidige datum',
  12589. afterDate: 'Die datum moet dieselfde of na {label} wees.',
  12590. beforeDate: 'Die datum moet dieselfde of voor {label} wees.',
  12591. startMonth: 'Kies asseblief \'n begin maand',
  12592. sameMonth: 'Hierdie twee datums moet in dieselfde maand wees - u moet een of beide verander.',
  12593. creditcard: 'Die ingevoerde kredietkaart nommer is ongeldig. Bevestig asseblief die nommer en probeer weer. {length} syfers is ingevoer.'
  12594. });
  12595. /*
  12596. ---
  12597. name: Locale.af-ZA.Number
  12598. description: Number messages for ZA Afrikaans.
  12599. license: MIT-style license
  12600. authors:
  12601. - Werner Mollentze
  12602. requires:
  12603. - Locale
  12604. - Locale.ZA.Number
  12605. provides: [Locale.af-ZA.Number]
  12606. ...
  12607. */
  12608. Locale.define('af-ZA').inherit('ZA', 'Number');
  12609. /*
  12610. ---
  12611. name: Locale.ar.Date
  12612. description: Date messages for Arabic.
  12613. license: MIT-style license
  12614. authors:
  12615. - Chafik Barbar
  12616. requires:
  12617. - Locale
  12618. provides: [Locale.ar.Date]
  12619. ...
  12620. */
  12621. Locale.define('ar', 'Date', {
  12622. // Culture's date order: DD/MM/YYYY
  12623. dateOrder: ['date', 'month', 'year'],
  12624. shortDate: '%d/%m/%Y',
  12625. shortTime: '%H:%M'
  12626. });
  12627. /*
  12628. ---
  12629. name: Locale.ar.Form.Validator
  12630. description: Form Validator messages for Arabic.
  12631. license: MIT-style license
  12632. authors:
  12633. - Chafik Barbar
  12634. requires:
  12635. - Locale
  12636. provides: [Locale.ar.Form.Validator]
  12637. ...
  12638. */
  12639. Locale.define('ar', 'FormValidator', {
  12640. required: 'هذا الحقل مطلوب.',
  12641. minLength: 'رجاءً إدخال {minLength} أحرف على الأقل (تم إدخال {length} أحرف).',
  12642. maxLength: 'الرجاء عدم إدخال أكثر من {maxLength} أحرف (تم إدخال {length} أحرف).',
  12643. integer: 'الرجاء إدخال عدد صحيح في هذا الحقل. أي رقم ذو كسر عشري أو مئوي (مثال 1.25 ) غير مسموح.',
  12644. numeric: 'الرجاء إدخال قيم رقمية في هذا الحقل (مثال "1" أو "1.1" أو "-1" أو "-1.1").',
  12645. digits: 'الرجاء أستخدام قيم رقمية وعلامات ترقيمية فقط في هذا الحقل (مثال, رقم هاتف مع نقطة أو شحطة)',
  12646. alpha: 'الرجاء أستخدام أحرف فقط (ا-ي) في هذا الحقل. أي فراغات أو علامات غير مسموحة.',
  12647. alphanum: 'الرجاء أستخدام أحرف فقط (ا-ي) أو أرقام (0-9) فقط في هذا الحقل. أي فراغات أو علامات غير مسموحة.',
  12648. dateSuchAs: 'الرجاء إدخال تاريخ صحيح كالتالي {date}',
  12649. dateInFormatMDY: 'الرجاء إدخال تاريخ صحيح (مثال, 31-12-1999)',
  12650. email: 'الرجاء إدخال بريد إلكتروني صحيح.',
  12651. url: 'الرجاء إدخال عنوان إلكتروني صحيح مثل http://www.example.com',
  12652. currencyDollar: 'الرجاء إدخال قيمة $ صحيحة. مثال, 100.00$',
  12653. oneRequired: 'الرجاء إدخال قيمة في أحد هذه الحقول على الأقل.',
  12654. errorPrefix: 'خطأ: ',
  12655. warningPrefix: 'تحذير: '
  12656. });
  12657. /*
  12658. ---
  12659. name: Locale.ca-CA.Date
  12660. description: Date messages for Catalan.
  12661. license: MIT-style license
  12662. authors:
  12663. - Ãlfons Sanchez
  12664. requires:
  12665. - Locale
  12666. provides: [Locale.ca-CA.Date]
  12667. ...
  12668. */
  12669. Locale.define('ca-CA', 'Date', {
  12670. months: ['Gener', 'Febrer', 'Març', 'Abril', 'Maig', 'Juny', 'Juli', 'Agost', 'Setembre', 'Octubre', 'Novembre', 'Desembre'],
  12671. months_abbr: ['gen.', 'febr.', 'març', 'abr.', 'maig', 'juny', 'jul.', 'ag.', 'set.', 'oct.', 'nov.', 'des.'],
  12672. days: ['Diumenge', 'Dilluns', 'Dimarts', 'Dimecres', 'Dijous', 'Divendres', 'Dissabte'],
  12673. days_abbr: ['dg', 'dl', 'dt', 'dc', 'dj', 'dv', 'ds'],
  12674. // Culture's date order: DD/MM/YYYY
  12675. dateOrder: ['date', 'month', 'year'],
  12676. shortDate: '%d/%m/%Y',
  12677. shortTime: '%H:%M',
  12678. AM: 'AM',
  12679. PM: 'PM',
  12680. firstDayOfWeek: 0,
  12681. // Date.Extras
  12682. ordinal: '',
  12683. lessThanMinuteAgo: 'fa menys d`un minut',
  12684. minuteAgo: 'fa un minut',
  12685. minutesAgo: 'fa {delta} minuts',
  12686. hourAgo: 'fa un hora',
  12687. hoursAgo: 'fa unes {delta} hores',
  12688. dayAgo: 'fa un dia',
  12689. daysAgo: 'fa {delta} dies',
  12690. lessThanMinuteUntil: 'menys d`un minut des d`ara',
  12691. minuteUntil: 'un minut des d`ara',
  12692. minutesUntil: '{delta} minuts des d`ara',
  12693. hourUntil: 'un hora des d`ara',
  12694. hoursUntil: 'unes {delta} hores des d`ara',
  12695. dayUntil: '1 dia des d`ara',
  12696. daysUntil: '{delta} dies des d`ara'
  12697. });
  12698. /*
  12699. ---
  12700. name: Locale.ca-CA.Form.Validator
  12701. description: Form Validator messages for Catalan.
  12702. license: MIT-style license
  12703. authors:
  12704. - Miquel Hudin
  12705. - Ãlfons Sanchez
  12706. requires:
  12707. - Locale
  12708. provides: [Locale.ca-CA.Form.Validator]
  12709. ...
  12710. */
  12711. Locale.define('ca-CA', 'FormValidator', {
  12712. required: 'Aquest camp es obligatori.',
  12713. minLength: 'Per favor introdueix al menys {minLength} caracters (has introduit {length} caracters).',
  12714. maxLength: 'Per favor introdueix no mes de {maxLength} caracters (has introduit {length} caracters).',
  12715. integer: 'Per favor introdueix un nombre enter en aquest camp. Nombres amb decimals (p.e. 1,25) no estan permesos.',
  12716. numeric: 'Per favor introdueix sols valors numerics en aquest camp (p.e. "1" o "1,1" o "-1" o "-1,1").',
  12717. digits: 'Per favor usa sols numeros i puntuacio en aquest camp (per exemple, un nombre de telefon amb guions i punts no esta permes).',
  12718. alpha: 'Per favor utilitza lletres nomes (a-z) en aquest camp. No s´admiteixen espais ni altres caracters.',
  12719. alphanum: 'Per favor, utilitza nomes lletres (a-z) o numeros (0-9) en aquest camp. No s´admiteixen espais ni altres caracters.',
  12720. dateSuchAs: 'Per favor introdueix una data valida com {date}',
  12721. dateInFormatMDY: 'Per favor introdueix una data valida com DD/MM/YYYY (p.e. "31/12/1999")',
  12722. email: 'Per favor, introdueix una adreça de correu electronic valida. Per exemple, "fred@domain.com".',
  12723. url: 'Per favor introdueix una URL valida com http://www.example.com.',
  12724. currencyDollar: 'Per favor introdueix una quantitat valida de €. Per exemple €100,00 .',
  12725. oneRequired: 'Per favor introdueix alguna cosa per al menys una d´aquestes entrades.',
  12726. errorPrefix: 'Error: ',
  12727. warningPrefix: 'Avis: ',
  12728. // Form.Validator.Extras
  12729. noSpace: 'No poden haver espais en aquesta entrada.',
  12730. reqChkByNode: 'No hi han elements seleccionats.',
  12731. requiredChk: 'Aquest camp es obligatori.',
  12732. reqChkByName: 'Per favor selecciona una {label}.',
  12733. match: 'Aquest camp necessita coincidir amb el camp {matchName}',
  12734. startDate: 'la data de inici',
  12735. endDate: 'la data de fi',
  12736. currentDate: 'la data actual',
  12737. afterDate: 'La data deu ser igual o posterior a {label}.',
  12738. beforeDate: 'La data deu ser igual o anterior a {label}.',
  12739. startMonth: 'Per favor selecciona un mes d´orige',
  12740. sameMonth: 'Aquestes dos dates deuen estar dins del mateix mes - deus canviar una o altra.'
  12741. });
  12742. /*
  12743. ---
  12744. name: Locale.cs-CZ.Date
  12745. description: Date messages for Czech.
  12746. license: MIT-style license
  12747. authors:
  12748. - Jan Černý chemiX
  12749. - Christopher Zukowski
  12750. requires:
  12751. - Locale
  12752. provides: [Locale.cs-CZ.Date]
  12753. ...
  12754. */
  12755. (function(){
  12756. // Czech language pluralization rules, see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  12757. // one -> n is 1; 1
  12758. // few -> n in 2..4; 2-4
  12759. // other -> everything else 0, 5-999, 1.31, 2.31, 5.31...
  12760. var pluralize = function(n, one, few, other){
  12761. if (n == 1) return one;
  12762. else if (n == 2 || n == 3 || n == 4) return few;
  12763. else return other;
  12764. };
  12765. Locale.define('cs-CZ', 'Date', {
  12766. months: ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'],
  12767. months_abbr: ['ledna', 'února', 'března', 'dubna', 'května', 'června', 'července', 'srpna', 'září', 'října', 'listopadu', 'prosince'],
  12768. days: ['Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'],
  12769. days_abbr: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
  12770. // Culture's date order: DD.MM.YYYY
  12771. dateOrder: ['date', 'month', 'year'],
  12772. shortDate: '%d.%m.%Y',
  12773. shortTime: '%H:%M',
  12774. AM: 'dop.',
  12775. PM: 'odp.',
  12776. firstDayOfWeek: 1,
  12777. // Date.Extras
  12778. ordinal: '.',
  12779. lessThanMinuteAgo: 'před chvílí',
  12780. minuteAgo: 'přibližně před minutou',
  12781. minutesAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'minutou', 'minutami', 'minutami'); },
  12782. hourAgo: 'přibližně před hodinou',
  12783. hoursAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'hodinou', 'hodinami', 'hodinami'); },
  12784. dayAgo: 'před dnem',
  12785. daysAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'dnem', 'dny', 'dny'); },
  12786. weekAgo: 'před týdnem',
  12787. weeksAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'týdnem', 'týdny', 'týdny'); },
  12788. monthAgo: 'před měsícem',
  12789. monthsAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'měsícem', 'měsíci', 'měsíci'); },
  12790. yearAgo: 'před rokem',
  12791. yearsAgo: function(delta){ return 'před {delta} ' + pluralize(delta, 'rokem', 'lety', 'lety'); },
  12792. lessThanMinuteUntil: 'za chvíli',
  12793. minuteUntil: 'přibližně za minutu',
  12794. minutesUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'minutu', 'minuty', 'minut'); },
  12795. hourUntil: 'přibližně za hodinu',
  12796. hoursUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'hodinu', 'hodiny', 'hodin'); },
  12797. dayUntil: 'za den',
  12798. daysUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'den', 'dny', 'dnů'); },
  12799. weekUntil: 'za týden',
  12800. weeksUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'týden', 'týdny', 'týdnů'); },
  12801. monthUntil: 'za měsíc',
  12802. monthsUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'měsíc', 'měsíce', 'měsíců'); },
  12803. yearUntil: 'za rok',
  12804. yearsUntil: function(delta){ return 'za {delta} ' + pluralize(delta, 'rok', 'roky', 'let'); }
  12805. });
  12806. })();
  12807. /*
  12808. ---
  12809. name: Locale.cs-CZ.Form.Validator
  12810. description: Form Validator messages for Czech.
  12811. license: MIT-style license
  12812. authors:
  12813. - Jan Černý chemiX
  12814. requires:
  12815. - Locale
  12816. provides: [Locale.cs-CZ.Form.Validator]
  12817. ...
  12818. */
  12819. Locale.define('cs-CZ', 'FormValidator', {
  12820. required: 'Tato položka je povinná.',
  12821. minLength: 'Zadejte prosím alespoň {minLength} znaků (napsáno {length} znaků).',
  12822. maxLength: 'Zadejte prosím méně než {maxLength} znaků (nápsáno {length} znaků).',
  12823. integer: 'Zadejte prosím celé číslo. Desetinná čísla (např. 1.25) nejsou povolena.',
  12824. numeric: 'Zadejte jen číselné hodnoty (tj. "1" nebo "1.1" nebo "-1" nebo "-1.1").',
  12825. digits: 'Zadejte prosím pouze čísla a interpunkční znaménka(například telefonní číslo s pomlčkami nebo tečkami je povoleno).',
  12826. alpha: 'Zadejte prosím pouze písmena (a-z). Mezery nebo jiné znaky nejsou povoleny.',
  12827. alphanum: 'Zadejte prosím pouze písmena (a-z) nebo číslice (0-9). Mezery nebo jiné znaky nejsou povoleny.',
  12828. dateSuchAs: 'Zadejte prosím platné datum jako {date}',
  12829. dateInFormatMDY: 'Zadejte prosím platné datum jako MM / DD / RRRR (tj. "12/31/1999")',
  12830. email: 'Zadejte prosím platnou e-mailovou adresu. Například "fred@domain.com".',
  12831. url: 'Zadejte prosím platnou URL adresu jako http://www.example.com.',
  12832. currencyDollar: 'Zadejte prosím platnou částku. Například $100.00.',
  12833. oneRequired: 'Zadejte prosím alespoň jednu hodnotu pro tyto položky.',
  12834. errorPrefix: 'Chyba: ',
  12835. warningPrefix: 'Upozornění: ',
  12836. // Form.Validator.Extras
  12837. noSpace: 'V této položce nejsou povoleny mezery',
  12838. reqChkByNode: 'Nejsou vybrány žádné položky.',
  12839. requiredChk: 'Tato položka je vyžadována.',
  12840. reqChkByName: 'Prosím vyberte {label}.',
  12841. match: 'Tato položka se musí shodovat s položkou {matchName}',
  12842. startDate: 'datum zahájení',
  12843. endDate: 'datum ukončení',
  12844. currentDate: 'aktuální datum',
  12845. afterDate: 'Datum by mělo být stejné nebo větší než {label}.',
  12846. beforeDate: 'Datum by mělo být stejné nebo menší než {label}.',
  12847. startMonth: 'Vyberte počáteční měsíc.',
  12848. sameMonth: 'Tyto dva datumy musí být ve stejném měsíci - změňte jeden z nich.',
  12849. creditcard: 'Zadané číslo kreditní karty je neplatné. Prosím opravte ho. Bylo zadáno {length} čísel.'
  12850. });
  12851. /*
  12852. ---
  12853. name: Locale.da-DK.Date
  12854. description: Date messages for Danish.
  12855. license: MIT-style license
  12856. authors:
  12857. - Martin Overgaard
  12858. - Henrik Hansen
  12859. requires:
  12860. - Locale
  12861. provides: [Locale.da-DK.Date]
  12862. ...
  12863. */
  12864. Locale.define('da-DK', 'Date', {
  12865. months: ['Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December'],
  12866. months_abbr: ['jan.', 'feb.', 'mar.', 'apr.', 'maj.', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
  12867. days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
  12868. days_abbr: ['søn', 'man', 'tir', 'ons', 'tor', 'fre', 'lør'],
  12869. // Culture's date order: DD-MM-YYYY
  12870. dateOrder: ['date', 'month', 'year'],
  12871. shortDate: '%d-%m-%Y',
  12872. shortTime: '%H:%M',
  12873. AM: 'AM',
  12874. PM: 'PM',
  12875. firstDayOfWeek: 1,
  12876. // Date.Extras
  12877. ordinal: '.',
  12878. lessThanMinuteAgo: 'mindre end et minut siden',
  12879. minuteAgo: 'omkring et minut siden',
  12880. minutesAgo: '{delta} minutter siden',
  12881. hourAgo: 'omkring en time siden',
  12882. hoursAgo: 'omkring {delta} timer siden',
  12883. dayAgo: '1 dag siden',
  12884. daysAgo: '{delta} dage siden',
  12885. weekAgo: '1 uge siden',
  12886. weeksAgo: '{delta} uger siden',
  12887. monthAgo: '1 måned siden',
  12888. monthsAgo: '{delta} måneder siden',
  12889. yearAgo: '1 år siden',
  12890. yearsAgo: '{delta} år siden',
  12891. lessThanMinuteUntil: 'mindre end et minut fra nu',
  12892. minuteUntil: 'omkring et minut fra nu',
  12893. minutesUntil: '{delta} minutter fra nu',
  12894. hourUntil: 'omkring en time fra nu',
  12895. hoursUntil: 'omkring {delta} timer fra nu',
  12896. dayUntil: '1 dag fra nu',
  12897. daysUntil: '{delta} dage fra nu',
  12898. weekUntil: '1 uge fra nu',
  12899. weeksUntil: '{delta} uger fra nu',
  12900. monthUntil: '1 måned fra nu',
  12901. monthsUntil: '{delta} måneder fra nu',
  12902. yearUntil: '1 år fra nu',
  12903. yearsUntil: '{delta} år fra nu'
  12904. });
  12905. /*
  12906. ---
  12907. name: Locale.da-DK.Form.Validator
  12908. description: Form Validator messages for Danish.
  12909. license: MIT-style license
  12910. authors:
  12911. - Martin Overgaard
  12912. requires:
  12913. - Locale
  12914. provides: [Locale.da-DK.Form.Validator]
  12915. ...
  12916. */
  12917. Locale.define('da-DK', 'FormValidator', {
  12918. required: 'Feltet skal udfyldes.',
  12919. minLength: 'Skriv mindst {minLength} tegn (du skrev {length} tegn).',
  12920. maxLength: 'Skriv maksimalt {maxLength} tegn (du skrev {length} tegn).',
  12921. integer: 'Skriv et tal i dette felt. Decimal tal (f.eks. 1.25) er ikke tilladt.',
  12922. numeric: 'Skriv kun tal i dette felt (i.e. "1" eller "1.1" eller "-1" eller "-1.1").',
  12923. digits: 'Skriv kun tal og tegnsætning i dette felt (eksempel, et telefon nummer med bindestreg eller punktum er tilladt).',
  12924. alpha: 'Skriv kun bogstaver (a-z) i dette felt. Mellemrum og andre tegn er ikke tilladt.',
  12925. alphanum: 'Skriv kun bogstaver (a-z) eller tal (0-9) i dette felt. Mellemrum og andre tegn er ikke tilladt.',
  12926. dateSuchAs: 'Skriv en gyldig dato som {date}',
  12927. dateInFormatMDY: 'Skriv dato i formatet DD-MM-YYYY (f.eks. "31-12-1999")',
  12928. email: 'Skriv en gyldig e-mail adresse. F.eks "fred@domain.com".',
  12929. url: 'Skriv en gyldig URL adresse. F.eks "http://www.example.com".',
  12930. currencyDollar: 'Skriv et gldigt beløb. F.eks Kr.100.00 .',
  12931. oneRequired: 'Et eller flere af felterne i denne formular skal udfyldes.',
  12932. errorPrefix: 'Fejl: ',
  12933. warningPrefix: 'Advarsel: ',
  12934. // Form.Validator.Extras
  12935. noSpace: 'Der må ikke benyttes mellemrum i dette felt.',
  12936. reqChkByNode: 'Foretag et valg.',
  12937. requiredChk: 'Dette felt skal udfyldes.',
  12938. reqChkByName: 'Vælg en {label}.',
  12939. match: 'Dette felt skal matche {matchName} feltet',
  12940. startDate: 'start dato',
  12941. endDate: 'slut dato',
  12942. currentDate: 'dags dato',
  12943. afterDate: 'Datoen skal være større end eller lig med {label}.',
  12944. beforeDate: 'Datoen skal være mindre end eller lig med {label}.',
  12945. startMonth: 'Vælg en start måned',
  12946. sameMonth: 'De valgte datoer skal være i samme måned - skift en af dem.'
  12947. });
  12948. /*
  12949. ---
  12950. name: Locale.de-DE.Date
  12951. description: Date messages for German.
  12952. license: MIT-style license
  12953. authors:
  12954. - Christoph Pojer
  12955. - Frank Rossi
  12956. - Ulrich Petri
  12957. - Fabian Beiner
  12958. requires:
  12959. - Locale
  12960. provides: [Locale.de-DE.Date]
  12961. ...
  12962. */
  12963. Locale.define('de-DE', 'Date', {
  12964. months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
  12965. months_abbr: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
  12966. days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
  12967. days_abbr: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
  12968. // Culture's date order: DD.MM.YYYY
  12969. dateOrder: ['date', 'month', 'year'],
  12970. shortDate: '%d.%m.%Y',
  12971. shortTime: '%H:%M',
  12972. AM: 'vormittags',
  12973. PM: 'nachmittags',
  12974. firstDayOfWeek: 1,
  12975. // Date.Extras
  12976. ordinal: '.',
  12977. lessThanMinuteAgo: 'vor weniger als einer Minute',
  12978. minuteAgo: 'vor einer Minute',
  12979. minutesAgo: 'vor {delta} Minuten',
  12980. hourAgo: 'vor einer Stunde',
  12981. hoursAgo: 'vor {delta} Stunden',
  12982. dayAgo: 'vor einem Tag',
  12983. daysAgo: 'vor {delta} Tagen',
  12984. weekAgo: 'vor einer Woche',
  12985. weeksAgo: 'vor {delta} Wochen',
  12986. monthAgo: 'vor einem Monat',
  12987. monthsAgo: 'vor {delta} Monaten',
  12988. yearAgo: 'vor einem Jahr',
  12989. yearsAgo: 'vor {delta} Jahren',
  12990. lessThanMinuteUntil: 'in weniger als einer Minute',
  12991. minuteUntil: 'in einer Minute',
  12992. minutesUntil: 'in {delta} Minuten',
  12993. hourUntil: 'in ca. einer Stunde',
  12994. hoursUntil: 'in ca. {delta} Stunden',
  12995. dayUntil: 'in einem Tag',
  12996. daysUntil: 'in {delta} Tagen',
  12997. weekUntil: 'in einer Woche',
  12998. weeksUntil: 'in {delta} Wochen',
  12999. monthUntil: 'in einem Monat',
  13000. monthsUntil: 'in {delta} Monaten',
  13001. yearUntil: 'in einem Jahr',
  13002. yearsUntil: 'in {delta} Jahren'
  13003. });
  13004. /*
  13005. ---
  13006. name: Locale.de-CH.Date
  13007. description: Date messages for German (Switzerland).
  13008. license: MIT-style license
  13009. authors:
  13010. - Michael van der Weg
  13011. requires:
  13012. - Locale
  13013. - Locale.de-DE.Date
  13014. provides: [Locale.de-CH.Date]
  13015. ...
  13016. */
  13017. Locale.define('de-CH').inherit('de-DE', 'Date');
  13018. /*
  13019. ---
  13020. name: Locale.de-CH.Form.Validator
  13021. description: Form Validator messages for German (Switzerland).
  13022. license: MIT-style license
  13023. authors:
  13024. - Michael van der Weg
  13025. requires:
  13026. - Locale
  13027. provides: [Locale.de-CH.Form.Validator]
  13028. ...
  13029. */
  13030. Locale.define('de-CH', 'FormValidator', {
  13031. required: 'Dieses Feld ist obligatorisch.',
  13032. minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13033. maxLength: 'Bitte geben Sie nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13034. integer: 'Geben Sie bitte eine ganze Zahl ein. Dezimalzahlen (z.B. 1.25) sind nicht erlaubt.',
  13035. 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;).',
  13036. digits: 'Benutzen Sie bitte nur Zahlen und Satzzeichen in diesem Eingabefeld (erlaubt ist z.B. eine Telefonnummer mit Bindestrichen und Punkten).',
  13037. alpha: 'Benutzen Sie bitte nur Buchstaben (a-z) in diesem Feld. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13038. alphanum: 'Benutzen Sie bitte nur Buchstaben (a-z) und Zahlen (0-9) in diesem Eingabefeld. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13039. dateSuchAs: 'Geben Sie bitte ein g&uuml;ltiges Datum ein. Wie zum Beispiel {date}',
  13040. dateInFormatMDY: 'Geben Sie bitte ein g&uuml;ltiges Datum ein. Wie zum Beispiel TT.MM.JJJJ (z.B. &quot;31.12.1999&quot;)',
  13041. email: 'Geben Sie bitte eine g&uuml;ltige E-Mail Adresse ein. Wie zum Beispiel &quot;maria@bernasconi.ch&quot;.',
  13042. url: 'Geben Sie bitte eine g&uuml;ltige URL ein. Wie zum Beispiel http://www.example.com.',
  13043. currencyDollar: 'Geben Sie bitte einen g&uuml;ltigen Betrag in Schweizer Franken ein. Wie zum Beispiel 100.00 CHF .',
  13044. oneRequired: 'Machen Sie f&uuml;r mindestens eines der Eingabefelder einen Eintrag.',
  13045. errorPrefix: 'Fehler: ',
  13046. warningPrefix: 'Warnung: ',
  13047. // Form.Validator.Extras
  13048. noSpace: 'In diesem Eingabefeld darf kein Leerzeichen sein.',
  13049. reqChkByNode: 'Es wurden keine Elemente gew&auml;hlt.',
  13050. requiredChk: 'Dieses Feld ist obligatorisch.',
  13051. reqChkByName: 'Bitte w&auml;hlen Sie ein {label}.',
  13052. match: 'Dieses Eingabefeld muss mit dem Feld {matchName} &uuml;bereinstimmen.',
  13053. startDate: 'Das Anfangsdatum',
  13054. endDate: 'Das Enddatum',
  13055. currentDate: 'Das aktuelle Datum',
  13056. afterDate: 'Das Datum sollte zur gleichen Zeit oder sp&auml;ter sein {label}.',
  13057. beforeDate: 'Das Datum sollte zur gleichen Zeit oder fr&uuml;her sein {label}.',
  13058. startMonth: 'W&auml;hlen Sie bitte einen Anfangsmonat',
  13059. sameMonth: 'Diese zwei Datumsangaben m&uuml;ssen im selben Monat sein - Sie m&uuml;ssen eine von beiden ver&auml;ndern.',
  13060. creditcard: 'Die eingegebene Kreditkartennummer ist ung&uuml;ltig. Bitte &uuml;berpr&uuml;fen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.'
  13061. });
  13062. /*
  13063. ---
  13064. name: Locale.de-CH.Number
  13065. description: Number messages for Switzerland.
  13066. license: MIT-style license
  13067. authors:
  13068. - Kim D. Jeker
  13069. requires:
  13070. - Locale
  13071. - Locale.CH.Number
  13072. provides: [Locale.de-CH.Number]
  13073. ...
  13074. */
  13075. Locale.define('de-CH').inherit('CH', 'Number');
  13076. /*
  13077. ---
  13078. name: Locale.de-DE.Form.Validator
  13079. description: Form Validator messages for German.
  13080. license: MIT-style license
  13081. authors:
  13082. - Frank Rossi
  13083. - Ulrich Petri
  13084. - Fabian Beiner
  13085. requires:
  13086. - Locale
  13087. provides: [Locale.de-DE.Form.Validator]
  13088. ...
  13089. */
  13090. Locale.define('de-DE', 'FormValidator', {
  13091. required: 'Dieses Eingabefeld muss ausgefüllt werden.',
  13092. minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben nur {length} Zeichen eingegeben).',
  13093. maxLength: 'Geben Sie bitte nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).',
  13094. integer: 'Geben Sie in diesem Eingabefeld bitte eine ganze Zahl ein. Dezimalzahlen (z.B. "1.25") sind nicht erlaubt.',
  13095. numeric: 'Geben Sie in diesem Eingabefeld bitte nur Zahlenwerte (z.B. "1", "1.1", "-1" oder "-1.1") ein.',
  13096. digits: 'Geben Sie in diesem Eingabefeld bitte nur Zahlen und Satzzeichen ein (z.B. eine Telefonnummer mit Bindestrichen und Punkten ist erlaubt).',
  13097. alpha: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) ein. Leerzeichen und andere Zeichen sind nicht erlaubt.',
  13098. alphanum: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) und Zahlen (0-9) ein. Leerzeichen oder andere Zeichen sind nicht erlaubt.',
  13099. dateSuchAs: 'Geben Sie bitte ein gültiges Datum ein (z.B. "{date}").',
  13100. dateInFormatMDY: 'Geben Sie bitte ein gültiges Datum im Format TT.MM.JJJJ ein (z.B. "31.12.1999").',
  13101. email: 'Geben Sie bitte eine gültige E-Mail-Adresse ein (z.B. "max@mustermann.de").',
  13102. url: 'Geben Sie bitte eine gültige URL ein (z.B. "http://www.example.com").',
  13103. currencyDollar: 'Geben Sie bitte einen gültigen Betrag in EURO ein (z.B. 100.00€).',
  13104. oneRequired: 'Bitte füllen Sie mindestens ein Eingabefeld aus.',
  13105. errorPrefix: 'Fehler: ',
  13106. warningPrefix: 'Warnung: ',
  13107. // Form.Validator.Extras
  13108. noSpace: 'Es darf kein Leerzeichen in diesem Eingabefeld sein.',
  13109. reqChkByNode: 'Es wurden keine Elemente gewählt.',
  13110. requiredChk: 'Dieses Feld muss ausgefüllt werden.',
  13111. reqChkByName: 'Bitte wählen Sie ein {label}.',
  13112. match: 'Dieses Eingabefeld muss mit dem {matchName} Eingabefeld übereinstimmen.',
  13113. startDate: 'Das Anfangsdatum',
  13114. endDate: 'Das Enddatum',
  13115. currentDate: 'Das aktuelle Datum',
  13116. afterDate: 'Das Datum sollte zur gleichen Zeit oder später sein als {label}.',
  13117. beforeDate: 'Das Datum sollte zur gleichen Zeit oder früher sein als {label}.',
  13118. startMonth: 'Wählen Sie bitte einen Anfangsmonat',
  13119. sameMonth: 'Diese zwei Datumsangaben müssen im selben Monat sein - Sie müssen eines von beiden verändern.',
  13120. creditcard: 'Die eingegebene Kreditkartennummer ist ungültig. Bitte überprüfen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.'
  13121. });
  13122. /*
  13123. ---
  13124. name: Locale.de-DE.Number
  13125. description: Number messages for German.
  13126. license: MIT-style license
  13127. authors:
  13128. - Christoph Pojer
  13129. requires:
  13130. - Locale
  13131. - Locale.EU.Number
  13132. provides: [Locale.de-DE.Number]
  13133. ...
  13134. */
  13135. Locale.define('de-DE').inherit('EU', 'Number');
  13136. /*
  13137. ---
  13138. name: Locale.el-GR.Date
  13139. description: Date messages for Greek language.
  13140. license: MIT-style license
  13141. authors:
  13142. - Periklis Argiriadis
  13143. requires:
  13144. - Locale
  13145. provides: [Locale.el-GR.Date]
  13146. ...
  13147. */
  13148. Locale.define('el-GR', 'Date', {
  13149. months: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
  13150. months_abbr: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μάι', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
  13151. days: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
  13152. days_abbr: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'],
  13153. // Culture's date order: DD/MM/YYYY
  13154. dateOrder: ['date', 'month', 'year'],
  13155. shortDate: '%d/%m/%Y',
  13156. shortTime: '%I:%M%p',
  13157. AM: 'πμ',
  13158. PM: 'μμ',
  13159. firstDayOfWeek: 1,
  13160. // Date.Extras
  13161. ordinal: function(dayOfMonth){
  13162. // 1st, 2nd, 3rd, etc.
  13163. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ος' : ['ος'][Math.min(dayOfMonth % 10, 4)];
  13164. },
  13165. lessThanMinuteAgo: 'λιγότερο από ένα λεπτό πριν',
  13166. minuteAgo: 'περίπου ένα λεπτό πριν',
  13167. minutesAgo: '{delta} λεπτά πριν',
  13168. hourAgo: 'περίπου μια ώρα πριν',
  13169. hoursAgo: 'περίπου {delta} ώρες πριν',
  13170. dayAgo: '1 ημέρα πριν',
  13171. daysAgo: '{delta} ημέρες πριν',
  13172. weekAgo: '1 εβδομάδα πριν',
  13173. weeksAgo: '{delta} εβδομάδες πριν',
  13174. monthAgo: '1 μήνα πριν',
  13175. monthsAgo: '{delta} μήνες πριν',
  13176. yearAgo: '1 χρόνο πριν',
  13177. yearsAgo: '{delta} χρόνια πριν',
  13178. lessThanMinuteUntil: 'λιγότερο από λεπτό από τώρα',
  13179. minuteUntil: 'περίπου ένα λεπτό από τώρα',
  13180. minutesUntil: '{delta} λεπτά από τώρα',
  13181. hourUntil: 'περίπου μια ώρα από τώρα',
  13182. hoursUntil: 'περίπου {delta} ώρες από τώρα',
  13183. dayUntil: '1 ημέρα από τώρα',
  13184. daysUntil: '{delta} ημέρες από τώρα',
  13185. weekUntil: '1 εβδομάδα από τώρα',
  13186. weeksUntil: '{delta} εβδομάδες από τώρα',
  13187. monthUntil: '1 μήνας από τώρα',
  13188. monthsUntil: '{delta} μήνες από τώρα',
  13189. yearUntil: '1 χρόνος από τώρα',
  13190. yearsUntil: '{delta} χρόνια από τώρα'
  13191. });
  13192. /*
  13193. ---
  13194. name: Locale.el-GR.Form.Validator
  13195. description: Form Validator messages for Greek language.
  13196. license: MIT-style license
  13197. authors:
  13198. - Dimitris Tsironis
  13199. requires:
  13200. - Locale
  13201. provides: [Locale.el-GR.Form.Validator]
  13202. ...
  13203. */
  13204. Locale.define('el-GR', 'FormValidator', {
  13205. required: 'Αυτό το πεδίο είναι απαραίτητο.',
  13206. length: 'Παρακαλούμε, εισάγετε {length} χαρακτήρες (έχετε ήδη εισάγει {elLength} χαρακτήρες).',
  13207. minLength: 'Παρακαλούμε, εισάγετε τουλάχιστον {minLength} χαρακτήρες (έχετε ήδη εισάγε {length} χαρακτήρες).',
  13208. maxlength: 'Παρακαλούμε, εισάγετε εώς {maxlength} χαρακτήρες (έχετε ήδη εισάγε {length} χαρακτήρες).',
  13209. integer: 'Παρακαλούμε, εισάγετε έναν ακέραιο αριθμό σε αυτό το πεδίο. Οι αριθμοί με δεκαδικά ψηφία (π.χ. 1.25) δεν επιτρέπονται.',
  13210. numeric: 'Παρακαλούμε, εισάγετε μόνο αριθμητικές τιμές σε αυτό το πεδίο (π.χ." 1 " ή " 1.1 " ή " -1 " ή " -1.1 " ).',
  13211. digits: 'Παρακαλούμε, χρησιμοποιήστε μόνο αριθμούς και σημεία στίξης σε αυτόν τον τομέα (π.χ. επιτρέπεται αριθμός τηλεφώνου με παύλες ή τελείες).',
  13212. alpha: 'Παρακαλούμε, χρησιμοποιήστε μόνο γράμματα (a-z) σε αυτό το πεδίο. Δεν επιτρέπονται κενά ή άλλοι χαρακτήρες.',
  13213. alphanum: 'Παρακαλούμε, χρησιμοποιήστε μόνο γράμματα (a-z) ή αριθμούς (0-9) σε αυτόν τον τομέα. Δεν επιτρέπονται κενά ή άλλοι χαρακτήρες.',
  13214. dateSuchAs: 'Παρακαλούμε, εισάγετε μια έγκυρη ημερομηνία, όπως {date}',
  13215. dateInFormatMDY: 'Παρακαλώ εισάγετε μια έγκυρη ημερομηνία, όπως ΜΜ/ΗΗ/ΕΕΕΕ (π.χ. "12/31/1999").',
  13216. email: 'Παρακαλούμε, εισάγετε μια έγκυρη διεύθυνση ηλεκτρονικού ταχυδρομείου (π.χ. "fred@domain.com").',
  13217. url: 'Παρακαλούμε, εισάγετε μια έγκυρη URL διεύθυνση, όπως http://www.example.com',
  13218. currencyDollar: 'Παρακαλούμε, εισάγετε ένα έγκυρο ποσό σε δολλάρια (π.χ. $100.00).',
  13219. oneRequired: 'Παρακαλούμε, εισάγετε κάτι για τουλάχιστον ένα από αυτά τα πεδία.',
  13220. errorPrefix: 'Σφάλμα: ',
  13221. warningPrefix: 'Προσοχή: ',
  13222. // Form.Validator.Extras
  13223. noSpace: 'Δεν επιτρέπονται τα κενά σε αυτό το πεδίο.',
  13224. reqChkByNode: 'Δεν έχει επιλεγεί κάποιο αντικείμενο',
  13225. requiredChk: 'Αυτό το πεδίο είναι απαραίτητο.',
  13226. reqChkByName: 'Παρακαλούμε, επιλέξτε μια ετικέτα {label}.',
  13227. match: 'Αυτό το πεδίο πρέπει να ταιριάζει με το πεδίο {matchName}.',
  13228. startDate: 'η ημερομηνία έναρξης',
  13229. endDate: 'η ημερομηνία λήξης',
  13230. currentDate: 'η τρέχουσα ημερομηνία',
  13231. afterDate: 'Η ημερομηνία πρέπει να είναι η ίδια ή μετά από την {label}.',
  13232. beforeDate: 'Η ημερομηνία πρέπει να είναι η ίδια ή πριν από την {label}.',
  13233. startMonth: 'Παρακαλώ επιλέξτε ένα μήνα αρχής.',
  13234. sameMonth: 'Αυτές οι δύο ημερομηνίες πρέπει να έχουν τον ίδιο μήνα - θα πρέπει να αλλάξετε ή το ένα ή το άλλο',
  13235. creditcard: 'Ο αριθμός της πιστωτικής κάρτας δεν είναι έγκυρος. Παρακαλούμε ελέγξτε τον αριθμό και δοκιμάστε ξανά. {length} μήκος ψηφίων.'
  13236. });
  13237. /*
  13238. ---
  13239. name: Locale.en-GB.Date
  13240. description: Date messages for British English.
  13241. license: MIT-style license
  13242. authors:
  13243. - Aaron Newton
  13244. requires:
  13245. - Locale
  13246. - Locale.en-US.Date
  13247. provides: [Locale.en-GB.Date]
  13248. ...
  13249. */
  13250. Locale.define('en-GB', 'Date', {
  13251. // Culture's date order: DD/MM/YYYY
  13252. dateOrder: ['date', 'month', 'year'],
  13253. shortDate: '%d/%m/%Y',
  13254. shortTime: '%H:%M'
  13255. }).inherit('en-US', 'Date');
  13256. /*
  13257. ---
  13258. name: Locale.en-US.Number
  13259. description: Number messages for US English.
  13260. license: MIT-style license
  13261. authors:
  13262. - Arian Stolwijk
  13263. requires:
  13264. - Locale
  13265. provides: [Locale.en-US.Number]
  13266. ...
  13267. */
  13268. Locale.define('en-US', 'Number', {
  13269. decimal: '.',
  13270. group: ',',
  13271. /* Commented properties are the defaults for Number.format
  13272. decimals: 0,
  13273. precision: 0,
  13274. scientific: null,
  13275. prefix: null,
  13276. suffic: null,
  13277. // Negative/Currency/percentage will mixin Number
  13278. negative: {
  13279. prefix: '-'
  13280. },*/
  13281. currency: {
  13282. // decimals: 2,
  13283. prefix: '$ '
  13284. }/*,
  13285. percentage: {
  13286. decimals: 2,
  13287. suffix: '%'
  13288. }*/
  13289. });
  13290. /*
  13291. ---
  13292. name: Locale.es-ES.Date
  13293. description: Date messages for Spanish.
  13294. license: MIT-style license
  13295. authors:
  13296. - Ãlfons Sanchez
  13297. requires:
  13298. - Locale
  13299. provides: [Locale.es-ES.Date]
  13300. ...
  13301. */
  13302. Locale.define('es-ES', 'Date', {
  13303. months: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
  13304. months_abbr: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'],
  13305. days: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
  13306. days_abbr: ['dom', 'lun', 'mar', 'mié', 'juv', 'vie', 'sáb'],
  13307. // Culture's date order: DD/MM/YYYY
  13308. dateOrder: ['date', 'month', 'year'],
  13309. shortDate: '%d/%m/%Y',
  13310. shortTime: '%H:%M',
  13311. AM: 'AM',
  13312. PM: 'PM',
  13313. firstDayOfWeek: 1,
  13314. // Date.Extras
  13315. ordinal: '',
  13316. lessThanMinuteAgo: 'hace menos de un minuto',
  13317. minuteAgo: 'hace un minuto',
  13318. minutesAgo: 'hace {delta} minutos',
  13319. hourAgo: 'hace una hora',
  13320. hoursAgo: 'hace unas {delta} horas',
  13321. dayAgo: 'hace un día',
  13322. daysAgo: 'hace {delta} días',
  13323. weekAgo: 'hace una semana',
  13324. weeksAgo: 'hace unas {delta} semanas',
  13325. monthAgo: 'hace un mes',
  13326. monthsAgo: 'hace {delta} meses',
  13327. yearAgo: 'hace un año',
  13328. yearsAgo: 'hace {delta} años',
  13329. lessThanMinuteUntil: 'menos de un minuto desde ahora',
  13330. minuteUntil: 'un minuto desde ahora',
  13331. minutesUntil: '{delta} minutos desde ahora',
  13332. hourUntil: 'una hora desde ahora',
  13333. hoursUntil: 'unas {delta} horas desde ahora',
  13334. dayUntil: 'un día desde ahora',
  13335. daysUntil: '{delta} días desde ahora',
  13336. weekUntil: 'una semana desde ahora',
  13337. weeksUntil: 'unas {delta} semanas desde ahora',
  13338. monthUntil: 'un mes desde ahora',
  13339. monthsUntil: '{delta} meses desde ahora',
  13340. yearUntil: 'un año desde ahora',
  13341. yearsUntil: '{delta} años desde ahora'
  13342. });
  13343. /*
  13344. ---
  13345. name: Locale.es-AR.Date
  13346. description: Date messages for Spanish (Argentina).
  13347. license: MIT-style license
  13348. authors:
  13349. - Ãlfons Sanchez
  13350. - Diego Massanti
  13351. requires:
  13352. - Locale
  13353. - Locale.es-ES.Date
  13354. provides: [Locale.es-AR.Date]
  13355. ...
  13356. */
  13357. Locale.define('es-AR').inherit('es-ES', 'Date');
  13358. /*
  13359. ---
  13360. name: Locale.es-AR.Form.Validator
  13361. description: Form Validator messages for Spanish (Argentina).
  13362. license: MIT-style license
  13363. authors:
  13364. - Diego Massanti
  13365. requires:
  13366. - Locale
  13367. provides: [Locale.es-AR.Form.Validator]
  13368. ...
  13369. */
  13370. Locale.define('es-AR', 'FormValidator', {
  13371. required: 'Este campo es obligatorio.',
  13372. minLength: 'Por favor ingrese al menos {minLength} caracteres (ha ingresado {length} caracteres).',
  13373. maxLength: 'Por favor no ingrese más de {maxLength} caracteres (ha ingresado {length} caracteres).',
  13374. integer: 'Por favor ingrese un número entero en este campo. Números con decimales (p.e. 1,25) no se permiten.',
  13375. numeric: 'Por favor ingrese solo valores numéricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',
  13376. 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).',
  13377. alpha: 'Por favor use sólo letras (a-z) en este campo. No se permiten espacios ni otros caracteres.',
  13378. alphanum: 'Por favor, usa sólo letras (a-z) o números (0-9) en este campo. No se permiten espacios u otros caracteres.',
  13379. dateSuchAs: 'Por favor ingrese una fecha válida como {date}',
  13380. dateInFormatMDY: 'Por favor ingrese una fecha válida, utulizando el formato DD/MM/YYYY (p.e. "31/12/1999")',
  13381. email: 'Por favor, ingrese una dirección de e-mail válida. Por ejemplo, "fred@dominio.com".',
  13382. url: 'Por favor ingrese una URL válida como http://www.example.com.',
  13383. currencyDollar: 'Por favor ingrese una cantidad válida de pesos. Por ejemplo $100,00 .',
  13384. oneRequired: 'Por favor ingrese algo para por lo menos una de estas entradas.',
  13385. errorPrefix: 'Error: ',
  13386. warningPrefix: 'Advertencia: ',
  13387. // Form.Validator.Extras
  13388. noSpace: 'No se permiten espacios en este campo.',
  13389. reqChkByNode: 'No hay elementos seleccionados.',
  13390. requiredChk: 'Este campo es obligatorio.',
  13391. reqChkByName: 'Por favor selecciona una {label}.',
  13392. match: 'Este campo necesita coincidir con el campo {matchName}',
  13393. startDate: 'la fecha de inicio',
  13394. endDate: 'la fecha de fin',
  13395. currentDate: 'la fecha actual',
  13396. afterDate: 'La fecha debe ser igual o posterior a {label}.',
  13397. beforeDate: 'La fecha debe ser igual o anterior a {label}.',
  13398. startMonth: 'Por favor selecciona un mes de origen',
  13399. sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.'
  13400. });
  13401. /*
  13402. ---
  13403. name: Locale.es-AR.Number
  13404. description: Number messages for es Argentina.
  13405. license: MIT-style license
  13406. authors:
  13407. - Oscar Kuchuk
  13408. requires:
  13409. - Locale
  13410. provides: [Locale.es-AR.Number]
  13411. ...
  13412. */
  13413. Locale.define('es-AR', 'Number', {
  13414. decimal: ',',
  13415. group: '.',
  13416. /* Commented properties are the defaults for Number.format
  13417. decimals: 0,
  13418. precision: 0,
  13419. scientific: null,
  13420. prefix: null,
  13421. suffic: null,
  13422. // Negative/Currency/percentage will mixin Number
  13423. negative: {
  13424. prefix: '-'
  13425. },*/
  13426. currency: {
  13427. decimals: 2,
  13428. prefix: '$ '
  13429. }/*,
  13430. percentage: {
  13431. decimals: 2,
  13432. suffix: '%'
  13433. }*/
  13434. });
  13435. /*
  13436. ---
  13437. name: Locale.es-ES.Form.Validator
  13438. description: Form Validator messages for Spanish.
  13439. license: MIT-style license
  13440. authors:
  13441. - Ãlfons Sanchez
  13442. requires:
  13443. - Locale
  13444. provides: [Locale.es-ES.Form.Validator]
  13445. ...
  13446. */
  13447. Locale.define('es-ES', 'FormValidator', {
  13448. required: 'Este campo es obligatorio.',
  13449. minLength: 'Por favor introduce al menos {minLength} caracteres (has introducido {length} caracteres).',
  13450. maxLength: 'Por favor introduce no m&aacute;s de {maxLength} caracteres (has introducido {length} caracteres).',
  13451. integer: 'Por favor introduce un n&uacute;mero entero en este campo. N&uacute;meros con decimales (p.e. 1,25) no se permiten.',
  13452. numeric: 'Por favor introduce solo valores num&eacute;ricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',
  13453. 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).',
  13454. alpha: 'Por favor usa letras solo (a-z) en este campo. No se admiten espacios ni otros caracteres.',
  13455. alphanum: 'Por favor, usa solo letras (a-z) o n&uacute;meros (0-9) en este campo. No se admiten espacios ni otros caracteres.',
  13456. dateSuchAs: 'Por favor introduce una fecha v&aacute;lida como {date}',
  13457. dateInFormatMDY: 'Por favor introduce una fecha v&aacute;lida como DD/MM/YYYY (p.e. "31/12/1999")',
  13458. email: 'Por favor, introduce una direcci&oacute;n de email v&aacute;lida. Por ejemplo, "fred@domain.com".',
  13459. url: 'Por favor introduce una URL v&aacute;lida como http://www.example.com.',
  13460. currencyDollar: 'Por favor introduce una cantidad v&aacute;lida de €. Por ejemplo €100,00 .',
  13461. oneRequired: 'Por favor introduce algo para por lo menos una de estas entradas.',
  13462. errorPrefix: 'Error: ',
  13463. warningPrefix: 'Aviso: ',
  13464. // Form.Validator.Extras
  13465. noSpace: 'No pueden haber espacios en esta entrada.',
  13466. reqChkByNode: 'No hay elementos seleccionados.',
  13467. requiredChk: 'Este campo es obligatorio.',
  13468. reqChkByName: 'Por favor selecciona una {label}.',
  13469. match: 'Este campo necesita coincidir con el campo {matchName}',
  13470. startDate: 'la fecha de inicio',
  13471. endDate: 'la fecha de fin',
  13472. currentDate: 'la fecha actual',
  13473. afterDate: 'La fecha debe ser igual o posterior a {label}.',
  13474. beforeDate: 'La fecha debe ser igual o anterior a {label}.',
  13475. startMonth: 'Por favor selecciona un mes de origen',
  13476. sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.'
  13477. });
  13478. /*
  13479. ---
  13480. name: Locale.es-VE.Date
  13481. description: Date messages for Spanish (Venezuela).
  13482. license: MIT-style license
  13483. authors:
  13484. - Daniel Barreto
  13485. requires:
  13486. - Locale
  13487. - Locale.es-ES.Date
  13488. provides: [Locale.es-VE.Date]
  13489. ...
  13490. */
  13491. Locale.define('es-VE').inherit('es-ES', 'Date');
  13492. /*
  13493. ---
  13494. name: Locale.es-VE.Form.Validator
  13495. description: Form Validator messages for Spanish (Venezuela).
  13496. license: MIT-style license
  13497. authors:
  13498. - Daniel Barreto
  13499. requires:
  13500. - Locale
  13501. - Locale.es-ES.Form.Validator
  13502. provides: [Locale.es-VE.Form.Validator]
  13503. ...
  13504. */
  13505. Locale.define('es-VE', 'FormValidator', {
  13506. 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.',
  13507. alpha: 'Por favor usa solo letras (a-z) en este campo. No se admiten espacios ni otros caracteres.',
  13508. currencyDollar: 'Por favor introduce una cantidad v&aacute;lida de Bs. Por ejemplo Bs. 100,00 .',
  13509. oneRequired: 'Por favor introduce un valor para por lo menos una de estas entradas.',
  13510. // Form.Validator.Extras
  13511. startDate: 'La fecha de inicio',
  13512. endDate: 'La fecha de fin',
  13513. currentDate: 'La fecha actual'
  13514. }).inherit('es-ES', 'FormValidator');
  13515. /*
  13516. ---
  13517. name: Locale.es-VE.Number
  13518. description: Number messages for Spanish (Venezuela).
  13519. license: MIT-style license
  13520. authors:
  13521. - Daniel Barreto
  13522. requires:
  13523. - Locale
  13524. provides: [Locale.es-VE.Number]
  13525. ...
  13526. */
  13527. Locale.define('es-VE', 'Number', {
  13528. decimal: ',',
  13529. group: '.',
  13530. /*
  13531. decimals: 0,
  13532. precision: 0,
  13533. */
  13534. // Negative/Currency/percentage will mixin Number
  13535. negative: {
  13536. prefix: '-'
  13537. },
  13538. currency: {
  13539. decimals: 2,
  13540. prefix: 'Bs. '
  13541. },
  13542. percentage: {
  13543. decimals: 2,
  13544. suffix: '%'
  13545. }
  13546. });
  13547. /*
  13548. ---
  13549. name: Locale.et-EE.Date
  13550. description: Date messages for Estonian.
  13551. license: MIT-style license
  13552. authors:
  13553. - Kevin Valdek
  13554. requires:
  13555. - Locale
  13556. provides: [Locale.et-EE.Date]
  13557. ...
  13558. */
  13559. Locale.define('et-EE', 'Date', {
  13560. months: ['jaanuar', 'veebruar', 'märts', 'aprill', 'mai', 'juuni', 'juuli', 'august', 'september', 'oktoober', 'november', 'detsember'],
  13561. months_abbr: ['jaan', 'veebr', 'märts', 'apr', 'mai', 'juuni', 'juuli', 'aug', 'sept', 'okt', 'nov', 'dets'],
  13562. days: ['pühapäev', 'esmaspäev', 'teisipäev', 'kolmapäev', 'neljapäev', 'reede', 'laupäev'],
  13563. days_abbr: ['pühap', 'esmasp', 'teisip', 'kolmap', 'neljap', 'reede', 'laup'],
  13564. // Culture's date order: MM.DD.YYYY
  13565. dateOrder: ['month', 'date', 'year'],
  13566. shortDate: '%m.%d.%Y',
  13567. shortTime: '%H:%M',
  13568. AM: 'AM',
  13569. PM: 'PM',
  13570. firstDayOfWeek: 1,
  13571. // Date.Extras
  13572. ordinal: '',
  13573. lessThanMinuteAgo: 'vähem kui minut aega tagasi',
  13574. minuteAgo: 'umbes minut aega tagasi',
  13575. minutesAgo: '{delta} minutit tagasi',
  13576. hourAgo: 'umbes tund aega tagasi',
  13577. hoursAgo: 'umbes {delta} tundi tagasi',
  13578. dayAgo: '1 päev tagasi',
  13579. daysAgo: '{delta} päeva tagasi',
  13580. weekAgo: '1 nädal tagasi',
  13581. weeksAgo: '{delta} nädalat tagasi',
  13582. monthAgo: '1 kuu tagasi',
  13583. monthsAgo: '{delta} kuud tagasi',
  13584. yearAgo: '1 aasta tagasi',
  13585. yearsAgo: '{delta} aastat tagasi',
  13586. lessThanMinuteUntil: 'vähem kui minuti aja pärast',
  13587. minuteUntil: 'umbes minuti aja pärast',
  13588. minutesUntil: '{delta} minuti pärast',
  13589. hourUntil: 'umbes tunni aja pärast',
  13590. hoursUntil: 'umbes {delta} tunni pärast',
  13591. dayUntil: '1 päeva pärast',
  13592. daysUntil: '{delta} päeva pärast',
  13593. weekUntil: '1 nädala pärast',
  13594. weeksUntil: '{delta} nädala pärast',
  13595. monthUntil: '1 kuu pärast',
  13596. monthsUntil: '{delta} kuu pärast',
  13597. yearUntil: '1 aasta pärast',
  13598. yearsUntil: '{delta} aasta pärast'
  13599. });
  13600. /*
  13601. ---
  13602. name: Locale.et-EE.Form.Validator
  13603. description: Form Validator messages for Estonian.
  13604. license: MIT-style license
  13605. authors:
  13606. - Kevin Valdek
  13607. requires:
  13608. - Locale
  13609. provides: [Locale.et-EE.Form.Validator]
  13610. ...
  13611. */
  13612. Locale.define('et-EE', 'FormValidator', {
  13613. required: 'Väli peab olema täidetud.',
  13614. minLength: 'Palun sisestage vähemalt {minLength} tähte (te sisestasite {length} tähte).',
  13615. maxLength: 'Palun ärge sisestage rohkem kui {maxLength} tähte (te sisestasite {length} tähte).',
  13616. integer: 'Palun sisestage väljale täisarv. Kümnendarvud (näiteks 1.25) ei ole lubatud.',
  13617. numeric: 'Palun sisestage ainult numbreid väljale (näiteks "1", "1.1", "-1" või "-1.1").',
  13618. digits: 'Palun kasutage ainult numbreid ja kirjavahemärke (telefoninumbri sisestamisel on lubatud kasutada kriipse ja punkte).',
  13619. alpha: 'Palun kasutage ainult tähti (a-z). Tühikud ja teised sümbolid on keelatud.',
  13620. alphanum: 'Palun kasutage ainult tähti (a-z) või numbreid (0-9). Tühikud ja teised sümbolid on keelatud.',
  13621. dateSuchAs: 'Palun sisestage kehtiv kuupäev kujul {date}',
  13622. dateInFormatMDY: 'Palun sisestage kehtiv kuupäev kujul MM.DD.YYYY (näiteks: "12.31.1999").',
  13623. email: 'Palun sisestage kehtiv e-maili aadress (näiteks: "fred@domain.com").',
  13624. url: 'Palun sisestage kehtiv URL (näiteks: http://www.example.com).',
  13625. currencyDollar: 'Palun sisestage kehtiv $ summa (näiteks: $100.00).',
  13626. oneRequired: 'Palun sisestage midagi vähemalt ühele antud väljadest.',
  13627. errorPrefix: 'Viga: ',
  13628. warningPrefix: 'Hoiatus: ',
  13629. // Form.Validator.Extras
  13630. noSpace: 'Väli ei tohi sisaldada tühikuid.',
  13631. reqChkByNode: 'Ükski väljadest pole valitud.',
  13632. requiredChk: 'Välja täitmine on vajalik.',
  13633. reqChkByName: 'Palun valige üks {label}.',
  13634. match: 'Väli peab sobima {matchName} väljaga',
  13635. startDate: 'algkuupäev',
  13636. endDate: 'lõppkuupäev',
  13637. currentDate: 'praegune kuupäev',
  13638. afterDate: 'Kuupäev peab olema võrdne või pärast {label}.',
  13639. beforeDate: 'Kuupäev peab olema võrdne või enne {label}.',
  13640. startMonth: 'Palun valige algkuupäev.',
  13641. sameMonth: 'Antud kaks kuupäeva peavad olema samas kuus - peate muutma ühte kuupäeva.'
  13642. });
  13643. /*
  13644. ---
  13645. name: Locale.fa.Date
  13646. description: Date messages for Persian.
  13647. license: MIT-style license
  13648. authors:
  13649. - Amir Hossein Hodjaty Pour
  13650. requires:
  13651. - Locale
  13652. provides: [Locale.fa.Date]
  13653. ...
  13654. */
  13655. Locale.define('fa', 'Date', {
  13656. months: ['ژانویه', 'فوریه', 'مارس', 'آپریل', 'مه', 'ژوئن', 'ژوئیه', 'آگوست', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'],
  13657. months_abbr: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
  13658. days: ['یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'],
  13659. days_abbr: ['ي', 'د', 'س', 'چ', 'پ', 'ج', 'ش'],
  13660. // Culture's date order: MM/DD/YYYY
  13661. dateOrder: ['month', 'date', 'year'],
  13662. shortDate: '%m/%d/%Y',
  13663. shortTime: '%I:%M%p',
  13664. AM: 'ق.ظ',
  13665. PM: 'ب.ظ',
  13666. // Date.Extras
  13667. ordinal: 'ام',
  13668. lessThanMinuteAgo: 'کمتر از یک دقیقه پیش',
  13669. minuteAgo: 'حدود یک دقیقه پیش',
  13670. minutesAgo: '{delta} دقیقه پیش',
  13671. hourAgo: 'حدود یک ساعت پیش',
  13672. hoursAgo: 'حدود {delta} ساعت پیش',
  13673. dayAgo: '1 روز پیش',
  13674. daysAgo: '{delta} روز پیش',
  13675. weekAgo: '1 هفته پیش',
  13676. weeksAgo: '{delta} هفته پیش',
  13677. monthAgo: '1 ماه پیش',
  13678. monthsAgo: '{delta} ماه پیش',
  13679. yearAgo: '1 سال پیش',
  13680. yearsAgo: '{delta} سال پیش',
  13681. lessThanMinuteUntil: 'کمتر از یک دقیقه از حالا',
  13682. minuteUntil: 'حدود یک دقیقه از حالا',
  13683. minutesUntil: '{delta} دقیقه از حالا',
  13684. hourUntil: 'حدود یک ساعت از حالا',
  13685. hoursUntil: 'حدود {delta} ساعت از حالا',
  13686. dayUntil: '1 روز از حالا',
  13687. daysUntil: '{delta} روز از حالا',
  13688. weekUntil: '1 هفته از حالا',
  13689. weeksUntil: '{delta} هفته از حالا',
  13690. monthUntil: '1 ماه از حالا',
  13691. monthsUntil: '{delta} ماه از حالا',
  13692. yearUntil: '1 سال از حالا',
  13693. yearsUntil: '{delta} سال از حالا'
  13694. });
  13695. /*
  13696. ---
  13697. name: Locale.fa.Form.Validator
  13698. description: Form Validator messages for Persian.
  13699. license: MIT-style license
  13700. authors:
  13701. - Amir Hossein Hodjaty Pour
  13702. requires:
  13703. - Locale
  13704. provides: [Locale.fa.Form.Validator]
  13705. ...
  13706. */
  13707. Locale.define('fa', 'FormValidator', {
  13708. required: 'این فیلد الزامی است.',
  13709. minLength: 'شما باید حداقل {minLength} حرف وارد کنید ({length} حرف وارد کرده اید).',
  13710. maxLength: 'لطفا حداکثر {maxLength} حرف وارد کنید (شما {length} حرف وارد کرده اید).',
  13711. integer: 'لطفا از عدد صحیح استفاده کنید. اعداد اعشاری (مانند 1.25) مجاز نیستند.',
  13712. numeric: 'لطفا فقط داده عددی وارد کنید (مانند "1" یا "1.1" یا "1-" یا "1.1-").',
  13713. digits: 'لطفا فقط از اعداد و علامتها در این فیلد استفاده کنید (برای مثال شماره تلفن با خط تیره و نقطه قابل قبول است).',
  13714. alpha: 'لطفا فقط از حروف الفباء برای این بخش استفاده کنید. کاراکترهای دیگر و فاصله مجاز نیستند.',
  13715. alphanum: 'لطفا فقط از حروف الفباء و اعداد در این بخش استفاده کنید. کاراکترهای دیگر و فاصله مجاز نیستند.',
  13716. dateSuchAs: 'لطفا یک تاریخ معتبر مانند {date} وارد کنید.',
  13717. dateInFormatMDY: 'لطفا یک تاریخ معتبر به شکل MM/DD/YYYY وارد کنید (مانند "12/31/1999").',
  13718. email: 'لطفا یک آدرس ایمیل معتبر وارد کنید. برای مثال "fred@domain.com".',
  13719. url: 'لطفا یک URL معتبر مانند http://www.example.com وارد کنید.',
  13720. currencyDollar: 'لطفا یک محدوده معتبر برای این بخش وارد کنید مانند 100.00$ .',
  13721. oneRequired: 'لطفا حداقل یکی از فیلدها را پر کنید.',
  13722. errorPrefix: 'خطا: ',
  13723. warningPrefix: 'هشدار: ',
  13724. // Form.Validator.Extras
  13725. noSpace: 'استفاده از فاصله در این بخش مجاز نیست.',
  13726. reqChkByNode: 'موردی انتخاب نشده است.',
  13727. requiredChk: 'این فیلد الزامی است.',
  13728. reqChkByName: 'لطفا یک {label} را انتخاب کنید.',
  13729. match: 'این فیلد باید با فیلد {matchName} مطابقت داشته باشد.',
  13730. startDate: 'تاریخ شروع',
  13731. endDate: 'تاریخ پایان',
  13732. currentDate: 'تاریخ کنونی',
  13733. afterDate: 'تاریخ میبایست برابر یا بعد از {label} باشد',
  13734. beforeDate: 'تاریخ میبایست برابر یا قبل از {label} باشد',
  13735. startMonth: 'لطفا ماه شروع را انتخاب کنید',
  13736. sameMonth: 'این دو تاریخ باید در یک ماه باشند - شما باید یکی یا هر دو را تغییر دهید.',
  13737. creditcard: 'شماره کارت اعتباری که وارد کرده اید معتبر نیست. لطفا شماره را بررسی کنید و مجددا تلاش کنید. {length} رقم وارد شده است.'
  13738. });
  13739. /*
  13740. ---
  13741. name: Locale.fi-FI.Date
  13742. description: Date messages for Finnish.
  13743. license: MIT-style license
  13744. authors:
  13745. - ksel
  13746. requires:
  13747. - Locale
  13748. provides: [Locale.fi-FI.Date]
  13749. ...
  13750. */
  13751. Locale.define('fi-FI', 'Date', {
  13752. // NOTE: months and days are not capitalized in finnish
  13753. months: ['tammikuu', 'helmikuu', 'maaliskuu', 'huhtikuu', 'toukokuu', 'kesäkuu', 'heinäkuu', 'elokuu', 'syyskuu', 'lokakuu', 'marraskuu', 'joulukuu'],
  13754. // these abbreviations are really not much used in finnish because they obviously won't abbreviate very much. ;)
  13755. // NOTE: sometimes one can see forms such as "tammi", "helmi", etc. but that is not proper finnish.
  13756. months_abbr: ['tammik.', 'helmik.', 'maalisk.', 'huhtik.', 'toukok.', 'kesäk.', 'heinäk.', 'elok.', 'syysk.', 'lokak.', 'marrask.', 'jouluk.'],
  13757. days: ['sunnuntai', 'maanantai', 'tiistai', 'keskiviikko', 'torstai', 'perjantai', 'lauantai'],
  13758. days_abbr: ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'],
  13759. // Culture's date order: DD/MM/YYYY
  13760. dateOrder: ['date', 'month', 'year'],
  13761. shortDate: '%d.%m.%Y',
  13762. shortTime: '%H:%M',
  13763. AM: 'AM',
  13764. PM: 'PM',
  13765. firstDayOfWeek: 1,
  13766. // Date.Extras
  13767. ordinal: '.',
  13768. lessThanMinuteAgo: 'vajaa minuutti sitten',
  13769. minuteAgo: 'noin minuutti sitten',
  13770. minutesAgo: '{delta} minuuttia sitten',
  13771. hourAgo: 'noin tunti sitten',
  13772. hoursAgo: 'noin {delta} tuntia sitten',
  13773. dayAgo: 'päivä sitten',
  13774. daysAgo: '{delta} päivää sitten',
  13775. weekAgo: 'viikko sitten',
  13776. weeksAgo: '{delta} viikkoa sitten',
  13777. monthAgo: 'kuukausi sitten',
  13778. monthsAgo: '{delta} kuukautta sitten',
  13779. yearAgo: 'vuosi sitten',
  13780. yearsAgo: '{delta} vuotta sitten',
  13781. lessThanMinuteUntil: 'vajaan minuutin kuluttua',
  13782. minuteUntil: 'noin minuutin kuluttua',
  13783. minutesUntil: '{delta} minuutin kuluttua',
  13784. hourUntil: 'noin tunnin kuluttua',
  13785. hoursUntil: 'noin {delta} tunnin kuluttua',
  13786. dayUntil: 'päivän kuluttua',
  13787. daysUntil: '{delta} päivän kuluttua',
  13788. weekUntil: 'viikon kuluttua',
  13789. weeksUntil: '{delta} viikon kuluttua',
  13790. monthUntil: 'kuukauden kuluttua',
  13791. monthsUntil: '{delta} kuukauden kuluttua',
  13792. yearUntil: 'vuoden kuluttua',
  13793. yearsUntil: '{delta} vuoden kuluttua'
  13794. });
  13795. /*
  13796. ---
  13797. name: Locale.fi-FI.Form.Validator
  13798. description: Form Validator messages for Finnish.
  13799. license: MIT-style license
  13800. authors:
  13801. - ksel
  13802. requires:
  13803. - Locale
  13804. provides: [Locale.fi-FI.Form.Validator]
  13805. ...
  13806. */
  13807. Locale.define('fi-FI', 'FormValidator', {
  13808. required: 'Tämä kenttä on pakollinen.',
  13809. minLength: 'Ole hyvä ja anna vähintään {minLength} merkkiä (annoit {length} merkkiä).',
  13810. maxLength: 'Älä anna enempää kuin {maxLength} merkkiä (annoit {length} merkkiä).',
  13811. integer: 'Ole hyvä ja anna kokonaisluku. Luvut, joissa on desimaaleja (esim. 1.25) eivät ole sallittuja.',
  13812. numeric: 'Anna tähän kenttään lukuarvo (kuten "1" tai "1.1" tai "-1" tai "-1.1").',
  13813. 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).',
  13814. alpha: 'Anna tähän kenttään vain kirjaimia (a-z). Välilyönnit tai muut merkit eivät ole sallittuja.',
  13815. 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.',
  13816. dateSuchAs: 'Ole hyvä ja anna kelvollinen päivmäärä, kuten esimerkiksi {date}',
  13817. dateInFormatMDY: 'Ole hyvä ja anna kelvollinen päivämäärä muodossa pp/kk/vvvv (kuten "12/31/1999")',
  13818. email: 'Ole hyvä ja anna kelvollinen sähköpostiosoite (kuten esimerkiksi "matti@meikalainen.com").',
  13819. url: 'Ole hyvä ja anna kelvollinen URL, kuten esimerkiksi http://www.example.com.',
  13820. currencyDollar: 'Ole hyvä ja anna kelvollinen eurosumma (kuten esimerkiksi 100,00 EUR) .',
  13821. oneRequired: 'Ole hyvä ja syötä jotakin ainakin johonkin näistä kentistä.',
  13822. errorPrefix: 'Virhe: ',
  13823. warningPrefix: 'Varoitus: ',
  13824. // Form.Validator.Extras
  13825. noSpace: 'Tässä syötteessä ei voi olla välilyöntejä',
  13826. reqChkByNode: 'Ei valintoja.',
  13827. requiredChk: 'Tämä kenttä on pakollinen.',
  13828. reqChkByName: 'Ole hyvä ja valitse {label}.',
  13829. match: 'Tämän kentän tulee vastata kenttää {matchName}',
  13830. startDate: 'alkupäivämäärä',
  13831. endDate: 'loppupäivämäärä',
  13832. currentDate: 'nykyinen päivämäärä',
  13833. afterDate: 'Päivämäärän tulisi olla sama tai myöhäisempi ajankohta kuin {label}.',
  13834. beforeDate: 'Päivämäärän tulisi olla sama tai aikaisempi ajankohta kuin {label}.',
  13835. startMonth: 'Ole hyvä ja valitse aloituskuukausi',
  13836. sameMonth: 'Näiden kahden päivämäärän tulee olla saman kuun sisällä -- sinun pitää muuttaa jompaa kumpaa.',
  13837. creditcard: 'Annettu luottokortin numero ei kelpaa. Ole hyvä ja tarkista numero sekä yritä uudelleen. {length} numeroa syötetty.'
  13838. });
  13839. /*
  13840. ---
  13841. name: Locale.fi-FI.Number
  13842. description: Finnish number messages
  13843. license: MIT-style license
  13844. authors:
  13845. - ksel
  13846. requires:
  13847. - Locale
  13848. - Locale.EU.Number
  13849. provides: [Locale.fi-FI.Number]
  13850. ...
  13851. */
  13852. Locale.define('fi-FI', 'Number', {
  13853. group: ' ' // grouped by space
  13854. }).inherit('EU', 'Number');
  13855. /*
  13856. ---
  13857. name: Locale.fr-FR.Date
  13858. description: Date messages for French.
  13859. license: MIT-style license
  13860. authors:
  13861. - Nicolas Sorosac
  13862. - Antoine Abt
  13863. requires:
  13864. - Locale
  13865. provides: [Locale.fr-FR.Date]
  13866. ...
  13867. */
  13868. Locale.define('fr-FR', 'Date', {
  13869. months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
  13870. months_abbr: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
  13871. days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
  13872. days_abbr: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
  13873. // Culture's date order: DD/MM/YYYY
  13874. dateOrder: ['date', 'month', 'year'],
  13875. shortDate: '%d/%m/%Y',
  13876. shortTime: '%H:%M',
  13877. AM: 'AM',
  13878. PM: 'PM',
  13879. firstDayOfWeek: 1,
  13880. // Date.Extras
  13881. ordinal: function(dayOfMonth){
  13882. return (dayOfMonth > 1) ? '' : 'er';
  13883. },
  13884. lessThanMinuteAgo: "il y a moins d'une minute",
  13885. minuteAgo: 'il y a une minute',
  13886. minutesAgo: 'il y a {delta} minutes',
  13887. hourAgo: 'il y a une heure',
  13888. hoursAgo: 'il y a {delta} heures',
  13889. dayAgo: 'il y a un jour',
  13890. daysAgo: 'il y a {delta} jours',
  13891. weekAgo: 'il y a une semaine',
  13892. weeksAgo: 'il y a {delta} semaines',
  13893. monthAgo: 'il y a 1 mois',
  13894. monthsAgo: 'il y a {delta} mois',
  13895. yearthAgo: 'il y a 1 an',
  13896. yearsAgo: 'il y a {delta} ans',
  13897. lessThanMinuteUntil: "dans moins d'une minute",
  13898. minuteUntil: 'dans une minute',
  13899. minutesUntil: 'dans {delta} minutes',
  13900. hourUntil: 'dans une heure',
  13901. hoursUntil: 'dans {delta} heures',
  13902. dayUntil: 'dans un jour',
  13903. daysUntil: 'dans {delta} jours',
  13904. weekUntil: 'dans 1 semaine',
  13905. weeksUntil: 'dans {delta} semaines',
  13906. monthUntil: 'dans 1 mois',
  13907. monthsUntil: 'dans {delta} mois',
  13908. yearUntil: 'dans 1 an',
  13909. yearsUntil: 'dans {delta} ans'
  13910. });
  13911. /*
  13912. ---
  13913. name: Locale.fr-FR.Form.Validator
  13914. description: Form Validator messages for French.
  13915. license: MIT-style license
  13916. authors:
  13917. - Miquel Hudin
  13918. - Nicolas Sorosac
  13919. requires:
  13920. - Locale
  13921. provides: [Locale.fr-FR.Form.Validator]
  13922. ...
  13923. */
  13924. /*eslint mootools-whitespace:0*/
  13925. Locale.define('fr-FR', 'FormValidator', {
  13926. required: 'Ce champ est obligatoire.',
  13927. length: 'Veuillez saisir {length} caract&egrave;re(s) (vous avez saisi {elLength} caract&egrave;re(s)',
  13928. minLength: 'Veuillez saisir un minimum de {minLength} caract&egrave;re(s) (vous avez saisi {length} caract&egrave;re(s)).',
  13929. maxLength: 'Veuillez saisir un maximum de {maxLength} caract&egrave;re(s) (vous avez saisi {length} caract&egrave;re(s)).',
  13930. integer: 'Veuillez saisir un nombre entier dans ce champ. Les nombres d&eacute;cimaux (ex : "1,25") ne sont pas autoris&eacute;s.',
  13931. numeric: 'Veuillez saisir uniquement des chiffres dans ce champ (ex : "1" ou "1,1" ou "-1" ou "-1,1").',
  13932. 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;).",
  13933. alpha: 'Veuillez saisir uniquement des lettres (a-z) dans ce champ. Les espaces ou autres caract&egrave;res ne sont pas autoris&eacute;s.',
  13934. 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.',
  13935. dateSuchAs: 'Veuillez saisir une date correcte comme {date}',
  13936. dateInFormatMDY: 'Veuillez saisir une date correcte, au format JJ/MM/AAAA (ex : "31/11/1999").',
  13937. email: 'Veuillez saisir une adresse de courrier &eacute;lectronique. Par exemple "fred@domaine.com".',
  13938. url: 'Veuillez saisir une URL, comme http://www.exemple.com.',
  13939. currencyDollar: 'Veuillez saisir une quantit&eacute; correcte. Par exemple 100,00&euro;.',
  13940. oneRequired: 'Veuillez s&eacute;lectionner au moins une de ces options.',
  13941. errorPrefix: 'Erreur : ',
  13942. warningPrefix: 'Attention : ',
  13943. // Form.Validator.Extras
  13944. noSpace: "Ce champ n'accepte pas les espaces.",
  13945. reqChkByNode: "Aucun &eacute;l&eacute;ment n'est s&eacute;lectionn&eacute;.",
  13946. requiredChk: 'Ce champ est obligatoire.',
  13947. reqChkByName: 'Veuillez s&eacute;lectionner un(e) {label}.',
  13948. match: 'Ce champ doit correspondre avec le champ {matchName}.',
  13949. startDate: 'date de d&eacute;but',
  13950. endDate: 'date de fin',
  13951. currentDate: 'date actuelle',
  13952. afterDate: 'La date doit &ecirc;tre identique ou post&eacute;rieure &agrave; {label}.',
  13953. beforeDate: 'La date doit &ecirc;tre identique ou ant&eacute;rieure &agrave; {label}.',
  13954. startMonth: 'Veuillez s&eacute;lectionner un mois de d&eacute;but.',
  13955. sameMonth: 'Ces deux dates doivent &ecirc;tre dans le m&ecirc;me mois - vous devez en modifier une.',
  13956. 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).'
  13957. });
  13958. /*
  13959. ---
  13960. name: Locale.fr-FR.Number
  13961. description: Number messages for French.
  13962. license: MIT-style license
  13963. authors:
  13964. - Arian Stolwijk
  13965. - sv1l
  13966. requires:
  13967. - Locale
  13968. - Locale.EU.Number
  13969. provides: [Locale.fr-FR.Number]
  13970. ...
  13971. */
  13972. Locale.define('fr-FR', 'Number', {
  13973. group: ' ' // In fr-FR localization, group character is a blank space
  13974. }).inherit('EU', 'Number');
  13975. /*
  13976. ---
  13977. name: Locale.he-IL.Date
  13978. description: Date messages for Hebrew.
  13979. license: MIT-style license
  13980. authors:
  13981. - Elad Ossadon
  13982. requires:
  13983. - Locale
  13984. provides: [Locale.he-IL.Date]
  13985. ...
  13986. */
  13987. Locale.define('he-IL', 'Date', {
  13988. months: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
  13989. months_abbr: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'],
  13990. days: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'],
  13991. days_abbr: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'],
  13992. // Culture's date order: MM/DD/YYYY
  13993. dateOrder: ['date', 'month', 'year'],
  13994. shortDate: '%d/%m/%Y',
  13995. shortTime: '%H:%M',
  13996. AM: 'AM',
  13997. PM: 'PM',
  13998. firstDayOfWeek: 0,
  13999. // Date.Extras
  14000. ordinal: '',
  14001. lessThanMinuteAgo: 'לפני פחות מדקה',
  14002. minuteAgo: 'לפני כדקה',
  14003. minutesAgo: 'לפני {delta} דקות',
  14004. hourAgo: 'לפני כשעה',
  14005. hoursAgo: 'לפני {delta} שעות',
  14006. dayAgo: 'לפני יום',
  14007. daysAgo: 'לפני {delta} ימים',
  14008. weekAgo: 'לפני שבוע',
  14009. weeksAgo: 'לפני {delta} שבועות',
  14010. monthAgo: 'לפני חודש',
  14011. monthsAgo: 'לפני {delta} חודשים',
  14012. yearAgo: 'לפני שנה',
  14013. yearsAgo: 'לפני {delta} שנים',
  14014. lessThanMinuteUntil: 'בעוד פחות מדקה',
  14015. minuteUntil: 'בעוד כדקה',
  14016. minutesUntil: 'בעוד {delta} דקות',
  14017. hourUntil: 'בעוד כשעה',
  14018. hoursUntil: 'בעוד {delta} שעות',
  14019. dayUntil: 'בעוד יום',
  14020. daysUntil: 'בעוד {delta} ימים',
  14021. weekUntil: 'בעוד שבוע',
  14022. weeksUntil: 'בעוד {delta} שבועות',
  14023. monthUntil: 'בעוד חודש',
  14024. monthsUntil: 'בעוד {delta} חודשים',
  14025. yearUntil: 'בעוד שנה',
  14026. yearsUntil: 'בעוד {delta} שנים'
  14027. });
  14028. /*
  14029. ---
  14030. name: Locale.he-IL.Form.Validator
  14031. description: Form Validator messages for Hebrew.
  14032. license: MIT-style license
  14033. authors:
  14034. - Elad Ossadon
  14035. requires:
  14036. - Locale
  14037. provides: [Locale.he-IL.Form.Validator]
  14038. ...
  14039. */
  14040. Locale.define('he-IL', 'FormValidator', {
  14041. required: 'נא למלא שדה זה.',
  14042. minLength: 'נא להזין לפחות {minLength} תווים (הזנת {length} תווים).',
  14043. maxLength: 'נא להזין עד {maxLength} תווים (הזנת {length} תווים).',
  14044. integer: 'נא להזין מספר שלם לשדה זה. מספרים עשרוניים (כמו 1.25) אינם חוקיים.',
  14045. numeric: 'נא להזין ערך מספרי בלבד בשדה זה (כמו "1", "1.1", "-1" או "-1.1").',
  14046. digits: 'נא להזין רק ספרות וסימני הפרדה בשדה זה (למשל, מספר טלפון עם מקפים או נקודות הוא חוקי).',
  14047. alpha: 'נא להזין רק אותיות באנגלית (a-z) בשדה זה. רווחים או תווים אחרים אינם חוקיים.',
  14048. alphanum: 'נא להזין רק אותריות באנגלית (a-z) או ספרות (0-9) בשדה זה. אווחרים או תווים אחרים אינם חוקיים.',
  14049. dateSuchAs: 'נא להזין תאריך חוקי, כמו {date}',
  14050. dateInFormatMDY: 'נא להזין תאריך חוקי בפורמט MM/DD/YYYY (כמו "12/31/1999")',
  14051. email: 'נא להזין כתובת אימייל חוקית. לדוגמה: "fred@domain.com".',
  14052. url: 'נא להזין כתובת אתר חוקית, כמו http://www.example.com.',
  14053. currencyDollar: 'נא להזין סכום דולרי חוקי. לדוגמה $100.00.',
  14054. oneRequired: 'נא לבחור לפחות בשדה אחד.',
  14055. errorPrefix: 'שגיאה: ',
  14056. warningPrefix: 'אזהרה: ',
  14057. // Form.Validator.Extras
  14058. noSpace: 'אין להזין רווחים בשדה זה.',
  14059. reqChkByNode: 'נא לבחור אחת מהאפשרויות.',
  14060. requiredChk: 'שדה זה נדרש.',
  14061. reqChkByName: 'נא לבחור {label}.',
  14062. match: 'שדה זה צריך להתאים לשדה {matchName}',
  14063. startDate: 'תאריך ההתחלה',
  14064. endDate: 'תאריך הסיום',
  14065. currentDate: 'התאריך הנוכחי',
  14066. afterDate: 'התאריך צריך להיות זהה או אחרי {label}.',
  14067. beforeDate: 'התאריך צריך להיות זהה או לפני {label}.',
  14068. startMonth: 'נא לבחור חודש התחלה',
  14069. sameMonth: 'שני תאריכים אלה צריכים להיות באותו חודש - נא לשנות אחד התאריכים.',
  14070. creditcard: 'מספר כרטיס האשראי שהוזן אינו חוקי. נא לבדוק שנית. הוזנו {length} ספרות.'
  14071. });
  14072. /*
  14073. ---
  14074. name: Locale.he-IL.Number
  14075. description: Number messages for Hebrew.
  14076. license: MIT-style license
  14077. authors:
  14078. - Elad Ossadon
  14079. requires:
  14080. - Locale
  14081. provides: [Locale.he-IL.Number]
  14082. ...
  14083. */
  14084. Locale.define('he-IL', 'Number', {
  14085. decimal: '.',
  14086. group: ',',
  14087. currency: {
  14088. suffix: ' ₪'
  14089. }
  14090. });
  14091. /*
  14092. ---
  14093. name: Locale.hu-HU.Date
  14094. description: Date messages for Hungarian.
  14095. license: MIT-style license
  14096. authors:
  14097. - Zsolt Szegheő
  14098. requires:
  14099. - Locale
  14100. provides: [Locale.hu-HU.Date]
  14101. ...
  14102. */
  14103. Locale.define('hu-HU', 'Date', {
  14104. months: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június', 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],
  14105. months_abbr: ['jan.', 'febr.', 'márc.', 'ápr.', 'máj.', 'jún.', 'júl.', 'aug.', 'szept.', 'okt.', 'nov.', 'dec.'],
  14106. days: ['Vasárnap', 'Hétfő', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
  14107. days_abbr: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
  14108. // Culture's date order: YYYY.MM.DD.
  14109. dateOrder: ['year', 'month', 'date'],
  14110. shortDate: '%Y.%m.%d.',
  14111. shortTime: '%I:%M',
  14112. AM: 'de.',
  14113. PM: 'du.',
  14114. firstDayOfWeek: 1,
  14115. // Date.Extras
  14116. ordinal: '.',
  14117. lessThanMinuteAgo: 'alig egy perce',
  14118. minuteAgo: 'egy perce',
  14119. minutesAgo: '{delta} perce',
  14120. hourAgo: 'egy órája',
  14121. hoursAgo: '{delta} órája',
  14122. dayAgo: '1 napja',
  14123. daysAgo: '{delta} napja',
  14124. weekAgo: '1 hete',
  14125. weeksAgo: '{delta} hete',
  14126. monthAgo: '1 hónapja',
  14127. monthsAgo: '{delta} hónapja',
  14128. yearAgo: '1 éve',
  14129. yearsAgo: '{delta} éve',
  14130. lessThanMinuteUntil: 'alig egy perc múlva',
  14131. minuteUntil: 'egy perc múlva',
  14132. minutesUntil: '{delta} perc múlva',
  14133. hourUntil: 'egy óra múlva',
  14134. hoursUntil: '{delta} óra múlva',
  14135. dayUntil: '1 nap múlva',
  14136. daysUntil: '{delta} nap múlva',
  14137. weekUntil: '1 hét múlva',
  14138. weeksUntil: '{delta} hét múlva',
  14139. monthUntil: '1 hónap múlva',
  14140. monthsUntil: '{delta} hónap múlva',
  14141. yearUntil: '1 év múlva',
  14142. yearsUntil: '{delta} év múlva'
  14143. });
  14144. /*
  14145. ---
  14146. name: Locale.hu-HU.Form.Validator
  14147. description: Form Validator messages for Hungarian.
  14148. license: MIT-style license
  14149. authors:
  14150. - Zsolt Szegheő
  14151. requires:
  14152. - Locale
  14153. provides: [Locale.hu-HU.Form.Validator]
  14154. ...
  14155. */
  14156. /*eslint mootools-whitespace:0*/
  14157. Locale.define('hu-HU', 'FormValidator', {
  14158. required: 'A mező kitöltése kötelező.',
  14159. minLength: 'Legalább {minLength} karakter megadása szükséges (megadva {length} karakter).',
  14160. maxLength: 'Legfeljebb {maxLength} karakter megadása lehetséges (megadva {length} karakter).',
  14161. integer: 'Egész szám megadása szükséges. A tizedesjegyek (pl. 1.25) nem engedélyezettek.',
  14162. numeric: 'Szám megadása szükséges (pl. "1" vagy "1.1" vagy "-1" vagy "-1.1").',
  14163. digits: 'Csak számok és írásjelek megadása lehetséges (pl. telefonszám kötőjelek és/vagy perjelekkel).',
  14164. alpha: 'Csak betűk (a-z) megadása lehetséges. Szóköz és egyéb karakterek nem engedélyezettek.',
  14165. 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.',
  14166. dateSuchAs: 'Valós dátum megadása szükséges (pl. {date}).',
  14167. dateInFormatMDY: 'Valós dátum megadása szükséges ÉÉÉÉ.HH.NN. formában. (pl. "1999.12.31.")',
  14168. email: 'Valós e-mail cím megadása szükséges (pl. "fred@domain.hu").',
  14169. url: 'Valós URL megadása szükséges (pl. http://www.example.com).',
  14170. currencyDollar: 'Valós pénzösszeg megadása szükséges (pl. 100.00 Ft.).',
  14171. oneRequired: 'Az alábbi mezők legalább egyikének kitöltése kötelező.',
  14172. errorPrefix: 'Hiba: ',
  14173. warningPrefix: 'Figyelem: ',
  14174. // Form.Validator.Extras
  14175. noSpace: 'A mező nem tartalmazhat szóközöket.',
  14176. reqChkByNode: 'Nincs egyetlen kijelölt elem sem.',
  14177. requiredChk: 'A mező kitöltése kötelező.',
  14178. reqChkByName: 'Egy {label} kiválasztása szükséges.',
  14179. match: 'A mezőnek egyeznie kell a(z) {matchName} mezővel.',
  14180. startDate: 'a kezdet dátuma',
  14181. endDate: 'a vég dátuma',
  14182. currentDate: 'jelenlegi dátum',
  14183. afterDate: 'A dátum nem lehet kisebb, mint {label}.',
  14184. beforeDate: 'A dátum nem lehet nagyobb, mint {label}.',
  14185. startMonth: 'Kezdeti hónap megadása szükséges.',
  14186. sameMonth: 'A két dátumnak ugyanazon hónapban kell lennie.',
  14187. creditcard: 'A megadott bankkártyaszám nem valódi (megadva {length} számjegy).'
  14188. });
  14189. /*
  14190. ---
  14191. name: Locale.it-IT.Date
  14192. description: Date messages for Italian.
  14193. license: MIT-style license.
  14194. authors:
  14195. - Andrea Novero
  14196. - Valerio Proietti
  14197. requires:
  14198. - Locale
  14199. provides: [Locale.it-IT.Date]
  14200. ...
  14201. */
  14202. Locale.define('it-IT', 'Date', {
  14203. months: ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'],
  14204. months_abbr: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
  14205. days: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
  14206. days_abbr: ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'],
  14207. // Culture's date order: DD/MM/YYYY
  14208. dateOrder: ['date', 'month', 'year'],
  14209. shortDate: '%d/%m/%Y',
  14210. shortTime: '%H.%M',
  14211. AM: 'AM',
  14212. PM: 'PM',
  14213. firstDayOfWeek: 1,
  14214. // Date.Extras
  14215. ordinal: 'º',
  14216. lessThanMinuteAgo: 'meno di un minuto fa',
  14217. minuteAgo: 'circa un minuto fa',
  14218. minutesAgo: 'circa {delta} minuti fa',
  14219. hourAgo: "circa un'ora fa",
  14220. hoursAgo: 'circa {delta} ore fa',
  14221. dayAgo: 'circa 1 giorno fa',
  14222. daysAgo: 'circa {delta} giorni fa',
  14223. weekAgo: 'una settimana fa',
  14224. weeksAgo: '{delta} settimane fa',
  14225. monthAgo: 'un mese fa',
  14226. monthsAgo: '{delta} mesi fa',
  14227. yearAgo: 'un anno fa',
  14228. yearsAgo: '{delta} anni fa',
  14229. lessThanMinuteUntil: 'tra meno di un minuto',
  14230. minuteUntil: 'tra circa un minuto',
  14231. minutesUntil: 'tra circa {delta} minuti',
  14232. hourUntil: "tra circa un'ora",
  14233. hoursUntil: 'tra circa {delta} ore',
  14234. dayUntil: 'tra circa un giorno',
  14235. daysUntil: 'tra circa {delta} giorni',
  14236. weekUntil: 'tra una settimana',
  14237. weeksUntil: 'tra {delta} settimane',
  14238. monthUntil: 'tra un mese',
  14239. monthsUntil: 'tra {delta} mesi',
  14240. yearUntil: 'tra un anno',
  14241. yearsUntil: 'tra {delta} anni'
  14242. });
  14243. /*
  14244. ---
  14245. name: Locale.it-IT.Form.Validator
  14246. description: Form Validator messages for Italian.
  14247. license: MIT-style license
  14248. authors:
  14249. - Leonardo Laureti
  14250. - Andrea Novero
  14251. requires:
  14252. - Locale
  14253. provides: [Locale.it-IT.Form.Validator]
  14254. ...
  14255. */
  14256. /*eslint mootools-whitespace:0*/
  14257. Locale.define('it-IT', 'FormValidator', {
  14258. required: 'Il campo &egrave; obbligatorio.',
  14259. minLength: 'Inserire almeno {minLength} caratteri (ne sono stati inseriti {length}).',
  14260. maxLength: 'Inserire al massimo {maxLength} caratteri (ne sono stati inseriti {length}).',
  14261. integer: 'Inserire un numero intero. Non sono consentiti decimali (es.: 1.25).',
  14262. numeric: 'Inserire solo valori numerici (es.: "1" oppure "1.1" oppure "-1" oppure "-1.1").',
  14263. digits: 'Inserire solo numeri e caratteri di punteggiatura. Per esempio &egrave; consentito un numero telefonico con trattini o punti.',
  14264. alpha: 'Inserire solo lettere (a-z). Non sono consentiti spazi o altri caratteri.',
  14265. alphanum: 'Inserire solo lettere (a-z) o numeri (0-9). Non sono consentiti spazi o altri caratteri.',
  14266. dateSuchAs: 'Inserire una data valida del tipo {date}',
  14267. dateInFormatMDY: 'Inserire una data valida nel formato MM/GG/AAAA (es.: "12/31/1999")',
  14268. email: 'Inserire un indirizzo email valido. Per esempio "nome@dominio.com".',
  14269. url: 'Inserire un indirizzo valido. Per esempio "http://www.example.com".',
  14270. currencyDollar: 'Inserire un importo valido. Per esempio "$100.00".',
  14271. oneRequired: 'Completare almeno uno dei campi richiesti.',
  14272. errorPrefix: 'Errore: ',
  14273. warningPrefix: 'Attenzione: ',
  14274. // Form.Validator.Extras
  14275. noSpace: 'Non sono consentiti spazi.',
  14276. reqChkByNode: 'Nessuna voce selezionata.',
  14277. requiredChk: 'Il campo &egrave; obbligatorio.',
  14278. reqChkByName: 'Selezionare un(a) {label}.',
  14279. match: 'Il valore deve corrispondere al campo {matchName}',
  14280. startDate: "data d'inizio",
  14281. endDate: 'data di fine',
  14282. currentDate: 'data attuale',
  14283. afterDate: 'La data deve corrispondere o essere successiva al {label}.',
  14284. beforeDate: 'La data deve corrispondere o essere precedente al {label}.',
  14285. startMonth: "Selezionare un mese d'inizio",
  14286. sameMonth: 'Le due date devono essere dello stesso mese - occorre modificarne una.'
  14287. });
  14288. /*
  14289. ---
  14290. name: Locale.ja-JP.Date
  14291. description: Date messages for Japanese.
  14292. license: MIT-style license
  14293. authors:
  14294. - Noritaka Horio
  14295. requires:
  14296. - Locale
  14297. provides: [Locale.ja-JP.Date]
  14298. ...
  14299. */
  14300. Locale.define('ja-JP', 'Date', {
  14301. months: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  14302. months_abbr: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  14303. days: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
  14304. days_abbr: ['日', '月', '火', '水', '木', '金', '土'],
  14305. // Culture's date order: YYYY/MM/DD
  14306. dateOrder: ['year', 'month', 'date'],
  14307. shortDate: '%Y/%m/%d',
  14308. shortTime: '%H:%M',
  14309. AM: '午前',
  14310. PM: '午後',
  14311. firstDayOfWeek: 0,
  14312. // Date.Extras
  14313. ordinal: '',
  14314. lessThanMinuteAgo: '1分以内前',
  14315. minuteAgo: '約1分前',
  14316. minutesAgo: '約{delta}分前',
  14317. hourAgo: '約1時間前',
  14318. hoursAgo: '約{delta}時間前',
  14319. dayAgo: '1日前',
  14320. daysAgo: '{delta}日前',
  14321. weekAgo: '1週間前',
  14322. weeksAgo: '{delta}週間前',
  14323. monthAgo: '1ヶ月前',
  14324. monthsAgo: '{delta}ヶ月前',
  14325. yearAgo: '1年前',
  14326. yearsAgo: '{delta}年前',
  14327. lessThanMinuteUntil: '今から約1分以内',
  14328. minuteUntil: '今から約1分',
  14329. minutesUntil: '今から約{delta}分',
  14330. hourUntil: '今から約1時間',
  14331. hoursUntil: '今から約{delta}時間',
  14332. dayUntil: '今から1日間',
  14333. daysUntil: '今から{delta}日間',
  14334. weekUntil: '今から1週間',
  14335. weeksUntil: '今から{delta}週間',
  14336. monthUntil: '今から1ヶ月',
  14337. monthsUntil: '今から{delta}ヶ月',
  14338. yearUntil: '今から1年',
  14339. yearsUntil: '今から{delta}年'
  14340. });
  14341. /*
  14342. ---
  14343. name: Locale.ja-JP.Form.Validator
  14344. description: Form Validator messages for Japanese.
  14345. license: MIT-style license
  14346. authors:
  14347. - Noritaka Horio
  14348. requires:
  14349. - Locale
  14350. provides: [Locale.ja-JP.Form.Validator]
  14351. ...
  14352. */
  14353. Locale.define('ja-JP', 'FormValidator', {
  14354. required: '入力は必須です。',
  14355. minLength: '入力文字数は{minLength}以上にしてください。({length}文字)',
  14356. maxLength: '入力文字数は{maxLength}以下にしてください。({length}文字)',
  14357. integer: '整数を入力してください。',
  14358. numeric: '入力できるのは数値だけです。(例: "1", "1.1", "-1", "-1.1"....)',
  14359. digits: '入力できるのは数値と句読記号です。 (例: -や+を含む電話番号など).',
  14360. alpha: '入力できるのは半角英字だけです。それ以外の文字は入力できません。',
  14361. alphanum: '入力できるのは半角英数字だけです。それ以外の文字は入力できません。',
  14362. dateSuchAs: '有効な日付を入力してください。{date}',
  14363. dateInFormatMDY: '日付の書式に誤りがあります。YYYY/MM/DD (i.e. "1999/12/31")',
  14364. email: 'メールアドレスに誤りがあります。',
  14365. url: 'URLアドレスに誤りがあります。',
  14366. currencyDollar: '金額に誤りがあります。',
  14367. oneRequired: 'ひとつ以上入力してください。',
  14368. errorPrefix: 'エラー: ',
  14369. warningPrefix: '警告: ',
  14370. // FormValidator.Extras
  14371. noSpace: 'スペースは入力できません。',
  14372. reqChkByNode: '選択されていません。',
  14373. requiredChk: 'この項目は必須です。',
  14374. reqChkByName: '{label}を選択してください。',
  14375. match: '{matchName}が入力されている場合必須です。',
  14376. startDate: '開始日',
  14377. endDate: '終了日',
  14378. currentDate: '今日',
  14379. afterDate: '{label}以降の日付にしてください。',
  14380. beforeDate: '{label}以前の日付にしてください。',
  14381. startMonth: '開始月を選択してください。',
  14382. sameMonth: '日付が同一です。どちらかを変更してください。'
  14383. });
  14384. /*
  14385. ---
  14386. name: Locale.ja-JP.Number
  14387. description: Number messages for Japanese.
  14388. license: MIT-style license
  14389. authors:
  14390. - Noritaka Horio
  14391. requires:
  14392. - Locale
  14393. provides: [Locale.ja-JP.Number]
  14394. ...
  14395. */
  14396. Locale.define('ja-JP', 'Number', {
  14397. decimal: '.',
  14398. group: ',',
  14399. currency: {
  14400. decimals: 0,
  14401. prefix: '\\'
  14402. }
  14403. });
  14404. /*
  14405. ---
  14406. name: Locale.nl-NL.Date
  14407. description: Date messages for Dutch.
  14408. license: MIT-style license
  14409. authors:
  14410. - Lennart Pilon
  14411. - Tim Wienk
  14412. requires:
  14413. - Locale
  14414. provides: [Locale.nl-NL.Date]
  14415. ...
  14416. */
  14417. Locale.define('nl-NL', 'Date', {
  14418. months: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
  14419. months_abbr: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
  14420. days: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
  14421. days_abbr: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
  14422. // Culture's date order: DD-MM-YYYY
  14423. dateOrder: ['date', 'month', 'year'],
  14424. shortDate: '%d-%m-%Y',
  14425. shortTime: '%H:%M',
  14426. AM: 'AM',
  14427. PM: 'PM',
  14428. firstDayOfWeek: 1,
  14429. // Date.Extras
  14430. ordinal: 'e',
  14431. lessThanMinuteAgo: 'minder dan een minuut geleden',
  14432. minuteAgo: 'ongeveer een minuut geleden',
  14433. minutesAgo: '{delta} minuten geleden',
  14434. hourAgo: 'ongeveer een uur geleden',
  14435. hoursAgo: 'ongeveer {delta} uur geleden',
  14436. dayAgo: 'een dag geleden',
  14437. daysAgo: '{delta} dagen geleden',
  14438. weekAgo: 'een week geleden',
  14439. weeksAgo: '{delta} weken geleden',
  14440. monthAgo: 'een maand geleden',
  14441. monthsAgo: '{delta} maanden geleden',
  14442. yearAgo: 'een jaar geleden',
  14443. yearsAgo: '{delta} jaar geleden',
  14444. lessThanMinuteUntil: 'over minder dan een minuut',
  14445. minuteUntil: 'over ongeveer een minuut',
  14446. minutesUntil: 'over {delta} minuten',
  14447. hourUntil: 'over ongeveer een uur',
  14448. hoursUntil: 'over {delta} uur',
  14449. dayUntil: 'over ongeveer een dag',
  14450. daysUntil: 'over {delta} dagen',
  14451. weekUntil: 'over een week',
  14452. weeksUntil: 'over {delta} weken',
  14453. monthUntil: 'over een maand',
  14454. monthsUntil: 'over {delta} maanden',
  14455. yearUntil: 'over een jaar',
  14456. yearsUntil: 'over {delta} jaar'
  14457. });
  14458. /*
  14459. ---
  14460. name: Locale.nl-NL.Form.Validator
  14461. description: Form Validator messages for Dutch.
  14462. license: MIT-style license
  14463. authors:
  14464. - Lennart Pilon
  14465. - Arian Stolwijk
  14466. - Tim Wienk
  14467. requires:
  14468. - Locale
  14469. provides: [Locale.nl-NL.Form.Validator]
  14470. ...
  14471. */
  14472. Locale.define('nl-NL', 'FormValidator', {
  14473. required: 'Dit veld is verplicht.',
  14474. length: 'Vul precies {length} karakters in (je hebt {elLength} karakters ingevoerd).',
  14475. minLength: 'Vul minimaal {minLength} karakters in (je hebt {length} karakters ingevoerd).',
  14476. maxLength: 'Vul niet meer dan {maxLength} karakters in (je hebt {length} karakters ingevoerd).',
  14477. integer: 'Vul een getal in. Getallen met decimalen (bijvoorbeeld 1.25) zijn niet toegestaan.',
  14478. numeric: 'Vul alleen numerieke waarden in (bijvoorbeeld "1" of "1.1" of "-1" of "-1.1").',
  14479. digits: 'Vul alleen nummers en leestekens in (bijvoorbeeld een telefoonnummer met streepjes is toegestaan).',
  14480. alpha: 'Vul alleen letters in (a-z). Spaties en andere karakters zijn niet toegestaan.',
  14481. alphanum: 'Vul alleen letters (a-z) of nummers (0-9) in. Spaties en andere karakters zijn niet toegestaan.',
  14482. dateSuchAs: 'Vul een geldige datum in, zoals {date}',
  14483. dateInFormatMDY: 'Vul een geldige datum, in het formaat MM/DD/YYYY (bijvoorbeeld "12/31/1999")',
  14484. email: 'Vul een geldig e-mailadres in. Bijvoorbeeld "fred@domein.nl".',
  14485. url: 'Vul een geldige URL in, zoals http://www.example.com.',
  14486. currencyDollar: 'Vul een geldig $ bedrag in. Bijvoorbeeld $100.00 .',
  14487. oneRequired: 'Vul iets in bij in ieder geval een van deze velden.',
  14488. warningPrefix: 'Waarschuwing: ',
  14489. errorPrefix: 'Fout: ',
  14490. // Form.Validator.Extras
  14491. noSpace: 'Spaties zijn niet toegestaan in dit veld.',
  14492. reqChkByNode: 'Er zijn geen items geselecteerd.',
  14493. requiredChk: 'Dit veld is verplicht.',
  14494. reqChkByName: 'Selecteer een {label}.',
  14495. match: 'Dit veld moet overeen komen met het {matchName} veld',
  14496. startDate: 'de begin datum',
  14497. endDate: 'de eind datum',
  14498. currentDate: 'de huidige datum',
  14499. afterDate: 'De datum moet hetzelfde of na {label} zijn.',
  14500. beforeDate: 'De datum moet hetzelfde of voor {label} zijn.',
  14501. startMonth: 'Selecteer een begin maand',
  14502. sameMonth: 'Deze twee data moeten in dezelfde maand zijn - u moet een van beide aanpassen.',
  14503. creditcard: 'Het ingevulde creditcardnummer is niet geldig. Controleer het nummer en probeer opnieuw. {length} getallen ingevuld.'
  14504. });
  14505. /*
  14506. ---
  14507. name: Locale.nl-NL.Number
  14508. description: Number messages for Dutch.
  14509. license: MIT-style license
  14510. authors:
  14511. - Arian Stolwijk
  14512. requires:
  14513. - Locale
  14514. - Locale.EU.Number
  14515. provides: [Locale.nl-NL.Number]
  14516. ...
  14517. */
  14518. Locale.define('nl-NL').inherit('EU', 'Number');
  14519. /*
  14520. ---
  14521. name: Locale.no-NO.Date
  14522. description: Date messages for Norwegian.
  14523. license: MIT-style license
  14524. authors:
  14525. - Espen 'Rexxars' Hovlandsdal
  14526. - Ole Tøsse Kolvik
  14527. requires:
  14528. - Locale
  14529. provides: [Locale.no-NO.Date]
  14530. ...
  14531. */
  14532. Locale.define('no-NO', 'Date', {
  14533. months: ['Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'],
  14534. months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
  14535. days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
  14536. days_abbr: ['Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'],
  14537. // Culture's date order: DD.MM.YYYY
  14538. dateOrder: ['date', 'month', 'year'],
  14539. shortDate: '%d.%m.%Y',
  14540. shortTime: '%H:%M',
  14541. AM: 'AM',
  14542. PM: 'PM',
  14543. firstDayOfWeek: 1,
  14544. lessThanMinuteAgo: 'mindre enn et minutt siden',
  14545. minuteAgo: 'omtrent et minutt siden',
  14546. minutesAgo: '{delta} minutter siden',
  14547. hourAgo: 'omtrent en time siden',
  14548. hoursAgo: 'omtrent {delta} timer siden',
  14549. dayAgo: '{delta} dag siden',
  14550. daysAgo: '{delta} dager siden',
  14551. weekAgo: 'en uke siden',
  14552. weeksAgo: '{delta} uker siden',
  14553. monthAgo: 'en måned siden',
  14554. monthsAgo: '{delta} måneder siden',
  14555. yearAgo: 'ett år siden',
  14556. yearsAgo: '{delta} år siden',
  14557. lessThanMinuteUntil: 'mindre enn et minutt til',
  14558. minuteUntil: 'omtrent et minutt til',
  14559. minutesUntil: '{delta} minutter til',
  14560. hourUntil: 'omtrent en time til',
  14561. hoursUntil: 'omtrent {delta} timer til',
  14562. dayUntil: 'en dag til',
  14563. daysUntil: '{delta} dager til',
  14564. weekUntil: 'en uke til',
  14565. weeksUntil: '{delta} uker til',
  14566. monthUntil: 'en måned til',
  14567. monthsUntil: '{delta} måneder til',
  14568. yearUntil: 'et år til',
  14569. yearsUntil: '{delta} år til'
  14570. });
  14571. /*
  14572. ---
  14573. name: Locale.no-NO.Form.Validator
  14574. description: Form Validator messages for Norwegian.
  14575. license: MIT-style license
  14576. authors:
  14577. - Aaron Newton
  14578. - Espen 'Rexxars' Hovlandsdal
  14579. - Ole Tøsse Kolvik
  14580. requires:
  14581. - Locale
  14582. provides: [Locale.no-NO.Form.Validator]
  14583. ...
  14584. */
  14585. Locale.define('no-NO', 'FormValidator', {
  14586. required: 'Dette feltet er påkrevd.',
  14587. length: 'Skriv inn {length} tegn (du skrev {elLength} tegn)',
  14588. minLength: 'Skriv inn minst {minLength} tegn (du skrev {length} tegn).',
  14589. maxLength: 'Ikke skriv mer enn {maxLength} tegn (du skrev {length} tegn).',
  14590. integer: 'Skriv inn et tall i dette feltet. Tall med desimaler (f.eks. 1,25) er ikke tillat.',
  14591. numeric: 'Skriv kun inn numeriske verdier i dette feltet (f.eks. "1", "1.1", "-1" eller "-1.1").',
  14592. digits: 'Skriv kun nummer og skilletegn i dette feltet.',
  14593. alpha: 'Skriv kun bokstaver (a-å) i dette feltet. Ingen mellomrom eller andre tegn er tillat.',
  14594. alphanum: 'Skriv kun bokstaver (a-å) eller nummer (0-9) i dette feltet. Ingen mellomrom eller andre tegn er tillat.',
  14595. dateSuchAs: 'Skriv inn en gyldig dato, som f.eks. {date}',
  14596. dateInFormatMDY: 'Skriv inn en gyldig dato, f.eks. DD/MM/YYYY ("31/12/1999")',
  14597. email: 'Skriv inn en gyldig epost-adresse. F.eks. "ola.nordmann@example.com".',
  14598. url: 'Skriv inn en gyldig URL, f.eks. http://www.example.com.',
  14599. currencyDollar: 'Skriv inn et gyldig beløp. F.eks. 100,00.',
  14600. oneRequired: 'Minst ett av disse feltene må fylles ut.',
  14601. errorPrefix: 'Feil: ',
  14602. warningPrefix: 'Advarsel: ',
  14603. // Form.Validator.Extras
  14604. noSpace: 'Mellomrom er ikke tillatt i dette feltet.',
  14605. reqChkByNode: 'Ingen objekter er valgt.',
  14606. requiredChk: 'Dette feltet er påkrevd.',
  14607. reqChkByName: 'Velg en {label}.',
  14608. match: 'Dette feltet må være lik {matchName}',
  14609. startDate: 'startdato',
  14610. endDate: 'sluttdato',
  14611. currentDate: 'dagens dato',
  14612. afterDate: 'Datoen må være den samme som eller etter {label}.',
  14613. beforeDate: 'Datoen må være den samme som eller før {label}.',
  14614. startMonth: 'Velg en startmåned',
  14615. sameMonth: 'Datoene må være i den samme måneden - velg den ene eller den andre.',
  14616. creditcard: 'Kortnummeret du skrev inn er ikke gyldig. Prøv igjen. Du skrev {length} siffer.'
  14617. });
  14618. /*
  14619. ---
  14620. name: Locale.no-NO.Number
  14621. description: Number messages for Norwegian.
  14622. license: MIT-style license
  14623. authors:
  14624. - Arian Stolwijk
  14625. - Martin Lundgren
  14626. - Ole T�sse Kolvik
  14627. requires:
  14628. - Locale
  14629. - Locale.EU.Number
  14630. provides: [Locale.no-NO.Number]
  14631. ...
  14632. */
  14633. Locale.define('no-NO', 'Number', {
  14634. currency: {
  14635. prefix: 'NOK '
  14636. }
  14637. }).inherit('EU', 'Number');
  14638. /*
  14639. ---
  14640. name: Locale.pl-PL.Date
  14641. description: Date messages for Polish.
  14642. license: MIT-style license
  14643. authors:
  14644. - Oskar Krawczyk
  14645. requires:
  14646. - Locale
  14647. provides: [Locale.pl-PL.Date]
  14648. ...
  14649. */
  14650. Locale.define('pl-PL', 'Date', {
  14651. months: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'],
  14652. months_abbr: ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
  14653. days: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],
  14654. days_abbr: ['niedz.', 'pon.', 'wt.', 'śr.', 'czw.', 'pt.', 'sob.'],
  14655. // Culture's date order: YYYY-MM-DD
  14656. dateOrder: ['year', 'month', 'date'],
  14657. shortDate: '%Y-%m-%d',
  14658. shortTime: '%H:%M',
  14659. AM: 'nad ranem',
  14660. PM: 'po południu',
  14661. firstDayOfWeek: 1,
  14662. // Date.Extras
  14663. ordinal: function(dayOfMonth){
  14664. return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ty' : ['ty', 'szy', 'gi', 'ci', 'ty'][Math.min(dayOfMonth % 10, 4)];
  14665. },
  14666. lessThanMinuteAgo: 'mniej niż minute temu',
  14667. minuteAgo: 'około minutę temu',
  14668. minutesAgo: '{delta} minut temu',
  14669. hourAgo: 'około godzinę temu',
  14670. hoursAgo: 'około {delta} godzin temu',
  14671. dayAgo: 'Wczoraj',
  14672. daysAgo: '{delta} dni temu',
  14673. lessThanMinuteUntil: 'za niecałą minutę',
  14674. minuteUntil: 'za około minutę',
  14675. minutesUntil: 'za {delta} minut',
  14676. hourUntil: 'za około godzinę',
  14677. hoursUntil: 'za około {delta} godzin',
  14678. dayUntil: 'za 1 dzień',
  14679. daysUntil: 'za {delta} dni'
  14680. });
  14681. /*
  14682. ---
  14683. name: Locale.pl-PL.Form.Validator
  14684. description: Form Validator messages for Polish.
  14685. license: MIT-style license
  14686. authors:
  14687. - Oskar Krawczyk
  14688. requires:
  14689. - Locale
  14690. provides: [Locale.pl-PL.Form.Validator]
  14691. ...
  14692. */
  14693. Locale.define('pl-PL', 'FormValidator', {
  14694. required: 'To pole jest wymagane.',
  14695. minLength: 'Wymagane jest przynajmniej {minLength} znaków (wpisanych zostało tylko {length}).',
  14696. maxLength: 'Dozwolone jest nie więcej niż {maxLength} znaków (wpisanych zostało {length})',
  14697. integer: 'To pole wymaga liczb całych. Liczby dziesiętne (np. 1.25) są niedozwolone.',
  14698. numeric: 'Prosimy używać tylko numerycznych wartości w tym polu (np. "1", "1.1", "-1" lub "-1.1").',
  14699. digits: 'Prosimy używać liczb oraz zankow punktuacyjnych w typ polu (dla przykładu, przy numerze telefonu myślniki i kropki są dozwolone).',
  14700. alpha: 'Prosimy używać tylko liter (a-z) w tym polu. Spacje oraz inne znaki są niedozwolone.',
  14701. alphanum: 'Prosimy używać tylko liter (a-z) lub liczb (0-9) w tym polu. Spacje oraz inne znaki są niedozwolone.',
  14702. dateSuchAs: 'Prosimy podać prawidłową datę w formacie: {date}',
  14703. dateInFormatMDY: 'Prosimy podać poprawną date w formacie DD.MM.RRRR (i.e. "12.01.2009")',
  14704. email: 'Prosimy podać prawidłowy adres e-mail, np. "jan@domena.pl".',
  14705. url: 'Prosimy podać prawidłowy adres URL, np. http://www.example.com.',
  14706. currencyDollar: 'Prosimy podać prawidłową sumę w PLN. Dla przykładu: 100.00 PLN.',
  14707. oneRequired: 'Prosimy wypełnić chociaż jedno z pól.',
  14708. errorPrefix: 'Błąd: ',
  14709. warningPrefix: 'Uwaga: ',
  14710. // Form.Validator.Extras
  14711. noSpace: 'W tym polu nie mogą znajdować się spacje.',
  14712. reqChkByNode: 'Brak zaznaczonych elementów.',
  14713. requiredChk: 'To pole jest wymagane.',
  14714. reqChkByName: 'Prosimy wybrać z {label}.',
  14715. match: 'To pole musi być takie samo jak {matchName}',
  14716. startDate: 'data początkowa',
  14717. endDate: 'data końcowa',
  14718. currentDate: 'aktualna data',
  14719. afterDate: 'Podana data poinna być taka sama lub po {label}.',
  14720. beforeDate: 'Podana data poinna być taka sama lub przed {label}.',
  14721. startMonth: 'Prosimy wybrać początkowy miesiąc.',
  14722. sameMonth: 'Te dwie daty muszą być w zakresie tego samego miesiąca - wymagana jest zmiana któregoś z pól.'
  14723. });
  14724. /*
  14725. ---
  14726. name: Locale.pt-PT.Date
  14727. description: Date messages for Portuguese.
  14728. license: MIT-style license
  14729. authors:
  14730. - Fabio Miranda Costa
  14731. requires:
  14732. - Locale
  14733. provides: [Locale.pt-PT.Date]
  14734. ...
  14735. */
  14736. Locale.define('pt-PT', 'Date', {
  14737. months: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
  14738. months_abbr: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
  14739. days: ['Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'],
  14740. days_abbr: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
  14741. // Culture's date order: DD-MM-YYYY
  14742. dateOrder: ['date', 'month', 'year'],
  14743. shortDate: '%d-%m-%Y',
  14744. shortTime: '%H:%M',
  14745. AM: 'AM',
  14746. PM: 'PM',
  14747. firstDayOfWeek: 1,
  14748. // Date.Extras
  14749. ordinal: 'º',
  14750. lessThanMinuteAgo: 'há menos de um minuto',
  14751. minuteAgo: 'há cerca de um minuto',
  14752. minutesAgo: 'há {delta} minutos',
  14753. hourAgo: 'há cerca de uma hora',
  14754. hoursAgo: 'há cerca de {delta} horas',
  14755. dayAgo: 'há um dia',
  14756. daysAgo: 'há {delta} dias',
  14757. weekAgo: 'há uma semana',
  14758. weeksAgo: 'há {delta} semanas',
  14759. monthAgo: 'há um mês',
  14760. monthsAgo: 'há {delta} meses',
  14761. yearAgo: 'há um ano',
  14762. yearsAgo: 'há {delta} anos',
  14763. lessThanMinuteUntil: 'em menos de um minuto',
  14764. minuteUntil: 'em um minuto',
  14765. minutesUntil: 'em {delta} minutos',
  14766. hourUntil: 'em uma hora',
  14767. hoursUntil: 'em {delta} horas',
  14768. dayUntil: 'em um dia',
  14769. daysUntil: 'em {delta} dias',
  14770. weekUntil: 'em uma semana',
  14771. weeksUntil: 'em {delta} semanas',
  14772. monthUntil: 'em um mês',
  14773. monthsUntil: 'em {delta} meses',
  14774. yearUntil: 'em um ano',
  14775. yearsUntil: 'em {delta} anos'
  14776. });
  14777. /*
  14778. ---
  14779. name: Locale.pt-BR.Date
  14780. description: Date messages for Portuguese (Brazil).
  14781. license: MIT-style license
  14782. authors:
  14783. - Fabio Miranda Costa
  14784. requires:
  14785. - Locale
  14786. - Locale.pt-PT.Date
  14787. provides: [Locale.pt-BR.Date]
  14788. ...
  14789. */
  14790. Locale.define('pt-BR', 'Date', {
  14791. // Culture's date order: DD/MM/YYYY
  14792. shortDate: '%d/%m/%Y'
  14793. }).inherit('pt-PT', 'Date');
  14794. /*
  14795. ---
  14796. name: Locale.pt-BR.Form.Validator
  14797. description: Form Validator messages for Portuguese (Brazil).
  14798. license: MIT-style license
  14799. authors:
  14800. - Fábio Miranda Costa
  14801. requires:
  14802. - Locale
  14803. provides: [Locale.pt-BR.Form.Validator]
  14804. ...
  14805. */
  14806. Locale.define('pt-BR', 'FormValidator', {
  14807. required: 'Este campo é obrigatório.',
  14808. minLength: 'Digite pelo menos {minLength} caracteres (tamanho atual: {length}).',
  14809. maxLength: 'Não digite mais de {maxLength} caracteres (tamanho atual: {length}).',
  14810. integer: 'Por favor digite apenas um número inteiro neste campo. Não são permitidos números decimais (por exemplo, 1,25).',
  14811. numeric: 'Por favor digite apenas valores numéricos neste campo (por exemplo, "1" ou "1.1" ou "-1" ou "-1,1").',
  14812. 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).',
  14813. alpha: 'Por favor use somente letras (a-z). Espaço e outros caracteres não são permitidos.',
  14814. alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Espaço e outros caracteres não são permitidos.',
  14815. dateSuchAs: 'Digite uma data válida, como {date}',
  14816. dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (por exemplo, "31/12/1999")',
  14817. email: 'Digite um endereço de email válido. Por exemplo "nome@dominio.com".',
  14818. url: 'Digite uma URL válida. Exemplo: http://www.example.com.',
  14819. currencyDollar: 'Digite um valor em dinheiro válido. Exemplo: R$100,00 .',
  14820. oneRequired: 'Digite algo para pelo menos um desses campos.',
  14821. errorPrefix: 'Erro: ',
  14822. warningPrefix: 'Aviso: ',
  14823. // Form.Validator.Extras
  14824. noSpace: 'Não é possível digitar espaços neste campo.',
  14825. reqChkByNode: 'Não foi selecionado nenhum item.',
  14826. requiredChk: 'Este campo é obrigatório.',
  14827. reqChkByName: 'Por favor digite um {label}.',
  14828. match: 'Este campo deve ser igual ao campo {matchName}.',
  14829. startDate: 'a data inicial',
  14830. endDate: 'a data final',
  14831. currentDate: 'a data atual',
  14832. afterDate: 'A data deve ser igual ou posterior a {label}.',
  14833. beforeDate: 'A data deve ser igual ou anterior a {label}.',
  14834. startMonth: 'Por favor selecione uma data inicial.',
  14835. sameMonth: 'Estas duas datas devem ter o mesmo mês - você deve modificar uma das duas.',
  14836. 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.'
  14837. });
  14838. /*
  14839. ---
  14840. name: Locale.pt-BR.Number
  14841. description: Number messages for PT Brazilian.
  14842. license: MIT-style license
  14843. authors:
  14844. - Arian Stolwijk
  14845. - Danillo César
  14846. requires:
  14847. - Locale
  14848. provides: [Locale.pt-BR.Number]
  14849. ...
  14850. */
  14851. Locale.define('pt-BR', 'Number', {
  14852. decimal: ',',
  14853. group: '.',
  14854. currency: {
  14855. prefix: 'R$ '
  14856. }
  14857. });
  14858. /*
  14859. ---
  14860. name: Locale.pt-PT.Form.Validator
  14861. description: Form Validator messages for Portuguese.
  14862. license: MIT-style license
  14863. authors:
  14864. - Miquel Hudin
  14865. requires:
  14866. - Locale
  14867. provides: [Locale.pt-PT.Form.Validator]
  14868. ...
  14869. */
  14870. Locale.define('pt-PT', 'FormValidator', {
  14871. required: 'Este campo é necessário.',
  14872. minLength: 'Digite pelo menos{minLength} caracteres (comprimento {length} caracteres).',
  14873. maxLength: 'Não insira mais de {maxLength} caracteres (comprimento {length} caracteres).',
  14874. integer: 'Digite um número inteiro neste domínio. Com números decimais (por exemplo, 1,25), não são permitidas.',
  14875. numeric: 'Digite apenas valores numéricos neste domínio (p.ex., "1" ou "1.1" ou "-1" ou "-1,1").',
  14876. 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).',
  14877. alpha: 'Por favor use somente letras (a-z), com nesta área. Não utilize espaços nem outros caracteres são permitidos.',
  14878. alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Não utilize espaços nem outros caracteres são permitidos.',
  14879. dateSuchAs: 'Digite uma data válida, como {date}',
  14880. dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (p.ex. "31/12/1999")',
  14881. email: 'Digite um endereço de email válido. Por exemplo "fred@domain.com".',
  14882. url: 'Digite uma URL válida, como http://www.example.com.',
  14883. currencyDollar: 'Digite um valor válido $. Por exemplo $ 100,00. ',
  14884. oneRequired: 'Digite algo para pelo menos um desses insumos.',
  14885. errorPrefix: 'Erro: ',
  14886. warningPrefix: 'Aviso: '
  14887. });
  14888. /*
  14889. ---
  14890. name: Locale.ru-RU-unicode.Date
  14891. description: Date messages for Russian (utf-8).
  14892. license: MIT-style license
  14893. authors:
  14894. - Evstigneev Pavel
  14895. - Kuryanovich Egor
  14896. requires:
  14897. - Locale
  14898. provides: [Locale.ru-RU.Date]
  14899. ...
  14900. */
  14901. (function(){
  14902. // Russian language pluralization rules, taken from CLDR project, http://unicode.org/cldr/
  14903. // one -> n mod 10 is 1 and n mod 100 is not 11;
  14904. // few -> n mod 10 in 2..4 and n mod 100 not in 12..14;
  14905. // many -> n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14;
  14906. // other -> everything else (example 3.14)
  14907. var pluralize = function(n, one, few, many, other){
  14908. var modulo10 = n % 10,
  14909. modulo100 = n % 100;
  14910. if (modulo10 == 1 && modulo100 != 11){
  14911. return one;
  14912. } else if ((modulo10 == 2 || modulo10 == 3 || modulo10 == 4) && !(modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){
  14913. return few;
  14914. } else if (modulo10 == 0 || (modulo10 == 5 || modulo10 == 6 || modulo10 == 7 || modulo10 == 8 || modulo10 == 9) || (modulo100 == 11 || modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){
  14915. return many;
  14916. } else {
  14917. return other;
  14918. }
  14919. };
  14920. Locale.define('ru-RU', 'Date', {
  14921. months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],
  14922. months_abbr: ['янв', 'февр', 'март', 'апр', 'май','июнь','июль','авг','сент','окт','нояб','дек'],
  14923. days: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
  14924. days_abbr: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
  14925. // Culture's date order: DD.MM.YYYY
  14926. dateOrder: ['date', 'month', 'year'],
  14927. shortDate: '%d.%m.%Y',
  14928. shortTime: '%H:%M',
  14929. AM: 'AM',
  14930. PM: 'PM',
  14931. firstDayOfWeek: 1,
  14932. // Date.Extras
  14933. ordinal: '',
  14934. lessThanMinuteAgo: 'меньше минуты назад',
  14935. minuteAgo: 'минуту назад',
  14936. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'минуту', 'минуты', 'минут') + ' назад'; },
  14937. hourAgo: 'час назад',
  14938. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'час', 'часа', 'часов') + ' назад'; },
  14939. dayAgo: 'вчера',
  14940. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'день', 'дня', 'дней') + ' назад'; },
  14941. weekAgo: 'неделю назад',
  14942. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'неделя', 'недели', 'недель') + ' назад'; },
  14943. monthAgo: 'месяц назад',
  14944. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'месяц', 'месяца', 'месяцев') + ' назад'; },
  14945. yearAgo: 'год назад',
  14946. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'год', 'года', 'лет') + ' назад'; },
  14947. lessThanMinuteUntil: 'меньше чем через минуту',
  14948. minuteUntil: 'через минуту',
  14949. minutesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'минуту', 'минуты', 'минут') + ''; },
  14950. hourUntil: 'через час',
  14951. hoursUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'час', 'часа', 'часов') + ''; },
  14952. dayUntil: 'завтра',
  14953. daysUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'день', 'дня', 'дней') + ''; },
  14954. weekUntil: 'через неделю',
  14955. weeksUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'неделю', 'недели', 'недель') + ''; },
  14956. monthUntil: 'через месяц',
  14957. monthsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'месяц', 'месяца', 'месяцев') + ''; },
  14958. yearUntil: 'через',
  14959. yearsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'год', 'года', 'лет') + ''; }
  14960. });
  14961. //<1.2compat>
  14962. Locale.define('ru-RU-unicode').inherit('ru-RU', 'Date');
  14963. //</1.2compat>
  14964. })();
  14965. /*
  14966. ---
  14967. name: Locale.ru-RU-unicode.Form.Validator
  14968. description: Form Validator messages for Russian (utf-8).
  14969. license: MIT-style license
  14970. authors:
  14971. - Chernodarov Egor
  14972. requires:
  14973. - Locale
  14974. provides: [Locale.ru-RU.Form.Validator]
  14975. ...
  14976. */
  14977. Locale.define('ru-RU', 'FormValidator', {
  14978. required: 'Это поле обязательно к заполнению.',
  14979. minLength: 'Пожалуйста, введите хотя бы {minLength} символов (Вы ввели {length}).',
  14980. maxLength: 'Пожалуйста, введите не больше {maxLength} символов (Вы ввели {length}).',
  14981. integer: 'Пожалуйста, введите в это поле число. Дробные числа (например 1.25) тут не разрешены.',
  14982. numeric: 'Пожалуйста, введите в это поле число (например "1" или "1.1", или "-1", или "-1.1").',
  14983. digits: 'В этом поле Вы можете использовать только цифры и знаки пунктуации (например, телефонный номер со знаками дефиса или с точками).',
  14984. alpha: 'В этом поле можно использовать только латинские буквы (a-z). Пробелы и другие символы запрещены.',
  14985. alphanum: 'В этом поле можно использовать только латинские буквы (a-z) и цифры (0-9). Пробелы и другие символы запрещены.',
  14986. dateSuchAs: 'Пожалуйста, введите корректную дату {date}',
  14987. dateInFormatMDY: 'Пожалуйста, введите дату в формате ММ/ДД/ГГГГ (например "12/31/1999")',
  14988. email: 'Пожалуйста, введите корректный емейл-адрес. Для примера "fred@domain.com".',
  14989. url: 'Пожалуйста, введите правильную ссылку вида http://www.example.com.',
  14990. currencyDollar: 'Пожалуйста, введите сумму в долларах. Например: $100.00 .',
  14991. oneRequired: 'Пожалуйста, выберите хоть что-нибудь в одном из этих полей.',
  14992. errorPrefix: 'Ошибка: ',
  14993. warningPrefix: 'Внимание: '
  14994. });
  14995. //<1.2compat>
  14996. Locale.define('ru-RU-unicode').inherit('ru-RU', 'FormValidator');
  14997. //</1.2compat>
  14998. /*
  14999. ---
  15000. name: Locale.sk-SK.Date
  15001. description: Date messages for Slovak.
  15002. license: MIT-style license
  15003. authors:
  15004. - Ivan Masár
  15005. requires:
  15006. - Locale
  15007. provides: [Locale.sk-SK.Date]
  15008. ...
  15009. */
  15010. (function(){
  15011. // Slovak language pluralization rules, see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
  15012. // one -> n is 1; 1
  15013. // few -> n in 2..4; 2-4
  15014. // other -> everything else 0, 5-999, 1.31, 2.31, 5.31...
  15015. var pluralize = function(n, one, few, other){
  15016. if (n == 1) return one;
  15017. else if (n == 2 || n == 3 || n == 4) return few;
  15018. else return other;
  15019. };
  15020. Locale.define('sk-SK', 'Date', {
  15021. months: ['Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'December'],
  15022. months_abbr: ['januára', 'februára', 'marca', 'apríla', 'mája', 'júna', 'júla', 'augusta', 'septembra', 'októbra', 'novembra', 'decembra'],
  15023. days: ['Nedele', 'Pondelí', 'Úterý', 'Streda', 'Čtvrtek', 'Pátek', 'Sobota'],
  15024. days_abbr: ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so'],
  15025. // Culture's date order: DD.MM.YYYY
  15026. dateOrder: ['date', 'month', 'year'],
  15027. shortDate: '%d.%m.%Y',
  15028. shortTime: '%H:%M',
  15029. AM: 'dop.',
  15030. PM: 'pop.',
  15031. firstDayOfWeek: 1,
  15032. // Date.Extras
  15033. ordinal: '.',
  15034. lessThanMinuteAgo: 'pred chvíľou',
  15035. minuteAgo: 'približne pred minútou',
  15036. minutesAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'minútou', 'minútami', 'minútami'); },
  15037. hourAgo: 'približne pred hodinou',
  15038. hoursAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'hodinou', 'hodinami', 'hodinami'); },
  15039. dayAgo: 'pred dňom',
  15040. daysAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'dňom', 'dňami', 'dňami'); },
  15041. weekAgo: 'pred týždňom',
  15042. weeksAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'týždňom', 'týždňami', 'týždňami'); },
  15043. monthAgo: 'pred mesiacom',
  15044. monthsAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'mesiacom', 'mesiacmi', 'mesiacmi'); },
  15045. yearAgo: 'pred rokom',
  15046. yearsAgo: function(delta){ return 'pred {delta} ' + pluralize(delta, 'rokom', 'rokmi', 'rokmi'); },
  15047. lessThanMinuteUntil: 'o chvíľu',
  15048. minuteUntil: 'približne o minútu',
  15049. minutesUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'minútu', 'minúty', 'minúty'); },
  15050. hourUntil: 'približne o hodinu',
  15051. hoursUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'hodinu', 'hodiny', 'hodín'); },
  15052. dayUntil: 'o deň',
  15053. daysUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'deň', 'dni', 'dní'); },
  15054. weekUntil: 'o týždeň',
  15055. weeksUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'týždeň', 'týždne', 'týždňov'); },
  15056. monthUntil: 'o mesiac',
  15057. monthsUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'mesiac', 'mesiace', 'mesiacov'); },
  15058. yearUntil: 'o rok',
  15059. yearsUntil: function(delta){ return 'o {delta} ' + pluralize(delta, 'rok', 'roky', 'rokov'); }
  15060. });
  15061. })();
  15062. /*
  15063. ---
  15064. name: Locale.sk-SK.Form.Validator
  15065. description: Form Validator messages for Czech.
  15066. license: MIT-style license
  15067. authors:
  15068. - Ivan Masár
  15069. requires:
  15070. - Locale
  15071. provides: [Locale.sk-SK.Form.Validator]
  15072. ...
  15073. */
  15074. Locale.define('sk-SK', 'FormValidator', {
  15075. required: 'Táto položka je povinná.',
  15076. minLength: 'Zadajte prosím aspoň {minLength} znakov (momentálne {length} znakov).',
  15077. maxLength: 'Zadajte prosím menej ako {maxLength} znakov (momentálne {length} znakov).',
  15078. integer: 'Zadajte prosím celé číslo. Desetinné čísla (napr. 1.25) nie sú povolené.',
  15079. numeric: 'Zadajte len číselné hodnoty (t.j. „1“ alebo „1.1“ alebo „-1“ alebo „-1.1“).',
  15080. digits: 'Zadajte prosím len čísla a interpunkčné znamienka (napríklad telefónne číslo s pomlčkami albo bodkami je povolené).',
  15081. alpha: 'Zadajte prosím len písmená (a-z). Medzery alebo iné znaky nie sú povolené.',
  15082. alphanum: 'Zadajte prosím len písmená (a-z) alebo číslice (0-9). Medzery alebo iné znaky nie sú povolené.',
  15083. dateSuchAs: 'Zadajte prosím platný dátum v tvare {date}',
  15084. dateInFormatMDY: 'Zadajte prosím platný datum v tvare MM / DD / RRRR (t.j. „12/31/1999“)',
  15085. email: 'Zadajte prosím platnú emailovú adresu. Napríklad „fred@domain.com“.',
  15086. url: 'Zadajte prosím platnoú adresu URL v tvare http://www.example.com.',
  15087. currencyDollar: 'Zadajte prosím platnú čiastku. Napríklad $100.00.',
  15088. oneRequired: 'Zadajte prosím aspoň jednu hodnotu z týchto položiek.',
  15089. errorPrefix: 'Chyba: ',
  15090. warningPrefix: 'Upozornenie: ',
  15091. // Form.Validator.Extras
  15092. noSpace: 'V tejto položle nie sú povolené medzery',
  15093. reqChkByNode: 'Nie sú vybrané žiadne položky.',
  15094. requiredChk: 'Táto položka je povinná.',
  15095. reqChkByName: 'Prosím vyberte {label}.',
  15096. match: 'Táto položka sa musí zhodovať s položkou {matchName}',
  15097. startDate: 'dátum začiatku',
  15098. endDate: 'dátum ukončenia',
  15099. currendDate: 'aktuálny dátum',
  15100. afterDate: 'Dátum by mal býť rovnaký alebo väčší ako {label}.',
  15101. beforeDate: 'Dátum by mal byť rovnaký alebo menší ako {label}.',
  15102. startMonth: 'Vyberte počiatočný mesiac.',
  15103. sameMonth: 'Tieto dva dátumy musia býť v rovnakom mesiaci - zmeňte jeden z nich.',
  15104. creditcard: 'Zadané číslo kreditnej karty je neplatné. Prosím, opravte ho. Bolo zadaných {length} číslic.'
  15105. });
  15106. /*
  15107. ---
  15108. name: Locale.si-SI.Date
  15109. description: Date messages for Slovenian.
  15110. license: MIT-style license
  15111. authors:
  15112. - Radovan Lozej
  15113. requires:
  15114. - Locale
  15115. provides: [Locale.si-SI.Date]
  15116. ...
  15117. */
  15118. (function(){
  15119. var pluralize = function(n, one, two, three, other){
  15120. return (n >= 1 && n <= 3) ? arguments[n] : other;
  15121. };
  15122. Locale.define('sl-SI', 'Date', {
  15123. months: ['januar', 'februar', 'marec', 'april', 'maj', 'junij', 'julij', 'avgust', 'september', 'oktober', 'november', 'december'],
  15124. months_abbr: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'avg', 'sep', 'okt', 'nov', 'dec'],
  15125. days: ['nedelja', 'ponedeljek', 'torek', 'sreda', 'četrtek', 'petek', 'sobota'],
  15126. days_abbr: ['ned', 'pon', 'tor', 'sre', 'čet', 'pet', 'sob'],
  15127. // Culture's date order: DD.MM.YYYY
  15128. dateOrder: ['date', 'month', 'year'],
  15129. shortDate: '%d.%m.%Y',
  15130. shortTime: '%H.%M',
  15131. AM: 'AM',
  15132. PM: 'PM',
  15133. firstDayOfWeek: 1,
  15134. // Date.Extras
  15135. ordinal: '.',
  15136. lessThanMinuteAgo: 'manj kot minuto nazaj',
  15137. minuteAgo: 'minuto nazaj',
  15138. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'minuto', 'minuti', 'minute', 'minut') + ' nazaj'; },
  15139. hourAgo: 'uro nazaj',
  15140. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'uro', 'uri', 'ure', 'ur') + ' nazaj'; },
  15141. dayAgo: 'dan nazaj',
  15142. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'dan', 'dneva', 'dni', 'dni') + ' nazaj'; },
  15143. weekAgo: 'teden nazaj',
  15144. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'teden', 'tedna', 'tedne', 'tednov') + ' nazaj'; },
  15145. monthAgo: 'mesec nazaj',
  15146. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'mesec', 'meseca', 'mesece', 'mesecov') + ' nazaj'; },
  15147. yearthAgo: 'leto nazaj',
  15148. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'leto', 'leti', 'leta', 'let') + ' nazaj'; },
  15149. lessThanMinuteUntil: 'še manj kot minuto',
  15150. minuteUntil: 'še minuta',
  15151. minutesUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'minuta', 'minuti', 'minute', 'minut'); },
  15152. hourUntil: 'še ura',
  15153. hoursUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'ura', 'uri', 'ure', 'ur'); },
  15154. dayUntil: 'še dan',
  15155. daysUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'dan', 'dneva', 'dnevi', 'dni'); },
  15156. weekUntil: 'še tedn',
  15157. weeksUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'teden', 'tedna', 'tedni', 'tednov'); },
  15158. monthUntil: 'še mesec',
  15159. monthsUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'mesec', 'meseca', 'meseci', 'mesecov'); },
  15160. yearUntil: 'še leto',
  15161. yearsUntil: function(delta){ return 'še {delta} ' + pluralize(delta, 'leto', 'leti', 'leta', 'let'); }
  15162. });
  15163. })();
  15164. /*
  15165. ---
  15166. name: Locale.si-SI.Form.Validator
  15167. description: Form Validator messages for Slovenian.
  15168. license: MIT-style license
  15169. authors:
  15170. - Radovan Lozej
  15171. requires:
  15172. - Locale
  15173. provides: [Locale.si-SI.Form.Validator]
  15174. ...
  15175. */
  15176. Locale.define('sl-SI', 'FormValidator', {
  15177. required: 'To polje je obvezno',
  15178. minLength: 'Prosim, vnesite vsaj {minLength} znakov (vnesli ste {length} znakov).',
  15179. maxLength: 'Prosim, ne vnesite več kot {maxLength} znakov (vnesli ste {length} znakov).',
  15180. integer: 'Prosim, vnesite celo število. Decimalna števila (kot 1,25) niso dovoljena.',
  15181. numeric: 'Prosim, vnesite samo numerične vrednosti (kot "1" ali "1.1" ali "-1" ali "-1.1").',
  15182. digits: 'Prosim, uporabite številke in ločila le na tem polju (na primer, dovoljena je telefonska številka z pomišlaji ali pikami).',
  15183. alpha: 'Prosim, uporabite le črke v tem plju. Presledki in drugi znaki niso dovoljeni.',
  15184. alphanum: 'Prosim, uporabite samo črke ali številke v tem polju. Presledki in drugi znaki niso dovoljeni.',
  15185. dateSuchAs: 'Prosim, vnesite pravilen datum kot {date}',
  15186. dateInFormatMDY: 'Prosim, vnesite pravilen datum kot MM.DD.YYYY (primer "12.31.1999")',
  15187. email: 'Prosim, vnesite pravilen email naslov. Na primer "fred@domain.com".',
  15188. url: 'Prosim, vnesite pravilen URL kot http://www.example.com.',
  15189. currencyDollar: 'Prosim, vnesit epravilno vrednost €. Primer 100,00€ .',
  15190. oneRequired: 'Prosimo, vnesite nekaj za vsaj eno izmed teh polj.',
  15191. errorPrefix: 'Napaka: ',
  15192. warningPrefix: 'Opozorilo: ',
  15193. // Form.Validator.Extras
  15194. noSpace: 'To vnosno polje ne dopušča presledkov.',
  15195. reqChkByNode: 'Nič niste izbrali.',
  15196. requiredChk: 'To polje je obvezno',
  15197. reqChkByName: 'Prosim, izberite {label}.',
  15198. match: 'To polje se mora ujemati z poljem {matchName}',
  15199. startDate: 'datum začetka',
  15200. endDate: 'datum konca',
  15201. currentDate: 'trenuten datum',
  15202. afterDate: 'Datum bi moral biti isti ali po {label}.',
  15203. beforeDate: 'Datum bi moral biti isti ali pred {label}.',
  15204. startMonth: 'Prosim, vnesite začetni datum',
  15205. sameMonth: 'Ta dva datuma morata biti v istem mesecu - premeniti morate eno ali drugo.',
  15206. creditcard: 'Številka kreditne kartice ni pravilna. Preverite številko ali poskusite še enkrat. Vnešenih {length} znakov.'
  15207. });
  15208. /*
  15209. ---
  15210. name: Locale.sv-SE.Date
  15211. description: Date messages for Swedish.
  15212. license: MIT-style license
  15213. authors:
  15214. - Martin Lundgren
  15215. requires:
  15216. - Locale
  15217. provides: [Locale.sv-SE.Date]
  15218. ...
  15219. */
  15220. Locale.define('sv-SE', 'Date', {
  15221. months: ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'],
  15222. months_abbr: ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
  15223. days: ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'],
  15224. days_abbr: ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör'],
  15225. // Culture's date order: YYYY-MM-DD
  15226. dateOrder: ['year', 'month', 'date'],
  15227. shortDate: '%Y-%m-%d',
  15228. shortTime: '%H:%M',
  15229. AM: '',
  15230. PM: '',
  15231. firstDayOfWeek: 1,
  15232. // Date.Extras
  15233. ordinal: '',
  15234. lessThanMinuteAgo: 'mindre än en minut sedan',
  15235. minuteAgo: 'ungefär en minut sedan',
  15236. minutesAgo: '{delta} minuter sedan',
  15237. hourAgo: 'ungefär en timme sedan',
  15238. hoursAgo: 'ungefär {delta} timmar sedan',
  15239. dayAgo: '1 dag sedan',
  15240. daysAgo: '{delta} dagar sedan',
  15241. lessThanMinuteUntil: 'mindre än en minut sedan',
  15242. minuteUntil: 'ungefär en minut sedan',
  15243. minutesUntil: '{delta} minuter sedan',
  15244. hourUntil: 'ungefär en timme sedan',
  15245. hoursUntil: 'ungefär {delta} timmar sedan',
  15246. dayUntil: '1 dag sedan',
  15247. daysUntil: '{delta} dagar sedan'
  15248. });
  15249. /*
  15250. ---
  15251. name: Locale.sv-SE.Form.Validator
  15252. description: Form Validator messages for Swedish.
  15253. license: MIT-style license
  15254. authors:
  15255. - Martin Lundgren
  15256. requires:
  15257. - Locale
  15258. provides: [Locale.sv-SE.Form.Validator]
  15259. ...
  15260. */
  15261. Locale.define('sv-SE', 'FormValidator', {
  15262. required: 'Fältet är obligatoriskt.',
  15263. minLength: 'Ange minst {minLength} tecken (du angav {length} tecken).',
  15264. maxLength: 'Ange högst {maxLength} tecken (du angav {length} tecken). ',
  15265. integer: 'Ange ett heltal i fältet. Tal med decimaler (t.ex. 1,25) är inte tillåtna.',
  15266. numeric: 'Ange endast numeriska värden i detta fält (t.ex. "1" eller "1.1" eller "-1" eller "-1,1").',
  15267. digits: 'Använd endast siffror och skiljetecken i detta fält (till exempel ett telefonnummer med bindestreck tillåtet).',
  15268. alpha: 'Använd endast bokstäver (a-ö) i detta fält. Inga mellanslag eller andra tecken är tillåtna.',
  15269. alphanum: 'Använd endast bokstäver (a-ö) och siffror (0-9) i detta fält. Inga mellanslag eller andra tecken är tillåtna.',
  15270. dateSuchAs: 'Ange ett giltigt datum som t.ex. {date}',
  15271. dateInFormatMDY: 'Ange ett giltigt datum som t.ex. YYYY-MM-DD (i.e. "1999-12-31")',
  15272. email: 'Ange en giltig e-postadress. Till exempel "erik@domain.com".',
  15273. url: 'Ange en giltig webbadress som http://www.example.com.',
  15274. currencyDollar: 'Ange en giltig belopp. Exempelvis 100,00.',
  15275. oneRequired: 'Vänligen ange minst ett av dessa alternativ.',
  15276. errorPrefix: 'Fel: ',
  15277. warningPrefix: 'Varning: ',
  15278. // Form.Validator.Extras
  15279. noSpace: 'Det får inte finnas några mellanslag i detta fält.',
  15280. reqChkByNode: 'Inga objekt är valda.',
  15281. requiredChk: 'Detta är ett obligatoriskt fält.',
  15282. reqChkByName: 'Välj en {label}.',
  15283. match: 'Detta fält måste matcha {matchName}',
  15284. startDate: 'startdatumet',
  15285. endDate: 'slutdatum',
  15286. currentDate: 'dagens datum',
  15287. afterDate: 'Datumet bör vara samma eller senare än {label}.',
  15288. beforeDate: 'Datumet bör vara samma eller tidigare än {label}.',
  15289. startMonth: 'Välj en start månad',
  15290. sameMonth: 'Dessa två datum måste vara i samma månad - du måste ändra det ena eller det andra.'
  15291. });
  15292. /*
  15293. ---
  15294. name: Locale.sv-SE.Number
  15295. description: Number messages for Swedish.
  15296. license: MIT-style license
  15297. authors:
  15298. - Arian Stolwijk
  15299. - Martin Lundgren
  15300. requires:
  15301. - Locale
  15302. - Locale.EU.Number
  15303. provides: [Locale.sv-SE.Number]
  15304. ...
  15305. */
  15306. Locale.define('sv-SE', 'Number', {
  15307. currency: {
  15308. prefix: 'SEK '
  15309. }
  15310. }).inherit('EU', 'Number');
  15311. /*
  15312. ---
  15313. name: Locale.tr-TR.Date
  15314. description: Date messages for Turkish.
  15315. license: MIT-style license
  15316. authors:
  15317. - Faruk Can Bilir
  15318. requires:
  15319. - Locale
  15320. provides: [Locale.tr-TR.Date]
  15321. ...
  15322. */
  15323. Locale.define('tr-TR', 'Date', {
  15324. months: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'],
  15325. months_abbr: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'],
  15326. days: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'],
  15327. days_abbr: ['Pa', 'Pzt', 'Sa', 'Ça', 'Pe', 'Cu', 'Cmt'],
  15328. // Culture's date order: MM/DD/YYYY
  15329. dateOrder: ['date', 'month', 'year'],
  15330. shortDate: '%d/%m/%Y',
  15331. shortTime: '%H.%M',
  15332. AM: 'AM',
  15333. PM: 'PM',
  15334. firstDayOfWeek: 1,
  15335. // Date.Extras
  15336. ordinal: '',
  15337. lessThanMinuteAgo: 'bir dakikadan önce',
  15338. minuteAgo: 'yaklaşık bir dakika önce',
  15339. minutesAgo: '{delta} dakika önce',
  15340. hourAgo: 'bir saat kadar önce',
  15341. hoursAgo: '{delta} saat kadar önce',
  15342. dayAgo: 'bir gün önce',
  15343. daysAgo: '{delta} gün önce',
  15344. weekAgo: 'bir hafta önce',
  15345. weeksAgo: '{delta} hafta önce',
  15346. monthAgo: 'bir ay önce',
  15347. monthsAgo: '{delta} ay önce',
  15348. yearAgo: 'bir yıl önce',
  15349. yearsAgo: '{delta} yıl önce',
  15350. lessThanMinuteUntil: 'bir dakikadan az sonra',
  15351. minuteUntil: 'bir dakika kadar sonra',
  15352. minutesUntil: '{delta} dakika sonra',
  15353. hourUntil: 'bir saat kadar sonra',
  15354. hoursUntil: '{delta} saat kadar sonra',
  15355. dayUntil: 'bir gün sonra',
  15356. daysUntil: '{delta} gün sonra',
  15357. weekUntil: 'bir hafta sonra',
  15358. weeksUntil: '{delta} hafta sonra',
  15359. monthUntil: 'bir ay sonra',
  15360. monthsUntil: '{delta} ay sonra',
  15361. yearUntil: 'bir yıl sonra',
  15362. yearsUntil: '{delta} yıl sonra'
  15363. });
  15364. /*
  15365. ---
  15366. name: Locale.tr-TR.Form.Validator
  15367. description: Form Validator messages for Turkish.
  15368. license: MIT-style license
  15369. authors:
  15370. - Faruk Can Bilir
  15371. requires:
  15372. - Locale
  15373. provides: [Locale.tr-TR.Form.Validator]
  15374. ...
  15375. */
  15376. Locale.define('tr-TR', 'FormValidator', {
  15377. required: 'Bu alan zorunlu.',
  15378. minLength: 'Lütfen en az {minLength} karakter girin (siz {length} karakter girdiniz).',
  15379. maxLength: 'Lütfen en fazla {maxLength} karakter girin (siz {length} karakter girdiniz).',
  15380. integer: 'Lütfen bu alana sadece tamsayı girin. Ondalıklı sayılar (ör: 1.25) kullanılamaz.',
  15381. numeric: 'Lütfen bu alana sadece sayısal değer girin (ör: "1", "1.1", "-1" ya da "-1.1").',
  15382. 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).',
  15383. alpha: 'Lütfen bu alanda yalnızca harf kullanın. Boşluk ve diğer karakterler kullanılamaz.',
  15384. alphanum: 'Lütfen bu alanda sadece harf ve rakam kullanın. Boşluk ve diğer karakterler kullanılamaz.',
  15385. dateSuchAs: 'Lütfen geçerli bir tarih girin (Ör: {date})',
  15386. dateInFormatMDY: 'Lütfen geçerli bir tarih girin (GG/AA/YYYY, ör: "31/12/1999")',
  15387. email: 'Lütfen geçerli bir email adresi girin. Ör: "kemal@etikan.com".',
  15388. url: 'Lütfen geçerli bir URL girin. Ör: http://www.example.com.',
  15389. currencyDollar: 'Lütfen geçerli bir TL miktarı girin. Ör: 100,00 TL .',
  15390. oneRequired: 'Lütfen en az bir tanesini doldurun.',
  15391. errorPrefix: 'Hata: ',
  15392. warningPrefix: 'Uyarı: ',
  15393. // Form.Validator.Extras
  15394. noSpace: 'Bu alanda boşluk kullanılamaz.',
  15395. reqChkByNode: 'Hiçbir öğe seçilmemiş.',
  15396. requiredChk: 'Bu alan zorunlu.',
  15397. reqChkByName: 'Lütfen bir {label} girin.',
  15398. match: 'Bu alan, {matchName} alanıyla uyuşmalı',
  15399. startDate: 'başlangıç tarihi',
  15400. endDate: 'bitiş tarihi',
  15401. currentDate: 'bugünün tarihi',
  15402. afterDate: 'Tarih, {label} tarihiyle aynı gün ya da ondan sonra olmalıdır.',
  15403. beforeDate: 'Tarih, {label} tarihiyle aynı gün ya da ondan önce olmalıdır.',
  15404. startMonth: 'Lütfen bir başlangıç ayı seçin',
  15405. sameMonth: 'Bu iki tarih aynı ayda olmalı - bir tanesini değiştirmeniz gerekiyor.',
  15406. creditcard: 'Girdiğiniz kredi kartı numarası geçersiz. Lütfen kontrol edip tekrar deneyin. {length} hane girildi.'
  15407. });
  15408. /*
  15409. ---
  15410. name: Locale.tr-TR.Number
  15411. description: Number messages for Turkish.
  15412. license: MIT-style license
  15413. authors:
  15414. - Faruk Can Bilir
  15415. requires:
  15416. - Locale
  15417. - Locale.EU.Number
  15418. provides: [Locale.tr-TR.Number]
  15419. ...
  15420. */
  15421. Locale.define('tr-TR', 'Number', {
  15422. currency: {
  15423. decimals: 0,
  15424. suffix: ' TL'
  15425. }
  15426. }).inherit('EU', 'Number');
  15427. /*
  15428. ---
  15429. name: Locale.uk-UA.Date
  15430. description: Date messages for Ukrainian (utf-8).
  15431. license: MIT-style license
  15432. authors:
  15433. - Slik
  15434. requires:
  15435. - Locale
  15436. provides: [Locale.uk-UA.Date]
  15437. ...
  15438. */
  15439. (function(){
  15440. var pluralize = function(n, one, few, many, other){
  15441. var d = (n / 10).toInt(),
  15442. z = n % 10,
  15443. s = (n / 100).toInt();
  15444. if (d == 1 && n > 10) return many;
  15445. if (z == 1) return one;
  15446. if (z > 0 && z < 5) return few;
  15447. return many;
  15448. };
  15449. Locale.define('uk-UA', 'Date', {
  15450. months: ['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'],
  15451. months_abbr: ['Січ', 'Лют', 'Бер', 'Квіт', 'Трав', 'Черв', 'Лип', 'Серп', 'Вер', 'Жовт', 'Лист', 'Груд' ],
  15452. days: ['Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', "П'ятниця", 'Субота'],
  15453. days_abbr: ['Нд', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
  15454. // Culture's date order: DD/MM/YYYY
  15455. dateOrder: ['date', 'month', 'year'],
  15456. shortDate: '%d/%m/%Y',
  15457. shortTime: '%H:%M',
  15458. AM: 'до полудня',
  15459. PM: 'по полудню',
  15460. firstDayOfWeek: 1,
  15461. // Date.Extras
  15462. ordinal: '',
  15463. lessThanMinuteAgo: 'меньше хвилини тому',
  15464. minuteAgo: 'хвилину тому',
  15465. minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'хвилину', 'хвилини', 'хвилин') + ' тому'; },
  15466. hourAgo: 'годину тому',
  15467. hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'годину', 'години', 'годин') + ' тому'; },
  15468. dayAgo: 'вчора',
  15469. daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'день', 'дня', 'днів') + ' тому'; },
  15470. weekAgo: 'тиждень тому',
  15471. weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'тиждень', 'тижні', 'тижнів') + ' тому'; },
  15472. monthAgo: 'місяць тому',
  15473. monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'місяць', 'місяці', 'місяців') + ' тому'; },
  15474. yearAgo: 'рік тому',
  15475. yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'рік', 'роки', 'років') + ' тому'; },
  15476. lessThanMinuteUntil: 'за мить',
  15477. minuteUntil: 'через хвилину',
  15478. minutesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'хвилину', 'хвилини', 'хвилин'); },
  15479. hourUntil: 'через годину',
  15480. hoursUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'годину', 'години', 'годин'); },
  15481. dayUntil: 'завтра',
  15482. daysUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'день', 'дня', 'днів'); },
  15483. weekUntil: 'через тиждень',
  15484. weeksUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'тиждень', 'тижні', 'тижнів'); },
  15485. monthUntil: 'через місяць',
  15486. monthesUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'місяць', 'місяці', 'місяців'); },
  15487. yearUntil: 'через рік',
  15488. yearsUntil: function(delta){ return 'через {delta} ' + pluralize(delta, 'рік', 'роки', 'років'); }
  15489. });
  15490. })();
  15491. /*
  15492. ---
  15493. name: Locale.uk-UA.Form.Validator
  15494. description: Form Validator messages for Ukrainian (utf-8).
  15495. license: MIT-style license
  15496. authors:
  15497. - Slik
  15498. requires:
  15499. - Locale
  15500. provides: [Locale.uk-UA.Form.Validator]
  15501. ...
  15502. */
  15503. Locale.define('uk-UA', 'FormValidator', {
  15504. required: 'Це поле повинне бути заповненим.',
  15505. minLength: 'Введіть хоча б {minLength} символів (Ви ввели {length}).',
  15506. maxLength: 'Кількість символів не може бути більше {maxLength} (Ви ввели {length}).',
  15507. integer: 'Введіть в це поле число. Дробові числа (наприклад 1.25) не дозволені.',
  15508. numeric: 'Введіть в це поле число (наприклад "1" або "1.1", або "-1", або "-1.1").',
  15509. digits: 'В цьому полі ви можете використовувати лише цифри і знаки пунктіації (наприклад, телефонний номер з знаками дефізу або з крапками).',
  15510. alpha: 'В цьому полі можна використовувати лише латинські літери (a-z). Пробіли і інші символи заборонені.',
  15511. alphanum: 'В цьому полі можна використовувати лише латинські літери (a-z) і цифри (0-9). Пробіли і інші символи заборонені.',
  15512. dateSuchAs: 'Введіть коректну дату {date}.',
  15513. dateInFormatMDY: 'Введіть дату в форматі ММ/ДД/РРРР (наприклад "12/31/2009").',
  15514. email: 'Введіть коректну адресу електронної пошти (наприклад "name@domain.com").',
  15515. url: 'Введіть коректне інтернет-посилання (наприклад http://www.example.com).',
  15516. currencyDollar: 'Введіть суму в доларах (наприклад "$100.00").',
  15517. oneRequired: 'Заповніть одне з полів.',
  15518. errorPrefix: 'Помилка: ',
  15519. warningPrefix: 'Увага: ',
  15520. noSpace: 'Пробіли заборонені.',
  15521. reqChkByNode: 'Не відмічено жодного варіанту.',
  15522. requiredChk: 'Це поле повинне бути віміченим.',
  15523. reqChkByName: 'Будь ласка, відмітьте {label}.',
  15524. match: 'Це поле повинно відповідати {matchName}',
  15525. startDate: 'початкова дата',
  15526. endDate: 'кінцева дата',
  15527. currentDate: 'сьогоднішня дата',
  15528. afterDate: 'Ця дата повинна бути такою ж, або пізнішою за {label}.',
  15529. beforeDate: 'Ця дата повинна бути такою ж, або ранішою за {label}.',
  15530. startMonth: 'Будь ласка, виберіть початковий місяць',
  15531. sameMonth: 'Ці дати повинні відноситись одного і того ж місяця. Будь ласка, змініть одну з них.',
  15532. creditcard: 'Номер кредитної карти введений неправильно. Будь ласка, перевірте його. Введено {length} символів.'
  15533. });
  15534. /*
  15535. ---
  15536. name: Locale.zh-CH.Date
  15537. description: Date messages for Chinese (simplified and traditional).
  15538. license: MIT-style license
  15539. authors:
  15540. - YMind Chan
  15541. requires:
  15542. - Locale
  15543. provides: [Locale.zh-CH.Date]
  15544. ...
  15545. */
  15546. // Simplified Chinese
  15547. Locale.define('zh-CHS', 'Date', {
  15548. months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  15549. months_abbr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  15550. days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  15551. days_abbr: ['日', '一', '二', '三', '四', '五', '六'],
  15552. // Culture's date order: YYYY-MM-DD
  15553. dateOrder: ['year', 'month', 'date'],
  15554. shortDate: '%Y-%m-%d',
  15555. shortTime: '%I:%M%p',
  15556. AM: 'AM',
  15557. PM: 'PM',
  15558. firstDayOfWeek: 1,
  15559. // Date.Extras
  15560. ordinal: '',
  15561. lessThanMinuteAgo: '不到1分钟前',
  15562. minuteAgo: '大约1分钟前',
  15563. minutesAgo: '{delta}分钟之前',
  15564. hourAgo: '大约1小时前',
  15565. hoursAgo: '大约{delta}小时前',
  15566. dayAgo: '1天前',
  15567. daysAgo: '{delta}天前',
  15568. weekAgo: '1星期前',
  15569. weeksAgo: '{delta}星期前',
  15570. monthAgo: '1个月前',
  15571. monthsAgo: '{delta}个月前',
  15572. yearAgo: '1年前',
  15573. yearsAgo: '{delta}年前',
  15574. lessThanMinuteUntil: '从现在开始不到1分钟',
  15575. minuteUntil: '从现在开始約1分钟',
  15576. minutesUntil: '从现在开始约{delta}分钟',
  15577. hourUntil: '从现在开始1小时',
  15578. hoursUntil: '从现在开始约{delta}小时',
  15579. dayUntil: '从现在开始1天',
  15580. daysUntil: '从现在开始{delta}天',
  15581. weekUntil: '从现在开始1星期',
  15582. weeksUntil: '从现在开始{delta}星期',
  15583. monthUntil: '从现在开始一个月',
  15584. monthsUntil: '从现在开始{delta}个月',
  15585. yearUntil: '从现在开始1年',
  15586. yearsUntil: '从现在开始{delta}年'
  15587. });
  15588. // Traditional Chinese
  15589. Locale.define('zh-CHT', 'Date', {
  15590. months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  15591. months_abbr: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  15592. days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  15593. days_abbr: ['日', '一', '二', '三', '四', '五', '六'],
  15594. // Culture's date order: YYYY-MM-DD
  15595. dateOrder: ['year', 'month', 'date'],
  15596. shortDate: '%Y-%m-%d',
  15597. shortTime: '%I:%M%p',
  15598. AM: 'AM',
  15599. PM: 'PM',
  15600. firstDayOfWeek: 1,
  15601. // Date.Extras
  15602. ordinal: '',
  15603. lessThanMinuteAgo: '不到1分鐘前',
  15604. minuteAgo: '大約1分鐘前',
  15605. minutesAgo: '{delta}分鐘之前',
  15606. hourAgo: '大約1小時前',
  15607. hoursAgo: '大約{delta}小時前',
  15608. dayAgo: '1天前',
  15609. daysAgo: '{delta}天前',
  15610. weekAgo: '1星期前',
  15611. weeksAgo: '{delta}星期前',
  15612. monthAgo: '1个月前',
  15613. monthsAgo: '{delta}个月前',
  15614. yearAgo: '1年前',
  15615. yearsAgo: '{delta}年前',
  15616. lessThanMinuteUntil: '從現在開始不到1分鐘',
  15617. minuteUntil: '從現在開始約1分鐘',
  15618. minutesUntil: '從現在開始約{delta}分鐘',
  15619. hourUntil: '從現在開始1小時',
  15620. hoursUntil: '從現在開始約{delta}小時',
  15621. dayUntil: '從現在開始1天',
  15622. daysUntil: '從現在開始{delta}天',
  15623. weekUntil: '從現在開始1星期',
  15624. weeksUntil: '從現在開始{delta}星期',
  15625. monthUntil: '從現在開始一個月',
  15626. monthsUntil: '從現在開始{delta}個月',
  15627. yearUntil: '從現在開始1年',
  15628. yearsUntil: '從現在開始{delta}年'
  15629. });
  15630. /*
  15631. ---
  15632. name: Locale.zh-CH.Form.Validator
  15633. description: Form Validator messages for Chinese (simplified and traditional).
  15634. license: MIT-style license
  15635. authors:
  15636. - YMind Chan
  15637. requires:
  15638. - Locale
  15639. - Form.Validator
  15640. provides: [Form.zh-CH.Form.Validator, Form.Validator.CurrencyYuanValidator]
  15641. ...
  15642. */
  15643. // Simplified Chinese
  15644. Locale.define('zh-CHS', 'FormValidator', {
  15645. required: '此项必填。',
  15646. minLength: '请至少输入 {minLength} 个字符 (已输入 {length} 个)。',
  15647. maxLength: '最多只能输入 {maxLength} 个字符 (已输入 {length} 个)。',
  15648. integer: '请输入一个整数,不能包含小数点。例如:"1", "200"。',
  15649. numeric: '请输入一个数字,例如:"1", "1.1", "-1", "-1.1"。',
  15650. digits: '请输入由数字和标点符号组成的内容。例如电话号码。',
  15651. alpha: '请输入 A-Z 的 26 个字母,不能包含空格或任何其他字符。',
  15652. alphanum: '请输入 A-Z 的 26 个字母或 0-9 的 10 个数字,不能包含空格或任何其他字符。',
  15653. dateSuchAs: '请输入合法的日期格式,如:{date}。',
  15654. dateInFormatMDY: '请输入合法的日期格式,例如:YYYY-MM-DD ("2010-12-31")。',
  15655. email: '请输入合法的电子信箱地址,例如:"fred@domain.com"。',
  15656. url: '请输入合法的 Url 地址,例如:http://www.example.com。',
  15657. currencyDollar: '请输入合法的货币符号,例如:¥100.0',
  15658. oneRequired: '请至少选择一项。',
  15659. errorPrefix: '错误:',
  15660. warningPrefix: '警告:',
  15661. // Form.Validator.Extras
  15662. noSpace: '不能包含空格。',
  15663. reqChkByNode: '未选择任何内容。',
  15664. requiredChk: '此项必填。',
  15665. reqChkByName: '请选择 {label}.',
  15666. match: '必须与{matchName}相匹配',
  15667. startDate: '起始日期',
  15668. endDate: '结束日期',
  15669. currentDate: '当前日期',
  15670. afterDate: '日期必须等于或晚于 {label}.',
  15671. beforeDate: '日期必须早于或等于 {label}.',
  15672. startMonth: '请选择起始月份',
  15673. sameMonth: '您必须修改两个日期中的一个,以确保它们在同一月份。',
  15674. creditcard: '您输入的信用卡号码不正确。当前已输入{length}个字符。'
  15675. });
  15676. // Traditional Chinese
  15677. Locale.define('zh-CHT', 'FormValidator', {
  15678. required: '此項必填。 ',
  15679. minLength: '請至少輸入{minLength} 個字符(已輸入{length} 個)。 ',
  15680. maxLength: '最多只能輸入{maxLength} 個字符(已輸入{length} 個)。 ',
  15681. integer: '請輸入一個整數,不能包含小數點。例如:"1", "200"。 ',
  15682. numeric: '請輸入一個數字,例如:"1", "1.1", "-1", "-1.1"。 ',
  15683. digits: '請輸入由數字和標點符號組成的內容。例如電話號碼。 ',
  15684. alpha: '請輸入AZ 的26 個字母,不能包含空格或任何其他字符。 ',
  15685. alphanum: '請輸入AZ 的26 個字母或0-9 的10 個數字,不能包含空格或任何其他字符。 ',
  15686. dateSuchAs: '請輸入合法的日期格式,如:{date}。 ',
  15687. dateInFormatMDY: '請輸入合法的日期格式,例如:YYYY-MM-DD ("2010-12-31")。 ',
  15688. email: '請輸入合法的電子信箱地址,例如:"fred@domain.com"。 ',
  15689. url: '請輸入合法的Url 地址,例如:http://www.example.com。 ',
  15690. currencyDollar: '請輸入合法的貨幣符號,例如:¥100.0',
  15691. oneRequired: '請至少選擇一項。 ',
  15692. errorPrefix: '錯誤:',
  15693. warningPrefix: '警告:',
  15694. // Form.Validator.Extras
  15695. noSpace: '不能包含空格。 ',
  15696. reqChkByNode: '未選擇任何內容。 ',
  15697. requiredChk: '此項必填。 ',
  15698. reqChkByName: '請選擇 {label}.',
  15699. match: '必須與{matchName}相匹配',
  15700. startDate: '起始日期',
  15701. endDate: '結束日期',
  15702. currentDate: '當前日期',
  15703. afterDate: '日期必須等於或晚於{label}.',
  15704. beforeDate: '日期必須早於或等於{label}.',
  15705. startMonth: '請選擇起始月份',
  15706. sameMonth: '您必須修改兩個日期中的一個,以確保它們在同一月份。 ',
  15707. creditcard: '您輸入的信用卡號碼不正確。當前已輸入{length}個字符。 '
  15708. });
  15709. Form.Validator.add('validate-currency-yuan', {
  15710. errorMsg: function(){
  15711. return Form.Validator.getMsg('currencyYuan');
  15712. },
  15713. test: function(element){
  15714. // [¥]1[##][,###]+[.##]
  15715. // [¥]1###+[.##]
  15716. // [¥]0.##
  15717. // [¥].##
  15718. 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'));
  15719. }
  15720. });
  15721. /*
  15722. ---
  15723. name: Locale.zh-CH.Number
  15724. description: Number messages for for Chinese (simplified and traditional).
  15725. license: MIT-style license
  15726. authors:
  15727. - YMind Chan
  15728. requires:
  15729. - Locale
  15730. - Locale.en-US.Number
  15731. provides: [Locale.zh-CH.Number]
  15732. ...
  15733. */
  15734. // Simplified Chinese
  15735. Locale.define('zh-CHS', 'Number', {
  15736. currency: {
  15737. prefix: '¥ '
  15738. }
  15739. }).inherit('en-US', 'Number');
  15740. // Traditional Chinese
  15741. Locale.define('zh-CHT').inherit('zh-CHS', 'Number');
  15742. /*
  15743. ---
  15744. script: Request.JSONP.js
  15745. name: Request.JSONP
  15746. description: Defines Request.JSONP, a class for cross domain javascript via script injection.
  15747. license: MIT-style license
  15748. authors:
  15749. - Aaron Newton
  15750. - Guillermo Rauch
  15751. - Arian Stolwijk
  15752. requires:
  15753. - Core/Element
  15754. - Core/Request
  15755. - MooTools.More
  15756. provides: [Request.JSONP]
  15757. ...
  15758. */
  15759. Request.JSONP = new Class({
  15760. Implements: [Chain, Events, Options],
  15761. options: {/*
  15762. onRequest: function(src, scriptElement){},
  15763. onComplete: function(data){},
  15764. onSuccess: function(data){},
  15765. onCancel: function(){},
  15766. onTimeout: function(){},
  15767. onError: function(){}, */
  15768. onRequest: function(src){
  15769. if (this.options.log && window.console && console.log){
  15770. console.log('JSONP retrieving script with url:' + src);
  15771. }
  15772. },
  15773. onError: function(src){
  15774. if (this.options.log && window.console && console.warn){
  15775. console.warn('JSONP '+ src +' will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs');
  15776. }
  15777. },
  15778. url: '',
  15779. callbackKey: 'callback',
  15780. injectScript: document.head,
  15781. data: '',
  15782. link: 'ignore',
  15783. timeout: 0,
  15784. log: false
  15785. },
  15786. initialize: function(options){
  15787. this.setOptions(options);
  15788. },
  15789. send: function(options){
  15790. if (!Request.prototype.check.call(this, options)) return this;
  15791. this.running = true;
  15792. var type = typeOf(options);
  15793. if (type == 'string' || type == 'element') options = {data: options};
  15794. options = Object.merge(this.options, options || {});
  15795. var data = options.data;
  15796. switch (typeOf(data)){
  15797. case 'element': data = document.id(data).toQueryString(); break;
  15798. case 'object': case 'hash': data = Object.toQueryString(data);
  15799. }
  15800. var index = this.index = Request.JSONP.counter++,
  15801. key = 'request_' + index;
  15802. var src = options.url +
  15803. (options.url.test('\\?') ? '&' :'?') +
  15804. (options.callbackKey) +
  15805. '=Request.JSONP.request_map.request_'+ index +
  15806. (data ? '&' + data : '');
  15807. if (src.length > 2083) this.fireEvent('error', src);
  15808. Request.JSONP.request_map[key] = function(){
  15809. delete Request.JSONP.request_map[key];
  15810. this.success(arguments, index);
  15811. }.bind(this);
  15812. var script = this.getScript(src).inject(options.injectScript);
  15813. this.fireEvent('request', [src, script]);
  15814. if (options.timeout) this.timeout.delay(options.timeout, this);
  15815. return this;
  15816. },
  15817. getScript: function(src){
  15818. if (!this.script) this.script = new Element('script', {
  15819. type: 'text/javascript',
  15820. async: true,
  15821. src: src
  15822. });
  15823. return this.script;
  15824. },
  15825. success: function(args){
  15826. if (!this.running) return;
  15827. this.clear()
  15828. .fireEvent('complete', args).fireEvent('success', args)
  15829. .callChain();
  15830. },
  15831. cancel: function(){
  15832. if (this.running) this.clear().fireEvent('cancel');
  15833. return this;
  15834. },
  15835. isRunning: function(){
  15836. return !!this.running;
  15837. },
  15838. clear: function(){
  15839. this.running = false;
  15840. if (this.script){
  15841. this.script.destroy();
  15842. this.script = null;
  15843. }
  15844. return this;
  15845. },
  15846. timeout: function(){
  15847. if (this.running){
  15848. this.running = false;
  15849. this.fireEvent('timeout', [this.script.get('src'), this.script]).fireEvent('failure').cancel();
  15850. }
  15851. return this;
  15852. }
  15853. });
  15854. Request.JSONP.counter = 0;
  15855. Request.JSONP.request_map = {};
  15856. /*
  15857. ---
  15858. script: Request.Periodical.js
  15859. name: Request.Periodical
  15860. description: Requests the same URL to pull data from a server but increases the intervals if no data is returned to reduce the load
  15861. license: MIT-style license
  15862. authors:
  15863. - Christoph Pojer
  15864. requires:
  15865. - Core/Request
  15866. - MooTools.More
  15867. provides: [Request.Periodical]
  15868. ...
  15869. */
  15870. Request.implement({
  15871. options: {
  15872. initialDelay: 5000,
  15873. delay: 5000,
  15874. limit: 60000
  15875. },
  15876. startTimer: function(data){
  15877. var fn = function(){
  15878. if (!this.running) this.send({data: data});
  15879. };
  15880. this.lastDelay = this.options.initialDelay;
  15881. this.timer = fn.delay(this.lastDelay, this);
  15882. this.completeCheck = function(response){
  15883. clearTimeout(this.timer);
  15884. this.lastDelay = (response) ? this.options.delay : (this.lastDelay + this.options.delay).min(this.options.limit);
  15885. this.timer = fn.delay(this.lastDelay, this);
  15886. };
  15887. return this.addEvent('complete', this.completeCheck);
  15888. },
  15889. stopTimer: function(){
  15890. clearTimeout(this.timer);
  15891. return this.removeEvent('complete', this.completeCheck);
  15892. }
  15893. });
  15894. /*
  15895. ---
  15896. script: Request.Queue.js
  15897. name: Request.Queue
  15898. description: Controls several instances of Request and its variants to run only one request at a time.
  15899. license: MIT-style license
  15900. authors:
  15901. - Aaron Newton
  15902. requires:
  15903. - Core/Element
  15904. - Core/Request
  15905. - Class.Binds
  15906. provides: [Request.Queue]
  15907. ...
  15908. */
  15909. Request.Queue = new Class({
  15910. Implements: [Options, Events],
  15911. Binds: ['attach', 'request', 'complete', 'cancel', 'success', 'failure', 'exception'],
  15912. options: {/*
  15913. onRequest: function(argsPassedToOnRequest){},
  15914. onSuccess: function(argsPassedToOnSuccess){},
  15915. onComplete: function(argsPassedToOnComplete){},
  15916. onCancel: function(argsPassedToOnCancel){},
  15917. onException: function(argsPassedToOnException){},
  15918. onFailure: function(argsPassedToOnFailure){},
  15919. onEnd: function(){},
  15920. */
  15921. stopOnFailure: true,
  15922. autoAdvance: true,
  15923. concurrent: 1,
  15924. requests: {}
  15925. },
  15926. initialize: function(options){
  15927. var requests;
  15928. if (options){
  15929. requests = options.requests;
  15930. delete options.requests;
  15931. }
  15932. this.setOptions(options);
  15933. this.requests = {};
  15934. this.queue = [];
  15935. this.reqBinders = {};
  15936. if (requests) this.addRequests(requests);
  15937. },
  15938. addRequest: function(name, request){
  15939. this.requests[name] = request;
  15940. this.attach(name, request);
  15941. return this;
  15942. },
  15943. addRequests: function(obj){
  15944. Object.each(obj, function(req, name){
  15945. this.addRequest(name, req);
  15946. }, this);
  15947. return this;
  15948. },
  15949. getName: function(req){
  15950. return Object.keyOf(this.requests, req);
  15951. },
  15952. attach: function(name, req){
  15953. if (req._groupSend) return this;
  15954. ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){
  15955. if (!this.reqBinders[name]) this.reqBinders[name] = {};
  15956. this.reqBinders[name][evt] = function(){
  15957. this['on' + evt.capitalize()].apply(this, [name, req].append(arguments));
  15958. }.bind(this);
  15959. req.addEvent(evt, this.reqBinders[name][evt]);
  15960. }, this);
  15961. req._groupSend = req.send;
  15962. req.send = function(options){
  15963. this.send(name, options);
  15964. return req;
  15965. }.bind(this);
  15966. return this;
  15967. },
  15968. removeRequest: function(req){
  15969. var name = typeOf(req) == 'object' ? this.getName(req) : req;
  15970. if (!name && typeOf(name) != 'string') return this;
  15971. req = this.requests[name];
  15972. if (!req) return this;
  15973. ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){
  15974. req.removeEvent(evt, this.reqBinders[name][evt]);
  15975. }, this);
  15976. req.send = req._groupSend;
  15977. delete req._groupSend;
  15978. return this;
  15979. },
  15980. getRunning: function(){
  15981. return Object.filter(this.requests, function(r){
  15982. return r.running;
  15983. });
  15984. },
  15985. isRunning: function(){
  15986. return !!(Object.keys(this.getRunning()).length);
  15987. },
  15988. send: function(name, options){
  15989. var q = function(){
  15990. this.requests[name]._groupSend(options);
  15991. this.queue.erase(q);
  15992. }.bind(this);
  15993. q.name = name;
  15994. if (Object.keys(this.getRunning()).length >= this.options.concurrent || (this.error && this.options.stopOnFailure)) this.queue.push(q);
  15995. else q();
  15996. return this;
  15997. },
  15998. hasNext: function(name){
  15999. return (!name) ? !!this.queue.length : !!this.queue.filter(function(q){ return q.name == name; }).length;
  16000. },
  16001. resume: function(){
  16002. this.error = false;
  16003. (this.options.concurrent - Object.keys(this.getRunning()).length).times(this.runNext, this);
  16004. return this;
  16005. },
  16006. runNext: function(name){
  16007. if (!this.queue.length) return this;
  16008. if (!name){
  16009. this.queue[0]();
  16010. } else {
  16011. var found;
  16012. this.queue.each(function(q){
  16013. if (!found && q.name == name){
  16014. found = true;
  16015. q();
  16016. }
  16017. });
  16018. }
  16019. return this;
  16020. },
  16021. runAll: function(){
  16022. this.queue.each(function(q){
  16023. q();
  16024. });
  16025. return this;
  16026. },
  16027. clear: function(name){
  16028. if (!name){
  16029. this.queue.empty();
  16030. } else {
  16031. this.queue = this.queue.map(function(q){
  16032. if (q.name != name) return q;
  16033. else return false;
  16034. }).filter(function(q){
  16035. return q;
  16036. });
  16037. }
  16038. return this;
  16039. },
  16040. cancel: function(name){
  16041. this.requests[name].cancel();
  16042. return this;
  16043. },
  16044. onRequest: function(){
  16045. this.fireEvent('request', arguments);
  16046. },
  16047. onComplete: function(){
  16048. this.fireEvent('complete', arguments);
  16049. if (!this.queue.length) this.fireEvent('end');
  16050. },
  16051. onCancel: function(){
  16052. if (this.options.autoAdvance && !this.error) this.runNext();
  16053. this.fireEvent('cancel', arguments);
  16054. },
  16055. onSuccess: function(){
  16056. if (this.options.autoAdvance && !this.error) this.runNext();
  16057. this.fireEvent('success', arguments);
  16058. },
  16059. onFailure: function(){
  16060. this.error = true;
  16061. if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext();
  16062. this.fireEvent('failure', arguments);
  16063. },
  16064. onException: function(){
  16065. this.error = true;
  16066. if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext();
  16067. this.fireEvent('exception', arguments);
  16068. }
  16069. });
  16070. /*
  16071. ---
  16072. script: Array.Extras.js
  16073. name: Array.Extras
  16074. description: Extends the Array native object to include useful methods to work with arrays.
  16075. license: MIT-style license
  16076. authors:
  16077. - Christoph Pojer
  16078. - Sebastian Markbåge
  16079. requires:
  16080. - Core/Array
  16081. - MooTools.More
  16082. provides: [Array.Extras]
  16083. ...
  16084. */
  16085. (function(nil){
  16086. Array.implement({
  16087. min: function(){
  16088. return Math.min.apply(null, this);
  16089. },
  16090. max: function(){
  16091. return Math.max.apply(null, this);
  16092. },
  16093. average: function(){
  16094. return this.length ? this.sum() / this.length : 0;
  16095. },
  16096. sum: function(){
  16097. var result = 0, l = this.length;
  16098. if (l){
  16099. while (l--){
  16100. if (this[l] != null) result += parseFloat(this[l]);
  16101. }
  16102. }
  16103. return result;
  16104. },
  16105. unique: function(){
  16106. return [].combine(this);
  16107. },
  16108. shuffle: function(){
  16109. for (var i = this.length; i && --i;){
  16110. var temp = this[i], r = Math.floor(Math.random() * ( i + 1 ));
  16111. this[i] = this[r];
  16112. this[r] = temp;
  16113. }
  16114. return this;
  16115. },
  16116. reduce: function(fn, value){
  16117. for (var i = 0, l = this.length; i < l; i++){
  16118. if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this);
  16119. }
  16120. return value;
  16121. },
  16122. reduceRight: function(fn, value){
  16123. var i = this.length;
  16124. while (i--){
  16125. if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this);
  16126. }
  16127. return value;
  16128. },
  16129. pluck: function(prop){
  16130. return this.map(function(item){
  16131. return item[prop];
  16132. });
  16133. }
  16134. });
  16135. })();
  16136. /*
  16137. ---
  16138. script: Date.Extras.js
  16139. name: Date.Extras
  16140. description: Extends the Date native object to include extra methods (on top of those in Date.js).
  16141. license: MIT-style license
  16142. authors:
  16143. - Aaron Newton
  16144. - Scott Kyle
  16145. requires:
  16146. - Date
  16147. provides: [Date.Extras]
  16148. ...
  16149. */
  16150. Date.implement({
  16151. timeDiffInWords: function(to){
  16152. return Date.distanceOfTimeInWords(this, to || new Date);
  16153. },
  16154. timeDiff: function(to, separator){
  16155. if (to == null) to = new Date;
  16156. var delta = ((to - this) / 1000).floor().abs();
  16157. var vals = [],
  16158. durations = [60, 60, 24, 365, 0],
  16159. names = ['s', 'm', 'h', 'd', 'y'],
  16160. value, duration;
  16161. for (var item = 0; item < durations.length; item++){
  16162. if (item && !delta) break;
  16163. value = delta;
  16164. if ((duration = durations[item])){
  16165. value = (delta % duration);
  16166. delta = (delta / duration).floor();
  16167. }
  16168. vals.unshift(value + (names[item] || ''));
  16169. }
  16170. return vals.join(separator || ':');
  16171. }
  16172. }).extend({
  16173. distanceOfTimeInWords: function(from, to){
  16174. return Date.getTimePhrase(((to - from) / 1000).toInt());
  16175. },
  16176. getTimePhrase: function(delta){
  16177. var suffix = (delta < 0) ? 'Until' : 'Ago';
  16178. if (delta < 0) delta *= -1;
  16179. var units = {
  16180. minute: 60,
  16181. hour: 60,
  16182. day: 24,
  16183. week: 7,
  16184. month: 52 / 12,
  16185. year: 12,
  16186. eon: Infinity
  16187. };
  16188. var msg = 'lessThanMinute';
  16189. for (var unit in units){
  16190. var interval = units[unit];
  16191. if (delta < 1.5 * interval){
  16192. if (delta > 0.75 * interval) msg = unit;
  16193. break;
  16194. }
  16195. delta /= interval;
  16196. msg = unit + 's';
  16197. }
  16198. delta = delta.round();
  16199. return Date.getMsg(msg + suffix, delta).substitute({delta: delta});
  16200. }
  16201. }).defineParsers(
  16202. {
  16203. // "today", "tomorrow", "yesterday"
  16204. re: /^(?:tod|tom|yes)/i,
  16205. handler: function(bits){
  16206. var d = new Date().clearTime();
  16207. switch (bits[0]){
  16208. case 'tom': return d.increment();
  16209. case 'yes': return d.decrement();
  16210. default: return d;
  16211. }
  16212. }
  16213. },
  16214. {
  16215. // "next Wednesday", "last Thursday"
  16216. re: /^(next|last) ([a-z]+)$/i,
  16217. handler: function(bits){
  16218. var d = new Date().clearTime();
  16219. var day = d.getDay();
  16220. var newDay = Date.parseDay(bits[2], true);
  16221. var addDays = newDay - day;
  16222. if (newDay <= day) addDays += 7;
  16223. if (bits[1] == 'last') addDays -= 7;
  16224. return d.set('date', d.getDate() + addDays);
  16225. }
  16226. }
  16227. ).alias('timeAgoInWords', 'timeDiffInWords');
  16228. /*
  16229. ---
  16230. name: Hash
  16231. description: Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects.
  16232. license: MIT-style license.
  16233. requires:
  16234. - Core/Object
  16235. - MooTools.More
  16236. provides: [Hash]
  16237. ...
  16238. */
  16239. (function(){
  16240. if (this.Hash) return;
  16241. var Hash = this.Hash = new Type('Hash', function(object){
  16242. if (typeOf(object) == 'hash') object = Object.clone(object.getClean());
  16243. for (var key in object) this[key] = object[key];
  16244. return this;
  16245. });
  16246. this.$H = function(object){
  16247. return new Hash(object);
  16248. };
  16249. Hash.implement({
  16250. forEach: function(fn, bind){
  16251. Object.forEach(this, fn, bind);
  16252. },
  16253. getClean: function(){
  16254. var clean = {};
  16255. for (var key in this){
  16256. if (this.hasOwnProperty(key)) clean[key] = this[key];
  16257. }
  16258. return clean;
  16259. },
  16260. getLength: function(){
  16261. var length = 0;
  16262. for (var key in this){
  16263. if (this.hasOwnProperty(key)) length++;
  16264. }
  16265. return length;
  16266. }
  16267. });
  16268. Hash.alias('each', 'forEach');
  16269. Hash.implement({
  16270. has: Object.prototype.hasOwnProperty,
  16271. keyOf: function(value){
  16272. return Object.keyOf(this, value);
  16273. },
  16274. hasValue: function(value){
  16275. return Object.contains(this, value);
  16276. },
  16277. extend: function(properties){
  16278. Hash.each(properties || {}, function(value, key){
  16279. Hash.set(this, key, value);
  16280. }, this);
  16281. return this;
  16282. },
  16283. combine: function(properties){
  16284. Hash.each(properties || {}, function(value, key){
  16285. Hash.include(this, key, value);
  16286. }, this);
  16287. return this;
  16288. },
  16289. erase: function(key){
  16290. if (this.hasOwnProperty(key)) delete this[key];
  16291. return this;
  16292. },
  16293. get: function(key){
  16294. return (this.hasOwnProperty(key)) ? this[key] : null;
  16295. },
  16296. set: function(key, value){
  16297. if (!this[key] || this.hasOwnProperty(key)) this[key] = value;
  16298. return this;
  16299. },
  16300. empty: function(){
  16301. Hash.each(this, function(value, key){
  16302. delete this[key];
  16303. }, this);
  16304. return this;
  16305. },
  16306. include: function(key, value){
  16307. if (this[key] == undefined) this[key] = value;
  16308. return this;
  16309. },
  16310. map: function(fn, bind){
  16311. return new Hash(Object.map(this, fn, bind));
  16312. },
  16313. filter: function(fn, bind){
  16314. return new Hash(Object.filter(this, fn, bind));
  16315. },
  16316. every: function(fn, bind){
  16317. return Object.every(this, fn, bind);
  16318. },
  16319. some: function(fn, bind){
  16320. return Object.some(this, fn, bind);
  16321. },
  16322. getKeys: function(){
  16323. return Object.keys(this);
  16324. },
  16325. getValues: function(){
  16326. return Object.values(this);
  16327. },
  16328. toQueryString: function(base){
  16329. return Object.toQueryString(this, base);
  16330. }
  16331. });
  16332. Hash.alias({indexOf: 'keyOf', contains: 'hasValue'});
  16333. })();
  16334. /*
  16335. ---
  16336. script: Hash.Extras.js
  16337. name: Hash.Extras
  16338. description: Extends the Hash Type to include getFromPath which allows a path notation to child elements.
  16339. license: MIT-style license
  16340. authors:
  16341. - Aaron Newton
  16342. requires:
  16343. - Hash
  16344. - Object.Extras
  16345. provides: [Hash.Extras]
  16346. ...
  16347. */
  16348. Hash.implement({
  16349. getFromPath: function(notation){
  16350. return Object.getFromPath(this, notation);
  16351. },
  16352. cleanValues: function(method){
  16353. return new Hash(Object.cleanValues(this, method));
  16354. },
  16355. run: function(){
  16356. Object.run(arguments);
  16357. }
  16358. });
  16359. /*
  16360. ---
  16361. name: Number.Format
  16362. description: Extends the Number Type object to include a number formatting method.
  16363. license: MIT-style license
  16364. authors: [Arian Stolwijk]
  16365. requires: [Core/Number, Locale.en-US.Number]
  16366. # Number.Extras is for compatibility
  16367. provides: [Number.Format, Number.Extras]
  16368. ...
  16369. */
  16370. Number.implement({
  16371. format: function(options){
  16372. // Thanks dojo and YUI for some inspiration
  16373. var value = this;
  16374. options = options ? Object.clone(options) : {};
  16375. var getOption = function(key){
  16376. if (options[key] != null) return options[key];
  16377. return Locale.get('Number.' + key);
  16378. };
  16379. var negative = value < 0,
  16380. decimal = getOption('decimal'),
  16381. precision = getOption('precision'),
  16382. group = getOption('group'),
  16383. decimals = getOption('decimals');
  16384. if (negative){
  16385. var negativeLocale = getOption('negative') || {};
  16386. if (negativeLocale.prefix == null && negativeLocale.suffix == null) negativeLocale.prefix = '-';
  16387. ['prefix', 'suffix'].each(function(key){
  16388. if (negativeLocale[key]) options[key] = getOption(key) + negativeLocale[key];
  16389. });
  16390. value = -value;
  16391. }
  16392. var prefix = getOption('prefix'),
  16393. suffix = getOption('suffix');
  16394. if (decimals !== '' && decimals >= 0 && decimals <= 20) value = value.toFixed(decimals);
  16395. if (precision >= 1 && precision <= 21) value = (+value).toPrecision(precision);
  16396. value += '';
  16397. var index;
  16398. if (getOption('scientific') === false && value.indexOf('e') > -1){
  16399. var match = value.split('e'),
  16400. zeros = +match[1];
  16401. value = match[0].replace('.', '');
  16402. if (zeros < 0){
  16403. zeros = -zeros - 1;
  16404. index = match[0].indexOf('.');
  16405. if (index > -1) zeros -= index - 1;
  16406. while (zeros--) value = '0' + value;
  16407. value = '0.' + value;
  16408. } else {
  16409. index = match[0].lastIndexOf('.');
  16410. if (index > -1) zeros -= match[0].length - index - 1;
  16411. while (zeros--) value += '0';
  16412. }
  16413. }
  16414. if (decimal != '.') value = value.replace('.', decimal);
  16415. if (group){
  16416. index = value.lastIndexOf(decimal);
  16417. index = (index > -1) ? index : value.length;
  16418. var newOutput = value.substring(index),
  16419. i = index;
  16420. while (i--){
  16421. if ((index - i - 1) % 3 == 0 && i != (index - 1)) newOutput = group + newOutput;
  16422. newOutput = value.charAt(i) + newOutput;
  16423. }
  16424. value = newOutput;
  16425. }
  16426. if (prefix) value = prefix + value;
  16427. if (suffix) value += suffix;
  16428. return value;
  16429. },
  16430. formatCurrency: function(decimals){
  16431. var locale = Locale.get('Number.currency') || {};
  16432. if (locale.scientific == null) locale.scientific = false;
  16433. locale.decimals = decimals != null ? decimals
  16434. : (locale.decimals == null ? 2 : locale.decimals);
  16435. return this.format(locale);
  16436. },
  16437. formatPercentage: function(decimals){
  16438. var locale = Locale.get('Number.percentage') || {};
  16439. if (locale.suffix == null) locale.suffix = '%';
  16440. locale.decimals = decimals != null ? decimals
  16441. : (locale.decimals == null ? 2 : locale.decimals);
  16442. return this.format(locale);
  16443. }
  16444. });
  16445. /*
  16446. ---
  16447. script: URI.js
  16448. name: URI
  16449. description: Provides methods useful in managing the window location and uris.
  16450. license: MIT-style license
  16451. authors:
  16452. - Sebastian Markbåge
  16453. - Aaron Newton
  16454. requires:
  16455. - Core/Object
  16456. - Core/Class
  16457. - Core/Class.Extras
  16458. - Core/Element
  16459. - String.QueryString
  16460. provides: [URI]
  16461. ...
  16462. */
  16463. (function(){
  16464. var toString = function(){
  16465. return this.get('value');
  16466. };
  16467. var URI = this.URI = new Class({
  16468. Implements: Options,
  16469. options: {
  16470. /*base: false*/
  16471. },
  16472. regex: /^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[A-Fa-f0-9:]+\]|[^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,
  16473. parts: ['scheme', 'user', 'password', 'host', 'port', 'directory', 'file', 'query', 'fragment'],
  16474. schemes: {http: 80, https: 443, ftp: 21, rtsp: 554, mms: 1755, file: 0},
  16475. initialize: function(uri, options){
  16476. this.setOptions(options);
  16477. var base = this.options.base || URI.base;
  16478. if (!uri) uri = base;
  16479. if (uri && uri.parsed) this.parsed = Object.clone(uri.parsed);
  16480. else this.set('value', uri.href || uri.toString(), base ? new URI(base) : false);
  16481. },
  16482. parse: function(value, base){
  16483. var bits = value.match(this.regex);
  16484. if (!bits) return false;
  16485. bits.shift();
  16486. return this.merge(bits.associate(this.parts), base);
  16487. },
  16488. merge: function(bits, base){
  16489. if ((!bits || !bits.scheme) && (!base || !base.scheme)) return false;
  16490. if (base){
  16491. this.parts.every(function(part){
  16492. if (bits[part]) return false;
  16493. bits[part] = base[part] || '';
  16494. return true;
  16495. });
  16496. }
  16497. bits.port = bits.port || this.schemes[bits.scheme.toLowerCase()];
  16498. bits.directory = bits.directory ? this.parseDirectory(bits.directory, base ? base.directory : '') : '/';
  16499. return bits;
  16500. },
  16501. parseDirectory: function(directory, baseDirectory){
  16502. directory = (directory.substr(0, 1) == '/' ? '' : (baseDirectory || '/')) + directory;
  16503. if (!directory.test(URI.regs.directoryDot)) return directory;
  16504. var result = [];
  16505. directory.replace(URI.regs.endSlash, '').split('/').each(function(dir){
  16506. if (dir == '..' && result.length > 0) result.pop();
  16507. else if (dir != '.') result.push(dir);
  16508. });
  16509. return result.join('/') + '/';
  16510. },
  16511. combine: function(bits){
  16512. return bits.value || bits.scheme + '://' +
  16513. (bits.user ? bits.user + (bits.password ? ':' + bits.password : '') + '@' : '') +
  16514. (bits.host || '') + (bits.port && bits.port != this.schemes[bits.scheme] ? ':' + bits.port : '') +
  16515. (bits.directory || '/') + (bits.file || '') +
  16516. (bits.query ? '?' + bits.query : '') +
  16517. (bits.fragment ? '#' + bits.fragment : '');
  16518. },
  16519. set: function(part, value, base){
  16520. if (part == 'value'){
  16521. var scheme = value.match(URI.regs.scheme);
  16522. if (scheme) scheme = scheme[1];
  16523. if (scheme && this.schemes[scheme.toLowerCase()] == null) this.parsed = { scheme: scheme, value: value };
  16524. else this.parsed = this.parse(value, (base || this).parsed) || (scheme ? { scheme: scheme, value: value } : { value: value });
  16525. } else if (part == 'data'){
  16526. this.setData(value);
  16527. } else {
  16528. this.parsed[part] = value;
  16529. }
  16530. return this;
  16531. },
  16532. get: function(part, base){
  16533. switch (part){
  16534. case 'value': return this.combine(this.parsed, base ? base.parsed : false);
  16535. case 'data' : return this.getData();
  16536. }
  16537. return this.parsed[part] || '';
  16538. },
  16539. go: function(){
  16540. document.location.href = this.toString();
  16541. },
  16542. toURI: function(){
  16543. return this;
  16544. },
  16545. getData: function(key, part){
  16546. var qs = this.get(part || 'query');
  16547. if (!(qs || qs === 0)) return key ? null : {};
  16548. var obj = qs.parseQueryString();
  16549. return key ? obj[key] : obj;
  16550. },
  16551. setData: function(values, merge, part){
  16552. if (typeof values == 'string'){
  16553. var data = this.getData();
  16554. data[arguments[0]] = arguments[1];
  16555. values = data;
  16556. } else if (merge){
  16557. values = Object.merge(this.getData(null, part), values);
  16558. }
  16559. return this.set(part || 'query', Object.toQueryString(values));
  16560. },
  16561. clearData: function(part){
  16562. return this.set(part || 'query', '');
  16563. },
  16564. toString: toString,
  16565. valueOf: toString
  16566. });
  16567. URI.regs = {
  16568. endSlash: /\/$/,
  16569. scheme: /^(\w+):/,
  16570. directoryDot: /\.\/|\.$/
  16571. };
  16572. URI.base = new URI(Array.convert(document.getElements('base[href]', true)).getLast(), {base: document.location});
  16573. String.implement({
  16574. toURI: function(options){
  16575. return new URI(this, options);
  16576. }
  16577. });
  16578. })();
  16579. /*
  16580. ---
  16581. script: URI.Relative.js
  16582. name: URI.Relative
  16583. description: Extends the URI class to add methods for computing relative and absolute urls.
  16584. license: MIT-style license
  16585. authors:
  16586. - Sebastian Markbåge
  16587. requires:
  16588. - Class.refactor
  16589. - URI
  16590. provides: [URI.Relative]
  16591. ...
  16592. */
  16593. URI = Class.refactor(URI, {
  16594. combine: function(bits, base){
  16595. if (!base || bits.scheme != base.scheme || bits.host != base.host || bits.port != base.port)
  16596. return this.previous.apply(this, arguments);
  16597. var end = bits.file + (bits.query ? '?' + bits.query : '') + (bits.fragment ? '#' + bits.fragment : '');
  16598. if (!base.directory) return (bits.directory || (bits.file ? '' : './')) + end;
  16599. var baseDir = base.directory.split('/'),
  16600. relDir = bits.directory.split('/'),
  16601. path = '',
  16602. offset;
  16603. var i = 0;
  16604. for (offset = 0; offset < baseDir.length && offset < relDir.length && baseDir[offset] == relDir[offset]; offset++);
  16605. for (i = 0; i < baseDir.length - offset - 1; i++) path += '../';
  16606. for (i = offset; i < relDir.length - 1; i++) path += relDir[i] + '/';
  16607. return (path || (bits.file ? '' : './')) + end;
  16608. },
  16609. toAbsolute: function(base){
  16610. base = new URI(base);
  16611. if (base) base.set('directory', '').set('file', '');
  16612. return this.toRelative(base);
  16613. },
  16614. toRelative: function(base){
  16615. return this.get('value', new URI(base));
  16616. }
  16617. });
  16618. /*
  16619. ---
  16620. script: Assets.js
  16621. name: Assets
  16622. description: Provides methods to dynamically load JavaScript, CSS, and Image files into the document.
  16623. license: MIT-style license
  16624. authors:
  16625. - Valerio Proietti
  16626. requires:
  16627. - Core/Element.Event
  16628. - MooTools.More
  16629. provides: [Assets, Asset.javascript, Asset.css, Asset.image, Asset.images]
  16630. ...
  16631. */
  16632. ;(function(){
  16633. var Asset = this.Asset = {
  16634. javascript: function(source, properties){
  16635. if (!properties) properties = {};
  16636. var script = new Element('script', {src: source, type: 'text/javascript'}),
  16637. doc = properties.document || document,
  16638. load = properties.onload || properties.onLoad;
  16639. delete properties.onload;
  16640. delete properties.onLoad;
  16641. delete properties.document;
  16642. if (load){
  16643. if (!script.addEventListener){
  16644. script.addEvent('readystatechange', function(){
  16645. if (['loaded', 'complete'].contains(this.readyState)) load.call(this);
  16646. });
  16647. } else {
  16648. script.addEvent('load', load);
  16649. }
  16650. }
  16651. return script.set(properties).inject(doc.head);
  16652. },
  16653. css: function(source, properties){
  16654. if (!properties) properties = {};
  16655. var load = properties.onload || properties.onLoad,
  16656. doc = properties.document || document,
  16657. timeout = properties.timeout || 3000;
  16658. ['onload', 'onLoad', 'document'].each(function(prop){
  16659. delete properties[prop];
  16660. });
  16661. var link = new Element('link', {
  16662. type: 'text/css',
  16663. rel: 'stylesheet',
  16664. media: 'screen',
  16665. href: source
  16666. }).setProperties(properties).inject(doc.head);
  16667. if (load){
  16668. // based on article at http://www.yearofmoo.com/2011/03/cross-browser-stylesheet-preloading.html
  16669. var loaded = false, retries = 0;
  16670. var check = function(){
  16671. var stylesheets = document.styleSheets;
  16672. for (var i = 0; i < stylesheets.length; i++){
  16673. var file = stylesheets[i];
  16674. var owner = file.ownerNode ? file.ownerNode : file.owningElement;
  16675. if (owner && owner == link){
  16676. loaded = true;
  16677. return load.call(link);
  16678. }
  16679. }
  16680. retries++;
  16681. if (!loaded && retries < timeout / 50) return setTimeout(check, 50);
  16682. };
  16683. setTimeout(check, 0);
  16684. }
  16685. return link;
  16686. },
  16687. image: function(source, properties){
  16688. if (!properties) properties = {};
  16689. var image = new Image(),
  16690. element = document.id(image) || new Element('img');
  16691. ['load', 'abort', 'error'].each(function(name){
  16692. var type = 'on' + name,
  16693. cap = 'on' + name.capitalize(),
  16694. event = properties[type] || properties[cap] || function(){};
  16695. delete properties[cap];
  16696. delete properties[type];
  16697. image[type] = function(){
  16698. if (!image) return;
  16699. if (!element.parentNode){
  16700. element.width = image.width;
  16701. element.height = image.height;
  16702. }
  16703. image = image.onload = image.onabort = image.onerror = null;
  16704. event.delay(1, element, element);
  16705. element.fireEvent(name, element, 1);
  16706. };
  16707. });
  16708. image.src = element.src = source;
  16709. if (image && image.complete) image.onload.delay(1);
  16710. return element.set(properties);
  16711. },
  16712. images: function(sources, options){
  16713. sources = Array.convert(sources);
  16714. var fn = function(){},
  16715. counter = 0;
  16716. options = Object.merge({
  16717. onComplete: fn,
  16718. onProgress: fn,
  16719. onError: fn,
  16720. properties: {}
  16721. }, options);
  16722. return new Elements(sources.map(function(source, index){
  16723. return Asset.image(source, Object.append(options.properties, {
  16724. onload: function(){
  16725. counter++;
  16726. options.onProgress.call(this, counter, index, source);
  16727. if (counter == sources.length) options.onComplete();
  16728. },
  16729. onerror: function(){
  16730. counter++;
  16731. options.onError.call(this, counter, index, source);
  16732. if (counter == sources.length) options.onComplete();
  16733. }
  16734. }));
  16735. }));
  16736. }
  16737. };
  16738. })();
  16739. /*
  16740. ---
  16741. script: Color.js
  16742. name: Color
  16743. description: Class for creating and manipulating colors in JavaScript. Supports HSB -> RGB Conversions and vice versa.
  16744. license: MIT-style license
  16745. authors:
  16746. - Valerio Proietti
  16747. requires:
  16748. - Core/Array
  16749. - Core/String
  16750. - Core/Number
  16751. - Core/Hash
  16752. - Core/Function
  16753. - MooTools.More
  16754. provides: [Color]
  16755. ...
  16756. */
  16757. (function(){
  16758. var Color = this.Color = new Type('Color', function(color, type){
  16759. if (arguments.length >= 3){
  16760. type = 'rgb'; color = Array.slice(arguments, 0, 3);
  16761. } else if (typeof color == 'string'){
  16762. if (color.match(/rgb/)) color = color.rgbToHex().hexToRgb(true);
  16763. else if (color.match(/hsb/)) color = color.hsbToRgb();
  16764. else color = color.hexToRgb(true);
  16765. }
  16766. type = type || 'rgb';
  16767. switch (type){
  16768. case 'hsb':
  16769. var old = color;
  16770. color = color.hsbToRgb();
  16771. color.hsb = old;
  16772. break;
  16773. case 'hex': color = color.hexToRgb(true); break;
  16774. }
  16775. color.rgb = color.slice(0, 3);
  16776. color.hsb = color.hsb || color.rgbToHsb();
  16777. color.hex = color.rgbToHex();
  16778. return Object.append(color, this);
  16779. });
  16780. Color.implement({
  16781. mix: function(){
  16782. var colors = Array.slice(arguments);
  16783. var alpha = (typeOf(colors.getLast()) == 'number') ? colors.pop() : 50;
  16784. var rgb = this.slice();
  16785. colors.each(function(color){
  16786. color = new Color(color);
  16787. for (var i = 0; i < 3; i++) rgb[i] = Math.round((rgb[i] / 100 * (100 - alpha)) + (color[i] / 100 * alpha));
  16788. });
  16789. return new Color(rgb, 'rgb');
  16790. },
  16791. invert: function(){
  16792. return new Color(this.map(function(value){
  16793. return 255 - value;
  16794. }));
  16795. },
  16796. setHue: function(value){
  16797. return new Color([value, this.hsb[1], this.hsb[2]], 'hsb');
  16798. },
  16799. setSaturation: function(percent){
  16800. return new Color([this.hsb[0], percent, this.hsb[2]], 'hsb');
  16801. },
  16802. setBrightness: function(percent){
  16803. return new Color([this.hsb[0], this.hsb[1], percent], 'hsb');
  16804. }
  16805. });
  16806. this.$RGB = function(r, g, b){
  16807. return new Color([r, g, b], 'rgb');
  16808. };
  16809. this.$HSB = function(h, s, b){
  16810. return new Color([h, s, b], 'hsb');
  16811. };
  16812. this.$HEX = function(hex){
  16813. return new Color(hex, 'hex');
  16814. };
  16815. Array.implement({
  16816. rgbToHsb: function(){
  16817. var red = this[0],
  16818. green = this[1],
  16819. blue = this[2],
  16820. hue = 0,
  16821. max = Math.max(red, green, blue),
  16822. min = Math.min(red, green, blue),
  16823. delta = max - min,
  16824. brightness = max / 255,
  16825. saturation = (max != 0) ? delta / max : 0;
  16826. if (saturation != 0){
  16827. var rr = (max - red) / delta;
  16828. var gr = (max - green) / delta;
  16829. var br = (max - blue) / delta;
  16830. if (red == max) hue = br - gr;
  16831. else if (green == max) hue = 2 + rr - br;
  16832. else hue = 4 + gr - rr;
  16833. hue /= 6;
  16834. if (hue < 0) hue++;
  16835. }
  16836. return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)];
  16837. },
  16838. hsbToRgb: function(){
  16839. var br = Math.round(this[2] / 100 * 255);
  16840. if (this[1] == 0){
  16841. return [br, br, br];
  16842. } else {
  16843. var hue = this[0] % 360;
  16844. var f = hue % 60;
  16845. var p = Math.round((this[2] * (100 - this[1])) / 10000 * 255);
  16846. var q = Math.round((this[2] * (6000 - this[1] * f)) / 600000 * 255);
  16847. var t = Math.round((this[2] * (6000 - this[1] * (60 - f))) / 600000 * 255);
  16848. switch (Math.floor(hue / 60)){
  16849. case 0: return [br, t, p];
  16850. case 1: return [q, br, p];
  16851. case 2: return [p, br, t];
  16852. case 3: return [p, q, br];
  16853. case 4: return [t, p, br];
  16854. case 5: return [br, p, q];
  16855. }
  16856. }
  16857. return false;
  16858. }
  16859. });
  16860. String.implement({
  16861. rgbToHsb: function(){
  16862. var rgb = this.match(/\d{1,3}/g);
  16863. return (rgb) ? rgb.rgbToHsb() : null;
  16864. },
  16865. hsbToRgb: function(){
  16866. var hsb = this.match(/\d{1,3}/g);
  16867. return (hsb) ? hsb.hsbToRgb() : null;
  16868. }
  16869. });
  16870. })();
  16871. /*
  16872. ---
  16873. script: Group.js
  16874. name: Group
  16875. description: Class for monitoring collections of events
  16876. license: MIT-style license
  16877. authors:
  16878. - Valerio Proietti
  16879. requires:
  16880. - Core/Events
  16881. - MooTools.More
  16882. provides: [Group]
  16883. ...
  16884. */
  16885. (function(){
  16886. var Group = this.Group = new Class({
  16887. initialize: function(){
  16888. this.instances = Array.flatten(arguments);
  16889. },
  16890. addEvent: function(type, fn){
  16891. var instances = this.instances,
  16892. len = instances.length,
  16893. togo = len,
  16894. args = new Array(len),
  16895. self = this;
  16896. instances.each(function(instance, i){
  16897. instance.addEvent(type, function(){
  16898. if (!args[i]) togo--;
  16899. args[i] = arguments;
  16900. if (!togo){
  16901. fn.call(self, instances, instance, args);
  16902. togo = len;
  16903. args = new Array(len);
  16904. }
  16905. });
  16906. });
  16907. }
  16908. });
  16909. })();
  16910. /*
  16911. ---
  16912. script: Hash.Cookie.js
  16913. name: Hash.Cookie
  16914. description: Class for creating, reading, and deleting Cookies in JSON format.
  16915. license: MIT-style license
  16916. authors:
  16917. - Valerio Proietti
  16918. - Aaron Newton
  16919. requires:
  16920. - Core/Cookie
  16921. - Core/JSON
  16922. - MooTools.More
  16923. - Hash
  16924. provides: [Hash.Cookie]
  16925. ...
  16926. */
  16927. Hash.Cookie = new Class({
  16928. Extends: Cookie,
  16929. options: {
  16930. autoSave: true
  16931. },
  16932. initialize: function(name, options){
  16933. this.parent(name, options);
  16934. this.load();
  16935. },
  16936. save: function(){
  16937. var value = JSON.encode(this.hash);
  16938. if (!value || value.length > 4096) return false; //cookie would be truncated!
  16939. if (value == '{}') this.dispose();
  16940. else this.write(value);
  16941. return true;
  16942. },
  16943. load: function(){
  16944. this.hash = new Hash(JSON.decode(this.read(), true));
  16945. return this;
  16946. }
  16947. });
  16948. Hash.each(Hash.prototype, function(method, name){
  16949. if (typeof method == 'function') Hash.Cookie.implement(name, function(){
  16950. var value = method.apply(this.hash, arguments);
  16951. if (this.options.autoSave) this.save();
  16952. return value;
  16953. });
  16954. });
  16955. /*
  16956. ---
  16957. name: Swiff
  16958. description: Wrapper for embedding SWF movies. Supports External Interface Communication.
  16959. license: MIT-style license.
  16960. credits:
  16961. - Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject.
  16962. requires: [Core/Options, Core/Object, Core/Element]
  16963. provides: Swiff
  16964. ...
  16965. */
  16966. (function(){
  16967. var Swiff = this.Swiff = new Class({
  16968. Implements: Options,
  16969. options: {
  16970. id: null,
  16971. height: 1,
  16972. width: 1,
  16973. container: null,
  16974. properties: {},
  16975. params: {
  16976. quality: 'high',
  16977. allowScriptAccess: 'always',
  16978. wMode: 'window',
  16979. swLiveConnect: true
  16980. },
  16981. callBacks: {},
  16982. vars: {}
  16983. },
  16984. toElement: function(){
  16985. return this.object;
  16986. },
  16987. initialize: function(path, options){
  16988. this.instance = 'Swiff_' + String.uniqueID();
  16989. this.setOptions(options);
  16990. options = this.options;
  16991. var id = this.id = options.id || this.instance;
  16992. var container = document.id(options.container);
  16993. Swiff.CallBacks[this.instance] = {};
  16994. var params = options.params, vars = options.vars, callBacks = options.callBacks;
  16995. var properties = Object.append({height: options.height, width: options.width}, options.properties);
  16996. var self = this;
  16997. for (var callBack in callBacks){
  16998. Swiff.CallBacks[this.instance][callBack] = (function(option){
  16999. return function(){
  17000. return option.apply(self.object, arguments);
  17001. };
  17002. })(callBacks[callBack]);
  17003. vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack;
  17004. }
  17005. params.flashVars = Object.toQueryString(vars);
  17006. if ('ActiveXObject' in window){
  17007. properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
  17008. params.movie = path;
  17009. } else {
  17010. properties.type = 'application/x-shockwave-flash';
  17011. }
  17012. properties.data = path;
  17013. var build = '<object id="' + id + '"';
  17014. for (var property in properties) build += ' ' + property + '="' + properties[property] + '"';
  17015. build += '>';
  17016. for (var param in params){
  17017. if (params[param]) build += '<param name="' + param + '" value="' + params[param] + '" />';
  17018. }
  17019. build += '</object>';
  17020. this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild;
  17021. },
  17022. replaces: function(element){
  17023. element = document.id(element, true);
  17024. element.parentNode.replaceChild(this.toElement(), element);
  17025. return this;
  17026. },
  17027. inject: function(element){
  17028. document.id(element, true).appendChild(this.toElement());
  17029. return this;
  17030. },
  17031. remote: function(){
  17032. return Swiff.remote.apply(Swiff, [this.toElement()].append(arguments));
  17033. }
  17034. });
  17035. Swiff.CallBacks = {};
  17036. Swiff.remote = function(obj, fn){
  17037. var rs = obj.CallFunction('<invoke name="' + fn + '" returntype="javascript">' + __flash__argumentsToXML(arguments, 2) + '</invoke>');
  17038. return eval(rs);
  17039. };
  17040. })();
  17041. /*
  17042. ---
  17043. name: Table
  17044. description: LUA-Style table implementation.
  17045. license: MIT-style license
  17046. authors:
  17047. - Valerio Proietti
  17048. requires: [Core/Array]
  17049. provides: [Table]
  17050. ...
  17051. */
  17052. (function(){
  17053. var Table = this.Table = function(){
  17054. this.length = 0;
  17055. var keys = [],
  17056. values = [];
  17057. this.set = function(key, value){
  17058. var index = keys.indexOf(key);
  17059. if (index == -1){
  17060. var length = keys.length;
  17061. keys[length] = key;
  17062. values[length] = value;
  17063. this.length++;
  17064. } else {
  17065. values[index] = value;
  17066. }
  17067. return this;
  17068. };
  17069. this.get = function(key){
  17070. var index = keys.indexOf(key);
  17071. return (index == -1) ? null : values[index];
  17072. };
  17073. this.erase = function(key){
  17074. var index = keys.indexOf(key);
  17075. if (index != -1){
  17076. this.length--;
  17077. keys.splice(index, 1);
  17078. return values.splice(index, 1)[0];
  17079. }
  17080. return null;
  17081. };
  17082. this.each = this.forEach = function(fn, bind){
  17083. for (var i = 0, l = this.length; i < l; i++) fn.call(bind, keys[i], values[i], this);
  17084. };
  17085. };
  17086. if (this.Type) new Type('Table', Table);
  17087. })();