- Timestamp:
- 04/30/10 09:52:49 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js
r2647 r2670 64 64 return htmlObj; 65 65 } catch(e) { 66 alert( 67 "TrophyIM Error: Cannot add html to page" + e.message); 66 alert("TrophyIM Error: Cannot add html to page " + e.message); 68 67 } 69 68 } … … 243 242 load : function() 244 243 { 245 load IM.setUserCurrent();244 loadscript.setUserCurrent(); 246 245 247 246 if (!TrophyIM.statusConn.connected) … … 258 257 else 259 258 { 260 load IM.rosterDiv();259 loadscript.rosterDiv(); 261 260 } 262 261 }, … … 309 308 { 310 309 // List Contact 311 load IM.rosterDiv();310 loadscript.rosterDiv(); 312 311 313 if ( load IM.getUserCurrent() != null )312 if ( loadscript.getUserCurrent() != null ) 314 313 { 315 TrophyIM.login( Base64.decode(load IM.getUserCurrent().jid), Base64.decode(loadIM.getUserCurrent().password));314 TrophyIM.login( Base64.decode(loadscript.getUserCurrent().jid), Base64.decode(loadscript.getUserCurrent().password)); 316 315 } 317 316 else 318 317 { 319 load IM.loginPage();318 loadscript.loginPage(); 320 319 } 321 320 } … … 401 400 var button = document.getElementById('trophyimconnect'); 402 401 403 load IM.setUserCurrent( barejid, password);402 loadscript.setUserCurrent( barejid, password); 404 403 405 404 if ( button.value == 'connect' ) … … 475 474 },10000); 476 475 477 load IM.clrAllContacts();476 loadscript.clrAllContacts(); 478 477 479 load IM.setStatusJabber("Desconectado","unavailable");478 loadscript.setStatusJabber("Desconectado","unavailable"); 480 479 481 480 delete TrophyIM.rosterObj.roster; … … 486 485 if( status == Strophe.Status.CONNECTED ) 487 486 { 488 load IM.setStatusJabber('Disponível','available');487 loadscript.setStatusJabber('Disponível','available'); 489 488 TrophyIM.statusConn.connected = true; 490 489 TrophyIM.showClient(); … … 511 510 TrophyIM.connection.send($iq({type: 'get', xmlns: Strophe.NS.CLIENT}).c('query', {xmlns: Strophe.NS.ROSTER}).tree()); 512 511 TrophyIM.connection.send($pres().tree()); 513 setTimeout( "TrophyIM.renderRoster()", 1000);512 setTimeout( TrophyIM.renderRoster, 1000); 514 513 }, 515 514 … … 640 639 } 641 640 642 var message = 643 { 644 contact : "<font style='font-weight:bold; color:black;'>" + contact + "</font>", 645 msg : Strophe.getText(elems[0]) 646 }; 647 648 TrophyIM.makeChat(from); //Make sure we have a chat window 649 TrophyIM.addMessage(message, jid_lower); 641 var _message = document.createElement("div"); 642 _message.innerHTML = Strophe.getText(elems[0]); 643 644 var scripts = _message.getElementsByTagName( 'script' ); 645 646 for ( var i = 0; i < scripts.length; i++ ) 647 _message.removeChild( scripts[ i-- ] ); 648 649 _message.innerHTML = _message.innerHTML.trim( ); 650 651 if ( _message.hasChildNodes( ) ) 652 { 653 var message = 654 { 655 contact : "<font style='font-weight:bold; color:black;'>" + contact + "</font>", 656 msg : _message.innerHTML 657 }; 658 659 TrophyIM.makeChat(from); //Make sure we have a chat window 660 TrophyIM.addMessage(message, jid_lower); 661 } 650 662 } 651 663 … … 702 714 visible : "display", 703 715 resizable : true, 704 zindex : load IM.getZIndex(),716 zindex : loadscript.getZIndex(), 705 717 title : titleWindow, 706 718 closeAction : "hidden", 707 content : load IM.parse("chat_box","chatBox.xsl", paramsChatBox)719 content : loadscript.parse("chat_box","chatBox.xsl", paramsChatBox) 708 720 } 709 721 … … 711 723 712 724 // Notification New Message 713 load IM.notification();725 loadscript.notification(); 714 726 715 727 // Photo User; 716 load IM.getPhotoUser(barejid);728 loadscript.getPhotoUser(barejid); 717 729 718 load IM.configEvents( document.getElementById( barejid + '__sendBox'),730 loadscript.configEvents( document.getElementById( barejid + '__sendBox'), 719 731 'onkeyup', function(e) 720 732 { … … 828 840 { 829 841 for( var i in presence ) 842 { 843 if ( presence[ i ].constructor == Function ) 844 continue; 845 830 846 TrophyIM.rosterObj.setPresence( jid, presence[i].priority, presence[i].show, presence[i].status); 847 } 831 848 },500); 832 849 }, … … 849 866 spanShow.parentNode.removeChild(spanShow); 850 867 851 load IM.removeGroup( divItenContact.parentNode );868 loadscript.removeGroup( divItenContact.parentNode ); 852 869 853 870 divItenContact.parentNode.removeChild(divItenContact); … … 892 909 for( var user in TrophyIM.rosterObj.roster ) 893 910 { 911 if ( TrophyIM.rosterObj.roster[ user ].constructor == Function ) 912 continue; 913 894 914 users[users.length] = TrophyIM.rosterObj.roster[user].contact.jid; 895 915 } … … 902 922 for (var group in TrophyIM.rosterObj.groups) 903 923 { 924 if ( TrophyIM.rosterObj.groups[ group ].constructor == Function ) 925 continue; 926 904 927 if( group ) 905 928 groups[groups.length] = group; … … 943 966 } 944 967 945 _element.innerHTML += load IM.parse("group","groups.xsl", paramsGroup);968 _element.innerHTML += loadscript.parse("group","groups.xsl", paramsGroup); 946 969 } 947 970 … … 992 1015 993 1016 var itensJid = document.getElementById( 'itenContact_' + objContact.contact.jid + '_' + index ); 994 1017 995 1018 if( itensJid == null ) 996 1019 { … … 1015 1038 for (var resource in objContact.presence) 1016 1039 { 1040 if ( objContact.presence[resource].constructor == Function ) 1041 continue; 1042 1017 1043 if( objContact.presence[resource].show != 'invisible' ) 1018 1044 presence = objContact.presence[resource].show; … … 1034 1060 jid : objContact.contact.jid, 1035 1061 id : 'itenContact_' + objContact.contact.jid + '_' + index , 1036 index : index,1062 index : ((index == 0 ) ? "0" : index), 1037 1063 path_jabberit : path_jabberit, 1038 1064 presence : presence, … … 1042 1068 subscription : objContact.contact.subscription 1043 1069 } 1044 1045 1046 1070 1047 1071 // Authorization … … 1096 1120 if( _NodeChild.childNodes[0].childNodes[0].nodeValue === group ) 1097 1121 { 1098 _NodeChild.innerHTML += load IM.parse("itens_group", "itensGroup.xsl", paramsContact);1122 _NodeChild.innerHTML += loadscript.parse("itens_group", "itensGroup.xsl", paramsContact); 1099 1123 } 1100 1124 } … … 1117 1141 for ( var resource in objContact.presence ) 1118 1142 { 1143 if ( objContact.presence[resource].constructor == Function ) 1144 continue; 1145 1119 1146 if( objContact.presence[resource].show != 'invisible' ) 1120 1147 presence = objContact.presence[resource].show; … … 1193 1220 for( var i = 0 ; i < users.length; i++ ) 1194 1221 { 1195 if( TrophyIM.rosterObj.roster[users[i]].contact.jid != Base64.decode(load IM.getUserCurrent().jid) )1222 if( TrophyIM.rosterObj.roster[users[i]].contact.jid != Base64.decode(loadscript.getUserCurrent().jid) ) 1196 1223 { 1197 1224 if( TrophyIM.rosterObj.roster[users[i]].contact.groups ) … … 1202 1229 { 1203 1230 for( var j = 0; j < groups.length; j++ ) 1231 { 1204 1232 addItem( TrophyIM.rosterObj.roster[users[i]], groups[j], element, j ); 1233 } 1205 1234 } 1206 1235 else … … 1264 1293 TrophyIM.logout(); 1265 1294 1266 load IM.clrAllContacts();1295 loadscript.clrAllContacts(); 1267 1296 1268 1297 delete TrophyIM.rosterObj.roster; … … 1293 1322 if (( _status = prompt("Digite sua mensagem !") )) 1294 1323 { 1295 for(var resource in TrophyIM.rosterObj.roster[Base64.decode(loadIM.getUserCurrent().jid)].presence ) 1296 { 1324 for(var resource in TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence ) 1325 { 1326 if ( TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence[ resource ].constructor == Function ) 1327 continue; 1328 1297 1329 if ( TROPHYIM_RESOURCE === ("/" + resource) ) 1298 _show = TrophyIM.rosterObj.roster[Base64.decode(load IM.getUserCurrent().jid)].presence[resource].show;1330 _show = TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence[resource].show; 1299 1331 } 1300 1332 … … 1478 1510 for (var resource in this.roster[jid.toLowerCase()]['presence']) 1479 1511 { 1512 if ( this.roster[jid.toLowerCase()]['presence'][ resource ].constructor == Function ) 1513 continue; 1514 1480 1515 var presence = this.roster[jid.toLowerCase()]['presence'][resource]; 1481 1516 if (current == null) … … 1540 1575 var contacts = 0; 1541 1576 for ( var contact in this.groups[ groups[ i ] ] ) 1577 { 1578 if ( this.groups[ groups[ i ] ][ contact ].constructor == Function ) 1579 continue; 1580 1542 1581 contacts++; 1582 } 1543 1583 1544 1584 if ( ! contacts ) … … 1686 1726 if (typeof(obj) == "object") { 1687 1727 for (var i in obj) { 1728 if ( obj[i].constructor == Function ) 1729 continue; 1730 1688 1731 if (i == '_empty_') { 1689 1732 obj[""] = this.emptyFix(obj['_empty_']);
Note: See TracChangeset
for help on using the changeset viewer.