Wait for content to be loaded before showing photo

This commit is contained in:
Tobias Reich 2016-03-06 18:32:20 +01:00
parent d31bbefbdc
commit 0096e2769f

View File

@ -24,6 +24,21 @@ photo.getID = function() {
photo.load = function(photoID, albumID) { photo.load = function(photoID, albumID) {
const checkContent = function() {
if (album.json!=null) photo.load(photoID, albumID)
else setTimeout(checkContent, 100)
}
const checkPasswd = function() {
if (password.value!=='') photo.load(photoID, albumID)
else setTimeout(checkPasswd, 200)
}
if (album.json==null) {
checkContent()
return false
}
let params = { let params = {
photoID, photoID,
albumID, albumID,
@ -32,11 +47,6 @@ photo.load = function(photoID, albumID) {
api.post('Photo::get', params, function(data) { api.post('Photo::get', params, function(data) {
const checkPasswd = function() {
if (password.value!=='') photo.load(photoID, albumID)
else setTimeout(checkPasswd, 250)
}
if (data==='Warning: Photo private!') { if (data==='Warning: Photo private!') {
lychee.content.show() lychee.content.show()
lychee.goto() lychee.goto()