Changeset 697 for trunk/jabberit_messenger/js/load.js
- Timestamp:
- 03/12/09 11:32:55 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jabberit_messenger/js/load.js
r624 r697 1 1 (function() 2 2 { 3 var _autoStatusTime = 60000; // 1 minuto 4 var _autoStatus; 3 5 var _conn = new JITConnector(path_jabberit); 4 6 var _xtools = new JITXTools(path_jabberit); 5 var _showhidden = new ShowHidden(1 500);7 var _showhidden = new ShowHidden(1000); 6 8 var myWindow = ''; 7 9 var flagMouseOver = ''; 8 10 var flagOpenIM = ''; 9 11 var flagOpenPopup = ''; 12 var flagAwayIM = ''; 10 13 11 14 // Sniffer Browser … … 40 43 var _ldap = new JITLdap( _conn, _xtools, _window); 41 44 45 function addContacts() 46 { 47 _ldap.add(); 48 } 49 42 50 function addIcon() 43 51 { … … 84 92 85 93 var _menu; 86 _menu = top.document.createElement(' span');94 _menu = top.document.createElement('div'); 87 95 _menu.setAttribute('id','fast_menu_jabberit'); 88 96 _menu.style.backgroundColor = 'cecece'; 97 _menu.style.border = '1px dashed #000'; 89 98 _menu.style.display = 'none'; 90 99 _menu.style.margin = '20px 5px 0px -15px'; 91 100 _menu.style.position = 'absolute'; 92 101 _menu.style.zIndex = '99999'; 93 _menu.style.border = '1px dashed #000'; 102 _menu.onmouseout = function(){ _showhidden.hiddenObject(false); }; 103 _menu.onmouseover = function(){ _showhidden.hiddenObject(true); }; 94 104 95 105 divJabber.insertBefore(_menu, divJabber.firstChild); … … 124 134 ['Add Contacts',addContacts], 125 135 ['Help',helpJabberit], 126 ['Preferences', preferences] 136 ['Preferences', preferences], 137 ['Change Status', subMenuChangeStatus] 127 138 ]; 128 139 129 var _style_text = 'cursor: pointer; padding:2px 2px 2px 15px; b ackground: no-repeat url(' + jabberit_group_close.src + ');';140 var _style_text = 'cursor: pointer; padding:2px 2px 2px 15px; border-bottom:1px solid #dedede; background: no-repeat url(' + jabberit_group_close.src + ');'; 130 141 131 142 var _xml = _xtools.xml('menu'); … … 165 176 ); 166 177 } 167 } 168 ); 169 170 171 172 // 173 } 174 } 175 176 function addContacts() 177 { 178 _ldap.add(); 178 }); 179 } 180 } 181 182 function autoStatus() 183 { 184 185 if ( _autoStatus ) 186 clearTimeout(_autoStatus); 187 188 var _div_status = document.getElementById('status_Jabber_Expresso'); 189 if ( _div_status ) 190 { 191 var _status = _div_status.style.backgroundImage; 192 _status = _status.substr(_status.lastIndexOf('/') + 1); 193 _status = _status.substr(0, _status.indexOf('.')); 194 if ( _status == 'xa' && _div_status.getAttribute('autoStatus') ) 195 { 196 _div_status.removeAttribute('autoStatus'); 197 changeStatusJava("2"); 198 } 199 } 200 201 var TimeStatus = flagAwayIM.split(':'); 202 203 if( TimeStatus[1] ) 204 _autoStatus = setTimeout(autoStatusHandler, parseInt(TimeStatus[1])*_autoStatusTime); 205 else 206 _autoStatus = setTimeout(autoStatusHandler, parseInt(_autoStatusTime)); 207 } 208 209 function autoStatusHandler() 210 { 211 var _div_status = document.getElementById('status_Jabber_Expresso'); 212 if ( _div_status ) 213 { 214 var _status = _div_status.style.backgroundImage; 215 _status = _status.substr(_status.lastIndexOf('/') + 1); 216 _status = _status.substr(0, _status.indexOf('.')); 217 if ( _status == 'available' ) 218 { 219 _div_status.setAttribute('autoStatus','true'); 220 changeStatusJava("5"); 221 } 222 } 179 223 } 180 224 … … 190 234 element.innerHTML = "Nome do Contato .: "; 191 235 } 236 } 237 238 function changeStatusJava() 239 { 240 if(arguments.length > 0 ) 241 { 242 try 243 { 244 // If Layer; 245 if( elementIframe = document.getElementById('iframe_applet_jabberit') ) 246 { 247 if( !is_ie ) 248 elementIframe.contentDocument.applets[0].changeStatusfromExpresso(arguments[0]); 249 else 250 elementIframe.contentWindow.document.applets[0].changeStatusfromExpresso(arguments[0]); 251 } 252 else // If Pop-Up 253 { 254 myWindow.document.applets[0].changeStatusfromExpresso(arguments[0]); 255 } 256 } 257 catch(e) 258 { 259 if( confirm('Deseja conectar o IM ?') ) 260 showWindow(); 261 } 262 } 192 263 } 193 264 … … 225 296 var autoConnect = ''; 226 297 flagOpenIM = data; 227 298 228 299 if( data.indexOf(';') != -1) 229 300 { 230 301 var temp = data.split(';'); 231 302 autoConnect = flagOpenIM = temp[0]; 232 303 304 // Open as Pop-Up 233 305 flagOpenPopup = 'openWindowJabberitPopUp:false'; 234 306 … … 238 310 flagOpenPopup = temp[1]; 239 311 } 312 313 // Away 314 flagAwayIM = 'flagAwayIM:5'; 315 316 if( temp[2] ) 317 { 318 flagAwayIM = temp[2]; 319 } 240 320 } 241 321 else … … 243 323 autoConnect = flagOpenIM; 244 324 } 245 325 246 326 if( autoConnect == 'openWindowJabberit:true' ) 247 327 { … … 401 481 _splash.style.zIndex = '99999'; 402 482 _splash.style.border = '2px outset #000'; 483 _splash.onmouseout = function(){ _showhidden.hiddenObject(false); }; 484 _splash.onmouseover = function(){ _showhidden.hiddenObject(true); }; 403 485 404 486 for(var i = 0; i < orgPartExternal.length; i++) … … 415 497 { 416 498 var _win_preferences = _window.load('jabberit_preferences'); 417 _win_preferences.size( 320,250);499 _win_preferences.size(400,310); 418 500 _win_preferences.position(150,100); 419 501 _win_preferences.title('.:: Expresso - JMessenger '+jabberitGetLang('Preferences')+'::.'); … … 447 529 'lang7' : jabberitGetLang('Cancel'), 448 530 'lang8' : jabberitGetLang('Window'), 449 'lang9' : jabberitGetLang('Open as Pop-Up Window'), 531 'lang9' : jabberitGetLang('Open as Pop-Up Window'), 532 'lang10' : jabberitGetLang('Away'), 533 'lang11' : jabberitGetLang('Set status to away after'), 534 'lang12' : jabberitGetLang('minutes'), 450 535 'langYes': jabberitGetLang('Yes'), 451 'langNo' :jabberitGetLang('No')536 'langNo' : jabberitGetLang('No') 452 537 }; 453 538 _win_preferences.content(_xtools.parse(_xtools.xml('preferences_jabberit'), 'preferences_jabberit.xsl', _params)); … … 462 547 _win_preferences.size(320,250); 463 548 } 464 549 465 550 // Element openWindowJabberit 466 551 var value1 = flagOpenIM.split(':'); … … 472 557 element1.options[i].selected = true; 473 558 474 475 // Element userOfflineJabberit559 560 // Element openWindowJabberitPopUp 476 561 var value2 = flagOpenPopup.split(':'); 477 562 var element2 = document.getElementById(value2[0]); … … 481 566 if( element2.options[i].value == valueSelect2 ) 482 567 element2.options[i].selected = true; 568 569 // Element flagAwayIM 570 var value3 = flagAwayIM.split(':'); 571 var element3 = document.getElementById(value3[0]); 572 element3.value = value3[1]; 483 573 484 574 } … … 521 611 flagOpenPopup = 'openWindowJabberitPopUp:' + elementOpenPop.options[i].value; 522 612 } 523 613 614 // Element flagAwayIM 615 var elementFlagIM = document.getElementById('flagAwayIM'); 616 617 if( elementFlagIM.value.length > 0 && parseInt(elementFlagIM.value) > 0 ) 618 { 619 flagAwayIM = 'flagAwayIM:' + elementFlagIM.value; 620 value += '&preferences3=flagAwayIM:' + elementFlagIM.value; 621 } 622 else 623 { 624 alert(jabberitGetLang('Enter a value greater than or equal to 1!')); 625 return false; 626 } 627 524 628 _conn.go('$this.db_im.setPreferences', 525 629 function(data) … … 552 656 var _win_contacts = _window.get('jabberit_contacts'); 553 657 554 if( flagOpenPopup == 'openWindowJabberitPopUp:true' )658 if( flagOpenPopup === 'openWindowJabberitPopUp:true' ) 555 659 { 556 660 openPopup(); … … 575 679 } 576 680 681 function subMenuChangeStatus() 682 { 683 if(document.getElementById('subMenu_Change_Status_JabberIt') == null ) 684 { 685 var _itens = [ 686 ['Online', 'loadscript.chstatusJava("2")', 'available_jabberit.src'], 687 ['Free For Chat', 'loadscript.chstatusJava("1")', 'chat_jabberit.src'], 688 ['Xa', 'loadscript.chstatusJava("3")','xa_jabberit.src'], 689 ['Dnd', 'loadscript.chstatusJava("4")','dnd_jabberit.src'], 690 ['Away', 'loadscript.chstatusJava("5")','away_jabberit.src'], 691 ['Invisible', 'loadscript.chstatusJava("6")','invisible_jabberit.src'] 692 ]; 693 694 var _itensMenu = "<dl style='padding:1px !important; margin:2px 2px !important;font-size:8pt !important;background: #cecece;color: #000;'>"; 695 696 for(var i in _itens) 697 { 698 if( i == 5 ) 699 _itensMenu += "<dt onmouseover='elementOnMouseOver(this);' onmouseout='elementOnMouseOut(this, false);' style='cursor: pointer;' onclick=" + _itens[i][1] + ">"; 700 else 701 _itensMenu += "<dt onmouseover='elementOnMouseOver(this);' onmouseout='elementOnMouseOut(this, false);' style='cursor: pointer;border-bottom:1px solid #dedede;' onclick=" + _itens[i][1] + ">"; 702 _itensMenu += "<img src='" + eval(_itens[i][2]) + "' style='margin-right:3px;'/>" + jabberitGetLang(_itens[i][0]) + "</dt>"; 703 } 704 705 _itensMenu += "</dl>"; 706 707 var _subMenu_div = document.createElement("div"); 708 _subMenu_div.setAttribute('id','subMenu_Change_Status_JabberIt'); 709 _subMenu_div.style.margin = '-10px 5px 0px 0px'; 710 _subMenu_div.style.background = '#cecece'; 711 _subMenu_div.style.border = '1px dashed #000'; 712 _subMenu_div.style.float = 'left'; 713 _subMenu_div.style.position = 'absolute'; 714 _subMenu_div.style.left = '55px'; 715 _subMenu_div.style.width = '120px'; 716 _subMenu_div.style.zindex = '99999'; 717 _subMenu_div.innerHTML = _itensMenu; 718 719 var elementParent = document.getElementById('fast_menu_jabberit'); 720 elementParent.appendChild(_subMenu_div); 721 } 722 } 723 577 724 function Load() 578 725 { 579 726 addIcon(); 580 727 getPreferences(); 581 } 582 583 Load.prototype.adIcon = addIcon; 584 Load.prototype.cLabel = changeLabel; 585 Load.prototype.closeW = closeWindow; 728 729 // AutoStatus Away 730 autoStatus(); 731 configEvents(document, 'onmousemove', autoStatus); 732 configEvents(document, 'onkeypress', autoStatus); 733 } 734 735 Load.prototype.adIcon = addIcon; 736 Load.prototype.autoStatusIM = autoStatus; 737 Load.prototype.chstatusJava = changeStatusJava; 738 Load.prototype.closeW = closeWindow; 739 Load.prototype.cLabel = changeLabel; 586 740 Load.prototype.getElement = getElementStatus; 587 741 Load.prototype.keyPress = keyPressSearch; 588 742 Load.prototype.openWinParExt = openWindowParticipantsExternal; 589 Load.prototype.search = searchUser;590 Load.prototype.setPrefe = setPreferences;591 Load.prototype.show = showDiv;592 Load.prototype.showW = showWindow;593 743 Load.prototype.search = searchUser; 744 Load.prototype.setPrefe = setPreferences; 745 Load.prototype.show = showDiv; 746 Load.prototype.showW = showWindow; 747 594 748 window.loadscript = new Load; 595 749 596 750 })(); 751 752 // Functions OnMouseOver e OnMouseOut 753 754 function elementOnMouseOut() 755 { 756 if( arguments.length > 0 ) 757 { 758 var _element = arguments[0]; 759 _element.style.backgroundColor = ''; 760 _element.style.border = ''; 761 if( !arguments[1] ) 762 _element.style.borderBottom = '1px solid #dedede'; 763 } 764 } 765 766 function elementOnMouseOver() 767 { 768 if( arguments.length > 0 ) 769 { 770 var _element = arguments[0]; 771 _element.style.backgroundColor = 'white'; 772 _element.style.border = '1px solid black'; 773 } 774 } 775
Note: See TracChangeset
for help on using the changeset viewer.