From cf44731c2d460337f1dfb9fdca461279802eccc9 Mon Sep 17 00:00:00 2001 From: uduki Date: Thu, 29 Oct 2026 11:57:49 +0900 Subject: [PATCH] =?UTF-8?q?style:=20=E3=82=B5=E3=82=A4=E3=83=89=E3=83=A1?= =?UTF-8?q?=E3=83=8B=E3=83=A5=E3=83=BC=E3=81=AE=E5=A4=A7=E6=8B=AC=E3=82=8A?= =?UTF-8?q?=E5=8C=96=E3=83=BB=E3=82=B9=E3=83=AA=E3=83=A0=E5=8C=96=EF=BC=88?= =?UTF-8?q?=E3=83=9D=E3=83=BC=E3=82=BF=E3=83=AB=E7=B5=8C=E7=94=B1=E3=81=A7?= =?UTF-8?q?=E3=81=AE=E5=80=8B=E5=88=A5=E9=81=B7=E7=A7=BB=E3=81=AB=E9=9B=86?= =?UTF-8?q?=E7=B4=84=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/js/wiki_common.js | 81 -------- common/sidebar.html | 386 ++------------------------------------- tools/clean_sidebar.py | 54 ++++++ 3 files changed, 71 insertions(+), 450 deletions(-) create mode 100644 tools/clean_sidebar.py diff --git a/common/js/wiki_common.js b/common/js/wiki_common.js index 3472bf6..f95ac84 100644 --- a/common/js/wiki_common.js +++ b/common/js/wiki_common.js @@ -92,87 +92,6 @@ const WIKI_NAV_CONFIG = { }, - { - - type: 'groups', - - title: '🏰 バトル個別攻略', - - groups: [ - - { - - name: '【ダンジョン個別攻略】', - - links: [ - - { text: 'ダンジョン総合ポータル', path: 'dungeons/index.html' }, - - { text: 'サスタシャ侵食洞 (Lv15)', path: 'dungeons/sastasha.html' }, - - { text: 'タムタラの墓所 (Lv16)', path: 'dungeons/tam_tara.html' }, - - { text: 'カッパーベル銅山 (Lv17)', path: 'dungeons/copperbell.html' }, - - { text: '記憶幻想 アレクサンドリア (Lv100)', path: 'dungeons/alexandria.html' }, - { text: 'サボテンダーバレー (Lv100)', path: 'dungeons/tender_valley.html' }, - { text: 'イフイカ・トゥム (Lv91)', path: 'dungeons/ihuykatumu.html' }, - - { text: 'ブレイフロクスの野営地 (Lv32)', path: 'dungeons/brayflox.html' }, - { text: 'カルン埋没寺院 (Lv35)', path: 'dungeons/sunken_temple.html' }, - { text: 'カッターズクライ (Lv38)', path: 'dungeons/cutter_cry.html' }, - { text: 'ストーンヴィジル (Lv41)', path: 'dungeons/stone_vigil.html' }, - { text: 'オーラムヴェイル (Lv47)', path: 'dungeons/aurum_vale.html' } - - ] - - }, - - { - - name: '【討滅戦個別攻略】', - - links: [ - - { text: '討滅戦総合ポータル', path: 'trials/index.html' }, - - { text: 'イフリート討滅戦 (Lv20)', path: 'trials/ifrit.html' }, - { text: 'タイタン討滅戦 (Lv34)', path: 'trials/titan.html' }, - { text: 'ガルーダ討滅戦 (Lv44)', path: 'trials/garuda.html' }, - { text: 'アルテマウェポン破壊作戦 (Lv50)', path: 'trials/ultima_weapon.html' }, - { text: 'ヴァリガルマンダ討滅戦 (Lv93)', path: 'trials/valigarmanda.html' }, - { text: 'ゾラージャ討滅戦 (Lv99)', path: 'trials/zorool_ja.html' }, - { text: 'エターナル・クイーン (Lv100)', path: 'trials/eternal_queen.html' } - - ] - - }, - - { - - name: '【レイド個別攻略】', - - links: [ - - { text: 'レイド総合ポータル', path: 'raids/index.html' }, - - { text: 'アルカディア LH1層 (Lv100)', path: 'raids/arcadia_lh1.html' }, - { text: 'アルカディア LH2層 (Lv100)', path: 'raids/arcadia_lh2.html' }, - { text: 'アルカディア LH3層 (Lv100)', path: 'raids/arcadia_lh3.html' }, - { text: 'アルカディア LH4層 (Lv100)', path: 'raids/arcadia_lh4.html' }, - - { text: '古代の民の迷宮 (Lv50)', path: 'raids/labyrinth_of_ancients.html' }, - { text: 'シルクスの塔 (Lv50)', path: 'raids/syrcus_tower.html' }, - { text: '闇の世界 (Lv50)', path: 'raids/world_of_darkness.html' } - - ] - - } - - ] - - }, - { type: 'links', diff --git a/common/sidebar.html b/common/sidebar.html index e849918..ecc09fc 100644 --- a/common/sidebar.html +++ b/common/sidebar.html @@ -1,498 +1,146 @@  - - - - - - - - - FF14 攻略Wiki 共通サイドメニュー - - - - - - - + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/clean_sidebar.py b/tools/clean_sidebar.py new file mode 100644 index 0000000..aea1ba2 --- /dev/null +++ b/tools/clean_sidebar.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +import os +import re + +def clean_and_save(path, content): + content = content.replace('\r\n', '\n').replace('\r', '\n') + lines = [line.rstrip() for line in content.split('\n')] + result_lines = [] + prev_empty = False + for line in lines: + if line == '': + if not prev_empty: + result_lines.append(line) + prev_empty = True + else: + result_lines.append(line) + prev_empty = False + while result_lines and result_lines[-1] == '': + result_lines.pop() + text = '\r\n'.join(result_lines) + '\r\n' + text = text.lstrip('\ufeff') + with open(path, 'wb') as f: + f.write(b'\xef\xbb\xbf' + text.encode('utf-8')) + +def clean_sidebar_js(): + path = 'common/js/wiki_common.js' + with open(path, 'rb') as f: + c = f.read().decode('utf-8', errors='ignore') + c = c.replace('\r\n', '\n') + + # バトル個別攻略のグループ全体を削除 + c = re.sub(r"\{\s*type:\s*'groups',\s*title:\s*'🏰 バトル個別攻略'.*?\n\s*\}\s*,\s*(?=\{\s*type:\s*'links',\s*title:\s*'⚔️ バトル・特殊コンテンツ')", "", c, flags=re.DOTALL) + + # バトル・特殊コンテンツにリンクを追加 + special_target = "{ text: 'ディープダンジョン完全攻略', path: 'deep_dungeon/index.html' }" + special_repl = '''{ text: 'ディープダンジョン完全攻略', path: 'deep_dungeon/index.html' }, + { text: 'PvP・クリコン&フロントライン', path: 'pvp/index.html' }, + { text: 'ゴールドソーサー総合攻略', path: 'gold_saucer/index.html' }, + { text: 'ミラプリ・2箇所染色完全攻略', path: 'glamour/index.html' }, + { text: 'リテイナー・マーケット金策', path: 'retainer/index.html' }''' + if special_target in c and 'pvp/index.html' not in c: + c = c.replace(special_target, special_repl) + + clean_and_save(path, c) + print("Cleaned common/js/wiki_common.js") + + # sidebar.html も正規化 + with open('common/sidebar.html', 'rb') as f: + sb_c = f.read().decode('utf-8', errors='ignore') + clean_and_save('common/sidebar.html', sb_c) + print("Cleaned common/sidebar.html") + +if __name__ == '__main__': + clean_sidebar_js()