From a9aaba5841f9d5532e5fd24cfb7cf162b8716ae7 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sun, 22 Jan 2017 12:26:18 +0000 Subject: [PATCH] fix delete #70 --- _embed/public/js/common.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/_embed/public/js/common.js b/_embed/public/js/common.js index 1be8dd87..603bbfa9 100644 --- a/_embed/public/js/common.js +++ b/_embed/public/js/common.js @@ -140,7 +140,7 @@ webdav.move = function (oldLink, newLink) { let request = new XMLHttpRequest(), destination = newLink.replace(baseURL + "/", webdavURL + "/"); - destination = window.location.origin + destination.substring(prefixURL.length); + destination = window.location.origin + destination.substring(prefixURL.length); request.open('MOVE', webdav.convertURL(oldLink), true); request.setRequestHeader('Destination', destination); @@ -191,7 +191,6 @@ webdav.delete = function (link) { request.onerror = () => reject(request.statusText); request.send(); }); - request.send(); } webdav.new = function (link) { @@ -208,7 +207,6 @@ webdav.new = function (link) { request.onerror = () => reject(request.statusText); request.send(); }); - request.send(); } /* * * * * * * * * * * * * * * * @@ -222,7 +220,10 @@ function closePrompt(event) { if(!prompt) return; - event.preventDefault(); + if(typeof event != 'undefined') { + event.preventDefault(); + } + document.querySelector('.overlay').classList.remove('active'); prompt.classList.remove('active'); @@ -277,7 +278,7 @@ function openEvent(event) { } function deleteOnSingleFile() { - closePrompt(event); + closePrompt(); buttons.setLoading('delete'); let promises = []; @@ -293,7 +294,7 @@ function deleteOnSingleFile() { } function deleteOnListing() { - closePrompt(event); + closePrompt(); buttons.setLoading('delete'); let promises = []; @@ -568,4 +569,4 @@ document.addEventListener("DOMContentLoaded", function (event) { setupSearch(); return false; -}); +}); \ No newline at end of file