diff --git a/.gitignore b/.gitignore
index 42fb6b1..721a95f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
./node_modules/
-./backend_django/myenv/lib/
+backend/myenv/lib/
node_modules
-backend_django/myenv/lib/
+backend/myenv/lib/
diff --git a/404.html b/404.html
index a7e2354..29b9fd0 100644
--- a/404.html
+++ b/404.html
@@ -55,7 +55,7 @@
The WeatherMate App
404
-
Oops! The page you're looking for can't be found.
+
Oops! The page you're looking for can't be found.
Back to Home
diff --git a/backend_django/app.py b/backend/app.py
similarity index 100%
rename from backend_django/app.py
rename to backend/app.py
diff --git a/backend_django/backend_django/__init__.py b/backend/backend_django/__init__.py
similarity index 100%
rename from backend_django/backend_django/__init__.py
rename to backend/backend_django/__init__.py
diff --git a/backend_django/backend_django/asgi.py b/backend/backend_django/asgi.py
similarity index 100%
rename from backend_django/backend_django/asgi.py
rename to backend/backend_django/asgi.py
diff --git a/backend_django/backend_django/settings.py b/backend/backend_django/settings.py
similarity index 100%
rename from backend_django/backend_django/settings.py
rename to backend/backend_django/settings.py
diff --git a/backend_django/backend_django/urls.py b/backend/backend_django/urls.py
similarity index 100%
rename from backend_django/backend_django/urls.py
rename to backend/backend_django/urls.py
diff --git a/backend_django/backend_django/wsgi.py b/backend/backend_django/wsgi.py
similarity index 100%
rename from backend_django/backend_django/wsgi.py
rename to backend/backend_django/wsgi.py
diff --git a/databases/database.py b/backend/databases/database.py
similarity index 100%
rename from databases/database.py
rename to backend/databases/database.py
diff --git a/databases/database.sql b/backend/databases/database.sql
similarity index 100%
rename from databases/database.sql
rename to backend/databases/database.sql
diff --git a/backend_django/db.sqlite3 b/backend/db.sqlite3
similarity index 100%
rename from backend_django/db.sqlite3
rename to backend/db.sqlite3
diff --git a/flask/app.py b/backend/flask/app.py
similarity index 100%
rename from flask/app.py
rename to backend/flask/app.py
diff --git a/flask/back-end.py b/backend/flask/back-end.py
similarity index 100%
rename from flask/back-end.py
rename to backend/flask/back-end.py
diff --git a/flask/urls.py b/backend/flask/urls.py
similarity index 100%
rename from flask/urls.py
rename to backend/flask/urls.py
diff --git a/backend_django/manage.py b/backend/manage.py
old mode 100755
new mode 100644
similarity index 100%
rename from backend_django/manage.py
rename to backend/manage.py
diff --git a/backend_django/models.py b/backend/models.py
similarity index 100%
rename from backend_django/models.py
rename to backend/models.py
diff --git a/php/UserRegistration.php b/backend/php/UserRegistration.php
similarity index 100%
rename from php/UserRegistration.php
rename to backend/php/UserRegistration.php
diff --git a/php/UserUpdateProfile.php b/backend/php/UserUpdateProfile.php
similarity index 100%
rename from php/UserUpdateProfile.php
rename to backend/php/UserUpdateProfile.php
diff --git a/php/WeatherForecasts.php b/backend/php/WeatherForecasts.php
similarity index 100%
rename from php/WeatherForecasts.php
rename to backend/php/WeatherForecasts.php
diff --git a/php/config.php b/backend/php/config.php
similarity index 100%
rename from php/config.php
rename to backend/php/config.php
diff --git a/php/db_config.php b/backend/php/db_config.php
similarity index 100%
rename from php/db_config.php
rename to backend/php/db_config.php
diff --git a/php/userAuth.php b/backend/php/userAuth.php
similarity index 100%
rename from php/userAuth.php
rename to backend/php/userAuth.php
diff --git a/php/weatherDataFetch.php b/backend/php/weatherDataFetch.php
similarity index 100%
rename from php/weatherDataFetch.php
rename to backend/php/weatherDataFetch.php
diff --git a/backend_django/serializers.py b/backend/serializers.py
similarity index 100%
rename from backend_django/serializers.py
rename to backend/serializers.py
diff --git a/backend_django/urls.py b/backend/urls.py
similarity index 100%
rename from backend_django/urls.py
rename to backend/urls.py
diff --git a/backend_django/views.py b/backend/views.py
similarity index 100%
rename from backend_django/views.py
rename to backend/views.py
diff --git a/src/js/script.js b/src/js/script.js
index f9dd6cd..6633031 100644
--- a/src/js/script.js
+++ b/src/js/script.js
@@ -65,6 +65,7 @@ async function displayAirQuality(lat, lon, visibility) {
aqiElement.style.display = 'block';
const aqiUrl = `https://api.openweathermap.org/data/2.5/air_pollution?lat=${lat}&lon=${lon}&appid=${weatherpath}`;
+
try {
const response = await fetch(aqiUrl, { origin: "cors" });
const aqiData = await response.json();
@@ -75,11 +76,22 @@ async function displayAirQuality(lat, lon, visibility) {
aqiElement.innerHTML = `
Air Quality Index: ${aqi} (${airQuality})
Visibility: ${visibilityKm} km
`;
- } catch (error) {
+ }
+ catch (error) {
aqiElement.innerHTML = 'Error loading data.';
}
}
+function updateBrowserURL(name) {
+ const nameSlug = createNameSlug(name);
+ const newURL = window.location.protocol + "//" + window.location.host + window.location.pathname + '?query=' + nameSlug;
+ window.history.replaceState({ path: newURL }, '', newURL);
+}
+
+function createNameSlug(name) {
+ return name.toLowerCase().replace(/ /g, '-').replace(/[^\w-]/g, '');
+}
+
function createAQIDisplayElement() {
const aqiElement = document.createElement("div");
aqiElement.id = "aqi-display";
@@ -379,6 +391,8 @@ form.addEventListener("submit", (e) => {
const subhead = document.getElementById("subhead");
subhead.style.display = 'none';
}
+
+ updateBrowserURL(city);
});
form.addEventListener("click", (e) => {
@@ -396,6 +410,8 @@ buttonSearch.addEventListener("click", (e) => {
const subhead = document.getElementById("subhead");
subhead.style.display = 'none';
}
+
+ updateBrowserURL(city);
});
function closeAllPopups() {