|
143 | 143 | justify-content: center;
|
144 | 144 | align-items: center;
|
145 | 145 | }
|
| 146 | + |
| 147 | + details button { |
| 148 | + text-align: left; |
| 149 | + } |
146 | 150 | </style>
|
147 | 151 |
|
148 | 152 | <main>
|
|
158 | 162 | flex-direction: column;
|
159 | 163 | ">
|
160 | 164 | <button id="reload-button">🔄 Reload</button>
|
| 165 | + <button id="about-button">ℹ️ About</button> |
161 | 166 | <button id="mcplant-button">🍔 McPlant</button>
|
162 | 167 | <!-- ⟳ <li>McPlant</li>
|
163 | 168 | <li>Linda McCartney</li>
|
@@ -208,6 +213,7 @@ <h2>welcome to pastagang!</h2>
|
208 | 213 |
|
209 | 214 | const mcplantButton = document.getElementById("mcplant-button");
|
210 | 215 | mcplantButton.addEventListener("click", () => {
|
| 216 | + closeBurgerMenu(); |
211 | 217 | alert("You eat the McPlant. It tastes just like a regular burger.");
|
212 | 218 | });
|
213 | 219 |
|
@@ -288,19 +294,44 @@ <h2>welcome to pastagang!</h2>
|
288 | 294 | }, 1000);
|
289 | 295 | }
|
290 | 296 |
|
| 297 | + const aboutButton = document.getElementById("about-button"); |
| 298 | + aboutButton.addEventListener("click", () => { |
| 299 | + closeBurgerMenu(); |
| 300 | + openWelcomeDialog(); |
| 301 | + }); |
| 302 | + |
| 303 | + function openWelcomeDialog() { |
| 304 | + document.getElementById("key-information").showModal(); |
| 305 | + iframe.style.display = "none"; |
| 306 | + dialogHolder.style.display = "flex"; |
| 307 | + coolButton.focus(); |
| 308 | + } |
| 309 | + |
291 | 310 | function closeWelcomeDialog() {
|
292 | 311 | document.getElementById("key-information").close();
|
293 | 312 | iframe.style.display = "block";
|
294 | 313 | dialogHolder.style.display = "none";
|
295 | 314 | iframe.focus();
|
296 | 315 | }
|
297 | 316 |
|
| 317 | + addEventListener("keydown", (e) => { |
| 318 | + if (e.key === "Escape") { |
| 319 | + closeWelcomeDialog(); |
| 320 | + } |
| 321 | + }); |
| 322 | + |
| 323 | + function closeBurgerMenu() { |
| 324 | + const details = document.querySelector(".burger-menu"); |
| 325 | + details.removeAttribute("open"); |
| 326 | + } |
| 327 | + |
298 | 328 | coolButton.addEventListener("click", closeWelcomeDialog);
|
299 | 329 |
|
300 | 330 | dialogHolder.addEventListener("click", (e) => {
|
301 | 331 | if (e.target !== dialogHolder) {
|
302 | 332 | return;
|
303 | 333 | }
|
304 |
| - coolButton.focus(); |
| 334 | + // coolButton.focus(); |
| 335 | + closeWelcomeDialog(); |
305 | 336 | });
|
306 | 337 | </script>
|
0 commit comments