Diferencia entre revisiones de «MediaWiki:Common.js»

Sin resumen de edición
Etiqueta: Reversión manual
Sin resumen de edición
Línea 79: Línea 79:


/* 각주 팝업창 위치 보정 */
/* 각주 팝업창 위치 보정 */
document.body.addEventListener(
var observer = new MutationObserver(function (mutationList) {
     'DOMNodeInserted',
     mutationList.forEach(function (mutation) {
    function (e) {
        mutation.addedNodes.forEach(function (node) {
        if (e.target.classList && e.target.classList.contains('rt-tooltip')) {
            if (node.classList && node.classList.contains('mwe-popups')) {
            requestAnimationFrame(function () {
                requestAnimationFrame(function () {
            var linkId = e.target.id.substring(3);
                    var bodyLeft = document.body.getBoundingClientRect().left;
            var $link = document.querySelector('#'+linkId);
                    var left = parseInt(window.getComputedStyle(node).left);
            var linkTop = $link.getBoundingClientRect().top + window.scrollY;
                    node.style.left = left - bodyLeft + 'px';
           
                 });
                var bodyTop = document.body.getBoundingClientRect().top + window.scrollY;
             }
                var top = parseInt(window.getComputedStyle(e.target).top);
        });
               
    });
                var bodyLeft = document.body.getBoundingClientRect().left;
});
                var left = parseInt(window.getComputedStyle(e.target).left);
// 감시할 대상 설정
               
observer.observe(document.body, {
                e.target.style.left = left - bodyLeft + 'px';
     childList: true,
                 e.target.style.top = linkTop - e.target.offsetHeight - 5 + 'px';
     subtree: true,
             });
});
        }
     },
     false
);


/* 우클릭 방지 */
/* 우클릭 방지 */