Spaces:
Running
Running
File size: 7,563 Bytes
8aeb522 |
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 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
<!DOCTYPE html>
<html lang="en">
<!-- Mirrored from es-teams-database2025.onrender.com/td-multi.html by HTTrack Website Copier/3.x [XR&CO'2017], Fri, 14 Feb 2025 22:35:16 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Truth or Dare</title>
<script src="../external.html?link=https://cdn.tailwindcss.com/"></script>
<style>
body {
background: linear-gradient(135deg, #a1c4fd, #c2e9fb);
color: black;
font-family: Arial, sans-serif;
text-align: center;
}
.game-container {
margin-top: 50px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 80vh;
}
.input-container input {
padding: 10px;
margin: 5px;
border: 2px solid #007bff;
border-radius: 5px;
font-size: 1rem;
background: white;
text-align: center;
}
.start-btn {
background-color: green;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
font-size: 1.2rem;
cursor: pointer;
transition: transform 0.3s;
}
.start-btn:hover {
transform: scale(1.1);
}
.question-box {
margin-top: 20px;
font-size: 1.5rem;
font-weight: bold;
padding: 20px;
border: 2px solid black;
border-radius: 10px;
min-height: 80px;
width: 80%;
background: white;
color: black;
}
.truth-btn, .dare-btn {
padding: 15px 30px;
font-size: 1.2rem;
border: none;
border-radius: 10px;
cursor: pointer;
margin: 10px;
transition: transform 0.3s;
}
.truth-btn {
background-color: blue;
color: white;
}
.dare-btn {
background-color: red;
color: white;
}
.truth-btn:hover, .dare-btn:hover {
transform: scale(1.1);
}
.timer {
font-size: 3rem;
font-weight: bold;
margin-top: 20px;
transition: transform 0.3s;
}
.warning {
color: red;
animation: shake 0.5s infinite alternate;
}
@keyframes shake {
from { transform: translateX(-5px); }
to { transform: translateX(5px); }
}
.back-btn {
position: absolute;
top: 10px;
left: 10px;
font-size: 2rem;
color: black;
cursor: pointer;
}
.header-marquee {
position: fixed;
top: 0;
width: 100%;
font-size: 2rem;
font-weight: bold;
color: white;
background: black;
padding: 10px 0;
overflow: hidden;
white-space: nowrap;
animation: marquee 10s linear infinite;
}
@keyframes marquee {
from { transform: translateX(100%); }
to { transform: translateX(-100%); }
}
</style>
</head>
<body>
<!-- Moving Header -->
<div class="header-marquee">ES TEAMS TRUTH OR DARE</div>
<!-- Back Button -->
<div class="back-btn" onclick="location.href='games-2.html'">⬅</div>
<div class="game-container">
<h1 class="text-3xl font-bold mb-4">Truth or Dare</h1>
<!-- Player Name Inputs -->
<div class="input-container">
<input type="text" id="player1" placeholder="Enter Player 1 Name">
<input type="text" id="player2" placeholder="Enter Player 2 Name">
<button class="start-btn" onclick="startGame()">Start Game</button>
</div>
<!-- Game Area -->
<div id="game-area" style="display: none;">
<h2 id="current-player" class="text-2xl font-bold"></h2>
<div id="question-box" class="question-box">Waiting for message...</div>
<button class="truth-btn" onclick="fetchQuestion('truth')">TRUTH</button>
<button class="dare-btn" onclick="fetchQuestion('dare')">DARE</button>
<div id="timer" class="timer">15</div>
</div>
</div>
<script>
let players = [];
let currentPlayerIndex = 0;
let timerInterval;
function startGame() {
let p1 = document.getElementById("player1").value.trim();
let p2 = document.getElementById("player2").value.trim();
if (!p1 || !p2) {
alert("Both players must enter their names!");
return;
}
players = [p1, p2];
document.querySelector(".input-container").style.display = "none";
document.getElementById("game-area").style.display = "block";
nextTurn();
}
function nextTurn() {
clearInterval(timerInterval);
document.getElementById("timer").textContent = "15";
document.getElementById("timer").classList.remove("warning");
let currentPlayer = players[currentPlayerIndex];
document.getElementById("current-player").textContent = `${currentPlayer}, it's your turn! Choose:`;
document.getElementById("question-box").textContent = "Waiting for message...";
document.querySelector(".truth-btn").disabled = false;
document.querySelector(".dare-btn").disabled = false;
}
function fetchQuestion(type) {
let url = type === 'truth' ? "https://api.davidcyriltech.my.id/truth" : "https://api.davidcyriltech.my.id/dare";
document.querySelector(".truth-btn").disabled = true;
document.querySelector(".dare-btn").disabled = true;
fetch(url)
.then(response => response.json())
.then(data => {
document.getElementById("question-box").textContent = data.question || "Error fetching question";
startTimer();
})
.catch(() => {
document.getElementById("question-box").textContent = "Error fetching question.";
startTimer();
});
}
function startTimer() {
let timeLeft = 15;
timerInterval = setInterval(() => {
timeLeft--;
let timerElement = document.getElementById("timer");
timerElement.textContent = timeLeft;
if (timeLeft <= 5) {
timerElement.classList.add("warning");
}
if (timeLeft === 0) {
clearInterval(timerInterval);
nextPlayer();
}
}, 1000);
}
function nextPlayer() {
currentPlayerIndex = (currentPlayerIndex + 1) % players.length;
nextTurn();
}
</script>
</body>
<!-- Mirrored from es-teams-database2025.onrender.com/td-multi.html by HTTrack Website Copier/3.x [XR&CO'2017], Fri, 14 Feb 2025 22:35:16 GMT -->
</html> |