USISimulator/simulator.js
2018-11-27 08:50:11 +01:00

68 lines
1.7 KiB
JavaScript

var looper;
var images = ["bavota.png", "nystrom.png", "langhhhhhhhhheeeeinrichhhhhh.png"];
var quotes = [
"ummmm...",
"you know...",
"funky quiz",
"funky feedback",
"funky gates",
"close your laptops",
"hands on",
"frugal maps",
"null is the devil",
"haskell is better",
"for some definitions of fun",
"accumulators > loops",
"bogosort > bubblesort",
"logisim",
"mic-1",
"maxima",
"proof by contradiction",
"proof by induction",
"exactly what we need to show",
"but we need to prove it",
"what did we do last week?",
"someone else?",
"Bin, is the hands-on online?",
"Guys please",
"check-expect or die",
"Trees!",
"without loss of generality",
"1 > 0",
"what is a for loop?",
"donald trump",
"zero one one one zero zero zero one zero one",
"Now we'll show proof that 1 > 0",
"[TELL ME]"
"Supercomplilation"
];
document.addEventListener("DOMContentLoaded", setup);
function setup() {
changeImages();
window.setInterval(changeImages, 15 * (360 / 5));
changeQuotes(250, 10);
document.getElementById("img1").removeAttribute("style");
document.getElementById("img2").removeAttribute("style");
document.getElementById("img3").removeAttribute("style");
}
var imageOffset = 0;
function changeImages() {
for (var i = 1; i < 4; i++)
document.getElementById("img" + i).src = images[(i+imageOffset) % 3];
imageOffset++;
}
var quote = 0;
function changeQuotes(time, offset) {
quote += 1 + Math.floor(Math.random() * (quotes.length - 2));
quote = quote % quotes.length;
document.getElementById("quote").innerHTML =
quotes[quote];
window.setTimeout(function() {
changeQuotes(time, offset);
}, offset + time * Math.sqrt(quotes[quote].length));
}