( ! ) Warning: session_start(): open(/tmp/sess_b3306378e2219adc3cbb4786fbe31e59, O_RDWR) failed: Disk quota exceeded (122) in /www/noahlabs/jwee/init.php on line 7
Call Stack
#TimeMemoryFunctionLocation
10.0010383960{main}( ).../index.php:0
20.0016397232include( '/www/noahlabs/jwee/init.php' ).../index.php:3
30.0016397232session_start ( ).../init.php:7
Variables in local scope (#2)
$Browser =
/www/noahlabs/jwee/init.php:7:*uninitialized*
$Session =
/www/noahlabs/jwee/init.php:7:*uninitialized*

( ! ) Warning: session_start(): Failed to read session data: files (path: /tmp) in /www/noahlabs/jwee/init.php on line 7
Call Stack
#TimeMemoryFunctionLocation
10.0010383960{main}( ).../index.php:0
20.0016397232include( '/www/noahlabs/jwee/init.php' ).../index.php:3
30.0016397232session_start ( ).../init.php:7
Variables in local scope (#2)
$Browser =
/www/noahlabs/jwee/init.php:7:*uninitialized*
$Session =
/www/noahlabs/jwee/init.php:7:*uninitialized*
Misc Coding Examples - Noah Ellman - Javascript Toolkit
mrspoonzy at gmail Cube by Noah Ellman A powerful javascript toolkit, in research © by Noah Ellman

Misc Coding Examples

Here are various coding examples of how to acheive some common and perhaps not common tasks. Hopefully these examples will help you become familiar with jWarp's style of coding.




Example of using Jwee's special Function methods.

Say you have an HTML element with id='mydiv'.

wee.fx.shake.passing('#mydiv').later(1000);

Easily permanently pass a value to a function, such as shake(), using passing(..). Since passing is also a function, you can then call the later(xx) method to cause the function execute after a certain millasecond delay. COOL!




How would you hide all the images inside an element called #myGallery ?

$( Dom.select('#myGallery img') ).each( ".hide()" );

  1. Dom.select retreives the array of images
  2. $ ensures that all the img elements in the array are "extended"
  3. The each function is a special function that arrays have.
  4. each normally takes a function, but it can also take a string like the example above. If this string represents a function call, then each will execute this function on all elements in the array.


How would I code the icon rollover animations like the tabs have on the top of this site. ?

Event.onReady(function() {
	Dom.select('#navlinks a').each( function(item) {
			var img = item.query('img')[0];
			item.onmouseover = function() { 
				img.animate('top',null,-25,0.3,{ease:'easeOut'});
			};
			item.onmouseout = function() {
				img.animate('top',null,-10,0.4,{ease:'easeOutBounce'});			
			}											  
	})

});


The fun code below selects more or less all the html elements on the page with Dom.select, then iterates through them with .each via the function passed to .each. The each callback takes the elements one by one, calls the .animate magic method and fades the alpha or opacity of the element to 0, hiding it. The addition of .callLater, which is a magic method extented on all functions, automatically delays the execution of the .animate by a specificied number of millasecond, which in the case below is index*100.


Dom.select('a, span, p, b, i, em, strong, li, div.box div.box, code, pre, div.box, div, h1, h2, h3, h4').each( 

	function(ele,index) { 
		ele.tween.callLater(index*500,ele,'alpha',0); 
	}

)

Discussion on /coding-examples-misc