Template:Fragoria Map
From FragoriaWiki
(Difference between revisions)
Line 66: | Line 66: | ||
}); | }); | ||
- | setMarkers (map, | + | setMarkers (map, greendungeons); |
infowindow = new google.maps.InfoWindow({ | infowindow = new google.maps.InfoWindow({ | ||
content: "Loading..." | content: "Loading..." | ||
Line 104: | Line 104: | ||
// repeat across x-axis | // repeat across x-axis | ||
if (x < 0 || x >= tileRange) { | if (x < 0 || x >= tileRange) { | ||
- | + | // x = (x % tileRange + tileRange) % tileRange; | |
- | + | return null; | |
} | } | ||
return { | return { | ||
Line 111: | Line 111: | ||
y: y | y: y | ||
}; | }; | ||
- | |||
} | } | ||
- | var | + | var greendungeons = [ |
- | ['Dark Konungs Tomb',-89.128166,16.829451,2,'<img src="/wiki/images/3/31/Pets1.png | + | ['Dark Konungs Tomb',-89.128166,16.829451,2,'<img src="/wiki/images/3/31/Pets1.png" />'], |
['Robbers Vault',-89.089905,47.766951,3,'Test'], | ['Robbers Vault',-89.089905,47.766951,3,'Test'], | ||
['Savage Dens',-89.221718,29.309920,4,'Test'], | ['Savage Dens',-89.221718,29.309920,4,'Test'], | ||
Line 132: | Line 131: | ||
function setMarkers(map, locations) { | function setMarkers(map, locations) { | ||
- | var | + | var greendungeonimage = { |
url: '/wiki/images/f/f7/Greendungeonicon.png', | url: '/wiki/images/f/f7/Greendungeonicon.png', | ||
size: new google.maps.Size(40, 40), | size: new google.maps.Size(40, 40), | ||
Line 138: | Line 137: | ||
anchor: new google.maps.Point(20, 20) | anchor: new google.maps.Point(20, 20) | ||
}; | }; | ||
- | var | + | var greendungeonshape = { |
coords: [0, 0, 0, 40, 40, 40 , 40, 0], | coords: [0, 0, 0, 40, 40, 40 , 40, 0], | ||
type: 'poly' | type: 'poly' | ||
}; | }; | ||
for (var i = 0; i < locations.length; i++) { | for (var i = 0; i < locations.length; i++) { | ||
- | var | + | var greendungeon = locations[i]; |
- | var | + | var greendungeonLatLng = new google.maps.LatLng(greendungeon[1], greendungeon[2]); |
var marker = new google.maps.Marker({ | var marker = new google.maps.Marker({ | ||
- | position: | + | position: greendungeonLatLng, |
map: map, | map: map, | ||
- | icon: | + | icon: greendungeonimage, |
- | shape: | + | shape: greendungeonshape, |
- | title: | + | title: greendungeon[0], |
- | html: | + | html: greendungeon[4], |
- | + | optimized: false, | |
- | zIndex: | + | zIndex: greendungeon[3] |
}); | }); | ||
- | + | var contentString = "Content"; | |
- | var contentString = " | + | |
- | + | ||
google.maps.event.addListener(marker, "click", function () { | google.maps.event.addListener(marker, "click", function () { | ||
infowindow.setContent(this.html); | infowindow.setContent(this.html); | ||
infowindow.open(map, this); | infowindow.open(map, this); | ||
}); | }); | ||
- | |||
- | |||
} | } | ||
- | |||
- | |||
} | } | ||
- | + | google.maps.event.addDomListener(window, 'load', initialize); | |
</script> | </script> |
Revision as of 23:39, 6 April 2015