User:Chrs/weedwhacker.js

mw.loader.using(['mediawiki.user'], function {	if(mw.config.get('wgCanonicalSpecialPageName') == 'Recentchanges'){		mw.hook('wikipage.content').add(function{ $('.mw-changeslist-log-farmer[data-mw-logaction="farmer/requestwiki"] .mw-changeslist-log-entry').each(function{				if($(this).find('.history-deleted:contains("log details removed")').length == 0 && $(this).find('.weedwhacker-link').length == 0){					var reqId = $(this).children('a[href*="/Special:RequestWikiQueue/"]').attr('href').match(/\/(\d+)$/)[1];					$(this).append([' [',$('whack').click(function{						if(window.confirm("Whack request #"+reqId+"?")){							$(this).off('click');							$(this).css('color', ' #871F78');							$(this).text('whacking');							$.ajax({ type: 'POST', url: 'https://meta.miraheze.org/wiki/Special:RequestWikiQueue/'+reqId, dataType: 'json', data: { 'wpEditToken': mw.user.tokens.get('csrfToken'), 'wpsubmit-handle': 'Submit', 'wpsubmission-action': 'decline', 'wpvisibility': 1, 'wpreason': 'Request removed from public view, purely disruptive material.' },								context: this }).always(function(a,b,c){ $(this).css('color', ' #006400'); $(this).text('whacked'); });						}					}),']']);				}			});		});	} });