From 1641b287b6f98f4d70202fa27f2498141dfd5364 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Tue, 14 Jun 2016 21:23:54 +0100 Subject: [PATCH] Updates --- assets/public/css/styles.css | 1 + assets/public/js/application.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) 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;