shithub: hugo

Download patch

ref: 448081b840db4a23c0c49c2d869ac207dcb6ac40
parent: 1f1d955b56471e41d5288c57f1ef8333dc297120
author: Bjørn Erik Pedersen <[email protected]>
date: Fri May 25 07:16:23 EDT 2018

Remove youtube_simple for now

We need to revisit and complete that.

See #4751

--- a/config/privacy/privacyConfig.go
+++ b/config/privacy/privacyConfig.go
@@ -89,11 +89,6 @@
 	// YouTube won’t store information about visitors on your website
 	// unless the user plays the embedded video.
 	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) {
--- a/config/privacy/privacyConfig_test.go
+++ b/config/privacy/privacyConfig_test.go
@@ -70,7 +70,6 @@
 
 	assert.True(pc.YouTube.PrivacyEnhanced)
 	assert.True(pc.YouTube.Disable)
-	assert.True(pc.YouTube.Simple)
 }
 
 func TestDecodeConfigFromTOMLCaseInsensitive(t *testing.T) {
--- a/tpl/tplimpl/embedded/templates.autogen.go
+++ b/tpl/tplimpl/embedded/templates.autogen.go
@@ -384,30 +384,13 @@
 	{`shortcodes/youtube.html`, `{{- $pc := .Page.Site.Config.Privacy.YouTube -}}
 {{- if not $pc.Disable -}}
 {{- $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) -}}
 {{- $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 }}>
   <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>
-{{ 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>`},
+{{ end -}}
+`},
 	{`twitter_cards.html`, `{{- with $.Params.images -}}
 <meta name="twitter:card" content="summary_large_image"/>
 <meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
--- a/tpl/tplimpl/embedded/templates/shortcodes/youtube.html
+++ b/tpl/tplimpl/embedded/templates/shortcodes/youtube.html
@@ -1,13 +1,9 @@
 {{- $pc := .Page.Site.Config.Privacy.YouTube -}}
 {{- if not $pc.Disable -}}
 {{- $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) -}}
 {{- $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 }}>
   <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>
-{{ end }}
-{{- end -}}
\ No newline at end of file
+{{ end -}}
--- a/tpl/tplimpl/embedded/templates/shortcodes/youtube_simple.html
+++ /dev/null
@@ -1,14 +1,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>
\ No newline at end of file