Skip to content

Commit e7f5c49

Browse files
committed
add after-vaccine.html
1 parent 8a2eaa9 commit e7f5c49

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

after-vaccine.html

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset='utf-8'>
5+
<title>接種後経過時間</title>
6+
<meta name='viewport' content='width=device-width, initial-scale=1'>
7+
<script>
8+
// 接種日時を設定
9+
const injection_date = new Date(2021, 8-1, 17, 16, 40);
10+
function parse_ms(ms) {
11+
const total_second = Math.floor( ms / 1000 );
12+
const day = Math.floor( total_second / 86400 );
13+
const hour = Math.floor( total_second % 86400 / 3600 );
14+
const minute = Math.floor( total_second % 3600 / 60 );
15+
return [day, hour, minute];
16+
}
17+
function update_message() {
18+
const now_date = new Date();
19+
const diff = now_date - injection_date;
20+
const [day, hour, minute] = parse_ms(diff);
21+
const sesshugo = `${day}日と${hour}時間${minute}分` + (
22+
day >= 1 ? `(${hour + 24 * day}時間)` : ''
23+
);
24+
document.getElementById("sesshugo").innerText = sesshugo;
25+
document.getElementById("last_update").innerText = now_date.toString();
26+
document.getElementById("menekiato").innerText = 14 - day;
27+
// TODO: 14 - day <= 0 の場合の表示
28+
}
29+
addEventListener("load", () => {
30+
update_message();
31+
setInterval(update_message, 60 * 1000);
32+
});
33+
</script>
34+
<style>
35+
body {
36+
font-size: 24pt;
37+
}
38+
#sesshugo {
39+
font-weight: bold;
40+
font-size: 1.5em;
41+
}
42+
@media (prefers-color-scheme: dark) {
43+
body {
44+
background-color: #000;
45+
color: #888
46+
}
47+
}
48+
</style>
49+
</head>
50+
<body>
51+
<div>接種後<br><span id="sesshugo">...</span><br>経過しました。</div>
52+
<div>免疫が付くまであと<span id="menekiato">...</span></div>
53+
<hr>
54+
<div>Last Update: <span id="last_update"></span></div>
55+
</body>
56+
</html>

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ <h1>xtetsuji/html-javascript-tinyapps</h1>
1818
<li><a href="kachimai-download.html">kachimai-download.html</a> - 十勝毎日新聞電子版の指定日付のアクセス・ダウンロード用(そのブラウザで要事前ログイン)</li>
1919
<li><a href="tweet-count.html">tweet-count.html</a> - Twitter向け(?)の風変わりな文字数カウント</li>
2020
<li><a href="copy-per-line.html">copy-per-line.html</a> - クリップボード行ごとコピー支援</li>
21+
<li><a href="after-vaccine.html">after-vaccine.html</a> - ワクチン接種後何日?</li>
2122
</ul>
2223

2324
</body>

0 commit comments

Comments
 (0)