From bde336a2e249cbbd038352f4076dcd5b02fbc2a6 Mon Sep 17 00:00:00 2001 From: TheArrayser Date: Sat, 18 Jan 2025 15:24:00 +0100 Subject: [PATCH] add "enter" key to press button, encode uri component --- query.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/query.html b/query.html index e3deb2f..18fccff 100644 --- a/query.html +++ b/query.html @@ -99,7 +99,16 @@ return; } - document.location.href = window.location.protocol + "//" + contents + "." + window.location.hostname; + document.location.href = window.location.protocol + "//" + encodeURIComponent(contents) + "." + window.location.hostname; + } + + window.onload = (event) => { + document.getElementById("name").addEventListener("keypress", function(event2) { + if(event2.key == "Enter") { + event2.preventDefault(); + document.getElementById("button").click(); + } + }) }