Changeset 812


Ignore:
Timestamp:
05/07/09 16:49:01 (15 years ago)
Author:
niltonneto
Message:

Ocorrência #432 - Otimização da função get_lang, que utiliza variável nativa "arguments".

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/js/common_functions.js

    r689 r812  
    5151                } 
    5252        } 
     53 
    5354        if(Element('content_folders')) 
    5455                Element('content_folders').style.height = defaultHeight - (is_ie ? 165 : 150); 
    5556        if(Element("divScrollMain_"+numBox)) 
    56                 Element("divScrollMain_"+numBox).style.height   = defaultHeight - (is_ie ? 111 : 110);   
     57                Element("divScrollMain_"+numBox).style.height   = defaultHeight - (is_ie ? 111 : 110); 
    5758} 
    5859// END: FUNCTION RESIZE WINDOW 
     
    7677 
    7778// Translate words and phrases using user language from eGroupware. 
    78 function get_lang(_key,_arg1,_arg2,_arg3,_arg4) { 
    79  
     79function get_lang(_key) { 
    8080        var key = _key.toLowerCase(); 
    81                 if(array_lang[key]) 
    82                         var _value = array_lang[key]; 
    83                 else 
    84                         var _value = _key+"*"; 
    85  
    86         if(_arg1) 
    87                 for(j = 1; eval("_arg"+j); j++) 
    88                                 _value = _value.replace("%"+j,eval("_arg"+j)); 
     81        if(array_lang[key]) 
     82                var _value = array_lang[key]; 
     83        else 
     84                var _value = _key+"*"; 
     85 
     86        if(arguments.length > 1) 
     87                for(j = 1; typeof(arguments[j]) != 'undefined'; j++) 
     88                        _value = _value.replace("%"+j,arguments[j]); 
    8989        return _value; 
    90 }  
     90} 
     91 
    9192// Make decimal round, using in size message 
    9293function round(value, decimal){ 
     
    660661function increment_folder_unseen(){ 
    661662        var folder_id = get_current_folder(); 
    662          
     663 
    663664        var folder_unseen = Element('dftree_'+folder_id+'_unseen'); 
    664665        var abas_unseen = Element('new_m').innerHTML; 
     
    675676        } 
    676677        if (abas_unseen) 
    677         { 
    678                 abas_unseen = parseInt(abas_unseen) + 1; 
    679                 Element('new_m').innerHTML = '<font style="color:red">' + abas_unseen + '</font>'; 
    680 } 
    681         else{ 
    682                 abas_unseen = Element('new_m').innerHTML; 
    683                 abas_unseen = abas_unseen.match( /[0-9]+/); 
    684                 abas_unseen = parseInt(abas_unseen) + 1; 
    685                 Element('new_m').innerHTML = '<font style="color:red">' + abas_unseen + '</font>'; 
     678        { 
     679                abas_unseen = parseInt(abas_unseen) + 1; 
     680                Element('new_m').innerHTML = '<font style="color:red">' + abas_unseen + '</font>'; 
     681        } 
     682        else{ 
     683                abas_unseen = Element('new_m').innerHTML; 
     684                abas_unseen = abas_unseen.match( /[0-9]+/); 
     685                abas_unseen = parseInt(abas_unseen) + 1; 
     686                Element('new_m').innerHTML = '<font style="color:red">' + abas_unseen + '</font>'; 
    686687        } 
    687688} 
    688689function decrement_folder_unseen(){ 
    689690        var folder_id = get_current_folder(); 
    690          
     691 
    691692        var folder_unseen = Element('dftree_'+folder_id+'_unseen'); 
    692693        var abas_unseen = Element('new_m').innerHTML; 
     
    711712                abas_unseen = (parseInt(abas_unseen) - 1); 
    712713                Element('new_m').innerHTML = '<font style="color:red">' + abas_unseen + '</font>'; 
    713 } 
     714        } 
    714715        else if (parseInt(abas_unseen) <= 1) 
    715716        { 
     
    722723        var strTemp = ""; 
    723724        var iTemp = 0; 
    724          
     725 
    725726        if(v_length < 1) 
    726727                return ""; 
     
    734735                } 
    735736                iTemp++; 
    736         }        
     737        } 
    737738        return strTemp; 
    738739} 
     
    761762} 
    762763 
    763  function lang_folder(fn) { 
     764function lang_folder(fn) { 
    764765        if (fn.toUpperCase() == "INBOX") return get_lang("Inbox"); 
    765766        if (special_folders[fn] && typeof(special_folders[fn]) == 'string') { 
     
    767768        } 
    768769        return fn; 
    769  } 
     770} 
    770771 
    771772function add_className(obj, className){ 
Note: See TracChangeset for help on using the changeset viewer.