<commit_before>function init_map() {
	var highlightStyle = {
		color: '#fff',
		opacity: 1,
	};

	var map = L.map('map');
	new L.OSM.CycleMap().addTo(map);
	var elevation = L.control.elevation({ width: 500 });
	elevation.addTo(map);

	var routesLayer = L.featureGroup().addTo(map);
	var routeCount = tracks.length;
	var colors = unique_colors(routeCount);
	var count = 0;
	var loadedCount = 0;

	tracks.forEach(function(track) {
		$.get("tracks/" + track, function(data) {
			var route = new L.GPX(data, {
				async: true,
				marker_options: { startIconUrl: null, endIconUrl: null },
				polyline_options: {
					color: colors[count++],
					opacity: 0.75,
					distanceMarkers: { lazy: true },
				}
			});
			route.on('addline', function(evt) {
				var polyline = evt.line;
				var originalStyle = polyline.options;

				polyline.on('mouseover', function() {
					polyline.setStyle(highlightStyle)
					polyline.addDistanceMarkers();
				});
				polyline.on('mouseout', function() {
					polyline.setStyle(originalStyle)
					polyline.removeDistanceMarkers();
				});
				polyline.on('click', function() {
					elevation.clear();
					elevation.addData(polyline);
				});

				polyline.bindLabel(route.get_name(), { direction: 'auto' });
			});
			route.on('loaded', function() {
				if (++loadedCount === routeCount) {
					map.fitBounds(routesLayer.getBounds());
				}
			});
			route.addTo(routesLayer);
		});<commit_msg>defer adding elevation plot until track is selected<commit_after>function init_map() {
	var highlightStyle = {
		color: '#fff',
		opacity: 1,
	};

	var map = L.map('map');
	new L.OSM.CycleMap().addTo(map);
	var elevation = L.control.elevation({ width: 500 });

	var routesLayer = L.featureGroup().addTo(map);
	var routeCount = tracks.length;
	var colors = unique_colors(routeCount);
	var count = 0;
	var loadedCount = 0;

	tracks.forEach(function(track) {
		$.get("tracks/" + track, function(data) {
			var route = new L.GPX(data, {
				async: true,
				marker_options: { startIconUrl: null, endIconUrl: null },
				polyline_options: {
					color: colors[count++],
					opacity: 0.75,
					distanceMarkers: { lazy: true },
				}
			});
			route.on('addline', function(evt) {
				var polyline = evt.line;
				var originalStyle = polyline.options;

				polyline.on('mouseover', function() {
					polyline.setStyle(highlightStyle)
					polyline.addDistanceMarkers();
				});
				polyline.on('mouseout', function() {
					polyline.setStyle(originalStyle)
					polyline.removeDistanceMarkers();
				});
				polyline.on('click', function() {
					if (!elevation.getContainer()) {
						elevation.addTo(map);
					}
					elevation.clear();
					elevation.addData(polyline);
				});

				polyline.bindLabel(route.get_name(), { direction: 'auto' });
			});
			route.on('loaded', function() {
				if (++loadedCount === routeCount) {
					map.fitBounds(routesLayer.getBounds());
				}
			});
			route.addTo(routesLayer);
		});
{'fraction_non_alphanumeric': 0.1611148878314072, 'fraction_numerical': 0.006118286879673691, 'mean_word_length': 3.445619335347432, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '4448354', 'n_tokens_mistral': 1229, 'n_tokens_neox': 973, 'n_words': 183}