📝 添加英文文档框架
This commit is contained in:
@ -20,7 +20,6 @@ export default defineUserConfig({
|
||||
head: [
|
||||
// 设置 favor.ico,.vuepress/public 下
|
||||
["script", {src: "/js/style.js", "type": "module"}],
|
||||
["script", {src: "/js/get_data.js", "type": "module"}],
|
||||
['link', {rel: 'icon', href: 'https://cdn.liteyuki.icu/favicon.ico'},],
|
||||
|
||||
['link', {rel: 'stylesheet', href: 'https://cdn.bootcdn.net/ajax/libs/firacode/6.2.0/fira_code.min.css'}],
|
||||
|
@ -21,5 +21,5 @@ export default navbar([
|
||||
text: "开发及贡献",
|
||||
link: "/dev/",
|
||||
prefix: "dev/",
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
25
docs/.vuepress/navbar/en.ts
Normal file
25
docs/.vuepress/navbar/en.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import {navbar} from "vuepress-theme-hope";
|
||||
|
||||
export const enNavbarConfig = navbar([
|
||||
"/en/",
|
||||
{
|
||||
text: "Deploy",
|
||||
link: "/en/deploy/",
|
||||
prefix: "deploy/",
|
||||
},
|
||||
{
|
||||
text: "Usage",
|
||||
link: "/en/usage/",
|
||||
prefix: "usage/",
|
||||
},
|
||||
{
|
||||
text: "Extensions",
|
||||
link: "/en/store/",
|
||||
prefix: "store/",
|
||||
},
|
||||
{
|
||||
text: "Contribute",
|
||||
link: "/en/dev/",
|
||||
prefix: "dev/",
|
||||
},
|
||||
]);
|
2
docs/.vuepress/navbar/index.ts
Normal file
2
docs/.vuepress/navbar/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from "./zh.js"
|
||||
export * from "./en.js"
|
26
docs/.vuepress/navbar/zh.ts
Normal file
26
docs/.vuepress/navbar/zh.ts
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
import {navbar} from "vuepress-theme-hope";
|
||||
|
||||
export const zhNavbarConfig = navbar([
|
||||
"/",
|
||||
{
|
||||
text: "安装及部署",
|
||||
link: "/deploy/",
|
||||
prefix: "deploy/",
|
||||
},
|
||||
{
|
||||
text: "使用及功能",
|
||||
link: "/usage/",
|
||||
prefix: "usage/",
|
||||
},
|
||||
{
|
||||
text: "资源及插件",
|
||||
link: "/store/",
|
||||
prefix: "store/",
|
||||
},
|
||||
{
|
||||
text: "开发及贡献",
|
||||
link: "/dev/",
|
||||
prefix: "dev/",
|
||||
},
|
||||
]);
|
@ -1,39 +0,0 @@
|
||||
// 定义全局变量来存储数据
|
||||
let globalTotal = 0;
|
||||
let globalOnline = 0;
|
||||
|
||||
// 从API获取数据并更新全局变量
|
||||
function fetchAndUpdateData() {
|
||||
Promise.all([
|
||||
fetch("https://api.liteyuki.icu/count").then(res => res.json()),
|
||||
fetch("https://api.liteyuki.icu/online").then(res => res.json())
|
||||
])
|
||||
.then(([countRes, onlineRes]) => {
|
||||
globalTotal = countRes.register;
|
||||
globalOnline = onlineRes.online;
|
||||
})
|
||||
.catch(err => {
|
||||
console.error("Error fetching data:", err);
|
||||
});
|
||||
}
|
||||
|
||||
// 更新页面显示,使用全局变量中的数据
|
||||
function updatePageDisplay() {
|
||||
let countInfo = document.getElementById("count-info");
|
||||
if (!countInfo) {
|
||||
let info = `<div id="count-info" style="text-align: center; font-size: 20px; font-weight: 500">
|
||||
全球实例:<span id="total">${globalTotal}</span> 当前在线:<span id="online">${globalOnline}</span></div>`;
|
||||
let mainDescription = document.querySelector("#main-description");
|
||||
if (mainDescription) {
|
||||
mainDescription.insertAdjacentHTML('afterend', info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 初始调用更新数据
|
||||
fetchAndUpdateData();
|
||||
updatePageDisplay();
|
||||
|
||||
// 设置定时器,分别以不同频率调用更新数据和更新页面的函数
|
||||
setInterval(fetchAndUpdateData, 10000); // 每10秒更新一次数据
|
||||
setInterval(updatePageDisplay, 1000); // 每1秒更新一次页面显示
|
0
docs/.vuepress/public/js/get_data_cn.js
Normal file
0
docs/.vuepress/public/js/get_data_cn.js
Normal file
0
docs/.vuepress/public/js/get_data_en.js
Normal file
0
docs/.vuepress/public/js/get_data_en.js
Normal file
31
docs/.vuepress/sidebar/en.ts
Normal file
31
docs/.vuepress/sidebar/en.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import {sidebar} from "vuepress-theme-hope";
|
||||
|
||||
export const enSidebarConfig = sidebar({
|
||||
"/en/": [
|
||||
"",
|
||||
{
|
||||
text: "Install & Deploy",
|
||||
icon: "laptop-code",
|
||||
prefix: "deploy/",
|
||||
children: "structure",
|
||||
},
|
||||
{
|
||||
text: "Usage & Features",
|
||||
icon: "book",
|
||||
prefix: "usage/",
|
||||
children: "structure",
|
||||
},
|
||||
{
|
||||
text: "Resources & Plugins",
|
||||
icon: "store",
|
||||
prefix: "store/",
|
||||
children: "structure",
|
||||
},
|
||||
{
|
||||
text: "Development & Contribution",
|
||||
icon: "pen-nib",
|
||||
prefix: "dev/",
|
||||
children: "structure",
|
||||
}
|
||||
],
|
||||
});
|
2
docs/.vuepress/sidebar/index.ts
Normal file
2
docs/.vuepress/sidebar/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from "./zh.js"
|
||||
export * from "./en.js"
|
@ -1,12 +1,12 @@
|
||||
import {sidebar} from "vuepress-theme-hope";
|
||||
|
||||
export default sidebar({
|
||||
export const zhSidebarConfig = sidebar({
|
||||
"/": [
|
||||
"",
|
||||
{
|
||||
text: "安装及部署",
|
||||
icon: "laptop-code",
|
||||
prefix: "deployment/",
|
||||
prefix: "deploy/",
|
||||
children: "structure",
|
||||
},
|
||||
{
|
@ -1,14 +1,30 @@
|
||||
import {hopeTheme} from "vuepress-theme-hope";
|
||||
import navbar from "./navbar.js";
|
||||
import sidebar from "./sidebar.js";
|
||||
import {enSidebarConfig, zhSidebarConfig} from "./sidebar/index.js";
|
||||
import {enNavbarConfig, zhNavbarConfig} from "./navbar/index.js";
|
||||
|
||||
export default hopeTheme({
|
||||
|
||||
hostname: "https://vuepress-theme-hope-docs-demo.netlify.app",
|
||||
|
||||
author: {
|
||||
name: "远野千束",
|
||||
url: "https://sfkm.me",
|
||||
locales: {
|
||||
"/": {
|
||||
navbar: zhNavbarConfig,
|
||||
sidebar: zhSidebarConfig,
|
||||
author: {
|
||||
name: "远野千束",
|
||||
url: "https://sfkm.me",
|
||||
}
|
||||
},
|
||||
"/en/": {
|
||||
navbar: enNavbarConfig,
|
||||
sidebar: enSidebarConfig,
|
||||
author: {
|
||||
name: "SnowyKami",
|
||||
url: "https://sfkm.me",
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
iconAssets: "fontawesome-with-brands",
|
||||
@ -19,12 +35,6 @@ export default hopeTheme({
|
||||
|
||||
docsDir: "docs",
|
||||
|
||||
// 导航栏
|
||||
navbar,
|
||||
|
||||
// 侧边栏
|
||||
sidebar,
|
||||
|
||||
// 页脚
|
||||
footer: "LiteyukiBot",
|
||||
displayFooter: true,
|
Reference in New Issue
Block a user