미디어위키:Minerva.js: 두 판 사이의 차이
Resultofunion (토론 | 기여) 편집 요약 없음 |
Resultofunion (토론 | 기여) 편집 요약 없음 태그: 모바일 편집 모바일 웹 편집 |
||
| 1번째 줄: | 1번째 줄: | ||
/* All JavaScript here will be loaded for users of the MinervaNeue skin */ | /* All JavaScript here will be loaded for users of the MinervaNeue skin */ | ||
// 모바일 메뉴에서 '둘러보기' 문서 보여주기 | // 모바일 메뉴에서 '둘러보기' 문서 보여주기 | ||
document | document | ||
.querySelector('#mw-mf-page-left #p-navigation') | .querySelector('#mw-mf-page-left #p-navigation') | ||
| 26번째 줄: | 27번째 줄: | ||
); | ); | ||
document.querySelector('#p-main-categories .title-recommended').addEventListener('click', function () { | // 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; | |||
} | } | ||
} | } | ||
| 54번째 줄: | 58번째 줄: | ||
if ($videoWrap && $videoWrap.classList.contains('video-wrap')) return; | if ($videoWrap && $videoWrap.classList.contains('video-wrap')) return; | ||
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(); | |||
} | |||
}); | |||
}); | |||
}); | }); | ||