Commit
•
3dadf94
1
Parent(s):
b98ad90
♿️ Use form
Browse files- app.ts +4 -1
- dist/app.js +3 -1
- index.html +2 -2
app.ts
CHANGED
@@ -19,6 +19,7 @@ window.addEventListener("load", function () {
|
|
19 |
const repoNameEl = document.querySelector<HTMLInputElement>("#repo_name")!;
|
20 |
const button = document.querySelector("#submit")!;
|
21 |
const output = document.querySelector("#logs")!;
|
|
|
22 |
|
23 |
const storedToken = window.localStorage.getItem("hf_token");
|
24 |
if (storedToken) {
|
@@ -29,7 +30,9 @@ window.addEventListener("load", function () {
|
|
29 |
repoNameEl.value = `tfjs-mobilenet-${Date.now() % 1_000}`;
|
30 |
/// "random" repo name
|
31 |
|
32 |
-
|
|
|
|
|
33 |
const token = tokenEl.value;
|
34 |
const repoName = repoNameEl.value;
|
35 |
if (!token || !repoName) {
|
|
|
19 |
const repoNameEl = document.querySelector<HTMLInputElement>("#repo_name")!;
|
20 |
const button = document.querySelector("#submit")!;
|
21 |
const output = document.querySelector("#logs")!;
|
22 |
+
const form = this.document.getElementsByTagName("form")[0];
|
23 |
|
24 |
const storedToken = window.localStorage.getItem("hf_token");
|
25 |
if (storedToken) {
|
|
|
30 |
repoNameEl.value = `tfjs-mobilenet-${Date.now() % 1_000}`;
|
31 |
/// "random" repo name
|
32 |
|
33 |
+
form.addEventListener("submit", async function (event) {
|
34 |
+
event.preventDefault();
|
35 |
+
|
36 |
const token = tokenEl.value;
|
37 |
const repoName = repoNameEl.value;
|
38 |
if (!token || !repoName) {
|
dist/app.js
CHANGED
@@ -15,6 +15,7 @@ window.addEventListener("load", function () {
|
|
15 |
const repoNameEl = document.querySelector("#repo_name");
|
16 |
const button = document.querySelector("#submit");
|
17 |
const output = document.querySelector("#logs");
|
|
|
18 |
const storedToken = window.localStorage.getItem("hf_token");
|
19 |
if (storedToken) {
|
20 |
tokenEl.value = storedToken;
|
@@ -22,7 +23,8 @@ window.addEventListener("load", function () {
|
|
22 |
}
|
23 |
repoNameEl.value = `tfjs-mobilenet-${Date.now() % 1_000}`;
|
24 |
/// "random" repo name
|
25 |
-
|
|
|
26 |
const token = tokenEl.value;
|
27 |
const repoName = repoNameEl.value;
|
28 |
if (!token || !repoName) {
|
|
|
15 |
const repoNameEl = document.querySelector("#repo_name");
|
16 |
const button = document.querySelector("#submit");
|
17 |
const output = document.querySelector("#logs");
|
18 |
+
const form = this.document.getElementsByTagName("form")[0];
|
19 |
const storedToken = window.localStorage.getItem("hf_token");
|
20 |
if (storedToken) {
|
21 |
tokenEl.value = storedToken;
|
|
|
23 |
}
|
24 |
repoNameEl.value = `tfjs-mobilenet-${Date.now() % 1_000}`;
|
25 |
/// "random" repo name
|
26 |
+
form.addEventListener("submit", async function (event) {
|
27 |
+
event.preventDefault();
|
28 |
const token = tokenEl.value;
|
29 |
const repoName = repoNameEl.value;
|
30 |
if (!token || !repoName) {
|
index.html
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
<script type="module" src="./dist/app.js"></script>
|
15 |
</head>
|
16 |
<body>
|
17 |
-
<
|
18 |
<h1 class="text-3xl font-bold">
|
19 |
<span
|
20 |
class="bg-clip-text text-transparent bg-gradient-to-r from-pink-500 to-violet-500"
|
@@ -147,6 +147,6 @@
|
|
147 |
<pre id="logs" class="bg-gray-100 rounded p-3 mb-8 text-sm">
|
148 |
Output will be here</pre
|
149 |
>
|
150 |
-
</
|
151 |
</body>
|
152 |
</html>
|
|
|
14 |
<script type="module" src="./dist/app.js"></script>
|
15 |
</head>
|
16 |
<body>
|
17 |
+
<form class="container mx-auto pt-8">
|
18 |
<h1 class="text-3xl font-bold">
|
19 |
<span
|
20 |
class="bg-clip-text text-transparent bg-gradient-to-r from-pink-500 to-violet-500"
|
|
|
147 |
<pre id="logs" class="bg-gray-100 rounded p-3 mb-8 text-sm">
|
148 |
Output will be here</pre
|
149 |
>
|
150 |
+
</form>
|
151 |
</body>
|
152 |
</html>
|