Fix splash for subtitles
This commit is contained in:
parent
df99ead67a
commit
cd515ec8d9
|
@ -1,4 +1,5 @@
|
||||||
const a = [
|
/** Subtitles dusplayed under site title in navbar. */
|
||||||
|
const subtitles = [
|
||||||
"Playtime's over, playtime's now",
|
"Playtime's over, playtime's now",
|
||||||
"永遠のオデッセイ",
|
"永遠のオデッセイ",
|
||||||
"0% code coverage",
|
"0% code coverage",
|
||||||
|
@ -40,6 +41,12 @@ const a = [
|
||||||
"a2Ftb3NoaS5vcmc=",
|
"a2Ftb3NoaS5vcmc=",
|
||||||
":: (Thought a) => a -> String",
|
":: (Thought a) => a -> String",
|
||||||
];
|
];
|
||||||
a.push(`${Math.round(1 / a.length * 10000)/100}% chance for this message`);
|
|
||||||
const target = document.getElementById("p-nav-splash");
|
const chance = Math.round(1 / (subtitles.length + 1) * 10000) / 100;
|
||||||
target && (target.innerText = a[Math.floor(Math.random() * a.length)]);
|
subtitles.push(`${chance}% chance for this message`);
|
||||||
|
|
||||||
|
export function bindSubtitle() {
|
||||||
|
const target = document.getElementById("p-nav-splash");
|
||||||
|
const choice = subtitles[Math.floor(Math.random() * subtitles.length)];
|
||||||
|
target && (target.innerText = choice);
|
||||||
|
}
|
|
@ -68,3 +68,9 @@ const menu: MenuItem[] = [
|
||||||
))}
|
))}
|
||||||
</menu>
|
</menu>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { bindSubtitle } from "../../assets/splash"
|
||||||
|
|
||||||
|
bindSubtitle();
|
||||||
|
</script>
|
Loading…
Reference in a new issue