미디어위키:Minerva.js: 두 판 사이의 차이
편집 요약 없음 태그: 되돌려진 기여 |
편집 요약 없음 태그: 되돌려진 기여 |
||
| 6번째 줄: | 6번째 줄: | ||
} | } | ||
// | // 메뉴 UI 삽입 | ||
document | |||
.querySelector('#mw-mf-page-left #p-navigation') | |||
.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){ | ['.recommended', '.category', '.family', '.youtube'].forEach(function(cls){ | ||
document.querySelectorAll('#p-main-categories ' + cls).forEach(function(li){ | document.querySelectorAll('#p-main-categories ' + cls).forEach(function(li){ | ||
| 62번째 줄: | 59번째 줄: | ||
}); | }); | ||
}); | }); | ||
// 타이틀 항목 open 클래스 제거 (초기엔 모두 닫힘) | |||
['.title-recommended', '.title-category', '.title-family', '.title-youtube'].forEach(function(cls){ | ['.title-recommended', '.title-category', '.title-family', '.title-youtube'].forEach(function(cls){ | ||
var el = document.querySelector('#p-main-categories ' + cls); | var el = document.querySelector('#p-main-categories ' + cls); | ||
| 67번째 줄: | 65번째 줄: | ||
}); | }); | ||
// 토글 함수 | // 토글 함수 (카테고리 제목 클릭 시 리스트 펼침/접힘) | ||
function openList(titleLi, selector) { | function openList(titleLi, selector) { | ||
titleLi.classList.toggle('open'); | titleLi.classList.toggle('open'); | ||
let isOpen = titleLi.classList.contains('open'); | let isOpen = titleLi.classList.contains('open'); | ||
let next = titleLi.nextElementSibling; | let next = titleLi.nextElementSibling; | ||
while ( | // 다음 제목 전까지만 토글 | ||
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)) { | if (next.matches(selector)) { | ||
next.style.display = isOpen ? 'block' : 'none'; | next.style.display = isOpen ? 'block' : 'none'; | ||
| 86번째 줄: | 82번째 줄: | ||
} | } | ||
// 이벤트 바인딩 | // 각 카테고리 타이틀에 토글 이벤트 바인딩 | ||
[ | [ | ||
{class: '.title-recommended', sel: '.recommended'}, | {class: '.title-recommended', sel: '.recommended'}, | ||
| 95번째 줄: | 91번째 줄: | ||
var el = document.querySelector('#p-main-categories ' + row.class); | var el = document.querySelector('#p-main-categories ' + row.class); | ||
if (el) el.addEventListener('click', function (event) { | if (el) el.addEventListener('click', function (event) { | ||
event.stopPropagation(); | event.stopPropagation(); // 모바일 미네르바 스킨 메뉴 자동 닫힘 방지 | ||
openList(this, row.sel); | openList(this, row.sel); | ||
}); | }); | ||
}); | }); | ||
// 유튜브 썸네일 기능 | // 유튜브 썸네일, 모달 등 기존 부가 기능 | ||
document.querySelectorAll('iframe').forEach(function (iframe) { | document.querySelectorAll('iframe').forEach(function (iframe) { | ||
var $container = iframe.parentElement; | |||
var $videoWrap = $container.parentElement; | |||
if ($videoWrap && $videoWrap.classList.contains('video-wrap')) return; | |||
iframe.parentElement.classList.add('video-wrap'); | |||
}); | }); | ||
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(); | modal.hide(); | ||
} | } | ||
}); | }); | ||
}); | }); | ||
} | }); | ||