From 37e630e2088f4341f2d2c8a634863b5456e451c9 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Tue, 4 Oct 2022 20:26:13 -0700 Subject: [PATCH] Add status output for null inputs --- index.html | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 7accbb3..89ae359 100644 --- a/index.html +++ b/index.html @@ -140,7 +140,7 @@ transition: filter 150ms; } - output { + output#table { display: none; } @@ -225,8 +225,9 @@ + - + @@ -289,11 +290,17 @@ document.querySelector('form').addEventListener('submit', async event => { event.preventDefault(); + const status = event.target.elements['status']; const formData = new FormData(event.target); const combined = `${formData.get('text')}\n${await formData.get('file').text()}`; // Concatenate textarea and file inputs const parsed = new Set(combined.split('\n').map(c => c.split(',')).flat().map(e => e.trim())); // Split on newline or comma, flatten, trim whitespace, de-duplicate const cleaned = [...parsed].filter(name => name.slice(-4) === '.eth'); // Remove anything that does not end in '.eth' + if (cleaned.length === 0) { + status.textContent = 'No valid ENS names found.' + return; + } + const batchPayload = cleaned.map((name, index) => ({ jsonrpc: '2.0', method: 'eth_call', @@ -326,7 +333,7 @@ address.textContent = `0x${response.result.slice(26)}`; } - document.querySelector('output').style.display = 'block'; + document.querySelector('output#table').style.display = 'block'; }); -- 2.47.3