Node.js based forum software built for the modern web
closes #397
Baris Usakli8e4ca8e4742f
diff --git a/public/src/modules/chat.js b/public/src/modules/chat.jsindex 4391b58cfc..0921f6d5a1 100644--- a/public/src/modules/chat.js+++ b/public/src/modules/chat.js@@ -20,7 +20,7 @@ define(['taskbar'], function(taskbar) {module.modalExists = function(touid) {return $('#chat-modal-' + touid).length !== 0;}-+function checkStatus(chatModal, callback) {socket.emit('api:user.isOnline', chatModal.touid, function(data) {if(data.online !== chatModal.online) {@@ -35,7 +35,7 @@ define(['taskbar'], function(taskbar) {callback(data.online);});}-+function checkOnlineStatus(chatModal) {if(chatModal.intervalId === 0) {chatModal.intervalId = setInterval(function() {@@ -43,12 +43,12 @@ define(['taskbar'], function(taskbar) {}, 1000);}}-+module.createModal = function(username, touid, callback) {-+var chatModal = $('#chat-modal').clone(),uuid = utils.generateUUID();-+chatModal.intervalId = 0;chatModal.touid = touid;chatModal.username = username;@@ -61,7 +61,7 @@ define(['taskbar'], function(taskbar) {module.bringModalToTop(chatModal);}});-+chatModal.find('#chat-with-name').html(username);chatModal.find('.close').on('click', function(e) {@@ -74,7 +74,7 @@ define(['taskbar'], function(taskbar) {chatModal.on('click', function(e) {module.bringModalToTop(chatModal);});-+addSendHandler(chatModal);getChatMessages(chatModal, function() {@@ -85,9 +85,17 @@ define(['taskbar'], function(taskbar) {return chatModal;}+ function center(chatModal) {+ chatModal.css("position","absolute");+ chatModal.css("top", Math.max(0, (($(window).height() - $(chatModal).outerHeight()) / 2) + $(window).scrollTop()) + "px");+ chatModal.css("left", Math.max(0, (($(window).width() - $(chatModal).outerWidth()) / 2) + $(window).scrollLeft()) + "px");+ return chatModal;+ }+module.load = function(uuid) {var chatModal = $('div[UUID="'+uuid+'"]');chatModal.show();+ center(chatModal);module.bringModalToTop(chatModal);checkOnlineStatus(chatModal);}diff --git a/public/templates/footer.tpl b/public/templates/footer.tplindex 27d8a74458..39bdc9eca0 100644--- a/public/templates/footer.tpl+++ b/public/templates/footer.tpl@@ -2,7 +2,7 @@</div><!--END container -->- <div id="chat-modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="Chat" aria-hidden="true">+ <div id="chat-modal" class="modal chat-modal" tabindex="-1" role="dialog" aria-labelledby="Chat" aria-hidden="true" data-backdrop="none"><div class="modal-dialog"><div class="modal-content"><div class="modal-header">diff --git a/public/themes/vanilla/style.less b/public/themes/vanilla/style.lessindex 0bf9140ff0..f3683941b2 100644--- a/public/themes/vanilla/style.less+++ b/public/themes/vanilla/style.less@@ -74,6 +74,11 @@ a:hover, .btn-link:hover, .btn-link:active, .btn-link:focus {resize:none;}+.chat-modal {+ width: 600px;+ height: 550px;+}+#content{padding-bottom:20px;}