pageflow-embedded-video 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67184b3cc1cfd459b6d6db35a0bb6ed2b566db5b885d85e776146387f897a83b
4
- data.tar.gz: 8a8fd6aedb40f7ddfe37e1d7b6242368ac425c969b967d9faea829ffd9d7b6fa
3
+ metadata.gz: 4953d1e48d49ae77ee788c40eafa938d6cbdf6120dbe0d8958bc43cc2d661485
4
+ data.tar.gz: cada1c6fdc972ed53bc66b8419918dc9c7491a79bae641b19fc48bb00df2f806
5
5
  SHA512:
6
- metadata.gz: 45b2f659be5ad09e7934b5ee69f338d80e4b59e7e43433f084698611a8f14507eb941b9034c7e83910dea7a44631215ff118dc4d5507ff587ca0694ebc7ad74f
7
- data.tar.gz: 4bc0cb16cccf6a2556f4157a73ce8a56b051e1f290788f044eb6da3a1c65c3976da7bfd0f796fafd3276cd2a44ba3a253b36bb31fd7c66583e00f35019c31cc7
6
+ metadata.gz: dd4e3644d0a87253544a5f0ad4a7e57a39adc130165aa5c431513b2cbb321baa368fc171b3857f98dbba79911ca2bf39e34f2c040727980f9212afdca10927c4
7
+ data.tar.gz: 592cfb3a4363ea49b54b16ba6b48788762f55e97ce46d45727d88e03a87f54bc40cd4b913524e7aef9bb89f96772b51a6acbce8dd084d5ba242c86cce3bc5282
data/CHANGELOG.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # CHANGELOG
2
2
 
3
- ### Version 1.7.0
3
+ ### Version 1.8.0
4
4
 
5
- 2019-11-04
5
+ 2022-07-18
6
6
 
