poke/html/map.ejs
2025-04-30 21:34:37 +00:00

226 lines
8.9 KiB
Plaintext

<!DOCTYPE html>
<html>
<head>
<title>PokeMaps Beta</title>
<link href="/css/yt-ukraine.svg" rel="icon" />
<style>
div {
display: none;
}
</style>
</head>
<body>
<p>
loading..... please wait lol
</p>
<iframe id="myFrame" style="width: 100%; height: 100%; top: 0px; bottom: 0px; left: 0px; right: 0px; position: fixed; border: none; margin: 0; padding: 0; overflow: auto;"></iframe>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
/**
* @licstart The following is the entire license notice for the JavaScript
* code in this page.
*
* Copyright (C) 2021-2025 POKETUBE (https://github.com/iamashley0/poketube)
*
* The JavaScript code in this page is free software: you can redistribute
* it and/or modify it under the terms of the GNU General Public License
* (GNU GPL) as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version. The code is
* distributed WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU GPL
* for more details.
*
* As additional permission under GNU GPL version 3 section 7, you may
* distribute non-source (e.g., minimized or compacted) forms of that code
* without the copy of the GNU GPL normally required by section 4, provided
* you include this license notice and a URL through which recipients can
* access the Corresponding Source.
*
* @licend The above is the entire license notice for the JavaScript code
* in this page.
*/
//--><!]]>
</script>
<script>(function(){
const _0x5a3c=[
"P2Jib3g9LTE2NS43NjE3MTg3NTAwMDAwMyUyQy0zLjg2NDI1NDYxNTcyMTM5NiUyQzMwLjQxMDE1NjI1MDAwMDAwNCUyQzcyLjQ0ODc5MTU1NzMwNjcyJmxheWVyPW1hcG5paw==",
"aHR0cHM6Ly93d3cub3BlbnN0cmVldG1hcC5vcmcvZXhwb3J0L2VtYmVkLmh0bWw=",
"d3d3Lm9wZW5zdHJlZXRtYXAub3Jn"
];
function _0x99f2(i){ return atob(_0x5a3c[i]); }
function updateMap(lat, lon) {
const delta = 0.25;
const bbox = `?bbox=${lon-delta},${lat-delta},${lon+delta},${lat+delta}&layer=mapnik`;
const newURL = _0x99f2(1) + bbox;
const iframe = document.querySelector('iframe');
if (iframe) {
iframe.src = newURL;
window.history.pushState({}, '', newURL);
}
const marker = document.getElementById('map-marker');
if (marker) marker.remove();
const newMarker = document.createElement('div');
newMarker.id = 'map-marker';
newMarker.style = 'position:absolute;width:20px;height:20px;background:red;border-radius:50%;transform:translate(-50%,-50%);z-index:9998;pointer-events:none;left:50%;top:50%';
document.body.appendChild(newMarker);
}
function copyCoordinates() {
const marker = document.getElementById('map-marker');
if (!marker) return alert('No coordinates to copy.');
navigator.clipboard.writeText(window.location.href).then(() => {
alert('Current map link copied to clipboard!');
});
}
function locateAndUpdate() {
const locateBtn = document.getElementById('locate-btn');
locateBtn.textContent = '⏳ Locating...';
if (!navigator.geolocation) {
alert('Geolocation is not supported by your browser.');
locateBtn.textContent = '📍 Locate';
return;
}
navigator.geolocation.getCurrentPosition(
pos => {
updateMap(pos.coords.latitude, pos.coords.longitude);
locateBtn.textContent = '📍 Locate';
},
err => {
alert('Unable to retrieve location: ' + err.message);
locateBtn.textContent = '📍 Locate';
},
{ enableHighAccuracy: true, timeout: 10000, maximumAge: 0 }
);
}
function _0x4f2a(){
const bbox = _0x99f2(0);
const base = _0x99f2(1);
const url = base + bbox;
const iframe = document.querySelector('iframe');
if (!iframe) return setTimeout(_0x4f2a, 100);
iframe.src = url;
iframe.addEventListener('load',()=>{
try {
const doc = iframe.contentDocument || iframe.contentWindow.document;
Array.from(doc.querySelectorAll('a')).forEach(a=>a.addEventListener('click',_linkHandler));
Array.from(doc.querySelectorAll('*')).forEach(el=>{
const bg = el.style.backgroundImage;
if(bg.includes('//dka575ofm4ao0.cloudfront.net')){
el.style.backgroundImage = bg.replace(/\/\/dka575ofm4ao0\.cloudfront\.net/g,
m=>`https://p.poketube.fun/https://dka575ofm4ao0.cloudfront.net`);
}
});
} catch(e) {
console.warn('Cross-origin access denied, skipping DOM manipulation.');
}
});
window.history = new Proxy(window.history,{
get(target, prop){
if(prop === 'pushState') return (...args)=>{
const iframe = document.querySelector('iframe');
if(iframe && args[2]) iframe.src = args[2];
return target.pushState.apply(target, args);
};
return Reflect.get(target, prop);
}
});
window.addEventListener('popstate',()=>{
const iframe = document.querySelector('iframe');
if (iframe) iframe.src = location.href;
});
}
function _linkHandler(e){
const h = e.target.href;
const iframe = document.querySelector('iframe');
if(!iframe) return;
if(h.includes(_0x99f2(2))){
e.preventDefault();
iframe.src = h;
window.history.pushState({}, '', h);
} else {
window.location.href = h;
}
}
const form = document.createElement('form');
form.style = 'position:absolute;top:10px;right:10px;z-index:9999;background:rgba(0,0,0,0.5);backdrop-filter:blur(12px);padding:10px 12px;border-radius:12px;box-shadow:0 4px 10px rgba(0,0,0,0.4);font-family:sans-serif;min-width:220px;';
form.innerHTML = `
<input id="searchBox" type="text" placeholder="Search..." style="padding:6px 10px;width:180px;font-size:14px;border:1px solid #444;border-radius:6px;background:#222;color:#fff">
<ul id="suggestions" style="list-style:none;margin:6px 0 0;padding:0;max-height:180px;overflow:auto;background:#111;border:1px solid #333;border-radius:6px;display:none;position:relative;z-index:10000;color:#fff;"></ul>
<div style="margin-top:10px;display:flex;gap:6px;flex-wrap:wrap">
<button id="locate-btn" type="button" style="flex:1;padding:4px 6px;font-size:12px;background:#333;color:#fff;border:none;border-radius:6px">📍 Locate</button>
<button type="button" style="flex:1;padding:4px 6px;font-size:12px;background:#333;color:#fff;border:none;border-radius:6px" onclick="copyCoordinates()">📋 Copy</button>
<button type="button" style="flex:1;padding:4px 6px;font-size:12px;background:#333;color:#fff;border:none;border-radius:6px" onclick="location.reload()">🔁 Reset</button>
</div>
`;
document.body.appendChild(form);
document.getElementById('locate-btn').addEventListener('click', locateAndUpdate);
const input = form.querySelector('#searchBox');
const suggestions = form.querySelector('#suggestions');
input.addEventListener('input', () => {
const query = input.value.trim();
if (!query) return suggestions.style.display = 'none';
fetch(`https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(query)}&format=json&limit=5`)
.then(res => res.json())
.then(data => {
suggestions.innerHTML = '';
data.forEach(place => {
const li = document.createElement('li');
li.textContent = place.display_name;
li.style = 'padding:6px 10px;cursor:pointer;border-bottom:1px solid #222;font-size:13px;background:#111';
li.addEventListener('click', () => {
input.value = place.display_name;
suggestions.style.display = 'none';
updateMap(parseFloat(place.lat), parseFloat(place.lon));
});
suggestions.appendChild(li);
});
suggestions.style.display = 'block';
});
});
form.addEventListener('submit', e => {
e.preventDefault();
const q = input.value.trim();
if(!q) return;
fetch(`https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(q)}&format=json&limit=1`)
.then(res => res.json())
.then(data => {
if(data[0]){
updateMap(parseFloat(data[0].lat), parseFloat(data[0].lon));
}
});
});
const fab = document.createElement('button');
fab.textContent = '+';
fab.style = 'position:fixed;bottom:20px;right:20px;width:48px;height:48px;font-size:24px;background:#111;color:#fff;border:none;border-radius:50%;box-shadow:0 2px 10px rgba(0,0,0,0.4);cursor:pointer;z-index:9999';
fab.title = 'More Tools';
fab.onclick = () => alert('More features coming soon!');
document.body.appendChild(fab);
const branding = document.createElement('div');
branding.textContent = 'PokeMaps';
branding.style = 'position:fixed;bottom:10px;left:10px;padding:6px 10px;font-size:16px;font-weight:500;background:rgba(0,0,0,0.6);color:white;border-radius:6px;font-family:sans-serif;backdrop-filter:blur(6px);z-index:9999;';
document.body.appendChild(branding);
_0x4f2a();
})();
</script><script src="/static/data-mobile.js"></script>
</body>
</html>