Improved formatting

This commit is contained in:
2021-11-27 10:59:29 +01:00
parent 19db5f3575
commit ae4eb30a73
4 changed files with 36 additions and 21 deletions

View File

@ -3,7 +3,9 @@ session_start();
require __DIR__ . '/vendor/autoload.php';
use PhotoPrismUpload\API\PhotoPrism;
$footer = '<footer style="position: fixed;bottom: 0;left: 0;"><a href="/git/phlaym/photoprismupload">Ich bin Open Source</a></footer>';
$footer = '<footer style="position: fixed;bottom: 0;left: 0;">'
.'<a href="/git/phlaym/photoprismupload">Ich bin Open Source</a></footer>';
?>
<html>
<head>
@ -258,7 +260,9 @@ if (!isset($_POST['submit'])) {
window.tooManyFiles = fileList.length > maxAmountOfFiles;
if (window.tooManyFiles) {
errorDiv.style.display = 'block';
errorDiv.innerHTML += `Das sind zu viele Dateien, du darfst max. ${maxAmountOfFiles} Dateien gleichzeitig hochladen. `;
errorDiv.innerHTML += ```
Das sind zu viele Dateien, du darfst max.
${maxAmountOfFiles} Dateien gleichzeitig hochladen. ```;
submitButton.disabled = true;
console.warn('Total files:', target.files.length, '. Too many!');
}
@ -267,8 +271,12 @@ if (!isset($_POST['submit'])) {
if (window.tooLarge) {
const names = filesTooLarge.join(', ')
errorDiv.style.display = 'block';
const pluralizedMessage = filesTooLarge.length > 1 ? 'Die folgenden Dateien sind' : 'Die folgende Datei ist';
errorDiv.innerHTML += `${pluralizedMessage} zu groß: ${names}. Jede Datei darf max. ${maxFileSize} MB groß sein.`;
const pluralizedMessage = filesTooLarge.length > 1
? 'Die folgenden Dateien sind'
: 'Die folgende Datei ist';
errorDiv.innerHTML += ```
${pluralizedMessage} zu groß: ${names}.
Jede Datei darf max. ${maxFileSize} MB groß sein.```;
submitButton.disabled = true;
}
});