Changeset 2568


Ignore:
Timestamp:
04/16/10 15:26:03 (14 years ago)
Author:
amuller
Message:

Ticket #1036 - Colocando semicolons nos finais das atribuições

Location:
trunk/phpgwapi/templates/default/js/jscode
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpgwapi/templates/default/js/jscode

    • Property svn:ignore set to
      *.jspack.js
  • trunk/phpgwapi/templates/default/js/jscode/slidereffects.js

    r2565 r2568  
    1111 *****************************************************/ 
    1212 
    13 ypSlideOutMenu.Registry = [] 
    14 ypSlideOutMenu.aniLen = 250 
    15 ypSlideOutMenu.hideDelay = 1000 
    16 ypSlideOutMenu.minCPUResolution = 10 
     13ypSlideOutMenu.Registry = []; 
     14ypSlideOutMenu.aniLen = 250; 
     15ypSlideOutMenu.hideDelay = 1000; 
     16ypSlideOutMenu.minCPUResolution = 10; 
    1717 
    1818// constructor 
    1919function ypSlideOutMenu(id, dir, left, top, width, height,pos) 
    2020{ 
    21         this.ie  = document.all ? 1 : 0 
    22                 this.ns4 = document.layers ? 1 : 0 
    23                 this.dom = document.getElementById ? 1 : 0 
     21        this.ie  = document.all ? 1 : 0; 
     22                this.ns4 = document.layers ? 1 : 0; 
     23                this.dom = document.getElementById ? 1 : 0; 
    2424 
    2525                if (this.ie || this.ns4 || this.dom) { 
    26                         this.id                  = id 
    27                                 this.dir                 = dir 
    28                                 this.orientation = dir == "left" || dir == "right" ? "h" : "v" 
    29                                 this.dirType     = dir == "right" || dir == "down" ? "-" : "+" 
    30                                 this.dim                 = this.orientation == "h" ? width : height 
    31                                 this.hideTimer   = false 
    32                                 this.aniTimer    = false 
    33                                 this.open                = false 
    34                                 this.over                = false 
    35                                 this.startTime   = 0 
     26                        this.id  = id; 
     27                                this.dir                 = dir; 
     28                                this.orientation = dir == "left" || dir == "right" ? "h" : "v"; 
     29                                this.dirType     = dir == "right" || dir == "down" ? "-" : "+"; 
     30                                this.dim                 = this.orientation == "h" ? width : height; 
     31                                this.hideTimer   = false; 
     32                                this.aniTimer    = false; 
     33                                this.open                = false; 
     34                                this.over                = false; 
     35                                this.startTime   = 0; 
    3636 
    3737                                // global reference to this object 
    38                                 this.gRef = "ypSlideOutMenu_"+id 
    39                                 eval(this.gRef+"=this") 
     38                                this.gRef = "ypSlideOutMenu_"+id; 
     39                                eval(this.gRef+"=this"); 
    4040 
    4141                                // add this menu object to an internal list of all menus 
    42                                 ypSlideOutMenu.Registry[id] = this 
    43  
    44                                 var d = document 
     42                                ypSlideOutMenu.Registry[id] = this; 
     43 
     44                                var d = document; 
    4545 
    4646                                var strCSS = '<style type="text/css">'; 
    47                         strCSS += '#' + this.id + 'Container { visibility:hidden; ' 
     47                        strCSS += '#' + this.id + 'Container { visibility:hidden; '; 
    4848                                if(pos) 
    4949                                { 
    50                                         strCSS += pos+':' + left + 'px; ' 
     50                                        strCSS += pos+':' + left + 'px; '; 
    5151                                } 
    5252                                else 
    5353                                { 
    54                                         strCSS += 'left:' + left + 'px; ' 
     54                                        strCSS += 'left:' + left + 'px; '; 
    5555                                } 
    56                                 strCSS += 'top:' + top + 'px; ' 
    57                                         strCSS += 'overflow:visible; z-index:10000; }' 
    58                                         strCSS += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; ' 
    59                                                 strCSS += 'width:' + width + 'px; ' 
    60                                                         //              strCSS += 'height:' + height + 'px; ' 
    61                                                         //              strCSS += 'clip:rect(0 ' + width + ' ' + height + ' 0); ' 
    62                                                         strCSS += '}' 
     56                                strCSS += 'top:' + top + 'px; '; 
     57                                        strCSS += 'overflow:visible; z-index:10000; }'; 
     58                                        strCSS += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; '; 
     59                                                strCSS += 'width:' + width + 'px; '; 
     60                                                        //              strCSS += 'height:' + height + 'px; '; 
     61                                                        //              strCSS += 'clip:rect(0 ' + width + ' ' + height + ' 0); '; 
     62                                                        strCSS += '}'; 
    6363                                                        strCSS += '</style>'; 
    6464 
    65                                                 d.write(strCSS) 
    66  
    67                                                         this.load() 
     65                                                d.write(strCSS); 
     66 
     67                                                        this.load(); 
    6868                                        } 
    6969                } 
    7070 
    7171        ypSlideOutMenu.prototype.load = function() { 
    72                 var d = document 
    73                         var lyrId1 = this.id + "Container" 
    74                         var lyrId2 = this.id + "Content" 
    75                         var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? d.all[lyrId1] : d.layers[lyrId1] 
    76                         if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? d.all[lyrId2] : d.getElementById(lyrId2) 
    77                                 var temp 
    78  
    79                                         if (!obj1 || !obj2) window.setTimeout(this.gRef + ".load()", 100) 
     72                var d = document; 
     73                        var lyrId1 = this.id + "Container"; 
     74                        var lyrId2 = this.id + "Content"; 
     75                        var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? d.all[lyrId1] : d.layers[lyrId1]; 
     76                        if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? d.all[lyrId2] : d.getElementById(lyrId2); 
     77                                var temp; 
     78 
     79                                        if (!obj1 || !obj2) 
     80                                                window.setTimeout(this.gRef + ".load()", 100); 
    8081                                        else { 
    81                                                 this.container  = obj1 
    82                                                         this.menu               = obj2 
    83                                                         this.style              = this.ns4 ? this.menu : this.menu.style 
    84                                                         this.homePos    = eval("0" + this.dirType + this.dim) 
    85                                                         this.outPos             = 0 
    86                                                         this.accelConst = (this.outPos - this.homePos) / ypSlideOutMenu.aniLen / ypSlideOutMenu.aniLen  
     82                                                this.container  = obj1; 
     83                                                        this.menu               = obj2; 
     84                                                        this.style              = this.ns4 ? this.menu : this.menu.style; 
     85                                                        this.homePos    = eval("0" + this.dirType + this.dim); 
     86                                                        this.outPos             = 0; 
     87                                                        this.accelConst = (this.outPos - this.homePos) / ypSlideOutMenu.aniLen / ypSlideOutMenu.aniLen ; 
    8788 
    8889                                                        // set event handlers. 
    8990                                                        if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT); 
    90                                                 this.menu.onmouseover = new Function("ypSlideOutMenu.showMenu('" + this.id + "')") 
    91                                                         this.menu.onmouseout = new Function("ypSlideOutMenu.hideMenu('" + this.id + "')") 
     91                                                this.menu.onmouseover = new Function("ypSlideOutMenu.showMenu('" + this.id + "')"); 
     92                                                        this.menu.onmouseout = new Function("ypSlideOutMenu.hideMenu('" + this.id + "')"); 
    9293 
    9394                                                        //set initial state 
    94                                                         this.endSlide() 
     95                                                        this.endSlide(); 
    9596                                        } 
    96         } 
     97        }; 
    9798 
    9899        ypSlideOutMenu.showMenu = function(id) 
    99100        { 
    100                 var reg = ypSlideOutMenu.Registry 
    101                         var obj = ypSlideOutMenu.Registry[id] 
     101                var reg = ypSlideOutMenu.Registry; 
     102                        var obj = ypSlideOutMenu.Registry[id]; 
    102103 
    103104                        //document.all.select.style="visibily:hidden"; 
     
    105106 
    106107                        //temporarly hide all selectboxes to fix IE bug with z-index   
    107                         if(document.all) 
     108                        if(document.all); 
    108109                        { 
    109110                                for (var i=0; i<document.all.length; i++) { 
    110                                         o = document.all(i) 
     111                                        o = document.all(i); 
    111112                                                if (o.type == 'select-one' || o.type == 'select-multiple') { 
    112113                                                        // todo: add check for select in div? 
     
    118119 
    119120                if (obj.container) { 
    120                         obj.over = true 
     121                        obj.over = true; 
    121122 
    122123                                // close other menus. 
    123                                 for (menu in reg) if (id != menu) ypSlideOutMenu.hide(menu) 
     124                                for (menu in reg) if (id != menu) ypSlideOutMenu.hide(menu); 
    124125 
    125126                                        // if this menu is scheduled to close, cancel it. 
    126                                         if (obj.hideTimer) { reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer) } 
     127                                        if (obj.hideTimer) {  
     128                                                reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer); 
     129                                                 } 
    127130 
    128131                        // if this menu is closed, open it. 
    129                         if (!obj.open && !obj.aniTimer) reg[id].startSlide(true) 
     132                        if (!obj.open && !obj.aniTimer) reg[id].startSlide(true); 
    130133                } 
    131         } 
     134        }; 
    132135 
    133136        ypSlideOutMenu.hideMenu = function(id) 
     
    135138                // schedules the menu to close after <hideDelay> ms, which 
    136139                // gives the user time to cancel the action if they accidentally moused out 
    137                 var obj = ypSlideOutMenu.Registry[id] 
     140                var obj = ypSlideOutMenu.Registry[id]; 
    138141                        if (obj.container) { 
    139                                 if (obj.hideTimer) window.clearTimeout(obj.hideTimer) 
     142                                if (obj.hideTimer) window.clearTimeout(obj.hideTimer); 
    140143                                        obj.hideTimer = window.setTimeout("ypSlideOutMenu.hide('" + id + "')", ypSlideOutMenu.hideDelay); 
    141144                        } 
    142         } 
     145        }; 
    143146 
    144147        ypSlideOutMenu.hide = function(id) 
    145148        { 
    146                 var obj = ypSlideOutMenu.Registry[id] 
    147                         obj.over = false 
    148  
    149                         if (obj.hideTimer) window.clearTimeout(obj.hideTimer) 
     149                var obj = ypSlideOutMenu.Registry[id]; 
     150                        obj.over = false; 
     151 
     152                        if (obj.hideTimer) window.clearTimeout(obj.hideTimer); 
    150153 
    151154                                // flag that this scheduled event has occured. 
    152                                 obj.hideTimer = 0 
     155                                obj.hideTimer = 0; 
    153156 
    154157                                        // if this menu is open, close it. 
    155                                         if (obj.open && !obj.aniTimer) obj.startSlide(false) 
     158                                        if (obj.open && !obj.aniTimer) obj.startSlide(false); 
    156159 
    157160                                                //show all selectboxes again to fix IE bug with z-index   
     
    159162                                                { 
    160163                                                        for (var i=0; i<document.all.length; i++) { 
    161                                                                 o = document.all(i) 
     164                                                                o = document.all(i); 
    162165                                                                        if (o.type == 'select-one' || o.type == 'select-multiple') { 
    163166                                                                                // todo: add check for select in div? 
     
    169172 
    170173 
     174        }; 
     175 
     176ypSlideOutMenu.prototype.startSlide = function(open) { 
     177        this[open ? "onactivate" : "ondeactivate"](); 
     178        this.open = open; 
     179        if (open) this.setVisibility(true); 
     180        this.startTime = (new Date()).getTime() ; 
     181        this.aniTimer = window.setInterval(this.gRef + ".slide()", ypSlideOutMenu.minCPUResolution); 
     182}; 
     183 
     184ypSlideOutMenu.prototype.slide = function() { 
     185        var elapsed = (new Date()).getTime() - this.startTime; 
     186        if (elapsed > ypSlideOutMenu.aniLen) this.endSlide(); 
     187        else { 
     188                var d = Math.round(Math.pow(ypSlideOutMenu.aniLen-elapsed, 2) * this.accelConst); 
     189                if (this.open && this.dirType == "-")           d = -d; 
     190                else if (this.open && this.dirType == "+")      d = -d; 
     191                else if (!this.open && this.dirType == "-")     d = -this.dim + d; 
     192                else                                                                            d = this.dim + d; 
     193 
     194                this.moveTo(d); 
    171195        } 
    172  
    173 ypSlideOutMenu.prototype.startSlide = function(open) { 
    174         this[open ? "onactivate" : "ondeactivate"]() 
    175         this.open = open 
    176         if (open) this.setVisibility(true) 
    177         this.startTime = (new Date()).getTime()  
    178         this.aniTimer = window.setInterval(this.gRef + ".slide()", ypSlideOutMenu.minCPUResolution) 
    179 } 
    180  
    181 ypSlideOutMenu.prototype.slide = function() { 
    182         var elapsed = (new Date()).getTime() - this.startTime 
    183         if (elapsed > ypSlideOutMenu.aniLen) this.endSlide() 
    184         else { 
    185                 var d = Math.round(Math.pow(ypSlideOutMenu.aniLen-elapsed, 2) * this.accelConst) 
    186                 if (this.open && this.dirType == "-")           d = -d 
    187                 else if (this.open && this.dirType == "+")      d = -d 
    188                 else if (!this.open && this.dirType == "-")     d = -this.dim + d 
    189                 else                                                                            d = this.dim + d 
    190  
    191                 this.moveTo(d) 
     196}; 
     197 
     198ypSlideOutMenu.prototype.endSlide = function() { 
     199        this.aniTimer = window.clearTimeout(this.aniTimer); 
     200        this.moveTo(this.open ? this.outPos : this.homePos); 
     201        if (!this.open) this.setVisibility(false); 
     202        if ((this.open && !this.over) || (!this.open && this.over)) { 
     203                this.startSlide(this.over); 
    192204        } 
    193 } 
    194  
    195 ypSlideOutMenu.prototype.endSlide = function() { 
    196         this.aniTimer = window.clearTimeout(this.aniTimer) 
    197         this.moveTo(this.open ? this.outPos : this.homePos) 
    198         if (!this.open) this.setVisibility(false) 
    199         if ((this.open && !this.over) || (!this.open && this.over)) { 
    200                 this.startSlide(this.over) 
    201         } 
    202 } 
     205}; 
    203206 
    204207ypSlideOutMenu.prototype.setVisibility = function(bShow) {  
    205         var s = this.ns4 ? this.container : this.container.style 
    206         s.visibility = bShow ? "visible" : "hidden" 
    207 } 
     208        var s = this.ns4 ? this.container : this.container.style; 
     209        s.visibility = bShow ? "visible" : "hidden"; 
     210}; 
    208211ypSlideOutMenu.prototype.moveTo = function(p) {  
    209         this.style[this.orientation == "h" ? "left" : "top"] = this.ns4 ? p : p + "px" 
    210 } 
     212        this.style[this.orientation == "h" ? "left" : "top"] = this.ns4 ? p : p + "px"; 
     213}; 
    211214ypSlideOutMenu.prototype.getPos = function(c) { 
    212         return parseInt(this.style[c]) 
    213 } 
     215        return parseInt(this.style[c]); 
     216}; 
    214217 
    215218// events 
    216 ypSlideOutMenu.prototype.onactivate             = function() { } 
    217 ypSlideOutMenu.prototype.ondeactivate   = function() { } 
     219ypSlideOutMenu.prototype.onactivate             = function() { }; 
     220ypSlideOutMenu.prototype.ondeactivate   = function() { }; 
Note: See TracChangeset for help on using the changeset viewer.