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 fbd566d commit 7581ff4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
6 changes: 5 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,12 @@ Notifications on Mobile
v2.5 Build 1 (7-3-2024):
Move Icons and other files to separate directory
Loading Screen
v2.6 Build 1 (8-2-2024):
Closest Lightning Strikes Adjusteded
Places capitalized on the main page
Full Extended Forecast Page fixed.

v2.5 Build 1 is the Latest Version.
v2.6 Build 1 is the Latest Version.
To Be Added:
Nothing at the moment.
To be decided:
Expand Down
42 changes: 21 additions & 21 deletions js/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ function notifyMe() {
litening();
const alerts = `https://api.aerisapi.com/lightning/flash/${city}?format=json&radius=25mi&minradius=0mi&limit=10&client_id=${client_id}&client_secret=${client_secret} `
async function litening() {
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) {
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"
const notification = new Notification("Lightning Alert:", {
body: `Lightning struck ${response[0].relativeTo.distanceMI} miles (${response[0].relativeTo.distanceKM} km) ${response[0].relativeTo.bearingENG} of this Location in ${city}.`,
icon: "lightning.svg",
audio: new Audio('lightning.mp3'),
});
alertaudio.innerHTML = `<audio controls autoplay><source src="${liteningaudio}"></audio>`
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
body: `Lightning struck ${response[0].relativeTo.distanceMI} miles (${response[0].relativeTo.distanceKM} km) ${response[0].relativeTo.bearingENG} of this Location in ${city}.`,
icon: "lightning.svg",
audio: new Audio('lightning.mp3'),
});


alertaudio.innerHTML = `<audio controls autoplay><source src="${liteningaudio}"></audio>`
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {

alert(`Lightning struck ${response[0].relativeTo.distanceMI} miles (${response[0].relativeTo.distanceKM} km) ${response[0].relativeTo.bearingENG} of this Location in ${city}.`)

Expand All @@ -36,20 +36,20 @@ notifyMe()
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;
console.log(data)
const responsee = await fetch(wxalerts)
const data = await responsee.json()
const {response} = data;
console.log(data)

alert = response[0].details.name
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, });
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) {
alertnotificaton = new Notification("Weather Alert:", {
alertnotificaton = new Notification("Weather Alert:", {
body: `${alert} in effect from ${starttime} and ending at ${endtime}`,
icon: "alert.svg",
})};
Expand Down

0 comments on commit 7581ff4

Please sign in to comment.