random pronouns!
parent
f5ff2a1664
commit
791d3b9cee
@ -1,5 +1,5 @@
|
||||
baseURL = "https://zoe.kittycat.homes/"
|
||||
languageCode = "eng"
|
||||
title = "batsite"
|
||||
title = "bat"
|
||||
theme = "battheme"
|
||||
sectionPagesMenu = "main"
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { updateMode } from "./lightmode.js";
|
||||
import { activateHamburger } from "./hamburger.js";
|
||||
import { randomizeWords } from "./randomword.js";
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
updateMode();
|
||||
activateHamburger();
|
||||
randomizeWords();
|
||||
});
|
||||
|
@ -0,0 +1,31 @@
|
||||
const buttons = document.getElementsByClassName("randomword-button");
|
||||
|
||||
export function randomizeWords() {
|
||||
registerButtons();
|
||||
}
|
||||
|
||||
function registerButtons() {
|
||||
for (let button of buttons) {
|
||||
button.addEventListener("click", function () {
|
||||
let new_word = processWordlist(button.getAttribute("data-wordlist"));
|
||||
// do this so people dont have to click twice
|
||||
if (button.innerHTML == new_word) {
|
||||
button.click();
|
||||
console.log("oh no!!! this was already the value!");
|
||||
} else {
|
||||
button.innerHTML = new_word;
|
||||
}
|
||||
});
|
||||
button.click();
|
||||
}
|
||||
}
|
||||
|
||||
// takes all the words and returns only one
|
||||
function processWordlist(wordlist) {
|
||||
let seperated = wordlist.split(",");
|
||||
return seperated.random();
|
||||
}
|
||||
|
||||
Array.prototype.random = function () {
|
||||
return this[Math.floor(Math.random() * this.length)];
|
||||
};
|
@ -1 +1 @@
|
||||
Subproject commit 26372fdcca121d7d9a5b5ae4c4259efd1bbc69f3
|
||||
Subproject commit d267fc4356534ddb02426ef7e6802848580a8579
|
Loading…
Reference in New Issue