acoeur/themes/acoeur/assets/js/misc.js

21 lines
476 B
JavaScript

/*
* Some javascript trick to sleep for some number of seconds
*/
const sleep = (seconds) => new Promise(resolve => {
document.body.classList.add('sleeping')
setTimeout(() => {
document.body.classList.remove('sleeping')
resolve()
}, seconds * 1000)
})
/*
* From the current URL generate an UUID
*/
const getUuidFromUrl = (pathname = document.location.pathname) =>
pathname
.split('')
.reverse()
.filter(l => l.match(/[0-9a-f]/))
.join('')