From d43791bfdd19f050acafa29bdddbd49aabc49009 Mon Sep 17 00:00:00 2001 From: David Kebler Date: Wed, 19 Apr 2017 15:43:53 -0700 Subject: [PATCH] fix youtube master parameters maxwitdh, wpad and nothumb and theirr shortcode overrides --- layouts/shortcodes/youtube.html | 13 +++++++++---- static/js/youtube.js | 9 +++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/layouts/shortcodes/youtube.html b/layouts/shortcodes/youtube.html index 915ef98..733fbcd 100644 --- a/layouts/shortcodes/youtube.html +++ b/layouts/shortcodes/youtube.html @@ -1,7 +1,10 @@ +{{ $.Scratch.Set "maxwidth" ( $.Page.Site.Params.youtube.maxwidth ) }} +{{ $.Scratch.Set "wpad" ( $.Page.Site.Params.youtube.wpad ) }} +{{ $.Scratch.Set "nothumb" ( $.Page.Site.Params.youtube.disable_thumb ) }} {{ if .IsNamedParams }} -{{ $.Scratch.Set "maxwidth" ( $.Page.Site.Params.youtube.maxwidth | .Get "maxwidth" ) }} -{{ $.Scratch.Set "wpad" ( $.Page.Site.Params.youtube.wpad | .Get "wpad" ) }} -{{ $.Scratch.Set "nothumb" ( $.Page.Site.Params.youtube.disable_thumb | .Get "nothumb" ) }} +{{ with .Get "maxwidth" }}{{ $.Scratch.Set "maxwidth" . }}{{ end }} +{{ with .Get "wpad" }}{{ $.Scratch.Set "wpad" . }}{{ end }} +{{ with .Get "nothumb" }}{{ $.Scratch.Set "nothumb" . }}{{ end }}
{{ with .Get "title" }}
{{ . }}
@@ -25,7 +28,9 @@
diff --git a/static/js/youtube.js b/static/js/youtube.js index 794a84a..f298f61 100644 --- a/static/js/youtube.js +++ b/static/js/youtube.js @@ -38,3 +38,12 @@ } }(jQuery)); + +// TODO grab the video title as well as the thumb for use in thumb display +// only works if server allows cross domain like s3 +//http://stackoverflow.com/questions/1760231/how-do-i-get-the-title-of-a-youtube-video-if-i-have-the-video-id +// #var ytApiKey = "..."; +// #var videoId = "ylLzyHk54Z0"; +// #$.get("https://www.googleapis.com/youtube/v3/videos?part=snippet&id=" + videoId + "&key=" + ytApiKey, function(data) { +// #alert(data.items[0].snippet.title); +// # });