diff --git a/file/js/TimWolla.WCF.Chat.js b/file/js/TimWolla.WCF.Chat.js index 83a1176..d6f4e55 100644 --- a/file/js/TimWolla.WCF.Chat.js +++ b/file/js/TimWolla.WCF.Chat.js @@ -12,6 +12,7 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {}; (function ($, document) { TimWolla.WCF.Chat = { + titleTemplate: '', init: function(roomID, messageID) { this.bindEvents(); }, @@ -33,17 +34,25 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {}; }, changeRoom: function(target) { window.history.replaceState({}, '', target.attr('href')); + + // mark as active; $('.activeMenuItem .chatRoom').parent().removeClass('activeMenuItem'); target.parent().addClass('activeMenuItem'); + + // actually change the room $.ajax(target.attr('href'), { dataType: 'json', data: { ajax: 1 }, type: 'POST', - success: function (data, textStatus, jqXHR) { + success: $.proxy(function (data, textStatus, jqXHR) { + // set new topic $('#topic').text(data.topic); - if (data.topic == '') $('#topic').hide(); - else $('#topic').show(); - } + if (data.topic == '') $('#topic').wcfBlindOut(); + else $('#topic').wcfBlindIn(); + + // set page-title + $('title').text(this.titleTemplate.fetch(data)); + }, this) }); } }; diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index fc7f109..a1b4dcf 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -168,6 +168,7 @@ public function show() { if ($this->useTemplate) exit; @header('Content-type: application/json'); echo \wcf\util\JSON::encode(array( + 'title' => WCF::getLanguage()->get($this->room->title), 'topic' => WCF::getLanguage()->get($this->room->topic) )); exit; diff --git a/template/chat.tpl b/template/chat.tpl index 9c8d007..2a43aa9 100644 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -247,6 +247,7 @@