<commit_before><!DOCTYPE html>
<html>
<head>

	<!-- <title>Maps Widget</title> -->

	<meta charset="utf-8">
	<meta content="width=device-width, initial-scale=1.0" name="viewport">

	<!-- JS Links -->
	<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
	<!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> -->
	<!-- <script src="https://raw.githubusercontent.com/stefanocudini/leaflet-search/master/src/leaflet-search.js" type="text/javascript" ></script> -->

	<!-- CSS Links -->
	<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" />
	<!-- <link rel="stylesheet" type="text/css" href="foundation.css" /> -->
	<!-- <link rel="stylesheet" type="text/css" href="https://raw.githubusercontent.com/stefanocudini/leaflet-search/master/src/leaflet-search.css"> -->

	<style type="text/css">
		
		#map { height: 100%; width: 100%; }

		.leaflet-popup-content {	min-width:100px;	}

		.popup-add-content-button { background-color: #199369; color: #FFFFFF; display: block; float: left; padding: 1px 2px;	}

		.popup-delete-content-button { background-color: #F04124; color: #FFFFFF; display: inline-block; float: right; padding: 1px 2px;	}		

	</style>

</head>

<body>

	<div id="map" data-mode="{{mode}}"><input type="hidden" data-map-markers="{{ node.location }}" value="" name="map-geojson-data"/></div>
	
	<script type="text/javascript">

	 	// We’ll add a tile layer to add to our map, in this case it’s a OSM tile layer.
	 	// Creating a tile layer usually involves setting the URL template for the tile images
	 	var osmUrl 	  = 'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
	 	osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
	 	osm 	  = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
	 	
	 	// initialize the map on the "map" div with a given center and zoom
	 	var map = L.map('map').setView([25.92,79.84], 5).addLayer(osm);

	 	// map.addControl( new L.Control.Search({layer: searchLayer}) );

	 	mapdata = $("input:hidden[name=map-geojson-data]").attr("data-map-markers");
	 	mapdata = mapdata.replace(/'/gm, '"');
	 	mapdata = mapdata.replace(/u"/gm, '"');
	 	mapdata = JSON.parse(mapdata);

	 	markerGeoJSON = [];

	 	if( mapdata.length > 0 )
	 	{
	 		// Adding mapdata on map
		 	// L.geoJson(mapdata, {onEachFeature: function (feature, layer) {
		 	// 	// layer.bindPopup("feature.properties.description");
		 	// }}).addTo(map);

			tempArr = []	// to catch newly created markers
			
			L.geoJson(mapdata, {
			    
			    pointToLayer: function (feature, latlng) {

			        var marker = L.marker(latlng);

					tempArr.push(marker);
			
					return marker;
					
			    }
			}).addTo(map);


	        // Adding mapdata values in markerGeoJSON.
	        $.each(tempArr, function(i, val){ 

	        	var addLeafletID = tempArr[i].toGeoJSON();
	        	
	        	$(addLeafletID).attr("properties", {"id": tempArr[i]._leaflet_id});
	        	markerGeoJSON.push(JSON.stringify(addLeafletID));

	        })

	 		
	 		// $.each(mapdata, function(i, val){

	 		// 	var co_ord = val.geometry.coordinates;
	 		// 	markerGeoJSON[i] = JSON.stringify(val)

	 		// })
	 	}

	 	

		{% if mode == "edit" %}
			map.on('click', onMapClick );

		// Script for adding marker on map click
		function onMapClick(e) {

			var marker = L.marker(e.latlng, {
				draggable:true,
				title:"Resource location",
				alt:"Resource Location",
				riseOnHover:true
			}).addTo(map)
				// .bindPopup(e.latlng.toString()).openPopup();
				// .bindPopup($(".popup-html").html()).openPopup();
			
			var addLeafletID = marker.toGeoJSON();
			$(addLeafletID).attr("properties", {"id": marker._leaflet_id});
			
			markerGeoJSON.push(JSON.stringify(addLeafletID));

			$('input:hidden[name=map-geojson-data]').attr("data-map-markers", markerGeoJSON)
			$('input:hidden[name=map-geojson-data]').attr("value", markerGeoJSON)
			
			// marker.on("popupopen", function(){

				// alert("kljhkj");
				// $(".popup-delete-content-button").click(function(){map.removeLayer(this)});
			// })


			// marker.on("dragstart",function(ev){
			// 	aaa = this.toGeoJSON();//.latlng.toString();
			// });

			// Update marker on changing it's position
			marker.on("dragend",function(ev){

				var changedPos = ev.target.getLatLng();
				
            	this.setLatLng(changedPos).update();	// Update the marker position
            	// map.removeLayer(this);

            	var lID = this._leaflet_id;		// Getting Leaflet ID of this marker
            
            	var addLeafletID = this.toGeoJSON();
				$(addLeafletID).attr("properties", {"id": lID});

            	updatedGeoJSON = JSON.stringify(addLeafletID);

            	$.each(markerGeoJSON, function(i, val) {
            	
            		var getID = $.parseJSON(val).properties.id; 
            		if(getID == lID) { markerGeoJSON[i] = updatedGeoJSON; }  
            	})

            	// this.setPopupContent(changedPos.toString()).openPopup();	// Updating popup Msg
            	// $('input:hidden[name=map-geojson-data]').attr("data-map-markers", markerGeoJSON);
            	$('input:hidden[name=map-geojson-data]').attr("data-map-markers", markerGeoJSON)
            	$('input:hidden[name=map-geojson-data]').attr("value", markerGeoJSON)
            });

			// marker.on("contextmenu", function(){(alert("aaa"))});
		}

		{% endif %}<commit_msg>Now added makers position can be edited/change<commit_after><!DOCTYPE html>
<html>
<head>

	<!-- <title>Maps Widget</title> -->

	<meta charset="utf-8">
	<meta content="width=device-width, initial-scale=1.0" name="viewport">

	<!-- JS Links -->
	<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
	<!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> -->
	<!-- <script src="https://raw.githubusercontent.com/stefanocudini/leaflet-search/master/src/leaflet-search.js" type="text/javascript" ></script> -->

	<!-- CSS Links -->
	<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" />
	<!-- <link rel="stylesheet" type="text/css" href="foundation.css" /> -->
	<!-- <link rel="stylesheet" type="text/css" href="https://raw.githubusercontent.com/stefanocudini/leaflet-search/master/src/leaflet-search.css"> -->

	<style type="text/css">
		
		#map { height: 100%; width: 100%; }

		.leaflet-popup-content {	min-width:100px;	}

		.popup-add-content-button { background-color: #199369; color: #FFFFFF; display: block; float: left; padding: 1px 2px;	}

		.popup-delete-content-button { background-color: #F04124; color: #FFFFFF; display: inline-block; float: right; padding: 1px 2px;	}		

	</style>

</head>

<body>

	<div id="map" data-mode="{{mode}}"><input type="hidden" data-map-markers="{{ node.location }}" value="" name="map-geojson-data"/></div>
	
	<script type="text/javascript">

	 	// We’ll add a tile layer to add to our map, in this case it’s a OSM tile layer.
	 	// Creating a tile layer usually involves setting the URL template for the tile images
	 	var osmUrl 	  = 'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
	 	osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
	 	osm 	  = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
	 	
	 	// initialize the map on the "map" div with a given center and zoom
	 	var map = L.map('map').setView([25.92,79.84], 5).addLayer(osm);

	 	// map.addControl( new L.Control.Search({layer: searchLayer}) );

	 	mapdata = $("input:hidden[name=map-geojson-data]").attr("data-map-markers");
	 	mapdata = mapdata.replace(/'/gm, '"');
	 	mapdata = mapdata.replace(/u"/gm, '"');
	 	mapdata = JSON.parse(mapdata);

	 	markerGeoJSON = [];

	 	if( mapdata.length > 0 )
	 	{
	 		// Adding mapdata on map
		 	// L.geoJson(mapdata, {onEachFeature: function (feature, layer) {
		 	// 	// layer.bindPopup("feature.properties.description");
		 	// }}).addTo(map);

			tempArr = []	// to catch newly created markers
			
			L.geoJson(mapdata, {
			    
			    pointToLayer: function (feature, latlng) {
			    	{% if mode == "edit" %}
			        	var marker = L.marker(latlng, {
							draggable:true,
							title:"Resource location",
							alt:"Resource Location",
							riseOnHover:true
						})

						marker.on("dragend", dragend);

			        {% else %}
			        	var marker = L.marker(latlng);

			       	{% endif %}

						tempArr.push(marker);
						
					return marker;
					
			    }
			}).addTo(map);


	        // Adding mapdata values in markerGeoJSON.
	        $.each(tempArr, function(i, val){ 

	        	var addLeafletID = tempArr[i].toGeoJSON();
	        	
	        	$(addLeafletID).attr("properties", {"id": tempArr[i]._leaflet_id});
	        	markerGeoJSON.push(JSON.stringify(addLeafletID));

	        })

	 		
	 		// $.each(mapdata, function(i, val){

	 		// 	var co_ord = val.geometry.coordinates;
	 		// 	markerGeoJSON[i] = JSON.stringify(val)

	 		// })
	 	}

	 	

		{% if mode == "edit" %}
			map.on('click', onMapClick );

		// Script for adding marker on map click
		function onMapClick(e) {

			var marker = L.marker(e.latlng, {
				draggable:true,
				title:"Resource location",
				alt:"Resource Location",
				riseOnHover:true
			}).addTo(map);
				// .bindPopup(e.latlng.toString()).openPopup();
				// .bindPopup($(".popup-html").html()).openPopup();
			
			marker.on("dragend", dragend);

			var addLeafletID = marker.toGeoJSON();
			$(addLeafletID).attr("properties", {"id": marker._leaflet_id});
			
			markerGeoJSON.push(JSON.stringify(addLeafletID));

			$('input:hidden[name=map-geojson-data]').attr("data-map-markers", markerGeoJSON)
			$('input:hidden[name=map-geojson-data]').attr("value", markerGeoJSON)
			
			// marker.on("popupopen", function(){

				// alert("kljhkj");
				// $(".popup-delete-content-button").click(function(){map.removeLayer(this)});
			// })


			// marker.on("dragstart",function(ev){
			// 	aaa = this.toGeoJSON();//.latlng.toString();
			// });

			// marker.on("contextmenu", function(){(alert("aaa"))});
		}

		// Update marker on changing it's position
			// marker.on("dragend",function(ev){
				function dragend(ev){

				var changedPos = ev.target.getLatLng();
				
            	this.setLatLng(changedPos).update();	// Update the marker position
            	// map.removeLayer(this);

            	var lID = this._leaflet_id;		// Getting Leaflet ID of this marker
            
            	var addLeafletID = this.toGeoJSON();
				$(addLeafletID).attr("properties", {"id": lID});

            	updatedGeoJSON = JSON.stringify(addLeafletID);

            	$.each(markerGeoJSON, function(i, val) {
            	
            		var getID = $.parseJSON(val).properties.id; 
            		if(getID == lID) { markerGeoJSON[i] = updatedGeoJSON; }  
            	})

            	// this.setPopupContent(changedPos.toString()).openPopup();	// Updating popup Msg
            	// $('input:hidden[name=map-geojson-data]').attr("data-map-markers", markerGeoJSON);
            	$('input:hidden[name=map-geojson-data]').attr("data-map-markers", markerGeoJSON)
            	$('input:hidden[name=map-geojson-data]').attr("value", markerGeoJSON)
            }//);

		{% endif %}
{'fraction_non_alphanumeric': 0.1860320284697509, 'fraction_numerical': 0.008540925266903915, 'mean_word_length': 2.8655433287482808, 'pattern_counts': {'":': 6, '<': 69, '<?xml version=': 0, '>': 71, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6717395', 'n_tokens_mistral': 4444, 'n_tokens_neox': 3820, 'n_words': 650}