Quickly switch between photos

This commit is contained in:
Tobias Reich 2015-02-07 00:04:20 +01:00
parent dd2a57e5f8
commit d0616d678b
2 changed files with 38 additions and 6 deletions

View File

@ -77,19 +77,21 @@ contextMenu.albumTitle = function(albumID, e) {
api.post('Album::getAll', {}, function(data) {
if (data.num!==0) {
if (data.num>1) {
items.push({ type: 'separator' });
// Generate list of albums
$.each(data.content, function(index) {
var that = this;
var that = this,
title = '';
if (!that.thumb0) that.thumb0 = 'src/images/no_cover.svg';
that.title = "<img class='albumCover' width='16' height='16' src='" + that.thumb0 + "'><div class='albumTitle'>" + that.title + "</div>";
if (that.id!=album.getID()) items.push({ type: 'item', title: that.title, fn: function() { lychee.goto(that.id) } });
title = "<img class='cover' width='16' height='16' src='" + that.thumb0 + "'><div class='title'>" + that.title + "</div>";
if (that.id!=albumID) items.push({ type: 'item', title, fn: function() { lychee.goto(that.id) } });
});
@ -145,6 +147,36 @@ contextMenu.photoMulti = function(photoIDs, e) {
}
contextMenu.photoTitle = function(albumID, photoID, e) {
var items = [
{ type: 'item', title: build.iconic('pencil') + 'Rename', fn: function() { photo.setTitle([photoID]) } }
];
var data = album.json;
if (data.num>1) {
items.push({ type: 'separator' });
// Generate list of albums
$.each(data.content, function(index) {
var that = this,
title = '';
title = "<img class='cover' width='16' height='16' src='" + that.thumbUrl + "'><div class='title'>" + that.title + "</div>";
if (that.id!=photoID) items.push({ type: 'item', title, fn: function() { lychee.goto(albumID + '/' + that.id) } });
});
}
basicContext.show(items, e, contextMenu.close);
}
contextMenu.photoMore = function(photoID, e) {
var items = [

View File

@ -15,8 +15,8 @@ $(document).ready(function() {
/* Header */
header.dom('#title').on(eventName, function(e) {
if (!$(this).hasClass('editable')) return false;
if (visible.photo()) photo.setTitle([photo.getID()]);
else contextMenu.albumTitle([album.getID()], e);
if (visible.photo()) contextMenu.photoTitle(album.getID(), photo.getID(), e);
else contextMenu.albumTitle(album.getID(), e);
});
header.dom('#button_share').on(eventName, function(e) {
if (photo.json.public==1||photo.json.public==2) contextMenu.sharePhoto(photo.getID(), e);