retina_tag 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/retina_tag.js +6 -4
- data/lib/retina_tag/version.rb +1 -1
- data/retina_tag.gemspec +1 -0
- metadata +19 -3
@@ -2,7 +2,9 @@ var RetinaTag = RetinaTag || {};
|
|
2
2
|
|
3
3
|
RetinaTag.init = function() {
|
4
4
|
RetinaTag.updateImages();
|
5
|
-
|
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
|
-
|
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
|
-
|
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);
|
data/lib/retina_tag/version.rb
CHANGED
data/retina_tag.gemspec
CHANGED
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.
|
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: -
|
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: -
|
88
|
+
hash: -803285465304008810
|
73
89
|
requirements: []
|
74
90
|
rubyforge_project:
|
75
91
|
rubygems_version: 1.8.24
|