Remove youtube_simple for now

We need to revisit and complete that.

See #4751
This commit is contained in:
Bjørn Erik Pedersen 2018-05-25 11:16:23 +02:00
parent 1f1d955b56
commit 448081b840
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
5 changed files with 3 additions and 44 deletions

View file

@ -89,11 +89,6 @@ type YouTube struct {
// YouTube wont store information about visitors on your website // YouTube wont store information about visitors on your website
// unless the user plays the embedded video. // unless the user plays the embedded video.
PrivacyEnhanced bool PrivacyEnhanced bool
// If simple mode is enabled, only a thumbnail is fetched from ytimg.com and
// shown with a play button overlaid. If a user clicks the button, he/she will
// be taken to the video page on youtube.com in a new browser tab.
Simple bool
} }
func DecodeConfig(cfg config.Provider) (pc Config, err error) { func DecodeConfig(cfg config.Provider) (pc Config, err error) {

View file

@ -70,7 +70,6 @@ simple = true
assert.True(pc.YouTube.PrivacyEnhanced) assert.True(pc.YouTube.PrivacyEnhanced)
assert.True(pc.YouTube.Disable) assert.True(pc.YouTube.Disable)
assert.True(pc.YouTube.Simple)
} }
func TestDecodeConfigFromTOMLCaseInsensitive(t *testing.T) { func TestDecodeConfigFromTOMLCaseInsensitive(t *testing.T) {

View file

@ -384,30 +384,13 @@ M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.5
{`shortcodes/youtube.html`, `{{- $pc := .Page.Site.Config.Privacy.YouTube -}} {`shortcodes/youtube.html`, `{{- $pc := .Page.Site.Config.Privacy.YouTube -}}
{{- if not $pc.Disable -}} {{- if not $pc.Disable -}}
{{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}} {{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}}
{{- if $pc.Simple -}}
{{ template "_internal/shortcodes/youtube_simple.html" . }}
{{- else -}}
{{- $id := .Get "id" | default (.Get 0) -}} {{- $id := .Get "id" | default (.Get 0) -}}
{{- $class := .Get "class" | default (.Get 1) }} {{- $class := .Get "class" | default (.Get 1) }}
<div {{ with $class }}class="{{ . }}"{{ else }}style="position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;"{{ end }}> <div {{ with $class }}class="{{ . }}"{{ else }}style="position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;"{{ end }}>
<iframe src="//{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" {{ if not $class }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" {{ end }}allowfullscreen frameborder="0" title="YouTube Video"></iframe> <iframe src="//{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" {{ if not $class }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" {{ end }}allowfullscreen frameborder="0" title="YouTube Video"></iframe>
</div> </div>
{{ end }} {{ end -}}
{{- end -}}`}, `},
{`shortcodes/youtube_simple.html`, `{{ $id := .Get "id" | default (.Get 0) }}
{{ $class := .Get "class" | default (.Get 1) }}
{{ $hasClass := $class }}
{{ $class := $class | default "__h_youtube" }}
{{ if not $hasClass }}
{{/* If class is set, assume the user wants to provide his own styles. */}}
{{ template "__h_simple_css" $ }}
{{ end }}
{{ $secondClass := "s_youtube_simple" }}
<div class="{{ $secondClass }} {{ $class }}">
{{ $tb := printf "//i.ytimg.com/vi/%s/" $id }}
<a href="//youtube.com/watch?v={{ $id | safeHTMLAttr }}" target="_blank">
<img src="{{ printf "%smaxresdefault.jpg" $tb }}" srcset="{{ printf "%shqdefault.jpg" $tb }} 1x {{ printf "%smaxresdefault.jpg" $tb }} 2x" alt="Video">
<div class="play"><svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path class="ytp-large-play-button-bg" d="{{ template "__h_simple_icon_play" $ }}" fill="#212121" fill-opacity="0.8"></path><path d="M 45,24 27,14 27,34" fill="#fff"></path></svg></div></a></div>`},
{`twitter_cards.html`, `{{- with $.Params.images -}} {`twitter_cards.html`, `{{- with $.Params.images -}}
<meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/> <meta name="twitter:image" content="{{ index . 0 | absURL }}"/>

View file

@ -1,13 +1,9 @@
{{- $pc := .Page.Site.Config.Privacy.YouTube -}} {{- $pc := .Page.Site.Config.Privacy.YouTube -}}
{{- if not $pc.Disable -}} {{- if not $pc.Disable -}}
{{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}} {{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}}
{{- if $pc.Simple -}}
{{ template "_internal/shortcodes/youtube_simple.html" . }}
{{- else -}}
{{- $id := .Get "id" | default (.Get 0) -}} {{- $id := .Get "id" | default (.Get 0) -}}
{{- $class := .Get "class" | default (.Get 1) }} {{- $class := .Get "class" | default (.Get 1) }}
<div {{ with $class }}class="{{ . }}"{{ else }}style="position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;"{{ end }}> <div {{ with $class }}class="{{ . }}"{{ else }}style="position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;"{{ end }}>
<iframe src="//{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" {{ if not $class }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" {{ end }}allowfullscreen frameborder="0" title="YouTube Video"></iframe> <iframe src="//{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" {{ if not $class }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" {{ end }}allowfullscreen frameborder="0" title="YouTube Video"></iframe>
</div> </div>
{{ end }} {{ end -}}
{{- end -}}

View file

@ -1,14 +0,0 @@
{{ $id := .Get "id" | default (.Get 0) }}
{{ $class := .Get "class" | default (.Get 1) }}
{{ $hasClass := $class }}
{{ $class := $class | default "__h_youtube" }}
{{ if not $hasClass }}
{{/* If class is set, assume the user wants to provide his own styles. */}}
{{ template "__h_simple_css" $ }}
{{ end }}
{{ $secondClass := "s_youtube_simple" }}
<div class="{{ $secondClass }} {{ $class }}">
{{ $tb := printf "//i.ytimg.com/vi/%s/" $id }}
<a href="//youtube.com/watch?v={{ $id | safeHTMLAttr }}" target="_blank">
<img src="{{ printf "%smaxresdefault.jpg" $tb }}" srcset="{{ printf "%shqdefault.jpg" $tb }} 1x {{ printf "%smaxresdefault.jpg" $tb }} 2x" alt="Video">
<div class="play"><svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path class="ytp-large-play-button-bg" d="{{ template "__h_simple_icon_play" $ }}" fill="#212121" fill-opacity="0.8"></path><path d="M 45,24 27,14 27,34" fill="#fff"></path></svg></div></a></div>