diff options
| author | stonedDiscord <stoned@derpymail.org> | 2020-04-13 19:18:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-13 19:18:25 +0200 |
| commit | d1235fcb242e6111f2ffff64519a45e4618af40c (patch) | |
| tree | 15eda50ca73d15d2b54023073f8db2326a87a8ee /webAO/client.js | |
| parent | 97caca41dfa78158fb64a0229f173d5d6f45a409 (diff) | |
| parent | 16b6800a1e95fa57bc33e4a6ba0f4034d98c3abf (diff) | |
Merge pull request #57 from AttorneyOnline/character_search
Character search
Diffstat (limited to 'webAO/client.js')
| -rw-r--r-- | webAO/client.js | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/webAO/client.js b/webAO/client.js index 9be4529..b5c8c2f 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -1124,9 +1124,9 @@ class Client extends EventEmitter { let img = document.getElementById(`demo_${i}`); if (args[i + 1] === "-1") - img.style = "opacity: 0.25"; + img.style.opacity = 0.25; else if (args[i + 1] === "0") - img.style = ""; + img.style.opacity = 1; } } @@ -2278,6 +2278,24 @@ function appendICLog(msg, name = "", time = new Date()) { } /** + * Triggered when the music search bar is changed + * @param {MouseEvent} event + */ +export function chartable_filter(_event) { + const searchname = document.getElementById("client_charactersearch").value; + + client.chars.forEach(function (character, charid) { + const demothing = document.getElementById(`demo_${charid}`); + if (character.name.toLowerCase().indexOf(searchname.toLowerCase()) === -1) { + demothing.style.display = "none"; + } else { + demothing.style.display = "inline-block"; + } + }); +} +window.chartable_filter = chartable_filter; + +/** * Requests to play as a character. * @param {number} ccharacter the character ID; if this is a large number, * then spectator is chosen instead. |
