MediaWiki:Gadget-LinkSectionEdits.js
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: hold down Ctrl and click the Refresh or Reload button. Firefox: hold down ⇧ Shift while clicking Reload (or press Ctrl+⇧ Shift+R). Google Chrome and Safari users can just click the Reload button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// from https://en.wikipedia.org/w/index.php?title=User:Enterprisey/link-section-edits.js&oldid=860294065
$( function () {
var el, autocomments = document.getElementsByClassName( "autocomment" );
for(var i = 0, n = autocomments.length; i < n; i++) {
el = autocomments[i];
el2 = el.cloneNode( false );
el2.textContent = el.textContent.replace( /\s*$/, "" );
el.parentNode.previousElementSibling.appendChild( el2 );
el.parentNode.removeChild( el );
};
} );