diff --git a/themes/default/public/js/lufi-download.js b/themes/default/public/js/lufi-download.js index 5f95b76..5e70021 100644 --- a/themes/default/public/js/lufi-download.js +++ b/themes/default/public/js/lufi-download.js @@ -39,7 +39,7 @@ document.addEventListener("DOMContentLoaded", () => { passwordFormDOM.onsubmit = (event) => { event.preventDefault(); - passwordFormDOM.classList.add("hidden"); + hideNode(passwordFormDOM); startDownload(); }; @@ -48,14 +48,14 @@ document.addEventListener("DOMContentLoaded", () => { const showZipContent = (zipFile, cardDOM) => { const zipContainerDOM = cardDOM.querySelector(".content .zip-container"); - zipContainerDOM.classList.remove("hidden"); + showNode(zipContainerDOM); zipContainerDOM.querySelector(".action-show-zip").onclick = (event) => { - event.target.classList.add("hidden"); + hideNode(event.target); const zipContentDOM = zipContainerDOM.querySelector(".zip-content"); - zipContentDOM.classList.remove("hidden"); + showNode(zipContentDOM); document.body.style.cursor = "wait"; @@ -64,7 +64,7 @@ document.addEventListener("DOMContentLoaded", () => { .andThen((job) => job.waitForCompletion()) .map((job) => { job.archiveFiles.forEach((file) => { - const itemDOM = zipContainerDOM + const itemDOM = document .querySelector("template#zip-item") .content.cloneNode(true).children[0]; diff --git a/themes/default/public/js/lufi-list-invitations.js b/themes/default/public/js/lufi-list-invitations.js index 020df17..ce3a564 100644 --- a/themes/default/public/js/lufi-list-invitations.js +++ b/themes/default/public/js/lufi-list-invitations.js @@ -31,14 +31,14 @@ const toggleHidden = () => { if (invitationsListDOM.getAttribute("data-visibility") === "hidden") { toggleButtonDOM.innerText = i18n.hideText; - itemsHiddenDOM.forEach((item) => item.classList.remove("hidden")); + itemsHiddenDOM.forEach((item) => showNode(item)); invitationsListDOM.setAttribute("data-visibility", "shown"); } else { toggleButtonDOM.innerText = i18n.showText; itemsHiddenDOM.forEach((item) => { - item.classList.add("hidden"); + hideNode(item); const checkbox = item.querySelector("input"); @@ -157,7 +157,7 @@ const toggleVisibility = () => { if (t.show) { itemDOM.setAttribute("data-visibility", 1); - itemDOM.classList.remove("hidden"); + showNode(itemDOM); itemDOM .querySelector(".column.selection .icon.hide-source") .remove(); @@ -169,7 +169,7 @@ const toggleVisibility = () => { .querySelector(".invitations-list") .getAttribute("data-visibility") === "hidden" ) { - itemDOM.classList.add("hidden"); + hideNode(itemDOM); } itemDOM diff --git a/themes/default/public/js/lufi-upload.js b/themes/default/public/js/lufi-upload.js index 928c2e5..49c0cc4 100644 --- a/themes/default/public/js/lufi-upload.js +++ b/themes/default/public/js/lufi-upload.js @@ -70,14 +70,15 @@ document.addEventListener("DOMContentLoaded", () => { }; const clearZip = () => { - zipZoneDOM.classList.add("hidden"); - zipZoneDOM.querySelector(".action-upload-zip").classList.remove("hidden"); - zipZoneDOM.querySelector(".zip-compressing").classList.add("hidden"); + hideNode(zipZoneDOM); + showNode(zipZoneDOM.querySelector(".action-upload-zip")); + hideNode(zipZoneDOM.querySelector(".zip-compressing")); + hideNode(inputZipNameDOM); + zipZoneDOM.querySelector(".files-list").replaceChildren(); - inputZipNameDOM.classList.add("hidden"); - archiveEntries = undefined; + zipSize = 0; mustZipDOM.checked = false; }; @@ -176,7 +177,7 @@ document.addEventListener("DOMContentLoaded", () => { } if (fileCardsDOM.querySelectorAll(".file-card.success").length > 0) { - uploadedZoneDOM.querySelector(".buttons").classList.remove("hidden"); + showNode(uploadedZoneDOM.querySelector(".buttons")); } return cardDOM; @@ -191,7 +192,7 @@ document.addEventListener("DOMContentLoaded", () => { if (!mustZipDOM.checked) { clearZip(); } else { - inputZipNameDOM.classList.remove("hidden"); + showNode(inputZipNameDOM); } }; @@ -237,7 +238,8 @@ document.addEventListener("DOMContentLoaded", () => { password ); } else { - zipZoneDOM.classList.remove("hidden"); + showNode(zipZoneDOM); + lufi .addFilesToArchive(files, archiveEntries) .andThen((entries) => { @@ -295,11 +297,11 @@ document.addEventListener("DOMContentLoaded", () => { updateMailLinksButton(serverKey, true); if (fileCardsDOM.children.length === 0) { - uploadedZoneDOM.classList.add("hidden"); + hideNode(uploadedZoneDOM); } if (fileCardsDOM.querySelectorAll(".file-card.success").length === 0) { - uploadedZoneDOM.querySelector(".buttons").classList.add("hidden"); + hideNode(uploadedZoneDOM); } }; @@ -388,7 +390,7 @@ document.addEventListener("DOMContentLoaded", () => { zipName, password ) => { - uploadedZoneDOM.classList.remove("hidden"); + showNode(uploadedZoneDOM); const serverUrl = new URL(ws_url.replace("/upload", "")); serverUrl.protocol = serverUrl.protocol === "ws:" ? "http:" : "https:"; @@ -511,8 +513,8 @@ document.addEventListener("DOMContentLoaded", () => { const uploadZip = () => { document.body.style.cursor = "wait"; - zipZoneDOM.querySelector(".action-upload-zip").classList.add("hidden"); - zipZoneDOM.querySelector(".zip-compressing").classList.remove("hidden"); + hideNode(zipZoneDOM.querySelector(".action-upload-zip")); + showNode(zipZoneDOM.querySelector(".zip-compressing")); const { zipName, deleteDays, shouldDeleteOnFirstView, password } = retrieveUploadParams(); @@ -522,9 +524,15 @@ document.addEventListener("DOMContentLoaded", () => { .andThen((job) => { document.body.style.cursor = "auto"; + zipZoneDOM.querySelector(".action-close").onclick = () => { + job.terminate(); + + clearZip(); + }; + return job.waitForCompletion(); }) - .andThen((job) => { + .map((job) => { // if '.zip-zone' is hidden, the zipping has been aborted if (!zipZoneDOM.classList.contains("hidden")) { addToast(i18n.enqueued.replace("XXX", zipName), "success"); diff --git a/themes/default/templates/about.html.ep b/themes/default/templates/about.html.ep index fc60ecc..d0af0d2 100644 --- a/themes/default/templates/about.html.ep +++ b/themes/default/templates/about.html.ep @@ -1,23 +1,24 @@
-

<%= l('What is Lufi?') %>

-

<%= l('Lufi is a free (as in free speech) file hosting software.') %>

-

<%= l('Privacy') %>

-

<%= l('The files uploaded on a Lufi instance are encrypted before the upload to the server: the administrator of the server can not see the file\'s content.') %>
- <%= l('The administrator can only see the file\'s name, its size and its mimetype (what kind of file it is: video, text, etc.).') %>

-

<%= l('You don\'t need to register yourself to upload files but be aware that, for legal reasons, your IP address will be stored when you send a file. Don\'t panic, this is normally the case for all sites on which you send files.') %>

-

<%= l('How does it work?') %>

-

<%= l('Drag and drop files in the appropriate area or use the traditional way to send files and the files will be chunked, encrypted and sent to the server. You will get two links per file: a download link, that you give to the people you want to share the file with and a deletion link, allowing you to delete the file whenever you want.') %>

-

<%= l('You can see the list of your files by clicking on the "My files" link at the top right of this page.') %>

-

<%= l('How to report an illegal file?') %>

-

<%== l('Please contact the administrator: %1', config('contact')) %>

-

<%= l('Who wrote this software?') %>

-

<%== l('The original (and only for now) author is Luc Didry.') %>

-

<%= l('How to install the software on my server?') %>

-

<%== l('As Lufi is a free software licensed under of the terms of the AGPLv3, you can install it on you own server. Have a look on the Wiki for the procedure.') %>
- <%== l('Get the source code on the official repository or on its Github mirror') %> -

-

<%= l('Version') %>

-

<%== l('Latest tag of this instance: %1', sprintf('%s', stash('version')->{tag}, stash('version')->{tag})) %>

-

<%== l('Latest commit of this instance: %1', sprintf('%s', stash('version')->{commit}, stash('version')->{commit})) %>

-

<%= link_to url_for('/') => ( class => "button action-back-homepage" ) => begin %><%= l('Back to homepage') %><% end%>

+

<%= l('About') %>

+

<%= l('What is Lufi?') %>

+

<%= l('Lufi is a free (as in free speech) file hosting software.') %>

+

<%= l('Privacy') %>

+

<%= l('The files uploaded on a Lufi instance are encrypted before the upload to the server: the administrator of the server can not see the file\'s content.') %>
+ <%= l('The administrator can only see the file\'s name, its size and its mimetype (what kind of file it is: video, text, etc.).') %>

+

<%= l('You don\'t need to register yourself to upload files but be aware that, for legal reasons, your IP address will be stored when you send a file. Don\'t panic, this is normally the case for all sites on which you send files.') %>

+

<%= l('How does it work?') %>

+

<%= l('Drag and drop files in the appropriate area or use the traditional way to send files and the files will be chunked, encrypted and sent to the server. You will get two links per file: a download link, that you give to the people you want to share the file with and a deletion link, allowing you to delete the file whenever you want.') %>

+

<%= l('You can see the list of your files by clicking on the "My files" link at the top right of this page.') %>

+

<%= l('How to report an illegal file?') %>

+

<%== l('Please contact the administrator: %1', config('contact')) %>

+

<%= l('Who wrote this software?') %>

+

<%== l('The original (and only for now) author is Luc Didry.') %>

+

<%= l('How to install the software on my server?') %>

+

<%== l('As Lufi is a free software licensed under of the terms of the AGPLv3, you can install it on you own server. Have a look on the Wiki for the procedure.') %>
+ <%== l('Get the source code on the official repository or on its Github mirror') %> +

+

<%= l('Version') %>

+

<%== l('Latest tag of this instance: %1', sprintf('%s', stash('version')->{tag}, stash('version')->{tag})) %>

+

<%== l('Latest commit of this instance: %1', sprintf('%s', stash('version')->{commit}, stash('version')->{commit})) %>

+

<%= link_to url_for('/') => ( class => "button action-back-homepage" ) => begin %><%= l('Back to homepage') %><% end%>

diff --git a/themes/default/templates/files.html.ep b/themes/default/templates/files.html.ep index d5faecf..69d782d 100644 --- a/themes/default/templates/files.html.ep +++ b/themes/default/templates/files.html.ep @@ -31,7 +31,7 @@ - + @@ -52,12 +52,12 @@ diff --git a/themes/default/templates/index.html.ep b/themes/default/templates/index.html.ep index 9007345..d4a31a3 100644 --- a/themes/default/templates/index.html.ep +++ b/themes/default/templates/index.html.ep @@ -29,7 +29,7 @@
- + +
- +
diff --git a/themes/default/templates/invitations/my_invitations.html.ep b/themes/default/templates/invitations/my_invitations.html.ep index 500c60b..77fd004 100644 --- a/themes/default/templates/invitations/my_invitations.html.ep +++ b/themes/default/templates/invitations/my_invitations.html.ep @@ -17,13 +17,13 @@
<%= l('Action') %> <%= l('File name') %> <%= l('Download link') %> <%= l('Counter') %>
- +
- + @@ -66,10 +66,10 @@ - + - +
- + - + @@ -34,10 +34,10 @@ % my $class = ''; % $class = 'deleted' unless $e->is_valid; % $class .= ' hidden' unless $e->show_in_list; - +
<%= l('Selection') %> <%= l('Guest mail') %> <%= l('URL') %> <%= l('Created at') %> <%= l('Expire at') %> <%= l('Files sent at') %><%= l('Files') %>
- + % unless ($e->show_in_list) { @@ -70,7 +70,7 @@
-

+

<%= l('Files sent in invitation XX1 by XX2') %>

diff --git a/themes/default/templates/layouts/default.html.ep b/themes/default/templates/layouts/default.html.ep index 549aedc..0974224 100644 --- a/themes/default/templates/layouts/default.html.ep +++ b/themes/default/templates/layouts/default.html.ep @@ -143,6 +143,16 @@ }); } }; + + const hideNode = (node) => { + node.classList.add("hidden"); + node.setAttribute("aria-hidden", true); + } + + const showNode = (node) => { + node.classList.remove("hidden"); + node.setAttribute("aria-hidden", false); + } document.addEventListener("DOMContentLoaded", () => { if (!"Notification" in window || typeof Notification === "undefined") { diff --git a/themes/default/templates/login.html.ep b/themes/default/templates/login.html.ep index cf68b6e..b5159ef 100644 --- a/themes/default/templates/login.html.ep +++ b/themes/default/templates/login.html.ep @@ -10,11 +10,11 @@