1
0
Fork 0
mirror of https://codeberg.org/ashley/poke.git synced 2024-11-17 00:34:41 -05:00
poke/html/map.ejs
2023-11-03 16:00:27 +00:00

86 lines
3.1 KiB
Text

<!DOCTYPE html>
<html>
<head>
<title>PokeMaps</title>
<link href="/css/yt-ukraine.svg" rel="icon" />
<style>
div {
display: none;
}
</style>
</head>
<body>
<p>
loading..
</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>
<div>
<img src="https://t.poketube.fun/t/rep.gif" style="width: 0; visibility: hidden" id="status" />
</div>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
/**
* @licstart The following is the entire license notice for the JavaScript
* code in this page.
*
* Copyright (C) 2021-2023 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>
var bbox = "?bbox=-165.76171875000003%2C-3.864254615721396%2C30.410156250000004%2C72.44879155730672&amp;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>
</html>