Ignore:
Timestamp:
04/28/10 11:40:39 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #986 - Correcao para compatibilizar o carregamento do script para o IE e status offline.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js

    r2641 r2647  
    137137                 
    138138        autoConnection : { connect : true }, 
    139                  
     139 
     140        /** Object: chatHistory 
     141    * 
     142    *  Stores chat history (last 10 message) and current presence of active 
     143    *  chat tabs.  Indexed by jid. 
     144    */ 
     145         
     146        chatHistory : {}, 
     147         
     148        /** Constants: 
     149    * 
     150    *    (Boolean) stale_roster - roster is stale and needs to be rewritten. 
     151    */ 
     152         
     153        constants : {stale_roster: false}, 
     154         
    140155        /** PosWindow 
    141156         *  
     
    149164        statusConn : { connected : false }, 
    150165         
    151         /** Constants: 
    152      * 
    153      *    (Boolean) stale_roster - roster is stale and needs to be rewritten. 
    154      */ 
    155     constants : {stale_roster: false}, 
    156      
    157         /** Object: chatHistory 
    158      * 
    159      *  Stores chat history (last 10 message) and current presence of active 
    160      *  chat tabs.  Indexed by jid. 
    161      */ 
    162     chatHistory : {}, 
    163      
     166        /** TimeOut Render Roster 
     167         *  
     168         *  
     169         */ 
     170         
     171        _timeOut : { renderRoster : null }, 
     172         
    164173     /** Function: setCookie 
    165174     * 
     
    207216        var cObj = {}; 
    208217        var cookies = document.cookie.split(';'); 
    209         for (var c in cookies) 
     218         
     219        for(var i = 0 ; i < cookies.length; i++ ) 
    210220        { 
    211                 while ( cookies[c].charAt(0) == ' ') 
     221                while ( cookies[i].charAt(0) == ' ') 
    212222            {  
    213                 cookies[c] = cookies[c].substring(1,cookies[c].length); 
    214             } 
    215             if (cookies[c].substr(0, 8) == "trophyim") 
     223                cookies[i] = cookies[i].substring(1,cookies[i].length); 
     224            } 
     225                 
     226            if (cookies[i].substr(0, 8) == "trophyim") 
    216227            { 
    217                 var nvpair = cookies[c].split("=", 2); 
     228                var nvpair = cookies[i].split("=", 2); 
    218229                cObj[nvpair[0]] = nvpair[1]; 
    219230                TrophyIM.setCookie(nvpair[0], nvpair[1]); 
     
    239250                         
    240251                        //Load other .js scripts needed 
    241                         document.getElementsByTagName('head')[0].appendChild(DOMObjects.getScript(path_jabberit + 'js/strophe.min.js')); 
     252                        //document.getElementsByTagName('head')[0].appendChild(DOMObjects.getScript(path_jabberit + 'js/strophe.min.js')); 
     253                        document.getElementsByTagName('head')[0].appendChild(DOMObjects.getScript(path_jabberit + 'js/strophe.js')); 
    242254                        document.getElementsByTagName('head')[0].appendChild(DOMObjects.getScript(path_jabberit + 'js/json2.js')); //Keep this script last 
    243255                        //Wait a second to give scripts time to load 
     
    427439    onConnect : function(status) 
    428440        { 
    429                 var loading_gif = document.getElementById("JabberIMRosterLoadingGif"); 
    430                  
    431                 loading_gif.style.display = "block"; 
     441        var loading_gif = document.getElementById("JabberIMRosterLoadingGif"); 
    432442                 
    433443        if( status == Strophe.Status.CONNECTING ) 
    434444                { 
    435                         Strophe.info('Strophe is connecting.'); 
     445                loading_gif.style.display = "block"; 
     446                Strophe.info('Strophe is connecting.'); 
    436447        } 
    437448                 
     
    440451                        TrophyIM.delCookie('trophyim_bosh_xid'); 
    441452            TrophyIM.statusConn.connected = false; 
     453            loading_gif.style.display = "block"; 
    442454        } 
    443455                 
     
    451463                        if( TrophyIM.autoConnection.connect ) 
    452464                        { 
     465                                loading_gif.style.display = "block"; 
     466                                 
    453467                                TrophyIM.delCookie('trophyim_bosh_xid'); 
    454468                     
     
    876890                                loading_gif.style.display = "none"; 
    877891                                 
    878                         //      loading_gif.parentNode.removeChild(loading_gif); 
    879                          
    880892                        for( var user in TrophyIM.rosterObj.roster ) 
    881893                        { 
     
    910922                } 
    911923                         
    912                 setTimeout("TrophyIM.renderRoster()", 1000 );            
     924                TrophyIM._timeOut.renderRoster = setTimeout("TrophyIM.renderRoster()", 1000 );           
    913925        }, 
    914926         
     
    12311243     */ 
    12321244 
    1233         setPresence : function( type ) 
    1234         { 
    1235                 if( type != 'status') 
    1236                 { 
    1237                         if(type == "unavailable") 
    1238                         { 
    1239                         TrophyIM.autoConnection.connect = false; 
     1245        setPresence : function( _type ) 
     1246        { 
     1247                if( _type != 'status') 
     1248                { 
     1249                        if( _type == "unavailable") 
     1250                        { 
     1251                                var loading_gif = document.getElementById("JabberIMRosterLoadingGif"); 
     1252                                 
     1253                                if( TrophyIM._timeOut.renderRoster != null ) 
     1254                                        clearTimeout(TrophyIM._timeOut.renderRoster); 
     1255                                 
     1256                                TrophyIM.connection.send($pres({type : _type}).tree()); 
     1257                                 
     1258                                for( var i = 0; i < TrophyIM.connection._requests.length; i++ ) 
     1259                        { 
     1260                                if( TrophyIM.connection._requests[i] ) 
     1261                                        TrophyIM.connection._removeRequest(TrophyIM.connection._requests[i]); 
     1262                        } 
     1263                                 
     1264                                TrophyIM.logout(); 
     1265                                 
     1266                        loadIM.clrAllContacts(); 
     1267                         
     1268                        delete TrophyIM.rosterObj.roster; 
     1269                        delete TrophyIM.rosterObj.groups; 
     1270                         
     1271                        setTimeout(function() 
     1272                        { 
     1273                                        if( loading_gif.style.display == "block" ) 
     1274                                                loading_gif.style.display = "none"; 
     1275                        }, 1000); 
    12401276                        } 
    12411277                        else 
     
    12471283                                } 
    12481284                                else 
    1249                                         TrophyIM.connection.send($pres( ).c('show').t(type).tree()); 
     1285                                        TrophyIM.connection.send($pres( ).c('show').t(_type).tree()); 
    12501286                        } 
    12511287                } 
Note: See TracChangeset for help on using the changeset viewer.