Files
qctool/index.html
hbk01 47c81f9efb + 常用操作规程更名为操作规程
+ 首页功能列表增加高度以防止误触
+ 添加设置页面
+ 删除 L014-1 与 L414-5KR 相关物质计算页面
2023-04-19 03:59:52 +08:00

141 lines
5.2 KiB
HTML

<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="./statics/github.css">
<link rel="stylesheet" href="./statics/theme.css">
<script src="./statics/modules/jquery.min.js"></script>
<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 = [
{
"name": "标水",
"location": "./views/titer.html"
},
{
"name": "干燥失重",
"location": "./views/lod.html"
},
{
"name": "炽灼残渣",
"location": "./views/roi.html"
},
{
"name": "进样时间",
"location": "./views/injection-sequence.html"
},
{
"name": "效期查询",
"location": "./views/expir-info.html"
},
{
"name": "操作规程",
"location": "./views/sop.html"
}
]
$(() => {
// 检查是否已初始化设置
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'
let color2 = '#f3f3f3'
let changeColor = false
data.forEach(element => {
// 处理换行和+号
let message = element.commit.message.replaceAll("\n", "<br>")
if (message.startsWith("+")) {
message = message.replace("+", "<br>&nbsp;&nbsp;<strong>&bull;</strong>")
}
message = message.replaceAll("+", "&nbsp;&nbsp;<strong>&bull;</strong>")
// 处理提交的日期
let date = new Date(element.commit.committer.date) // "2022-10-08T10:54:36Z"
date = new Date(+ new Date(date) + 28800000).toISOString()
date = date.replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
// 组装标题信息
let verifiedString = "<span style='color: green;'><strong>Verified</strong></span>"
let hash = `<a href='${element.html_url}'>${element.sha.slice(0, 7)}</a>`
let verified = `${element.commit.verification.verified ? verifiedString : ""}`
let header = `${hash} ${date} ${verified}`
changeColor = !changeColor
let color = `${changeColor ? color1 : color2}`
let msg = `
<div style="background-color: ${color}; padding: 5px 0px 5px 10px">
${header}
${message}
</div>`
$(".changelog").append(msg)
})
})
})
</script>
<title>QC TOOL</title>
</head>
<body>
<h4 onclick="window.location.href='./views/settings.html'">功能列表</h4>
<div class="list"></div>
<h4>关于</h4>
<div class="about">
<p>建议使用系统自带浏览器,以完善使用体验!</p>
本项目开源于
<a href="https://github.com/hbk01/hbk01.github.io">Github</a> ,并由
<a href="https://docs.github.com/en/pages">Github Pages</a> 提供页面构建及部署服务。
</div>
<h4 id="changelog_title">变更日志</h4>
<div class="changelog" style="width: 100%;"></div>
</body>
</html>