PageSourceSearch

https://essft.com/wp-content/plugins/geodirectory/assets/jawj/oms-leaflet.js?ver=2.8.180

js essft.com collected 2026-10-03 00:48:59 UTC 10,285 bytes, 240 lines download raw bytes

1(function() {
2    /*
3     OverlappingMarkerSpiderfier
4     https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet
5     Copyright (c) 2011 - 2012 George MacKerron
6     Released under the MIT licence: http://opensource.org/licenses/mit-license
7     Note: The Leaflet maps API must be included *before* this code
8     */
9    (function() {
10        var q = {}.hasOwnProperty,
11            r = [].slice;
12        null != this.L && (this.OverlappingMarkerSpiderfier = function() {
13            function n(c, b) {
14                var a, e, g, f, d = this;
15                this.map = c;
16                null == b && (b = {});
17                for (a in b) q.call(b, a) && (e = b[a], this[a] = e);
18                this.initMarkerArrays();
19                this.listeners = {};
20                f = ["click", "zoomend"];
21                e = 0;
22                for (g = f.length; e < g; e++) a = f[e], this.map.addEventListener(a, function() {
23                    return d.unspiderfy()
24                })
25            }
26            var d, k;
27            d = n.prototype;
28            d.VERSION = "0.2.6";
29            k = 2 * Math.PI;
30            d.keepSpiderfied = !1;
31            d.nearbyDistance = 20;
32            d.circleSpiralSwitchover = 9;
33            d.circleFootSeparation =
34                25;
35            d.circleStartAngle = k / 12;
36            d.spiralFootSeparation = 28;
37            d.spiralLengthStart = 11;
38            d.spiralLengthFactor = 5;
39            d.legWeight = 1.5;
40            d.legColors = {
41                usual: "#222",
42                highlighted: "#f00"
43            };
44            d.initMarkerArrays = function() {
45                this.markers = [];
46                return this.markerListeners = []
47            };
48            d.addMarker = function(c) {
49                var b, a = this;
50                if (null != c._oms) return this;
51                c._oms = !0;
52                b = function() {
53                    return a.spiderListener(c)
54                };
55                c.addEventListener("click", b);
56                this.markerListeners.push(b);
57                this.markers.push(c);
58                return this
59            };
60            d.getMarkers = function() {
61                return this.markers.slice(0)
62            };
63            d.removeMarker = function(c) {
64                var b, a;
65                null != c._omsData && this.unspiderfy();
66                b = this.arrIndexOf(this.markers, c);
67                if (0 > b) return this;
68                a = this.markerListeners.splice(b, 1)[0];
69                c.removeEventListener("click", a);
70                delete c._oms;
71                this.markers.splice(b, 1);
72                return this
73            };
74            d.clearMarkers = function() {
75                var c, b, a, e, g;
76                this.unspiderfy();
77                g = this.markers;
78                c = a = 0;
79                for (e = g.length; a < e; c = ++a) b = g[c], c = this.markerListeners[c], b.removeEventListener("click", c), delete b._oms;
80                this.initMarkerArrays();
81                return this
82            };
83            d.addListener = function(c, b) {
84                var a,
85                    e;
86                (null != (e = (a = this.listeners)[c]) ? e : a[c] = []).push(b);
87                return this
88            };
89            d.removeListener = function(c, b) {
90                var a;
91                a = this.arrIndexOf(this.listeners[c], b);
92                0 > a || this.listeners[c].splice(a, 1);
93                return this
94            };
95            d.clearListeners = function(c) {
96                this.listeners[c] = [];
97                return this
98            };
99            d.trigger = function() {
100                var c, b, a, e, g, f;
101                b = arguments[0];
102                c = 2 <= arguments.length ? r.call(arguments, 1) : [];
103                b = null != (a = this.listeners[b]) ? a : [];
104                f = [];
105                e = 0;
106                for (g = b.length; e < g; e++) a = b[e], f.push(a.apply(null, c));
107                return f
108            };
109            d.generatePtsCircle = function(c, b) {
110                var a, e,
111                    g, f, d;
112                g = this.circleFootSeparation * (2 + c) / k;
113                e = k / c;
114                d = [];
115                for (a = f = 0; 0 <= c ? f < c : f > c; a = 0 <= c ? ++f : --f) a = this.circleStartAngle + a * e, d.push(new L.Point(b.x + g * Math.cos(a), b.y + g * Math.sin(a)));
116                return d
117            };
118            d.generatePtsSpiral = function(c, b) {
119                var a, e, g, f, d;
120                g = this.spiralLengthStart;
121                a = 0;
122                d = [];
123                for (e = f = 0; 0 <= c ? f < c : f > c; e = 0 <= c ? ++f : --f) a += this.spiralFootSeparation / g + 5E-4 * e, e = new L.Point(b.x + g * Math.cos(a), b.y + g * Math.sin(a)), g += k * this.spiralLengthFactor / a, d.push(e);
124                return d
125            };
126            d.spiderListener = function(c) {
127                var b, a, e, g, f, d, h, k, l;
128                (b = null !=
129                    c._omsData) && this.keepSpiderfied || this.unspiderfy();
130                if (b) return this.trigger("click", c);
131                g = [];
132                f = [];
133                d = this.nearbyDistance * this.nearbyDistance;
134                e = this.map.latLngToLayerPoint(c.getLatLng());
135                l = this.markers;
136                h = 0;
137                for (k = l.length; h < k; h++) b = l[h], this.map.hasLayer(b) && (a = this.map.latLngToLayerPoint(b.getLatLng()), this.ptDistanceSq(a, e) < d ? g.pu
137sh({
138                    marker: b,
139                    markerPt: a
140                }) : f.push(b));
141                return 1 === g.length ? this.trigger("click", c) : this.spiderfy(g, f)
142            };
143            d.makeHighlightListeners = function(c) {
144                var b = this;
145                return {
146                    highlight: function() {
147                        return c._omsData.leg.setStyle({
148                            color: b.legColors.highlighted
149                        })
150                    },
151                    unhighlight: function() {
152                        return c._omsData.leg.setStyle({
153                            color: b.legColors.usual
154                        })
155                    }
156                }
157            };
158            d.spiderfy = function(c, b) {
159                var a, e, g, d, p, h, k, l, n, m;
160                this.spiderfying = !0;
161                m = c.length;
162                a = this.ptAverage(function() {
163                    var a, b, e;
164                    e = [];
165                    a = 0;
166                    for (b = c.length; a < b; a++) k = c[a], e.push(k.markerPt);
167                    return e
168                }());
169                d = m >= this.circleSpiralSwitchover ? this.generatePtsSpiral(m, a).reverse() : this.generatePtsCircle(m, a);
170                a = function() {
171                    var a, b, k, m = this;
172                    k = [];
173                    a = 0;
174                    for (b = d.length; a < b; a++) g = d[a], e = this.map.layerPointToLatLng(g), n = this.minExtract(c, function(a) {
175                        return m.ptDistanceSq(a.markerPt,
176                            g)
177                    }), h = n.marker, p = new L.Polyline([h.getLatLng(), e], {
178                        color: this.legColors.usual,
179                        weight: this.legWeight,
180                        clickable: !1
181                    }), this.map.addLayer(p), h._omsData = {
182                        usualPosition: h.getLatLng(),
183                        leg: p
184                    }, this.legColors.highlighted !== this.legColors.usual && (l = this.makeHighlightListeners(h), h._omsData.highlightListeners = l, h.addEventListener("mouseover", l.highlight), h.addEventListener("mouseout", l.unhighlight)), h.setLatLng(e), h.setZIndexOffset(1E6), k.push(h);
185                    return k
186                }.call(this);
187                delete this.spiderfying;
188                this.spiderfied = !0;
189                return this.trigger("spiderfy", a, b)
190            };
191            d.unspiderfy = function(c) {
192                var b, a, e, d, f, k, h;
193                null == c && (c = null);
194                if (null == this.spiderfied) return this;
195                this.unspiderfying = !0;
196                d = [];
197                e = [];
198                h = this.markers;
199                f = 0;
200                for (k = h.length; f < k; f++) b = h[f], null != b._omsData ? (this.map.removeLayer(b._omsData.leg), b !== c && b.setLatLng(b._omsData.usualPosition), b.setZIndexOffset(0), a = b._omsData.highlightListeners, null != a && (b.removeEventListener("mouseover", a.highlight), b.removeEventListener("mouseout", a.unhighlight)), delete b._omsData, d.push(b)) :
201                    e.push(b);
202                delete this.unspiderfying;
203                delete this.spiderfied;
204                this.trigger("unspiderfy", d, e);
205                return this
206            };
207            d.ptDistanceSq = function(c, b) {
208                var a, e;
209                a = c.x - b.x;
210                e = c.y - b.y;
211                return a * a + e * e
212            };
213            d.ptAverage = function(c) {
214                var b, a, e, d, f;
215                d = a = e = 0;
216                for (f = c.length; d < f; d++) b = c[d], a += b.x, e += b.y;
217                c = c.length;
218                return new L.Point(a / c, e / c)
219            };
220            d.minExtract = function(c, b) {
221                var a, d, g, f, k, h;
222                g = k = 0;
223                for (h = c.length; k < h; g = ++k)
224                    if (f = c[g], f = b(f), "undefined" === typeof a || null === a || f < d) d = f, a = g;
225                return c.splice(a, 1)[0]
226            };
227            d.arrIndexOf = function(c, b) {
228                var a,
229                    d, g, f;
230                if (null != c.indexOf) return c.indexOf(b);
231                a = g = 0;
232                for (f = c.length; g < f; a = ++g)
233                    if (d = c[a], d === b) return a;
234                return -1
235            };
236            return n
237        }())
238    }).call(this);
239}).call(this);
240/* Mon 14 Oct 2013 10:54:59 BST */

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.