diff --git a/frontend/src/ketr-photos/ketr-photos.html b/frontend/src/ketr-photos/ketr-photos.html index e70088a..d85ee89 100755 --- a/frontend/src/ketr-photos/ketr-photos.html +++ b/frontend/src/ketr-photos/ketr-photos.html @@ -427,6 +427,11 @@ console.log("Max per day: " + this.cols); } + var albums = this.querySelectorAll(".album-line"); + if (albums.length) { + lastPath = albums[albums.length - 1]; + } + thisDay = 0; for (var i = 0; i < photos.length; i++) { var photo = photos[i], @@ -438,6 +443,26 @@ thumbnail.addEventListener("load-album", this.loadAlbum.bind(this)); datetime = (photo.taken || photo.modified || photo.added).replace(/T.*$/, ""); + if (this.order == "by-album") { + if (lastPath != photo.path) { + lastPath = photo.path; + var albumBlock = document.createElement("div"); + albumBlock.classList.add("album-line"); + albumBlock.classList.add("layout"); + albumBlock.classList.add("horizontal"); + var trail = this.breadcrumb(lastPath); + trail.forEach(function(crumb) { + var div = document.createElement("div"); + div.path = crumb.path; + div.textContent = crumb.name + " /"; + div.addEventListener("tap", this.pathTapped.bind(this)); + albumBlock.appendChild(div); + }.bind(this)); + + Polymer.dom(this.$.thumbnails).appendChild(albumBlock); + } + } + if (this.breakOnDayChange) { var dateBlock = this.querySelector("#date-" + datetime); if (!dateBlock) { @@ -463,25 +488,6 @@ } } - if (this.order == "by-album") { - if (lastPath != photo.path) { - lastPath = photo.path; - var albumBlock = document.createElement("div"); - albumBlock.classList.add("album-line"); - albumBlock.classList.add("layout"); - albumBlock.classList.add("horizontal"); - var trail = this.breadcrumb(lastPath); - trail.forEach(function(crumb) { - var div = document.createElement("div"); - div.path = crumb.path; - div.textContent = crumb.name + " /"; - div.addEventListener("tap", this.pathTapped.bind(this)); - albumBlock.appendChild(div); - }.bind(this)); - - Polymer.dom(this.$.thumbnails).appendChild(albumBlock); - } - } if (!this.limitPerFolder || thisDay < this.cols) { Polymer.dom(this.$.thumbnails).appendChild(thumbnail);