Veto's Giveaway
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Veto's Giveaway</title>
<link rel="stylesheet" href="styles.css">
<script src="script.js" defer></script>
</head>
<body>
<div class="container">
<h1 class="title">Veto's Giveaway</h1>
<div id="timer" class="timer"></div>
<form id="username-form">
<input type="text" id="username" placeholder="Enter your Instagram username" required>
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>
CSS
body {
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #121212;
font-family: 'Arial', sans-serif;
}
.container {
text-align: center;
}
.title {
font-family: 'Brush Script MT', cursive;
font-size: 48px;
color: #ff6347;
margin-bottom: 20px;
}
.timer {
font-size: 24px;
color: #ff6347;
margin-bottom: 20px;
}
form {
display: flex;
flex-direction: column;
align-items: center;
}
input[type="text"] {
padding: 10px;
margin-bottom: 10px;
border: 2px solid #ff6347;
border-radius: 5px;
background-color: #333;
color: #fff;
}
button {
padding: 10px 20px;
border: none;
border-radius: 5px;
background-color: #ff6347;
color: #fff;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #e5533c;
}
JAVASCRIPT
document.addEventListener('DOMContentLoaded', () => {
// Timer setup
const timerElement = document.getElementById('timer');
const targetTime = new Date('July 6, 2024 12:00:00').getTime();
const timerInterval = setInterval(() => {
const now = new Date().getTime();
const timeLeft = targetTime - now;
const hours = Math.floor((timeLeft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((timeLeft % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeLeft % (1000 * 60)) / 1000);
timerElement.innerHTML = `${hours}h ${minutes}m ${seconds}s`;
if (timeLeft < 0) {
clearInterval(timerInterval);
timerElement.innerHTML = "EXPIRED";
}
}, 1000);
// Form submission and Telegram bot integration
const form = document.getElementById('username-form');
const usernameInput = document.getElementById('username');
let usernames = [];
form.addEventListener('submit', (e) => {
e.preventDefault();
const username = usernameInput.value.trim();
if (username) {
usernames.push(username);
usernameInput.value = '';
alert('Your username is submitted');
if (usernames.length % 10 === 0) {
sendUsernamesToTelegram(usernames);
usernames = [];
}
}
});
function sendUsernamesToTelegram(usernames) {
const apiToken = '6534147514:AAEYaOin1Nyu_gwcIOueoLyiBh2o8pL1gDs';
const chatId = '6881713177';
const message = usernames.join('\n');
const url = `https://api.telegram.org/bot${apiToken}/sendMessage?chat_id=${chatId}&text=${encodeURIComponent(message)}`;
fetch(url)
.then(response => response.json())
.then(data => console.log('Success:', data))
.catch((error) => console.error('Error:', error));
}
});