Add repo link to complete page

This commit is contained in:
Shadowfacts 2016-10-02 11:06:53 -04:00
parent 81b730ff23
commit 27e7357e52
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 6 additions and 3 deletions

View File

@ -7,7 +7,7 @@
<body>
<p id="congrats"></p>
<p>Return to <a href="/">start</a>.</p>
<p>Return to <a id="repo">repo</a> or <a href="/">start</a>.</p>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="js/complete.js"></script>

View File

@ -1,7 +1,10 @@
let hash = window.location.hash.substring(1);
let hashBits = hash.split("/");
let repo = hashBits.slice(0, 2).join("/");
let repo = hashBits.slice(0, 3).join("/");
let repoName = hashBits.slice(0, 2).join("/");
let file = hashBits[hashBits.length - 1];
$("#congrats").html(`Congratulations, you've completed <code>${file}</code> in <code>${repo}</code>!`);
$("#congrats").html(`Congratulations, you've completed <code>${file}</code> in <code>${repoName}</code>!`);
$("#repo").attr("href", `/repo.html#${repo}`);