[2670] | 1 | (function() |
---|
| 2 | { |
---|
[2696] | 3 | var _autoStatus; |
---|
| 4 | var _autoStatusTime = 60000; // 1 minuto |
---|
| 5 | var addUser = null; |
---|
| 6 | var conn = null; |
---|
[2670] | 7 | var fullName = ""; |
---|
| 8 | var path = ""; |
---|
[2696] | 9 | var _preferencesIM = ""; |
---|
[2670] | 10 | var selectEditable = null; |
---|
| 11 | var showhidden = null; |
---|
[2711] | 12 | var _statusMessage = ""; |
---|
[2696] | 13 | var timeoutId = null; |
---|
[2670] | 14 | var userCurrent = null; |
---|
| 15 | var Xtools = null; |
---|
| 16 | var zIndex = 9001; |
---|
[2750] | 17 | var windowPopUp = null; |
---|
[2670] | 18 | |
---|
| 19 | // Images |
---|
| 20 | var add_user = new Image(); |
---|
| 21 | add_user.src = path_jabberit + 'templates/default/images/adduser_azul.png'; |
---|
| 22 | |
---|
| 23 | var arrow_down = new Image(); |
---|
| 24 | arrow_down.src = path_jabberit + 'templates/default/images/arrow_down.gif'; |
---|
| 25 | |
---|
| 26 | var arrow_right = new Image(); |
---|
| 27 | arrow_right.src = path_jabberit + 'templates/default/images/arrow_right.gif'; |
---|
| 28 | |
---|
| 29 | function actionButton() |
---|
| 30 | { |
---|
| 31 | if( arguments.length > 0 ) |
---|
| 32 | { |
---|
| 33 | var e = arguments[0]; |
---|
| 34 | var _element = ( e.target ) ? e.target : e.srcElement; |
---|
| 35 | var jid = arguments[1]; |
---|
| 36 | var index = arguments[2]; |
---|
| 37 | var coord = null; |
---|
| 38 | |
---|
| 39 | if ( !e ) |
---|
| 40 | e = window.event; |
---|
| 41 | |
---|
| 42 | var _X = e.clientX + document.body.scrollLeft - document.body.clientLeft; |
---|
| 43 | var _Y = e.clientY + document.body.scrollTop - document.body.clientTop; |
---|
| 44 | |
---|
| 45 | coord = { X : _X, Y : _Y }; |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | var _onContextMenu = function() |
---|
| 49 | { |
---|
| 50 | return false; |
---|
| 51 | }; |
---|
| 52 | |
---|
| 53 | window.document.oncontextmenu = _onContextMenu; |
---|
| 54 | |
---|
| 55 | if( e.button ) |
---|
| 56 | { |
---|
| 57 | if( e.button > 1 ) |
---|
| 58 | optionsItensContact( jid, index, coord ); |
---|
| 59 | else |
---|
| 60 | TrophyIM.rosterClick(jid); |
---|
| 61 | } |
---|
| 62 | else if( e.which ) |
---|
| 63 | { |
---|
| 64 | if( e.which > 1 ) |
---|
| 65 | optionsItensContact( jid, index, coord ); |
---|
| 66 | else |
---|
| 67 | if( e.target.id ) |
---|
| 68 | TrophyIM.rosterClick(jid); |
---|
| 69 | } |
---|
| 70 | } |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | function addContact() |
---|
| 74 | { |
---|
| 75 | if( arguments.length > 0 ) |
---|
| 76 | addUser.add(); |
---|
| 77 | else |
---|
| 78 | addUser.show(); |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | function addIcon() |
---|
| 82 | { |
---|
[2689] | 83 | |
---|
| 84 | var div_write_msg = ( getElement('em_div_write_msg') != null ) ? getElement('em_div_write_msg') : null ; |
---|
| 85 | var StatusBar = ( getElement('divStatusBar') != null ) ? getElement('divStatusBar') : null ; |
---|
| 86 | var StatusBarIM = ( getElement('JabberMessenger') != null ) ? getElement('JabberMessenger') : null; |
---|
| 87 | |
---|
| 88 | /************************************************************************** |
---|
| 89 | * |
---|
| 90 | * Quando estiver habilitada a opção fora de escritório nos filtros. |
---|
| 91 | * |
---|
| 92 | */ |
---|
[2670] | 93 | |
---|
[2689] | 94 | if( ( div_write_msg && StatusBarIM ) != null ) |
---|
[2670] | 95 | { |
---|
[2689] | 96 | div_write_msg.parentNode.insertBefore(StatusBarIM, div_write_msg); |
---|
| 97 | StatusBarIM.style.paddingLeft = '33px'; |
---|
| 98 | return; |
---|
[2670] | 99 | } |
---|
[2711] | 100 | |
---|
[2689] | 101 | /**************************************************************************/ |
---|
[2670] | 102 | |
---|
[2689] | 103 | if ( !StatusBarIM ) |
---|
| 104 | { |
---|
| 105 | StatusBarIM = document.createElement('div'); |
---|
| 106 | StatusBarIM.setAttribute('id', 'JabberMessenger'); |
---|
| 107 | } |
---|
| 108 | |
---|
[2670] | 109 | if( StatusBar ) |
---|
| 110 | { |
---|
| 111 | StatusBar.style.paddingLeft = '33px'; |
---|
| 112 | |
---|
| 113 | var _div = document.createElement('div'); |
---|
| 114 | _div.appendChild(StatusBar.parentNode.removeChild(StatusBar.previousSibling)); |
---|
| 115 | |
---|
| 116 | StatusBar.parentNode.insertBefore( _div, StatusBar); |
---|
| 117 | |
---|
| 118 | var _fastMenu = top.document.createElement('div'); |
---|
| 119 | _fastMenu.setAttribute('id', 'fast_menu_jabber_expresso'); |
---|
| 120 | _fastMenu.style.background = 'no-repeat'; |
---|
| 121 | _fastMenu.style.backgroundImage = 'url(' + arrow_down.src + ')'; |
---|
| 122 | _fastMenu.style.float = 'left'; |
---|
| 123 | _fastMenu.style.height = '15px'; |
---|
| 124 | _fastMenu.style.left = '7px'; |
---|
| 125 | _fastMenu.style.margin = '8 0 0 10px'; |
---|
| 126 | _fastMenu.style.padding = '0px'; |
---|
| 127 | _fastMenu.style.position = 'absolute'; |
---|
| 128 | _fastMenu.style.width = '15px'; |
---|
| 129 | _fastMenu.style.cursor = 'pointer'; |
---|
| 130 | |
---|
[2689] | 131 | StatusBarIM.insertBefore( _fastMenu, StatusBarIM.firstChild ); |
---|
[2670] | 132 | |
---|
| 133 | // Add event onclick element _fastMenu |
---|
| 134 | configEvents( _fastMenu, 'onclick', function(){ fastMenu(_fastMenu); }); |
---|
| 135 | |
---|
| 136 | var _statusJabber = top.document.createElement('div'); |
---|
| 137 | _statusJabber.setAttribute('id','status_jabber_expresso'); |
---|
| 138 | _statusJabber.style.background = 'no-repeat'; |
---|
| 139 | _statusJabber.style.backgroundImage = 'url(' + add_user.src +')'; |
---|
| 140 | _statusJabber.style.float = 'left'; |
---|
| 141 | _statusJabber.style.height = '18px'; |
---|
| 142 | _statusJabber.style.left = '19px'; |
---|
| 143 | _statusJabber.style.margin = '0 0 0 10px'; |
---|
| 144 | _statusJabber.style.padding = '0px'; |
---|
| 145 | _statusJabber.style.position = 'absolute'; |
---|
| 146 | _statusJabber.style.width = '18px'; |
---|
| 147 | _statusJabber.style.cursor = 'pointer'; |
---|
| 148 | _statusJabber.style.zindex = '999999'; |
---|
| 149 | |
---|
[2689] | 150 | StatusBarIM.insertBefore( _statusJabber, StatusBarIM.firstChild ); |
---|
[2670] | 151 | |
---|
[2689] | 152 | StatusBar.insertBefore( StatusBarIM, StatusBar.firstChild ); |
---|
[2670] | 153 | |
---|
| 154 | // Add event onclick element _statusJabber |
---|
| 155 | configEvents( _statusJabber, 'onclick', function(){ TrophyIM.load();}); |
---|
| 156 | } |
---|
| 157 | } |
---|
| 158 | |
---|
[2696] | 159 | function autoStatus() |
---|
| 160 | { |
---|
| 161 | var _div_status = ( getElement('status_jabber_expresso') != null ) ? getElement('status_jabber_expresso') : null; |
---|
| 162 | |
---|
| 163 | if ( _autoStatus ) |
---|
| 164 | clearTimeout(_autoStatus); |
---|
| 165 | |
---|
| 166 | if ( _div_status != null ) |
---|
| 167 | { |
---|
| 168 | var _status = _div_status.style.backgroundImage; |
---|
| 169 | _status = _status.substr(_status.lastIndexOf('/') + 1); |
---|
| 170 | _status = _status.substr(0, _status.indexOf('.')); |
---|
| 171 | |
---|
| 172 | if( _status == "xa" ) |
---|
| 173 | { |
---|
[2711] | 174 | if( getStatusMessage() != "") |
---|
| 175 | TrophyIM.setPresence("available", getStatusMessage()); |
---|
| 176 | else |
---|
| 177 | TrophyIM.setPresence("available"); |
---|
| 178 | |
---|
[2696] | 179 | loadscript.setStatusJabber("Disponível","available"); |
---|
| 180 | } |
---|
| 181 | } |
---|
| 182 | |
---|
| 183 | var TimeStatus = _preferencesIM[2].split(':'); |
---|
| 184 | |
---|
| 185 | if( TimeStatus[1] ) |
---|
| 186 | _autoStatus = setTimeout( function(){ autoStatusHandler();}, parseInt(TimeStatus[1]) * _autoStatusTime ); |
---|
| 187 | else |
---|
| 188 | _autoStatus = setTimeout( function(){ autoStatusHandler();}, parseInt(_autoStatusTime)); |
---|
| 189 | } |
---|
| 190 | |
---|
| 191 | function autoStatusHandler() |
---|
| 192 | { |
---|
| 193 | var _div_status = ( getElement('status_jabber_expresso') != null ) ? getElement('status_jabber_expresso') : null; |
---|
| 194 | |
---|
| 195 | if ( _div_status != null ) |
---|
| 196 | { |
---|
| 197 | var _status = _div_status.style.backgroundImage; |
---|
| 198 | _status = _status.substr(_status.lastIndexOf('/') + 1); |
---|
| 199 | _status = _status.substr(0, _status.indexOf('.')); |
---|
| 200 | |
---|
| 201 | if( _status == "available" ) |
---|
| 202 | { |
---|
[2711] | 203 | if(getStatusMessage() != "") |
---|
| 204 | TrophyIM.setPresence("xa", getStatusMessage()); |
---|
| 205 | else |
---|
| 206 | TrophyIM.setPresence("xa"); |
---|
| 207 | |
---|
[2696] | 208 | loadscript.setStatusJabber("Não Disponível","xa"); |
---|
| 209 | } |
---|
| 210 | } |
---|
| 211 | } |
---|
| 212 | |
---|
[2670] | 213 | function clrAllContacts() |
---|
| 214 | { |
---|
| 215 | getElement("JabberIMRoster").innerHTML = ""; |
---|
| 216 | } |
---|
| 217 | |
---|
| 218 | function configEvents(pObj, pEvent, pHandler) |
---|
| 219 | { |
---|
| 220 | if ( typeof pObj == 'object' ) |
---|
| 221 | { |
---|
| 222 | if ( pEvent.substring(0, 2) == 'on' ) |
---|
| 223 | pEvent = pEvent.substring(2, pEvent.length); |
---|
| 224 | |
---|
| 225 | if ( pObj.addEventListener ) |
---|
| 226 | pObj.addEventListener(pEvent, pHandler, false); |
---|
| 227 | else if ( pObj.attachEvent ) |
---|
| 228 | pObj.attachEvent('on' + pEvent, pHandler); |
---|
| 229 | } |
---|
| 230 | } |
---|
| 231 | |
---|
| 232 | function fastMenu() |
---|
| 233 | { |
---|
| 234 | if( arguments.length > 0 ) |
---|
| 235 | { |
---|
| 236 | var element = arguments[0]; |
---|
| 237 | |
---|
| 238 | if( showhidden == null ) |
---|
| 239 | showhidden = new ShowHidden(300); |
---|
| 240 | |
---|
| 241 | var _options = [ |
---|
| 242 | ['Adicionar Contato', 'loadscript.addContact();' ], |
---|
| 243 | ['Ajuda', 'alert("2")' ], |
---|
[2696] | 244 | ['Preferências', 'loadscript.preferences();'], |
---|
[2670] | 245 | ]; |
---|
| 246 | |
---|
| 247 | var _itens = ""; |
---|
| 248 | |
---|
| 249 | for( var i in _options ) |
---|
| 250 | { |
---|
| 251 | if( _options[i].constructor == Function ) |
---|
| 252 | continue; |
---|
| 253 | |
---|
[2672] | 254 | _itens += '<img src="'+arrow_right.src+'"/>'; |
---|
| 255 | _itens += '<span style="cursor:pointer; margin:3px;" onclick='+_options[i][1]+'>'; |
---|
| 256 | _itens += _options[i][0] + '</span><br/>'; |
---|
[2670] | 257 | } |
---|
| 258 | |
---|
| 259 | var _optionsItens = document.createElement("div"); |
---|
| 260 | _optionsItens.id = "fastMenu_Jabber"; |
---|
| 261 | _optionsItens.style.marginTop = "19px"; |
---|
| 262 | _optionsItens.style.marginLeft = "-8px"; |
---|
| 263 | _optionsItens.className = "x-menu"; |
---|
| 264 | _optionsItens.style.zIndex = '999999'; |
---|
| 265 | _optionsItens.innerHTML = _itens; |
---|
| 266 | _optionsItens.onclick = function(){ showhidden.hiddenObject(false); }; |
---|
| 267 | _optionsItens.onmouseout = function(){ showhidden.hiddenObject(false); }; |
---|
| 268 | _optionsItens.onmouseover = function(){ showhidden.hiddenObject(true); }; |
---|
| 269 | |
---|
| 270 | showhidden.action('onmouseover', 'onmouseout', _optionsItens); |
---|
| 271 | |
---|
| 272 | element.parentNode.appendChild( _optionsItens ); |
---|
| 273 | } |
---|
| 274 | } |
---|
| 275 | |
---|
| 276 | function getElement( elementId ) |
---|
| 277 | { |
---|
| 278 | return document.getElementById( elementId ); |
---|
| 279 | } |
---|
| 280 | |
---|
| 281 | function getPhotoUser( jid ) |
---|
| 282 | { |
---|
| 283 | var _divPhoto = getElement( jid + '__photo' ); |
---|
| 284 | |
---|
| 285 | if( _divPhoto.style.backgroundImage.indexOf('photo.png') > 0 ) |
---|
| 286 | { |
---|
| 287 | var _imgUser = path_jabberit + 'inc/WebService.php?' + Date.parse( new Date ); |
---|
| 288 | _imgUser += '&photo_ldap=' + jid; |
---|
| 289 | |
---|
| 290 | _divPhoto.style.backgroundImage = 'url(' + _imgUser + ')'; |
---|
| 291 | } |
---|
| 292 | } |
---|
| 293 | |
---|
[2711] | 294 | function getStatusMessage() |
---|
| 295 | { |
---|
| 296 | return _statusMessage; |
---|
| 297 | } |
---|
| 298 | |
---|
[2706] | 299 | function getShowContactsOffline() |
---|
| 300 | { |
---|
| 301 | if( _preferencesIM[3] ) |
---|
| 302 | { |
---|
| 303 | var showOffline = _preferencesIM[3].split(":"); |
---|
| 304 | |
---|
| 305 | if( showOffline[1] === "true") |
---|
| 306 | return true; |
---|
| 307 | else |
---|
| 308 | return false; |
---|
| 309 | } |
---|
| 310 | |
---|
| 311 | return true; |
---|
| 312 | } |
---|
| 313 | |
---|
[2670] | 314 | function getUserCurrent() |
---|
| 315 | { |
---|
| 316 | return userCurrent; |
---|
| 317 | } |
---|
| 318 | |
---|
| 319 | function getZindex() |
---|
| 320 | { |
---|
| 321 | return zIndex++; |
---|
| 322 | } |
---|
| 323 | |
---|
| 324 | function groupsHidden() |
---|
| 325 | { |
---|
| 326 | if( arguments.length > 0 ) |
---|
| 327 | { |
---|
| 328 | var _element = arguments[0]; |
---|
| 329 | _element.style.background = "url('"+path_jabberit+"templates/default/images/arrow_right.gif') no-repeat center left"; |
---|
| 330 | _element.onclick = function(){ groupsVisible(_element);}; |
---|
| 331 | |
---|
| 332 | // Hidden all |
---|
| 333 | var _elementNext = _element.nextSibling; |
---|
| 334 | |
---|
| 335 | while( _elementNext ) |
---|
| 336 | { |
---|
| 337 | if( _elementNext.nodeType == 1 ) |
---|
| 338 | _elementNext.style.display = "none"; |
---|
| 339 | |
---|
| 340 | _elementNext = _elementNext.nextSibling; |
---|
| 341 | } |
---|
| 342 | } |
---|
| 343 | } |
---|
| 344 | |
---|
| 345 | function groupsVisible() |
---|
| 346 | { |
---|
| 347 | if( arguments.length > 0 ) |
---|
| 348 | { |
---|
| 349 | var _element = arguments[0]; |
---|
| 350 | _element.style.background = "url('"+path_jabberit+"templates/default/images/arrow_down.gif') no-repeat center left"; |
---|
| 351 | _element.onclick = function(){ groupsHidden(_element);}; |
---|
| 352 | |
---|
| 353 | // Display all |
---|
| 354 | var _elementNext = _element.nextSibling; |
---|
| 355 | |
---|
| 356 | while( _elementNext ) |
---|
| 357 | { |
---|
[2750] | 358 | if( _elementNext.nodeType == 1 && _elementNext.nodeName.toLowerCase() == "div" ) |
---|
[2706] | 359 | { |
---|
| 360 | var is_off = _elementNext.style.backgroundImage.indexOf("unavailable"); |
---|
[2670] | 361 | |
---|
[2750] | 362 | if( is_off > 0 && !getShowContactsOffline()) |
---|
| 363 | { |
---|
[2706] | 364 | _elementNext.style.display = "none"; |
---|
[2750] | 365 | getElement("span_show_" + _elementNext.id ).style.display = "none"; |
---|
| 366 | |
---|
| 367 | } |
---|
[2706] | 368 | else |
---|
[2750] | 369 | { |
---|
[2706] | 370 | _elementNext.style.display = "block"; |
---|
[2750] | 371 | getElement("span_show_" + _elementNext.id ).style.display = "block"; |
---|
| 372 | } |
---|
[2706] | 373 | } |
---|
| 374 | |
---|
[2670] | 375 | _elementNext = _elementNext.nextSibling; |
---|
| 376 | } |
---|
| 377 | } |
---|
| 378 | } |
---|
| 379 | |
---|
| 380 | function keyPressSearch() |
---|
| 381 | { |
---|
| 382 | if( arguments.length > 0 ) |
---|
| 383 | { |
---|
| 384 | var ev = arguments[0]; |
---|
| 385 | var element = arguments[1]; |
---|
| 386 | |
---|
| 387 | if ( ev.keyCode == 13 ) |
---|
| 388 | if( element.value.length >= 3 ) |
---|
| 389 | searchUser( element.value ); |
---|
| 390 | else |
---|
| 391 | alert('Your search argument must be longer than 3 characters.'); |
---|
| 392 | } |
---|
| 393 | } |
---|
| 394 | |
---|
| 395 | |
---|
| 396 | function loginPage() |
---|
| 397 | { |
---|
| 398 | var winLoginPage = |
---|
| 399 | { |
---|
| 400 | id_window : "window_login_page", |
---|
| 401 | width : 260, |
---|
| 402 | height : 150, |
---|
| 403 | top : 100, |
---|
| 404 | left : 400, |
---|
| 405 | draggable : true, |
---|
| 406 | visible : "display", |
---|
| 407 | resizable : true, |
---|
| 408 | zindex : zIndex++, |
---|
| 409 | title : "Expresso Messenger - Login", |
---|
| 410 | closeAction : "remove", |
---|
| 411 | content : Xtools.parse(Xtools.xml("login_page"), "loginPage.xsl") |
---|
| 412 | }; |
---|
| 413 | |
---|
| 414 | _winBuild( winLoginPage ); |
---|
| 415 | } |
---|
| 416 | |
---|
| 417 | function loadScripts(pFiles) |
---|
| 418 | { |
---|
| 419 | // Load JavaScript |
---|
| 420 | var loadJavaScript = function(pJs) |
---|
| 421 | { |
---|
| 422 | var newScript = document.createElement("script"); |
---|
| 423 | newScript.setAttribute("type", "text/javascript"); |
---|
| 424 | newScript.setAttribute("src", pJs ); |
---|
| 425 | |
---|
| 426 | return newScript; |
---|
| 427 | }; |
---|
| 428 | |
---|
| 429 | // Load CSS |
---|
| 430 | var loadStyleSheet = function(pCss) |
---|
| 431 | { |
---|
| 432 | var newStyle = document.createElement("link"); |
---|
| 433 | newStyle.setAttribute("rel", "stylesheet"); |
---|
| 434 | newStyle.setAttribute("type", "text/css"); |
---|
| 435 | newStyle.setAttribute("href", pCss); |
---|
| 436 | |
---|
| 437 | return newStyle; |
---|
| 438 | }; |
---|
| 439 | |
---|
| 440 | for(var i = 0; i < pFiles.length; i++) |
---|
| 441 | { |
---|
| 442 | if( pFiles[i].indexOf(".js") > -1 ) |
---|
| 443 | document.getElementsByTagName("head")[0].appendChild(loadJavaScript(pFiles[i])); |
---|
| 444 | |
---|
| 445 | if( pFiles[i].indexOf(".css") > -1 ) |
---|
| 446 | document.getElementsByTagName("head")[0].appendChild(loadStyleSheet(pFiles[i])); |
---|
| 447 | } |
---|
| 448 | } |
---|
| 449 | |
---|
| 450 | function notificationNewMessage() |
---|
| 451 | { |
---|
| 452 | var oldTitle = document.title; |
---|
| 453 | var newTitle = "## NOVA MENSAGEM ##"; |
---|
| 454 | var idWindow = arguments[1]; |
---|
| 455 | |
---|
| 456 | if( timeoutId == null ) |
---|
| 457 | { |
---|
| 458 | timeoutId = setInterval(function() |
---|
| 459 | { |
---|
| 460 | document.title = ( document.title == newTitle ) ? oldTitle : newTitle; |
---|
| 461 | }, 1000); |
---|
| 462 | |
---|
| 463 | configEvents( window.document, 'onclick', function() |
---|
| 464 | { |
---|
| 465 | clearInterval(timeoutId); |
---|
| 466 | document.title = oldTitle; |
---|
| 467 | timeoutId = null; |
---|
| 468 | }); |
---|
| 469 | |
---|
| 470 | configEvents( window.document, 'onkeypress', function() |
---|
| 471 | { |
---|
| 472 | clearInterval(timeoutId); |
---|
| 473 | document.title = oldTitle; |
---|
| 474 | timeoutId = null; |
---|
| 475 | }); |
---|
| 476 | } |
---|
| 477 | } |
---|
| 478 | |
---|
| 479 | function optionsItensContact() |
---|
| 480 | { |
---|
| 481 | if( arguments.length > 0 ) |
---|
| 482 | { |
---|
| 483 | var jid = arguments[0]; |
---|
| 484 | var index = arguments[1]; |
---|
| 485 | var coord = arguments[2]; |
---|
| 486 | var element = getElement('itenContact_' + jid + '_' + index ); |
---|
| 487 | var action = ( element.getAttribute("subscription") === "not-in-roster" ) ? "Adicionar" : "Autorizar"; |
---|
| 488 | |
---|
| 489 | if( showhidden == null ) |
---|
| 490 | showhidden = new ShowHidden(300); |
---|
| 491 | |
---|
| 492 | var _options = [ |
---|
| 493 | [ action , 'loadscript.setAutorization(\''+jid+'\',\''+index+'\')'], |
---|
| 494 | ['Remover' , 'loadscript.removeContact(\''+jid+'\',\''+index+'\')'], |
---|
| 495 | ['Renomear' , 'loadscript.renameContact(\''+jid+'\',\''+index+'\')'], |
---|
| 496 | ['Trocar grupo' , 'loadscript.renameGroup(\''+jid+'\',\''+index+'\')'] |
---|
| 497 | ]; |
---|
| 498 | |
---|
| 499 | var _itens = ""; |
---|
| 500 | |
---|
| 501 | for( var i in _options ) |
---|
| 502 | { |
---|
| 503 | if( typeof(_options[i]) == "object") |
---|
| 504 | { |
---|
| 505 | _itens += '<img src="'+arrow_right.src+'"/>'; |
---|
| 506 | _itens += '<span style="cursor:pointer;margin:3px;font-weight:normal;" onclick='+_options[i][1]+'>'; |
---|
| 507 | _itens += _options[i][0] + '</span><br/>'; |
---|
| 508 | } |
---|
| 509 | } |
---|
| 510 | |
---|
| 511 | var _optionsItens = document.createElement("div"); |
---|
| 512 | _optionsItens.className = "x-menu"; |
---|
| 513 | _optionsItens.style.top = coord.Y; |
---|
| 514 | _optionsItens.style.left = ( coord.X - element.offsetLeft ); |
---|
| 515 | _optionsItens.style.zIndex = getZindex(); |
---|
| 516 | _optionsItens.innerHTML = _itens; |
---|
| 517 | _optionsItens.onclick = function(){ showhidden.hiddenObject(false); }; |
---|
| 518 | _optionsItens.onmouseout = function(){ showhidden.hiddenObject(false); }; |
---|
| 519 | _optionsItens.onmouseover = function(){ showhidden.hiddenObject(true); }; |
---|
| 520 | |
---|
| 521 | showhidden.action('onmouseover', 'onmouseout', _optionsItens); |
---|
| 522 | |
---|
| 523 | window.document.body.appendChild(_optionsItens); |
---|
| 524 | |
---|
| 525 | |
---|
| 526 | setTimeout(function() |
---|
| 527 | { |
---|
| 528 | window.document.oncontextmenu = function() |
---|
| 529 | { |
---|
| 530 | return true; |
---|
| 531 | }; |
---|
| 532 | |
---|
| 533 | },500); |
---|
| 534 | } |
---|
| 535 | } |
---|
| 536 | |
---|
| 537 | function parse() |
---|
| 538 | { |
---|
| 539 | if( arguments.length == 2 ) |
---|
| 540 | return Xtools.parse(Xtools.xml(arguments[0]), arguments[1] ); |
---|
| 541 | |
---|
| 542 | if( arguments.length === 3 ) |
---|
| 543 | return Xtools.parse(Xtools.xml(arguments[0]), arguments[1], arguments[2] ); |
---|
| 544 | } |
---|
| 545 | |
---|
[2696] | 546 | function preferences() |
---|
| 547 | { |
---|
| 548 | var paramPreferences = |
---|
| 549 | { |
---|
| 550 | 'path' : path, |
---|
| 551 | 'lang1' : 'Suas Preferências', |
---|
| 552 | 'lang2' : 'Conexão', |
---|
| 553 | 'lang3' : 'Conectar Automaticamente o IM', |
---|
| 554 | 'lang4' : 'Usuários OffLine', |
---|
| 555 | 'lang5' : 'Exibir amigos Offline', |
---|
| 556 | 'lang6' : 'Salvar', |
---|
| 557 | 'lang7' : 'Cancelar', |
---|
| 558 | 'lang8' : 'Janela de Contatos', |
---|
| 559 | 'lang9' : 'Abrir janela como Pop-up', |
---|
| 560 | 'lang10' : 'Ausente', |
---|
| 561 | 'lang11' : 'Definir status de ausente depois de', |
---|
[2706] | 562 | 'lang12' : 'minutos', |
---|
| 563 | 'lang13' : 'Mostrar Contatos', |
---|
| 564 | 'lang14' : 'Mostrar contatos desconectados', |
---|
[2696] | 565 | 'langYes': 'Sim', |
---|
| 566 | 'langNo' : 'Não' |
---|
| 567 | }; |
---|
| 568 | |
---|
| 569 | |
---|
| 570 | var _win_preferences = |
---|
| 571 | { |
---|
| 572 | id_window : "jabberit_preferences", |
---|
| 573 | width : 430, |
---|
[2706] | 574 | height : 410, |
---|
[2696] | 575 | top : 150, |
---|
| 576 | left : 100, |
---|
| 577 | draggable : true, |
---|
| 578 | visible : "display", |
---|
| 579 | resizable : true, |
---|
| 580 | zindex : zIndex++, |
---|
| 581 | title : 'Expresso Messenger - Preferências', |
---|
| 582 | closeAction : "remove", |
---|
| 583 | content : Xtools.parse(Xtools.xml('preferences'), 'preferences.xsl', paramPreferences) |
---|
| 584 | }; |
---|
| 585 | |
---|
| 586 | _winBuild(_win_preferences); |
---|
| 587 | |
---|
| 588 | |
---|
| 589 | var _pButtons = { |
---|
| 590 | 'lang1' : 'Salvar', |
---|
| 591 | 'lang2' : 'Fechar', |
---|
| 592 | 'onclickClose' : '_winBuild("jabberit_preferences","remove");', |
---|
| 593 | 'onclickSubmit' : 'javascript:loadscript.setPreferences();' |
---|
| 594 | }; |
---|
| 595 | |
---|
| 596 | document.getElementById('buttons_preferences_jabberit').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons); |
---|
| 597 | |
---|
| 598 | // Element openWindowJabberit |
---|
| 599 | var value1 = _preferencesIM[0].split(':'); |
---|
| 600 | var element1 = document.getElementById(value1[0]); |
---|
| 601 | var valueSelect1 = value1[1]; |
---|
| 602 | |
---|
| 603 | for(var i = 0; i < element1.options.length; i++) |
---|
| 604 | if( element1.options[i].value == valueSelect1 ) |
---|
| 605 | element1.options[i].selected = true; |
---|
| 606 | |
---|
| 607 | // Element openWindowJabberitPopUp |
---|
| 608 | var value2 = _preferencesIM[1].split(':'); |
---|
| 609 | var element2 = document.getElementById(value2[0]); |
---|
| 610 | var valueSelect2 = value2[1]; |
---|
| 611 | |
---|
| 612 | for(var i = 0; i < element2.options.length; i++) |
---|
| 613 | if( element2.options[i].value == valueSelect2 ) |
---|
| 614 | element2.options[i].selected = true; |
---|
| 615 | |
---|
| 616 | // Element flagAwayIM |
---|
| 617 | var value3 = _preferencesIM[2].split(':'); |
---|
| 618 | var element3 = document.getElementById(value3[0]); |
---|
| 619 | element3.value = value3[1]; |
---|
[2706] | 620 | |
---|
| 621 | // Element showContactsOfflineJabberit |
---|
| 622 | var value4 = _preferencesIM[3].split(':'); |
---|
| 623 | var element4 = document.getElementById(value4[0]); |
---|
| 624 | var valueSelect4 = value4[1]; |
---|
| 625 | for(var i = 0; i < element4.options.length; i++) |
---|
| 626 | if( element4.options[i].value == valueSelect4 ) |
---|
| 627 | element4.options[i].selected = true; |
---|
[2696] | 628 | } |
---|
| 629 | |
---|
[2670] | 630 | function removeContact(jid, index) |
---|
| 631 | { |
---|
| 632 | setTimeout(function() |
---|
| 633 | { |
---|
| 634 | TrophyIM.removeContact(jid, index); |
---|
| 635 | |
---|
| 636 | },300); |
---|
| 637 | } |
---|
| 638 | |
---|
| 639 | function removeElement( ) |
---|
| 640 | { |
---|
| 641 | if( arguments.length > 0 ) |
---|
| 642 | { |
---|
| 643 | var _element = arguments[0] |
---|
| 644 | var _parent = _element.parentNode; |
---|
| 645 | |
---|
| 646 | _parent.removeChild( _element ); |
---|
| 647 | } |
---|
| 648 | } |
---|
| 649 | |
---|
| 650 | function removeGroup() |
---|
| 651 | { |
---|
| 652 | var _parent = arguments[0]; |
---|
| 653 | |
---|
| 654 | if( _parent.childNodes.length <= 2 ) |
---|
| 655 | _parent.parentNode.removeChild(_parent); |
---|
| 656 | } |
---|
| 657 | |
---|
| 658 | function renameContact() |
---|
| 659 | { |
---|
| 660 | if( arguments.length > 0 ) |
---|
| 661 | { |
---|
| 662 | var _jid = arguments[0]; |
---|
| 663 | var _index = arguments[1]; |
---|
| 664 | |
---|
| 665 | TrophyIM.renameContact( _jid, _index ); |
---|
| 666 | } |
---|
| 667 | } |
---|
| 668 | |
---|
| 669 | function renameGroup() |
---|
| 670 | { |
---|
| 671 | if( arguments.length > 0 ) |
---|
| 672 | { |
---|
| 673 | var _jid = arguments[0]; |
---|
| 674 | var _index = arguments[1]; |
---|
| 675 | |
---|
| 676 | TrophyIM.renameGroup( _jid , _index ); |
---|
| 677 | } |
---|
| 678 | } |
---|
| 679 | |
---|
| 680 | function rosterDiv() |
---|
| 681 | { |
---|
[2750] | 682 | var _popUp = (_preferencesIM[1]).split(":"); |
---|
| 683 | |
---|
[2670] | 684 | var paramListContact = |
---|
| 685 | { |
---|
| 686 | 'idUser' : Base64.decode(getUserCurrent().jid), |
---|
| 687 | 'full_name' : (( fullName.length < 25 ) ? fullName : ( fullName.substring( 0, 25) + "...")), |
---|
| 688 | 'path_jabberit' : path_jabberit, |
---|
| 689 | 'zIndex_' : zIndex++ |
---|
| 690 | }; |
---|
[2750] | 691 | |
---|
[2670] | 692 | var winRosterDiv = |
---|
| 693 | { |
---|
| 694 | id_window : "window_Roster_im", |
---|
| 695 | width : 250, |
---|
| 696 | height : 410, |
---|
| 697 | top : 50, |
---|
[2750] | 698 | left : -1500, |
---|
| 699 | leftOld : 50, |
---|
[2670] | 700 | draggable : true, |
---|
| 701 | visible : "display", |
---|
| 702 | resizable : true, |
---|
| 703 | zindex : zIndex++, |
---|
| 704 | title : "Expresso Messenger - Contatos", |
---|
| 705 | closeAction : "hidden", |
---|
| 706 | content : Xtools.parse(Xtools.xml("contacts_list"),"contactsList.xsl", paramListContact) |
---|
| 707 | }; |
---|
| 708 | |
---|
[2750] | 709 | if( _preferencesIM[0] == "openWindowJabberit:false" ) |
---|
| 710 | { |
---|
| 711 | winRosterDiv.left = 50; |
---|
| 712 | winRosterDiv.leftOld = -1500; |
---|
| 713 | } |
---|
| 714 | |
---|
[2670] | 715 | _winBuild( winRosterDiv ); |
---|
[2750] | 716 | |
---|
[2670] | 717 | // Photo User |
---|
| 718 | getPhotoUser(Base64.decode(getUserCurrent().jid)); |
---|
[2750] | 719 | |
---|
[2670] | 720 | } |
---|
| 721 | |
---|
| 722 | function searchUser() |
---|
| 723 | { |
---|
| 724 | var _input = getElement('search_user_jabber'); |
---|
| 725 | |
---|
| 726 | if( _input.value.length >= 3 ) |
---|
| 727 | addUser.search(); |
---|
| 728 | else |
---|
| 729 | alert('Your search argument must be longer than 3 characters.'); |
---|
| 730 | } |
---|
| 731 | |
---|
| 732 | function setAutorization(jidTo, indexTo) |
---|
| 733 | { |
---|
| 734 | var divItenContact = null; |
---|
| 735 | |
---|
| 736 | if( ( divItenContact = getElement('itenContact_' + jidTo + '_' + indexTo ))) |
---|
| 737 | { |
---|
| 738 | var subscription = divItenContact.getAttribute('subscription'); |
---|
| 739 | |
---|
| 740 | switch(subscription) |
---|
| 741 | { |
---|
| 742 | case 'from': |
---|
| 743 | |
---|
| 744 | TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribe'); |
---|
| 745 | break; |
---|
| 746 | |
---|
| 747 | case 'none' : |
---|
| 748 | |
---|
| 749 | TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribe'); |
---|
| 750 | TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribed'); |
---|
| 751 | |
---|
| 752 | break; |
---|
| 753 | |
---|
| 754 | case 'not-in-roster': |
---|
| 755 | |
---|
| 756 | setTimeout(function() |
---|
| 757 | { |
---|
| 758 | var _add = ""; |
---|
| 759 | |
---|
| 760 | if( ( _add = confirm("Deseja adicionar o usuario!")) ) |
---|
| 761 | { |
---|
| 762 | addUser.add( jidTo, indexTo ); |
---|
| 763 | } |
---|
| 764 | |
---|
| 765 | },100); |
---|
| 766 | |
---|
| 767 | break; |
---|
| 768 | |
---|
| 769 | case 'to' : |
---|
| 770 | |
---|
| 771 | TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribed'); |
---|
| 772 | |
---|
| 773 | case 'subscribe' : |
---|
| 774 | |
---|
| 775 | TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribe'); |
---|
| 776 | |
---|
| 777 | break; |
---|
| 778 | } |
---|
| 779 | } |
---|
| 780 | } |
---|
| 781 | |
---|
[2711] | 782 | function setMessageStatus() |
---|
| 783 | { |
---|
| 784 | if( arguments.length > 0 ) |
---|
| 785 | { |
---|
| 786 | var _element = arguments[0]; |
---|
| 787 | var _parent = _element.parentNode; |
---|
| 788 | |
---|
| 789 | if( _element.nodeName.toLowerCase() == "label") |
---|
| 790 | { |
---|
| 791 | var _input = document.createElement("input"); |
---|
| 792 | _input.size = "35"; |
---|
| 793 | _input.maxlength = "35"; |
---|
| 794 | _input.style.border = "0"; |
---|
| 795 | _input.value = _element.innerHTML; |
---|
| 796 | |
---|
| 797 | // OnkeyUp |
---|
| 798 | configEvents( _input, "onkeyup", function(e) |
---|
| 799 | { |
---|
| 800 | if( e.keyCode == 13 ) loadscript.setMessageStatus(_input, _element); |
---|
| 801 | } |
---|
| 802 | ); |
---|
| 803 | |
---|
| 804 | // Onblur |
---|
| 805 | configEvents(_input, "onblur", function(){ loadscript.setMessageStatus(_input, _element)}); |
---|
| 806 | |
---|
| 807 | |
---|
| 808 | if( _parent != null ) |
---|
| 809 | { |
---|
| 810 | // Remove label |
---|
| 811 | if( _element != null ) |
---|
| 812 | _parent.removeChild( _element ); |
---|
| 813 | |
---|
| 814 | // Add Input |
---|
| 815 | if( _input != null ) |
---|
| 816 | _parent.appendChild( _input ); |
---|
| 817 | } |
---|
| 818 | |
---|
| 819 | _input.focus(); |
---|
| 820 | _input.select(); |
---|
| 821 | } |
---|
| 822 | else |
---|
| 823 | { |
---|
| 824 | var _label = arguments[1]; |
---|
| 825 | _statusMessage = _element.value.replace(/^\(+|\)+$/g,""); |
---|
| 826 | |
---|
| 827 | if( ( _statusMessage = _statusMessage.replace(/^\s+|\s+$|^\n|\n$/g,"") ) != "") |
---|
| 828 | _label.innerHTML = "( " + _statusMessage + " )"; |
---|
| 829 | else |
---|
| 830 | _label.innerHTML = "( Digite aqui sua mensagem de Status )"; |
---|
| 831 | |
---|
| 832 | if( _parent != null ) |
---|
| 833 | { |
---|
| 834 | // Remove Input |
---|
| 835 | if( _element != null ) |
---|
| 836 | _parent.removeChild( _element ); |
---|
| 837 | |
---|
| 838 | // Add Label |
---|
| 839 | if( _label != null ) |
---|
| 840 | _parent.appendChild( _label ); |
---|
| 841 | } |
---|
| 842 | |
---|
| 843 | // Send Status Message |
---|
[2736] | 844 | _statusMessage = ( ( _statusMessage != "Digite aqui sua mensagem de Status") ? _statusMessage : "" ); |
---|
| 845 | |
---|
[2711] | 846 | TrophyIM.setPresence("status", _statusMessage ); |
---|
| 847 | } |
---|
| 848 | } |
---|
| 849 | } |
---|
[2696] | 850 | |
---|
| 851 | function setPreferences() |
---|
| 852 | { |
---|
| 853 | // Element openWindowJabberit |
---|
| 854 | var elementOpenW = document.getElementById('openWindowJabberit'); |
---|
| 855 | var value = ''; |
---|
| 856 | var flagReload = false; |
---|
| 857 | |
---|
| 858 | for(var i = 0 ; i < elementOpenW.options.length; i++) |
---|
| 859 | if( elementOpenW.options[i].selected == true) |
---|
| 860 | { |
---|
| 861 | value = 'preferences1=openWindowJabberit:' + elementOpenW.options[i].value; |
---|
| 862 | _preferencesIM[0] = 'openWindowJabberit:' + elementOpenW.options[i].value; |
---|
| 863 | } |
---|
| 864 | |
---|
| 865 | // Element openWindowJabberitPopUp |
---|
| 866 | var elementOpenPop = document.getElementById('openWindowJabberitPopUp'); |
---|
| 867 | |
---|
| 868 | for(var i = 0; i < elementOpenPop.options.length; i++ ) |
---|
| 869 | if( elementOpenPop.options[i].selected == true ) |
---|
| 870 | { |
---|
| 871 | value += '&preferences2=openWindowJabberitPopUp:' + elementOpenPop.options[i].value; |
---|
| 872 | |
---|
| 873 | if( _preferencesIM[1] != 'openWindowJabberitPopUp:' + elementOpenPop.options[i].value) |
---|
| 874 | flagReload = true; |
---|
| 875 | |
---|
| 876 | _preferencesIM[1] = 'openWindowJabberitPopUp:' + elementOpenPop.options[i].value; |
---|
| 877 | } |
---|
| 878 | |
---|
| 879 | // Element flagAwayIM |
---|
| 880 | var elementFlagIM = document.getElementById('flagAwayIM'); |
---|
| 881 | |
---|
| 882 | if( elementFlagIM.value.length > 0 && parseInt(elementFlagIM.value) > 0 ) |
---|
| 883 | { |
---|
| 884 | _preferencesIM[2] = 'flagAwayIM:' + elementFlagIM.value; |
---|
| 885 | value += '&preferences3=flagAwayIM:' + elementFlagIM.value; |
---|
| 886 | } |
---|
| 887 | else |
---|
| 888 | { |
---|
| 889 | alert('Informe um valor igual ou maior que 1!'); |
---|
| 890 | return false; |
---|
| 891 | } |
---|
[2706] | 892 | |
---|
| 893 | // Element showContactsOfflineJabberit |
---|
| 894 | var elementShowOffline = document.getElementById('showContactsOfflineJabberit'); |
---|
[2696] | 895 | |
---|
[2706] | 896 | for(var i = 0 ; i < elementShowOffline.options.length; i++) |
---|
| 897 | if( elementShowOffline.options[i].selected == true) |
---|
| 898 | { |
---|
| 899 | _preferencesIM[3] = 'showContactsOfflineJabberit:' + elementShowOffline.options[i].value; |
---|
| 900 | value += '&preferences4=showContactsOfflineJabberit:' + elementShowOffline.options[i].value; |
---|
| 901 | } |
---|
| 902 | |
---|
[2696] | 903 | // Save Preferences |
---|
| 904 | conn.go('p.pf.setPreferences', |
---|
| 905 | function(data) |
---|
| 906 | { |
---|
| 907 | if(data == 'true') |
---|
| 908 | { |
---|
| 909 | if( flagReload ) |
---|
| 910 | { |
---|
| 911 | window.location.reload(); |
---|
| 912 | myWindow.close(); |
---|
| 913 | } |
---|
| 914 | } |
---|
| 915 | else{ alert('Erro salvando suas preferências!'); } |
---|
| 916 | |
---|
| 917 | _winBuild('jabberit_preferences', 'remove'); |
---|
| 918 | }, |
---|
| 919 | value); |
---|
| 920 | } |
---|
| 921 | |
---|
[2670] | 922 | function setPresence() |
---|
| 923 | { |
---|
| 924 | if( arguments.length > 0 ) |
---|
| 925 | { |
---|
| 926 | var element = arguments[0]; |
---|
| 927 | |
---|
| 928 | if( showhidden == null ) |
---|
| 929 | showhidden = new ShowHidden(300); |
---|
| 930 | |
---|
| 931 | var _status = [ |
---|
| 932 | ['Afastado', 'away', '<img src="'+path_jabberit+'templates/default/images/away.gif" />'], |
---|
| 933 | ['Disponível', 'available', '<img src="'+path_jabberit+'templates/default/images/available.gif" />'], |
---|
| 934 | ['Livre p/ Conversa', 'chat', '<img src="'+path_jabberit+'templates/default/images/chat.gif" />'], |
---|
| 935 | ['Não Disponível', 'xa', '<img src="'+path_jabberit+'templates/default/images/xa.gif" />'], |
---|
| 936 | ['Ocupado', 'dnd', '<img src="'+path_jabberit+'templates/default/images/dnd.gif" />'], |
---|
| 937 | ['Desconectado', 'unavailable', '<img src="'+path_jabberit+'templates/default/images/unavailable.gif" />'], |
---|
| 938 | ['Mensagem de Status...', 'status', '<img src="'+path_jabberit+'templates/default/images/message_normal.gif" />'], |
---|
| 939 | ]; |
---|
| 940 | |
---|
| 941 | var _itens = ""; |
---|
| 942 | |
---|
| 943 | for( var i in _status ) |
---|
| 944 | { |
---|
| 945 | if( typeof( _status[i]) == "object" ) |
---|
| 946 | { |
---|
| 947 | _itens += '<span style="cursor:pointer;" onclick="TrophyIM.setPresence(\''+_status[i][1]+'\'); loadscript.setStatusJabber(\''+_status[i][0]+'\',\''+_status[i][1]+'\');">'; |
---|
| 948 | _itens += _status[i][2]+ "<span style='margin:3px;'>" + _status[i][0] + "</span></span><br/>"; |
---|
| 949 | } |
---|
| 950 | } |
---|
| 951 | |
---|
| 952 | var _statusItens = document.createElement("div"); |
---|
| 953 | _statusItens.style.marginTop = "65px"; |
---|
| 954 | _statusItens.style.marginLeft = "67px"; |
---|
| 955 | _statusItens.className = "x-menu"; |
---|
| 956 | _statusItens.style.zIndex = '99999'; |
---|
| 957 | _statusItens.innerHTML = _itens; |
---|
| 958 | _statusItens.onclick = function(){ showhidden.hiddenObject(false); }; |
---|
| 959 | |
---|
| 960 | showhidden.action('onmouseover', 'onmouseout', _statusItens); |
---|
| 961 | |
---|
| 962 | element.parentNode.onmouseout = function(){ showhidden.hiddenObject(false); }; |
---|
| 963 | element.parentNode.onmouseover = function(){ showhidden.hiddenObject(true); }; |
---|
| 964 | element.parentNode.appendChild(_statusItens); |
---|
| 965 | } |
---|
| 966 | } |
---|
| 967 | |
---|
| 968 | function setSelectEditable(element) |
---|
| 969 | { |
---|
| 970 | if( getElement('selectBox0') == null ) |
---|
| 971 | selectEditable.create(element); |
---|
| 972 | } |
---|
| 973 | |
---|
| 974 | function setStatusJabber() |
---|
| 975 | { |
---|
| 976 | if( arguments.length > 0 ) |
---|
| 977 | { |
---|
| 978 | if( arguments[1] != 'status' ) |
---|
| 979 | { |
---|
| 980 | var _text = arguments[0]; |
---|
| 981 | var _img = arguments[1]; |
---|
| 982 | |
---|
| 983 | getElement('statusJabberText').innerHTML = _text; |
---|
| 984 | getElement('statusJabberImg').style.background = "url('"+path_jabberit+"templates/default/images/"+_img+".gif')"; |
---|
| 985 | getElement('status_jabber_expresso').style.background = "url('"+path_jabberit+"templates/default/images/"+_img+".gif') no-repeat"; |
---|
| 986 | } |
---|
| 987 | } |
---|
| 988 | } |
---|
| 989 | |
---|
[2750] | 990 | function _setUserCurrent( _jid, _password ) |
---|
[2670] | 991 | { |
---|
| 992 | userCurrent = |
---|
| 993 | { |
---|
| 994 | 'jid' : _jid.substring(11, _jid.length), |
---|
| 995 | 'password' : _password.substring(11, _password.length) |
---|
| 996 | } |
---|
| 997 | } |
---|
| 998 | |
---|
| 999 | function setUserCurrent() |
---|
| 1000 | { |
---|
| 1001 | conn.go('p.ff.data_0', |
---|
| 1002 | function(_User) |
---|
| 1003 | { |
---|
| 1004 | var _user = _User; |
---|
| 1005 | |
---|
| 1006 | conn.go('p.ff.data_1', |
---|
| 1007 | function(_pass) |
---|
| 1008 | { |
---|
[2750] | 1009 | _setUserCurrent( _user, _pass ); |
---|
[2670] | 1010 | }); |
---|
| 1011 | }); |
---|
| 1012 | } |
---|
| 1013 | |
---|
| 1014 | function loadIM() |
---|
| 1015 | { |
---|
| 1016 | if( arguments.length > 0 ) |
---|
| 1017 | { |
---|
| 1018 | var files = [ |
---|
| 1019 | path_jabberit + 'js/connector.js', |
---|
| 1020 | path_jabberit + 'js/xtools.js', |
---|
| 1021 | path_jabberit + 'js/dragdrop.js', |
---|
| 1022 | path_jabberit + 'js/makeW.js', |
---|
| 1023 | path_jabberit + 'js/show_hidden.js', |
---|
| 1024 | path_jabberit + 'js/trophyim.js', |
---|
| 1025 | path_jabberit + 'js/AddUser.js', |
---|
| 1026 | path_jabberit + 'js/SelectEditable.js', |
---|
| 1027 | path_jabberit + 'templates/default/css/button.css', |
---|
| 1028 | path_jabberit + 'templates/default/css/common.css', |
---|
| 1029 | path_jabberit + 'templates/default/css/selectEditableStyle.css', |
---|
| 1030 | path_jabberit + 'templates/default/css/' + theme_jabberit |
---|
| 1031 | ]; |
---|
| 1032 | // FullName |
---|
| 1033 | fullName = arguments[0]; |
---|
| 1034 | |
---|
[2696] | 1035 | // Preferences |
---|
| 1036 | _preferencesIM = arguments[1].split(";"); |
---|
[2706] | 1037 | |
---|
| 1038 | if( !_preferencesIM[3] ) _preferencesIM[3] = "showContactsOfflineJabberit:false"; |
---|
| 1039 | |
---|
[2670] | 1040 | loadScripts(files); |
---|
| 1041 | |
---|
| 1042 | setTimeout(function() |
---|
| 1043 | { |
---|
| 1044 | // Object Xtools |
---|
| 1045 | if( Xtools == null ) |
---|
| 1046 | Xtools = new xtools(path_jabberit); |
---|
| 1047 | |
---|
| 1048 | // Object Conector |
---|
| 1049 | if( conn == null ) |
---|
| 1050 | conn = new AjaxConnector(path_jabberit); |
---|
| 1051 | |
---|
| 1052 | // Object Add User |
---|
| 1053 | if( addUser == null ) |
---|
| 1054 | addUser = new addUserIM(Xtools, conn); |
---|
| 1055 | |
---|
| 1056 | |
---|
| 1057 | // Object SelectEditable |
---|
| 1058 | if( selectEditable == null ) |
---|
| 1059 | selectEditable = new SelectEditable(); |
---|
| 1060 | |
---|
| 1061 | // Add Jabber in StatusBar; |
---|
| 1062 | addIcon(); |
---|
[2750] | 1063 | |
---|
[2696] | 1064 | // Auto Connect |
---|
| 1065 | setTimeout(function() |
---|
| 1066 | { |
---|
| 1067 | if( _preferencesIM[0] === 'openWindowJabberit:true' ) |
---|
| 1068 | TrophyIM.load(); |
---|
| 1069 | },1500); |
---|
| 1070 | |
---|
| 1071 | // Auto Status |
---|
| 1072 | autoStatus(); |
---|
| 1073 | configEvents( document, 'onmousemove', autoStatus ); |
---|
| 1074 | configEvents( document, 'onkeypress', autoStatus ); |
---|
[2670] | 1075 | |
---|
[2689] | 1076 | }, 2000); |
---|
[2670] | 1077 | } |
---|
| 1078 | } |
---|
| 1079 | |
---|
| 1080 | loadIM.prototype.adIcon = addIcon; |
---|
| 1081 | loadIM.prototype.actionButton = actionButton; |
---|
| 1082 | loadIM.prototype.addContact = addContact; |
---|
| 1083 | loadIM.prototype.clrAllContacts = clrAllContacts; |
---|
| 1084 | loadIM.prototype.configEvents = configEvents; |
---|
| 1085 | loadIM.prototype.getPhotoUser = getPhotoUser; |
---|
[2711] | 1086 | loadIM.prototype.getStatusMessage = getStatusMessage; |
---|
[2706] | 1087 | loadIM.prototype.getShowContactsOffline = getShowContactsOffline; |
---|
[2670] | 1088 | loadIM.prototype.getUserCurrent = getUserCurrent; |
---|
| 1089 | loadIM.prototype.getZIndex = getZindex; |
---|
| 1090 | loadIM.prototype.groupsHidden = groupsHidden; |
---|
| 1091 | loadIM.prototype.groupsVisible = groupsVisible; |
---|
| 1092 | loadIM.prototype.keyPressSearch = keyPressSearch; |
---|
| 1093 | loadIM.prototype.loginPage = loginPage; |
---|
| 1094 | loadIM.prototype.notification = notificationNewMessage; |
---|
| 1095 | loadIM.prototype.parse = parse; |
---|
[2696] | 1096 | loadIM.prototype.preferences = preferences; |
---|
[2670] | 1097 | loadIM.prototype.searchUser = searchUser |
---|
| 1098 | loadIM.prototype.setAutorization = setAutorization; |
---|
[2711] | 1099 | loadIM.prototype.setMessageStatus = setMessageStatus; |
---|
[2696] | 1100 | loadIM.prototype.setPreferences = setPreferences; |
---|
[2670] | 1101 | loadIM.prototype.setPresence = setPresence; |
---|
| 1102 | loadIM.prototype.setStatusJabber = setStatusJabber; |
---|
| 1103 | loadIM.prototype.setSelectEditable = setSelectEditable; |
---|
| 1104 | loadIM.prototype.setUserCurrent = setUserCurrent; |
---|
| 1105 | loadIM.prototype.removeContact = removeContact; |
---|
| 1106 | loadIM.prototype.removeElement = removeElement; |
---|
| 1107 | loadIM.prototype.removeGroup = removeGroup; |
---|
| 1108 | loadIM.prototype.renameContact = renameContact; |
---|
| 1109 | loadIM.prototype.renameGroup = renameGroup; |
---|
| 1110 | loadIM.prototype.rosterDiv = rosterDiv; |
---|
| 1111 | |
---|
| 1112 | window.LoadIM = loadIM; |
---|
| 1113 | |
---|
| 1114 | })(); |
---|