app/views/event_venues/index.js.erb in radiant-event_map-extension-1.3.2 vs app/views/event_venues/index.js.erb in radiant-event_map-extension-1.3.3
- old
+ new
@@ -1,17 +1,8 @@
-if(typeof jQuery == 'function') {
- jQuery.fn.populate_map = function() {
- this.each(function() { build_map_and_markers(this); });
- };
-
- jQuery(function() {
- jQuery("#map_canvas").populate_map();
- });
-}
-
function build_map_and_markers(element) {
- if (element != null) {
+ if (!element) element = document.getElementById('map_canvas');
+ if (element) {
var map = new google.maps.Map(element, {
mapTypeId: google.maps.MapTypeId.<%= (Radiant::Config['event_map.googlemap.type'] || 'ROADMAP').upcase %>,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.<%= (Radiant::Config['event_map.googlemap.controlstyle'] || 'DROPDOWN_MENU').upcase %>
}
@@ -39,9 +30,18 @@
function add_marker (map, mark) {
var marker = new google.maps.Marker({ map : map, position : mark['position'], title : mark['title'], icon : mark['image'], shadow : mark['shadow'] });
var infowindow = new google.maps.InfoWindow({ content : mark['description'] , maxWidth : 400 });
google.maps.event.addListener(marker, 'click', function() { infowindow.open(map, marker); });
}
+
+if(typeof jQuery == 'function') {
+ jQuery.fn.populate_map = function() { this.each(function() { build_map_and_markers(this); }); };
+ jQuery(function() { jQuery("#map_canvas").populate_map(); });
+} else {
+ window.onLoad = build_map_and_markers;
+}
+
+