Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 22nd, 2011  |  syntax: JavaScript  |  size: 1.66 KB  |  views: 87  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /// <reference path="../jquery-1.6.2-vsdoc.js" />
  2. var gMap;
  3.  
  4.  
  5.  
  6. var gMapDomObject = document.getElementById('gMap');
  7.  
  8. function GlobalMap() {
  9.     var gMapDefaultOptions = {
  10.         zoom: 8,
  11.         mapTypeId: google.maps.MapTypeId.ROADMAP,
  12.         mapTypeControlOptions: {
  13.             style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
  14.             position: google.maps.ControlPosition.TOP_RIGHT
  15.         },
  16.         zoomControl: false,
  17.         panControl: false,
  18.         streetViewControl: false
  19.     };
  20.  
  21.     gMap = new google.maps.Map(document.getElementById("gMap"), gMapDefaultOptions);
  22.  
  23.     if (navigator.geolocation) {
  24.         navigator.geolocation.getCurrentPosition(function (position) {
  25.             var initialLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
  26.             gMap.setCenter(initialLocation);
  27.         }, function () {
  28.             alert("geolocation not accepted");
  29.         });
  30.     } else {
  31.         alert("really old browser");
  32.     }
  33.  
  34.     google.maps.event.addDomListener(window, 'resize', function () {
  35.            
  36.         //TODO add some resize ajax Logic
  37.            
  38.         google.maps.event.trigger(gMap, 'resize');
  39.  
  40.     });
  41.  
  42.     this.
  43. };
  44.  
  45. function handleNoGeolocation(errorFlag) {
  46.     if (errorFlag) {
  47.         var content = 'Error: The Geolocation service failed.';
  48.     } else {
  49.         var content = 'Error: Your browser doesn\'t support geolocation.';
  50.     }
  51.  
  52.     var options = {
  53.         map: map,
  54.         position: new google.maps.LatLng(0, 0),
  55.         content: content
  56.     };
  57.  
  58.     var infowindow = new google.maps.InfoWindow(options);
  59.     map.setCenter(options.position);
  60. }
clone this paste RAW Paste Data