summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2011-05-09 09:51:22 -0400
committerJason A. Donenfeld <Jason@zx2c4.com>2011-05-09 09:51:22 -0400
commitebf158f3a579634124039f1ea543120fb8fa7ac5 (patch)
treee02842fc42f4115b86e38c551e428c201fd21d32
parentPut photo segment at top and trim slashes from urls. (diff)
downloadPhotoFloat-ebf158f3a579634124039f1ea543120fb8fa7ac5.tar.xz
PhotoFloat-ebf158f3a579634124039f1ea543120fb8fa7ac5.zip
Update google tracker for url scheme change.
-rw-r--r--web/js/010-control.js22
-rw-r--r--web/js/999-googletracker.js2
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