active_frontend 12.2.0 → 12.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/fonts/gotham/gotham-bold.woff +0 -0
- data/app/assets/fonts/gotham/gotham-book.woff +0 -0
- data/app/assets/fonts/gotham/gotham-light.woff +0 -0
- data/app/assets/fonts/gotham/gotham-medium.woff +0 -0
- data/app/assets/fonts/gotham/gotham-rounded-bold.woff +0 -0
- data/app/assets/fonts/gotham/gotham-rounded-book.woff +0 -0
- data/app/assets/fonts/gotham/gotham-rounded-light.woff +0 -0
- data/app/assets/fonts/gotham/gotham-rounded-medium.woff +0 -0
- data/lib/active_frontend/version.rb +1 -1
- data/vendor/assets/javascripts/_affix.js +4 -4
- data/vendor/assets/javascripts/_alert.js +1 -1
- data/vendor/assets/javascripts/_animation.js +14 -14
- data/vendor/assets/javascripts/_button.js +1 -1
- data/vendor/assets/javascripts/_carousel.js +5 -5
- data/vendor/assets/javascripts/_chart.js +713 -280
- data/vendor/assets/javascripts/_collapse.js +6 -6
- data/vendor/assets/javascripts/_dropdown.js +47 -43
- data/vendor/assets/javascripts/_inputmask.js +6 -4
- data/vendor/assets/javascripts/_map.js +136 -88
- data/vendor/assets/javascripts/_modal.js +136 -42
- data/vendor/assets/javascripts/_popover.js +2 -7
- data/vendor/assets/javascripts/_scrollspy.js +16 -19
- data/vendor/assets/javascripts/_slider.js +156 -85
- data/vendor/assets/javascripts/_tab.js +5 -3
- data/vendor/assets/javascripts/_tooltip.js +73 -31
- data/vendor/assets/stylesheets/_header.scss +3 -1
- data/vendor/assets/stylesheets/_typography.scss +8 -40
- metadata +10 -34
- data/app/assets/fonts/gotham/regular/gotham-bold.eot +0 -0
- data/app/assets/fonts/gotham/regular/gotham-bold.svg +0 -2066
- data/app/assets/fonts/gotham/regular/gotham-bold.ttf +0 -0
- data/app/assets/fonts/gotham/regular/gotham-bold.woff +0 -0
- data/app/assets/fonts/gotham/regular/gotham-book.eot +0 -0
- data/app/assets/fonts/gotham/regular/gotham-book.svg +0 -631
- data/app/assets/fonts/gotham/regular/gotham-book.ttf +0 -0
- data/app/assets/fonts/gotham/regular/gotham-book.woff +0 -0
- data/app/assets/fonts/gotham/regular/gotham-light.eot +0 -0
- data/app/assets/fonts/gotham/regular/gotham-light.svg +0 -635
- data/app/assets/fonts/gotham/regular/gotham-light.ttf +0 -0
- data/app/assets/fonts/gotham/regular/gotham-light.woff +0 -0
- data/app/assets/fonts/gotham/regular/gotham-medium.eot +0 -0
- data/app/assets/fonts/gotham/regular/gotham-medium.svg +0 -629
- data/app/assets/fonts/gotham/regular/gotham-medium.ttf +0 -0
- data/app/assets/fonts/gotham/regular/gotham-medium.woff +0 -0
- data/app/assets/fonts/gotham/round/gothamrnd-bold.eot +0 -0
- data/app/assets/fonts/gotham/round/gothamrnd-bold.svg +0 -3528
- data/app/assets/fonts/gotham/round/gothamrnd-bold.ttf +0 -0
- data/app/assets/fonts/gotham/round/gothamrnd-bold.woff +0 -0
- data/app/assets/fonts/gotham/round/gothamrnd-book.eot +0 -0
- data/app/assets/fonts/gotham/round/gothamrnd-book.svg +0 -3654
- data/app/assets/fonts/gotham/round/gothamrnd-book.ttf +0 -0
- data/app/assets/fonts/gotham/round/gothamrnd-book.woff +0 -0
- data/app/assets/fonts/gotham/round/gothamrnd-light.eot +0 -0
- data/app/assets/fonts/gotham/round/gothamrnd-light.svg +0 -3503
- data/app/assets/fonts/gotham/round/gothamrnd-light.ttf +0 -0
- data/app/assets/fonts/gotham/round/gothamrnd-light.woff +0 -0
- data/app/assets/fonts/gotham/round/gothamrnd-medium.eot +0 -0
- data/app/assets/fonts/gotham/round/gothamrnd-medium.svg +0 -3659
- data/app/assets/fonts/gotham/round/gothamrnd-medium.ttf +0 -0
- data/app/assets/fonts/gotham/round/gothamrnd-medium.woff +0 -0
@@ -7,7 +7,8 @@
|
|
7
7
|
var Collapse = function (element, options) {
|
8
8
|
this.$element = $(element)
|
9
9
|
this.options = $.extend({}, Collapse.DEFAULTS, options)
|
10
|
-
this.$trigger = $(
|
10
|
+
this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
|
11
|
+
'[data-toggle="collapse"][data-target="#' + element.id + '"]')
|
11
12
|
this.transitioning = null
|
12
13
|
|
13
14
|
if (this.options.parent) {
|
@@ -19,13 +20,12 @@
|
|
19
20
|
if (this.options.toggle) this.toggle()
|
20
21
|
}
|
21
22
|
|
22
|
-
Collapse.VERSION = '3.3.
|
23
|
+
Collapse.VERSION = '3.3.6'
|
23
24
|
|
24
25
|
Collapse.TRANSITION_DURATION = 350
|
25
26
|
|
26
27
|
Collapse.DEFAULTS = {
|
27
|
-
toggle: true
|
28
|
-
trigger: '[data-toggle="collapse"]'
|
28
|
+
toggle: true
|
29
29
|
}
|
30
30
|
|
31
31
|
Collapse.prototype.dimension = function () {
|
@@ -163,7 +163,7 @@
|
|
163
163
|
var data = $this.data('bs.collapse')
|
164
164
|
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
165
165
|
|
166
|
-
if (!data && options.toggle && option
|
166
|
+
if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
|
167
167
|
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
|
168
168
|
if (typeof option == 'string') data[option]()
|
169
169
|
})
|
@@ -194,7 +194,7 @@
|
|
194
194
|
|
195
195
|
var $target = getTargetFromTrigger($this)
|
196
196
|
var data = $target.data('bs.collapse')
|
197
|
-
var option = data ? 'toggle' :
|
197
|
+
var option = data ? 'toggle' : $this.data()
|
198
198
|
|
199
199
|
Plugin.call($target, option)
|
200
200
|
})
|
@@ -10,7 +10,41 @@
|
|
10
10
|
$(element).on('click.bs.dropdown', this.toggle)
|
11
11
|
}
|
12
12
|
|
13
|
-
Dropdown.VERSION = '3.3.
|
13
|
+
Dropdown.VERSION = '3.3.6'
|
14
|
+
|
15
|
+
function getParent($this) {
|
16
|
+
var selector = $this.attr('data-target')
|
17
|
+
|
18
|
+
if (!selector) {
|
19
|
+
selector = $this.attr('href')
|
20
|
+
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
|
21
|
+
}
|
22
|
+
|
23
|
+
var $parent = selector && $(selector)
|
24
|
+
|
25
|
+
return $parent && $parent.length ? $parent : $this.parent()
|
26
|
+
}
|
27
|
+
|
28
|
+
function clearMenus(e) {
|
29
|
+
if (e && e.which === 3) return
|
30
|
+
$(backdrop).remove()
|
31
|
+
$(toggle).each(function () {
|
32
|
+
var $this = $(this)
|
33
|
+
var $parent = getParent($this)
|
34
|
+
var relatedTarget = { relatedTarget: this }
|
35
|
+
|
36
|
+
if (!$parent.hasClass('open')) return
|
37
|
+
|
38
|
+
if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
|
39
|
+
|
40
|
+
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
|
41
|
+
|
42
|
+
if (e.isDefaultPrevented()) return
|
43
|
+
|
44
|
+
$this.attr('aria-expanded', 'false')
|
45
|
+
$parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
|
46
|
+
})
|
47
|
+
}
|
14
48
|
|
15
49
|
Dropdown.prototype.toggle = function (e) {
|
16
50
|
var $this = $(this)
|
@@ -25,7 +59,10 @@
|
|
25
59
|
if (!isActive) {
|
26
60
|
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
|
27
61
|
// if mobile we use a backdrop because click events don't delegate
|
28
|
-
$('
|
62
|
+
$(document.createElement('div'))
|
63
|
+
.addClass('dropdown-backdrop')
|
64
|
+
.insertAfter($(this))
|
65
|
+
.on('click', clearMenus)
|
29
66
|
}
|
30
67
|
|
31
68
|
var relatedTarget = { relatedTarget: this }
|
@@ -39,7 +76,7 @@
|
|
39
76
|
|
40
77
|
$parent
|
41
78
|
.toggleClass('open')
|
42
|
-
.trigger('shown.bs.dropdown', relatedTarget)
|
79
|
+
.trigger($.Event('shown.bs.dropdown', relatedTarget))
|
43
80
|
}
|
44
81
|
|
45
82
|
return false
|
@@ -58,57 +95,25 @@
|
|
58
95
|
var $parent = getParent($this)
|
59
96
|
var isActive = $parent.hasClass('open')
|
60
97
|
|
61
|
-
if (
|
98
|
+
if (!isActive && e.which != 27 || isActive && e.which == 27) {
|
62
99
|
if (e.which == 27) $parent.find(toggle).trigger('focus')
|
63
100
|
return $this.trigger('click')
|
64
101
|
}
|
65
102
|
|
66
|
-
var desc = ' li:not(.
|
67
|
-
var $items = $parent.find('
|
103
|
+
var desc = ' li:not(.disabled):visible a'
|
104
|
+
var $items = $parent.find('.dropdown-menu' + desc)
|
68
105
|
|
69
106
|
if (!$items.length) return
|
70
107
|
|
71
108
|
var index = $items.index(e.target)
|
72
109
|
|
73
|
-
if (e.which == 38 && index > 0) index--
|
74
|
-
if (e.which == 40 && index < $items.length - 1) index++
|
75
|
-
if (!~index)
|
110
|
+
if (e.which == 38 && index > 0) index-- // up
|
111
|
+
if (e.which == 40 && index < $items.length - 1) index++ // down
|
112
|
+
if (!~index) index = 0
|
76
113
|
|
77
114
|
$items.eq(index).trigger('focus')
|
78
115
|
}
|
79
116
|
|
80
|
-
function clearMenus(e) {
|
81
|
-
if (e && e.which === 3) return
|
82
|
-
$(backdrop).remove()
|
83
|
-
$(toggle).each(function () {
|
84
|
-
var $this = $(this)
|
85
|
-
var $parent = getParent($this)
|
86
|
-
var relatedTarget = { relatedTarget: this }
|
87
|
-
|
88
|
-
if (!$parent.hasClass('open')) return
|
89
|
-
|
90
|
-
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
|
91
|
-
|
92
|
-
if (e.isDefaultPrevented()) return
|
93
|
-
|
94
|
-
$this.attr('aria-expanded', 'false')
|
95
|
-
$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
|
96
|
-
})
|
97
|
-
}
|
98
|
-
|
99
|
-
function getParent($this) {
|
100
|
-
var selector = $this.attr('data-target')
|
101
|
-
|
102
|
-
if (!selector) {
|
103
|
-
selector = $this.attr('href')
|
104
|
-
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
|
105
|
-
}
|
106
|
-
|
107
|
-
var $parent = selector && $(selector)
|
108
|
-
|
109
|
-
return $parent && $parent.length ? $parent : $this.parent()
|
110
|
-
}
|
111
|
-
|
112
117
|
|
113
118
|
// DROPDOWN PLUGIN DEFINITION
|
114
119
|
// ==========================
|
@@ -146,7 +151,6 @@
|
|
146
151
|
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
147
152
|
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
|
148
153
|
.on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
|
149
|
-
.on('keydown.bs.dropdown.data-api', '
|
150
|
-
.on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown)
|
154
|
+
.on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
|
151
155
|
|
152
156
|
}(jQuery);
|
@@ -68,7 +68,7 @@
|
|
68
68
|
Inputmask.prototype.listen = function() {
|
69
69
|
if (this.$element.attr("readonly")) return
|
70
70
|
|
71
|
-
var pasteEventName = (isIE ? 'paste' : 'input') + ".
|
71
|
+
var pasteEventName = (isIE ? 'paste' : 'input') + ".bs.inputmask"
|
72
72
|
|
73
73
|
this.$element
|
74
74
|
.on("unmask.bs.inputmask", $.proxy(this.unmask, this))
|
@@ -164,8 +164,8 @@
|
|
164
164
|
|
165
165
|
Inputmask.prototype.unmask = function() {
|
166
166
|
this.$element
|
167
|
-
.unbind(".
|
168
|
-
.removeData("inputmask")
|
167
|
+
.unbind(".bs.inputmask")
|
168
|
+
.removeData("bs.inputmask")
|
169
169
|
}
|
170
170
|
|
171
171
|
Inputmask.prototype.focusEvent = function() {
|
@@ -188,8 +188,10 @@
|
|
188
188
|
|
189
189
|
Inputmask.prototype.blurEvent = function() {
|
190
190
|
this.checkVal()
|
191
|
-
if (this.$element.val() !== this.focusText)
|
191
|
+
if (this.$element.val() !== this.focusText) {
|
192
192
|
this.$element.trigger('change')
|
193
|
+
this.$element.trigger('input')
|
194
|
+
}
|
193
195
|
}
|
194
196
|
|
195
197
|
Inputmask.prototype.keydownEvent = function(e) {
|
@@ -13,10 +13,6 @@
|
|
13
13
|
|
14
14
|
}(this, function() {
|
15
15
|
|
16
|
-
if (!(typeof window.google === 'object' && window.google.maps)) {
|
17
|
-
throw 'Google Maps API is required. Please register the following JavaScript library http://maps.google.com/maps/api/js?sensor=true.'
|
18
|
-
}
|
19
|
-
|
20
16
|
var extend_object = function(obj, new_obj) {
|
21
17
|
var name;
|
22
18
|
|
@@ -25,7 +21,9 @@ var extend_object = function(obj, new_obj) {
|
|
25
21
|
}
|
26
22
|
|
27
23
|
for (name in new_obj) {
|
28
|
-
|
24
|
+
if (new_obj[name] !== undefined) {
|
25
|
+
obj[name] = new_obj[name];
|
26
|
+
}
|
29
27
|
}
|
30
28
|
|
31
29
|
return obj;
|
@@ -112,9 +110,7 @@ var arrayToLatLng = function(coords, useGeoJSON) {
|
|
112
110
|
return coords;
|
113
111
|
};
|
114
112
|
|
115
|
-
|
116
113
|
var getElementsByClassName = function (class_name, context) {
|
117
|
-
|
118
114
|
var element,
|
119
115
|
_class = class_name.replace('.', '');
|
120
116
|
|
@@ -160,6 +156,15 @@ var GMaps = (function(global) {
|
|
160
156
|
var doc = document;
|
161
157
|
|
162
158
|
var GMaps = function(options) {
|
159
|
+
|
160
|
+
if (!(typeof window.google === 'object' && window.google.maps)) {
|
161
|
+
if (typeof window.console === 'object' && window.console.error) {
|
162
|
+
console.error('Google Maps API is required. Please register the following JavaScript library https://maps.googleapis.com/maps/api/js.');
|
163
|
+
}
|
164
|
+
|
165
|
+
return function() {};
|
166
|
+
}
|
167
|
+
|
163
168
|
if (!this) return new GMaps(options);
|
164
169
|
|
165
170
|
options.zoom = options.zoom || 15;
|
@@ -214,13 +219,11 @@ var GMaps = (function(global) {
|
|
214
219
|
};
|
215
220
|
|
216
221
|
if (typeof(options.el) === 'string' || typeof(options.div) === 'string') {
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
}
|
223
|
-
|
222
|
+
if (identifier.indexOf("#") > -1) {
|
223
|
+
this.el = getElementById(identifier, options.context);
|
224
|
+
} else {
|
225
|
+
this.el = getElementsByClassName.apply(this, [identifier, options.context]);
|
226
|
+
}
|
224
227
|
} else {
|
225
228
|
this.el = identifier;
|
226
229
|
}
|
@@ -1366,7 +1369,7 @@ GMaps.prototype.getRoutes = function(options) {
|
|
1366
1369
|
}
|
1367
1370
|
|
1368
1371
|
if (options.callback) {
|
1369
|
-
options.callback(self.routes);
|
1372
|
+
options.callback(self.routes, result, status);
|
1370
1373
|
}
|
1371
1374
|
}
|
1372
1375
|
else {
|
@@ -1378,7 +1381,7 @@ GMaps.prototype.getRoutes = function(options) {
|
|
1378
1381
|
};
|
1379
1382
|
|
1380
1383
|
GMaps.prototype.removeRoutes = function() {
|
1381
|
-
this.routes =
|
1384
|
+
this.routes.length = 0;
|
1382
1385
|
};
|
1383
1386
|
|
1384
1387
|
GMaps.prototype.getElevations = function(options) {
|
@@ -1426,6 +1429,35 @@ GMaps.prototype.getElevations = function(options) {
|
|
1426
1429
|
|
1427
1430
|
GMaps.prototype.cleanRoute = GMaps.prototype.removePolylines;
|
1428
1431
|
|
1432
|
+
GMaps.prototype.renderRoute = function(options, renderOptions) {
|
1433
|
+
var self = this,
|
1434
|
+
panel = ((typeof renderOptions.panel === 'string') ? document.getElementById(renderOptions.panel.replace('#', '')) : renderOptions.panel),
|
1435
|
+
display;
|
1436
|
+
|
1437
|
+
renderOptions.panel = panel;
|
1438
|
+
renderOptions = extend_object({
|
1439
|
+
map: this.map
|
1440
|
+
}, renderOptions);
|
1441
|
+
display = new google.maps.DirectionsRenderer(renderOptions);
|
1442
|
+
|
1443
|
+
this.getRoutes({
|
1444
|
+
origin: options.origin,
|
1445
|
+
destination: options.destination,
|
1446
|
+
travelMode: options.travelMode,
|
1447
|
+
waypoints: options.waypoints,
|
1448
|
+
unitSystem: options.unitSystem,
|
1449
|
+
error: options.error,
|
1450
|
+
avoidHighways: options.avoidHighways,
|
1451
|
+
avoidTolls: options.avoidTolls,
|
1452
|
+
optimizeWaypoints: options.optimizeWaypoints,
|
1453
|
+
callback: function(routes, response, status) {
|
1454
|
+
if (status === google.maps.DirectionsStatus.OK) {
|
1455
|
+
display.setDirections(response);
|
1456
|
+
}
|
1457
|
+
}
|
1458
|
+
});
|
1459
|
+
};
|
1460
|
+
|
1429
1461
|
GMaps.prototype.drawRoute = function(options) {
|
1430
1462
|
var self = this;
|
1431
1463
|
|
@@ -1436,10 +1468,13 @@ GMaps.prototype.drawRoute = function(options) {
|
|
1436
1468
|
waypoints: options.waypoints,
|
1437
1469
|
unitSystem: options.unitSystem,
|
1438
1470
|
error: options.error,
|
1439
|
-
|
1440
|
-
|
1471
|
+
avoidHighways: options.avoidHighways,
|
1472
|
+
avoidTolls: options.avoidTolls,
|
1473
|
+
optimizeWaypoints: options.optimizeWaypoints,
|
1474
|
+
callback: function(routes) {
|
1475
|
+
if (routes.length > 0) {
|
1441
1476
|
var polyline_options = {
|
1442
|
-
path:
|
1477
|
+
path: routes[routes.length - 1].overview_path,
|
1443
1478
|
strokeColor: options.strokeColor,
|
1444
1479
|
strokeOpacity: options.strokeOpacity,
|
1445
1480
|
strokeWeight: options.strokeWeight
|
@@ -1452,7 +1487,7 @@ GMaps.prototype.drawRoute = function(options) {
|
|
1452
1487
|
self.drawPolyline(polyline_options);
|
1453
1488
|
|
1454
1489
|
if (options.callback) {
|
1455
|
-
options.callback(
|
1490
|
+
options.callback(routes[routes.length - 1]);
|
1456
1491
|
}
|
1457
1492
|
}
|
1458
1493
|
}
|
@@ -1852,7 +1887,7 @@ GMaps.staticMapURL = function(options){
|
|
1852
1887
|
opacity = parseFloat(opacity);
|
1853
1888
|
opacity = Math.min(1, Math.max(opacity, 0));
|
1854
1889
|
if (opacity === 0) {
|
1855
|
-
return '
|
1890
|
+
return '0x00000000';
|
1856
1891
|
}
|
1857
1892
|
opacity = (opacity * 255).toString(16);
|
1858
1893
|
if (opacity.length === 1) {
|
@@ -1998,6 +2033,10 @@ GMaps.prototype.off = function(event_name) {
|
|
1998
2033
|
GMaps.off(event_name, this);
|
1999
2034
|
};
|
2000
2035
|
|
2036
|
+
GMaps.prototype.once = function(event_name, handler) {
|
2037
|
+
return GMaps.once(event_name, this, handler);
|
2038
|
+
};
|
2039
|
+
|
2001
2040
|
GMaps.custom_events = ['marker_added', 'marker_removed', 'polyline_added', 'polyline_removed', 'polygon_added', 'polygon_removed', 'geolocated', 'geolocation_failed'];
|
2002
2041
|
|
2003
2042
|
GMaps.on = function(event_name, object, handler) {
|
@@ -2028,6 +2067,13 @@ GMaps.off = function(event_name, object) {
|
|
2028
2067
|
}
|
2029
2068
|
};
|
2030
2069
|
|
2070
|
+
GMaps.once = function(event_name, object, handler) {
|
2071
|
+
if (GMaps.custom_events.indexOf(event_name) == -1) {
|
2072
|
+
if(object instanceof GMaps) object = object.map;
|
2073
|
+
return google.maps.event.addListenerOnce(object, event_name, handler);
|
2074
|
+
}
|
2075
|
+
};
|
2076
|
+
|
2031
2077
|
GMaps.fire = function(event_name, object, scope) {
|
2032
2078
|
if (GMaps.custom_events.indexOf(event_name) == -1) {
|
2033
2079
|
google.maps.event.trigger(object, event_name, Array.prototype.slice.apply(arguments).slice(2));
|
@@ -2088,91 +2134,93 @@ GMaps.geocode = function(options) {
|
|
2088
2134
|
});
|
2089
2135
|
};
|
2090
2136
|
|
2091
|
-
|
2092
|
-
|
2093
|
-
//
|
2094
|
-
//
|
2095
|
-
//
|
2096
|
-
|
2097
|
-
google.maps.Polygon.prototype.getBounds
|
2098
|
-
|
2099
|
-
|
2100
|
-
|
2101
|
-
|
2102
|
-
|
2103
|
-
|
2104
|
-
|
2105
|
-
|
2137
|
+
if (typeof window.google === 'object' && window.google.maps) {
|
2138
|
+
//==========================
|
2139
|
+
// Polygon containsLatLng
|
2140
|
+
// https://github.com/tparkin/Google-Maps-Point-in-Polygon
|
2141
|
+
// Poygon getBounds extension - google-maps-extensions
|
2142
|
+
// http://code.google.com/p/google-maps-extensions/source/browse/google.maps.Polygon.getBounds.js
|
2143
|
+
if (!google.maps.Polygon.prototype.getBounds) {
|
2144
|
+
google.maps.Polygon.prototype.getBounds = function(latLng) {
|
2145
|
+
var bounds = new google.maps.LatLngBounds();
|
2146
|
+
var paths = this.getPaths();
|
2147
|
+
var path;
|
2148
|
+
|
2149
|
+
for (var p = 0; p < paths.getLength(); p++) {
|
2150
|
+
path = paths.getAt(p);
|
2151
|
+
for (var i = 0; i < path.getLength(); i++) {
|
2152
|
+
bounds.extend(path.getAt(i));
|
2153
|
+
}
|
2106
2154
|
}
|
2107
|
-
}
|
2108
2155
|
|
2109
|
-
|
2110
|
-
|
2111
|
-
}
|
2156
|
+
return bounds;
|
2157
|
+
};
|
2158
|
+
}
|
2112
2159
|
|
2113
|
-
if (!google.maps.Polygon.prototype.containsLatLng) {
|
2114
|
-
|
2115
|
-
|
2116
|
-
|
2117
|
-
|
2160
|
+
if (!google.maps.Polygon.prototype.containsLatLng) {
|
2161
|
+
// Polygon containsLatLng - method to determine if a latLng is within a polygon
|
2162
|
+
google.maps.Polygon.prototype.containsLatLng = function(latLng) {
|
2163
|
+
// Exclude points outside of bounds as there is no way they are in the poly
|
2164
|
+
var bounds = this.getBounds();
|
2118
2165
|
|
2119
|
-
|
2120
|
-
|
2121
|
-
|
2166
|
+
if (bounds !== null && !bounds.contains(latLng)) {
|
2167
|
+
return false;
|
2168
|
+
}
|
2122
2169
|
|
2123
|
-
|
2124
|
-
|
2170
|
+
// Raycast point in polygon method
|
2171
|
+
var inPoly = false;
|
2125
2172
|
|
2126
|
-
|
2127
|
-
|
2128
|
-
|
2129
|
-
|
2130
|
-
|
2173
|
+
var numPaths = this.getPaths().getLength();
|
2174
|
+
for (var p = 0; p < numPaths; p++) {
|
2175
|
+
var path = this.getPaths().getAt(p);
|
2176
|
+
var numPoints = path.getLength();
|
2177
|
+
var j = numPoints - 1;
|
2131
2178
|
|
2132
|
-
|
2133
|
-
|
2134
|
-
|
2179
|
+
for (var i = 0; i < numPoints; i++) {
|
2180
|
+
var vertex1 = path.getAt(i);
|
2181
|
+
var vertex2 = path.getAt(j);
|
2135
2182
|
|
2136
|
-
|
2137
|
-
|
2138
|
-
|
2183
|
+
if (vertex1.lng() < latLng.lng() && vertex2.lng() >= latLng.lng() || vertex2.lng() < latLng.lng() && vertex1.lng() >= latLng.lng()) {
|
2184
|
+
if (vertex1.lat() + (latLng.lng() - vertex1.lng()) / (vertex2.lng() - vertex1.lng()) * (vertex2.lat() - vertex1.lat()) < latLng.lat()) {
|
2185
|
+
inPoly = !inPoly;
|
2186
|
+
}
|
2139
2187
|
}
|
2188
|
+
|
2189
|
+
j = i;
|
2140
2190
|
}
|
2191
|
+
}
|
2141
2192
|
|
2142
|
-
|
2193
|
+
return inPoly;
|
2194
|
+
};
|
2195
|
+
}
|
2196
|
+
|
2197
|
+
if (!google.maps.Circle.prototype.containsLatLng) {
|
2198
|
+
google.maps.Circle.prototype.containsLatLng = function(latLng) {
|
2199
|
+
if (google.maps.geometry) {
|
2200
|
+
return google.maps.geometry.spherical.computeDistanceBetween(this.getCenter(), latLng) <= this.getRadius();
|
2143
2201
|
}
|
2144
|
-
|
2202
|
+
else {
|
2203
|
+
return true;
|
2204
|
+
}
|
2205
|
+
};
|
2206
|
+
}
|
2145
2207
|
|
2146
|
-
|
2208
|
+
google.maps.LatLngBounds.prototype.containsLatLng = function(latLng) {
|
2209
|
+
return this.contains(latLng);
|
2147
2210
|
};
|
2148
|
-
}
|
2149
2211
|
|
2150
|
-
|
2151
|
-
|
2152
|
-
if (google.maps.geometry) {
|
2153
|
-
return google.maps.geometry.spherical.computeDistanceBetween(this.getCenter(), latLng) <= this.getRadius();
|
2154
|
-
}
|
2155
|
-
else {
|
2156
|
-
return true;
|
2157
|
-
}
|
2212
|
+
google.maps.Marker.prototype.setFences = function(fences) {
|
2213
|
+
this.fences = fences;
|
2158
2214
|
};
|
2159
|
-
}
|
2160
2215
|
|
2161
|
-
google.maps.
|
2162
|
-
|
2163
|
-
};
|
2164
|
-
|
2165
|
-
google.maps.Marker.prototype.setFences = function(fences) {
|
2166
|
-
this.fences = fences;
|
2167
|
-
};
|
2168
|
-
|
2169
|
-
google.maps.Marker.prototype.addFence = function(fence) {
|
2170
|
-
this.fences.push(fence);
|
2171
|
-
};
|
2216
|
+
google.maps.Marker.prototype.addFence = function(fence) {
|
2217
|
+
this.fences.push(fence);
|
2218
|
+
};
|
2172
2219
|
|
2173
|
-
google.maps.Marker.prototype.getId = function() {
|
2174
|
-
|
2175
|
-
};
|
2220
|
+
google.maps.Marker.prototype.getId = function() {
|
2221
|
+
return this['__gm_id'];
|
2222
|
+
};
|
2223
|
+
}
|
2176
2224
|
|
2177
2225
|
//==========================
|
2178
2226
|
// Array indexOf
|