Skip to content

Commit

Permalink
新增功能:适配并翻译www.githubstatus.com`
Browse files Browse the repository at this point in the history
  • Loading branch information
maboloshi committed Jun 8, 2024
1 parent d50798b commit 8cfcfb6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions locals.js
Original file line number Diff line number Diff line change
Expand Up @@ -19041,3 +19041,10 @@ I18N.zh["features"] = {
],
};

I18N.zh["status"] = {
"static": {
"All Systems Operational": "所有系统运行正常",
},
"regexp": [
],
};
9 changes: 8 additions & 1 deletion main.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// @license GPL-3.0
// @match https://github.com/*
// @match https://gist.github.com/*
// @match https://www.githubstatus.com/*
// @require https://raw.githubusercontent.com/maboloshi/github-chinese/gh-pages/locals.js?v1.9.0
// @run-at document-end
// @grant GM_xmlhttpRequest
Expand Down Expand Up @@ -180,7 +181,11 @@
function getPage() {

// 站点,如 gist, developer, help 等,默认主站是 github
const site = location.hostname === "gist.github.com" ? "gist" : "github"; // 站点
const siteMapping = {
'gist.github.com': 'gist',
'www.githubstatus.com': 'status'
};
const site = siteMapping[location.hostname] || 'github'; // 站点
const pathname = location.pathname; // 当前路径

// 是否登录
Expand Down Expand Up @@ -208,6 +213,8 @@
}
} else if (site === 'gist') { // Gist 站点
page = 'gist';
} else if (site === 'status') { // GitHub Status 页面
page = 'status';
} else if (pathname === '/' && site === 'github') { // github.com 首页
page = isLogin ? 'page-dashboard' : 'homepage';
} else if (isRepository) { // 仓库页
Expand Down

0 comments on commit 8cfcfb6

Please sign in to comment.