fuzzyworld

quantum-inspiration / files / public / index.html

index.html

1.1 KB · history · blame

1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <title>Quantum Inspiration - Results</title>
6 </head>
7 <body>
8 <h1 id="header">Quantum Inspiration</h1>
9 <h2 id="subheader"></h2>
10 <div id="root"></div>
11 <script src="results.js"></script>
12 <script>
13 header.innerHTML = `Quantum Inspiration - ${results.CreationDate}`;
14
15 const chosenPage = results.Pages[results.RandomNumber];
16 subheader.innerHTML = `Today's randomly chosen page: <a href="#chosen">#${results.RandomNumber + 1}</a> - <a href="${chosenPage.Url}">${chosenPage.Title}</a>`;
17
18 results.Pages.forEach(function (page, index) {
19 var div = document.createElement('div');
20 div.innerHTML = `${index + 1} - <a href="${page.Url}">${page.Title}</a>`;
21
22 const isChosen = results.RandomNumber === index;
23 if (isChosen) {
24 div.style.fontWeight = 'bold';
25 div.id = 'chosen';
26 }
27
28 root.appendChild(div);
29 });
30 </script>
31 </body>
32</html>