From 1a6113c857b7b11c258b09a002cfbf1a8c6f05f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bell=C3=AAtre?= Date: Mon, 12 Apr 2021 17:16:44 +0200 Subject: [PATCH 1/3] Update Instagram integration --- tarteaucitron.services.js | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 40b2829..2042d60 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -1832,28 +1832,37 @@ tarteaucitron.services.instagram = { "js": function () { "use strict"; tarteaucitron.fallback(['instagram_post'], function (x) { - var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Instagram iframe'), - post_id = x.getAttribute("postId"), - embed_width = x.getAttribute("width"), - frame_width = 'width=', - embed_height = x.getAttribute("height"), - frame_height = 'height=', + var post_id = x.getAttribute('postId'), + post_permalink = x.getAttribute('data-instgrm-permalink'), + embed_width = x.getAttribute('width'), + embed_height = x.getAttribute('height'), + frame_width, + frame_height, post_frame; + if (post_permalink != null) { + tarteaucitron.addScript('//www.instagram.com/embed.js', 'instagram-embed'); + + return ''; + } + if (post_id === undefined) { return ""; } + if (embed_width !== undefined) { - frame_width += '"' + embed_width + '" '; + frame_width = 'width="' + embed_width + '" '; } else { - frame_width += '"" '; + frame_width = '"" '; } if (embed_height !== undefined) { - frame_height += '"' + embed_height + '" '; + frame_height = 'height="' + embed_height + '" '; } else { - frame_height += '"" '; + frame_height = '"" '; } - post_frame = ''; + + post_frame = ''; + return post_frame; }); }, From 797fa033571ed9536e2774d3a8636116df3f2cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bell=C3=AAtre?= Date: Mon, 12 Apr 2021 17:18:41 +0200 Subject: [PATCH 2/3] Revert iframe title --- tarteaucitron.services.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 2042d60..3c50a3e 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -1832,7 +1832,7 @@ tarteaucitron.services.instagram = { "js": function () { "use strict"; tarteaucitron.fallback(['instagram_post'], function (x) { - var post_id = x.getAttribute('postId'), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Instagram iframe'), post_permalink = x.getAttribute('data-instgrm-permalink'), embed_width = x.getAttribute('width'), embed_height = x.getAttribute('height'), @@ -1861,7 +1861,7 @@ tarteaucitron.services.instagram = { frame_height = '"" '; } - post_frame = ''; + post_frame = ''; return post_frame; }); From 2a6756ebaae286ab7ea58d7b1062e5fc20e61e35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bell=C3=AAtre?= Date: Tue, 13 Apr 2021 18:43:49 +0200 Subject: [PATCH 3/3] Revert Instagram postId attribute --- tarteaucitron.services.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 3c50a3e..7a8bd30 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -1833,6 +1833,7 @@ tarteaucitron.services.instagram = { "use strict"; tarteaucitron.fallback(['instagram_post'], function (x) { var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Instagram iframe'), + post_id = x.getAttribute('postId'), post_permalink = x.getAttribute('data-instgrm-permalink'), embed_width = x.getAttribute('width'), embed_height = x.getAttribute('height'),