Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
v2.6 Build 1
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseWx2011 authored Aug 2, 2024
1 parent b4317e6 commit fbd566d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 27 deletions.
6 changes: 3 additions & 3 deletions fullextended.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<head>
<title id="extendedtitle">Deluge - Extended Forecast - Unknown Location</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="stylecurrentconditions.css" />
<script type="text/javascript" src="config.js"></script>
<script type="text/javascript" src="fullextended.js"></script>
<link rel="stylesheet" href="./css/stylecurrentconditions.css" />
<script type="text/javascript" src="./js/config.js"></script>
<script type="text/javascript" src="./js/fullextended.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<meta name="authors" content="Jesse Hasty">
<meta name='viewport' content='width=device-width; content='width = 425; initial-scale=1.0; maximum-scale=1.0; user-scalable=yes; target-densitydpi=160dpi'>
Expand Down
20 changes: 7 additions & 13 deletions js/notification.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
function notifyMe() {
// Request acess to show notifications
if (!("Notification" in window)) {
} else if (Notification.permission === "granted") {
} else if (Notification.permission !== "denied") {
Expand All @@ -13,7 +12,7 @@ function notifyMe() {
const responsee = await fetch(alerts)
const data = await responsee.json()
const {response} = data

console.log(data)
var liteningaudio = "lightning.mp3"
if (response[0]?.relativeTo?.distanceMI !== null) {
document.getElementById("lightningbutton").style.display = "block"
Expand All @@ -35,23 +34,18 @@ function notifyMe() {
}
notifyMe()
alerts();
// Get Alerts
const wxalerts = `https://data.api.xweather.com/alerts/${city}?client_id=${client_id}&client_secret=${client_secret}`
async function alerts() {
const responsee = await fetch(wxalerts)
const data = await responsee.json()
const {response} = data;

// JSON returns as ISO-8601
console.log(data)

alert = response[0].details.name
starttimeold = response[0].timestamps.beginsISO // When Alert Started
endtimeold = response[0].timestamps.expiresISO // When Alert Expires
tz = response[0].profile.tz // Timezone
/* Convert it to a string we are more familiar with
Example: 2021-10-04T17:08:09.000Z
String Conversion: October 4th, 2021 17:08:09 UTC
*/
starttime = new Date(starttimeold).toLocaleString("en-US", {timeStyle: "short", timeZone: tz, }); //
starttimeold = response[0].timestamps.beginsISO
endtimeold = response[0].timestamps.expiresISO
tz = response[0].profile.tz
starttime = new Date(starttimeold).toLocaleString("en-US", {timeStyle: "short", timeZone: tz, });
endtime = new Date(endtimeold).toLocaleString("en-US", {timeStyle: "short", timeZone: tz, });
console.log(starttime)
if (alert !== null) {
Expand Down
34 changes: 23 additions & 11 deletions js/scriptcc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,29 @@
var city = newcity
var language = oldlang

const url = `https://data.api.xweather.com/places/${city}?format=json&limit=10&client_id=${client_id}&client_secret=${client_secret}`
async function placename() {
const responsee = await fetch(url)
const data = await responsee.json()
const {response} = data;
console.log(data)


mainroot = response
country = mainroot.place.country
state = mainroot.place.state.toUpperCase()

// Default to USA if country string is "US"
if (country === "US") {
country = "USA"
} else {
}

city = `${mainroot.loc.lat},${mainroot.loc.long}`
document.getElementById('cityname').innerHTML = `<div class="city">Weather for ${mainroot.place.name}, ${state}, ${country} </div>`;

}
placename();
// Get Weather
getWx();
const api_url = `https://api.aerisapi.com/conditions/${city}?format=json&plimit=1&filter=1min&client_id=${client_id}&client_secret=${client_secret}&limit=5`;
Expand All @@ -29,7 +52,6 @@
tempFarenheit = response[0].periods[0].tempF
tempC = response[0].periods[0].tempC
const rainr = (response[0].periods[0].precipRateIN ).toFixed(3)
document.getElementById('cityname').innerHTML = `<div class="city">Deluge - Weather for ${response[0].place.name}, ${state}</div>`;
document.getElementById('temp').innerHTML = `${tempFarenheit}°F (${tempC}°C)`;
document.getElementById('title').innerHTML = `Deluge - Weather for ${response[0].place.name}, ${response[0].place.state}`
document.getElementById('icon').innerHTML = `<img src="https://raw.githubusercontent.com/JesseWx2011/weather-dashboard/main/icons/${response[0].periods[0].icon}" style="width: 10%; padding-left: 590px; display: flex;"></img>`;
Expand Down Expand Up @@ -90,16 +112,6 @@ tempC = response[0].periods[0].tempC
visibilitytext.innerHTML = `Extremely Dense Fog`
};}
visibility()

// Just get city name if it is set to :auto

function correctcity() {
if (city === `:auto`) {
document.getElementById('cityname').innerHTML = `<div class="city">Weather for ${response[0].place.name}, ${response[0].place.state}</div>`;
} else {
document.getElementById('cityname').innerHTML = `<div class="city" style="position: relative;">Weather for ${response[0].place.name}, ${response[0].place.state}</div>`;
}};
correctcity()
// Function for UV
if (response[0].periods[0].uvi >= 5) {
uvvaluedesc.innerHTML = "Put on Sunscreen when outdoors."
Expand Down

0 comments on commit fbd566d

Please sign in to comment.