mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Show text/plain message
This commit is contained in:
parent
c7232b8bd0
commit
c2745de23b
@ -253,7 +253,7 @@ TimWolla.WCF ?= {}
|
|||||||
|
|
||||||
if typeof window.webkitNotifications isnt 'undefined'
|
if typeof window.webkitNotifications isnt 'undefined'
|
||||||
if window.webkitNotifications.checkPermission() is 0
|
if window.webkitNotifications.checkPermission() is 0
|
||||||
notification = window.webkitNotifications.createNotification WCF.Icon.get('timwolla.wcf.chat.chat'), WCF.Language.get('wcf.chat.newMessages'), 'New message by' + message.username
|
notification = window.webkitNotifications.createNotification WCF.Icon.get('timwolla.wcf.chat.chat'), WCF.Language.get('wcf.chat.newMessages'), message.username + ' ' + message.message
|
||||||
notification.show()
|
notification.show()
|
||||||
setTimeout(() ->
|
setTimeout(() ->
|
||||||
notification.cancel()
|
notification.cancel()
|
||||||
|
@ -47,7 +47,7 @@ public function __toString() {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFormattedMessage() {
|
public function getFormattedMessage($outputType = 'text/html') {
|
||||||
$message = $this->message;
|
$message = $this->message;
|
||||||
switch ($this->type) {
|
switch ($this->type) {
|
||||||
case self::TYPE_JOIN:
|
case self::TYPE_JOIN:
|
||||||
@ -56,7 +56,7 @@ public function getFormattedMessage() {
|
|||||||
$message = WCF::getLanguage()->get('wcf.chat.message.'.$this->type);
|
$message = WCF::getLanguage()->get('wcf.chat.message.'.$this->type);
|
||||||
break;
|
break;
|
||||||
case self::TYPE_NORMAL:
|
case self::TYPE_NORMAL:
|
||||||
if (!$this->enableHTML) {
|
if (!$this->enableHTML && $outputType == 'text/html') {
|
||||||
$message = \wcf\system\bbcode\SimpleMessageParser::getInstance()->parse($message, true, $this->enableSmilies);
|
$message = \wcf\system\bbcode\SimpleMessageParser::getInstance()->parse($message, true, $this->enableSmilies);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,6 +97,7 @@ public function jsonify($raw = false) {
|
|||||||
'formattedUsername' => $this->getFormattedUsername(),
|
'formattedUsername' => $this->getFormattedUsername(),
|
||||||
'formattedMessage' => (string) $this,
|
'formattedMessage' => (string) $this,
|
||||||
'formattedTime' => \wcf\util\DateUtil::format(\wcf\util\DateUtil::getDateTimeByTimestamp($this->time), 'H:i:s'),
|
'formattedTime' => \wcf\util\DateUtil::format(\wcf\util\DateUtil::getDateTimeByTimestamp($this->time), 'H:i:s'),
|
||||||
|
'message' => $this->getFormattedMessage('text/plain'),
|
||||||
'sender' => $this->sender,
|
'sender' => $this->sender,
|
||||||
'username' => $this->getUsername(),
|
'username' => $this->getUsername(),
|
||||||
'time' => $this->time,
|
'time' => $this->time,
|
||||||
|
Loading…
Reference in New Issue
Block a user