mirror of
https://github.com/LukeSmithxyz/based.cooking.git
synced 2026-01-23 19:33:05 +00:00
add random recipe link
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user