Use yepnope for lazy loading JS
[busui.git] / include / common-template.inc.php
blob:a/include/common-template.inc.php -> blob:b/include/common-template.inc.php
--- a/include/common-template.inc.php
+++ b/include/common-template.inc.php
@@ -46,30 +46,38 @@
     echo '
 <!DOCTYPE html> 
 <html lang="en">
-	<head>
+	<head profile="http://microformats.org/profile/hcalendar http://microformats.org/profile/geo http://vocab.org/transit/terms">
         <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1"> 	
 <title>' . $pageTitle . ' - Canberra Bus Timetable</title>
         <meta name="google-site-verification" content="-53T5Qn4TB_de1NyfR_ZZkEVdUNcNFSaYKSFkWKx-sY" />
 <link rel="dns-prefetch" href="//code.jquery.com">
-<link rel="dns-prefetch" href="//ajax.googleapis.com">';
-    $jqmVersion = "1.0.1";
-    echo '
-	<script src="js/yepnope/yepnope.1.5.3-min.js"></script>
-		 <script>
-                 yepnope([{
-  load: "//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js",
-  complete: function () {
-    
-     $(document).bind("mobileinit", function(){
+<link rel="dns-prefetch" href="//ajax.googleapis.com">
+	<link rel="stylesheet"  href="' . $basePath . 'css/jquery-ui-1.8.12.custom.css" />';
+    $jqmVersion = "1.1.0";
+    if (isDebugServer()) {
+        $jqmcss = $basePath . "css/jquery.mobile-$jqmVersion.min.css";
+        $jqjs = $basePath . "js/jquery-1.7.2.min.js";
+        $jqmjs = $basePath . "js/jquery.mobile-$jqmVersion.min.js";
+    } else {
+        $jqmcss = "//code.jquery.com/mobile/$jqmVersion/jquery.mobile-$jqmVersion.min.css";
+        $jqjs = "//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js";
+        $jqmjs = "//code.jquery.com/mobile/$jqmVersion/jquery.mobile-$jqmVersion.min.js";
+    }
+    echo '<link rel="stylesheet"  href="' . $jqmcss . '" />
+	<script src="' . $jqjs . '"></script>
+		 <script>$(document).bind("mobileinit", function(){
   $.mobile.ajaxEnabled = false;
-}); }
-  
-}, {
-  load: ["//code.jquery.com/mobile/' . $jqmVersion . '/jquery.mobile-' . $jqmVersion . '.min.css","//code.jquery.com/mobile/' . $jqmVersion . '/jquery.mobile-' . $jqmVersion . '.min.js"] 
-  }, {
-  load: ["' . $basePath . 'css/jquery-ui-1.8.12.custom.css","' . $basePath . 'js/jquery.ui.core.min.js","' . $basePath . 'js/jquery.ui.position.min.js","' . $basePath . 'js/jquery.ui.widget.min.js","' . $basePath . 'js/jquery.ui.autocomplete.min.js"],
-  complete: function() {
+});
+</script> 
+	<script src="' . $jqmjs . '"></script>
+
+<script src="' . $basePath . 'js/jquery.ui.core.min.js"></script>
+<script src="' . $basePath . 'js/jquery.ui.position.min.js"></script>
+<script src="' . $basePath . 'js/jquery.ui.widget.min.js"></script>
+  <script src="' . $basePath . 'js/jquery.ui.autocomplete.min.js"></script>
+  <script>
+	$(function() {
 		$( "#geolocate" ).autocomplete({
 			source: "lib/autocomplete.php",
 			minLength: 2
@@ -82,13 +90,8 @@
 			source: "lib/autocomplete.php",
 			minLength: 2
 		});
-	}
-  
-  
-}]);
-                
-</script> 
-	';
+	});
+	</script>';
     echo '<style type="text/css">';
     if (strstr($_SERVER['HTTP_USER_AGENT'], 'Android'))
         echo '.ui-shadow,.ui-btn-up-a,.ui-btn-hover-a,.ui-btn-down-a,.ui-body-b,.ui-btn-up-b,.ui-btn-hover-b,
@@ -158,11 +161,11 @@
     </div>
  ';
     if ($opendiv) {
-        echo '<div data-role="page"> 
-	<div data-role="header" data-position="inline">
+        echo '<div data-role="page"'. (isset($stopid) ? 'itemscope itemtype="http://schema.org/BusStop"':'').'>'; 
+	echo '<div data-role="header" data-position="inline">
 	<a href="' . (isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "javascript:history.go(-1)") . '" data-icon="arrow-l" data-rel="back" class="ui-btn-left">Back</a> 
-		<h1>' . $pageTitle . '</h1>
-		<a href="' . $basePath . '/index.php" data-icon="home" class="ui-btn-right">Home</a>
+		<h1 itemprop="name">' . $pageTitle . '</h1>
+		<a href="' . $basePath . '/index.php" data-icon="home" class="ui-btn-right" rel="home">Home</a>
 	</div><!-- /header -->
         <a name="maincontent" id="maincontent"></a>
         <div data-role="content"> ';
@@ -212,7 +215,8 @@
 function include_footer() {
     global $basePath;
     echo '<div id="footer"><a href="' . $basePath . 'about.php">About/Contact Us</a>&nbsp;<a href="' . $basePath . 'feedback.php">Feedback/Bug Report</a>&nbsp;<a href="' . $basePath . 'privacy.php">Privacy Policy</a>';
-    echo '</div>';
+    echo '<br><small>
+        <a rel="license" href="http://creativecommons.org/licenses/by/3.0/au/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by/3.0/au/80x15.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/au/">Creative Commons Attribution 3.0 Australia License</a>.</div></small>';
     if (isAnalyticsOn()) {
         echo "<script>  (function() {
     var ga = document.createElement('script'); ga.type =