日本神社的命名密碼:揭秘日本神社的命名藝術






日本神社深度探索指南





<div class="container mx-auto p-4 md:p-8 max-w-5xl">

    <header class="text-center mb-8">
        <h1 class="text-3xl md:text-4xl font-bold text-[#A0522D] mb-2"><span class="ez-toc-section" id="%e6%97%a5%e6%9c%ac%e7%a5%9e%e7%a4%be%e7%9a%84%e5%91%bd%e5%90%8d%e5%af%86%e7%a2%bc%ef%bc%9a%e4%b8%80%e9%8d%b5%e8%a7%a3%e9%8e%96%e7%a5%9e%e8%81%96%e4%b9%8b%e5%9c%b0%e7%9a%84%e5%a5%a7%e7%a7%98%ef%bc%81"></span>日本神社的命名密碼:一鍵解鎖神聖之地的奧秘!<span class="ez-toc-section-end"></span></h1><div id="ez-toc-container" class="ez-toc-v2_0_82_2 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction">

內容目錄

        <p class="text-lg text-gray-600">從「神宮」到「大社」,每個名字都藏著一段故事,快來跟我一起探索吧!</p>
    </header>

    <main>
        <!-- 按社格等級 - Original Intro -->
        <div class="p-6 bg-white/50 rounded-xl shadow-inner mb-8 border border-gray-200">
            <h2 class="text-2xl font-bold text-center mb-4 text-[#775A4A]"><span class="ez-toc-section" id="%e6%8f%ad%e7%a7%98%e7%a4%be%e6%a0%bc%e7%ad%89%e7%b4%9a%ef%bc%9a%e5%90%8d%e5%ad%97%e8%a3%a1%e7%9a%84%e5%9c%b0%e4%bd%8d%e6%8e%92%e5%ba%8f"></span>揭秘社格等級:名字裡的地位排序<span class="ez-toc-section-end"></span></h2>
            <p class="text-center text-gray-600 mb-6">你曾好奇為什麼有些神社叫「神宮」,有些卻是「大社」嗎?其實,神社的後綴名稱就像是它們的「身份證」,透露著歷史地位、規模大小,甚至與日本皇室的關係!點擊下方的卡片,深入了解每個稱號的獨特意義。別忘了看看下面的圖表,它會讓你一眼看懂這些稱號之間,那微妙又有趣的地位層級關係喔!</p>
            <div class="chart-container mb-8">
                <canvas id="rankChart"></canvas>
            </div>
        </div>
        <div id="rank-cards" class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-12">
        </div>

        <!-- 按供奉神祇 - Original Intro -->
        <div class="p-6 bg-white/50 rounded-xl shadow-inner mb-8 border border-gray-200">
            <h2 class="text-2xl font-bold text-center mb-4 text-[#775A4A]"><span class="ez-toc-section" id="%e7%a5%9e%e7%a5%87%e4%bf%a1%e4%bb%b0%ef%bc%9a%e5%90%8d%e5%ad%97%e8%83%8c%e5%be%8c%e7%9a%84%e7%a5%9e%e6%98%8e%e6%95%85%e4%ba%8b"></span>神祇信仰:名字背後的神明故事<span class="ez-toc-section-end"></span></h2>
            <p class="text-center text-gray-600">除了社格等級,許多神社的名稱更是直接與其供奉的神祇息息相關!從掌管豐收的稻荷神,到守護學業的天神,每一位神明都有著獨特的故事與庇佑。這些以神祇命名的神社遍布日本,各自承載著不同的文化標誌和人們的祈願。一起來看看這些名字背後,是哪位神明在默默守護著吧!</p>
        </div>
        <div id="deity-cards" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-12">
        </div>

        <!-- 日本神社文化 - Consolidated Content -->
        <div id="culture-sections-container">
            <!-- Culture sections will be dynamically loaded here -->
        </div>
    </main>

    <footer class="text-center mt-12 text-gray-500 text-sm">
        資訊來源於部落格文章,由互動式應用程式呈現。
    </footer>
</div>

