PageSourceSearch

https://www.meijigakuin.ac.jp/assets/js/common.js

js meijigakuin.ac.jp collected 2026-10-01 11:33:55 UTC 38,151 bytes, 737 lines download raw bytes

1document.addEventListener('DOMContentLoaded', () => {
2    // ==========================================================================
3    // ニュース一覧ページ フィルタリング機能(公式サイト、入試、AI・データサイエンス、情報数理)
4    // ==========================================================================
5    // ニュース一覧の主要なコンテナ要素が存在する場合のみ、以下の処理を実行する
6    const newsListContainer = document.getElementById('news-list-container');
7    if (newsListContainer) {
8        const mainFilterContainer = document.getElementById('news-main-filter');
9        const subFiltersContainer = document.getElementById('news-sub-filters');
10        const yearFilterContainer = document.getElementById('news-year-filter');
11        const viewMoreButton = document.getElementById('view-more-button');
12
13        // --- 1. 事前データ解析(起動時に一度だけ実行) ---
14        const newsCards = Array.from(newsListContainer.querySelectorAll('.news-list2__card'));
15        const cardCache = newsCards.map(card => {
16            let fYear = 0;
17            const dateEl = card.querySelector('.news-list2__date');
18            if (dateEl) {
19                const parts = dateEl.textContent.trim().split('.');
20                if (parts.length === 3) {
21                    const y = parseInt(parts[0], 10);
22                    const m = parseInt(parts[1], 10);
23                    fYear = (m >= 4) ? y : y - 1;
24                }
25            }
26            return {
27                element: card,
28                mainCat: card.dataset.mainCategory,
29                year: fYear,
30                subCats: JSON.parse(card.dataset.filterCategory || '[]'),
31                targets: JSON.parse(card.dataset.filterTarget || '[]')
32            };
33        });
34
35        // --- 2. 状態管理(ハッシュを優先的に反映) ---
36        const urlParams = new URLSearchParams(window.location.search);
37        const hashParams = new URLSearchParams(window.location.hash.slice(1));
38
39        let currentMainCategory = hashParams.get('main') || urlParams.get('main') || 'all';
40        let currentSubCategory  = hashParams.get('sub')  || urlParams.get('sub')  || '00';
41        let currentTarget       = hashParams.get('target') || urlParams.get('target') || '00';
42        let currentYear         = hashParams.get('year') || urlParams.get('year') || 'all';
43        let displayedCount = 9;
44        const increment = 9;
45
46        // --- 3. フィルタ適用関数 ---
47        function applyFilters() {
48            const filteredResults = cardCache.filter(data => {
49                if (currentMainCategory !== 'all' && data.mainCat !== currentMainCategory) return false;
50                if (currentYear !== 'all') {
51                    if (currentYear === 'before-2022') {
52                        if (data.year > 2022) return false;
53                    } else if (data.year !== parseInt(currentYear, 10)) {
54                        return false;
55                    }
56                }
57                const subMatch = (currentSubCategory === '00' || data.subCats.includes(currentSubCategory));
58                const targetMatch = (currentTarget === '00' || data.targets.includes(currentTarget));
59                return subMatch && targetMatch;
60            });
61
62            newsCards.forEach(c => c.style.display = 'none');
63            filteredResults.slice(0, displayedCount).forEach(data => {
64                data.element.style.display = '';
65            });
66
67            if (viewMoreButton) {
68                viewMoreButton.style.display = filteredResults.length > displayedCount ? '' : 'none';
69            }
70            newsListContainer.classList.add('is-visible');
71        }
72
73        // --- 4. UI状態の同期 & ハッシュ更新 ---
74        function syncUIState(updateHash = false) {
75            // URLハッシュの更新(タブ切り替え時に実行)
76            if (updateHash) {
77                const newHash = `#main=${currentMainCategory}&sub=${currentSubCategory}&target=${currentTarget}&year=${currentYear}`;
78                history.replaceState(null, '', newHash); // リロードせずにURLを書き換え
79            }
80
81            if (mainFilterContainer) {
82                const active = mainFilterContainer.querySelector('.ptab__item_active');
83                if (active) active.classList.remove('ptab__item_active');
84                const target = mainFilterContainer.querySelector(`[data-main-category="${currentMainCategory}"]`);
85                if (target) target.classList.add('ptab__item_active');
86            }
87
88            if (yearFilterContainer) {
89                const active = yearFilterContainer.querySelector('.ptab__item_active');
90                if (active) active.classList.remove('ptab__item_active');
91                const target = yearFilterContainer.querySelector(`[data-year="${currentYear}"]`);
92                if (target) target.classList.add('ptab__item_active');
93            }
94
95            if (subFiltersContainer) {
96                subFiltersContainer.style.display = (currentMainCategory === 'pressrelease') ? 'none' : '';
97                Array.from(subFiltersContainer.children).forEach(child => {
98                    if (child.dataset.mainCategory) {
99                        child.style.display = (child.dataset.mainCategory === currentMainCategory) ? '' : 'none';
100                    }
101                });
102                const activeBlock = subFiltersContainer.querySelector(`[data-main-category="${currentMainCategory}"]`) || subFiltersContainer;
103                const subInput = activeBlock.querySelector(`input[name="filter-category"][value="${currentSubCategory}"]`);
104                if (subInput) subInput.checked = true;
105                const targetInput = activeBlock.querySelector(`input[name="filter-target"][value="${currentTarget}"]`);
106                if (targetInput) targetInput.checked = true;
107            }
108        }
109
110        // --- 5. イベントリスナー ---
111        if (mainFilterContainer) {
112            mainFilterContainer.addEventListener('click', (e) => {
113                const item = e.target.closest('.ptab__item');
114                if (!item) return;
115                currentMainCategory = item.dataset.mainCategory;
116                currentSubCategory = '00'; currentTarget = '00'; displayedCount = increment;
117                syncUIState(true); // ハッシュを更新
118                applyFilters();
119            });
120        }
121
122        if (subFiltersContainer) {
123            subFiltersContainer.addEventListener('change', () => {
124                const activeBlock = subFiltersContainer.querySelector(`[data-main-category="${currentMainCategory}"]`) || subFiltersContainer;
125                currentSubCategory = activeBlock.querySelector('input[name="filter-category"]:checked')?.value || '00';
126                currentTarget = activeBlock.querySelector('input[name="filter-target"]:checked')?.value || '00';
127                displayedCount = increment;
128                syncUIState(true); // ハッシュを更新
129                applyFilters();
130            });
131        }
132
133        if (yearFilterContainer) {
134            yearFilterContainer.addEventListener('click', (e) => {
135                const item = e.target.closest('.ptab__item');
136                if (!item) return;
137                currentYear = item.dataset.year; displayedCount = increment;
138                syncUIState(true); // ハッシュを更新
139                applyFilters();
140            });
141        }
142
143        if (viewMoreButton) {
144            viewMoreButton.addEventListener('click', () => {
145                displayedCount += increment;
146                applyFilters();
147            });
148        }
149
150        // ブラウザの戻る・進む(ハッシュ変更)に対応
151        window.addEventListener('hashchange', () => {
152            const h = new URLSearchParams(window.location.hash.slice(1));
153            if (h.has('main')) {
154                currentMainCategory = h.get('main');
155                currentSubCategory = h.get('sub') || '00';
156                currentTarget = h.get('target') || '00';
157                currentYear = h.get('year') || 'all';
158                syncUIState(false);
159                applyFilters();
160            }
161        });
162
163        // 起動処理
164        syncUIState(false);
165        applyFilters();
166    } else {
167        // ------------------------------------------------------------------------
168        // ニュース以外の一覧の絞り込みとMOREボタン
169        // ------------------------------------------------------------------------
170        const newsCards = document.querySelectorAll('.gradually-list__card');
171        const moreBtn = document.querySelector('.gradually-more');
172        const graduallyList = document.querySelector('.gradually-list');
173        // 初期表示件数(デフォルト:9件)
174        // data-init-numがあればその値を使用
175        const itemsToShowInitially = (graduallyList && graduallyList.dataset.initNum) ? parseInt(graduallyList.dataset.initNum, 10) : 9;
176        // console.log('itemsToShowInitially='+ itemsToShowInitially);
177
178        // ラジオボタンの存在チェック
179        const categoryRadios = document.querySelectorAll('.pradio input[name="filter-category"]');
180        const targetRadios = document.querySelectorAll('.pradio input[name="filter-target"]');
181
182        const hasCategoryFilter = categoryRadios.length > 0;
183        const hasTargetFilter = targetRadios.length > 0;
184        const hasAnyFilter = hasCategoryFilter || hasTargetFilter;
185
186        // フィルタリングによって表示されるカードのリスト
187        let currentlyVisibleCards = [];
188
189        // 絞り込みと表示制御を統合した関数
190        const applyFilterAndManageDisplay = () => {
191            // NEWラベルを適用
192            applyNewLabelsToCards(newsCards);
193
194            // 選択されているカテゴリと対象の値を取得
195            const selectedCategory = hasCategoryFilter ? document.querySelector('.pradio input[name="filter-category"]:checked').value : '00';
196            const selectedTarget = hasTargetFilter ? document.querySelector('.pradio input[name="filter-target"]:checked').value : '00';
197
198            const tempFilteredCards = [];
199
200            newsCards.forEach(card => {
201                const cardCategories = JSON.parse(card.dataset.filterCategory || '[]');
202                const cardTargets = JSON.parse(card.dataset.filterTarget || '[]');
203
204                let isCategoryMatch = false;
205                let isTargetMatch = false;
206
207                // カテゴリフィルターがある場合、その条件で判定。ない場合は常にtrue
208                if (!hasCategoryFilter || selectedCategory === '00' || cardCategories.includes(selectedCategory)) {
209                    isCategoryMatch = true;
210                }
211
212                // ターゲットフィルターがある場合、その条件で判定。ない場合は常にtrue
213                if (!hasTargetFilter || selectedTarget === '00' || cardTargets.includes(selectedTarget)) {
214                    isTargetMatch = true;
215                }
216
217                if (isCategoryMatch && isTargetMatch) {
218                    tempFilteredCards.push(card);
219                }
220            });
221
222            currentlyVisibleCards = tempFilteredCards;
223
224            // すべてのカードを一旦非表示にする
225            newsCards.forEach(card => {
226                card.style.display = 'none';
227            });
228
229            // フィルタリングされたカードの中から、初期表示件数分だけ表示する
230            currentlyVisibleCards.forEach((card, index) => {
231                if (index < itemsToShowInitially) {
232                    card.style.display = 'grid'; // CSSに合わせて適宜変更(例: 'block', 'flex'など)
233                } else {
234                    card.style.display = 'none';
235                }
236            });
237
238            // MOREボタンの表示/非表示を決定
239            if (moreBtn) {
240                if (currentlyVisibleCards.length > itemsToShowInitially) {
241                    moreBtn.style.display = ''; // 表示
242                } else {
243                    moreBtn.style.display = 'none'; // 非表示
244                }
245            }
246        };
247
248        // 絞り込み機能がある場合の処理
249        if (hasAnyFilter && newsCards.length > 0) {
250            if (hasCategoryFilter) {
251                categoryRadios.forEach(radio => {
252                    radio.addEventListener('change', applyFilterAndManageDisplay);
253                });
254            }
255            if (hasTargetFilter) {
256                targetRadios.forEach(radio => {
257                    radio.addEventListener('change', applyFilterAndManageDisplay);
258                });
259            }
260
261            // 初期表示時に絞り込みを実行
262            applyFilterAndManageDisplay();
263
264            // MOREボタンのクリックイベント (絞り込み機能がある場合)
265            if (moreBtn) {
266                moreBtn.addEventListener('click', function() {
267                    let visibleCount = 0;
268                    currentlyVisibleCards.forEach(card => {
269                        if (card.style.display !== 'none') {
270                            visibleCount++;
271                        }
272                    });
273
274                    let cardsShownByMore = 0;
275                    for (let i = visibleCount; i < currentlyVisibleCards.length && cardsShownByMore < itemsToShowInitially; i++) {
276                        currentlyVisibleCards[i].style.display = 'grid'; // CSSに合わせて適宜変更
277                        cardsShownByMore++;
278                    }
279
280                    if (visibleCount + cardsShownByMore >= currentlyVisibleCards.length) {
281                        moreBtn.style.display = 'none';
282                    }
283                });
284            }
285        }
286        // 絞り込み機能が全くない場合のMOREボタンのロジック
287        else if (newsCards.length > 0 && moreBtn) {
288            // 初期表示で itemsToShowInitially 件まで表示し、残りを非表示にする
289            newsCards.forEach((card, index) => {
290                if (index >= itemsToShowInitially) {
291                    card.style.display = 'none';
292                }
293            });
294
295            // MOREボタンの表示/非表示を決定
296            if (newsCards.length > itemsToShowInitially) {
297                moreBtn.style.display = ''; // 表示
298            } else {
299                moreBtn.style.display = 'none'; // 非表示
300            }
301
302            // MOREボタンのクリックイベント (絞り込み機能がない場合)
303            moreBtn.addEventListener('click', function() {
304                let visibleCount = 0;
305                // 現在表示されているカードの数を数える
306                newsCards.forEach(card => {
307                    if (card.style.display !== 'none') {
308                        visibleCount++;
309                    }
310                });
311
312                let cardsShownByMore = 0;
313                // 非表示になっているカードを itemsToShowInitially 件ずつ表示
314                for (let i = visibleCount; i < newsCards.length && cardsShownByMore < itemsToShowInitially; i++) {
315                    newsCards[i].style.display = 'grid'; // CSSに合わせて適宜変更
316                    cardsShownByMore++;
317                }
318
319                // すべてのカードが表示されたらMOREボタンを非表示にする
320                if (visibleCount + cardsShownByMore >= newsCards.length) {
321                    moreBtn.style.display = 'none';
322                }
323            });
324        }
325
326        // ------------------------------------------------------------------------
327        // 明学の理由(語り手から探す)
328        // #のついた<a>
328タグをクリックした時、遷移先の対応するラジオボタンをチェックする
329        // ------------------------------------------------------------------------
330        const anchorLinks = document.querySelectorAll('a[href*="#"]');
331        anchorLinks.forEach(link => {
332            link.addEventListener('click', function(event) {
333                const hash = this.hash;
334                const targetNumber = hash.substring(1);
335                const targetRadio = document.querySelector(`input[name="filter-target"][value="${targetNumber}"]`);
336                const targetRadio2 = document.querySelector(`input[name="filter-category"][value="${targetNumber}"]`);
337                if (targetRadio) {
338                    targetRadio.checked = true;
339                }
340                if (targetRadio2) {
341                    targetRadio2.checked = true;
342                }
343            });
344        });
345
346        function checkHashOnLoad() {
347            const currentHash = window.location.hash;
348            if (currentHash) {
349                const targetNumber = currentHash.substring(1);
350                const targetRadio = document.querySelector(`input[name="filter-target"][value="${targetNumber}"]`);
351                const targetRadio2 = document.querySelector(`input[name="filter-category"][value="${targetNumber}"]`);
352                if (targetRadio) {
353                    targetRadio.checked = true;
354                }
355                if (targetRadio2) {
356                    targetRadio2.checked = true;
357                }
358            }
359        }
360
361        // ロード時にハッシュをチェック+絞り込み発火
362        checkHashOnLoad();
363        applyFilterAndManageDisplay();
364    }
365
366    // ------------------------------------------------------------------------
367    // 明学の理由 詳細ページ
368    // .editor内のh2で目次の自動生成(#anchor-00)
369    // ------------------------------------------------------------------------
370    const editor = document.querySelector('.editor');
371    const h2Elements = editor ? editor.querySelectorAll('h2') : []; // .editorが存在しない場合は空の配列
372    const toc = document.querySelector('.article-toc');
373    const tocList = document.querySelector('.article-toc__list');
374    if (h2Elements.length > 0 && tocList) {
375        h2Elements.forEach((h2, index) => {
376            const anchorId = `anchor-${String(index + 1).padStart(2, '0')}`;
377            h2.id = anchorId;
378
379            const tocLink = document.createElement('a');
380            tocLink.classList.add('article-toc__list-link');
381            tocLink.href = `#${anchorId}`; // href属性に生成したIDを入れる
382            tocLink.textContent = h2.textContent; // h2のテキストを目次リンクのテキストに入れる
383
384            tocList.appendChild(tocLink);
385        });
386    } else {
387        if(toc) toc.style.display = 'none';
388    }
389
390    // ------------------------------------------------------------------------
391    // エディタ用
392    // 先頭のdetails以外open属性を削除
393    // ------------------------------------------------------------------------
394    const pdetailsTabContainers = document.querySelectorAll('[class*="pdetails_tab"]');
395    pdetailsTabContainers.forEach(container => {
396        const allDetailsInContainer = container.querySelectorAll('details');
397        if (allDetailsInContainer.length <= 1) {
398            for (let i = 1; i < allDetailsInContainer.length; i++) {
399                allDetailsInContainer[i].removeAttribute('open');
400            }
401        }
402    });
403
404    // ------------------------------------------------------------------------
405    // 白金通信 詳細ページ
406    // 指定クラスの画像を祖拡大
407    // ------------------------------------------------------------------------
408    const zoomableImages = document.querySelectorAll('.js-img-zoom-trigger');
409    if (zoomableImages.length > 0) {
410        zoomableImages.forEach(img => {
411            img.addEventListener('click', function () {
412            const overlay = document.createElement('div');
413            overlay.className = 'img-zoom-overlay';
414
415            const enlargedImg = document.createElement('img');
416            enlargedImg.className = 'img-zoom-overlay__image';
417            enlargedImg.src = this.src;
418
419            overlay.appendChild(enlargedImg);
420
421            overlay.addEventListener('click', function () {
422                document.body.removeChild(overlay);
423            });
424
425            document.body.appendChild(overlay);
426            });
427        });
428    }
429});
430
431/**
432 * 外部JSONファイルを読み込んでニュースリストを生成する
433 * @param {string} targetSelector - ニュースリストを挿入する要素のCSSセレクタ (e.g., '.news-list.faculty_english')
434 * @param {string} jsonPath - 読み込むJSONファイルのパス (e.g., '/external_article/faculty_english.json')
435 */
436function loadJsonNews(targetSelector, jsonPath) {
437    const newsListContainers = document.querySelectorAll(targetSelector);
438
439    // 対象の要素がページに存在しない場合は処理を終了
440    if (newsListContainers.length === 0) {
441        return;
442    }
443
444    fetch(jsonPath)
445        .then(response => {
446            if (!response.ok) {
447                throw new Error('Network response was not ok for ' + jsonPath + ': ' + response.statusText);
448            }
449            // .json()の代わりに.text()を使い、不正な改行文字を削除してからパースする
450            return response.text();
451        })
452        .then(text => {
453            // JSON文字列内の改行文字を削除
454            const cleanedText = text.replace(/[\n\r]/g, '');
455            return JSON.parse(cleanedText);
456        })
457        .then(data => {
458            const articles = data.entrys; // JSONデータのルートはオブジェクトなので、'entrys'プロパティから配列を取得
459
460            if (!Array.isArray(articles)) {
461                console.error('Loaded data from ' + jsonPath + ' does not contain an "entrys" array:', data);
462                throw new Error('Invalid JSON format: Expected an object with an "entrys" array.');
463            }
464
465            const htmlContent = articles.length === 0 ? '<li>現在、お知らせはありません。</li>' : articles.map(article => {
466                // 安全のため、各プロパティが存在するか確認し、なければ空文字を割り当てる
467                const url = article.url || '#';
468                const date = article.date ? article.date.replace(/\//g, '.') : ''; // 日付の区切り文字を'/'から'.'に変換
469                const title = article.title || '';
470
471                return `
472                    <li class="news-list__item">
473                        <a class="news-list__link" href="${url}">
474                            <div class="news-list__date">${date}</div>
475                            <div class="news-list__title pclamp pclamp_line2">${title}</div>
476                        </a>
477                    </li>`;
478            }).join('');
479
480            newsListContainers.forEach(container => {
481                container.innerHTML = htmlContent;
482            });
483        })
484        .catch(error => {
485            console.error('Error fetching or parsing ' + jsonPath + ':', error);
486            newsListContainers.forEach(container => {
487                container.innerHTML = '<li>お知らせの読み込みに失敗しました。</li>';
488            });
489        });
490}
491
492document.addEventListener('DOMContentLoaded', function() {
493    // ------------------------------------------------------------------------
494    // .pbox_bg
495    // スクロールに合わせて背景画像を切り替える
496    // ------------------------------------------------------------------------
497    const pboxBgElements = document.querySelectorAll('.pbox_bg');
498    const pboxBgImages = document.querySelectorAll('.pbox_bg__image');
499    // if (pboxBgElements.length === 0 || pboxBgImages.length === 0 || pboxBgElements.length !== pboxBgImages.length) {
500    //     console.log('pbox_bg または pbox_bg__image 要素が見つからないか、数が一致しません。');
501    //     return;
502    // }
503    pboxBgImages.forEach(img => {
504        img.style.opacity = '0';
505        img.style.transition = 'opacity 0.8s ease-out';
506    });
507    const options = {
508        root: null,
509        rootMargin: '0px 0px -10% 0px',
510        threshold: 0.1
511    };
512    const observerCallback = (entries, observer) => {
513        entries.forEach(entry => {
514            if (entry.isIntersecting) {
515                const index = Array.from(pboxBgElements).indexOf(entry.target);
516                if (index !== -1 && pboxBgImages[index]) {
517                    pboxBgImages[index].style.opacity = '1';
518                }
519            } else {
520                const index = Array.from(pboxBgElements).indexOf(entry.target);
521                 if (index !== -1 && pboxBgImages[index]) {
522                     pboxBgImages[index].style.opacity = '0';
523                 }
524            }
525        });
526    };
527    const observer = new IntersectionObserver(observerCallback, options);
528    pboxBgElements.forEach(element => {
529        observer.observe(element);
530    });
531
532        // ------------------------------------------------------------------------
533    // 共通:指定IDの要素に指定パスのHTMLを読み込む関数
534    // ------------------------------------------------------------------------
535    function loadHtmlIntoElement(elementId, htmlPath, callback) {
536        const el = document.getElementById(elementId);
537        if (el) {
538            fetch(htmlPath)
539                .then(response => {
540                    if (!response.ok) throw new Error('Network response was not ok');
541                    return response.text();
542                })
543                .then(html => {
544                    el.innerHTML = html;
545                    // matchHeightの再実行
546                    if (typeof window.funcMatchHeight === 'object' && typeof window.funcMatchHeight.funcInit === 'function') {
547                        window.funcMatchHeight.funcInit();
548                    }
549                    if (typeof callback === 'function') {
550                        callback();
551                    }
552                })
553                .catch(error => {
554                    console.error(`Error loading ${elementId}:`, error);
555                });
556        }
557    }
558
559    // 外部ニュース読み込み処理を呼び出し
560    loadJsonNews('.news-list.faculty_english', '/external_article/faculty_english.json');
561    loadJsonNews('.news-list.faculty_french', '/external_article/faculty_french.json');
562    loadJsonNews('.news-list.faculty_art', '/external_article/faculty_art.json');
563    loadJsonNews('.news-list.faculty_econ', '/external_article/faculty_econ.json');
564    loadJsonNews('.news-list.faculty_soc', '/external_article/faculty_soc.json');
565    loadJsonNews('.news-list.faculty_law', '/external_article/faculty_law.json');
566    loadJsonNews('.news-list.faculty_fis', '/external_article/faculty_fis.json');
567    loadJsonNews('.news-list.faculty_psy', '/external_article/faculty_psy.json');
568    loadJsonNews('.news-list.research_kiriken', '/external_article/research_kiriken.json');
569    loadJsonNews('.news-list.research_prime', '/external_article/research_prime.json');
570    loadJsonNews('.news-list.research_fusion', '/external_article/research_fusion.json');
571    loadJsonNews('.news-list.research_gengobunka', '/external_article/research_gengobunka.json');
572    loadJsonNews('.news-list.research_fuzoku', '/external_article/research_fuzoku.json');
573    loadJsonNews('.news-list.research_iism', '/external_article/research_iism.json');
574    loadJsonNews('.news-list.research_psy', '/external_article/research_psy.json');
575    loadJsonNews('.news-list.research_cfla', '/external_article/research_cfla.json');
576    loadJsonNews('.news-list.research_mbl', '/external_article/research_mbl.json');
577
578    // 各所で利用
579    //loadHtmlIntoElement('include-news-sample', '/_include/news/sample.html');
580    //loadHtmlIntoElement('include-event-sample', '/_include/event/sample.html');
581    loadHtmlIntoElement('include-news-student', '/_include/news/student.html');
582    loadHtmlIntoElement('include-news-graduate', '/_include/news/graduate.html');
583    loadHtmlIntoElement('include-news-guarantor', '/_include/news/guarantor.html');
584    loadHtmlIntoElement('include-news-industry', '/_include/news/industry.html');
585    loadHtmlIntoElement('include-news-visitors', '/_include/news/visitors.html');
586    loadHtmlIntoElement('include-news-corporations', '/_include/news/corporations.html');
587    loadHtmlIntoElement('include-news-about-christianity', '/_include/news/about-christianity.html');
588    loadHtmlIntoElement('include-news-academics', '/_include/news/academics.html');
589    loadHtmlIntoElement('include-news-academics-graduate', '/_include/news/academics-graduate.html');
590    loadHtmlIntoElement('include-news-academics-literature', '/_include/news/academics-literature.html');
591    loadHtmlIntoElement('include-news-academics-economics', '/_include/news/academics-economics.html');
592    loadHtmlIntoElement('include-news-academics-sociology', '/_include/news/academics-sociology.html');
593    loadHtmlIntoElement('include-news-academics-law', '/_include/news/academics-law.html');
594    loadHtmlIntoElement('include-news-academics-international', '/_include/news/academics-international.html');
595    loadHtmlIntoElement('include-news-academics-psychology', '/_include/news/academics-psychology.html');
596    loadHtmlIntoElement('include-news-academics-mathematical_informatics', '/_include/news/academics-mathematical_informatics.html');
597    loadHtmlIntoElement('include-news-research', '/_include/news/research.html');
598    loadHtmlIntoElement('include-news-campuslife', '/_include/news/campuslife.html');
599    loadHtmlIntoElement('include-news-campuslife-ekiden', '/_include/news/campuslife-ekiden.html');
600    loadHtmlIntoElement('include-news-campuslife-sports', '/_include/news/campuslife-sports.html');
601    loadHtmlIntoElement('include-news-campuslife-support', '/_include/news/campuslife-support.html');
602    loadHtmlIntoElement('include-news-international', '/_include/news/international.html');
603    loadHtmlIntoElement('include-news-volunteer_activities', '/_include/news/volunteer_activities.html');
604    loadHtmlIntoElement('include-news-regionalalliances', '/_include/news/regionalalliances.html');
605    loadHtmlIntoElement('include-news-regionalalliances-challengecommunity', '/_include/news/regionalalliances-challengecommunity.html');
606    loadHtmlIntoElement('include-news-regionalalliances-platinum_college', '/_include/news/regionalalliances-platinum_college.html');
607    loadHtmlIntoElement('include-news-campus-yokohama-new_building', '/_include/news/campus-yokohama-new_building.html');
608
609    loadHtmlIntoElement('include-news-admission-event', '/_include/news/admission-event.html');
610
611    loadHtmlIntoElement('include-event-student', '/_include/event/student.html');
612    loadHtmlIntoElement('include-event-graduate', '/_include/event/graduate.html');
613    loadHtmlIntoElement('include-event-guarantor', '/_include/event/guarantor.html');
614    loadHtmlIntoElement('include-event-industry', '/_include/event/industry.html');
615    loadHtmlIntoElement('include-event-visitors', '/_include/event/visitors.html');
616    loadHtmlIntoElement('include-event-campuslife', '/_include/event/campuslife.html');
617    loadHtmlIntoElement('include-event-campuslife-support', '/_include/event/campuslife-support.html');
618    loadHtmlIntoElement('include-event-regionalalliances', '/_include/event/regionalalliances.html');
619    loadHtmlIntoElement('include-event-regionalalliances-open_academy', '/_include/event/regionalalliances-open_academy.html');
620
621    loadHtmlIntoElement('include-why-research', '/_include/why/research.html');
622    loadHtmlIntoElement('include-why-international', '/_include/why/international.html');
623    loadHtmlIntoElement('include-why-career', '/_include/why/career.html');
624    loadHtmlIntoElement('include-why-volunteer_activities', '/_include/why/volunteer_activities.html');
625    loadHtmlIntoElement('include-why-academics-literature', '/_include/why/academics-literature.html');
626    loadHtmlIntoElement('include-why-academics-economics', '/_include/why/academics-economics.html');
627    loadHtmlIntoElement('include-why-academics-sociology', '/_include/why/academics-sociology.html');
628    loadHtmlIntoElement('include-why-academics-law', '/_include/why/academics-law.html');
629    loadHtmlIntoElement('include-why-academics-international', '/_include/why/academics-international.html');
630    loadHtmlIntoElement('include-why-academics-psychology', '/_include/why/academics-psychology.html');
631    loadHtmlIntoElement('include-why-academics-mathematical_informatics', '/_include/why/academics-mathematical_informatics.html');
632    loadHtmlIntoElement('include-en-why-campuslife-volunteer_activities', '/en/_include/why/volunteer.html');
633
634    loadHtmlIntoElement('include-shirogane-archive', '/_include/shirogane/archive.html', () => {
635        const shiroganeArchive = document.querySelectorAll('#include-shirogane-archive details');
636        if (typeof funcAccordionDetailsAnimation === "object" && shiroganeArchive.length > 0) {
637            funcAccordionDetailsAnimation.funcInit();
638        }
639    });
640    loadHtmlIntoElement('include-volunteer-activity-others', '/_include/volunteer/others.html', () => {
641        const volunteerOtherCards = document.querySelectorAll('#include-volunteer-activity-others .gradually-list__card');
642        if (volunteerOtherCards.length > 0) {
643            applyNewLabelsToCards(volunteerOtherCards);
644        }
645    });
646    loadHtmlIntoElement('include-volunteer-activity-latest-articles', '/_include/volunteer-activity/latest-articles.html');
647    loadHtmlIntoElement('include-volunteer-activity-latest-articles-itsudemo', '/_include/volunteer-activity/latest-articles-itsudemo.html');
648    loadHtmlIntoElement('include-volunteer-activity-latest-articles-1day', '/_include/volunteer-activity/latest-articles-1day.html');
649    loadHtmlIntoElement('include-graduate-interview-latest-articles', '/_include/graduate-interview/latest-articles.html');
650    loadHtmlIntoElement('include-club-list-sports-project', '/_include/club/list-sports-project.html');
651    loadHtmlIntoElement('include-club-event-list-sports-project', '/_include/club/event-list-sports-project.html', () => {
652        const clubEventCalendar = document.querySelectorAll('#include-club-event-list-sports-project .calendar-slider');
653        if (clubEventCalendar.length > 0) {
654            initCalendarSlider();
655        }
656
657    });
658    loadHtmlIntoElement('include-story-latest-articles', '/academics/faculty/mathematical_informatics/_include/story/latest-articles.html');
659
660    const recommend_el = document.getElementById('include-common-recommend');
661    if (recommend_el) {
662        const identifier = recommend_el.dataset.fileIdentifier;
663        if (identifier) {
664            const path = `/_include/common_recommend/${identifier}.html`;
665            loadHtmlIntoElement('include-common-recommend', path, initRecommendedSlider);
666        }
667    }
668
669    $(function () {
670        initRecommendedSlider();
671        initCalendarSlider();
672    });
673});
674
675function initRecommendedSlider() {
676    const mvSlider = $('.recommended__slider');
677    if (mvSlider.length > 0) {
678        mvSlider.each(function () {
679            $(this).slick({
680                dots: false,
681                arrows: true,
682                slidesToShow: 1,
683                slidesToScroll: 1,
684                prevArrow: '<button class="slick-prev"></button>',
685                nextArrow: '<button class="slick-next"></button>'
686            });
687        });
688    }
689}
690function initCalendarSlider() {
691    const mvSlider = $('.calendar-slider');
692    if (mvSlider.length > 0) {
693        mvSlider.each(function () {
694            $(this).slick({
695				// autoplay: true,
696                dots: false,
697                slidesToShow: 4,
698				prevArrow: '<button class="calendar-slider__arrow calendar-slider__arrow_prev"></button>',
699                nextArrow: '<button class="calendar-slider__arrow calendar-slider__arrow_next"></button>',
700				responsive: [
701                    {
702                        breakpoint: 768,
703						settings: {
704                            centerMode: true,
705                            centerPadding: '50px',
706                            slidesToShow: 1
707						}
708					}
709				]
710            });
711        });
712    }
713}
714
715// NEW表示処理:日付を取得し、1か月以内ならNEW追加
716function applyNewLabelsToCards(cards) {
717    const today = new Date();
718    const oneMonthAgo = new Date(today);
719    oneMonthAgo.setMonth(today.getMonth() - 1);
720    cards.forEach(card => {
721        const dateEl = card.querySelector('.js-publish-date');
722        if (dateEl) {
723            const dateText = dateEl.textContent.trim().replace(/\./g, '/'); // 2023.3.20 → 2023/3/20
724            const cardDate = new Date(dateText);
725
726            if (!isNaN(cardDate.getTime()) && cardDate >= oneMonthAgo) {
727                // 既にNEWが存在しない場合だけ追加
728                if (!card.querySelector('.news-list2__new')) {
729                    const newEl = document.createElement('div');
730                    newEl.className = 'news-list2__new';
731                    newEl.textContent = 'NEW';
732                    dateEl.insertAdjacentElement('afterend', newEl);
733                }
734            }
735        }
736    });
vendor: 3 bytes, line 737
737}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.