aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2011-05-13 04:51:49 -0400
committerJason A. Donenfeld <Jason@zx2c4.com>2011-05-13 04:51:49 -0400
commitfbf63ba769ba3b0f39b767640666681d50fa57b4 (patch)
tree68d3538b22e4bf93b22d3717e4e44484ad2cab21 /web/js
parentRescan corrupted albums. (diff)
downloadPhotoFloat-fbf63ba769ba3b0f39b767640666681d50fa57b4.tar.xz
PhotoFloat-fbf63ba769ba3b0f39b767640666681d50fa57b4.zip
Proper ID scheme for thumbs.
Diffstat (limited to 'web/js')
-rw-r--r--web/js/010-control.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/web/js/010-control.js b/web/js/010-control.js
index 7fc2b25..3bb7976 100644
--- a/web/js/010-control.js
+++ b/web/js/010-control.js
@@ -32,6 +32,11 @@ $(document).ready(function() {
suffix = size.toString();
return "cache/" + cachePath(path + "/" + image + "_" + suffix + ".jpg");
}
+ function properId(path) {
+ if (!path[0].match(/[a-zA-Z]/))
+ path = "a" + path;
+ return path.replace(/[^a-zA-Z0-9_:.\-]/g, "-");
+ }
function escapeId(id) {
return id.replace(/\./g, "\\.").replace(/,/g, "\\,");
}
@@ -114,7 +119,7 @@ $(document).ready(function() {
var thumbFinderList = new Array();
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;
+ var id = properId("album-" + path);
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) });
}
@@ -217,7 +222,7 @@ $(document).ready(function() {
if (photo == null)
return;
}
- var thumb = $("#thumb-" + escapeId(photo));
+ var thumb = $("#thumb-" + escapeId(properId(photo)));
if (!thumb.length)
return;
if (current_photo_cache != null) {