This commit is contained in:
Henrique Dias 2016-06-14 21:23:54 +01:00
parent 7be383330a
commit 1641b287b6
2 changed files with 29 additions and 0 deletions

View File

@ -173,6 +173,7 @@ sub {
img {
border: 0;
max-width: 100%;
}
/**

View File

@ -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;