Skip to content

Commit

Permalink
Merge branch 'release/4.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Jun 7, 2021
2 parents bbcc301 + 7ac7f84 commit 1e7e2cf
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 17 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# v4.1.0
## 06/07/2021

1. [](#improved)
* Mentioned `shortcode-core` as required for shortcode syntax
* Added new `class` option for shortcode
* Added a new `.grav-youtube-wrapper` element for simpler targeting
1. [](#bugfix)
* Fixed padding to remove black bars at top and bottom [#34](https://github.com/getgrav/grav-plugin-youtube/pull/34)


# v4.0.0
## 12/14/2020

1. [](#new)
* NextGen Editor shortcode support
1. [](#improved)
* Loop parameter fix for a single video [#36](https://github.com/getgrav/grav-plugin-youtube/pull/36)

# v3.1.0
## 05/20/2020

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ CSS is also loaded to provide the appropriate responsive layout.

# Shortcode Syntax

As of version `3.0` you can now use an alternative _shortcode_ syntax that supports passing in the player parameter values inline
As of version `3.0` you can now use an alternative _shortcode_ syntax that supports passing in the player parameter values inline.

**NOTE: `shortcode-core` plugin is required and must be installed and enabled for Shortcode Syntax to work.**

```
[youtube color=white autoplay=1]https://www.youtube.com/watch?v=BK8guP9ov2U[/youtube]
Expand Down
4 changes: 3 additions & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: YouTube
version: 3.1.0
slug: youtube
type: plugin
version: 4.1.0
description: "**YouTube** is a simple plugin that converts markdown links or shortcodes into responsive embeds."
icon: youtube
author:
Expand Down
3 changes: 1 addition & 2 deletions css/youtube.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.grav-youtube {
height: 0;
padding-top: 25px;
padding-bottom: 56.34%;
padding-bottom: 56.25%;
margin-bottom: 10px;
position: relative;
overflow: hidden;
Expand Down
6 changes: 6 additions & 0 deletions nextgen-editor/shortcodes/youtube/youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ window.nextgenEditor.addShortcode('youtube', {
widget: 'input-text',
default: '',
},
class: {
type: String,
title: 'Class',
widget: 'input-text',
default: '',
},
autoplay: {
type: Number,
title: 'Autoplay',
Expand Down
1 change: 1 addition & 0 deletions shortcodes/YoutubeShortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function init()
'player_parameters' => $params,
'privacy_enhanced_mode' => $privacy_mode,
'video_id' => $matches[1],
'class' => $sc->getParameter('class'),
);

// check if size was given
Expand Down
28 changes: 15 additions & 13 deletions templates/partials/youtube.html.twig
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<div class="grav-youtube-wrapper {{ class }}">
{% if lazy_load == true %}
<div class="grav-youtube grav-youtube--lazyloaded" style="background-image: url('{{- youtube_thumbnail_url(video_id) -}}')">
<iframe data-src="{{- youtube_embed_url(video_id, player_parameters, privacy_enhanced_mode) -}}" frameborder="0" allow="autoplay" allowfullscreen></iframe>
<button>
<svg viewBox="0 0 68 48">
<path d="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.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#212121" fill-opacity="0.8"></path>
<path d="M 45,24 27,14 27,34" fill="#fff"></path>
</svg>
</button>
</div>
<div class="grav-youtube grav-youtube--lazyloaded" style="background-image: url('{{- youtube_thumbnail_url(video_id) -}}')">
<iframe data-src="{{- youtube_embed_url(video_id, player_parameters, privacy_enhanced_mode) -}}" frameborder="0" allow="autoplay" allowfullscreen></iframe>
<button>
<svg viewBox="0 0 68 48">
<path d="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.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#212121" fill-opacity="0.8"></path>
<path d="M 45,24 27,14 27,34" fill="#fff"></path>
</svg>
</button>
</div>
{% else %}
<div class="grav-youtube">
<iframe src="{{- youtube_embed_url(video_id, player_parameters, privacy_enhanced_mode) -}}" frameborder="0" allowfullscreen></iframe>
</div>
{% endif %}
<div class="grav-youtube">
<iframe src="{{- youtube_embed_url(video_id, player_parameters, privacy_enhanced_mode) -}}" frameborder="0" allowfullscreen></iframe>
</div>
{% endif %}
</div>

0 comments on commit 1e7e2cf

Please sign in to comment.