diff --git a/.gitignore b/.gitignore index 728822b..3ade1ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store # Logs logs *.log @@ -136,4 +137,4 @@ dist .pnp.* # Add .vscode folder -.vscode/ \ No newline at end of file +.vscode/ diff --git a/webroot/images/.DS_Store b/webroot/images/.DS_Store new file mode 100644 index 0000000..67d7e12 Binary files /dev/null and b/webroot/images/.DS_Store differ diff --git a/webroot/images/skeletons/.DS_Store b/webroot/images/skeletons/.DS_Store new file mode 100644 index 0000000..df47461 Binary files /dev/null and b/webroot/images/skeletons/.DS_Store differ diff --git a/webroot/index.html b/webroot/index.html index 403e800..e5248de 100644 --- a/webroot/index.html +++ b/webroot/index.html @@ -98,6 +98,10 @@ +
diff --git a/webroot/js/config.js b/webroot/js/config.js index 5e015fb..c04fddf 100644 --- a/webroot/js/config.js +++ b/webroot/js/config.js @@ -1,13 +1,13 @@ -var api_key = "e1f10a1e78da46f5b10a1e78da96f525"; -var map_key = "pk.eyJ1Ijoid2VhdGhlciIsImEiOiJjaW4wbzllcjkwYWtrd2JsdWl3dG1hZjZ1In0.AdcjoWQiVfvjHfOB0nsyeQ"; +var api_key = "YOUR_API_KEY"; +var map_key = "YOUR_API_KEY"; var apperanceSettings = { providerName: "Mist Digital Cable", skipSettings: false, //set to true for no settings panel on startup startupTime: 5000, //How long you want to wait for everything to load //we recommend not setting startupTime to anything less than like 3000 (4 seconds) as it takes time to download info off the internet. - enableCrawl: true, //set to fale if you don't want any ad crawl - adMessage: ["If you are interested in TWC, EAS, or anything weather/tech related, join Mist Weather Media! Visit mistwx.com/discord right now!", "Want to watch Weatherscan and more from around the US? Visit live.weatherscan.net and search through the guide today!", "If a tornado warning is issued will you get the call? Sign up now to recieve a phone call warning when severe weather is headed your way. Visit weather.com/notify to learn more.", "Now Available! Get picture perfect weather with The Weather Channel HD.",], + enableCrawl: true, //set to false if you don't want any ad crawl + adMessage: ["If you are interested in TWC, EAS, or anything weather/tech related, join Mist Weather Media! Visit mistwx.com/discord right now!", "Want to watch Weatherscan and more from around the globe? Visit live.mistweather.com and search through the guide today!", "If a tornado warning is issued will you get the call? Sign up now to recieve a phone call warning when severe weather is headed your way. Visit weather.com/notify to learn more.", "Now Available! Get picture perfect weather with The Weather Channel HD.",], aspectRatio: 4/3, //3/2 or 4/3 crawlInterval: 48000, version: "1.22", diff --git a/webroot/js/data.js b/webroot/js/data.js index b7abd87..c89f651 100644 --- a/webroot/js/data.js +++ b/webroot/js/data.js @@ -189,12 +189,12 @@ var weatherData = { function grabData() { //console.log("grabbed data") function grabCurrentConditions() { - var url = "https://api.weather.com/v3/wx/observations/current?geocode=" + locationConfig.mainCity.lat + "," + locationConfig.mainCity.lon + "&units=e&language=en-US&format=json&apiKey=" + api_key + var url = "https://api.weather.com/v3/wx/observations/current?geocode=" + locationConfig.mainCity.lat + "," + locationConfig.mainCity.lon + "&units=" + locationConfig.units +"&language=en-US&format=json&apiKey=" + api_key $.getJSON(url, function(data) { try { weatherData.currentConditions.cityname = locationConfig.mainCity.displayname weatherData.currentConditions.cond = data.wxPhraseLong - weatherData.currentConditions.gusts = ((data.windGust != null || data.windGust != undefined) ? data.windGust + " mph" : "None") + weatherData.currentConditions.gusts = ((data.windGust != null || data.windGust != undefined) ? data.windGust + ((locationConfig.units == "e") ? " mph" : "km/h") : "None") weatherData.currentConditions.humidity = data.relativeHumidity + "%" weatherData.currentConditions.icon = data.iconCode weatherData.currentConditions.pressure = data.pressureAltimeter.toFixed(2) @@ -234,7 +234,7 @@ function grabData() { for (var li = 0; li < locationConfig.eightCities.citiesAmount; li++) { url += locationConfig.eightCities.cities[li].lat + "," + locationConfig.eightCities.cities[li].lon + ";" } - url += "&language=en-US&units=e&format=json&apiKey=" + api_key + url += "&language=en-US&units=" + locationConfig.units + "&format=json&apiKey=" + api_key $.getJSON(url, function(data) { data.forEach((ajaxedLoc, i) => { var nearbyCitiesObj = {noReport:false,cityname:"", temp:"", icon:"", wind:"", windspeed:""}; @@ -286,7 +286,7 @@ function grabData() { } grabNearbyConditions(); function grabDayDesc() { - var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.mainCity.lat + "," + locationConfig.mainCity.lon + "&format=json&units=e&language=en-US&apiKey=" + api_key + var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.mainCity.lat + "," + locationConfig.mainCity.lon + "&format=json&units=" + locationConfig.units + "&language=en-US&apiKey=" + api_key $.getJSON(url, function(data) { var ii = 0 try { @@ -324,7 +324,7 @@ function grabData() { } grabDayDesc() function grabExtended() { - var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.mainCity.lat + "," + locationConfig.mainCity.lon + "&format=json&units=e&language=en-US&apiKey=" + api_key + var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.mainCity.lat + "," + locationConfig.mainCity.lon + "&format=json&units=" + locationConfig.units + "&language=en-US&apiKey=" + api_key $.getJSON(url, function(data) { var daysDivs = ['one', "two", "three", "four", "five"] try { @@ -383,7 +383,7 @@ function grabData() { } grabExtended() function grabAlmanac() { - var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.mainCity.lat + "," + locationConfig.mainCity.lon + "&format=json&units=e&language=en-US&apiKey=" + api_key + var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.mainCity.lat + "," + locationConfig.mainCity.lon + "&format=json&units=" + locationConfig.units + "&language=en-US&apiKey=" + api_key $.getJSON(url, function(data) { var ii = 0 if (data.daypart[0].daypartName[0] == null) { @@ -592,7 +592,7 @@ function grabAirportData() { for (var li = 0; li < locationConfig.airport.airportsAmount; li++) { url += locationConfig.airport.airports[li].lat + "," + locationConfig.airport.airports[li].lon + ";" } - url += "&language=en-US&units=e&format=json&apiKey=" + api_key + url += "&language=en-US&units=" + locationConfig.units + "&format=json&apiKey=" + api_key $.getJSON(url, function(data) { data.forEach((ajaxedLoc, i) => { var airportsObj = {noReport:false,airportName:"",iataCode:"",temp:"",icon:"",condition:"",humidity:"",pressure:"",wind:"",gusts:"",windspeed:"",delay:""} @@ -603,7 +603,7 @@ function grabAirportData() { airportsObj.iataCode = locationConfig.airport.airports[i].iataCode airportsObj.condition = ajaxedLoc["v3-wx-observations-current"].wxPhraseLong airportsObj.icon = ajaxedLoc["v3-wx-observations-current"].iconCode - airportsObj.gusts = ((ajaxedLoc["v3-wx-observations-current"].windGust != null || ajaxedLoc["v3-wx-observations-current"].windGust != undefined) ? ajaxedLoc["v3-wx-observations-current"].windGust + " mph" : "None") + airportsObj.gusts = ((ajaxedLoc["v3-wx-observations-current"].windGust != null || ajaxedLoc["v3-wx-observations-current"].windGust != undefined) ? ajaxedLoc["v3-wx-observations-current"].windGust + ((locationConfig.units == "e") ? " mph" : "km/h") : "None") airportsObj.humidity = ajaxedLoc["v3-wx-observations-current"].relativeHumidity + "%" airportsObj.pressure = ajaxedLoc["v3-wx-observations-current"].pressureAltimeter airportsObj.temp = ajaxedLoc["v3-wx-observations-current"].temperature @@ -675,7 +675,7 @@ function grabAirportData() { for (var li = 0; li < weatherData.nationalAirports.airports.length; li++) { url += weatherData.nationalAirports.airports[li].lat + "," + weatherData.nationalAirports.airports[li].lon + ";" } - url += "&language=en-US&units=e&format=json&apiKey=" + api_key + url += "&language=en-US&units=" + locationConfig.units + "&format=json&apiKey=" + api_key $.getJSON(url, function(data) { data.forEach((ajaxedLoc, i) => { weatherData.nationalAirports.airports[i].delay = "" @@ -725,12 +725,12 @@ function grabAirportData() { function grabSpanishData() { //console.log("grabbed data") function grabESCurrentConditions() { - var url = "https://api.weather.com/v3/wx/observations/current?geocode=" + locationConfig.mainCity.lat + "," + locationConfig.mainCity.lon + "&units=e&language=es-US&format=json&apiKey=" + api_key + var url = "https://api.weather.com/v3/wx/observations/current?geocode=" + locationConfig.mainCity.lat + "," + locationConfig.mainCity.lon + "&units=" + locationConfig.units + "&language=es-US&format=json&apiKey=" + api_key $.getJSON(url, function(data) { try { weatherData.spanish.currentConditions.cityname = locationConfig.mainCity.displayname weatherData.spanish.currentConditions.cond = data.wxPhraseLong - weatherData.spanish.currentConditions.gusts = ((data.windGust != null || data.windGust != undefined) ? data.windGust + " mph" : "No") + weatherData.spanish.currentConditions.gusts = ((data.windGust != null || data.windGust != undefined) ? data.windGust + ((locationConfig.units == "e") ? " mph" : "km/h") : "No") weatherData.spanish.currentConditions.humidity = data.relativeHumidity + "%" weatherData.spanish.currentConditions.icon = data.iconCode weatherData.spanish.currentConditions.pressure = data.pressureAltimeter.toFixed(2) @@ -776,7 +776,7 @@ function grabSpanishData() { for (var li = 0; li < locationConfig.eightCities.citiesAmount; li++) { url += locationConfig.eightCities.cities[li].lat + "," + locationConfig.eightCities.cities[li].lon + ";" } - url += "&language=es-US&units=e&format=json&apiKey=" + api_key + url += "&language=es-US&units=" + locationConfig.units + "&format=json&apiKey=" + api_key $.getJSON(url, function(data) { data.forEach((ajaxedLoc, i) => { var nearbyCitiesObj = {noReport:false,cityname:"", temp:"", icon:"", wind:"", windspeed:""}; @@ -828,7 +828,7 @@ function grabSpanishData() { } grabESNearbyConditions(); function grabESExtended() { - var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.mainCity.lat + "," + locationConfig.mainCity.lon + "&format=json&units=e&language=es-US&apiKey=" + api_key + var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.mainCity.lat + "," + locationConfig.mainCity.lon + "&format=json&units=" + locationConfig.units + "&language=es-US&apiKey=" + api_key //console.log(url) $.getJSON(url, function(data) { var daysDivs = ['one', "two", "three", "four", "five"] @@ -888,7 +888,7 @@ function grabSpanishData() { } grabESExtended() function grabESAlmanac() { - var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.mainCity.lat + "," + locationConfig.mainCity.lon + "&format=json&units=e&language=es-US&apiKey=" + api_key + var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.mainCity.lat + "," + locationConfig.mainCity.lon + "&format=json&units=" + locationConfig.units + "&language=es-US&apiKey=" + api_key $.getJSON(url, function(data) { var ii = 0 if (data.daypart[0].daypartName[0] == null) { @@ -975,7 +975,7 @@ function grabSpanishData() { } function grabGolfData() { function grabCoursesData(ci) { - var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.golf.courses[ci].lat + "," + locationConfig.golf.courses[ci].lon + "&format=json&units=e&language=en-US&apiKey=" + api_key + var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.golf.courses[ci].lat + "," + locationConfig.golf.courses[ci].lon + "&format=json&units=" + locationConfig.units + "&language=en-US&apiKey=" + api_key $.getJSON(url, function(data) { try { weatherData.golf.courseForecast[ci].cityname = locationConfig.golf.courses[ci].displayname @@ -1036,7 +1036,7 @@ function grabGolfData() { grabCoursesData(i) } function grabResortsData(ri) { - var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.golf.resorts[ri].lat + "," + locationConfig.golf.resorts[ri].lon + "&format=json&units=e&language=en-US&apiKey=" + api_key + var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.golf.resorts[ri].lat + "," + locationConfig.golf.resorts[ri].lon + "&format=json&units=" + locationConfig.units + "&language=en-US&apiKey=" + api_key $.getJSON(url, function(data) { try { weatherData.golf.resortForecast[ri].cityname = locationConfig.golf.resorts[ri].displayname @@ -1168,12 +1168,12 @@ function grabHealthData() { } function grabExtraData() { function grabEXCurrentConditions() { - var url = "https://api.weather.com/v3/wx/observations/current?geocode=" + locationConfig.extraCity.lat + "," + locationConfig.extraCity.lon + "&units=e&language=en-US&format=json&apiKey=" + api_key + var url = "https://api.weather.com/v3/wx/observations/current?geocode=" + locationConfig.extraCity.lat + "," + locationConfig.extraCity.lon + "&units=" + locationConfig.units + "&language=en-US&format=json&apiKey=" + api_key $.getJSON(url, function(data) { try { weatherData.extraLocal.currentConditions.cityname = locationConfig.extraCity.displayname weatherData.extraLocal.currentConditions.cond = data.wxPhraseLong - weatherData.extraLocal.currentConditions.gusts = ((data.windGust != null || data.windGust != undefined) ? data.windGust + " mph" : "None") + weatherData.extraLocal.currentConditions.gusts = ((data.windGust != null || data.windGust != undefined) ? data.windGust + ((locationConfig.units == "e") ? " mph" : "km/h") : "None") weatherData.extraLocal.currentConditions.humidity = data.relativeHumidity + "%" weatherData.extraLocal.currentConditions.icon = data.iconCode weatherData.extraLocal.currentConditions.pressure = data.pressureAltimeter.toFixed(2) @@ -1208,7 +1208,7 @@ function grabExtraData() { } grabEXCurrentConditions(); function grabEXDayDesc() { - var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.extraCity.lat + "," + locationConfig.extraCity.lon + "&format=json&units=e&language=en-US&apiKey=" + api_key + var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.extraCity.lat + "," + locationConfig.extraCity.lon + "&format=json&units=" + locationConfig.units + "&language=en-US&apiKey=" + api_key $.getJSON(url, function(data) { var ii = 0 try { @@ -1240,7 +1240,7 @@ function grabExtraData() { } grabEXDayDesc() function grabEXExtended() { - var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.extraCity.lat + "," + locationConfig.extraCity.lon + "&format=json&units=e&language=en-US&apiKey=" + api_key + var url = "https://api.weather.com/v3/wx/forecast/daily/5day?geocode=" + locationConfig.extraCity.lat + "," + locationConfig.extraCity.lon + "&format=json&units=" + locationConfig.units + "&language=en-US&apiKey=" + api_key $.getJSON(url, function(data) { var daysDivs = ['one', "two", "three", "four", "five"] try { diff --git a/webroot/js/location.js b/webroot/js/location.js index 76c3531..44eaf04 100644 --- a/webroot/js/location.js +++ b/webroot/js/location.js @@ -106,7 +106,8 @@ var locationSettings = { val:"", }, ], - } + }, + units: "" } var locationConfig = { radar: { @@ -142,7 +143,8 @@ var locationConfig = { golf: { courses:[], resorts:[], - } + }, + units: "e" } var extraCityList = {} var surrCityList = {} @@ -165,6 +167,7 @@ function locationJS() { locationConfig.airport.airports = [] locationConfig.golf.courses = [] locationConfig.golf.resorts = [] + locationConfig.units = "e" if (window.location.search) { queryname = window.location.search.split("?")[1] } @@ -181,6 +184,7 @@ function locationGrab() { locationConfig.mainCity.lon = data.location.longitude locationConfig.mainCity.state = data.location.adminDistrictCode locationConfig.mainCity.stateFull = data.location.adminDistrict + locationConfig.units = locationSettings.units /*$.getJSON("https://pro.ip-api.com/json/?key=AmUN9xAaQALVYu6&exposeDate=false", function(ipdata){ console.log(ipdata.timezone) timezone = ipdata.timezone; @@ -224,6 +228,7 @@ function locationGrab() { locationConfig.mainCity.lon = data.location.longitude[0] locationConfig.mainCity.state = data.location.adminDistrictCode[0] locationConfig.mainCity.stateFull = data.location.adminDistrict[0] + locationConfig.units = (["US", "MM", "LR"].includes(data.location.countryCode[0])) ? "e" : "m" /*$.getJSON("https://pro.ip-api.com/json/?key=AmUN9xAaQALVYu6&exposeDate=false", function(ipdata){ console.log(ipdata.timezone) timezone = ipdata.timezone; diff --git a/webroot/js/settingspanel.js b/webroot/js/settingspanel.js index 8828ecb..48cc8e3 100644 --- a/webroot/js/settingspanel.js +++ b/webroot/js/settingspanel.js @@ -257,6 +257,7 @@ function mainlocfuncs(type) { //document.cookie = `mainCitySearchType=${locationSettings.mainCity.type}`; locationSettings.mainCity.val = document.getElementById("mainloc-data").value; + locationSettings.units = (document.getElementById("tempunit-dropdown").value == "Imperial") ? "e" : "m" //document.cookie = `mainCitySearchValue=${locationSettings.mainCity.val}`; $("#setup-extraloc").fadeIn(0); } diff --git a/webroot/weatherscan.css b/webroot/weatherscan.css index fef2f73..97dcc78 100644 --- a/webroot/weatherscan.css +++ b/webroot/weatherscan.css @@ -362,6 +362,11 @@ button { top: 41%; right: 34%; } +#tempunit-dropdown { + width: 210px; + top: 48%; + right: 34%; +} #mainloc-data { top: 41%; left: 68%;