-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
71510c1
commit f9007f1
Showing
7 changed files
with
182 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<title>QB Reader</title> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
<link href="/apple-touch-icon.png" rel="apple-touch-icon"> | ||
<link href="/apple-touch-icon-precomposed.png" rel="apple-touch-icon-precomposed"> | ||
<link type="image/x-icon" href="/favicon.ico" rel="icon"> | ||
|
||
<link href="/bootstrap/light.css" rel="stylesheet"> | ||
<link href="/bootstrap/dark.css" rel="stylesheet" id="custom-css"> | ||
<script src="/apply-theme.js"></script> | ||
</head> | ||
|
||
<body> | ||
<nav class="navbar navbar-light navbar-expand-lg bg-custom" id="navbar" style="z-index: 10"> | ||
<div class="container-fluid"> | ||
<a class="navbar-brand ms-1 py-0" id="logo" href="/"> | ||
<span class="logo-prefix">QB</span><span class="logo-suffix">Reader</span> | ||
</a> | ||
<button class="navbar-toggler" data-bs-target="#navbarSupportedContent" data-bs-toggle="collapse" type="button" | ||
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
<div class="collapse navbar-collapse" id="navbarSupportedContent"> | ||
<ul class="navbar-nav me-auto mb-2 mb-lg-0"> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="/tossups">Tossups</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="/bonuses">Bonuses</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="/multiplayer">Multiplayer</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="/db">Database</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link active" href="/geoword">Geoword</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="/api-docs">API</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="/about">About</a> | ||
</li> | ||
</ul> | ||
<div class="d-flex"> | ||
<ul class="navbar-nav mb-2 mb-lg-0"> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="/user/login" id="login-link">Log in</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
<div class="container-xl mt-3 mb-5 pb-5"> | ||
<p class="text-center lead"><span id="packet-name"></span> Tossups:</p> | ||
<div id="packet"></div> | ||
</div> | ||
|
||
<script src="/bootstrap/bootstrap.bundle.min.js"></script> | ||
<script src="/script.js"></script> | ||
|
||
<script src="/geoword/script.js"></script> | ||
<script src="/geoword/packet.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const division = decodeURIComponent(window.location.search.slice(1)); | ||
const packetName = window.location.pathname.split('/').pop(); | ||
const packetTitle = titleCase(packetName); | ||
|
||
document.getElementById('packet-name').textContent = packetTitle; | ||
|
||
fetch('/api/geoword/packet?' + new URLSearchParams({ packetName, division })) | ||
.then(response => { | ||
if (response.status === 403) { | ||
document.getElementById('packet').textContent = 'You do not have permission to view this packet. Either you have not paid for it, or you have not finished playing it. Please contact the administrator if you believe this is an error.'; | ||
} else { | ||
return response.json(); | ||
} | ||
}) | ||
.then(data => { | ||
const { packet } = data; | ||
let innerHTML = ''; | ||
|
||
for (const tossup of packet) { | ||
innerHTML += `<div>${tossup.questionNumber}. ${tossup.question}</div>`; | ||
innerHTML += `<div>ANSWER: ${tossup.formatted_answer ?? tossup.answer}</div>`; | ||
innerHTML += `<p><${tossup.category} / ${tossup.subcategory}></p>`; | ||
innerHTML += '<hr class="my-3"></hr>'; | ||
} | ||
|
||
document.getElementById('packet').innerHTML += innerHTML; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters