Update index.html

This commit is contained in:
Daniel LaForce 2024-08-01 21:40:04 -06:00
parent ce329eeb4a
commit d6d4ee3371
1 changed files with 21 additions and 8 deletions

View File

@ -59,8 +59,8 @@
</head> </head>
<body> <body>
<h1>CSMS Claims and Neighbors</h1> <h1>CSMS Claims and Neighbors</h1>
<iframe src="https://csms.argobox.com/redirect/google-maps"></iframe> <iframe id="google-maps-iframe" src=""></iframe>
<iframe src="https://csms.argobox.com/redirect/gaia-gps"></iframe> <iframe id="gaia-gps-iframe" src=""></iframe>
<div id="button-container"> <div id="button-container">
<a href="#" class="button" id="google-maps-link">View in Google Maps</a> <a href="#" class="button" id="google-maps-link">View in Google Maps</a>
<a href="#" class="button" id="gaia-gps-link">View in Gaia GPS</a> <a href="#" class="button" id="gaia-gps-link">View in Gaia GPS</a>
@ -84,11 +84,14 @@
document.getElementById('consent-banner').style.display = 'block'; document.getElementById('consent-banner').style.display = 'block';
} }
const googleMapsIframe = document.getElementById('google-maps-iframe');
const gaiaGpsIframe = document.getElementById('gaia-gps-iframe');
document.getElementById('gaia-gps-link').addEventListener('click', function(event) { document.getElementById('gaia-gps-link').addEventListener('click', function(event) {
event.preventDefault(); event.preventDefault();
const token = generateToken(16); const token = generateToken(16);
localStorage.setItem('gaiaAccessToken', token); localStorage.setItem('gaiaAccessToken', token);
const url = `https://csms.argobox.com/redirect/gaia-gps?token=${token}`; const url = `/redirect/gaia-gps?token=${token}`;
gtag('event', 'click', { gtag('event', 'click', {
'event_category': 'Outbound Link', 'event_category': 'Outbound Link',
'event_label': 'Gaia GPS', 'event_label': 'Gaia GPS',
@ -101,7 +104,7 @@
event.preventDefault(); event.preventDefault();
const token = generateToken(16); const token = generateToken(16);
localStorage.setItem('googleMapsAccessToken', token); localStorage.setItem('googleMapsAccessToken', token);
const url = `https://csms.argobox.com/redirect/google-maps?token=${token}`; const url = `/redirect/google-maps?token=${token}`;
gtag('event', 'click', { gtag('event', 'click', {
'event_category': 'Outbound Link', 'event_category': 'Outbound Link',
'event_label': 'Google Maps', 'event_label': 'Google Maps',
@ -109,6 +112,16 @@
}); });
window.location.href = url; window.location.href = url;
}); });
const googleMapsToken = localStorage.getItem('googleMapsAccessToken');
if (googleMapsToken) {
googleMapsIframe.src = `/redirect/google-maps?token=${googleMapsToken}`;
}
const gaiaGpsToken = localStorage.getItem('gaiaAccessToken');
if (gaiaGpsToken) {
gaiaGpsIframe.src = `/redirect/gaia-gps?token=${gaiaGpsToken}`;
}
}); });
function acceptConsent() { function acceptConsent() {