Code:
ZeroBin.net is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES. More information on the project page. www.Zerobin.net is not affiliated with the ZeroBin or PrivateBin projects.
Click here to visit the public Guest Book.
By using this site you agree to the Terms Of Service.
ZeroBin.net
Because ignorance is bliss
Find us on Tor Onionspace:
https://zerobinqmdqd236y.onion
NewClone Raw text
// ==UserScript==
// @name Mafia Post Filter
// @icon https://www.sc2mafia.com/forum/favicon.ico
// @description ♥
// @namespace RnVjaywgSSBkaWRuJ3QgbWlzcyB1c2luZyBqYXZhc2NyaXB0LiAgIOKYuiDimLs=
// @include https://www.sc2mafia.com/forum/showthread.php/*
// @version 1.0
// @run-at document-end
//
@Grant
none
// ==/UserScript==
var names=[],posts=document.getElementsByClassName("postcontainer"),postCount=posts.length,reg=/(href="member\.php\/\d*-)(\S*[^"])(")/;
names=getUsersFrom(posts);
names.sort(function(a,b){return a.toLowerCase().localeCompare(b.toLowerCase());});
addMenu();
function addMenu(){
var menu=document.createElement('li');
menu.innerHTML='<h6><a class="popupctrl" href="javascript:void(0);">Filter</a></h6></li>';
menu.addEventListener('click',show,false);
menu.setAttribute('class','popupmenu');
menu.setAttribute('id','fuckingmenu');
document.getElementById('votecounter').parentNode.insertBefore(menu,document.getElementById('votecounter'));
menu.appendChild(UL());
//fixMenu();
}
function show(e){
if(document.getElementById('hidemenu').style.display==='block')
document.getElementById('hidemenu').style.display='none';
else
document.getElementById('hidemenu').setAttribute('style',"display:block;left:-37px;top:-6px;");
}
function hideMenu(e){
document.getElementById('hidemenu').setAttribute('style',"display:none");
}
function fixMenu(){
var menu=document.getElementsByClassName('tcat')[0];
menu.style.position='fixed';
menu.style.bottom='0px';
menu.style.zIndex='99999';
if(document.getElementsByClassName('firstunread')[0]){
menu.style.width='26%';
menu.style.left='42%';
}
else{
menu.style.width='18%'
menu.style.left='44%';;
}
}
function selectUser(u){
var i=-1;
while(++i<postCount)
posts[i].style.display="";
var name=u;
i=-1;
while(++i<postCount)
if(reg.exec(posts[i].innerHTML)[2]!=names[name])
posts[i].style.display="none";
}
function showAll(){
var i=-1;
while(++i<postCount)
posts[i].style.display="";
}
function search(){
var u=prompt('Enter username (case sensitive).');
if(u==null)
return;
var i=-1;
while(++i<postCount)
if(posts[i].innerHTML.indexOf(';">'+u+'<')==-1)
posts[i].style.display="none";
}
function UL(){
var e=names.length,i=-1,u,l,a,t,c='';
u=document.createElement('ul');
u.setAttribute('class','popupbody');
u.setAttribute('id','hidemenu');
u.setAttribute('style','display:none;');
l=document.createElement('li');
a=document.createElement('a');
a.setAttribute('style','text-align:center;color:#6495ed;');
a.setAttribute('href','javascript:void(0);');
a.addEventListener('click',showAll,false);
t=document.createTextNode('ALL');
a.appendChild(t);
l.appendChild(a);
u.appendChild(l);
l=document.createElement('li');
a=document.createElement('a');
a.setAttribute('style','text-align:center;color:#ffff00;');
a.setAttribute('href','javascript:void(0);');
a.addEventListener('click',search,false);
//t=document.createTextNode('Other');
//a.appendChild(t);
//l.appendChild(a);
//u.appendChild(l);
while(++i<e){
//c=c=='999'?'aaa':'999';
l=document.createElement('li');
a=document.createElement('a');
//a.setAttribute('style','text-align:center;color:#'+c+';');
a.setAttribute('style','text-align:center;');
a.setAttribute('href','javascript:void(0);');
a.addEventListener('click',(function(I){return function(){selectUser(I)};})(i),false);
t=document.createTextNode(names[i]);
a.appendChild(t);
l.appendChild(a);
u.appendChild(l);
}
u.style.fontSize='120%';
u.style.width='80%';
return u;
}
function getUsersFrom(data){
var n=[],i=-1,e=postCount,h='',user='';
while(++i<postCount){
h=data[i].innerHTML;
user=reg.exec(h)[2];
if(n.includes(user))
continue;
n[n.length]=user;
}
return n;
}