<commit_before>$(document).ready(function(){
  var lat;
  var long;
  var location;
  var state;
  var city;

  // Documentation from Mdn geolocation for html5 and its accuracy
  var options = {
    enableHighAccuracy: true,
    timeout: 5000,
    maximumAge: 0
  };

  function success(pos){
    var crd = pos.coords;

    /* => Previous Code
    console.log('Your current position is:');
    console.log(`Latitude : ${crd.latitude}`);
    console.log(`Longitude: ${crd.longitude}`);
    console.log(`More or less ${crd.accuracy} meters.`);
    console.log(crd.latitude + "1");*/

    lat = crd.latitude.toFixed(2);
    long= crd.longitude.toFixed(2);

    var weather = function(long,lat){
      var apiKey ="eefb3de557ed0c0a";
      var api = "http://api.wunderground.com/api/"+apiKey +"/geolookup/q/" +long+ "," + lat +".json";
      
      console.log(api);

      // JSON Call to get location
      $.getJSON(api,function(data){
        location = data.location.city.replace(/ /g,"_");
        state = data.location.state
        $('#location').html(location+","+state);
        console.log(location,state);

        var api2 = "http://api.wunderground.com/api/"+apiKey +"/conditions/q/"+state+"/"+location+".json";
        console.log(api2);
        $.getJSON(api2,function(data){
          //console...... other stuff

          var weatherInfo = data.current_observation.weather;
          $('#weatherInfo').html(weatherInfo);
          // console.log(weatherInfo);

          var weather_icon = data.current_observation.icon_url;
          var security = "https://crossorigin.me/"+weather_icon;
          $("#weather_icon").attr("src",weather_icon);
          // console.log(weather_icon);

         // CHAnge me 
          var api3 = "https://fcc-weather-api.glitch.me/api/current?lat=" +lat+'&lon=' +long;
          console.log(api3)
          $.getJSON(api3,function(data){
          
          var sunriseTime= new Date(1000 * data.sys.sunrise);
          sunriseTime= sunriseTime.getHours() + ":" + sunriseTime.getMinutes();
          //==> PM version
          var sunsetTime= new Date(1000 * data.sys.sunset);
          var sunsetHr = sunsetTime.getHours();
          if (sunsetHr <= 11){
          console.log("fix me please");
          }else(sunsetHr > 11)
          sunsetHr = sunsetHr -12;
          sunsetTime= sunsetHr + ":" + sunsetTime.getMinutes();
          // var sunup =
          // var sundown = 
          });

          var windSpeed = data.current_observation.wind_mph;
          $("#windSpeed").html(windSpeed+" mph");
          // console.log(windSpeed);

          var humidity = data.current_observation.relative_humidity;
          console.log(humidity);

          var pressure = data.current_observation.pressure_mb;
          console.log(pressure);

          // var marco = data.current_observation.temperature_string;
          // console.log(marco);


          //DATE AND TIME//
          //Converted into days, months, hours, day-name, AM/PM
          //Understood it but it took too long to code.
          var dt = new Date();
          var days = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
          $('#day').html(days[dt.getDay()]);
          var months = ["January","February","March","April","May","June","July","August","September","October","November","December"]
          $('#date').html(months[dt.getMonth()] + " " + dt.getDate() + ", " + dt.getFullYear());
          $('#time').html((dt.getHours()>12?(dt.getHours()-12):dt.getHours()).toString() + ":" + ((dt.getMinutes() < 10 ? '0' : '').toString() + dt.getMinutes().toString()) + (dt.getHours() < 12 ? ' AM' : ' PM').toString());
        });
      });
    };
    weather(lat,long);
    };
  
  function error(err) {
  console.warn(`ERROR(${err.code}): ${err.message}`);
  };

  navigator.geolocation.getCurrentPosition(success, error, options);

});







