<commit_before><!DOCTYPE html>
<html>
<head>
	
	<title>Simple PA Legislative District Map</title>

	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	
	<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />

	<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
	<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>


	<style>
		#map {
			width: 600px;
			height: 400px;
		}
	</style>

	<style>#map { width: 800px; height: 500px; }
.info { padding: 6px 8px; font: 14px/16px Arial, Helvetica, sans-serif; background: white; background: rgba(255,255,255,0.8); box-shadow: 0 0 15px rgba(0,0,0,0.2); border-radius: 5px; } .info h4 { margin: 0 0 5px; color: #777; }
.legend { text-align: left; line-height: 18px; color: #555; } .legend i { width: 18px; height: 18px; float: left; margin-right: 8px; opacity: 0.7; }</style>
</head>
<body>

<div id='map'></div>

<script type="text/javascript" src="https://raw.githubusercontent.com/mholt/PapaParse/master/papaparse.min.js"></script>

<script type="text/javascript" src="pa-house.js"></script>

<script type="text/javascript">

	var map = L.map('map').setView([41.0, -77], 7);
	var csv;
	
		
	L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=<KEY>', {
		crossOrigin: true,
		maxZoom: 18,
		attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
			'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
			'Imagery © <a href="http://mapbox.com">Mapbox</a>',
		id: 'mapbox.light'
	}).addTo(map);


	// control that shows state info on hover
	var info = L.control();

	info.onAdd = function (map) {
		this._div = L.DomUtil.create('div', 'info');
		this.update();
		return this._div;
	};

	info.update = function (props) {
		this._div.innerHTML = '<h4>PA House District</h4>' +  (props ? '<b>' + props.LEG_DISTRI + '</b><br />'	: 'Select a district');
	};

	info.addTo(map);


	// get color depending on population density value
	function getColor(support) {
		return support === "Yes" ? 'green' :
				support === "Maybe"  ? 'gold' :
				support === "No"  ? 'firebrick' :
					'grey';
	}

	function style(feature) {
		return {
			weight: 2,
			opacity: 1,
			color: 'white',
			dashArray: '3',
			fillOpacity: 0.7,
			fillColor: getColor(feature.properties.support)
		};
	}

	function highlightFeature(e) {
		var layer = e.target;

		layer.setStyle({
			weight: 5,
			color: '#666',
			dashArray: '',
			fillOpacity: 0.7
		});

		if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) {
			layer.bringToFront();
		}

		info.update(layer.feature.properties);
	}

	var geojson;

	function resetHighlight(e) {
		geojson.resetStyle(e.target);
		info.update();
	}

	function zoomToFeature(e) {
		map.fitBounds(e.target.getBounds());
	}

	map.attributionControl.addAttribution('Population data &copy; <a href="http://census.gov/">US Census Bureau</a>');

	Papa.parse("https://nicholastulach.github.io/fdpa-demo/PAHouse.csv", {
    	download: true,
    	header: true,
	    complete: function(results, file) {
        	geojson = L.geoJson(statesData, {
				onEachFeature: function(feature, layer) {
					var popupText = "";
					var labelText = "";
					if (feature.properties && feature.properties.LEG_DISTRI) {
                    	popupText += "<b>District: " + feature.properties.LEG_DISTRI.toString() + "</b>";
						labelText = feature.properties.LEG_DISTRI.toString();
						var filtered = results.data.filter(function(data){return data.LEG_DISTRI == this;}, feature.properties.LEG_DISTRI.toString());
						popupText += "<br>Volunteer Count: " + JSON.stringify(parseInt(filtered[0].volunteers));
						feature.properties.support = filtered[0].support;
                    }
					if (feature.properties && feature.properties.description) {
                    	popupText += "<br>" + feature.properties.description.toString();
                    }
					layer.bindPopup(popupText)/*.bindLabel(labelText)*/;
					layer.on({
						mouseover: highlightFeature,
						mouseout: resetHighlight,
						click: zoomToFeature
					});
					layer.setStyle({ fillColor: getColor(feature.properties.support)})
				},
				style: style
			}).addTo(map);
    	},
    	error: function(error, file) {
	    	console.log("An error occurred in Papa.parse:", error)
    	}
	});

	var legend = L.control({position: 'bottomright'});

	legend.onAdd = function (map) {

		var div = L.DomUtil.create('div', 'info legend'),
			grades = ["Yes", "No", "Maybe"],
			labels = [];

		for (let grade of grades) {
			labels.push(
				'<i style="background:' + getColor(grade) + '"></i> ' + grade);
		}

		div.innerHTML = labels.join('<br>');
		return div;
	};

	legend.addTo(map);

</script>



</body>
</html>

