<commit_before>var app = {

  urlParams: {},

  userFields: [],

  bounds: new google.maps.LatLngBounds(),

  infoWindow: new google.maps.InfoWindow(),

  autocomplete: new google.maps.places.Autocomplete((document.getElementById("search")), {
    types: ["geocode"]
  }),

  init: function() {
    this.bindUIActions();
    this.loadURLparams();
    this.buildMap();
    this.initLocationCtrl();

    $(window).resize(function () {
      $("#table").bootstrapTable("resetView", {
        height: $("#table-container").height()
      });
      google.maps.event.trigger(map, "resize");
    });
  },

  bindUIActions: function() {
    $("#extent-btn").click(function() {
      app.map.fitBounds(app.bounds);
      $(".navbar-collapse.in").collapse("hide");
      return false;
    });

    $("#legend-btn").click(function() {
      $("#legend-modal").modal("show");
      $(".navbar-collapse.in").collapse("hide");
      return false;
    });

    $("[name='view']").click(function() {
      $(".in,.open").removeClass("in open");
      if (this.id === "split-view-btn") {
        app.switchView("split");
        return false;
      } else if (this.id === "map-view-btn") {
        app.switchView("map");
        return false;
      } else if (this.id === "table-view-btn") {
        app.switchView("table");
        return false;
      }
    });
  },

  loadURLparams: function() {
    if (location.search) {
      var parts = location.search.substring(1).split("&");
      for (var i = 0; i < parts.length; i++) {
        var nv = parts[i].split("=");
        if (!nv[0]) continue;
        app.urlParams[nv[0]] = nv[1] || true;
      }
    }

    if (app.urlParams.title && app.urlParams.title.length > 0) {
      var title = decodeURI(app.urlParams.title);
      $("[name='title']").html(title);
    }

    if (app.urlParams.src) {
      app.fetchData(decodeURIComponent(app.urlParams.src));
      $("#download-btn").attr("href", app.urlParams.src);
    } else {
      window.location = window.location.href + "build.html";
      return false;
    }

    if (app.urlParams.icon && app.urlParams.icon.length > 0) {
      $("#navbar-title").prepend("<img src='" + decodeURIComponent(app.urlParams.icon) + "'>");
      $("[name=icon]").attr("href", decodeURIComponent(app.urlParams.icon));
    }

    if (app.urlParams.fields) {
      app.fields = decodeURIComponent(app.urlParams.fields).split(",");
      $.each(app.fields, function(index, field) {
        field = decodeURI(field);
        app.userFields.push(field);
      });
    }
  },

  buildMap: function() {
    app.map = new google.maps.Map(document.getElementById("map"), {
      styles: [{
        featureType: "poi",
        stylers: [{visibility: "off"}]
      }, {
        featureType: "transit",
        elementType: "labels.icon",
        stylers: [{visibility: "off"}]
      }],
      fullscreenControl: false,
      mapTypeId: app.urlParams.map ? app.urlParams.map : "roadmap"
    });

    app.selectedFeature = new google.maps.Data({
      map: app.map,
      style: {
        clickable: false,
        fillColor: "#00ffff",
        fillOpacity: 0,
        strokeColor: "#00ffff",
        strokeWeight: (app.urlParams.style && JSON.parse(decodeURIComponent(app.urlParams.style)).strokeWeight) ? JSON.parse(decodeURIComponent(app.urlParams.style)).strokeWeight : 2,
        icon: {
          path: google.maps.SymbolPath.CIRCLE,
          scale: (app.urlParams.style && JSON.parse(decodeURIComponent(app.urlParams.style)).icon && JSON.parse(decodeURIComponent(app.urlParams.style)).icon.scale) ? JSON.parse(decodeURIComponent(app.urlParams.style)).icon.scale : 5,
          strokeColor: "white",
          strokeWeight: (app.urlParams.style && JSON.parse(decodeURIComponent(app.urlParams.style)).icon && JSON.parse(decodeURIComponent(app.urlParams.style)).icon.strokeWeight) ? JSON.parse(decodeURIComponent(app.urlParams.style)).icon.strokeWeight : 1,
          fillColor: "#00ffff",
          fillOpacity: 0.9
        }
      }
    });

    app.map.addListener("click", function(event) {
      $("input").blur();
      app.selectedFeature.forEach(function(feature) {
        app.selectedFeature.remove(feature);
      });
    });

    app.map.addListener("dragstart", function(event) {
      $("input").blur();
    });

    app.autocomplete.addListener("place_changed", function() {
      var place = this.getPlace();
      if (place) {
        app.placeChanged(place);
      }
    });

    app.autocomplete.bindTo("bounds", app.map);

    app.map.data.setStyle(function(feature) {
      var style = {
        fillColor: "red",
        fillOpacity: 0.2,
        strokeColor: "red",
        strokeOpacity: 1,
        strokeWeight: 2
      };

      if (app.urlParams.style) {
        style = JSON.parse(decodeURIComponent(app.urlParams.style));

        if (style.property && style.values) {
          var value = feature.getProperty(style.property);
          style = {
            fillColor: style.values[value] ? style.values[value] : "white",
            fillOpacity: 0.2,
            strokeColor: style.values[value] ? style.values[value] : "white",
            strokeOpacity: 1,
            strokeWeight: 2,
            icon: (style.values[value] && style.values[value].startsWith("http")) ? style.values[value] : {
              path: google.maps.SymbolPath.CIRCLE,
              scale: 5,
              strokeColor: "white",
              strokeWeight: 1,
              fillColor: style.values[value] ? style.values[value] : "white",
              fillOpacity: 0.9
            }<commit_msg>Add zIndex values so selection highlight is always on top<commit_after>var app = {

  urlParams: {},

  userFields: [],

  bounds: new google.maps.LatLngBounds(),

  infoWindow: new google.maps.InfoWindow(),

  autocomplete: new google.maps.places.Autocomplete((document.getElementById("search")), {
    types: ["geocode"]
  }),

  init: function() {
    this.bindUIActions();
    this.loadURLparams();
    this.buildMap();
    this.initLocationCtrl();

    $(window).resize(function () {
      $("#table").bootstrapTable("resetView", {
        height: $("#table-container").height()
      });
      google.maps.event.trigger(map, "resize");
    });
  },

  bindUIActions: function() {
    $("#extent-btn").click(function() {
      app.map.fitBounds(app.bounds);
      $(".navbar-collapse.in").collapse("hide");
      return false;
    });

    $("#legend-btn").click(function() {
      $("#legend-modal").modal("show");
      $(".navbar-collapse.in").collapse("hide");
      return false;
    });

    $("[name='view']").click(function() {
      $(".in,.open").removeClass("in open");
      if (this.id === "split-view-btn") {
        app.switchView("split");
        return false;
      } else if (this.id === "map-view-btn") {
        app.switchView("map");
        return false;
      } else if (this.id === "table-view-btn") {
        app.switchView("table");
        return false;
      }
    });
  },

  loadURLparams: function() {
    if (location.search) {
      var parts = location.search.substring(1).split("&");
      for (var i = 0; i < parts.length; i++) {
        var nv = parts[i].split("=");
        if (!nv[0]) continue;
        app.urlParams[nv[0]] = nv[1] || true;
      }
    }

    if (app.urlParams.title && app.urlParams.title.length > 0) {
      var title = decodeURI(app.urlParams.title);
      $("[name='title']").html(title);
    }

    if (app.urlParams.src) {
      app.fetchData(decodeURIComponent(app.urlParams.src));
      $("#download-btn").attr("href", app.urlParams.src);
    } else {
      window.location = window.location.href + "build.html";
      return false;
    }

    if (app.urlParams.icon && app.urlParams.icon.length > 0) {
      $("#navbar-title").prepend("<img src='" + decodeURIComponent(app.urlParams.icon) + "'>");
      $("[name=icon]").attr("href", decodeURIComponent(app.urlParams.icon));
    }

    if (app.urlParams.fields) {
      app.fields = decodeURIComponent(app.urlParams.fields).split(",");
      $.each(app.fields, function(index, field) {
        field = decodeURI(field);
        app.userFields.push(field);
      });
    }
  },

  buildMap: function() {
    app.map = new google.maps.Map(document.getElementById("map"), {
      styles: [{
        featureType: "poi",
        stylers: [{visibility: "off"}]
      }, {
        featureType: "transit",
        elementType: "labels.icon",
        stylers: [{visibility: "off"}]
      }],
      fullscreenControl: false,
      mapTypeId: app.urlParams.map ? app.urlParams.map : "roadmap"
    });

    app.selectedFeature = new google.maps.Data({
      map: app.map,
      style: {
        clickable: false,
        zIndex: 2,
        fillColor: "#00ffff",
        fillOpacity: 0,
        strokeColor: "#00ffff",
        strokeWeight: (app.urlParams.style && JSON.parse(decodeURIComponent(app.urlParams.style)).strokeWeight) ? JSON.parse(decodeURIComponent(app.urlParams.style)).strokeWeight : 2,
        icon: {
          path: google.maps.SymbolPath.CIRCLE,
          scale: (app.urlParams.style && JSON.parse(decodeURIComponent(app.urlParams.style)).icon && JSON.parse(decodeURIComponent(app.urlParams.style)).icon.scale) ? JSON.parse(decodeURIComponent(app.urlParams.style)).icon.scale : 5,
          strokeColor: "white",
          strokeWeight: (app.urlParams.style && JSON.parse(decodeURIComponent(app.urlParams.style)).icon && JSON.parse(decodeURIComponent(app.urlParams.style)).icon.strokeWeight) ? JSON.parse(decodeURIComponent(app.urlParams.style)).icon.strokeWeight : 1,
          fillColor: "#00ffff",
          fillOpacity: 0.9
        }
      }
    });

    app.map.addListener("click", function(event) {
      $("input").blur();
      app.selectedFeature.forEach(function(feature) {
        app.selectedFeature.remove(feature);
      });
    });

    app.map.addListener("dragstart", function(event) {
      $("input").blur();
    });

    app.autocomplete.addListener("place_changed", function() {
      var place = this.getPlace();
      if (place) {
        app.placeChanged(place);
      }
    });

    app.autocomplete.bindTo("bounds", app.map);

    app.map.data.setStyle(function(feature) {
      var style = {
        zIndex: 1,
        fillColor: "red",
        fillOpacity: 0.2,
        strokeColor: "red",
        strokeOpacity: 1,
        strokeWeight: 2
      };

      if (app.urlParams.style) {
        style = JSON.parse(decodeURIComponent(app.urlParams.style));

        if (style.property && style.values) {
          var value = feature.getProperty(style.property);
          style = {
            fillColor: style.values[value] ? style.values[value] : "white",
            fillOpacity: 0.2,
            strokeColor: style.values[value] ? style.values[value] : "white",
            strokeOpacity: 1,
            strokeWeight: 2,
            icon: (style.values[value] && style.values[value].startsWith("http")) ? style.values[value] : {
              path: google.maps.SymbolPath.CIRCLE,
              scale: 5,
              strokeColor: "white",
              strokeWeight: 1,
              fillColor: style.values[value] ? style.values[value] : "white",
              fillOpacity: 0.9
            }
{'fraction_non_alphanumeric': 0.17222321269388483, 'fraction_numerical': 0.0057051167766090215, 'mean_word_length': 2.5302076777847704, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2831279', 'n_tokens_mistral': 3521, 'n_tokens_neox': 3483, 'n_words': 535}