advent-of-code-2020/solutions/day11/viewer.html
2020-12-11 06:17:50 +00:00

43 lines
No EOL
1.2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Solution Viewer</title>
<style>
html, body { font-family: sans-serif; }
pre { border-radius: 0.5em; padding: 0.5em; background: #eee; }
</style>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<body>
<div id="viewer">
<h1>Solution Viewer ({{ solutionTitle }})</h1>
<p>For interesting problems; this page can be used as a dynamic viewer.</p>
<h3><a href="./input.txt">input.txt</a></h3>
<pre><code>{{ inputText }}</code></pre>
<h3><a href="./solution.js">solution.js</a></h3>
<pre><code>{{ solutionText }}</code></pre>
</div>
<script>
const app = new Vue({
el: '#viewer',
data: () => {
return {
solutionText: '[Loading]',
inputText: '[Loading]'
}
},
computed: {
solutionTitle() {
const parts = (document.location + '').split('/')
return parts.reverse()[1]
}
},
async mounted () {
this.solutionText = (await axios.get('./solution.js')).data
this.inputText = (await axios.get('./input.txt')).data
}
})
</script>
</body>
</html>