filebrowser/_assets/_old/js/listing.js
Henrique Dias 0bfd6cee55 New File and New DIr working :D
Former-commit-id: 76264ae6d176b8806b1a2fac4e50250486be9463 [formerly ad5a3d0565ca78adb58c303eb3c62523faea27ac] [formerly 47bd2f1043b61ac235effab6a81335a9d7c8c0c7 [formerly 59912e1dda3112fb8c1b3c3037b392e959051c73]]
Former-commit-id: 1435f0a891e5f551e9d2eb35ebd05b9828fe6c73 [formerly 7a2d24d974d9c1f1a77ff58c9eedf9f2796138f7]
Former-commit-id: 23a8cb3738ce9dfa22358f31820f5f14085d7f92
2017-06-29 19:12:05 +01:00

57 lines
1.2 KiB
JavaScript

'use strict'
listing.redefineDownloadURLs = function () {
let files = ''
for (let i = 0; i < selectedItems.length; i++) {
let url = document.getElementById(selectedItems[i]).dataset.url
files += url.replace(window.location.pathname, '') + ','
}
files = files.substring(0, files.length - 1)
files = encodeURIComponent(files)
let links = document.querySelectorAll('#download ul a')
Array.from(links).forEach(link => {
link.href = '?download=' + link.dataset.format + '&files=' + files
})
}
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
}
})
})
}
document.addEventListener('DOMContentLoaded', event => {
listing.addDoubleTapEvent()
if (user.AllowNew) {
buttons.new.addEventListener('click', listing.newFileButton)
}
})