trevor403

Untitled

Jan 15th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var filename = window.location.pathname.replace(/^.*(\\|\/|\:)/, '');
  2.  
  3. function mapview() {
  4.     var map;
  5.     var geocoder;
  6.     obj('markerfloat').innerHTML = "Jeep Wrangler<br>Address: Irving Place<br>Speed: 0 MPH <br>Direction: N";
  7.     obj('refrehUnits').parentElement.removeChild(obj('refrehUnits'));
  8.     obj('landmarkStatus').parentElement.parentElement.removeChild(obj('landmarkStatus').parentElement);
  9.     geocoder = new google.maps.Geocoder();
  10.     var latlng = new google.maps.LatLng(41.0426984, -73.8597068);
  11.     var mapOptions = {
  12.         zoom: 25,
  13.         center: latlng,
  14.         mapTypeId: google.maps.MapTypeId.HYBRID
  15.     };
  16.     map = new google.maps.Map(document.getElementById("mapCanvas"), mapOptions);
  17.     var address = "Irving Place, Irvington, NY";
  18.     geocoder.geocode({
  19.         'address': address
  20.     }, function (results, status) {
  21.         if (status == google.maps.GeocoderStatus.OK) {
  22.             map.setCenter(results[0].geometry.location);
  23.             var icon1 = "http://www.guidepointsystems.com/fleet/img/dark/icons/fleet_small.png";
  24.             var icon2 = "http://www.guidepointsystems.com/fleet/img/dark/icons/fleet_small_over.png";
  25.             var marker = new google.maps.Marker({
  26.                 position: latlng,
  27.                 map: map,
  28.                 icon: icon1
  29.             });
  30.             google.maps.event.addListener(marker, 'mousemove', function (event) {
  31.                 marker.setIcon(icon2);
  32.                 var float = obj('markerfloat');
  33.                 try {
  34.                     float.style.left = (window.event.clientX + 12) + "px";
  35.                     if (navigator.appName == "Microsoft Internet Explorer") {
  36.                         float.style.top = (window.event.clientY - 16 + document.documentElement.scrollTop) + "px";
  37.                     }
  38.                     else {
  39.                         float.style.top = (window.event.clientY - 16 + window.pageYOffset) + "px";
  40.                     }
  41.                 } catch (e) {}
  42.             });
  43.             google.maps.event.addListener(marker, 'mouseover', function () {
  44.                 marker.setIcon(icon2);
  45.                 obj('markerfloat').style.display = 'block';
  46.             });
  47.             google.maps.event.addListener(marker, 'mouseout', function () {
  48.                 marker.setIcon(icon1);
  49.                 obj('markerfloat').style.display = 'none';
  50.             });
  51.         }
  52.     });
  53. }
  54.  
  55. function landing() {
  56.     var map;
  57.     var geocoder;
  58.     obj('vehicle_locate_button').parentElement.removeChild(obj('vehicle_locate_button'));
  59.     geocoder = new google.maps.Geocoder();
  60.     var latlng = new google.maps.LatLng(41.0426984, -73.8597068);
  61.     var mapOptions = {
  62.         zoom: 17,
  63.         center: latlng,
  64.         draggable : false,
  65.         mapTypeId: google.maps.MapTypeId.HYBRID
  66.     };
  67.     map = new google.maps.Map(document.getElementById("map_container"), mapOptions);
  68.     var address = "Irving Place, Irvington, NY";
  69.     geocoder.geocode({
  70.         'address': address
  71.     }, function (results, status) {
  72.         if (status == google.maps.GeocoderStatus.OK) {
  73.             map.setCenter(results[0].geometry.location);
  74.             var marker = new google.maps.Marker({
  75.                 map: map,
  76.                 position: results[0].geometry.location
  77.             });
  78.         }
  79.     });
  80. }
  81. var runIt = function() {
  82.     if (filename == "landing") {landing();}
  83.     if (filename == "mapview") {mapview();}
  84. }
  85.  
  86. var checkLoad = function() {  
  87.     document.readyState !== "complete" ? setTimeout(checkLoad,11) : runIt();  
  88. };
  89. checkLoad();  
  90. console.log(filename)
Advertisement
Add Comment
Please, Sign In to add comment