Files
filebrowser/assets/src/utils/buttons.js
T

40 lines
766 B
JavaScript
Raw Normal View History

2017-07-04 18:04:00 +01:00
function loading (button) {
let el = document.querySelector(`#${button}-button > i`)
if (el === undefined || el === null) {
console.log('Error getting button ' + button)
return
}
el.dataset.icon = el.innerHTML
el.style.opacity = 0
setTimeout(() => {
el.classList.add('spin')
el.innerHTML = 'autorenew'
el.style.opacity = 1
2017-07-08 12:32:25 +01:00
}, 100)
2017-07-04 18:04:00 +01:00
}
function done (button, success = true) {
let el = document.querySelector(`#${button}-button > i`)
if (el === undefined || el === null) {
console.log('Error getting button ' + button)
return
}
el.style.opacity = 0
setTimeout(() => {
2017-07-04 18:04:00 +01:00
el.classList.remove('spin')
el.innerHTML = el.dataset.icon
2017-07-04 18:04:00 +01:00
el.style.opacity = 1
2017-07-08 12:32:25 +01:00
}, 100)
2017-07-04 18:04:00 +01:00
}
export default {
loading,
done
}