<commit_before>// marker icons: https://www.mapbox.com/maki-icons

(function() {

  var filters = null;
  var checkboxes = [];
  var map = null;
  var geojsonData = {};
  var featureLayer = null;

  var mapboxSettings = {
    accessToken: "<KEY>",
    tileLayerId: "olistik.00d43ij6" // or "mapbox.streets"
  };

  var viewSettings = {
    // center of Desio
    latitude: 45.61820986655421,
    longitude: 9.207572937011719,
    zoomLevel: 15
  };

  function capitalize(string) {
    if (string.length > 0) {
      return string.charAt(0).toUpperCase() + string.slice(1);
    } else {
      return "";
    }
  }

  }

  function fetchDataset(datasetUrl, callback) {
    fetch(datasetUrl).then(function(response) {
      return response.json();
    }).then(function(json) {
      callback(json);
    });
  }

  function createCustomTooltips() {
    var layers = featureLayer.getLayers();
    for (var i = 0; i < layers.length; ++i) {
      var layer = layers[i];
      var marker = layer;
      var feature = marker.feature;

      var content = "";
      content += feature.properties.title + "<br />";
      content += "Indirizzo: " + feature.properties.address + "<br />";
      content += "URL: " + "<a href=\"" + feature.properties.url + "\">" + feature.properties.url + "</a><br />";
      content += "e-mail: " + "<a href=\"mailto:" + feature.properties["e-mail"] + "\">" + feature.properties["e-mail"] + "</a><br />";
      content += "Tel. " + "<a href=\"call:" + feature.properties.telephone + "\">" + feature.properties.telephone + "</a><br />";

      marker.bindPopup(content, {
        closeButton: false,
        minWidth: 320
      });
    }
  }

  function update() {
    var enabled = {};
    for (var i = 0; i < checkboxes.length; i++) {
      if (checkboxes[i].checked) {
        enabled[checkboxes[i].id] = true;
      }
    }
    featureLayer.setFilter(function(feature) {
      return (feature.properties.category in enabled);
    });<commit_msg>shows fields only if present<commit_after>// marker icons: https://www.mapbox.com/maki-icons

(function() {

  var filters = null;
  var checkboxes = [];
  var map = null;
  var geojsonData = {};
  var featureLayer = null;

  var mapboxSettings = {
    accessToken: "<KEY>",
    tileLayerId: "olistik.00d43ij6" // or "mapbox.streets"
  };

  var viewSettings = {
    // center of Desio
    latitude: 45.61820986655421,
    longitude: 9.207572937011719,
    zoomLevel: 15
  };

  function capitalize(string) {
    if (string.length > 0) {
      return string.charAt(0).toUpperCase() + string.slice(1);
    } else {
      return "";
    }
  }

  function isPresent(string) {
    return string !== undefined && string !== null && string.length > 0;
  }

  function fetchDataset(datasetUrl, callback) {
    fetch(datasetUrl).then(function(response) {
      return response.json();
    }).then(function(json) {
      callback(json);
    });
  }

  function createCustomTooltips() {
    var layers = featureLayer.getLayers();
    for (var i = 0; i < layers.length; ++i) {
      var layer = layers[i];
      var marker = layer;
      var feature = marker.feature;

      var content = "";
      content += "<strong>" + feature.properties.title + "</strong><br />";

      if (isPresent(feature.properties.address)) {
        content += "Indirizzo: " + feature.properties.address + "<br />";
      }
      if (isPresent(feature.properties.url)) {
        content += "URL: " + "<a href=\"" + feature.properties.url + "\">" + feature.properties.url + "</a><br />";
      }
      if (isPresent(feature.properties["e-mail"])) {
        content += "e-mail: " + "<a href=\"mailto:" + feature.properties["e-mail"] + "\">" + feature.properties["e-mail"] + "</a><br />";
      }
      if (isPresent(feature.properties.telephone)) {
        content += "Tel. " + "<a href=\"call:" + feature.properties.telephone + "\">" + feature.properties.telephone + "</a><br />";
      }

      marker.bindPopup(content, {
        closeButton: false,
        minWidth: 320
      });
    }
  }

  function update() {
    var enabled = {};
    for (var i = 0; i < checkboxes.length; i++) {
      if (checkboxes[i].checked) {
        enabled[checkboxes[i].id] = true;
      }
    }
    featureLayer.setFilter(function(feature) {
      return (feature.properties.category in enabled);
    });
{'fraction_non_alphanumeric': 0.17383263985205732, 'fraction_numerical': 0.021960240406842347, 'mean_word_length': 2.6088407005838197, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 32, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '5849844', 'n_tokens_mistral': 1466, 'n_tokens_neox': 1375, 'n_words': 284}