lazyload google maps

This commit is contained in:
rolux 2010-12-22 17:58:39 +00:00
parent feb7a876b7
commit e25043765a

View File

@ -218,8 +218,6 @@ requires
var config = data;
Ox.print('config', config);
document.title = config.site.name;
window.google = function() {};
$.getScript('http://maps.google.com/maps/api/js?callback=google&sensor=false', function() {
loadImages(function() {
that.api.api(function(result) {
$.each(result.data.actions, function(i, action) {
@ -257,7 +255,6 @@ requires
});
});
});
});
}
function stop() {
that.request.send(self.options.init, getUserData(), function() {});
@ -7270,6 +7267,21 @@ requires
key_escape: deselectPlace
});
if (Ox.isUndefined(window.google)) {
window.google = function() {};
$.getScript('http://maps.google.com/maps/api/js?callback=google&sensor=false', function() {
var interval = setInterval(function() {
if (!Ox.isUndefined(google.maps)) {
clearInterval(interval);
initMap();
}
}, 100);
});
} else {
initMap();
}
function initMap() {
$.extend(self, {
geocoder: new google.maps.Geocoder(),
selected: -1
@ -7304,6 +7316,7 @@ requires
});
});
}
}
function loadMap() {
self.center = self.bounds ? self.bounds.getCenter() : new google.maps.LatLng(0, 0);
@ -7328,9 +7341,9 @@ requires
});
resize();
that.gainFocus();
that.triggerEvent('loaded');
}
function canContain(outerBounds, innerBounds) {
var outerSpan = outerBounds.toSpan(),
innerSpan = innerBounds.toSpan();