2017-06-25 08:11:25 +00:00
|
|
|
'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()
|
2017-06-29 16:54:57 +00:00
|
|
|
|
2017-06-25 08:11:25 +00:00
|
|
|
if (user.AllowNew) {
|
2017-06-28 15:05:30 +00:00
|
|
|
buttons.new.addEventListener('click', listing.newFileButton)
|
2017-06-25 08:11:25 +00:00
|
|
|
}
|
|
|
|
})
|