<commit_before>function getLocation() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
    } else {
        alert('Geolocation is not suppurted');
    }
}

function showPosition(pos) {
    currentLocation = {
      lat: pos.coords.latitude,
      lng: pos.coords.longitude
    };
    map.setCenter(currentLocation);
    centerCoordContainer.innerHTML = currentLocation['lat'].toFixed(6) + ' : ' + currentLocation['lng'].toFixed(6);
}

var map, currentLocation, marker;
var centerCoordContainer = document.getElementById('output');
var autocomplete, autocompleteSelfLocation, geocoder;
var countryRestrict = {'country': 'georgia'};

function initMap() {
  map = new google.maps.Map(document.getElementById('map'), {
    zoom: 15
  });

  var input =  document.getElementById('pac-input');
  var inputSelfLocation = document.getElementById('pac-input-self-location');

  autocomplete = new google.maps.places.Autocomplete(input);
  autocompleteSelfLocation = new google.maps.places.Autocomplete(inputSelfLocation);

  geocoder = new google.maps.Geocoder;

  autocomplete.addListener('place_changed', function() {
    var place = autocomplete.getPlace();
    map.setCenter(place.geometry.location);
  });

  autocompleteSelfLocation.addListener('place_changed', function() {
    var place = autocompleteSelfLocation.getPlace();
    map.setCenter(place.geometry.location);
  });

  map.addListener('center_changed', function () {
    var center = map.getCenter();
    centerCoordContainer.innerHTML = center.lat().toFixed(6) + ' : ' + center.lng().toFixed(6);

    geocoder.geocode({'location': { lat:center.lat(), lng: center.lng() }}, function(results, status) {
      if (status === google.maps.GeocoderStatus.OK) {
        if (results[0]) {
          input.value = results[0].formatted_address;
        } else {
          // window.alert('No results found');
          input.value = "No results found";
        }
      }
    });
  })
}

getLocation();

// Creating backbone sceletone

var Navig = Backbone.Router.extend({
  routes: {
    "": "start",
    "!/": "start",
    "!/location": "location",
  },

  start: function() {
    $(".block").hide();
    $("#screen-container").show();
  },

  location: function () {
    $(".block").hide();
    $("#self-location-container").show();
  },
});

var route = new Navig();

var Start = Backbone.View.extend({
  el:$("#screen-container"),
  events:{
    "click button":"currentLocation"
  },
  currentLocation:function () {
    route.navigate("!/location", true);
  }
});

var Locate = Backbone.View.extend({
  el:$("#self-location-container"),
  events:{
    "click button.self-location-button":"locate"
  },
  locate:function () {
    route.navigate("!/", true);
  }
});

var start = new Start();
var locate = new Locate();

Backbone.history.start();<commit_msg>Render and hide methods are added to Views<commit_after>function getLocation() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
    } else {
        alert('Geolocation is not suppurted');
    }
}

function showPosition(pos) {
    currentLocation = {
      lat: pos.coords.latitude,
      lng: pos.coords.longitude
    };
    map.setCenter(currentLocation);
    centerCoordContainer.innerHTML = currentLocation['lat'].toFixed(6) + ' : ' + currentLocation['lng'].toFixed(6);
}

var map, currentLocation, marker;
var centerCoordContainer = document.getElementById('output');
var autocomplete, autocompleteSelfLocation, geocoder;
var countryRestrict = {'country': 'georgia'};

function initMap() {
  map = new google.maps.Map(document.getElementById('map'), {
    zoom: 15
  });

  var input =  document.getElementById('pac-input');
  var inputSelfLocation = document.getElementById('pac-input-self-location');

  autocomplete = new google.maps.places.Autocomplete(input);
  autocompleteSelfLocation = new google.maps.places.Autocomplete(inputSelfLocation);

  geocoder = new google.maps.Geocoder;

  autocomplete.addListener('place_changed', function() {
    var place = autocomplete.getPlace();
    map.setCenter(place.geometry.location);
  });

  autocompleteSelfLocation.addListener('place_changed', function() {
    var place = autocompleteSelfLocation.getPlace();
    map.setCenter(place.geometry.location);
  });

  map.addListener('center_changed', function () {
    var center = map.getCenter();
    centerCoordContainer.innerHTML = center.lat().toFixed(6) + ' : ' + center.lng().toFixed(6);

    geocoder.geocode({'location': { lat:center.lat(), lng: center.lng() }}, function(results, status) {
      if (status === google.maps.GeocoderStatus.OK) {
        if (results[0]) {
          input.value = results[0].formatted_address;
        } else {
          // window.alert('No results found');
          input.value = "No results found";
        }
      }
    });
  })
}

getLocation();

// Creating backbone sceletone

var Navig = Backbone.Router.extend({
  routes: {
    "": "start",
    "!/": "start",
    "!/location": "location",
  },

  start: function() {
    $(".block").hide();
    $("#screen-container").show();
  },

  location: function () {
    $(".block").hide();
    $("#self-location-container").show();
  },
});

var route = new Navig();

var Start = Backbone.View.extend({
  el:$("#screen-container"),
  events:{
    "click button":"currentLocation"
  },
  render: function () {
    $(this.el).show();
  },
  hide: function () {
    $(this.el).hide();
  }
  // currentLocation:function () {
  //   route.navigate("!/location", true);
  // }
});

var Locate = Backbone.View.extend({
  el:$("#self-location-container"),
  events:{
    "click button.self-location-button":"locate"
  },
  render: function () {
    $(this.el).show();
  },
  hide: function () {
    $(this.el).hide();
  }
  // locate:function () {
  //   route.navigate("!/", true);
  // }
});

var start = new Start();
var locate = new Locate();

Backbone.history.start();
{'fraction_non_alphanumeric': 0.17155302395711175, 'fraction_numerical': 0.002680515999329871, 'mean_word_length': 3.5782208588957056, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 3, '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': '1014166', 'n_tokens_mistral': 1889, 'n_tokens_neox': 1834, 'n_words': 322}