7
- [Compare changes](https://github.com/codevise/pageflow-embedded-video/compare/1-6-stable...v1.7.0)
7
+ [Compare changes](https://github.com/codevise/pageflow-embedded-video/compare/1-7-stable...v1.8.0)
8
8
 
9
- - Extend pageflow version requirement to < 16
10
- ([#36](https://github.com/codevise/pageflow-embedded-video/pull/36))
9
+ - Embed opt-in
10
+ ([#37](https://github.com/codevise/pageflow-embedded-video/pull/37))
11
11
 
12
12
  See
13
- [1-6-stable branch](https://github.com/codevise/pageflow-embedded-video/blob/1-6-stable/CHANGELOG.md)
13
+ [1-7-stable branch](https://github.com/codevise/pageflow-embedded-video/blob/1-7-stable/CHANGELOG.md)
14
14
  for previous changes.
data/README.md CHANGED
@@ -14,11 +14,11 @@ Add this line to your application's Gemfile:
14
14
 
15
15
  Run `bundle install`
16
16
 
17
- Register the page type:
17
+ Register the plugin:
18
18
 
19
19
  # config/initializers/pageflow.rb
20
20
  Pageflow.configure do |config|
21
- config.page_types.register(Pageflow::EmbeddedVideo.page_type)
21
+ config.plugin(Pageflow::EmbeddedVideo.plugin)
22
22
  end
23
23
 
24
24
  Include javascript/stylesheets:
@@ -0,0 +1,41 @@
1
+ pageflow.embeddedVideo.consent = new (pageflow.Object.extend({
2
+ accepted: {},
3
+ promises: {},
4
+ registered: {},
5
+
6
+ ensureVendorRegistered: function(options) {
7
+ var name = options.name;
8
+
9
+ if (!name || this.registered[name]) {
10
+ return;
11
+ }
12
+
13
+ this.registered[name] = true;
14
+
15
+ pageflow.consent.registerVendor(name, {
16
+ paradigm: options.skip ? 'skip' : 'lazy opt-in',
17
+ displayName: I18n.t(
18
+ 'pageflow.public.embedded_video.consent.' + name + '.vendor_name'
19
+ ),
20
+ description: I18n.t(
21
+ 'pageflow.public.embedded_video.consent.' + name + '.vendor_description'
22
+ )
23
+ });
24
+ },
25
+
26
+ setup: function(name) {
27
+ if (!name) {
28
+ return;
29
+ }
30
+
31
+ var that = this;
32
+
33
+ this.promises[name] = this.promises[name] ||
34
+ pageflow.consent.requireAccepted(name).then(function(result) {
35
+ if (result == 'fulfilled') {
36
+ that.accepted[name] = true;
37
+ that.trigger('accepted:' + name);
38
+ }
39
+ });
40
+ }
41
+ }));
@@ -1,15 +1,40 @@
1
1
  /*global YT, URI, $f */
2
2
 
3
+ pageflow.pageType.registerInitializer('embedded_video', function(configuration) {
4
+ var url = configuration.display_embedded_video_url;
5
+
6
+ pageflow.embeddedVideo.consent.ensureVendorRegistered({
7
+ name: pageflow.embeddedVideo.providerFromUrl(url),
8
+ skip: !pageflow.features.isEnabled('embedded_video_opt_in')
9
+ });
10
+ });
11
+
3
12
  pageflow.react.registerPageTypeWithDefaultBackground('embedded_video', _.extend({
4
13
  prepareNextPageTimeout: 0,
5
14
 
6
15
  enhance: function(pageElement, configuration) {
16
+ var url = configuration.display_embedded_video_url;
17
+
18
+ pageflow.embeddedVideo.consent.setup(
19
+ pageflow.embeddedVideo.providerFromUrl(url)
20
+ );
21
+
22
+ pageElement.thirdPartyEmbedConsent();
23
+
24
+ if (!pageflow.features.isEnabled('embedded_video_opt_in')) {
25
+ pageElement.find('.opt_out_wrapper').hide();
26
+ }
27
+
7
28
  var that = this;
8
29
 
9
30
  pageElement.addClass('no_hidden_text_indicator');
10
31
 
11
32
  if (pageflow.features.has('mobile platform')) {
12
33
  pageElement.find('.close_button, .iframe_container').click(function(event) {
34
+ if ($(event.target).parents('.third_party_embed_opt_in').length) {
35
+ return;
36
+ }
37
+
13
38
  event.stopPropagation();
14
39
  that._pauseVideo();
15
40
  pageElement.find('.iframe_container, .close_button').removeClass('show');
@@ -101,22 +126,11 @@ pageflow.react.registerPageTypeWithDefaultBackground('embedded_video', _.extend(
101
126
  var that = this,
102
127
  iframeWrapper = pageElement.find('.iframe_wrapper'),
103
128
  captionElement = pageElement.find('.video_caption'),
129
+ captionTextElement = pageElement.find('.video_caption_text'),
104
130
  caption = configuration.get('video_caption');
105
131
 
106
- if ((caption || '').trim() !== '') {
107
- if (!captionElement.length) {
108
- captionElement = $('<div class="video_caption"></div>');
109
-
110
- if (pageElement.find('.scroller iframe').length) {
111
- captionElement.insertAfter(iframeWrapper);
112
- } else {
113
- captionElement.appendTo(iframeWrapper);
114
- }
115
- }
116
- captionElement.text(caption || '');
117
- } else {
118
- captionElement.remove();
119
- }
132
+ captionElement.toggleClass('video_caption_blank', (caption || '').trim() === '');
133
+ captionTextElement.text(caption || '');
120
134
 
121
135
  if (this.active) {
122
136
  if (configuration.hasChanged('display_embedded_video_url') ||
@@ -140,6 +154,17 @@ pageflow.react.registerPageTypeWithDefaultBackground('embedded_video', _.extend(
140
154
  url = configuration.display_embedded_video_url,
141
155
  provider = pageflow.embeddedVideo.providerFromUrl(url);
142
156
 
157
+ pageflow.embeddedVideo.consent.setup(
158
+ pageflow.embeddedVideo.providerFromUrl(url)
159
+ );
160
+
161
+ if (!pageflow.embeddedVideo.consent.accepted[provider]) {
162
+ pageflow.embeddedVideo.consent.once('accepted:' + provider, function() {
163
+ this._createPlayer(pageElement, configuration);
164
+ }, this);
165
+ return;
166
+ }
167
+
143
168
  if (provider === 'youtube') {
144
169
  this.ytApiInitialize().done(function () {
145
170
  that._createYouTubePlayer(pageElement, url, configuration);
@@ -255,6 +280,8 @@ pageflow.react.registerPageTypeWithDefaultBackground('embedded_video', _.extend(
255
280
  },
256
281
 
257
282
  _removePlayer: function (pageElement, callback) {
283
+ pageflow.embeddedVideo.consent.off(null, null, this);
284
+
258
285
  if (this.player && typeof this.player.destroy === 'function') {
259
286
  this.player.destroy();
260
287
  }
@@ -1,4 +1,5 @@
1
1
  //= require_self
2
+ //= require ./embedded_video/consent
2
3
  //= require ./embedded_video/page_type
3
4
  //= require ./URI.js
4
5
  //= require ./froogaloop.js
@@ -76,6 +76,7 @@
76
76
  height: initial;
77
77
  padding-top: 56.25%;
78
78
  position: relative;
79
+ color: #fff;
79
80
 
80
81
  iframe {
81
82
  position: absolute;
@@ -214,6 +215,8 @@
214
215
  position: relative;
215
216
  display: block;
216
217
  margin-bottom: 40px;
218
+ padding-right: 40px;
219
+ box-sizing: border-box;
217
220
 
218
221
  &:before {
219
222
  content: "";
@@ -244,10 +247,22 @@
244
247
  }
245
248
  }
246
249
 
250
+ .video_caption_blank:before {
251
+ display: none;
252
+ }
253
+
247
254
  .widescreened .video_caption {
248
255
  position: absolute;
249
256
  top: 100%;
250
257
  width: 100%;
251
258
  margin-bottom: 0;
252
259
  }
260
+
261
+ .opt_out_wrapper {
262
+ position: absolute;
263
+ top: -10px;
264
+ right: -10px;
265
+ bottom: -10px;
266
+ left: -10px;
267
+ }
253
268
  }
@@ -0,0 +1,33 @@
1
+ module Pageflow
2
+ module EmbeddedVideo
3
+ # @api private
4
+ module ConsentHelper
5
+ include PageflowPaged::ThirdPartyEmbedConsentHelper
6
+
7
+ def embedded_video_opt_in(entry, configuration)
8
+ vendor_name = embedded_video_consent_vendor_name(configuration)
9
+ return unless vendor_name
10
+
11
+ vendor_display_name = I18n.t(
12
+ "pageflow.public.embedded_video.consent.#{vendor_name}.vendor_name"
13
+ )
14
+
15
+ third_party_embed_opt_in(
16
+ entry: entry,
17
+ vendor_name: vendor_name,
18
+ message: t('pageflow.public.embedded_video.opt_in_prompt',
19
+ vendor: vendor_display_name)
20
+ )
21
+ end
22
+
23
+ def embedded_video_consent_vendor_name(configuration)
24
+ if configuration['display_embedded_video_url'] =~ /youtube\.com/ ||
25
+ configuration['display_embedded_video_url'] =~ /youtu\.be/
26
+ 'youtube'
27
+ elsif configuration['display_embedded_video_url'] =~ /vimeo\.com/
28
+ 'vimeo'
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -20,10 +20,18 @@
20
20
  </div>
21
21
  </div>
22
22
  <div class="iframe_container">
23
- <div class="iframe_wrapper"></div>
24
- <% if configuration['video_caption'].present? %>
25
- <div class="video_caption"><%= configuration['video_caption'] %></div>
26
- <% end %>
23
+ <div class="iframe_wrapper">
24
+ <%= embedded_video_opt_in(entry, configuration) %>
25
+ </div>
26
+ <div class="video_caption
27
+ <%= configuration['video_caption'].blank? ? 'video_caption_blank' : ''%>">
28
+ <span class="video_caption_text">
29
+ <%= configuration['video_caption'] %>
30
+ </span>
31
+ <div class="opt_out_wrapper">
32
+ <%= third_party_embed_opt_out_info(entry) %>
33
+ </div>
34
+ </div>
27
35
  </div>
28
36
  </div>
29
37
  </div>
@@ -29,6 +29,8 @@ de:
29
29
  page_type_category_name: Media
30
30
  page_type_description: Bettet ein externes Video von YouTube oder Vimeo ein
31
31
  page_type_name: Embedded Video
32
+ embedded_video_opt_in:
33
+ feature_name: Opt-In für YouTube/Vimeo Embeds
32
34
  ui:
33
35
  configuration_editor:
34
36
  tabs:
@@ -29,6 +29,8 @@ en:
29
29
  page_type_category_name: Media
30
30
  page_type_description: Embed YouTube or Vimeo videos
31
31
  page_type_name: Embedded Video
32
+ embedded_video_opt_in:
33
+ feature_name: Opt-in for YouTube/Vimeo embeds
32
34
  ui:
33
35
  configuration_editor:
34
36
  tabs:
@@ -3,10 +3,13 @@ module Pageflow
3
3
  class PageType < Pageflow::PageType
4
4
  name 'embedded_video'
5
5
 
6
+ def view_helpers
7
+ [ConsentHelper]
8
+ end
9
+
6
10
  def json_seed_template
7
11
  'pageflow/embedded_video/page_type.json.jbuilder'
8
12
  end
9
-
10
13
  end
11
14
  end
12
15
  end
@@ -0,0 +1,10 @@
1
+ module Pageflow
2
+ module EmbeddedVideo
3
+ class Plugin < Pageflow::Plugin
4
+ def configure(config)
5
+ config.page_types.register(EmbeddedVideo.page_type)
6
+ config.features.register('embedded_video_opt_in')
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  module Pageflow
2
2
  module EmbeddedVideo
3
- VERSION = '1.7.0'.freeze
3
+ VERSION = '1.8.0'.freeze
4
4
  end
5
5
  end
@@ -10,6 +10,10 @@ module Pageflow
10
10
  block.call(config)
11
11
  end
12
12
 
13
+ def self.plugin
14
+ EmbeddedVideo::Plugin.new
15
+ end
16
+
13
17
  def self.page_type
14
18
  EmbeddedVideo::PageType.new
15
19
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  spec.required_ruby_version = '~> 2.1'
20
20
 
21
- spec.add_runtime_dependency 'pageflow', ['>= 14', '< 16']
21
+ spec.add_runtime_dependency 'pageflow', '~> 15.7.x'
22
22
  spec.add_runtime_dependency 'pageflow-public-i18n', '~> 1.0'
23
23
 
24
24
  spec.add_development_dependency 'bundler', ['>= 1.0', '< 3']
metadata CHANGED
@@ -1,35 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pageflow-embedded-video
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Codevise Solutions Ltd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-04 00:00:00.000000000 Z
11
+ date: 2022-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pageflow
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '14'
20
- - - "<"
17
+ - - "~>"
21
18
  - !ruby/object:Gem::Version
22
- version: '16'
19
+ version: 15.7.x
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '14'
30
- - - "<"
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: '16'
26
+ version: 15.7.x
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: pageflow-public-i18n
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +144,7 @@ files:
150
144
  - app/assets/images/pageflow/ov-embedded_video.png
151
145
  - app/assets/javascript/pageflow/URI.js
152
146
  - app/assets/javascript/pageflow/embedded_video.js
147
+ - app/assets/javascript/pageflow/embedded_video/consent.js
153
148
  - app/assets/javascript/pageflow/embedded_video/editor.js
154
149
  - app/assets/javascript/pageflow/embedded_video/editor/collections/embedded_videos_collection.js
155
150
  - app/assets/javascript/pageflow/embedded_video/editor/initializers/setup_collections.js
@@ -164,6 +159,7 @@ files:
164
159
  - app/assets/stylesheets/pageflow/embedded_video/custom.scss
165
160
  - app/assets/stylesheets/pageflow/embedded_video/editor.scss
166
161
  - app/assets/stylesheets/pageflow/embedded_video/themes/default.scss
162
+ - app/helpers/pageflow/embedded_video/consent_helper.rb
167
163
  - app/views/pageflow/embedded_video/page.html.erb
168
164
  - app/views/pageflow/embedded_video/page_type.json.jbuilder
169
165
  - bin/rails-cmd
@@ -174,6 +170,7 @@ files:
174
170
  - lib/pageflow/embedded_video/configuration.rb
175
171
  - lib/pageflow/embedded_video/engine.rb
176
172
  - lib/pageflow/embedded_video/page_type.rb
173
+ - lib/pageflow/embedded_video/plugin.rb
177
174
  - lib/pageflow/embedded_video/version.rb
178
175
  - pageflow-embedded-video.gemspec
179
176
  - spec/integration/page_type_spec.rb
@@ -197,8 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
194
  - !ruby/object:Gem::Version
198
195
  version: '0'
199
196
  requirements: []
200
- rubyforge_project:
201
- rubygems_version: 2.7.5
197
+ rubygems_version: 3.0.8
202
198
  signing_key:
203
199
  specification_version: 4
204
200
  summary: Pagetype for embedded youtube/vimeo videos