From 76b43690f25b5f6bf72a8ed16c89fb5e8bddf19b Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 9 May 2011 08:22:52 -0400 Subject: [PATCH] Better titles. --- web/js/010-control.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/web/js/010-control.js b/web/js/010-control.js index 4e481d7..17cb8e2 100644 --- a/web/js/010-control.js +++ b/web/js/010-control.js @@ -67,20 +67,26 @@ $(document).ready(function() { } function setTitle() { var title = ""; + var documentTitle = ""; var components; if (current_album.path.length == 0) - components = [document.title]; + components = [original_title]; else { components = current_album.path.split("/"); - components.unshift(document.title); + components.unshift(original_title); } + if (current_photo_cache != null) + documentTitle += trimExtension(current_photo.name); var last = ""; for (var i = 0; i < components.length; ++i) { + if (i || current_photo_cache != null) + documentTitle += " \u00ab "; if (i) last += "/" + components[i]; if (i < components.length - 1 || current_photo_cache != null) title += ""; title += components[i]; + documentTitle += components[components.length - 1 - i]; if (i < components.length - 1 || current_photo_cache != null) { title += ""; title += " » "; @@ -89,6 +95,7 @@ $(document).ready(function() { if (current_photo_cache != null) title += trimExtension(current_photo.name); $("#title").html(title); + document.title = documentTitle; } function showAlbum(populate) { if (current_photo_cache == null && previous_photo_cache == null) @@ -270,6 +277,7 @@ $(document).ready(function() { var current_album = null; var current_photo = null; var current_photo_index = -1; + var original_title = document.title; var album_cache = new Array(); $(window).hashchange(function() { var new_album_cache = location.hash.substring(1);