pageflow-embedded-video 0.2.1 → 0.3.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
  SHA1:
3
- metadata.gz: a74fecff08bbcca780ac0a4ac6ef8a4809abed33
4
- data.tar.gz: ced938c2f292a28da4c4a267250605bfceee1157
3
+ metadata.gz: 9ab2a126175d3b53e98841097cd3b40da61ef743
4
+ data.tar.gz: 3421f5e51c631fa53d22b83d7c6480ccf5262ced
5
5
  SHA512:
6
- metadata.gz: d40e22b826db14367d0006ca97db485a01a9fec800c321f5527f298347d4d3c512a44405e6e4b20f585f3df9640c7cadfffab658f7c2aebfe28734b220e3fd0f
7
- data.tar.gz: d0f0ba3e8c68743122898339fd80403a6ac25cba83a016914a70cf7524a29e6236a3b862341921874e4dcc82f025c12e1ab860d98405e88345ea847bb9ce3ffe
6
+ metadata.gz: 4a1f9a124ccbf200f36a485a13731213c056d0859be57c13369611325bb1796b17c1052ab0edb86a8d2f3ac479173c1f10f63aed04a477a36104ac9589931e32
7
+ data.tar.gz: c7ff2e8a5b96b0b07e923319047e3fb48e6703801a321788c64429a0d55d06d6fd7204da1e7a0ef05a652f1208debb9768188627fefd0f60a6e895d1dc562998
data/CHANGELOG.md CHANGED
@@ -1,12 +1,15 @@
1
1
  # CHANGELOG
2
2
 
3
- ### Version 0.2.1
3
+ ### Version 0.3.0
4
4
 
5
- 2016-06-09
5
+ 2016-09-09
6
6
 
7
- [Compare changes](https://github.com/codevise/pageflow-embedded-video/compare/v0.2.0...v0.2.1)
7
+ [Compare changes](https://github.com/codevise/pageflow-embedded-video/compare/v0.2.0...v0.3.0)
8
8
 
9
- - Do not depend on pre version of pageflow.
9
+ - Allow youtube urls with timecode
10
+ ([#14](https://github.com/codevise/pageflow-embedded-video/pull/14))
11
+ - Align close button with slim player control
12
+ ([#13](https://github.com/codevise/pageflow-embedded-video/pull/13))
10
13
 
11
14
  ### Version 0.2.0
12
15
 
data/Gemfile CHANGED
@@ -2,9 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in embedded-video.gemspec
4
4
  gemspec
5
-
6
- gem 'activeadmin', :git => 'https://github.com/codevise/active_admin.git', :branch => 'rails4'
7
- gem 'ransack'
8
- gem 'inherited_resources', '1.4.1'
9
- gem 'formtastic', '2.3.0.rc2'
10
-
data/README.md CHANGED
@@ -17,13 +17,13 @@ Register the page type:
17
17
 
18
18
  # config/initializers/pageflow.rb
19
19
  Pageflow.configure do |config|
20
- config.register_page_type(Pageflow::EmbeddedVideo.page_type)
20
+ config.page_types.register(Pageflow::EmbeddedVideo.page_type)
21
21
  end
22
22
 
23
23
  Include javascript/stylesheets:
24
24
 
25
25
  # app/assets/javascripts/pageflow/application.js
26
- //= require "pageflow/embedded_video"
26
+ //= require pageflow/embedded_video
27
27
 
28
28
  # app/assets/javascripts/pageflow/editor.js
29
29
  //= require pageflow/embedded_video/editor
@@ -39,14 +39,15 @@ Include javascript/stylesheets:
39
39
 
40
40
  ## Configuration
41
41
 
42
- Configure Pageflow Embedded Video by creating an initializer in your app
42
+ Optionally, configure Pageflow Embedded Video by creating an initializer in your app
43
43
  `config/initializers/pageflow_embedded_video.rb`.
44
44
 
45
45
  Example:
46
46
 
47
47
  Pageflow::EmbeddedVideo.configure do |config|
48
48
  # Remove items to disallow hosts
49
- # config.supported_hosts = %w(https://www.youtube.com http://www.youtube.com http://vimeo.com)
49
+ # The listed hosts are supported by default:
50
+ # config.supported_hosts = %w(https://www.youtube.com http://www.youtube.com https://vimeo.com http://vimeo.com)
50
51
  end
51
52
 
52
53
  ## Troubleshooting
@@ -12,7 +12,7 @@ pageflow.pageType.register('embedded_video', _.extend({
12
12
  pageElement.find('.close_button, .iframe_container').click(function(event) {
13
13
  event.stopPropagation();
14
14
  that._pauseVideo();
15
- pageElement.find('.iframe_container').removeClass('show');
15
+ pageElement.find('.iframe_container, .close_button').removeClass('show');
16
16
  pageflow.hideText.deactivate();
17
17
  });
18
18
 
@@ -125,13 +125,7 @@ pageflow.pageType.register('embedded_video', _.extend({
125
125
  }
126
126
 
127
127
  if (this.active) {
128
- var currentUrl = this._getCurrentUrl(pageElement),
129
- newUrl = configuration.get('display_embedded_video_url');
130
-
131
- if (this._urlOrigin(currentUrl) === this._urlOrigin(newUrl)) {
132
- this._updatePlayerSrc(pageElement, configuration);
133
- }
134
- else {
128
+ if (configuration.hasChanged('display_embedded_video_url')) {
135
129
  this._removePlayer(pageElement, function() {
136
130
  that._createPlayer(pageElement, configuration.attributes);
137
131
  });
@@ -202,7 +196,8 @@ pageflow.pageType.register('embedded_video', _.extend({
202
196
  width: '100%',
203
197
  videoId: that._getVideoId(url),
204
198
  playerVars: {
205
- rel: false
199
+ rel: false,
200
+ start: that._getVideoStartTime(url)
206
201
  },
207
202
  events: {
208
203
  'onReady': function(event) {
@@ -244,15 +239,6 @@ pageflow.pageType.register('embedded_video', _.extend({
244
239
  });
245
240
  },
246
241
 
247
- _updatePlayerSrc: function(pageElement, configuration) {
248
- var that = this,
249
- newUrl = configuration.get('display_embedded_video_url'),
250
- p = pageElement.find('iframe'),
251
- url = new URI(p.attr('src'));
252
-
253
- p.attr('src', url.filename(that._getVideoId(newUrl)));
254
- },
255
-
256
242
  _setPlayerVolume: function(value) {
257
243
  if (this.player) {
258
244
  if (typeof this.player.setVolume === 'function') {
@@ -288,7 +274,7 @@ pageflow.pageType.register('embedded_video', _.extend({
288
274
  _initPlaceholderImage: function(pageElement, configuration) {
289
275
  var $div = $(document.createElement('div')),
290
276
  pageHeader = pageElement.find('.page_header'),
291
- container = pageElement.find('.iframe_container'),
277
+ containerAndCloseButton = pageElement.find('.iframe_container, .close_button'),
292
278
  url = configuration.display_embedded_video_url;
293
279
 
294
280
  $div.addClass('iframe_overlay ' + this._urlOrigin(url));
@@ -298,7 +284,7 @@ pageflow.pageType.register('embedded_video', _.extend({
298
284
 
299
285
  $div.click(function(event) {
300
286
  event.preventDefault();
301
- container.addClass('show');
287
+ containerAndCloseButton.addClass('show');
302
288
  pageflow.hideText.activate();
303
289
  });
304
290
  },
@@ -321,10 +307,6 @@ pageflow.pageType.register('embedded_video', _.extend({
321
307
  }
322
308
  },
323
309
 
324
- _getCurrentUrl: function(pageElement) {
325
- return pageElement.find('iframe').attr('src');
326
- },
327
-
328
310
  _urlOrigin: function(url) {
329
311
  var uri = new URI(url),
330
312
  domain = uri.domain(true);
@@ -358,6 +340,32 @@ pageflow.pageType.register('embedded_video', _.extend({
358
340
  return '';
359
341
  },
360
342
 
343
+ _getVideoStartTime: function(url) {
344
+ var query = new URI(url).query();
345
+ var params = query.split('&');
346
+ var that = this;
347
+
348
+ return _.reduce(params, function(result, param) {
349
+ var parts = param.split('=');
350
+
351
+ if (parts[0] === 't') {
352
+ return that._timestampToSeconds(parts[1] || '');
353
+ }
354
+
355
+ return result;
356
+ }, 0);
357
+ },
358
+
359
+ _timestampToSeconds: function(timestamp) {
360
+ if (timestamp.match(/\d+m(\d+s)?/)) {
361
+ var parts = timestamp.split('m');
362
+ return parseInt(parts[0], 10) * 60 + parseInt(parts[1] || 0, 10);
363
+ }
364
+ else {
365
+ return 0;
366
+ }
367
+ },
368
+
361
369
  _getRandom: function(string) {
362
370
  string = string + new Date().getTime();
363
371
  var hash = 0, i, chr, len;
@@ -139,11 +139,15 @@
139
139
  }
140
140
  }
141
141
 
142
- .iframe_container {
143
- .close_button {
144
- display: none;
142
+ .close_button {
143
+ display: none;
144
+
145
+ .has_mobile_platform &.show {
146
+ display: block;
145
147
  }
148
+ }
146
149
 
150
+ .iframe_container {
147
151
  .has_mobile_platform & {
148
152
  pointer-events: none;
149
153
  height: 0;
@@ -177,10 +181,6 @@
177
181
  right: 0;
178
182
  bottom: 0;
179
183
  opacity: 1;
180
-
181
- .close_button {
182
- display: block;
183
- }
184
184
  }
185
185
 
186
186
  .iframe_wrapper {
@@ -1,5 +1,10 @@
1
1
  <div class="blackLayer"></div>
2
2
  <div class="content_and_background embedded_video_page">
3
+ <div class="close_button" tabindex="4" title="<%= t('pageflow.public.embedded_video.leave_video') %>">
4
+ <div class="label">
5
+ <%= t('pageflow.public.close') %>
6
+ </div>
7
+ </div>
3
8
 
4
9
  <div class="backgroundArea">
5
10
  <%= background_image_div(configuration, 'background_image') %>
@@ -25,11 +30,6 @@
25
30
  </div>
26
31
  </div>
27
32
  <div class="iframe_container">
28
- <div class="close_button" tabindex="4" title="<%= t('pageflow.public.embedded_video.leave_video') %>">
29
- <div class="label">
30
- <%= t('pageflow.public.close') %>
31
- </div>
32
- </div>
33
33
  <div class="iframe_wrapper"></div>
34
34
  <% if configuration['video_caption'].present? %>
35
35
  <div class="video_caption"><%= configuration['video_caption'] %></div>
@@ -1,5 +1,5 @@
1
1
  module Pageflow
2
2
  module EmbeddedVideo
3
- VERSION = '0.2.1'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
5
5
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_runtime_dependency 'pageflow', '~> 0.10'
20
+ spec.add_runtime_dependency 'pageflow', '~> 0.11'
21
21
  spec.add_runtime_dependency 'i18n-js'
22
22
  spec.add_runtime_dependency 'pageflow-public-i18n', '~> 1.0'
23
23
 
@@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "webmock"
27
27
 
28
28
  # Semantic versioning rake tasks
29
- spec.add_development_dependency 'semmy', '~> 0.2'
29
+ spec.add_development_dependency 'semmy', '~> 0.3'
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pageflow-embedded-video
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Schöttelndreyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-09 00:00:00.000000000 Z
11
+ date: 2016-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pageflow
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.10'
19
+ version: '0.11'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.10'
26
+ version: '0.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: i18n-js
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0.2'
103
+ version: '0.3'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0.2'
110
+ version: '0.3'
111
111
  description:
112
112
  email:
113
113
  - sschoettelndreyer@codevise.de
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  version: '0'
178
178
  requirements: []
179
179
  rubyforge_project:
180
- rubygems_version: 2.2.5
180
+ rubygems_version: 2.5.1
181
181
  signing_key:
182
182
  specification_version: 4
183
183
  summary: Pagetype for embedded youtube/vimeo videos