2016-07-10 1 views
0

나는 Firefox addon Ubiquity로 게임을하고 있습니다. 미리보기 페이지에 맞춤형 Google지도를 넣으려고합니다. 이 페이지에는 다음이 포함되어야합니다Firefox에 맞춤지도 추가하기 유비쿼터스 addon

<html> 
<head> 
    <title>Google Maps Multiple Markers</title> 
    <script src="https://maps.googleapis.com/maps/api/js?key=MY_KEY" type="text/javascript"></script> 
</head> 
<body> 
<div id="map" style="height: 400px; width: 500px;"></div> 
<script type="text/javascript"> 
    var locations = ['Bondi Beach', 'Coogee Beach', 'Cronulla Beach', 'Manly Beach', 'Maroubra Beach']; 

    var map = new google.maps.Map(document.getElementById('map'), { 
     zoom: 10, 
     center: new google.maps.LatLng(-33.92, 151.25), 
     mapTypeId: google.maps.MapTypeId.ROADMAP 
    }); 

    var marker, i; 
    var geocoder = new google.maps.Geocoder(); 

    for (i = 0; i < locations.length; i++) { 
     console.log("coding " + locations[i]); 
     geocoder.geocode({'address': locations[i].toLowerCase()}, function(results, status) { 
      if (status == google.maps.GeocoderStatus.OK) { 
       map.setCenter(results[0].geometry.location); 
       var marker = new google.maps.Marker({ 
        map: map, 
        position: results[0].geometry.location 
       }); 
      } else { 
       alert("Geocode was not successful for the following reason: " + status); 
      } 
     }); 
    } 
    </script> 
</body> 
</html> 

을하지만 locations 변수는 입력으로 설정해야합니다. 아이디어는 사용자가 여러 위치를 매핑하도록하는 것입니다 (이 기능은 한 번 거기에 있었고 다시 만들려고합니다). 단순히 설정을 시도했습니다 pblock.innerHTML,하지만 그것은 입력을 가져 오는 것, 아무것도 나타납니다. 리버스 엔지니어링 기본 map 명령의 기능을 시도했지만 어떻게 작동하는지 이해하지 못합니다.

답변

0

지도 명령이 포함 된 전체 파일을 복사하고 내가 필요한 부분 만 남을 때까지 모든 부분을 자르면서이를 해결했습니다. 아직도 내 오래된 솔루션이 작동하지 않는 이유는 아직 확실하지 않습니다.