summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
Diffstat (limited to 'static')
-rw-r--r--static/index.html36
1 files changed, 29 insertions, 7 deletions
diff --git a/static/index.html b/static/index.html
index 37a831f..8162ac9 100644
--- a/static/index.html
+++ b/static/index.html
@@ -14,25 +14,47 @@
const result = await response.json();
console.log(result);
+
+ const problems_div = document.getElementById("problems");
+ while (problems_div.firstChild) {
+ problems_div.removeChild(problems_div.lastChild);
+ }
+
+ for (const problem of result) {
+ const problem_div = document.createElement("div");
+ problem_div.className = "problem";
+ problems_div.appendChild(problem_div);
+
+ const title = document.createElement("h2");
+ title.innerHTML = problem.title;
+ problem_div.appendChild(title);
+
+ const description = document.createElement("p");
+ description.innerHTML = problem.description;
+ problem_div.appendChild(description);
+ }
}
</script>
</head>
- <body>
+ <body onload="fetch_problems()">
<div id="layout">
<div id="container">
- <div id="holes">
+ <div id="content">
- <button onclick="fetch_problems()">Hello</button>
<h1>C&amp;! Code Golf Leaderboard</h1>
<p>In golf, the goal is to get a ball into a hole in as few swings as possible. The goal of code golf is similarly to solve a problem in as few bytes (of source code) as possible. The following is a list of programming challenges. Your task is to try and solve them in Python with as little code as possible measured in bytes.</p>
-
- <div class="problem">
- <h2>Title</h2>
- <p>Description</p>
+ <button onclick="fetch_problems()">Refresh Problems</button>
+ <div id="problems">
+ <div class="problem">
+ <h2>Title</h2>
+ <p>Description</p>
+ </div>
</div>
+
+ <center>&copy; 2026 Daniel Hader</center>
</div>
</div>
</div>