coyotte508 HF staff commited on
Commit
e0d4ec0
โ€ข
1 Parent(s): 3dadf94

๐Ÿ› Fix on Firefox

Browse files
Files changed (4) hide show
  1. .prettierignore +1 -0
  2. app.ts +3 -3
  3. dist/app.js +2 -2
  4. index.html +3 -1
.prettierignore ADDED
@@ -0,0 +1 @@
 
 
1
+ dist
app.ts CHANGED
@@ -14,12 +14,12 @@ function filenameFromURL(url: string): string {
14
  return url.substring(url.lastIndexOf("/") + 1);
15
  }
16
 
17
- window.addEventListener("load", function () {
18
  const tokenEl = document.querySelector<HTMLInputElement>("#token")!;
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,7 +30,7 @@ window.addEventListener("load", function () {
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;
 
14
  return url.substring(url.lastIndexOf("/") + 1);
15
  }
16
 
17
+ window.document.addEventListener("DOMContentLoaded", () => {
18
  const tokenEl = document.querySelector<HTMLInputElement>("#token")!;
19
  const repoNameEl = document.querySelector<HTMLInputElement>("#repo_name")!;
20
  const button = document.querySelector("#submit")!;
21
  const output = document.querySelector("#logs")!;
22
+ const form = 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 (event) => {
34
  event.preventDefault();
35
 
36
  const token = tokenEl.value;
dist/app.js CHANGED
@@ -10,12 +10,12 @@ const FILES_TO_UPLOAD = [
10
  function filenameFromURL(url) {
11
  return url.substring(url.lastIndexOf("/") + 1);
12
  }
13
- window.addEventListener("load", function () {
14
  const tokenEl = document.querySelector("#token");
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;
 
10
  function filenameFromURL(url) {
11
  return url.substring(url.lastIndexOf("/") + 1);
12
  }
13
+ window.document.addEventListener("DOMContentLoaded", () => {
14
  const tokenEl = document.querySelector("#token");
15
  const repoNameEl = document.querySelector("#repo_name");
16
  const button = document.querySelector("#submit");
17
  const output = document.querySelector("#logs");
18
+ const form = document.getElementsByTagName("form")[0];
19
  const storedToken = window.localStorage.getItem("hf_token");
20
  if (storedToken) {
21
  tokenEl.value = storedToken;
index.html CHANGED
@@ -4,10 +4,12 @@
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
  <script src="https://cdn.tailwindcss.com"></script>
 
 
7
  <script type="importmap">
8
  {
9
  "imports": {
10
- "@huggingface/hub": "https://cdn.skypack.dev/@huggingface/hub@0.2.1"
11
  }
12
  }
13
  </script>
 
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
  <script src="https://cdn.tailwindcss.com"></script>
7
+ <!-- polyfill for firefox + import maps -->
8
+ <script src="https://unpkg.com/es-module-shims@1.7.0/dist/es-module-shims.js"></script>
9
  <script type="importmap">
10
  {
11
  "imports": {
12
+ "@huggingface/hub": "https://cdn.skypack.dev/@huggingface/hub@0.2.2"
13
  }
14
  }
15
  </script>