2013-05-03 11:57:08 +00:00
|
|
|
/**
|
2014-01-22 10:12:51 +00:00
|
|
|
* @name Albums Module
|
|
|
|
* @description Takes care of every action albums can handle and execute.
|
|
|
|
* @author Tobias Reich
|
|
|
|
* @copyright 2014 by Tobias Reich
|
2013-05-03 11:57:08 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
albums = {
|
|
|
|
|
2013-09-03 09:59:30 +00:00
|
|
|
json: null,
|
|
|
|
|
2013-05-03 11:57:08 +00:00
|
|
|
load: function() {
|
|
|
|
|
2013-09-03 09:59:30 +00:00
|
|
|
var startTime,
|
|
|
|
durationTime,
|
2014-01-22 10:12:51 +00:00
|
|
|
waitTime;
|
2013-05-03 11:57:08 +00:00
|
|
|
|
2014-07-12 18:30:46 +00:00
|
|
|
lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomOut");
|
2013-05-03 11:57:08 +00:00
|
|
|
lychee.animate(".divider", "fadeOut");
|
|
|
|
|
|
|
|
startTime = new Date().getTime();
|
|
|
|
|
2014-01-22 10:12:51 +00:00
|
|
|
lychee.api("getAlbums", function(data) {
|
2013-05-03 11:57:08 +00:00
|
|
|
|
2013-09-03 09:59:30 +00:00
|
|
|
/* Smart Albums */
|
|
|
|
data.unsortedAlbum = {
|
|
|
|
id: 0,
|
|
|
|
title: "Unsorted",
|
|
|
|
sysdate: data.unsortedNum + " photos",
|
|
|
|
unsorted: 1,
|
|
|
|
thumb0: data.unsortedThumb0,
|
|
|
|
thumb1: data.unsortedThumb1,
|
|
|
|
thumb2: data.unsortedThumb2
|
2014-02-25 21:14:25 +00:00
|
|
|
};
|
2013-09-03 09:59:30 +00:00
|
|
|
|
|
|
|
data.starredAlbum = {
|
|
|
|
id: "f",
|
|
|
|
title: "Starred",
|
|
|
|
sysdate: data.starredNum + " photos",
|
|
|
|
star: 1,
|
|
|
|
thumb0: data.starredThumb0,
|
|
|
|
thumb1: data.starredThumb1,
|
|
|
|
thumb2: data.starredThumb2
|
2014-02-25 21:14:25 +00:00
|
|
|
};
|
2013-09-03 09:59:30 +00:00
|
|
|
|
|
|
|
data.publicAlbum = {
|
|
|
|
id: "s",
|
|
|
|
title: "Public",
|
|
|
|
sysdate: data.publicNum + " photos",
|
|
|
|
public: 1,
|
|
|
|
thumb0: data.publicThumb0,
|
|
|
|
thumb1: data.publicThumb1,
|
|
|
|
thumb2: data.publicThumb2
|
2014-02-25 21:14:25 +00:00
|
|
|
};
|
2013-09-03 09:59:30 +00:00
|
|
|
|
2014-06-29 13:40:06 +00:00
|
|
|
data.recentAlbum = {
|
|
|
|
id: "r",
|
|
|
|
title: "Recent",
|
|
|
|
sysdate: data.recentNum + " photos",
|
|
|
|
recent: 1,
|
|
|
|
thumb0: data.recentThumb0,
|
|
|
|
thumb1: data.recentThumb1,
|
|
|
|
thumb2: data.recentThumb2
|
|
|
|
};
|
|
|
|
|
2013-09-03 09:59:30 +00:00
|
|
|
albums.json = data;
|
|
|
|
|
2013-05-03 11:57:08 +00:00
|
|
|
durationTime = (new Date().getTime() - startTime);
|
|
|
|
if (durationTime>300) waitTime = 0; else waitTime = 300 - durationTime;
|
2013-09-03 09:59:30 +00:00
|
|
|
if (!visible.albums()&&!visible.photo()&&!visible.album()) waitTime = 0;
|
2013-05-03 11:57:08 +00:00
|
|
|
|
2013-09-08 17:50:31 +00:00
|
|
|
setTimeout(function() {
|
2013-05-03 11:57:08 +00:00
|
|
|
|
2013-09-03 09:59:30 +00:00
|
|
|
view.header.mode("albums");
|
|
|
|
view.albums.init();
|
2014-07-12 18:30:46 +00:00
|
|
|
lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomIn");
|
2013-05-03 11:57:08 +00:00
|
|
|
|
2013-09-08 17:50:31 +00:00
|
|
|
}, waitTime);
|
2013-05-03 11:57:08 +00:00
|
|
|
|
2014-02-25 21:14:25 +00:00
|
|
|
});
|
2013-05-03 11:57:08 +00:00
|
|
|
|
|
|
|
},
|
|
|
|
|
2013-09-03 09:59:30 +00:00
|
|
|
parse: function(album) {
|
2013-05-03 11:57:08 +00:00
|
|
|
|
2013-09-03 09:59:30 +00:00
|
|
|
if (album.password&&lychee.publicMode) {
|
2014-01-22 10:12:51 +00:00
|
|
|
album.thumb0 = "assets/img/password.svg";
|
|
|
|
album.thumb1 = "assets/img/password.svg";
|
|
|
|
album.thumb2 = "assets/img/password.svg";
|
2013-05-03 11:57:08 +00:00
|
|
|
} else {
|
2014-07-12 18:12:38 +00:00
|
|
|
if (!album.thumb0) album.thumb0 = "assets/img/no_images.svg";
|
|
|
|
if (!album.thumb1) album.thumb1 = "assets/img/no_images.svg";
|
|
|
|
if (!album.thumb2) album.thumb2 = "assets/img/no_images.svg";
|
2013-06-17 18:40:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-03 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
2014-02-25 22:37:05 +00:00
|
|
|
};
|