- Timestamp:
- 05/14/10 14:53:17 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/jabberit_messenger/trophy_expresso/js/jscode/loadIM.js
r2754 r2787 15 15 var Xtools = null; 16 16 var zIndex = 9001; 17 var windowPopUp = null; 18 17 var windowPopUp = []; 18 19 // Sniffer Browser 20 var agt = navigator.userAgent.toLowerCase(); 21 var is_major = parseInt(navigator.appVersion); 22 var is_minor = parseFloat(navigator.appVersion); 23 var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 24 && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 25 && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)); 26 var is_gecko = (agt.indexOf('gecko') != -1); 27 var is_gecko1_5 = (agt.indexOf('firefox/1.5') != -1 || agt.indexOf('firefox/2') != -1 || agt.indexOf('iceweasel/2') != -1); 28 var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); 29 var is_ie3 = (is_ie && (is_major < 4)); 30 var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) ); 31 var is_ie4up = (is_ie && (is_major >= 4)); 32 var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) ); 33 var is_ie5_5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1)); 34 var is_ie5up = (is_ie && !is_ie3 && !is_ie4); 35 var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5); 36 var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) ); 37 var is_ie6up = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5); 38 var is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) ); 39 19 40 // Images 20 41 var add_user = new Image(); … … 68 89 TrophyIM.rosterClick(jid); 69 90 } 91 92 setTimeout(function() 93 { 94 window.document.oncontextmenu = function() 95 { 96 return true; 97 }; 98 99 },500); 70 100 } 71 101 } … … 223 253 { 224 254 if ( pEvent.substring(0, 2) == 'on' ) 225 pEvent = pEvent.substring(2, pEvent.length); 226 227 if ( pObj.addEventListener ) 228 pObj.addEventListener(pEvent, pHandler, false); 229 else if ( pObj.attachEvent ) 230 pObj.attachEvent('on' + pEvent, pHandler); 255 pEvent = pEvent.substring(2, pEvent.length ); 256 257 if ( arguments.length == 3 ) 258 { 259 if ( pObj.addEventListener ) 260 pObj.addEventListener(pEvent, pHandler, false ); 261 else if ( pObj.attachEvent ) 262 pObj.attachEvent( 'on' + pEvent, pHandler ); 263 } 264 else if ( arguments.length == 4 ) 265 { 266 if ( pObj.removeEventListener ) 267 pObj.removeEventListener( pEvent, pHandler, false ); 268 else if ( pObj.detachEvent ) 269 pObj.detachEvent( 'on' + pEvent, pHandler ); 270 } 231 271 } 232 272 } … … 281 321 } 282 322 323 function getIsIE() 324 { 325 return is_ie; 326 } 327 283 328 function getPhotoUser( jid ) 284 329 { 330 try 331 { 285 332 var _divPhoto = getElement( jid + '__photo' ); 286 333 … … 292 339 _divPhoto.style.backgroundImage = 'url(' + _imgUser + ')'; 293 340 } 341 } 342 catch(e) 343 {} 294 344 } 295 345 … … 452 502 function notificationNewMessage() 453 503 { 454 var oldTitle = document.title; 504 var _doc = document; 505 var _id = arguments[0]; 506 var _win_name = _id.replace( /\W/g, '' ); 507 508 if ( windowPOPUP( _id ) ) 509 { 510 _doc = windowPopUp[_win_name].document; 511 } 512 513 var oldTitle = _doc.title; 455 514 var newTitle = "## NOVA MENSAGEM ##"; 456 var idWindow = arguments[1];457 515 458 516 if( timeoutId == null ) … … 460 518 timeoutId = setInterval(function() 461 519 { 462 document.title = ( document.title == newTitle ) ? oldTitle : newTitle;520 _doc.title = ( _doc.title == newTitle ) ? oldTitle : newTitle; 463 521 }, 1000); 464 522 465 configEvents( window.document, 'onclick', function()523 configEvents( _doc, 'onclick', function() 466 524 { 467 525 clearInterval(timeoutId); 468 document.title = oldTitle;526 _doc.title = oldTitle; 469 527 timeoutId = null; 470 528 }); 471 529 472 configEvents( window.document, 'onkeypress', function()530 configEvents( _doc, 'onkeypress', function() 473 531 { 474 532 clearInterval(timeoutId); 475 document.title = oldTitle;533 _doc.title = oldTitle; 476 534 timeoutId = null; 477 535 }); … … 524 582 525 583 window.document.body.appendChild(_optionsItens); 526 527 528 setTimeout(function()529 {530 window.document.oncontextmenu = function()531 {532 return true;533 };534 535 },500);536 584 } 537 585 } … … 682 730 function rosterDiv() 683 731 { 684 var _popUp = (_preferencesIM[1]).split(":"); 685 686 var paramListContact = 687 { 688 'idUser' : Base64.decode(getUserCurrent().jid), 689 'full_name' : (( fullName.length < 25 ) ? fullName : ( fullName.substring( 0, 25) + "...")), 690 'path_jabberit' : path_jabberit, 691 'zIndex_' : zIndex++ 692 }; 693 694 var winRosterDiv = 695 { 696 id_window : "window_Roster_im", 697 width : 250, 698 height : 410, 699 top : 50, 700 left : -1500, 701 leftOld : 50, 702 draggable : true, 703 visible : "display", 704 resizable : true, 705 zindex : zIndex++, 706 title : "Expresso Messenger - Contatos", 707 closeAction : "hidden", 708 content : Xtools.parse(Xtools.xml("contacts_list"),"contactsList.xsl", paramListContact) 709 }; 710 711 if( _preferencesIM[0] == "openWindowJabberit:false" ) 712 { 713 winRosterDiv.left = 50; 714 winRosterDiv.leftOld = -1500; 715 } 716 717 _winBuild( winRosterDiv ); 718 719 // Photo User 720 getPhotoUser(Base64.decode(getUserCurrent().jid)); 721 732 var _rosterDiv = function() 733 { 734 var _popUp = (_preferencesIM[1]).split(":"); 735 var _idUser = Base64.decode(getUserCurrent().jid); 736 737 var paramListContact = 738 { 739 'idUser' : _idUser, 740 'full_name' : (( fullName.length < 25 ) ? fullName : ( fullName.substring( 0, 25) + "...")), 741 'path_jabberit' : path_jabberit, 742 'zIndex_' : zIndex++ 743 }; 744 745 var winRosterDiv = 746 { 747 id_window : "window_Roster_im", 748 width : 250, 749 height : 410, 750 top : 50, 751 left : -1500, 752 leftOld : 50, 753 draggable : true, 754 visible : "display", 755 resizable : true, 756 zindex : zIndex++, 757 title : "Expresso Messenger - Contatos", 758 closeAction : "hidden", 759 content : Xtools.parse(Xtools.xml("contacts_list"),"contactsList.xsl", paramListContact) 760 }; 761 762 if( _preferencesIM[0] == "openWindowJabberit:false" ) 763 { 764 winRosterDiv.left = 50; 765 winRosterDiv.leftOld = -1500; 766 } 767 768 _winBuild( winRosterDiv ); 769 770 // Photo User 771 getPhotoUser(_idUser); 772 773 } 774 775 setTimeout( function(){ _rosterDiv(); }, 500 ); 722 776 } 723 777 … … 1014 1068 } 1015 1069 1070 var _stylesheets = [ ]; 1071 var _links = document.getElementsByTagName( 'link' ); 1072 1073 for ( var i = 0; i < _links.length; i++ ) 1074 if ( _links.item( i ).type && _links.item( i ).type.toLowerCase( ) == 'text/css' ) 1075 _stylesheets[ _stylesheets.length ] = _links.item( i ); 1076 1077 function windowPOPUP() 1078 { 1079 var _id = arguments[0]; 1080 var _win_name = _id.replace( /\W/g, '' ); 1081 1082 if ( arguments.length == 1 ) 1083 { 1084 if ( windowPopUp[_win_name] ) 1085 return true; 1086 else 1087 return false; 1088 } 1089 1090 if( arguments.length == 2 ) 1091 { 1092 if( !windowPopUp[_win_name] ) 1093 { 1094 windowPopUp[_win_name] = window.open( '', _win_name + '__popup', 'height=355,width=380,top=50,left=50,toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,location=no,titlebar=no'); 1095 var tmp = windowPopUp[_win_name].document; 1096 1097 tmp.write('<html><head>'); 1098 tmp.write('</head><body>'); 1099 tmp.write('</body></html>'); 1100 tmp.close(); 1101 1102 for ( var i = 0; i < _stylesheets.length; i++ ) 1103 tmp.documentElement.getElementsByTagName( 'head' ).item(0).appendChild( _stylesheets[ i ].cloneNode( true ) ); 1104 1105 var divPOP = getElement( _id + "__popUp" ); 1106 divPOP.style.background = "url('"+path_jabberit+"templates/default/images/icon_down.png') no-repeat"; 1107 divPOP.innerHTML = "PopIn"; 1108 1109 function _close( ) 1110 { 1111 windowPopUp[_win_name].close(); 1112 configEvents( divPOP ,'onclick', _close, true ); 1113 } 1114 1115 configEvents( divPOP ,'onclick', _close ); 1116 1117 var _content = tmp.documentElement.getElementsByTagName( 'body' ).item(0).appendChild( getElement(_id + '__chatBox' ).parentNode ); 1118 1119 _content.firstChild.scrollTop = _content.firstChild.scrollHeight; 1120 1121 configEvents( windowPopUp[_win_name] ,'onbeforeunload', function() 1122 { 1123 delete windowPopUp[_win_name]; 1124 divPOP.style.background = "url('"+path_jabberit+"templates/default/images/icon_up.png') no-repeat"; 1125 divPOP.innerHTML = "PopOut"; 1126 divPOP.onclick = function(){ loadscript.windowPOPUP( _id , true ); }; 1127 _winBuild( 'window_chat_area_' + _id, "display" ).content( true ); 1128 }); 1129 1130 _winBuild( 'window_chat_area_' + _id, 'hidden' ); 1131 } 1132 } 1133 } 1134 1016 1135 function loadIM() 1017 1136 { … … 1085 1204 loadIM.prototype.clrAllContacts = clrAllContacts; 1086 1205 loadIM.prototype.configEvents = configEvents; 1206 loadIM.prototype.getIsIE = getIsIE; 1087 1207 loadIM.prototype.getPhotoUser = getPhotoUser; 1088 1208 loadIM.prototype.getStatusMessage = getStatusMessage; … … 1111 1231 loadIM.prototype.renameGroup = renameGroup; 1112 1232 loadIM.prototype.rosterDiv = rosterDiv; 1233 loadIM.prototype.windowPOPUP = windowPOPUP; 1113 1234 1114 1235 window.LoadIM = loadIM;
Note: See TracChangeset
for help on using the changeset viewer.