jvectormap-rails 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -1
- data/README.md +9 -4
- data/Rakefile +8 -8
- data/jvectormap-rails.gemspec +7 -7
- data/lib/jvectormap-rails.rb +2 -10
- data/lib/jvectormap/rails/engine.rb +11 -2
- data/lib/jvectormap/rails/version.rb +3 -5
- data/tasks/jvectormap.rake +6 -3
- data/vendor/assets/javascripts/jvectormap.js +32 -25
- data/vendor/assets/javascripts/jvectormap/jquery-jvectormap.js +5 -6
- data/vendor/assets/javascripts/jvectormap/lib/jquery-mousewheel.js +201 -0
- data/vendor/assets/javascripts/jvectormap/maps/africa_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/africa_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ar_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ar_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/asia_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/asia_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/at_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/at_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/au_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/au_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/be_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/be_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ca_lcc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ca_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ca_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ch_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ch_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/cn_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/cn_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/co_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/co_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/continents_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/continents_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/de_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/de_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/dk_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/dk_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/es_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/es_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/europe_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/europe_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/fr_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/fr_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/fr_regions_2016_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/fr_regions_2016_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/fr_regions_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/fr_regions_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/in_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/in_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/it_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/it_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/it_regions_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/it_regions_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/kr_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/kr_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/nl_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/nl_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/no_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/no_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/north_america_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/north_america_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/nz_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/nz_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/oceania_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/oceania_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/pl_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/pl_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/pt_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/pt_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ru_fd_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ru_fd_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ru_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ru_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/se_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/se_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/south_america_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/south_america_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/th_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/th_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/uk_countries_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/uk_countries_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/uk_regions_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/uk_regions_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/us-il-chicago_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/us-il-chicago_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/us-ny-newyork_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/us-ny-newyork_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/us_aea.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/us_lcc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/us_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/us_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ve_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/ve_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/world_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/world_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/za_merc.js +1 -0
- data/vendor/assets/javascripts/jvectormap/maps/za_mill.js +1 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/abstract-canvas-element.js +26 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/abstract-element.js +0 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/abstract-shape-element.js +1 -24
- data/vendor/assets/javascripts/jvectormap/{lib → src}/color-scale.js +0 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/data-series.js +36 -17
- data/vendor/assets/javascripts/jvectormap/src/jvectormap.js +185 -0
- data/vendor/assets/javascripts/jvectormap/src/legend.js +83 -0
- data/vendor/assets/javascripts/jvectormap/src/map-object.js +73 -0
- data/vendor/assets/javascripts/jvectormap/{lib/world-map.js → src/map.js} +357 -148
- data/vendor/assets/javascripts/jvectormap/src/marker.js +76 -0
- data/vendor/assets/javascripts/jvectormap/src/multimap.js +139 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/numeric-scale.js +41 -3
- data/vendor/assets/javascripts/jvectormap/src/ordinal-scale.js +21 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/proj.js +0 -0
- data/vendor/assets/javascripts/jvectormap/src/region.js +45 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/simple-scale.js +0 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/svg-canvas-element.js +4 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/svg-circle-element.js +0 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/svg-element.js +0 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/svg-group-element.js +0 -0
- data/vendor/assets/javascripts/jvectormap/src/svg-image-element.js +36 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/svg-path-element.js +0 -0
- data/vendor/assets/javascripts/jvectormap/src/svg-shape-element.js +49 -0
- data/vendor/assets/javascripts/jvectormap/src/svg-text-element.js +13 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/vector-canvas.js +2 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/vml-canvas-element.js +0 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/vml-circle-element.js +0 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/vml-element.js +1 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/vml-group-element.js +0 -0
- data/vendor/assets/javascripts/jvectormap/src/vml-image-element.js +47 -0
- data/vendor/assets/javascripts/jvectormap/{lib → src}/vml-path-element.js +1 -14
- data/vendor/assets/javascripts/jvectormap/{lib → src}/vml-shape-element.js +0 -0
- data/vendor/assets/stylesheets/jvectormap.css +107 -9
- metadata +127 -103
- data/History.txt +0 -7
- data/lib/jvectormap/rails/railtie.rb +0 -17
- data/vendor/assets/javascripts/jvectormap/jquery-mousewheel.js +0 -84
- data/vendor/assets/javascripts/jvectormap/lib/jvectormap.js +0 -99
- data/vendor/assets/javascripts/jvectormap/lib/ordinal-scale.js +0 -7
- data/vendor/assets/javascripts/jvectormap/lib/svg-shape-element.js +0 -7
- data/vendor/assets/javascripts/jvectormap/maps/ar_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/ar_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/at_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/at_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/au_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/au_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/be_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/be_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/ca_lcc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/ca_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/ca_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/ch_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/ch_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/cn_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/cn_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/co_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/co_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/de_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/de_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/dk_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/dk_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/es_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/es_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/europe_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/europe_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/fr_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/fr_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/in_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/in_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/it_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/it_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/nl_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/nl_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/no_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/no_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/nz_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/nz_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/ph_regions_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/ph_regions_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/pl_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/pl_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/pt_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/pt_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/se_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/se_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/th_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/th_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/th_regions_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/th_regions_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/uk_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/uk_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/us-il-chicago_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/us-ny-newyork_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/us_aea_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/us_lcc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/us_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/us_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/ve_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/ve_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/world_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/world_mill_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/za_merc_en.js +0 -1
- data/vendor/assets/javascripts/jvectormap/maps/za_mill_en.js +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18c74cc7f5f22d91c70d75173b1b46ab2c889e51
|
4
|
+
data.tar.gz: 73a6bf2db4c756f7a08ab00d41fc49bfb8acdbc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e82164aa5a0a0e936d8667c940512074af1d55548e2bd45a32594ea3a94c8883281bf04e83736044d771774566483cfa0310d1cf62cc03057f7b9c74727a0e0
|
7
|
+
data.tar.gz: 73073eb680c475ce8b6dc7818b06b1ec5a61e3399ce739c7ae8a645a169d30278e44c4947aebd61ba1d1c7fc2fc5fd7df0e06e32dd2e10ae35385d3b294e50bc
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -18,21 +18,26 @@ You can add jvectormap-rails to your `application.js` file using a require state
|
|
18
18
|
//= require jvectormap
|
19
19
|
```
|
20
20
|
|
21
|
-
|
21
|
+
Don't forget to add the CSS to your `application.css` file too:
|
22
|
+
|
23
|
+
```
|
24
|
+
*= require 'jvectormap'
|
25
|
+
```
|
26
|
+
|
27
|
+
To add support for whatever maps you want to use, include them in `application.js`:
|
22
28
|
|
23
29
|
```
|
24
|
-
//= require jvectormap
|
25
30
|
//= require jvectormap/maps/us_merc_en
|
26
31
|
```
|
27
32
|
|
28
|
-
The basic pattern is `{country}-{region}_{city}_{projection}
|
33
|
+
The basic pattern is `{country}-{region}_{city}_{projection}`. For example, the map `us-il-chicago_mill` has a country of `us` (United States), region of `il` (Illinois), city of `chicago`, and a projection of `mill` (Miller). Other common projections include Mercator (`merc`), and Albers equal area (`aea`).
|
29
34
|
|
30
35
|
### Asset Precompilation
|
31
36
|
|
32
37
|
jvectormap-rails supports precompiling individual maps. Add an initializer to your app, eg. `config/initializers/jvectormap.rb`:
|
33
38
|
|
34
39
|
```ruby
|
35
|
-
JVectorMap::Rails.precompile_maps <<
|
40
|
+
JVectorMap::Rails.precompile_maps << 'us_merc'
|
36
41
|
```
|
37
42
|
|
38
43
|
### Rake Tasks
|
data/Rakefile
CHANGED
@@ -13,26 +13,26 @@ task :download_maps do
|
|
13
13
|
# I wish there was a better way to get the map data, but I can't find a repo or anything, so here we are...
|
14
14
|
|
15
15
|
output_dir = File.join(File.dirname(__FILE__), "vendor")
|
16
|
-
puts
|
17
|
-
home = open(
|
16
|
+
puts 'Getting list of map urls...'
|
17
|
+
home = open('http://jvectormap.com/maps/').read
|
18
18
|
links = home.scan(/<a\shref="(\/maps.*)">/).flatten.uniq
|
19
19
|
|
20
20
|
js_files = links.flat_map do |link|
|
21
21
|
puts "Getting list of maps for #{link}..."
|
22
|
-
content = open(File.join(
|
22
|
+
content = open(File.join('http://jvectormap.com', link)).read
|
23
23
|
content.scan(/<a\shref=\"(\/js\/jquery-jvectormap[\w\d\-]+\.js)">/).flatten.uniq
|
24
24
|
end
|
25
25
|
|
26
26
|
js_files.uniq.each do |file|
|
27
27
|
puts "Downloading map #{File.basename(file)}..."
|
28
|
-
map_data = open(File.join(
|
29
|
-
save_name = map_data.scan(
|
30
|
-
File.open(File.join(output_dir,
|
28
|
+
map_data = open(File.join('http://jvectormap.com', file)).read
|
29
|
+
save_name = map_data.scan(/jQuery\.fn\.vectorMap\('addMap',\s'([\w_\-]+)'/).flatten.first
|
30
|
+
File.open(File.join(output_dir, 'assets/javascripts/jvectormap/maps', "#{save_name}.js"), 'w+') do |f|
|
31
31
|
f.write(map_data)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
puts
|
35
|
+
puts 'Done.'
|
36
36
|
end
|
37
37
|
|
38
|
-
load
|
38
|
+
load 'tasks/jvectormap.rake'
|
data/jvectormap-rails.gemspec
CHANGED
@@ -2,19 +2,19 @@ $:.unshift File.join(File.dirname(__FILE__), 'lib')
|
|
2
2
|
require 'jvectormap/rails/version'
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
|
-
s.name =
|
5
|
+
s.name = 'jvectormap-rails'
|
6
6
|
s.version = ::JVectorMap::Rails::VERSION
|
7
|
-
s.authors = [
|
8
|
-
s.email = [
|
9
|
-
s.homepage =
|
7
|
+
s.authors = ['Cameron Dutro', 'Kirill Lebedev']
|
8
|
+
s.email = ['camertron@gmail.com', 'echo.bjornd@gmail.com']
|
9
|
+
s.homepage = 'https://github.com/bjornd/jvectormap'
|
10
10
|
|
11
|
-
s.description = s.summary =
|
11
|
+
s.description = s.summary = 'jVectorMap for the Rails asset pipeline'
|
12
12
|
|
13
13
|
s.platform = Gem::Platform::RUBY
|
14
14
|
s.has_rdoc = true
|
15
15
|
|
16
|
-
s.add_dependency 'railties', '>= 3.1'
|
16
|
+
s.add_dependency 'railties', '>= 3.1'
|
17
17
|
|
18
18
|
s.require_path = 'lib'
|
19
|
-
s.files = Dir[
|
19
|
+
s.files = Dir['{lib,vendor,tasks}/**/*', 'Gemfile', 'History.txt', 'LICENSE', 'README.md', 'Rakefile', 'jvectormap-rails.gemspec']
|
20
20
|
end
|
data/lib/jvectormap-rails.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
|
1
|
+
require 'jvectormap/rails/engine'
|
2
2
|
|
3
3
|
module JVectorMap
|
4
4
|
module Rails
|
5
|
-
|
6
5
|
class << self
|
7
6
|
|
8
7
|
# maps that will be added to asset precompilation
|
@@ -11,16 +10,9 @@ module JVectorMap
|
|
11
10
|
end
|
12
11
|
|
13
12
|
def gem_root
|
14
|
-
File.expand_path(File.join(File.dirname(__FILE__),
|
13
|
+
File.expand_path(File.join(File.dirname(__FILE__), '../'))
|
15
14
|
end
|
16
15
|
|
17
16
|
end
|
18
|
-
|
19
17
|
end
|
20
18
|
end
|
21
|
-
|
22
|
-
require 'rails'
|
23
|
-
|
24
|
-
require 'jvectormap/rails/version'
|
25
|
-
require 'jvectormap/rails/engine'
|
26
|
-
require 'jvectormap/rails/railtie'
|
@@ -1,8 +1,17 @@
|
|
1
|
-
|
1
|
+
require 'rails'
|
2
2
|
|
3
3
|
module JVectorMap
|
4
4
|
module Rails
|
5
5
|
class Engine < ::Rails::Engine
|
6
|
+
rake_tasks do
|
7
|
+
load File.join(JVectorMap::Rails.gem_root, 'tasks/jvectormap.rake')
|
8
|
+
end
|
9
|
+
|
10
|
+
config.after_initialize do
|
11
|
+
::Rails.application.config.assets.precompile += JVectorMap::Rails.precompile_maps.map do |map_name|
|
12
|
+
"jvectormap/maps/#{map_name}.js"
|
13
|
+
end
|
14
|
+
end
|
6
15
|
end
|
7
16
|
end
|
8
|
-
end
|
17
|
+
end
|
data/tasks/jvectormap.rake
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
namespace :jvectormap do
|
2
2
|
task :maps do
|
3
|
-
path = File.expand_path(
|
4
|
-
|
3
|
+
path = File.expand_path(
|
4
|
+
File.join(File.dirname(__FILE__), '../vendor/assets/javascripts/jvectormap/maps/**')
|
5
|
+
)
|
6
|
+
|
7
|
+
puts Dir.glob(path).map { |file| File.basename(file).gsub(/\.js\z/, '') }.join("\r\n")
|
5
8
|
end
|
6
|
-
end
|
9
|
+
end
|
@@ -1,26 +1,33 @@
|
|
1
1
|
//= require jvectormap/jquery-jvectormap.js
|
2
|
-
//= require jvectormap/jquery-mousewheel.js
|
3
|
-
//= require jvectormap/
|
4
|
-
//= require jvectormap/
|
5
|
-
//= require jvectormap/
|
6
|
-
//= require jvectormap/
|
7
|
-
//= require jvectormap/
|
8
|
-
//= require jvectormap/
|
9
|
-
//= require jvectormap/
|
10
|
-
//= require jvectormap/
|
11
|
-
//= require jvectormap/
|
12
|
-
//= require jvectormap/
|
13
|
-
//= require jvectormap/
|
14
|
-
//= require jvectormap/
|
15
|
-
//= require jvectormap/
|
16
|
-
//= require jvectormap/
|
17
|
-
//= require jvectormap/
|
18
|
-
//= require jvectormap/
|
19
|
-
//= require jvectormap/
|
20
|
-
//= require jvectormap/
|
21
|
-
//= require jvectormap/
|
22
|
-
//= require jvectormap/
|
23
|
-
//= require jvectormap/
|
24
|
-
//= require jvectormap/
|
25
|
-
//= require jvectormap/
|
26
|
-
//= require jvectormap/
|
2
|
+
//= require jvectormap/lib/jquery-mousewheel.js
|
3
|
+
//= require jvectormap/src/jvectormap.js
|
4
|
+
//= require jvectormap/src/abstract-element.js
|
5
|
+
//= require jvectormap/src/abstract-canvas-element.js
|
6
|
+
//= require jvectormap/src/abstract-shape-element.js
|
7
|
+
//= require jvectormap/src/svg-element.js
|
8
|
+
//= require jvectormap/src/svg-group-element.js
|
9
|
+
//= require jvectormap/src/svg-canvas-element.js
|
10
|
+
//= require jvectormap/src/svg-shape-element.js
|
11
|
+
//= require jvectormap/src/svg-path-element.js
|
12
|
+
//= require jvectormap/src/svg-circle-element.js
|
13
|
+
//= require jvectormap/src/svg-image-element.js
|
14
|
+
//= require jvectormap/src/svg-text-element.js
|
15
|
+
//= require jvectormap/src/vml-element.js
|
16
|
+
//= require jvectormap/src/vml-group-element.js
|
17
|
+
//= require jvectormap/src/vml-canvas-element.js
|
18
|
+
//= require jvectormap/src/vml-shape-element.js
|
19
|
+
//= require jvectormap/src/vml-path-element.js
|
20
|
+
//= require jvectormap/src/vml-circle-element.js
|
21
|
+
//= require jvectormap/src/vector-canvas.js
|
22
|
+
//= require jvectormap/src/simple-scale.js
|
23
|
+
//= require jvectormap/src/ordinal-scale.js
|
24
|
+
//= require jvectormap/src/numeric-scale.js
|
25
|
+
//= require jvectormap/src/color-scale.js
|
26
|
+
//= require jvectormap/src/legend.js
|
27
|
+
//= require jvectormap/src/data-series.js
|
28
|
+
//= require jvectormap/src/proj.js
|
29
|
+
//= require jvectormap/src/map-object.js
|
30
|
+
//= require jvectormap/src/region.js
|
31
|
+
//= require jvectormap/src/marker.js
|
32
|
+
//= require jvectormap/src/map.js
|
33
|
+
//= require jvectormap/src/multimap.js
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
|
-
* jVectorMap version
|
2
|
+
* jVectorMap version 2.0.4
|
3
3
|
*
|
4
|
-
* Copyright 2011-
|
5
|
-
* Licensed under the MIT license.
|
4
|
+
* Copyright 2011-2014, Kirill Lebedev
|
6
5
|
*
|
7
6
|
*/
|
7
|
+
|
8
8
|
(function( $ ){
|
9
9
|
var apiParams = {
|
10
10
|
set: {
|
@@ -26,18 +26,17 @@
|
|
26
26
|
$.fn.vectorMap = function(options) {
|
27
27
|
var map,
|
28
28
|
methodName,
|
29
|
-
event,
|
30
29
|
map = this.children('.jvectormap-container').data('mapObject');
|
31
30
|
|
32
31
|
if (options === 'addMap') {
|
33
|
-
jvm.
|
32
|
+
jvm.Map.maps[arguments[1]] = arguments[2];
|
34
33
|
} else if ((options === 'set' || options === 'get') && apiParams[options][arguments[1]]) {
|
35
34
|
methodName = arguments[1].charAt(0).toUpperCase()+arguments[1].substr(1);
|
36
35
|
return map[options+methodName].apply(map, Array.prototype.slice.call(arguments, 2));
|
37
36
|
} else {
|
38
37
|
options = options || {};
|
39
38
|
options.container = this;
|
40
|
-
map = new jvm.
|
39
|
+
map = new jvm.Map(options);
|
41
40
|
}
|
42
41
|
|
43
42
|
return this;
|
@@ -0,0 +1,201 @@
|
|
1
|
+
/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
|
2
|
+
* Licensed under the MIT License (LICENSE.txt).
|
3
|
+
*
|
4
|
+
* Version: 3.1.9
|
5
|
+
*
|
6
|
+
* Requires: jQuery 1.2.2+
|
7
|
+
*/
|
8
|
+
|
9
|
+
(function (factory) {
|
10
|
+
if ( typeof define === 'function' && define.amd ) {
|
11
|
+
// AMD. Register as an anonymous module.
|
12
|
+
define(['jquery'], factory);
|
13
|
+
} else if (typeof exports === 'object') {
|
14
|
+
// Node/CommonJS style for Browserify
|
15
|
+
module.exports = factory;
|
16
|
+
} else {
|
17
|
+
// Browser globals
|
18
|
+
factory(jQuery);
|
19
|
+
}
|
20
|
+
}(function ($) {
|
21
|
+
|
22
|
+
var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
|
23
|
+
toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
|
24
|
+
['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
|
25
|
+
slice = Array.prototype.slice,
|
26
|
+
nullLowestDeltaTimeout, lowestDelta;
|
27
|
+
|
28
|
+
if ( $.event.fixHooks ) {
|
29
|
+
for ( var i = toFix.length; i; ) {
|
30
|
+
$.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
var special = $.event.special.mousewheel = {
|
35
|
+
version: '3.1.9',
|
36
|
+
|
37
|
+
setup: function() {
|
38
|
+
if ( this.addEventListener ) {
|
39
|
+
for ( var i = toBind.length; i; ) {
|
40
|
+
this.addEventListener( toBind[--i], handler, false );
|
41
|
+
}
|
42
|
+
} else {
|
43
|
+
this.onmousewheel = handler;
|
44
|
+
}
|
45
|
+
// Store the line height and page height for this particular element
|
46
|
+
$.data(this, 'mousewheel-line-height', special.getLineHeight(this));
|
47
|
+
$.data(this, 'mousewheel-page-height', special.getPageHeight(this));
|
48
|
+
},
|
49
|
+
|
50
|
+
teardown: function() {
|
51
|
+
if ( this.removeEventListener ) {
|
52
|
+
for ( var i = toBind.length; i; ) {
|
53
|
+
this.removeEventListener( toBind[--i], handler, false );
|
54
|
+
}
|
55
|
+
} else {
|
56
|
+
this.onmousewheel = null;
|
57
|
+
}
|
58
|
+
},
|
59
|
+
|
60
|
+
getLineHeight: function(elem) {
|
61
|
+
return parseInt($(elem)['offsetParent' in $.fn ? 'offsetParent' : 'parent']().css('fontSize'), 10);
|
62
|
+
},
|
63
|
+
|
64
|
+
getPageHeight: function(elem) {
|
65
|
+
return $(elem).height();
|
66
|
+
},
|
67
|
+
|
68
|
+
settings: {
|
69
|
+
adjustOldDeltas: true
|
70
|
+
}
|
71
|
+
};
|
72
|
+
|
73
|
+
$.fn.extend({
|
74
|
+
mousewheel: function(fn) {
|
75
|
+
return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
|
76
|
+
},
|
77
|
+
|
78
|
+
unmousewheel: function(fn) {
|
79
|
+
return this.unbind('mousewheel', fn);
|
80
|
+
}
|
81
|
+
});
|
82
|
+
|
83
|
+
|
84
|
+
function handler(event) {
|
85
|
+
var orgEvent = event || window.event,
|
86
|
+
args = slice.call(arguments, 1),
|
87
|
+
delta = 0,
|
88
|
+
deltaX = 0,
|
89
|
+
deltaY = 0,
|
90
|
+
absDelta = 0;
|
91
|
+
event = $.event.fix(orgEvent);
|
92
|
+
event.type = 'mousewheel';
|
93
|
+
|
94
|
+
// Old school scrollwheel delta
|
95
|
+
if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
|
96
|
+
if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
|
97
|
+
if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
|
98
|
+
if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
|
99
|
+
|
100
|
+
// Firefox < 17 horizontal scrolling related to DOMMouseScroll event
|
101
|
+
if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
|
102
|
+
deltaX = deltaY * -1;
|
103
|
+
deltaY = 0;
|
104
|
+
}
|
105
|
+
|
106
|
+
// Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
|
107
|
+
delta = deltaY === 0 ? deltaX : deltaY;
|
108
|
+
|
109
|
+
// New school wheel delta (wheel event)
|
110
|
+
if ( 'deltaY' in orgEvent ) {
|
111
|
+
deltaY = orgEvent.deltaY * -1;
|
112
|
+
delta = deltaY;
|
113
|
+
}
|
114
|
+
if ( 'deltaX' in orgEvent ) {
|
115
|
+
deltaX = orgEvent.deltaX;
|
116
|
+
if ( deltaY === 0 ) { delta = deltaX * -1; }
|
117
|
+
}
|
118
|
+
|
119
|
+
// No change actually happened, no reason to go any further
|
120
|
+
if ( deltaY === 0 && deltaX === 0 ) { return; }
|
121
|
+
|
122
|
+
// Need to convert lines and pages to pixels if we aren't already in pixels
|
123
|
+
// There are three delta modes:
|
124
|
+
// * deltaMode 0 is by pixels, nothing to do
|
125
|
+
// * deltaMode 1 is by lines
|
126
|
+
// * deltaMode 2 is by pages
|
127
|
+
if ( orgEvent.deltaMode === 1 ) {
|
128
|
+
var lineHeight = $.data(this, 'mousewheel-line-height');
|
129
|
+
delta *= lineHeight;
|
130
|
+
deltaY *= lineHeight;
|
131
|
+
deltaX *= lineHeight;
|
132
|
+
} else if ( orgEvent.deltaMode === 2 ) {
|
133
|
+
var pageHeight = $.data(this, 'mousewheel-page-height');
|
134
|
+
delta *= pageHeight;
|
135
|
+
deltaY *= pageHeight;
|
136
|
+
deltaX *= pageHeight;
|
137
|
+
}
|
138
|
+
|
139
|
+
// Store lowest absolute delta to normalize the delta values
|
140
|
+
absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
|
141
|
+
|
142
|
+
if ( !lowestDelta || absDelta < lowestDelta ) {
|
143
|
+
lowestDelta = absDelta;
|
144
|
+
|
145
|
+
// Adjust older deltas if necessary
|
146
|
+
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
|
147
|
+
lowestDelta /= 40;
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
// Adjust older deltas if necessary
|
152
|
+
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
|
153
|
+
// Divide all the things by 40!
|
154
|
+
delta /= 40;
|
155
|
+
deltaX /= 40;
|
156
|
+
deltaY /= 40;
|
157
|
+
}
|
158
|
+
|
159
|
+
// Get a whole, normalized value for the deltas
|
160
|
+
delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
|
161
|
+
deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
|
162
|
+
deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
|
163
|
+
|
164
|
+
// Add information to the event object
|
165
|
+
event.deltaX = deltaX;
|
166
|
+
event.deltaY = deltaY;
|
167
|
+
event.deltaFactor = lowestDelta;
|
168
|
+
// Go ahead and set deltaMode to 0 since we converted to pixels
|
169
|
+
// Although this is a little odd since we overwrite the deltaX/Y
|
170
|
+
// properties with normalized deltas.
|
171
|
+
event.deltaMode = 0;
|
172
|
+
|
173
|
+
// Add event and delta to the front of the arguments
|
174
|
+
args.unshift(event, delta, deltaX, deltaY);
|
175
|
+
|
176
|
+
// Clearout lowestDelta after sometime to better
|
177
|
+
// handle multiple device types that give different
|
178
|
+
// a different lowestDelta
|
179
|
+
// Ex: trackpad = 3 and mouse wheel = 120
|
180
|
+
if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
|
181
|
+
nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
|
182
|
+
|
183
|
+
return ($.event.dispatch || $.event.handle).apply(this, args);
|
184
|
+
}
|
185
|
+
|
186
|
+
function nullLowestDelta() {
|
187
|
+
lowestDelta = null;
|
188
|
+
}
|
189
|
+
|
190
|
+
function shouldAdjustOldDeltas(orgEvent, absDelta) {
|
191
|
+
// If this is an older event and the delta is divisable by 120,
|
192
|
+
// then we are assuming that the browser is treating this as an
|
193
|
+
// older mouse wheel event and that we should divide the deltas
|
194
|
+
// by 40 to try and get a more usable deltaFactor.
|
195
|
+
// Side note, this actually impacts the reported scroll distance
|
196
|
+
// in older browsers and can cause scrolling to be slower than native.
|
197
|
+
// Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
|
198
|
+
return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
|
199
|
+
}
|
200
|
+
|
201
|
+
}));
|