Khác biệt giữa bản sửa đổi của “MediaWiki:Minerva.js”
Bước tới điều hướng
Bước tới tìm kiếm
Không có tóm lược sửa đổi Thẻ: Sửa đổi di động Sửa đổi từ trang di động |
Không có tóm lược sửa đổi Thẻ: Sửa đổi di động Sửa đổi từ trang di động |
||
| Dòng 43: | Dòng 43: | ||
}); | }); | ||
function openList(titleLi, | 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; | |||
} | } | ||
} | } | ||
Phiên bản lúc 15:00, ngày 26 tháng 9 năm 2025
/* All JavaScript here will be loaded for users of the MinervaNeue skin */
function wikiLink(title) {
// 공백 → _ 치환 후 절대 경로 생성
return mw.config.get('wgServer') + '/vi/' + title.replace(/ /g, '_');
}
document
.querySelector('#mw-mf-page-left #p-navigation')
.insertAdjacentHTML(
'afterend',
'<ul id="p-main-categories" class="recommended-open">' +
'<li class="title-recommended open"><a><span>Bài viết đề xuất</span></a><span class="ico-arrow"></span></li>' +
'<li class="recommended"><a href="' + wikiLink("Hội Thánh của Đức Chúa Trời Hiệp Hội Truyền Giáo Tin Lành Thế Giới") + '"><span>Hội Thánh của Đức Chúa Trời (Tài liệu)</span></a></li>' +
'<li class="recommended"><a href="' + wikiLink("An Xang Hồng") + '"><span>Đấng Christ An Xang Hồng</span></a></li>' +
'<li class="recommended"><a href="' + wikiLink("Đức Chúa Trời Mẹ") + '"><span>Đức Chúa Trời Mẹ</span></a></li>' +
'<li class="recommended"><a href="' + wikiLink("Ngày Sabát") + '"><span>Ngày Sabát</span></a></li>' +
'<li class="recommended"><a href="' + wikiLink("Lễ Vượt Qua") + '"><span>Lễ Vượt Qua</span></a></li>' +
'<li class="recommended"><a href="' + wikiLink("Tin Lành và giao ước mới") + '"><span>Tin Lành và giao ước mới</span></a></li>' +
'<li class="title-category"><a><span>Dò xem danh mục</span></a><span class="ico-arrow"></span></li>' +
'<li class="category"><a href="' + wikiLink("Category:Hội Thánh của Đức Chúa Trời") + '"><span>Hội Thánh của Đức Chúa Trời</span></a></li>' +
'<li class="category"><a href="' + wikiLink("Category:Ðức Chúa Trời Cha") + '"><span>Ðức Chúa Trời Cha</span></a></li>' +
'<li class="category"><a href="' + wikiLink("Category:Đức Chúa Trời Mẹ") + '"><span>Đức Chúa Trời Mẹ</span></a></li>' +
'<li class="category"><a href="' + wikiLink("Category:Tin Lành giao ước mới") + '"><span>Tin Lành giao ước mới</span></a></li>' +
'<li class="category"><a href="' + wikiLink("Category:Thường thức Kinh Thánh") + '"><span>Thường thức Kinh Thánh</span></a></li>' +
'<li class="category"><a href="' + wikiLink("Category:Vấn đề Kinh Thánh") + '"><span>Vấn đề Kinh Thánh</span></a></li>' +
'<li class="category"><a href="' + wikiLink("Category:Cống hiến cho xã hội") + '"><span>Cống hiến cho xã hội</span></a></li>' +
'<li class="category"><a href="' + wikiLink("Category:Hợp tác quốc tế") + '"><span>Hợp tác quốc tế</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();
}
});
});
});