+ 常用操作规程更名为操作规程
+ 首页功能列表增加高度以防止误触 + 添加设置页面 + 删除 L014-1 与 L414-5KR 相关物质计算页面
This commit is contained in:
62
index.html
62
index.html
@@ -7,8 +7,12 @@
|
||||
<link rel="stylesheet" href="./statics/github.css">
|
||||
<link rel="stylesheet" href="./statics/theme.css">
|
||||
<script src="./statics/modules/jquery.min.js"></script>
|
||||
<script>
|
||||
let page = 10
|
||||
<script type="module">
|
||||
import { IO } from "./statics/modules/tools.js"
|
||||
|
||||
let settings = new IO('settings')
|
||||
let num = settings.read("index.history.num")
|
||||
let page = num == null ? 10 : num
|
||||
let url = `https://api.github.com/repos/hbk01/hbk01.github.io/commits?per_page=${page}`
|
||||
|
||||
let functions = [
|
||||
@@ -33,27 +37,53 @@
|
||||
"location": "./views/expir-info.html"
|
||||
},
|
||||
{
|
||||
"name": "常用操作规程",
|
||||
"location": "./views/common-sop.html"
|
||||
"name": "操作规程",
|
||||
"location": "./views/sop.html"
|
||||
}
|
||||
// {
|
||||
// "name": "L414-5KR 相关物质",
|
||||
// "location": "./views/L414-5KR-impurities.html"
|
||||
// },
|
||||
// {
|
||||
// "name": "L014-1 相关物质",
|
||||
// "location": "./views/L014-1-impurities.html"
|
||||
// }
|
||||
]
|
||||
|
||||
$(document).ready(() => {
|
||||
// var getRandomColor = () => '#' + (Math.random() * 0xffffff << 0).toString(16)
|
||||
$(() => {
|
||||
|
||||
// 检查是否已初始化设置
|
||||
let init = settings.read("settings.initialized")
|
||||
if (init != "true") {
|
||||
// 移除所有项目
|
||||
settings.listKeys().forEach(key => {
|
||||
settings.remove(key)
|
||||
})
|
||||
|
||||
// 云端获取默认设置并写入
|
||||
$.getJSON("../statics/settings.json", (data) => {
|
||||
for (const iterator of data) {
|
||||
settings.write(iterator.id, iterator.default)
|
||||
settings.write(`${iterator.id}.desc`, iterator.description)
|
||||
}
|
||||
// 写入完成后重新加载页面,以应用当前设置
|
||||
window.location.reload()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
let hidden = settings.read("index.functions.hidden")
|
||||
hidden = hidden == "" ? [] : hidden.split(',')
|
||||
|
||||
// 加载功能列表
|
||||
functions.forEach(value => {
|
||||
for (const iterator of hidden) {
|
||||
if (value.location.endsWith(iterator)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
let div = `<div class="item" onclick="window.location.href='${value.location}'">${value.name}</div>`
|
||||
$(".list").append(div)
|
||||
})
|
||||
|
||||
let show = settings.read("index.history.enable")
|
||||
if (show == "false") {
|
||||
$("#changelog_title").hide()
|
||||
return
|
||||
}
|
||||
|
||||
// 加载最近的 commit 记录
|
||||
$.getJSON(url, data => {
|
||||
let color1 = '#f9f9f9'
|
||||
@@ -94,7 +124,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h4>功能列表</h4>
|
||||
<h4 onclick="window.location.href='./views/settings.html'">功能列表</h4>
|
||||
<div class="list"></div>
|
||||
<h4>关于</h4>
|
||||
<div class="about">
|
||||
@@ -103,7 +133,7 @@
|
||||
<a href="https://github.com/hbk01/hbk01.github.io">Github</a> ,并由
|
||||
<a href="https://docs.github.com/en/pages">Github Pages</a> 提供页面构建及部署服务。
|
||||
</div>
|
||||
<h4>变更日志</h4>
|
||||
<h4 id="changelog_title">变更日志</h4>
|
||||
<div class="changelog" style="width: 100%;"></div>
|
||||
</body>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user