diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..e69de29b diff --git a/docs/index.html b/docs/index.html index 8c4d8097..62aab3fb 100644 --- a/docs/index.html +++ b/docs/index.html @@ -58,9 +58,9 @@ 语言/Language diff --git a/docs/main.js b/docs/main.js index 5edc84b2..62791eac 100644 --- a/docs/main.js +++ b/docs/main.js @@ -4,7 +4,7 @@ window.$docsify = { requestHeaders: { 'cache-control': 'max-age=0', }, - + notFoundPage: 'redirect.html', pagination: { previousText: '上一节', nextText: '下一节', @@ -37,11 +37,10 @@ window.$docsify = { } }, - executeScript: true + executeScript: true, + } - - let dropdowns = document.getElementsByClassName('dropdown') for (let i = 0; i < dropdowns.length; i++) { @@ -87,11 +86,14 @@ function getcurrlang(url) { } return '' } +function switchlang(lang) { + window.location.href = window.location.href.replace('/' + currentlang + '/', '/' + lang + '/') +} window.onpopstate = function (event) { let url = window.location.href; - console.log(url) if (url.endsWith('/#/')) { - window.location.href += 'zh/' + let lang = window.localStorage.currentlang ? window.localStorage.currentlang : 'zh' + window.location.href += lang + '/' return } for (let key in navitexts) { @@ -101,9 +103,9 @@ window.onpopstate = function (event) { } } let thislang = getcurrlang(url) + window.localStorage.currentlang = thislang if (thislang != currentlang) { currentlang = thislang - console.log(navitexts[currentlang]) for (let key in navitexts[currentlang]) { document.getElementById(key).innerText = navitexts[currentlang][key] diff --git a/docs/redirect.html b/docs/redirect.html new file mode 100644 index 00000000..d38aabb7 --- /dev/null +++ b/docs/redirect.html @@ -0,0 +1 @@ + \ No newline at end of file