Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding Google map & analytics

  • Loading branch information...
commit 38d8275fb4073d9cb71e17f5da19a668114ae605 1 parent e5ed68c
@lindsayevans authored
Showing with 58 additions and 10 deletions.
  1. +20 −10 index.html
  2. +38 −0 js/sotc.js
View
30 index.html
@@ -11,8 +11,8 @@
<h2 itemprop="fn org">Kings Cross Train Station</h2>
<address itemprop="adr">
<div itemprop="geo">
- <meta itemprop="latitude" content="-33.87446">
- <meta itemprop="longitude" content="151.22436">
+ <span itemprop="latitude" content="-33.87446"/>
+ <span itemprop="longitude" content="151.22436"/>
</div>
<span itemprop="street-address">Victoria Street</span>, <span itemprop="locality">Kings Cross</span> <abbr itemprop="region" title="New South Wales">NSW</abbr> <span itemprop="postal-code">2011</span>
</address>
@@ -22,8 +22,8 @@ <h2 itemprop="fn org">Kings Cross Train Station</h2>
<h2 itemprop="fn org">Kings Cross Police Station</h2>
<address itemprop="adr">
<div itemprop="geo">
- <meta itemprop="latitude" content="-33.873696">
- <meta itemprop="longitude" content="151.226965">
+ <span itemprop="latitude" content="-33.873696"/>
+ <span itemprop="longitude" content="151.226965"/>
</div>
<span itemprop="street-address">1-15 Elizabeth Bay Road</span>, <span itemprop="locality">Kings Cross</span> <abbr itemprop="region" title="New South Wales">NSW</abbr> <span itemprop="postal-code">2011</span>
</address>
@@ -33,8 +33,8 @@ <h2 itemprop="fn org">Kings Cross Police Station</h2>
<h2 itemprop="fn org">Tobacco Station</h2>
<address itemprop="adr">
<div itemprop="geo">
- <meta itemprop="latitude" content="-33.874531">
- <meta itemprop="longitude" content="151.223159">
+ <span itemprop="latitude" content="-33.874531"/>
+ <span itemprop="longitude" content="151.223159"/>
</div>
<span itemprop="street-address">68a Darlinghurst Road</span>, <span itemprop="locality">Kings Cross</span> <abbr itemprop="region" title="New South Wales">NSW</abbr> <span itemprop="postal-code">2011</span>
</address>
@@ -44,8 +44,8 @@ <h2 itemprop="fn org">Tobacco Station</h2>
<h2 itemprop="fn org">Bayswater Parking Station</h2>
<address itemprop="adr">
<div itemprop="geo">
- <meta itemprop="latitude" content="-33.875297">
- <meta itemprop="longitude" content="151.223803">
+ <span itemprop="latitude" content="-33.875297"/>
+ <span itemprop="longitude" content="151.223803"/>
</div>
<span itemprop="street-address">33 Bayswater Road</span>, <span itemprop="locality">Kings Cross</span> <abbr itemprop="region" title="New South Wales">NSW</abbr> <span itemprop="postal-code">2011</span>
</address>
@@ -55,8 +55,8 @@ <h2 itemprop="fn org">Bayswater Parking Station</h2>
<h2 itemprop="fn org">Darlinghurst Fire Station</h2>
<address itemprop="adr">
<div itemprop="geo">
- <meta itemprop="latitude" content="-33.875885">
- <meta itemprop="longitude" content="151.221356">
+ <span itemprop="latitude" content="-33.875885"/>
+ <span itemprop="longitude" content="151.221356"/>
</div>
<span itemprop="street-address">185 Darlinghurst Road</span>, <span itemprop="locality">Darlinghurst</span> <abbr itemprop="region" title="New South Wales">NSW</abbr> <span itemprop="postal-code">2010</span>
</address>
@@ -64,6 +64,16 @@ <h2 itemprop="fn org">Darlinghurst Fire Station</h2>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/sotc.js"></script>
+ <script type="text/javascript">
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+ </script>
+ <script type="text/javascript">
+ try {
+ var pageTracker = _gat._getTracker("UA-13227451-1");
+ pageTracker._setDomainName(".stationsofthecross.info");
+ pageTracker._trackPageview();
+ } catch(err) {}</script>
</body>
</html>
View
38 js/sotc.js
@@ -1,2 +1,40 @@
+
+var MAP_API_KEY = location.host.indexOf('localhost') != -1 ?
+ 'ABQIAAAA1IX7KXHN5eMgHy4n0_SLChT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSyZYEKrrVg7vrnYqb9D5lPd4zJWQ':
+ 'ABQIAAAA1IX7KXHN5eMgHy4n0_SLChQwrrIPAdeMAqJ7rTrefujICwNWehR5Hs6MxIso0nY-EL20LCpGsgrTwg';
+
+document.write(unescape('%3Cscript src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key='+MAP_API_KEY+'" type="text/javascript"></script>'));
+
$(function(){
+
+ $('body').css({fontFamily: 'Comic Sans MS, Comic Sans'});
+
+ var map = $('<div id="m"/>')
+ .appendTo('body')
+ .css({
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ width: '100%',
+ height: '100%'
+ }),
+ gmap = new GMap2(map[0])
+ ;
+ gmap.setCenter(new GLatLng(-33.872268,151.22509), 16);
+
+ $('section').each(function(i){
+ var _this = $(this),
+ point = new GLatLng(
+ $('span[itemprop="latitude"]', _this).attr('content'),
+ $('span[itemprop="longitude"]', _this).attr('content')
+ ),
+ marker = new GMarker(point, {title: $('h2[itemprop~="org"]', _this).text()})
+ ;
+ gmap.addOverlay(marker);
+ GEvent.addListener(marker, 'click', function(){
+ marker.openInfoWindowHtml(_this.html());
+ });
+
+ });
+
});
Please sign in to comment.
Something went wrong with that request. Please try again.