From d3ba7eeb13a889d694dc78731a240f6cc86a055b Mon Sep 17 00:00:00 2001 From: rugk Date: Thu, 23 Apr 2020 12:07:08 +0200 Subject: [PATCH] Reset checkboxes on new paste --- js/privatebin.js | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 86e40711..23344dd8 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -3601,6 +3601,20 @@ jQuery.PrivateBin = (function($, RawDeflate) { } } + + /** + * Clear the attachment input in the top navigation. + * + * @name TopNav.clearAttachmentInput + * @function + */ + function clearAttachmentInput() + { + // hide UI for selected files + // our up-to-date jQuery can handle it :) + $fileWrap.find('input').val(''); + } + /** * return raw text * @@ -3695,7 +3709,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { // in any case, remove saved attachment data AttachmentViewer.removeAttachmentData(); - me.clearAttachmentInput(); + clearAttachmentInput(); AttachmentViewer.clearDragAndDrop(); // pevent '#' from appearing in the URL @@ -4111,16 +4125,21 @@ jQuery.PrivateBin = (function($, RawDeflate) { }; /** - * Clear the attachment input in the top navigation. + * Reset the top navigation back to it's default values. * - * @name TopNav.clearAttachmentInput + * @name TopNav.resetInput * @function */ - me.clearAttachmentInput = function() + me.resetInput = function() { - // hide UI for selected files - // our up-to-date jQuery can handle it :) - $fileWrap.find('input').val(''); + clearAttachmentInput(); + + $openDiscussion.prop('checked', false); + $burnAfterReading.prop('checked', false); + $openDiscussionOption.removeClass('buttondisabled'); + $burnAfterReadingOption.removeClass('buttondisabled'); + + // TODO: reset expiration time }; /** @@ -5144,7 +5163,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { Editor.show(); Editor.focusInput(); AttachmentViewer.removeAttachment(); - TopNav.clearAttachmentInput(); + TopNav.resetInput(); TopNav.showCreateButtons();