diff --git a/assets/public/css/styles.css b/assets/public/css/styles.css index 881522b8..70edc721 100644 --- a/assets/public/css/styles.css +++ b/assets/public/css/styles.css @@ -173,6 +173,7 @@ sub { img { border: 0; + max-width: 100%; } /** diff --git a/assets/public/js/application.js b/assets/public/js/application.js index 09da5391..2f6765de 100644 --- a/assets/public/js/application.js +++ b/assets/public/js/application.js @@ -37,6 +37,11 @@ document.addEventListener("DOMContentLoaded", function(event) { return false; }); +var changeView = function(event) { + + return false; +} + var changeToLoading = function(element) { var originalText = element.innerHTML; element.style.opacity = 0; @@ -99,6 +104,7 @@ var backEvent = function(event) { } var deleteEvent = function(event) { + if (selectedItems.length) { Array.from(selectedItems).forEach(item => { var html = changeToLoading(document.getElementById("delete")); var request = new XMLHttpRequest(); @@ -117,6 +123,22 @@ var deleteEvent = function(event) { }); return false; + } + + var request = new XMLHttpRequest(); + request.open("DELETE", window.location); + request.send(); + request.onreadystatechange = function() { + if (request.readyState == 4) { + if (request.status == 200) { + window.location.pathname = RemoveLastDirectoryPartOf(window.location.pathname); + } + + changeToDone(document.getElementById("delete"), (request.status != 200), html); + } + } + + return false; } var downloadEvent = function(event) { @@ -131,6 +153,12 @@ var downloadEvent = function(event) { return false; } +var RemoveLastDirectoryPartOf = function(url) { + var arr = url.split('/'); + arr.pop(); + return( arr.join('/') ); +} + document.addEventListener("changed-selected", function(event) { var toolbar = document.getElementById("toolbar"); var selectedNumber = selectedItems.length;