Jump to content

Snippets/Special:WhatLinksHere action links

From mediawiki.org
How to use Snippets
List of Snippets
Special:WhatLinksHere action links
Language(s): JavaScript
Compatible with: MediaWiki 1.17+ (Monobook; Vector)

Description

[edit]

Adds a "hist" link to Special:WhatLinksHere.

Code

[edit]
/**
 * Special:WhatLinksHere edit, history and delete links
 *
 * Adds "hist" and "delete" link to [[Special:WhatLinksHere]]
 *
 * @source: https://www.mediawiki.org/wiki/Snippets/Special:WhatLinksHere_history_link
 * @rev: 3
 */
$( '#mw-whatlinkshere-list li' ).each( function() {
	var url = mw.config.get( 'wgScript' ) + '?title=' + encodeURIComponent( $( 'a:first', this ).text() ) + '&action=';
	$( '.mw-whatlinkshere-tools a:last', this )
		.after( $( '<a>' ).attr( 'href', url + 'delete' ).text( 'delete' ) ).after( ' | ' )
		.after( $( '<a>' ).attr( 'href', url + 'history' ).text( 'hist' ) ).after( ' | ' );
});