Fixe le comportement du chat

This commit is contained in:
2017-03-16 17:13:47 +01:00
parent 1eaa0021cb
commit 5a4f654978

View File

@ -46,12 +46,17 @@
<script src="~/api/signalr/hubs"></script>
<!--SignalR script to update the chat page and send messages.-->
<script>
var pvuis;
var audio = new Audio('/sounds/bell.mp3');
$(function () {
var pvuis;
var audio = new Audio('/sounds/bell.mp3');
// This optional function html-encodes messages for display in the page.
function htmlEncode(value) {
var encodedValue = $('<div />').text(value).html();
return encodedValue;
}
var setPrivate = function (li) {
var setPrivate = function (li) {
console.log("here I am");
$("#sendmessagebox").addClass("hidden");
$("#sendpvbox").removeClass("hidden");
@ -95,7 +100,8 @@
);
};
// Reference the auto-generated proxy for the hub.
$(document).ready(function(){
// Reference the auto-generated proxy for the hub.
var chat = $.connection.chatHub;
// Create a function that the hub can call back to display messages.
chat.client.addMessage = function (name, message) {
@ -216,20 +222,12 @@
}, 3000); // Re-start connection after 3 seconds
});
});
$(window).unload(function () { chat.server.abort(); });
});
// This optional function html-encodes messages for display in the page.
function htmlEncode(value) {
var encodedValue = $('<div />').text(value).html();
return encodedValue;
}
</script>
@if (!ViewBag.IsAuthenticated) { // Get the user name and store it to prepend to messages.
<script>
$('#displayname').val(prompt('Enter your name:', ''));
</script>
} }
</script>
} }