- Location format examples: City, Country Code - Osaka, JP | ZIP,Country Code - 94040, US | Latitude, Longitude - 34.6937, 135.5023
+
+ Location format examples: City, Country Code - Osaka, JP | ZIP,Country Code - 94040, US | Latitude, Longitude - 34.6937, 135.5023
+
+
+
+ Note: External links and the "Get My Location" button require internet access.
+ They won't work while the device is in AP Mode - connect to Wi-Fi first.
Rebooting the device now... ", false);
+ setTimeout(() => {
document.getElementById('configForm').style.display = 'none';
- updateSavingModal("✅ All done!
You can now close this tab safely.", false);
+ document.querySelector('.footer').style.display = 'none';
+ document.querySelector('html').style.height = '100vh';
+ document.body.style.height = '100vh';
+ document.getElementById('configForm').style.display = 'none';
+ updateSavingModal("✅ All done! You can now close this tab safely.
Your device is now rebooting and connecting to your Wi-Fi. Its new IP address will appear on the display for future access.", false);
}, 5000);
return;
} else {
- updateSavingModal("✅ Configuration saved successfully.
Rebooting the device now... ", false);
setTimeout(() => {
- document.getElementById('configForm').style.display = 'none';
- updateSavingModal("✅ All done!
You can now close this tab safely.", false);
+ document.getElementById('configForm').style.display = 'none';
+ updateSavingModal("✅ All done! You can now close this tab safely.
Your device is now rebooting and connecting to your Wi-Fi. Its new IP address will appear on the display for future access.", false);
}, 5000);
removeReloadButton();
removeRestoreButton();
@@ -1036,6 +1059,36 @@ function setDimmingFieldsEnabled(enabled) {
document.getElementById('dimBrightness').disabled = !enabled;
}
+function getLocation() {
+ fetch('http://www.geoplugin.net/json.gp')
+ .then(response => response.json())
+ .then(data => {
+ document.getElementById('openWeatherCity').value = data.geoplugin_latitude;
+ document.getElementById('openWeatherCountry').value = data.geoplugin_longitude;
+
+ const button = document.getElementById('geo-button');
+ let label = data.geoplugin_city;
+ if (!label) label = data.geoplugin_region;
+ if (!label) label = data.geoplugin_countryName;
+ if (!label) label = "Location Found";
+
+ button.textContent = "Location: " + label;
+ button.disabled = true;
+ button.classList.add('geo-disabled');
+
+ console.log("Location fetched via GeoPlugin. Consider crediting them: https://www.geoplugin.com/");
+ })
+ .catch(error => {
+ alert(
+ "Failed to guess your location.\n\n" +
+ "This may happen if:\n" +
+ "- You are using an AdBlocker (GeoPlugin might be blocked)\n" +
+ "- There is a network issue\n\n" +
+ "You can visit https://openweathermap.org/find to manually search for your city and get latitude/longitude."
+ );
+ });
+}
+