|
|
| (사용자 2명의 중간 판 7개는 보이지 않습니다) |
| 1번째 줄: |
1번째 줄: |
| /* All JavaScript here will be loaded for users of the MinervaNeue skin */
| | mw.loader.load('/resources/assets/common/minerva.js'); |
| | |
| // 링크 생성 함수
| |
| function wikiLink(title) {
| |
| return mw.config.get('wgServer') + '/' + title.replace(/ /g, '_');
| |
| }
| |
| | |
| // 네비가 없는 환경이면 중단
| |
| var nav = document.querySelector('#mw-mf-page-left #p-navigation');
| |
| if (!nav) return;
| |
| | |
| // 기존 메뉴 중복 방지
| |
| var oldMenu = document.getElementById('p-main-categories');
| |
| if (oldMenu) oldMenu.remove();
| |
| | |
| // 메뉴 UI 삽입
| |
| nav.insertAdjacentHTML(
| |
| 'afterend',
| |
| '<ul id="p-main-categories" class="recommended-open">' +
| |
| '<li class="title-recommended"><a><span>추천문서</span></a><span class="ico-arrow"></span></li>' +
| |
| '<li class="recommended"><a href="/"><span>하나님의 교회</span></a></li>' +
| |
| '<li class="recommended"><a href="'+wikiLink("안상홍")+'"><span>그리스도 안상홍님</span></a></li>' +
| |
| '<li class="recommended"><a href="'+wikiLink("어머니 하나님")+'"><span>어머니 하나님</span></a></li>' +
| |
| '<li class="recommended"><a href="'+wikiLink("안식일")+'"><span>안식일</span></a></li>' +
| |
| '<li class="recommended"><a href="'+wikiLink("유월절")+'"><span>유월절</span></a></li>' +
| |
| '<li class="recommended"><a href="'+wikiLink("복음과 새 언약")+'"><span>복음과 새 언약</span></a></li>' +
| |
| '<li class="recommended"><a href="'+wikiLink("하나님의 교회 마지막 종교개혁")+'"><span>마지막 종교개혁</span></a></li>' +
| |
| '<li class="title-category"><a><span>카테고리 둘러보기</span></a><span class="ico-arrow"></span></li>' +
| |
| '<li class="category"><a href="'+wikiLink("분류:하나님의 교회")+'"><span>하나님의 교회</span></a></li>' +
| |
| '<li class="category"><a href="'+wikiLink("분류:아버지")+'"><span>아버지 하나님</span></a></li>' +
| |
| '<li class="category"><a href="'+wikiLink("분류:어머니")+'"><span>어머니 하나님</span></a></li>' +
| |
| '<li class="category"><a href="'+wikiLink("분류:새 언약 복음")+'"><span>새 언약 복음</span></a></li>' +
| |
| '<li class="category"><a href="'+wikiLink("분류:성경 일반")+'"><span>성경 상식</span></a></li>' +
| |
| '<li class="category"><a href="'+wikiLink("분류:성경 이슈")+'"><span>성경 이슈</span></a></li>' +
| |
| '<li class="category"><a href="'+wikiLink("분류:사회 공헌")+'"><span>사회 공헌</span></a></li>' +
| |
| '<li class="category"><a href="'+wikiLink("분류:국제 협력")+'"><span>국제 협력</span></a></li>' +
| |
| '<li class="title-family"><a><span>패밀리 사이트</span></a><span class="ico-arrow"></span></li>' +
| |
| '<li class="family"><a href="https://watv.org/"><span>하나님의교회 공식사이트</span></a></li>' +
| |
| '<li class="family"><a href="https://ahnsahnghong.com/"><span>그리스도 안상홍님</span></a></li>' +
| |
| '<li class="family"><a href="https://jerusalemmother.com/"><span>어머니 하나님</span></a></li>' +
| |
| '<li class="family"><a href="https://watvseminar.org/"><span>국제 성경 세미나</span></a></li>' +
| |
| '<li class="family"><a href="https://webinar.watv.org/ko/"><span>WATV Webinar</span></a></li>' +
| |
| '<li class="family"><a href="https://ukzion.watv.org/"><span>영국 여왕상 수상</span></a></li>' +
| |
| '<li class="family"><a href="https://watvaward.org/"><span>수상내역 스페셜</span></a></li>' +
| |
| '<li class="family"><a href="https://watvpress.org/"><span>전 세계 언론보도</span></a></li>' +
| |
| '<li class="title-youtube"><a><span>유튜브 채널</span></a><span class="ico-arrow"></span></li>' +
| |
| '<li class="youtube"><a href="https://www.youtube.com/c/WMSCOGTV"><span>하나님의교회 공식유튜브</span></a></li>' +
| |
| '<li class="youtube"><a href="https://www.youtube.com/c/WorldMissionSocietyChurchofGod"><span>하나님의교회 소개영상</span></a></li>' +
| |
| '<li class="youtube"><a href="https://www.youtube.com/channel/UC5eMiMT79Q9dBNjC0ZGjqxQ"><span>그리스도 안상홍님</span></a></li>' +
| |
| '<li class="youtube"><a href="https://www.youtube.com/@JerusalemMother"><span>어머니 하나님</span></a></li>' +
| |
| '<li class="youtube"><a href="https://www.youtube.com/channel/UCYJ3ZTBXsk1XIfjACZRE4yg"><span>하나님의교회 미디어</span></a></li>' +
| |
| '<li class="youtube"><a href="https://www.youtube.com/c/ChurchofGodNEWSONG"><span>하나님의교회 새노래</span></a></li>' +
| |
| '<li class="youtube"><a href="https://www.youtube.com/channel/UCygKTjdV8ULvNT2cPANTE9A"><span>Church of God TUBE</span></a></li>' +
| |
| '<li class="youtube"><a href="https://www.youtube.com/channel/UCYLPtSHjJeyoXYaYTG0J_Gw"><span>사막에 뜨는 별</span></a></li>' +
| |
| '</ul>'
| |
| );
| |
| | |
| // 기본 접힘
| |
| ['.recommended', '.category', '.family', '.youtube'].forEach(function(cls){
| |
| document.querySelectorAll('#p-main-categories ' + cls).forEach(function(li){
| |
| li.style.display = 'none';
| |
| });
| |
| });
| |
| ['.title-recommended', '.title-category', '.title-family', '.title-youtube'].forEach(function(cls){
| |
| var el = document.querySelector('#p-main-categories ' + cls);
| |
| if(el) el.classList.remove('open');
| |
| });
| |
| | |
| // 토글 함수
| |
| function openList(titleLi, selector) {
| |
| titleLi.classList.toggle('open');
| |
| let isOpen = titleLi.classList.contains('open');
| |
| let next = titleLi.nextElementSibling;
| |
| while (
| |
| next &&
| |
| !next.classList.contains('title-recommended') &&
| |
| !next.classList.contains('title-category') &&
| |
| !next.classList.contains('title-family') &&
| |
| !next.classList.contains('title-youtube')
| |
| ) {
| |
| if (next.matches(selector)) {
| |
| next.style.display = isOpen ? 'block' : 'none';
| |
| }
| |
| next = next.nextElementSibling;
| |
| }
| |
| }
| |
| | |
| // 이벤트 바인딩
| |
| [
| |
| {class: '.title-recommended', sel: '.recommended'},
| |
| {class: '.title-category', sel: '.category'},
| |
| {class: '.title-family', sel: '.family'},
| |
| {class: '.title-youtube', sel: '.youtube'}
| |
| ].forEach(function(row) {
| |
| var el = document.querySelector('#p-main-categories ' + row.class);
| |
| if (el) el.addEventListener('click', function (event) {
| |
| event.stopPropagation();
| |
| openList(this, row.sel);
| |
| });
| |
| });
| |
| | |
| // 유튜브 썸네일 기능(간단한 널체크 보완)
| |
| document.querySelectorAll('iframe').forEach(function (iframe) {
| |
| if (iframe.parentElement) {
| |
| var $container = iframe.parentElement;
| |
| var $videoWrap = $container.parentElement;
| |
| if (!($videoWrap && $videoWrap.classList.contains('video-wrap'))) {
| |
| $container.classList.add('video-wrap');
| |
| }
| |
| }
| |
| });
| |
| | |
| // 모달 구현 (jQuery가 있다면)
| |
| if (window.jQuery) {
| |
| mw.loader.using(['jquery']).then(function() {
| |
| $(function() {
| |
| var modal = $('#myLayer');
| |
| var btn = $('#selectLanguage');
| |
| var span = $('.close-button').first();
| |
| btn.click(function() {
| |
| modal.show();
| |
| });
| |
| span.click(function() {
| |
| modal.hide();
| |
| });
| |
| $(window).click(function(event) {
| |
| if ($(event.target).is(modal)) {
| |
| modal.hide();
| |
| }
| |
| });
| |
| });
| |
| });
| |
| }
| |