mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
Move file dialog - Testing
This commit is contained in:
parent
267203bec9
commit
64520a75c5
@ -317,7 +317,7 @@ listing.addDoubleTapEvent = function () {
|
||||
|
||||
setTimeout(() => {
|
||||
touches.count = 0;
|
||||
}, 500)
|
||||
}, 300)
|
||||
|
||||
return;
|
||||
}
|
||||
@ -377,7 +377,7 @@ function loadNextFolder(event) {
|
||||
prompt = document.querySelector("form.prompt.active");
|
||||
|
||||
prompt.addEventListener("submit", moveSelected);
|
||||
|
||||
console.log(event);
|
||||
request.open("GET", event.target.dataset.url);
|
||||
request.setRequestHeader("Accept", "application/json");
|
||||
request.send();
|
||||
@ -388,11 +388,23 @@ function loadNextFolder(event) {
|
||||
prompt.querySelector("ul").innerHTML = "";
|
||||
prompt.querySelector('code').innerHTML = event.target.dataset.url;
|
||||
|
||||
if(prompt.querySelector('code').innerHTML != baseURL + "/") {
|
||||
let newNode = document.createElement("li");
|
||||
newNode.dataset.url = removeLastDirectoryPartOf(event.target.dataset.url) + "/";
|
||||
newNode.innerHTML = "..";
|
||||
newNode.setAttribute("aria-selected", false);
|
||||
newNode.addEventListener("dblclick", loadNextFolder);
|
||||
newNode.addEventListener("click", selectMoveFolder);
|
||||
|
||||
prompt.querySelector("div.file-list ul").appendChild(newNode);
|
||||
}
|
||||
|
||||
if(JSON.parse(request.response) == null) {
|
||||
prompt.querySelector("p").innerHTML = `There aren't any folders in this directory.`;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for(let f of JSON.parse(request.response)) {
|
||||
if(f.IsDir === true) {
|
||||
dirs++;
|
||||
@ -457,6 +469,17 @@ function moveEvent(event) {
|
||||
prompt.querySelector("form").addEventListener("submit", moveSelected);
|
||||
prompt.querySelector('code').innerHTML = window.location.pathname;
|
||||
|
||||
if(window.location.pathname !== baseURL + "/") {
|
||||
let newNode = document.createElement("li");
|
||||
newNode.dataset.url = removeLastDirectoryPartOf(window.location.pathname) + "/";
|
||||
newNode.innerHTML = "..";
|
||||
newNode.setAttribute("aria-selected", false);
|
||||
newNode.addEventListener("dblclick", loadNextFolder);
|
||||
newNode.addEventListener("click", selectMoveFolder);
|
||||
|
||||
prompt.querySelector("div.file-list ul").appendChild(newNode);
|
||||
}
|
||||
|
||||
for(let f of JSON.parse(request.response)) {
|
||||
if(f.IsDir === true) {
|
||||
dirs++;
|
||||
|
Loading…
Reference in New Issue
Block a user