hide random link when no js

This commit is contained in:
dvhar 2021-03-30 21:20:26 -05:00
parent f42c51179d
commit 95004f566f
3 changed files with 4 additions and 2 deletions

View File

@ -49,6 +49,7 @@ img[alt="XMR Logo"] {
#rand {
color: lightgreen;
display: none;
}
@media (prefers-color-scheme: light) {
@ -70,6 +71,7 @@ img[alt="XMR Logo"] {
}
#rand {
color: green;
display: none;
}
}

View File

@ -2,9 +2,10 @@
<script>
var entries = document.getElementsByClassName('entrylink');
var randlink = document.getElementById('rand');
randlink.style.display = 'revert';
function setbutton() {
let rand = entries[Math.floor(Math.random() * entries.length)];
randlink.innerHTML = 'Random: ' + rand.innerHTML;
randlink.innerHTML = 'Random: ' + rand.innerHTML + '<br>';
randlink.href = rand.href;
}
setbutton();

View File

@ -1,4 +1,3 @@
<h2>Recipes</h2>
<ul id=artlist>
<a id=rand oncontextmenu="return false"></a>
<br>