Section 11.7. Utility Methods


11.7. Utility Methods

script.aculo.us defines a handful of other methods that don't fit in the main categories.


Scriptaculous.Version

Defined in scriptaculous.js, which is not included by default in the Rails distribution. A string containing the current version of script.aculo.us.

Scriptaculous.Version // => '1.6.1'


Scriptaculous.require( libraryName )

Defined in scriptaculous.js, which is not included by default in the Rails distribution. Takes a URL to a JavaScript file and appends a <SCRIPT> tag to the current document, thereby loading the file.

Scriptaculous.require('/javascripts/custom_effects.js')


Scriptaculous.load( )

Defined in scriptaculous.js, which is not included by default in the Rails distribution. Requires each of the standard files in the script.aculo.us distribution: builder.js, effects.js, dragdrop.js, controls.js, and slider.js.

Scriptaculous.load(  )


String.prototype.parseColor

Defined in effects.js. Converts a string from rgb( x , x , x ) or # xxx format to # xxxxxx format.

"rgb(255,255,255)".parseColor(  ) #=> '#ffffff' "#123".parseColor(  ) #=> '#112233'


Array.prototype.call( arg1[, arg2 ...] )

Defined in effects.js. Expects each element of the array to be a function. Calls each function once and passes the arguments through.

var functions = [ function(v){ alert('hello, ' + v);},                   function(v){ alert('hi, ' + v);} ]; functions.call('scott');




Ajax on Rails
Ajax on Rails
ISBN: 0596527446
EAN: 2147483647
Year: 2006
Pages: 103
Authors: Scott Raymond

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net