From 3cee729830232aa6f77b78b98701c266119c2945 Mon Sep 17 00:00:00 2001 From: Mitchdev Date: Wed, 20 Mar 2024 03:48:29 +1300 Subject: [PATCH 01/24] Fix autocomplete construction --- assets/chat/js/autocomplete.js | 6 +++--- assets/chat/js/chat.js | 3 ++- assets/views/embed.html | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/assets/chat/js/autocomplete.js b/assets/chat/js/autocomplete.js index 3ff9cd3f..16ba8e55 100644 --- a/assets/chat/js/autocomplete.js +++ b/assets/chat/js/autocomplete.js @@ -81,9 +81,10 @@ function selectHelper(ac) { } class ChatAutoComplete { - constructor() { + constructor(chat) { + this.chat = chat; /** @member jQuery */ - this.ui = $(`
`); + this.ui = this.chat.ui.find('#chat-auto-complete'); this.ui.on('click', 'li', (e) => this.select(parseInt(e.currentTarget.getAttribute('data-index'), 10)), ); @@ -98,7 +99,6 @@ class ChatAutoComplete { bind(chat) { this.chat = chat; this.input = chat.input; - this.ui.insertBefore(chat.input); let originval = ''; let shiftdown = false; let keypressed = false; diff --git a/assets/chat/js/chat.js b/assets/chat/js/chat.js index ee355b68..c872d600 100644 --- a/assets/chat/js/chat.js +++ b/assets/chat/js/chat.js @@ -94,7 +94,7 @@ class Chat { this.windows = new Map(); this.settings = new Map(settingsdefault); this.commands = new ChatCommands(); - this.autocomplete = new ChatAutoComplete(); + this.autocomplete = null; this.menus = new Map(); this.taggednicks = new Map(); this.taggednotes = new Map(); @@ -295,6 +295,7 @@ class Chat { this.loginscrn = this.ui.find('#chat-login-screen'); this.loadingscrn = this.ui.find('#chat-loading'); this.windowselect = this.ui.find('#chat-windows-select'); + this.autocomplete = new ChatAutoComplete(this); this.inputhistory = new ChatInputHistory(this); this.userfocus = new ChatUserFocus(this, this.css); this.mainwindow = new ChatWindow('main').into(this); diff --git a/assets/views/embed.html b/assets/views/embed.html index a420196c..fadeff29 100644 --- a/assets/views/embed.html +++ b/assets/views/embed.html @@ -29,6 +29,9 @@
+
+
    +