MCPcopy Create free account
hub / github.com/codemistic/Web-Development / printQuote

Function printQuote

RandomQuoteGenerator/js/script.js:184–195  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

182//Function to call the getRandomQuote function and stores the returned quote object in a variable
183//Constructs a string containing the different properties of the quote object
184function printQuote () {
185 var quotes = getRandomQuote ();
186 var quoteContainer = document.getElementById("quote-box");
187 var quoteString = `<p class="quote">${quotes.quote}</p><p class="source">${quotes.source}`;
188 if (quotes.citation) {quoteString += `<span class="citation">${quotes.citation}</span>`}
189 if (quotes.year) {quoteString += `<span class="year">${quotes.year}</span></p>`}
190 else {quoteString += '</p>'};
191 quoteContainer.innerHTML = quoteString;
192
193 //assigns random color value to document background color
194 document.body.style.backgroundColor = getRandomColor ();
195}
196
197//Quote automatically refreshes every 15 seconds
198window.setInterval(function(){

Callers 1

script.jsFile · 0.85

Calls 2

getRandomQuoteFunction · 0.85
getRandomColorFunction · 0.70

Tested by

no test coverage detected