Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="area-around-box">
  <div class="box">
    <i id="image" class="wi wi-night-sleet"> </i>
    <h1 id="summary"> Cloudy </h1>
    
    
    <div class="">
      <div id="Temperature"> Temperature</div>
      <div class="temp-symbol" id="tempSymbol"></div>
    </div>
    
    
    <div id="forementionAPP">But it feels like
      <div id="appTemp"> </div>
      <div class="temp-symbol" id="apSymbol"></div>
    </div>


    <div class="row">
      <div id="wind-symbol"></div>
      <div id="wind-description"></div>
    </div>

    <div class="row">
      <div id="rain-symbol"></div>
      <div id="rain-description"></div>
    </div>


    <div class="row"> Sunrise:
      <div class="sunrise"> </div>
    </div>
    <div class="row"> Sunset:
      <div class="sunset"> </div>
    </div>
    <div id="test"></div>


  </div>
</div>
              
            
!

CSS

              
                .area-around-box {
  background: #112C4B;
  padding-left: 17%;
  padding-right: 17%;
  padding-top: 5%;
  padding-bottom: 20%
}

.box {
  text-align: center;
  background: #C9C9C9;
  color: #262626;
  box-shadow: 7px 7px 2px #15191E;
}

#Temperature, #tempSymbol{
  display: inline-block;
}

#forementionAPP, #appTemp, #apSymbol{
  display: inline-block;
}

i{
  font-size: 20px; 
 
}


              
            
!

