From ebf158f3a579634124039f1ea543120fb8fa7ac5 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 9 May 2011 09:51:22 -0400 Subject: Update google tracker for url scheme change. --- web/js/010-control.js | 22 +++++++++++++--------- web/js/999-googletracker.js | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/web/js/010-control.js b/web/js/010-control.js index f675508..5cd6cb7 100644 --- a/web/js/010-control.js +++ b/web/js/010-control.js @@ -270,6 +270,18 @@ $(document).ready(function() { $("#error-text, #error-overlay").fadeOut(500); $("body, html").css("overflow", "auto"); } + window.hashUrl = function() { + var new_album_cache = location.hash.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); + } + return new_album_cache; + } var current_album_cache = null; var current_photo_cache = null; @@ -280,15 +292,7 @@ $(document).ready(function() { var original_title = document.title; var album_cache = new Array(); $(window).hashchange(function() { - var new_album_cache = location.hash.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 new_album_cache = window.hashUrl(); var index = new_album_cache.lastIndexOf("/"); if (index != -1 && index != new_album_cache.length - 1) { previous_photo_cache = current_photo_cache; diff --git a/web/js/999-googletracker.js b/web/js/999-googletracker.js index b5427c1..62fb400 100644 --- a/web/js/999-googletracker.js +++ b/web/js/999-googletracker.js @@ -11,5 +11,5 @@ $(window).load(function () { $(window).hashchange(function() { window._gaq = window._gaq || []; window._gaq.push(['_trackPageview']); - window._gaq.push(['_trackPageview', location.hash.substring(1)]); + window._gaq.push(['_trackPageview', window.hashUrl()]); }); \ No newline at end of file -- cgit v1.2.3-59-g8ed1b