sample script working. remove privacy page
This commit is contained in:
parent
5e3d979999
commit
b459dee4ce
@ -12,6 +12,12 @@
|
||||
|
||||
<div class="text-center">
|
||||
|
||||
|
||||
|
||||
<textarea id="code"></textarea>
|
||||
|
||||
@*<button id="send">Send</button>*@
|
||||
|
||||
<textarea id="mirror"></textarea>
|
||||
|
||||
</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
|
||||
document.getElementById("sendButton").disabled = true;
|
||||
var connection = new signalR.HubConnectionBuilder().withUrl("/codeHub").build();
|
||||
|
||||
connection.on("ReceiveMessage", function (user, message) {
|
||||
var li = document.createElement("li");
|
||||
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}`;
|
||||
});
|
||||
let $code = $('#code');
|
||||
let $mirror = $('#mirror');
|
||||
|
||||
connection.start().then(function () {
|
||||
document.getElementById("sendButton").disabled = false;
|
||||
}).catch(function (err) {
|
||||
return console.error(err.toString());
|
||||
});
|
||||
$('#code').keyup(function () {
|
||||
|
||||
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) {
|
||||
let user = 'ryan';
|
||||
let message = $code.val();
|
||||
|
||||
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());
|
||||
});
|
||||
event.preventDefault();
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user