From d0bc74ec553cdf12d54047d0084b4ab00e6c2a28 Mon Sep 17 00:00:00 2001 From: Daniel Heath Date: Wed, 31 Jan 2018 09:14:32 +1100 Subject: [PATCH] Only save the page if its contents have changed --- templates/index.tmpl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/index.tmpl b/templates/index.tmpl index 8898e70..f020dcc 100755 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -167,7 +167,13 @@ body#pad textarea { // This will apply the debounce effect on the keyup event // And it only fires 500ms or half a second after the user stopped typing + var prevText = $('#userInput').val(); $('#userInput').on('keyup', debounce(function() { + if (prevText == $('#userInput').val()) { + return // no changes + } + prevText = $('#userInput').val(); + if (oulipo) { $('#userInput').val($('#userInput').val().replace(/e/g,"")); }