diff --git a/dist/main.js b/dist/main.js index f44d498..922236e 100644 Binary files a/dist/main.js and b/dist/main.js differ diff --git a/src/scripts/album.js b/src/scripts/album.js index cd604bc..00ced60 100644 --- a/src/scripts/album.js +++ b/src/scripts/album.js @@ -384,7 +384,7 @@ album.setPublic = function(albumID, e) { albums.refresh(); - if (!basicModal.visible()&&album.json.public==0) { + if (!basicModal.visible()&&album.json.public==='0') { var msg = '', action; @@ -475,7 +475,7 @@ album.setPublic = function(albumID, e) { view.album.public(); view.album.password(); - if (album.json.public==1) contextMenu.shareAlbum(albumID, e); + if (album.json.public==='1') contextMenu.shareAlbum(albumID, e); } diff --git a/src/scripts/albums.js b/src/scripts/albums.js index b0a0289..72dbb81 100644 --- a/src/scripts/albums.js +++ b/src/scripts/albums.js @@ -25,45 +25,7 @@ albums.load = function() { api.post('Album::getAll', {}, function(data) { /* Smart Albums */ - data.smartalbums.unsorted = { - id: 0, - title: 'Unsorted', - sysdate: data.smartalbums.unsorted.num + ' photos', - unsorted: '1', - thumb0: data.smartalbums.unsorted.thumb0, - thumb1: data.smartalbums.unsorted.thumb1, - thumb2: data.smartalbums.unsorted.thumb2 - }; - - data.smartalbums.starred = { - id: 'f', - title: 'Starred', - sysdate: data.smartalbums.starred.num + ' photos', - star: '1', - thumb0: data.smartalbums.starred.thumb0, - thumb1: data.smartalbums.starred.thumb1, - thumb2: data.smartalbums.starred.thumb2 - }; - - data.smartalbums.public = { - id: 's', - title: 'Public', - sysdate: data.smartalbums.public.num + ' photos', - public: '1', - thumb0: data.smartalbums.public.thumb0, - thumb1: data.smartalbums.public.thumb1, - thumb2: data.smartalbums.public.thumb2 - }; - - data.smartalbums.recent = { - id: 'r', - title: 'Recent', - sysdate: data.smartalbums.recent.num + ' photos', - recent: '1', - thumb0: data.smartalbums.recent.thumb0, - thumb1: data.smartalbums.recent.thumb1, - thumb2: data.smartalbums.recent.thumb2 - }; + if (lychee.publicMode===false) albums._createSmartAlbums(data.smartalbums); albums.json = data; @@ -108,6 +70,50 @@ albums.parse = function(album) { } +albums._createSmartAlbums = function(data) { + + data.unsorted = { + id: 0, + title: 'Unsorted', + sysdate: data.unsorted.num + ' photos', + unsorted: '1', + thumb0: data.unsorted.thumb0, + thumb1: data.unsorted.thumb1, + thumb2: data.unsorted.thumb2 + }; + + data.starred = { + id: 'f', + title: 'Starred', + sysdate: data.starred.num + ' photos', + star: '1', + thumb0: data.starred.thumb0, + thumb1: data.starred.thumb1, + thumb2: data.starred.thumb2 + }; + + data.public = { + id: 's', + title: 'Public', + sysdate: data.public.num + ' photos', + public: '1', + thumb0: data.public.thumb0, + thumb1: data.public.thumb1, + thumb2: data.public.thumb2 + }; + + data.recent = { + id: 'r', + title: 'Recent', + sysdate: data.recent.num + ' photos', + recent: '1', + thumb0: data.recent.thumb0, + thumb1: data.recent.thumb1, + thumb2: data.recent.thumb2 + }; + +} + albums.refresh = function() { albums.json = null; diff --git a/src/scripts/photo.js b/src/scripts/photo.js index bb9d21a..9755c44 100644 --- a/src/scripts/photo.js +++ b/src/scripts/photo.js @@ -393,12 +393,12 @@ photo.setStar = function(photoIDs) { if (!photoIDs) return false; if (visible.photo()) { - photo.json.star = (photo.json.star==0) ? 1 : 0; + photo.json.star = (photo.json.star==='0') ? '1' : '0'; view.photo.star(); } photoIDs.forEach(function(id, index, array) { - album.json.content[id].star = (album.json.content[id].star==0) ? 1 : 0; + album.json.content[id].star = (album.json.content[id].star==='0') ? '1' : '0'; view.album.content.star(id); }); @@ -449,13 +449,13 @@ photo.setPublic = function(photoID, e) { if (visible.photo()) { - photo.json.public = (photo.json.public==0) ? 1 : 0; + photo.json.public = (photo.json.public==='0') ? '1' : '0'; view.photo.public(); - if (photo.json.public==1) contextMenu.sharePhoto(photoID, e); + if (photo.json.public==='1') contextMenu.sharePhoto(photoID, e); } - album.json.content[photoID].public = (album.json.content[photoID].public==0) ? 1 : 0; + album.json.content[photoID].public = (album.json.content[photoID].public==='0') ? '1' : '0'; view.album.content.public(photoID); albums.refresh(); diff --git a/src/scripts/view.js b/src/scripts/view.js index 1b7280e..745087a 100644 --- a/src/scripts/view.js +++ b/src/scripts/view.js @@ -209,14 +209,14 @@ view.album = { star: function(photoID) { $('.photo[data-id="' + photoID + '"] .iconic-star').remove(); - if (album.json.content[photoID].star==1) $('.photo[data-id="' + photoID + '"]').append("" + build.iconic('star') + ""); + if (album.json.content[photoID].star==='1') $('.photo[data-id="' + photoID + '"]').append("" + build.iconic('star') + ""); }, public: function(photoID) { $('.photo[data-id="' + photoID + '"] .iconic-share').remove(); - if (album.json.content[photoID].public==1) $('.photo[data-id="' + photoID + '"]').append("" + build.iconic('eye') + ""); + if (album.json.content[photoID].public==='1') $('.photo[data-id="' + photoID + '"]').append("" + build.iconic('eye') + ""); }, @@ -253,7 +253,7 @@ view.album = { public: function() { - if (album.json.public==1) { + if (album.json.public==='1') { $('#button_share_album') .addClass('active') @@ -378,7 +378,7 @@ view.photo = { public: function() { - if (photo.json.public==1||photo.json.public==2) { + if (photo.json.public==='1'||photo.json.public==='2') { // Photo public $('#button_share') .addClass('active')