lazyload google maps
This commit is contained in:
parent
d267b21f41
commit
33cce09096
1 changed files with 82 additions and 69 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue