added support for vimeo configurable attributes: title, byline, portrait, loop, autoplay

This commit is contained in:
Alan Mac Kenna 2018-11-09 17:48:08 +00:00
parent 118cee2534
commit e57c017b89
1 changed files with 50 additions and 2 deletions

View File

@ -1913,8 +1913,15 @@ tarteaucitron.services.vimeo = {
frame_width = 'width=', frame_width = 'width=',
video_height = x.getAttribute("height"), video_height = x.getAttribute("height"),
frame_height = 'height=', frame_height = 'height=',
video_title = x.getAttribute("title") || '',
video_byline = x.getAttribute("byline") || '',
video_portrait = x.getAttribute("portrait") || '',
video_loop = x.getAttribute("loop") || '',
video_autoplay = x.getAttribute("autoplay") || '',
video_frame; video_frame;
var video_qs = '';
if (video_id === undefined) { if (video_id === undefined) {
return ""; return "";
} }
@ -1928,7 +1935,48 @@ tarteaucitron.services.vimeo = {
} else { } else {
frame_height += '"" '; frame_height += '"" ';
} }
video_frame = '<iframe src="//player.vimeo.com/video/' + video_id + '" ' + frame_width + frame_height + ' frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
if (video_title.length > 0 || video_byline.length > 0 || video_portrait.length > 0) {
video_qs = "?";
if (video_title.length > 0) {
video_qs += "title=" + video_title;
}
if (video_byline.length > 0) {
if (video_qs.length > 1) {
video_qs += "&";
}
video_qs += "byline=" + video_byline;
}
if (video_portrait.length > 0) {
if (video_qs.length > 1) {
video_qs += "&";
}
video_qs += "portrait=" + video_portrait;
}
if (video_loop.length > 0) {
if (video_qs.length > 1) {
video_qs += "&";
}
video_qs += "loop=" + video_loop;
}
if (video_autoplay.length > 0) {
if (video_qs.length > 1) {
video_qs += "&";
}
video_qs += "autoplay=" + video_autoplay;
}
}
video_frame = '<iframe src="//player.vimeo.com/video/' + video_id + video_qs + '" ' + frame_width + frame_height + ' frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
return video_frame; return video_frame;
}); });
}, },