p4n + wallets

This commit is contained in:
fred 2024-02-24 01:16:47 +01:00
parent c253cae4d0
commit e53d7c70d3
3 changed files with 69 additions and 20 deletions

View File

@ -277,6 +277,16 @@ for UMAP in ${unique_combined[@]}; do
## GET 100KM GCHANGE ADS ( https://data.gchange.fr )
${MY_PATH}/../tools/gchange_get_50km_around_LAT_LON_ads.sh ${LAT} ${LON} > ~/.zen/tmp/${MOATS}/${UMAP}/gchange50.json
## GET WALLETS
echo "* GET WALLETS https://g1-stats.axiom-team.fr/data/geoloc-members.json"
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/wallets.json ]] && touch ~/.zen/tmp/${MOATS}/${UMAP}/wallets.json
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ]] \
&& curl -s "https://g1-stats.axiom-team.fr/data/geoloc-members.json" -o ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json \
&& [[ $(stat -c %s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json) -gt $(stat -c %s ~/.zen/tmp/${MOATS}/${UMAP}/wallets.json) ]] \
&& mv ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ~/.zen/tmp/${MOATS}/${UMAP}/wallets.json \
&& echo "UPDATED WALLETS" \
|| rm ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json
echo "MAKING _index.p4n.html with ./templates/P4N/index.html"
## CREATE INDEX LOADING JSONs ON OPENSTREETMAP
cat ${MY_PATH}/../templates/P4N/index.html \

View File

@ -46,33 +46,70 @@ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
// Fetch JSON data
axios.get('./p4n.json')
// Fetch wallets data
axios.get('./wallets.json')
.then(response => {
const places = response.data;
// Iterate through places and add markers to the map
// Initialize Leaflet map
const map = L.map('map').setView([0, 0], 2); // Set initial view and zoom level
// Add a tile layer to the map (you can choose your preferred tile layer)
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
// Iterate through JSON
places.forEach(place => {
const { lat, lng, title_short, description, images, services, activities } = place;
const marker = L.marker([lat, lng]).addTo(map);
// Create a popup content
const popupContent = `
<b>${title_short}</b><br>
${description}<br>
<b>Services:</b> ${services.join(', ')}<br>
<b>Activities:</b> ${activities.join(', ')}<br>
<a href="#" onclick="goToLocation(${lat}, ${lng})">Zoom In</a>
`;
const { geoPoint, title, description, socials } = place;
const { lat, lon } = geoPoint;
// Bind popup to the marker
marker.bindPopup(popupContent);
// Create a marker on the map
const marker = L.marker([lat, lon]).addTo(map);
// Create a popup content
const popupContent = `
<b>${title}</b><br>
${description}<br>
<a href="${socials[0].url}" target="_blank">Visit Website</a>
`;
// Bind popup to the marker
marker.bindPopup(popupContent);
});
})
.catch(error => {
console.error('Error fetching JSON data:', error);
});
// Fetch p4n data
axios.get('./p4n.json')
.then(response => {
const p4nPlaces = response.data;
// Iterate through p4n data
p4nPlaces.forEach(place => {
const { lat, lng, title_short, description, services, activities } = place;
const marker = L.marker([lat, lng]).addTo(map);
// Create a popup content
const popupContent = `
<b>${title_short}</b><br>
${description}<br>
<b>Services:</b> ${services.join(', ')}<br>
<b>Activities:</b> ${activities.join(', ')}<br>
<a href="#" onclick="goToLocation(${lat}, ${lng})">Zoom In</a>
`;
// Bind popup to the marker
marker.bindPopup(popupContent);
});
})
.catch(error => {
console.error('Error fetching p4n JSON data:', error);
});
function goToLocation(lat, lng) {
// Switch to ArcGIS World Imagery basemap
L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
@ -86,20 +123,22 @@ axios.get('./p4n.json')
// Fetch JSON data for rolling text
axios.get('gchange50.json')
.then(response => {
const ids = response.data.hits.hits.map(hit => hit._id);
//
const titles = response.data.hits.hits.map(hit => hit._source.title);
displayRollingText(titles);
displayRollingText(titles, ids);
})
.catch(error => {
console.error('Error fetching rolling text JSON data:', error);
});
function displayRollingText(titles) {
function displayRollingText(titles, ids) {
const rollingTextContainer = document.getElementById('rollingText');
let currentIndex = 0;
function updateText() {
rollingTextContainer.textContent = titles[currentIndex];
currentIndex = (currentIndex + 1) % titles.length;
rollingTextContainer.innerHTML = `<a href="https://data.gchange.fr/market/record/${ids[currentIndex]}/_share">${titles[currentIndex]}</a>`;
currentIndex = (currentIndex + 1) % titles.length;
}
setInterval(updateText, 3000); // Change text every 3 seconds (adjust as needed)

View File

@ -488,7 +488,7 @@ if [[ $XDG_SESSION_TYPE == 'x11' || $XDG_SESSION_TYPE == 'wayland' ]]; then
fi
## https://git.p2p.legal/qo-op/OSM2IPFS
EARTHCID="/ipfs/QmYGS24WxVbsmmQfqWohXhXQZiwSmNswhTtSj9msVWKkNh"
EARTHCID="/ipfs/QmUY7FAEnfrXPb3MdnH7EzQMHsdk7gNSkiZ9irnphTa4ct"
FLIPPERCID="${EARTHCID}/coinflip" ### EASTER EGG
###########################