includes/clientside/static/functions.js
changeset 691 dab7850c098d
parent 679 80bf9b8fe6aa
child 699 c7d737202d59
equal deleted inserted replaced
690:aeac05b5b7ca 691:dab7850c098d
   581   var left = $(el).Left();
   581   var left = $(el).Left();
   582   var width = $(el).Width();
   582   var width = $(el).Width();
   583   var height = $(el).Height();
   583   var height = $(el).Height();
   584   
   584   
   585   var blackout = document.createElement('div');
   585   var blackout = document.createElement('div');
   586   blackout.style.position = 'absolute';
   586   // using fixed here allows modal windows to be blacked out
       
   587   blackout.style.position = ( el.style.position == 'fixed' ) ? 'fixed' : 'absolute';
   587   blackout.style.top = top + 'px';
   588   blackout.style.top = top + 'px';
   588   blackout.style.left = left + 'px';
   589   blackout.style.left = left + 'px';
   589   blackout.style.width = width + 'px';
   590   blackout.style.width = width + 'px';
   590   blackout.style.height = height + 'px';
   591   blackout.style.height = height + 'px';
   591   
   592   
   626   }
   627   }
   627   setTimeout(function()
   628   setTimeout(function()
   628     {
   629     {
   629       whitey.parentNode.removeChild(whitey);
   630       whitey.parentNode.removeChild(whitey);
   630     }, 1250);
   631     }, 1250);
       
   632 }
       
   633 
       
   634 /**
       
   635  * Whites out a form and disables all buttons under it. Useful for onsubmit functions.
       
   636  * @example
       
   637  <code>
       
   638  <form action="foo" onsubmit="whiteOutForm(this);">
       
   639  </code>
       
   640  * @param object Form object
       
   641  * @return object Whiteout div
       
   642  */
       
   643 
       
   644 function whiteOutForm(form)
       
   645 {
       
   646   if ( !form.getElementsByTagName )
       
   647     return false;
       
   648   
       
   649   // disable all buttons
       
   650   var buttons = form.getElementsByTagName('input');
       
   651   for ( var i = 0; i < buttons.length; i++ )
       
   652   {
       
   653     if ( buttons[i].type == 'button' || buttons[i].type == 'submit' || buttons[i].type == 'image' )
       
   654     {
       
   655       buttons[i].disabled = 'disabled';
       
   656       // ... but also make a hidden element to preserve any flags
       
   657       var clone = buttons[i].cloneNode(true);
       
   658       clone.type = 'hidden';
       
   659       clone.disabled = false;
       
   660       console.debug(clone);
       
   661       form.appendChild(clone);
       
   662     }
       
   663   }
       
   664   var buttons = form.getElementsByTagName('button');
       
   665   for ( var i = 0; i < buttons.length; i++ )
       
   666   {
       
   667     buttons[i].disabled = 'disabled';
       
   668     // ... but also make a hidden element to preserve any flags
       
   669     if ( buttons[i].name )
       
   670     {
       
   671       var clone = document.createElement('input');
       
   672       clone.type = 'hidden';
       
   673       clone.name = buttons[i].name;
       
   674       clone.value = ( buttons[i].value ) ? buttons[i].value : '';
       
   675       form.appendChild(clone);
       
   676     }
       
   677   }
       
   678   
       
   679   return whiteOutElement(form);
   631 }
   680 }
   632 
   681 
   633 // other DHTML functions
   682 // other DHTML functions
   634 
   683 
   635 function fetch_offset(obj)
   684 function fetch_offset(obj)