<commit_before>var MAEDImap = {};
var MAEDImap = function(elID) {
  var map, layerControl, year;
  var markers = {}

  this.addLocation = function(data) {
    console.log("addLocation", data);
    var newLocation = new L.marker(
      new L.LatLng(
        data['latitude'],
        data['longitude']
      )
    );
    var popupContent = getPopupContent(data);
    newLocation.bindPopup(popupContent);
    map.addLayer(newLocation);
    markers[data.geonamesid] = newLocation;
  }
  
  this.removeLocation = function(data) {
    map.removeLayer(markers[data['geonamesid']]);
  }

  this._init = function () {
    layer_MapBox = new L.tileLayer(
    'https://d.tiles.mapbox.com/v3/markbrough.n3kod47p/{z}/{x}/{y}.png',{
        maxZoom: 15, attribution: 'MapBox Streets'
    })
    map = new L.Map(elID, {
        center: new L.LatLng(18,-2),
        zoom: 5,
        maxZoom: 15
    });
    layer_MapBox.addTo(map);
    map.scrollWheelZoom.disable();
  }
  
  this.resize = function() {
    map.invalidateSize();
  }

  function getPopupContent(data) {<commit_msg>Adjust map to improve toggling<commit_after>var MAEDImap = {};
var markers = {}
var MAEDImap = function(elID) {
  var map, layerControl, year;

  this.addLocation = function(data) {
    var newLocation = new L.marker(
      new L.LatLng(
        data['latitude'],
        data['longitude']
      )
    );
    var popupContent = getPopupContent(data);
    newLocation.bindPopup(popupContent);
    map.addLayer(newLocation);
    markers[data.id] = newLocation;
  }
  
  this.removeLocation = function(data) {
    map.removeLayer(markers[data['id']]);
  }
  this.toggleLocation = function(data) {
    if (data.id in markers) {
      this.removeLocation(data);
      delete markers[data.id];
      return "removed";
    } else {
      this.addLocation(data);
      return "added";
    }
  }

  this._init = function () {
    layer_MapBox = new L.tileLayer(
    'https://d.tiles.mapbox.com/v3/markbrough.n3kod47p/{z}/{x}/{y}.png',{
        maxZoom: 15, attribution: 'MapBox Streets'
    })
    map = new L.Map(elID, {
        center: new L.LatLng(18,-2),
        zoom: 5,
        maxZoom: 15
    });
    layer_MapBox.addTo(map);
    map.scrollWheelZoom.disable();
  }
  
  this.resize = function() {
    map.invalidateSize();
  }

  function getPopupContent(data) {
{'fraction_non_alphanumeric': 0.14709677419354839, 'fraction_numerical': 0.01032258064516129, 'mean_word_length': 2.745571658615137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2337908', 'n_tokens_mistral': 837, 'n_tokens_neox': 818, 'n_words': 139}