mirror of
https://codeberg.org/ashley/poke
synced 2025-05-30 02:59:43 +00:00
192 lines
7.3 KiB
Plaintext
192 lines
7.3 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 _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:#fff;padding:10px 12px;border-radius:12px;box-shadow:0 4px 10px rgba(0,0,0,0.15);font-family:sans-serif;min-width:260px;';
|
|
form.innerHTML = `
|
|
<input id="searchBox" type="text" placeholder="Search anywhere..." style="padding:6px 10px;width:100%;font-size:14px;border:1px solid #ccc;border-radius:6px">
|
|
<ul id="suggestions" style="list-style:none;margin:6px 0 0;padding:0;max-height:180px;overflow:auto;background:#fff;border:1px solid #ccc;border-radius:6px;display:none;position:relative;z-index:10000;"></ul>
|
|
<div style="margin-top:10px;display:flex;gap:6px;flex-wrap:wrap">
|
|
<button type="button" style="flex:1;padding:4px 6px;font-size:12px" onclick="navigator.geolocation.getCurrentPosition(p=>updateMap(p.coords.latitude, p.coords.longitude))">📍 Locate</button>
|
|
<button type="button" style="flex:1;padding:4px 6px;font-size:12px" onclick="copyCoordinates()">📋 Copy Link</button>
|
|
<button type="button" style="flex:1;padding:4px 6px;font-size:12px" onclick="location.reload()">🔁 Reset</button>
|
|
</div>
|
|
`;
|
|
|
|
document.body.appendChild(form);
|
|
|
|
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 #eee;font-size:13px';
|
|
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));
|
|
}
|
|
});
|
|
});
|
|
|
|
_0x4f2a();
|
|
})();
|
|
</script><script src="/static/data-mobile.js"></script>
|
|
</body>
|
|
</html>
|