User:Mr. Stradivarius/gadgets/SearchEditLink.js

/*                           SearchEditLink * * This gadget adds an [edit] link next to each search result when using the * internal wiki search engine. * * To install it, add the following to your Special:MyPage/common.js:

importScript('User:Mr. Stradivarius/gadgets/SearchEditLink.js') // Linkback: User:Mr. Stradivarius/gadgets/SearchEditLink.js

*/

mw.loader.using( [ 'mediawiki.Uri' ], function {	if ( mw.config.get( 'wgCanonicalSpecialPageName' ) !== 'Search' ) {		return;	}	$( '.mw-search-result-heading' )		.append( function  { var url = new mw.Uri( this.children[0].href ); url.extend( {				title: mw.Uri.decode( url.path.replace( /^\/wiki\//, '' ) ),				action: 'edit'			} ); url.path = '/w/index.php'; return $( ' ' ) .addClass( 'mw-editsection' ) .append( $( ' ' )					.addClass( 'mw-editsection-bracket' )					.text( '[' )				) .append( $( '' )					.attr( 'href', url.toString )					.text( 'edit' )				) .append( $( ' ' )					.addClass( 'mw-editsection-bracket' )					.text( ']' )				); } ); } );