MediaWiki:Common.js

$(window).on("scroll", function {   for (i=0;i<($(".ns-0 .youtube-placeholderlink").size);i++) {        currentItem = $(".youtube-placeholderlink")[i];        if (isScrolledIntoView(currentItem)) {            embeedId = $(currentItem).attr("data-id");            $(currentItem).replaceWith(' ');        }    }    for (i=0;i<($(".ns-0 .spotify-placeholderlink").size);i++) {        currentItem = $(".spotify-placeholderlink")[i];        if (isScrolledIntoView(currentItem)) {            embeedId = $(currentItem).attr("data-id");            $(currentItem).replaceWith(' ');        }    } }); function isScrolledIntoView(elem) {   var $elem = $(elem); var $window = $(window); var docViewTop = $window.scrollTop; var docViewBottom = docViewTop + $window.height; var elemTop = $elem.offset.top; var elemBottom = elemTop + $elem.height; return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)); }