corrade-http-templates

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 51  →  ?path2? @ 52
/groupChat/groupChat.html
@@ -60,7 +60,7 @@
<script src="bower_components/velocity/velocity.min.js"></script>
<script>
$(document).ready(function () {
function sendGroupMessage() {
function sendGroupMessage(token) {
// Hide the controls.
$("#controls").animate(
{
@@ -77,7 +77,8 @@
url: "sendGroupMessage.php",
data: {
name: $("#name").val(),
message: $("#message").val()
message: $("#message").val(),
token: token
}
}).done(function(data) {
// If any error occurred, display it.
@@ -96,6 +97,7 @@
);
});
}
// Polls the chatlog every second for changes.
(function retrieveMessages() {
$.get("chat.log?t=" + Math.random(), function(data) {
@@ -104,18 +106,22 @@
setTimeout(retrieveMessages, 1000);
});
}());
// When the send button is pressed, then call the sendGroupMessage function to
// send the message to the PHP script, which then send the message to Corrade.
$("#send").click(function(e){
sendGroupMessage();
$.get('session.php').then((token) => {
// When the send button is pressed, then call the sendGroupMessage function to
// send the message to the PHP script, which then send the message to Corrade.
$("#send").click(function(e){
sendGroupMessage(token);
});
// Subscribe to pressing enter with the message input box selected.
$("#message").keypress(function(e) {
if (e.which == 13) {
sendGroupMessage(token);
return false;
}
});
});
// Subscribe to pressing enter with the message input box selected.
$("#message").keypress(function(e) {
if (e.which == 13) {
sendGroupMessage();
return false;
}
});
});
</script>
</body>