filebrowser/_assets/src/mixins/buttons.js
Henrique Dias 4f964faf6e More vue updates
Former-commit-id: ec29aa7447e3ad1c90dea24e94072d51f212333e [formerly d370cb523dde06fb6d5aab614bf6ec1d94097363] [formerly bbabc4da0a6128b3bd8ecfa226156c9c2be7297e [formerly 2789ff2161cb4c1b1dc51282cb7aaa539a272966]]
Former-commit-id: fb3ae368534aa2bd7cc08283463ac9d8e0d1d825 [formerly efbb60cc4dd2856bbc004fcbdc0567540c72f5b3]
Former-commit-id: d0c3699029c88a3ed2a8f5ab72c70d0f5289292d
2017-06-30 10:25:35 +01:00

51 lines
1.1 KiB
JavaScript

export default {
data: function () {
return {
buttonState: ''
}
},
methods: {
setLoading: function () {
let i = this.$el.querySelector('i')
i.style.opacity = 0
this.buttonState = i.innerHTML
setTimeout(() => {
i.classList.add('spin')
i.innerHTML = 'autorenew'
i.style.opacity = 1
}, 200)
},
setDone: function (success = true) {
let i = this.$el.querySelector('i')
i.style.opacity = 0
let thirdStep = () => {
i.innerHTML = this.buttonState
i.style.opacity = null
}
let secondStep = () => {
i.style.opacity = 0
setTimeout(thirdStep, 200)
}
let firstStep = () => {
i.classList.remove('spin')
i.innerHTML = success
? 'done'
: 'close'
i.style.opacity = 1
setTimeout(secondStep, 1000)
}
setTimeout(firstStep, 200)
}
}
}
/* // third step ?
if (selectedItems.length === 0 && document.getElementById('listing')) {
document.sendCostumEvent('changed-selected')
} */