sample jotted code

This commit is contained in:
Ryan Peters 2021-07-18 22:17:18 -04:00
parent b459dee4ce
commit 28bfb0ad19
6 changed files with 45 additions and 107 deletions

View File

@ -8,16 +8,31 @@
{
<script src="~/js/signalr/dist/browser/signalr.js"></script>
<script src="~/js/hub.js"></script>
<script src="~/js/jotted/jotted.min.js"></script>
<script>
new Jotted(document.querySelector('#editor'), {
files: [{
type: 'html',
content: '<html>\n <body>\n <h1>Hello!</h1>\n </body>\n</html>'
}, {
type: 'css',
content: ''
}, {
type: 'js',
content: ''
}]
})
</script>
}
@section Css
{
<link href="~/css/jotted/jotted.min.css" rel="stylesheet" />
}
<div class="text-center">
<textarea id="code"></textarea>
@*<button id="send">Send</button>*@
<textarea id="mirror"></textarea>
<div id="editor"></div>
</div>

View File

@ -6,28 +6,13 @@
<title>@ViewData["Title"] - BinaryDad.Coding</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono&display=swap" rel="stylesheet">
@await RenderSectionAsync("Css", false)
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container">
<a class="navbar-brand" asp-area="" asp-page="/Index">BinaryDad.Coding</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@ -45,6 +30,6 @@
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)
@await RenderSectionAsync("Scripts", false)
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -1,71 +1,7 @@
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
for details on configuring this project to bundle and minify static web assets. */
body {
a.navbar-brand {
white-space: normal;
text-align: center;
word-break: break-all;
}
/* Provide sufficient contrast against white background */
a {
color: #0366d6;
}
.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
/* Sticky footer styles
-------------------------------------------------- */
html {
font-size: 14px;
}
@media (min-width: 768px) {
html {
font-size: 16px;
}
}
.border-top {
border-top: 1px solid #e5e5e5;
}
.border-bottom {
border-bottom: 1px solid #e5e5e5;
}
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}
button.accept-policy {
font-size: 1rem;
line-height: inherit;
}
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
white-space: nowrap;
line-height: 60px; /* Vertically center the text there */
}
textarea {
font-family: 'Roboto Mono', monospace;
}

View File

@ -2,24 +2,24 @@
var connection = new signalR.HubConnectionBuilder().withUrl("/codeHub").build();
let $code = $('#code');
let $mirror = $('#mirror');
//let $code = $('#code');
//let $mirror = $('#mirror');
$('#code').keyup(function () {
//$('#code').keyup(function () {
let user = 'ryan';
let message = $code.val();
// let user = 'ryan';
// let message = $code.val();
connection.invoke("SendMessage", user, message).catch(function (err) {
return console.error(err.toString());
});
});
// connection.invoke("SendMessage", user, message).catch(function (err) {
// return console.error(err.toString());
// });
//});
connection.on("ReceiveMessage", function (user, message) {
//connection.on("ReceiveMessage", function (user, message) {
$mirror.val(message);
// $mirror.val(message);
});
//});
connection.start().then(function () {
//$('#send').prop('disabled', false);

File diff suppressed because one or more lines are too long