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) {
|
(function ($, document) {
|
||||||
TimWolla.WCF.Chat = {
|
TimWolla.WCF.Chat = {
|
||||||
|
titleTemplate: '',
|
||||||
init: function(roomID, messageID) {
|
init: function(roomID, messageID) {
|
||||||
this.bindEvents();
|
this.bindEvents();
|
||||||
},
|
},
|
||||||
@ -33,17 +34,25 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {};
|
|||||||
},
|
},
|
||||||
changeRoom: function(target) {
|
changeRoom: function(target) {
|
||||||
window.history.replaceState({}, '', target.attr('href'));
|
window.history.replaceState({}, '', target.attr('href'));
|
||||||
|
|
||||||
|
// mark as active;
|
||||||
$('.activeMenuItem .chatRoom').parent().removeClass('activeMenuItem');
|
$('.activeMenuItem .chatRoom').parent().removeClass('activeMenuItem');
|
||||||
target.parent().addClass('activeMenuItem');
|
target.parent().addClass('activeMenuItem');
|
||||||
|
|
||||||
|
// actually change the room
|
||||||
$.ajax(target.attr('href'), {
|
$.ajax(target.attr('href'), {
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: { ajax: 1 },
|
data: { ajax: 1 },
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
success: function (data, textStatus, jqXHR) {
|
success: $.proxy(function (data, textStatus, jqXHR) {
|
||||||
|
// set new topic
|
||||||
$('#topic').text(data.topic);
|
$('#topic').text(data.topic);
|
||||||
if (data.topic == '') $('#topic').hide();
|
if (data.topic == '') $('#topic').wcfBlindOut();
|
||||||
else $('#topic').show();
|
else $('#topic').wcfBlindIn();
|
||||||
}
|
|
||||||
|
// set page-title
|
||||||
|
$('title').text(this.titleTemplate.fetch(data));
|
||||||
|
}, this)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -168,6 +168,7 @@ public function show() {
|
|||||||
if ($this->useTemplate) exit;
|
if ($this->useTemplate) exit;
|
||||||
@header('Content-type: application/json');
|
@header('Content-type: application/json');
|
||||||
echo \wcf\util\JSON::encode(array(
|
echo \wcf\util\JSON::encode(array(
|
||||||
|
'title' => WCF::getLanguage()->get($this->room->title),
|
||||||
'topic' => WCF::getLanguage()->get($this->room->topic)
|
'topic' => WCF::getLanguage()->get($this->room->topic)
|
||||||
));
|
));
|
||||||
exit;
|
exit;
|
||||||
|
@ -247,6 +247,7 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
TimWolla.WCF.Chat.init({$room->roomID}, 1);
|
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>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user