-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcount.html
More file actions
134 lines (113 loc) · 5.53 KB
/
Copy pathcount.html
File metadata and controls
134 lines (113 loc) · 5.53 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Token Launch Countdown</title>
<style>
body { margin: 0; font-family: system-ui, sans-serif; background: #0a0e27; color: #f1f5f9; display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }
.container { background: #131a33; padding: 32px; border-radius: 20px; width: 100%; max-width: 600px; text-align: center; border: 1px solid #1e293b; }
h1 { margin: 0 0 8px; font-size: 1.8rem; }
.subtitle { color: #94a3b8; margin-bottom: 24px; }
/* Countdown display */
.countdown { display: flex; gap: 12px; justify-content: center; margin: 30px 0; flex-wrap: wrap; }
.unit { background: #1e293b; padding: 20px 12px; border-radius: 12px; min-width: 80px; }
.num { font-size: 3rem; font-weight: 700; line-height: 1; color: #3b82f6; }
.label { font-size: 0.8rem; text-transform: uppercase; color: #94a3b8; margin-top: 4px; }
.launched { font-size: 2.5rem; color: #22c55e; font-weight: 700; padding: 40px 0; }
/* Date picker */
.picker { margin: 20px 0; }
input[type="datetime-local"] { padding: 10px; border-radius: 8px; border: 1px solid #334155; background: #0a0e27; color: #f1f5f9; font-size: 1rem; }
/* Progress bar */
.progress-bg { height: 8px; background: #1e293b; border-radius: 4px; overflow: hidden; margin: 24px 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #3b82f6, #22c55e); width: 0%; transition: width 1s linear; }
/* Subscribe form */
.subscribe { margin-top: 24px; padding-top: 24px; border-top: 1px solid #1e293b; }
.subscribe input { padding: 12px; border-radius: 8px; border: 1px solid #334155; background: #0a0e27; color: #f1f5f9; width: 60%; margin-right: 8px; }
.subscribe button { padding: 12px 20px; border: none; border-radius: 8px; background: #3b82f6; color: white; font-weight: 600; cursor: pointer; }
.subscribe button:hover { background: #2563eb; }
</style>
</head>
<body>
<div class="container">
<h1>Token Launch</h1>
<div class="subtitle" id="targetDateDisplay">Set a target date below</div>
<div class="picker">
<input type="datetime-local" id="datePicker">
</div>
<div id="countdownDisplay" class="countdown">
<div class="unit"><div class="num" id="days">00</div><div class="label">Days</div></div>
<div class="unit"><div class="num" id="hours">00</div><div class="label">Hours</div></div>
<div class="unit"><div class="num" id="minutes">00</div><div class="label">Minutes</div></div>
<div class="unit"><div class="num" id="seconds">00</div><div class="label">Seconds</div></div>
</div>
<div class="progress-bg">
<div class="progress-fill" id="progressBar"></div>
</div>
<div class="subscribe">
<input type="email" id="emailInput" placeholder="Enter email for launch alerts">
<button onclick="subscribe()">Subscribe</button>
</div>
</div>
<script>
let targetDate = null;
let startTime = null;
let timer = null;
const daysEl = document.getElementById('days');
const hoursEl = document.getElementById('hours');
const minutesEl = document.getElementById('minutes');
const secondsEl = document.getElementById('seconds');
const countdownDisplay = document.getElementById('countdownDisplay');
const targetDateDisplay = document.getElementById('targetDateDisplay');
const progressBar = document.getElementById('progressBar');
const datePicker = document.getElementById('datePicker');
// Set default to 7 days from now for demo
datePicker.value = new Date(Date.now() + 7*24*60*60*1000).toISOString().slice(0,16);
datePicker.addEventListener('change', () => {
targetDate = new Date(datePicker.value).getTime();
startTime = Date.now();
targetDateDisplay.textContent = `Launching: ${new Date(targetDate).toLocaleString()}`;
if (timer) clearInterval(timer);
timer = setInterval(updateCountdown, 1000);
updateCountdown();
});
// Logic: calculate difference and convert ms to d/h/m/s
function updateCountdown() {
const now = Date.now();
const diff = targetDate - now;
// Stop timer and show "Launched!" if time reaches zero
if (diff <= 0) {
clearInterval(timer);
countdownDisplay.innerHTML = '<div class="launched">Launched! 🚀</div>';
progressBar.style.width = '100%';
return;
}
const days = Math.floor(diff / (1000 * 60 * 60 * 24));
const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((diff % (1000 * 60)) / 1000);
daysEl.textContent = String(days).padStart(2, '0');
hoursEl.textContent = String(hours).padStart(2, '0');
minutesEl.textContent = String(minutes).padStart(2, '0');
secondsEl.textContent = String(seconds).padStart(2, '0');
// Bonus: progress bar fills as time gets closer to zero
const totalDuration = targetDate - startTime;
const elapsed = now - startTime;
const progress = Math.min((elapsed / totalDuration) * 100, 100);
progressBar.style.width = progress + '%';
}
// Bonus: Subscribe form
function subscribe() {
const emailInput = document.getElementById('emailInput');
const email = emailInput.value.trim();
if (!email || !email.includes('@')) {
alert('Please enter a valid email');
return;
}
console.log('Subscribed email:', email); // Simulates collecting email
emailInput.value = '';
alert('Subscribed! You\'ll get launch alerts.');
}
</script>
</body>
</html>