From cbaccd1268e09c1b1598d845c25cdb2a41205918 Mon Sep 17 00:00:00 2001 From: Nicolas Rosset Date: Wed, 3 Mar 2021 17:43:23 +0100 Subject: [PATCH] Add Instragram Embed --- tarteaucitron.services.js | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 5c6b850..9832a55 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -1504,6 +1504,52 @@ tarteaucitron.services.hubspot = { } }; +// instagram +tarteaucitron.services.instagram = { + "key": "instagram", + "type": "social", + "name": "Instagram", + "uri": "https://www.instagram.com/legal/privacy/", + "needConsent": true, + "cookies": ['shbts', 'sessionid', 'csrftoken', 'rur', 'shbid', 'mid', 'ds_usr_id', 'ig_did', 'ig_cb', 'datr'], + "js": function () { + "use strict"; + tarteaucitron.fallback(['instagram_post'], function (x) { + var post_id = x.getAttribute("postId"), + embed_width = x.getAttribute("width"), + frame_width = 'width=', + embed_height = x.getAttribute("height"), + frame_height = 'height=', + post_frame; + + if (post_id === undefined) { + return ""; + } + if (embed_width !== undefined) { + frame_width += '"' + embed_width + '" '; + } else { + frame_width += '"" '; + } + if (embed_height !== undefined) { + frame_height += '"' + embed_height + '" '; + } else { + frame_height += '"" '; + } + post_frame = ''; + return post_frame; + }); + }, + "fallback": function () { + "use strict"; + var id = 'instagram'; + tarteaucitron.fallback(['instagram_post'], function (elem) { + elem.style.width = elem.getAttribute('width') + 'px'; + elem.style.height = elem.getAttribute('height') + 'px'; + return tarteaucitron.engage(id); + }); + } +}; + // jsapi tarteaucitron.services.jsapi = { "key": "jsapi",