Umap rendering for UPlanet OSM2IPFS

This commit is contained in:
fred 2023-09-01 01:49:29 +02:00
parent 19e40cbdc6
commit 20d70e8543
4 changed files with 6 additions and 152 deletions

View File

@ -8,4 +8,4 @@
https://ipfs.asycn.io/ipfs/QmWahUMy1umsebt3WjJNExSNBh1mvDb9G9RDBNLNqeSvPb/
https://ipfs.asycn.io/ipfs/QmUQKH5eMAsUwRYwZD7ZywytjBExCRhEFY2wVeZ8PGGtLE/

View File

@ -1,147 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>G1Visa Application</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
background-color: #ffffff;
border-radius: 8px;
padding: 20px;
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
max-width: 400px;
width: 100%;
text-align: center;
}
input[type="email"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
input[type="submit"] {
background-color: #007bff;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="container">
<h1>G1Visa Application</h1>
<form onsubmit="constructURL(); return false;">
<label for="email">Email:</label>
<input type="email" id="email" name="uplanet" required pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$">
<input type="hidden" id="lat" name="lat" value="">
<input type="hidden" id="lon" name="lon" value="">
<input type="submit" value="Submit">
</form>
</div>
<center><div id="countdown"></div></center>
<script>
// Extract latitude and longitude from URL parameters
const urlParams = new URLSearchParams(window.location.search);
const lat = urlParams.get('lat').toFixed(2);
const lon = urlParams.get('lon').toFixed(2);
// Set latitude and longitude values to hidden inputs
document.getElementById('lat').value = lat;
document.getElementById('lon').value = lon;
async function homeAstroportStation(myURL, option = '', duration = 3000) {
try {
let one = await fetch(myURL); // Gets a promise
var doc = await one.text();
var regex = /url='([^']+)/i; // Get response PORT
const match = doc.match(regex);
if (match) {
const redirectURL = match[1];
} else {
const redirectURL = myURL;
}
console.log(option + " ... Teleportation ... in " + duration + " ms ... " + redirectURL)
// start countdown
var timeLeft = Math.floor(duration / 1000);
var elem = document.getElementById("countdown");
var timerId = setInterval(countdown, 1000);
function countdown() {
if (timeLeft == -1) {
clearTimeout(timerId);
switch(option) {
case "tab":
window.open( redirectURL, "AstroTab");
break;
case "page":
window.location.replace(redirectURL);
break;
case "parent":
window.parent.location.href = redirectURL;
break;
case "aframe":
document.getElementById("aframe").src = redirectURL;
break;
case "ainfo":
ainfo(redirectURL);
break;
default:
window.location.href = redirectURL;
}
if (document.getElementById("countdown").innerHTML !== '') {
document.getElementById("countdown").innerHTML = "<a href='"+redirectURL+"' target='aframe'>OK</a>";
}
} else {
elem.innerHTML = timeLeft + " s";
timeLeft--;
}
}
} catch (err) {
console.log('Fetch error:' + err + myURL ); // Error handling
}
}
//// Create G1Visa wit Astroport.ONE API
function constructURL() {
// Get email, latitude, and longitude values
const email = document.getElementById('email').value;
const lat = document.getElementById('lat').value;
const lon = document.getElementById('lon').value;
// Construct the URL with parameters
const myURL = `https://astroport.copylaradio.com/?uplanet=${email}&${lat}=${lon}`;
// Call homeAstroportStation function with the constructed URL
homeAstroportStation(myURL, 'tab', 3000);
}
</script>
</body>
</html>

View File

@ -108,7 +108,7 @@
</div>
<h2>U Planet</h2>
<h3><br>become a protector of the earth<br>select your land</h3>
<h3><br>♥ Earth ♥<br>... select landing zone ...</h3>
<!--
<div class="choose_example">

View File

@ -2,6 +2,7 @@
<html>
<head>
<meta charset="UTF-8">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<title>Occupy UPlanet ! Please. Zoom In.</title>
<link rel="stylesheet" href="leaflet.css" />
<style>
@ -55,8 +56,8 @@
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}
const defaultSouthWestLat = 44.000;
const defaultSouthWestLon = -1.000;
const defaultSouthWestLat = 0.000;
const defaultSouthWestLon = 0.000;
const defaultOffsetDegrees = 10.000; // 10° offset
const southWestLat = parseFloat(getUrlParameter('southWestLat')) || defaultSouthWestLat;
@ -148,7 +149,7 @@ if (deg <= 0.01) {
button.style.color = '#fff'; // Customize the font color
button.addEventListener('click', () => {
const url = `./g1visa.html?lat=${southWestLat}&lon=${southWestLon}`;
const url = `http://astroport.localhost:1234/?lat=${southWestLat}&lon=${southWestLon}`;
window.location.href = url;
});