2013-05-03 11:57:08 +00:00
|
|
|
/**
|
|
|
|
* @name albums.js
|
|
|
|
* @author Philipp Maurer
|
|
|
|
* @author Tobias Reich
|
|
|
|
* @copyright 2013 by Philipp Maurer, Tobias Reich
|
|
|
|
*
|
|
|
|
* Albums Module
|
|
|
|
* Takes care of every action albums can handle and execute.
|
|
|
|
*/
|
|
|
|
|
|
|
|
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,
|
|
|
|
unsortedAlbum,
|
|
|
|
starredAlbum,
|
|
|
|
publicAlbum,
|
|
|
|
smartData = "",
|
|
|
|
albumsData = "";
|
2013-05-03 11:57:08 +00:00
|
|
|
|
2013-09-03 09:59:30 +00:00
|
|
|
lychee.animate(".album, .photo", "contentZoomOut");
|
2013-05-03 11:57:08 +00:00
|
|
|
lychee.animate(".divider", "fadeOut");
|
|
|
|
|
|
|
|
startTime = new Date().getTime();
|
|
|
|
|
|
|
|
lychee.api("getAlbums", "json", function(data) {
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
data.starredAlbum = {
|
|
|
|
id: "f",
|
|
|
|
title: "Starred",
|
|
|
|
sysdate: data.starredNum + " photos",
|
|
|
|
star: 1,
|
|
|
|
thumb0: data.starredThumb0,
|
|
|
|
thumb1: data.starredThumb1,
|
|
|
|
thumb2: data.starredThumb2
|
|
|
|
}
|
|
|
|
|
|
|
|
data.publicAlbum = {
|
|
|
|
id: "s",
|
|
|
|
title: "Public",
|
|
|
|
sysdate: data.publicNum + " photos",
|
|
|
|
public: 1,
|
|
|
|
thumb0: data.publicThumb0,
|
|
|
|
thumb1: data.publicThumb1,
|
|
|
|
thumb2: data.publicThumb2
|
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
|
|
|
lychee.animate(".album, .photo", "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
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
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) {
|
|
|
|
album.thumb0 = "img/password.png";
|
|
|
|
album.thumb1 = "img/password.png";
|
|
|
|
album.thumb2 = "img/password.png";
|
2013-05-03 11:57:08 +00:00
|
|
|
} else {
|
2013-09-03 09:59:30 +00:00
|
|
|
if (album.thumb0) album.thumb0 = lychee.upload_path_thumb + album.thumb0; else album.thumb0 = "img/no_images.png";
|
|
|
|
if (album.thumb1) album.thumb1 = lychee.upload_path_thumb + album.thumb1; else album.thumb1 = "img/no_images.png";
|
|
|
|
if (album.thumb2) album.thumb2 = lychee.upload_path_thumb + album.thumb2; else album.thumb2 = "img/no_images.png";
|
2013-06-17 18:40:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-03 11:57:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|