aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2011-05-09 09:42:17 -0400
committerJason A. Donenfeld <Jason@zx2c4.com>2011-05-09 09:42:17 -0400
commit99be279ae3d6991ea5c0d813ebb5aa536b7631cc (patch)
tree56017fcebead6b451b6255ea2d5ee241be1b146c /web/js
parentTo work around Espen's corrupted image bug, we simply try to copy the image twice. The second time will usually work, unless the file is totally borked. (diff)
downloadPhotoFloat-99be279ae3d6991ea5c0d813ebb5aa536b7631cc.tar.xz
PhotoFloat-99be279ae3d6991ea5c0d813ebb5aa536b7631cc.zip
Put photo segment at top and trim slashes from urls.
Diffstat (limited to 'web/js')
-rw-r--r--web/js/010-control.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/web/js/010-control.js b/web/js/010-control.js
index 17cb8e2..f675508 100644
--- a/web/js/010-control.js
+++ b/web/js/010-control.js
@@ -281,10 +281,14 @@ $(document).ready(function() {
var album_cache = new Array();
$(window).hashchange(function() {
var new_album_cache = location.hash.substring(1);
- if (new_album_cache.length && new_album_cache[0] == "!")
- new_album_cache = new_album_cache.substring(1);
- if (new_album_cache.length && new_album_cache[0] == "/")
- new_album_cache = new_album_cache.substring(1);
+ if (new_album_cache.length) {
+ if (new_album_cache[0] == "!")
+ new_album_cache = new_album_cache.substring(1);
+ if (new_album_cache[0] == "/")
+ new_album_cache = new_album_cache.substring(1);
+ if (new_album_cache[new_album_cache.length - 1] == "/")
+ new_album_cache = new_album_cache.substring(0, new_album_cache.length - 1);
+ }
var index = new_album_cache.lastIndexOf("/");
if (index != -1 && index != new_album_cache.length - 1) {
previous_photo_cache = current_photo_cache;