Merge pull request #129 from d4rk694/master
Added iframe google maps with search query + customization cookie expire
This commit is contained in:
commit
c449b76380
|
|
@ -6,6 +6,8 @@ var scripts = document.getElementsByTagName('script'),
|
||||||
cdn = path.split('/').slice(0, -1).join('/') + '/',
|
cdn = path.split('/').slice(0, -1).join('/') + '/',
|
||||||
alreadyLaunch = (alreadyLaunch === undefined) ? 0 : alreadyLaunch,
|
alreadyLaunch = (alreadyLaunch === undefined) ? 0 : alreadyLaunch,
|
||||||
tarteaucitronForceLanguage = (tarteaucitronForceLanguage === undefined) ? '' : tarteaucitronForceLanguage,
|
tarteaucitronForceLanguage = (tarteaucitronForceLanguage === undefined) ? '' : tarteaucitronForceLanguage,
|
||||||
|
tarteaucitronForceExpire = (tarteaucitronForceExpire === undefined) ? '' : tarteaucitronForceExpire,
|
||||||
|
timeExipre = 31536000000,
|
||||||
tarteaucitronProLoadServices,
|
tarteaucitronProLoadServices,
|
||||||
tarteaucitronNoAdBlocker = false;
|
tarteaucitronNoAdBlocker = false;
|
||||||
|
|
||||||
|
|
@ -873,9 +875,15 @@ var tarteaucitron = {
|
||||||
"owner": {},
|
"owner": {},
|
||||||
"create": function (key, status) {
|
"create": function (key, status) {
|
||||||
"use strict";
|
"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(),
|
var d = new Date(),
|
||||||
time = d.getTime(),
|
time = d.getTime(),
|
||||||
expireTime = time + 31536000000, // 365 days
|
expireTime = time + timeExipre, // 365 days
|
||||||
regex = new RegExp("!" + key + "=(wait|true|false)", "g"),
|
regex = new RegExp("!" + key + "=(wait|true|false)", "g"),
|
||||||
cookie = tarteaucitron.cookie.read().replace(regex, ""),
|
cookie = tarteaucitron.cookie.read().replace(regex, ""),
|
||||||
value = 'tarteaucitron=' + cookie + '!' + key + '=' + status,
|
value = 'tarteaucitron=' + cookie + '!' + key + '=' + status,
|
||||||
|
|
|
||||||
|
|
@ -1128,6 +1128,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 '<iframe src="' + url + '" width="' + width + '" height="' + height + '" frameborder="0" scrolling="no" allowtransparency allowfullscreen></iframe>';
|
||||||
|
return '<iframe width="' + width +'" height="' + height + '" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?q='+query+'&key='+key+'" allowfullscreen></iframe> '
|
||||||
|
});
|
||||||
|
},
|
||||||
|
"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
|
// google tag manager
|
||||||
tarteaucitron.services.googletagmanager = {
|
tarteaucitron.services.googletagmanager = {
|
||||||
"key": "googletagmanager",
|
"key": "googletagmanager",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue