Diferencia entre revisiones de «MediaWiki:Minerva.js»
Sin resumen de edición Etiquetas: Edición desde móvil Edición vía web móvil |
Sin resumen de edición |
||
| Línea 25: | Línea 25: | ||
); | ); | ||
document.querySelector( | // 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. | 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; | |||
} | |||
} | } | ||
| Línea 51: | Línea 54: | ||
document.querySelectorAll("iframe").forEach(function (iframe) { | document.querySelectorAll("iframe").forEach(function (iframe) { | ||
iframe.parentElement.classList.add("video-wrap"); | 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(); | |||
} | |||
}); | |||
}); | |||
}); | }); | ||