This commit is contained in:
adrian
2025-10-30 20:53:31 +01:00
parent fa0c5b976e
commit a57ad9b136
3 changed files with 17 additions and 9 deletions

View File

@ -1,4 +1,4 @@
document.addEventListener('DOMContentLoaded', () => {
const inputElement = document.getElementById('input')as HTMLFormElement; const inputElement = document.getElementById('input')as HTMLFormElement;
const box = document.getElementById('response_text')as HTMLFormElement; const box = document.getElementById('response_text')as HTMLFormElement;
@ -22,13 +22,20 @@ inputElement.addEventListener('keydown', function(event) {
function convert_form(): string { function convert_form(): string {
const user_input = inputElement.value; const user_input = inputElement.value;
const converted_user_input = user_input.replace(/ /g, ""); if (user_input == "") {
box.textContent = converted_user_input; return "error";
} else {
const converted_user_input = user_input.replace(/ /g, "");
inputElement.value = ''; box.textContent = converted_user_input;
return converted_user_input; inputElement.value = '';
copy_to_clipboard();
return converted_user_input;}
} }
@ -39,4 +46,3 @@ function copy_to_clipboard() {
} }
});

4
package-lock.json generated
View File

@ -1,9 +1,13 @@
{ {
"name": "web_tool", "name": "web_tool",
"version": "1.0.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "web_tool",
"version": "1.0.0",
"license": "ISC",
"dependencies": { "dependencies": {
"express": "^5.1.0" "express": "^5.1.0"
}, },

View File

@ -21,6 +21,4 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"type": "commonjs" "type": "commonjs"
} }