-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathspawnLegacyHelpButton.js
More file actions
73 lines (57 loc) · 2.43 KB
/
spawnLegacyHelpButton.js
File metadata and controls
73 lines (57 loc) · 2.43 KB
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
import { ImageSrc } from '/twcheese/conf/ImageSrc.js';
var language = { "twcheese": {} };
switch (game_data.market) {
default:
/*==== tribalwars.net, tribalwars.us, tribalwars.co.uk, beta.tribalwars.net ====*/
language['twcheese']['Help'] = 'Help';
break;
case 'cz':
/*==== divokekmeny.cz/ ====*/
language['twcheese']['Help'] = 'Pomoc';
break;
case 'se':
language['twcheese']['Help'] = 'Hjälp';
break;
/*==== fyletikesmaxes.gr/ ====*/
case 'gr':
language['twcheese']['Help'] = 'Βοήθεια';
break;
/* Norwegian */
case 'no':
language['twcheese']['Help'] = 'Hjelp';
break;
}
/**
* @param address:String (optional) if included, causes the button to open a new window when clicked, directing the page to the specified address
*/
function spawnLegacyHelpButton(address) {
var twcheese_menu = document.createElement('div');
twcheese_menu.style.textAlign = 'center';
var twcheese_menu_text = document.createElement('p');
twcheese_menu_text.style.fontSize = '9pt';
twcheese_menu_text.innerHTML = language['twcheese']['Help'];
twcheese_menu_text.style.fontWeight = '700';
twcheese_menu_text.style.marginTop = '3px';
twcheese_menu_text.style.color = '#422301';
twcheese_menu.appendChild(twcheese_menu_text);
twcheese_menu.style.background = `url("${ImageSrc.legacy.helpBackground}")`;
twcheese_menu.style.height = '22px';
twcheese_menu.style.width = '49px';
twcheese_menu.style.display = 'block';
twcheese_menu.style.position = 'fixed';
twcheese_menu.style.left = '100%';
twcheese_menu.style.top = '100%';
twcheese_menu.style.marginTop = '-24px';
twcheese_menu.style.marginLeft = '-52px';
twcheese_menu.style.zIndex = '99999999999';
twcheese_menu.onmouseover = function () { this.style.background = `url("${ImageSrc.legacy.helpBackgroundBright}")` };
twcheese_menu.onmouseout = function () { this.style.background = `url("${ImageSrc.legacy.helpBackground}")` };
if (address) {
twcheese_menu.style.cursor = 'pointer';
twcheese_menu.onclick = function () { window.open(address, 'twcheese_menu_window') };
}
else
twcheese_menu.style.cursor = 'default';
return document.body.appendChild(twcheese_menu);
}
export { spawnLegacyHelpButton };