public/javascripts/inputex/build/inputex.js
function() {
	   
	   var grid, eventDelegation, square, i;
	   
	   // remember squares
	   this.squares = [];
	
	   // container
	   grid = inputEx.cn('div', {className: 'inputEx-ColorField-Grid'});
	   
	   // Is event delegation available ?
	   // (YAHOO.util.Event.delegate method is in "event-delegate" YUI-module)
	   eventDelegation = !lang.isUndefined(Event.delegate);
	   
	   for(i = 0 ; i < this.length ; i++) {
	      
	      //var square = inputEx.cn('div', {className: 'inputEx-ColorField-square'},{backgroundColor: this.colors[i], width:this.cellWidth+"px", height:this.cellHeight+"px", margin:this.cellMargin+"px" });
	      square = inputEx.cn('div', {className: 'inputEx-ColorField-square'},{backgroundColor: this.colors[i] });
	   	grid.appendChild(square);
			
	   	this.squares.push(square);
	   	
	   	// No event delegation available : add a listener on each square
	   	if (!eventDelegation) {
	   	  Event.addListener(square, "mousedown", function(e) {
	   	     var el = Event.getTarget(e);
	   	     this.onColorClick(e,el,grid);
	   	  }, this, true );
   	   }
	   	
	   	// <br clear='both'/> insertion to end a line
	   	// ( + always after the last colored square)
	   	if (i%this.cellPerLine === this.cellPerLine-1 || i === this.length-1) {
            grid.appendChild(inputEx.cn('br',{clear:'both'}));
         }
      }
      
      // Mousedown event delegation
      if (eventDelegation) {
         
         if (!lang.isUndefined(YAHOO.util.Selector)) {
            
            Event.delegate(grid,"mousedown",this.onColorClick,"div.inputEx-ColorField-square",this,true);
            
         } else {
            
            Event.delegate(grid,"mousedown",this.onColorClick,function(el) {
               if (el.nodeName === "DIV" && YAHOO.util.Dom.hasClass(el,'inputEx-ColorField-square')) {
                  return el;
               }
            },this,true);
            
         }
      }
      
	   return grid;
	}
function() {
	   
	   var grid, eventDelegation, square, i;
	   
	   // remember squares
	   this.squares = [];
	
	   // container
	   grid = inputEx.cn('div', {className: 'inputEx-ColorField-Grid'});
	   
	   // Is event delegation available ?
	   // (YAHOO.util.Event.delegate method is in "event-delegate" YUI-module)
	   eventDelegation = !lang.isUndefined(Event.delegate);
	   
	   for(i = 0 ; i < this.length ; i++) {
	      
	      //var square = inputEx.cn('div', {className: 'inputEx-ColorField-square'},{backgroundColor: this.colors[i], width:this.cellWidth+"px", height:this.cellHeight+"px", margin:this.cellMargin+"px" });
	      square = inputEx.cn('div', {className: 'inputEx-ColorField-square'},{backgroundColor: this.colors[i] });
	   	grid.appendChild(square);
			
	   	this.squares.push(square);
	   	
	   	// No event delegation available : add a listener on each square
	   	if (!eventDelegation) {
	   	  Event.addListener(square, "mousedown", function(e) {
	   	     var el = Event.getTarget(e);
	   	     this.onColorClick(e,el,grid);
	   	  }, this, true );
   	   }
	   	
	   	// <br clear='both'/> insertion to end a line
	   	// ( + always after the last colored square)
	   	if (i%this.cellPerLine === this.cellPerLine-1 || i === this.length-1) {
            grid.appendChild(inputEx.cn('br',{clear:'both'}));
         }
      }
      
      // Mousedown event delegation
      if (eventDelegation) {
         
         if (!lang.isUndefined(YAHOO.util.Selector)) {
            
            Event.delegate(grid,"mousedown",this.onColorClick,"div.inputEx-ColorField-square",this,true);
            
         } else {
            
            Event.delegate(grid,"mousedown",this.onColorClick,function(el) {
               if (el.nodeName === "DIV" && YAHOO.util.Dom.hasClass(el,'inputEx-ColorField-square')) {
                  return el;
               }
            },this,true);
            
         }
      }
      
	   return grid;
	}
function ( ) { var grid , eventDelegation , square , i ; // remember squares this . squares = [ ] ; // container grid = inputEx . cn ( 'div' , { className : 'inputEx-ColorField-Grid' } ) ; // Is event delegation available ? // (YAHOO.util.Event.delegate method is in "event-delegate" YUI-module) eventDelegation = ! lang . isUndefined ( Event . delegate ) ; for ( i = 0 ; i < this . length ; i ++ ) { //var square = inputEx.cn('div', {className: 'inputEx-ColorField-square'},{backgroundColor: this.colors[i], width:this.cellWidth+"px", height:this.cellHeight+"px", margin:this.cellMargin+"px" }); square = inputEx . cn ( 'div' , { className : 'inputEx-ColorField-square' } , { backgroundColor : this . colors [ i ] } ) ; grid . appendChild ( square ) ; this . squares . push ( square ) ; // No event delegation available : add a listener on each square if ( ! eventDelegation ) { Event . addListener ( square , "mousedown" , function ( e ) { var el = Event . getTarget ( e ) ; this . onColorClick ( e , el , grid ) ; } , this , true ) ; } // <br clear='both'/> insertion to end a line // ( + always after the last colored square) if ( i % this . cellPerLine === this . cellPerLine - 1 || i === this . length - 1 ) { grid . appendChild ( inputEx . cn ( 'br' , { clear : 'both' } ) ) ; } } // Mousedown event delegation if ( eventDelegation ) { if ( ! lang . isUndefined ( YAHOO . util . Selector ) ) { Event . delegate ( grid , "mousedown" , this . onColorClick , "div.inputEx-ColorField-square" , this , true ) ; } else { Event . delegate ( grid , "mousedown" , this . onColorClick , function ( el ) { if ( el . nodeName === "DIV" && YAHOO . util . Dom . hasClass ( el , 'inputEx-ColorField-square' ) ) { return el ; } } , this , true ) ; } } return grid ; }
This creates a color grid
This creates a color grid