781 lines
18 KiB
JavaScript
781 lines
18 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: '⭐ フリートライアル最強装備', path: 'equipment/freetrial_gear_guide.html' },
|
||
|
||
{ title: '🐎 マウント完全攻略', path: 'mounts/index.html' },
|
||
{ title: '🔨 ギャザクラ完全攻略', path: 'crafter_gatherer/index.html' },
|
||
|
||
{ title: '🏰 ダンジョン完全攻略一覧', path: 'dungeons/index.html' },
|
||
|
||
{ title: '🔥 討滅戦完全攻略一覧', path: 'trials/index.html' },
|
||
|
||
{ title: '👑 レイド完全攻略一覧', path: 'raids/index.html' },
|
||
|
||
{ title: '⚔️ バトル・ルーレット完全攻略', path: 'battle_contents/index.html' },
|
||
|
||
{ title: '🏡 ハウジング・潜水艦完全攻略', path: 'housing/index.html' }
|
||
|
||
],
|
||
|
||
sidebar: [
|
||
|
||
{
|
||
|
||
type: 'search',
|
||
|
||
title: 'サイト内検索'
|
||
|
||
},
|
||
|
||
{
|
||
|
||
type: 'links',
|
||
|
||
title: 'メインメニュー',
|
||
|
||
links: [
|
||
|
||
{ text: '🏠 Wiki トップ', path: 'index.html' },
|
||
|
||
{ text: '⭐ フリートライアル最強装備', path: 'equipment/freetrial_gear_guide.html' },
|
||
|
||
{ text: '🐎 マウント総合・全一覧', path: 'mounts/index.html' },
|
||
{ text: '🔨 ギャザクラ総合攻略・育成', path: 'crafter_gatherer/index.html' },
|
||
|
||
{ text: '🏰 ダンジョン完全攻略一覧', path: 'dungeons/index.html' },
|
||
|
||
{ text: '🔥 討滅戦完全攻略一覧', path: 'trials/index.html' },
|
||
|
||
{ text: '👑 レイド完全攻略一覧', path: 'raids/index.html' },
|
||
|
||
{ text: '⚔️ バトル・ルーレット完全攻略', path: 'battle_contents/index.html' },
|
||
|
||
{ text: '🏡 ハウジング・潜水艦完全攻略', path: 'housing/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: 'links',
|
||
|
||
title: '⚔️ バトル・特殊コンテンツ',
|
||
|
||
links: [
|
||
|
||
{ text: 'CF・ルーレット・トームストーン', path: 'battle_contents/index.html' },
|
||
|
||
{ text: 'コンサポ&フェイス完全攻略', path: 'battle_contents/duty_support.html' },
|
||
|
||
{ text: '宝の地図 G1〜G17完全攻略', path: 'battle_contents/treasure_hunt.html' },
|
||
|
||
{ text: 'モブハント・A連戦・S湧かせ', path: 'battle_contents/hunt.html' },
|
||
|
||
{ text: 'ディープダンジョン完全攻略', path: 'deep_dungeon/index.html' }
|
||
|
||
]
|
||
|
||
},
|
||
|
||
{
|
||
|
||
type: 'groups',
|
||
|
||
title: '⚔️ バトルジョブ攻略',
|
||
|
||
groups: [
|
||
{
|
||
name: '🛡️ タンク',
|
||
links: [
|
||
{ text: 'ナイト', path: 'jobs/paladin/index.html' },
|
||
{ text: '戦士', path: 'jobs/warrior/index.html' },
|
||
{ text: '暗黒騎士', path: 'jobs/darkknight/index.html' },
|
||
{ text: 'ガンブレイカー', path: 'jobs/gunbreaker/index.html' }
|
||
]
|
||
},
|
||
{
|
||
name: '💚 ヒーラー',
|
||
links: [
|
||
{ text: '白魔道士', path: 'jobs/whitemage/index.html' },
|
||
{ text: '学者', path: 'jobs/scholar/index.html' },
|
||
{ text: '占星術師', path: 'jobs/astrologian/index.html' },
|
||
{ text: '賢者', path: 'jobs/sage/index.html' }
|
||
]
|
||
},
|
||
{
|
||
name: '⚔️ 近接DPS(メレー)',
|
||
links: [
|
||
{ text: 'モンク', path: 'jobs/monk/index.html' },
|
||
{ text: '竜騎士', path: 'jobs/dragoon/index.html' },
|
||
{ text: '忍者', path: 'jobs/ninja/index.html' },
|
||
{ text: '侍', path: 'jobs/samurai/index.html' },
|
||
{ text: 'リーパー', path: 'jobs/reaper/index.html' },
|
||
{ text: 'ヴァイパー', path: 'jobs/viper/index.html' }
|
||
]
|
||
},
|
||
{
|
||
name: '🏹 遠隔物理DPS(レンジ)',
|
||
links: [
|
||
{ text: '吟遊詩人', path: 'jobs/bard/index.html' },
|
||
{ text: '機工士', path: 'jobs/machinist/index.html' },
|
||
{ text: '踊り子', path: 'jobs/dancer/index.html' }
|
||
]
|
||
},
|
||
{
|
||
name: '🔮 遠隔魔法DPS(キャスター)',
|
||
links: [
|
||
{ text: '黒魔道士', path: 'jobs/blackmage/index.html' },
|
||
{ text: '召喚士', path: 'jobs/summoner/index.html' },
|
||
{ text: '赤魔道士', path: 'jobs/redmage/index.html' },
|
||
{ text: 'ピクトマンサー', path: 'jobs/pictomancer/index.html' },
|
||
{ text: '巴術士(クラス)', path: 'jobs/arcanist/index.html' }
|
||
]
|
||
}
|
||
]
|
||
|
||
},
|
||
|
||
{
|
||
|
||
type: 'links',
|
||
|
||
title: '🏡 ハウジング・生活・金策',
|
||
|
||
links: [
|
||
|
||
{ text: 'ハウジング総合・土地購入抽選', path: 'housing/index.html' },
|
||
|
||
{ text: '内装・浮かせ技・レイアウト', path: 'housing/interior_layout.html' },
|
||
|
||
{ text: '潜水艦・ボイジャー金策', path: 'housing/submarine_airship.html' },
|
||
|
||
{ text: 'リテイナー&マーケット金策', path: 'retainer/index.html' },
|
||
|
||
{ text: 'ミラプリ&2箇所染色ガイド', path: 'glamour/index.html' },
|
||
|
||
{ text: 'ゴールドソーサー&MGP稼ぎ', path: 'gold_saucer/index.html' }
|
||
|
||
]
|
||
|
||
},
|
||
|
||
{
|
||
|
||
type: 'links',
|
||
|
||
title: '⭐ 装備・IL・育成',
|
||
|
||
links: [
|
||
|
||
{ text: 'フリトラ最強装備ガイド', path: 'equipment/freetrial_gear_guide.html' }
|
||
|
||
]
|
||
|
||
},
|
||
|
||
{
|
||
|
||
type: 'links',
|
||
|
||
title: '🐎 マウント完全攻略',
|
||
|
||
links: [
|
||
|
||
{ text: 'マウント総合トップ・全一覧', path: 'mounts/index.html' },
|
||
|
||
{ text: 'ストーリー・クエスト入手', path: 'mounts/quest_story.html' },
|
||
|
||
{ text: '友好部族(蛮族)マウント', path: 'mounts/tribal_quests.html' },
|
||
|
||
{ text: '極蛮神・連動マウント', path: 'mounts/extreme_trials.html' },
|
||
|
||
{ text: '高難易度レイド・零式', path: 'mounts/raids_savage.html' },
|
||
|
||
{ text: 'ゴールドソーサー(MGP)', path: 'mounts/gold_saucer.html' },
|
||
|
||
{ text: 'DD・特殊探索・VD', path: 'mounts/deep_dungeon_field.html' },
|
||
|
||
{ text: 'アチーブメント・PvP', path: 'mounts/achievements_pvp.html' },
|
||
|
||
{ text: '生活系・復興・無人島', path: 'mounts/life_island_hunt.html' },
|
||
|
||
{ text: 'オンラインストア・絶版', path: 'mounts/store_events.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: '⚔️ PvP完全攻略',
|
||
|
||
links: [
|
||
|
||
{ text: 'PvP総合・クリコン&FL立ち回り', path: 'pvp/index.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/js/ 直下のスクリプトがルート直下から読み込まれた場合
|
||
|
||
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('/mounts/') ||
|
||
|
||
pathname.includes('/equipment/') ||
|
||
|
||
pathname.includes('/housing/') ||
|
||
|
||
pathname.includes('/battle_contents/') ||
|
||
|
||
pathname.includes('/glamour/') ||
|
||
|
||
pathname.includes('/retainer/') ||
|
||
|
||
pathname.includes('/gold_saucer/') ||
|
||
|
||
pathname.includes('/pvp/') ||
|
||
|
||
pathname.includes('/deep_dungeon/') ||
|
||
|
||
pathname.includes('/dungeons/') ||
|
||
|
||
pathname.includes('/trials/') ||
|
||
|
||
pathname.includes('/raids/') ||
|
||
|
||
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 = `
|
||
|
||
<button type="button" class="wiki-drawer-toggle" id="wiki-drawer-toggle" aria-controls="wiki-sidebar" aria-expanded="false" aria-label="サイドメニューを開く">
|
||
|
||
<span aria-hidden="true">☰</span><span>メニュー</span>
|
||
|
||
</button>
|
||
|
||
<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 setupMobileDrawer() {
|
||
|
||
const sidebar = document.getElementById('wiki-sidebar');
|
||
|
||
const toggle = document.getElementById('wiki-drawer-toggle');
|
||
|
||
if (!sidebar || !toggle) return;
|
||
|
||
// 背景オーバーレイを生成
|
||
let overlay = document.querySelector('.wiki-drawer-overlay');
|
||
|
||
if (!overlay) {
|
||
|
||
overlay = document.createElement('div');
|
||
|
||
overlay.className = 'wiki-drawer-overlay';
|
||
|
||
overlay.setAttribute('aria-hidden', 'true');
|
||
|
||
document.body.appendChild(overlay);
|
||
|
||
}
|
||
|
||
const openDrawer = function () {
|
||
|
||
sidebar.classList.add('is-open');
|
||
|
||
overlay.classList.add('is-open');
|
||
|
||
toggle.setAttribute('aria-expanded', 'true');
|
||
|
||
toggle.setAttribute('aria-label', 'サイドメニューを閉じる');
|
||
|
||
};
|
||
|
||
const closeDrawer = function () {
|
||
|
||
sidebar.classList.remove('is-open');
|
||
|
||
overlay.classList.remove('is-open');
|
||
|
||
toggle.setAttribute('aria-expanded', 'false');
|
||
|
||
toggle.setAttribute('aria-label', 'サイドメニューを開く');
|
||
|
||
};
|
||
|
||
toggle.addEventListener('click', function () {
|
||
|
||
if (sidebar.classList.contains('is-open')) { closeDrawer(); }
|
||
|
||
else { openDrawer(); }
|
||
|
||
});
|
||
|
||
overlay.addEventListener('click', closeDrawer);
|
||
|
||
// Esc キーで閉じる
|
||
document.addEventListener('keydown', function (e) {
|
||
|
||
if (e.key === 'Escape' && sidebar.classList.contains('is-open')) { closeDrawer(); }
|
||
|
||
});
|
||
|
||
// ドロワー内リンク遷移時は閉じる
|
||
sidebar.addEventListener('click', function (e) {
|
||
|
||
if (e.target.closest('a')) { closeDrawer(); }
|
||
|
||
});
|
||
|
||
// PC 幅に戻したらドロワー状態を解除(CSS 側は 860px 以下でのみ有効)
|
||
window.addEventListener('resize', function () {
|
||
|
||
if (window.innerWidth > 860) { closeDrawer(); }
|
||
|
||
});
|
||
|
||
}
|
||
|
||
// グローバルナビレンダリング
|
||
|
||
function renderGlobalNav(rootPrefix) {
|
||
|
||
const nav = document.getElementById('wiki-global-nav');
|
||
|
||
if (!nav) return;
|
||
|
||
const items = WIKI_NAV_CONFIG.globalNav.map(item => {
|
||
|
||
const active = isCurrentPage(item.path) ? ' class="active"' : '';
|
||
|
||
return `<li><a href="${rootPrefix}${item.path}"${active}>${item.title}</a></li>`;
|
||
|
||
}).join('');
|
||
|
||
nav.innerHTML = `<ul class="wiki-nav-list">${items}</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">
|
||
|
||
<form onsubmit="doSearch(event)" class="sidebar-search-box">
|
||
|
||
<input type="text" id="sidebarSearchInput" class="sidebar-search-input" placeholder="キーワード検索...">
|
||
|
||
<button type="submit" id="sidebarSearchBtn" class="sidebar-search-btn">検索</button>
|
||
|
||
</form>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
`;
|
||
|
||
} else if (section.type === 'links') {
|
||
|
||
const linksHtml = section.links.map(l => {
|
||
|
||
const active = isCurrentPage(l.path) ? ' class="active"' : '';
|
||
|
||
return `<li><a href="${rootPrefix}${l.path}"${active}>${l.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(g => {
|
||
|
||
const groupLinks = g.links.map(l => {
|
||
|
||
const active = isCurrentPage(l.path) ? ' class="active"' : '';
|
||
|
||
return `<li><a href="${rootPrefix}${l.path}"${active}>${l.text}</a></li>`;
|
||
|
||
}).join('');
|
||
|
||
groupsHtml += `
|
||
|
||
<p style="font-size: 11px; font-weight: bold; color: var(--wiki-text-muted); margin: 6px 0 2px;">${g.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 copyToClipboard(button, targetId) {
|
||
|
||
const target = document.getElementById(targetId);
|
||
|
||
if (!target) return;
|
||
|
||
const text = target.innerText;
|
||
|
||
navigator.clipboard.writeText(text).then(() => {
|
||
|
||
const originalText = button.innerText;
|
||
|
||
button.innerText = 'コピー完了!';
|
||
|
||
button.classList.add('copied');
|
||
|
||
setTimeout(() => {
|
||
|
||
button.innerText = originalText;
|
||
|
||
button.classList.remove('copied');
|
||
|
||
}, 2000);
|
||
|
||
}).catch(err => {
|
||
|
||
console.error('コピー失敗:', err);
|
||
|
||
});
|
||
|
||
}
|
||
|
||
// サイト内検索実行
|
||
|
||
function doSearch(event) {
|
||
|
||
if (event) event.preventDefault();
|
||
|
||
const input = document.getElementById('sidebarSearchInput');
|
||
|
||
const q = input ? input.value.trim() : '';
|
||
|
||
if (q) {
|
||
|
||
const root = getWikiRootPrefix();
|
||
|
||
window.location.href = `${root}index.html?q=${encodeURIComponent(q)}`;
|
||
|
||
}
|
||
|
||
}
|
||
|
||
// 初期化実行
|
||
|
||
document.addEventListener('DOMContentLoaded', () => {
|
||
|
||
const root = getWikiRootPrefix();
|
||
|
||
// 共通パーツ(ヘッダー・グローバルナビ・サイドバー・フッター)を JS で一元生成
|
||
// iframe を使わないため、コンテンツの回り込みは CSS Grid 構造で原理的に発生しない
|
||
renderHeader(root);
|
||
|
||
renderGlobalNav(root);
|
||
|
||
renderSidebar(root);
|
||
|
||
renderFooter();
|
||
|
||
// モバイル用ドロワー(ハンバーガーメニュー)
|
||
setupMobileDrawer();
|
||
|
||
// ロール別アコーディオン:同時に1つだけ開く
|
||
document.querySelectorAll('[data-accordion="single"]').forEach(function (box) {
|
||
box.querySelectorAll('details').forEach(function (d) {
|
||
d.addEventListener('toggle', function () {
|
||
if (!d.open) return;
|
||
box.querySelectorAll('details').forEach(function (o) {
|
||
if (o !== d) o.open = false;
|
||
});
|
||
});
|
||
});
|
||
});
|
||
|
||
});
|