includes/clientside/static/faders.js
changeset 550 685e839d934e
parent 542 5841df0ab575
child 555 ac4c6a7f01d8
equal deleted inserted replaced
549:6894cfd94dfb 550:685e839d934e
   119  *             NOTE: key names are to be strings, and they must be the value of the input, CaSe-SeNsItIvE
   119  *             NOTE: key names are to be strings, and they must be the value of the input, CaSe-SeNsItIvE
   120  *   onbeforeclick - same as onclick but called before the messagebox div is destroyed
   120  *   onbeforeclick - same as onclick but called before the messagebox div is destroyed
   121  * Methods:
   121  * Methods:
   122  *   destroy: kills the running message box
   122  *   destroy: kills the running message box
   123  * Example:
   123  * Example:
   124  *   var my_message = new messagebox(MB_OK|MB_ICONSTOP, 'Error logging in', 'The username and/or password is incorrect. Please check the username and retype your password');
   124  *   var my_message = new MessageBox(MB_OK|MB_ICONSTOP, 'Error logging in', 'The username and/or password is incorrect. Please check the username and retype your password');
   125  *   my_message.onclick['OK'] = function() {
   125  *   my_message.onclick['OK'] = function() {
   126  *       document.getElementById('password').value = '';
   126  *       document.getElementById('password').value = '';
   127  *     };
   127  *     };
   128  * Deps:
   128  * Deps:
   129  *   Modern browser that supports DOM
   129  *   Modern browser that supports DOM
   133  */
   133  */
   134 
   134 
   135 var mb_current_obj;
   135 var mb_current_obj;
   136 var mb_previously_had_darkener = false;
   136 var mb_previously_had_darkener = false;
   137 
   137 
   138 function messagebox(type, title, message)
   138 function MessageBox(type, title, message)
   139 {
   139 {
   140   var y = getScrollOffset();
   140   var y = getScrollOffset();
   141   
   141   
   142   // Prevent multiple instances
   142   // Prevent multiple instances
   143   if ( document.getElementById('messageBox') )
   143   if ( document.getElementById('messageBox') )
   358   this.onclick = new Array();
   358   this.onclick = new Array();
   359   this.onbeforeclick = new Array();
   359   this.onbeforeclick = new Array();
   360   mb_current_obj = this;
   360   mb_current_obj = this;
   361 }
   361 }
   362 
   362 
       
   363 var messagebox = MessageBox;
       
   364 
   363 function mb_runFlyIn()
   365 function mb_runFlyIn()
   364 {
   366 {
   365   var mydiv = document.getElementById('messageBox');
   367   var mydiv = document.getElementById('messageBox');
   366   var maindiv = mydiv.parentNode;
   368   var maindiv = mydiv.parentNode;
   367   fly_in_top(maindiv, true, false);
   369   fly_in_top(maindiv, true, false);
   403   }
   405   }
   404 }
   406 }
   405 
   407 
   406 function testMessageBox()
   408 function testMessageBox()
   407 {
   409 {
   408   mb = new messagebox(MB_OKCANCEL|MB_ICONINFORMATION, 'Javascripted dynamic message boxes', 'This is soooooo coool, now if only document.createElement() worked in IE!<br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text');
   410   mb = new MessageBox(MB_OKCANCEL|MB_ICONINFORMATION, 'Javascripted dynamic message boxes', 'This is soooooo coool, now if only document.createElement() worked in IE!<br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text');
   409   mb.onclick['OK'] = function()
   411   mb.onclick['OK'] = function()
   410     {
   412     {
   411       alert('You clicked OK!');
   413       alert('You clicked OK!');
   412     }
   414     }
   413   mb.onbeforeclick['Cancel'] = function()
   415   mb.onbeforeclick['Cancel'] = function()
   760     object.filter = "alpha(opacity=" + opacity + ")";
   762     object.filter = "alpha(opacity=" + opacity + ")";
   761 }
   763 }
   762 
   764 
   763 function mb_logout()
   765 function mb_logout()
   764 {
   766 {
   765   var mb = new messagebox(MB_YESNO|MB_ICONQUESTION, $lang.get('user_logout_confirm_title'), $lang.get('user_logout_confirm_body'));
   767   var mb = new MessageBox(MB_YESNO|MB_ICONQUESTION, $lang.get('user_logout_confirm_title'), $lang.get('user_logout_confirm_body'));
   766   mb.onclick['Yes'] = function()
   768   mb.onclick['Yes'] = function()
   767     {
   769     {
   768       window.location = makeUrlNS('Special', 'Logout/' + title);
   770       window.location = makeUrlNS('Special', 'Logout/' + title);
   769     }
   771     }
   770 }
   772 }