close #28 i think
This commit is contained in:
parent
82e4d36b14
commit
c35d27198c
20
main.js
20
main.js
@ -20,6 +20,7 @@ function toggleIME() {
|
|||||||
|
|
||||||
function animateHeader(inout = false) {
|
function animateHeader(inout = false) {
|
||||||
//todo: debounce this
|
//todo: debounce this
|
||||||
|
// const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)"); //do shit
|
||||||
if (inout) {
|
if (inout) {
|
||||||
header.classList.add("header-animation-reverse");
|
header.classList.add("header-animation-reverse");
|
||||||
header.classList.remove("header-animation");
|
header.classList.remove("header-animation");
|
||||||
@ -242,6 +243,13 @@ function loadDictionary() {
|
|||||||
|
|
||||||
//ok, we're all ready!
|
//ok, we're all ready!
|
||||||
document.querySelector("header input").placeholder = "search";
|
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 {
|
} else {
|
||||||
alert("yeah something went horribly wrong loading the wordlist so uh,,, certified ike moment");
|
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");
|
let header = document.createElement("div");
|
||||||
header.classList.add("results-header");
|
header.classList.add("results-header");
|
||||||
//When using search methods, accomodate search text.
|
//When using search methods, accomodate search text.
|
||||||
|
//we dont wanna actually change val, because this breaks searchParams
|
||||||
switch (type) {
|
switch (type) {
|
||||||
//show:all
|
//show:all
|
||||||
case "all":
|
case "all":
|
||||||
val = "Showing all words";
|
header.innerHTML += "<span class='heonian'>showing all words</span><br>";
|
||||||
break;
|
break;
|
||||||
case "random":
|
case "random":
|
||||||
val = "Showing random word: " + results[0];
|
//think about whether we wanna set searchparams to this, though..?
|
||||||
|
header.innerHTML += "<span class='heonian'>showing random word: " + results[0] + "</span><br>";
|
||||||
break;
|
break;
|
||||||
//OMG A WORD
|
//OMG A WORD
|
||||||
default:
|
default:
|
||||||
val = "search results for: " + val;
|
header.innerHTML += "<span class='heonian'>search results for: " + val + "</span><br>";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
header.innerHTML += "<span class='heonian'>" + val + "</span><br>";
|
|
||||||
for (let i in types) {
|
for (let i in types) {
|
||||||
if (i !== "") { header.innerHTML += "<span class='results-header-count'>" + i + "s - " + types[i] + "</span>"; }
|
if (i !== "") { header.innerHTML += "<span class='results-header-count'>" + i + "s - " + types[i] + "</span>"; }
|
||||||
}
|
}
|
||||||
@ -566,8 +575,7 @@ window.onload = () => {
|
|||||||
doSearch(false);
|
doSearch(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerSW();
|
registerSW(); //considering disabling this for now,.... itso nly lead to trouble :////
|
||||||
//also check if ?s is there . for hecks sake (todo) (TODO!!!!!!)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortObject = obj => Object.keys(obj).sort().reduce((res, key) => (res[key] = obj[key], res), {})
|
const sortObject = obj => Object.keys(obj).sort().reduce((res, key) => (res[key] = obj[key], res), {})
|
Loading…
Reference in New Issue
Block a user