MediaWiki:Gadget-highlightsUsername.js

Fonte: Wikinotícias

Nota: Depois de publicar, deve limpar o cachê do seu navegador para ver as alterações.

  • Firefox e Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
  • Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
  • Internet Explorer e Edge: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5
  • Opera: Pressione Ctrl-F5.
/**
 * Highlights your username in historic
 *
 * @author [[w:en:User:Gray King]]
 * @author [[w:pt:User:!Silent]]
 * @source [[w:en:User:Gary/highlight my username in history.js]]
 * @update 12/Ago/2014
*/
/* global mediaWiki, jQuery */

( function ( mw, $ ) {
'use strict';

function highlightsUsername() {
	$( '#pagehistory' ).find( '.mw-userlink' ).each( function () {
		var $this = $( this );

		if ( $this.text() === mw.config.get( 'wgUserName' ) ) {
			$this.addClass( 'highlightsUsername' );
		}
	} );
}

if ( mw.config.get( 'wgAction' ) === 'history' ) {
	$( highlightsUsername );
}

}( mediaWiki, jQuery ) );