「Widget:Custom map」の版間の差分

提供:メタファー リファンタジオ 攻略Wiki
移動先:案内検索
編集の要約なし
編集の要約なし
1行目: 1行目:
<includeonly>
<!-- Required CSS and libraries... -->
 
<!-- Global Configuration -->
<script>
<script>
// Initialize required global objects
// Clear any existing GTP8 object
if (window.GTP8) {
    delete window.GTP8;
}
 
// Initialize fresh GTP8 namespace
window.GTP8 = {
window.GTP8 = {
    initializeMap: null,
     map: null,
     map: null,
     drawnItems: null,
     drawnItems: null,
18行目: 24行目:
     const baseUrl = currentUrl.origin + currentUrl.pathname.split('/').slice(0, -1).join('/');
     const baseUrl = currentUrl.origin + currentUrl.pathname.split('/').slice(0, -1).join('/');
     window.API_BASE_URL = baseUrl;
     window.API_BASE_URL = baseUrl;
    console.log('API_BASE_URL initialized:', baseUrl);
})();
})();


// Map configuration must be defined before loading other scripts
// Map configuration
window.mapConfig = {
window.mapConfig = {
     imageUrl: '<!--{$img}-->',
     imageUrl: '<!--{$img}-->',
45行目: 52行目:
     }
     }
};
};
</script>
<!-- Load scripts sequentially -->
<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);
        });
}


// Debug verification
// Start loading when document is ready
console.log('Initial setup complete:', {
$(document).ready(() => {
     GTP8: !!window.GTP8,
     loadScriptsSequentially();
    mapConfig: !!window.mapConfig,
    API_BASE_URL: !!window.API_BASE_URL
});
});
</script>
</script>
<!-- Load scripts after configuration -->
<script src="https://dq.h1g.jp/leaflet/gtp8-core.js"></script>
<script src="https://dq.h1g.jp/leaflet/gtp8-icons.js"></script>
<script src="https://dq.h1g.jp/leaflet/gtp8-popups.js"></script>
<script src="https://dq.h1g.jp/leaflet/gtp8-api.js"></script>
<script src="https://dq.h1g.jp/leaflet/gtp8-init.js"></script>
</includeonly>

2024年11月10日 (日) 21:25時点における版


<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>