diff --git a/homepage/index.html b/homepage/index.html index 0dc058e..6e8733c 100644 --- a/homepage/index.html +++ b/homepage/index.html @@ -25,6 +25,7 @@ window.onload = function(){ window.initializesheets(); window.quotes_initialize(); + window.quote_new(); }; //--> diff --git a/homepage/js/quotes.js b/homepage/js/quotes.js index 7fd8f13..a02d395 100644 --- a/homepage/js/quotes.js +++ b/homepage/js/quotes.js @@ -1,9 +1,12 @@ /* quotes.js; Deven Blake 2021-2022; Public Domain */ /* With thanks to Ками on Discord. */ /* To use: - * - * - add two elements with the IDs QUOTE_AUTHOR_ID (see code) and * QUOTE_VALUE_ID (see code) respectively + * - make a JSON file with a "quotes" object that's an array of arrays + * (see code) + * - change window.QUOTES_FILE_LOCATION to wherever you put it + * - window.quotes_initialize(); * - use window.quote_new() to get a new quote. */ /* firefox doesn't support import assertions yet (2022-02-20; fx 97.0) */ @@ -16,7 +19,10 @@ window.QUOTES_QUOTE_AUTHOR_PREFIX = "~ "; window.QUOTES_QUOTE_VALUE_ID = "quote_value"; window.quotes_initialize = function(){ - fetch(window.QUOTES_FILE_LOCATION).then(response => {return response.json();}).then(data => window.quotes = data["quotes"]); + /* Weird JavaScript web voodoo. */ + fetch(window.QUOTES_FILE_LOCATION) + .then(response => {return response.json();}) + .then(data => window.quotes = data["quotes"]); }; /* Will not give you the same quote twice in a row! */