//author Marcus Tennant <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #map-canvas { height: 80% } #bottom { height: 20%; background-image: url('http://i.imgur.com/wxRmWg1.png'); background-size: 100% 100%; background-repeat: no-repeat} </style> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAdzzL7pzTPATw4DQVr99WXnMlHLQvSErE&sensor=false"> </script> <script type="text/javascript"> function test(){ //user agent testing stuff, for the demo the test function gets loaded and immediately calls initialize2 where it begins the infinite loop var userAgent = navigator.userAgent.toLowerCase(); var android = userAgent.indexOf("android"); //var ie = userAgent.indexOf("msie"); //if (userAgent.indexof("iphone") > -1 || userAgent.indexof("ipod") > -1 || userAgent.indexof("ipad") > -1 || userAgent.indexof("android") > -1); //if (android >= 0) // initMobile(); //ANDROID //else initialize(); //DESKTOP }; function initialize() { var mapOptions = { zoom: 16, center: new google.maps.LatLng(42.11973, -79.98150), disableDefaultUI: true, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); var lat var lng var refreshRate = 100; var route = 'http://i.imgur.com/YZ38E3t.png'; //remake icons var load = 'http://i.imgur.com/D6ZmfxG.png'; var pos = new google.maps.LatLng(42.12324, -79.98089); var marker = new google.maps.Marker({ position: pos, map: map, icon: route }); //gigantic hardcoded array for offline demo var demoCoords = new Array ( "42.12324, -79.98089","42.12317, -79.98092","42.12309, -79.98097","42.12299, -79.98102","42.12288, -79.98109","42.12278, -79.98113","42.12267, -79.98117","42.12260, -79.98120","42.12249, -79.98120","42.12241, -79.98119","42.12230, -79.98118","42.12220, -79.98118","42.12210, -79.98118","42.12199, -79.98121","42.12187, -79.98125","42.12176, -79.98131","42.12166, -79.98140","42.12156, -79.98151","42.12147, -79.98165","42.12138, -79.98179","42.12132, -79.98177","42.12131, -79.98194","42.12127, -79.98211","42.12124, -79.98224","42.12121, -79.98239","42.12118, -79.98258","42.12115, -79.98278","42.12112, -79.98294","42.12110, -79.98312","42.12107, -79.98330","42.12103, -79.98345","42.12100, -79.98365","42.12097, -79.98383","42.12095, -79.98398","42.12092, -79.98414","42.12089, -79.98430","42.12086, -79.98447","42.12082, -79.98460","42.12079, -79.98479","42.12074, -79.98494","42.12067, -79.98509","42.12060, -79.98525","42.12054, -79.98544","42.12047, -79.98566","42.12039, -79.98584","42.12037, -79.98602","42.12033, -79.98623","42.12030, -79.98646","42.12028, -79.98664","42.12027, -79.98682","42.12025, -79.98703","42.12024, -79.98721","42.12022, -79.98741","42.12022, -79.98762","42.12020, -79.98783","42.12016, -79.98803","42.12013, -79.98823","42.12010, -79.98840","42.12010, -79.98840","42.12010, -79.98840","42.12010, -79.98840","42.12010, -79.98840","42.12008, -79.98857","42.12007, -79.98873","42.12006, -79.98888","42.12006, -79.98888","42.12007, -79.98873","42.12008, -79.98857","42.12010, -79.98841","42.12013, -79.98823","42.12016, -79.98803","42.12020, -79.98783","42.12022, -79.98762","42.12022, -79.98741","42.12024, -79.98721","42.12025, -79.98703","42.12027, -79.98682","42.12028, -79.98664","42.12030, -79.98646","42.12033, -79.98623","42.12037, -79.98602","42.12039, -79.98584","42.12047, -79.98566","42.12054, -79.98544","42.12060, -79.98525","42.12067, -79.98509","42.12074, -79.98494","42.12079, -79.98479","42.12082, -79.98460","42.12086, -79.98447","42.12089, -79.98430","42.12092, -79.98414","42.12095, -79.98398","42.12097, -79.98383","42.12100, -79.98365","42.12103, -79.98345","42.12107, -79.98330","42.12110, -79.98312","42.12112, -79.98294","42.12115, -79.98278","42.12118, -79.98258","42.12121, -79.98239","42.12124, -79.98224","42.12127, -79.98211","42.12131, -79.98194","42.12132, -79.98177","42.12136, -79.98160","42.12137, -79.98144","42.12142, -79.98129","42.12140, -79.98098","42.12112, -79.98082","42.12102, -79.98084","42.12089, -79.98085","42.12078, -79.98084","42.12065, -79.98086","42.12054, -79.98085","42.12044, -79.98088","42.12031, -79.98088","42.12017, -79.98090","42.12009, -79.98089","42.11997, -79.98090","42.11985, -79.98091","42.11967, -79.98092","42.11957, -79.98091","42.11945, -79.98092","42.11935, -79.98092","42.11920, -79.98092","42.11911, -79.98093","42.11896, -79.98093","42.11884, -79.98094","42.11862, -79.98096","42.11852, -79.98097","42.11841, -79.98097","42.11831, -79.98096","42.11821, -79.98097","42.11813, -79.98097","42.11802, -79.98099","42.11792, -79.98098","42.11780, -79.98098","42.11780, -79.98098","42.11780, -79.98098","42.11780, -79.98098","42.11780, -79.98098","42.11768, -79.98100","42.11757, -79.98100","42.11744, -79.98099","42.11735, -79.98097","42.11717, -79.98091","42.11707, -79.98089","42.11697, -79.98085","42.11685, -79.98081","42.11674, -79.98072","42.11662, -79.98065","42.11651, -79.98057","42.11645, -79.98071","42.11639, -79.98091","42.11631, -79.98112","42.11629, -79.98132","42.11628, -79.98155","42.11614, -79.98167","42.11603, -79.98183","42.11599, -79.98212","42.11599, -79.98243","42.11599, -79.98268","42.11599, -79.98283","42.11599, -79.98305","42.11598, -79.98322","42.11602, -79.98336","42.11606, -79.98351","42.11611, -79.98369","42.11611, -79.98369","42.11611, -79.98369","42.11611, -79.98369","42.11611, -79.98369","42.11606, -79.98351","42.11602, -79.98336","42.11598, -79.98322","42.11599, -79.98305","42.11599, -79.98283","42.11599, -79.98268","42.11599, -79.98243","42.11599, -79.98212","42.11603, -79.98183","42.11614, -79.98167","42.11628, -79.98155","42.11629, -79.98132","42.11631, -79.98112","42.11639, -79.98091","42.11645, -79.98071","42.11651, -79.98057","42.11662, -79.98065","42.11674, -79.98072","42.11685, -79.98081","42.11697, -79.98085","42.11707, -79.98089","42.11717, -79.98091","42.11735, -79.98097","42.11744, -79.98099","42.11757, -79.98100","42.11768, -79.98100","42.11781, -79.98098","42.11792, -79.98098","42.11802, -79.98099","42.11813, -79.98097","42.11821, -79.98097","42.11831, -79.98096","42.11841, -79.98097","42.11852, -79.98097","42.11862, -79.98096","42.11884, -79.98094","42.11896, -79.98093","42.11911, -79.98093","42.11920, -79.98092","42.11935, -79.98092","42.11945, -79.98092","42.11957, -79.98091","42.11967, -79.98092","42.11985, -79.98091","42.11997, -79.98090","42.12009, -79.98089","42.12017, -79.98090","42.12031, -79.98088","42.12044, -79.98088","42.12054, -79.98085","42.12065, -79.98086","42.12078, -79.98084","42.12089, -79.98085","42.12102, -79.98084","42.12112, -79.98082","42.12123, -79.98082","42.12149, -79.98075","42.12153, -79.98047","42.12157, -79.98018","42.12162, -79.97987","42.12170, -79.97959","42.12173, -79.97955","42.12185, -79.97935","42.12195, -79.97920","42.12207, -79.97900","42.12219, -79.97879","42.12230, -79.97860","42.12236, -79.97838","42.12239, -79.97817","42.12237, -79.97797","42.12239, -79.97779","42.12238, -79.97761","42.12240, -79.97745","42.12239, -79.97728","42.12239, -79.97710","42.12239, -79.97694","42.12238, -79.97677","42.12230, -79.97677","42.12221, -79.97677","42.12214, -79.97677","42.12203, -79.97677","42.12198, -79.97678","42.12186, -79.97679","42.12180, -79.97687","42.12172, -79.97697","42.12164, -79.97704","42.12155, -79.97708","42.12147, -79.97714","42.12140, -79.97713","42.12132, -79.97710","42.12127, -79.97710","42.12124, -79.97709","42.12120, -79.97724","42.12115, -79.97743","42.12114, -79.97759","42.12111, -79.97777","42.12100, -79.97775","42.12100, -79.97775","42.12100, -79.97775","42.12100, -79.97775","42.12100, -79.97775","42.12111, -79.97777","42.12114, -79.97759","42.12115, -79.97743","42.12120, -79.97724","42.12124, -79.97709","42.12127, -79.97710","42.12132, -79.97710","42.12140, -79.97713","42.12147, -79.97714","42.12155, -79.97708","42.12164, -79.97704","42.12172, -79.97697","42.12180, -79.97687","42.12186, -79.97679","42.12198, -79.97678","42.12203, -79.97677","42.12214, -79.97677","42.12221, -79.97677","42.12230, -79.97677","42.12238, -79.97677","42.12239, -79.97694","42.12239, -79.97710","42.12239, -79.97728","42.12240, -79.97745","42.12238, -79.97761","42.12239, -79.97779","42.12237, -79.97797","42.12239, -79.97817","42.12236, -79.97838","42.12219, -79.97879","42.12210, -79.97898","42.12200, -79.97911","42.12191, -79.97924","42.12182, -79.97937","42.12172, -79.97954","42.12166, -79.97969","42.12162, -79.97991","42.12158, -79.98010","42.12158, -79.98027","42.12159, -79.98043","42.12164, -79.98055","42.12165, -79.98063","42.12179, -79.98073","42.12188, -79.98076","42.12198, -79.98075","42.12212, -79.98077","42.12222, -79.98077","42.12232, -79.98077","42.12246, -79.98076","42.12259, -79.98075","42.12269, -79.98076","42.12281, -79.98075","42.12293, -79.98075","42.12300, -79.98074","42.12308, -79.98074","42.12316, -79.98072" ); var i = 0; function myLoop () { setTimeout(function () { lat = demoCoords[i].substr(0,8); lng = demoCoords[i].substr(10,9); marker.setPosition( new google.maps.LatLng( lat, lng) ); i++; if (demoCoords[i] == "42.12010, -79.98840" || demoCoords[i] == "42.11780, -79.98098" || demoCoords[i] == "42.11611, -79.98369" || demoCoords[i] == "42.12100, -79.97775") //bus stops with real data include +- .00010 on lat and lng marker.setIcon(load); else marker.setIcon(route); if ( i == demoCoords.length) i = 0; myLoop(); }, refreshRate) } myLoop(); } google.maps.event.addDomListener(window, 'load', test); </script> </head> <body> <div id="map-canvas"></div> <div id="bottom"> </div> </body> </html>