diff --git a/changelog.txt b/changelog.txt index 011b9e5..c9bdd99 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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: diff --git a/js/notification.js b/js/notification.js index e2d6595..5deb75a 100644 --- a/js/notification.js +++ b/js/notification.js @@ -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 = `` - 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 = `` + 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}.`) @@ -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", })};