|
|
| 1번째 줄: |
1번째 줄: |
| /* All JavaScript here will be loaded for users of the MinervaNeue skin */
| |
| function wikiLink(title) {
| |
| return mw.config.get('wgServer') + '/' + title.replace(/ /g, '_');
| |
| }
| |
| document
| |
| .querySelector('#mw-mf-page-left #p-navigation')
| |
| .insertAdjacentHTML(
| |
| 'afterend',
| |
| '<ul id="p-main-categories" class="recommended-open">' +
| |
| // open 클래스
| |
| '<li class="title-recommended open"><a><span>추천문서</span></a><span class="ico-arrow"></span></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="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>'
| |
| );
| |
|
| |
| // 메뉴 상태 초기화
| |
| document.querySelectorAll('#p-main-categories .recommended').forEach(function(li){
| |
| li.style.display = 'block'; // 추천문서만 open
| |
| });
| |
| ['.category', '.family', '.youtube'].forEach(function(selector) {
| |
| document.querySelectorAll('#p-main-categories ' + selector).forEach(function(li) {
| |
| li.style.display = 'none';
| |
| });
| |
| });
| |
|
| |
| // Recommended Documents 토글
| |
| document.querySelector('#p-main-categories .title-recommended')
| |
| .addEventListener('click', function (event) {
| |
| event.stopPropagation();
| |
| openList(this, '.recommended');
| |
| });
| |
| // Browse by Category 토글
| |
| document.querySelector('#p-main-categories .title-category')
| |
| .addEventListener('click', function (event) {
| |
| event.stopPropagation();
| |
| openList(this, '.category');
| |
| });
| |
| // Family Sites 토글
| |
| document.querySelector('#p-main-categories .title-family')
| |
| .addEventListener('click', function (event) {
| |
| event.stopPropagation();
| |
| openList(this, '.family');
| |
| });
| |
| // Youtube Channel 토글
| |
| document.querySelector('#p-main-categories .title-youtube')
| |
| .addEventListener('click', function (event) {
| |
| event.stopPropagation();
| |
| openList(this, '.youtube');
| |
| });
| |
| function openList(titleLi, selector) {
| |
| titleLi.classList.toggle('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 = (next.style.display === 'none' || next.style.display === '') ? 'block' : 'none';
| |
| }
| |
| next = next.nextElementSibling;
| |
| }
| |
| }
| |
| // 유튜브 썸네일
| |
| 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();
| |
| }
| |
| });
| |
| });
| |
| });
| |
| function fillMobileLanguageFromInterwiki() {
| |
| var $mobileList = $('#mobile-language');
| |
|
| |
| // 인터위키 링크 읽기
| |
| var $interwikiLinks = $('#p-lang ul.minerva-languages .interlanguage-link a');
| |
| if (!$interwikiLinks.length) return;
| |
|
| |
| var langMap = {
| |
| 'ko': '한국어',
| |
| 'en': '영어',
| |
| 'es': '스페인어',
| |
| 'vi': '베트남어',
| |
| 'ne': '네팔어',
| |
| 'pt': '포르투갈어'
| |
| };
| |
|
| |
| $mobileList.empty();
| |
|
| |
| $interwikiLinks.each(function () {
| |
| var $a = $(this);
| |
| var href = $a.attr('href');
| |
| var langCode = $a.attr('lang');
| |
| var autonym = $a.find('span').text() || $a.text(); // English, Español ...
| |
| var korean = langMap[langCode] || '';
| |
| var label = korean ? (autonym + ' (' + korean + ')') : autonym;
| |
|
| |
| var $li = $('<li>');
| |
| var $new = $('<a>', { href: href, text: label });
| |
|
| |
| $li.append($new);
| |
| $mobileList.append($li);
| |
| });
| |
| }
| |
|
| |
| mw.loader.using(['jquery']).then(function () {
| |
| $(function () {
| |
| // body DOM 변경 감시
| |
| var observer = new MutationObserver(function (mutations) {
| |
| mutations.forEach(function (m) {
| |
| $(m.addedNodes).each(function () {
| |
| var $node = $(this);
| |
| if ($node.is('#mobile-language') || $node.find('#mobile-language').length) {
| |
| fillMobileLanguageFromInterwiki();
| |
| }
| |
| });
| |
| });
| |
| });
| |
|
| |
| observer.observe(document.body, {
| |
| childList: true,
| |
| subtree: true
| |
| });
| |
|
| |
| // 혹시 이미 열려 있는 상태에서 로딩될 수도 있으니 한 번 시도
| |
| fillMobileLanguageFromInterwiki();
| |
| });
| |
| });
| |