Skip to content

Commit

Permalink
Improve page load and add noscript tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Jcparkyn committed Dec 10, 2023
1 parent 6685c2b commit 0ff9ee3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
<meta name="og:url" content="https://jcparkyn.github.io/scrobburl" />
</head>
<body>
<div id="myapp">Fetching dictionary...</div>
<div id="myapp"></div>
<noscript>Sorry, but this page requires Javascript to run.</noscript>
<script>
"use strict";
const cellSizePx = 55;
const gridSize = 14;
const gapPx = 4;
Expand Down Expand Up @@ -71,7 +73,7 @@
e.stopPropagation();
}
}
}, { capture: true});
}, { capture: true });
}
});

Expand All @@ -86,7 +88,15 @@
}

const start = async () => {
const wordlist = await fetchWordlist();
document.getElementById("myapp").innerHTML = "Loading dictionary...";
let wordlist;
try {
wordlist = await fetchWordlist();
document.getElementById("myapp").innerHTML = "Loading app...";
} catch (e) {
document.getElementById("myapp").innerHTML = "Failed to load dictionary";
return;
}

// This seed isn't perfect, but it doesn't matter too much
const initialSeed = Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
Expand Down

0 comments on commit 0ff9ee3

Please sign in to comment.