I don't mind trading my opinion for a better one,
but not for one with equal or lesser value.
- My father

Intention.js

  • Ajax
  • Extend
  • Indexeddb
  • Intention
  • Utils
  • Bind
  • Element
  • Html
  • Selector
  • Trigger

Meet Mr. Ajax


Performs an ajax request to the requested url with specified data

@method ajax
@depends XMLHttpRequest
@param {String} type The type of request to send , for example 'post' or 'get'
@param {String} url The endpoint of the request
@param {Mixed} data Optional , data to send to the endpoint
@param {Function} onsuccess Optional , success callback handler
@param {Function} onfailure Optional , failure callback handler
@return {Object} the XHR Object

[post description]

@method post
@param {String} url The endpoint of the request
@param {Mixed} data Optional , data to send to the endpoint
@param {Function} onsuccess Optional , success callback handler
@param {Function} onfailure Optional , failure callback handler
@return {Object} the XHR Object

Meet Mr. Extend


[extend description]

@method extend
@depends [depends]
@param {[type]} child
@param {[type]} parent
@return {[type]}

[abstract description]

@method abstract
@depends [depends]
@param {[type]} receiver
@param {[type]} method
@return {[type]}

Meet Mr. Indexeddb


Meet Mr. Intention


[module description]

@method module
@depends [depends]
@param {[type]} dependancies
@param {[type]} name
@param {[type]} module
@param {[type]} ignorePrefix
@return {[type]}

[load description]

@method load
@depends [depends]
@param {[type]} dependancies
@param {Function} callback
@param {[type]} ignorePrefix
@return {[type]}

[get description]

@method get
@depends [depends]
@param {[type]} name
@return {[type]}

Meet Mr. Utils


Normalizes 'item' to an array if given a function , executes it and uses it's return value as item if given an object , returns an array containing the object

@method handle
@param {Mixed} item If given a string , retrieves the matching elements with I.select(),
@return {Array} or array-like object

Multi-functional random function

@method random
@param {Int} min Optional , the minimal number returned, defaults to 0
@param {Mixed} max The maximum number returned , if an array is given becomes the length of the array
@param {Int} exp Optional exponential , how many numbers behind the comma you want, defaults to 0
@example random ([min, ] max [, exp])
@return {Number}

Shuffles given array

@method shuffle
@param {Array} array
@return {Array}

Roll a s-sided dice n amount of times

@method dice
@param {Int} n
@param {Int} s
@return {Int}

Returns the index of neelde in target haystack , or -1 if not present

@method indexOf
@param {Object} haystack Wherever you are searching in
@param {Mixed} needle Whatever it is you are searching for
@return {[type]}

Checks if given needle is present in given haystack

@method inArray
@param {Mixed} needle Whatever it is you are searching for
@param {Object} haystack Either a normal object or an array
@return {Boolean}

Fuzzy search feature

@method fuzzy
@param {Mixed} needle Whatever it is you are searching for
@param {Object} haystack Wherever you are searching in
@param {String} flags Optional , the flags to pass to the regex, defaults to 'ig'
@return {Array} contains the elements found

Checks if the given argument is a valid JSON string

@method isJSON
@param {string} json
@return {Boolean} success

Converts degrees to radians

@method deg 2rad
@param {Number} degrees
@return {Number} radians

Converts radians to degrees

@method rad 2deg
@param {Number} radians
@return {Number} degrees

[stringifyObj description]

@method stringifyObj
@param {[type]} obj [description]
@param {[type]} includeProto [description]
@return {[type]} [description]

[capitalize description]

@method capitalize
@param {String} str
@return {String} STR

[capitalize description]

@method getAngleBetween
@param {x,y} a [description]
@param {x,y} b [description]
@return {Number} [description]

[getMouseCoords description]

@method getMouseCoords
@param HTMLObject element
@return Something

Meet Mr. Bind


Meet Mr. Element


