zfben_libjs 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/zfben_libjs/helpers.rb +4 -4
- data/lib/zfben_libjs/lib.coffee +9 -2
- data/zfben_libjs.gemspec +1 -1
- metadata +13 -13
data/lib/zfben_libjs/helpers.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Zfben_libjs::Helpers
|
2
2
|
Lib_version = Time.now.strftime('?%s')
|
3
3
|
def lib *opts
|
4
|
-
html = ''
|
4
|
+
html = lib_js 'lib.js'
|
5
5
|
unless opts.blank?
|
6
6
|
preload = []
|
7
7
|
lib_preload = []
|
@@ -13,6 +13,7 @@ module Zfben_libjs::Helpers
|
|
13
13
|
lib_preload.push name
|
14
14
|
end
|
15
15
|
end
|
16
|
+
|
16
17
|
if preload.length > 0
|
17
18
|
preload.each do |url|
|
18
19
|
if url.end_with?('.css')
|
@@ -22,10 +23,9 @@ module Zfben_libjs::Helpers
|
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
26
|
+
|
25
27
|
if lib_preload.length > 0
|
26
|
-
html <<
|
27
|
-
else
|
28
|
-
html << '<script>lib()</script>'
|
28
|
+
html << "<script>lib('#{lib_preload.join(' ')}')</script>"
|
29
29
|
end
|
30
30
|
end
|
31
31
|
return html
|
data/lib/zfben_libjs/lib.coffee
CHANGED
@@ -4,13 +4,20 @@ libs = {}
|
|
4
4
|
# save loaded source to `loaded`
|
5
5
|
loaded = {}
|
6
6
|
|
7
|
+
progress_loaded_url = (url)->
|
8
|
+
url = url.match(/[^?]+/)[0]
|
9
|
+
local = location.protocol + '//' + location.host
|
10
|
+
if url.indexOf(local) is 0
|
11
|
+
url = url.substring(local.length)
|
12
|
+
return url
|
13
|
+
|
7
14
|
for link in document.getElementsByTagName('link')
|
8
15
|
if link.href && link.href isnt ''
|
9
|
-
loaded[link.href] = true
|
16
|
+
loaded[progress_loaded_url(link.href)] = true
|
10
17
|
|
11
18
|
for script in document.getElementsByTagName('script')
|
12
19
|
if script.src && script.src isnt ''
|
13
|
-
loaded[script.src] = true
|
20
|
+
loaded[progress_loaded_url(script.src)] = true
|
14
21
|
|
15
22
|
# pending
|
16
23
|
pending_urls = {}
|
data/zfben_libjs.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zfben_libjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-09-13 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rainbow
|
16
|
-
requirement: &
|
16
|
+
requirement: &7249620 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *7249620
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &7248900 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *7248900
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: compass
|
38
|
-
requirement: &
|
38
|
+
requirement: &7248120 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *7248120
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: coffee-script
|
49
|
-
requirement: &
|
49
|
+
requirement: &7247280 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *7247280
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: uglifier
|
60
|
-
requirement: &
|
60
|
+
requirement: &7246840 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *7246840
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activesupport
|
71
|
-
requirement: &
|
71
|
+
requirement: &7246420 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *7246420
|
80
80
|
description: ''
|
81
81
|
email:
|
82
82
|
- ben@zfben.com
|