- .wiki-header-frame の高さを 108px から 124px へ拡大し、グローバルナビ下部リンクの埋まり・見切れを解消 - ヘッダー内のパディング・マージンを微調整し、全体が余裕を持って完全表示されるよう最適化 - グローバルナビを全ジョブ展開を見据えた公式5大ロール(タンク、ヒーラー、近接DPS、物理レンジ、キャスター)グループ別に再編 - サイドバーの戦闘ジョブ一覧もロール別見出し(💚 ヒーラー、⚔️ 近接DPS、🏹 遠隔物理DPS、🔮 遠隔魔法DPS)に構造化
328 lines
12 KiB
JavaScript
328 lines
12 KiB
JavaScript
/**
|
||
* FINAL FANTASY XIV 総合攻略Wiki
|
||
* 共通ナビゲーション&UI自動レンダリングエンジン
|
||
* Seesaa Wiki ニュートラルグレー テンプレート準拠
|
||
*/
|
||
|
||
// サイト共通ナビゲーション定義マスター
|
||
const WIKI_NAV_CONFIG = {
|
||
siteTitle: 'FINAL FANTASY XIV 総合攻略Wiki',
|
||
siteDesc: '光の戦士のための実戦立ち回り・XHB配置・マクロ詳細・育成ロードマップ集成 (パッチ7.x 黄金のレガシー対応)',
|
||
globalNav: [
|
||
{ title: 'トップ', path: 'index.html' },
|
||
{ title: 'XHB・操作', path: 'xhb/index.html' },
|
||
{ title: '🛡️ タンク', path: 'index.html#tank' },
|
||
{ title: '💚 ヒーラー', path: 'jobs/scholar/index.html' },
|
||
{ title: '⚔️ 近接DPS', path: 'jobs/samurai/index.html' },
|
||
{ title: '🏹 物理レンジ', path: 'jobs/bard/index.html' },
|
||
{ title: '🔮 キャスター', path: 'jobs/summoner/index.html' },
|
||
{ title: '🔨 ギャザクラ', path: 'crafter_gatherer/index.html' },
|
||
{ title: '📜 便利マクロ', path: 'macros/useful_macros.html' },
|
||
{ title: '👥 マルチプレイ', path: 'multiplayer/index.html' }
|
||
],
|
||
sidebar: [
|
||
{
|
||
type: 'search',
|
||
title: 'サイト内検索'
|
||
},
|
||
{
|
||
type: 'links',
|
||
title: 'メインメニュー',
|
||
links: [
|
||
{ text: '🏠 Wiki トップ', path: 'index.html' }
|
||
]
|
||
},
|
||
{
|
||
type: 'links',
|
||
title: '🎮 XHB・操作設計',
|
||
links: [
|
||
{ text: 'XHB総合案内・思想', path: 'xhb/index.html' },
|
||
{ text: '全ジョブ共通XHB配置', path: 'xhb/common_layout.html' },
|
||
{ text: 'WXHB・同時押し設定', path: 'xhb/wxhb_settings.html' }
|
||
]
|
||
},
|
||
{
|
||
type: 'groups',
|
||
title: '⚔️ 戦闘ジョブ攻略',
|
||
groups: [
|
||
{
|
||
name: '【巴術士】',
|
||
links: [
|
||
{ text: '巴術士基礎・ジョブ解放', path: 'jobs/arcanist/index.html' },
|
||
{ text: '巴術士専用マクロ', path: 'jobs/arcanist/macros.html' }
|
||
]
|
||
},
|
||
{
|
||
name: '【召喚士】',
|
||
links: [
|
||
{ text: '召喚士トップ・基礎', path: 'jobs/summoner/index.html' },
|
||
{ text: 'Lv34スキル回し', path: 'jobs/summoner/rotation_lv34.html' },
|
||
{ text: 'Lv50〜100バースト回し', path: 'jobs/summoner/rotation_lv50_100.html' },
|
||
{ text: '召喚士専用XHB配置', path: 'jobs/summoner/xhb.html' },
|
||
{ text: '召喚士実戦マクロ集', path: 'jobs/summoner/macros.html' }
|
||
]
|
||
},
|
||
{
|
||
name: '【学者】',
|
||
links: [
|
||
{ text: '学者トップ・Lv34基礎', path: 'jobs/scholar/index.html' },
|
||
{ text: 'フェアリー操作の極意', path: 'jobs/scholar/fairy_guide.html' },
|
||
{ text: '学者専用XHB配置', path: 'jobs/scholar/xhb.html' },
|
||
{ text: '学者実戦マクロ集', path: 'jobs/scholar/macros.html' }
|
||
]
|
||
},
|
||
{
|
||
name: '【吟遊詩人】',
|
||
links: [
|
||
{ text: '吟遊詩人トップ・基礎', path: 'jobs/bard/index.html' },
|
||
{ text: '3大戦歌ローテーション', path: 'jobs/bard/songs_rotation.html' },
|
||
{ text: 'Lv70〜100スキル回し', path: 'jobs/bard/rotation_lv70_100.html' },
|
||
{ text: '固定48枠XHB完全設計', path: 'jobs/bard/xhb.html' },
|
||
{ text: '12×1 CD監視ホットバー', path: 'jobs/bard/cd_hotbar.html' },
|
||
{ text: '吟遊詩人実戦マクロ集', path: 'jobs/bard/macros.html' }
|
||
]
|
||
},
|
||
{
|
||
name: '【侍】',
|
||
links: [
|
||
{ text: '侍トップ・基礎', path: 'jobs/samurai/index.html' },
|
||
{ text: '雪月花・コンボ・バースト', path: 'jobs/samurai/combos_rotation.html' },
|
||
{ text: '固定48枠XHB完全設計', path: 'jobs/samurai/xhb.html' },
|
||
{ text: '12×1 CD監視ホットバー', path: 'jobs/samurai/cd_hotbar.html' },
|
||
{ text: '侍実戦マクロ集', path: 'jobs/samurai/macros.html' }
|
||
]
|
||
}
|
||
]
|
||
},
|
||
{
|
||
type: 'links',
|
||
title: '🔨 ギャザラー・クラフター',
|
||
links: [
|
||
{ text: 'ギャザクラ総合トップ', path: 'crafter_gatherer/index.html' },
|
||
{ text: '全ギルド・NPC座標一覧', path: 'crafter_gatherer/npc_locations.html' },
|
||
{ text: '爆速レベル上げロードマップ', path: 'crafter_gatherer/leveling_roadmap.html' },
|
||
{ text: 'リーヴ&GC調達納品', path: 'crafter_gatherer/leves_gc_supply.html' },
|
||
{ text: '復興・釣り・お得意様', path: 'crafter_gatherer/ishgard_ocean_custom.html' },
|
||
{ text: 'ギャザクラ製作マクロ集', path: 'crafter_gatherer/macros.html' }
|
||
]
|
||
},
|
||
{
|
||
type: 'links',
|
||
title: '📜 システム・便利マクロ',
|
||
links: [
|
||
{ text: 'プレイ快適化・便利マクロ大全', path: 'macros/useful_macros.html' }
|
||
]
|
||
},
|
||
{
|
||
type: 'links',
|
||
title: '🛡️ マルチプレイ基礎',
|
||
links: [
|
||
{ text: '初心者心得・基本マナー', path: 'multiplayer/index.html' },
|
||
{ text: 'ID・討伐戦立ち回り基礎', path: 'multiplayer/dungeon_basics.html' }
|
||
]
|
||
}
|
||
],
|
||
footer: {
|
||
copyright: '© SQUARE ENIX CO., LTD. All Rights Reserved. | FINAL FANTASY XIV',
|
||
subText: 'FF14 攻略Wiki (Seesaa Wiki ニュートラルグレー テンプレート完全準拠)'
|
||
}
|
||
};
|
||
|
||
// Wikiルートへの相対パスプレフィックスを検出
|
||
function getWikiRootPrefix() {
|
||
const scripts = document.querySelectorAll('script');
|
||
for (let i = 0; i < scripts.length; i++) {
|
||
const src = scripts[i].getAttribute('src') || '';
|
||
const idx = src.indexOf('common/js/wiki_common.js');
|
||
if (idx !== -1) {
|
||
return src.substring(0, idx);
|
||
}
|
||
// common/ 内のパーツHTML (common/sidebar.html 等) からの読み込み
|
||
if (src.endsWith('wiki_common.js') && (src.includes('js/') || src === 'wiki_common.js')) {
|
||
return '../';
|
||
}
|
||
}
|
||
const pathname = window.location.pathname.replace(/\\/g, '/');
|
||
if (pathname.includes('/jobs/')) return '../../';
|
||
if (pathname.includes('/crafter_gatherer/') || pathname.includes('/xhb/') || pathname.includes('/multiplayer/') || pathname.includes('/macros/') || pathname.includes('/common/')) return '../';
|
||
return '';
|
||
}
|
||
|
||
// 現在のページ判定
|
||
function isCurrentPage(linkPath) {
|
||
const currentPath = window.location.pathname.replace(/\\/g, '/');
|
||
if (currentPath.endsWith('/' + linkPath) || currentPath.endsWith(linkPath)) {
|
||
return true;
|
||
}
|
||
if (linkPath.endsWith('index.html')) {
|
||
const dirPath = linkPath.replace(/index\.html$/, '');
|
||
if (currentPath.endsWith('/' + dirPath) || currentPath.endsWith(dirPath)) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
|
||
// ヘッダーレンダリング
|
||
function renderHeader(rootPrefix) {
|
||
const header = document.getElementById('wiki-header');
|
||
if (!header) return;
|
||
header.innerHTML = `
|
||
<div class="wiki-site-title">
|
||
<a href="${rootPrefix}index.html">${WIKI_NAV_CONFIG.siteTitle}</a>
|
||
</div>
|
||
<div class="wiki-site-desc">
|
||
${WIKI_NAV_CONFIG.siteDesc}
|
||
</div>
|
||
`;
|
||
}
|
||
|
||
// グローバルナビレンダリング
|
||
function renderGlobalNav(rootPrefix) {
|
||
const nav = document.getElementById('wiki-global-nav');
|
||
if (!nav) return;
|
||
const itemsHtml = WIKI_NAV_CONFIG.globalNav.map(item => {
|
||
const fullHref = rootPrefix + item.path;
|
||
const activeClass = isCurrentPage(item.path) ? ' class="active"' : '';
|
||
return `<li><a href="${fullHref}"${activeClass}>${item.title}</a></li>`;
|
||
}).join('');
|
||
nav.innerHTML = `<ul class="wiki-nav-list">${itemsHtml}</ul>`;
|
||
}
|
||
|
||
// サイドバーレンダリング
|
||
function renderSidebar(rootPrefix) {
|
||
const sidebar = document.getElementById('wiki-sidebar');
|
||
if (!sidebar) return;
|
||
let html = '';
|
||
WIKI_NAV_CONFIG.sidebar.forEach(section => {
|
||
if (section.type === 'search') {
|
||
html += `
|
||
<div class="sidebar-box">
|
||
<div class="sidebar-title">${section.title}</div>
|
||
<div class="sidebar-content">
|
||
<div class="sidebar-search-box">
|
||
<input type="text" id="sidebarSearchInput" class="sidebar-search-input" placeholder="キーワード検索...">
|
||
<button type="button" id="sidebarSearchBtn" class="sidebar-search-btn">検索</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
`;
|
||
} else if (section.type === 'links') {
|
||
const linksHtml = section.links.map(link => {
|
||
const fullHref = rootPrefix + link.path;
|
||
const currentClass = isCurrentPage(link.path) ? ' class="current"' : '';
|
||
return `<li${currentClass}><a href="${fullHref}">${link.text}</a></li>`;
|
||
}).join('');
|
||
html += `
|
||
<div class="sidebar-box">
|
||
<div class="sidebar-title">${section.title}</div>
|
||
<div class="sidebar-content">
|
||
<ul>${linksHtml}</ul>
|
||
</div>
|
||
</div>
|
||
`;
|
||
} else if (section.type === 'groups') {
|
||
let groupsHtml = '';
|
||
section.groups.forEach((group, idx) => {
|
||
const marginTop = idx === 0 ? '4px' : '8px';
|
||
const groupLinks = group.links.map(link => {
|
||
const fullHref = rootPrefix + link.path;
|
||
const currentClass = isCurrentPage(link.path) ? ' class="current"' : '';
|
||
return `<li${currentClass}><a href="${fullHref}">${link.text}</a></li>`;
|
||
}).join('');
|
||
groupsHtml += `
|
||
<p style="font-size: 11px; font-weight: bold; color: #525a66; margin: ${marginTop} 0 2px;">${group.name}</p>
|
||
<ul>${groupLinks}</ul>
|
||
`;
|
||
});
|
||
html += `
|
||
<div class="sidebar-box">
|
||
<div class="sidebar-title">${section.title}</div>
|
||
<div class="sidebar-content">
|
||
${groupsHtml}
|
||
</div>
|
||
</div>
|
||
`;
|
||
}
|
||
});
|
||
sidebar.innerHTML = html;
|
||
}
|
||
|
||
// フッターレンダリング
|
||
function renderFooter() {
|
||
const footer = document.getElementById('wiki-footer');
|
||
if (!footer) return;
|
||
footer.innerHTML = `
|
||
<p>${WIKI_NAV_CONFIG.footer.copyright}</p>
|
||
<p>${WIKI_NAV_CONFIG.footer.subText}</p>
|
||
`;
|
||
}
|
||
|
||
// サイト内検索機能の初期化
|
||
function initSearch(rootPrefix) {
|
||
const searchInput = document.getElementById('sidebarSearchInput');
|
||
const searchBtn = document.getElementById('sidebarSearchBtn');
|
||
if (searchInput) {
|
||
const doSearch = () => {
|
||
const q = searchInput.value.trim();
|
||
if (q) {
|
||
window.location.href = `${rootPrefix}index.html?q=${encodeURIComponent(q)}`;
|
||
}
|
||
};
|
||
if (searchBtn) searchBtn.addEventListener('click', doSearch);
|
||
searchInput.addEventListener('keydown', (e) => {
|
||
if (e.key === 'Enter') doSearch();
|
||
});
|
||
}
|
||
}
|
||
|
||
// マクロコピーボタンの初期化
|
||
function initMacroCopy() {
|
||
document.querySelectorAll('.wiki-macro-box').forEach(box => {
|
||
const header = box.querySelector('.wiki-macro-header');
|
||
const code = box.querySelector('.wiki-macro-code');
|
||
if (header && code && !header.querySelector('button')) {
|
||
const btn = document.createElement('button');
|
||
btn.type = 'button';
|
||
btn.textContent = '📋 マクロをコピー';
|
||
btn.style.cssText = 'background: #525a66; color: #fff; border: 1px solid #3c424c; padding: 2px 8px; font-size: 11px; cursor: pointer; border-radius: 2px;';
|
||
btn.addEventListener('click', () => {
|
||
navigator.clipboard.writeText(code.innerText.trim()).then(() => {
|
||
btn.textContent = '✔ コピー完了!';
|
||
setTimeout(() => { btn.textContent = '📋 マクロをコピー'; }, 2000);
|
||
});
|
||
});
|
||
header.appendChild(btn);
|
||
}
|
||
});
|
||
}
|
||
|
||
// 共通初期化処理
|
||
function initWikiCommon() {
|
||
const rootPrefix = getWikiRootPrefix();
|
||
|
||
// iframeが配置されていない場合のみJS動的レンダリング(フォールバック)
|
||
const hasHeaderFrame = document.querySelector('.wiki-header-frame');
|
||
const hasSidebarFrame = document.querySelector('.wiki-sidebar-frame');
|
||
|
||
if (!hasHeaderFrame) {
|
||
renderHeader(rootPrefix);
|
||
renderGlobalNav(rootPrefix);
|
||
}
|
||
|
||
if (!hasSidebarFrame) {
|
||
renderSidebar(rootPrefix);
|
||
initSearch(rootPrefix);
|
||
}
|
||
|
||
renderFooter();
|
||
initMacroCopy();
|
||
}
|
||
|
||
// DOM ready 時に安全に実行(すでにロード済みのケースも完全対応)
|
||
if (document.readyState === 'loading') {
|
||
document.addEventListener('DOMContentLoaded', initWikiCommon);
|
||
} else {
|
||
initWikiCommon();
|
||
}
|