mirror of https://github.com/dirtbags/moth.git
Move most legacy web files into new locations
This commit is contained in:
parent
811307b8ce
commit
b3577564fa
|
@ -33,7 +33,7 @@ function koth.page(title, body)
|
|||
print()
|
||||
end
|
||||
print("<!DOCTYPE html>")
|
||||
print("<html><head><title>" .. title .. "</title><link rel=\"stylesheet\" href=\"../style.css\"><meta name=\"viewport\" content=\"width=device-width\"></head>")
|
||||
print("<html><head><title>" .. title .. "</title><link rel=\"stylesheet\" href=\"../css/style.css\"><meta name=\"viewport\" content=\"width=device-width\"></head>")
|
||||
print("<body><h1>" .. title .. "</h1>")
|
||||
if (body) then
|
||||
print("<section>")
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<title>The Credits</title>
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css">
|
||||
<script>
|
||||
function shuf (ul) {
|
||||
var lists = document.getElementsByClassName("shuf");
|
||||
|
|
|
@ -6,10 +6,10 @@ Light brown: #432115
|
|||
Tan: #e1caa5
|
||||
*/
|
||||
|
||||
@import "fonts/maven_pro.css";
|
||||
@import "../fonts/maven_pro.css";
|
||||
|
||||
html {
|
||||
background: #35170c url(images/background.png) no-repeat center center fixed;
|
||||
background: #35170c url(../images/background.png) no-repeat center center fixed;
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
-o-background-size: cover;
|
|
@ -4,16 +4,16 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="stylesheet" href="res/style.css">
|
||||
<link rel="icon" href="res/luna-moth.svg" type="image/svg+xml">
|
||||
<link rel="icon" href="res/luna-moth.png" type="image/png">
|
||||
<link rel="icon" href="images/luna-moth.svg" type="image/svg+xml">
|
||||
<link rel="icon" href="images/luna-moth.png" type="image/png">
|
||||
|
||||
<script src="res/common.js"></script>
|
||||
<script src="res/terminal.js"></script>
|
||||
<script src="res/overview.js"></script>
|
||||
<script src="res/messages.js"></script>
|
||||
<script src="res/puzzles.js"></script>
|
||||
<script src="res/main.js"></script>
|
||||
<script src="res/md5.min.js" async></script>
|
||||
<script src="js/common.js"></script>
|
||||
<script src="js/terminal.js"></script>
|
||||
<script src="js/overview.js"></script>
|
||||
<script src="js/messages.js"></script>
|
||||
<script src="js/puzzles.js"></script>
|
||||
<script src="js/main.js"></script>
|
||||
<script src="js/md5.min.js" async></script>
|
||||
|
||||
<title>MOTH Dashboard</title>
|
||||
</head>
|
||||
|
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>Welcome</title>
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>MOTH</h1>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<title>Scoreboard</title>
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<script src="scoreboard.js" async></script>
|
||||
<script src="js/scoreboard.js" async></script>
|
||||
<style>
|
||||
body, html {
|
||||
width: 100%;
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
<head>
|
||||
<title>Open Puzzles</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css">
|
||||
<link rel="stylesheet" href="res/style.css">
|
||||
<link rel="icon" href="res/luna-moth.svg" type="image/svg+xml">
|
||||
<link rel="icon" href="res/luna-moth.png" type="image/png">
|
||||
<link rel="icon" href="images/luna-moth.svg" type="image/svg+xml">
|
||||
<link rel="icon" href="images/luna-moth.png" type="image/png">
|
||||
|
||||
<script src="res/common.js"></script>
|
||||
<script src="res/terminal.js"></script>
|
||||
<script src="res/puzzles.js"></script>
|
||||
<script src="js/common.js"></script>
|
||||
<script src="js/terminal.js"></script>
|
||||
<script src="js/puzzles.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Open Puzzles</h1>
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
<head>
|
||||
<title>Open Puzzles</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css">
|
||||
<link rel="stylesheet" href="res/style.css">
|
||||
<link rel="icon" href="res/luna-moth.svg" type="image/svg+xml">
|
||||
<link rel="icon" href="res/luna-moth.png" type="image/png">
|
||||
<link rel="icon" href="images/luna-moth.svg" type="image/svg+xml">
|
||||
<link rel="icon" href="images/luna-moth.png" type="image/png">
|
||||
|
||||
<script src="res/common.js"></script>
|
||||
<script src="res/terminal.js"></script>
|
||||
<script src="res/puzzles.js"></script>
|
||||
<script src="js/common.js"></script>
|
||||
<script src="js/terminal.js"></script>
|
||||
<script src="js/puzzles.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Open Puzzles</h1>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<title>Team Registration</title>
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Team Registration</h1>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Scoreboard</title>
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css">
|
||||
<style>
|
||||
#info {
|
||||
max-width: 20em;
|
||||
|
@ -13,8 +13,8 @@
|
|||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<script src="d3.js" async></script>
|
||||
<script src="scoreboard-llnl.js" async></script>
|
||||
<script src="js/d3.js" async></script>
|
||||
<script src="js/scoreboard-llnl.js" async></script>
|
||||
<script>
|
||||
|
||||
var type = "original";
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Scoreboard</title>
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css">
|
||||
<style>
|
||||
#info {
|
||||
max-width: 20em;
|
||||
|
@ -13,8 +13,8 @@
|
|||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<script src="d3.js" async></script>
|
||||
<script src="scoreboard-llnl.js" async></script>
|
||||
<script src="js/d3.js" async></script>
|
||||
<script src="js/scoreboard-llnl.js" async></script>
|
||||
<script>
|
||||
|
||||
var type = "original";
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Scoreboard</title>
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<script src="scoreboard.js" async></script>
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css">
|
||||
<script src="js/scoreboard.js" async></script>
|
||||
<script>
|
||||
function init() {
|
||||
var sb = document.getElementById("scoreboard");
|
||||
|
|
|
@ -1,116 +0,0 @@
|
|||
function loadJSON(url, callback) {
|
||||
function loaded(e) {
|
||||
callback(e.target.response);
|
||||
}
|
||||
var xhr = new XMLHttpRequest()
|
||||
xhr.onload = loaded;
|
||||
xhr.open("GET", url, true);
|
||||
xhr.responseType = "json";
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function scoreboard(element, continuous) {
|
||||
function update(state) {
|
||||
var teamnames = state["teams"];
|
||||
var pointslog = state["points"];
|
||||
var pointshistory = JSON.parse(localStorage.getItem("pointshistory")) || [];
|
||||
if (pointshistory.length >= 20){
|
||||
pointshistory.shift();
|
||||
}
|
||||
pointshistory.push(pointslog);
|
||||
localStorage.setItem("pointshistory", JSON.stringify(pointshistory));
|
||||
var highscore = {};
|
||||
var teams = {};
|
||||
|
||||
// Dole out points
|
||||
for (var i in pointslog) {
|
||||
var entry = pointslog[i];
|
||||
var timestamp = entry[0];
|
||||
var teamhash = entry[1];
|
||||
var category = entry[2];
|
||||
var points = entry[3];
|
||||
|
||||
var team = teams[teamhash] || {__hash__: teamhash};
|
||||
|
||||
// Add points to team's points for that category
|
||||
team[category] = (team[category] || 0) + points;
|
||||
|
||||
// Record highest score in a category
|
||||
highscore[category] = Math.max(highscore[category] || 0, team[category]);
|
||||
|
||||
teams[teamhash] = team;
|
||||
}
|
||||
|
||||
// Sort by team score
|
||||
function teamScore(t) {
|
||||
var score = 0;
|
||||
|
||||
for (var category in highscore) {
|
||||
score += (t[category] || 0) / highscore[category];
|
||||
}
|
||||
// XXX: This function really shouldn't have side effects.
|
||||
t.__score__ = score;
|
||||
return score;
|
||||
}
|
||||
function teamCompare(a, b) {
|
||||
return teamScore(a) - teamScore(b);
|
||||
}
|
||||
|
||||
var winners = [];
|
||||
for (var i in teams) {
|
||||
winners.push(teams[i]);
|
||||
}
|
||||
if (winners.length == 0) {
|
||||
// No teams!
|
||||
return;
|
||||
}
|
||||
winners.sort(teamCompare);
|
||||
winners.reverse();
|
||||
|
||||
// Clear out the element we're about to populate
|
||||
while (element.lastChild) {
|
||||
element.removeChild(element.lastChild);
|
||||
}
|
||||
|
||||
// Populate!
|
||||
var topActualScore = winners[0].__score__;
|
||||
|
||||
// (100 / ncats) * (ncats / topActualScore);
|
||||
var maxWidth = 100 / topActualScore;
|
||||
for (var i in winners) {
|
||||
var team = winners[i];
|
||||
var row = document.createElement("div");
|
||||
var ncat = 0;
|
||||
for (var category in highscore) {
|
||||
var catHigh = highscore[category];
|
||||
var catTeam = team[category] || 0;
|
||||
var catPct = catTeam / catHigh;
|
||||
var width = maxWidth * catPct;
|
||||
|
||||
var bar = document.createElement("span");
|
||||
bar.classList.add("cat" + ncat);
|
||||
bar.style.width = width + "%";
|
||||
bar.textContent = category + ": " + catTeam;
|
||||
bar.title = bar.textContent;
|
||||
|
||||
row.appendChild(bar);
|
||||
ncat += 1;
|
||||
}
|
||||
|
||||
var te = document.createElement("span");
|
||||
te.classList.add("teamname");
|
||||
te.textContent = teamnames[team.__hash__];
|
||||
row.appendChild(te);
|
||||
|
||||
element.appendChild(row);
|
||||
}
|
||||
}
|
||||
|
||||
function once() {
|
||||
loadJSON("points.json", update);
|
||||
}
|
||||
if (continuous) {
|
||||
setInterval(once, 60000);
|
||||
}
|
||||
once();
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<title>About scoring</title>
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css">
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
var baud = 1200;
|
||||
|
||||
function tx(element, text, baud_) {
|
||||
var drawTimer;
|
||||
baud_ = baud_ || baud;
|
||||
|
||||
var sp = false;
|
||||
function draw() {
|
||||
c = text[0];
|
||||
if ((c == " ") || (c == "\n")) {
|
||||
sp = true;
|
||||
c = " ";
|
||||
} else if (sp) {
|
||||
c = " " + c;
|
||||
sp = false;
|
||||
}
|
||||
element.textContent += c;
|
||||
text = text.substr(1);
|
||||
if (text == "") {
|
||||
clearInterval(drawTimer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// N81 uses 1 stop bit, and 1 parity bit.
|
||||
// That works out to exactly 10 bits per byte.
|
||||
msec = 10000 / baud_;
|
||||
|
||||
drawTimer = setInterval(draw, msec);
|
||||
draw();
|
||||
}
|
||||
|
||||
|
||||
var outq = [];
|
||||
var outTimer;
|
||||
|
||||
function drawPar() {
|
||||
oute = document.getElementById("output");
|
||||
outp = document.createElement("p");
|
||||
|
||||
oute.appendChild(outp);
|
||||
tx(outp, outq.shift());
|
||||
if (outq.length == 0) {
|
||||
clearInterval(outTimer);
|
||||
}
|
||||
}
|
||||
|
||||
function output(par) {
|
||||
outq = outq.concat(par);
|
||||
if (! outTimer) {
|
||||
outTimer = setInterval(drawPar, 150);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue