resizeend-rails 1.2.0 → 1.2.1

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: ce3b55f182ce0d94476368aa0246a1e4d753c610
4
- data.tar.gz: a6c19293a6ec7c0f1b5196483a8c300bd8ca27f4
3
+ metadata.gz: 740ea1a583271236767dce230a04a44e4545a013
4
+ data.tar.gz: bf333d5e0011da8603c14f56660ccf21951e2f36
5
5
  SHA512:
6
- metadata.gz: f5cb8fb075065c6a86715ae0616126d91c747ac1808045e473d3e9250588ea963c12ea8bf0f47683c3415850c22a00d0cc01c74e8326a306916b25e73e497be4
7
- data.tar.gz: 507ec0ce69647f64497bcc2441f516fc26f61c5325854e4d5864276c908609cdbf4756811abd69f2c9a7e3ddef5fecf4d3664fbfe6e9cd150253b2a79fcbf0b5
6
+ metadata.gz: 52a3d5eb3f709a249a907f79cbb7d2ae656d1901817f3cf7188138794c63838e0d6455b2912271afe0260226cb6962b0e614916511400c20d44c272a282fbbde
7
+ data.tar.gz: 84fddbc04abbd9b562aed85c6e0cf7361839a77b576acdaa53dd48d8babd58d9c3aef19362962a24e0c890bde2550fc217a3897e1fb73d26b4773c1c28dac504
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'bundler/gem_tasks'
2
2
 
3
3
  desc 'Fetch a new version of the script'
4
4
  task :fetch do
5
- source = 'https://raw.github.com/porada/resizeend/gh-pages/src/resizeend.coffee'
6
- target = 'vendor/assets/javascripts/resizeend.coffee'
7
- sh "curl -#L #{source} > #{target}"
5
+ source = 'https://raw.githubusercontent.com/porada/resizeend/master/resizeend.js'
6
+ target = 'vendor/assets/javascripts/resizeend.js'
7
+ sh "rm -rf #{target.sub('.js', '*')} && curl -#L #{source} > #{target}"
8
8
  end
@@ -1,5 +1,5 @@
1
1
  module ResizeEnd
2
2
  module Rails
3
- VERSION = '1.2.0'
3
+ VERSION = '1.2.1'.freeze
4
4
  end
5
5
  end
@@ -19,4 +19,19 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_development_dependency 'bundler', '~> 1.3'
21
21
  spec.add_development_dependency 'rake'
22
+
23
+ spec.post_install_message = <<-TEXT
24
+
25
+
26
+ This asset gem will not be updated anymore. In order to
27
+ make sure you’re using the newest version of resizeend,
28
+ please include this snippet in your Gemfile:
29
+
30
+ source 'https://rails-assets.org'
31
+ gem 'rails-assets-resizeend'
32
+
33
+ Read more about Rails Assets: https://rails-assets.org
34
+
35
+
36
+ TEXT
22
37
  end
@@ -0,0 +1,40 @@
1
+ /*! https://github.com/porada/resizeend · MIT */
2
+
3
+ (function(window) {
4
+ var document = window.document;
5
+
6
+ var event;
7
+ var events = ['resize:end', 'resizeend'].map(function(name) {
8
+ event = document.createEvent('Event');
9
+ event.initEvent(name, false, false);
10
+ return event;
11
+ });
12
+
13
+ var dispatchResizeEndEvent = function() {
14
+ events.forEach(function(event) {
15
+ window.dispatchEvent(event);
16
+ });
17
+ };
18
+
19
+ var getCurrentOrientation = function() {
20
+ return Math.abs(+window.orientation || 0) % 180;
21
+ };
22
+
23
+ var initialOrientation = getCurrentOrientation();
24
+ var currentOrientation;
25
+ var resizeDebounceTimeout;
26
+
27
+ var debounce = function() {
28
+ currentOrientation = getCurrentOrientation();
29
+
30
+ if ( currentOrientation !== initialOrientation ) {
31
+ dispatchResizeEndEvent();
32
+ initialOrientation = currentOrientation;
33
+ } else {
34
+ clearTimeout(resizeDebounceTimeout);
35
+ resizeDebounceTimeout = setTimeout(dispatchResizeEndEvent, 100);
36
+ }
37
+ };
38
+
39
+ window.addEventListener('resize', debounce, false);
40
+ })(window);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resizeend-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Porada
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-02 00:00:00.000000000 Z
11
+ date: 2014-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,12 +52,24 @@ files:
52
52
  - lib/resizeend-rails.rb
53
53
  - lib/resizeend-rails/version.rb
54
54
  - resizeend-rails.gemspec
55
- - vendor/assets/javascripts/resizeend.coffee
55
+ - vendor/assets/javascripts/resizeend.js
56
56
  homepage: https://github.com/rails-assets/resizeend-rails
57
57
  licenses:
58
58
  - MIT
59
59
  metadata: {}
60
- post_install_message:
60
+ post_install_message: |2+
61
+
62
+
63
+ This asset gem will not be updated anymore. In order to
64
+ make sure you’re using the newest version of resizeend,
65
+ please include this snippet in your Gemfile:
66
+
67
+ source 'https://rails-assets.org'
68
+ gem 'rails-assets-resizeend'
69
+
70
+ Read more about Rails Assets: https://rails-assets.org
71
+
72
+
61
73
  rdoc_options: []
62
74
  require_paths:
63
75
  - lib
@@ -73,9 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
85
  version: '0'
74
86
  requirements: []
75
87
  rubyforge_project:
76
- rubygems_version: 2.1.5
88
+ rubygems_version: 2.2.2
77
89
  signing_key:
78
90
  specification_version: 4
79
91
  summary: resizeend packaged for Rails assets pipeline
80
92
  test_files: []
81
- has_rdoc:
@@ -1,38 +0,0 @@
1
- #
2
- # resizeend.coffee © 2012–2013 Dominik Porada · http://porada.mit-license.org
3
- # ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
4
-
5
- do (window) ->
6
- document = window.document
7
- return unless window.addEventListener and document.createEvent
8
-
9
- # Preparing for v2.0
10
- events = ['resize:end', 'resizeend'].map (name) ->
11
- event = document.createEvent 'Event'
12
- event.initEvent name, false, false
13
- event
14
-
15
- dispatchResizeEndEvent = ->
16
- events.forEach window.dispatchEvent.bind(window)
17
-
18
- # Assuming `window.orientation` is all about degrees (or nothing),
19
- # the function expression returns either 0 or 90
20
- getCurrentOrientation = -> Math.abs(+window.orientation or 0) % 180
21
- initialOrientation = getCurrentOrientation()
22
-
23
- currentOrientation = null
24
- resizeDebounceTimeout = null
25
-
26
- debounce = ->
27
- currentOrientation = getCurrentOrientation()
28
-
29
- # If `window` is resized due to an orientation change,
30
- # dispatch `resize:end` immediately; otherwise, slightly delay it
31
- unless currentOrientation is initialOrientation
32
- dispatchResizeEndEvent()
33
- initialOrientation = currentOrientation
34
- else
35
- clearTimeout resizeDebounceTimeout
36
- resizeDebounceTimeout = setTimeout dispatchResizeEndEvent, 100
37
-
38
- window.addEventListener 'resize', debounce, false