Update Instagram integration

This commit is contained in:
Marc Bellêtre 2021-04-12 17:16:44 +02:00
parent f4450c5a73
commit 1a6113c857
1 changed files with 20 additions and 11 deletions

View File

@ -1832,28 +1832,37 @@ tarteaucitron.services.instagram = {
"js": function () { "js": function () {
"use strict"; "use strict";
tarteaucitron.fallback(['instagram_post'], function (x) { tarteaucitron.fallback(['instagram_post'], function (x) {
var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Instagram iframe'), var post_id = x.getAttribute('postId'),
post_id = x.getAttribute("postId"), post_permalink = x.getAttribute('data-instgrm-permalink'),
embed_width = x.getAttribute("width"), embed_width = x.getAttribute('width'),
frame_width = 'width=', embed_height = x.getAttribute('height'),
embed_height = x.getAttribute("height"), frame_width,
frame_height = 'height=', frame_height,
post_frame; post_frame;
if (post_permalink != null) {
tarteaucitron.addScript('//www.instagram.com/embed.js', 'instagram-embed');
return '';
}
if (post_id === undefined) { if (post_id === undefined) {
return ""; return "";
} }
if (embed_width !== undefined) { if (embed_width !== undefined) {
frame_width += '"' + embed_width + '" '; frame_width = 'width="' + embed_width + '" ';
} else { } else {
frame_width += '"" '; frame_width = '"" ';
} }
if (embed_height !== undefined) { if (embed_height !== undefined) {
frame_height += '"' + embed_height + '" '; frame_height = 'height="' + embed_height + '" ';
} else { } else {
frame_height += '"" '; frame_height = '"" ';
} }
post_frame = '<iframe title="' + frame_title + '" src="//www.instagram.com/' + post_id + '/embed" ' + frame_width + frame_height + '></iframe>';
post_frame = '<iframe title="Instagram iframe" src="//www.instagram.com/' + post_id + '/embed" ' + frame_width + frame_height + '></iframe>';
return post_frame; return post_frame;
}); });
}, },