Created
April 6, 2015 16:40
-
-
Save anonymous/6e39bc36ff1395de0b2d to your computer and use it in GitHub Desktop.
DSD Ban Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name FB Ban/Unban Like a Boss | |
// @namespace fb-banlikeaboss-dsd | |
// @include https://www.facebook.com/* | |
// @version 2.1 | |
// @grant none | |
// @require http://cdn.craig.is/js/mousetrap/mousetrap.min.js | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js | |
// ==/UserScript== | |
//Avoid conflicts | |
this.$ = this.jQuery = jQuery.noConflict(true); | |
$(document).ready(function() { | |
if (self == top) { | |
$('body').append('<div style="position: fixed; bottom: 1em; left: 1em; z-index: 99; text-align: center; background: none repeat scroll 0% 0% rgb(204, 204, 204);" id="AdminButtons"><div id="unBANcont" style="background: none repeat scroll 0px 0px rgb(255, 255, 255); margin: 2px; font-size: 13px;"></div><input type="text" placeholder="URL(w/ https)/Uname/ID" size="22" id="dsdUNBANURL" /> <button id="dsdUNBANSubmit"> Unban </button><br /><button id="AdminButton"> Remove Member Buttons </button> <button id="dsdBANSubmit"> Ban </button></div>'); | |
} | |
if (window.location.href.indexOf('dsdbangladesh') > -1) { | |
automatedRM(); | |
} | |
$('#AdminButton').click(function() { | |
if (window.location.href.indexOf('dsdbangladesh') > -1) { | |
clickyRM(); | |
} | |
}); | |
Mousetrap.bind(['ctrl ctrl ctrl', | |
'ctrl+alt+shift+l' | |
], function(e) { | |
if (window.location.href.indexOf('dsdbangladesh') > -1) { | |
clickyRM(); | |
} | |
}); | |
$('#dsdUNBANSubmit').click(function() { | |
banHandle('unban'); | |
}); | |
$('#dsdBANSubmit').click(function() { | |
banHandle('ban'); | |
}); | |
}); | |
function automatedRM() { | |
$('.UFICommentContentBlock').each(function(i, obj) { | |
var hvrbrd = $('div span a', this).data('hovercard'); | |
var mpfbusrid = hvrbrd.split('='); | |
var fbuserid = mpfbusrid[1].split('&'); | |
$('.UFICommentActions', this).append('<span class="RMClassified"> <span> · </span> <a href="/ajax/groups/members/remove.php?group_id=598842063567445&uid=' + fbuserid[0] + '" rel="dialog-post" role="menuitem">Remove Member</a></span>'); | |
}); | |
} | |
function clickyRM() { | |
$('.UFICommentContentBlock').each(function(i, obj) { | |
if ($(this).find('.RMClassified').length) { | |
// Do nothing | |
} else { | |
var hvrbrd = $('div span a', this).data('hovercard'); | |
var mpfbusrid = hvrbrd.split('='); | |
var fbuserid = mpfbusrid[1].split('&'); | |
$('.UFICommentActions', this).append('<span class="RMClassified"> <span> · </span> <a href="/ajax/groups/members/remove.php?group_id=598842063567445&uid=' + fbuserid[0] + '" rel="dialog-post" role="menuitem">Remove Member</a></span>'); | |
} | |
}); | |
} | |
function banHandle(arg) { | |
var ubInput = $('#dsdUNBANURL').val(); | |
$('#dsdUNBANURL').val(''); | |
if (ubInput.indexOf('facebook.com') > -1) { | |
var ajaxURL = ubInput.replace(/[\w]*\.facebook\.com/, "graph.facebook.com"); | |
} else { | |
var ajaxURL = 'https://graph.facebook.com/' + ubInput; | |
} | |
$.getJSON(ajaxURL, function(result) { | |
// var parsedJSON = $.parseJSON(result); | |
var fbunbanID = result.id; | |
var fbunbanNAME = result.name; | |
$('#unBANcont').empty(); | |
if (arg == 'unban') { | |
$('#unBANcont').append('<a role="button" ajaxify="/ajax/groups/admins_get.php?gid=598842063567445&uid=' + fbunbanID + '&action=remove_block" rel="dialog-post" href="#">Unban ' + fbunbanNAME + '</a>'); | |
} else { | |
$('#unBANcont').append('<a role="button" ajaxify="/ajax/groups/members/remove.php?group_id=598842063567445&uid=' + fbunbanID + '" rel="dialog-post" href="#">Ban ' + fbunbanNAME + '</a>'); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment