Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions WappLab.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
* {

display: block;
color: rgb(169, 175, 177);
margin: Auto;
margin-bottom: 60px;
}

title{
color: black;
font-size: 25px;
font-style: italic;
padding-left: right 25px;
font-weight: normal;
}

h1 {
color: rgb(41, 28, 226);
}
39 changes: 39 additions & 0 deletions WappLab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@


// calling API
const weather = document.querySelector(".placeName");

const userZip = prompt("What's your Zip Code?");
const userLink = 'http://api.zippopotam.us/us/' + parseInt(userZip);

var client = new XMLHttpRequest();
client.open("GET", userLink,);
client.onreadystatechange = function() {
if(client.readyState == 4) {
console.log ('working');
};
if(client.readyState == 4 && client.status === 200) {
let zipData = JSON.parse(client.responseText);
const {places:
[{"place name": placeName, state: state, latitude: lat, longitude: lon}]
} = zipData;
weather.textContent = placeName + ", " + state;

let request = client.open("GET", `https://api.openweathermap.org/data/2.5/onecall?lat=${lat}&lon=${lon}&exclude=minutely,hourly&appid={APIKey}`)
console.log(request)
}

}


!function(d,s,id) {
var js,fjs=d.getElementsByTagName(s)[0];
if(!d.getElementById(id)){
js=d.createElement(s);js.id=id;js.src='https://weatherwidget.io/js/widget.min.js';
fjs.parentNode.insertBefore(js,fjs);}
}
(document,'script','weatherwidget-io-js');


client.send();

1 change: 1 addition & 0 deletions apikey.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const APIKey = `ff927fa124d7ae776e059bd7########`;
11 changes: 0 additions & 11 deletions index.html

This file was deleted.

32 changes: 32 additions & 0 deletions weatherAppLAB.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="WappLab.css">
<title>Weather App</title>
</head>
<body>
<h1> Hola Mundo</h1>

<div class="header">
<h1 class="placeName"></h1>
<div class="currentWeatherDiv">
<img class="img">
<h2 class="currentWeather"></h2>
</div>
</div>

<a class="weatherwidget-io" href="https://forecast7.com/en/34d10n118d41/90210/?unit=us"
data-label_1="BEVERLY HILLS, CA"
data-label_2="WEATHER"
data-theme="marine" >BEVERLY HILLS WEATHER</a>

</body>

<script src="WappLab.js"></script>
<script src="apikey.js"></script>

</html>