From df37abdba0cdb065fd479876b3dff8b37cd3632a Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Sun, 8 Mar 2026 19:00:42 +0000 Subject: [PATCH 01/13] update title --- Sprint-3/quote-generator/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..5f6a720f1 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,7 +3,7 @@ - Title here + Quote generator app From 31fcc7d0bc3c07775ca038a4e26f7168186cfb55 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Mon, 9 Mar 2026 08:51:27 +0000 Subject: [PATCH 02/13] Add functionality to display a random quote on page load --- Sprint-3/quote-generator/quotes.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..4eab02865 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -20,6 +20,8 @@ function pickFromArray(choices) { return choices[Math.floor(Math.random() * choices.length)]; } + + // A list of quotes you can use in your app. // DO NOT modify this array, otherwise the tests may break! const quotes = [ @@ -491,3 +493,10 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote + +//window.addEventListener("load",pickFromArray(quotes)) +const randomQuote = pickFromArray(quotes); +const quote=document.getElementById("quote") +const author=document.getElementById("author") +quote.innerText=randomQuote.quote +author.innerText=randomQuote.author From 670779a25e26822edc1486182edcb02e862dcfbb Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Mon, 9 Mar 2026 09:37:51 +0000 Subject: [PATCH 03/13] add button functionality for new quotes --- Sprint-3/quote-generator/quotes.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4eab02865..703d83fe0 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -20,8 +20,6 @@ function pickFromArray(choices) { return choices[Math.floor(Math.random() * choices.length)]; } - - // A list of quotes you can use in your app. // DO NOT modify this array, otherwise the tests may break! const quotes = [ @@ -494,9 +492,21 @@ const quotes = [ // call pickFromArray with the quotes array to check you get a random quote -//window.addEventListener("load",pickFromArray(quotes)) const randomQuote = pickFromArray(quotes); -const quote=document.getElementById("quote") -const author=document.getElementById("author") -quote.innerText=randomQuote.quote -author.innerText=randomQuote.author + +const quote = document.getElementById("quote"); +quote.innerText = randomQuote.quote; + +const author = document.getElementById("author"); +author.innerText = randomQuote.author; + +const button = document.getElementById("new-quote"); +button.addEventListener("click", () => { + const randomQuote = pickFromArray(quotes); + + const quote = document.getElementById("quote"); + quote.innerText = randomQuote.quote; + + const author = document.getElementById("author"); + author.innerText = randomQuote.author; +}); From 0015e404bc3543a418a8b5273924c0ca7394a071 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Mon, 9 Mar 2026 11:18:31 +0000 Subject: [PATCH 04/13] replace pickFromArray with direct random selection from quotes array --- Sprint-3/quote-generator/quotes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 703d83fe0..94af3c242 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -492,7 +492,7 @@ const quotes = [ // call pickFromArray with the quotes array to check you get a random quote -const randomQuote = pickFromArray(quotes); +const randomQuote = quotes[Math.floor(Math.random()*quotes.length)]; const quote = document.getElementById("quote"); quote.innerText = randomQuote.quote; @@ -502,7 +502,7 @@ author.innerText = randomQuote.author; const button = document.getElementById("new-quote"); button.addEventListener("click", () => { - const randomQuote = pickFromArray(quotes); + const randomQuote =quotes[Math.floor(Math.random()*quotes.length)]; const quote = document.getElementById("quote"); quote.innerText = randomQuote.quote; From be903f2ce6e2a2b62aa496a414aa0fde4bc402a4 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Mon, 9 Mar 2026 16:36:21 +0000 Subject: [PATCH 05/13] Add auto-play functionality to display quotes at intervals --- Sprint-3/quote-generator/quotes.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 94af3c242..9ecfb16cb 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -510,3 +510,25 @@ button.addEventListener("click", () => { const author = document.getElementById("author"); author.innerText = randomQuote.author; }); + +function chooseQuote(){ + const randomQuote = quotes[Math.floor(Math.random() * quotes.length)]; + + const quote = document.getElementById("quote"); + quote.innerText = randomQuote.quote; + + const author = document.getElementById("author"); + author.innerText = randomQuote.author; +} +const autoGenerate = document.getElementById("auto-play-toggle"); +let interval = null; +autoGenerate.addEventListener("change",()=>{ + + if(autoGenerate.checked){ + interval=setInterval(chooseQuote,2000) + }else{ + clearInterval(interval) + interval=null + } +}) + From 17571ba03204d0e7d62049a6d36a1888a73cdd70 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Mon, 9 Mar 2026 16:36:35 +0000 Subject: [PATCH 06/13] Fix HTML doctype and add auto-generate toggle checkbox --- Sprint-3/quote-generator/index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 5f6a720f1..a31ca66c6 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -1,4 +1,4 @@ - + @@ -7,6 +7,9 @@ +

hello there

