User:DarkMatterMan4500/weedwhacker.js
From WikiOasis Meta
More actions
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
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([' [',$('<a class="weedwhacker-link" href="javascript:void(0)" style="color: #8b0000; font-weight: bold">whack</a>').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');
});
}
}),']']);
}
});
});
}
});