「Widget:Custom map」の版間の差分
提供:メタファー リファンタジオ 攻略Wiki
ヘイグ運営用アカウント (トーク | 投稿記録) 編集の要約なし |
ヘイグ運営用アカウント (トーク | 投稿記録) 編集の要約なし |
||
75行目: | 75行目: | ||
<!-- Load scripts sequentially --> | <!-- Load scripts sequentially --> | ||
<script> | <script> | ||
// | // Clear any existing GTP8 object | ||
if (window.GTP8) { | |||
console.log('[Init] Clearing existing GTP8 object'); | |||
delete window.GTP8; | |||
} | |||
// Initialize fresh GTP8 namespace | |||
window.GTP8 = { | window.GTP8 = { | ||
map: null, | map: null, | ||
83行目: | 89行目: | ||
api: {}, | api: {}, | ||
popups: {}, | popups: {}, | ||
icons: {} | icons: {} | ||
}; | }; | ||
96行目: | 100行目: | ||
script.onload = () => { | script.onload = () => { | ||
console.log('[Script Loader] Successfully loaded:', src); | console.log('[Script Loader] Successfully loaded:', src); | ||
if (src.includes('gtp8-core.js')) { | if (src.includes('gtp8-core.js')) { | ||
// コア読み込み後の検証を強化 | |||
const verification = { | |||
hasGTP8: !!window.GTP8, | hasGTP8: !!window.GTP8, | ||
initializeMapType: | initializeMapType: typeof window.GTP8.initializeMap, | ||
isFunction: typeof window.GTP8.initializeMap === 'function' | |||
}; | |||
if ( | console.log('[Script Loader] Core verification:', verification); | ||
reject(new Error(` | |||
if (!verification.isFunction) { | |||
console.error('[Script Loader] initializeMap not properly defined'); | |||
reject(new Error(`initializeMap not properly defined. Type: ${verification.initializeMapType}`)); | |||
return; | return; | ||
} | } | ||
116行目: | 122行目: | ||
} | } | ||
// スクリプトの順次読み込み | |||
'https://dq.h1g.jp/leaflet/gtp8-core.js' | return Promise.resolve() | ||
'https://dq.h1g.jp/leaflet/gtp8-icons.js' | .then(() => loadScript('https://dq.h1g.jp/leaflet/gtp8-core.js')) | ||
'https://dq.h1g.jp/leaflet/gtp8-popups.js' | .then(() => loadScript('https://dq.h1g.jp/leaflet/gtp8-icons.js')) | ||
'https://dq.h1g.jp/leaflet/gtp8-api.js' | .then(() => loadScript('https://dq.h1g.jp/leaflet/gtp8-popups.js')) | ||
'https://dq.h1g.jp/leaflet/gtp8-init.js' | .then(() => loadScript('https://dq.h1g.jp/leaflet/gtp8-api.js')) | ||
.then(() => loadScript('https://dq.h1g.jp/leaflet/gtp8-init.js')); | |||
} | } | ||
// Start loading when document is ready | |||
$(document).ready(() => { | $(document).ready(() => { | ||
console.log('[Main] Starting initialization | console.log('[Main] Starting initialization'); | ||
loadScriptsSequentially().catch(error => { | loadScriptsSequentially().catch(error => { | ||
console.error('[Main] Loading sequence failed:', error); | console.error('[Main] Loading sequence failed:', error); |