From 6d73f0046a77be0082bd7fa8d5a6532075b3d9c3 Mon Sep 17 00:00:00 2001 From: Sebastien HEYD Date: Wed, 4 Apr 2018 08:26:41 +0200 Subject: [PATCH] User define Google Maps callback By defining tarteaucitron.user.mapscallback variable, user can call another callback than the default one. --- tarteaucitron.services.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 9b042b0..a4199c4 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -873,9 +873,13 @@ tarteaucitron.services.googlemaps = { map, uniqIds = [], 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 () { tarteaucitron.fallback(['googlemaps-canvas'], function (x) { var uniqId = '_' + Math.random().toString(36).substr(2, 9);