From d996a8a46787a4522bc3f354bd10f7b4497d6441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:56:56 +0800 Subject: [PATCH] doc --- docs/main.js | 28 +++++++++++++++++++--------- docs/redirect.html | 1 - 2 files changed, 19 insertions(+), 10 deletions(-) delete mode 100644 docs/redirect.html diff --git a/docs/main.js b/docs/main.js index 594bf89a..5edc84b2 100644 --- a/docs/main.js +++ b/docs/main.js @@ -1,6 +1,6 @@ window.$docsify = { - homepage: '/redirect.html', + // homepage: '/redirect.html', requestHeaders: { 'cache-control': 'max-age=0', }, @@ -79,18 +79,28 @@ const navitexts = { contactme: 'Chat Groups' } } +function getcurrlang(url) { + for (let key in navitexts) { + if (url.includes(`/${key}/`)) { + return key + } + } + return '' +} window.onpopstate = function (event) { let url = window.location.href; - let thislang = currentlang - if (url.includes('/zh/')) { - thislang = 'zh' + console.log(url) + if (url.endsWith('/#/')) { + window.location.href += 'zh/' + return } - else if (url.includes('/en/')) { - thislang = 'en' - } - else if (url.includes('/ru/')) { - thislang = 'ru' + for (let key in navitexts) { + if (url.endsWith(`/${key}/`)) { + window.location.href += 'README' + return + } } + let thislang = getcurrlang(url) if (thislang != currentlang) { currentlang = thislang console.log(navitexts[currentlang]) diff --git a/docs/redirect.html b/docs/redirect.html deleted file mode 100644 index 00222f9e..00000000 --- a/docs/redirect.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file