Jump to content

User:HueSatLum/highlightMyEdits.js

From Wikipedia, the free encyclopedia
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.
// <nowiki>
/*
 * highlightMyEdits
 *
 * This highlights your username in history pages.
 *
 * To install the script, add the following to your personal .js page:
 
importScript( 'User:HueSatLum/highlightMyEdits.js' ); // Linkback: [[User:HueSatLum/highlightMyEdits.js]]
 
 
 * == Customization ==
 * This adds the class "history-me" to the <span> that contains the links to
 * your userpage and talk/cotribs. By default, it gives it a light green
 * background, but it can be customized by adding the following to your personal
 * .css page (replace `lightblue` with whatever color you want):

.history-me { background-color: lightblue !important; }

* or, to use a different style than background color (e.g., bolding):

.history-me {
	background-color: none !important;
	font-weight: bold;
}

 */

( function ( $, mw ) {
	mw.util.addCSS( '.history-me { background-color: lightgreen; }' );
	var username = mw.config.get( 'wgUserName' );
	
	$( '.history-user' ).each( function () {
		if ( $( this ).find( '.mw-userlink' ).first().text() === username ) {
			$( this ).addClass( 'history-me' );
		}
	});
} ) ( jQuery, mediaWiki );

// </nowiki>