diff options
Diffstat (limited to 'webAO')
| -rw-r--r-- | webAO/client.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/webAO/client.js b/webAO/client.js index e6647c1..90d9ba0 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -168,7 +168,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)); + setCookie("OOC_name",escapeChat(encodeChat(document.getElementById("OOC_name").value))); this.serv.send(`CT#${escapeChat(encodeChat(document.getElementById("OOC_name").value))}#${escapeChat(encodeChat(message))}#%`); } @@ -286,7 +286,7 @@ class Client extends EventEmitter { loadResources() { // Set to playerID to server chat name // TODO: Make a text box for this! - document.getElementById("OOC_name").value = getCookie("OOC_name"); + document.getElementById("OOC_name").value = getCookie("OOC_name") !== "" ? "web" + this.playerID : getCookie("OOC_name"); // Load evidence array to select const evidence_select = document.getElementById("evi_select"); @@ -1341,6 +1341,16 @@ function getCookie(cname) { } /** + * set a cookie + * the version from w3schools expects these to expire + * @param {String} cname The name of the cookie to return + * @param {String} value The value of that cookie option + */ +function setCookie(cname,value) { + document.cookie = cname + "=" + value; +} + +/** * Triggered when the Return key is pressed on the out-of-character chat input box. * @param {KeyboardEvent} event */ |