/*Testing Information
googleapis
var apiKey = "<KEY>"
var api = "http://ip-api.com/json/?callback=yourfunction"*/
<commit_msg>gonna add another api<commit_after>$(document).ready(function(){
  var lat;
  var long;
  var location;
  var state;
  var city;

  // Documentation from Mdn geolocation for html5 and its accuracy
  var options = {
    enableHighAccuracy: true,
    timeout: 5000,
    maximumAge: 0
  };

  function success(pos){
    var crd = pos.coords;

    /* => Previous Code
    console.log('Your current position is:');
    console.log(`Latitude : ${crd.latitude}`);
    console.log(`Longitude: ${crd.longitude}`);
    console.log(`More or less ${crd.accuracy} meters.`);
    console.log(crd.latitude + "1");*/

    lat = crd.latitude.toFixed(2);
    long= crd.longitude.toFixed(2);

    var weather = function(long,lat){
      var apiKey ="eefb3de557ed0c0a";
      var api = "http://api.wunderground.com/api/"+apiKey +"/geolookup/q/" +long+ "," + lat +".json";
      
      console.log(api);

      // JSON Call to get location
      $.getJSON(api,function(data){
        location = data.location.city.replace(/ /g,"_");
        state = data.location.state
        $('#location').html(location+","+state);
        console.log(location,state);

        var api2 = "http://api.wunderground.com/api/"+apiKey +"/conditions/q/"+state+"/"+location+".json";
        console.log(api2);
        $.getJSON(api2,function(data){
          //console...... other stuff

          var weatherInfo = data.current_observation.weather;
          $('#weatherInfo').html(weatherInfo);
          // console.log(weatherInfo);

          var weather_icon = data.current_observation.icon_url;
          var security = "https://crossorigin.me/"+weather_icon;
          $("#weather_icon").attr("src",weather_icon);
          // console.log(weather_icon);

         // // CHAnge me 
         // https://sunrise-sunset.org/api
          var api3 = "https://fcc-weather-api.glitch.me/api/current?lat=" +lat+'&lon=' +long;
          console.log(api3)
          $.getJSON(api3,function(data){
          
          var sunriseTime= new Date(1000 * data.sys.sunrise);
          sunriseTime= sunriseTime.getHours() + ":" + sunriseTime.getMinutes();
          //==> PM version
          var sunsetTime= new Date(1000 * data.sys.sunset);
          var sunsetHr = sunsetTime.getHours();
          if (sunsetHr <= 11){
          console.log("fix me please");
          }else(sunsetHr > 11)
          sunsetHr = sunsetHr -12;
          sunsetTime= sunsetHr + ":" + sunsetTime.getMinutes();
          // var sunup =
          // var sundown = 
          });

          var windSpeed = data.current_observation.wind_mph;
          $("#windSpeed").html(windSpeed+" mph");
          // console.log(windSpeed);

          var humidity = data.current_observation.relative_humidity;
          console.log(humidity);

          var pressure = data.current_observation.pressure_mb;
          console.log(pressure);

          // var marco = data.current_observation.temperature_string;
          // console.log(marco);


          //DATE AND TIME//
          //Converted into days, months, hours, day-name, AM/PM
          //Understood it but it took too long to code.
          var dt = new Date();
          var days = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
          $('#day').html(days[dt.getDay()]);
          var months = ["January","February","March","April","May","June","July","August","September","October","November","December"]
          $('#date').html(months[dt.getMonth()] + " " + dt.getDate() + ", " + dt.getFullYear());
          $('#time').html((dt.getHours()>12?(dt.getHours()-12):dt.getHours()).toString() + ":" + ((dt.getMinutes() < 10 ? '0' : '').toString() + dt.getMinutes().toString()) + (dt.getHours() < 12 ? ' AM' : ' PM').toString());
        });
      });
    };
    weather(lat,long);
    };
  
  function error(err) {
  console.warn(`ERROR(${err.code}): ${err.message}`);
  };

  navigator.geolocation.getCurrentPosition(success, error, options);

});







/*Testing Information
googleapis
var apiKey = "<KEY>"
var api = "http://ip-api.com/json/?callback=yourfunction"*/

{'fraction_non_alphanumeric': 0.17151754701161817, 'fraction_numerical': 0.010540184453227932, 'mean_word_length': 2.2668231611893583, 'pattern_counts': {'":': 6, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 5, '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': '2590964', 'n_tokens_mistral': 2773, 'n_tokens_neox': 2528, 'n_words': 456}