<commit_before>// defaults
//

// good general center
//
var default_center_longitude = -73.979876
var default_center_latitude = 40.679718
var default_zoom = 13

// how many tiles to divide map into
//
var tiles_across = 1;
var tiles_down = 1;

// Milliseconds between points required to start new tracks
var NEW_TRACK_GAP_MILLIS = 150000;

// home
//
// var default_center_longitude = -73.96205100000000000000;
// var default_center_latitude = 40.68463700000000000000;

var center_longitude;
var center_latitude;

var bounds_change_timeout_millis = 500;

var tile_count = 0;
var heatmap_count = 0;
var line_count = 0;

var initial_zoom = default_zoom;
var initial_center_longitude = default_center_longitude;
var initial_center_latitude = default_center_latitude;

// How many hits are visible on the map; Tallied in draw_visualization()
// to display in pie chart text
//
var gVisibleHits;
var gBoundsStartCountingVisibleHits;

var gMap;

var gProgressBar;

function initialize() {
  gProgressBar = $( "#progressbar" );
  gProgressBar.progressbar({
    value: 0,
    max: 100
  });
           
  $.history.init(history_callback,  { unescape: "/=;&" });

  var latlng = new google.maps.LatLng(initial_center_latitude, initial_center_longitude);
  var myOptions = {
    zoom: initial_zoom,
    center: latlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  gMap = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  google.maps.event.addDomListener(gMap, 'bounds_changed', handle_bounds_changed);
  google.maps.event.addListener(gMap, 'mousemove', update_pointer_info);

  // if we can geolocate and we're on the default zoom and center, try to do it
  //
  if(navigator.geolocation && initial_center_latitude === default_center_latitude && initial_center_longitude === default_center_longitude)
  {
    navigator.geolocation.getCurrentPosition(position_handler, position_handler,  {maximumAge:600000, timeout:10000});
  }

}

function clearmap_button_onclick()
{
  clear_map(); 
}


function locateme_button_onclick()
{
    if(!navigator.geolocation) {
      display_error("Your browser doesn't support geolocation");
    }
    navigator.geolocation.getCurrentPosition(position_handler, position_handler,  {maximumAge:600000, timeout:10000});
}
function display_error(msg)
{
  $( "#dialog_message_text" ).html(msg);
  $( "#dialog_message" ).dialog({ modal: true, buttons: { Ok: function() { $( this ).dialog( "close" ); } } });
}

function position_handler(position)
{
  if(position.message)
  {
     display_error('geolocation error : ' + position.message);
  }
  else
  {
    if(position && position.coords)
    {
        initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
        gMap.setCenter(initialLocation);
    }
  }
}

var gobjDisplayedTiles = new Object();
var gobjDisplayedHeatmaps = new Object();
var gobjDisplayedLines = new Object();

function handle_bounds_changed()
{
  var bounds_changed_bounds = gMap.getBounds();
  var maybe_process_map_display = function() { 
    current_bounds = gMap.getBounds();
    if(current_bounds.equals(bounds_changed_bounds))
    {
      save_map_state();
      // process_map_display();
    }
    else
    {
      console.log('opting out of processing map display because bounds have changed since original handler call');
    }

  }
  setTimeout(maybe_process_map_display, bounds_change_timeout_millis);
}<commit_msg>add marker at current location<commit_after>// defaults
//

// good general center
//
var default_center_longitude = -73.979876
var default_center_latitude = 40.679718
var default_zoom = 13

// how many tiles to divide map into
//
var tiles_across = 1;
var tiles_down = 1;

// Milliseconds between points required to start new tracks
var NEW_TRACK_GAP_MILLIS = 150000;

// home
//
// var default_center_longitude = -73.96205100000000000000;
// var default_center_latitude = 40.68463700000000000000;

var center_longitude;
var center_latitude;

var bounds_change_timeout_millis = 500;

var tile_count = 0;
var heatmap_count = 0;
var line_count = 0;

var initial_zoom = default_zoom;
var initial_center_longitude = default_center_longitude;
var initial_center_latitude = default_center_latitude;

// How many hits are visible on the map; Tallied in draw_visualization()
// to display in pie chart text
//
var gVisibleHits;
var gBoundsStartCountingVisibleHits;

var gMap;

var gProgressBar;

function initialize() {
  gProgressBar = $( "#progressbar" );
  gProgressBar.progressbar({
    value: 0,
    max: 100
  });
           
  $.history.init(history_callback,  { unescape: "/=;&" });

  var latlng = new google.maps.LatLng(initial_center_latitude, initial_center_longitude);
  var myOptions = {
    zoom: initial_zoom,
    center: latlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  gMap = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  google.maps.event.addDomListener(gMap, 'bounds_changed', handle_bounds_changed);
  google.maps.event.addListener(gMap, 'mousemove', update_pointer_info);

  // if we can geolocate and we're on the default zoom and center, try to do it
  //
  if(navigator.geolocation && initial_center_latitude === default_center_latitude && initial_center_longitude === default_center_longitude)
  {
    navigator.geolocation.getCurrentPosition(position_handler, position_handler,  {maximumAge:600000, timeout:10000});
  }

}

function clearmap_button_onclick()
{
  clear_map(); 
}


function locateme_button_onclick()
{
    if(!navigator.geolocation) {
      display_error("Your browser doesn't support geolocation");
    }
    navigator.geolocation.getCurrentPosition(position_handler, position_handler,  {maximumAge:600000, timeout:10000});
}
function display_error(msg)
{
  $( "#dialog_message_text" ).html(msg);
  $( "#dialog_message" ).dialog({ modal: true, buttons: { Ok: function() { $( this ).dialog( "close" ); } } });
}

function position_handler(position)
{
  if(position.message)
  {
     display_error('geolocation error : ' + position.message);
  }
  else
  {
    if(position && position.coords)
    {
        initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
        gMap.setCenter(initialLocation);
        var marker = new google.maps.Marker
        ({
          position: initialLocation,
          map: gMap,
          title:"Current Location"
        });
    }
  }
}

var gobjDisplayedTiles = new Object();
var gobjDisplayedHeatmaps = new Object();
var gobjDisplayedLines = new Object();

function handle_bounds_changed()
{
  var bounds_changed_bounds = gMap.getBounds();
  var maybe_process_map_display = function() { 
    current_bounds = gMap.getBounds();
    if(current_bounds.equals(bounds_changed_bounds))
    {
      save_map_state();
      // process_map_display();
    }
    else
    {
      console.log('opting out of processing map display because bounds have changed since original handler call');
    }

  }
  setTimeout(maybe_process_map_display, bounds_change_timeout_millis);
}
{'fraction_non_alphanumeric': 0.10795857568449425, 'fraction_numerical': 0.028940275216342744, 'mean_word_length': 4.292792792792793, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, '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': '2044678', 'n_tokens_mistral': 2403, 'n_tokens_neox': 2227, 'n_words': 490}