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