Jump to content

User:Fred Gandt/addUserContribsEditSummaryCountLink.js

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by Fred Gandt (talk | contribs) at 15:28, 16 May 2023 (update per changes to xtools hostname). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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 );
		}
	}
} );