diff --git a/dist/frontend.js b/dist/frontend.js new file mode 100644 index 0000000..8329404 --- /dev/null +++ b/dist/frontend.js @@ -0,0 +1,23 @@ +"use strict"; +document.addEventListener('DOMContentLoaded', () => { + const inputElement = document.getElementById('input'); + const box = document.getElementById('response_text'); + const response_text = document.getElementById('response_text'); + inputElement.addEventListener('keydown', function (event) { + if (event.key === 'Enter') { + convert_form(); + } + }); + function convert_form() { + const user_input = inputElement.value; + const converted_user_input = user_input.replace(/ /g, ""); + box.textContent = converted_user_input; + inputElement.value = ''; + return converted_user_input; + } + function copy_to_clipboard() { + const text_to_copy = response_text.textContent; + navigator.clipboard.writeText(text_to_copy); + } +}); +//# sourceMappingURL=frontend.js.map \ No newline at end of file diff --git a/dist/frontend.js.map b/dist/frontend.js.map new file mode 100644 index 0000000..eb26ec7 --- /dev/null +++ b/dist/frontend.js.map @@ -0,0 +1 @@ +{"version":3,"file":"frontend.js","sourceRoot":"","sources":["../frontend.ts"],"names":[],"mappings":";AAAA,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAEnD,MAAM,YAAY,GAAG,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAmB,CAAC;IACxE,MAAM,GAAG,GAAG,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAmB,CAAC;IACvE,MAAM,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAmB,CAAC;IAIjF,YAAY,CAAC,gBAAgB,CAAC,SAAS,EAAE,UAAS,KAAK;QACnD,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,EAAC,CAAC;YAC3B,YAAY,EAAE,CAAC;QACf,CAAC;IACL,CAAC,CAAC,CAAA;IASF,SAAS,YAAY;QAEjB,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC;QACtC,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAE1D,GAAG,CAAC,WAAW,GAAG,oBAAoB,CAAC;QAEvC,YAAY,CAAC,KAAK,GAAG,EAAE,CAAC;QAExB,OAAO,oBAAoB,CAAC;IAChC,CAAC;IAGD,SAAS,iBAAiB;QACtB,MAAM,YAAY,GAAG,aAAa,CAAC,WAAW,CAAC;QAE/C,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;AAGD,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/frontend.js b/frontend.js deleted file mode 100644 index fcfe120..0000000 --- a/frontend.js +++ /dev/null @@ -1,28 +0,0 @@ - - - -const input = document.getElementById('input'); -input.addEventListener('keydown', function(event) { - if (event.key === 'Enter'){ - convert_input(); - } -}) - - -function convert_input() { -const input = document.getElementById('input').value; -const converted_input = input.replace(/ /g, ""); - - -const box = document.getElementById('response_text'); -box.textContent = converted_input; -document.getElementById('input').value = ''; - -} - -function copy_to_clipboard() { - const copyText = document.getElementById('response_text').textContent; - console.log(copyText); - - navigator.clipboard.writeText(copyText); -} \ No newline at end of file diff --git a/frontend.ts b/frontend.ts new file mode 100644 index 0000000..0485d09 --- /dev/null +++ b/frontend.ts @@ -0,0 +1,42 @@ +document.addEventListener('DOMContentLoaded', () => { + +const inputElement = document.getElementById('input')as HTMLFormElement; +const box = document.getElementById('response_text')as HTMLFormElement; +const response_text = document.getElementById('response_text')as HTMLFormElement; + + + +inputElement.addEventListener('keydown', function(event) { + if (event.key === 'Enter'){ + convert_form(); + } +}) + + + + + + + + +function convert_form(): string { + + const user_input = inputElement.value; + const converted_user_input = user_input.replace(/ /g, ""); + + box.textContent = converted_user_input; + + inputElement.value = ''; + + return converted_user_input; +} + + +function copy_to_clipboard() { + const text_to_copy = response_text.textContent; + + navigator.clipboard.writeText(text_to_copy); +} + + +}); \ No newline at end of file diff --git a/index.html b/index.html index e8e6921..96eac26 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@
- +
@@ -18,6 +18,6 @@
- + \ No newline at end of file diff --git a/package.json b/package.json index 1c9bb2f..045e416 100644 --- a/package.json +++ b/package.json @@ -4,5 +4,23 @@ }, "devDependencies": { "typescript": "^5.9.3" - } + }, + "name": "web_tool", + "version": "1.0.0", + "description": "", + "main": "backend.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "build": "tsc" + }, + "repository": { + "type": "git", + "url": "https://gitea.adrianru.de/adrian/web_tool.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "type": "commonjs" + + } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..d599f68 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "outDir": "./dist", + "sourceMap": true, + "strict": true, + "module": "ES6", + "target": "ES6", + "allowJs": false + }, + "include": ["*.ts"], + "exclude": ["node_modules", "dist"] +} \ No newline at end of file