mirror of
https://github.com/ipfs/awesome-ipfs.git
synced 2024-12-26 15:59:33 -05:00
Random card order :)
This commit is contained in:
parent
0544b37ba3
commit
390088c7f2
@ -17,6 +17,13 @@ const cards = Array.from(document.querySelectorAll('.Card'))
|
||||
return 0
|
||||
})
|
||||
|
||||
function randomizr () {
|
||||
const cards = document.querySelector('.CardContainer')
|
||||
for (var i = cards.children.length; i >= 0; i--) {
|
||||
cards.appendChild(cards.children[Math.random() * i | 0])
|
||||
}
|
||||
}
|
||||
|
||||
function update (display) {
|
||||
cards.forEach((c) => {
|
||||
if (display.indexOf(c.dataset.ref) >= 0) {
|
||||
@ -29,6 +36,8 @@ function update (display) {
|
||||
})
|
||||
}
|
||||
|
||||
randomizr()
|
||||
|
||||
if (search) {
|
||||
search.classList.remove('dn')
|
||||
const input = search.querySelector('input')
|
||||
|
@ -11,7 +11,7 @@
|
||||
type="text" />
|
||||
</div>
|
||||
|
||||
<main class="mv4 flex flex-wrap justify-between" >
|
||||
<main class="CardContainer mv4 flex flex-wrap justify-between" >
|
||||
{{ range (sort . "Params.index") -}}
|
||||
<article data-ref="{{ .Params.index }}" class="Card flex flex-column bg-white shadow-4 grow2 br1 dark-gray b--black-10 flex-grow-1 ma2">
|
||||
{{ $cat := index .Params.categories 0 }}
|
||||
|
Loading…
Reference in New Issue
Block a user