Skip to content
Snippets Groups Projects
Commit c5e5b943 authored by Brandon Bergren's avatar Brandon Bergren
Browse files

JSLint run.

Fix unguarded for in.
parent d7c7bb3b
No related branches found
No related tags found
No related merge requests found
/* $Id$ */
/**
* @file
* Common marker routines.
*/
Drupal.gmap.addHandler('gmap', function(elem) {
/*global $, Drupal, GEvent, GInfoWindowTab, GLatLng, GLatLngBounds */
Drupal.gmap.addHandler('gmap', function (elem) {
var obj = this;
obj.bind('init', function() {
obj.bind('init', function () {
if (obj.vars.behavior.autozoom) {
obj.bounds = new GLatLngBounds();
}
});
obj.bind('addmarker',function(marker) {
var m = Drupal.gmap.factory.marker(new GLatLng(marker.latitude,marker.longitude), marker.opts);
obj.bind('addmarker', function (marker) {
var m = Drupal.gmap.factory.marker(new GLatLng(marker.latitude, marker.longitude), marker.opts);
marker.marker = m;
GEvent.addListener(m,'click',function() {
obj.change('clickmarker',-1,marker);
GEvent.addListener(m, 'click', function () {
obj.change('clickmarker', -1, marker);
});
if (obj.vars.behavior.extramarkerevents) {
GEvent.addListener(m,'mouseover',function() {
obj.change('mouseovermarker',-1,marker);
GEvent.addListener(m, 'mouseover', function () {
obj.change('mouseovermarker', -1, marker);
});
GEvent.addListener(m,'mouseout',function() {
obj.change('mouseoutmarker',-1,marker);
GEvent.addListener(m, 'mouseout', function () {
obj.change('mouseoutmarker', -1, marker);
});
GEvent.addListener(m,'dblclick',function() {
obj.change('dblclickmarker',-1,marker);
GEvent.addListener(m, 'dblclick', function () {
obj.change('dblclickmarker', -1, marker);
});
}
/**
* Perform a synthetic marker click on this marker on load.
*/
if (marker.autoclick || (marker.options && marker.options.autoclick)) {
obj.deferChange('clickmarker',-1,marker);
obj.deferChange('clickmarker', -1, marker);
}
if (obj.vars.behavior.autozoom) {
obj.bounds.extend(marker.marker.getPoint());
......@@ -42,28 +45,30 @@ Drupal.gmap.addHandler('gmap', function(elem) {
});
// Default marker actions.
obj.bind('clickmarker',function(marker) {
obj.bind('clickmarker', function (marker) {
if (marker.text) {
marker.marker.openInfoWindowHtml(marker.text);
}
if (marker.rmt) {
$.get(obj.vars.rmtcallback + '/' + marker.rmt, {}, function(data){
$.get(obj.vars.rmtcallback + '/' + marker.rmt, {}, function (data) {
marker.marker.openInfoWindowHtml(data);
});
}
else if (marker.tabs) {
var infoWinTabs = [];
for (var m in marker.tabs) {
infoWinTabs.push(new GInfoWindowTab(m,marker.tabs[m]));
if (marker.tabs.hasOwnProperty(m)) {
infoWinTabs.push(new GInfoWindowTab(m, marker.tabs[m]));
}
}
marker.marker.openInfoWindowTabsHtml(infoWinTabs);
}
else if (marker.link) {
open(marker.link,'_self');
open(marker.link, '_self');
}
});
obj.bind('markersready', function() {
obj.bind('markersready', function () {
// If we are autozooming, set the map center at this time.
if (obj.vars.behavior.autozoom) {
if (!obj.bounds.isEmpty()) {
......@@ -72,7 +77,7 @@ Drupal.gmap.addHandler('gmap', function(elem) {
}
});
obj.bind('clearmarkers', function() {
obj.bind('clearmarkers', function () {
// Reset bounds if autozooming
// @@@ Perhaps we should have a bounds for both markers and shapes?
if (obj.vars.behavior.autozoom) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment