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 | var pElement = arguments[0]; |
---|
13 | delete arguments[0]; |
---|
14 | var pMenu = ( func.isString(arguments[1]) ) ? arguments[1] : arguments; |
---|
15 | if ( document.getElementById(pElement).innerHTML == "" ) |
---|
16 | { |
---|
17 | func.confEl(pElement, 'style', 'display:block;'); |
---|
18 | this.layout(pMenu, pElement); |
---|
19 | } |
---|
20 | else |
---|
21 | { |
---|
22 | func.confEl(pElement, 'style', 'display:none;'); |
---|
23 | this.del_innerHTML(pElement); |
---|
24 | this.clear_delayhide(); |
---|
25 | } |
---|
26 | } |
---|
27 | catch(e) |
---|
28 | { |
---|
29 | } |
---|
30 | }, |
---|
31 | |
---|
32 | "layout" : function(pHtml, pElement) |
---|
33 | { |
---|
34 | var _this = this; |
---|
35 | var el_dest_ = ( func.isString(pElement) ) ? func.byId(pElement) : pElement; |
---|
36 | var div_menu = func.newEl("div"); |
---|
37 | func.confEl(div_menu, 'style', 'padding:0px;border:1px solid #809aa9'); |
---|
38 | div_menu.onmouseover = function(){_this.clear_delayhide();}; |
---|
39 | div_menu.onmouseout = function(){_this.resetit(pElement);}; |
---|
40 | if ( func.isString(pHtml) ) |
---|
41 | div_menu.innerHTML = pHtml; |
---|
42 | else |
---|
43 | for ( i = 1; i < pHtml.length; i++ ) |
---|
44 | func.insEl(pHtml[i], div_menu); |
---|
45 | |
---|
46 | func.insEl(div_menu, el_dest_); |
---|
47 | this.delayhide = setTimeout("im_menu_action.del_innerHTML('"+pElement+"')", 2000); |
---|
48 | }, |
---|
49 | |
---|
50 | "del_innerHTML": function(pElement) |
---|
51 | { |
---|
52 | func.confEl(pElement, 'style', 'display:none;'); |
---|
53 | func.byId(pElement).innerHTML = ""; |
---|
54 | document.oncontextmenu = new Function("return true"); |
---|
55 | }, |
---|
56 | |
---|
57 | "resetit": function(pElement) |
---|
58 | { |
---|
59 | this.delayhide = setTimeout("im_menu_action.del_innerHTML('"+pElement+"')",this.delay_hide); |
---|
60 | }, |
---|
61 | |
---|
62 | "clear_delayhide" : function() |
---|
63 | { |
---|
64 | if ( this.delayhide ) |
---|
65 | clearTimeout(this.delayhide); |
---|
66 | } |
---|
67 | } |
---|