|
1
|
|
|
'use strict'; |
|
2
|
|
|
// Node search polyfill for mobile browsers and IE |
|
3
|
|
|
if (!String.prototype.includes) { |
|
4
|
|
|
String.prototype.includes = function () { |
|
5
|
|
|
return String.prototype.indexOf.apply(this, arguments) !== -1; |
|
6
|
|
|
}; |
|
7
|
|
|
} |
|
8
|
|
|
|
|
9
|
|
|
if (!String.prototype.startsWith) { |
|
10
|
|
|
String.prototype.startsWith = function (searchString, position) { |
|
11
|
|
|
position = position || 0; |
|
12
|
|
|
return this.substr(position, searchString.length) === searchString; |
|
13
|
|
|
}; |
|
14
|
|
|
} |
|
15
|
|
|
if (!String.prototype.repeat) { |
|
16
|
|
|
String.prototype.repeat = function (count) { |
|
17
|
|
|
'use strict'; |
|
18
|
|
|
if (this === null) { |
|
19
|
|
|
throw new TypeError('can\'t convert ' + this + ' to object'); |
|
20
|
|
|
} |
|
21
|
|
|
var str = '' + this; |
|
22
|
|
|
count = +count; |
|
23
|
|
|
|
|
24
|
|
|
count = Math.floor(count); |
|
25
|
|
|
if (str.length === 0 || count === 0) { |
|
26
|
|
|
return ''; |
|
27
|
|
|
} |
|
28
|
|
|
// Ensuring count is a 31-bit integer allows us to heavily optimize the |
|
29
|
|
|
// main part. But anyway, most current (August 2014) browsers can't handle |
|
30
|
|
|
// strings 1 << 28 chars or longer, so: |
|
31
|
|
|
if (str.length * count >= 1 << 28) { |
|
32
|
|
|
throw new RangeError('repeat count must not overflow maximum string size'); |
|
33
|
|
|
} |
|
34
|
|
|
var rpt = ''; |
|
35
|
|
|
for (; ;) { |
|
36
|
|
|
if ((count & 1) === 1) { |
|
37
|
|
|
rpt += str; |
|
38
|
|
|
} |
|
39
|
|
|
count >>>= 1; |
|
40
|
|
|
if (count === 0) { |
|
41
|
|
|
break; |
|
42
|
|
|
} |
|
43
|
|
|
str += str; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
return rpt; |
|
47
|
|
|
}; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
require.config({ |
|
51
|
|
|
baseUrl: 'lib', |
|
52
|
|
|
paths: { |
|
53
|
|
|
'polyglot': '../node_modules/node-polyglot/build/polyglot', |
|
54
|
|
|
'Navigo': '../node_modules/navigo/lib/navigo', |
|
55
|
|
|
'leaflet': '../node_modules/leaflet/dist/leaflet', |
|
56
|
|
|
'moment': '../node_modules/moment/moment', |
|
57
|
|
|
// d3 modules indirect dependencies |
|
58
|
|
|
// by d3-zoom: d3-drag |
|
59
|
|
|
'd3-ease': '../node_modules/d3-ease/build/d3-ease', |
|
60
|
|
|
'd3-transition': '../node_modules/d3-transition/build/d3-transition', |
|
61
|
|
|
'd3-color': '../node_modules/d3-color/build/d3-color', |
|
62
|
|
|
'd3-interpolate': '../node_modules/d3-interpolate/build/d3-interpolate', |
|
63
|
|
|
// by d3-force |
|
64
|
|
|
'd3-collection': '../node_modules/d3-collection/build/d3-collection', |
|
65
|
|
|
'd3-dispatch': '../node_modules/d3-dispatch/build/d3-dispatch', |
|
66
|
|
|
'd3-quadtree': '../node_modules/d3-quadtree/build/d3-quadtree', |
|
67
|
|
|
'd3-timer': '../node_modules/d3-timer/build/d3-timer', |
|
68
|
|
|
// by d3-drag: d3-selection |
|
69
|
|
|
// d3 modules dependencies |
|
70
|
|
|
'd3-selection': '../node_modules/d3-selection/build/d3-selection', |
|
71
|
|
|
'd3-force': '../node_modules/d3-force/build/d3-force', |
|
72
|
|
|
'd3-zoom': '../node_modules/d3-zoom/build/d3-zoom', |
|
73
|
|
|
'd3-drag': '../node_modules/d3-drag/build/d3-drag', |
|
74
|
|
|
'snabbdom': '../node_modules/snabbdom/dist/snabbdom-patch', |
|
75
|
|
|
'rbush': '../node_modules/rbush/rbush', |
|
76
|
|
|
'helper': 'utils/helper' |
|
77
|
|
|
}, |
|
78
|
|
|
shim: { |
|
79
|
|
|
'd3-drag': ['d3-selection'], |
|
80
|
|
|
'd3-force': ['d3-collection', 'd3-dispatch', 'd3-quadtree', 'd3-timer'], |
|
81
|
|
|
'd3-interpolate': ['d3-color'], |
|
82
|
|
|
'd3-zoom': ['d3-drag', 'd3-ease', 'd3-transition', 'd3-interpolate'] |
|
83
|
|
|
} |
|
84
|
|
|
}); |
|
85
|
|
|
|
|
86
|
|
|
require(['main'], function (main) { |
|
87
|
|
|
main(jsonData); |
|
88
|
|
|
}); |
|
89
|
|
|
|