Get / set an attribute of the given element.

@method attr
@depends this.handle
@param {Mixed} query Goes through this.handle ()
@param {String} property
@param {String} value Optional
@return {Mixed} If value is given , returns boolean succes. Otherwise returns value of specified property

[style description]

@method style
@param {[type]} element
@param {[type]} property
@param {[type]} value
@return {[type]}

[css description]

@method css
@depends this.style ()
@param {[type]} element
@param {[type]} css
@return {[type]}

Animation element style properties , uses CSS3 transition (with prefixes), if that's not supported, no animations for you!

@method animate
@depends this.style ()
@param {[type]} element
@param {Mixed} property The property to animate , can be an array(-like) object
@param {Mixed} value The value to set the property to
@param {Number} duration How long the animation should take in seconds , defaults to 1
@param {Number} delay How long to wait before the animation starts in seconds , defaults to 0
@param {String} easing What kind of easing should be used , defaults to ease-in-out
@param {Function} callback Optional callback function that will be executed when the animation completes
@return {[type]}

[data description]

@method data
@depends [depends]
@param {[type]} element
@param {[type]} property
@param {[type]} value
@return {[type]}

[html description]

@method html
@depends [depends]
@param {[type]} element
@param {[type]} value
@return {[type]}

[text description]

@method text
@depends [depends]
@param {[type]} element
@param {[type]} value
@return {[type]}

[value description]

@method value
@depends [depends]
@param {[type]} element
@param {[type]} value
@return {[type]}

[className description]

@method className
@depends [depends]
@param {[type]} element
@return {[type]}

[hasClass description]

@method hasClass
@depends [depends]
@param {[type]} element
@param {[type]} value
@return {Boolean}

[addClass description]

@method addClass
@depends [depends]
@param {[type]} element
@param {[type]} value

[removeClass description]

@method removeClass
@depends [depends]
@param {[type]} element
@param {[type]} value
@return {[type]}

[toggleClass description]

@method toggleClass
@depends [depends]
@param {[type]} element
@param {[type]} value
@return {[type]}

Facade for this.style (element, 'display', 'block')

@method show
@depends this.style ()
@param {Mixed} element The element to show
@return {Boolean} success

Facade for this.style (element, 'display', 'none')

@method hide
@depends this.style ()
@param {Mixed} element The element to hide
@return {Boolean} success

[slideDown description]

@method slideDown
@depends this.animate ()
@param {Mixed} element
@param {Number} duration How long the animation should take in seconds , defaults to 1
@param {Number} delay How long to wait before the animation starts in seconds , defaults to 0
@param {String} easing What kind of easing should be used , defaults to ease-in-out
@param {Function} callback Optional callback function that will be executed when the animation completes
@return {[type]}

[slideUp description]

@method slideUp
@depends this.animate ()
@param {Mixed} element
@param {Number} duration How long the animation should take in seconds , defaults to 1
@param {Number} delay How long to wait before the animation starts in seconds , defaults to 0
@param {String} easing What kind of easing should be used , defaults to ease-in-out
@param {Function} callback Optional callback function that will be executed when the animation completes
@return {Mixed}

Meet Mr. Html


[create description]

@method create
@depends [depends]
@param {[type]} tag
@param {[type]} options
@param {[type]} children
@param {[type]} appendTo
@return {[type]}

[remove description]

@method remove
@depends [depends]
@param {[type]} element
@return {[type]}

Meet Mr. Selector


TODO : Whatever the documentation below is telling you, it is lying. Returns all DOM elements matching the query inside the scope

@method select
@depends [depends]
@param {String]} query Represents the query
@param {Object} scope Optional DOM Element representing the scope , defaults to document
@return {Array} The DOM Elements matched

Meet Mr. Trigger


[trigger description]

@method trigger
@depends [depends]
@param {[type]} element
@param {[type]} type
@param {[type]} data
@return {[type]}