Skip to content

Commit

Permalink
Merge pull request Aidenir#5 from electerious/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
qligier committed Mar 22, 2016
2 parents 456e881 + 6998ae0 commit 45a5713
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 61 deletions.
File renamed without changes.
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Detailed description of the problem

### Steps to reproduce the issue

### Output of the diagnostics (Settings => Diagnostics)

### Browser and system
6 changes: 3 additions & 3 deletions dist/main.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/view.js

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions src/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,7 @@ build.uploadModal = function(title, files) {
html += lychee.html`
<div class='row'>
<a class='name'>$${ file.name }</a>
`

if (file.supported===true) html += `<a class='status'></a>`
else html += `<a class='status error'>Not supported</a>`

html += `
<a class='status'></a>
<p class='notice'></p>
</div>
`
Expand Down
63 changes: 13 additions & 50 deletions src/scripts/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ upload.start = {

const process = function(files, file) {

let formData = new FormData()
let xhr = new XMLHttpRequest()
let pre_progress = 0
let progress = 0
let formData = new FormData()
let xhr = new XMLHttpRequest()
let pre_progress = 0
let progress = 0
let next_file_started = false

const finish = function() {

Expand Down Expand Up @@ -84,35 +85,6 @@ upload.start = {

}

// Check if file is supported
if (file.supported===false) {

// Skip file
if (file.next!=null) process(files, file.next)
else {

// Look for supported files
// If zero files are supported, hide the upload after a delay

let hasSupportedFiles = false

for (let i = 0; i < files.length; i++) {

if (files[i].supported===true) {
hasSupportedFiles = true
break
}

}

if (hasSupportedFiles===false) setTimeout(finish, 2000)

}

return false

}

formData.append('function', 'Photo::add')
formData.append('albumID', albumID)
formData.append(0, file)
Expand Down Expand Up @@ -205,7 +177,7 @@ upload.start = {
pre_progress = progress
}

if (progress>=100) {
if (progress>=100 && next_file_started===false) {

// Scroll to the uploading file
let scrollPos = 0
Expand All @@ -216,7 +188,10 @@ upload.start = {
$('.basicModal .rows .row:nth-child(' + (file.num + 1) + ') .status').html('Processing')

// Upload next file
if (file.next!=null) process(files, file.next)
if (file.next!=null) {
process(files, file.next)
next_file_started = true
}

}

Expand All @@ -233,19 +208,10 @@ upload.start = {

files[i].num = i
files[i].ready = false
files[i].supported = true

if (i < files.length-1) files[i].next = files[i + 1]
else files[i].next = null

// Check if file is supported
if (files[i].type!=='image/jpeg' && files[i].type!=='image/jpg' && files[i].type!=='image/png' && files[i].type!=='image/gif') {

files[i].ready = true
files[i].supported = false

}

}

window.onbeforeunload = function() { return 'Lychee is currently uploading!' }
Expand Down Expand Up @@ -276,8 +242,7 @@ upload.start = {
basicModal.close()

files[0] = {
name : data.link,
supported : true
name : data.link
}

upload.show('Importing URL', files, function() {
Expand Down Expand Up @@ -356,8 +321,7 @@ upload.start = {
let files = []

files[0] = {
name : data.path,
supported : true
name : data.path
}

upload.show('Importing from server', files, function() {
Expand Down Expand Up @@ -466,8 +430,7 @@ upload.start = {
links += files[i].link + ','

files[i] = {
name : files[i].link,
supported : true
name : files[i].link
}

}
Expand Down

0 comments on commit 45a5713

Please sign in to comment.