mirror of
https://github.com/LukeSmithxyz/based.cooking.git
synced 2025-03-14 13:55:53 +00:00
add random recipe link
This commit is contained in:
parent
7d05044a2d
commit
f42c51179d
@ -47,6 +47,10 @@ img[alt="XMR Logo"] {
|
||||
display: inline ;
|
||||
}
|
||||
|
||||
#rand {
|
||||
color: lightgreen;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
body {
|
||||
background: white ;
|
||||
@ -64,6 +68,9 @@ img[alt="XMR Logo"] {
|
||||
code {
|
||||
color: forestgreen ;
|
||||
}
|
||||
#rand {
|
||||
color: green;
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
|
@ -1 +1 @@
|
||||
<li><a href="$URL">$TITLE</a></li>
|
||||
<li><a class="entrylink" href="$URL">$TITLE</a></li>
|
||||
|
@ -1 +1,15 @@
|
||||
</ul>
|
||||
<script>
|
||||
var entries = document.getElementsByClassName('entrylink');
|
||||
var randlink = document.getElementById('rand');
|
||||
function setbutton() {
|
||||
let rand = entries[Math.floor(Math.random() * entries.length)];
|
||||
randlink.innerHTML = 'Random: ' + rand.innerHTML;
|
||||
randlink.href = rand.href;
|
||||
}
|
||||
setbutton();
|
||||
randlink.onmouseup = function(e){
|
||||
if (e.which != 1)
|
||||
setTimeout(setbutton, 10);
|
||||
}
|
||||
</script>
|
||||
|
@ -1,2 +1,4 @@
|
||||
<h2>Recipes</h2>
|
||||
<ul id=artlist>
|
||||
<a id=rand oncontextmenu="return false"></a>
|
||||
<br>
|
||||
|
Loading…
x
Reference in New Issue
Block a user