<commit_before>var loading_screen;

var ParkingMap = ParkingMap || {};

(function () {
  'use strict';

  var mapLayers = {};
  var layerNames = ['rppblocks',
  'rppdistricts',
  //'scooters', 
  'lots',
  'valet',
  'meters',
  'satellite'];

  var accessToken = '<KEY>';

  var INTERACTIVE_PATTERN = /\.i$/;
  var isInteractive = function (feature) {
    /* Check whether the given feature belongs to an
     * interactive layer.
     */
    var layerName = feature.layer.id;
    return INTERACTIVE_PATTERN.test(layerName) && ParkingMap.map.getLayoutProperty(layerName, 'visibility') === 'visible';
  };

  var featuresAt = function (map, point, options, callback) {
    /* A wrapper around mapboxgl.Map.featuresAt that will
     * only take interactive layers into account. Layer
     * interactivity is determined by the isInteractive
     * function.
     *
     * TODO: Allow overriding the isInteractive method from
     * within the options.
     */

    // Hijack the callback.
    var hijacked = function (err, features) {
      var filteredFeatures = [],
        i;
      for (i = 0; i < features.length; i++) {
        if (isInteractive(features[i])) {
          filteredFeatures.push(features[i]);
        }
      }
      callback(err, filteredFeatures);
    };

    // Call mapboxgl.Map.featuresAt with the hijacked callback function.
    map.featuresAt(point, options, hijacked);
  };

  ParkingMap.initFancyMap = function () {
    var map;

    mapboxgl.accessToken = accessToken;

    // Set bounds to Philadelphia metro
    var bounds = [
  [-75.387541, 39.864439],
  [-74.883544, 40.156325]
];

    var map = ParkingMap.map = new mapboxgl.Map({
      container: 'map', // container id
      style: 'mapbox://styles/laurenancona/cij3k82x800018wkmhwgg7tgt', // stylesheet location
      center: [-75.1694, 39.9294],
      bearing: 9.2, // Rotate Philly ~9° off of north, thanks <NAME>.
      zoom: 12,
      maxZoom: 19,
      minZoom: 12,
      pitch: 60,
      //    maxBounds: bounds,
      hash: true,
      touchRotate: false
    });

    // Change cursor state when hovering on interactive features

    var getPoint = function (evt) {
      // MapboxGL will call it `point`, leaflet `containerPoint`.
      return evt.point || evt.containerPoint;
    };

    ParkingMap.map.on('mousemove', function (evt) {
      if (map.loaded()) {
        var point = getPoint(evt);
        featuresAt(map, point, {
          radius: 10
        }, function (err, features) {
          if (err) throw err;
          ParkingMap.map._container.classList.toggle('interacting', features.length > 0);
          //  document.getElementById('features').innerHTML = JSON.stringify(features, null, 2);
        });
      }
    });

    /* TODO: setTimeout instead of waiting for user to click
       from https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout:
    */

    ParkingMap.map.on('load', function (evt) {
      window.setTimeout(goHome, 2000);
    });

    function goHome() {
      if (map.loaded()) {
        var p = map.getPitch();
        console.log(p);
        if (p > 0) {
          map.flyTo({
            center: [-75.1650, 39.9433],
            zoom: 13,
            speed: 0.2,
            bearing: 9.2,
            pitch: 0
          });
        }
      }
    }

    // Flatten out pitch on first click for functional use

    //    ParkingMap.map.on('click', function (evt) {
    //      if (map.loaded()) {
    //        var p = map.getPitch();
    //        console.log(p);
    //        if (p > 0) {
    //          map.flyTo({
    //            center: [-75.1650, 39.9433],
    //            zoom: 13,
    //            speed: 0.2,
    //            bearing: 9.2,
    //            pitch: 0
    //          });
    //        }
    //      }
    //    });

    // Add/remove class for bottom button onClicks
    // From https://developer.mozilla.org/en-US/docs/Web/API/Element/classList:

    // if class 'quiet' is set remove it, otherwise add it
    document.getElementById("search").addEventListener('click', function (evt) {
      document.getElementById("geocoder-container").classList.toggle("quiet")
    });
    //
    //        //  add/remove 'quiet', depending on test conditional, i less than 10<commit_msg>Focus and select geocoder input on open<commit_after>var loading_screen;

var ParkingMap = ParkingMap || {};

(function () {
  'use strict';

  var mapLayers = {};
  var layerNames = ['rppblocks',
  'rppdistricts',
  //'scooters', 
  'lots',
  'valet',
  'meters',
  'satellite'];

  var accessToken = '<KEY>';

  var INTERACTIVE_PATTERN = /\.i$/;
  var isInteractive = function (feature) {
    /* Check whether the given feature belongs to an
     * interactive layer.
     */
    var layerName = feature.layer.id;
    return INTERACTIVE_PATTERN.test(layerName) && ParkingMap.map.getLayoutProperty(layerName, 'visibility') === 'visible';
  };

  var featuresAt = function (map, point, options, callback) {
    /* A wrapper around mapboxgl.Map.featuresAt that will
     * only take interactive layers into account. Layer
     * interactivity is determined by the isInteractive
     * function.
     *
     * TODO: Allow overriding the isInteractive method from
     * within the options.
     */

    // Hijack the callback.
    var hijacked = function (err, features) {
      var filteredFeatures = [],
        i;
      for (i = 0; i < features.length; i++) {
        if (isInteractive(features[i])) {
          filteredFeatures.push(features[i]);
        }
      }
      callback(err, filteredFeatures);
    };

    // Call mapboxgl.Map.featuresAt with the hijacked callback function.
    map.featuresAt(point, options, hijacked);
  };

  ParkingMap.initFancyMap = function () {
    var map;

    mapboxgl.accessToken = accessToken;

    // Set bounds to Philadelphia metro
    var bounds = [
  [-75.387541, 39.864439],
  [-74.883544, 40.156325]
];

    var map = ParkingMap.map = new mapboxgl.Map({
      container: 'map', // container id
      style: 'mapbox://styles/laurenancona/cij3k82x800018wkmhwgg7tgt', // stylesheet location
      center: [-75.1694, 39.9294],
      bearing: 9.2, // Rotate Philly ~9° off of north, thanks <NAME>.
      zoom: 12,
      maxZoom: 19,
      minZoom: 12,
      pitch: 60,
      //    maxBounds: bounds,
      hash: true,
      touchRotate: false
    });

    // Change cursor state when hovering on interactive features

    var getPoint = function (evt) {
      // MapboxGL will call it `point`, leaflet `containerPoint`.
      return evt.point || evt.containerPoint;
    };

    ParkingMap.map.on('mousemove', function (evt) {
      if (map.loaded()) {
        var point = getPoint(evt);
        featuresAt(map, point, {
          radius: 10
        }, function (err, features) {
          if (err) throw err;
          ParkingMap.map._container.classList.toggle('interacting', features.length > 0);
          //  document.getElementById('features').innerHTML = JSON.stringify(features, null, 2);
        });
      }
    });

    /* TODO: setTimeout instead of waiting for user to click
       from https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout:
    */

    ParkingMap.map.on('load', function (evt) {
      window.setTimeout(goHome, 2000);
    });

    function goHome() {
      if (map.loaded()) {
        var p = map.getPitch();
        console.log(p);
        if (p > 0) {
          map.flyTo({
            center: [-75.1650, 39.9433],
            zoom: 13,
            speed: 0.2,
            bearing: 9.2,
            pitch: 0
          });
        }
      }
    }

    // Flatten out pitch on first click for functional use

    //    ParkingMap.map.on('click', function (evt) {
    //      if (map.loaded()) {
    //        var p = map.getPitch();
    //        console.log(p);
    //        if (p > 0) {
    //          map.flyTo({
    //            center: [-75.1650, 39.9433],
    //            zoom: 13,
    //            speed: 0.2,
    //            bearing: 9.2,
    //            pitch: 0
    //          });
    //        }
    //      }
    //    });

    // Add/remove class for bottom button onClicks
    // From https://developer.mozilla.org/en-US/docs/Web/API/Element/classList:

    // if class 'quiet' is set remove it, otherwise add it
    var geocoderCt = document.getElementById('geocoder-container');

    document.getElementById('search').addEventListener('click', function (evt) {
      geocoderCt.classList.toggle('quiet');
      geocoderCt.querySelector('input').select();
    });
    //
    //        //  add/remove 'quiet', depending on test conditional, i less than 10
{'fraction_non_alphanumeric': 0.1364847642219905, 'fraction_numerical': 0.026879851697369946, 'mean_word_length': 2.0171268787137366, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 4, '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': '1596619', 'n_tokens_mistral': 2847, 'n_tokens_neox': 2631, 'n_words': 659}