diff --git a/WappLab.css b/WappLab.css new file mode 100644 index 0000000..2130bf8 --- /dev/null +++ b/WappLab.css @@ -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); +} \ No newline at end of file diff --git a/WappLab.js b/WappLab.js new file mode 100644 index 0000000..3b8d9c0 --- /dev/null +++ b/WappLab.js @@ -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(); + diff --git a/apikey.js b/apikey.js new file mode 100644 index 0000000..c897d0f --- /dev/null +++ b/apikey.js @@ -0,0 +1 @@ +const APIKey = `ff927fa124d7ae776e059bd7########`; diff --git a/index.html b/index.html deleted file mode 100644 index 3233671..0000000 --- a/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - Document - - -

Hola Mundo

- - \ No newline at end of file diff --git a/weatherAppLAB.html b/weatherAppLAB.html new file mode 100644 index 0000000..f0bd138 --- /dev/null +++ b/weatherAppLAB.html @@ -0,0 +1,32 @@ + + + + + + + Weather App + + +

Hola Mundo

+ +
+

+
+ +

+
+
+ + BEVERLY HILLS WEATHER + + + + + + + + +