From 9687144c9226cd9ad53c963c7cb8acc34041adad Mon Sep 17 00:00:00 2001 From: Hexalyse Date: Sat, 5 Sep 2015 14:38:53 +0200 Subject: [PATCH 1/2] Error messages are now replaced and not appended Error messages are now replaced and not appended in the #errormessage div, without removing the glyphicon (which a .text() would have done). This way, we don't have HTML code in the JS (which would be ugly). But it's still not a really elegant solution. --- js/zerobin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/zerobin.js b/js/zerobin.js index fe8576bf..7258cde4 100644 --- a/js/zerobin.js +++ b/js/zerobin.js @@ -535,7 +535,9 @@ function showError(message) { if ($('#status').length) { $('#status').addClass('errorMessage').text(message); } else { - $('#errormessage').removeClass('hidden').append(message); + $('#errormessage').removeClass('hidden'); + var content = $('#errormessage').contents(); + content[content.length - 1].nodeValue = message; } $('#replystatus').addClass('errorMessage').text(message); } From d74172064b0698ca9c9b233e89b8c564819dff8d Mon Sep 17 00:00:00 2001 From: Hexalyse Date: Sat, 5 Sep 2015 14:45:50 +0200 Subject: [PATCH 2/2] Hide error message when paste is posted correctly --- js/zerobin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/zerobin.js b/js/zerobin.js index 7258cde4..ad7827f8 100644 --- a/js/zerobin.js +++ b/js/zerobin.js @@ -396,7 +396,7 @@ function send_data() { var url = scriptLocation() + "?" + data.id + '#' + randomkey; var deleteUrl = scriptLocation() + "?pasteid=" + data.id + '&deletetoken=' + data.deletetoken; showStatus(''); - + $('#errormessage').addClass('hidden'); $('#pastelink').html('Your paste is ' + url + ' (Hit CTRL+C to copy)'); $('#deletelink').html('Delete data'); $('#pasteresult').removeClass('hidden');