final tweaks with save indicator
This commit is contained in:
parent
1348f73400
commit
5b3b6711d9
@ -3,4 +3,6 @@
|
|||||||
ViewData["Title"] = "Home Page";
|
ViewData["Title"] = "Home Page";
|
||||||
}
|
}
|
||||||
|
|
||||||
<textarea id="content" name="content">@Model</textarea>
|
<textarea id="content" name="content" spellcheck="false">@Model</textarea>
|
||||||
|
|
||||||
|
<div id="saved-indicator">Saved!</div>
|
@ -1,6 +1,7 @@
|
|||||||
html {
|
html {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 768px) {
|
||||||
@ -9,10 +10,6 @@ html {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
|
|
||||||
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
html {
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
@ -27,10 +24,28 @@ textarea {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
margin: 0;
|
||||||
|
resize: none;
|
||||||
color: #444;
|
color: #444;
|
||||||
font-size: 16px;
|
font-size: 12px;
|
||||||
font-family: Consolas;
|
font-family: Consolas;
|
||||||
outline: none;
|
outline: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#saved-indicator {
|
||||||
|
position: fixed;
|
||||||
|
bottom: -40px;
|
||||||
|
right: 10px;
|
||||||
|
font-size: 12px;
|
||||||
|
background-color: green;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 10px 10px 0 0;
|
||||||
|
color: #fff;
|
||||||
|
transition: bottom 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#saved-indicator.show {
|
||||||
|
bottom: 0;
|
||||||
|
}
|
@ -9,7 +9,11 @@
|
|||||||
type: 'POST'
|
type: 'POST'
|
||||||
}).done(function (data) {
|
}).done(function (data) {
|
||||||
|
|
||||||
// saved!
|
// show 'saved' indicator
|
||||||
|
$('#saved-indicator').addClass('show').delay(800).queue(function (next) {
|
||||||
|
$(this).removeClass('show');
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
alert('Could not connect to server. Check your internet connection and try again.');
|
alert('Could not connect to server. Check your internet connection and try again.');
|
||||||
@ -18,13 +22,16 @@
|
|||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|
||||||
// bind on blur event
|
var timer = null;
|
||||||
$('textarea').on('blur', function () {
|
$('textarea').keyup(function () {
|
||||||
saveContent($(this));
|
clearTimeout(timer);
|
||||||
|
timer = setTimeout(function () {
|
||||||
|
saveContent();
|
||||||
|
}, 500);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 20 second interval
|
// 20 second interval
|
||||||
setInterval(saveContent, 20000);
|
setInterval(saveContent, 60000);
|
||||||
|
|
||||||
//onbeforeunload = saveContent();
|
//onbeforeunload = saveContent();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user