Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SCUD FastBan
// ==UserScript==
// @name SCUD FastBan
// @version 0.2.0
// @author KorDen
// @grant none
// @include *//steamcommunity.com/discussions/forum/*
// @include *//steamcommunity.com/groups/*/discussions/*
// @include *//steamcommunity.com/app/*discussions*
// @include *//steamcommunity.com/app/*/tradingforum*
// @include *//steamcommunity.com/workshop/discussions/*
// @include *//steamcommunity.com/*/filedetails/discussion*
// ==/UserScript==
///////////////
var bNum = 2;
var bReasons = ["Spam", "Trading"];
var bTimes = ["7", "3"]; // days, 0 = permanent
var bIcons = ["//steamcommunity.com/economy/emoticon/TryAgain", "//steamcommunity.com/economy/emoticon/csgox" ];
///////////////
( function() {
if($J('.forum_comment_actions').length > 0) {
updateActions();
setInterval (updateActions, 3000);
}
})();
function updateActions() {
$J('.commentthread_comment_author:not([modifiedFB])').each(function () {
var author = $J(this);
author.attr('modifiedFB', 1);
var aLink = author.find('.commentthread_author_link[onclick*="( this, event, true,"]')
if(aLink.length > 0) {
var target = aLink.attr('data-miniprofile');
var action = author.find('.forum_comment_action:first')
var info = action.attr('href').match(/CCommentThread.DeleteComment\( 'ForumTopic_(.+)_(.+)_(.+)', '(.+)' \)/)
if(info)
{
for( var i = 0; i < bNum; i++)
{
action.before('<a class="forum_comment_action" href=\'javascript:FastBanC("' + info[1] + '", "' + info[2] + '", "' + info[3] + '", "' + info[4] + '", "' + target + '", "' + bTimes[i] + '", "' + bReasons[i] + '");\' title="Delete & ban user\nReason: ' + bReasons[i] + '\nLength: ' + bTimes[i] + ' day(s)"><img src="' + bIcons[i] + '"></a>')
}
}
}
});
}
contentEval( function FastBanC(gid, gidforum, gidtopic, gidcomment, target, time, reason) {
if(confirm("Are you sure?")) {
CCommentThread.DeleteComment( 'ForumTopic_'+ gid + '_' + gidforum + '_' + gidtopic, gidcomment );
//Forum_OnConfirmActionOK();
$J.post('//steamcommunity.com/gid/' + gid + '/banuser/?ajax=1', 'gidforum= '+ gidforum + '&gidtopic=' + gidtopic + '&gidcomment= ' + gidcomment +'&target=' + target + '&sessionid=' + g_sessionID + '&ban_length=' + time + '&ban_reason=' + reason).done(function(data) {
alert(data.message ? data.message : 'Banned');
}).fail(function() {
alert('You may not have permission to ban users');
});
}
} );
function contentEval(source) {
var script = document.createElement('script');
script.setAttribute("type", "application/javascript");
script.textContent = source;
document.body.appendChild(script);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment