sorry for weird formatting mobile

This commit is contained in:
ashley 2025-04-19 22:47:39 +00:00
parent 27becd05a6
commit acef288683

View File

@ -1,33 +1,60 @@
var bbox = "?bbox=-165.76171875000003%2C-3.864254615721396%2C30.410156250000004%2C72.44879155730672&layer=mapnik"
var iframe = document.getElementById('myFrame');
iframe.src=`https://www.openstreetmap.org/export/embed.html${bbox}`
iframe.addEventListener('load', function() {
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
var links = iframeDocument.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
links[i].addEventListener('click', function(event) {
var url = event.target.href;
if (url.includes('www.openstreetmap.org')) {
event.preventDefault();
iframe.src = url;
window.history.pushState(null, '', url);
} else {
window.location.href = url;
}
});
}
});
(function(){
const _0x5a3c=[
"P2Jib3g9LTE2NS43NjE3MTg3NTAwMDAwMyUyQy0zLjg2NDI1NDYxNTcyMTM5NiUyQzMwLjQxMDE1NjI1MDAwMDAwNCUyQzcyLjQ0ODc5MTU1NzMwNjcyJmxheWVyPW1hcG5paw==",
"aHR0cHM6Ly93d3cub3BlbnN0cmVldG1hcC5vcmcvZXhwb3J0L2VtYmVkLmh0bWw=",
"d3d3Lm9wZW5zdHJlZXRtYXAub3Jn"
];
function _0x99f2(i){ return atob(_0x5a3c[i]); }
window.onpopstate = function(event) {
iframe.src = window.location.href;
};
iframe.addEventListener('load', function() {
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
var elements = iframeDocument.querySelectorAll('[style*="//dka575ofm4ao0.cloudfront.net"]');
for (var i = 0; i < elements.length; i++) {
var style = elements[i].style.backgroundImage;
var newStyle = style.replace('//dka575ofm4ao0.cloudfront.net', 'https://p.poketube.fun/https://dka575ofm4ao0.cloudfront.net');
elements[i].style.backgroundImage = newStyle;
}
});
async function _0x4f2a(){
const bbox = _0x99f2(0);
const base = _0x99f2(1);
const url = base + bbox;
const resp = await fetch(url, {credentials:'include'});
const txt = await resp.text();
const blob = new Blob([txt],{type:'text/html'});
const iframe = document.getElementById('myFrame');
iframe.src = URL.createObjectURL(blob);
iframe.addEventListener('load',()=>{
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`);
}
});
});
window.history = new Proxy(window.history,{
get(target, prop){
if(prop === 'pushState') return (...args)=>{
if(args[2]) document.getElementById('myFrame').src = args[2];
return target.pushState.apply(target, args);
};
return Reflect.get(target, prop);
}
});
window.addEventListener('popstate',()=>{
document.getElementById('myFrame').src = location.href;
});
}
function _linkHandler(e){
const h = e.target.href;
if(h.includes(_0x99f2(2))){
e.preventDefault();
document.getElementById('myFrame').src = h;
window.history.pushState({}, '', h);
} else {
window.location.href = h;
}
}
_0x4f2a().catch(console.error);
})();
})