jquery-rails-cdn 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jquery-rails-cdn.rb +19 -11
- data/lib/jquery-rails-cdn/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8e888e45dfe3fb34ae2ff6a2070241e25f09a5e
|
4
|
+
data.tar.gz: b7659e994085b1026ffe224d250c8287cae04460
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f0613d6eb3e943abd0162d5abf0c42db0383cd2a02401d3f95ce804e814f2fab62786e5936fd8e9f2b866315becaec1e4f176aad64e953bfd22190a3bda383a
|
7
|
+
data.tar.gz: 6301ba7e1b0b24d9a8a847020339fbcc640065c4674a46d5e6eb81d2396812f40287c0df3c138475a4cd3772254829a7f8d34dde91498ae1b9cbaf5e8a465d92
|
data/lib/jquery-rails-cdn.rb
CHANGED
@@ -16,24 +16,32 @@ module Jquery::Rails::Cdn
|
|
16
16
|
|
17
17
|
def jquery_url(name)
|
18
18
|
@@jquery_urls ||= begin
|
19
|
-
version =
|
20
|
-
when 1, NilClass
|
21
|
-
Jquery::Rails::JQUERY_VERSION
|
22
|
-
when 2
|
23
|
-
Jquery::Rails::JQUERY_2_VERSION
|
24
|
-
else
|
25
|
-
raise 'invalid :major_version option'
|
26
|
-
end
|
19
|
+
version = jquery_version_chooser(Jquery::Rails::JQUERY_VERSION, Jquery::Rails::JQUERY_2_VERSION)
|
27
20
|
Hash[URL.map{|k,v| [k, v.sub(/\{JQUERY_VERSION\}/, version)] }]
|
28
21
|
end
|
29
|
-
|
22
|
+
if name == :local
|
23
|
+
jquery_version_chooser(:jquery, :jquery2)
|
24
|
+
else
|
25
|
+
@@jquery_urls[name]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def jquery_version_chooser(one, two)
|
30
|
+
case Jquery::Rails::Cdn.major_version
|
31
|
+
when 1, NilClass
|
32
|
+
one
|
33
|
+
when 2
|
34
|
+
two
|
35
|
+
else
|
36
|
+
raise 'invalid :major_version option'
|
37
|
+
end
|
30
38
|
end
|
31
39
|
|
32
40
|
def jquery_include_tag(name, options = {})
|
33
|
-
return javascript_include_tag(:
|
41
|
+
return javascript_include_tag(jquery_url(:local), options) if OFFLINE && !options.delete(:force)
|
34
42
|
|
35
43
|
[ javascript_include_tag(jquery_url(name), options),
|
36
|
-
javascript_tag("window.jQuery || document.write(unescape('#{javascript_include_tag(:
|
44
|
+
javascript_tag("window.jQuery || document.write(unescape('#{javascript_include_tag(jquery_url(:local), options).gsub('<','%3C')}'))")
|
37
45
|
].join("\n").html_safe
|
38
46
|
end
|
39
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-rails-cdn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenn Ejima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-rails
|