includes/clientside/static/messagebox.js
changeset 677 2a263b598a2b
parent 673 99c617146a34
child 694 43367c66d869
equal deleted inserted replaced
676:47413d71c2d9 677:2a263b598a2b
   323 function miniPrompt(call_on_create)
   323 function miniPrompt(call_on_create)
   324 {
   324 {
   325   if ( !aclDisableTransitionFX )
   325   if ( !aclDisableTransitionFX )
   326   {
   326   {
   327     load_component('flyin');
   327     load_component('flyin');
   328   }
   328     load_component('SpryEffects');
   329   if ( document.getElementById('specialLayer_darkener') )
   329   }
   330   {
   330   var darkener = darken(aclDisableTransitionFX, 40, 'miniprompt_darkener');
   331     if ( document.getElementById('specialLayer_darkener').style.display != 'none' )
       
   332     {
       
   333       var opac = parseFloat(document.getElementById('specialLayer_darkener').style.opacity);
       
   334       opac = opac * 100;
       
   335       darken(aclDisableTransitionFX, opac);
       
   336     }
       
   337     else
       
   338     {
       
   339       darken(aclDisableTransitionFX, 40);
       
   340     }
       
   341   }
       
   342   else
       
   343   {
       
   344     darken(aclDisableTransitionFX, 40);
       
   345   }
       
   346   
   331   
   347   var wrapper = document.createElement('div');
   332   var wrapper = document.createElement('div');
   348   wrapper.className = 'miniprompt';
   333   wrapper.className = 'miniprompt';
   349   var top = document.createElement('div');
   334   var top = document.createElement('div');
   350   top.className = 'mp-top';
   335   top.className = 'mp-top';
   379       {
   364       {
   380         domObjChangeOpac(100, wrapper);
   365         domObjChangeOpac(100, wrapper);
   381       }, 40);
   366       }, 40);
   382   }
   367   }
   383   
   368   
       
   369   // set the darkener's onclick to refocus/shake the miniprompt
       
   370   darkener.miniprompt = wrapper;
       
   371   darkener.onclick = function()
       
   372   {
       
   373     if ( !aclDisableTransitionFX )
       
   374     {
       
   375       // for some reason, spry's pulsate effects takes duration in ms instead of seconds.
       
   376       (new Spry.Effect.Pulsate(this.miniprompt, { duration: 500, from: '100%', to: '70%' })).start();
       
   377     }
       
   378   }
       
   379   
   384   return wrapper;
   380   return wrapper;
   385 }
   381 }
   386 
   382 
   387 /**
   383 /**
   388  * For a given element, loops through the element and all of its ancestors looking for a miniPrompt div, and returns it. Returns false on failure.
   384  * For a given element, loops through the element and all of its ancestors looking for a miniPrompt div, and returns it. Returns false on failure.
   409 
   405 
   410 /**
   406 /**
   411  * Destroys the first miniPrompt div encountered by recursively checking all parent nodes.
   407  * Destroys the first miniPrompt div encountered by recursively checking all parent nodes.
   412  * Usage: <a href="javascript:miniPromptDestroy(this);">click</a>
   408  * Usage: <a href="javascript:miniPromptDestroy(this);">click</a>
   413  * @param object:HTMLElement a child of the div.miniprompt
   409  * @param object:HTMLElement a child of the div.miniprompt
   414  * @param bool If true, does not call enlighten().
   410  * @param bool (DEPRECATED) If true, does not call enlighten().
   415  */
   411  */
   416 
   412 
   417 function miniPromptDestroy(obj, nofade)
   413 function miniPromptDestroy(obj, nofade)
   418 {
   414 {
   419   obj = miniPromptGetParent(obj);
   415   obj = miniPromptGetParent(obj);
   420   if ( !obj )
   416   if ( !obj )
   421     return false;
   417     return false;
   422   
   418   
   423   // found it
   419   // found it
   424   var parent = obj.parentNode;
   420   var parent = obj.parentNode;
   425   if ( !nofade )
   421   // if ( !nofade )
   426     enlighten(aclDisableTransitionFX);
   422   //   enlighten(aclDisableTransitionFX);
       
   423   enlighten(aclDisableTransitionFX, 'miniprompt_darkener');
   427   if ( aclDisableTransitionFX )
   424   if ( aclDisableTransitionFX )
   428   {
   425   {
   429     parent.removeChild(obj);
   426     parent.removeChild(obj);
   430   }
   427   }
   431   else
   428   else
   550           }
   547           }
   551           parent.appendChild(button.input);
   548           parent.appendChild(button.input);
   552         }
   549         }
   553         if ( parms.buttons[0] )
   550         if ( parms.buttons[0] )
   554         {
   551         {
       
   552           var timeout = ( aclDisableTransitionFX ) ? 10 : 1000;
   555           setTimeout(function()
   553           setTimeout(function()
   556             {
   554             {
   557               parms.buttons[0].input.focus();
   555               parms.buttons[0].input.focus();
   558             }, 1000);
   556             }, timeout);
   559         }
   557         }
   560       }
   558       }
   561       catch ( e )
   559       catch ( e )
   562       {
   560       {
   563         console.error(e);
   561         console.error(e);
   575         text: 'Abort',
   573         text: 'Abort',
   576         color: 'red',
   574         color: 'red',
   577         style: {
   575         style: {
   578           fontWeight: 'bold'
   576           fontWeight: 'bold'
   579         },
   577         },
       
   578         image: cdnPath + '/images/icons/abort.png',
   580         onclick: function() {
   579         onclick: function() {
   581           miniPromptDestroy(this);
   580           miniPromptDestroy(this);
   582         }
   581         }
   583       },
   582       },
   584       {
   583       {
   585         text: 'Retry',
   584         text: 'Retry',
   586         color: 'blue',
   585         color: 'blue',
       
   586         image: cdnPath + '/images/icons/retry.png',
   587         onclick: function() {
   587         onclick: function() {
   588           miniPromptDestroy(this);
   588           miniPromptDestroy(this);
   589         }
   589         }
   590       },
   590       },
   591       {
   591       {
   592         text: 'Ignore',
   592         text: 'Ignore',
   593         color: 'green',
   593         color: 'green',
       
   594         image: cdnPath + '/images/icons/ignore.png',
   594         onclick: function() {
   595         onclick: function() {
   595           miniPromptDestroy(this);
   596           miniPromptDestroy(this);
   596         }
   597         }
   597       }
   598       }
   598     ]
   599     ]