Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hellpanderrr committed May 20, 2024
1 parent 8c800be commit 0d9133d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion wiktionary_pron/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ async function updateOptionsUponLanguageSelection(event) {
const selectedLanguageElement = event.target;
const selectedLanguage = selectedLanguageElement.value;
const lang = languages[selectedLanguage];
window.history.pushState({}, "", `?lang=${selectedLanguage}`);

if (!(selectedLanguage in loadedLanguages)) {
disableAll();
Expand All @@ -508,7 +509,6 @@ async function updateOptionsUponLanguageSelection(event) {
}

enableAll();
window.history.pushState({}, "", `?lang=${selectedLanguage}`);
loadedLanguages[selectedLanguage] = true;
}

Expand Down
12 changes: 10 additions & 2 deletions wiktionary_pron/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,18 @@ async function fetchWithCache(url) {

if (contentType == "application/zip") {
responseContent = await response.blob();
await localforage.setItem(url, responseContent);
try {
await localforage.setItem(url, responseContent);
} catch (err) {
console.log(err);
}
} else {
responseContent = await response.text();
await localforage.setItem(url, JSON.stringify(responseContent));
try {
await localforage.setItem(url, JSON.stringify(responseContent));
} catch (err) {
console.log(err);
}
}
responseWithHeaders = new Response(responseContent);
return responseWithHeaders;
Expand Down

0 comments on commit 0d9133d

Please sign in to comment.