Browse Source

When deleting picture from album show next picture #242

Tobias Reich 9 years ago
parent
commit
263eed3447
2 changed files with 8 additions and 6 deletions
  1. 0 0
      dist/main.js
  2. 8 6
      src/scripts/photo.js

File diff suppressed because it is too large
+ 0 - 0
dist/main.js


+ 8 - 6
src/scripts/photo.js

@@ -53,7 +53,7 @@ photo = {
 
 	},
 
-	//preload the next photo for better response time
+	// Preload the next photo for better response time
 	preloadNext: function(photoID) {
 
 		var nextPhoto,
@@ -185,8 +185,8 @@ photo = {
 		buttons = [
 			["", function() {
 
-				var nextPhoto,
-					previousPhoto;
+				var nextPhoto = "",
+					previousPhoto = "";
 
 				photoIDs.forEach(function(id, index, array) {
 
@@ -206,11 +206,13 @@ photo = {
 
 				});
 
-				// Only when search is not active
-				if (!visible.albums()) lychee.goto(album.getID());
-
 				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!==""&&nextPhoto!==photo.getID()) lychee.goto(album.getID() + "/" + nextPhoto);
+				else if (!visible.albums()) lychee.goto(album.getID());
+
 				params = "deletePhoto&photoIDs=" + photoIDs;
 				lychee.api(params, function(data) {
 

Some files were not shown because too many files changed in this diff