User:JPxG/current-switcher.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | This user script seems to have a documentation page at User:JPxG/current-switcher. |
// This is a very simple script. Basically, what it does is add buttons to "contributions" pages, like Special:Contributions/JPxG or Special:MyContributions, which allow you to toggle displaying current contributions.
// It's useful if you participate in a lot of discussions, and you want to see which of them have been responded to (i.e. which of your comments are no longer the current revision).
// - JPxG, 2021 08 24
$( function() {
if( (window.location.href.indexOf( "Special:Contributions/" ) >= 0 ) || (window.location.href.indexOf( "Special%3AContributions" ) >= 0 )) {
$('.mw-pager-navigation-bar').append(' <button type="button" id="currentrevs-hide">hide current</button><button type="button" id="currentrevs-show">show current</button>');
// Add a listener to your button, that does something when it is clicked.
$('#currentrevs-hide').click(function(e) {
$( '.mw-contributions-current' ).hide();
});
$('#currentrevs-show').click(function(e) {
$( '.mw-contributions-current' ).show();
});
}
} );