From 62522b076fe887f8327cb18ec02d157d8ff8aa32 Mon Sep 17 00:00:00 2001
From: hasandemiroz <64849417+hasandemiroz@users.noreply.github.com>
Date: Sat, 12 Apr 2025 15:40:00 +0100
Subject: [PATCH] current branch merge with updated main
---
.../quote-generator/Quote_generator_app.html | 27 +++++++++++++++++++
Sprint-3/quote-generator/index.html | 15 -----------
Sprint-3/quote-generator/quotes.js | 26 ++++++++++++++++++
Sprint-3/quote-generator/style.css | 23 ++++++++++++++++
4 files changed, 76 insertions(+), 15 deletions(-)
create mode 100644 Sprint-3/quote-generator/Quote_generator_app.html
delete mode 100644 Sprint-3/quote-generator/index.html
diff --git a/Sprint-3/quote-generator/Quote_generator_app.html b/Sprint-3/quote-generator/Quote_generator_app.html
new file mode 100644
index 000000000..224d370bd
--- /dev/null
+++ b/Sprint-3/quote-generator/Quote_generator_app.html
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+ Quote Generator
+
+
+
+
+
+
+
+
Hello There!!!
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html
deleted file mode 100644
index 30b434bcf..000000000
--- a/Sprint-3/quote-generator/index.html
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
- Title here
-
-
-
- hello there
-
-
-
-
-
diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js
index 4a4d04b72..b21ea1a1e 100644
--- a/Sprint-3/quote-generator/quotes.js
+++ b/Sprint-3/quote-generator/quotes.js
@@ -15,6 +15,12 @@
// ---------------
// pickFromArray(['a','b','c','d']) // maybe returns 'c'
+const quoteElement = document.getElementById("quote");
+const authorElement = document.getElementById("author");
+const newQuoteButton = document.getElementById("new-quote");
+const checkBox = document.getElementById("autoOnOff");
+const onOffDisplay = document.getElementById("onOff");
+
// You don't need to change this function
function pickFromArray(choices) {
return choices[Math.floor(Math.random() * choices.length)];
@@ -491,3 +497,23 @@ const quotes = [
];
// call pickFromArray with the quotes array to check you get a random quote
+function displayRandomQuote() {
+ const randomQuote = pickFromArray(quotes);
+ quoteElement.textContent = randomQuote.quote;
+ authorElement.textContent = `- ${randomQuote.author}`;
+}
+
+let interval;
+function autoPlayer(){
+ if (checkBox.checked){
+ onOffDisplay.innerText = `Auto-play is On`;
+ interval = setInterval(displayRandomQuote, 60000);
+ } else {
+ onOffDisplay.innerText = `Auto-play is Off`;
+ clearInterval(interval)
+ }
+}
+
+displayRandomQuote();
+newQuoteButton.addEventListener("click", displayRandomQuote);
+checkBox.addEventListener("change", autoPlayer);
diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css
index 63cedf2d2..e8478dab8 100644
--- a/Sprint-3/quote-generator/style.css
+++ b/Sprint-3/quote-generator/style.css
@@ -1 +1,24 @@
/** Write your CSS in here **/
+body{
+ padding: 100px;
+ background-color: orange;
+}
+
+#sentence{
+ border: 40px solid whitesmoke;
+ background-color: whitesmoke;
+ font-size: 200%;
+}
+
+#author{
+ float: right;
+ margin-left: 10px;
+}
+
+
+button{
+ background-color: orange;
+ width: 150px;
+ height: 70px;
+ font-size: 80%;
+}