diff --git a/_embed/public/js/common.js b/_embed/public/js/common.js index 395e1c58..76cae2a3 100644 --- a/_embed/public/js/common.js +++ b/_embed/public/js/common.js @@ -306,7 +306,15 @@ function getHash (event, hash) { event.preventDefault() let request = new window.XMLHttpRequest() - request.open('GET', `${window.location.pathname}?checksum=${hash}`, true) + let link + + if (selectedItems.length) { + link = document.getElementById(selectedItems[0]).dataset.url + } else { + link = window.location.pathname + } + + request.open('GET', `${link}?checksum=${hash}`, true) request.onload = () => { if (request.status >= 300) { @@ -339,15 +347,34 @@ function infoEvent (event) { link = window.location.pathname } + buttons.setLoading('info', false) + webdav.propfind(link) .then((text) => { let parser = new window.DOMParser() let xml = parser.parseFromString(text, 'text/xml') - let clone = document.importNode(templates.info.content, true) - clone.getElementById('display_name').innerHTML = xml.getElementsByTagName('displayname')[0].innerHTML - clone.getElementById('content_length').innerHTML = xml.getElementsByTagName('getcontentlength')[0].innerHTML - clone.getElementById('last_modified').innerHTML = xml.getElementsByTagName('getlastmodified')[0].innerHTML + + let value = xml.getElementsByTagName('displayname') + if (value.length > 0) { + clone.getElementById('display_name').innerHTML = value[0].innerHTML + } else { + clone.getElementById('display_name').innerHTML = xml.getElementsByTagName('D:displayname')[0].innerHTML + } + + value = xml.getElementsByTagName('getcontentlength') + if (value.length > 0) { + clone.getElementById('content_length').innerHTML = value[0].innerHTML + } else { + clone.getElementById('content_length').innerHTML = xml.getElementsByTagName('D:getcontentlength')[0].innerHTML + } + + value = xml.getElementsByTagName('getlastmodified') + if (value.length > 0) { + clone.getElementById('last_modified').innerHTML = value[0].innerHTML + } else { + clone.getElementById('last_modified').innerHTML = xml.getElementsByTagName('D:getlastmodified')[0].innerHTML + } if (dir === true || dir === 'true') { clone.querySelector('.file-only').style.display = 'none' @@ -356,6 +383,7 @@ function infoEvent (event) { document.querySelector('body').appendChild(clone) document.querySelector('.overlay').classList.add('active') document.querySelector('.prompt').classList.add('active') + buttons.setDone('info', true) }) .catch(e => { buttons.setDone('info', false) diff --git a/_embed/public/js/listing.js b/_embed/public/js/listing.js index e11ccd7d..baef101d 100644 --- a/_embed/public/js/listing.js +++ b/_embed/public/js/listing.js @@ -220,6 +220,7 @@ listing.handleSelectionChange = function (event) { return false } + buttons.info.classList.remove('disabled') fileAction.classList.add('disabled') return false } diff --git a/assets/binary.go.REMOVED.git-id b/assets/binary.go.REMOVED.git-id index 7d50f731..ec2ca9c5 100644 --- a/assets/binary.go.REMOVED.git-id +++ b/assets/binary.go.REMOVED.git-id @@ -1 +1 @@ -87559c62da6283a45d7fb2271a25476c6a3fdf2a \ No newline at end of file +daba2fbc36c78566185e93440bd706f4722e118e \ No newline at end of file