1 | var im_win = { |
---|
2 | |
---|
3 | chat_pJid : null, |
---|
4 | _imWindowTemplate : null, |
---|
5 | xslWin : false, |
---|
6 | photo : false, |
---|
7 | |
---|
8 | "load" : function() |
---|
9 | { |
---|
10 | try |
---|
11 | { |
---|
12 | var backFantom = func.newEl('div'); |
---|
13 | func.confEl(backFantom, 'id', 'backFantom'); |
---|
14 | func.confEl(backFantom, 'style', 'position:absolute;top:0px;left:0px;width:100%;height:100%;z-Index:-1;'); |
---|
15 | |
---|
16 | var menu_contato = func.newEl('div'); |
---|
17 | func.confEl(menu_contato, 'id', 'menu_contato'); |
---|
18 | func.confEl(menu_contato, 'class', 'menu_im'); |
---|
19 | func.confEl(menu_contato, 'style', 'position:absolute;z-index:99999'); |
---|
20 | |
---|
21 | var emotions = func.newEl('div'); |
---|
22 | func.confEl(emotions, 'id', 'shared_emotions'); |
---|
23 | func.confEl(emotions, 'class', 'emotionFrame'); |
---|
24 | func.confEl(emotions, 'style', 'position:absolute;padding:1px;left:350px;visibility:hidden;top:0px'); |
---|
25 | |
---|
26 | var font_name = func.newEl('div'); |
---|
27 | func.confEl(font_name, 'id', 'shared_fontName'); |
---|
28 | func.confEl(font_name, 'class', 'statusMenu'); |
---|
29 | func.confEl(font_name, 'style', 'position:absolute;visibility:hidden;padding:1px;left:400px;top:0px'); |
---|
30 | |
---|
31 | var font_size = func.newEl('div'); |
---|
32 | func.confEl(font_size, 'id', 'shared_fontSize'); |
---|
33 | func.confEl(font_size, 'class', 'statusMenu'); |
---|
34 | func.confEl(font_size, 'style', 'position:absolute;visibility:hidden;padding:1px;left:400px;top:0px'); |
---|
35 | |
---|
36 | var font_color = func.newEl('div'); |
---|
37 | func.confEl(font_color, 'id', 'shared_fontColor'); |
---|
38 | func.confEl(font_color, 'class', 'statusMenu'); |
---|
39 | func.confEl(font_color, 'style', 'position:absolute;visibility:hidden;padding:1px;left:400px;top:0px'); |
---|
40 | |
---|
41 | var font_style = func.newEl('div'); |
---|
42 | func.confEl(font_style, 'id', 'shared_fontStyle'); |
---|
43 | func.confEl(font_style, 'class', 'statusMenu'); |
---|
44 | func.confEl(font_style, 'style', 'position:absolute;visibility:hidden;padding:1px;left:400px;top:0px'); |
---|
45 | |
---|
46 | func.insEl(backFantom, menu_contato, emotions, font_name, font_size, font_color, font_style, false); |
---|
47 | |
---|
48 | emotions.innerHTML = Templates.emotions(); |
---|
49 | font_name.innerHTML = Templates.font_name(); |
---|
50 | font_size.innerHTML = Templates.font_size(); |
---|
51 | font_color.innerHTML = Templates.font_color(); |
---|
52 | /*font_style.innerHTML = Templates.font_style();*/ |
---|
53 | |
---|
54 | var pId = 'contacts'; |
---|
55 | |
---|
56 | var main_menu_all = func.newEl('div'); |
---|
57 | func.confEl(main_menu_all, 'style', 'margin: 3px;'); |
---|
58 | |
---|
59 | var main_menu_head = func.newEl('div'); |
---|
60 | func.confEl(main_menu_head, 'id', pId + '_im_window_body_inner_head'); |
---|
61 | func.confEl(main_menu_head, 'style', 'margin: 0px 0px 3px 0px; border: 1px solid #809aa9; display: block;'); |
---|
62 | |
---|
63 | var main_menu_vcard = func.newEl('div'); |
---|
64 | func.confEl(main_menu_vcard, 'id', 'im_vcard_contacts'); |
---|
65 | func.confEl(main_menu_vcard, 'style', 'display: none;'); |
---|
66 | |
---|
67 | var main_menu_body = func.newEl('div'); |
---|
68 | func.confEl(main_menu_body, 'id', 'div_contacts'); |
---|
69 | func.confEl(main_menu_body, 'style', 'border: 1px solid #809aa9;'); |
---|
70 | main_menu_body.innerHTML = '<b>Nenhum Contato</b>'; |
---|
71 | |
---|
72 | func.insEl(main_menu_head, main_menu_vcard, main_menu_body, main_menu_all); |
---|
73 | |
---|
74 | var main_menu_head_picture = func.newEl('img'); |
---|
75 | func.confEl(main_menu_head_picture, 'id', pId + '_avatar'); |
---|
76 | func.confEl(main_menu_head_picture, 'src', img_photo.src); |
---|
77 | func.confEl(main_menu_head_picture, 'style', 'float: left; height: 65px; margin: 2px; width: 49px;'); |
---|
78 | |
---|
79 | var main_menu_head_name_lable = func.newEl('span'); |
---|
80 | func.confEl(main_menu_head_name_lable,'style','margin: 3px;'); |
---|
81 | main_menu_head_name_lable.innerHTML = IM.get_lang('Nickname'); |
---|
82 | |
---|
83 | var br1 = func.newEl('br'); |
---|
84 | |
---|
85 | var main_menu_head_name = func.newEl('span'); |
---|
86 | func.confEl(main_menu_head_name, 'id', 'span_nickname'); |
---|
87 | func.confEl(main_menu_head_name, 'style', 'margin-left: 5px;'); |
---|
88 | var main_menu_head_name_txt = document.createTextNode("your nickname"); |
---|
89 | func.insEl(main_menu_head_name_txt, main_menu_head_name); |
---|
90 | |
---|
91 | var br2 = func.newEl('br'); |
---|
92 | var br3 = func.newEl('br'); |
---|
93 | |
---|
94 | func.insEl(main_menu_head_picture, main_menu_head_name_lable, br1, main_menu_head_name, br2, br3, main_menu_head); |
---|
95 | |
---|
96 | var main_menu_head_div = func.newEl("div"); |
---|
97 | func.confEl(main_menu_head_div,'id','menu_preferences'); |
---|
98 | func.confEl(main_menu_head_div,'class','menu_im'); |
---|
99 | func.confEl(main_menu_head_div,'style','float: left;cursor:pointer'); |
---|
100 | |
---|
101 | func.insEl(main_menu_head_div, false); |
---|
102 | |
---|
103 | var params = []; |
---|
104 | params['body'] = main_menu_all; |
---|
105 | params['close'] = true; |
---|
106 | params['height'] = 270; |
---|
107 | params['left'] = 10; |
---|
108 | params['id'] = pId; |
---|
109 | params['maximize'] = true; |
---|
110 | params['style'] = 'visibility:hidden'; |
---|
111 | params['title'] = 'Expresso Messenger'; |
---|
112 | params['top'] = 10; |
---|
113 | params['width'] = 210; |
---|
114 | this.build(params); |
---|
115 | |
---|
116 | this.config(pId); |
---|
117 | |
---|
118 | this.windowMinimize(pId + '_im'); |
---|
119 | |
---|
120 | main_menu_head.innerHTML += '<span id="span_menu_pref" style="float: left;cursor: pointer;" onmousedown="IM.menu_preferences(event ,\'menu_preferences\'); document.oncontextmenu = new Function(\'return false\');"></span>'; |
---|
121 | |
---|
122 | var br3 = func.newEl('br'); |
---|
123 | func.confEl(br3, 'style', 'clear: both'); |
---|
124 | |
---|
125 | var div_ie = func.newEl('div'); |
---|
126 | |
---|
127 | func.insEl(br3, div_ie, main_menu_head); |
---|
128 | |
---|
129 | main_menu_head_pref_img = func.newEl('img'); |
---|
130 | func.confEl(main_menu_head_pref_img, 'src', img_group_close.src); |
---|
131 | func.confEl(main_menu_head_pref_img, 'id', 'img_pref'); |
---|
132 | |
---|
133 | main_menu_head_pref_txt = document.createTextNode(IM.get_lang('Options')); |
---|
134 | |
---|
135 | func.insEl(main_menu_head_pref_img, main_menu_head_pref_txt, 'span_menu_pref'); |
---|
136 | } |
---|
137 | catch(e) |
---|
138 | { |
---|
139 | alert("load\n\n" + e + "\n\n" + e.description) |
---|
140 | } |
---|
141 | }, |
---|
142 | |
---|
143 | "config" : function(pId) |
---|
144 | { |
---|
145 | try |
---|
146 | { |
---|
147 | ADD_DHTML("backFantom"+NO_DRAG); |
---|
148 | ADD_DHTML("shared_fontStyle"+NO_DRAG); |
---|
149 | ADD_DHTML("shared_fontColor"+NO_DRAG); |
---|
150 | ADD_DHTML("shared_fontSize"+NO_DRAG); |
---|
151 | ADD_DHTML("shared_fontName"+NO_DRAG); |
---|
152 | ADD_DHTML("shared_emotions"+NO_DRAG); |
---|
153 | ADD_DHTML(pId+"_im_window_body_inner"+NO_DRAG); |
---|
154 | ADD_DHTML(pId+"_im_window"+NO_DRAG); |
---|
155 | ADD_DHTML(pId+"_im_window_master"+NO_DRAG); |
---|
156 | ADD_DHTML(pId+"_im_window_fantom"+NO_DRAG); |
---|
157 | ADD_DHTML(pId+"_im_window_movable"+CURSOR_MOVE); |
---|
158 | ADD_DHTML(pId+"_im_window_resize"+CURSOR_NW_RESIZE); |
---|
159 | |
---|
160 | |
---|
161 | dd.elements.backFantom.setOpacity(0); |
---|
162 | document.getElementById("backFantom").style.zIndex = -1; |
---|
163 | |
---|
164 | |
---|
165 | dd.elements.contacts_im_window_resize.moveTo(dd.elements.contacts_im_window.x+dd.elements.contacts_im_window.w-dd.elements.contacts_im_window_resize.w-2, dd.elements.contacts_im_window.y+dd.elements.contacts_im_window.h-dd.elements.contacts_im_window_resize.h-2); |
---|
166 | dd.elements.contacts_im_window_movable.moveTo(dd.elements.contacts_im_window.x, dd.elements.contacts_im_window.y); |
---|
167 | dd.elements.contacts_im_window_movable.setOpacity(0); |
---|
168 | |
---|
169 | dd.elements.contacts_im_window_resize.setOpacity(1); |
---|
170 | dd.elements.contacts_im_window_resize.moveTo(dd.elements.contacts_im_window_fantom.x+dd.elements.contacts_im_window_fantom.w-dd.elements.contacts_im_window_resize.w-2, dd.elements.contacts_im_window_fantom.y+dd.elements.contacts_im_window_fantom.h-dd.elements.contacts_im_window_resize.h-2); |
---|
171 | |
---|
172 | var contacts_im_window = new Object(); |
---|
173 | contacts_im_window.x = dd.elements.contacts_im_window_master.x; |
---|
174 | contacts_im_window.y = dd.elements.contacts_im_window_master.y; |
---|
175 | contacts_im_window.w = dd.elements.contacts_im_window_master.w; |
---|
176 | contacts_im_window.h = dd.elements.contacts_im_window_master.h; |
---|
177 | contacts_im_window.state = WINDOW_STATE_REGULAR; |
---|
178 | windowItems[pId] = contacts_im_window; |
---|
179 | } |
---|
180 | catch(e) |
---|
181 | { |
---|
182 | alert("config\n\n" + e + "\n\n" + e.description) |
---|
183 | } |
---|
184 | }, |
---|
185 | |
---|
186 | "build" : function() |
---|
187 | { |
---|
188 | var pBody = ''; |
---|
189 | var pClose = true; |
---|
190 | var pHeight = 360; |
---|
191 | var pId = false; |
---|
192 | var pLeft = NaN; |
---|
193 | var pMaximize = true; |
---|
194 | var pMinimize = true; |
---|
195 | var pStyle = ''; |
---|
196 | var pTitle = ''; |
---|
197 | var pTop = NaN; |
---|
198 | var pWidth = 250; |
---|
199 | |
---|
200 | for ( var i = 0; i < arguments.length; i++ ) |
---|
201 | { |
---|
202 | for ( var n in arguments[i] ) |
---|
203 | if ( !func.isUndefined(arguments[i][n]) ) |
---|
204 | switch ( n ) |
---|
205 | { |
---|
206 | case 'body' : pBody = arguments[i][n]; break; |
---|
207 | case 'close' : pClose = arguments[i][n]; break; |
---|
208 | case 'height' : pHeight = arguments[i][n]; break; |
---|
209 | case 'id' : pId = arguments[i][n]; break; |
---|
210 | case 'left' : pLeft = arguments[i][n]; break; |
---|
211 | case 'maximize': pMaximize = arguments[i][n]; break; |
---|
212 | case 'minimize': pMinimize = arguments[i][n]; break; |
---|
213 | case 'style' : pStyle = arguments[i][n]; break; |
---|
214 | case 'title' : pTitle = arguments[i][n]; break; |
---|
215 | case 'top' : pTop = arguments[i][n]; break; |
---|
216 | case 'width' : pWidth = arguments[i][n]; break; |
---|
217 | } |
---|
218 | } |
---|
219 | |
---|
220 | if ( !pId || pHeight < 60 || pWidth < 100 ) |
---|
221 | return false; |
---|
222 | |
---|
223 | if ( isNaN(pLeft) ) |
---|
224 | if ( windowItems[pId] ) |
---|
225 | pLeft = windowItems[pId].x; |
---|
226 | else |
---|
227 | pLeft = Math.floor(Math.random()*(dd.getWndH()-100)); |
---|
228 | |
---|
229 | if ( isNaN(pTop) ) |
---|
230 | if ( windowItems[pId] ) |
---|
231 | pTop = windowItems[pId].y; |
---|
232 | else |
---|
233 | pTop = Math.floor(Math.random()*(dd.getWndW()-pHeight-480)) |
---|
234 | |
---|
235 | if ( windowItems[pId] ) |
---|
236 | { |
---|
237 | pHeight = dd.elements[pId + "_im_window_body_inner"].h; |
---|
238 | pWidth = dd.elements[pId + "_im_window_body_inner"].w; |
---|
239 | } |
---|
240 | |
---|
241 | if ( !this.xslWin ) this.xslWin = XMLTools.load(im_path + 'xsl/window.xsl?' + Date.parse(new Date)); |
---|
242 | _xmlDoc = '<window id="' + pId + '" title="' + pTitle + '" height="' + pHeight + '" width="' + pWidth + '" left="' + pLeft + '" top="' + pTop + '" minimize="' + pMinimize + '" maximize="' + pMaximize + '" close="' + pClose + '" style="position:absolute;' + pStyle + '" />'; |
---|
243 | |
---|
244 | a = document.createElement('div'); |
---|
245 | |
---|
246 | if (window.ActiveXObject) |
---|
247 | { |
---|
248 | var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); |
---|
249 | xmlDoc.async = "false"; |
---|
250 | xmlDoc.loadXML(_xmlDoc); |
---|
251 | } |
---|
252 | else |
---|
253 | { |
---|
254 | var parser = new DOMParser(); |
---|
255 | var xmlDoc = parser.parseFromString(_xmlDoc, "text/xml"); |
---|
256 | } |
---|
257 | a.innerHTML = XMLTools.transform(xmlDoc, this.xslWin); |
---|
258 | document.getElementsByTagName('body').item(0).appendChild(a); |
---|
259 | |
---|
260 | switch ( typeof pBody ) |
---|
261 | { |
---|
262 | case 'object' : |
---|
263 | func.insEl(pBody, pId + '_im_window_body_inner'); |
---|
264 | break; |
---|
265 | case 'string' : |
---|
266 | func.byId(pId + '_im_window_body_inner').innerHTML = pBody; |
---|
267 | |
---|
268 | } |
---|
269 | |
---|
270 | RoundedTop('div#' + pId + '_im_window_master', '', '#cbdae4'); |
---|
271 | this.windowMaximizeZ(pId); |
---|
272 | |
---|
273 | }, |
---|
274 | |
---|
275 | "hideAllChatSelections" : function() |
---|
276 | { |
---|
277 | this.hideEmotionSelection(); |
---|
278 | this.hideFontNameSelection(); |
---|
279 | this.hideFontSizeSelection(); |
---|
280 | this.hideFontColorSelection(); |
---|
281 | this.hideFontStyleSelection(); |
---|
282 | }, |
---|
283 | |
---|
284 | "hideWindowItem" : function(pId) |
---|
285 | { |
---|
286 | try |
---|
287 | { |
---|
288 | dd.elements[pId + "_im_window"].hide(); |
---|
289 | dd.elements[pId + "_im_window_master"].hide(); |
---|
290 | dd.elements[pId + "_im_window_fantom"].hide(); |
---|
291 | dd.elements[pId + "_im_window_resize"].hide(); |
---|
292 | dd.elements[pId + "_im_window_movable"].hide(); |
---|
293 | if ( (name_document = document.getElementById(pId + '_divEdita')) ) |
---|
294 | { |
---|
295 | name_document.innerHTML = ''; |
---|
296 | var contact = func.byId(pId); |
---|
297 | var _status = IM.vcard_contacts[contact.getAttribute('nuncontact')].online |
---|
298 | contact.firstChild.src = ( _status == parseInt(1) ) ? img_online.src : img_offline.src; |
---|
299 | } |
---|
300 | } |
---|
301 | catch(e) |
---|
302 | {} |
---|
303 | }, |
---|
304 | |
---|
305 | "incZ" : function() |
---|
306 | { |
---|
307 | zValue += 5; |
---|
308 | return zValue; |
---|
309 | }, |
---|
310 | |
---|
311 | "drag" : function() |
---|
312 | { |
---|
313 | try |
---|
314 | { |
---|
315 | var objName = dd.obj.name; |
---|
316 | i = objName.indexOf("_"); |
---|
317 | objName = objName.substr(0,i); |
---|
318 | |
---|
319 | this.incZ(); |
---|
320 | document.getElementById(objName + "_im_window_fantom").style.zIndex = zValue; |
---|
321 | dd.elements[objName + "_im_window_fantom"].setOpacity(0.5); |
---|
322 | |
---|
323 | document.getElementById(objName + "_im_window_fantom").className = "im_window_fantom"; |
---|
324 | |
---|
325 | var posX = dd.obj.x; |
---|
326 | var posY = dd.obj.y; |
---|
327 | if ( posX < 0 ) |
---|
328 | posX = 0; |
---|
329 | if ( posY < 0 ) |
---|
330 | posY = 0; |
---|
331 | |
---|
332 | dd.elements[objName + "_im_window_resize"].setOpacity(0); |
---|
333 | |
---|
334 | if ( dd.obj.name == (objName + "_im_window_resize") ) |
---|
335 | { |
---|
336 | windowState = WINDOW_STATE_REGULAR; |
---|
337 | |
---|
338 | // check if the re-size goes out of the screen |
---|
339 | if ( posX > ( dd.getWndW() - 15 ) ) |
---|
340 | posX = dd.getWndW()-15; |
---|
341 | if ( posY > ( dd.getWndH() - 13 ) ) |
---|
342 | posY = dd.getWndH()-13; |
---|
343 | |
---|
344 | // everything is fine, let's change the size of all required objects |
---|
345 | var newW = posX-dd.elements[objName + "_im_window_fantom"].x+15; |
---|
346 | var newH = posY-dd.elements[objName + "_im_window_fantom"].y+15; |
---|
347 | if ( newW < 100) newW = 100; |
---|
348 | if ( newH < 100) newH = 100; |
---|
349 | dd.elements[objName + "_im_window_fantom"].resizeTo(newW, newH); |
---|
350 | |
---|
351 | if( document.getElementById(objName + "_chatMessages")) |
---|
352 | { |
---|
353 | func.confEl(document.getElementById(objName + "_chatMessages"),"style","width:" + (newW - 105) +";height:" + (newH - 150) +";margin: 2px 0px 2px 2px; overflow:auto;"); |
---|
354 | func.confEl(document.getElementById(objName + '_edita'),"style","width:" + (newW - 105) + ";height: 50px;margin: 3px 1px 0px 2px;float: left;"); |
---|
355 | } |
---|
356 | |
---|
357 | dd.elements[objName + "_im_window_resize"].moveTo(dd.elements[objName + "_im_window_fantom"].x+dd.elements[objName + "_im_window_fantom"].w-dd.elements[objName + "_im_window_resize"].w-2, dd.elements[objName + "_im_window_fantom"].y+dd.elements[objName + "_im_window_fantom"].h-dd.elements[objName + "_im_window_resize"].h-2); |
---|
358 | var windowItem = windowItems[objName]; |
---|
359 | windowItem.state = WINDOW_STATE_REGULAR; |
---|
360 | } |
---|
361 | else |
---|
362 | { |
---|
363 | if ( posX > ( dd.getWndW() - dd.elements[objName + "_im_window_master"].w ) ) |
---|
364 | posX = dd.getWndW() - dd.elements[objName + "_im_window_master"].w; |
---|
365 | |
---|
366 | if ( posY > ( dd.getWndH() - dd.elements[objName + "_im_window_master"].h ) ) |
---|
367 | posY = dd.getWndH() - dd.elements[objName + "_im_window_master"].h; |
---|
368 | |
---|
369 | dd.elements[objName + "_im_window_fantom"].moveTo(posX, posY); |
---|
370 | } |
---|
371 | } |
---|
372 | catch(e) |
---|
373 | { |
---|
374 | } |
---|
375 | }, |
---|
376 | |
---|
377 | "drop" : function() |
---|
378 | { |
---|
379 | try |
---|
380 | { |
---|
381 | document.getElementById("backFantom").style.zIndex = -1; |
---|
382 | |
---|
383 | var objName = dd.obj.name; |
---|
384 | i = objName.indexOf("_"); |
---|
385 | objName = objName.substr(0,i); |
---|
386 | |
---|
387 | var posX = dd.obj.x; |
---|
388 | var posY = dd.obj.y; |
---|
389 | if ( posX < 0 ) |
---|
390 | posX = 0; |
---|
391 | if ( posY < 0 ) |
---|
392 | posY = 0; |
---|
393 | if ( posX > ( dd.getWndW() - dd.elements[objName + "_im_window_master"].w ) ) |
---|
394 | posX = dd.getWndW() - dd.elements[objName + "_im_window_master"].w; |
---|
395 | if ( posY > ( dd.getWndH() - dd.elements[objName + "_im_window_master"].h ) ) |
---|
396 | posY = dd.getWndH() - dd.elements[objName + "_im_window_master"].h; |
---|
397 | |
---|
398 | dd.elements[objName + "_im_window_resize"].setOpacity(1); |
---|
399 | |
---|
400 | if ( dd.obj.name == (objName + "_im_window_resize") ) |
---|
401 | { |
---|
402 | var newW = dd.obj.x-dd.elements[objName + "_im_window_fantom"].x+17; |
---|
403 | var newH = dd.obj.y-dd.elements[objName + "_im_window_fantom"].y+17; |
---|
404 | |
---|
405 | if ( newW < 100) newW = 100; |
---|
406 | if ( newH < 100) newH = 100; |
---|
407 | |
---|
408 | var winW = dd.elements[objName + "_im_window_master"].w - dd.elements[objName + "_im_window"].w; |
---|
409 | var winH = dd.elements[objName + "_im_window_master"].h - dd.elements[objName + "_im_window"].h; |
---|
410 | |
---|
411 | dd.elements[objName + "_im_window_fantom"].resizeTo(newW, newH); |
---|
412 | dd.elements[objName + "_im_window_master"].resizeTo(newW, newH); |
---|
413 | |
---|
414 | var bodyW = dd.elements[objName + "_im_window"].w - dd.elements[objName + "_im_window_body_inner"].w; |
---|
415 | var bodyH = dd.elements[objName + "_im_window"].h - dd.elements[objName + "_im_window_body_inner"].h; |
---|
416 | |
---|
417 | dd.elements[objName + "_im_window"].resizeTo(newW - winW, newH - winH); |
---|
418 | |
---|
419 | bodyW = dd.elements[objName + "_im_window"].w - bodyW; |
---|
420 | bodyH = dd.elements[objName + "_im_window"].h - bodyH; |
---|
421 | |
---|
422 | dd.elements[objName + "_im_window_body_inner"].resizeTo(bodyW, bodyH); |
---|
423 | |
---|
424 | dd.elements[objName + "_im_window_movable"].resizeTo(newW-55, 25); |
---|
425 | dd.elements[objName + "_im_window_resize"].moveTo(dd.elements[objName + "_im_window_fantom"].x+dd.elements[objName + "_im_window_fantom"].w-dd.elements[objName + "_im_window_resize"].w-2, dd.elements[objName + "_im_window_fantom"].y+dd.elements[objName + "_im_window_fantom"].h-dd.elements[objName + "_im_window_resize"].h-2); |
---|
426 | } |
---|
427 | else |
---|
428 | { |
---|
429 | dd.elements[objName + "_im_window_fantom"].moveTo(posX, posY); |
---|
430 | dd.elements[objName + "_im_window_master"].moveTo(posX, posY); |
---|
431 | dd.elements[objName + "_im_window"].moveTo(posX, (posY+4)); |
---|
432 | dd.elements[objName + "_im_window_movable"].moveTo(posX, posY); |
---|
433 | dd.elements[objName + "_im_window_resize"].moveTo(dd.elements[objName + "_im_window_fantom"].x+dd.elements[objName + "_im_window_fantom"].w-dd.elements[objName + "_im_window_resize"].w-3, dd.elements[objName + "_im_window_fantom"].y+dd.elements[objName + "_im_window_fantom"].h-dd.elements[objName + "_im_window_resize"].h-3); |
---|
434 | } |
---|
435 | |
---|
436 | this.windowMaximizeZ(objName); |
---|
437 | |
---|
438 | dd.elements[objName + "_im_window_fantom"].setOpacity(0); |
---|
439 | var windowItem = windowItems[objName]; |
---|
440 | |
---|
441 | if ( windowItem != null ) |
---|
442 | { |
---|
443 | windowItem.x = dd.elements[objName + "_im_window_master"].x; |
---|
444 | windowItem.y = dd.elements[objName + "_im_window_master"].y; |
---|
445 | windowItem.w = dd.elements[objName + "_im_window_master"].w; |
---|
446 | windowItem.h = dd.elements[objName + "_im_window_master"].h; |
---|
447 | } |
---|
448 | }catch(e){} |
---|
449 | }, |
---|
450 | |
---|
451 | "pick" : function() |
---|
452 | { |
---|
453 | document.getElementById("backFantom").style.zIndex = zValue; |
---|
454 | this.hideAllChatSelections(); |
---|
455 | var objName = dd.obj.name; |
---|
456 | i = objName.indexOf("_im"); |
---|
457 | objName = objName.substr(0,i); |
---|
458 | ACTIVE_OBJECTID = objName; |
---|
459 | }, |
---|
460 | |
---|
461 | "showWindowItem" : function(pId) |
---|
462 | { |
---|
463 | /* |
---|
464 | * Não tire esta linha |
---|
465 | * Isso deve estar aqui para a janela 'oculta' |
---|
466 | * não 'piscar' na tela no momento que é criada. |
---|
467 | */ |
---|
468 | func.byId(pId + '_im_window_body_inner').style.overflow = 'auto'; |
---|
469 | |
---|
470 | if ( (name_document = document.getElementById(pId + '_divEdita')) ) |
---|
471 | { |
---|
472 | name_document.innerHTML = '<iframe name="' + pId.replace('@', '_at_').replace(/\./g, '_dot_') + '_edita" class="edit_message" id="' + pId + '_edita" frameborder="0" style="border:margin: 3px 1px 0px 2px; width:220px; height:50px; float:left;"></iframe>'; |
---|
473 | |
---|
474 | name_document = document.getElementById(pId + '_edita'); |
---|
475 | name_document.contentWindow.document.write('<html><body id="' + pId.replace('@', '_at_').replace(/\./g, '_dot_') + '" style="margin:0px;padding:0px"></body></html>'); |
---|
476 | name_document.contentWindow.document.close(); |
---|
477 | name_document.contentWindow.document.designMode = "On"; |
---|
478 | |
---|
479 | func.attachEvent(name_document.contentWindow.document, 'keypress', im_win.getText); |
---|
480 | func.attachEvent(name_document.contentWindow.document, 'keyup', im_win.clearText); |
---|
481 | |
---|
482 | name_document.contentWindow.focus(); |
---|
483 | } |
---|
484 | |
---|
485 | dd.elements[pId + "_im_window_master"].show(); |
---|
486 | dd.elements[pId + "_im_window"].show(); |
---|
487 | dd.elements[pId + "_im_window_fantom"].show(); |
---|
488 | dd.elements[pId + "_im_window_resize"].show(); |
---|
489 | dd.elements[pId + "_im_window_movable"].show(); |
---|
490 | |
---|
491 | }, |
---|
492 | |
---|
493 | "windowMaximizeZ" : function(objName) |
---|
494 | { |
---|
495 | try |
---|
496 | { |
---|
497 | this.incZ(); |
---|
498 | document.getElementById(objName + "_im_window_fantom").style.zIndex = zValue-3; |
---|
499 | document.getElementById(objName + "_im_window_master").style.zIndex = zValue-2; |
---|
500 | document.getElementById(objName + "_im_window").style.zIndex = zValue-1; |
---|
501 | document.getElementById(objName + "_im_window_body_inner").style.zIndex = zValue-1; |
---|
502 | document.getElementById(objName + "_im_window_resize").style.zIndex = zValue; |
---|
503 | document.getElementById(objName + "_im_window_movable").style.zIndex = zValue; |
---|
504 | if ( dd.elements[objName + "_im_window_movable"] ) |
---|
505 | dd.elements[objName + "_im_window_movable"].z = zValue+1; |
---|
506 | }catch(e){} |
---|
507 | }, |
---|
508 | |
---|
509 | "windowMinimize" : function(objName) |
---|
510 | { |
---|
511 | with(objName) |
---|
512 | objName = substr(0, indexOf('_im')); |
---|
513 | |
---|
514 | this.hideWindowItem(objName); |
---|
515 | windowItem = windowItems[objName]; |
---|
516 | if ( windowItem != null ) |
---|
517 | { |
---|
518 | windowItem.state = WINDOW_STATE_MINIMIZED; |
---|
519 | } |
---|
520 | |
---|
521 | }, |
---|
522 | |
---|
523 | "windowMaximizeRestore" : function(objName) |
---|
524 | { |
---|
525 | with(objName) |
---|
526 | objName = substr(0, indexOf('_im')); |
---|
527 | |
---|
528 | this.hideAllChatSelections(); |
---|
529 | |
---|
530 | windowItem = windowItems[objName]; |
---|
531 | |
---|
532 | if ( windowItem != null ) |
---|
533 | { |
---|
534 | var bodyW = dd.elements[objName + "_im_window"].w - dd.elements[objName + "_im_window_body_inner"].w; |
---|
535 | var bodyH = dd.elements[objName + "_im_window"].h - dd.elements[objName + "_im_window_body_inner"].h; |
---|
536 | |
---|
537 | if ( windowItem.state==WINDOW_STATE_REGULAR ) |
---|
538 | { |
---|
539 | windowItem.x = dd.elements[objName + "_im_window_master"].x; |
---|
540 | windowItem.y = dd.elements[objName + "_im_window_master"].y; |
---|
541 | windowItem.w = dd.elements[objName + "_im_window_master"].w; |
---|
542 | windowItem.h = dd.elements[objName + "_im_window_master"].h; |
---|
543 | |
---|
544 | var bodyX = dd.elements[objName + "_im_window_body_inner"].x + dd.elements[objName + "_im_window"].x; |
---|
545 | var bodyY = dd.elements[objName + "_im_window_body_inner"].y + dd.elements[objName + "_im_window"].y; |
---|
546 | |
---|
547 | dd.elements[objName + "_im_window_fantom"].moveTo(0, 0); |
---|
548 | dd.elements[objName + "_im_window_master"].moveTo(0, 0); |
---|
549 | dd.elements[objName + "_im_window"].moveTo(0, 4); |
---|
550 | |
---|
551 | dd.elements[objName + "_im_window_fantom"].resizeTo(dd.getWndW(), dd.getWndH()); |
---|
552 | dd.elements[objName + "_im_window_master"].resizeTo(dd.getWndW(), dd.getWndH()); |
---|
553 | dd.elements[objName + "_im_window"].resizeTo(dd.getWndW(), dd.getWndH() - 5); |
---|
554 | dd.elements[objName + "_im_window_body_inner"].resizeTo(dd.getWndW() - bodyW, dd.getWndH() - bodyH - 5); |
---|
555 | |
---|
556 | dd.elements[objName + "_im_window_resize"].moveTo(dd.elements[objName + "_im_window_fantom"].x+dd.elements[objName + "_im_window_fantom"].w-dd.elements[objName + "_im_window_resize"].w-2, dd.elements[objName + "_im_window_fantom"].y+dd.elements[objName + "_im_window_fantom"].h-dd.elements[objName + "_im_window_resize"].h-2); |
---|
557 | windowItem.state = WINDOW_STATE_MAXIMIZED; |
---|
558 | |
---|
559 | window.status = objName + "'s Z: " + document.getElementById(objName+"_im_window").style.zIndex; |
---|
560 | |
---|
561 | } |
---|
562 | else |
---|
563 | { |
---|
564 | dd.elements[objName + "_im_window_fantom"].resizeTo(windowItem.w, windowItem.h); |
---|
565 | dd.elements[objName + "_im_window_master"].resizeTo(windowItem.w, windowItem.h); |
---|
566 | dd.elements[objName + "_im_window"].resizeTo(windowItem.w, windowItem.h - 5); |
---|
567 | dd.elements[objName + "_im_window_body_inner"].resizeTo(windowItem.w - bodyW, windowItem.h - bodyH - 5); |
---|
568 | |
---|
569 | dd.elements[objName + "_im_window_fantom"].moveTo(windowItem.x, windowItem.y); |
---|
570 | dd.elements[objName + "_im_window_master"].moveTo(windowItem.x, windowItem.y); |
---|
571 | dd.elements[objName + "_im_window_resize"].moveTo(dd.elements[objName + "_im_window_fantom"].x+dd.elements[objName + "_im_window_fantom"].w-dd.elements[objName + "_im_window_resize"].w-2, dd.elements[objName + "_im_window_fantom"].y+dd.elements[objName + "_im_window_fantom"].h-dd.elements[objName + "_im_window_resize"].h-2); |
---|
572 | windowItem.state = WINDOW_STATE_REGULAR; |
---|
573 | } |
---|
574 | |
---|
575 | dd.elements[objName + "_im_window_movable"].moveTo(dd.elements[objName + "_im_window"].x, dd.elements[objName + "_im_window"].y); |
---|
576 | dd.elements[objName + "_im_window_movable"].resizeTo(dd.elements[objName + "_im_window"].w-55, 25); |
---|
577 | |
---|
578 | this.showWindowItem(objName); |
---|
579 | this.windowMaximizeZ(objName); |
---|
580 | } |
---|
581 | |
---|
582 | if( !this.photo ) |
---|
583 | { |
---|
584 | setTimeout('im_win.get_photo_ldap(\"user@user\")',1000 ); |
---|
585 | this.photo = true; |
---|
586 | } |
---|
587 | }, |
---|
588 | |
---|
589 | "create_window" : function() |
---|
590 | { |
---|
591 | pId = arguments[0]['id']; |
---|
592 | |
---|
593 | if ( document.getElementById(pId + '_im_window')) |
---|
594 | { |
---|
595 | this.windowMaximizeZ(pId); |
---|
596 | this.showWindowItem(pId); |
---|
597 | } |
---|
598 | else |
---|
599 | { |
---|
600 | this.build(arguments[0]); |
---|
601 | |
---|
602 | ADD_DHTML(pId + "_im_window_body_inner"+NO_DRAG); |
---|
603 | ADD_DHTML(pId + "_im_window"+NO_DRAG); |
---|
604 | ADD_DHTML(pId + "_im_window_master"+NO_DRAG); |
---|
605 | ADD_DHTML(pId + "_im_window_fantom"+NO_DRAG); |
---|
606 | ADD_DHTML(pId + "_im_window_movable"+CURSOR_MOVE); |
---|
607 | ADD_DHTML(pId + "_im_window_resize"+CURSOR_NW_RESIZE); |
---|
608 | |
---|
609 | dd.elements[pId + "_im_window_movable"].moveTo(dd.elements[pId + "_im_window"].x, dd.elements[pId + "_im_window"].y); |
---|
610 | dd.elements[pId + "_im_window_movable"].resizeTo(dd.elements[pId + "_im_window"].w-20, 25); |
---|
611 | dd.elements[pId + "_im_window_movable"].setOpacity(0); |
---|
612 | |
---|
613 | dd.elements[pId + "_im_window_resize"].setOpacity(1); |
---|
614 | |
---|
615 | dd.elements[pId + "_im_window_resize"].moveTo(dd.elements[pId + "_im_window"].x+dd.elements[pId + "_im_window"].w-dd.elements[pId + "_im_window_resize"].w-2, dd.elements[pId + "_im_window"].y+dd.elements[pId + "_im_window"].h-dd.elements[pId + "_im_window_resize"].h-2); |
---|
616 | dd.elements[pId + "_im_window_resize"].moveTo(dd.elements[pId + "_im_window_fantom"].x+dd.elements[pId + "_im_window_fantom"].w-dd.elements[pId + "_im_window_resize"].w-2, dd.elements[pId + "_im_window_fantom"].y+dd.elements[pId + "_im_window_fantom"].h-dd.elements[pId + "_im_window_resize"].h-2); |
---|
617 | |
---|
618 | var windowItem = new Object(); |
---|
619 | windowItem.x = dd.elements[pId + "_im_window_master"].x; |
---|
620 | windowItem.y = dd.elements[pId + "_im_window_master"].y; |
---|
621 | windowItem.w = dd.elements[pId + "_im_window_master"].w; |
---|
622 | windowItem.h = dd.elements[pId + "_im_window_master"].h; |
---|
623 | windowItem.state = WINDOW_STATE_MINIMIZED; |
---|
624 | windowItems[pId] = windowItem; |
---|
625 | |
---|
626 | title = (arguments[0]['title']) ? arguments[0]['title'] : arguments[0]['id']; |
---|
627 | this.windowMinimize(pId + '_im'); |
---|
628 | this.windowMaximizeRestore(pId + '_im'); |
---|
629 | } |
---|
630 | }, |
---|
631 | |
---|
632 | "open_chat" : function(pId) |
---|
633 | { |
---|
634 | if ( !func.byId(pId + '_im_window') ) |
---|
635 | { |
---|
636 | text = ''; |
---|
637 | text += '<div class="border" id="' + pId + '_chatMessages" style="width:220px; height:130px; margin: 2px 0px 2px 2px; overflow:auto;"></div>'; |
---|
638 | text += '<div style="float: left; position: relative; height:130px;">'; |
---|
639 | text += ' <div class="myAvatar">'; |
---|
640 | text += ' <img id="' + pId + '_avatar" alt="Display Picture" title="Display Picture" src="' + im_path + 'templates/default/images/photo.png" width="49" height="65" border="0" />'; |
---|
641 | text += ' </div>'; |
---|
642 | text += ' <div id="' + pId + '_composing" class="composing"><img src="' + img_typing.src + '" /></div>'; |
---|
643 | text += '</div>'; |
---|
644 | text += '<br style="clear:both;"/>'; |
---|
645 | text += '<dl>'; |
---|
646 | text += ' <dd class="small">'; |
---|
647 | text += ' <span id="selectEmotionsDiv" class="des-small" onmouseover="selectDiv(this)" onmouseout="unselectDiv(this)" onclick="im_win.showEmotionSelection(\'' + pId + '\');" title="Select Imotions here!"><img src="' + im_path + 'templates/default/images/img/1.gif" width="15" height="15" alt="Select Imotions here!" style="vertical-align: text-top;" /></span>'; |
---|
648 | text += ' </dd>'; |
---|
649 | text += ' <dd class="small">|</dd>'; |
---|
650 | text += ' <dd class="small">'; |
---|
651 | text += ' <span id="selectFontNameDiv" class="des-small" onmouseover="selectDiv(this)" onmouseout="unselectDiv(this)" onclick="im_win.showFontNameSelection(\'' + pId + '\');" title="Select Font Name here!" style="height:19px;">'+IM.get_lang('Font')+'</span>'; |
---|
652 | text += ' </dd>'; |
---|
653 | text += ' <dd class="small">|</dd>'; |
---|
654 | text += ' <dd class="small">'; |
---|
655 | text += ' <span id="selectFontSizeDiv" class="des-small" onmouseover="selectDiv(this)" onmouseout="unselectDiv(this)" onclick="im_win.showFontSizeSelection(\'' + pId + '\')" title="Select Font Size here!" style="height:19px;">'+IM.get_lang('Size')+'</span>'; |
---|
656 | text += ' </dd>'; |
---|
657 | text += ' <dd class="small">|</dd>'; |
---|
658 | text += ' <dd class="small">'; |
---|
659 | text += ' <span id="selectFontColorDiv" class="des-small" onmouseover="selectDiv(this)" onmouseout="unselectDiv(this)" onclick="im_win.showFontColorSelection(\'' + pId + '\')" title="Select Font Color here!" style="height:19px;">'+IM.get_lang('Color')+'</span>'; |
---|
660 | text += ' </dd>'; |
---|
661 | text += ' <dd class="small">|</dd>'; |
---|
662 | text += ' <dd class="small">'; |
---|
663 | text += ' <span id="selectFontStyleDiv" class="des-small" onmouseover="selectDiv(this)" onmouseout="unselectDiv(this)" onclick="im_win.showFontStyleSelection(\'' + pId + '\')" title="Select Font Color here!" style="height:19px;">'+IM.get_lang('Style')+'</span>'; |
---|
664 | text += ' </dd>'; |
---|
665 | text += '</dl>'; |
---|
666 | text += '<div id="' + pId + '_divEdita" style="margin: 0px 2px"><iframe name="' + pId.replace('@', '_at_').replace(/\./g, '_dot_') + '_edita" class="edit_message" id="' + pId + '_edita" frameborder="0" style="margin: 3px 1px 0px 2px; width:220px; height:50px; float:left;"></iframe></div>'; |
---|
667 | text += '<br/><a onclick="javascript:IM.sendMessage(\'' + pId + '\')" title="Send a message" style="float:left;margin: 0px 2px;"><img src="' + im_path + 'templates/default/images/send.gif" width="50" height="25" border=0 style="margin-top:3px"></a>'; |
---|
668 | text += '<br style="clear:both" /><span id="' + pId + '_im_window_message" style="margin-left: 2px" />'; |
---|
669 | |
---|
670 | var params = []; |
---|
671 | params['body'] = text; |
---|
672 | params['height'] = 225; |
---|
673 | params['id'] = pId; |
---|
674 | params['maximize'] = false; |
---|
675 | params['minimize'] = false; |
---|
676 | params['title'] = pId; |
---|
677 | params['width'] = 320; |
---|
678 | this.create_window(params); |
---|
679 | |
---|
680 | // Photo Ldap; |
---|
681 | this.get_photo_ldap(pId); |
---|
682 | |
---|
683 | name_document = document.getElementById(pId + '_edita'); |
---|
684 | name_document.contentWindow.document.write('<html><body id="' + pId.replace('@', '_at_').replace(/\./g, '_dot_') + '" style="margin:0px;padding:0px"></body></html>'); |
---|
685 | name_document.contentWindow.document.close(); |
---|
686 | name_document.contentWindow.document.designMode = "On"; |
---|
687 | |
---|
688 | func.attachEvent(name_document.contentWindow.document, 'keypress', im_win.getText); |
---|
689 | func.attachEvent(name_document.contentWindow.document, 'keyup', im_win.clearText); |
---|
690 | |
---|
691 | name_document.contentWindow.focus(); |
---|
692 | |
---|
693 | var status = func.byId(pId + '_im_window'); |
---|
694 | status.firstChild.style.background = 'url('+func.byId(pId).firstChild.src+')'; |
---|
695 | } |
---|
696 | else |
---|
697 | { |
---|
698 | this.showWindowItem(pId); |
---|
699 | } |
---|
700 | }, |
---|
701 | |
---|
702 | "get_photo_ldap" : function(IdLdap) |
---|
703 | { |
---|
704 | var uid_ldap = IdLdap.substr(0,IdLdap.indexOf('@')); |
---|
705 | var handler_photo_ldap = function(_XMLdata) |
---|
706 | { |
---|
707 | var data = _XMLdata.getElementsByTagName('retorno').item(0); |
---|
708 | data = eval(data.firstChild.nodeValue); |
---|
709 | if(data) |
---|
710 | { |
---|
711 | IdLdap = ( IdLdap == 'user@user' ) ? 'contacts' : IdLdap; |
---|
712 | if( document.getElementById(IdLdap + "_avatar") != null ){ |
---|
713 | var ph_img = document.getElementById(IdLdap + "_avatar"); |
---|
714 | ph_img.src = (im_path + "inc/class.ldap_im.inc.php?user="+uid_ldap) ? im_path + "inc/class.ldap_im.inc.php?user="+uid_ldap : img_photo.src ; |
---|
715 | } |
---|
716 | } |
---|
717 | } |
---|
718 | |
---|
719 | XMLTools.__RETURN_MODE__ = 'XML'; |
---|
720 | XMLTools.request('$this.ldap_im.photo_ldap','POST',handler_photo_ldap,'uid='+uid_ldap); |
---|
721 | }, |
---|
722 | |
---|
723 | "windowClose" : function(objName) |
---|
724 | { |
---|
725 | with(objName) |
---|
726 | objName = substr(0, indexOf('_im')); |
---|
727 | |
---|
728 | this.hideWindowItem(objName); |
---|
729 | this.hideAllChatSelections(); |
---|
730 | |
---|
731 | var windowItem = windowItems[objName]; |
---|
732 | if ( windowItem != null ) |
---|
733 | windowItem.state = WINDOW_STATE_CLOSED; |
---|
734 | |
---|
735 | if ( objName != 'contacts' ) |
---|
736 | { |
---|
737 | var win = document.getElementById(objName + '_im_window_master'); |
---|
738 | var resize = document.getElementById(objName + '_im_window_resize'); |
---|
739 | var fantom = document.getElementById(objName + '_im_window_fantom'); |
---|
740 | var movable = document.getElementById(objName + '_im_window_movable'); |
---|
741 | |
---|
742 | win.parentNode.removeChild(win); |
---|
743 | resize.parentNode.removeChild(resize); |
---|
744 | fantom.parentNode.removeChild(fantom); |
---|
745 | movable.parentNode.removeChild(movable); |
---|
746 | |
---|
747 | //delete windowItem; |
---|
748 | } |
---|
749 | }, |
---|
750 | |
---|
751 | "hideEmotionSelection" : function() |
---|
752 | { |
---|
753 | emotionsDiv = document.getElementById("shared_emotions"); |
---|
754 | if ( isEmotionSelectionVisible ) |
---|
755 | { |
---|
756 | emotionsDiv.style.visibility = "hidden"; |
---|
757 | isEmotionSelectionVisible = false; |
---|
758 | } |
---|
759 | }, |
---|
760 | |
---|
761 | "highlightie5" : function (e) |
---|
762 | { |
---|
763 | if ( e.className == "emotionItem" ) |
---|
764 | e.className = "emotionItem-sel"; |
---|
765 | else if ( e.className == "menuitems" ) |
---|
766 | e.className = "menuitems-sel"; |
---|
767 | |
---|
768 | }, |
---|
769 | |
---|
770 | "lowlightie5" : function(e) |
---|
771 | { |
---|
772 | if ( e.className == "emotionItem-sel" ) |
---|
773 | e.className = "emotionItem"; |
---|
774 | else if ( e.className == "menuitems-sel" ) |
---|
775 | e.className = "menuitems"; |
---|
776 | }, |
---|
777 | |
---|
778 | "addEmotion" : function(emotion) |
---|
779 | { |
---|
780 | var n_document = document.getElementById(this.chat_pJid + '_edita'); |
---|
781 | var edita = n_document.contentWindow.document.getElementsByTagName('body').item(0); |
---|
782 | edita.innerHTML += IM.emotions_icons(emotion); |
---|
783 | |
---|
784 | this.hideEmotionSelection(); |
---|
785 | }, |
---|
786 | |
---|
787 | "showEmotionSelection" : function(objName) |
---|
788 | { |
---|
789 | this.chat_pJid = objName; |
---|
790 | activeChatWindowId = objName; |
---|
791 | var emotionsDiv = document.getElementById("shared_emotions"); |
---|
792 | if(!isEmotionSelectionVisible) |
---|
793 | { |
---|
794 | this.hideAllChatSelections(); |
---|
795 | chatObj = dd.elements[objName + "_im_window"]; |
---|
796 | x = chatObj.x + 6; |
---|
797 | y = chatObj.y + chatObj.h - 200; |
---|
798 | dd.elements.shared_emotions.moveTo(x,y); |
---|
799 | this.incZ(); |
---|
800 | document.getElementById("shared_emotions").style.zIndex = zValue; |
---|
801 | emotionsDiv.style.visibility = "visible"; |
---|
802 | isEmotionSelectionVisible = true; |
---|
803 | } |
---|
804 | else |
---|
805 | { |
---|
806 | this.hideAllChatSelections(); |
---|
807 | } |
---|
808 | }, |
---|
809 | |
---|
810 | "showFontNameSelection" : function(objName) |
---|
811 | { |
---|
812 | this.chat_pJid = objName; |
---|
813 | activeChatWindowId = objName; |
---|
814 | var objDiv = document.getElementById("shared_fontName"); |
---|
815 | if(!isFontNameSelectionVisible) |
---|
816 | { |
---|
817 | this.hideAllChatSelections(); |
---|
818 | chatObj = dd.elements[objName + "_im_window"]; |
---|
819 | x = chatObj.x + 85; |
---|
820 | y = chatObj.y + chatObj.h - 185; |
---|
821 | dd.elements.shared_fontName.moveTo(x,y); |
---|
822 | this.incZ(); |
---|
823 | document.getElementById("shared_fontName").style.zIndex = zValue; |
---|
824 | objDiv.style.visibility = "visible"; |
---|
825 | isFontNameSelectionVisible = true; |
---|
826 | } |
---|
827 | else |
---|
828 | { |
---|
829 | this.hideAllChatSelections(); |
---|
830 | } |
---|
831 | }, |
---|
832 | |
---|
833 | "hideFontNameSelection" : function() |
---|
834 | { |
---|
835 | var objDiv = document.getElementById("shared_fontName"); |
---|
836 | if ( isFontNameSelectionVisible ) |
---|
837 | { |
---|
838 | objDiv.style.visibility = "hidden"; |
---|
839 | isFontNameSelectionVisible = false; |
---|
840 | } |
---|
841 | }, |
---|
842 | |
---|
843 | "showFontSizeSelection" : function(objName) |
---|
844 | { |
---|
845 | |
---|
846 | this.chat_pJid = objName; |
---|
847 | activeChatWindowId = objName; |
---|
848 | var objDiv = document.getElementById("shared_fontSize"); |
---|
849 | if ( !isFontSizeSelectionVisible ) |
---|
850 | { |
---|
851 | this.hideAllChatSelections(); |
---|
852 | chatObj = dd.elements[objName + "_im_window"]; |
---|
853 | x = chatObj.x + 154; |
---|
854 | y = chatObj.y + chatObj.h - 200; |
---|
855 | dd.elements.shared_fontSize.moveTo(x,y); |
---|
856 | this.incZ(); |
---|
857 | document.getElementById("shared_fontSize").style.zIndex = zValue; |
---|
858 | objDiv.style.visibility = "visible"; |
---|
859 | isFontSizeSelectionVisible = true; |
---|
860 | } |
---|
861 | else |
---|
862 | { |
---|
863 | this.hideAllChatSelections(); |
---|
864 | } |
---|
865 | }, |
---|
866 | |
---|
867 | "hideFontSizeSelection" : function() |
---|
868 | { |
---|
869 | var objDiv = document.getElementById("shared_fontSize"); |
---|
870 | if ( isFontSizeSelectionVisible ) |
---|
871 | { |
---|
872 | objDiv.style.visibility = "hidden"; |
---|
873 | isFontSizeSelectionVisible = false; |
---|
874 | } |
---|
875 | }, |
---|
876 | |
---|
877 | "showFontColorSelection" : function(objName) |
---|
878 | { |
---|
879 | this.chat_pJid = objName; |
---|
880 | activeChatWindowId = objName; |
---|
881 | var objDiv = document.getElementById("shared_fontColor"); |
---|
882 | if ( !isFontColorSelectionVisible ) |
---|
883 | { |
---|
884 | this.hideAllChatSelections(); |
---|
885 | chatObj = dd.elements[objName + "_im_window"]; |
---|
886 | x = chatObj.x + 191; |
---|
887 | y = chatObj.y + chatObj.h - 200; |
---|
888 | dd.elements.shared_fontColor.moveTo(x,y); |
---|
889 | this.incZ(); |
---|
890 | document.getElementById("shared_fontColor").style.zIndex = zValue; |
---|
891 | objDiv.style.visibility = "visible"; |
---|
892 | isFontColorSelectionVisible = true; |
---|
893 | } |
---|
894 | else |
---|
895 | { |
---|
896 | this.hideAllChatSelections(); |
---|
897 | } |
---|
898 | }, |
---|
899 | |
---|
900 | "showFontStyleSelection" : function(objName) |
---|
901 | { |
---|
902 | this.chat_pJid = objName; |
---|
903 | activeChatWindowId = objName; |
---|
904 | var objDiv = document.getElementById("shared_fontStyle"); |
---|
905 | if ( !isFontStyleSelectionVisible ) |
---|
906 | { |
---|
907 | this.hideAllChatSelections(); |
---|
908 | chatObj = dd.elements[objName + "_im_window"]; |
---|
909 | x = chatObj.x + 234; |
---|
910 | y = chatObj.y + chatObj.h - 181; |
---|
911 | dd.elements.shared_fontStyle.moveTo(x,y); |
---|
912 | this.incZ(); |
---|
913 | document.getElementById("shared_fontStyle").style.zIndex = zValue; |
---|
914 | objDiv.style.visibility = "visible"; |
---|
915 | isFontStyleSelectionVisible = true; |
---|
916 | } |
---|
917 | else |
---|
918 | { |
---|
919 | this.hideAllChatSelections(); |
---|
920 | } |
---|
921 | }, |
---|
922 | |
---|
923 | "hideFontColorSelection" : function() |
---|
924 | { |
---|
925 | var objDiv = document.getElementById("shared_fontColor"); |
---|
926 | if ( isFontColorSelectionVisible ) |
---|
927 | { |
---|
928 | objDiv.style.visibility = "hidden"; |
---|
929 | isFontColorSelectionVisible = false; |
---|
930 | } |
---|
931 | }, |
---|
932 | |
---|
933 | "hideFontStyleSelection" : function() |
---|
934 | { |
---|
935 | var objDiv = document.getElementById("shared_fontStyle"); |
---|
936 | if ( isFontStyleSelectionVisible ) |
---|
937 | { |
---|
938 | objDiv.style.visibility = "hidden"; |
---|
939 | isFontStyleSelectionVisible = false; |
---|
940 | } |
---|
941 | }, |
---|
942 | |
---|
943 | "newMessageNotification" : function() |
---|
944 | { |
---|
945 | if ( !focusFlag ) |
---|
946 | { |
---|
947 | if ( document.title=="......................" ) |
---|
948 | document.title = IM.get_lang("New Message!"); |
---|
949 | else |
---|
950 | document.title = "......................"; |
---|
951 | |
---|
952 | this.Mod_Notification(); |
---|
953 | |
---|
954 | if ( newMessageTimer ) |
---|
955 | clearTimeout(newMessageTimer); |
---|
956 | newMessageTimer = setTimeout("im_win.newMessageNotification()", 1000); |
---|
957 | } |
---|
958 | else |
---|
959 | { |
---|
960 | if ( newMessageTimer ) clearTimeout(newMessageTimer); |
---|
961 | } |
---|
962 | |
---|
963 | }, |
---|
964 | |
---|
965 | "Mod_Notification" : function() |
---|
966 | { |
---|
967 | // Aviso Normal |
---|
968 | if(eval(IM_Preferences.LoadPreferences('rd_nm'))) |
---|
969 | { |
---|
970 | } |
---|
971 | // Aviso Chato |
---|
972 | if(eval(IM_Preferences.LoadPreferences('rd_ch'))) |
---|
973 | { |
---|
974 | if(self.moveBy) |
---|
975 | { |
---|
976 | for(i=10;i>0;i--) |
---|
977 | { |
---|
978 | self.moveBy(i,0); |
---|
979 | self.moveBy(-i,0); |
---|
980 | } |
---|
981 | } |
---|
982 | } |
---|
983 | }, |
---|
984 | |
---|
985 | "getText" : function(e) |
---|
986 | { |
---|
987 | |
---|
988 | if ( !focusFlag ) windowFocus(); |
---|
989 | evt = e.keyCode; |
---|
990 | pId = ( e.srcElement ) ? e.srcElement.id : e.target.getElementsByTagName('body').item(0).id; |
---|
991 | pId = pId.replace('_at_', '@').replace(/_dot_/g, '.') |
---|
992 | IM.composingMessage(pId); |
---|
993 | switch ( evt ) |
---|
994 | { |
---|
995 | case 13 : |
---|
996 | if ( !e.shiftKey ) |
---|
997 | IM.sendMessage(pId); |
---|
998 | return false; |
---|
999 | break; |
---|
1000 | case 27 : |
---|
1001 | im_win.windowClose(pId + '_im'); |
---|
1002 | break; |
---|
1003 | } |
---|
1004 | }, |
---|
1005 | |
---|
1006 | "clearText" : function(e) |
---|
1007 | { |
---|
1008 | if ( !focusFlag ) windowFocus(); |
---|
1009 | evt = e.keyCode; |
---|
1010 | _text = ( e.srcElement ) ? e.srcElement.id : e.target.getElementsByTagName('body').item(0); |
---|
1011 | |
---|
1012 | switch ( evt ) |
---|
1013 | { |
---|
1014 | case 13 : |
---|
1015 | //if ( !e.shiftKey ) |
---|
1016 | _text.innerHTML = ''; |
---|
1017 | return false; |
---|
1018 | break; |
---|
1019 | } |
---|
1020 | } |
---|
1021 | } |
---|
1022 | |
---|
1023 | function my_DragFunc() |
---|
1024 | { |
---|
1025 | im_win.drag(); |
---|
1026 | } |
---|
1027 | function my_DropFunc() |
---|
1028 | { |
---|
1029 | im_win.drop(); |
---|
1030 | } |
---|
1031 | function my_PickFunc() |
---|
1032 | { |
---|
1033 | im_win.pick(); |
---|
1034 | } |
---|
1035 | function selectDiv(obj) { |
---|
1036 | obj.className = "sel-small"; |
---|
1037 | } |
---|
1038 | function unselectDiv(obj) { |
---|
1039 | obj.className = "des-small"; |
---|
1040 | } |
---|
1041 | function getElementsBySelector(selector) |
---|
1042 | { |
---|
1043 | var i; |
---|
1044 | var s=[]; |
---|
1045 | var selid=""; |
---|
1046 | var selclass=""; |
---|
1047 | var tag=selector; |
---|
1048 | var objlist=[]; |
---|
1049 | if ( selector.indexOf(" ") > 0 ) |
---|
1050 | {//descendant selector like "tag#id tag" |
---|
1051 | s=selector.split(" "); |
---|
1052 | var fs=s[0].split("#"); |
---|
1053 | if ( fs.length == 1 ) |
---|
1054 | return(objlist); |
---|
1055 | return(document.getElementById(fs[1]).getElementsByTagName(s[1])); |
---|
1056 | } |
---|
1057 | if ( selector.indexOf("#") > 0 ) |
---|
1058 | {//id selector like "tag#id" |
---|
1059 | s=selector.split("#"); |
---|
1060 | tag=s[0]; |
---|
1061 | selid=s[1]; |
---|
1062 | } |
---|
1063 | if ( selid != "" ) |
---|
1064 | { |
---|
1065 | objlist.push(document.getElementById(selid)); |
---|
1066 | return(objlist); |
---|
1067 | } |
---|
1068 | if ( selector.indexOf(".") > 0 ) |
---|
1069 | {//class selector like "tag.class" |
---|
1070 | s=selector.split("."); |
---|
1071 | tag=s[0]; |
---|
1072 | selclass=s[1]; |
---|
1073 | } |
---|
1074 | var v = document.getElementsByTagName(tag); // tag selector like "tag" |
---|
1075 | if ( selclass == "" ) |
---|
1076 | return(v); |
---|
1077 | |
---|
1078 | for ( i = 0; i < v.length; i++ ) |
---|
1079 | if ( v[i].className ==selclass ) |
---|
1080 | objlist.push(v[i]); |
---|
1081 | |
---|
1082 | return(objlist); |
---|
1083 | } |
---|
1084 | function AddTop(el,bk,color,size) |
---|
1085 | { |
---|
1086 | try |
---|
1087 | { |
---|
1088 | var i; |
---|
1089 | var d=document.createElement("b"); |
---|
1090 | var cn="_r"; |
---|
1091 | var lim=4; |
---|
1092 | if(size && size=="small"){ cn="_rs"; lim=2} |
---|
1093 | d.className="_rtop"; |
---|
1094 | d.style.backgroundColor=bk; |
---|
1095 | for(i=1;i<=lim;i++) |
---|
1096 | { |
---|
1097 | var x=document.createElement("b"); |
---|
1098 | x.className=cn + i; |
---|
1099 | x.style.backgroundColor=color; |
---|
1100 | d.appendChild(x); |
---|
1101 | } |
---|
1102 | el.insertBefore(d,el.firstChild); |
---|
1103 | } |
---|
1104 | catch(e) |
---|
1105 | {} |
---|
1106 | } |
---|
1107 | function RoundedTop(selector,bk,color,size){ |
---|
1108 | var i; |
---|
1109 | var v=getElementsBySelector(selector); |
---|
1110 | for(i=0;i<v.length;i++) |
---|
1111 | AddTop(v[i],bk,color,size); |
---|
1112 | } |
---|
1113 | |
---|
1114 | im_win.load(); |
---|