diff --git a/README.md b/README.md index fa29ffb..6a4f342 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # lolisafe, a small safe worth protecting -![safe.fiery.me](https://i.fiery.me/3zrP.png) +![safe.fiery.me](https://i.fiery.me/hIty.png) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/WeebDev/lolisafe/master/LICENSE) [![Chat / Support](https://img.shields.io/badge/Chat%20%2F%20Support-discord-7289DA.svg?style=flat-square)](https://discord.gg/5g6vgwn) diff --git a/public/css/home.css b/public/css/home.css index 50690f8..3a1f97b 100644 --- a/public/css/home.css +++ b/public/css/home.css @@ -107,7 +107,12 @@ } .uploads { - margin-bottom: .75rem; + padding-top: 1rem; + margin-bottom: 1rem; +} + +.uploads.nojs { + margin-bottom: 0; } .uploads progress { diff --git a/public/js/home.js b/public/js/home.js index accda64..1e4d614 100644 --- a/public/js/home.js +++ b/public/js/home.js @@ -252,6 +252,7 @@ page.prepareDropzone = () => { }) page.dropzone.on('addedfile', file => { + tabDiv.getElementsByClassName('uploads')[0].style.display = 'block' file.previewElement.querySelector('.name').innerHTML = file.name }) @@ -298,11 +299,21 @@ page.uploadUrls = async button => { if (button.classList.contains('is-loading')) { return } button.classList.add('is-loading') - const albumid = page.album - const previewsContainer = tabDiv.getElementsByClassName('uploads')[0] - const files = document.getElementById('urls').value - .split(/\r?\n/) - .map(url => { + await new Promise(async (resolve, reject) => { + const albumid = page.album + const previewsContainer = tabDiv.getElementsByClassName('uploads')[0] + const urls = document.getElementById('urls').value + .split(/\r?\n/) + .filter(url => url.trim().length) + document.getElementById('urls').value = urls.join('\n') + + if (!urls.length) { + // eslint-disable-next-line prefer-promise-reject-errors + return reject('You have not entered any URLs.') + } + + tabDiv.getElementsByClassName('uploads')[0].style.display = 'block' + const files = urls.map(url => { const previewTemplate = document.createElement('template') previewTemplate.innerHTML = page.previewTemplate.trim() const previewElement = previewTemplate.content.firstChild @@ -314,7 +325,6 @@ page.uploadUrls = async button => { } }) - await new Promise(resolve => { const post = async i => { if (i === files.length) { return resolve() } const file = files[i] @@ -345,6 +355,8 @@ page.uploadUrls = async button => { post(i + 1) } post(0) + }).catch(error => { + swal('An error occurred!', error.toString(), 'error') }) button.classList.remove('is-loading') diff --git a/views/_globals.njk b/views/_globals.njk index fb733e7..d006278 100644 --- a/views/_globals.njk +++ b/views/_globals.njk @@ -13,7 +13,7 @@ v2: Images and config files (manifest.json, browserconfig.xml, etc). v3: CSS and JS files (libs such as bulma, lazyload, etc). #} -{% set v1 = "HrvcYD3KTh" %} +{% set v1 = "dSRVE9qwPF" %} {% set v2 = "Ii3JYKIhb0" %} {% set v3 = "HrvcYD3KTh" %} diff --git a/views/home.njk b/views/home.njk index ea6315a..382226e 100644 --- a/views/home.njk +++ b/views/home.njk @@ -46,41 +46,39 @@ -
- {% if urlMaxSize -%} - - {%- endif %} - - {% if urlMaxSize -%} - - {%- endif %} + {% if urlMaxSize -%} + + {%- endif %} + + {% if urlMaxSize -%} + + {%- endif %}
diff --git a/views/nojs.njk b/views/nojs.njk index e99e9c2..3cfc3e1 100644 --- a/views/nojs.njk +++ b/views/nojs.njk @@ -23,50 +23,41 @@
-
-

- Files uploaded through this No-JS uploader will not be associated to your account, if you have any. -

-
-
- {% if renderOptions.uploadDisabled -%} - {{ renderOptions.uploadDisabled }} - {%- else -%} -
-
- -
-
- -
-
- {%- endif %} +

+ Files uploaded through this No-JS uploader will not be associated to your account, if you have any. +

+ {% if renderOptions.uploadDisabled -%} + {{ renderOptions.uploadDisabled }} + {%- else -%} +
+
+ +
+
+ +
+
+ {%- endif %} + {% if files -%} +
+ {% for file in files -%} +
+ {% if errorMessage -%} +

{{ errorMessage | safe }}

+ {%- endif %} + {% if file.url -%} + + {%- endif %} +
+ {% endfor %}
+ {%- endif %}
- {% if files -%} -
- {% for file in files -%} -
-
-
- {% if errorMessage -%} -

{{ errorMessage | safe }}

- {%- endif %} - {% if file.url -%} - - {%- endif %} -
-
-
- {% endfor %} -
- {%- endif %} - {% set plain_links = true %} {% include "_partial/links.njk" %}