diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2011-05-06 21:12:51 -0400 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2011-05-06 21:12:51 -0400 |
commit | 2e017d0df3cca1000a45a869892b5f058f9d01e9 (patch) | |
tree | 2b7667892aa24018ea3a8959698b4c22889b60b1 /web/js/010-control.js | |
parent | Redirect from zen photo urls. (diff) | |
download | PhotoFloat-2e017d0df3cca1000a45a869892b5f058f9d01e9.tar.xz PhotoFloat-2e017d0df3cca1000a45a869892b5f058f9d01e9.zip |
Polishing...
Diffstat (limited to 'web/js/010-control.js')
-rw-r--r-- | web/js/010-control.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/web/js/010-control.js b/web/js/010-control.js index ab4be0f..ab3a410 100644 --- a/web/js/010-control.js +++ b/web/js/010-control.js @@ -56,6 +56,12 @@ $(document).ready(function() { showPhoto(); setTitle(); } + function trimExtension(title) { + var index = title.lastIndexOf("."); + if (index != -1) + return title.substring(0, index) + return title; + } function setTitle() { var title = ""; var components; @@ -78,14 +84,14 @@ $(document).ready(function() { } } if (current_photo_cache != null) - title += current_photo.name; + title += trimExtension(current_photo.name); $("#title").html(title); } function showAlbum() { $("html, body").animate({ scrollTop: 0 }, "slow"); var photos = ""; for (var i = 0; i < current_album.photos.length; ++i) - photos += "<a href=\"#" + current_album_cache + "/" + cachePath(current_album.photos[i].name) + "\"><img id=\"thumb-" + cachePath(current_album.photos[i].name) + "\" src=\"" + imagePath(current_album.photos[i].name, current_album.path, 150, true) + "\" height=\"150\" width=\"150\"></a>"; + photos += "<a href=\"#" + current_album_cache + "/" + cachePath(current_album.photos[i].name) + "\"><img title=\"" + trimExtension(current_album.photos[i].name) + "\" alt=\"" + trimExtension(current_album.photos[i].name) + "\" id=\"thumb-" + cachePath(current_album.photos[i].name) + "\" src=\"" + imagePath(current_album.photos[i].name, current_album.path, 150, true) + "\" height=\"150\" width=\"150\"></a>"; $("#thumbs").html(photos); if (current_album.albums.length) $("#subalbums-title").show(); @@ -96,7 +102,7 @@ $(document).ready(function() { for (var i = current_album.albums.length - 1; i >= 0; --i) { var path = cachePath(current_album.path + "/" + current_album.albums[i].path); var id = "album-" + path; - subalbums += "<a href=\"#" + path + "\"><div id=\"" + id + "\" class=\"album-button\">" + current_album.albums[i].path + "</div></a>"; + subalbums += "<a href=\"#" + path + "\"><div title=\"" + current_album.albums[i].date + "\" id=\"" + id + "\" class=\"album-button\">" + current_album.albums[i].path + "</div></a>"; thumbFinderList.push({ path: path, id: escapeId(id) }); } $("#subalbums").html(subalbums); @@ -131,7 +137,7 @@ $(document).ready(function() { .attr("width", width).attr("height", height) .attr("src", imagePath(current_photo.name, current_album.path, maxSize, false)) .attr("alt", current_photo.name) - .attr("title", current_photo.name) + .attr("title", current_photo.date) .load(function() { $(this).css("width", "auto").css("height", "100%"); }); var nextLink = "#" + current_album_cache + "/" + cachePath(current_album.photos[ (current_photo_index + 1 >= current_album.photos.length) ? 0 : (current_photo_index + 1) |