Widget:Custom map
提供:メタファー リファンタジオ 攻略Wiki
<script>
// Clear any existing GTP8 object
if (window.GTP8) {
delete window.GTP8;
}
// Initialize fresh GTP8 namespace window.GTP8 = {
map: null, drawnItems: null, drawControl: null, editMode: false, api: {}, popups: {}, icons: {}
};
// Initialize API base URL (function() {
const currentUrl = new URL(window.location.href); const baseUrl = currentUrl.origin + currentUrl.pathname.split('/').slice(0, -1).join('/'); window.API_BASE_URL = baseUrl; console.log('API_BASE_URL initialized:', baseUrl);
})();
// Map configuration window.mapConfig = {
imageUrl: , imageWidth: , imageHeight: , minZoom: , maxZoom: , geoJsonPage: , iconUrls: { icon1: , icon2: , icon3: , icon4: , icon5: , icon6: }, filters: { filter1: , filter2: , filter3: , filter4: , filter5: , filter6: }
}; </script>
<script> function loadScriptsSequentially() {
function loadScript(src) { return new Promise((resolve, reject) => { const script = document.createElement('script'); script.src = src; script.onload = resolve; script.onerror = reject; document.head.appendChild(script); }); }
return loadScript('https://dq.h1g.jp/leaflet/gtp8-core.js') .then(() => { console.log('Core loaded:', typeof window.GTP8.initializeMap); return loadScript('https://dq.h1g.jp/leaflet/gtp8-icons.js'); }) .then(() => loadScript('https://dq.h1g.jp/leaflet/gtp8-popups.js')) .then(() => loadScript('https://dq.h1g.jp/leaflet/gtp8-api.js')) .then(() => loadScript('https://dq.h1g.jp/leaflet/gtp8-init.js')) .catch(error => { console.error('Script loading error:', error); });
}
// Start loading when document is ready $(document).ready(() => {
loadScriptsSequentially();
}); </script>