diff --git a/main.js b/main.js
index e3bf134..bde6f47 100644
--- a/main.js
+++ b/main.js
@@ -20,6 +20,7 @@ function toggleIME() {
function animateHeader(inout = false) {
//todo: debounce this
+ // const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)"); //do shit
if (inout) {
header.classList.add("header-animation-reverse");
header.classList.remove("header-animation");
@@ -242,6 +243,13 @@ function loadDictionary() {
//ok, we're all ready!
document.querySelector("header input").placeholder = "search";
+ const url = new URL(window.location);
+ const val = url.searchParams.get('s');
+ if (val != null) {
+ header.querySelector("input").value = val;
+ doSearch(false);
+ animateHeader(false);
+ }
});
} else {
alert("yeah something went horribly wrong loading the wordlist so uh,,, certified ike moment");
@@ -448,20 +456,21 @@ function doSearch(state = true) {
let header = document.createElement("div");
header.classList.add("results-header");
//When using search methods, accomodate search text.
+ //we dont wanna actually change val, because this breaks searchParams
switch (type) {
//show:all
case "all":
- val = "Showing all words";
+ header.innerHTML += "showing all words
";
break;
case "random":
- val = "Showing random word: " + results[0];
+ //think about whether we wanna set searchparams to this, though..?
+ header.innerHTML += "showing random word: " + results[0] + "
";
break;
//OMG A WORD
default:
- val = "search results for: " + val;
+ header.innerHTML += "search results for: " + val + "
";
break;
}
- header.innerHTML += "" + val + "
";
for (let i in types) {
if (i !== "") { header.innerHTML += ""; }
}
@@ -566,8 +575,7 @@ window.onload = () => {
doSearch(false);
}
});
- registerSW();
- //also check if ?s is there . for hecks sake (todo) (TODO!!!!!!)
+ registerSW(); //considering disabling this for now,.... itso nly lead to trouble :////
}
const sortObject = obj => Object.keys(obj).sort().reduce((res, key) => (res[key] = obj[key], res), {})
\ No newline at end of file
diff --git a/sw.js b/sw.js
index 2fb56c4..475e5f3 100644
--- a/sw.js
+++ b/sw.js
@@ -1,4 +1,4 @@
-const currentVersion = '20945';
+const currentVersion = '24678';
const addResourcesToCache = async (resources) => {
const cache = await caches.open(currentVersion);