Sensiable error policy.

This commit is contained in:
Jason A. Donenfeld 2011-05-09 05:01:24 -04:00
parent 4a7d7ad39f
commit b7298ae6bc
3 changed files with 28 additions and 8 deletions

View File

@ -156,9 +156,23 @@ a:hover {
text-align: center; text-align: center;
} }
#error { #error-overlay, #error-text {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: none; display: none;
}
#error-overlay {
background-color: #000000;
opacity: 0.8;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
filter: alpha(opacity=80);
}
#error-text {
text-align: center; text-align: center;
position: fixed;
padding-top: 20%; padding-top: 20%;
font-size: 4em; font-size: 4em;
font-weight: bold; font-weight: bold;

View File

@ -30,7 +30,8 @@
<a id="next">&rsaquo;</a> <a id="next">&rsaquo;</a>
</div> </div>
<div id="error">Forgot my camera.</div> <div id="error-overlay"></div>
<div id="error-text">Forgot my camera.</div>
</body> </body>
</html> </html>

View File

@ -49,6 +49,7 @@ $(document).ready(function() {
}); });
} }
function albumLoaded(album) { function albumLoaded(album) {
undie();
$("#loading").hide(); $("#loading").hide();
album_cache[cachePath(album.path)] = album; album_cache[cachePath(album.path)] = album;
current_album = album; current_album = album;
@ -141,9 +142,10 @@ $(document).ready(function() {
function showPhoto() { function showPhoto() {
currentPhoto(); currentPhoto();
if (current_photo == null) { if (current_photo == null) {
$(document.body).html("Wrong picture."); die();
return; return;
} }
undie();
var maxSize = 800; var maxSize = 800;
var width = current_photo.size[0]; var width = current_photo.size[0];
var height = current_photo.size[1]; var height = current_photo.size[1];
@ -245,18 +247,21 @@ $(document).ready(function() {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: "cache/" + album + ".json", url: "cache/" + album + ".json",
error: die,
success: callback success: callback
}); });
} }
function albumThumbFinder(album, callback) { function albumThumbFinder(album, callback) {
fetchAlbumForThumb(album, function(fetchedAlbum) { albumForThumbIteration(fetchedAlbum, callback); }); fetchAlbumForThumb(album, function(fetchedAlbum) { albumForThumbIteration(fetchedAlbum, callback); });
} }
function die() { function die() {
$("#album-view").hide(); $("#error-overlay").fadeIn(500);
$("#photo-view").hide(); $("#error-text").fadeIn(2500);
$("#title").hide(); $("body, html").css("overflow", "hidden");
$("#error").fadeIn(5000); }
function undie() {
$("#error-text, #error-overlay").fadeOut(500);
$("body, html").css("overflow", "auto");
} }
var current_album_cache = null; var current_album_cache = null;