<commit_msg>Change to hosted version of PapaParse<commit_after><!DOCTYPE html>
<html>
<head>
	
	<title>Simple PA Legislative District Map</title>

	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	
	<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />

	<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
	<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>


	<style>
		#map {
			width: 600px;
			height: 400px;
		}
	</style>

	<style>#map { width: 800px; height: 500px; }
.info { padding: 6px 8px; font: 14px/16px Arial, Helvetica, sans-serif; background: white; background: rgba(255,255,255,0.8); box-shadow: 0 0 15px rgba(0,0,0,0.2); border-radius: 5px; } .info h4 { margin: 0 0 5px; color: #777; }
.legend { text-align: left; line-height: 18px; color: #555; } .legend i { width: 18px; height: 18px; float: left; margin-right: 8px; opacity: 0.7; }</style>
</head>
<body>

<div id='map'></div>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/4.2.0/papaparse.min.js"></script>

<script type="text/javascript" src="pa-house.js"></script>

<script type="text/javascript">

	var map = L.map('map').setView([41.0, -77], 7);
	var csv;
	
		
	L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=<KEY>', {
		crossOrigin: true,
		maxZoom: 18,
		attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
			'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
			'Imagery © <a href="http://mapbox.com">Mapbox</a>',
		id: 'mapbox.light'
	}).addTo(map);


	// control that shows state info on hover
	var info = L.control();

	info.onAdd = function (map) {
		this._div = L.DomUtil.create('div', 'info');
		this.update();
		return this._div;
	};

	info.update = function (props) {
		this._div.innerHTML = '<h4>PA House District</h4>' +  (props ? '<b>' + props.LEG_DISTRI + '</b><br />'	: 'Select a district');
	};

	info.addTo(map);


	// get color depending on population density value
	function getColor(support) {
		return support === "Yes" ? 'green' :
				support === "Maybe"  ? 'gold' :
				support === "No"  ? 'firebrick' :
					'grey';
	}

	function style(feature) {
		return {
			weight: 2,
			opacity: 1,
			color: 'white',
			dashArray: '3',
			fillOpacity: 0.7,
			fillColor: getColor(feature.properties.support)
		};
	}

	function highlightFeature(e) {
		var layer = e.target;

		layer.setStyle({
			weight: 5,
			color: '#666',
			dashArray: '',
			fillOpacity: 0.7
		});

		if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) {
			layer.bringToFront();
		}

		info.update(layer.feature.properties);
	}

	var geojson;

	function resetHighlight(e) {
		geojson.resetStyle(e.target);
		info.update();
	}

	function zoomToFeature(e) {
		map.fitBounds(e.target.getBounds());
	}

	map.attributionControl.addAttribution('Population data &copy; <a href="http://census.gov/">US Census Bureau</a>');

	Papa.parse("https://nicholastulach.github.io/fdpa-demo/PAHouse.csv", {
    	download: true,
    	header: true,
	    complete: function(results, file) {
        	geojson = L.geoJson(statesData, {
				onEachFeature: function(feature, layer) {
					var popupText = "";
					var labelText = "";
					if (feature.properties && feature.properties.LEG_DISTRI) {
                    	popupText += "<b>District: " + feature.properties.LEG_DISTRI.toString() + "</b>";
						labelText = feature.properties.LEG_DISTRI.toString();
						var filtered = results.data.filter(function(data){return data.LEG_DISTRI == this;}, feature.properties.LEG_DISTRI.toString());
						popupText += "<br>Volunteer Count: " + JSON.stringify(parseInt(filtered[0].volunteers));
						feature.properties.support = filtered[0].support;
                    }
					if (feature.properties && feature.properties.description) {
                    	popupText += "<br>" + feature.properties.description.toString();
                    }
					layer.bindPopup(popupText)/*.bindLabel(labelText)*/;
					layer.on({
						mouseover: highlightFeature,
						mouseout: resetHighlight,
						click: zoomToFeature
					});
					layer.setStyle({ fillColor: getColor(feature.properties.support)})
				},
				style: style
			}).addTo(map);
    	},
    	error: function(error, file) {
	    	console.log("An error occurred in Papa.parse:", error)
    	}
	});

	var legend = L.control({position: 'bottomright'});

	legend.onAdd = function (map) {

		var div = L.DomUtil.create('div', 'info legend'),
			grades = ["Yes", "No", "Maybe"],
			labels = [];

		for (let grade of grades) {
			labels.push(
				'<i style="background:' + getColor(grade) + '"></i> ' + grade);
		}

		div.innerHTML = labels.join('<br>');
		return div;
	};

	legend.addTo(map);

</script>



</body>
</html>


{'fraction_non_alphanumeric': 0.18508230452674898, 'fraction_numerical': 0.019444444444444445, 'mean_word_length': 3.412619155696777, 'pattern_counts': {'":': 0, '<': 99, '<?xml version=': 0, '>': 99, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2422194', 'n_tokens_mistral': 3996, 'n_tokens_neox': 3410, 'n_words': 669}