From da6b132f488b45a06140c0346ead1f2fb821ff0f Mon Sep 17 00:00:00 2001 From: Ricci Dorian Date: Sat, 2 Jun 2018 23:19:51 +0200 Subject: [PATCH 1/2] Added iframe google maps with search query --- tarteaucitron.services.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 50f07dc..35a6c05 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -937,6 +937,38 @@ tarteaucitron.services.googlemaps = { } }; +// googlemaps search +tarteaucitron.services.googlemapssearch = { + "key": "googlemapssearch", + "type": "api", + "name": "Google Maps Seard API", + "uri": "http://www.google.com/ads/preferences/", + "needConsent": true, + "cookies": ['nid'], + "js": function () { + "use strict"; + tarteaucitron.fallback(['googlemapssearch'], function (x) { + var width = x.getAttribute("width"), + height = x.getAttribute("height"), + // url = x.getAttribute("data-url"); + query = escape(x.getAttribute("data-search")), + key = x.getAttribute("data-api-key"); + + // return ''; + return ' ' + }); + }, + "fallback": function () { + "use strict"; + var id = 'googlemapssearch'; + tarteaucitron.fallback(['googlemapssearch'], function (elem) { + elem.style.width = elem.getAttribute('width') + 'px'; + elem.style.height = elem.getAttribute('height') + 'px'; + return tarteaucitron.engage(id); + }); + } +}; + // google tag manager tarteaucitron.services.googletagmanager = { "key": "googletagmanager", From cf3a58fa86974eb5cd4fddd30c23ab437e2687d5 Mon Sep 17 00:00:00 2001 From: Ricci Dorian Date: Sun, 3 Jun 2018 13:10:37 +0200 Subject: [PATCH 2/2] added customisation of time cookie expire --- tarteaucitron.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tarteaucitron.js b/tarteaucitron.js index 0cada71..d8d2c14 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -6,6 +6,8 @@ var scripts = document.getElementsByTagName('script'), cdn = path.split('/').slice(0, -1).join('/') + '/', alreadyLaunch = (alreadyLaunch === undefined) ? 0 : alreadyLaunch, tarteaucitronForceLanguage = (tarteaucitronForceLanguage === undefined) ? '' : tarteaucitronForceLanguage, + tarteaucitronForceExpire = (tarteaucitronForceExpire === undefined) ? '' : tarteaucitronForceExpire, + timeExipre = 31536000000, tarteaucitronProLoadServices, tarteaucitronNoAdBlocker = false; @@ -860,9 +862,15 @@ var tarteaucitron = { "owner": {}, "create": function (key, status) { "use strict"; + + if (tarteaucitronForceExpire !== '') { + // The number of day cann't be higher than 1 year + timeExipre = (tarteaucitronForceExpire > 365) ? 31536000000 : tarteaucitronForceExpire * 86400000; // Multiplication to tranform the number of days to milliseconds + } + var d = new Date(), time = d.getTime(), - expireTime = time + 31536000000, // 365 days + expireTime = time + timeExipre, // 365 days regex = new RegExp("!" + key + "=(wait|true|false)", "g"), cookie = tarteaucitron.cookie.read().replace(regex, ""), value = 'tarteaucitron=' + cookie + '!' + key + '=' + status,