mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
parent
fa5387b141
commit
3d3ab8bb16
@ -117,6 +117,7 @@
|
|||||||
src: local('Material Icons'), local('MaterialIcons-Regular'), url(material/icons.woff2) format('woff2');
|
src: local('Material Icons'), local('MaterialIcons-Regular'), url(material/icons.woff2) format('woff2');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.prompt .file-list ul li:before,
|
||||||
.material-icons {
|
.material-icons {
|
||||||
font-family: 'Material Icons';
|
font-family: 'Material Icons';
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
|
@ -471,7 +471,7 @@ header .actions {
|
|||||||
|
|
||||||
#bottom-bar>*:first-child {
|
#bottom-bar>*:first-child {
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
max-width: calc(100% - 21em);
|
max-width: calc(100% - 25em);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -919,6 +919,49 @@ header .actions {
|
|||||||
background-color: #e9eaeb;
|
background-color: #e9eaeb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* * * * * * * * * * * * * * * *
|
||||||
|
* PROMPT - MOVE *
|
||||||
|
* * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
.prompt .file-list {
|
||||||
|
flex-direction: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
.prompt .file-list ul {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.prompt .file-list ul li {
|
||||||
|
width: 100%;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.prompt .file-list ul li[aria-selected=true] {
|
||||||
|
background: #2196f3 !important;
|
||||||
|
color: #fff !important;
|
||||||
|
transition: .1s ease all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.prompt .file-list ul li:hover {
|
||||||
|
background-color: #e9eaeb;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.prompt .file-list ul li:before {
|
||||||
|
content: "folder";
|
||||||
|
color: #6f6f6f;
|
||||||
|
vertical-align: middle;
|
||||||
|
padding: 0 .25em;
|
||||||
|
line-height: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.prompt .file-list ul li[aria-selected=true]:before {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * *
|
||||||
* HELP *
|
* HELP *
|
||||||
|
@ -161,9 +161,7 @@ function logoutEvent(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openEvent(event) {
|
function openEvent(event) {
|
||||||
if (event.currentTarget.classList.contains('disabled')) {
|
if (event.currentTarget.classList.contains('disabled')) return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let link = '?raw=true';
|
let link = '?raw=true';
|
||||||
|
|
||||||
@ -177,6 +175,64 @@ function openEvent(event) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectMoveFolder(event) {
|
||||||
|
if(event.target.getAttribute("aria-selected") === "true") {
|
||||||
|
event.target.setAttribute("aria-selected", false);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if(document.querySelector(".file-list li[aria-selected=true]")) {
|
||||||
|
document.querySelector(".file-list li[aria-selected=true]").setAttribute("aria-selected", false);
|
||||||
|
}
|
||||||
|
event.target.setAttribute("aria-selected", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveSelected(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadNextFolder(event) {
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveEvent(event) {
|
||||||
|
if(event.currentTarget.classList.contains("disabled")) return;
|
||||||
|
|
||||||
|
let request = new XMLHttpRequest();
|
||||||
|
|
||||||
|
request.open("GET", window.location.pathname, true);
|
||||||
|
request.setRequestHeader("Accept", "application/json");
|
||||||
|
request.send();
|
||||||
|
request.onreadystatechange = function() {
|
||||||
|
if(request.readyState == 4) {
|
||||||
|
if(request.status == 200) {
|
||||||
|
let clone = document.importNode(templates.move.content, true);
|
||||||
|
|
||||||
|
clone.querySelector("p").innerHTML = `Choose new house for your file(s)/folder(s):`;
|
||||||
|
|
||||||
|
for(let f of JSON.parse(request.response)) {
|
||||||
|
if(f.URL.split("/").length == 3) {
|
||||||
|
if(selectedItems.includes(btoa(f.URL.split("/")[1]))) continue;
|
||||||
|
let newNode = document.createElement("li");
|
||||||
|
newNode.innerHTML = f.URL.split("/")[1];
|
||||||
|
newNode.setAttribute("aria-selected", false);
|
||||||
|
|
||||||
|
newNode.addEventListener("dblclick", loadNextFolder);
|
||||||
|
newNode.addEventListener("click", selectMoveFolder);
|
||||||
|
newNode.addEventListener("submit", moveSelected);
|
||||||
|
|
||||||
|
clone.querySelector("div.file-list ul").appendChild(newNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.appendChild(clone);
|
||||||
|
document.querySelector(".overlay").classList.add("active");
|
||||||
|
document.querySelector(".prompt").classList.add("active");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function deleteSelected(single) {
|
function deleteSelected(single) {
|
||||||
return function(event) {
|
return function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -238,7 +294,7 @@ function deleteEvent(event) {
|
|||||||
clone.querySelector('.ok').innerHTML = 'Delete';
|
clone.querySelector('.ok').innerHTML = 'Delete';
|
||||||
clone.querySelector('form').addEventListener('submit', deleteSelected(single));
|
clone.querySelector('form').addEventListener('submit', deleteSelected(single));
|
||||||
|
|
||||||
document.querySelector('body').appendChild(clone)
|
document.body.appendChild(clone);
|
||||||
document.querySelector('.overlay').classList.add('active');
|
document.querySelector('.overlay').classList.add('active');
|
||||||
document.querySelector('.prompt').classList.add('active');
|
document.querySelector('.prompt').classList.add('active');
|
||||||
|
|
||||||
@ -414,13 +470,16 @@ document.addEventListener("DOMContentLoaded", function(event) {
|
|||||||
buttons.open = document.getElementById("open");
|
buttons.open = document.getElementById("open");
|
||||||
buttons.delete = document.getElementById("delete");
|
buttons.delete = document.getElementById("delete");
|
||||||
buttons.previous = document.getElementById("previous");
|
buttons.previous = document.getElementById("previous");
|
||||||
|
buttons.move = document.getElementById("move");
|
||||||
|
|
||||||
// Attach event listeners
|
// Attach event listeners
|
||||||
buttons.logout.addEventListener("click", logoutEvent);
|
buttons.logout.addEventListener("click", logoutEvent);
|
||||||
buttons.open.addEventListener("click", openEvent);
|
buttons.open.addEventListener("click", openEvent);
|
||||||
|
buttons.move.addEventListener("click", moveEvent);
|
||||||
|
|
||||||
templates.question = document.querySelector('#question-template');
|
templates.question = document.querySelector('#question-template');
|
||||||
templates.info = document.querySelector('#info-template');
|
templates.info = document.querySelector('#info-template');
|
||||||
|
templates.move = document.querySelector("#move-template");
|
||||||
|
|
||||||
if (user.AllowEdit) {
|
if (user.AllowEdit) {
|
||||||
buttons.delete.addEventListener("click", deleteEvent);
|
buttons.delete.addEventListener("click", deleteEvent);
|
||||||
|
@ -80,6 +80,12 @@
|
|||||||
<i class="material-icons" title="See raw">open_in_new</i>
|
<i class="material-icons" title="See raw">open_in_new</i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{- if .User.AllowEdit }}
|
||||||
|
<div class="action" id="move">
|
||||||
|
<i class="material-icons" title="Move">forward</i>
|
||||||
|
</div>
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- if and .IsDir .User.AllowEdit }}
|
{{- if and .IsDir .User.AllowEdit }}
|
||||||
<div class="action" id="rename">
|
<div class="action" id="rename">
|
||||||
<i class="material-icons" title="Edit">mode_edit</i>
|
<i class="material-icons" title="Edit">mode_edit</i>
|
||||||
@ -186,6 +192,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template id="move-template">
|
||||||
|
<form class="prompt">
|
||||||
|
<h3>Move</h3>
|
||||||
|
<p></p>
|
||||||
|
|
||||||
|
<div class="file-list">
|
||||||
|
<ul>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button type="submit" autofocus class="ok">OK</button>
|
||||||
|
<button class="cancel" onclick="closePrompt(event);">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</template>
|
||||||
|
|
||||||
<div class="help">
|
<div class="help">
|
||||||
<h3>Help</h3>
|
<h3>Help</h3>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user