<script>
    const shrineData = {
        rank: [
            {
                title: "神宮 (Jingū)",
                icon: "👑",
                subtitle: "與皇室的深刻連結",
                description: "此稱謂專用於供奉天皇、皇室祖神或與皇室歷史密切相關的神社。它們在所有神社中地位最為崇高。",
                example: "著名例子:伊勢神宮 (Ise Jingū),日本神道信仰的中心。",
                rankValue: 100
            },
            {
                title: "宮 (Gū/Miya)",
                icon: "🏛️",
                subtitle: "供奉重要神祇或皇族",
                description: "表示供奉皇室成員或歷史上極其重要的神祇。地位尊貴,僅次於「神宮」。",
                example: "著名例子:八幡宮 (Hachimangū)、天滿宮 (Tenmangū)。",
                rankValue: 85
            },
            {
                title: "大社 (Taisha)",
                icon: "웅",
                subtitle: "規模與地位的象徵",
                description: "意為「大社」,通常指在過去的社格制度中層級較高、規模宏大且歷史悠久的神社,常作為地區信仰中心。",
                example: "著名例子:出雲大社 (Izumo Taisha)。",
                rankValue: 70
            },
            {
                title: "神社 (Jinja)",
                icon: "⛩️",
                subtitle: "最泛用的神聖之地",
                description: "最普遍的神社名稱後綴,意為「神祇所在的社」。它是一個廣泛的稱謂,可用於各種規模和類型的神社。",
                example: "日本絕大多數神社都使用此後綴。",
                rankValue: 50
            },
            {
                title: "社 (Sha/Ja)",
                icon: "📜",
                subtitle: "分社或小型神社",
                description: "作為後綴時,通常表示規模較小的神社,或者是由其他大型神社分靈而來的「分社」。",
                example: "著名例子:神明社 (Shinmei-sha)。",
                rankValue: 30
            },
            {
                title: "杜 (Mori)",
                icon: "🌳",
                subtitle: "與自然的古老連結",
                description: "字面意思是「樹林」。在古代,神明常降臨於聖樹或森林,因此該詞強調了神社與自然的原始連結。",
                example: "一些古老的神社使用此名稱。",
                rankValue: 20
            }
        ],
        deity: [
            {
                title: "稻荷 (Inari)",
                icon: "🦊",
                subtitle: "豐收與商業之神",
                description: "供奉稻荷神的神社,他是掌管農業豐收和商業繁榮的神祇。其最顯著的標誌是狐狸石像,被視為神使。",
                example: "總本社:伏見稻荷大社 (Fushimi Inari Taisha)。"
            },
            {
                title: "天神 (Tenjin)",
                icon: "🎓",
                subtitle: "學問與智慧之神",
                description: "供奉平安時代的學者菅原道真,被尊為學問之神。在考試季節,無數學生會前來祈求學業順利。",
                example: "總本社:太宰府天滿宮 (Dazaifu Tenmangū)。"
            },
            {
                title: "淺間 (Sengen)",
                icon: "🗻",
                subtitle: "富士山之守護神",
                description: "供奉富士山的神祇——木花開耶姬。這類神社大多分佈在富士山周邊地區,是山岳信仰的代表。",
                example: "總本社:富士山本宮淺間大社。"
            }
        ],
        culture_sections: [
            {
                id: "culture-intro",
                type: "intro",
                title: "深入體驗:日本神社文化面面觀",
                description: "神社不僅是神聖的場所,更是日本文化與日常生活中不可或缺的一部分。走進神社,你會發現一系列獨特的禮儀和習俗,它們共同構成了豐富的神社文化體驗。從入門的鳥居到祈願的繪馬,每一個環節都充滿了故事和意義。本指南將從神社的起源與意義、主要建築構造、典型建築風格、參拜禮儀,以及年度祭典活動、社格體系與神祇詳解等面向介紹。準備好跟我一起,沉浸在這份獨特的文化魅力中了嗎?"
            },
            {
                id: "culture-origin",
                type: "text",
                title: "一、神社的起源與意義",
                description: "神社(日語:神社, jinja)為供奉日本神道(Shinto)之“神”(kami)的場域,是神道信仰中「神靈居所」的具象化。神道崇尚萬物有靈,認為山川、樹木、岩石乃至先祖皆可成為神的化身,每座神社通常奉祀特定的地域神、自然神或祖靈,以祈求平安、豐饒與庇佑。"
            },
            {
                id: "architecture-structure",
                type: "cards",
                title: "二、神社的主要建築構造",
                description: "神社並非單一建築,而是由多重設施組成的「境內」。各構造功能分明,常見要素如下:",
                cards: [
                    { title: "鳥居 (Torii)", icon: "⛩️", subtitle: "神聖界限", description: "標誌神聖界限,劃分俗世與神域的入口。", example: "進入鳥居前應先鞠躬。" },
                    { title: "參道 (Sandō)", icon: "🚶", subtitle: "引導神靈之路", description: "通往本殿的參拜道路,兩側留白以示引導神靈往來之道。", example: "勿走中線,神道尊神行走中心路徑。" },
                    { title: "手水舍 (Temizuya)", icon: "💧", subtitle: "身心潔淨", description: "供信眾淨手漱口的水池,象徵心身潔淨後再進入神域。", example: "參拜前淨化身心的儀式。" },
                    { title: "拝殿 (Haiden)", icon: "🙏", subtitle: "參拜獻供場所", description: "信眾參拜、獻供與祝詞儀式之場所。", example: "在此進行二拜二拍手一拜禮。" },
                    { title: "本殿 (Honden)", icon: "🔒", subtitle: "神體寄宿處", description: "神體(shintai)寄宿之處,非一般信眾開放,僅供神職與儀式使用。", example: "神社最神聖的核心建築。" },
                    { title: "社務所 (Shamusho)", icon: "📝", subtitle: "行政與事務", description: "管理、頒發御守、御朱印等事務的辦公室。", example: "購買御守或蓋御朱印的地方。" }
                ]
            },
            {
                id: "architecture-style",
                type: "cards",
                title: "三、典型建築風格",
                description: "神社建築融合了原始祭祀形式與佛教、中國建築影響,形成多種風格:",
                cards: [
                    { title: "神明造 (Shinmei-zukuri)", icon: "🌲", subtitle: "簡潔原木", description: "以簡潔原木為主,無檐曲,屋頂有貫木(katsuogi)與千木(chigi)裝飾。", example: "代表伊勢神宮本殿風格。" },
                    { title: "大社造 (Taisha-zukuri)", icon: "🏛️", subtitle: "屋高柱直", description: "屋高柱直,外觀如古代倉庫。", example: "典型代表為出雲大社。" },
                    { title: "樸實風格", icon: "🏡", subtitle: "簡易木石", description: "小型路邊祠(hokora)多為簡易木構或石造,保留原始祭壇風貌。", example: "常見於鄉間小路邊。" }
                ]
            },
            {
                id: "worship-etiquette",
                type: "cards",
                title: "四、參拜禮儀流程",
                description: "遵循正確禮儀,可穩妥表達敬意並獲得心靈滿足:",
                cards: [
                    { title: "鳥居前鞠躬", icon: "🙇", subtitle: "入門敬意", description: "到達鳥居前,向神明鞠躬以示敬意,進入後勿走中線(神道尊神行走中心路徑)。", example: "這是進入神域的第一步。" },
                    { title: "手水淨身", icon: "💦", subtitle: "淨化身心", description: "取瓢以右手汲水,先洗左手,再洗右手,接少量水漱口,最後洗淨瓢柄。", example: "參拜前必須完成的潔淨儀式。" },
                    { title: "賽錢、參拜", icon: "💰", subtitle: "獻供與祈願", description: "於拝殿前投幣(通常五円、十円吉利),兩次深鞠躬、兩次拍手、再一次深鞠躬,默念願望或感謝。", example: "「二拜二拍手一拜」是基本禮儀。" },
                    { title: "離境禮", icon: "👋", subtitle: "表達謝意", description: "離開時再次面對鳥居鞠躬,表達謝意。", example: "完整的參拜體驗,從頭到尾都充滿敬意。" }
                ]
            },
            {
                id: "annual-events",
                type: "cards",
                title: "五、年度祭典與活動",
                description: "神社祭典(matsuri)融合在地信仰與季節變化,常見活動包括:",
                cards: [
                    { title: "新年參拜 (Hatsumōde)", icon: "�", subtitle: "新年祈福", description: "元旦至三日間大量參拜,祈福新年平安。", example: "日本人過年最重要的活動之一。" },
                    { title: "節分祭 (Setsubun)", icon: "👹", subtitle: "撒豆驅邪", description: "立春前後撒豆驅邪,祈求家宅平安。", example: "與家人一起撒豆喊「鬼在外,福在內」。" },
                    { title: "七五三", icon: "👧👦", subtitle: "兒童成長祈願", description: "11月15日為七歲、五歲、三歲兒童參拜,以祈願健康成長。", example: "穿著和服的孩子們在神社裡格外可愛。" },
                    { title: "地方例祭", icon: "🏮", subtitle: "社區凝聚力", description: "各神社年度例行御神輿巡遊,展現古老信仰與社區凝聚力。", example: "體驗日本傳統節慶氛圍的最佳機會。" }
                ]
            },
            {
                id: "ranking-overview",
                type: "ranking-overview",
                title: "六、社格體系概述:神社的歷史分級",
                description: "日本神社自明治維新後曾依「近代社格制度」分為「官社」(官幣社)與「諸社」兩大類,各再分若干等級。各等級神社多奉祀不同階層與屬性的神祇,其地位與祭祀資源配給息息相關。近代社格制度(Kindai Shakaku Seido)始於1871年,由太政官公布,1946年撤廢。主要分:",
                sections: [
                    {
                        category: "官社(Kan-sha)",
                        icon: "✨",
                        items: [
                            {
                                title: "官幣社(Kanpei-sha,奉幣官社)",
                                sub_items: [
                                    { name: "官幣大社(Kanpei-taisha)", level: "1級", count: "67座" },
                                    { name: "官幣中社(Kanpei-chūsha)", level: "2級", count: "23座" },
                                    { name: "官幣小社(Kanpei-shōsha)", level: "3級", count: "5座" },
                                    { name: "別格官幣社(Bekkaku Kanpei-sha)", level: "不列級", count: "" }
                                ]
                            },
                            {
                                title: "國幣社(Kokuhei-sha,供幣國社)",
                                sub_items: [
                                    { name: "國幣大社(Kokuhei-taisha)", level: "1級", count: "6座" },
                                    { name: "國幣中社(Kokuhei-chūsha)", level: "2級", count: "47座" },
                                    { name: "國幣小社(Kokuhei-shōsha)", level: "3級", count: "50座" }
                                ]
                            }
                        ]
                    },
                    {
                        category: "諸社(Shosha,又稱民社)",
                        icon: "🔗",
                        items: [
                            { name: "府縣社(Metropolitan & Prefectural Shrines)" },
                            { name: "郷社(District Shrines)" },
                            { name: "村社(Village Shrines)" },
                            { name: "無格社(Ungraded Shrines)" }
                        ]
                    }
                ],
                note: "小知識:伊勢神宮(Ise Jingū)地位超然,不列入上述任何分級,是日本神社的最高殿堂喔!"
            },
            {
                id: "rank-deity-examples",
                type: "rank-deity-examples",
                title: "七、社格與神祇關係:實例解析",
                description: "不同社格的神社,通常供奉著不同階層與屬性的神祇。這份表格將帶你一窺社格與其主要供奉神祇之間的奧秘,看看那些你可能聽過的神社,都屬於哪個等級,又供奉著哪位神明呢?",
                examples: [
                    { rank: "官幣大社", shrine: "伊勢神宮(Ise Jingū)", deity: "天照大神(Amaterasu-ōmikami)", explanation: "最高神社,不列入分級" },
                    { rank: "官幣大社", shrine: "賀茂別雷神社(Kamigamo)", deity: "賀茂別雷神(Kamo-wake-ikazuchi)", explanation: "京都「上七社」之一" },
                    { rank: "官幣中社", shrine: "北野天滿宮(Kitano Tenmangū)", deity: "菅原道真(Sugawara no Michizane)", explanation: "學問之神,文化名所" },
                    { rank: "官幣中社", shrine: "靖國神社(Yasukuni Jinja)", deity: "英靈(War Dead Spirits)", explanation: "別格官幣社,戰歿者祭祀中心" },
                    { rank: "官幣小社", shrine: "生駒大社(Ikoma Jinja)", deity: "伊邪那岐命(Izanagi)", explanation: "地方守護" },
                    { rank: "國幣大社", shrine: "出雲大社(Izumo Taisha)", deity: "大國主命(Ōkuninushi)", explanation: "結緣之神" },
                    { rank: "國幣大社", shrine: "厳島神社(Itsukushima)", deity: "市杵島姫命(Ichikishima-hime)", explanation: "海上交通與漁業守護" },
                    { rank: "國幣中社", shrine: "諏訪大社(Suwa Taisha)", deity: "建御名方神(Takeminakata)", explanation: "武勇與豐穣之神" },
                    { rank: "國幣中社", shrine: "鹿島神宮(Kashima Jingū)", deity: "武甕槌神(Takemikazuchi)", explanation: "軍事與護國象徵" },
                    { rank: "國幣小社", shrine: "鹿嶋神社(Kashima)", deity: "武甕槌神(Takemikazuchi)", explanation: "地方護國" },
                    { rank: "府縣社", shrine: "明治神宮(Meiji Jingū)", deity: "明治天皇、昭憲皇太后", explanation: "現代建立,皇室祭祀" },
                    { rank: "郷社", shrine: "八坂神社(Yasaka Jinja)", deity: "素戔嗚尊(Susanoo)", explanation: "祇園信仰,保疫解厄" },
                    { rank: "村社", shrine: "各地小村社", deity: "多為當地氏神(Ujigami)", explanation: "祈求所在村落平安與豐饒" },
                    { rank: "無格社", shrine: "祠(Hokora)", deity: "各地小神(Local Kami)", explanation: "非正式小型祭祀空間" }
                ]
            },
            {
                id: "ranking-meaning",
                type: "points",
                title: "八、祭祀與社格意義:為何要分級?",
                description: "", // No main description, points will explain
                points: [
                    "社格高的神社能獲得國家資源的優先支持,因此祭典規模通常更宏大、儀式也更為隆重。",
                    "供奉的神祇多為「皇室神祇」(官幣社)或「國家守護神」(國幣社),這象徵著國家、皇室與地方政權之間的緊密聯繫。",
                    "而「諸社」則更集中於民間氏族所崇敬的「氏神」與自然神,它們承載著地方社區的凝聚力,是當地居民信仰的中心。"
                ]
            },
            {
                id: "deity-overview",
                type: "deity-overview",
                title: "九、日本神社供奉神祇總覽",
                description: "日本神道之神(kami)數量繁多,常見依神格、職能與地域,可分為以下三大類。下表僅列出各類中最具代表性、且在全國各地神社中經常被奉祀的主要神明,供參考。",
                categories: [
                    {
                        name: "天照大御神・天神系",
                        icon: "🌞",
                        deities: [
                            { name: "Amaterasu (天照大神)", function: "太陽與皇室祖神,伊勢神宮主祭神" },
                            { name: "Tsukuyomi (月讀命)", function: "月亮之神" },
                            { name: "Susanoo (須佐之男命)", function: "海神、風暴與武勇" },
                            { name: "Ōkuninushi (大國主命)", function: "國土開拓與縁結之神" },
                            { name: "Toyouke (豐受大御神)", function: "丰饒與農耕供給" }
                        ]
                    },
                    {
                        name: "農業與豐收系",
                        icon: "🌾",
                        deities: [
                            { name: "Inari (稻荷神)", function: "穀物豐收、商業繁榮與家庭守護" },
                            { name: "Ukanomitama (宇迦之御魂神)", function: "穀物與五穀之神" },
                            { name: "Kuanōkami (田心姫命)", function: "稻作守護" }
                        ]
                    },
                    {
                        name: "學問與文化系",
                        icon: "🎓",
                        deities: [
                            { name: "Tenjin (天神/菅原道真)", function: "學問與書寫之神" },
                            { name: "Benzaiten (弁才天)", function: "音樂、文藝與智慧" }
                        ]
                    },
                    {
                        name: "豐饒與商業系",
                        icon: "💰",
                        deities: [
                            { name: "Ebisu (恵比寿)", function: "漁業、商業與大漁幸運" }
                        ]
                    },
                    {
                        name: "武神與守護系",
                        icon: "⚔️",
                        deities: [
                            { name: "Hachiman (八幡神)", function: "武運長久與國家守護" },
                            { name: "Takemikazuchi (建御雷神)", function: "武勇與鎮護" },
                            { name: "Kotoshironushi (事代主命)", function: "漁業與商業" }
                        ]
                    },
                    {
                        name: "地方氏神與自然神",
                        icon: "⛰️",
                        deities: [
                            { name: "Ōyamatsumi (大山祇神)", function: "山岳與林木" },
                            { name: "Sarutahiko (猿田毘古神)", function: "道路與交通守護" },
                            { name: "Kuebiko (久延毘古神)", function: "農事與智慧老翁" }
                        ]
                    },
                    {
                        name: "創造與始源神",
                        icon: "👨‍👩‍👧‍👦",
                        deities: [
                            { name: "Izanagi (伊邪那岐命)", function: "創造與生命之父" },
                            { name: "Izanami (伊邪那美命)", function: "創造與生命之母" }
                        ]
                    }
                ],
                note: "本表僅摘錄約十五位最廣為信仰之神明。日本神道神祇數萬,且因地域、神社社格或氏族習俗不同,各有獨特本地神(氏神)。若需查閱完整列表,可參考「List of Shinto deities」維基頁面。"
            }
        ]
    };

    document.addEventListener('DOMContentLoaded', () => {
        const rankCardsContainer = document.getElementById('rank-cards');
        const deityCardsContainer = document.getElementById('deity-cards');
        const cultureSectionsContainer = document.getElementById('culture-sections-container');

        const createCard = (item) => {
            return `
                <div class="content-card rounded-lg p-6 shadow-lg border border-gray-200/50">
                    <div class="flex items-center mb-3">
                        <span class="text-3xl mr-4">${item.icon || ''}</span>
                        <div>
                            <h3 class="text-xl font-bold text-[#A0522D]">${item.title}</h3>
                            <p class="text-sm font-medium text-gray-500">${item.subtitle || ''}</p>
                        </div>
                    </div>
                    <p class="text-gray-700 mb-3">${item.description || ''}</p>
                    <p class="text-sm text-gray-600 italic bg-gray-100 p-2 rounded-md">${item.example || ''}</p>
                </div>
            `;
        };

        const createRankingOverviewSectionHtml = (data) => {
            let html = `
                <div class="p-6 bg-white/50 rounded-xl shadow-inner mb-8 border border-gray-200">
                    <h2 class="text-2xl font-bold text-center mb-4 text-[#775A4A]"><span class="ez-toc-section" id="datatitle"></span>${data.title}<span class="ez-toc-section-end"></span></h2>
                    <p class="text-gray-700 bg-white/50 p-4 rounded-lg shadow-sm border border-gray-200 mb-4">${data.description}</p>
                    <div class="space-y-4">
            `;
            data.sections.forEach(section => {
                html += `
                    <div class="bg-white/50 p-4 rounded-lg shadow-sm border border-gray-200">
                        <h4 class="text-lg font-semibold text-[#775A4A] flex items-center mb-3">
                            ${section.icon ? `<span class="text-2xl mr-2">${section.icon}</span>` : ''}
                            ${section.category}
                        </h4>
                `;
                section.items.forEach(item => {
                    html += `<div class="ml-4 mb-2">`;
                    if (item.title) {
                        html += `<h5 class="font-medium text-gray-800">${item.title}</h5>`;
                    } else {
                        html += `<h5 class="font-medium text-gray-800">${item.name}</h5>`;
                    }
                    if (item.sub_items) {
                        html += `<ul class="list-disc list-inside ml-4 text-gray-700">`;
                        item.sub_items.forEach(subItem => {
                            html += `<li>${subItem.name} (${subItem.level}${subItem.count ? `, ${subItem.count}` : ''})</li>`;
                        });
                        html += `</ul>`;
                    }
                    html += `</div>`;
                });
                html += `</div>`;
            });
            html += `
                    </div>
                    <p class="text-sm text-gray-600 italic mt-4">${data.note}</p>
                </div>
            `;
            return html;
        };

        const createRankDeityExamplesHtml = (data) => {
            let html = `
                <div class="p-6 bg-white/50 rounded-xl shadow-inner mb-8 border border-gray-200">
                    <h2 class="text-2xl font-bold text-center mb-4 text-[#775A4A]"><span class="ez-toc-section" id="datatitle-2"></span>${data.title}<span class="ez-toc-section-end"></span></h2>
                    <p class="text-gray-700 bg-white/50 p-4 rounded-lg shadow-sm border border-gray-200 mb-4">${data.description}</p>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
            `;
            data.examples.forEach(item => {
                html += `
                    <div class="content-card rounded-lg p-6 shadow-lg border border-gray-200/50">
                        <h3 class="text-xl font-bold text-[#A0522D] mb-2">${item.shrine}</h3>
                        <p class="text-gray-700 mb-1"><span class="font-semibold">社格:</span> ${item.rank}</p>
                        <p class="text-gray-700 mb-3"><span class="font-semibold">供奉神祇:</span> ${item.deity}</p>
                        <p class="text-sm text-gray-600 italic bg-gray-100 p-2 rounded-md">${item.explanation}</p>
                    </div>
                `;
            });
            html += `</div></div>`;
            return html;
        };

        const createRankingMeaningHtml = (data) => {
            let html = `
                <div class="p-6 bg-white/50 rounded-xl shadow-inner mb-8 border border-gray-200">
                    <h2 class="text-2xl font-bold text-center mb-4 text-[#775A4A]"><span class="ez-toc-section" id="datatitle-3"></span>${data.title}<span class="ez-toc-section-end"></span></h2>
                    <ul class="list-disc list-inside text-gray-700 bg-white/50 p-4 rounded-lg shadow-sm border border-gray-200 space-y-2">
            `;
            data.points.forEach(point => {
                html += `<li>${point}</li>`;
            });
            html += `</ul></div>`;
            return html;
        };

        const createDeityOverviewHtml = (data) => {
            let html = `
                <div class="p-6 bg-white/50 rounded-xl shadow-inner mb-8 border border-gray-200">
                    <h2 class="text-2xl font-bold text-center mb-4 text-[#775A4A]"><span class="ez-toc-section" id="datatitle-4"></span>${data.title}<span class="ez-toc-section-end"></span></h2>
                    <p class="text-gray-700 bg-white/50 p-4 rounded-lg shadow-sm border border-gray-200 mb-4">${data.description}</p>
                    <div class="space-y-6">
            `;
            data.categories.forEach(category => {
                html += `
                    <div class="bg-white/50 p-4 rounded-lg shadow-sm border border-gray-200">
                        <h4 class="text-lg font-semibold text-[#775A4A] flex items-center mb-3">
                            ${category.icon ? `<span class="text-2xl mr-2">${category.icon}</span>` : ''}
                            ${category.name}
                        </h4>
                        <ul class="list-disc list-inside ml-4 text-gray-700 space-y-1">
                `;
                category.deities.forEach(deity => {
                    html += `<li><span class="font-medium">${deity.name}:</span> ${deity.function}</li>`;
                });
                html += `</ul></div>`;
            });
            html += `
                    </div>
                    <p class="text-sm text-gray-600 italic mt-4">${data.note}</p>
                </div>
            `;
            return html;
        };


        shrineData.rank.forEach(item => {
            rankCardsContainer.innerHTML += createCard(item);
        });

        shrineData.deity.forEach(item => {
            deityCardsContainer.innerHTML += createCard(item);
        });

        // Dynamically populate culture sections
        shrineData.culture_sections.forEach(section => {
            let sectionHtml = '';
            if (section.type === 'intro') {
                sectionHtml = `
                    <div class="p-6 bg-white/50 rounded-xl shadow-inner mb-8 border border-gray-200">
                        <h2 class="text-2xl font-bold text-center mb-4 text-[#775A4A]"><span class="ez-toc-section" id="sectiontitle"></span>${section.title}<span class="ez-toc-section-end"></span></h2>
                        <p class="text-center text-gray-600">${section.description}</p>
                    </div>
                `;
            } else if (section.type === 'text') {
                sectionHtml = `
                    <div class="mb-8">
                        <h3 class="text-xl font-bold text-[#A0522D] mb-4">${section.title}</h3>
                        <p class="text-gray-700 bg-white/50 p-4 rounded-lg shadow-sm border border-gray-200">${section.description}</p>
                    </div>
                `;
            } else if (section.type === 'cards') {
                sectionHtml = `
                    <div class="mb-8">
                        <h3 class="text-xl font-bold text-[#A0522D] mb-4">${section.title}</h3>
                        ${section.description ? `<p class="text-gray-700 bg-white/50 p-4 rounded-lg shadow-sm border border-gray-200 mb-4">${section.description}</p>` : ''}
                        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                `;
                section.cards.forEach(card => {
                    sectionHtml += createCard(card);
                });
                sectionHtml += `</div></div>`;
            } else if (section.type === 'ranking-overview') {
                sectionHtml = createRankingOverviewSectionHtml(section);
            } else if (section.type === 'rank-deity-examples') {
                sectionHtml = createRankDeityExamplesHtml(section);
            } else if (section.type === 'points') {
                sectionHtml = createRankingMeaningHtml(section);
            } else if (section.type === 'deity-overview') {
                sectionHtml = createDeityOverviewHtml(section);
            }
            cultureSectionsContainer.innerHTML += sectionHtml;
        });


        const ctx = document.getElementById('rankChart').getContext('2d');
        const chartData = shrineData.rank.slice().sort((a, b) => a.rankValue - b.rankValue);

        new Chart(ctx, {
            type: 'bar',
            data: {
                labels: chartData.map(item => item.title),
                datasets: [{
                    label: '大致地位層級',
                    data: chartData.map(item => item.rankValue),
                    backgroundColor: [
                        'rgba(128, 128, 128, 0.6)',
                        'rgba(119, 90, 74, 0.6)',
                        'rgba(160, 82, 45, 0.6)',
                        'rgba(224, 192, 151, 0.6)',
                        'rgba(160, 82, 45, 0.8)',
                        'rgba(210, 105, 30, 0.8)'
                    ],
                    borderColor: [
                        'rgba(128, 128, 128, 1)',
                        'rgba(119, 90, 74, 1)',
                        'rgba(160, 82, 45, 1)',
                        'rgba(224, 192, 151, 1)',
                        'rgba(160, 82, 45, 1)',
                        'rgba(210, 105, 30, 1)'
                    ],
                    borderWidth: 1
                }]
            },
            options: {
                indexAxis: 'y',
                responsive: true,
                maintainAspectRatio: false,
                plugins: {
                    legend: {
                        display: false
                    },
                    tooltip: {
                        callbacks: {
                            label: function(context) {
                                let label = context.dataset.label || '';
                                if (label) {
                                    label += ': ';
                                }
                                let value = context.raw;
                                let status = '';
                                if (value > 90) status = '最高崇敬';
                                else if (value > 80) status = '極高地位';
                                else if (value > 60) status = '重要地位';
                                else if (value > 40) status = '普遍';
                                else if (value > 20) status = '特定類型';
                                else status = '基礎類型';
                                return `${context.label} - ${status}`;
                            }
                        }
                    }
                },
                scales: {
                    x: {
                        beginAtZero: true,
                        display: false
                    },
                    y: {
                       ticks: {
                            color: '#3C3633',
                            font: {
                                size: 14,
                                weight: 'bold'
                            }
                       }
                    }
                }
            }
        });
    });
</script>



相關閱讀


探索更多來自 大衛的觀察日記 的內容

訂閱即可透過電子郵件收到最新文章。

發表迴響