you can now play... The Lynne Quiz.

This commit is contained in:
Lynne Megido 2020-03-26 00:13:08 +10:00
parent bfac02d8e1
commit ce0052fc0c
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90
4 changed files with 154 additions and 8 deletions

View file

@ -0,0 +1,86 @@
// @license magnet:?xt=urn:btih:5305d91886084f776adcf57509a648432709a7c7&dn=x11.txt X11 License
// checking the source code is cheating and now your score is null and void >:c
var questions = {
"have never broken a bone": false,
"like Banjo Kazooie: Nuts & Bolts": true,
"tell people who say \"Linux\" that it's actually \"GNU/Linux\"": false,
"have never broken a bone": false,
"joined the Fediverse in August 2018": true,
"have a habit of buying domain names that I never use": true,
"have mixed up the phrases \"Middle Earth\" and \"Middle East\" several times": true,
"am lactose intolerant": true,
"have never seen a rabbit in real life": true,
"have never seen a sheep in real life": false,
"chew my nails": true,
"am the only person on fedi.lynnesbian.space": false,
"often mix up my lefts and rights": true,
"main Isabelle in Smash Ultimate": false,
"main Mii Swordfighter in Smash Ultimate": true,
"have accidentally stolen a library book before": true,
"am allergic to gluten": true,
"can draw The Cool S": false,
"have written several games for the TI-84+ calculator": true,
"can play the trumpet": true,
"can play the ukelele": false,
"never have to look at the keyboard when typing": false,
"have never owned an Apple device": false,
"have never used FaceBook": false,
"do not particularly care for the way LibreJS requires you to annotate your JavaScript files": true,
"have walked into a tree while reading a book": true,
"have walked into a tree while using my phone": false,
"live and die by vim": false,
"live and die by emacs": false,
"have a truck driver's license": false,
}
var ranks = [
"The AntiLynne",
"Poop martial",
"Twitter crossposter",
"Fake gamer",
"CLASS D LICENSE",
"Coin flipper",
"Much to learn",
"Lucky number sevlynne",
"Long leggy creacher",
"The Seer",
"Gosh Amongst Mortals" // unless you read the JS, in which case you are a poop martial
]
var score = 0;
var answered = 0;
var ready = false;
var current = null;
function next_question(butotn) {
let correct = null;
let gamediv = dgel('quiz');
if (!ready) {
ready = true;
} else {
correct = butotn.classList.contains("true") == questions[current]
if (correct) { score++; }
answered++;
}
delete questions[current];
if (answered < 10) {
// https://stackoverflow.com/a/15106541
var qkeys = Object.keys(questions);
current = qkeys[qkeys.length * Math.random() << 0];
gamediv.innerHTML = `<div class='quiz-popup ${correct}'></div><h2>Question ${answered + 1}</h2><p>True or false: I ${current}.</p><div id='quiz-buttons'><button class='true' onclick='next_question(this)'>True</button><button class='false' onclick='next_question(this)'>False</button></div>`;
} else {
gamediv.innerHTML = `<div class='quiz-popup ${correct}'></div><h2>Finish!</h2><p>You got ${score} points, earning you the rank of "${ranks[score]}"! Thanks for playing!</p><a class='button' onclick='window.location=window.location'>Play again</a>`;
}
}
window.addEventListener('DOMContentLoaded', (event) => {
dgel('quiz-questions').innerHTML = Object.keys(questions).length;
dgel('quiz-start').onclick = next_question;
});
// @license-end

View file

@ -2,7 +2,6 @@
var use_local_storage = storage_check();
var html_element = null;
function dgel(id) {
return document.getElementById(id);
}

View file

@ -232,6 +232,57 @@ html.night #theme-control::before {
content: "Theme: Night";
}
button, a.button {
background: mediumpurple;
border: none;
cursor: pointer;
color: white;
font-size: 1.3em;
padding: 10px;
margin: 0 20px;
min-width: 100px;
}
#quiz {
text-align: center;
position: relative;
}
.quiz-popup:not(.null) {
display: block;
position: absolute;
color: white;
top: 0;
left: 0;
right: 0;
bottom: 0;
font-size: 3em;
padding-top: 40px;
animation: quiz-popup-fadeout 0.25s 0.25s linear forwards;
animation-fill-mode: forwards;
}
.quiz-popup.true {
background: #0c9;
}
.quiz-popup.true::before {
content: "Correct!";
}
.quiz-popup.false {
background: #c03;
}
.quiz-popup.false::before {
content: "Incorrect!";
}
@keyframes quiz-popup-fadeout {
0% {
opacity: 1;
}
100% {
opacity: 0;
pointer-events: none;
}
}
/*this is very silly do not look*/
#big-leggy-lynne {
margin: 40px auto 0;
@ -253,16 +304,10 @@ html.night #theme-control::before {
#bll-bottom {
background: url('/assets/img/bll-send-pics.png');
}
#bll-enlarge {
background: mediumpurple;
border: none;
cursor: pointer;
color: white;
font-size: 2em;
padding: 10px;
margin: 30px auto;
display: block;
margin: 30px auto;
}
@media only screen and (max-width: 1200px) {

16
quiz.html Normal file
View file

@ -0,0 +1,16 @@
---
title: Quiz
layout: default
less_important: true
---
<script src='/assets/big-thicc-quiz-of-the-lynne.js'></script>
<h1>The Lynne Quiz</h1>
<div id='quiz'>
<h2>Welcome!</h2>
<p>
Hello and welcome to The Lynne Quiz! You will be presented with 10 of a possible <span id='quiz-questions'>PLEASE ENABLE JAVASCRIPT</span> true or false questions. Your job is to answer as many of them as accurately as you can! Find out how well you truly know the bune behind it all.
</p>
<button id='quiz-start'>Button that starts the quiz</button>
</div>