From 8e34dfc158906ad1ddf5810b8d0a88be6b7ffb1f Mon Sep 17 00:00:00 2001
From: Peter Grassberger <petertheone@gmail.com>
Date: Mon, 3 Aug 2015 00:29:08 +0200
Subject: switch to hashless urls


diff --git a/www/index.html b/www/index.html
index 3d9754d..da72fd7 100644
--- a/www/index.html
+++ b/www/index.html
@@ -58,9 +58,9 @@
             <span class="brand">Radio Helsinki - Import</span>
             <div class="nav-collapse">
               <ul class="nav">
-                <li id="nav-btn-shows"><a href="#shows/" onclick="event.preventDefault(); apps_select('shows')">Sendungen</a></li>
-                <li id="nav-btn-jingles"><a href="#jingles/" onclick="event.preventDefault(); apps_select('jingles')">Jingles</a></li>
-                <li id="nav-btn-musicpools"><a href="#musicpools/" onclick="event.preventDefault(); apps_select('musicpools')">Musikpools</a></li>
+                <li id="nav-btn-shows"><a href="/shows/" onclick="event.preventDefault(); apps_select('shows')">Sendungen</a></li>
+                <li id="nav-btn-jingles"><a href="/jingles/" onclick="event.preventDefault(); apps_select('jingles')">Jingles</a></li>
+                <li id="nav-btn-musicpools"><a href="/musicpools/" onclick="event.preventDefault(); apps_select('musicpools')">Musikpools</a></li>
               </ul>
               <form id="logoutform" class="navbar-form pull-right">
                 <span class="navbar-text">angmeldet als <strong id="username-field">UNKNOWN</strong></span>&nbsp;&nbsp;
diff --git a/www/js/apps.js b/www/js/apps.js
index dcabe98..249947a 100644
--- a/www/js/apps.js
+++ b/www/js/apps.js
@@ -59,13 +59,13 @@ function apps_select(app) {
       apps_current = app = 'shows';
       shows_init();
   }
-  if (locationHashValue() !== app) {
-    history.pushState(null, null, '/#' + app + '/');
+  if (locationHrefValue() !== app) {
+    history.pushState(null, null, '/' + app + '/');
   }
 }
 
 function apps_init() {
-  apps_current = locationHashValue();
+  apps_current = locationHrefValue();
 
   if(auth_token && auth_username) {
     apps_select(apps_current);
@@ -73,7 +73,7 @@ function apps_init() {
 
   $(window).on('popstate', function(event) {
     if(auth_token && auth_username) {
-      apps_select(locationHashValue());
+      apps_select(locationHrefValue());
     }
   });
 }
diff --git a/www/js/utils.js b/www/js/utils.js
index 2c69b73..2b5d576 100644
--- a/www/js/utils.js
+++ b/www/js/utils.js
@@ -96,7 +96,7 @@ function get_rd_week(msEpoch) {
   return week;
 }
 
-function locationHashValue() {
-  var hash = window.location.hash.match(/#([a-z]+)\/?.*/);
-  return hash ? hash[1] : '';
+function locationHrefValue() {
+  var value = window.location.href.match(/import.helsinki.at\/([a-z]+)\/?.*/);
+  return value ? value[1] : '';
 }
-- 
cgit v0.10.2