quotes may actually work now
This commit is contained in:
parent
4b040fa5fa
commit
cfe28f6f39
@ -25,6 +25,7 @@
|
|||||||
window.onload = function(){
|
window.onload = function(){
|
||||||
window.initializesheets();
|
window.initializesheets();
|
||||||
window.quotes_initialize();
|
window.quotes_initialize();
|
||||||
|
window.quote_new();
|
||||||
};
|
};
|
||||||
//--></SCRIPT>
|
//--></SCRIPT>
|
||||||
|
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
/* quotes.js; Deven Blake 2021-2022; Public Domain */
|
/* quotes.js; Deven Blake 2021-2022; Public Domain */
|
||||||
/* With thanks to Ками on Discord. */
|
/* With thanks to Ками on Discord. */
|
||||||
/* To use:
|
/* To use:
|
||||||
* - <SCRIPT SRC="quotes.js" TYPE="module"></SCRIPT>
|
|
||||||
* - add two elements with the IDs QUOTE_AUTHOR_ID (see code) and
|
* - add two elements with the IDs QUOTE_AUTHOR_ID (see code) and
|
||||||
* QUOTE_VALUE_ID (see code) respectively
|
* 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. */
|
* - use window.quote_new() to get a new quote. */
|
||||||
|
|
||||||
/* firefox doesn't support import assertions yet (2022-02-20; fx 97.0) */
|
/* 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_QUOTE_VALUE_ID = "quote_value";
|
||||||
|
|
||||||
window.quotes_initialize = function(){
|
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! */
|
/* Will not give you the same quote twice in a row! */
|
||||||
|
Loading…
Reference in New Issue
Block a user