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;
|
var config = data;
|
||||||
Ox.print('config', config);
|
Ox.print('config', config);
|
||||||
document.title = config.site.name;
|
document.title = config.site.name;
|
||||||
window.google = function() {};
|
|
||||||
$.getScript('http://maps.google.com/maps/api/js?callback=google&sensor=false', function() {
|
|
||||||
loadImages(function() {
|
loadImages(function() {
|
||||||
that.api.api(function(result) {
|
that.api.api(function(result) {
|
||||||
$.each(result.data.actions, function(i, action) {
|
$.each(result.data.actions, function(i, action) {
|
||||||
|
@ -257,7 +255,6 @@ requires
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
function stop() {
|
function stop() {
|
||||||
that.request.send(self.options.init, getUserData(), function() {});
|
that.request.send(self.options.init, getUserData(), function() {});
|
||||||
|
@ -7270,6 +7267,21 @@ requires
|
||||||
key_escape: deselectPlace
|
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, {
|
$.extend(self, {
|
||||||
geocoder: new google.maps.Geocoder(),
|
geocoder: new google.maps.Geocoder(),
|
||||||
selected: -1
|
selected: -1
|
||||||
|
@ -7304,6 +7316,7 @@ requires
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function loadMap() {
|
function loadMap() {
|
||||||
self.center = self.bounds ? self.bounds.getCenter() : new google.maps.LatLng(0, 0);
|
self.center = self.bounds ? self.bounds.getCenter() : new google.maps.LatLng(0, 0);
|
||||||
|
@ -7328,9 +7341,9 @@ requires
|
||||||
});
|
});
|
||||||
resize();
|
resize();
|
||||||
that.gainFocus();
|
that.gainFocus();
|
||||||
|
that.triggerEvent('loaded');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function canContain(outerBounds, innerBounds) {
|
function canContain(outerBounds, innerBounds) {
|
||||||
var outerSpan = outerBounds.toSpan(),
|
var outerSpan = outerBounds.toSpan(),
|
||||||
innerSpan = innerBounds.toSpan();
|
innerSpan = innerBounds.toSpan();
|
||||||
|
|
Loading…
Reference in a new issue