Mootools 1.3 Cheat Sheet1

of 2
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Document Description
Type: Object Type: Array Element Type: Element Type: Window Class: Request Class: Request.HTML mootools Core Core Static methods (O = Object) * O.each(fn(v, k, o){} [, bn]) * O.every(fn(v, k, o){} [, bn]) * O.filter(fn(v, k, o){} [, bn]) * O.keyOf(o, value m) *, k, o){} [, bn]) * O.some(fn(v, k, o){} [, bn]) * mostly synonymous to Array fn Full CheatSheet for Javascript Framework mootools 1.3 by instanceOf(item m, type m) typeOf(item m) element, textnode, n
Document Share
Document Tags
Document Transcript
  Class new Class(o | contructor n) special properties:Extends: o | class | a,Implements: o,initialize: n (=constructor) implement(o) Class.Extras Class: Chain new Class({Implements: Chain}) callChain([args])chain(n [, n [,...] ])clearChain() Class: Events new Class({Implements: Events}) addEvent(s, n [, internal?])addEvents(o, n [, internal?])reEvent(s [, args, delay ms])removeEvent(s, n)removeEvents([s]) Class: Options new Class({Implements: Options}) setOptions([opt]) Type:  Array  Array.each(iterable, n [, bind]) Array.clone(a) Array.rom(o)* each(n(el, i, a){} [, bn])* every(n(el, i, a){} [, bn])* lter(n(el, i, a){} [, bn])* indexO(el [, rom n])* map(n(el, i, a){} [, bn])* some(n(el, i, a){} [, bn]) * only i not supported natively append(a)associate(a)clean()combine(a)contains(el [, rom n])erase(el)empty()fatten()getLast()getRandom()include(el)invoke(method [, arg, arg, ...])link(o)pick()rgbToHex(returnArray?)hexToRgb(returnArray?) Type: Function Function.rom(m)Function.attempt(n [, n [, ...] ])attempt([args [, bn])bind([bn [, args] ])delay([ms [, bn [, args] ] ])extend(key s, value m)implement(key s, value m)pass([args [, bn])periodical([ms [, bn [, args] ] ]) replace: bindWithEvent myEl.addEvent(“click“,unction(e){ myFunction.bind(bn [, e]) })replace: run myFn.apply(bn, arg) Core instanceO(item m, type m)typeO(item m) element, textnode, number,whitespace, unction, date,arguments, array, object, string,boolean, regexp, class, collection,window, document,event, alseType: Number Number.rom(m)Number.random(min n, max n)limit(min n, max n)round([n])times(n [, bn])toInt(), toFloat() Methods rom ‘Math’ abs, acos, asin, atan2, ceil, cos,exp, foor, log, max, min, pow, sin,sqrt, tanType: String String.rom(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?) Element Type: Element new Element(tag s | el |selector s [, opt]) each opt calls ‘Element.set’ 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 el’s) wraps(el [, where]) <myEl>el</myEl> (move myEl) appendText(s)empty() remove children destroy() trash, ree memory dispose() remove rom DOM clone([cloneContents?, keepId?])replaces(el)hasClass(s)addClass(s)removeClass(s)toggleClass(s)getPrevious([match])getAllPrevious([match])getNext([match])getAllNext([match])getFirst([match])getLast([match])getParent([match])getParents([match])getSiblings([match])getChildren([match])toQueryString()getSelected() (only on <select>) getProperty(s)getProperties(s [,s [, ...] ])setProperty(s, val)setProperties( {s: val, ...} )removeProperty(s)removeProperties(s [,s [, ...] ])store(s, val)retreive(s [, deault m])eliminate(s) Class: Request new Request( [opt] ) opt = { url: s,method: post | get,data: s,link: ignore | cancel | chain,async: asyncRequest?,encoding: s, (deault: ut-8)headers: {name: content},evalScripts: eval<script>?,evalResponse: evalAll?,emulation:  put   _method?,urlEncoded: ormUrlEncoding?,timeout: ms,noCache: orceNoCache?,user: basicAuthUser s,password: basicAuthPasswd s,isSuccess: n,onRequest(),onLoadStart(event, xhr),onProgress(event, xhr),onComplete(),onCancel(),onSuccess(rText, rXml),onFailure(xhr),onException(hdName ,val),onTimeout() } cancel()getHeader(name s)setHeader(name s, val s)isRunning()send( [Request opt] ) Object: Element.Properties send [, Request opt] Type: Element send([url s]) (only on <orm>)Class: Request.HTML new Request.HTML([opt]) opt = { all opt rom Request +update: el,append: el,evalScripts: eval<script>?,lter: n,onSuccess(rTree, rElems,rHTML, rJS) } get(opt | url s)post(opt | queryString | el) Object: Element.Properties load [, opt] Type: Element load(url s) > Request.HTML.getClass: Request.JSON new Request.JSON([opt]) opt = { all opt rom Request +secure: checkSyntax?onComplete(rJSON, rText) } mootools Core Full CheatSheet or JavascriptFramework mootools Object: Browser ie, ie6, ie7, ie8,reox, reox2, reox3,saari, saari3, saari4,chrome, opera Features xpath, xhr, air, query, json RequestPlatorm mac, win, linux, ios, webos,android, other, anyName Plugins Flash Type: Object Static methods (O = Object) * O.each(n(v, k, o){} [, bn])* O.every(n(v, k, o){} [, bn])* O.lter(n(v, k, o){} [, bn])* O.keyO(o, value m)*n(v, k, o){} [, bn])* O.some(n(v, k, o){} [, bn]) * mostly synonymous to Array n O.append(srcin 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)new Event([e [, win] ])Properties alt, client.x, client.y, code, control,key, meta, page.x, page.y, shit,relatedTarget, rightClick, target,wheel ‘key’ can be: enter, up, down, let, right, tab,space, backspace, delete, esc preventDeault()stop(), stopPropagation() Object: Event.Keys Event.Keys.key = keyCode Type: Event Class: Slick (Selectors) ‘Slick’ engine FTW! WindowEvent: domready domready the all time avourite ;)Object: Cookie Cookie.write(key s, value s [, opt]) opt = { domain: s, path: s,duration: n, secure: b? } s)Cookie.dispose(key s [, opt]) Object: JSON JSON.encode(o)JSON.decode(s [, secure?]) Class: Swi new Swi(swPath s [, opt]) opt = { id: swidth: n, height : n,container: el,params: swParams,properties: o,vars: o,events: o }swParams = { allowScriptAccess: s,quality: high | medium | low,swLiveConnect: remoteScripting?,wMode: s } Swi.remote( mySwi o, n[, arg, arg, ...]) Element.Event Type: Element addEvent(e, n)addEvents({e: n})removeEvent(e, n)removeEvents([e])reEvent(e [, args, delay])cloneEvents(rom el [, type s]) Object: Element.Events Element.Events.key = o o = { base: e, condition: n,onAdd: n, onRemove: n } Custom Events mouseentermouseleavemousewheel Element.Style Type: Element setStyle(s, val)setStyles( {s : val, ...} )getStyle(s)getStyles(s [, s [, ...] ]) Element.Dimensions Type: Element getCoordinates()getOsetParent()getPosition(relative el)setPosition( {x: posX, y: posY} )getScroll(), getScrollSize()getSize()scrollTo(x,y) o ~ Object e ~ Event bn ~ Element to bind ‘this’s ~ String n ~ Function [ ] ~ optionala ~ Array el ~ Element | ~ choice / orn ~ Number el a ~ Array o el ms ~ Milliseconds? ~ Boolean m ~ mixed match ~ CSS SelectorType: Window | s | o)  Alias: $ (unction($){ // $ is sae in closure (compat!) })( $$(selector s | el a | el[, el, ...]) any combination; commaseparatedObject: Element.Properties html: htmlStr [, htmlStr [, ...] ]text: textStringprop: propValuetag (only getter)Type: IFrame new IFrame([el [, opt] ]) Type: Elements new Elements(el a [, opt])lter(sel s)  Fx.Transitions Class: Fx adds possibility to use transitionoption as string e.g. ‘bounce:out’Object: Fx.Transitions Linear, Quad, Cubic, Quart,Quint, Pow, Expo, Circ, Sine,Back, Bounce, Elastic each has easIn,easeOut,easeInOut Class: Fx.Transition new Fx.Transition(trans [, opt]) Class: Fx.Tween new Fx.Tween(el, opt) opt = { all opt rom Fx +property: cssProp s } set(cssProp s, value m)start([cssProp s,] [rom,] to) Object: Element.Properties tween, [ opt] Type: Element tween(cssProp s, rom [, to])ade([how]) how = in | out | show | hide | toggleor number between 0 and 1 highlight([start, end]) Class: FX new Fx(opt) opt = { ps: n (deault: 50),unit: alse | px | em | %,link: ignore | cancel | chain,duration: ms | short | normal | long,transition: Fx.Transitions,onStart(xInstance),onComplete(xInstance),onCancel(xInstance),onChainComplete(xInstance) } start(rom n, [to n])set(value m n)cancel()pause()resume() mootools FX/More Full CheatSheet or JavascriptFramework mootools    Class: FX.Morph new Fx.Morph(el, opt) opt = { all opt rom Fx } set( match | {cssProp: to} )start( match | {cssProp: rom,[to] } ) Object: Element.Properties morph, [ opt] Type: Element morph( match | {cssProp:rom, [to] } ) Class: Fx.Elements new Fx.Elements(el a, opt) opt = all opt rom FX set(to) to = { index o el: {cssProp: to} } start(obj) obj = { index o el: {cssProp: [rom, to]} }Module: Types  Array.Extras (  Type:  Array) min()max()average()shufe()sum()unique()reduce(n [, rstCallVal m])reduceRight(n [, rstCallVal m]) n(previousVal, currentVal, i, a) String.Extras (  Type: String) pad(length, padString, dir) dir = let | right | both repeat(times n)tidy() common special-chars to ascii standardize() remove non-ascii getTags([tagType, contents])stripTags([tagType, contents]) Object.Extras (  Type: Object) O.getFromPath(o, path s) path like ‘key1.sub1.sub3‘ O.cleanValues(o, n(val))O.erase(o, key) [, arg [, arg [, ...]]]) Number.Format (  Type: Number) ormat([opt]) opt = { decimal: separator s,group: separator s,decimals: numODecimals n,precision: signicantNum n,scientic: replace’e+4’?,prex: s, sux: s } ormatCurrency() > Locale ormatPercentage() Module: Request Class: Request.Periodical extends Request, Request.HTML& Request.JSONopt = { all opt rom Request +initialDelay: ms,delay: ms,limit: ms } startTimer(m)stopTimer() Class: Request.Queue new Request.Queue(opt) opt = { stopOnFailure: b?,autoAdvance: b?,concurrent: parrallelReq n } + Events rom 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]) Hash:  Asset  Asset.javascript(source s [, opt]) Asset.css(source s [, opt]) opt = { all opt rom Element +onLoad() }  Asset.image(source s [, opt]) opt = { all opt rom Element +onLoad(), onError(), onAbort() }  Asset.images(sources a [, opt]) opt = { all opt rom Element +onComplete(),onProgress(counter, index),onError(counter, index) }Note: Don’t use Mootools events!Type: URI new URI([strUri, opt]) opt = { base: baseHre s } toString()set(part, value) part = scheme, user, password,host, port, directory, le, query,ragment, data get(part)setData(o [, merge?, part])getData([key, part])clearData()go()toURI() Type: String toURI() Module: URI.Relative Type: URI toAbsolute()toRelative() Type: Date get(key) set(key, val) / set({key: val}) key = Date, Day, FullYear / year,Hours / hr, Milliseconds / ms,Minutes / min, Month / mo,Seconds / sec, Time, UTCDate,UTCFullYear, UTCHours,UTCMilliseconds, UTCMinutes,UTCMonth, UTCSecondsor ‘get(key)’ key may also be:TimezoneOset, Week, Timezone,GMTOset, Ordinal, DayOYear,LastDayOMonth, UTCDay, AMPM clone()increment(resolution, times n)decrement(resolution, times n)di(date [, resolution]) resolution = year, month, week,day, hour, minute, second, ms isLeapYear()clearTime()toISOString()parse(date | s) Static methods (D = Date)neFormat(name, ormat)neFormats({name, ormat})D.parse(date | s)neParser(pattern s)neParsers(pattern a) pattern = hybrid o ormat keys & regular expressions%key - match key? - optional() - groupse.g. “%d%o( %b( %Y)?)?( %X)?“~ 14th~ 31st October~ 1 Jan 2000~ 1 Jan 12:00amne2DigitYearStart(year) example:D.parse(‘01/01/00’);//Year 2000D.parse(‘12/31/99’);//Yearne2DigitYearStart(2000);D.parse(‘01/01/00’);//Year 2000D.parse(‘12/31/99’);//Year 2099Class: Date.Extras Extra Date Parsers Date.parse(“today“)Date.parse(“next monday“) ... Type: Date timeDi([date, joiner])timeDiInWords([date]) Ino: Date.ormat ormat(ormat) keys: (“%key %key2%key3”)a short day (“Mon”, “Tue”)  A ull day (“Monday”) b short month (“Jan”, “Feb”) B ull month (“January”) c ull date to string (“Mon Dec10 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 o the year to three digits(001 - 366, is Jan 1st) k  hour / 24h as a digit (0 - 23)Single digits preceded by space l hour / 12h as digit (1 to 12).Single digits preceded by space L time in milliseconds to 3 digits m numerical month to two digits(01 is Jan, 12 is Dec) M minutes to two digits (01 - 59) o ordinal o the day o the monthin the current language(“st” or 1st, “nd” or 2nd, etc.) p current language equivalent oeither AM or PM s Unix Epoch Time timestamp S seconds to two digits (01 - 59) U week to two digits (01- 52) w numerical day o week one digit(0 is Sunday, 1 is Monday) x date in the current languagepreerred ormaten-US: %m/%d/%Y (12/10/2007)  X time in the current languagepreerred ormaten-US: %I:%M%p (02:45PM) y short year in two digits (“07”)  Y ull year in our digits (“2007”) z GMT oset (“-0800”) Z time zone (“GMT”) % returns % (%y%% = 07%) shortcuts: db %Y-%m-%d %H:%M:%S compact %Y%m%dT%H%M%S iso8601  %Y-%m-%dT%H:%M:%S%T rc822 %a, %d %b %Y %H:%M:%S %Z short %d %b %H:%M long  %B %d, %Y %H:%MClass: Fx.Slide new Fx.Slide(el, opt) opt = { all opt rom Fx +mode: horizontal | vertical,wrapper: el,hideOverfow: setHidden?,resetHeight: autoResetHeight? } slideIn([mode])slideOut([mode])toggle([mode])hide([mode])show([mode]) Hash: Element.Properties slide, [ opt] Type: Element slide( [how] ) how = in | out | show | hide | toggleClass: Fx.Scroll new Fx.Scroll(el, opt) opt = { all opt rom Fx +oset: {x: n, y: n},overfown: a,wheelStops: wheelStopsTrans? } set(x, y)start(x, y)toTop(), toBottom()toLet(), toRight(),toElement(el) Class: Drag new Drag(el, opt) opt = { grid: pixels n,handle: el,invert: invertValuesOnDrag?,limit: {x: n, y:n},modiers: {x: cssProp, y: cssProp}snap: distance n,style: setModiersAsStyleProp?unit: s (deault: px),preventDeault: b?, > EventstopPropagation: b?, > EventonBeoreStart(el),onStart(el),onSnap(el),onDrag(el),onComplete(el),onCancel(el) } attach()detach()stop([event]) Type: Element makeResizable([opt]) opt = all opt rom DragClass: Drag.Move new Drag.Move(el, opt) opt = { all opt rom Drag +container: el,droppables: el a,precalculate: b?,includeMargins: b?,checkDroppables: b?,onDrop(el, droppable, event),onLeave(el, droppable),onEnter(el, droppable) } stop() Type: Element makeDraggable([opt]) opt = all opt rom Drag / Drag.Move mootools More From here on you will ndsome selected plugins romMore, I consider useul.It’s not a complete list!Be sure to check orlatest up-to-date inormation. Found typos?
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!