|
|
@ -1,6 +1,6 @@
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @description Responsible to reflect data changes to the UI.
|
|
|
|
* @description Responsible to reflect data changes to the UI.
|
|
|
|
* @copyright 2015 by Tobias Reich
|
|
|
|
* @copyright 2015 by Tobias Reich
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
view = {}
|
|
|
|
view = {}
|
|
|
@ -9,14 +9,14 @@ view.albums = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
|
init: function() {
|
|
|
|
|
|
|
|
|
|
|
|
view.albums.title();
|
|
|
|
view.albums.title()
|
|
|
|
view.albums.content.init();
|
|
|
|
view.albums.content.init()
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
title: function() {
|
|
|
|
title: function() {
|
|
|
|
|
|
|
|
|
|
|
|
lychee.setTitle('Albums', false);
|
|
|
|
lychee.setTitle('Albums', false)
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
@ -26,68 +26,67 @@ view.albums = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
|
init: function() {
|
|
|
|
|
|
|
|
|
|
|
|
var smartData = '',
|
|
|
|
let smartData = '',
|
|
|
|
albumsData = '';
|
|
|
|
albumsData = ''
|
|
|
|
|
|
|
|
|
|
|
|
/* Smart Albums */
|
|
|
|
// Smart Albums
|
|
|
|
if (lychee.publicMode===false) {
|
|
|
|
if (lychee.publicMode===false) {
|
|
|
|
|
|
|
|
|
|
|
|
albums.parse(albums.json.smartalbums.unsorted);
|
|
|
|
albums.parse(albums.json.smartalbums.unsorted)
|
|
|
|
albums.parse(albums.json.smartalbums.public);
|
|
|
|
albums.parse(albums.json.smartalbums.public)
|
|
|
|
albums.parse(albums.json.smartalbums.starred);
|
|
|
|
albums.parse(albums.json.smartalbums.starred)
|
|
|
|
albums.parse(albums.json.smartalbums.recent);
|
|
|
|
albums.parse(albums.json.smartalbums.recent)
|
|
|
|
|
|
|
|
|
|
|
|
smartData = build.divider('Smart Albums') + build.album(albums.json.smartalbums.unsorted) + build.album(albums.json.smartalbums.public) + build.album(albums.json.smartalbums.starred) + build.album(albums.json.smartalbums.recent);
|
|
|
|
smartData = build.divider('Smart Albums') + build.album(albums.json.smartalbums.unsorted) + build.album(albums.json.smartalbums.public) + build.album(albums.json.smartalbums.starred) + build.album(albums.json.smartalbums.recent)
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Albums */
|
|
|
|
// Albums
|
|
|
|
if (albums.json.albums&&albums.json.num!==0) {
|
|
|
|
if (albums.json.albums && albums.json.num!==0) {
|
|
|
|
|
|
|
|
|
|
|
|
$.each(albums.json.albums, function() {
|
|
|
|
$.each(albums.json.albums, function() {
|
|
|
|
albums.parse(this);
|
|
|
|
albums.parse(this)
|
|
|
|
albumsData += build.album(this);
|
|
|
|
albumsData += build.album(this)
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// Add divider
|
|
|
|
// Add divider
|
|
|
|
if (lychee.publicMode===false) albumsData = build.divider('Albums') + albumsData;
|
|
|
|
if (lychee.publicMode===false) albumsData = build.divider('Albums') + albumsData
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (smartData===''&&albumsData==='') {
|
|
|
|
if (smartData==='' && albumsData==='') {
|
|
|
|
lychee.content.html('');
|
|
|
|
lychee.content.html('')
|
|
|
|
$('body').append(build.no_content('eye'));
|
|
|
|
$('body').append(build.no_content('eye'))
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
lychee.content.html(smartData + albumsData);
|
|
|
|
lychee.content.html(smartData + albumsData)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Restore scroll position
|
|
|
|
// Restore scroll position
|
|
|
|
if (view.albums.content.scrollPosition!==null&&
|
|
|
|
if (view.albums.content.scrollPosition!==null && view.albums.content.scrollPosition!==0) {
|
|
|
|
view.albums.content.scrollPosition!==0) {
|
|
|
|
$(document).scrollTop(view.albums.content.scrollPosition)
|
|
|
|
$(document).scrollTop(view.albums.content.scrollPosition);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
title: function(albumID) {
|
|
|
|
title: function(albumID) {
|
|
|
|
|
|
|
|
|
|
|
|
var title = albums.getByID(albumID).title;
|
|
|
|
let title = albums.getByID(albumID).title
|
|
|
|
|
|
|
|
|
|
|
|
$('.album[data-id="' + albumID + '"] .overlay h1')
|
|
|
|
$('.album[data-id="' + albumID + '"] .overlay h1')
|
|
|
|
.html(title)
|
|
|
|
.html(title)
|
|
|
|
.attr('title', title);
|
|
|
|
.attr('title', title)
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
delete: function(albumID) {
|
|
|
|
delete: function(albumID) {
|
|
|
|
|
|
|
|
|
|
|
|
$('.album[data-id="' + albumID + '"]').css('opacity', 0).animate({
|
|
|
|
$('.album[data-id="' + albumID + '"]').css('opacity', 0).animate({
|
|
|
|
width: 0,
|
|
|
|
width : 0,
|
|
|
|
marginLeft: 0
|
|
|
|
marginLeft : 0
|
|
|
|
}, 300, function() {
|
|
|
|
}, 300, function() {
|
|
|
|
$(this).remove();
|
|
|
|
$(this).remove()
|
|
|
|
if (albums.json.num<=0) lychee.content.find('.divider:last-child').remove();
|
|
|
|
if (albums.json.num<=0) lychee.content.find('.divider:last-child').remove()
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -99,38 +98,38 @@ view.album = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
|
init: function() {
|
|
|
|
|
|
|
|
|
|
|
|
album.parse();
|
|
|
|
album.parse()
|
|
|
|
|
|
|
|
|
|
|
|
view.album.sidebar();
|
|
|
|
view.album.sidebar()
|
|
|
|
view.album.title();
|
|
|
|
view.album.title()
|
|
|
|
view.album.public();
|
|
|
|
view.album.public()
|
|
|
|
view.album.content.init();
|
|
|
|
view.album.content.init()
|
|
|
|
|
|
|
|
|
|
|
|
album.json.init = 1;
|
|
|
|
album.json.init = 1
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
title: function() {
|
|
|
|
title: function() {
|
|
|
|
|
|
|
|
|
|
|
|
if ((visible.album()||!album.json.init)&&!visible.photo()) {
|
|
|
|
if ((visible.album() || !album.json.init) && !visible.photo()) {
|
|
|
|
|
|
|
|
|
|
|
|
switch (album.getID()) {
|
|
|
|
switch (album.getID()) {
|
|
|
|
case 'f':
|
|
|
|
case 'f':
|
|
|
|
lychee.setTitle('Starred', false);
|
|
|
|
lychee.setTitle('Starred', false)
|
|
|
|
break;
|
|
|
|
break
|
|
|
|
case 's':
|
|
|
|
case 's':
|
|
|
|
lychee.setTitle('Public', false);
|
|
|
|
lychee.setTitle('Public', false)
|
|
|
|
break;
|
|
|
|
break
|
|
|
|
case 'r':
|
|
|
|
case 'r':
|
|
|
|
lychee.setTitle('Recent', false);
|
|
|
|
lychee.setTitle('Recent', false)
|
|
|
|
break;
|
|
|
|
break
|
|
|
|
case '0':
|
|
|
|
case '0':
|
|
|
|
lychee.setTitle('Unsorted', false);
|
|
|
|
lychee.setTitle('Unsorted', false)
|
|
|
|
break;
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
if (album.json.init) sidebar.changeAttr('title', album.json.title);
|
|
|
|
if (album.json.init) sidebar.changeAttr('title', album.json.title)
|
|
|
|
lychee.setTitle(album.json.title, true);
|
|
|
|
lychee.setTitle(album.json.title, true)
|
|
|
|
break;
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -141,64 +140,64 @@ view.album = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
|
init: function() {
|
|
|
|
|
|
|
|
|
|
|
|
var photosData = '';
|
|
|
|
let photosData = ''
|
|
|
|
|
|
|
|
|
|
|
|
if (album.json.content&&album.json.content!==false) {
|
|
|
|
if (album.json.content && album.json.content!==false) {
|
|
|
|
|
|
|
|
|
|
|
|
// Build photos
|
|
|
|
// Build photos
|
|
|
|
$.each(album.json.content, function() {
|
|
|
|
$.each(album.json.content, function() {
|
|
|
|
photosData += build.photo(this);
|
|
|
|
photosData += build.photo(this)
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Save and reset scroll position
|
|
|
|
// Save and reset scroll position
|
|
|
|
view.albums.content.scrollPosition = $(document).scrollTop();
|
|
|
|
view.albums.content.scrollPosition = $(document).scrollTop()
|
|
|
|
requestAnimationFrame(() => $(document).scrollTop(0));
|
|
|
|
requestAnimationFrame(() => $(document).scrollTop(0))
|
|
|
|
|
|
|
|
|
|
|
|
// Add photos to view
|
|
|
|
// Add photos to view
|
|
|
|
lychee.content.html(photosData);
|
|
|
|
lychee.content.html(photosData)
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
title: function(photoID) {
|
|
|
|
title: function(photoID) {
|
|
|
|
|
|
|
|
|
|
|
|
var title = album.json.content[photoID].title;
|
|
|
|
let title = album.json.content[photoID].title
|
|
|
|
|
|
|
|
|
|
|
|
$('.photo[data-id="' + photoID + '"] .overlay h1')
|
|
|
|
$('.photo[data-id="' + photoID + '"] .overlay h1')
|
|
|
|
.html(title)
|
|
|
|
.html(title)
|
|
|
|
.attr('title', title);
|
|
|
|
.attr('title', title)
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
star: function(photoID) {
|
|
|
|
star: function(photoID) {
|
|
|
|
|
|
|
|
|
|
|
|
$('.photo[data-id="' + photoID + '"] .iconic-star').remove();
|
|
|
|
$('.photo[data-id="' + photoID + '"] .iconic-star').remove()
|
|
|
|
if (album.json.content[photoID].star==='1') $('.photo[data-id="' + photoID + '"]').append("<a class='badge iconic-star'>" + build.iconic('star') + "</a>");
|
|
|
|
if (album.json.content[photoID].star==='1') $('.photo[data-id="' + photoID + '"]').append("<a class='badge iconic-star'>" + build.iconic('star') + "</a>")
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
public: function(photoID) {
|
|
|
|
public: function(photoID) {
|
|
|
|
|
|
|
|
|
|
|
|
$('.photo[data-id="' + photoID + '"] .iconic-share').remove();
|
|
|
|
$('.photo[data-id="' + photoID + '"] .iconic-share').remove()
|
|
|
|
if (album.json.content[photoID].public==='1') $('.photo[data-id="' + photoID + '"]').append("<a class='badge iconic-share'>" + build.iconic('eye') + "</a>");
|
|
|
|
if (album.json.content[photoID].public==='1') $('.photo[data-id="' + photoID + '"]').append("<a class='badge iconic-share'>" + build.iconic('eye') + "</a>")
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
delete: function(photoID) {
|
|
|
|
delete: function(photoID) {
|
|
|
|
|
|
|
|
|
|
|
|
$('.photo[data-id="' + photoID + '"]').css('opacity', 0).animate({
|
|
|
|
$('.photo[data-id="' + photoID + '"]').css('opacity', 0).animate({
|
|
|
|
width: 0,
|
|
|
|
width : 0,
|
|
|
|
marginLeft: 0
|
|
|
|
marginLeft : 0
|
|
|
|
}, 300, function() {
|
|
|
|
}, 300, function() {
|
|
|
|
$(this).remove();
|
|
|
|
$(this).remove()
|
|
|
|
// Only when search is not active
|
|
|
|
// Only when search is not active
|
|
|
|
if (!visible.albums()) {
|
|
|
|
if (!visible.albums()) {
|
|
|
|
album.json.num--;
|
|
|
|
album.json.num--
|
|
|
|
view.album.num();
|
|
|
|
view.album.num()
|
|
|
|
view.album.title();
|
|
|
|
view.album.title()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -206,13 +205,13 @@ view.album = {
|
|
|
|
|
|
|
|
|
|
|
|
description: function() {
|
|
|
|
description: function() {
|
|
|
|
|
|
|
|
|
|
|
|
sidebar.changeAttr('description', album.json.description);
|
|
|
|
sidebar.changeAttr('description', album.json.description)
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
num: function() {
|
|
|
|
num: function() {
|
|
|
|
|
|
|
|
|
|
|
|
sidebar.changeAttr('images', album.json.num);
|
|
|
|
sidebar.changeAttr('images', album.json.num)
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
@ -222,53 +221,54 @@ view.album = {
|
|
|
|
|
|
|
|
|
|
|
|
$('#button_share_album')
|
|
|
|
$('#button_share_album')
|
|
|
|
.addClass('active')
|
|
|
|
.addClass('active')
|
|
|
|
.attr('title', 'Share Album');
|
|
|
|
.attr('title', 'Share Album')
|
|
|
|
|
|
|
|
|
|
|
|
$('.photo .iconic-share').remove();
|
|
|
|
$('.photo .iconic-share').remove()
|
|
|
|
|
|
|
|
|
|
|
|
if (album.json.init) sidebar.changeAttr('public', 'Yes');
|
|
|
|
if (album.json.init) sidebar.changeAttr('public', 'Yes')
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
$('#button_share_album')
|
|
|
|
$('#button_share_album')
|
|
|
|
.removeClass('active')
|
|
|
|
.removeClass('active')
|
|
|
|
.attr('title', 'Make Public');
|
|
|
|
.attr('title', 'Make Public')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (album.json.init) sidebar.changeAttr('public', 'No')
|
|
|
|
|
|
|
|
|
|
|
|
if (album.json.init) sidebar.changeAttr('public', 'No');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
visible: function() {
|
|
|
|
visible: function() {
|
|
|
|
|
|
|
|
|
|
|
|
if (album.json.visible==='1') sidebar.changeAttr('visible', 'Yes');
|
|
|
|
if (album.json.visible==='1') sidebar.changeAttr('visible', 'Yes')
|
|
|
|
else sidebar.changeAttr('visible', 'No');
|
|
|
|
else sidebar.changeAttr('visible', 'No')
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
downloadable: function() {
|
|
|
|
downloadable: function() {
|
|
|
|
|
|
|
|
|
|
|
|
if (album.json.downloadable==='1') sidebar.changeAttr('downloadable', 'Yes');
|
|
|
|
if (album.json.downloadable==='1') sidebar.changeAttr('downloadable', 'Yes')
|
|
|
|
else sidebar.changeAttr('downloadable', 'No');
|
|
|
|
else sidebar.changeAttr('downloadable', 'No')
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
password: function() {
|
|
|
|
password: function() {
|
|
|
|
|
|
|
|
|
|
|
|
if (album.json.password==='1') sidebar.changeAttr('password', 'Yes');
|
|
|
|
if (album.json.password==='1') sidebar.changeAttr('password', 'Yes')
|
|
|
|
else sidebar.changeAttr('password', 'No');
|
|
|
|
else sidebar.changeAttr('password', 'No')
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
sidebar: function() {
|
|
|
|
sidebar: function() {
|
|
|
|
|
|
|
|
|
|
|
|
if ((visible.album()||!album.json.init)&&!visible.photo()) {
|
|
|
|
if ((visible.album() || !album.json.init) && !visible.photo()) {
|
|
|
|
|
|
|
|
|
|
|
|
let structure = sidebar.createStructure.album(album.json),
|
|
|
|
let structure = sidebar.createStructure.album(album.json),
|
|
|
|
html = sidebar.render(structure);
|
|
|
|
html = sidebar.render(structure)
|
|
|
|
|
|
|
|
|
|
|
|
sidebar.dom('.wrapper').html(html);
|
|
|
|
sidebar.dom('.wrapper').html(html)
|
|
|
|
sidebar.bind();
|
|
|
|
sidebar.bind()
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -280,151 +280,161 @@ view.photo = {
|
|
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
|
init: function() {
|
|
|
|
|
|
|
|
|
|
|
|
photo.parse();
|
|
|
|
photo.parse()
|
|
|
|
|
|
|
|
|
|
|
|
view.photo.sidebar();
|
|
|
|
view.photo.sidebar()
|
|
|
|
view.photo.title();
|
|
|
|
view.photo.title()
|
|
|
|
view.photo.star();
|
|
|
|
view.photo.star()
|
|
|
|
view.photo.public();
|
|
|
|
view.photo.public()
|
|
|
|
view.photo.photo();
|
|
|
|
view.photo.photo()
|
|
|
|
|
|
|
|
|
|
|
|
photo.json.init = 1;
|
|
|
|
photo.json.init = 1
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
show: function() {
|
|
|
|
show: function() {
|
|
|
|
|
|
|
|
|
|
|
|
// Change header
|
|
|
|
// Change header
|
|
|
|
lychee.content.addClass('view');
|
|
|
|
lychee.content.addClass('view')
|
|
|
|
header.setMode('photo');
|
|
|
|
header.setMode('photo')
|
|
|
|
|
|
|
|
|
|
|
|
// Make body not scrollable
|
|
|
|
// Make body not scrollable
|
|
|
|
$('body').css('overflow', 'hidden');
|
|
|
|
$('body').css('overflow', 'hidden')
|
|
|
|
|
|
|
|
|
|
|
|
// Fullscreen
|
|
|
|
// Fullscreen
|
|
|
|
$(document)
|
|
|
|
$(document)
|
|
|
|
.bind('mouseenter', header.show)
|
|
|
|
.bind('mouseenter', header.show)
|
|
|
|
.bind('mouseleave', header.hide);
|
|
|
|
.bind('mouseleave', header.hide)
|
|
|
|
|
|
|
|
|
|
|
|
lychee.animate(lychee.imageview, 'fadeIn');
|
|
|
|
lychee.animate(lychee.imageview, 'fadeIn')
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
hide: function() {
|
|
|
|
hide: function() {
|
|
|
|
|
|
|
|
|
|
|
|
header.show();
|
|
|
|
header.show()
|
|
|
|
|
|
|
|
|
|
|
|
lychee.content.removeClass('view');
|
|
|
|
lychee.content.removeClass('view')
|
|
|
|
header.setMode('album');
|
|
|
|
header.setMode('album')
|
|
|
|
|
|
|
|
|
|
|
|
// Make body scrollable
|
|
|
|
// Make body scrollable
|
|
|
|
$('body').css('overflow', 'auto');
|
|
|
|
$('body').css('overflow', 'auto')
|
|
|
|
|
|
|
|
|
|
|
|
// Disable Fullscreen
|
|
|
|
// Disable Fullscreen
|
|
|
|
$(document)
|
|
|
|
$(document)
|
|
|
|
.unbind('mouseenter')
|
|
|
|
.unbind('mouseenter')
|
|
|
|
.unbind('mouseleave');
|
|
|
|
.unbind('mouseleave')
|
|
|
|
|
|
|
|
|
|
|
|
// Hide Photo
|
|
|
|
// Hide Photo
|
|
|
|
lychee.animate(lychee.imageview, 'fadeOut');
|
|
|
|
lychee.animate(lychee.imageview, 'fadeOut')
|
|
|
|
setTimeout(function() {
|
|
|
|
setTimeout(() => {
|
|
|
|
lychee.imageview.hide();
|
|
|
|
lychee.imageview.hide()
|
|
|
|
view.album.sidebar();
|
|
|
|
view.album.sidebar()
|
|
|
|
}, 300);
|
|
|
|
}, 300)
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
title: function() {
|
|
|
|
title: function() {
|
|
|
|
|
|
|
|
|
|
|
|
if (photo.json.init) sidebar.changeAttr('title', photo.json.title);
|
|
|
|
if (photo.json.init) sidebar.changeAttr('title', photo.json.title)
|
|
|
|
lychee.setTitle(photo.json.title, true);
|
|
|
|
lychee.setTitle(photo.json.title, true)
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
description: function() {
|
|
|
|
description: function() {
|
|
|
|
|
|
|
|
|
|
|
|
if (photo.json.init) sidebar.changeAttr('description', photo.json.description);
|
|
|
|
if (photo.json.init) sidebar.changeAttr('description', photo.json.description)
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
star: function() {
|
|
|
|
star: function() {
|
|
|
|
|
|
|
|
|
|
|
|
if (photo.json.star==1) {
|
|
|
|
if (photo.json.star==='1') {
|
|
|
|
|
|
|
|
|
|
|
|
// Starred
|
|
|
|
// Starred
|
|
|
|
$('#button_star')
|
|
|
|
$('#button_star')
|
|
|
|
.addClass('active')
|
|
|
|
.addClass('active')
|
|
|
|
.attr('title', 'Unstar Photo');
|
|
|
|
.attr('title', 'Unstar Photo')
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
// Unstarred
|
|
|
|
// Unstarred
|
|
|
|
$('#button_star').removeClass('active');
|
|
|
|
$('#button_star').removeClass('active')
|
|
|
|
$('#button_star').attr('title', 'Star Photo');
|
|
|
|
$('#button_star').attr('title', 'Star Photo')
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
public: function() {
|
|
|
|
public: function() {
|
|
|
|
|
|
|
|
|
|
|
|
if (photo.json.public==='1'||photo.json.public==='2') {
|
|
|
|
if (photo.json.public==='1' || photo.json.public==='2') {
|
|
|
|
|
|
|
|
|
|
|
|
// Photo public
|
|
|
|
// Photo public
|
|
|
|
$('#button_share')
|
|
|
|
$('#button_share')
|
|
|
|
.addClass('active')
|
|
|
|
.addClass('active')
|
|
|
|
.attr('title', 'Share Photo');
|
|
|
|
.attr('title', 'Share Photo')
|
|
|
|
if (photo.json.init) sidebar.changeAttr('public', 'Yes');
|
|
|
|
|
|
|
|
|
|
|
|
if (photo.json.init) sidebar.changeAttr('public', 'Yes')
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
// Photo private
|
|
|
|
// Photo private
|
|
|
|
$('#button_share')
|
|
|
|
$('#button_share')
|
|
|
|
.removeClass('active')
|
|
|
|
.removeClass('active')
|
|
|
|
.attr('title', 'Make Public');
|
|
|
|
.attr('title', 'Make Public')
|
|
|
|
if (photo.json.init) sidebar.changeAttr('public', 'No');
|
|
|
|
|
|
|
|
|
|
|
|
if (photo.json.init) sidebar.changeAttr('public', 'No')
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
tags: function() {
|
|
|
|
tags: function() {
|
|
|
|
|
|
|
|
|
|
|
|
sidebar.changeAttr('tags', build.tags(photo.json.tags));
|
|
|
|
sidebar.changeAttr('tags', build.tags(photo.json.tags))
|
|
|
|
sidebar.bind();
|
|
|
|
sidebar.bind()
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
photo: function() {
|
|
|
|
photo: function() {
|
|
|
|
|
|
|
|
|
|
|
|
lychee.imageview.html(build.imageview(photo.json, photo.getSize(), visible.header()));
|
|
|
|
lychee.imageview.html(build.imageview(photo.json, photo.getSize(), visible.header()))
|
|
|
|
|
|
|
|
|
|
|
|
var $nextArrow = lychee.imageview.find('a#next'),
|
|
|
|
let $nextArrow = lychee.imageview.find('a#next'),
|
|
|
|
$previousArrow = lychee.imageview.find('a#previous'),
|
|
|
|
$previousArrow = lychee.imageview.find('a#previous'),
|
|
|
|
hasNext = album.json&&album.json.content&&album.json.content[photo.getID()]&&album.json.content[photo.getID()].nextPhoto==='',
|
|
|
|
hasNext = album.json && album.json.content && album.json.content[photo.getID()] && album.json.content[photo.getID()].nextPhoto==='',
|
|
|
|
hasPrevious = album.json&&album.json.content&&album.json.content[photo.getID()]&&album.json.content[photo.getID()].previousPhoto==='';
|
|
|
|
hasPrevious = album.json && album.json.content && album.json.content[photo.getID()] && album.json.content[photo.getID()].previousPhoto===''
|
|
|
|
|
|
|
|
|
|
|
|
if (hasNext||lychee.viewMode) { $nextArrow.hide(); }
|
|
|
|
if (hasNext || lychee.viewMode) { $nextArrow.hide() }
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
|
|
var nextPhotoID = album.json.content[photo.getID()].nextPhoto,
|
|
|
|
let nextPhotoID = album.json.content[photo.getID()].nextPhoto,
|
|
|
|
nextPhoto = album.json.content[nextPhotoID];
|
|
|
|
nextPhoto = album.json.content[nextPhotoID]
|
|
|
|
|
|
|
|
|
|
|
|
$nextArrow.css('background-image', 'linear-gradient(to bottom, rgba(0, 0, 0, .4), rgba(0, 0, 0, .4)), url("' + nextPhoto.thumbUrl + '")');
|
|
|
|
$nextArrow.css('background-image', `linear-gradient(to bottom, rgba(0, 0, 0, .4), rgba(0, 0, 0, .4)), url("${ nextPhoto.thumbUrl }")`)
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (hasPrevious||lychee.viewMode) { $previousArrow.hide(); }
|
|
|
|
if (hasPrevious || lychee.viewMode) { $previousArrow.hide() }
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
|
|
var previousPhotoID = album.json.content[photo.getID()].previousPhoto,
|
|
|
|
let previousPhotoID = album.json.content[photo.getID()].previousPhoto,
|
|
|
|
previousPhoto = album.json.content[previousPhotoID];
|
|
|
|
previousPhoto = album.json.content[previousPhotoID]
|
|
|
|
|
|
|
|
|
|
|
|
$previousArrow.css('background-image', 'linear-gradient(to bottom, rgba(0, 0, 0, .4), rgba(0, 0, 0, .4)), url("' + previousPhoto.thumbUrl + '")');
|
|
|
|
$previousArrow.css('background-image', `linear-gradient(to bottom, rgba(0, 0, 0, .4), rgba(0, 0, 0, .4)), url("${ previousPhoto.thumbUrl }")`)
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
sidebar: function() {
|
|
|
|
sidebar: function() {
|
|
|
|
|
|
|
|
|
|
|
|
var structure = sidebar.createStructure.photo(photo.json),
|
|
|
|
let structure = sidebar.createStructure.photo(photo.json),
|
|
|
|
html = sidebar.render(structure);
|
|
|
|
html = sidebar.render(structure)
|
|
|
|
|
|
|
|
|
|
|
|
sidebar.dom('.wrapper').html(html);
|
|
|
|
sidebar.dom('.wrapper').html(html)
|
|
|
|
sidebar.bind();
|
|
|
|
sidebar.bind()
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|