Add map embedding and redirect functionality for testing

This commit is contained in:
Daniel LaForce 2024-08-02 11:12:10 -06:00
parent 48b541f32b
commit fa1c71b4da
3 changed files with 79 additions and 121 deletions

View File

@ -1,127 +1,57 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<title>CSMS Claims and Neighbors</title> <meta charset="UTF-8">
<!-- Google tag (gtag.js) --> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<script async src="https://www.googletagmanager.com/gtag/js?id=G-CC1B9CQ691"></script> <title>Map Viewer</title>
<script> <style>
window.dataLayer = window.dataLayer || []; body {
function gtag(){dataLayer.push(arguments);} font-family: Arial, sans-serif;
gtag('js', new Date()); margin: 0;
gtag('config', 'G-CC1B9CQ691'); padding: 0;
</script> display: flex;
<style> flex-direction: column;
body { align-items: center;
font-family: Arial, sans-serif; }
text-align: center; iframe {
margin: 0; width: 100%;
padding: 0; height: 50vh;
} border: none;
iframe { }
border: none; .buttons {
width: 800px; margin: 20px;
height: 600px; }
margin: 20px auto; .buttons button {
display: block; padding: 10px 20px;
} margin: 0 10px;
.button { font-size: 16px;
display: inline-block; cursor: pointer;
margin: 10px 20px; }
padding: 10px 20px; </style>
font-size: 16px; <!-- Google tag (gtag.js) -->
color: white; <script async src="https://www.googletagmanager.com/gtag/js?id=G-CC1B9CQ691"></script>
background-color: #007bff; <script>
border: none; window.dataLayer = window.dataLayer || [];
border-radius: 5px; function gtag(){dataLayer.push(arguments);}
text-decoration: none; gtag('js', new Date());
cursor: pointer; gtag('config', 'G-CC1B9CQ691');
} </script>
.button:hover {
background-color: #0056b3;
}
#button-container {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
}
#consent-banner {
position: fixed;
bottom: 0;
width: 100%;
background: #333;
color: #fff;
padding: 10px;
text-align: center;
display: none;
}
</style>
</head> </head>
<body> <body>
<h1>CSMS Claims and Neighbors</h1> <iframe src="https://www.google.com/maps/d/u/0/viewer?mid=1uaJCMW64w_zwERr9nFcVJchrZdocNbA&ll=39.03554998301922%2C-105.29915470303165&z=14"></iframe>
<iframe id="google-maps-iframe" src="https://csms.argobox.com/redirect/google-maps"></iframe> <iframe src="https://www.gaiagps.com/map/?lat=39.03966489533956&lon=-105.32945964046155&zoom=14&loc=14.0/-105.3120/39.0318&pubLink=VVXcZPvEfvAbvRWi5F0DQPNT&folderId=e810350b-1b3f-49bf-8f67-6a497827f190"></iframe>
<iframe id="gaia-gps-iframe" src="https://csms.argobox.com/redirect/gaia-gps"></iframe> <div class="buttons">
<div id="button-container"> <button onclick="navigateToMap('google')">View on Google Maps</button>
<a href="#" class="button" id="google-maps-link">View in Google Maps</a> <button onclick="navigateToMap('gaia')">View on Gaia GPS</button>
<a href="#" class="button" id="gaia-gps-link">View in Gaia GPS</a> </div>
</div> <script>
<div id="consent-banner"> function navigateToMap(map) {
This site uses cookies to improve your experience. By continuing to browse, you accept the use of cookies. if (map === 'google') {
<button onclick="acceptConsent()">Accept</button> window.location.href = '/redirect-google';
</div> } else if (map === 'gaia') {
<script> window.location.href = '/redirect-gaia';
console.log("Script loaded"); }
}
function generateToken(length) { </script>
console.log("Generating token");
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * characters.length));
}
return result;
}
document.addEventListener('DOMContentLoaded', function() {
console.log("DOM fully loaded and parsed");
if (!localStorage.getItem('consentGiven')) {
document.getElementById('consent-banner').style.display = 'block';
}
document.getElementById('gaia-gps-link').addEventListener('click', function(event) {
event.preventDefault();
const token = generateToken(16);
localStorage.setItem('gaiaAccessToken', token);
const url = `https://csms.argobox.com/redirect/gaia-gps?token=${token}`;
gtag('event', 'click', {
'event_category': 'Outbound Link',
'event_label': 'Gaia GPS',
'value': url
});
document.getElementById('gaia-gps-iframe').src = url;
console.log("Gaia GPS URL: ", url);
});
document.getElementById('google-maps-link').addEventListener('click', function(event) {
event.preventDefault();
const token = generateToken(16);
localStorage.setItem('googleMapsAccessToken', token);
const url = `https://csms.argobox.com/redirect/google-maps?token=${token}`;
gtag('event', 'click', {
'event_category': 'Outbound Link',
'event_label': 'Google Maps',
'value': url
});
document.getElementById('google-maps-iframe').src = url;
console.log("Google Maps URL: ", url);
});
});
function acceptConsent() {
localStorage.setItem('consentGiven', 'true');
document.getElementById('consent-banner').style.display = 'none';
}
</script>
</body> </body>
</html> </html>

14
redirect-gaia.html Normal file
View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Redirecting...</title>
<script>
window.location.href = 'https://www.gaiagps.com/map/?lat=39.03966489533956&lon=-105.32945964046155&zoom=14&loc=14.0/-105.3120/39.0318&pubLink=VVXcZPvEfvAbvRWi5F0DQPNT&folderId=e810350b-1b3f-49bf-8f67-6a497827f190';
</script>
</head>
<body>
<p>Redirecting to Gaia GPS...</p>
</body>
</html>

14
redirect-google.html Normal file
View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Redirecting...</title>
<script>
window.location.href = 'https://www.google.com/maps/d/u/0/viewer?mid=1uaJCMW64w_zwERr9nFcVJchrZdocNbA&ll=39.03554998301922%2C-105.29915470303165&z=14';
</script>
</head>
<body>
<p>Redirecting to Google Maps...</p>
</body>
</html>