forked from mkzi-nya/milthm-calculator-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtable.html
More file actions
54 lines (47 loc) · 1.57 KB
/
table.html
File metadata and controls
54 lines (47 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>Phigros Chart Constant Table</title>
<style>
body { background:#121212; color:#fff; font-family:sans-serif; margin:0; text-align:center; }
input { margin:5px; padding:5px; }
button { padding:8px 16px; margin:5px; }
#result img { max-width:100%; margin-top:10px; border:1px solid #444; }
</style>
</head>
<body>
<h1>Phigros Chart Constant Table</h1>
<div>
<input id="difficulty" placeholder="难度(如 CL 或 all)" value="all">
<input id="minVal" placeholder="起始定数">
<input id="maxVal" placeholder="结束定数">
<button onclick="generate()">生成</button>
<button onclick="downloadImage()">下载</button>
</div>
<div id="result"></div>
<script type="module">
import { generateTable } from './pic.js';
window.generate = async function() {
const difficulty = document.getElementById('difficulty').value.trim() || 'all';
const minVal = document.getElementById('minVal').value.trim();
const maxVal = document.getElementById('maxVal').value.trim();
try {
const dataUrl = await generateTable({ difficulty, minVal, maxVal });
document.getElementById('result').innerHTML =
`<img id="outputImage" src="${dataUrl}" alt="constant table">`;
} catch (e) {
alert('生成失败: ' + e.message);
}
};
window.downloadImage = function() {
const img = document.getElementById('outputImage');
if (!img) return alert('请先生成图片');
const link = document.createElement('a');
link.href = img.src;
link.download = 'constant_table.png';
link.click();
};
</script>
</body>
</html>