-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
185 lines (141 loc) · 7.19 KB
/
index.html
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./style.css">
<title>ファイト!</title>
</head>
<body>
<h1>超甘デジ!修了・合格占い</h1>
<img id="floating-image" src="fight_miura.png" alt="浮揚する画像">
<p>(注)本カウントダウンはすべて日本時間(Japan Standard Time)を基準としています。</p>
<div id="kyushu-countdown" class="countdown"></div>
<button id="fortune">今日の運勢を占う</button>
<div id="slot-container">
<div id="slot1" class="slot"></div>
<div id="slot2" class="slot"></div>
<div id="slot3" class="slot"></div>
</div>
<div id="fortune-result"></div>
<h1>残り文字数チェッカー</h1>
<div id="inputs">
<label for="remaining-characters">残りの文字数:</label>
<input type="number" id="remaining-characters" value="20000">
<label for="sleep-hours">睡眠時間(時間):</label>
<input type="number" id="sleep-hours" value="6">
<label for="work-hours">バイト等の時間(時間):</label>
<input type="number" id="work-hours" value="4">
</div>
<select id="deadline-selector">
<option value="kyushu">九州大学基準</option>
</select>
<div id="writing-speed">
<p>単位時間あたりの必要執筆文字数:</p>
<p>24時間あたり: <span id="speed-24"></span>文字</p>
<p>6時間あたり: <span id="speed-6"></span>文字</p>
<p>1時間あたり: <span id="speed-1"></span>文字</p>
<p>30分あたり: <span id="speed-0_5"></span>文字</p>
<p>1分あたり: <span id="speed-0_016"></span>文字</p>
<p>30秒あたり: <span id="speed-0_008"></span>文字</p>
</div>
<script>
function updateCountdown() {
const now = new Date();
const kyushuDeadline = new Date("2025-01-20T17:00:00+09:00");
const kyushuDiff = kyushuDeadline - now;
document.getElementById("kyushu-countdown").innerText =
`九州大学大学院人間環境学府教育システム専攻:\n残り ${formatTime(kyushuDiff)}` +
`\n(2025年1月20日 17:00)`;
const selector = document.getElementById("deadline-selector").value;
const deadline = kyushuDiff;
calculateWritingSpeed(deadline);
}
function formatTime(diff) {
if (diff <= 0) return "期限が過ぎました!";
const totalHours = Math.floor(diff / (1000 * 60 * 60)); // 総時間数に変換
const minutes = Math.floor((diff / (1000 * 60)) % 60);
const seconds = Math.floor((diff / 1000) % 60);
const milliseconds = diff % 1000; // ミリ秒を計算
return `${totalHours}時間 ${minutes}分 ${seconds}秒 ${milliseconds}ミリ秒`;
}
function calculateWritingSpeed(diff) {
const remainingCharacters = parseInt(document.getElementById("remaining-characters").value);
const sleepHours = parseInt(document.getElementById("sleep-hours").value);
const workHours = parseInt(document.getElementById("work-hours").value);
if (diff <= 0 || isNaN(remainingCharacters) || isNaN(sleepHours) || isNaN(workHours)) {
document.getElementById("speed-24").innerText = "-";
document.getElementById("speed-6").innerText = "-";
document.getElementById("speed-1").innerText = "-";
document.getElementById("speed-0_5").innerText = "-";
document.getElementById("speed-0_016").innerText = "-";
document.getElementById("speed-0_008").innerText = "-";
return;
}
const totalHours = diff / (1000 * 60 * 60);
const availableHours = totalHours - sleepHours - workHours;
if (availableHours <= 0) {
document.getElementById("speed-24").innerText = "-";
document.getElementById("speed-6").innerText = "-";
document.getElementById("speed-1").innerText = "-";
document.getElementById("speed-0_5").innerText = "-";
document.getElementById("speed-0_016").innerText = "-";
document.getElementById("speed-0_008").innerText = "-";
return;
}
const speedPerHour = remainingCharacters / availableHours;
document.getElementById("speed-24").innerText = (speedPerHour * 24).toFixed(2);
document.getElementById("speed-6").innerText = (speedPerHour * 6).toFixed(2);
document.getElementById("speed-1").innerText = speedPerHour.toFixed(2);
document.getElementById("speed-0_5").innerText = (speedPerHour / 2).toFixed(2);
document.getElementById("speed-0_016").innerText = (speedPerHour / 60).toFixed(2);
document.getElementById("speed-0_008").innerText = (speedPerHour / 120).toFixed(2);
}
setInterval(updateCountdown, 100);
</script>
<script>
const images = [
"fight_miura.png",
"chi.jpg",
"inmu.jpeg"
];
let fortuneTimeout = null;
document.getElementById("fortune").addEventListener("click", () => {
if (fortuneTimeout) return; // 待機中はボタンを無効化
const slotContainer = document.getElementById("slot-container");
const slots = [
document.getElementById("slot1"),
document.getElementById("slot2"),
document.getElementById("slot3")
];
// Show the slot machine
slotContainer.style.display = "block";
let spinCount = 0;
const spinInterval = setInterval(() => {
spinCount++;
// Randomly assign images to the slots during spin
slots.forEach(slot => {
const randomImage = images[Math.floor(Math.random() * images.length)];
slot.style.backgroundImage = `url(${randomImage})`;
});
// Stop spinning after a few iterations
if (spinCount >= 10) {
clearInterval(spinInterval);
// Set all slots to "fight_miura.png"
slots.forEach(slot => {
slot.style.backgroundImage = "url(fight_miura.png)";
});
document.getElementById("fortune-result").innerText = "大吉!三浦スロットが揃いました!今日も頑張りましょう!\n連打は10秒まってね";
// ボタンを無効化して10秒後に再度有効化
const fortuneButton = document.getElementById("fortune");
fortuneButton.disabled = true;
fortuneTimeout = setTimeout(() => {
fortuneButton.disabled = false;
fortuneTimeout = null;
}, 10000);
}
}, 100);
});
</script>
</body>
</html>