sample script working. remove privacy page

This commit is contained in:
Ryan Peters 2021-07-18 21:42:15 -04:00
parent 5e3d979999
commit b459dee4ce
4 changed files with 28 additions and 53 deletions

View File

@ -14,4 +14,10 @@
<textarea id="code"></textarea>
@*<button id="send">Send</button>*@
<textarea id="mirror"></textarea>
</div> </div>

View File

@ -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>

View File

@ -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()
{
}
}
}

View File

@ -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) { let user = 'ryan';
return console.error(err.toString()); let message = $code.val();
});
document.getElementById("sendButton").addEventListener("click", function (event) {
var user = document.getElementById("userInput").value;
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()); return console.error(err.toString());
}); });
event.preventDefault(); });
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());
});
}); });