summaryrefslogtreecommitdiff
path: root/web_page/main.js
diff options
context:
space:
mode:
authorleo <azuminha1@gmail.co>2025-10-20 03:56:20 -0300
committerleo <azuminha1@gmail.co>2025-10-20 03:56:20 -0300
commit05ac71d4b76dc10d56301ce58858fd90eeb1fe82 (patch)
tree2e733a00eb4535ca6d6451fdbc96ad16e2e856bb /web_page/main.js
parent3a78df7d613c61bf74a43ec023af23b47c9b5635 (diff)
moved from go to react, and added a better cssHEADmaster
Diffstat (limited to 'web_page/main.js')
-rw-r--r--web_page/main.js48
1 files changed, 29 insertions, 19 deletions
diff --git a/web_page/main.js b/web_page/main.js
index 8d83b4c..dbb3495 100644
--- a/web_page/main.js
+++ b/web_page/main.js
@@ -1,26 +1,36 @@
-function click_send(){
- data = document.getElementById("inp1").value;
- console.log(data);
+import { createRoot } from "react-dom/client";
- fetch("https://sl.azuminha.com/add/"+encodeURIComponent(data)).then(response => {
- if (!response.ok) {
- throw new Error('Network response was not ok');
- }
- return response.text();
- }).then(result => {
- console.log(result);
- const res = document.createElement("p");
- res.textContent = data + " => " + "sl.azuminha.com/" + result;
- document.body.appendChild(res);
+// Clear the existing HTML content
+document.body.innerHTML = '<div id="app"></div>';
+
+// Render your React component instead
+const root = createRoot(document.getElementById("app"));
+root.render(<h1>Hello, world</h1>);
+
+function click_send() {
+ data = document.getElementById("inp1").value;
+ console.log(data);
+
+ fetch("https://sl.azuminha.com/add/" + encodeURIComponent(data))
+ .then((response) => {
+ if (!response.ok) {
+ throw new Error("Network response was not ok");
+ }
+ return response.text();
})
- return 10 * 3;
+ .then((result) => {
+ console.log(result);
+ const res = document.createElement("p");
+ res.textContent = data + " => " + "sl.azuminha.com/" + result;
+ document.body.appendChild(res);
+ });
+ return 10 * 3;
}
document.addEventListener("DOMContentLoaded", function () {
- const input = document.getElementById("inp1");
+ const input = document.getElementById("inp1");
- input.addEventListener("keydown", function (event) {
- if (event.key === "Enter")
- click_send();
- });
+ input.addEventListener("keydown", function (event) {
+ if (event.key === "Enter") click_send();
+ });
});