From 1b5f0cad472e3724eb63cb1b37a71002459eb3f6 Mon Sep 17 00:00:00 2001 From: Hugo Heneault Date: Fri, 14 Sep 2018 11:55:41 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20Google=20Maps=20Iframe=20embe?= =?UTF-8?q?d=20service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tarteaucitron.js | 6 ++++++ tarteaucitron.services.js | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/tarteaucitron.js b/tarteaucitron.js index 8108076..36985f1 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -1447,5 +1447,11 @@ var tarteaucitron = { } } return source; + }, + "getElemWidth": function(elem) { + return elem.getAttribute('width') || elem.clientWidth; + }, + "getElemHeight": function(elem) { + return elem.getAttribute('height') || elem.clientHeight; } }; diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index f5096b2..1c46b4f 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -1191,6 +1191,35 @@ tarteaucitron.services.googlemapssearch = { } }; +// googlemaps embed iframe +tarteaucitron.services.googlemapsembed = { + "key": "googlemapsembed", + "type": "api", + "name": "Google Maps Embed", + "uri": "http://www.google.com/ads/preferences/", + "needConsent": true, + "cookies": ['apisid', 'hsid', 'nid', 'sapisid', 'sid', 'sidcc', 'ssid', '1p_jar'], + "js": function () { + "use strict"; + tarteaucitron.fallback(['googlemapsembed'], function (x) { + var width = tarteaucitron.getElemWidth(x), + height = tarteaucitron.getElemHeight(x), + url = x.getAttribute("data-url"); + + return ''; + }); + }, + "fallback": function () { + "use strict"; + var id = 'googlemapsembed'; + tarteaucitron.fallback(['googlemapsembed'], function (elem) { + elem.style.width = tarteaucitron.getElemWidth(elem) + 'px'; + elem.style.height = tarteaucitron.getElemHeight(elem) + 'px'; + return tarteaucitron.engage(id); + }); + } +}; + // google tag manager tarteaucitron.services.googletagmanager = { "key": "googletagmanager",