top 5 worst search features of all time. number 5
This commit is contained in:
parent
686b844233
commit
624293168f
19
index.html
19
index.html
@ -19,25 +19,6 @@
|
|||||||
click search box or show all words, screen animates search box and. title and all that to top of screen
|
click search box or show all words, screen animates search box and. title and all that to top of screen
|
||||||
and. results appear n stuff,
|
and. results appear n stuff,
|
||||||
Vewy Cool Fancy Totally Not Waste Of Resources
|
Vewy Cool Fancy Totally Not Waste Of Resources
|
||||||
|
|
||||||
RUBY TAGS HOLY SHIT
|
|
||||||
um,
|
|
||||||
results layout would kinda look like,,,
|
|
||||||
|
|
||||||
[words - 420 found / expressions - 69 found / wahtever else - ygettheidea] (click one to filter to just those)
|
|
||||||
|
|
||||||
word {
|
|
||||||
word [word in latin, in ruby]
|
|
||||||
[tags like. common word, slang, formal???, type, etc]
|
|
||||||
[maybe formal and non-formal versions of word could be shown]
|
|
||||||
[show inflections button (steal from jisho)]
|
|
||||||
[play audio clip would also be cool....]
|
|
||||||
|
|
||||||
short english translation, followed by . long description/explanation of word
|
|
||||||
maybe an example? usage?
|
|
||||||
and. source/who made it/etc
|
|
||||||
repeat for all meanings of word,
|
|
||||||
}
|
|
||||||
-->
|
-->
|
||||||
<header class="fullscreen">
|
<header class="fullscreen">
|
||||||
<span class="heonian"></span>
|
<span class="heonian"></span>
|
||||||
|
9
main.css
9
main.css
@ -146,4 +146,11 @@ main {
|
|||||||
|
|
||||||
.main-animation-reverse {
|
.main-animation-reverse {
|
||||||
animation: not-cheating 0.5s ease-in-out reverse;
|
animation: not-cheating 0.5s ease-in-out reverse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.result-header {
|
||||||
|
font-family: var(--font-h);
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* todo. organize this file better. this is a fucking mess */
|
69
main.js
69
main.js
@ -15,22 +15,22 @@ function animateHeader(inout = false) {
|
|||||||
header.classList.add("fullscreen");
|
header.classList.add("fullscreen");
|
||||||
main.style.opacity = "0";
|
main.style.opacity = "0";
|
||||||
main.classList.remove("main-animation-reverse");
|
main.classList.remove("main-animation-reverse");
|
||||||
},500);
|
}, 500);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
header.classList.remove("header-animation-reverse");
|
header.classList.remove("header-animation-reverse");
|
||||||
},1000);
|
}, 1000);
|
||||||
} else {
|
} else {
|
||||||
header.classList.add("header-animation");
|
header.classList.add("header-animation");
|
||||||
header.classList.remove("header-animation-reverse");
|
header.classList.remove("header-animation-reverse");
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
header.classList.remove("fullscreen");
|
header.classList.remove("fullscreen");
|
||||||
main.classList.add("main-animation");
|
main.classList.add("main-animation");
|
||||||
},500);
|
}, 500);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
header.classList.remove("header-animation");
|
header.classList.remove("header-animation");
|
||||||
main.style.opacity = "1";
|
main.style.opacity = "1";
|
||||||
main.classList.remove("main-animation");
|
main.classList.remove("main-animation");
|
||||||
},1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
//somewhere here we animate in the actual page too, but it.. doesnt exist yet
|
//somewhere here we animate in the actual page too, but it.. doesnt exist yet
|
||||||
}
|
}
|
||||||
@ -53,7 +53,9 @@ document.addEventListener("keydown", (e) => {
|
|||||||
if (header.querySelector("input").matches(":focus")) {
|
if (header.querySelector("input").matches(":focus")) {
|
||||||
//search
|
//search
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
animateHeader(); //just in case
|
if (header.classList.contains("fullscreen")) {
|
||||||
|
animateHeader();
|
||||||
|
}
|
||||||
doSearch();
|
doSearch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,7 +123,7 @@ function heonianToRoman(text) {
|
|||||||
if (h[1] == 0 && h[2] == 0) {
|
if (h[1] == 0 && h[2] == 0) {
|
||||||
roman += heonianVowelsSeparate[h[3]];
|
roman += heonianVowelsSeparate[h[3]];
|
||||||
} else {
|
} else {
|
||||||
roman += heonianConsonants[h[1]+""+h[2]]+heonianVowels[h[3]-1];
|
roman += heonianConsonants[h[1] + "" + h[2]] + heonianVowels[h[3] - 1];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
roman += text.charAt(i);
|
roman += text.charAt(i);
|
||||||
@ -144,21 +146,26 @@ function loadDictionary() {
|
|||||||
//create array
|
//create array
|
||||||
searchDictionary[keys[i]] = [];
|
searchDictionary[keys[i]] = [];
|
||||||
|
|
||||||
//add: base word (obvious, will always exist)
|
//add: word
|
||||||
searchDictionary[keys[i]].push(stripWord(keys[i]));
|
searchDictionary[keys[i]].push(keys[i]);
|
||||||
//add: base word, but in heonian (todo, needs translator)
|
|
||||||
|
|
||||||
//add: translation (will always exist, i hope)
|
//add: romanized word
|
||||||
searchDictionary[keys[i]].push(stripWord(values[i].translation));
|
searchDictionary[keys[i]].push(heonianToRoman(keys[i]));
|
||||||
|
|
||||||
|
//add: translations, meanings
|
||||||
|
for (let o = 0; o < values[i].length; o++) {
|
||||||
|
searchDictionary[keys[i]].push(values[i][o]["meaning"]);
|
||||||
|
searchDictionary[keys[i]].push(values[i][o]["translation"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//ok, we're all ready!
|
//ok, we're all ready!
|
||||||
document.querySelector("header input").placeholder = "search";
|
document.querySelector("header input").placeholder = "search";
|
||||||
});
|
});
|
||||||
} 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");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,6 +176,7 @@ function search(word) {
|
|||||||
for (let value in searchDictionary[key]) {
|
for (let value in searchDictionary[key]) {
|
||||||
if (searchDictionary[key][value].includes(word)) {
|
if (searchDictionary[key][value].includes(word)) {
|
||||||
result.push(key);
|
result.push(key);
|
||||||
|
break; //????
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,7 +188,40 @@ function doSearch() {
|
|||||||
if (results.length == 0) {
|
if (results.length == 0) {
|
||||||
main.innerHTML = "no results lulw";
|
main.innerHTML = "no results lulw";
|
||||||
} else {
|
} else {
|
||||||
//actually render results or w/e
|
main.innerHTML = "";
|
||||||
|
/*
|
||||||
|
[words - 420 found / expressions - 69 found / wahtever else - ygettheidea] (click one to filter to just those)
|
||||||
|
*/
|
||||||
|
for (let i = 0; i < results.length; i++) {
|
||||||
|
let div = document.createElement("div");
|
||||||
|
|
||||||
|
// 1. add word in heo + romanized ruby as header
|
||||||
|
let header = document.createElement("ruby");
|
||||||
|
header.classList.add("result-header");
|
||||||
|
header.innerHTML = results[i] + " <rt>" + heonianToRoman(results[i]) + "</rt>";
|
||||||
|
|
||||||
|
// 2. add tags [tags like. common word, slang, formal???, type, etc]
|
||||||
|
|
||||||
|
// 3. formal/nonformal versions, inflections button
|
||||||
|
|
||||||
|
// 4. audio clip if found
|
||||||
|
|
||||||
|
// 5. render all meanings of word
|
||||||
|
/*
|
||||||
|
short english translation, followed by . long description/explanation of word
|
||||||
|
maybe an example? usage?
|
||||||
|
and. source/who made it/etc
|
||||||
|
repeat for all meanings of word,
|
||||||
|
*/
|
||||||
|
div.appendChild(header);
|
||||||
|
for (let o = 0; o < json[results[i]].length; o++) {
|
||||||
|
let div2 = document.createElement("div");
|
||||||
|
div2.classList.add("result-meaning");
|
||||||
|
div2.innerHTML = json[results[i]][o]["meaning"];
|
||||||
|
div.appendChild(div2); //y, yeah.
|
||||||
|
}
|
||||||
|
main.appendChild(div);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,5 +17,16 @@
|
|||||||
"im safe with ari": ":3"
|
"im safe with ari": ":3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"": [
|
||||||
|
{
|
||||||
|
"type": "verb",
|
||||||
|
"meaning": "to like",
|
||||||
|
"translation": "snAAAAow",
|
||||||
|
"notes": "ari is cute",
|
||||||
|
"examples": {
|
||||||
|
" ": "i hope ari can see snAAAAow"
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user