fix youtube master parameters maxwitdh, wpad and nothumb and theirr shortcode overrides

master
David Kebler 2017-04-19 15:43:53 -07:00
parent fa8f5c6fc2
commit d43791bfdd
2 changed files with 18 additions and 4 deletions

View File

@ -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 }}
<div class="box box--embed box--column box--youtube">
{{ with .Get "title" }}
<div class="box__title">{{ . }}</div>
@ -25,7 +28,9 @@
<div class="box box--embed box--youtube"
youtube_id="{{ .Get 0 }}"
{{ if eq $numOfParams 2 }} start="{{ .Get 1 }}"{{ end }}
{{ with $.Page.Site.Params.youtube.disable_thumb }} nothumb="yes" {{ end }}
{{ with $.Scratch.Get "maxwidth"}} maxWidth="{{ . }}"{{ end }}
{{ with $.Scratch.Get "wpad"}} wPad="{{ . }}"{{ end }}
{{ with $.Scratch.Get "nothumb"}} nothumb="yes" {{ end }}
>
<!-- image or iframe injected here -->
</div>

View File

@ -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);
// # });