User:Finnusertop/pipedlinks.js

__NOINDEX__ if(window.checkLinksToCitations === undefined) window.checkLinksToCitations = true;

mw.hook( 'wikipage.content' ).add( function( $content ) {   // first check: do links in Harvard citations point to a valid citation?    var href,    	links = $content.find( 'a[href^="#"]' );

links.each( function (i, elem) {   	href = elem.getAttribute( 'href' ).substring(1); //skip the #    	// IDs can contain characters like . that have meaning in selectors    	// use $.escapeSelector to make sure they are escaped        if ( $content.find( '#' + $.escapeSelector(href) ))            elem.parentNode.innerHTML +=                " LINK" +                href +                "LONK. ";    });});