let cols_selector = document.getElementById("n_cols");
let key_selectors = document.querySelectorAll('[id^="key_"]');
+function restore_selector_value(selector) {
+ let stored_selection = window.localStorage.getItem(selector.id);
+ if (stored_selection) {
+ selector.value = stored_selection;
+ }
+}
+restore_selector_value(rows_selector);
+restore_selector_value(cols_selector);
+for (let key_selector of key_selectors) {
+ restore_selector_value(key_selector);
+}
+
let terminal = {
foreground: 'white',
background: 'black',
tui.log_msg("@ server disconnected :(");
tui.log_msg("@ hint: try the '/reconnect' command");
};
- this.websocket.onmessage = this.handle_event;
- },
+ this.websocket.onmessage = this.handle_event;
+ },
reconnect: function() {
- this.reconnect_to(this.url);
+ this.reconnect_to(this.url);
},
reconnect_to: function(url) {
this.websocket.close();
if (rows_selector.value % 4 != 0) {
return;
}
+ window.localStorage.setItem(rows_selector.id, rows_selector.value);
terminal.initialize();
tui.full_refresh();
}, false);
if (cols_selector.value % 4 != 0) {
return;
}
+ window.localStorage.setItem(cols_selector.id, cols_selector.value);
terminal.initialize();
tui.window_width = terminal.cols / 2,
tui.full_refresh();
}, false);
for (let key_selector of key_selectors) {
key_selector.addEventListener('input', function() {
+ window.localStorage.setItem(key_selector.id, key_selector.value);
tui.init_keys();
}, false);
}