From 3df8711f508dced311fb216e00335dc0200ecb64 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 30 Dec 2016 11:37:17 +0000 Subject: [PATCH 1/2] update Former-commit-id: af219c017c6eea620e157445f2bdb62871e7850b --- _embed/public/js/common.js | 3 ++- _embed/public/js/listing.js | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/_embed/public/js/common.js b/_embed/public/js/common.js index b227ba5e..34d58cc4 100644 --- a/_embed/public/js/common.js +++ b/_embed/public/js/common.js @@ -1,7 +1,8 @@ 'use strict'; var tempID = "_fm_internal_temporary_id", - buttons = {}; + buttons = {}, + selectedItems = []; // Removes an element, if exists, from an array Array.prototype.removeElement = function(element) { diff --git a/_embed/public/js/listing.js b/_embed/public/js/listing.js index f8338b00..63b78abf 100644 --- a/_embed/public/js/listing.js +++ b/_embed/public/js/listing.js @@ -1,7 +1,5 @@ 'use strict'; -var selectedItems = []; - var reloadListing = function(callback) { let request = new XMLHttpRequest(); request.open('GET', window.location); From 8fdfb6ee6d6d9494dd7cfc0406f66e5241969df6 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 30 Dec 2016 11:45:09 +0000 Subject: [PATCH 2/2] update common.js Former-commit-id: 092dbf46f7f403bfaef402f6e6d13634240c005c --- _embed/public/js/common.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/_embed/public/js/common.js b/_embed/public/js/common.js index 34d58cc4..e2745264 100644 --- a/_embed/public/js/common.js +++ b/_embed/public/js/common.js @@ -143,15 +143,21 @@ function deleteEvent(event) { let single = false; if (!selectedItems.length) { - selectedItems = [window.location.pathname]; + selectedItems = ["placeholder"]; single = true; } Array.from(selectedItems).forEach(id => { let request = new XMLHttpRequest(), html = buttons.delete.changeToLoading(), - el = document.getElementById(id), + el, url; + + if (single) { + url = window.location.pathname; + } else { + el = document.getElementById(id); url = el.dataset.url; + } request.open('DELETE', toWebDavURL(url)); request.onreadystatechange = function() {