1 | // Instant Messenger |
---|
2 | // im_menu_action.js |
---|
3 | |
---|
4 | var im_menu_action = { |
---|
5 | "delay_hide" : 500, |
---|
6 | "delayhide" : false, |
---|
7 | |
---|
8 | "menu" : function() |
---|
9 | { |
---|
10 | try |
---|
11 | { |
---|
12 | pElement = arguments[0]; |
---|
13 | delete arguments[0]; |
---|
14 | pMenu = ( func.isString(arguments[1]) ) ? arguments[1] : arguments; |
---|
15 | if ( document.getElementById(pElement).innerHTML == "" ) |
---|
16 | { |
---|
17 | func.confEl(pElement, 'style', 'display:block;'); |
---|
18 | var _this = this; |
---|
19 | _this.layout(pMenu, pElement); |
---|
20 | } |
---|
21 | else |
---|
22 | { |
---|
23 | func.confEl(pElement, 'style', 'display:none;'); |
---|
24 | this.del_innerHTML(pElement); |
---|
25 | this.clear_delayhide(); |
---|
26 | } |
---|
27 | } |
---|
28 | catch(e) |
---|
29 | { |
---|
30 | } |
---|
31 | }, |
---|
32 | |
---|
33 | "layout" : function(pHtml, pElement) |
---|
34 | { |
---|
35 | var _this = this; |
---|
36 | var el_dest_ = ( func.isString(pElement) ) ? func.byId(pElement) : pElement; |
---|
37 | var div_menu = func.newEl("div"); |
---|
38 | func.confEl(div_menu, 'id', 'div_pref'); |
---|
39 | func.confEl(div_menu, 'style', 'padding:0px;position:absolute;padding:0px;'); |
---|
40 | div_menu.style.Zindex = "150"; |
---|
41 | div_menu.onmouseover = function(){_this.clear_delayhide();}; |
---|
42 | div_menu.onmouseout = function(){_this.resetit(pElement);}; |
---|
43 | if ( func.isString(pHtml) ) |
---|
44 | div_menu.innerHTML = pHtml; |
---|
45 | else |
---|
46 | for ( i = 1; i < pHtml.length; i++ ) |
---|
47 | func.insEl(pHtml[i], div_menu); |
---|
48 | |
---|
49 | func.insEl(div_menu, el_dest_); |
---|
50 | this.delayhide = setTimeout("im_menu_action.del_innerHTML('"+pElement+"')", 2000); |
---|
51 | }, |
---|
52 | |
---|
53 | "del_innerHTML": function(pElement) |
---|
54 | { |
---|
55 | func.confEl(pElement, 'style', 'display:none;'); |
---|
56 | func.byId(pElement).innerHTML = ""; |
---|
57 | document.oncontextmenu = new Function("return true"); |
---|
58 | }, |
---|
59 | |
---|
60 | "resetit": function(pElement) |
---|
61 | { |
---|
62 | this.delayhide = setTimeout("im_menu_action.del_innerHTML('"+pElement+"')",this.delay_hide); |
---|
63 | }, |
---|
64 | |
---|
65 | "clear_delayhide" : function() |
---|
66 | { |
---|
67 | if ( this.delayhide ) |
---|
68 | clearTimeout(this.delayhide); |
---|
69 | } |
---|
70 | } |
---|