responsive_images 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjY5MjkwZmFhNTVlYjk2ZGIzZDFiMjYxNWU3NzI2MmViZDE2M2NmZQ==
5
- data.tar.gz: !binary |-
6
- YTJmOTM3ZWNiNjE2OGVkNzk4YTA3MTQ3ZjJlOWI2NTA4ZjMyNWYzMA==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- NTRlNGRiNGUzOTk1OGY5OTFlNzMwMDg2ZTY1ZjliMzQ2NzdlNWJjMmU0ZDli
10
- YWY5Y2YzNDAwMmEwZmNlZTdmYjFiM2IwYjM3ZDkwYzZkZWViYTUzNzg2NGM1
11
- OTQ5YWEzNjE2MTdlNzE4MjJmZmQxZjVjYjRmYjFjNDM0YzQ1MTU=
12
- data.tar.gz: !binary |-
13
- N2Y5ZGYwNzUyNWFkZjU5NDNmMTJmMWMzNmY2MTZhMWMzZDAzMTIzMjhiYzUx
14
- ZTExYjdjNjllN2Y4MmYyOTZkOWFhMjk3YTc3MGVjNjczNTRhODBmMzI3MDRl
15
- OWRmYzc4NzAwYjY0ZWI2YmY5ODQ2ZmE5M2NiYjIzNThiNTc5Njg=
2
+ SHA1:
3
+ metadata.gz: 3e4dd3c4b94654c4e4798dc1ba23e57388b2d843
4
+ data.tar.gz: 20f82f2b249e465cadaaccde8ddd5a21b703ad85
5
+ SHA512:
6
+ metadata.gz: 9ba615db84fdbfc576a4a824714af1f57b8ff9c99c1f926b59d462af07b47b4148fff66c6d48b180ec2ef3248e93df03f9739989217e18365b4d306ecf77732c
7
+ data.tar.gz: f843a89b660af0ded1ef6583ceacea1f0bd599387ab7132f1d1a8e84132f4bdf23043d6b9a3860e4136cd81b4a31da94acb2fcfae8bede4b78236a4e9aa6f0c2
@@ -1,3 +1,3 @@
1
1
  module ResponsiveImages
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -46,27 +46,27 @@
46
46
  responsive_images.settings.screen_width = $(window).width();
47
47
  responsive_images.settings.screen_height = $(window).height();
48
48
  }
49
- // Set up our array of sizes and the closest match as null
50
- var size = null;
51
- var size_key = null;
52
- var sizes = {
53
- mobile_size: defaults.mobile_size,
54
- tablet_size: defaults.tablet_size,
55
- desktop_size: defaults.desktop_size,
56
- };
57
- // Loop over our size array to figure out which size is the closest to our screen size
58
- $.each(sizes, function(key, value) {
59
- if (size == null || Math.abs(value - responsive_images.settings.screen_width) < Math.abs(size - responsive_images.settings.screen_width)) {
60
- size = value;
61
- size_key = key;
62
- };
63
- });
64
- responsive_images.update_images(size_key, size);
49
+ // Default image is considered the largest one
50
+ var size_key = 'default_size';
51
+ var sizes = [
52
+ ['desktop_size', responsive_images.settings.desktop_size],
53
+ ['tablet_size', responsive_images.settings.tablet_size],
54
+ ['mobile_size', responsive_images.settings.mobile_size],
55
+ ];
56
+ // Iterate over sizes and find one which matches current screen size
57
+ for(var i = 0; i < sizes.length; i++) {
58
+ // If screen width is larger than any breakpoint
59
+ if (responsive_images.settings.screen_width < sizes[i][1]) {
60
+ size_key = sizes[i][0];
61
+ }
62
+ }
63
+
64
+ responsive_images.update_images(size_key);
65
65
  };
66
66
 
67
67
 
68
68
  // Update the actual images
69
- responsive_images.update_images = function(key, size) {
69
+ responsive_images.update_images = function(key) {
70
70
  // Set up our data attribute
71
71
  var data_attribute = "data-" + key.replace("_", "-").replace('size', 'src');
72
72
  responsive_images.each(function(index, item) {
@@ -75,8 +75,7 @@
75
75
  // If the item is a div, let's set the background image
76
76
  if ( $(item).is('div') ) {
77
77
  $(item).css({
78
- "background-image" : 'url("' + $(item).attr(data_attribute) + '")',
79
- "background-size" : "auto",
78
+ "background-image" : 'url("' + $(item).attr(data_attribute) + '")'
80
79
  });
81
80
  }
82
81
  // If it's an image, let's just replace the source
@@ -93,4 +92,4 @@
93
92
  };
94
93
 
95
94
 
96
- })(jQuery);
95
+ })(jQuery);
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: responsive_images
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Koht
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-28 00:00:00.000000000 Z
11
+ date: 2015-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mobvious
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: A responsive image gem for Rails and Carrierwave
@@ -59,7 +59,7 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
62
+ - ".gitignore"
63
63
  - Gemfile
64
64
  - LICENSE.txt
65
65
  - README.md
@@ -83,19 +83,18 @@ require_paths:
83
83
  - lib
84
84
  required_ruby_version: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ! '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - ! '>='
91
+ - - ">="
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.0.7
96
+ rubygems_version: 2.4.2
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: A responsive image gem for Rails and Carrierwave
100
100
  test_files: []
101
- has_rdoc: