User define Google Maps callback

By defining tarteaucitron.user.mapscallback variable, user can call another callback than the default one.
This commit is contained in:
Sebastien HEYD 2018-04-04 08:26:41 +02:00 committed by GitHub
parent 813e036f0f
commit 6d73f0046a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -873,9 +873,13 @@ tarteaucitron.services.googlemaps = {
map, map,
uniqIds = [], uniqIds = [],
i; i;
tarteaucitron.addScript('//maps.googleapis.com/maps/api/js?v=3.exp&key=' + tarteaucitron.user.googlemapsKey + '&callback=tac_googlemaps_callback'); if (tarteaucitron.user.mapscallback === undefined) {
tarteaucitron.user.mapscallback = 'tac_googlemaps_callback';
}
tarteaucitron.addScript('//maps.googleapis.com/maps/api/js?v=3.exp&key=' + tarteaucitron.user.googlemapsKey + '&callback='+tarteaucitron.user.mapscallback);
window.tac_googlemaps_callback = function () { window.tac_googlemaps_callback = function () {
tarteaucitron.fallback(['googlemaps-canvas'], function (x) { tarteaucitron.fallback(['googlemaps-canvas'], function (x) {
var uniqId = '_' + Math.random().toString(36).substr(2, 9); var uniqId = '_' + Math.random().toString(36).substr(2, 9);