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

21 lines
476 B
JavaScript
Raw Normal View History

2022-12-25 16:58:52 +01:00
/*
* 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)
})
2022-12-25 16:58:52 +01:00
/*
* From the current URL generate an UUID
*/
2023-05-07 17:52:17 +02:00
const getUuidFromUrl = (pathname = document.location.pathname) =>
2022-12-25 16:58:52 +01:00
pathname
.split('')
.reverse()
.filter(l => l.match(/[0-9a-f]/))
.join('')