時間帯データを読み込み中...
// URL管理システムの情報表示機能 function refreshUrlInfo() { if (window.GasAPI && window.GasAPI.getUrlManagerInfo) { // 現在のURL情報を取得 const oldInfo = window.GasAPI.getUrlManagerInfo(); console.log('[URL Refresh] 更新前URL情報:', oldInfo); // ランダムURL選択を実行 if (window.GasAPI.selectRandomUrl) { const newInfo = window.GasAPI.selectRandomUrl(); console.log('[URL Refresh] 更新後URL情報:', newInfo); // URL情報表示を更新 const urlInfoText = document.getElementById('url-info-text'); if (urlInfoText) { urlInfoText.textContent = `API URL: ${newInfo.index}/${newInfo.total}`; } // URL変更アニメーションを表示 if (window.showUrlChangeAnimation) { console.log('[Timeslot HTML] アニメーション表示実行'); window.showUrlChangeAnimation(oldInfo.url, newInfo.url, 'random'); } else { console.warn('[Timeslot HTML] showUrlChangeAnimation 関数が見つかりません'); // フォールバック: 直接アニメーション関数を定義 showUrlChangeAnimationFallback(oldInfo.url, newInfo.url, 'random'); } } else { // フォールバック: 情報のみ更新 const info = window.GasAPI.getUrlManagerInfo(); const urlInfoText = document.getElementById('url-info-text'); if (urlInfoText) { urlInfoText.textContent = `API URL: ${info.index}/${info.total}`; } console.log('URL管理システム情報:', info); } } } // フォールバック用のアニメーション関数 function showUrlChangeAnimationFallback(oldUrl, newUrl, changeType = 'rotation') { console.log('[Fallback Animation] アニメーション表示開始:', { oldUrl, newUrl, changeType }); // 通知要素を作成 const notification = document.createElement('div'); notification.className = 'url-change-notification'; notification.style.cssText = ` position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 12px 20px; border-radius: 8px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); z-index: 10000; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 14px; font-weight: 500; opacity: 0; transform: translateX(-50%) translateY(-20px); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); max-width: 90vw; text-align: center; border: 1px solid rgba(255, 255, 255, 0.2); cursor: pointer; `; // アイコンとメッセージを設定 const icon = changeType === 'rotation' ? '↻' : '⚡'; const message = changeType === 'rotation' ? 'API URL ローテーション' : 'API URL ランダム選択'; // スクリプトIDを抽出(/macros/s/以降の部分) const scriptId = newUrl.split('/macros/s/')[1]?.split('/')[0] || 'unknown'; const displayId = scriptId.substring(0, 8) + '...'; notification.innerHTML = `
${icon} ${message} (${displayId})
`; // 通知表示用のCSS if (!document.getElementById('url-change-animation-styles')) { const style = document.createElement('style'); style.id = 'url-change-animation-styles'; style.textContent = ` @keyframes slideInDown { from { opacity: 0; transform: translateX(-50%) translateY(-20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } } @keyframes slideOutUp { from { opacity: 1; transform: translateX(-50%) translateY(0); } to { opacity: 0; transform: translateX(-50%) translateY(-20px); } } .url-change-notification { animation: slideInDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards; } .url-change-notification.hiding { animation: slideOutUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards; } `; document.head.appendChild(style); } // 通知を表示 console.log('[Fallback Animation] 通知要素をDOMに追加'); document.body.appendChild(notification); // アニメーション開始 console.log('[Fallback Animation] アニメーション開始'); requestAnimationFrame(() => { notification.style.opacity = '1'; notification.style.transform = 'translateX(-50%) translateY(0)'; console.log('[Fallback Animation] アニメーション適用完了'); }); // 3秒後に自動で消す setTimeout(() => { notification.classList.add('hiding'); setTimeout(() => { if (notification.parentElement) { notification.remove(); } }, 300); }, 3000); // クリックで即座に消す notification.addEventListener('click', () => { notification.classList.add('hiding'); setTimeout(() => { if (notification.parentElement) { notification.remove(); } }, 300); }); } // ページ読み込み時にURL情報を表示 document.addEventListener('DOMContentLoaded', () => { setTimeout(() => { if (window.GasAPI && window.GasAPI.getUrlManagerInfo) { const info = window.GasAPI.getUrlManagerInfo(); const urlInfo = document.getElementById('url-info'); const urlInfoText = document.getElementById('url-info-text'); if (urlInfo && urlInfoText) { urlInfoText.textContent = `API URL: ${info.index}/${info.total}`; urlInfo.style.display = 'block'; } } }, 1000); // 1秒後に表示(API読み込み完了を待つ) });