Merge pull request #887 from kiwix/seamonkey

This commit is contained in:
Matthieu Gautier 2023-02-08 15:41:59 +01:00 committed by GitHub
commit a74aaa5b13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 12 deletions

View File

@ -92,8 +92,7 @@ function getUserLanguage() {
} }
function setUserLanguage(lang, callback) { function setUserLanguage(lang, callback) {
const rootPath = new URL('..', import.meta.url).pathname.replace(/\/$/, ''); setPermanentGlobalCookie('userlang', lang);
document.cookie = `userlang=${lang};path=${rootPath};max-age=31536000`;
Translations.load(lang); Translations.load(lang);
Translations.whenReady(callback); Translations.whenReady(callback);
} }

View File

@ -44,8 +44,8 @@
margin: 0 auto; margin: 0 auto;
} }
#ui_language { .kiwix #ui_language {
float: left float: left;
} }
#kiwix_button_show_toggle { #kiwix_button_show_toggle {
@ -84,6 +84,7 @@ label[for="kiwix_button_show_toggle"],
float: right; float: right;
} }
.kiwix #ui_language,
.kiwix #kiwixtoolbar button, .kiwix #kiwixtoolbar button,
.kiwix #kiwixtoolbar input[type="submit"] { .kiwix #kiwixtoolbar input[type="submit"] {
box-sizing: border-box !important; box-sizing: border-box !important;

View File

@ -198,7 +198,10 @@ function updateToolbarVisibilityState() {
} }
function handle_visual_viewport_change() { function handle_visual_viewport_change() {
contentIframe.height = window.visualViewport.height - contentIframe.offsetTop - 4; const wh = window.visualViewport
? window.visualViewport.height
: window.innerHeight;
contentIframe.height = wh - contentIframe.offsetTop - 4;
} }
function handle_location_hash_change() { function handle_location_hash_change() {
@ -512,3 +515,7 @@ function finishViewerSetupOnceTranslationsAreLoaded()
viewerSetupComplete = true; viewerSetupComplete = true;
} }
function setPermanentGlobalCookie(name, value) {
document.cookie = `${name}=${value};path=${root};max-age=31536000`;
}

View File

@ -29,7 +29,7 @@
<body style="margin:0" onload="setupViewer()"> <body style="margin:0" onload="setupViewer()">
<div class="kiwix" style="display:none" id="kiwixtoolbarwrapper"> <div class="kiwix" style="display:none" id="kiwixtoolbarwrapper">
<div id="kiwixtoolbar" class="ui-widget-header"> <div id="kiwixtoolbar" class="ui-widget-header">
<select id="ui_language" onchange="changeUILanguage()"> <select id="ui_language" class="kiwix" onchange="changeUILanguage()">
</select> </select>
<div class="kiwix_centered"> <div class="kiwix_centered">
<div class="kiwix_searchform"> <div class="kiwix_searchform">

View File

