mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-17 01:34:43 -05:00
use javascript file
This commit is contained in:
parent
8ec890dea1
commit
efc7e8a687
1 changed files with 1 additions and 35 deletions
36
html/map.ejs
36
html/map.ejs
|
@ -44,40 +44,6 @@
|
||||||
|
|
||||||
//--><!]]>
|
//--><!]]>
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script src="/static/map.js"></script><script src="/static/data-mobile.js"></script>
|
||||||
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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue