Skip to content

Commit

Permalink
add code page
Browse files Browse the repository at this point in the history
  • Loading branch information
avan1235 committed Mar 4, 2024
1 parent 5abebc4 commit 0288296
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,16 @@
</body>

<script type="text/javascript">
function clearCode(code) {
const idx = code.indexOf("=");
if (idx === -1) return code;

return code.substring(idx + 1);
}

if (window.location.hash.length > 0) {
let codeElement = document.getElementById("code");
let code = window.location.hash.substring(1);
const codeElement = document.getElementById("code");
const code = clearCode(window.location.hash.substring(1));
codeElement.textContent = code;
codeElement.addEventListener("click", function () {
navigator.clipboard.writeText(code);
Expand Down

0 comments on commit 0288296

Please sign in to comment.