Browse Source

- Continue Chat javascript refactoring

pull/16/head
Jaussoin Timothée 11 years ago
parent
commit
5d6594c6f4
  1. 4
      app/widgets/Chat/Chat.php
  2. 17
      app/widgets/Chat/chat.js

4
app/widgets/Chat/Chat.php

@ -431,7 +431,7 @@ class Chat extends WidgetBase {
$this->genCallAjax(
'ajaxSendMessage',
"'" . $contact->jid . "'",
"sendMessage(this, '" . $contact->jid . "')",
"Chats.sendMessage(this, '" . $contact->jid . "')",
"false",
"'" . $contact->ressource . "'"));
@ -479,7 +479,7 @@ class Chat extends WidgetBase {
$this->genCallAjax(
'ajaxSendMessage',
"'" . $jid . "'",
"sendMessage(this, '" . $jid . "')", "true"));
"Chats.sendMessage(this, '" . $jid . "')", "true"));
$session = \Sessionx::start();
$mucview->assign('exitmuc', $this->genCallAjax("ajaxExitMuc", "'" . $jid . "'", "'" . $session->username . "'"));

17
app/widgets/Chat/chat.js

@ -31,6 +31,13 @@ var Chats = {
chat = document.getElementById('chat' + jid);
chat.querySelector('.tab').className = 'tab alert';
},
sendMessage: function(n, jid)
{
var text = n.value;
n.value = "";
n.focus();
return encodeURIComponent(text);
},
}
movim_add_onload(function()
@ -91,13 +98,3 @@ function hidePaused(jid) {
var paused = document.getElementById('paused' + jid);
paused.style.display = 'none';
}
function sendMessage(n, jid)
{
var text = n.value;
n.value = "";
n.focus();
// We escape the text to prevent XML errors
return encodeURIComponent(text);
}
Loading…
Cancel
Save