1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Only save the page if its contents have changed

This commit is contained in:
Daniel Heath 2018-01-31 09:14:32 +11:00
parent b42750073c
commit d0bc74ec55

View File

@ -167,7 +167,13 @@ body#pad textarea {
// This will apply the debounce effect on the keyup event // This will apply the debounce effect on the keyup event
// And it only fires 500ms or half a second after the user stopped typing // And it only fires 500ms or half a second after the user stopped typing
var prevText = $('#userInput').val();
$('#userInput').on('keyup', debounce(function() { $('#userInput').on('keyup', debounce(function() {
if (prevText == $('#userInput').val()) {
return // no changes
}
prevText = $('#userInput').val();
if (oulipo) { if (oulipo) {
$('#userInput').val($('#userInput').val().replace(/e/g,"")); $('#userInput').val($('#userInput').val().replace(/e/g,""));
} }