미디어위키:Common.js: 두 판 사이의 차이

편집 요약 없음
편집 요약 없음
94번째 줄: 94번째 줄:


/* 각주 팝업창 위치 보정 */
/* 각주 팝업창 위치 보정 */
// MutationObserver를 사용하여 DOM 변경 사항 감지
var observer = new MutationObserver(function (mutationList){
var observer = new MutationObserver(function (mutationList){
console.log('observer');
mutationList.forEach(function(mutation){
mutationList.forEach(function(mutation){
console.log(mutation);
         mutation.addedNodes.forEach(function (node) {
         mutation.addedNodes.forEach(function (node) {
if (node.classList && node.classList.contains('mwe-popups')) {
if (node.classList && node.classList.contains('mwe-popups')) {
109번째 줄: 108번째 줄:
})
})
})
})
// 감시할 대상 설정
observer.observe(document.body, {
observer.observe(document.body, {
childList:true,
childList:true,