diff --git a/main.js b/main.js
index 4ae9c2b..e3bf134 100644
--- a/main.js
+++ b/main.js
@@ -371,13 +371,15 @@ function doSearch(state = true) {
} else {
types[json[results[i]][o]["type"]]++;
}
- //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) {
- if (json[results[i]][o]["meaning"] != undefined && json[results[i]][o]["translation"].toLowerCase() != json[results[i]][o]["meaning"].toLowerCase()) {
+ //meaning, tl, etc
+ if (json[results[i]][o]["meaning"] != undefined) {
+ meaning.innerHTML += "" + (o + 1) + "" + escapeHTML(json[results[i]][o]["meaning"]) + "";
+ } else if (json[results[i]][o]["translation"] != undefined) {
+ meaning.innerHTML += "" + (o + 1) + "" + escapeHTML(json[results[i]][o]["translation"]) + "";
+ }
+ if (json[results[i]][o]["translation"] != undefined && json[results[i]][o]["meaning"] != undefined) {
+ if (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) {
@@ -428,14 +430,14 @@ function doSearch(state = true) {
}
//notes
if (json[results[i]][o]["notes"] != undefined) {
- meaning.innerHTML += "
" + json[results[i]][o]["notes"] + "
"; + meaning.innerHTML += "" + escapeHTML(json[results[i]][o]["notes"]) + "
"; } //(source, etc) if (json[results[i]][o]["canon-etymology"] != undefined) { - meaning.innerHTML += " "; + meaning.innerHTML += " "; } if (json[results[i]][o]["meta-etymology"] != undefined) { - meaning.innerHTML += " "; + meaning.innerHTML += " "; } //todo result.appendChild(meaning); //y, yeah. @@ -518,9 +520,13 @@ function removeSW() { caches.delete(name); }); //this doesnt actually seem to work :/ but . i'll leave it in for later fixing navigator.serviceWorker.getRegistrations().then(function(registrations) { - for (let registration of registrations) { + for (let registration of registrations) registration.unregister(); - }}); //dev use only!! or whatever... i just copypasted this from SO + }); //dev use only!! or whatever... i just copypasted this from SO +} + +function escapeHTML(str){ + return new Option(str).innerHTML; } window.onload = () => { diff --git a/sw.js b/sw.js index f7743f7..2fb56c4 100644 --- a/sw.js +++ b/sw.js @@ -1,4 +1,4 @@ -const currentVersion = '2909'; +const currentVersion = '20945'; const addResourcesToCache = async (resources) => { const cache = await caches.open(currentVersion);