PageSourceSearch

https://www.life-run.co.il/includes/map/travelmappro-min.js

js life-run.co.il collected 2026-09-29 16:25:41 UTC 12,482 bytes, 341 lines download raw bytes

1google.maps.LatLng.prototype.distanceFrom = function (latlng) {
2    var lat = [this.lat(), latlng.lat()]
3    var lng = [this.lng(), latlng.lng()]
4    var R = 6378137;
5    var dLat = (lat[1] - lat[0]) * Math.PI / 180;
6    var dLng = (lng[1] - lng[0]) * Math.PI / 180;
7    var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
8    Math.cos(lat[0] * Math.PI / 180) * Math.cos(lat[1] * Math.PI / 180) *
9    Math.sin(dLng / 2) * Math.sin(dLng / 2);
10    var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
11    var d = R * c;
12    return Math.round(d);
13}
14
15var Namespace = {
16    Register: function (e) {
17        var a = false;
18        var b = "";
19        var d = e.split(".");
20        for (var c = 0; c < d.length; c++) {
21            if (b != "") { b += "." }
22            b += d[c];
23            a = this.Exists(b);
24            if (!a) { this.Create(b) }
25        }
26
27        if (a) {
28            throw "Namespace: " + e + " is already defined."
29        }
30    }, Create: function (_Src) {
31        eval("window." + _Src + " = new Object();")
32    }, Exists: function (_Src) {
33        eval("var NE = false; try{if(" + _Src + "){NE = true;}else{NE = false;}}catch(err){NE=false;}");
34        return NE
35    }
36};
37
38Namespace.Register("assafmediaMap");
39
40assafmediaMap.initialize = function (iconDistance) {
41    if (iconDistance == undefined)
42        iconDistance = 1;
43
44    var b = {
45        zoom: assafmediaMap.mapZoom,
46        // center: new google.maps.LatLng(32.10252573408225,34.814321994781494),
47        center: new google.maps.LatLng(assafmediaMap.mapCenter[0], assafmediaMap.mapCenter[1]),
48        mapTypeId: google.maps.MapTypeId.ROADMAP
49    };
50    var h = new google.maps.Map($(".map_canvas")[0], b);
51
52    var f = new google.maps.InfoWindow();
53    function e(i) {
54        f.close();
55        f.setPosition(i.getPosition());
56        f.setContent(i.infoContent);
57        f.open(h)
58    }
59    closeinfowindow = function () {
60        f.close()
61    };
62
63    google.maps.event.addListener(h, 'rightclick', function (event) {
64        // points = [];
65        var lat = event.latLng.lat();
66        var lng = event.latLng.lng();
67        // $("#maslul").append("<div>['נקודת ביניים', "+lat+", "+lng+", 'נקודת ביניים', ''],</div>");
68    });
69
70    var total_d = 0;
71    var kilo_meters = 1;
72    var my_row = 0;
73
74    for (var d = 0; d < assafmediaMap.locations.length; d++) {
75
76        my_row = d;
77
78        var last_row = assafmediaMap.locations[my_row - 1];
79        var this_row = assafmediaMap.locations[my_row];
80
81        if (d > 0) { //There is a last_row AND This is NOT the last_row
82            var last_location = new google.maps.LatLng(last_row[1], last_row[2]);
83            var this_location = new google.maps.LatLng(this_row[1], this_row[2]);
84
85            var this_d = this_location.distanceFrom(last_location);
86            total_d = this_d + total_d;
87
88            if (total_d > kilo_meters * 1000 * iconDistance && this_row[0] != 'Water' && this_row[0] != 'Gel' && this_row[0] != 'toilet' &&
89			    this_row[0] != 'Izo' && this_row[0] != 'Kibud' && this_row[0] != 'Shpritzer' && this_row[0] != 'Stage') {
90                this_row[0] = (kilo_meters * iconDistance) + " KM";
91                this_row[3] = (kilo_meters * iconDistance) + " KM";;
92                ++kilo_meters;
93            } else {
94                //toilet,water,gel,izo,iso,isotonic,cheering,shpritzer,splash,kibud,refreshments,stage,parking
95                if (this_row[0].toLowerCase() == 'water') {
96                    this_row[3] = "נקודת מים - Water Point";
97                }
98                else if (this_row[0].toLowerCase() == 'gel') {
99                    this_row[3] = "נקודת אנרגיה - Gel";
100                }
101                else if (this_row[0].toLowerCase() == 'toilet') {
102                    this_row[3] = "שירותים - Toilet";
103                }
104                else if (this_row[0].toLowerCase() == 'izo' || this_row[0].toLowerCase() == 'iso' || this_row[0].toLowerCase() == 'isotonic') {
105                    this_row[3] = "נקודת אנרגיה - משקה Isotonic";
106                }
107                else if (this_row[0].toLowerCase() == 'cheering') {
108                    this_row[3] = "הקודת עידוד - Cheering Point";
109                }
110                else if (this_row[0].toLowerCase() == 'kibud' || this_row[0].toLowerCase() == 'refreshments') {
111                    this_row[3] = "כיבוד קל - Refreshments";
112                }
113                else if (this_row[0].toLowerCase() == 'shpritzer' || this_row[0].toLowerCase() == 'splash') {
114                    this_row[3] = "מתיז מים - Splash";
115                }
116                else if (this_row[0].toLowerCase() == 'stage') {
117                    this_row[3] = "במת מוסיקה - Stage";
118                }
119                else if (this_row[0].toLowerCase() == 'parking') {
120                    this_row[3] = "חנייה - Parking";
121                }
122                else {
123                    this_row[0] = "";
124                    this_row[3] = "";
125                }
126            }
127        }
128
129        var g = new google.maps.LatLng(this_row[1], this_row[2]);
130
131        var a = new google.maps.Marker({
132            position: g,
133            shadow: assafmediaMap.shadowImage(),
134            icon: assafmediaMap.markerImage(this_row[0].toLowerCase(), d, assafmediaMap.locations.length),
135            shape: assafmediaMap.markerShape(),
136            title: this_row[3],
137            zIndex: d
138        });
139
140        a.infoContent = assafmediaMap.infoWindowHtml(this_row[0], this_row[3], this_row[4]);
141
142        a.setMap(h);
143
144        google.maps.event.addListener(a, "click", function () {
145            e(this)
146        });
147    }
148
149    if (assafmediaMap.extraMarkers.length > 0) {
150        for (var i = 0; i < assafmediaMap.extraMarkers.length; i++) {
151            //water_crossing,meet_up,toilets,food,hazard,other
152
153            var extraMarkersTitle = "";
154            if (assafmediaMap.extraMarkers[i][2] == "water_crossing")
155                extraMarkersTitle = "נקודת מים - Water Point";
156            else if (assafmediaMap.extraMarkers[i][2] == "meet_up")
157                extraMarkersTitle = "במת מוסיקה - Stage";
158            else if (assafmediaMap.extraMarkers[i][2] == "toilets")
159                extraMarkersTitle = "שירותים - Toilet";
160            else if (assafmediaMap.extraMarkers[i][2] == "food")
161                extraMarkersTitle = "כיבוד קל - Refreshments";
162            else if (assafmediaMap.extraMarkers[i][2] == "hazard")
163                extraMarkersTitle = "נקודת אנרגיה - משקה Isotonic";
164            else if (assafmediaMap.extraMarkers[i][2] == "other")
165                extraMarkersTitle = "נקודת אנרגיה - Gel";
166
167            var z = new google.maps.Marker({
168                position: new google.maps.LatLng(assafmediaMap.extraMarkers[i][0], assafmediaMap.extraMarkers[i][1]),
169                shadow: assafmediaMap.shadowImage(),
170                icon: assafmediaMap.markerImage(assafmediaMap.extraMarkers[i][2], 5, 10),
171                shape: assafmediaMap.markerShape(),
172                title: extraMarkersTitle,
173                zIndex: 0
174            });
175
176            z.setMap(h);
177        }
178    }
179
180    // for(var d=0;d<km_markers.length;d++){
181    // var c=km_markers[d];
182    // var g=new google.maps.LatLng(c[1],c[2]);
183
184    // var a=new google.maps.Marker({
185    // position:g,
186    // shadow:assafmediaMap.shadowImage(),
187    // icon: assafmediaMap.markerImage(c[0],d,km_markers.length),
188    // shape:assafmediaMap.markerShape(),
189    // title:c[0],
190    // zIndex:d
191    // });
192
193    // a.infoContent=assafmediaMap.infoWindowHtml(c[0],c[3],c[4]);
194
195    // a.setMap(h);
196
197    // google.maps.event.addListener(a,"click",function(){
198    // e(this)
199    // });
200    // }
201
202    assafmediaMap.setPolyline(h, assafmediaMap.locations)
203};
204
205assafmediaMap.setPolyline = function (f, a) {
206    var e = new Array();
207    var km_markers = new Array();
208
209    for (var d = 0; d < a.length; d++) {
210
211        var c = a[d];
212        var thisPoint = new google.maps.LatLng(c[1], c[2]);
213
214        if (d == 0) {
215            var km = 1;
216            window.lastMarkerPoint = new google.maps.LatLng(c[1], c[2]);
217        }
218
219        var my_distance = google.maps.geometry.spherical.computeDistanceBetween(window.lastMarkerPoint, thisPoint);
220        if (my_distance > 1000 * km) {
221            km = km + 1;
222            window.lastMarkerPoint = thisPoint;
223            // km_markers.push(['stop',thisPoint,km+' ק"מ','',])
224            // alert(km+" KM");
225        }
226
227        e.push(thisPoint);
228    }
229
230    var b = new google.maps.Polyline({
231        path: e,
232        strokeColor: assafmediaMap.polylineColor,
233        strokeOpacity: 1,
234        strokeWeight: 2,
235        geodesic: false,
236        editable: false
237    });
238
239    b.setMap(f);
240    // var length_in_km = b.inKm();
241    // var a = new google.maps.LatLng(32.08448938390158,34.76934020163503);
242    // var b = new google.maps.LatLng(32.082618681633974,34.76852191858643);
243    // alert(google.maps.geometry.spherical.computeDistanceBetween(a,b));
244};
245
246google.maps.LatLng.prototype.kmTo = function (a) {
247    var e = Math, ra = e.PI / 180;
248    var b = this.lat() * ra, c = a.lat() * ra, d = b - c;
249    var g = this.lng() * ra - a.lng() * ra;
250    var f = 2 * e.asin(e.sqrt(e.pow(e.sin(d / 2), 2) + e.cos(b) * e.cos
251    (c) * e.pow(e.sin(g / 2), 2)));
252    return f * 6378.137;
253}
254
255google.maps.Polyline.prototype.inKm = function (n) {
256    var a = this.getPath(n), len = a.getLength(), dist = 0;
257    for (var i = 0; i < len - 1; i++) {
258        dist += a.getAt(i).kmTo(a.getAt(i + 1));
259    }
260    return dist;
261}
262
263assafmediaMap.markerImage = function (getmytitle, index, a) {
264    //alert(getmytitle);
265    
266    var icon = "";
267    var c = getmytitle.split(" ");
268    icon = "includes/map/images/" + c[0] + "km_marker.png";
269    //toilet,water,gel,izo,iso,isotonic,cheering,shpritzer,splash,kibud,refreshments,stage,parking
270    if (getmytitle.indexOf('toilet') !== -1 || getmytitle.indexOf('toilets') !== -1) {
271        icon = "https://www.kapaimactive.co.il/includes/map/images/toilet_marker.png";//
272    }
273
274    if (getmytitle.indexOf('water') !== -1 || getmytitle.indexOf('water_crossing') !== -1) {
275        icon = "https://www.kapaimactive.co.il/includes/map/images/water_marker.png";//
276    }
277
278    if (getmytitle.indexOf('gel') !== -1 || getmytitle.indexOf('other') !== -1) {
279        icon = "https://www.kapaimactive.co.il/includes/map/images/gel_marker.png";
280    }
281
282    if (getmytitle.indexOf('izo') !== -1 || getmytitle.indexOf('iso') !== -1 || getmytitle.indexOf('isotonic') !== -1 || getmytitle.indexOf('hazard') !== -1) {
283        icon = "https://www.kapaimactive.co.il/includes/map/images/izo_marker.png";
284    }
285
286    if (getmytitle.indexOf('cheering') !== -1) {
287        icon = "https://www.kapaimactive.co.il/includes/map/images/cheering_marker.png";
288    }
289
290    if (getmytitle.indexOf('shpritzer') !== -1 || getmytitle.indexOf('splash') !== -1) {
291        icon = "https://www.kapaimactive.co.il/includes/map/images/shpritzer_marker.png";
292    }
293
294    if (getmytitle.indexOf('kibud') !== -1 || getmytitle.indexOf('refreshments') !== -1 || getmytitle.indexOf('food') !== -1) {
295        icon = "https://www.kapaimactive.co.il/includes/map/images/kibud_marker.png";
296    }
297
298    if (getmytitle.indexOf('stage') !== -1 || getmytitle.indexOf('meet_up') !== -1) {
299        icon = "https://www.kapaimactive.co.il/includes/map/images/music.png";
300    }
301
302    //if (getmytitle.indexOf('parking') !== -1) {
303    //    icon = "includes/map/images/parking.png";
304    //}
305
306
307    if (index == 0) {
308        icon = "includes/map/images/start_marker.png";
309    } else {
310        if (index == a - 1) {
311            icon = "includes/map/images/end_marker.png";
312        }
313    }
314
315
316
317    //if (icon != "")
318    //    alert(icon);
319    return new google.maps.MarkerImage(
320		icon,
321		new google.maps.Size(35, 35),
322		new google.maps.Point(0, 0),
323		new google.maps.Point(9, 37)
324	);
325}
326
327assafmediaMap.shadowImage = function () {
328    return new google.maps.MarkerImage(
329		"includes/map/images/marker_shadow.png",
330		new google.maps.Size(37, 35),
331		new google.maps.Point(0, 0),
332		new google.maps.Point(9, 34)
333	)
334};
335
336assafmediaMap.markerShape = function () {
337    var a = {
338        coord: [1, 1, 1, 20, 18, 20, 18, 1],
339        type: "poly"
340    }
341};

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.