- Ecriture du LSsession
[ldapsaisie.git] / trunk / includes / js / LSdefault.js
1 var LSdefault = new Class({
2     initialize: function(){
3                         LSdebug('toto');
4                         this.LSdebug = $('LSdebug');
5                         this.LSdebugInfos = $('LSdebug_infos');
6                         this.LSdebug.setOpacity(0);
7                         if (this.LSdebugInfos.innerHTML != '') {
8                                 this.displayDebugBox();
9                         }
10
11                         this.LSdebugHidden = $('LSdebug_hidden');
12                         this.LSdebugHidden.addEvent('click',this.onLSdebugHiddenClick.bind(this));
13                         this.LSerror = $('LSerror');
14                         this.LSerror.setOpacity(0);
15                         if (this.LSerror.innerHTML != '') {
16                                 this.displayLSerror();
17                         }
18     },
19
20                 onLSdebugHiddenClick: function(){
21                         new Fx.Style(this.LSdebug,'opacity',{duration:500}).start(1,0);
22                 },
23
24                 displayDebugBox: function() {
25                         new Fx.Style(this.LSdebug,'opacity',{duration:500}).start(0,0.8);
26                 },
27
28                 displayError: function(html) {
29                         this.LSerror.empty();
30                         this.LSerror.setHTML(html);
31                         this.displayLSerror();
32                 },
33
34                 displayLSerror: function() {
35                         new Fx.Style(this.LSerror,'opacity',{duration:500}).start(0,0.8);
36                         (function(){new Fx.Style(this.LSerror,'opacity',{duration:500}).start(0.8,0);}).delay(5000, this);
37                 },
38
39                 loadingImgDisplay: function(el) {
40                         this.loading_img = new Element('img');
41                         this.loading_img.src='templates/images/ajax-loader.gif';
42                         this.loading_img.injectAfter(el);
43                 },
44
45                 loadingImgHide: function() {
46                         this.loading_img.remove();
47                 }
48
49 });
50 window.addEvent(window.ie ? 'load' : 'domready', function() {
51         varLSdefault = new LSdefault();
52 });
53
54 LSdebug_active = 1;
55
56 function LSdebug() {
57     if (LSdebug_active != 1) return;
58     if (typeof console == 'undefined') return;
59     console.log.apply(this, arguments);
60 }