From 0988f1df2ad8c455fa8fe9f57bd3877b9e78b4ae Mon Sep 17 00:00:00 2001 From: Junior Date: Sun, 8 Nov 2026 15:44:22 -0500 Subject: [PATCH] Make sure successive clicks to open a folder get cancelled if the previous click hasn't finished rendering --- js/comics.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/comics.js b/js/comics.js index 2154067..d96fa04 100644 --- a/js/comics.js +++ b/js/comics.js @@ -1,4 +1,6 @@ const NOREFRESH = false; +var folderRequest = false; +toastr.options.escapeHtml = true; // This function is executed after the page load completes on the client $(document).ready(function() { @@ -92,6 +94,8 @@ function cycleSortOrder() { * @returns {void} */ function getFolderContents() { + if ( folderRequest ) return; + folderRequest = true; $("#list").html(""); toastr.info("Loading folder contents. Comics containing a large number of issues, or issues with a large number of pages, that have not been opened recently may take some time to load. Thank you for your patience!", "Loading Contents...", {timeOut: 15000}); $.ajax({ @@ -111,6 +115,9 @@ function getFolderContents() { toastr.error("There was an error retrieving the current folder contents.", "API Error...", {timeOut: 15000}); console.log(xhr.status); console.log(err); + }, + complete : function(xhr, stat) { + folderRequest = false; } }); }