Updated home.js

* Cache selected album the exact moment "Upload URLs" button is pressed, so that any in progress requests will not have its album id altered.

* All URLs will now be displayed in the uploads list (the thing in between upload buttons and footer links) the moment "Upload URLs" button is pressed. Previously it would only show the URLs one by one after each finished request.
Brief video: https://i.fiery.me/AByv.mp4.
This commit is contained in:
Bobby Wibowo 2018-05-11 22:10:49 +07:00
parent 933fcb8612
commit 4d634196c5
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF
2 changed files with 5 additions and 6 deletions

View File

@ -298,6 +298,7 @@ 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/)
@ -305,8 +306,9 @@ page.uploadUrls = async button => {
const previewTemplate = document.createElement('template')
previewTemplate.innerHTML = page.previewTemplate.trim()
const previewElement = previewTemplate.content.firstChild
previewElement.querySelector('.name').innerHTML = url
previewsContainer.appendChild(previewElement)
return {
name: url,
url,
previewElement
}
@ -316,9 +318,6 @@ page.uploadUrls = async button => {
const post = async i => {
if (i === files.length) { return resolve() }
const file = files[i]
file.previewElement.querySelector('.name').innerHTML = file.name
previewsContainer.appendChild(file.previewElement)
const response = await axios.post('api/upload',
{
urls: [file.url]
@ -326,7 +325,7 @@ page.uploadUrls = async button => {
{
headers: {
token: page.token,
albumid: page.album
albumid
}
})
.then(response => response.data)

View File

@ -12,7 +12,7 @@
v1: CSS and JS files.
v2: Images and config files (manifest.json, browserconfig.xml, etcetera).
#}
{% set v1 = "ZIUmml610x" %}
{% set v1 = "HrvcYD3KTh" %}
{% set v2 = "Ii3JYKIhb0" %}
{#