Skip to content

Commit

Permalink
Merge pull request #13 from aidan-yip/v2.0.0
Browse files Browse the repository at this point in the history
Re-upload repo files
  • Loading branch information
aidan-yip committed May 21, 2024
2 parents 3981065 + d3c72d3 commit 4a056bf
Show file tree
Hide file tree
Showing 51 changed files with 1,534 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
674 changes: 674 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Weather 64
A clean minimal weather app.

# Powered by

<ul>
<li>The ©OpenWeather API</li>
<li>Google Maps - Map Data ©Google</li>
</ul>

# Features
<ul>
<li>Installable as a web app</li>
<li>City search by user text input</li>
<li>Current location (w/search function)</li>
<li>Current temperature</li>
<li>Current condition description</li>
<li>12 hour real time clock</li>
<li>Current date</li>
<li>Interactive map</li>
</ul>

# Credits

## Original Idea: https://dev.to/iamcymentho/building-a-complete-weather-app-from-scratch-with-html-css-and-javascript-a-step-by-step-guide-30h4
## OpenWeather API: https://openweathermap.org
## Google Maps: https://www.google.ca/maps
71 changes: 71 additions & 0 deletions dark_mode.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
@media (prefers-color-scheme: dark) {
#background {
background-image: url("https://raw.githubusercontent.com/aidan-yip/weather_64/main/public/moon.jpg");
}

.container {
background: linear-gradient(
137deg,
rgba(93, 93, 93, 0.4) 0%,
rgba(0, 0, 0, 0.4) 100%
);
border: solid 1px #515151;
box-shadow: 0px 0px 80px #eaeaea3b;
}

.side_block {
background: linear-gradient(
137deg,
rgba(93, 93, 93, 0.6) 0%,
rgba(0, 0, 0, 0.6) 100%
);
border: solid 1px #6e6e6e;
box-shadow: 0px 0px 50px #eaeaea3b;
}

#inner {
background: linear-gradient(
137deg,
rgba(93, 93, 93, 0.6) 0%,
rgba(0, 0, 0, 0.6) 100%
);
border: solid 1px #6e6e6e;
box-shadow: 0px 0px 50px #eaeaea3b;
}

h1 {
color: #ffffff;
}

#date {
color: #ffffff;
}

#location {
color: #ffffff;
}

#temperature {
color: #ffffff;
}

#description {
color: #ffffff;
}

input[type="text"] {
color: #0a78ff;
}

#clock {
color: #ffffff;
}

a {
color: #ffffff;
}

a:visited {
color: #ffffff;
}
}
318 changes: 318 additions & 0 deletions index.html

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "Weather 64",
"short_name": "Weather 64",
"start_url": "https://weather-64.pages.dev",
"display": "standalone",
"x-robots-tag": "index",
"background_color": "#0052bc",
"theme_color": "#0052bc",
"description": "A clean minimal open source weather app.",
"icons": [
{
"src": "./public/icons/icon.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "./public/splash/manifest-icon-192.maskable.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "./public/splash/manifest-icon-512.maskable.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "./public/splash/manifest-icon-512.maskable.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
]
}

Binary file added public/.DS_Store
Binary file not shown.
Binary file added public/cloud.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon.ico
Binary file not shown.
Binary file added public/icons/.DS_Store
Binary file not shown.
Binary file added public/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/moon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-icon-180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1125-2436.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1136-640.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1170-2532.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1179-2556.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1242-2208.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1242-2688.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1284-2778.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1290-2796.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1334-750.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1488-2266.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1536-2048.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1620-2160.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1640-2360.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1668-2224.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1668-2388.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-1792-828.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-2048-1536.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-2048-2732.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-2160-1620.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-2208-1242.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-2224-1668.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/splash/apple-splash-2266-1488.jpg
Binary file added public/splash/apple-splash-2360-1640.jpg
Binary file added public/splash/apple-splash-2388-1668.jpg
Binary file added public/splash/apple-splash-2436-1125.jpg
Binary file added public/splash/apple-splash-2532-1170.jpg
Binary file added public/splash/apple-splash-2556-1179.jpg
Binary file added public/splash/apple-splash-2688-1242.jpg
Binary file added public/splash/apple-splash-2732-2048.jpg
Binary file added public/splash/apple-splash-2778-1284.jpg
Binary file added public/splash/apple-splash-2796-1290.jpg
Binary file added public/splash/apple-splash-640-1136.jpg
Binary file added public/splash/apple-splash-750-1334.jpg
Binary file added public/splash/apple-splash-828-1792.jpg
Binary file added public/splash/manifest-icon-192.maskable.png
Binary file added public/splash/manifest-icon-512.maskable.png
68 changes: 68 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Clock

function currentTime() {
let date = new Date();
let hh = date.getHours();
let mm = date.getMinutes();
let ss = date.getSeconds();
let session = "AM";

if(hh == 0){
hh = 12;
}
if(hh > 12){
hh = hh - 12;
session = "PM";
}

hh = (hh < 10) ? "0" + hh : hh;
mm = (mm < 10) ? "0" + mm : mm;
ss = (ss < 10) ? "0" + ss : ss;

let time = hh + ":" + mm + ":" + ss + " " + session;

document.getElementById("clock").innerText = time;
let t = setTimeout(function(){ currentTime() }, 1000);
}
currentTime();

// Date

const date = new Date();
const dateWithoutTime = date.toDateString();

document.getElementById("date").innerHTML = dateWithoutTime;

//OPEN WEATHER API

const apiKey = '2bfdac11a6fb05bc2347f9f0f01e3031';
const apiUrl = 'https://api.openweathermap.org/data/2.5/weather';

const locationInput = document.getElementById('locationInput');
const searchButton = document.getElementById('searchButton');
const locationElement = document.getElementById('location');
const temperatureElement = document.getElementById('temperature');
const descriptionElement = document.getElementById('description');

searchButton.addEventListener('click', () => {
const location = locationInput.value;
if (location) {
fetchWeather(location);
}
});

function fetchWeather(location) {
const url = `${apiUrl}?q=${location}&appid=${apiKey}&units=metric`;

fetch(url)
.then(response => response.json())
.then(data => {
locationElement.textContent = data.name;
temperatureElement.textContent = `${Math.round(data.main.temp)}°C`;
descriptionElement.textContent = data.weather[0].description;
})
.catch(error => {
console.error('Error fetching weather data:', error);
alert("Please enter a valid city");
});
}
Loading

0 comments on commit 4a056bf

Please sign in to comment.