includes/clientside/static/functions.js
changeset 677 2a263b598a2b
parent 672 08a7875258b4
child 679 80bf9b8fe6aa
equal deleted inserted replaced
676:47413d71c2d9 677:2a263b598a2b
   157   load_component('SpryEffects');
   157   load_component('SpryEffects');
   158   load_component('fadefilter');
   158   load_component('fadefilter');
   159   load_component('flyin');
   159   load_component('flyin');
   160   load_component('l10n');
   160   load_component('l10n');
   161   
   161   
   162   darken();
   162   darken(aclDisableTransitionFX);
   163   
   163   
   164   var box = document.createElement('div');
   164   var box = document.createElement('div');
   165   var mainwin = document.createElement('div');
   165   var mainwin = document.createElement('div');
   166   var panel = document.createElement('div');
   166   var panel = document.createElement('div');
   167   
   167   
   286     closer.type = 'button';
   286     closer.type = 'button';
   287     closer.value = btn_close;
   287     closer.value = btn_close;
   288     closer.onclick = function()
   288     closer.onclick = function()
   289     {
   289     {
   290       var parentdiv = this.parentNode.parentNode;
   290       var parentdiv = this.parentNode.parentNode;
   291       var effect = new Spry.Effect.Blind(parentdiv, {
   291       if ( aclDisableTransitionFX )
   292           from: '100%',
   292       {
   293           to: '0%',
   293         parentdiv.parentNode.removeChild(parentdiv);
   294           duration: '1000'
   294         enlighten(aclDisableTransitionFX);
   295         });
   295       }
   296       var observer = {
   296       else
   297         onPostEffect: function()
   297       {
   298           {
   298         var effect = new Spry.Effect.Blind(parentdiv, {
   299             parentdiv.parentNode.removeChild(parentdiv);
   299             from: '100%',
   300             enlighten();
   300             to: '0%',
   301           }
   301             duration: '1000'
   302         };
   302           });
   303       effect.addObserver(observer);
   303         var observer = {
   304       effect.start();
   304           onPostEffect: function()
       
   305             {
       
   306               parentdiv.parentNode.removeChild(parentdiv);
       
   307               enlighten();
       
   308             }
       
   309           };
       
   310         effect.addObserver(observer);
       
   311         effect.start();
       
   312       }
   305     }
   313     }
   306     panel.appendChild(closer);
   314     panel.appendChild(closer);
   307     
   315     
   308   //
   316   //
   309   // put it together
   317   // put it together
   314     
   322     
   315     // add it to the body to allow height/width calculation
   323     // add it to the body to allow height/width calculation
   316     
   324     
   317     box.style.display = 'block';
   325     box.style.display = 'block';
   318     box.style.position = 'absolute';
   326     box.style.position = 'absolute';
       
   327     box.style.zIndex = getHighestZ() + 1;
   319     domObjChangeOpac(0, box);
   328     domObjChangeOpac(0, box);
   320     
   329     
   321     var body = document.getElementsByTagName('body')[0];
   330     var body = document.getElementsByTagName('body')[0];
   322     body.appendChild(box);
   331     body.appendChild(box);
   323     
   332     
   329     console.debug('top = %d, left = %d', top, left);
   338     console.debug('top = %d, left = %d', top, left);
   330     box.style.top = top + 'px';
   339     box.style.top = top + 'px';
   331     box.style.left = left + 'px';
   340     box.style.left = left + 'px';
   332     
   341     
   333     // we have width and height, set display to none and reset opacity
   342     // we have width and height, set display to none and reset opacity
   334     box.style.display = 'none';
   343     if ( aclDisableTransitionFX )
   335     domObjChangeOpac(100, box);
   344     {
   336     
   345       domObjChangeOpac(100, box);
   337     setTimeout(function()
   346       box.style.display = 'block';
   338       {
   347     }
   339         (new Spry.Effect.Blind(box, {
   348     else
   340             from: '0%',
   349     {
   341             to: '100%',
   350       box.style.display = 'none';
   342             duration: 1000
   351       domObjChangeOpac(100, box);
   343           })).start();
   352       
   344       }, 1000);
   353       setTimeout(function()
       
   354         {
       
   355           (new Spry.Effect.Blind(box, {
       
   356               from: '0%',
       
   357               to: '100%',
       
   358               duration: 1000
       
   359             })).start();
       
   360         }, 1000);
       
   361     }
   345 }
   362 }
   346 
   363 
   347 /**
   364 /**
   348  * Verify that a string is roughly a valid JSON object. Warning - this is only a very cheap syntax check.
   365  * Verify that a string is roughly a valid JSON object. Warning - this is only a very cheap syntax check.
   349  * @param string
   366  * @param string
   719   var divs = document.getElementsByTagName('div');
   736   var divs = document.getElementsByTagName('div');
   720   for(var i = 0; i < divs.length; i++)
   737   for(var i = 0; i < divs.length; i++)
   721   {
   738   {
   722     if(divs[i].style.zIndex > z) z = divs[i].style.zIndex;
   739     if(divs[i].style.zIndex > z) z = divs[i].style.zIndex;
   723   }
   740   }
   724   return z;
   741   return parseInt(z);
   725 }
   742 }
   726 
   743 
   727 var shift = false;
   744 var shift = false;
   728 function isKeyPressed(event)
   745 function isKeyPressed(event)
   729 {
   746 {