Skip to content

Commit

Permalink
Tweak results page; add favicon
Browse files Browse the repository at this point in the history
  • Loading branch information
inthar-raven committed Aug 13, 2024
1 parent 765f81a commit 6ce47ae
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 52 deletions.
2 changes: 1 addition & 1 deletion static/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ thead th {
}

.data tr:nth-child(even) {
background-color: hsl(22, 100%, 36%);
background-color: rgb(20%, 10%, 30%);
}

table.clickable tr.selected {
Expand Down
Binary file added static/favicon.ico
Binary file not shown.
3 changes: 2 additions & 1 deletion static/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/static/basic.css">
<link rel="stylesheet" href="/static/basic.css">
<link id="favicon" rel="icon" href="/static/favicon.ico">
</head>
<body>
<div class="normal">
Expand Down
46 changes: 4 additions & 42 deletions static/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html>
<head>
<link rel="stylesheet" href="/static/basic.css" />
<link id="favicon" rel="icon" href="/static/favicon.ico">
</head>
<body>
<div class="normal">
Expand All @@ -19,54 +20,15 @@
overflow-y: auto;
overflow-x: hidden;
height: 300px;
width: 1200px;
width: 1350px;
"
></div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td>
<div
style="
overflow-y: auto;
overflow-x: hidden;
vertical-align: top;
height: 420px;
width: 200px;
"
>
<table class="data" id="table-scales">Scales</table>
</div>
</td>
<td>
<div
style="
overflow-y: auto;
overflow-x: hidden;
vertical-align: top;
height: 420px;
width: 200px;
"
>
<table class="data" id="table-ji-tunings">JI tunings</table>
</div>
</td>
<td>
<div
style="
overflow-y: auto;
overflow-x: hidden;
vertical-align: top;
height: 420px;
width: 200px;
"
>
<table class="data" id="table-ed-tunings">edo tunings</table>
</div>
</td>
<tr id="tables">
</tr>
</table>
</td>
Expand All @@ -78,7 +40,7 @@
overflow-x: hidden;
vertical-align: top;
height: 420px;
width: 600px;
width: 400px;
"
>
</div>
Expand Down
87 changes: 79 additions & 8 deletions static/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,6 @@ function escapeHtml(text) {
return text;
}

const scaleTable = document.getElementById("table-scales");
const jiTuningTable = document.getElementById("table-ji-tunings");
const edTuningTable = document.getElementById("table-ed-tunings");
const query = window.location.search;
const sigQuery = new URLSearchParams(query).get("step_sig");
const wordQuery = new URLSearchParams(query).get("word");
Expand Down Expand Up @@ -655,6 +652,52 @@ if (sigQuery) {
myInit,
});
if (response["status"] === 200) {
document.getElementById("tables").innerHTML = `
<td>
Scales
<div
style="
overflow-y: auto;
overflow-x: auto;
vertical-align: top;
height: 420px;
width: 250px;
"
>
<table class="data" id="table-scales"></table>
</div>
</td>
<td>
JI tunings
<div
style="
overflow-y: auto;
overflow-x: auto;
vertical-align: top;
height: 420px;
width: 250px;
"
>
<table class="data" id="table-ji-tunings"></table>
</div>
</td>
<td>
edo tunings
<div
style="
overflow-y: auto;
overflow-x: auto;
vertical-align: top;
height: 420px;
width: 200px;
"
>
<table class="data" id="table-ed-tunings"></table>
</div>
</td>`;
const scaleTable = document.getElementById("table-scales");
const jiTuningTable = document.getElementById("table-ji-tunings");
const edTuningTable = document.getElementById("table-ed-tunings");
const json = await response.json();
const stuff = json["scales"];
const scales = stuff.map((j) => j["word"]);
Expand Down Expand Up @@ -822,7 +865,7 @@ if (sigQuery) {
} else if (response["status"] === 400) {
element.textContent = "Server error 400: Invalid input";
} else if (response["status"] === 504) {
element.textContent = `Server error 504:<br/>Computation timed out after ${await response.text()} (timeout is 6 seconds)`;
element.innerHTML = `Server error 504:<br/>Computation timed out after ${await response.text()} (timeout is 6 seconds)`;
} else {
element.textContent = `Server error ${response["status"]}`;
}
Expand All @@ -839,6 +882,37 @@ if (sigQuery) {
});

if (response["status"] === 200) {
document.getElementById("tables").innerHTML = `
<td>
JI tunings
<div
style="
overflow-y: auto;
overflow-x: auto;
vertical-align: top;
height: 420px;
width: 250px;
"
>
<table class="data" id="table-ji-tunings"></table>
</div>
</td>
<td>
edo tunings
<div
style="
overflow-y: auto;
overflow-x: auto;
vertical-align: top;
height: 420px;
width: 200px;
"
>
<table class="data" id="table-ed-tunings"></table>
</div>
</td>`;
const jiTuningTable = document.getElementById("table-ji-tunings");
const edTuningTable = document.getElementById("table-ed-tunings");
const json = await response.json();
const brightestMode = json["brightest"];
currentWord = brightestMode;
Expand All @@ -850,9 +924,6 @@ if (sigQuery) {
}
const sig = Object.values(sig_); // values will be extracted ordered by the keys; for indexing by 0, 1, 2... rather than L, m, s

const jiTuningTable = document.getElementById("table-ji-tunings");
const edTuningTable = document.getElementById("table-ed-tunings");

const jiTunings = json["ji_tunings"];
const edTunings = json["ed_tunings"].map((stepRatio) => {
return Object.fromEntries([
Expand Down Expand Up @@ -968,7 +1039,7 @@ if (sigQuery) {
} else if (response["status"] === 400) {
element.textContent = "Server error 400: Invalid input";
} else if (response["status"] === 504) {
element.textContent = `Server error 504:<br/>Computation timed out after ${await response.text()} (timeout is 6 seconds)`;
element.innerHTML = `Server error 504:<br/>Computation timed out after ${await response.text()} (timeout is 6 seconds)`;
} else {
element.textContent = `Server error ${response["status"]}`;
}
Expand Down

0 comments on commit 6ce47ae

Please sign in to comment.