From 21dcd0c9dfaff87e12cd4647fb081969031f1230 Mon Sep 17 00:00:00 2001 From: Erhannis Date: Sat, 20 Feb 2021 14:24:18 -0500 Subject: [PATCH] In upload, in url field, fetch when 'enter' key (#55) --- assets/js/upload.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/assets/js/upload.js b/assets/js/upload.js index beab2c42..7b511f9c 100644 --- a/assets/js/upload.js +++ b/assets/js/upload.js @@ -108,6 +108,13 @@ function setupImageUpload() { }).catch(showError); }); + // Fetch on "enter" in url field + remoteUrl.addEventListener("keydown", function(event) { + if (event.keyCode === 13) { // Hit enter + fetchButton.click(); + } + }); + // Enable/disable the fetch button based on content in the image scraper. Fetching with no URL makes no sense. remoteUrl.addEventListener('input', () => { if (remoteUrl.value.length > 0) {