[151] | 1 | function IM() |
---|
| 2 | { |
---|
| 3 | this.vcards = false; |
---|
| 4 | this.statusvcard = false; |
---|
| 5 | this.UsersNot = []; |
---|
| 6 | this.userPrefe = false; |
---|
| 7 | this.count_Vcard = 0; |
---|
| 8 | this._listen = ""; |
---|
| 9 | this.custom_message = ""; |
---|
| 10 | this.timeout_composing = ""; |
---|
| 11 | } |
---|
| 12 | |
---|
| 13 | IM.prototype.load_im = function() |
---|
| 14 | { |
---|
| 15 | this.listen(); |
---|
| 16 | this.requireContacts(); |
---|
| 17 | this.atalho(); |
---|
| 18 | |
---|
| 19 | var handler_Status = function(XmlData) |
---|
| 20 | { |
---|
| 21 | var data = XmlData.getElementsByTagName('retorno').item(0); |
---|
| 22 | data = data.firstChild.nodeValue; |
---|
| 23 | if( data ) |
---|
| 24 | { |
---|
| 25 | if(data == 'available' || data == 'xa') |
---|
| 26 | awayFlag = true; |
---|
| 27 | statusFlag = data; |
---|
| 28 | setTimeout('IM.ImgStatus("'+data+'")',4000); |
---|
| 29 | } |
---|
| 30 | }; |
---|
| 31 | XMLTools.request('$this.Ujabber.MyPresence', 'GET', handler_Status); |
---|
| 32 | }; |
---|
| 33 | |
---|
| 34 | IM.prototype.listen = function() |
---|
| 35 | { |
---|
| 36 | var _this = this; |
---|
| 37 | var handler = function(XMLdata) |
---|
| 38 | { |
---|
| 39 | try |
---|
| 40 | { |
---|
| 41 | var data = XMLdata.documentElement; |
---|
| 42 | if ( data.hasChildNodes() ) |
---|
| 43 | { |
---|
| 44 | data = data.firstChild; |
---|
| 45 | if ( data.nodeType == 3 && data.nodeValue == 'disconnected' ) |
---|
| 46 | { |
---|
| 47 | document.getElementById('div_contacts').innerHTML = '<a href="javascript:void(0);" onclick="javascript:IM.reconnect();">'+_this.get_lang("Re-connect Expresso Messenger ?")+'</a>'; |
---|
| 48 | _this.ImgStatus('unavailable'); |
---|
| 49 | statusFlag = 'unavailable'; |
---|
| 50 | clearTimeout(_awayTimer); |
---|
| 51 | return false; |
---|
| 52 | } |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | if( !_this.userPrefe ) |
---|
| 56 | { |
---|
| 57 | if(window.IM_Preferences) |
---|
| 58 | IM_Preferences.GetYourPreferences(); |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | _this.getContacts(XMLdata); |
---|
| 62 | _this.getPresence(XMLdata); |
---|
| 63 | _this.getComposing(XMLdata); |
---|
| 64 | _this.getMessages(XMLdata); |
---|
| 65 | _this.getVcard(XMLdata); |
---|
| 66 | |
---|
| 67 | if(!_this.vcards) |
---|
| 68 | { |
---|
| 69 | _this.Vcard(); |
---|
| 70 | _this.vcards = true; |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | }catch(e){} |
---|
| 74 | |
---|
| 75 | _this._listen = setTimeout('IM.listen()', 3000); |
---|
| 76 | }; |
---|
| 77 | |
---|
| 78 | XMLTools.__RETURN_MODE__ = 'XML'; |
---|
| 79 | XMLTools.request('$this.Ujabber.listen', 'GET', handler); |
---|
| 80 | }; |
---|
| 81 | |
---|
| 82 | IM.prototype.reconnect = function() |
---|
| 83 | { |
---|
| 84 | var _this = this; |
---|
| 85 | var handler_reconnect = function(XMLdata) |
---|
| 86 | { |
---|
| 87 | if ( XMLdata.documentElement.firstChild.nodeValue == 'true' ) |
---|
| 88 | { |
---|
| 89 | document.getElementById('div_contacts').innerHTML = '<div><img src="' + img_wait.src + '" width="25px" heigth="25px" style="float:left;margin:3px "/>'; |
---|
| 90 | document.getElementById('div_contacts').innerHTML += '<font style="color:#0000FF;float:left;margin:9px 5px">' + _this.get_lang("Wait a moment !!") + '</font></div>'; |
---|
| 91 | setTimeout('IM.load_im()',2000); |
---|
| 92 | _this.count_Vcard = 0; |
---|
| 93 | _this.ImgStatus('available'); |
---|
| 94 | statusFlag = 'available'; |
---|
| 95 | _awayTimer = setTimeout("IM.setAway()", parseInt(IM_Preferences.im_timer_xa) * 60000 ); |
---|
| 96 | }else{ |
---|
| 97 | document.getElementById('div_contacts').innerHTML = '<a href="javascript:void(0);" onclick="javascript:IM.reconnect();">'+_this.get_lang("Re-connect Expresso Messenger ?")+'</a>'; |
---|
| 98 | _this.ImgStatus('unavailable'); |
---|
| 99 | statusFlag = 'unavailable'; |
---|
| 100 | return false; |
---|
| 101 | } |
---|
| 102 | }; |
---|
| 103 | XMLTools.__RETURN_MODE__ = 'XML'; |
---|
| 104 | XMLTools.request('$this.Ujabber.reconnect', 'GET', handler_reconnect); |
---|
| 105 | }; |
---|
| 106 | |
---|
| 107 | /* |
---|
| 108 | * Contacts |
---|
| 109 | */ |
---|
| 110 | |
---|
| 111 | IM.prototype.requireContacts = function() |
---|
| 112 | { |
---|
| 113 | var handler = function(data) |
---|
| 114 | { |
---|
| 115 | }; |
---|
| 116 | XMLTools.request('$this.Ujabber.requireContacts', 'GET', handler); |
---|
| 117 | }; |
---|
| 118 | |
---|
| 119 | IM.prototype.getContacts = function(data) |
---|
| 120 | { |
---|
| 121 | try |
---|
| 122 | { |
---|
| 123 | if ( data.getElementsByTagName('contacts').length > 0 ) |
---|
| 124 | { |
---|
| 125 | var node = data.documentElement.firstChild; |
---|
| 126 | while ( node.nodeName != 'contacts' ) |
---|
| 127 | node = node.nextSibling; |
---|
| 128 | |
---|
| 129 | var div = document.getElementById("div_contacts"); |
---|
| 130 | var xsl = XMLTools.load(im_path + 'xsl/contacts.xsl?' + Date.parse(new Date)); |
---|
| 131 | var img = document.createElement('img'); |
---|
| 132 | img.id = 'img_all_groups'; |
---|
| 133 | img.src = img_group_open.src; |
---|
| 134 | img.onclick = function(){IM.visible_group("all_groups")}; |
---|
| 135 | |
---|
| 136 | var a = document.createElement('div'); |
---|
| 137 | a.innerHTML = XMLTools.transform(node, xsl); |
---|
| 138 | |
---|
| 139 | div.innerHTML = ''; |
---|
| 140 | div.appendChild(img); |
---|
| 141 | div.appendChild(document.createTextNode(this.get_lang('List of Contacts'))); |
---|
| 142 | div.appendChild(a); |
---|
| 143 | |
---|
| 144 | var group = func.byId("all_groups").firstChild; |
---|
| 145 | while ( group ) |
---|
| 146 | { |
---|
| 147 | var contact = group.firstChild.nextSibling; |
---|
| 148 | while ( contact = contact.nextSibling ) |
---|
| 149 | { |
---|
| 150 | var img = func.newEl('img'); |
---|
| 151 | img.src = img_unavailable.src; |
---|
| 152 | |
---|
| 153 | func.insElB(img, func.byId(contact.id).firstChild); |
---|
| 154 | } |
---|
| 155 | |
---|
| 156 | try |
---|
| 157 | { |
---|
| 158 | var img = document.createElement('img'); |
---|
| 159 | img.src = img_group_open.src; |
---|
| 160 | img.id = "img_" + group.id; |
---|
| 161 | var el_parent = group; |
---|
| 162 | |
---|
| 163 | el_parent.insertBefore(img,el_parent.firstChild); |
---|
| 164 | |
---|
| 165 | } catch(e){} |
---|
| 166 | group = group.nextSibling; |
---|
| 167 | } |
---|
| 168 | } |
---|
| 169 | }catch(e){} |
---|
| 170 | |
---|
| 171 | }; |
---|
| 172 | |
---|
| 173 | /* |
---|
| 174 | * Visible / Unvisible |
---|
| 175 | */ |
---|
| 176 | |
---|
| 177 | IM.prototype.visible_group = function(el) |
---|
| 178 | { |
---|
| 179 | var _this = this; |
---|
| 180 | var divParent = document.getElementById(el); |
---|
| 181 | divParent.style.display = "none"; |
---|
| 182 | var img = document.getElementById("img_" + el); |
---|
| 183 | img.onclick = function(){_this.unvisible_group(el)}; |
---|
| 184 | img.src = img_group_close.src; |
---|
| 185 | } |
---|
| 186 | |
---|
| 187 | IM.prototype.unvisible_group = function(el) |
---|
| 188 | { |
---|
| 189 | var _this = this; |
---|
| 190 | var div = document.getElementById(el); |
---|
| 191 | div.style.display = ""; |
---|
| 192 | var img = document.getElementById("img_" + el); |
---|
| 193 | img.onclick = function(){_this.visible_group(el)}; |
---|
| 194 | img.src = img_group_open.src; |
---|
| 195 | } |
---|
| 196 | |
---|
| 197 | /* |
---|
| 198 | * Presence |
---|
| 199 | */ |
---|
| 200 | |
---|
| 201 | IM.prototype.getPresence = function(data) |
---|
| 202 | { |
---|
| 203 | try |
---|
| 204 | { |
---|
| 205 | var presence = data.documentElement.firstChild; |
---|
| 206 | var _this = this; |
---|
| 207 | while ( presence ) |
---|
| 208 | { |
---|
| 209 | if ( presence.nodeName != 'presence' ) |
---|
| 210 | { |
---|
| 211 | presence = presence.nextSibling; |
---|
| 212 | continue; |
---|
| 213 | } |
---|
| 214 | |
---|
| 215 | var from = presence.getAttribute('from'); |
---|
| 216 | var type = presence.getAttribute('type'); |
---|
| 217 | if ( presence.hasChildNodes() ) |
---|
| 218 | var status_message = presence.firstChild.nodeValue; |
---|
| 219 | else |
---|
| 220 | var status_message = false; |
---|
| 221 | |
---|
| 222 | if( from ) |
---|
| 223 | { |
---|
| 224 | switch ( type ) |
---|
| 225 | { |
---|
| 226 | case 'subscribe' : |
---|
| 227 | if ( !func.byId(from) ) |
---|
| 228 | _this.UsersNot[_this.UsersNot.length] = from; |
---|
| 229 | else |
---|
| 230 | { |
---|
| 231 | Subscription.subscribed(from); |
---|
| 232 | this.setStatus(statusFlag); |
---|
| 233 | } |
---|
| 234 | break; |
---|
| 235 | case 'subscribed' : |
---|
| 236 | // |
---|
| 237 | break; |
---|
| 238 | case 'unsubscribe' : |
---|
| 239 | Subscription.unsubscribe(from); |
---|
| 240 | type = 'unavailable'; |
---|
| 241 | func.byId(from).firstChild.src = eval('img_' + type + '.src'); |
---|
| 242 | break; |
---|
| 243 | case 'unsubscribed' : |
---|
| 244 | Subscription.unsubscribed(from); |
---|
| 245 | type = 'unavailable'; |
---|
| 246 | func.byId(from).firstChild.src = eval('img_' + type + '.src'); |
---|
| 247 | break; |
---|
| 248 | default : |
---|
| 249 | if ( func.byId(from) ) |
---|
| 250 | { |
---|
| 251 | func.byId(from).firstChild.src = eval('img_' + type + '.src'); |
---|
| 252 | var status; |
---|
| 253 | |
---|
| 254 | if ( (status = func.byId(from + '_im_window')) ) |
---|
| 255 | { |
---|
| 256 | status.firstChild.style.background = 'url('+func.byId(from).firstChild.src+')'; |
---|
| 257 | status = func.byId(from + '_im_window_message'); |
---|
| 258 | if( status_message && status_message != "available" ) |
---|
| 259 | status.innerHTML = from.substr(0, from.indexOf('@')) + ' : ' + status_message; |
---|
| 260 | else |
---|
| 261 | status.innerHTML = ''; |
---|
| 262 | } |
---|
| 263 | |
---|
| 264 | if( document.getElementById('status_message_' + from) == null) |
---|
| 265 | { |
---|
| 266 | var lbl = document.createElement('label'); |
---|
| 267 | lbl.id = 'status_message_' + from; |
---|
| 268 | if(!status_message) |
---|
| 269 | lbl.innerHTML = ""; |
---|
| 270 | else |
---|
| 271 | if( status_message != "available" ) |
---|
| 272 | lbl.innerHTML = "<span style='margin-left:10px'><br/> ( " + status_message + " )</span>"; |
---|
| 273 | func.byId(from).appendChild(lbl); |
---|
| 274 | }else{ |
---|
| 275 | var lbl = document.getElementById('status_message_' + from); |
---|
| 276 | if(!status_message) |
---|
| 277 | lbl.innerHTML = ""; |
---|
| 278 | else |
---|
| 279 | if( status_message != "available" ) |
---|
| 280 | lbl.innerHTML = "<span style='margin-left:10px'><br/> ( " + status_message + " )</span>"; |
---|
| 281 | } |
---|
| 282 | } |
---|
| 283 | } |
---|
| 284 | } |
---|
| 285 | if( _this.UsersNot.length > 0 ) |
---|
| 286 | Templates.Users_Not_Auth(_this.UsersNot); |
---|
| 287 | presence = presence.nextSibling; |
---|
| 288 | } |
---|
| 289 | _this.Contacts_Offline(); |
---|
| 290 | }catch(e){} |
---|
| 291 | }; |
---|
| 292 | |
---|
| 293 | /* |
---|
| 294 | * Contatos - Offline |
---|
| 295 | */ |
---|
| 296 | |
---|
| 297 | IM.prototype.Contacts_Offline = function() |
---|
| 298 | { |
---|
| 299 | var offline = true; |
---|
| 300 | if(IM.userPrefe) |
---|
| 301 | offline = eval(IM_Preferences.LoadPreferences('ch_offline')); |
---|
| 302 | else |
---|
| 303 | offline = eval(IM_Preferences.LoadPreferences('ch_offline')); |
---|
| 304 | |
---|
| 305 | var group = func.byId("all_groups").firstChild; |
---|
| 306 | while ( group ) |
---|
| 307 | { |
---|
| 308 | var contact = group.firstChild; |
---|
| 309 | while ( contact ) |
---|
| 310 | { |
---|
| 311 | if(contact.tagName == "DIV") |
---|
| 312 | { |
---|
| 313 | var childF = contact.firstChild; |
---|
| 314 | if( childF.src == img_unavailable.src && !offline) |
---|
| 315 | func.byId(contact.id).style.display = "none"; |
---|
| 316 | else |
---|
| 317 | func.byId(contact.id).style.display = "block"; |
---|
| 318 | } |
---|
| 319 | contact = contact.nextSibling; |
---|
| 320 | } |
---|
| 321 | group = group.nextSibling; |
---|
| 322 | } |
---|
| 323 | } |
---|
| 324 | |
---|
| 325 | /* |
---|
| 326 | * Get / Send - Messages |
---|
| 327 | */ |
---|
| 328 | |
---|
| 329 | IM.prototype.getMessages = function(data) |
---|
| 330 | { |
---|
| 331 | try |
---|
| 332 | { |
---|
| 333 | data = data.documentElement; |
---|
| 334 | if ( data.childNodes.length > 0 ) |
---|
| 335 | { |
---|
| 336 | var message = data.firstChild; |
---|
| 337 | while ( message ) |
---|
| 338 | { |
---|
| 339 | if ( message.tagName == 'messages' ) |
---|
| 340 | { |
---|
| 341 | var from = message.getAttribute('from'); |
---|
| 342 | with ( from ) |
---|
| 343 | from = substr(0, indexOf('/')) |
---|
| 344 | |
---|
| 345 | if( document.getElementById('vcard_' + from) != null) |
---|
| 346 | { |
---|
| 347 | var vcards = IM_Preferences.vCardLoad(from); |
---|
| 348 | var nickname = vcards.substr(vcards.indexOf('NICKNAME'),vcards.length); |
---|
| 349 | nickname = nickname.substr(0,nickname.indexOf('|')); |
---|
| 350 | nickname = nickname.substr(nickname.indexOf(':') + 1 , nickname.length); |
---|
| 351 | nickname = ( func.trim(nickname) != "" ) ? nickname : from ; |
---|
| 352 | } |
---|
| 353 | else |
---|
| 354 | var nickname = from; |
---|
| 355 | |
---|
| 356 | if(nickname.indexOf('@') != -1) |
---|
| 357 | nickname = nickname.substr(0,nickname.indexOf('@')); |
---|
| 358 | |
---|
| 359 | var win = document.getElementById(from + '_chatMessages'); |
---|
| 360 | if ( !win ) |
---|
| 361 | { |
---|
| 362 | im_win.open_chat(from); |
---|
| 363 | win = document.getElementById(from + '_chatMessages'); |
---|
| 364 | } |
---|
| 365 | |
---|
| 366 | var el = message.firstChild; |
---|
| 367 | while ( el ) |
---|
| 368 | { |
---|
| 369 | var xsl = XMLTools.load(im_path + 'xsl/message.xsl?' + Date.parse(new Date)); |
---|
| 370 | var next = el.nextSibling; |
---|
| 371 | |
---|
| 372 | var label = document.createElement('strong'); |
---|
| 373 | label.appendChild(document.createTextNode(nickname)); |
---|
| 374 | |
---|
| 375 | win.appendChild(label); |
---|
| 376 | win.appendChild(document.createElement('br')); |
---|
| 377 | var msg = XMLTools.transform(el, xsl); |
---|
| 378 | win.innerHTML += this.emotions_icons(msg); |
---|
| 379 | win.appendChild(document.createElement('br')); |
---|
| 380 | win.appendChild(document.createElement('br')); |
---|
| 381 | win.scrollTop = win.scrollHeight; |
---|
| 382 | im_win.newMessageNotification(); |
---|
| 383 | |
---|
| 384 | el = next; |
---|
| 385 | } |
---|
| 386 | } |
---|
| 387 | |
---|
| 388 | if ( (composing = func.byId(from + '_composing')) ) |
---|
| 389 | if ( composing.style.display = 'block' ) |
---|
| 390 | composing.style.display = 'none'; |
---|
| 391 | |
---|
| 392 | message = message.nextSibling; |
---|
| 393 | } |
---|
| 394 | } |
---|
| 395 | }catch(e){} |
---|
| 396 | } |
---|
| 397 | |
---|
| 398 | IM.prototype.sendMessage = function (pJID) |
---|
| 399 | { |
---|
| 400 | var _this = this; |
---|
| 401 | var name_document = document.getElementById(pJID + '_edita'); |
---|
| 402 | var envio = name_document.contentWindow.document.getElementsByTagName('body').item(0); |
---|
| 403 | |
---|
| 404 | var imgs = envio.getElementsByTagName('img'); |
---|
| 405 | var cod; |
---|
| 406 | var emotion_regexp; |
---|
| 407 | |
---|
| 408 | for ( i = imgs.length - 1; i > -1; i--) |
---|
| 409 | { |
---|
| 410 | if ( (cod = imgs[i].getAttribute('emotion')) ) |
---|
| 411 | { |
---|
| 412 | emotion_regexp = new RegExp('<img[^>]*?emotion="' + cod_emotions[cod][1] + '"[^>]*?>', "i"); |
---|
| 413 | envio.innerHTML = envio.innerHTML.replace(emotion_regexp, cod); |
---|
| 414 | } |
---|
| 415 | else |
---|
| 416 | imgs[i].parentNode.removeChild(imgs[i]); |
---|
| 417 | } |
---|
| 418 | |
---|
| 419 | envio.innerHTML = func.trim(envio.innerHTML); |
---|
| 420 | envio.innerHTML = envio.innerHTML.replace(/ | +/gi, ' '); |
---|
| 421 | envio.innerHTML = envio.innerHTML.replace(/<br[^>]*>/gi, '<br />'); |
---|
| 422 | |
---|
| 423 | if ( envio.innerHTML != "" ) |
---|
| 424 | { |
---|
| 425 | var message_text = "<div style='"; |
---|
| 426 | message_text += (envio.style.fontFamily != "") ? "font-family:"+envio.style.fontFamily+";" : ""; |
---|
| 427 | message_text += (envio.style.fontSize != "") ? "font-size:"+envio.style.fontSize+";" : "" ; |
---|
| 428 | message_text += (envio.style.fontWeight != "") ? "font-weight:"+envio.style.fontWeight+";": ""; |
---|
| 429 | message_text += (envio.style.fontStyle != "" ) ? "font-style:"+envio.style.fontStyle+";" : ""; |
---|
| 430 | message_text += (envio.style.color != "") ? "color:"+envio.style.color+";" : "color:black"; |
---|
| 431 | message_text += "'>"; |
---|
| 432 | message_text += envio.innerHTML + "</div>"; |
---|
| 433 | |
---|
| 434 | message_text = message_text.replace(/ | +/gi, ' '); |
---|
| 435 | message_text = message_text.replace(/<br[^>]*>/gi, '<br />'); |
---|
| 436 | |
---|
| 437 | envio.innerHTML = ''; |
---|
| 438 | |
---|
| 439 | var message_element = document.getElementById(pJID + '_chatMessages'); |
---|
| 440 | var nickname = "me "; |
---|
| 441 | if( IM_Preferences.jid ) |
---|
| 442 | { |
---|
| 443 | var vcards = IM_Preferences.vCardLoad(IM_Preferences.jid); |
---|
| 444 | nickname = vcards.substr(vcards.indexOf('NICKNAME'),vcards.length); |
---|
| 445 | nickname = nickname.substr(0,nickname.indexOf('|')); |
---|
| 446 | nickname = nickname.substr(nickname.indexOf(':') + 1 , nickname.length); |
---|
| 447 | nickname = (func.trim(nickname) != "") ? nickname : IM_Preferences.jid; |
---|
| 448 | if(nickname.indexOf('@') != -1) |
---|
| 449 | nickname = nickname.substr(0,nickname.indexOf('@')); |
---|
| 450 | } |
---|
| 451 | |
---|
| 452 | message_element.innerHTML += '<strong>' + nickname + ' '; |
---|
| 453 | message_element.innerHTML += ' ' + _this.get_lang('speak') + ':</strong><br />'; |
---|
| 454 | message_element.innerHTML += this.emotions_icons(message_text) + '<br />'; |
---|
| 455 | message_element.scrollTop = message_element.scrollHeight; |
---|
| 456 | |
---|
| 457 | var handler_sendMessage = function(data) |
---|
| 458 | { |
---|
| 459 | var data = func.interface(data); |
---|
| 460 | if(!data) |
---|
| 461 | alert(data); |
---|
| 462 | } |
---|
| 463 | XMLTools.request('$this.Ujabber.SendMessage','POST',handler_sendMessage,"to="+pJID+"&body="+escape(message_text)); |
---|
| 464 | } |
---|
| 465 | }; |
---|
| 466 | |
---|
| 467 | /* |
---|
| 468 | * Composing / GetComposing / Paused Message |
---|
| 469 | */ |
---|
| 470 | |
---|
| 471 | IM.prototype.getComposing = function(data) |
---|
| 472 | { |
---|
| 473 | if ( data.hasChildNodes() ) |
---|
| 474 | { |
---|
| 475 | var node = data.documentElement.firstChild; |
---|
| 476 | while ( node ) |
---|
| 477 | { |
---|
| 478 | var composing; |
---|
| 479 | if ( node.nodeName == 'composing' ) |
---|
| 480 | if ( (composing = func.byId(node.getAttribute('from') + '_composing')) ) |
---|
| 481 | if ( composing.style.display = 'none' ) |
---|
| 482 | composing.style.display = 'block'; |
---|
| 483 | |
---|
| 484 | if ( node.nodeName == 'paused' ) |
---|
| 485 | if ( (composing = func.byId(node.getAttribute('from') + '_composing')) ) |
---|
| 486 | if ( composing.style.display = 'block' ) |
---|
| 487 | composing.style.display = 'none'; |
---|
| 488 | |
---|
| 489 | node = node.nextSibling; |
---|
| 490 | } |
---|
| 491 | } |
---|
| 492 | }; |
---|
| 493 | |
---|
| 494 | IM.prototype.composingMessage = function(pId) |
---|
| 495 | { |
---|
| 496 | if( IM.timeout_composing ) |
---|
| 497 | { |
---|
| 498 | clearTimeout(IM.timeout_composing); |
---|
| 499 | IM.timeout_composing = eval('setTimeout("IM.pausedMessage(\'' + pId + '\')",2000)'); |
---|
| 500 | } |
---|
| 501 | else |
---|
| 502 | { |
---|
| 503 | IM.timeout_composing = eval('setTimeout("IM.pausedMessage(\'' + pId + '\')",2000)'); |
---|
| 504 | var handler_composingMessage = function(data) |
---|
| 505 | { |
---|
| 506 | }; |
---|
| 507 | XMLTools.request('$this.Ujabber.composingMessage', 'POST', handler_composingMessage,"to="+pId); |
---|
| 508 | } |
---|
| 509 | }; |
---|
| 510 | |
---|
| 511 | IM.prototype.pausedMessage = function(pId) |
---|
| 512 | { |
---|
| 513 | clearTimeout(IM.timeout_composing); |
---|
| 514 | IM.timeout_composing = ""; |
---|
| 515 | var handler_pausedMessage = function(data) |
---|
| 516 | { |
---|
| 517 | }; |
---|
| 518 | XMLTools.request('$this.Ujabber.pausedMessage','POST',handler_pausedMessage,"to="+pId); |
---|
| 519 | }; |
---|
| 520 | |
---|
| 521 | /* |
---|
| 522 | * Get_lang |
---|
| 523 | */ |
---|
| 524 | |
---|
| 525 | IM.prototype.get_lang = function(_key, _arg1, _arg2, _arg3, _arg4) |
---|
| 526 | { |
---|
| 527 | var _value = ""; |
---|
| 528 | |
---|
| 529 | if ( !lang_im[_key.toLowerCase()] ) |
---|
| 530 | return _key + "*"; |
---|
| 531 | |
---|
| 532 | _value = lang_im[_key.toLowerCase()]; |
---|
| 533 | |
---|
| 534 | if ( _arg1 || _arg2 ||_arg3 || _arg4 ) |
---|
| 535 | { |
---|
| 536 | for (j = 1; j <= 4; j++ ) |
---|
| 537 | if( eval("_arg"+j) ) |
---|
| 538 | { |
---|
| 539 | var regExp = new RegExp("%" + j + ""); |
---|
| 540 | _value = _value.replace(regExp, eval("_arg"+j)); |
---|
| 541 | } |
---|
| 542 | } |
---|
| 543 | |
---|
| 544 | return _value; |
---|
| 545 | }; |
---|
| 546 | |
---|
| 547 | IM.prototype.getWinContactsState = function() |
---|
| 548 | { |
---|
| 549 | try |
---|
| 550 | { |
---|
| 551 | var win_state = false; |
---|
| 552 | win_state = ( windowItems['contacts'].state == WINDOW_STATE_REGULAR ) ? true : false; |
---|
| 553 | win_state = ( win_state ) ? win_state : ( windowItems['contacts'].state == WINDOW_STATE_MAXIMIZED ) ? true : false; |
---|
| 554 | return win_state; |
---|
| 555 | |
---|
| 556 | }catch(e){} |
---|
| 557 | }; |
---|
| 558 | |
---|
| 559 | IM.prototype.showContacts = function() |
---|
| 560 | { |
---|
| 561 | if ( this.getWinContactsState() ) |
---|
| 562 | im_win.windowClose('contacts_im'); |
---|
| 563 | else |
---|
| 564 | { |
---|
| 565 | im_win.windowMaximizeRestore('contacts_im'); |
---|
| 566 | } |
---|
| 567 | }; |
---|
| 568 | |
---|
| 569 | /* |
---|
| 570 | * Smiles |
---|
| 571 | */ |
---|
| 572 | |
---|
| 573 | IM.prototype.emotions_icons = function(pEmotion) |
---|
| 574 | { |
---|
| 575 | var emotion_regexp; |
---|
| 576 | for ( i in cod_emotions ) |
---|
| 577 | { |
---|
| 578 | try |
---|
| 579 | { |
---|
| 580 | emotion_regexp = new RegExp(cod_emotions[i][1], 'gi'); |
---|
| 581 | if ( emotion_regexp.test(pEmotion) ) |
---|
| 582 | { |
---|
| 583 | var image = eval('smile_' + cod_emotions[i][0] + '.src.substr(smile_' +cod_emotions[i][0] + '.src.indexOf(im_path))'); |
---|
| 584 | emotion_regexp = new RegExp(cod_emotions[i][1], 'gi'); |
---|
| 585 | pEmotion = pEmotion.replace(emotion_regexp, '<img emotion="' + i + '" src="' + image + '">'); |
---|
| 586 | } |
---|
| 587 | }catch(e){} |
---|
| 588 | } |
---|
| 589 | return pEmotion; |
---|
| 590 | } |
---|
| 591 | |
---|
| 592 | IM.prototype.atalho = function() |
---|
| 593 | { |
---|
| 594 | if ( (local = func.byId('user_info')) && !(func.byId('myStatus')) ) |
---|
| 595 | { |
---|
| 596 | var aux = new Array(); |
---|
| 597 | var _mix = func.newEl('a', 'a', 'img', 'img', 'dl'); |
---|
| 598 | |
---|
| 599 | var fast_menu_link = _mix[0]; |
---|
| 600 | var contacts_link = _mix[1]; |
---|
| 601 | var fast_menu_image = _mix[2]; |
---|
| 602 | var contacts_image = _mix[3]; |
---|
| 603 | var im_fast_menu = _mix[4]; |
---|
| 604 | |
---|
| 605 | fast_menu_link.onclick = function(){IM.showFastMenu();}; |
---|
| 606 | contacts_link.onclick = function(){IM.showContacts();}; |
---|
| 607 | |
---|
| 608 | aux['fast_menu_image'] = new Array(); |
---|
| 609 | aux['fast_menu_image']['element'] = fast_menu_image; |
---|
| 610 | aux['fast_menu_image']['style'] = 'width:9px;height:9px'; |
---|
| 611 | aux['fast_menu_image']['src'] = im_path + 'templates/default/images/menuarwopen.gif'; |
---|
| 612 | |
---|
| 613 | aux['im_fast_menu'] = new Array(); |
---|
| 614 | aux['im_fast_menu']['element'] = im_fast_menu; |
---|
| 615 | aux['im_fast_menu']['id'] = 'fast_menu_im'; |
---|
| 616 | aux['im_fast_menu']['class'] = 'menu_im'; |
---|
| 617 | |
---|
| 618 | aux['contacts_image'] = new Array(); |
---|
| 619 | aux['contacts_image']['element'] = contacts_image; |
---|
| 620 | aux['contacts_image']['id'] = 'myStatus'; |
---|
| 621 | aux['contacts_image']['src'] = eval('img_' + statusFlag + '.src'); |
---|
| 622 | aux['contacts_image']['style'] = 'width:15px;height:15px'; |
---|
| 623 | func.confEl(aux); |
---|
| 624 | |
---|
| 625 | func.insEl(fast_menu_image, fast_menu_link); |
---|
| 626 | func.insEl(contacts_image, contacts_link); |
---|
| 627 | func.insElB(fast_menu_link, contacts_link, im_fast_menu, document.createTextNode(' '), local.firstChild); |
---|
| 628 | } |
---|
| 629 | else |
---|
| 630 | setTimeout('IM.atalho()', 5000); |
---|
| 631 | }; |
---|
| 632 | |
---|
| 633 | /* |
---|
| 634 | * Vcard |
---|
| 635 | */ |
---|
| 636 | |
---|
| 637 | IM.prototype.Vcard = function() |
---|
| 638 | { |
---|
| 639 | var _this = this; |
---|
| 640 | if( _this.count_Vcard < 4) |
---|
| 641 | { |
---|
| 642 | var handler_getVcard = function(_XMLdata) |
---|
| 643 | { |
---|
| 644 | var data = _XMLdata.getElementsByTagName('retorno').item(0); |
---|
| 645 | data = eval(data.firstChild.nodeValue); |
---|
| 646 | if(!data) |
---|
| 647 | setTimeout("IM.Vcard()",2000); |
---|
| 648 | _this.count_Vcard++; |
---|
| 649 | }; |
---|
| 650 | XMLTools.request('$this.Ujabber.Vcard','GET',handler_getVcard); |
---|
| 651 | }else{ |
---|
| 652 | var handler_getVcardUser = function(XMLdata) |
---|
| 653 | { |
---|
| 654 | }; |
---|
| 655 | XMLTools.request('$this.Ujabber.VcardUser','GET',handler_getVcardUser); |
---|
| 656 | } |
---|
| 657 | |
---|
| 658 | }; |
---|
| 659 | |
---|
| 660 | IM.prototype.getVcard = function(data) |
---|
| 661 | { |
---|
| 662 | var _this = this; |
---|
| 663 | try |
---|
| 664 | { |
---|
| 665 | if ( data.getElementsByTagName('vcard').length > 0 && !_this.statusvcard ) |
---|
| 666 | { |
---|
| 667 | var div = document.getElementById("im_vcard_contacts"); |
---|
| 668 | var xsl = XMLTools.load(im_path + 'xsl/vcard_contacts.xsl?' + Date.parse(new Date)); |
---|
| 669 | _this.statusvcard = true; |
---|
| 670 | |
---|
| 671 | div.innerHTML = ""; |
---|
| 672 | div.innerHTML += XMLTools.transform(data, xsl); |
---|
| 673 | IM_Preferences.vCardInit(); |
---|
| 674 | } |
---|
| 675 | |
---|
| 676 | |
---|
| 677 | }catch(e){} |
---|
| 678 | }; |
---|
| 679 | |
---|
| 680 | IM.prototype.open_chat = function(pJID) |
---|
| 681 | { |
---|
| 682 | im_win.open_chat(pJID); |
---|
| 683 | }; |
---|
| 684 | |
---|
| 685 | IM.prototype.action_button = function(pEv, pJid) |
---|
| 686 | { |
---|
| 687 | try |
---|
| 688 | { |
---|
| 689 | if ( pEv.button > 1 ) |
---|
| 690 | { |
---|
| 691 | var posx = 0; |
---|
| 692 | var posy = 0; |
---|
| 693 | if (pEv.pageX || pEv.pageY) |
---|
| 694 | { |
---|
| 695 | posx = pEv.pageX; |
---|
| 696 | posy = pEv.pageY; |
---|
| 697 | } |
---|
| 698 | else if (pEv.clientX || pEv.clientY) |
---|
| 699 | { |
---|
| 700 | posx = pEv.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; |
---|
| 701 | posy = pEv.clientY + document.body.scrollTop + document.documentElement.scrollTop; |
---|
| 702 | } |
---|
| 703 | this.menu_button_right(pJid, posx, posy); |
---|
| 704 | document.oncontextmenu = new Function("return false"); |
---|
| 705 | } |
---|
| 706 | else |
---|
| 707 | if ( func.byId(pJid).firstChild.src != img_unavailable.src ) |
---|
| 708 | this.open_chat(pJid); |
---|
| 709 | }catch(e){} |
---|
| 710 | }; |
---|
| 711 | |
---|
| 712 | IM.prototype.menu_button_right = function(pElement, pX, pY) |
---|
| 713 | { |
---|
| 714 | var form_menu_button_right = '<dl style="z-index:99999">'+ |
---|
| 715 | '<dt><a href="javascript:void(0);" onclick="javascript:IM_Preferences.Update_NickName(\''+pElement+'\');"><img src="'+img_group_close.src+'">' + IM.get_lang('Nick') + '</a>'+ |
---|
| 716 | '<dt><a href="javascript:void(0);" onclick="javascript:IM_Preferences.Update_Group(\''+pElement+'\');"><img src="'+img_group_close.src+'">' + IM.get_lang('Group') + '</a>'+ |
---|
| 717 | '<dt><a href="javascript:void(0);" onclick="javascript:IM_Preferences.RemoveContact(\''+pElement+'\');"><img src="'+img_group_close.src+'">' + IM.get_lang('Delete') + '</a>'+ |
---|
| 718 | '<dt><a href="javascript:void(0);" onclick="javascript:Subscription.RequestAutorization(\''+pElement+'\');"><img src="'+img_group_close.src+'">' + IM.get_lang('(Re)-requisitar Autorização') + '</a>' + |
---|
| 719 | '<dt><a href="javascript:void(0);" onclick="javascript:IM_Preferences.vCardLoad_Contact(\''+pElement+'\');"><img src="'+img_group_close.src+'">' + IM.get_lang('See Info') + '</a>'+ |
---|
| 720 | '</dl>'; |
---|
| 721 | im_menu_action.menu('menu_contato', form_menu_button_right); |
---|
| 722 | func.byId('menu_contato').style.top = pY-10; |
---|
| 723 | func.byId('menu_contato').style.left = pX-10; |
---|
| 724 | func.byId('menu_contato').style.zIndex = zValue + 10; |
---|
| 725 | }; |
---|
| 726 | |
---|
| 727 | /* |
---|
| 728 | * Menu |
---|
| 729 | */ |
---|
| 730 | |
---|
| 731 | IM.prototype.menu_preferences = function() |
---|
| 732 | { |
---|
| 733 | var posx = 0; |
---|
| 734 | var posy = 0; |
---|
| 735 | var pEv = arguments[0]; |
---|
| 736 | |
---|
| 737 | if (pEv.pageX || pEv.pageY) |
---|
| 738 | { |
---|
| 739 | posx = pEv.pageX; |
---|
| 740 | posy = pEv.pageY; |
---|
| 741 | } |
---|
| 742 | else if (pEv.clientX || pEv.clientY) |
---|
| 743 | { |
---|
| 744 | posx = pEv.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; |
---|
| 745 | posy = pEv.clientY + document.body.scrollTop + document.documentElement.scrollTop; |
---|
| 746 | } |
---|
| 747 | |
---|
| 748 | var p_element = document.getElementById(arguments[1]); |
---|
| 749 | var _xmlDoc = ""; |
---|
| 750 | var _this = this; |
---|
| 751 | |
---|
| 752 | _xmlDoc = '<menu>' + |
---|
| 753 | '<item function="IM_Preferences.Add_userLoad()" lang="'+IM.get_lang('Add Contact')+'"/>' + |
---|
| 754 | '<item function="IM_Preferences.Remove_userLoad()" lang="'+IM.get_lang('Remove Contact')+'"/>' + |
---|
| 755 | '<item function="IM_Preferences.vCard()" lang="'+IM.get_lang('Vcard')+'"/>' + |
---|
| 756 | '<item function="IM_Preferences.yourPreferences()" lang="'+IM.get_lang('preferences')+'"/>' + |
---|
| 757 | '</menu>'; |
---|
| 758 | |
---|
| 759 | im_menu_action.menu(p_element.id,parse_XmlXsl(_xmlDoc,'menu_preferences.xsl')); |
---|
| 760 | func.byId(p_element).style.top = posy; |
---|
| 761 | func.byId(p_element).style.left = posx; |
---|
| 762 | func.byId(p_element).style.zIndex = zValue + 10; |
---|
| 763 | |
---|
| 764 | _this.Load_Images_menu(); |
---|
| 765 | } |
---|
| 766 | |
---|
| 767 | IM.prototype.Load_Images_menu = function(Element) |
---|
| 768 | { |
---|
| 769 | try |
---|
| 770 | { |
---|
| 771 | var group = document.getElementById("dl_im_menu_preferences"); |
---|
| 772 | var Child = group.childNodes; |
---|
| 773 | |
---|
| 774 | for(var i = 0; i < Child.length; i++) |
---|
| 775 | { |
---|
| 776 | var img = document.createElement('img'); |
---|
| 777 | img.src = img_menu.src; |
---|
| 778 | Child[i].firstChild.insertBefore(img, Child[i].firstChild.firstChild); |
---|
| 779 | } |
---|
| 780 | }catch(e){} |
---|
| 781 | } |
---|
| 782 | |
---|
| 783 | /* |
---|
| 784 | * Função Provisória - By AlC |
---|
| 785 | */ |
---|
| 786 | |
---|
| 787 | function parse_XmlXsl(_xmlDoc, form_xsl) |
---|
| 788 | { |
---|
| 789 | var xslWin = false; |
---|
| 790 | |
---|
| 791 | if ( !xslWin ) xslWin = XMLTools.load(im_path + 'xsl/' + form_xsl + '?' + Date.parse(new Date)); |
---|
| 792 | |
---|
| 793 | a = document.createElement('div'); |
---|
| 794 | if (window.ActiveXObject) |
---|
| 795 | { |
---|
| 796 | var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); |
---|
| 797 | xmlDoc.async = "false"; |
---|
| 798 | xmlDoc.loadXML(_xmlDoc); |
---|
| 799 | } |
---|
| 800 | else |
---|
| 801 | { |
---|
| 802 | var parser = new DOMParser(); |
---|
| 803 | var xmlDoc = parser.parseFromString(_xmlDoc, "text/xml"); |
---|
| 804 | } |
---|
| 805 | a.innerHTML = XMLTools.transform(xmlDoc, xslWin); |
---|
| 806 | |
---|
| 807 | return a; |
---|
| 808 | |
---|
| 809 | } |
---|
| 810 | |
---|
| 811 | IM.prototype.showFastMenu = function() |
---|
| 812 | { |
---|
| 813 | var _dt = func.newEl('dt', 'dt', 'dt', 'dt', 'dt'); |
---|
| 814 | var _a = func.newEl('a', 'a', 'a', 'a', 'a'); |
---|
| 815 | |
---|
| 816 | for ( var i in _dt ) |
---|
| 817 | { |
---|
| 818 | if ( typeof _dt[i] == 'function' ) |
---|
| 819 | continue; |
---|
| 820 | eval('var option' + (parseInt(i)+1) + ' = _dt[' + i + '];'); |
---|
| 821 | eval('var option' + (parseInt(i)+1) + '_link = _a[' + i + '];'); |
---|
| 822 | } |
---|
| 823 | |
---|
| 824 | var _img = func.newEl('img', 'img', 'img', 'img','img'); |
---|
| 825 | |
---|
| 826 | for ( var i in _img ) |
---|
| 827 | { |
---|
| 828 | if ( typeof _dt[i] == 'function' ) |
---|
| 829 | continue; |
---|
| 830 | eval('var option' + (parseInt(i)+1) + '_image = _img[' + i + '];'); |
---|
| 831 | } |
---|
| 832 | |
---|
| 833 | option1_link.onclick = function(){statusFlag = 'available'; IM.setStatus('available');}; |
---|
| 834 | option2_link.onclick = function(){statusFlag = 'xa'; awayFlag = false; IM.setStatus('xa');}; |
---|
| 835 | option3_link.onclick = function(){statusFlag = 'dnd'; IM.setStatus('dnd');}; |
---|
| 836 | option4_link.onclick = function(){statusFlag = 'unavailable'; IM.setStatus('unavailable');}; |
---|
| 837 | option5_link.onclick = function(){IM.setStatus('custom')}; |
---|
| 838 | |
---|
| 839 | func.confEl(option1_image, 'src', img_available.src); |
---|
| 840 | func.confEl(option1_image, 'style', 'width:16px;height:16px;cursor:pointer;'); |
---|
| 841 | func.confEl(option2_image, 'src', img_xa.src); |
---|
| 842 | func.confEl(option2_image, 'style', 'width:16px;height:16px;cursor:pointer;'); |
---|
| 843 | func.confEl(option3_image, 'src', img_dnd.src); |
---|
| 844 | func.confEl(option3_image, 'style', 'width:16px;height:16px;cursor:pointer;'); |
---|
| 845 | func.confEl(option4_image, 'src', img_unavailable.src); |
---|
| 846 | func.confEl(option4_image, 'style', 'width:16px;height:16px;cursor:pointer;'); |
---|
| 847 | func.confEl(option5_image, 'src', img_edit.src); |
---|
| 848 | func.confEl(option5_image, 'style', 'width:16px;height:16px;cursor:pointer;'); |
---|
| 849 | |
---|
| 850 | func.insEl(option1_image, IM.get_lang('online'), option1_link); |
---|
| 851 | func.confEl(option1_link, 'style','cursor:pointer;'); |
---|
| 852 | func.insEl(option1_link, option1); |
---|
| 853 | |
---|
| 854 | func.insEl(option2_image, IM.get_lang('away'), option2_link); |
---|
| 855 | func.confEl(option2_link, 'style','cursor:pointer;'); |
---|
| 856 | func.insEl(option2_link, option2); |
---|
| 857 | |
---|
| 858 | func.insEl(option3_image, IM.get_lang('busy'), option3_link); |
---|
| 859 | func.confEl(option3_link, 'style','cursor:pointer;'); |
---|
| 860 | func.insEl(option3_link, option3); |
---|
| 861 | |
---|
| 862 | func.insEl(option4_image, IM.get_lang('offline'), option4_link); |
---|
| 863 | func.confEl(option4_link, 'style','cursor:pointer;'); |
---|
| 864 | func.insEl(option4_link, option4); |
---|
| 865 | |
---|
| 866 | func.insEl(option5_image, IM.get_lang('Custom message...'), option5_link); |
---|
| 867 | func.confEl(option5_link, 'style','cursor:pointer;'); |
---|
| 868 | func.insEl(option5_link, option5); |
---|
| 869 | |
---|
| 870 | im_menu_action.menu('fast_menu_im', option1, option2, option3, option4, option5); |
---|
| 871 | }; |
---|
| 872 | |
---|
| 873 | IM.prototype.setStatus = function(pStatus) |
---|
| 874 | { |
---|
| 875 | try |
---|
| 876 | { |
---|
| 877 | var handler = function() |
---|
| 878 | { |
---|
| 879 | }; |
---|
| 880 | |
---|
| 881 | if ( func.byId('fast_menu_im').style.display == 'block' ) |
---|
| 882 | im_menu_action.menu('fast_menu_im', null); |
---|
| 883 | |
---|
| 884 | if ( pStatus == 'custom' ) |
---|
| 885 | { |
---|
| 886 | pStatus = prompt('Personalize seu Status : ', this.custom_message); |
---|
| 887 | pStatus = 'show=' + statusFlag + '&status=' + pStatus; |
---|
| 888 | } |
---|
| 889 | else |
---|
| 890 | { |
---|
| 891 | if ( pStatus == 'unavailable' ) |
---|
| 892 | { |
---|
| 893 | this.ImgStatus(pStatus); |
---|
| 894 | pStatus = 'type=' + pStatus; |
---|
| 895 | } |
---|
| 896 | else |
---|
| 897 | { |
---|
| 898 | try |
---|
| 899 | { |
---|
| 900 | this.ImgStatus(pStatus); |
---|
| 901 | pStatus = 'show=' + pStatus; |
---|
| 902 | }catch(e){} |
---|
| 903 | } |
---|
| 904 | } |
---|
| 905 | XMLTools.request('$this.Ujabber.setPresence', 'POST', handler, pStatus); |
---|
| 906 | }catch(e){} |
---|
| 907 | }; |
---|
| 908 | |
---|
| 909 | IM.prototype.ImgStatus = function(pStatus) |
---|
| 910 | { |
---|
| 911 | var myStatus; |
---|
| 912 | if ( (myStatus = func.byId('myStatus')) ) |
---|
| 913 | myStatus.src = eval('img_' + pStatus + '.src'); |
---|
| 914 | }; |
---|
| 915 | |
---|
| 916 | IM.prototype.setAway = function() |
---|
| 917 | { |
---|
| 918 | if(statusFlag != 'dnd' && statusFlag != 'unavailable') |
---|
| 919 | { |
---|
| 920 | if ( awayFlag ) |
---|
| 921 | { |
---|
| 922 | this.setStatus('available'); |
---|
| 923 | statusFlag = 'available'; |
---|
| 924 | awayFlag = false; |
---|
| 925 | } |
---|
| 926 | else |
---|
| 927 | { |
---|
| 928 | this.setStatus('xa'); |
---|
| 929 | statusFlag = 'xa'; |
---|
| 930 | awayFlag = true; |
---|
| 931 | } |
---|
| 932 | } |
---|
| 933 | }; |
---|
| 934 | |
---|
| 935 | IM.prototype.infoContact = function(pUid) |
---|
| 936 | { |
---|
| 937 | try |
---|
| 938 | { |
---|
| 939 | var info = false; |
---|
| 940 | var div_allg = document.getElementById('all_groups'); |
---|
| 941 | var elements = div_allg.firstChild; |
---|
| 942 | while ( elements ) |
---|
| 943 | { |
---|
| 944 | var childs = elements.firstChild; |
---|
| 945 | while( childs ) |
---|
| 946 | { |
---|
| 947 | if(childs.tagName == "DIV" && childs.id.indexOf(pUid) === 0 ) |
---|
| 948 | { |
---|
| 949 | info = {'jid':childs.id, 'src':childs.firstChild.src}; |
---|
| 950 | break; |
---|
| 951 | } |
---|
| 952 | childs = childs.nextSibling; |
---|
| 953 | } |
---|
| 954 | if ( !info ) |
---|
| 955 | elements = elements.nextSibling; |
---|
| 956 | else |
---|
| 957 | break; |
---|
| 958 | } |
---|
| 959 | return info; |
---|
| 960 | }catch(e){return false;} |
---|
| 961 | }; |
---|
| 962 | |
---|
| 963 | var IM = new IM(); |
---|