retina_tag 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,9 @@ var RetinaTag = RetinaTag || {};
2
2
 
3
3
  RetinaTag.init = function() {
4
4
  RetinaTag.updateImages();
5
- RetinaTag.interval = setInterval(RetinaTag.updateImages,50);
5
+ window.matchMedia('(-webkit-device-pixel-ratio:1)').addListener(RetinaTag.updateImages);
6
+ document.addEventListener("page:load", RetinaTag.updateImages);
7
+ document.addEventListener("retina_tag:refresh", RetinaTag.updateImages);
6
8
  };
7
9
 
8
10
  RetinaTag.updateImages = function() {
@@ -26,7 +28,7 @@ RetinaTag.refreshImage = function(image) {
26
28
  image.setAttribute('lowdpi_src',imageSrc);
27
29
  }
28
30
  if(lazyLoad) {
29
- lazyLoad.setAttribute('data-lazy-load','2x');
31
+ image.setAttribute('data-lazy-load','2x');
30
32
  }
31
33
  else {
32
34
  image.src = hiDpiSrc;
@@ -35,7 +37,7 @@ RetinaTag.refreshImage = function(image) {
35
37
  }
36
38
  else if(window.devicePixelRatio <= 1 && (imageSrc == hiDpiSrc || (lowDpiSrc && imageSrc != lowDpiSrc))) {
37
39
  if(lazyLoad) {
38
- lazyLoad.setAttribute('data-lazy-load','1x');
40
+ image.setAttribute('data-lazy-load','1x');
39
41
  }
40
42
  else {
41
43
  image.src = lowDpiSrc;
@@ -43,4 +45,4 @@ RetinaTag.refreshImage = function(image) {
43
45
  }
44
46
  };
45
47
 
46
- RetinaTag.init();
48
+ $(document).ready(RetinaTag.init);
@@ -1,3 +1,3 @@
1
1
  module RetinaTag
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
data/retina_tag.gemspec CHANGED
@@ -16,4 +16,5 @@ Gem::Specification.new do |gem|
16
16
  gem.version = RetinaTag::VERSION
17
17
 
18
18
  gem.add_dependency "rails", "~> 3.1"
19
+ gem.add_dependency "jquery-rails"
19
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: retina_tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3.1'
30
+ - !ruby/object:Gem::Dependency
31
+ name: jquery-rails
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  description: This gem overrides image_tag to support retina resolution images using
31
47
  asset pipeline
32
48
  email:
@@ -60,7 +76,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
76
  version: '0'
61
77
  segments:
62
78
  - 0
63
- hash: -2961901041095853751
79
+ hash: -803285465304008810
64
80
  required_rubygems_version: !ruby/object:Gem::Requirement
65
81
  none: false
66
82
  requirements:
@@ -69,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
85
  version: '0'
70
86
  segments:
71
87
  - 0
72
- hash: -2961901041095853751
88
+ hash: -803285465304008810
73
89
  requirements: []
74
90
  rubyforge_project:
75
91
  rubygems_version: 1.8.24