Skip to content

Commit 6af1284

Browse files
committed
Display "Auto-Play: ON" when Random quote every minute setting is ticked
1 parent 0e346fc commit 6af1284

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

Sprint-3/quote-generator/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
Random quote every minute
2323
</label>
2424
</div>
25-
2625
</blockquote>
26+
<p id="autoplay-status">Auto-Play: ON</p>
2727
</body>
2828
</html>

Sprint-3/quote-generator/quotes.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,13 +506,16 @@ document.getElementById("new-quote").addEventListener("click", () => {
506506
let autoQuoteIntervalID = null;
507507

508508
document.getElementById("auto-quote").addEventListener("change", function () {
509+
const autoplayStatus = document.getElementById("autoplay-status");
510+
509511
if (this.checked) {
510-
newRandomQuote();
511512
const oneMinute = 60 * 1000;
512513
autoQuoteIntervalID = setInterval(newRandomQuote, oneMinute);
514+
autoplayStatus.style.display = "block";
513515
} else {
514516
clearInterval(autoQuoteIntervalID);
515517
autoQuoteIntervalID = null;
518+
autoplayStatus.style.display = "none";
516519
}
517520
});
518521

Sprint-3/quote-generator/style.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,19 @@ body {
8282
.auto-refresh input {
8383
transform: scale(1.2);
8484
margin-right: 10px;
85+
}
86+
87+
#autoplay-status {
88+
position: fixed;
89+
bottom: 10px;
90+
right: 15px;
91+
font-size: 1rem;
92+
color: white;
93+
background: rgba(0, 0, 0, 0.4);
94+
padding: 6px 10px;
95+
border-radius: 5px;
96+
display: none;
97+
/* hidden by default */
98+
pointer-events: none;
99+
/* so clicks pass through */
85100
}

0 commit comments

Comments
 (0)