From bfd8f1f8b963f0c859ed40234c09ab61c75d239a Mon Sep 17 00:00:00 2001 From: Harmen Christophe Date: Wed, 7 Apr 2021 08:46:41 +0200 Subject: [PATCH] =?UTF-8?q?Gestion=20des=20titles=20personnalis=C3=A9s=20s?= =?UTF-8?q?ur=20les=20services=20de=20type=20iframe=20(#650)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tarteaucitron.services.js | 129 ++++++++++++++++++++++---------------- 1 file changed, 76 insertions(+), 53 deletions(-) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index ff4156f..b603ad5 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -12,11 +12,12 @@ tarteaucitron.services.iframe = { "js": function () { "use strict"; tarteaucitron.fallback(['tac_iframe'], function (x) { - var width = x.getAttribute("width"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title")), + width = x.getAttribute("width"), height = x.getAttribute("height"), url = x.getAttribute("data-url"); - return ''; + return ''; }); }, "fallback": function () { @@ -73,11 +74,12 @@ tarteaucitron.services.helloasso = { "js": function () { "use strict"; tarteaucitron.fallback(['tac_helloasso'], function (x) { - var width = x.getAttribute("width"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'HelloAsso iframe'), + width = x.getAttribute("width"), height = x.getAttribute("height"), url = x.getAttribute("data-url"); - return ''; + return ''; }); }, "fallback": function () { @@ -102,11 +104,12 @@ tarteaucitron.services.podcloud = { "js": function () { "use strict"; tarteaucitron.fallback(['tac_podcloud'], function (x) { - var width = x.getAttribute("width"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'podCloud iframe'), + width = x.getAttribute("width"), height = x.getAttribute("height"), url = x.getAttribute("data-url"); - return ''; + return ''; }); }, "fallback": function () { @@ -131,12 +134,13 @@ tarteaucitron.services.facebookpost = { "js": function () { "use strict"; tarteaucitron.fallback(['tac_facebookpost'], function (x) { - var width = x.getAttribute("width"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Facebook iframe'), + width = x.getAttribute("width"), height = x.getAttribute("height"), url = x.getAttribute("data-url"), appId = x.getAttribute("data-appid"); - return ''; + return ''; }); }, "fallback": function () { @@ -538,10 +542,11 @@ tarteaucitron.services.amazon = { "js": function () { "use strict"; tarteaucitron.fallback(['amazon_product'], function (x) { - var amazonId = x.getAttribute("amazonid"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Amazon iframe'), + amazonId = x.getAttribute("amazonid"), productId = x.getAttribute("productid"), url = '//ws-eu.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=' + tarteaucitron.getLanguage().toUpperCase() + '&source=ss&ref=ss_til&ad_type=product_link&tracking_id=' + amazonId + '&marketplace=amazon®ion=' + tarteaucitron.getLanguage().toUpperCase() + '&placement=' + productId + '&asins=' + productId + '&show_border=true&link_opens_in_new_window=true', - iframe = ''; + iframe = ''; return iframe; }); @@ -564,12 +569,13 @@ tarteaucitron.services.calameo = { "js": function () { "use strict"; tarteaucitron.fallback(['calameo-canvas'], function (x) { - var id = x.getAttribute("data-id"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Calameo iframe'), + id = x.getAttribute("data-id"), width = x.getAttribute("width"), height = x.getAttribute("height"), url = '//v.calameo.com/?bkcode=' + id; - return ''; + return ''; }); }, "fallback": function () { @@ -768,7 +774,8 @@ tarteaucitron.services.artetv = { "js": function () { "use strict"; tarteaucitron.fallback(['artetv_player'], function (x) { - var video_json = x.getAttribute("json"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Arte.tv iframe'), + video_json = x.getAttribute("json"), video_width = x.getAttribute("width"), video_height = x.getAttribute("height"), video_frame; @@ -777,7 +784,7 @@ tarteaucitron.services.artetv = { return ""; } - video_frame = ''; + video_frame = ''; return video_frame; }); }, @@ -803,7 +810,8 @@ tarteaucitron.services.dailymotion = { "js": function () { "use strict"; tarteaucitron.fallback(['dailymotion_player'], function (x) { - var video_id = x.getAttribute("videoID"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Dailymotion iframe'), + video_id = x.getAttribute("videoID"), video_width = x.getAttribute("width"), frame_width = 'width=', video_height = x.getAttribute("height"), @@ -828,7 +836,7 @@ tarteaucitron.services.dailymotion = { if (embed_type === undefined || !['video', 'playlist'].includes(embed_type) ) { embed_type = "video"; } - video_frame = ''; + video_frame = ''; return video_frame; }); }, @@ -854,7 +862,8 @@ tarteaucitron.services.datingaffiliation = { "js": function () { "use strict"; tarteaucitron.fallback(['datingaffiliation-canvas'], function (x) { - var comfrom = x.getAttribute("data-comfrom"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Dating Affiliation iframe'), + comfrom = x.getAttribute("data-comfrom"), r = x.getAttribute("data-r"), p = x.getAttribute("data-p"), cf0 = x.getAttribute("data-cf0"), @@ -866,7 +875,7 @@ tarteaucitron.services.datingaffiliation = { height = x.getAttribute("height"), url = 'http://www.tools-affil2.com/rotaban/ban.php?' + comfrom; - return ''; + return ''; }); }, "fallback": function () { @@ -944,7 +953,8 @@ tarteaucitron.services.deezer = { "js": function () { "use strict"; tarteaucitron.fallback(['deezer_player'], function (x) { - var deezer_id = x.getAttribute("deezerID"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Deezer iframe'), + deezer_id = x.getAttribute("deezerID"), deezer_width = x.getAttribute("width"), frame_width = 'width=', deezer_height = x.getAttribute("height"), @@ -982,7 +992,7 @@ tarteaucitron.services.deezer = { tracklist = "true"; } params = 'tracklist=' + tracklist + '&radius=' + radius; - deezer_frame = ''; + deezer_frame = ''; return deezer_frame; }); }, @@ -1235,7 +1245,7 @@ tarteaucitron.services.stonly = { window.StonlyWidget || ((window.w = window.StonlyWidget = function() { window.w._api ? window.w._api.apply(window.w, arguments) : window.w.queue.push(arguments) }).queue = []); - + tarteaucitron.addScript('https://stonly.com/js/widget/v2/stonly-widget.js?v=' + Date.now()); } }; @@ -1653,13 +1663,14 @@ tarteaucitron.services.googlemapssearch = { "js": function () { "use strict"; tarteaucitron.fallback(['googlemapssearch'], function (x) { - var width = x.getAttribute("width"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Google search iframe'), + 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 ' ' + return ' ' }); }, "fallback": function () { @@ -1684,11 +1695,12 @@ tarteaucitron.services.googlemapsembed = { "js": function () { "use strict"; tarteaucitron.fallback(['googlemapsembed'], function (x) { - var width = tarteaucitron.getElemWidth(x), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Google maps iframe'), + width = tarteaucitron.getElemWidth(x), height = tarteaucitron.getElemHeight(x), url = x.getAttribute("data-url"); - return ''; + return ''; }); }, "fallback": function () { @@ -1798,7 +1810,8 @@ 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_id = x.getAttribute("postId"), embed_width = x.getAttribute("width"), frame_width = 'width=', embed_height = x.getAttribute("height"), @@ -1818,7 +1831,7 @@ tarteaucitron.services.instagram = { } else { frame_height += '"" '; } - post_frame = ''; + post_frame = ''; return post_frame; }); }, @@ -1885,7 +1898,7 @@ tarteaucitron.services.recaptcha = { } else { tarteaucitron.addScript('https://www.google.com/recaptcha/api.js?onload=tacRecaptchaOnLoad&render=' + tarteaucitron.user.recaptchaapi); } - + }, "fallback": function () { "use strict"; @@ -2059,12 +2072,13 @@ tarteaucitron.services.prezi = { "js": function () { "use strict"; tarteaucitron.fallback(['prezi-canvas'], function (x) { - var id = x.getAttribute("data-id"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Prezi iframe'), + id = x.getAttribute("data-id"), width = x.getAttribute("width"), height = x.getAttribute("height"), url = 'https://prezi.com/embed/' + id + '/?bgcolor=ffffff&lock_to_path=0&autoplay=0&autohide_ctrls=0'; - return ''; + return ''; }); }, "fallback": function () { @@ -2283,12 +2297,13 @@ tarteaucitron.services.slideshare = { "js": function () { "use strict"; tarteaucitron.fallback(['slideshare-canvas'], function (x) { - var id = x.getAttribute("data-id"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Slideshare iframe'), + id = x.getAttribute("data-id"), width = x.getAttribute("width"), height = x.getAttribute("height"), url = '//www.slideshare.net/slideshow/embed_code/' + id; - return ''; + return ''; }); }, "fallback": function () { @@ -2312,7 +2327,8 @@ tarteaucitron.services.soundcloud = { js: function () { "use strict"; tarteaucitron.fallback(['soundcloud_player'], function (x) { - var player_height = x.getAttribute('data-height'), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Soundcloud iframe'), + player_height = x.getAttribute('data-height'), frame_height = 'height="' + player_height + '" ', playable_id = x.getAttribute('data-playable-id'), playable_type = x.getAttribute('data-playable-type'), @@ -2344,7 +2360,7 @@ tarteaucitron.services.soundcloud = { if (visual && visual.length > 0) qs += '&visual=' + visual; if (artwork && artwork.length > 0) qs += '&show_artwork=' + artwork; - return ''; + return ''; }); }, fallback: function () { @@ -2367,7 +2383,8 @@ tarteaucitron.services.spotify = { "js": function () { "use strict"; tarteaucitron.fallback(['spotify_player'], function (x) { - var spotify_id = x.getAttribute("spotifyID"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Spotify iframe'), + spotify_id = x.getAttribute("spotifyID"), spotify_width = x.getAttribute("width"), frame_width = 'width=', spotify_height = x.getAttribute("height"), @@ -2387,7 +2404,7 @@ tarteaucitron.services.spotify = { } else { frame_height += '"" '; } - spotify_frame = ''; + spotify_frame = ''; return spotify_frame; }); }, @@ -2444,7 +2461,8 @@ tarteaucitron.services.timelinejs = { "js": function () { "use strict"; tarteaucitron.fallback(['timelinejs-canvas'], function (x) { - var spreadsheet_id = x.getAttribute("spreadsheet_id"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Twitter iframe'), + spreadsheet_id = x.getAttribute("spreadsheet_id"), width = x.getAttribute("width"), height = x.getAttribute("height"), lang = x.getAttribute("lang_2_letter"), @@ -2456,7 +2474,7 @@ tarteaucitron.services.timelinejs = { start_zoom = x.getAttribute("start_zoom"), url = '//cdn.knightlab.com/libs/timeline/latest/embed/index.html?source=' + spreadsheet_id + '&font=' + font + '&maptype=' + map + '&lang=' + lang + '&start_at_end=' + start_at_end + '&hash_bookmark=' + hash_bookmark + '&start_at_slide=' + start_at_slide + '&start_zoom_adjust=' + start_zoom + '&height=' + height; - return ''; + return ''; }); }, "fallback": function () { @@ -2677,7 +2695,8 @@ tarteaucitron.services.vimeo = { "js": function () { "use strict"; tarteaucitron.fallback(['vimeo_player'], function (x) { - var video_width = x.getAttribute("data-width") || x.getAttribute("width"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("data-title") || x.getAttribute("title") || 'Vimeo iframe'), + video_width = x.getAttribute("data-width") || x.getAttribute("width"), frame_width = 'width=', video_height = x.getAttribute("data-height") || x.getAttribute("height"), frame_height = 'height=', @@ -2824,7 +2843,7 @@ tarteaucitron.services.vimeo = { video_qs = ""; } - video_frame = ''; + video_frame = ''; return video_frame; }); @@ -3039,7 +3058,7 @@ tarteaucitron.services.atinternetoptin = { "js": function () { "use strict"; tarteaucitron.launch['atinternetoptout'] = false; - + setTimeout(function() { tarteaucitron.userInterface.respond(document.getElementById('atinternetAllowed'), true); tarteaucitron.userInterface.respond(document.getElementById('atinternetoptoutDenied'), false); @@ -3126,7 +3145,8 @@ tarteaucitron.services.youtube = { "js": function () { "use strict"; tarteaucitron.fallback(['youtube_player'], function (x) { - var video_id = x.getAttribute("videoID"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Youtube iframe'), + video_id = x.getAttribute("videoID"), video_width = x.getAttribute("width"), frame_width = 'width=', video_height = x.getAttribute("height"), @@ -3147,7 +3167,7 @@ tarteaucitron.services.youtube = { } else { frame_height += '"" '; } - video_frame = ''; + video_frame = ''; return video_frame; }); }, @@ -3173,7 +3193,8 @@ tarteaucitron.services.youtubeplaylist = { "js": function () { "use strict"; tarteaucitron.fallback(['youtube_playlist_player'], function (x) { - var playlist_id = x.getAttribute("playlistID"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Youtube iframe'), + playlist_id = x.getAttribute("playlistID"), video_width = x.getAttribute("width"), frame_width = 'width=', video_height = x.getAttribute("height"), @@ -3194,7 +3215,7 @@ tarteaucitron.services.youtubeplaylist = { } else { frame_height += '"" '; } - video_frame = ''; + video_frame = ''; return video_frame; }); }, @@ -3256,7 +3277,7 @@ tarteaucitron.services.linkedininsighttag = { window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || []; window._linkedin_data_partner_ids.push(tarteaucitron.user.linkedininsighttag); } - + tarteaucitron.addScript('https://snap.licdn.com/li.lms-analytics/insight.min.js'); } }; @@ -3323,7 +3344,8 @@ tarteaucitron.services.issuu = { "js": function () { "use strict"; tarteaucitron.fallback(['issuu_player'], function (x) { - var issuu_id = x.getAttribute("issuuID"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Issuu iframe'), + issuu_id = x.getAttribute("issuuID"), issuu_width = x.getAttribute("width"), frame_width = 'width=', issuu_height = x.getAttribute("height"), @@ -3349,7 +3371,7 @@ tarteaucitron.services.issuu = { if (issuu_id.match(/\d+\/\d+/)) { issuu_embed = '#' + issuu_id; } else if (issuu_id.match(/d=(.*)&u=(.*)/)) { issuu_embed = '?' + issuu_id; } - issuu_frame = ''; + issuu_frame = ''; return issuu_frame; }); @@ -3529,8 +3551,8 @@ tarteaucitron.services.matomo = { }, 100) } }; - - + + tarteaucitron.services.matomohightrack = { "key": "matomohightrack", "type": "analytic", @@ -3649,7 +3671,8 @@ tarteaucitron.services.matterport = { "js": function () { "use strict"; tarteaucitron.fallback(['matterport'], function (x) { - var matterport_id = x.getAttribute("matterportID"), + var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Matterport iframe'), + matterport_id = x.getAttribute("matterportID"), matterport_width = x.getAttribute("width"), frame_width = 'width=', matterport_height = x.getAttribute("height"), @@ -3674,7 +3697,7 @@ tarteaucitron.services.matterport = { return ""; } - matterport_frame = ''; + matterport_frame = ''; return matterport_frame; }); }, @@ -3851,7 +3874,7 @@ tarteaucitron.services.userlike = { tarteaucitron.addScript('//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/' + tarteaucitron.user.userlikeKey); } }; - + // adobeanalytics tarteaucitron.services.adobeanalytics = { "key": "adobeanalytics",