Adjust soundcloud embed for non mandatory settings + add artwork setting

This commit is contained in:
Nicolas Rosset 2021-03-03 19:36:33 +01:00
parent 6f4c8d30c1
commit 932c87e16e
1 changed files with 12 additions and 10 deletions

View File

@ -1969,7 +1969,8 @@ tarteaucitron.services.soundcloud = {
showUser = x.getAttribute('data-show-user'), showUser = x.getAttribute('data-show-user'),
showReposts = x.getAttribute('data-show-reposts'), showReposts = x.getAttribute('data-show-reposts'),
showTeaser = x.getAttribute('data-show-teaser'), 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"' : ''; 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; var qs = '?url=https%3A//api.soundcloud.com/' + playable_type + '/' + playable_id;
if (hideRelated.length > 0) qs += '&hide_related=' + hideRelated; if (hideRelated && hideRelated.length > 0) qs += '&hide_related=' + hideRelated;
if (color.length > 0) qs += '&color=' + color.replace('#', '%23'); if (color && color.length > 0) qs += '&color=' + color.replace('#', '%23');
if (autoplay.length > 0) qs += '&auto_play=' + autoplay; if (autoplay && autoplay.length > 0) qs += '&auto_play=' + autoplay;
if (showComments.length > 0) qs += '&show_comments=' + showComments; if (showComments && showComments.length > 0) qs += '&show_comments=' + showComments;
if (hideRelated.length > 0) qs += '&hide_related=' + hideRelated; if (hideRelated && hideRelated.length > 0) qs += '&hide_related=' + hideRelated;
if (showUser.length > 0) qs += '&show_user=' + showUser; if (showUser && showUser.length > 0) qs += '&show_user=' + showUser;
if (showReposts.length > 0) qs += '&show_reposts=' + showReposts; if (showReposts && showReposts.length > 0) qs += '&show_reposts=' + showReposts;
if (showTeaser.length > 0) qs += '&show_teaser=' + showTeaser; if (showTeaser && showTeaser.length > 0) qs += '&show_teaser=' + showTeaser;
if (visual.length > 0) qs += '&visual=' + visual; if (visual && visual.length > 0) qs += '&visual=' + visual;
if (artwork && artwork.length > 0) qs += '&show_artwork=' + artwork;
return '<iframe width="100%" ' + frame_height + ' scrolling="no" frameborder="no" ' + allowAutoplay + ' src="https://w.soundcloud.com/player/' + qs + '"></iframe>'; return '<iframe width="100%" ' + frame_height + ' scrolling="no" frameborder="no" ' + allowAutoplay + ' src="https://w.soundcloud.com/player/' + qs + '"></iframe>';
}); });