<commit_before>/* global L,
          REVERSE_URL,
          map
*/

L.Control.ReverseLabel = L.Control.extend({
  options: {
    position: 'topright', // hack
  },

  onAdd: () => {
    const container = L.DomUtil.create('div', 'reverse-label');
    const reverse = new L.PhotonReverse({
      url: REVERSE_URL,
      handleResults: (data) => {
        container.innerHTML = `Carte centrée sur «${data.features[0].properties.label}»`;
      },
      /* eslint-enable no-unused-vars */
    });

    map.on('moveend', () => {
      if (map.getZoom() > 14) {
        reverse.doReverse(this.getCenter());
        document.getElementById('head').className += ' headmasked';
        document.getElementById('map').className += ' nohead';
      } else {
        container.innerHTML = '';
      }
    });
    return container;
  },
});

new L.Control.ReverseLabel().addTo(map);<commit_msg>Fix also an old bug, in reverseLabel.js<commit_after>/* global L,
          REVERSE_URL,
          map
*/

L.Control.ReverseLabel = L.Control.extend({
  options: {
    position: 'topright', // hack
  },

  onAdd: () => {
    const container = L.DomUtil.create('div', 'reverse-label');
    const reverse = new L.PhotonReverse({
      url: REVERSE_URL,
      handleResults: (data) => {
        container.innerHTML = `Carte centrée sur «${data.features[0].properties.label}»`;
      },
      /* eslint-enable no-unused-vars */
    });

    map.on('moveend', () => {
      if (map.getZoom() > 14) {
        reverse.doReverse(map.getCenter());
        document.getElementById('head').className += ' headmasked';
        document.getElementById('map').className += ' nohead';
      } else {
        container.innerHTML = '';
      }
    });
    return container;
  },
});

new L.Control.ReverseLabel().addTo(map);
{'fraction_non_alphanumeric': 0.1732811626607043, 'fraction_numerical': 0.003353828954723309, 'mean_word_length': 2.4689922480620154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2189421', 'n_tokens_mistral': 581, 'n_tokens_neox': 564, 'n_words': 101}