diff --git a/heonian-resources b/heonian-resources
index 1222e87..08c7594 160000
--- a/heonian-resources
+++ b/heonian-resources
@@ -1 +1 @@
-Subproject commit 1222e87853bbd79540ca1d8a91602b619131644b
+Subproject commit 08c759451d133ea8009ef89a6aec7b0def82a1f5
diff --git a/main.js b/main.js
index 33ab76d..d14d049 100644
--- a/main.js
+++ b/main.js
@@ -216,6 +216,7 @@ function loadDictionary() {
//prepare search. maybe async this if we're loading a specific word?
for (let i = 0; i < keys.length; i++) {
try {
+ if (keys[i] == "") continue;
//create array
searchDictionary[keys[i]] = [];
@@ -250,13 +251,11 @@ function loadDictionary() {
}
function search(word, type) {
- console.log(type);
if (type == "all") { word = "" };
if (type == "random") {
let random = Math.floor(Math.random() * Object.keys(json).length);
return [Object.keys(json)[random]];
}
- console.log(word);
let words = word.split(" ");
for (let i = 0; i < words.length; i++) {
words[i] = stripWord(words[i]);
@@ -375,8 +374,10 @@ function doSearch(state = true) {
//number, meaning (*required)
meaning.innerHTML += "" + (o + 1) + "" + json[results[i]][o]["meaning"] + "";
//longer translation (below are not required, make sure to check for them)
- if (json[results[i]][o]["translation"] != undefined && json[results[i]][o]["translation"].toLowerCase() != json[results[i]][o]["meaning"].toLowerCase()) {
- meaning.innerHTML += "
" + json[results[i]][o]["translation"] + "";
+ if (json[results[i]][o]["translation"] != undefined) {
+ if (json[results[i]][o]["meaning"] != undefined && json[results[i]][o]["translation"].toLowerCase() != json[results[i]][o]["meaning"].toLowerCase()) {
+ meaning.innerHTML += "
" + json[results[i]][o]["translation"] + "";
+ }
}
//example
if (json[results[i]][o]["examples"] != undefined) {
@@ -478,6 +479,11 @@ function goHome(state = true) {
async function registerSW() {
if ('serviceWorker' in navigator) {
+ if (location.hostname === "localhost" || location.hostname === "127.0.0.1") {
+ console.log("localhost - not registering sw"); //because spamming removeSW() every time i make a change is annoying;
+ removeSW(); //just in case =w=
+ return;
+ }
navigator.serviceWorker.register('./sw.js').then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
@@ -491,21 +497,11 @@ async function registerSW() {
// but the previous service worker will still serve the older
// content until all client tabs are closed.
header.querySelector("#update").style.display = "block";
-
- // Execute callback
- if (config && config.onUpdate) {
- config.onUpdate(registration);
- }
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
console.log('Content is cached for offline use.');
-
- // Execute callback
- if (config && config.onSuccess) {
- config.onSuccess(registration);
- }
}
}
};
diff --git a/sw.js b/sw.js
index f9d1018..5d2b1ac 100644
--- a/sw.js
+++ b/sw.js
@@ -1,4 +1,4 @@
-const currentVersion = '12521';
+const currentVersion = '20267';
const addResourcesToCache = async (resources) => {
const cache = await caches.open(currentVersion);