Professional Documents
Culture Documents
Type: Array
Element
Type: Element Type: Window
Class: Request
Class: Request.HTML
mootools Core
Core
ie, ie6, ie7, ie8, firefox, firefox2, firefox3, safari, safari3, safari4, chrome, opera
O.append(origin o, ext o) O.clone(o) O.contains(o, value m) O.getLength(o) O.keys(o) O.merge(o1, o2 [, o3, ...]) O.subset(o, keys a) O.toQueryString(o) O.values(o)
Type: String
Array.each(iterable, fn [, bind]) Array.clone(a) Array.from(o) * each(fn(el, i, a){} [, bn]) * every(fn(el, i, a){} [, bn]) * filter(fn(el, i, a){} [, bn]) * indexOf(el [, from n]) * map(fn(el, i, a){} [, bn]) * some(fn(el, i, a){} [, bn])
* only if not supported natively
new Request.HTML([opt])
opt = { all opt from Request + update: el, append: el, evalScripts: eval<script>?, filter: fn, onSuccess(rTree, rElems, rHTML, rJS) }
Features
xpath, xhr, air, query, json
Request Platform
mac, win, linux, ios, webos, android, other, anyName
Plugins
Flash
Class
new Class(o | contructor fn)
special properties: Extends: o | class | a, Implements: o, initialize: fn (=constructor)
implement(o)
String.from(m) String.uniqueID() camelCase() capitalize() clean() contains(s [, separator s]) escapeRegExp() hyphenate() stripScripts(evaluate?) substitute(o [, regex]) test(regex [, params]) toInt(), toFloat() trim() rgbToHex(returnArray?) hexToRgb(returnArray?)
Class.Extras
Class: Chain new Class({Implements: Chain})
addEvent(s, fn [, internal?]) addEvents(o, fn [, internal?]) fireEvent(s [, args, delay ms]) removeEvent(s, fn) removeEvents([s])
Class: Options new Class({Implements: Options})
setOptions([opt])
appendText(s) empty() remove children destroy() trash, free memory dispose() remove from DOM clone([cloneContents?, keepId?]) replaces(el) Type: Number hasClass(s) Number.from(m) addClass(s) Number.random(min n, max n) removeClass(s) limit(min n, max n) toggleClass(s) round([n]) getPrevious([match]) times(fn [, bn]) getAllPrevious([match]) toInt(), toFloat() getNext([match]) getAllNext([match]) Methods from Math getFirst([match]) abs, acos, asin, atan2, ceil, cos, Type: Function exp, floor, log, max, min, pow, sin, getLast([match]) Function.from(m) sqrt, tan getParent([match]) Function.attempt(fn [, fn [, ...] ]) getParents([match]) Type: Event attempt([args [, bn]) getSiblings([match]) new Event([e [, win] ]) bind([bn [, args] ]) getChildren([match]) Properties delay([ms [, bn [, args] ] ]) alt, client.x, client.y, code, control, toQueryString() extend(key s, value m) getSelected() (only on <select>) key, meta, page.x, page.y, shift, implement(key s, value m) relatedTarget, rightClick, target, getProperty(s) pass([args [, bn]) wheel getProperties(s [,s [, ...] ]) periodical([ms [, bn [, args] ] ]) key can be: setProperty(s, val) replace: bindWithEvent enter, up, down, left, right, tab, setProperties( {s: val, ...} ) myEl.addEvent(click,function(e){ space, backspace, delete, esc removeProperty(s) myFunction.bind(bn [, e]) preventDefault() removeProperties(s [,s [, ...] ]) }) stop(), stopPropagation() store(s, val) retreive(s [, default m]) Object: Event.Keys replace: run eliminate(s) myFn.apply(bn, arg) Event.Keys.key = keyCode
append(a) associate(a) clean() combine(a) contains(el [, from n]) erase(el) empty() flatten() getLast() getRandom() include(el) invoke(method [, arg, arg, ...]) link(o) pick() rgbToHex(returnArray?) hexToRgb(returnArray?)
getElement(match) getElements(match) getElementById(s) set(s, val | o) get(s) erase(s) match(match) contains(el) inject(el [, where])
<el>myEl</el> (move myEl)
grab(el [, where])
<myEl>el</myEl> (move el)
adopt(el [, el a | el [,...] ])
<myEl>el el</myEl> (move els)
wraps(el [, where])
<myEl>el</myEl> (move myEl)
opt = { url: s, method: post | get, (function($){ data: s, // $ is safe in closure (compat!) link: ignore | cancel | chain, })(document.id) async: asyncRequest?, $$(selector s | el a | el[, el, ...]) any combination; commaseparated encoding: s, (default: utf-8) headers: {name: content}, Object: Element.Properties evalScripts: eval<script>?, html: htmlStr [, htmlStr [, ...] ] evalResponse: evalAll?, text: textString emulation: put_method?, prop: propValue urlEncoded: formUrlEncoding?, tag (only getter) timeout: ms, noCache: forceNoCache?, Type: IFrame user: basicAuthUser s, new IFrame([el [, opt] ]) password: basicAuthPasswd s, isSuccess: fn, Type: Elements onRequest(), new Elements(el a [, opt]) onLoadStart(event, xhr), filter(sel s) onProgress(event, xhr), Element.Style onComplete(), onCancel(), Type: Element onSuccess(rText, rXml), setStyle(s, val) onFailure(xhr), setStyles( {s : val, ...} ) onException(hdName ,val), getStyle(s) onTimeout() getStyles(s [, s [, ...] ]) }
load [, opt]
Type: Element load(url s) > Request.HTML.get Class: Request.JSON
new Request.JSON([opt])
opt = { all opt from Request + secure: checkSyntax? onComplete(rJSON, rText) } Object:
JSON
Element.Event
Type:
Element
addEvent(e, fn) addEvents({e: fn}) removeEvent(e, fn) removeEvents([e]) fireEvent(e [, args, delay]) cloneEvents(from el [, type s])
Object: Element.Events
Element.Events.key = o
o = { base: e, condition: fn, onAdd: fn, onRemove: fn }
Custom Events
mouseenter mouseleave mousewheel
opt = { id: s width: n, height : n, container: el, Object: Element.Properties params: swfParams, send [, Request opt] properties: o, vars: o, Type: Element events: o send([url s]) (only on <form>) } Object: Cookie swfParams = { allowScriptAccess: s, Cookie.write(key s, value s [, opt]) quality: high | medium | low, opt = { swLiveConnect: remoteScripting?, domain: s, path: s, wMode: s duration: n, secure: b? } }
Element.Dimensions
Type: Element
getCoordinates() getOffsetParent() getPosition(relative el) setPosition( {x: posX, y: posY} ) getScroll(), getScrollSize() getSize() scrollTo(x,y)
domready
e ~ Event fn ~ Function el ~ Element el a ~ Array of el m ~ mixed
(Selectors)
domready
the all time favourite ;) o ~ Object s ~ String a ~ Array n ~ Number ? ~ Boolean
Fx.Transitions
Class: Fx.Scroll
Module: Types
Info: Date.format
Module: Request Class: Request.Periodical extends Request, Request.HTML & Request.JSON opt = { all opt from Request + initialDelay: ms, delay: ms, limit: ms }
mootools FX/More
Full CheatSheet for Javascript Framework mootools 1.3 by mediavrog.net/blog/ Class: FX
Class: Fx adds possibility to use transition option as string e.g. bounce:out Object: Fx.Transitions
format(format)
new Fx(opt)
opt = { fps: n (default: 50), unit: false | px | em | %, link: ignore | cancel | chain, duration: ms | short | normal | long, transition: Fx.Transitions, onStart(fxInstance), onComplete(fxInstance), onCancel(fxInstance), onChainComplete(fxInstance) }
Linear, Quad, Cubic, Quart, Quint, Pow, Expo, Circ, Sine, Back, Bounce, Elastic
set(x, y) start(x, y) each has easIn,easeOut,easeInOut toTop(), toBottom() toLeft(), toRight(), Class: Fx.Transition new Fx.Transition(trans [, opt]) toElement(el)
mootools More
From here on you will find some selected plugins from More, I consider useful. Its not a complete list! Be sure to check out mootools.net/docs/more for latest up-to-date information.
Class: Drag
repeat(times n) tidy() common special-chars to ascii standardize() remove non-ascii getTags([tagType, contents]) stripTags([tagType, contents])
Found typos?
maik@mediavrog.net
Class: Fx.Elements
set(to)
to = { index of el: {cssProp: to} }
tween, [ opt]
Type: Element
start(obj)
Class: Fx.Slide how = in | out | show | hide | toggle new Fx.Slide(el, opt) or number between 0 and 1 opt = { all opt from Fx + highlight([start, end]) mode: horizontal | vertical, wrapper: el, Class: FX.Morph hideOverflow: setHidden?, new Fx.Morph(el, opt) resetHeight: autoResetHeight? opt = { all opt from Fx } }
makeResizable([opt])
opt = all opt from Drag Class: Drag.Move
formatPercentage()
Hash: Asset
set( match | {cssProp: to} ) start( match | {cssProp: from, [to] } ) morph, [ opt]
Type: Element
Object: Element.Properties
Asset.image(source s [, opt])
opt = { all opt from Element + onLoad(), onError(), onAbort() }
short day (Mon, Tue) full day (Monday) short month (Jan, Feb) full month (January) full date to string (Mon Dec 10 14:35:42 2007) d date to two digits (01, 05, ...) e date as one digit (1, 5, 12, ...) H hour to two digits / 24h (00 - 24) I hour as decimal / 12h (01 - 12) j day of the year to three digits clone() (001 - 366, is Jan 1st) increment(resolution, times n) k hour / 24h as a digit (0 - 23) decrement(resolution, times n) Single digits preceded by space diff(date [, resolution]) l hour / 12h as digit (1 to 12). resolution = year, month, week, Single digits preceded by space day, hour, minute, second, ms L time in milliseconds to 3 digits m numerical month to two digits isLeapYear() (01 is Jan, 12 is Dec) clearTime() M minutes to two digits (01 - 59) toISOString() o ordinal of the day of the month parse(date | s) in the current language Static methods (D = Date) (st for 1st, nd for 2nd, etc.) D.defineFormat(name, format) p current language equivalent of either AM or PM D.defineFormats({name, format}) s Unix Epoch Time timestamp D.parse(date | s) S seconds to two digits (01 - 59) D.defineParser(pattern s) U week to two digits (01- 52) D.defineParsers(pattern a) pattern = hybrid of format keys & w numerical day of week one digit (0 is Sunday, 1 is Monday) regular expressions x date in the current language %key - match key preferred format ? - optional en-US: %m/%d/%Y (12/10/2007) () - groups X time in the current language e.g. %d%o( %b( %Y)?)?( %X)? preferred format ~ 14th en-US: %I:%M%p (02:45PM) ~ 31st October y short year in two digits (07) ~ 1 Jan 2000 Y full year in four digits (2007) ~ 1 Jan 12:00am z GMT offset (-0800) D.define2DigitYearStart(year) Z time zone (GMT) example: % returns % (%y%% = 07%) D.parse(01/01/00);//Year 2000 D.parse(12/31/99);//Year 1999 shortcuts: db D.define2DigitYearStart(2000); %Y-%m-%d %H:%M:%S D.parse(01/01/00);//Year 2000 D.parse(12/31/99);//Year 2099 Class: Date.Extras
startTimer(m) stopTimer()
Class: Request.Queue
new Request.Queue(opt)
opt = { stopOnFailure: b?, autoAdvance: b?, concurrent: parrallelReq n } + Events from Request like so: onComplete(name, inst, rText, rXml)
addRequest(name, request) addRequests({name, request}) cancel(name) clear([name]) getName(request) getRunning() hasNext([name]) removeRequest(name | request) resume() runAll() runNext([name])
Type: URI
compact iso8601
%Y%m%dT%H%M%S %Y-%m-%dT%H:%M:%S%T
slide, [ opt]
Type: Element
stop()
Type: Element
Asset.images(sources a [, opt]) Extra Date Parsers opt = { all opt from Element + Date.parse(today) onComplete(), Date.parse(next monday) ...
onProgress(counter, index), onError(counter, index) Type: Date
rfc822
%a, %d %b %Y %H:%M:%S %Z
toURI()
Module: URI.Relative Type: URI
short
%d %b %H:%M
slide( [how] )
how = in | out | show | hide | toggle
makeDraggable([opt])
} opt = all opt from Drag / Drag.Move Note: Dont use Mootools events!
long
%B %d, %Y %H:%M
toAbsolute() toRelative()