From ea60dd5a3d3f89c80ac2ddf8f96c1b2c3ced1ba1 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Mon, 9 Mar 2026 16:43:56 +0000 Subject: [PATCH 07/13] Refactor quote selection logic into a reusable function and update event listeners for better readability --- Sprint-3/quote-generator/quotes.js | 41 ++++++++++-------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 9ecfb16cb..abdd39192 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -492,43 +492,28 @@ const quotes = [ // call pickFromArray with the quotes array to check you get a random quote -const randomQuote = quotes[Math.floor(Math.random()*quotes.length)]; - -const quote = document.getElementById("quote"); -quote.innerText = randomQuote.quote; - -const author = document.getElementById("author"); -author.innerText = randomQuote.author; - -const button = document.getElementById("new-quote"); -button.addEventListener("click", () => { - const randomQuote =quotes[Math.floor(Math.random()*quotes.length)]; +function chooseQuote() { + const randomQuote = quotes[Math.floor(Math.random() * quotes.length)]; const quote = document.getElementById("quote"); quote.innerText = randomQuote.quote; const author = document.getElementById("author"); author.innerText = randomQuote.author; -}); +} -function chooseQuote(){ - const randomQuote = quotes[Math.floor(Math.random() * quotes.length)]; +window.addEventListener("load", chooseQuote); - const quote = document.getElementById("quote"); - quote.innerText = randomQuote.quote; +const button = document.getElementById("new-quote"); +button.addEventListener("click", chooseQuote); - const author = document.getElementById("author"); - author.innerText = randomQuote.author; -} const autoGenerate = document.getElementById("auto-play-toggle"); let interval = null; -autoGenerate.addEventListener("change",()=>{ - - if(autoGenerate.checked){ - interval=setInterval(chooseQuote,2000) - }else{ - clearInterval(interval) - interval=null +autoGenerate.addEventListener("change", () => { + if (autoGenerate.checked) { + interval = setInterval(chooseQuote, 2000); + } else { + clearInterval(interval); + interval = null; } -}) - +}); From 405bec99f949fc18e2979e248dfc359e4246af1a Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Fri, 20 Mar 2026 20:16:51 +0000 Subject: [PATCH 08/13] Refactor quote selection to use pickFromArray for improved randomness --- Sprint-3/quote-generator/quotes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index abdd39192..51f8b7012 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -493,7 +493,7 @@ const quotes = [ // call pickFromArray with the quotes array to check you get a random quote function chooseQuote() { - const randomQuote = quotes[Math.floor(Math.random() * quotes.length)]; + const randomQuote = pickFromArray(quotes) const quote = document.getElementById("quote"); quote.innerText = randomQuote.quote; From 828dc035233e1015edba8ca56f11a1259cef9dc9 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Fri, 20 Mar 2026 20:27:58 +0000 Subject: [PATCH 09/13] Fix null checks for quote and author elements and refactor interval variable for auto-generate functionality --- Sprint-3/quote-generator/quotes.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 51f8b7012..4c2d357c5 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -496,10 +496,13 @@ function chooseQuote() { const randomQuote = pickFromArray(quotes) const quote = document.getElementById("quote"); + if(quote!==null){ quote.innerText = randomQuote.quote; - + } const author = document.getElementById("author"); + if(author!==null){ author.innerText = randomQuote.author; + } } window.addEventListener("load", chooseQuote); @@ -510,8 +513,9 @@ button.addEventListener("click", chooseQuote); const autoGenerate = document.getElementById("auto-play-toggle"); let interval = null; autoGenerate.addEventListener("change", () => { + let changeQuoteInterval=2000 if (autoGenerate.checked) { - interval = setInterval(chooseQuote, 2000); + interval = setInterval(chooseQuote, changeQuoteInterval); } else { clearInterval(interval); interval = null; From f41fe77ce5b754318e160ab5b301ec76fa053ce1 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Fri, 20 Mar 2026 20:28:39 +0000 Subject: [PATCH 10/13] Use textContent instead of innerText for quote and author elements --- Sprint-3/quote-generator/quotes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4c2d357c5..85f7a5022 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -497,11 +497,11 @@ function chooseQuote() { const quote = document.getElementById("quote"); if(quote!==null){ - quote.innerText = randomQuote.quote; + quote.textContent = randomQuote.quote; } const author = document.getElementById("author"); if(author!==null){ - author.innerText = randomQuote.author; + author.textContent = randomQuote.author; } } From da857e3dd0a06d9deb2923dcb30fdb92ba1547ec Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Sun, 12 Apr 2026 21:20:47 +0100 Subject: [PATCH 11/13] Fix formatting and improve readability in chooseQuote function --- Sprint-3/quote-generator/quotes.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 85f7a5022..8843d98c2 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -493,15 +493,15 @@ const quotes = [ // call pickFromArray with the quotes array to check you get a random quote function chooseQuote() { - const randomQuote = pickFromArray(quotes) + const randomQuote = pickFromArray(quotes); const quote = document.getElementById("quote"); - if(quote!==null){ - quote.textContent = randomQuote.quote; + if (quote !== null) { + quote.textContent = randomQuote.quote; } const author = document.getElementById("author"); - if(author!==null){ - author.textContent = randomQuote.author; + if (author !== null) { + author.textContent = randomQuote.author; } } @@ -513,7 +513,7 @@ button.addEventListener("click", chooseQuote); const autoGenerate = document.getElementById("auto-play-toggle"); let interval = null; autoGenerate.addEventListener("change", () => { - let changeQuoteInterval=2000 + let changeQuoteInterval = 2000; if (autoGenerate.checked) { interval = setInterval(chooseQuote, changeQuoteInterval); } else { From a17fc2bd968490c460386fc12a055cbbf666e146 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Sun, 12 Apr 2026 21:28:53 +0100 Subject: [PATCH 12/13] Fix formatting and spacing in auto-generate event listener --- Sprint-3/quote-generator/quotes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 8843d98c2..9a8b8bdeb 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -516,8 +516,8 @@ autoGenerate.addEventListener("change", () => { let changeQuoteInterval = 2000; if (autoGenerate.checked) { interval = setInterval(chooseQuote, changeQuoteInterval); - } else { + } else { clearInterval(interval); interval = null; } -}); + }); From e0c8d35caf66e72efdae95a3adf0af85982c4905 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Thu, 16 Apr 2026 19:25:49 +0100 Subject: [PATCH 13/13] delete unnecessary code --- Sprint-3/quote-generator/quotes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 9a8b8bdeb..46257b705 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -518,6 +518,6 @@ autoGenerate.addEventListener("change", () => { interval = setInterval(chooseQuote, changeQuoteInterval); } else { clearInterval(interval); - interval = null; + } });