From d59cfb1fa20b826688871438c00cbd8827bc1218 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Fri, 20 Jan 2023 17:53:05 +0400 Subject: [PATCH] Hiding the userlang query parameter Now that we have proper UI for user language selection, we don't need the `?userlang=` query parameter present in the URL. If `?userlang=` is explicitly provided in the URL, it sets the requested language and disappears. --- static/skin/viewer.js | 4 ++++ test/server.cpp | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/static/skin/viewer.js b/static/skin/viewer.js index 1181f99d5..b4fe88a9f 100644 --- a/static/skin/viewer.js +++ b/static/skin/viewer.js @@ -468,6 +468,10 @@ function setupViewer() { const lang = getUserLanguage(); setUserLanguage(lang, finishViewerSetupOnceTranslationsAreLoaded); viewerState.uiLanguage = lang; + const q = new URLSearchParams(window.location.search); + q.delete('userlang'); + const rewrittenURL = makeURL(q.toString(), location.hash); + history.replaceState(viewerState, null, rewrittenURL); kiwixToolBarWrapper.style.display = 'block'; if ( ! viewerSettings.libraryButtonEnabled ) { diff --git a/test/server.cpp b/test/server.cpp index 8f2af7d22..00160d2ad 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -73,7 +73,7 @@ const ResourceCollection resources200Compressible{ { DYNAMIC_CONTENT, "/ROOT/skin/taskbar.css" }, { STATIC_CONTENT, "/ROOT/skin/taskbar.css?cacheid=2cbac34b" }, { DYNAMIC_CONTENT, "/ROOT/skin/viewer.js" }, - { STATIC_CONTENT, "/ROOT/skin/viewer.js?cacheid=4f0e70d6" }, + { STATIC_CONTENT, "/ROOT/skin/viewer.js?cacheid=b3c754ec" }, { DYNAMIC_CONTENT, "/ROOT/skin/fonts/Poppins.ttf" }, { STATIC_CONTENT, "/ROOT/skin/fonts/Poppins.ttf?cacheid=af705837" }, { DYNAMIC_CONTENT, "/ROOT/skin/fonts/Roboto.ttf" }, @@ -302,7 +302,7 @@ R"EXPECTEDRESULT( - + const blankPageUrl = root + "/skin/blank.html?cacheid=6b1fa032";