mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Fixed broken ZIM viewer under SeaMonkey
SeaMonkey doesn't yet support ['import.meta'][1]. This change requires that a function `setPermanentGlobalCookie(name, value)` is defined before `setUserLanguage()` (exported by i18n.js) can be called. [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta
This commit is contained in:
committed by
Matthieu Gautier
parent
2781da3221
commit
3a40b6b6d7
@ -92,8 +92,7 @@ function getUserLanguage() {
|
||||
}
|
||||
|
||||
function setUserLanguage(lang, callback) {
|
||||
const rootPath = new URL('..', import.meta.url).pathname.replace(/\/$/, '');
|
||||
document.cookie = `userlang=${lang};path=${rootPath};max-age=31536000`;
|
||||
setPermanentGlobalCookie('userlang', lang);
|
||||
Translations.load(lang);
|
||||
Translations.whenReady(callback);
|
||||
}
|
||||
|
@ -512,3 +512,7 @@ function finishViewerSetupOnceTranslationsAreLoaded()
|
||||
|
||||
viewerSetupComplete = true;
|
||||
}
|
||||
|
||||
function setPermanentGlobalCookie(name, value) {
|
||||
document.cookie = `${name}=${value};path=${root};max-age=31536000`;
|
||||
}
|
||||
|
Reference in New Issue
Block a user