sample script working. remove privacy page
This commit is contained in:
parent
5e3d979999
commit
b459dee4ce
@ -14,4 +14,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<textarea id="code"></textarea>
|
||||||
|
|
||||||
|
@*<button id="send">Send</button>*@
|
||||||
|
|
||||||
|
<textarea id="mirror"></textarea>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
@page
|
|
||||||
@model PrivacyModel
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Privacy Policy";
|
|
||||||
}
|
|
||||||
<h1>@ViewData["Title"]</h1>
|
|
||||||
|
|
||||||
<p>Use this page to detail your site's privacy policy.</p>
|
|
@ -1,24 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BinaryDad.Coding.Pages
|
|
||||||
{
|
|
||||||
public class PrivacyModel : PageModel
|
|
||||||
{
|
|
||||||
private readonly ILogger<PrivacyModel> _logger;
|
|
||||||
|
|
||||||
public PrivacyModel(ILogger<PrivacyModel> logger)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnGet()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +1,29 @@
|
|||||||
var connection = new signalR.HubConnectionBuilder().withUrl("/chatHub").build();
|
$(function () {
|
||||||
|
|
||||||
//Disable send button until connection is established
|
var connection = new signalR.HubConnectionBuilder().withUrl("/codeHub").build();
|
||||||
document.getElementById("sendButton").disabled = true;
|
|
||||||
|
|
||||||
connection.on("ReceiveMessage", function (user, message) {
|
let $code = $('#code');
|
||||||
var li = document.createElement("li");
|
let $mirror = $('#mirror');
|
||||||
document.getElementById("messagesList").appendChild(li);
|
|
||||||
// We can assign user-supplied strings to an element's textContent because it
|
|
||||||
// is not interpreted as markup. If you're assigning in any other way, you
|
|
||||||
// should be aware of possible script injection concerns.
|
|
||||||
li.textContent = `${user} says ${message}`;
|
|
||||||
});
|
|
||||||
|
|
||||||
connection.start().then(function () {
|
$('#code').keyup(function () {
|
||||||
document.getElementById("sendButton").disabled = false;
|
|
||||||
}).catch(function (err) {
|
|
||||||
return console.error(err.toString());
|
|
||||||
});
|
|
||||||
|
|
||||||
document.getElementById("sendButton").addEventListener("click", function (event) {
|
let user = 'ryan';
|
||||||
var user = document.getElementById("userInput").value;
|
let message = $code.val();
|
||||||
var message = document.getElementById("messageInput").value;
|
|
||||||
connection.invoke("SendMessage", user, message).catch(function (err) {
|
connection.invoke("SendMessage", user, message).catch(function (err) {
|
||||||
|
return console.error(err.toString());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
connection.on("ReceiveMessage", function (user, message) {
|
||||||
|
|
||||||
|
$mirror.val(message);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
connection.start().then(function () {
|
||||||
|
//$('#send').prop('disabled', false);
|
||||||
|
}).catch(function (err) {
|
||||||
return console.error(err.toString());
|
return console.error(err.toString());
|
||||||
});
|
});
|
||||||
event.preventDefault();
|
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user