User:Gryllida/js/deleteLinkInRc.js

/* Author : Svetlana Tkachenko svetlana@members.fsf.org This file is a part of deleteLinkInRc. Licence: GPLv3+ Description: [beta] adds delete link to 'N' pages in recent changes or block or contribs Recommends: User:Gryllida/js/showPagePreviewWhenDeleting.js See also .

function _addDeleteLink { // new page markers present? if($('abbr.newpage')){ // traverse DOM to the parent element of the new page marker $('abbr.newpage').parent.each(function(e){			// get page title as an attribute			var title = $(this).attr('data-target-page') || $(this).find('.mw-contributions-title').text;			// construct the deletion url			var url = 'https://en.wikinews.org/w/index.php?title=$1&action=delete';			url = url.replace('$1', title);			// add the deletion link			var button = $('', { text: 'delete', href: url }); 			$(this).append(' [');			$(this).append(button);			$(this).append(']');			var buttonSpam = $('', { text: 'spam delete', href: url + '&wpReason=spam', }); 			$(this).append(' [');			$(this).append(buttonSpam);			$(this).append(']');		}); } }

mw.loader.using(['mediawiki.api'], function {	"use strict";	// == Quit if this is not main namespace ==	 var thisPageTitle = mw.config.get( 'wgPageName' );	// check that it's recent changes or block or contribs page	if (thisPageTitle == 'Special:RecentChanges' || thisPageTitle.indexOf('Special:Contributions') === 0){		_addDeleteLink;	} });