improvements
This commit is contained in:
parent
c7165ec051
commit
5cb7412575
12 changed files with 105 additions and 32 deletions
14
js/script.js
Normal file
14
js/script.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
// This sucks but works.
|
||||
function getRandomLine(file) {
|
||||
return fetch(file)
|
||||
.then(res => res.text())
|
||||
.then(text => {
|
||||
const lines = text.trim().split('\n');
|
||||
const randomIndex = Math.floor(Math.random() * lines.length);
|
||||
return lines[randomIndex];
|
||||
});
|
||||
}
|
||||
|
||||
getRandomLine("/assets/messages.txt").then(line => {
|
||||
document.getElementById("qotd").innerHTML = line;
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue