Merge pull request #218 from OwnWeb/feature/googlemaps-embed

 Add Google Maps Iframe embed service
This commit is contained in:
Amauri CHAMPEAUX 2018-09-25 14:28:46 +02:00 committed by GitHub
commit 8ff060c449
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 0 deletions

View File

@ -1459,5 +1459,11 @@ var tarteaucitron = {
}
}
return source;
},
"getElemWidth": function(elem) {
return elem.getAttribute('width') || elem.clientWidth;
},
"getElemHeight": function(elem) {
return elem.getAttribute('height') || elem.clientHeight;
}
};

View File

@ -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 '<iframe src="' + url + '" width="' + width + '" height="' + height + '" frameborder="0" scrolling="no" allowtransparency allowfullscreen></iframe>';
});
},
"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",