From c7751f02310eececfeaa086ed43998b3d9eca4af Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 6 Mar 2016 16:36:22 +0100 Subject: [PATCH] Move to next photo after after moving a picture #437 --- src/scripts/photo.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/scripts/photo.js b/src/scripts/photo.js index a636938..92bd026 100644 --- a/src/scripts/photo.js +++ b/src/scripts/photo.js @@ -335,14 +335,12 @@ photo.setTitle = function(photoIDs) { photo.setAlbum = function(photoIDs, albumID) { - let nextPhoto - let previousPhoto + let nextPhoto = null + let previousPhoto = null if (!photoIDs) return false if (photoIDs instanceof Array===false) photoIDs = [ photoIDs ] - if (visible.photo) lychee.goto(album.getID()) - photoIDs.forEach(function(id, index, array) { // Change reference for the next and previous photo @@ -363,6 +361,11 @@ photo.setAlbum = function(photoIDs, albumID) { albums.refresh() + // Go to next photo if there is a next photo and + // next photo is not the current one. Show album otherwise. + if (visible.photo() && nextPhoto!=null && nextPhoto!==photo.getID()) lychee.goto(album.getID() + '/' + nextPhoto) + else if (!visible.albums()) lychee.goto(album.getID()) + let params = { photoIDs: photoIDs.join(), albumID