JS

              
                $(document).ready(function() {
  //let's get the information on the user's location

  function getUserInfo() {
    function getIMG(val) {
      var answer = "";
      // Only change code below this line
      if (val == "day-sunny" || val == "night-clear" || val == "day-cloudy" || val == "strong-wind" || val == "cloudy-night" || val == "Clear") {
        switch (val) {
          case "Clear":
            answer = "clear-day"
            break;
          case "day-sunny":
            answer = "clear-day";
            break;
          case "night-clear":
            answer = "clear-night";
            break;
          case "day-cloudy":
            answer = "partly-cloudy-day";
            break;
          case "strong-wind":
            answer = "wind";
            break;
          case "cloudy-night":
            answer = "partly-cloudy-night";
            break;
        }
      } else {
        answer = val;
        console.log(val);
      }

      // Only change code above this line  
      return answer;
    }

    function getPrecipDesc(precip) {
      if (precip < 0.01) {
        return "The flowers would be crying if they had water";
      }
      if (precip < 0.098) {
        return "You could carry this rain it's so light";
      }
      if (precip < .1) {
        return "Meh, bring an umbrella";
      }
      if (precip < .3) {
        return "Bring your shampoo to work and shower on the way"
      }
      if (precip >= .3) {
        return "GET IN THE ARK, NOAH";
      }

    }

    function getWindDesc(speed) {
      /* Ack: https://www.windfinder.com/wind/windspeed.htm for brief descriptions of windspeed, which I based these off of */
      if (speed < .2) {
        return "Wind? The fuck you talking about?";
      } else if (speed < 1.5) {
        return "Unless you're hitting a bong there ain't no wind bro.";
      } else if (speed < 3.3) {
        return "Some wind on ya body bro.";

      } else if (speed < 5.4) {
        return "Aye look at that tree it's twigs are fucking moving hahahaha holy shit hang on i'm gonna take a movie it's like it's waving hahaha holy crap this is going to go viral. ";
      } else if (speed < 7.9) {
        return "WATCH OUT IT'S A MINI TORNADO AAAAAAH!";
      } else if (speed < 10.7) {
        return "Be on the lookout for long branches on the ground, they might attack you.";
      } else if (speed < 13.8) {
        return "HAHAHA GOOD LUCK USING THAT UMBRELLA HAHAHAHAH";
      } else if (speed < 17.1) {
        return "AAAAH THE TREES ARE FUCKING POSSESSED AAAAH!!!";
      } else if (speed >= 17.1) {
        return "WHY THE FUCK ARE YOU OUTSIDE?";
      }
    } /*
       END OF WINDDESC */
    function trash(){
 
    /* function getTemp(T, rh) { /* t is temperature, rh is humidity */
    /*  
      if (unit = "celsius") {
        T = cToF(weatherInfo.main.temp);
      }
      
      var relativeTemp = (-42.379) + (2.04901523 * T) + (10.14333127 * rh) - (.22475541 * T * rh) - (6.83783 * (Math.power(10, -3)) * (Math.power(T, 2))) - (5.481717 * (Math.power(10, -2)) * (Math.power(rh, 2))) + (1.22874 * (Math.power(10, 3)) * (Math.power(T, 2)) * rh) + (8.5282 * (Math.power(10, -4)) * T * (Math.power(rh, 2))) - (1.99 * (Math.power(10, -6)) * (T * 2) * (Math.power(rh, 2)));
      console.log(relativeTemp);
      if (unit = "celsius") {
        return (relativeTemp - 32) * (5 / 9);
      } else {
        return relativeTemp;
      } 
    } */
    /* END OF GETHUMIDITYDESC */
    /*
     function changeImage(a) {
            document.getElementById("cloud").src=;
        }
      */
    }
    function cTOf(temp) {
      return (temp * 1.8) + 32;
    } /* END OF CTOF */
    function fTOc(temp) {
      return (temp - 32) * (5 / 9);
    }
    $.getJSON("http://ip-api.com/json", function(json) {
      /* CHANGE LAT AND LONG */
      var lat = json.lat;
      var long = json.lon;
      $("#long").html(Math.floor(long));
      $("#lat").html(Math.floor(lat));

      /* UNITS */
      var unit;
      var unitURL;
      if (json.countryCode == "US") {
        unitURL = "imperial";
        unit = "fahren"
        $(".temp-symbol").html("&#8457");
      } else {
        unitURL = "metric";
        unit = "celsius";
        $(".temp-symbol").html("&#8451");
      }

      /* ACCESS API */
      var api_key = "e082c3da28e6ca94272c2398b922c049";
      var base = "http://api.openweathermap.org/data/2.5/weather?lat=";
      var weatherCall = base + lat + "&lon=" + long + "&APPID=" + api_key + "&units=" + unitURL;

      var for_key = "813195e09d571d569dfc52a878bea90c";
      var for_call = "https://api.forecast.io/forecast/" + for_key + "/" + lat + "," + long + "?callback=?";
      /*   console.log(weatherCall);
          console.log(for_call); */

      /* USE API */
      $.getJSON(for_call, function(weatherInfo) { /* forecast.io */
        /* document.getElementById("image").className = "wi-forecast-io-clear-day";*/

        $("#summary").html(weatherInfo.currently.summary);
        $("#wind-description").html(getWindDesc(weatherInfo.currently.windSpeed));
        $("#rain-description").html(getPrecipDesc(weatherInfo.currently.precipIntensity));
        /* Temperature */
        if (json.countryCode != "US") {
          $("#Temperature").html(Math.floor(fTOc(weatherInfo.currently.temperature)));
          $("#appTemp").html(Math.floor(fTOc(weatherInfo.currently.apparentTemperature)));
        } else {
          $("#Temperature").html(Math.floor(weatherInfo.currently.temperature));
          $("#appTemp").html(Math.floor(weatherInfo.currently.apparentTemperature));
        }
        console.log(weatherInfo.currently.summary);
        document.getElementById("image").className = "wi wi-forecast-io-" + getIMG(weatherInfo.currently.summary);
      });

      $.getJSON(weatherCall, function(weatherInfo) { /* OPEN WEATHER */
        var sec = weatherInfo.sys.sunrise;
        var date = new Date(sec * 1000);
        var timestr = date.toLocaleTimeString();
        $(".sunrise").html(timestr);

        var sec = weatherInfo.sys.sunset;
        var date = new Date(sec * 1000);
        var timestr = date.toLocaleTimeString();
        $(".sunset").html(timestr);

        /*
document.getElementById("image").className = "wi wi-"+   ;
    */
      }); /* End of .getJSON weaatherinfo */
    }); /* End of .getJSON ip */

  } /* End of getUserInfo() */
  getUserInfo();

});
              
            
!
999px

Console