Deal with deleting faulty images.
This commit is contained in:
parent
ba72d7c8b7
commit
b41ad8c91e
@ -98,9 +98,16 @@ $(document).ready(function() {
|
|||||||
for (i = 0; i < currentAlbum.photos.length; ++i) {
|
for (i = 0; i < currentAlbum.photos.length; ++i) {
|
||||||
link = $("<a href=\"#!/" + photoFloat.photoHash(currentAlbum, currentAlbum.photos[i]) + "\"></a>");
|
link = $("<a href=\"#!/" + photoFloat.photoHash(currentAlbum, currentAlbum.photos[i]) + "\"></a>");
|
||||||
image = $("<img title=\"" + photoFloat.trimExtension(currentAlbum.photos[i].name) + "\" alt=\"" + photoFloat.trimExtension(currentAlbum.photos[i].name) + "\" src=\"" + photoFloat.photoPath(currentAlbum, currentAlbum.photos[i], 150, true) + "\" height=\"150\" width=\"150\" />");
|
image = $("<img title=\"" + photoFloat.trimExtension(currentAlbum.photos[i].name) + "\" alt=\"" + photoFloat.trimExtension(currentAlbum.photos[i].name) + "\" src=\"" + photoFloat.photoPath(currentAlbum, currentAlbum.photos[i], 150, true) + "\" height=\"150\" width=\"150\" />");
|
||||||
link.append(image);
|
|
||||||
image.get(0).photo = currentAlbum.photos[i];
|
image.get(0).photo = currentAlbum.photos[i];
|
||||||
|
link.append(image);
|
||||||
photos.push(link);
|
photos.push(link);
|
||||||
|
(function(theLink, theImage, theAlbum) {
|
||||||
|
theImage.error(function() {
|
||||||
|
photos.splice(photos.indexOf(theLink), 1);
|
||||||
|
theLink.remove();
|
||||||
|
theAlbum.photos.splice(theAlbum.photos.indexOf(theImage.get(0).photo), 1);
|
||||||
|
});
|
||||||
|
})(link, image, currentAlbum);
|
||||||
}
|
}
|
||||||
thumbsElement = $("#thumbs");
|
thumbsElement = $("#thumbs");
|
||||||
thumbsElement.empty();
|
thumbsElement.empty();
|
||||||
@ -112,11 +119,16 @@ $(document).ready(function() {
|
|||||||
image = $("<div title=\"" + currentAlbum.albums[i].date + "\" class=\"album-button\">" + currentAlbum.albums[i].path + "</div>");
|
image = $("<div title=\"" + currentAlbum.albums[i].date + "\" class=\"album-button\">" + currentAlbum.albums[i].path + "</div>");
|
||||||
link.append(image);
|
link.append(image);
|
||||||
subalbums.push(link);
|
subalbums.push(link);
|
||||||
(function(theAlbum, theImage) {
|
(function(theContainer, theAlbum, theImage, theLink) {
|
||||||
photoFloat.albumPhoto(theAlbum, function(album, photo) {
|
photoFloat.albumPhoto(theAlbum, function(album, photo) {
|
||||||
theImage.css("background-image", "url(" + photoFloat.photoPath(album, photo, 150, true) + ")");
|
theImage.css("background-image", "url(" + photoFloat.photoPath(album, photo, 150, true) + ")");
|
||||||
|
}, function error() {
|
||||||
|
theContainer.albums.splice(currentAlbum.albums.indexOf(theAlbum), 1);
|
||||||
|
theLink.remove();
|
||||||
|
subalbums.splice(subalbums.indexOf(theLink), 1);
|
||||||
|
|
||||||
});
|
});
|
||||||
})(currentAlbum.albums[i], image);
|
})(currentAlbum, currentAlbum.albums[i], image, link);
|
||||||
}
|
}
|
||||||
subalbumsElement = $("#subalbums");
|
subalbumsElement = $("#subalbums");
|
||||||
subalbumsElement.empty();
|
subalbumsElement.empty();
|
||||||
|
Loading…
Reference in New Issue
Block a user