From 932c87e16e3f7243bbc7733444116f5f0af66844 Mon Sep 17 00:00:00 2001 From: Nicolas Rosset Date: Wed, 3 Mar 2021 19:36:33 +0100 Subject: [PATCH] Adjust soundcloud embed for non mandatory settings + add artwork setting --- tarteaucitron.services.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 5c6b850..e0db714 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -1969,7 +1969,8 @@ tarteaucitron.services.soundcloud = { showUser = x.getAttribute('data-show-user'), showReposts = x.getAttribute('data-show-reposts'), showTeaser = x.getAttribute('data-show-teaser'), - visual = x.getAttribute('data-visual'); + visual = x.getAttribute('data-visual'), + artwork = x.getAttribute('data-artwork'); var allowAutoplay = autoplay === 'true' ? 'allow="autoplay"' : ''; @@ -1978,15 +1979,16 @@ tarteaucitron.services.soundcloud = { } var qs = '?url=https%3A//api.soundcloud.com/' + playable_type + '/' + playable_id; - if (hideRelated.length > 0) qs += '&hide_related=' + hideRelated; - if (color.length > 0) qs += '&color=' + color.replace('#', '%23'); - if (autoplay.length > 0) qs += '&auto_play=' + autoplay; - if (showComments.length > 0) qs += '&show_comments=' + showComments; - if (hideRelated.length > 0) qs += '&hide_related=' + hideRelated; - if (showUser.length > 0) qs += '&show_user=' + showUser; - if (showReposts.length > 0) qs += '&show_reposts=' + showReposts; - if (showTeaser.length > 0) qs += '&show_teaser=' + showTeaser; - if (visual.length > 0) qs += '&visual=' + visual; + if (hideRelated && hideRelated.length > 0) qs += '&hide_related=' + hideRelated; + if (color && color.length > 0) qs += '&color=' + color.replace('#', '%23'); + if (autoplay && autoplay.length > 0) qs += '&auto_play=' + autoplay; + if (showComments && showComments.length > 0) qs += '&show_comments=' + showComments; + if (hideRelated && hideRelated.length > 0) qs += '&hide_related=' + hideRelated; + if (showUser && showUser.length > 0) qs += '&show_user=' + showUser; + if (showReposts && showReposts.length > 0) qs += '&show_reposts=' + showReposts; + if (showTeaser && showTeaser.length > 0) qs += '&show_teaser=' + showTeaser; + if (visual && visual.length > 0) qs += '&visual=' + visual; + if (artwork && artwork.length > 0) qs += '&show_artwork=' + artwork; return ''; });