From e57c017b89cf45658c3f110352d11c30e757581c Mon Sep 17 00:00:00 2001 From: Alan Mac Kenna Date: Fri, 9 Nov 2018 17:48:08 +0000 Subject: [PATCH] added support for vimeo configurable attributes: title, byline, portrait, loop, autoplay --- tarteaucitron.services.js | 52 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 502abd4..3926f0a 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -1913,8 +1913,15 @@ tarteaucitron.services.vimeo = { frame_width = 'width=', video_height = x.getAttribute("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; + var video_qs = ''; + if (video_id === undefined) { return ""; } @@ -1924,11 +1931,52 @@ tarteaucitron.services.vimeo = { frame_width += '"" '; } if (video_height !== undefined) { - frame_height += '"' + video_height + '" '; + frame_height += '"' + video_height + '" '; } else { frame_height += '"" '; } - video_frame = ''; + + 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 = ''; + return video_frame; }); },