Put photo segment at top and trim slashes from urls.

This commit is contained in:
Jason A. Donenfeld 2011-05-09 09:42:17 -04:00
parent 6d75a3ed64
commit 99be279ae3
2 changed files with 14 additions and 10 deletions

View File

@ -10,12 +10,6 @@
</head>
<body>
<div id="title">Photos</div>
<div id="album-view">
<div id="thumbs">
<div id="loading">Loading...</div>
</div>
<div id="subalbums"></div>
</div>
<div id="photo-view">
<div id="photo-box">
<a id="next-photo"><img id="photo" /></a>
@ -30,6 +24,12 @@
<a id="back">&lsaquo;</a>
<a id="next">&rsaquo;</a>
</div>
<div id="album-view">
<div id="thumbs">
<div id="loading">Loading...</div>
</div>
<div id="subalbums"></div>
</div>
<div id="error-overlay"></div>
<div id="error-text">Forgot my camera.</div>

View File

@ -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;