mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2025-01-09 00:20:08 +00:00
Change Page-Title as well
This commit is contained in:
parent
d470fc8ebe
commit
3bf303a612
@ -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)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -247,6 +247,7 @@
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
TimWolla.WCF.Chat.init({$room->roomID}, 1);
|
||||
TimWolla.WCF.Chat.titleTemplate = new WCF.Template('{ldelim}$title} - {'wcf.chat.title'|language|encodeJS} - {PAGE_TITLE|language|encodeJS}');
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user