+
+document.getElementById("help").onclick = function() {
+ tui.show_help = true;
+ tui.full_refresh();
+};
+document.getElementById("switch_to_play").onclick = function() {
+ tui.switch_mode(mode_play);
+ tui.full_refresh();
+};
+document.getElementById("switch_to_study").onclick = function() {
+ tui.switch_mode(mode_study);
+ tui.full_refresh();
+};
+document.getElementById("switch_to_chat").onclick = function() {
+ tui.switch_mode(mode_chat);
+ tui.full_refresh();
+};
+document.getElementById("switch_to_password").onclick = function() {
+ tui.switch_mode(mode_password);
+ tui.full_refresh();
+};
+document.getElementById("switch_to_edit").onclick = function() {
+ tui.switch_mode(mode_edit);
+ tui.full_refresh();
+};
+document.getElementById("switch_to_annotate").onclick = function() {
+ tui.switch_mode(mode_annotate);
+ tui.full_refresh();
+};
+document.getElementById("switch_to_portal").onclick = function() {
+ tui.switch_mode(mode_portal);
+ tui.full_refresh();
+};
+document.getElementById("toggle_map_mode").onclick = function() {
+ if (tui.map_mode == 'terrain') {
+ tui.map_mode = 'control';
+ } else {
+ tui.map_mode = 'terrain';
+ }
+ tui.full_refresh();
+};
+document.getElementById("take_thing").onclick = function() {
+ server.send(['TASK:PICK_UP']);
+};
+document.getElementById("drop_thing").onclick = function() {
+ server.send(['TASK:DROP']);
+};
+document.getElementById("flatten").onclick = function() {
+ server.send(['TASK:FLATTEN_SURROUNDINGS', tui.password]);
+};
+document.getElementById("move_upleft").onclick = function() {
+ if (tui.mode == mode_play) {
+ server.send(['TASK:MOVE', 'UPLEFT']);
+ } else {
+ explorer.move('UPLEFT');
+ };
+};
+document.getElementById("move_left").onclick = function() {
+ if (tui.mode == mode_play) {
+ server.send(['TASK:MOVE', 'LEFT']);
+ } else {
+ explorer.move('LEFT');
+ };
+};
+document.getElementById("move_downleft").onclick = function() {
+ if (tui.mode == mode_play) {
+ server.send(['TASK:MOVE', 'DOWNLEFT']);
+ } else {
+ explorer.move('DOWNLEFT');
+ };
+};
+document.getElementById("move_down").onclick = function() {
+ if (tui.mode == mode_play) {
+ server.send(['TASK:MOVE', 'DOWN']);
+ } else {
+ explorer.move('DOWN');
+ };
+};
+document.getElementById("move_up").onclick = function() {
+ if (tui.mode == mode_play) {
+ server.send(['TASK:MOVE', 'UP']);
+ } else {
+ explorer.move('UP');
+ };
+};
+document.getElementById("move_upright").onclick = function() {
+ if (tui.mode == mode_play) {
+ server.send(['TASK:MOVE', 'UPRIGHT']);
+ } else {
+ explorer.move('UPRIGHT');
+ };
+};
+document.getElementById("move_right").onclick = function() {
+ if (tui.mode == mode_play) {
+ server.send(['TASK:MOVE', 'RIGHT']);
+ } else {
+ explorer.move('RIGHT');
+ };
+};
+document.getElementById("move_downright").onclick = function() {
+ if (tui.mode == mode_play) {
+ server.send(['TASK:MOVE', 'DOWNRIGHT']);
+ } else {
+ explorer.move('DOWNRIGHT');
+ };
+};