Spaces:
Sleeping
Sleeping
Robin
commited on
Commit
·
51189ba
1
Parent(s):
b6be8eb
popups
Browse files- static/images/game_over.png +0 -0
- static/images/trump_popup.jpg +0 -0
- static/index.html +125 -1
- static/styles.css +110 -0
static/images/game_over.png
ADDED
|
static/images/trump_popup.jpg
ADDED
|
static/index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
| 14 |
<div class="profile-text">
|
| 15 |
<h2>Donald J. Trump</h2>
|
| 16 |
<span>@realDonaldTrump</span>
|
| 17 |
-
<p>45th
|
| 18 |
DonaldJTrump.com<br/>
|
| 19 |
A rejoint X en mars 2009</p>
|
| 20 |
</div>
|
|
@@ -27,6 +27,35 @@
|
|
| 27 |
</div>
|
| 28 |
</div>
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
<script>
|
| 31 |
function addMessageToChat(message, isUser) {
|
| 32 |
const chatWindow = document.getElementById('chatWindow');
|
|
@@ -90,6 +119,101 @@
|
|
| 90 |
sendMessage();
|
| 91 |
}
|
| 92 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
</script>
|
| 94 |
</body>
|
| 95 |
</html>
|
|
|
|
| 14 |
<div class="profile-text">
|
| 15 |
<h2>Donald J. Trump</h2>
|
| 16 |
<span>@realDonaldTrump</span>
|
| 17 |
+
<p>45th & 47th President 🇺🇸<br/>
|
| 18 |
DonaldJTrump.com<br/>
|
| 19 |
A rejoint X en mars 2009</p>
|
| 20 |
</div>
|
|
|
|
| 27 |
</div>
|
| 28 |
</div>
|
| 29 |
|
| 30 |
+
<div class="popup" id="gamePopup">
|
| 31 |
+
<div class="popup-header">
|
| 32 |
+
<span class="popup-title">Game intro</span>
|
| 33 |
+
<div class="popup-controls">
|
| 34 |
+
<button class="control-btn minimize">−</button>
|
| 35 |
+
<button class="control-btn maximize">□</button>
|
| 36 |
+
<button class="control-btn close">×</button>
|
| 37 |
+
</div>
|
| 38 |
+
</div>
|
| 39 |
+
<div class="popup-content">
|
| 40 |
+
<p>Welcome to the 21st century—where America is thriving on the edge of total collapse! Wokeness has spread like a glorious plague, the Democrats have worked their magic to send inflation soaring, and oil production? Oh, it's practically a fairy tale now. But don't worry, salvation is here! A brand-new, ultra-competent (and just a little unpredictable) president has stepped in to save the day. What could possibly go wrong?</p>
|
| 41 |
+
<img src="/images/trump_popup.jpg" alt="USA Flag" class="popup-gif">
|
| 42 |
+
<button class="popup-ok">OK</button>
|
| 43 |
+
</div>
|
| 44 |
+
</div>
|
| 45 |
+
|
| 46 |
+
<div class="popup" id="gameOverPopup">
|
| 47 |
+
<div class="popup-header">
|
| 48 |
+
<span class="popup-title">Game Over</span>
|
| 49 |
+
<div class="popup-controls">
|
| 50 |
+
<button class="control-btn close">×</button>
|
| 51 |
+
</div>
|
| 52 |
+
</div>
|
| 53 |
+
<div class="popup-content">
|
| 54 |
+
<img src="/images/game_over.png" alt="Game Over" class="popup-gif">
|
| 55 |
+
<button class="popup-ok">Try Again</button>
|
| 56 |
+
</div>
|
| 57 |
+
</div>
|
| 58 |
+
|
| 59 |
<script>
|
| 60 |
function addMessageToChat(message, isUser) {
|
| 61 |
const chatWindow = document.getElementById('chatWindow');
|
|
|
|
| 119 |
sendMessage();
|
| 120 |
}
|
| 121 |
});
|
| 122 |
+
|
| 123 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 124 |
+
// Show initial game popup after 2 seconds
|
| 125 |
+
setTimeout(() => {
|
| 126 |
+
const popup = document.getElementById('gamePopup');
|
| 127 |
+
popup.style.display = 'block';
|
| 128 |
+
}, 2000);
|
| 129 |
+
|
| 130 |
+
// Show game over popup after 5 seconds
|
| 131 |
+
setTimeout(() => {
|
| 132 |
+
const gameOverPopup = document.getElementById('gameOverPopup');
|
| 133 |
+
gameOverPopup.style.display = 'block';
|
| 134 |
+
}, 5000);
|
| 135 |
+
|
| 136 |
+
// Initialize game popup controls
|
| 137 |
+
const popup = document.getElementById('gamePopup');
|
| 138 |
+
const minimizeBtn = popup.querySelector('.minimize');
|
| 139 |
+
const maximizeBtn = popup.querySelector('.maximize');
|
| 140 |
+
const closeBtn = popup.querySelector('.close');
|
| 141 |
+
const okBtn = popup.querySelector('.popup-ok');
|
| 142 |
+
|
| 143 |
+
minimizeBtn.addEventListener('click', () => {
|
| 144 |
+
popup.classList.add('minimized');
|
| 145 |
+
});
|
| 146 |
+
|
| 147 |
+
maximizeBtn.addEventListener('click', () => {
|
| 148 |
+
popup.classList.remove('minimized');
|
| 149 |
+
});
|
| 150 |
+
|
| 151 |
+
closeBtn.addEventListener('click', () => {
|
| 152 |
+
popup.style.display = 'none';
|
| 153 |
+
});
|
| 154 |
+
|
| 155 |
+
okBtn.addEventListener('click', () => {
|
| 156 |
+
popup.classList.add('minimized');
|
| 157 |
+
});
|
| 158 |
+
|
| 159 |
+
// Make the popup draggable
|
| 160 |
+
const header = popup.querySelector('.popup-header');
|
| 161 |
+
let isDragging = false;
|
| 162 |
+
let currentX;
|
| 163 |
+
let currentY;
|
| 164 |
+
let initialX;
|
| 165 |
+
let initialY;
|
| 166 |
+
let xOffset = 0;
|
| 167 |
+
let yOffset = 0;
|
| 168 |
+
|
| 169 |
+
header.addEventListener('mousedown', dragStart);
|
| 170 |
+
document.addEventListener('mousemove', drag);
|
| 171 |
+
document.addEventListener('mouseup', dragEnd);
|
| 172 |
+
|
| 173 |
+
function dragStart(e) {
|
| 174 |
+
initialX = e.clientX - xOffset;
|
| 175 |
+
initialY = e.clientY - yOffset;
|
| 176 |
+
|
| 177 |
+
if (e.target === header) {
|
| 178 |
+
isDragging = true;
|
| 179 |
+
}
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
function drag(e) {
|
| 183 |
+
if (isDragging) {
|
| 184 |
+
e.preventDefault();
|
| 185 |
+
currentX = e.clientX - initialX;
|
| 186 |
+
currentY = e.clientY - initialY;
|
| 187 |
+
xOffset = currentX;
|
| 188 |
+
yOffset = currentY;
|
| 189 |
+
|
| 190 |
+
setTranslate(currentX, currentY, popup);
|
| 191 |
+
}
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
function setTranslate(xPos, yPos, el) {
|
| 195 |
+
el.style.transform = `translate(${xPos}px, ${yPos}px)`;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
function dragEnd() {
|
| 199 |
+
initialX = currentX;
|
| 200 |
+
initialY = currentY;
|
| 201 |
+
isDragging = false;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
// Initialize game over popup controls
|
| 205 |
+
const gameOverPopup = document.getElementById('gameOverPopup');
|
| 206 |
+
const gameOverCloseBtn = gameOverPopup.querySelector('.close');
|
| 207 |
+
const gameOverOkBtn = gameOverPopup.querySelector('.popup-ok');
|
| 208 |
+
|
| 209 |
+
gameOverCloseBtn.addEventListener('click', () => {
|
| 210 |
+
location.reload(); // Reload page on close
|
| 211 |
+
});
|
| 212 |
+
|
| 213 |
+
gameOverOkBtn.addEventListener('click', () => {
|
| 214 |
+
location.reload(); // Reload page on Try Again
|
| 215 |
+
});
|
| 216 |
+
});
|
| 217 |
</script>
|
| 218 |
</body>
|
| 219 |
</html>
|
static/styles.css
CHANGED
|
@@ -191,4 +191,114 @@
|
|
| 191 |
height: 1px;
|
| 192 |
background-color: #2f3336;
|
| 193 |
margin-top: 16px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
}
|
|
|
|
| 191 |
height: 1px;
|
| 192 |
background-color: #2f3336;
|
| 193 |
margin-top: 16px;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
.popup {
|
| 197 |
+
display: none;
|
| 198 |
+
position: fixed;
|
| 199 |
+
top: 50%;
|
| 200 |
+
left: 50%;
|
| 201 |
+
transform: translate(-50%, -50%);
|
| 202 |
+
width: 400px;
|
| 203 |
+
background-color: #fff3e0;
|
| 204 |
+
border-radius: 8px;
|
| 205 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
|
| 206 |
+
z-index: 1000;
|
| 207 |
+
transition: all 0.3s ease;
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
.popup.minimized {
|
| 211 |
+
top: unset;
|
| 212 |
+
bottom: 20px;
|
| 213 |
+
right: 20px;
|
| 214 |
+
left: unset;
|
| 215 |
+
transform: none;
|
| 216 |
+
width: 200px;
|
| 217 |
+
height: 40px;
|
| 218 |
+
overflow: hidden;
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
.popup-header {
|
| 222 |
+
background-color: #1da1f2;
|
| 223 |
+
color: white;
|
| 224 |
+
padding: 8px 12px;
|
| 225 |
+
display: flex;
|
| 226 |
+
justify-content: space-between;
|
| 227 |
+
align-items: center;
|
| 228 |
+
border-radius: 8px 8px 0 0;
|
| 229 |
+
cursor: move;
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
.popup-controls {
|
| 233 |
+
display: flex;
|
| 234 |
+
gap: 5px;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
.control-btn {
|
| 238 |
+
background: none;
|
| 239 |
+
border: none;
|
| 240 |
+
color: white;
|
| 241 |
+
cursor: pointer;
|
| 242 |
+
width: 24px;
|
| 243 |
+
height: 24px;
|
| 244 |
+
display: flex;
|
| 245 |
+
align-items: center;
|
| 246 |
+
justify-content: center;
|
| 247 |
+
border-radius: 4px;
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
.control-btn:hover {
|
| 251 |
+
background-color: rgba(255, 255, 255, 0.2);
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
.popup-content {
|
| 255 |
+
padding: 20px;
|
| 256 |
+
display: flex;
|
| 257 |
+
flex-direction: column;
|
| 258 |
+
align-items: center;
|
| 259 |
+
gap: 15px;
|
| 260 |
+
color: #000;
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
.popup-gif {
|
| 264 |
+
max-width: 100%;
|
| 265 |
+
height: auto;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
.popup-ok {
|
| 269 |
+
background-color: #1da1f2;
|
| 270 |
+
color: white;
|
| 271 |
+
border: none;
|
| 272 |
+
padding: 8px 24px;
|
| 273 |
+
border-radius: 20px;
|
| 274 |
+
cursor: pointer;
|
| 275 |
+
font-size: 14px;
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
.popup-ok:hover {
|
| 279 |
+
background-color: #1a91da;
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
#gameOverPopup {
|
| 283 |
+
width: fit-content;
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
#gameOverPopup .popup-content {
|
| 287 |
+
padding: 0;
|
| 288 |
+
gap: 5px;
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
#gameOverPopup .popup-gif {
|
| 292 |
+
display: block;
|
| 293 |
+
width: 600px;
|
| 294 |
+
height: 300px;
|
| 295 |
+
margin: 0;
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
#gameOverPopup .popup-header {
|
| 299 |
+
padding: 5px 10px;
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
#gameOverPopup .popup-ok {
|
| 303 |
+
margin: 5px 0;
|
| 304 |
}
|