This commit is contained in:
恍兮惚兮 2024-07-19 00:56:56 +08:00
parent eddc025ee1
commit d996a8a467
2 changed files with 19 additions and 10 deletions

View File

@ -1,6 +1,6 @@
window.$docsify = { window.$docsify = {
homepage: '/redirect.html', // homepage: '/redirect.html',
requestHeaders: { requestHeaders: {
'cache-control': 'max-age=0', 'cache-control': 'max-age=0',
}, },
@ -79,18 +79,28 @@ const navitexts = {
contactme: 'Chat Groups' contactme: 'Chat Groups'
} }
} }
function getcurrlang(url) {
for (let key in navitexts) {
if (url.includes(`/${key}/`)) {
return key
}
}
return ''
}
window.onpopstate = function (event) { window.onpopstate = function (event) {
let url = window.location.href; let url = window.location.href;
let thislang = currentlang console.log(url)
if (url.includes('/zh/')) { if (url.endsWith('/#/')) {
thislang = 'zh' window.location.href += 'zh/'
return
} }
else if (url.includes('/en/')) { for (let key in navitexts) {
thislang = 'en' if (url.endsWith(`/${key}/`)) {
window.location.href += 'README'
return
} }
else if (url.includes('/ru/')) {
thislang = 'ru'
} }
let thislang = getcurrlang(url)
if (thislang != currentlang) { if (thislang != currentlang) {
currentlang = thislang currentlang = thislang
console.log(navitexts[currentlang]) console.log(navitexts[currentlang])

View File

@ -1 +0,0 @@
<meta http-equiv="refresh" content="0; URL=/#/zh/">