User:Fred Gandt/addUserContribsEditSummaryCountLink.js

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
$( document ).ready( () => {
	"use strict";
	if ( mw.config.get( "wgCanonicalSpecialPageName" ) === "Contributions" ) {
		const EC_PARENT = document.querySelector( '.mw-contributions-footer li a[href*="//xtools.wmcloud.org/ec/en.wikipedia.org/"]' )?.parentElement,
			ESLI = document.createElement( "li" ),
			ESA = document.createElement( "a" );
		ESA.href = `https://xtools.wmflabs.org/editsummary/en.wikipedia.org/${encodeURIComponent( mw.config.get( "wgTitle" ).replace( "Contributions/", "" ) )}`;
		ESA.textContent = "Edit summary count";
		ESA.target = "_blank";
		ESLI.append( ESA );
      console.log( EC_PARENT, ESLI, ESA )
        if ( EC_PARENT ) {
			EC_PARENT.after( ESLI );
		}
	}
} );