Node.js based forum software built for the modern web
added chat:autocomplete:init
barisusakli222ef14d7f64
diff --git a/public/src/client/chats.js b/public/src/client/chats.jsindex 305588d019..d415949381 100644--- a/public/src/client/chats.js+++ b/public/src/client/chats.js@@ -19,6 +19,7 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',Chats.addEventListeners();Chats.createTagsInput($('[component="chat/messages"] .users-tag-input'), ajaxify.data);+ Chats.createAutoComplete($('[component="chat/input"]');if (env === 'md' || env === 'lg') {Chats.resizeMainWindow();@@ -212,6 +213,26 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',});};+ Chats.createAutoComplete = function(element) {+ var data = {+ element: element,+ strategies: [],+ options: {+ zIndex: 20000,+ listPosition: function(position) {+ this.$el.css(this._applyPlacement(position));+ this.$el.css('position', 'absolute');+ return this;+ }+ }+ };++ $(window).trigger('chat:autocomplete:init', data);+ if (data.strategies.length) {+ data.element.textcomplete(data.strategies, data.options);+ }+ };+Chats.createTagsInput = function(tagEl, data) {tagEl.tagsinput({confirmKeys: [13, 44],diff --git a/public/src/modules/chat.js b/public/src/modules/chat.jsindex b04ce8743d..0ced2bf483 100644--- a/public/src/modules/chat.js+++ b/public/src/modules/chat.js@@ -283,6 +283,7 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'traChats.addSendHandlers(chatModal.attr('roomId'), chatModal.find('#chat-message-input'), chatModal.find('#chat-message-send-btn'));Chats.createTagsInput(chatModal.find('.users-tag-input'), data);+ Chats.createAutoComplete(chatModal.find('[component="chat/input"]'));Chats.loadChatSince(chatModal.attr('roomId'), chatModal.find('.chat-content'), 'recent');