Merge pull request #183 from electerious/performance
Slightly improved performance for big albums
This commit is contained in:
commit
ae493bd918
@ -37,7 +37,7 @@ album = {
|
||||
|
||||
if (!refresh) {
|
||||
loadingBar.show();
|
||||
lychee.animate(".album, .photo", "contentZoomOut");
|
||||
lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomOut");
|
||||
lychee.animate(".divider", "fadeOut");
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ album = {
|
||||
view.album.init();
|
||||
|
||||
if (!refresh) {
|
||||
lychee.animate(".album, .photo", "contentZoomIn");
|
||||
lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomIn");
|
||||
view.header.mode("album");
|
||||
}
|
||||
|
||||
@ -88,8 +88,7 @@ album = {
|
||||
|
||||
parse: function(photo) {
|
||||
|
||||
if (photo&&photo.thumbUrl) photo.thumbUrl = lychee.upload_path_thumb + photo.thumbUrl;
|
||||
else if (!album.json.title) album.json.title = "Untitled";
|
||||
if (!album.json.title) album.json.title = "Untitled";
|
||||
|
||||
},
|
||||
|
||||
|
@ -15,7 +15,7 @@ albums = {
|
||||
durationTime,
|
||||
waitTime;
|
||||
|
||||
lychee.animate(".album, .photo", "contentZoomOut");
|
||||
lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomOut");
|
||||
lychee.animate(".divider", "fadeOut");
|
||||
|
||||
startTime = new Date().getTime();
|
||||
@ -73,7 +73,7 @@ albums = {
|
||||
|
||||
view.header.mode("albums");
|
||||
view.albums.init();
|
||||
lychee.animate(".album, .photo", "contentZoomIn");
|
||||
lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomIn");
|
||||
|
||||
}, waitTime);
|
||||
|
||||
@ -88,9 +88,9 @@ albums = {
|
||||
album.thumb1 = "assets/img/password.svg";
|
||||
album.thumb2 = "assets/img/password.svg";
|
||||
} else {
|
||||
if (album.thumb0) album.thumb0 = lychee.upload_path_thumb + album.thumb0; else album.thumb0 = "assets/img/no_images.svg";
|
||||
if (album.thumb1) album.thumb1 = lychee.upload_path_thumb + album.thumb1; else album.thumb1 = "assets/img/no_images.svg";
|
||||
if (album.thumb2) album.thumb2 = lychee.upload_path_thumb + album.thumb2; else album.thumb2 = "assets/img/no_images.svg";
|
||||
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";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,9 +16,6 @@ var lychee = {
|
||||
updateURL: "https://github.com/electerious/Lychee",
|
||||
website: "http://lychee.electerious.com",
|
||||
|
||||
upload_path_thumb: "uploads/thumb/",
|
||||
upload_path_big: "uploads/big/",
|
||||
|
||||
publicMode: false,
|
||||
viewMode: false,
|
||||
debugMode: false,
|
||||
|
@ -52,7 +52,6 @@ photo = {
|
||||
parse: function() {
|
||||
|
||||
if (!photo.json.title) photo.json.title = "Untitled";
|
||||
photo.json.url = lychee.upload_path_big + photo.json.url;
|
||||
|
||||
},
|
||||
|
||||
|
@ -49,7 +49,7 @@ search = {
|
||||
|
||||
$(".no_content").remove();
|
||||
|
||||
lychee.animate(".album, .photo", "contentZoomOut");
|
||||
lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomOut");
|
||||
lychee.animate(".divider", "fadeOut");
|
||||
|
||||
search.code = md5(code);
|
||||
@ -59,7 +59,7 @@ search = {
|
||||
if (code==="error") $("body").append(build.no_content("search"));
|
||||
else {
|
||||
lychee.content.html(code);
|
||||
lychee.animate(".album, .photo", "contentZoomIn");
|
||||
lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomIn");
|
||||
$("img[data-type!='svg']").retina();
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,6 @@ view = {
|
||||
var photosData = "";
|
||||
|
||||
$.each(album.json.content, function() {
|
||||
album.parse(this);
|
||||
photosData += build.photo(this);
|
||||
});
|
||||
lychee.content.html(photosData);
|
||||
|
File diff suppressed because one or more lines are too long
@ -21,4 +21,8 @@ define('LYCHEE_PLUGINS', LYCHEE . 'plugins/');
|
||||
# Define files
|
||||
define('LYCHEE_CONFIG_FILE', LYCHEE_DATA . 'config.php');
|
||||
|
||||
# Define urls
|
||||
define('LYCHEE_URL_UPLOADS_THUMB', 'uploads/thumb/');
|
||||
define('LYCHEE_URL_UPLOADS_BIG', 'uploads/big/');
|
||||
|
||||
?>
|
@ -97,6 +97,7 @@ class Album extends Module {
|
||||
$photo['sysdate'] = date('d F Y', substr($photo['id'], 0, -4));
|
||||
$photo['previousPhoto'] = $previousPhotoID;
|
||||
$photo['nextPhoto'] = '';
|
||||
$photo['thumbUrl'] = LYCHEE_URL_UPLOADS_THUMB . $photo['thumbUrl'];
|
||||
|
||||
if ($photo['takestamp']!=='0') {
|
||||
$photo['cameraDate'] = 1;
|
||||
@ -175,7 +176,7 @@ class Album extends Module {
|
||||
# For each thumb
|
||||
$k = 0;
|
||||
while ($thumb = $thumbs->fetch_object()) {
|
||||
$album["thumb$k"] = $thumb->thumbUrl;
|
||||
$album["thumb$k"] = LYCHEE_URL_UPLOADS_THUMB . $thumb->thumbUrl;
|
||||
$k++;
|
||||
}
|
||||
|
||||
@ -206,7 +207,7 @@ class Album extends Module {
|
||||
$i = 0;
|
||||
while($row = $unsorted->fetch_object()) {
|
||||
if ($i<3) {
|
||||
$return["unsortedThumb$i"] = $row->thumbUrl;
|
||||
$return["unsortedThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row->thumbUrl;
|
||||
$i++;
|
||||
} else break;
|
||||
}
|
||||
@ -217,7 +218,7 @@ class Album extends Module {
|
||||
$i = 0;
|
||||
while($row2 = $public->fetch_object()) {
|
||||
if ($i<3) {
|
||||
$return["publicThumb$i"] = $row2->thumbUrl;
|
||||
$return["publicThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row2->thumbUrl;
|
||||
$i++;
|
||||
} else break;
|
||||
}
|
||||
@ -228,7 +229,7 @@ class Album extends Module {
|
||||
$i = 0;
|
||||
while($row3 = $starred->fetch_object()) {
|
||||
if ($i<3) {
|
||||
$return["starredThumb$i"] = $row3->thumbUrl;
|
||||
$return["starredThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row3->thumbUrl;
|
||||
$i++;
|
||||
} else break;
|
||||
}
|
||||
@ -239,7 +240,7 @@ class Album extends Module {
|
||||
$i = 0;
|
||||
while($row3 = $recent->fetch_object()) {
|
||||
if ($i<3) {
|
||||
$return["recentThumb$i"] = $row3->thumbUrl;
|
||||
$return["recentThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row3->thumbUrl;
|
||||
$i++;
|
||||
} else break;
|
||||
}
|
||||
|
@ -390,6 +390,9 @@ class Photo extends Module {
|
||||
$photo['sysdate'] = date('d M. Y', substr($photo['id'], 0, -4));
|
||||
if (strlen($photo['takestamp'])>1) $photo['takedate'] = date('d M. Y', $photo['takestamp']);
|
||||
|
||||
# Parse url
|
||||
$photo['url'] = LYCHEE_URL_UPLOADS_BIG . $photo['url'];
|
||||
|
||||
if ($albumID!='false') {
|
||||
|
||||
if ($photo['album']!=0) {
|
||||
|
Loading…
Reference in New Issue
Block a user