@ -59,7 +59,7 @@ const ResourceCollection resources200Compressible{
{ DYNAMIC_CONTENT, "/ROOT/skin/favicon/favicon.ico" }, { DYNAMIC_CONTENT, "/ROOT/skin/favicon/favicon.ico" },
{ STATIC_CONTENT, "/ROOT/skin/favicon/favicon.ico?cacheid=fba03a27" }, { STATIC_CONTENT, "/ROOT/skin/favicon/favicon.ico?cacheid=fba03a27" },
{ DYNAMIC_CONTENT, "/ROOT/skin/i18n.js" }, { DYNAMIC_CONTENT, "/ROOT/skin/i18n.js" },
{ STATIC_CONTENT, "/ROOT/skin/i18n.js?cacheid=dcf3d584" }, { STATIC_CONTENT, "/ROOT/skin/i18n.js?cacheid=6da2bca0" },
{ DYNAMIC_CONTENT, "/ROOT/skin/index.css" }, { DYNAMIC_CONTENT, "/ROOT/skin/index.css" },
{ STATIC_CONTENT, "/ROOT/skin/index.css?cacheid=0f9ba34e" }, { STATIC_CONTENT, "/ROOT/skin/index.css?cacheid=0f9ba34e" },
{ DYNAMIC_CONTENT, "/ROOT/skin/index.js" }, { DYNAMIC_CONTENT, "/ROOT/skin/index.js" },
@ -71,9 +71,9 @@ const ResourceCollection resources200Compressible{
{ DYNAMIC_CONTENT, "/ROOT/skin/mustache.min.js" }, { DYNAMIC_CONTENT, "/ROOT/skin/mustache.min.js" },
{ STATIC_CONTENT, "/ROOT/skin/mustache.min.js?cacheid=bd23c4fb" }, { STATIC_CONTENT, "/ROOT/skin/mustache.min.js?cacheid=bd23c4fb" },
{ DYNAMIC_CONTENT, "/ROOT/skin/taskbar.css" }, { DYNAMIC_CONTENT, "/ROOT/skin/taskbar.css" },
{ STATIC_CONTENT, "/ROOT/skin/taskbar.css?cacheid=2cbac34b" }, { STATIC_CONTENT, "/ROOT/skin/taskbar.css?cacheid=eb3bec90" },
{ DYNAMIC_CONTENT, "/ROOT/skin/viewer.js" }, { DYNAMIC_CONTENT, "/ROOT/skin/viewer.js" },
{ STATIC_CONTENT, "/ROOT/skin/viewer.js?cacheid=b3c754ec" }, { STATIC_CONTENT, "/ROOT/skin/viewer.js?cacheid=03fd97ee" },
{ DYNAMIC_CONTENT, "/ROOT/skin/fonts/Poppins.ttf" }, { DYNAMIC_CONTENT, "/ROOT/skin/fonts/Poppins.ttf" },
{ STATIC_CONTENT, "/ROOT/skin/fonts/Poppins.ttf?cacheid=af705837" }, { STATIC_CONTENT, "/ROOT/skin/fonts/Poppins.ttf?cacheid=af705837" },
{ DYNAMIC_CONTENT, "/ROOT/skin/fonts/Roboto.ttf" }, { DYNAMIC_CONTENT, "/ROOT/skin/fonts/Roboto.ttf" },
@ -298,11 +298,11 @@ R"EXPECTEDRESULT( <img src="../skin/download.png?
}, },
{ {
/* url */ "/ROOT/viewer", /* url */ "/ROOT/viewer",
R"EXPECTEDRESULT( <link type="text/css" href="./skin/taskbar.css?cacheid=2cbac34b" rel="Stylesheet" /> R"EXPECTEDRESULT( <link type="text/css" href="./skin/taskbar.css?cacheid=eb3bec90" rel="Stylesheet" />
<link type="text/css" href="./skin/css/autoComplete.css?cacheid=08951e06" rel="Stylesheet" /> <link type="text/css" href="./skin/css/autoComplete.css?cacheid=08951e06" rel="Stylesheet" />
<script type="module" src="./skin/i18n.js?cacheid=dcf3d584" defer></script> <script type="module" src="./skin/i18n.js?cacheid=6da2bca0" defer></script>
<script type="text/javascript" src="./skin/languages.js?cacheid=fe100348" defer></script> <script type="text/javascript" src="./skin/languages.js?cacheid=fe100348" defer></script>
<script type="text/javascript" src="./skin/viewer.js?cacheid=b3c754ec" defer></script> <script type="text/javascript" src="./skin/viewer.js?cacheid=03fd97ee" defer></script>
<script type="text/javascript" src="./skin/autoComplete.min.js?cacheid=1191aaaf"></script> <script type="text/javascript" src="./skin/autoComplete.min.js?cacheid=1191aaaf"></script>
const blankPageUrl = root + "/skin/blank.html?cacheid=6b1fa032"; const blankPageUrl = root + "/skin/blank.html?cacheid=6b1fa032";
<label for="kiwix_button_show_toggle"><img src="./skin/caret.png?cacheid=22b942b4" alt=""></label> <label for="kiwix_button_show_toggle"><img src="./skin/caret.png?cacheid=22b942b4" alt=""></label>