Dynamically get pride flags

This commit is contained in:
MeowcaTheoRange 2023-11-30 20:55:43 -06:00
parent 82f0d288ab
commit b37943ff12
3 changed files with 21 additions and 6 deletions

View file

@ -57,12 +57,7 @@
></small
>
</p>
<button
onclick="initDocument(['7F7F7F','C3C3C3','9AD9EA','FFFFFF','9AD9EA','C3C3C3','7F7F7F'], 300, 200, 'vert', 'Demiboy');
initDocument(['FF218C','FFD800','21B1FF'], 300, 200, 'vert', 'Pansexual')"
>
Cool Flags
</button>
<button id="buttonflags" disabled>Cool Flags</button>
</section>
<section id="fields"></section>
</main>

View file

@ -3,6 +3,7 @@ const time = document.getElementById("time");
const weekday = document.getElementById("weekday");
const timezone = document.getElementById("timezone");
const nofetchy = document.getElementById("no-fetchy");
const buttonflags = document.getElementById("buttonflags");
const fields = document.getElementById("fields");
fetch("https://pronouns.cc/api/v1/users/MeowcaTheoRange")
.then((x) => x.json())
@ -19,6 +20,19 @@ fetch("https://pronouns.cc/api/v1/users/MeowcaTheoRange")
timezone.innerHTML = `(UTC${user.utc_offset > 0 ? "+" : "-"}${Math.abs(
user.utc_offset / (60 * 60)
)})`;
buttonflags.onclick = () => {
user.flags.forEach((flag) => {
const props = flag.description.split(";");
initDocument(
props[0].split(","),
props[1],
props[2],
props[3],
flag.name
);
});
};
buttonflags.disabled = false;
function updateTime() {
curTime.setTime(
Date.now() -

View file

@ -228,6 +228,12 @@ input[type="submit"]:active,
input[type="reset"]:active {
opacity: 0.5;
}
button:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled,
input[type="reset"]:disabled {
opacity: 0.5;
}
/* -- Checkbox styling */