diff options
Diffstat (limited to 'webAO')
| -rw-r--r-- | webAO/client.js | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/webAO/client.js b/webAO/client.js index 57b0d0c..9971d0e 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -35,9 +35,11 @@ if (/webOS|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|PlaySt oldLoading = true; } +/** presettings */ let selectedEffect = 0; let selectedMenu = 1; let selectedShout = 0; +document.getElementById("OOC_name").value = getCookie("OOC_name"); const fp = new Fingerprint({ canvas: true, @@ -167,6 +169,7 @@ class Client extends EventEmitter { * @param {string} message the message to send */ sendOOC(message) { + document.cookie = "OOC_name=" + escapeChat(encodeChat(document.getElementById("OOC_name").value)); this.serv.send(`CT#${escapeChat(encodeChat(document.getElementById("OOC_name").value))}#${escapeChat(encodeChat(message))}#%`); } @@ -1067,7 +1070,7 @@ class Viewport { duration += delay < 2 ? 10 : delay; } } - return duration*10; + return duration * 10; } /** @@ -1317,6 +1320,28 @@ class INI { } /** + * read a cookie from storage + * got this from w3schools + * https://www.w3schools.com/js/js_cookies.asp + * @param {String} cname The name of the cookie to return + */ +function getCookie(cname) { + var name = cname + "="; + var decodedCookie = decodeURIComponent(document.cookie); + var ca = decodedCookie.split(';'); + for (var i = 0; i < ca.length; i++) { + var c = ca[i]; + while (c.charAt(0) == ' ') { + c = c.substring(1); + } + if (c.indexOf(name) == 0) { + return c.substring(name.length, c.length); + } + } + return ""; +} + +/** * Triggered when the Return key is pressed on the out-of-character chat input box. * @param {KeyboardEvent} event */ |
