MediaWiki:Minerva.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* 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">'+
'<li class="title-recommended"><a><span>Recommended Documents</span></a><span class="ico-arrow"></span></li>'+
'<li class="recommended" style="display:none;"><a href="' + wikiLink("en/World Mission Society Church of God") + '"><span>Church of God(Document)</span></a></li>' +
'<li class="recommended" style="display:none;"><a href="' + wikiLink("en/Ahnsahnghong") + '"><span>Christ Ahnsahnghong</span></a></li>' +
'<li class="recommended" style="display:none;"><a href="' + wikiLink("en/God the Mother") + '"><span>God the Mother</span></a></li>' +
'<li class="recommended" style="display:none;"><a href="' + wikiLink("en/Sabbath") + '"><span>Sabbath</span></a></li>' +
'<li class="recommended" style="display:none;"><a href="' + wikiLink("en/Passover") + '"><span>Passover</span></a></li>' +
'<li class="recommended" style="display:none;"><a href="' + wikiLink("en/Gospel and the New Covenant") + '"><span>Gospel and New Covenant</span></a></li>' +
'<li class="title-category"><a><span>Browse by Category</span></a><span class="ico-arrow"></span></li>'+
'<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:Church of God") + '"><span>Church of God</span></a></li>' +
'<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:God the Father") + '"><span>God the Father</span></a></li>' +
'<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:God the Mother") + '"><span>God the Mother</span></a></li>' +
'<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:Gospel of the New Covenant") + '"><span>Gospel of the New Covenant</span></a></li>' +
'<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:Bible Knowledge") + '"><span>Bible Knowledge</span></a></li>' +
'<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:Biblical Issues") + '"><span>Biblical Issues</span></a></li>' +
'<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:Community Service") + '"><span>Community Service</span></a></li>' +
'<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:Global Cooperation") + '"><span>Global Cooperation</span></a></li>' +
'</ul>'
);
// 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');
});
function openList(titleLi, selector) {
titleLi.classList.toggle('open');
let next = titleLi.nextElementSibling;
while (next && !next.classList.contains('title-recommended') && !next.classList.contains('title-category')) {
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){
iframe.parentElement.classList.add('video-wrap');
});
mw.loader.using(['jquery']).then(function() {
$(function() {
var modal = $('#myLayer');
var btn = $('#selectLanguage'); // jQuery 선택자 사용
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();
}
});
});
});