MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
Line 84: Line 84:
             });
             });
         }
         }
         // if (e.target.classList && e.target.classList.contains('mwe-popups')){
         if (e.target.classList && e.target.classList.contains('mwe-popups')){
        //    requestAnimationFrame(function () {
            requestAnimationFrame(function () {
        //    var $link = document.querySelector('.mw-parser-output');
document.querySelectorAll('.cog-box-inner a').forEach(link => {
        //    var linkTop = $link.getBoundingClientRect().top + window.scrollY;
    link.addEventListener('mouseover', function(event) {
           
        var parentBox = this.closest('.cog-box-inner');
        //        var bodyTop = document.body.getBoundingClientRect().top + window.scrollY;
        console.log(parentBox);
        //        var top = parseInt(window.getComputedStyle(e.target).top);
        if (parentBox) {
               
            var rect = parentBox.getBoundingClientRect();
        //        var bodyLeft = document.body.getBoundingClientRect().left;
            console.log('Element position: ', rect);
        //        var left = parseInt(window.getComputedStyle(e.target).left);
        }
               
    });
        //        e.target.style.left = left - bodyLeft + 'px';
});
        //        e.target.style.top = linkTop - e.target.offsetHeight - 5 + 'px';
            });
               
         }
        //    console.log('^^');
        //    });
         // }
     },
     },
     false
     false