summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyfraeviolae <cyfraeviolae>2024-01-18 19:36:06 -0500
committercyfraeviolae <cyfraeviolae>2024-01-18 19:36:06 -0500
commitef61e162799411535a48664948b57a2a8ff5dc21 (patch)
tree4c5ca425d73ba11e18f372900a8968d275ad260e
parent2c0de05b73ca0f48e14bd7880bbdfab327b782d6 (diff)
optimize
-rw-r--r--index.html2
-rw-r--r--static/script.js19
2 files changed, 9 insertions, 12 deletions
diff --git a/index.html b/index.html
index 781eb82..dcad106 100644
--- a/index.html
+++ b/index.html
@@ -41,6 +41,6 @@
</div>
<script src="/infinite-connections/static/corpus.js"></script>
<script src="/infinite-connections/static/script.js"></script>
- <script src="/infinite-connections/static/full_corpus.js"></script>
+ <script defer src="/infinite-connections/static/full_corpus.js"></script>
</body>
</html>
diff --git a/static/script.js b/static/script.js
index 198bd72..a4c5d09 100644
--- a/static/script.js
+++ b/static/script.js
@@ -224,17 +224,6 @@ document.getElementById('give-up').addEventListener('click', function(evt) {
giveUp();
});
-
-window.onload = function() {
- var urlParams = new URLSearchParams(window.location.search);
- var q = urlParams.get('q')
- if (q) {
- startBoard(deserializeBoard(q));
- return;
- }
- startBoard(newBoard());
-}
-
// Source: https://stackoverflow.com/a/19270021
function randomSelect(arr, n) {
var result = new Array(n),
@@ -268,3 +257,11 @@ function shuffle(array) {
return array;
}
+
+var urlParams = new URLSearchParams(window.location.search);
+var q = urlParams.get('q')
+if (q) {
+ startBoard(deserializeBoard(q));
+} else {
+ startBoard(newBoard());
+}