diff --git a/books/templates/books/scrape.html b/books/templates/books/scrape.html index 6c7999ec..cd00eb2b 100644 --- a/books/templates/books/scrape.html +++ b/books/templates/books/scrape.html @@ -71,7 +71,7 @@ ISBN: 9787020104345 {{ form.media }} {{ form }} - {% trans '剽取!' %} + {% trans '剽取!' %} @@ -99,9 +99,13 @@ ISBN: 9787020104345 diff --git a/common/static/js/scrape.js b/common/static/js/scrape.js index 69e015d2..67ce3e3a 100644 --- a/common/static/js/scrape.js +++ b/common/static/js/scrape.js @@ -2,7 +2,14 @@ $(document).ready( function() { $(".submit").click(function(e) { e.preventDefault(); - $("#scrapeForm form").submit(); + let form = $("#scrapeForm form"); + if (form.data('submitted') === true) { + // Previously submitted - don't submit again + } else { + // Mark it so that the next submit can be ignored + form.data('submitted', true); + $("#scrapeForm form").submit(); + } }); // assume there is only one input[file] on page diff --git a/movies/templates/movies/scrape.html b/movies/templates/movies/scrape.html index 4f6733cc..85212f15 100644 --- a/movies/templates/movies/scrape.html +++ b/movies/templates/movies/scrape.html @@ -69,7 +69,7 @@ {% endfor %} - {% trans '剽取!' %} + {% trans '剽取!' %} @@ -99,7 +99,11 @@ // mark required $("#content input[required]").each(function () { $(this).prev().prepend("*"); - }) + }); + $('form').submit(function () { + $(this).find("input[type='submit']").prop('disabled', true); + $(this).find("button[type='submit']").prop('disabled', true); + });