diff options
| author | stonedDiscord <stoned@derpymail.org> | 2020-11-16 20:59:47 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-16 20:59:47 +0100 |
| commit | e4b75a9a94b24f2ca35981294dcfa5bfd79b713f (patch) | |
| tree | eb40c3246ef08f4d16155a34825150c46b13eaa7 /webAO/client.js | |
| parent | a960ee76886457e832734bd24187c0563a63c958 (diff) | |
| parent | b93303daa116a1c385346f4a67d9bec5a8401af8 (diff) | |
Merge pull request #72 from AttorneyOnline/showname_switch
Showname switch
Diffstat (limited to 'webAO/client.js')
| -rw-r--r-- | webAO/client.js | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/webAO/client.js b/webAO/client.js index f21056b..baaf4ca 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -463,6 +463,7 @@ class Client extends EventEmitter { document.getElementById("ic_chat_name").value = getCookie("ic_chat_name"); document.getElementById("showname").checked = getCookie("showname"); + showname_click(); document.getElementById("client_callwords").value = getCookie("callwords"); } @@ -1891,7 +1892,7 @@ async changeBackground(position) { } this.lastChar = this.chatmsg.name; - appendICLog(this.chatmsg.content, displayname); + appendICLog(this.chatmsg.content, this.chatmsg.showname, this.chatmsg.nameplate); checkCallword(this.chatmsg.content); @@ -2383,6 +2384,13 @@ window.mutelist_click = mutelist_click; export function showname_click(_event) { setCookie("showname", document.getElementById("showname").checked); setCookie("ic_chat_name", document.getElementById("ic_chat_name").value); + + const css_s = document.getElementById("nameplate_setting"); + + if (document.getElementById("showname").checked) + css_s.href = "styles/shownames.css"; + else + css_s.href = "styles/nameplates.css"; } window.showname_click = showname_click; @@ -2658,17 +2666,25 @@ window.ReconnectButton = ReconnectButton; * @param {string} msg the string to be added * @param {string} name the name of the sender */ -function appendICLog(msg, name = "", time = new Date()) { +function appendICLog(msg, showname = "", nameplate = "", time = new Date()) { const entry = document.createElement("p"); - const nameField = document.createElement("span"); - const textField = document.createElement("span"); - nameField.className = "iclog_name"; - nameField.appendChild(document.createTextNode(name)); + const shownameField = document.createElement("span"); + const nameplateField = document.createElement("span"); + const textField = document.createElement("span"); + nameplateField.classList = "iclog_name iclog_nameplate"; + nameplateField.appendChild(document.createTextNode(nameplate)); + + shownameField.classList = "iclog_name iclog_showname"; + if (showname === "" || !showname) + shownameField.appendChild(document.createTextNode(nameplate)); + else + shownameField.appendChild(document.createTextNode(showname)); textField.className = "iclog_text"; textField.appendChild(document.createTextNode(msg)); - entry.appendChild(nameField); + entry.appendChild(shownameField); + entry.appendChild(nameplateField); entry.appendChild(textField); // Only put a timestamp if the minute has changed. |
