summaryrefslogtreecommitdiffstats
path: root/web/js/010-debugger.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/js/010-debugger.js')
-rw-r--r--web/js/010-debugger.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/web/js/010-debugger.js b/web/js/010-debugger.js
new file mode 100644
index 0000000..988c0a2
--- /dev/null
+++ b/web/js/010-debugger.js
@@ -0,0 +1,38 @@
+$(document).ready(function() {
+ function cachePath(path) {
+ return path.replace(/ /g, "_").replace(/\//g, "-");
+ }
+ function imagePath(image, path, size, square) {
+ var suffix;
+ if (square)
+ suffix = size.toString() + "s";
+ else
+ suffix = size.toString();
+ return "cache/" + cachePath(path + "/" + image + "_" + suffix + ".jpg");
+ }
+ function loadAlbum(path) {
+ $.ajax({
+ type: "GET",
+ url: "cache/" + path + ".json",
+ success: function(album) {
+ $("#debug").html("<h2>" + album.path + "</h2>");
+ $("#debug").append("<h3>Photos</h3>");
+ for (var i = 0; i < album.photos.length; ++i)
+ $("#debug").append("<a href=\"" + imagePath(album.photos[i].name, album.path, 1024, false) + "\"><img border=0 src=\"" + imagePath(album.photos[i].name, album.path, 150, true) + "\" height=150 width=150></a>");
+ if (album.albums.length)
+ $("#debug").append("<h3>Sub-albums</h3>");
+ for (var i = 0; i < album.albums.length; ++i) {
+ var link = $("<a href=\"#" + cachePath(album.path + "/" + album.albums[i].path) + "\"><li>" + album.albums[i].path + "</li></a>");
+ $("#debug").append(link);
+ }
+ }
+ });
+ }
+ $(window).hashchange(function() {
+ var cache = location.hash.substring(1);
+ if (!cache.length)
+ cache = cachePath("New York Summer 2009"); //root
+ loadAlbum(cache);
+ });
+ $(window).hashchange();
+});