-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelp.js
149 lines (138 loc) · 3.84 KB
/
help.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
var g_menu_color , g_menu_color2 , g_menu_flag;
var g_target_object , g_target_text;
var g_mouse_x , g_mouse_y , g_mouse_x2 , g_mouse_y2;
function initialize()
{
//mouse
document.onmousemove = mousemove;
document.onmousedown = mousedown;
//load json (language dependent text file)
new Ajax.Request("/json.txt" , {method:"get" , onComplete:initialize2 , onFailure:display_fail});
}
function display_fail(httpObject)
{
}
function initialize2(httpObject)
{
//process json
json_text = eval("(" + httpObject.responseText + ")");
day_of_week = new Array(json_text.sunday_a,json_text.monday_a,json_text.tuesday_a,json_text.wednesday_a,json_text.thursday_a,json_text.friday_a,json_text.saturday_a);
//initialize menu
initialize_menu();
}
function initialize_menu()
{
menu = $("a_menu");
g_menu_flag = 0;
g_menu_color = menu.style.backgroundColor;
color = getStyleValue(".menu3" , "color");
if(color != null)
{
g_menu_color2 = convertColor(color);
}
else
{
g_menu_color2 = "#B0FFB0";//"#ABFFAC";
}
}
function show_menu3(obj)
{
menu = $("a_menu");
g_target_text = getContent(obj);
html = "";
html += "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" class=\"menu2\">";
html += "<tr onclick=\"jacascript:menu_command3(2);\" onmouseover=\"javascript:this.bgColor='"+g_menu_color2+"';view_menu();\" onmouseout=\"javascript:this.bgColor='"+g_menu_color+"'\"><td style=\"cursor:default\">"+json_text.board_menu_download+"</td></tr>";//download
if(Prototype.Browser.IE)
{
html += "<tr onmouseover=\"javascript:view_menu();\"><td height=\"1\" align=\"center\" style=\"cursor:default\"><hr style=\"margin:0px;border:0px;padding:0px;height:1px;width:95%;background-color:#707070\"></td></tr>";//border
html += "<tr onclick=\"jacascript:menu_command3(1);\" onmouseover=\"javascript:this.bgColor='"+g_menu_color2+"';view_menu();\" onmouseout=\"javascript:this.bgColor='"+g_menu_color+"'\"><td style=\"cursor:default\">"+json_text.board_menu_copy_to_clipboard+"</td></tr>";//copy to clipboard
}
html += "</table>";
show_menu_core(html , obj , 1);
}
function menu_command3(command)
{//g_target_text
if((command == 0) || (command == 2))
{//uri
post_data = "text=" + encodeURIComponent(g_target_text) + "&menu2=" + command;
new Ajax.Request("/menu2" , {method:"post" , postBody:post_data , onComplete:menu_success , onFailure:menu_fail});
}
else if(command == 1)
{//copy to clipboard
if(Prototype.Browser.IE) clipboardData.setData("Text" , g_target_text);
}
hide_menu();
}
function menu_success(httpObject)
{
}
function menu_fail(httpObject)
{
}
function show_menu_core(html , obj , flag , pop_n)
{//flag 0:text menu 1:mouse menu
var ppo;
if(flag == 0)
{
ppo = get_popup_offset(pop_n);
menu.style.top = (Element.cumulativeOffset(obj).top - ppo.top) + "px";
menu.style.left = (Element.cumulativeOffset(obj).left - ppo.left) + "px";
}
else
{
menu.style.top = g_mouse_y2 + "px";//"px" for firefox
menu.style.left = g_mouse_x2 + "px";
}
menu.innerHTML = html;
menu.style.zIndex = 10000;
menu.style.visibility = "visible";
}
function view_menu()
{
menu = $("a_menu");
menu.style.zIndex = 1000;
menu.style.visibility = "visible";
}
function hide_menu()
{
menu = $("a_menu");
$("a_menu").style.visibility = "hidden";
menu.style.top = 0;
menu.style.left = 0;
}
function getContent(obj)
{
if(typeof(obj.innerText) != "undefined")
{
return obj.innerText;
}
else
{//firefox
return obj.textContent;
}
}
function mousedown()
{
if(g_menu_flag)
{
hide_menu();
g_menu_flag = 0;
}
}
function mousemove(event)
{
if(window.event)
{
g_mouse_y = window.event.offsetY;//relative
g_mouse_x = window.event.offsetX;
g_mouse_y2 = Event.pointerY(window.event);//absolute
g_mouse_x2 = Event.pointerX(window.event);
}
else
{//firefox
g_mouse_y = event.layerY;
g_mouse_x = event.layerX;
g_mouse_y2 = event.pageY;
g_mouse_x2 = event.pageX;
}
}