Deploying to gh-pages from @ DGP-Studio/Snap.Hutao.Docs@66b2230b7f 🚀

This commit is contained in:
Masterain98
2023-03-20 08:16:16 +00:00
parent b9831dead9
commit b2aefb979f
114 changed files with 530 additions and 354 deletions

68
markmap.html Normal file
View File

@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="robots" content="noindex">
<title>Redirecting...</title>
<script>
const { hash, origin, pathname } = window.location;
const { languages } = window.navigator;
const anchor = hash.substr(1);
const localeConfig = {"/en/":["en-US","en-UK","en"],"/":["zh-CN","zh-TW","zh"]};
const availableLocales = ["/en/"];
const defaultLocale = availableLocales.pop();
const defaultBehavior = "defaultLocale"
let localePath = null;
// get matched locale
findLanguage:
for (const lang of languages)
for (const [path, langs] of Object.entries(localeConfig))
if (langs.includes(lang)) {
if (!availableLocales.includes(path))
continue;
localePath = path;
break findLanguage;
}
// default link
const defaultLink = defaultLocale? `${origin}${defaultLocale}${pathname.substring(1)}${anchor?`#${anchor}`:""}`: null;
// a locale matches
if (localePath) {
const localeLink = `${origin}${localePath}${pathname.substring(1)}${anchor?`#${anchor}`:""}`;
if (availableLocales.includes(localePath)) {
location.href = localeLink;
}
// the page does not exist
else {
// locale homepage
if (defaultBehavior === "homepage") {
location.href = `${origin}${localePath}`;
}
// default locale page
else if (defaultBehavior === "defaultLocale" && defaultLink) {
location.href = defaultLink;
}
// as is to get a 404 page of that locale
else {
location.href = localeLink;
}
}
}
// we have a default page
else if (defaultLink) {
location.href = defaultLink;
}
else {
location.href = `${origin}/404.html`;
}
</script>
</head>
<body>
<p>Redirecting...</p>
</body>
</html>