Advertisement
Adam_Martin

Untitled

Feb 16th, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var $_widgetName = 'input_control';
  2.  
  3. widgetControls[ $_widgetName ] =
  4. {
  5.     input_control__input :
  6.     {
  7.         events :
  8.         {
  9.             mouseover   : function()
  10.             {
  11.                 //this.widget.input_control__button.displayHalf();
  12.                 this.bricks('input_control__button').displayHalf();
  13.             },
  14.  
  15.             mouseout    : function()
  16.             {
  17.                 this.bricks('input_control__button').displayNone();
  18.             }
  19.         },
  20.  
  21.         actions :
  22.         {
  23.             __before    : function( obj )
  24.             {
  25.                 var self = $( this.template );
  26.  
  27.                 if ( obj instanceof Node ) {
  28.                     $.each(
  29.                         obj.attributes,
  30.                         function( index, attr )
  31.                         {
  32.                             if ( attr.name != "class" )
  33.                             {
  34.                                 self.attr( attr.name, attr.value );
  35.                             }
  36.                         }
  37.                     );
  38.                 } else {
  39.                     var params = this.widget.params;
  40.  
  41.                     for ( var param in params )
  42.                     {
  43.                         self.attr( param, params[ param ] );
  44.                     }
  45.                 }
  46.  
  47.  
  48.  
  49.             },
  50.  
  51.             clear       : function()
  52.             {
  53.                 this.template.removeAttr( 'disabled' )
  54.                     .val('')
  55.                     .focus();
  56.             }
  57.         }
  58.     },
  59.  
  60.     input_control__button :
  61.     {
  62.         events :
  63.         {
  64.             click       : function()
  65.             {
  66.                 this.bricks('input_control__input').clear()
  67.             },
  68.  
  69.             mouseover   : function()
  70.             {
  71.                 this.displayFull()
  72.             },
  73.  
  74.             mouseout    : function()
  75.             {
  76.                 this.displayNone()
  77.             }
  78.         },
  79.  
  80.         actions :
  81.         {
  82.             setPosition : function()
  83.             {
  84.                 var _input      = this.bricks('input_control__input').template;
  85.                 var _input_pos  = _input.position();
  86.  
  87.                 var _left = _input_pos.left + _input.width();
  88.                 var _top  = _input_pos.top  + _input.height();
  89.                 this.template.css( 'left', ( _left - 15 ) );
  90.                 this.template.css( 'top',  ( _top  - 12 ) );
  91.  
  92.                 this.template.css( 'visibility', 'visible' )
  93.             },
  94.  
  95.             displayFull : function()
  96.             {
  97.                 this.setPosition();
  98.                 this.template.css( 'opacity', '1' )
  99.             },
  100.  
  101.             displayHalf : function()
  102.             {
  103.                 this.setPosition();
  104.                 this.template.css( 'opacity', '0.5' )
  105.             },
  106.  
  107.             displayNone : function()
  108.             {
  109.                 this.template.css( 'opacity', '0' )
  110.                 this.template.css( 'visibility', 'hidden' )
  111.             }
  112.         }
  113.     }
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement