mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-05-09 11:42:57 +00:00

Former-commit-id: 9f1f09311813203910d5b323ba80712553ee2741 [formerly 0be00be1de305d786affc6bf0886aed9b20fbc51] [formerly 04597463117e94830b24b87faaaccf3d35284427 [formerly 3f2dc3f1c56a7a636a836d36b94c052f55f32d93]] Former-commit-id: 8d26cc1d96faed73c7974ea7e5e78bf268af3ad9 [formerly a083ac8f68c90a636843c3565bd349657c0ec383] Former-commit-id: ef10f3b3c388d65ceac40785b45dbac190a6cc99
80 lines
1.6 KiB
JavaScript
80 lines
1.6 KiB
JavaScript
var buttons = {
|
|
previousState: {}
|
|
}
|
|
|
|
buttons.setLoading = function (name) {
|
|
if (typeof this[name] === 'undefined') return
|
|
let i = this[name].querySelector('i')
|
|
|
|
this.previousState[name] = i.innerHTML
|
|
i.style.opacity = 0
|
|
|
|
setTimeout(function () {
|
|
i.classList.add('spin')
|
|
i.innerHTML = 'autorenew'
|
|
i.style.opacity = 1
|
|
}, 200)
|
|
}
|
|
|
|
// Changes an element to done animation
|
|
buttons.setDone = function (name, success = true) {
|
|
let i = this[name].querySelector('i')
|
|
|
|
i.style.opacity = 0
|
|
|
|
let thirdStep = () => {
|
|
i.innerHTML = this.previousState[name]
|
|
i.style.opacity = null
|
|
|
|
if (selectedItems.length === 0 && document.getElementById('listing')) {
|
|
document.sendCostumEvent('changed-selected')
|
|
}
|
|
}
|
|
|
|
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)
|
|
return false
|
|
}
|
|
|
|
listing.addDoubleTapEvent = function () {
|
|
let items = document.getElementsByClassName('item'),
|
|
touches = {
|
|
id: '',
|
|
count: 0
|
|
}
|
|
|
|
Array.from(items).forEach(file => {
|
|
file.addEventListener('touchstart', event => {
|
|
if (touches.id != file.id) {
|
|
touches.id = file.id
|
|
touches.count = 1
|
|
|
|
setTimeout(() => {
|
|
touches.count = 0
|
|
}, 300)
|
|
|
|
return
|
|
}
|
|
|
|
touches.count++
|
|
|
|
if (touches.count > 1) {
|
|
window.location = file.dataset.url
|
|
}
|
|
})
|
|
})
|
|
}
|