Greasy Fork is available in English.

Deviantart Activity Filter

For the activitiy-notification (not -feed) to filter for llamas, watches, favourites etc.

// ==UserScript==
// @name            Deviantart Activity Filter
// @namespace       dev_hide_mes
// @match			*://*.deviantart.com/messages/*
// @grant        	GM_registerMenuCommand
// @grant        	GM_getValue
// @grant        	GM_setValue
// @grant        	GM_xmlhttpRequest
// @require    	http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// @version       	1.4
// @description For the activitiy-notification (not -feed) to filter for llamas, watches, favourites etc.
// ==/UserScript==

if(navigator.appName=="Opera"){window.onload=laden;}else{laden();} //Opera...
function laden(){

// var $=unsafeWindow.jQuery,holder,query,offset,fPage,pPage,lPage;
var deakt=false;
if(GM_getValue('dev_hide_mes_akt')){deakt=GM_getValue('dev_hide_mes_akt');}
function keyHandler(e){
	if (e.which ==78 &&e.altKey){verschw();return false;}else{return true;}
}
function verschw(){
	deakt=!deakt;
	GM_setValue('dev_hide_mes_akt',deakt);
	if(deakt==true){location.reload();}else{pruf();req(0);}
}
GM_registerMenuCommand("Disable/Enable Deviantart Activity Filter", verschw,"N","","D");
window.addEventListener('keydown', keyHandler, false);

var devakt=["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAYAAAArdgcFAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw%2FeHBhY2tldCBiZWdpbj0i77u%2FIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50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AcEUeCiXUbhqiBoXZtqGbWpRaS0iSD6QVhgUThhNY4mg%2BOoOaO%2B92bej9titBl%2FQN%2FNPRw%2B9%2FA959wL%2FxSva0pHVdNT%2Fq9wd8PstLLUIxX5sCO8NSPXAlGlotWYqhqvLV2IXY%2B9ab4G0CfKsAbQJWahVvb34ooxfhW2L124cqyjpWs%2BExsf8crw2j2j9Wzo8VE09qq4GOQT0SAhT6BHJ%2BfKsF46zMvm7WEyvCAl%2FqDI0SAdxJIut%2FKsCwxgN%2FU4uDxgiJ9cjciPrcc3wZpv8xqLFuYZpZ8OxkljSTvuxTdXDmnswcYkIMN5DhOnFgsF3ia4sNjIEcZ4yyIGyzjEaMNDlUdQbtC9m%2Fsef2kTIGjhOT0YpFhAVWxiNewSMJNd4Ry91FHPRWqY4T1DrjZQ9WxD5W8KZFjjNA73%2BcEYD0mTZMW17tmLJ8WwWmejJAcDn1lO0YQgzzb%2FQPgda2iFo1ImQCIxuMkd%2BnDFsoaBsaFBQFfkCNR%2B4fOVPJDE1lMHKeAwzxR%2BBRxKBAODtzwZIFAIJKBUrhOTIpJXJHC0Etopphxn1G0vZr2ElzV3niGkJkQeLVOcCzws9mExtwpnAep8zRvx0iRld1skL4qYWvKQm%2FYXqMbkNymx7lHtoodWIgTRS8EuhfLsG06GenRsnpCqHF3ABAvUYBJdcoN2wC5OYrCC4DMz6zZf%2BSExqSFEI80Y%2BHxhmgL8BSus3CP%2BH3LSAAAAAElFTkSuQmCC"];
var devnams=["devfavbut","devllamabut","devwatchbut"];
var userid= /{"(\d+),oq:/.exec(document.body.innerHTML)[1];
var hintlist=new Array();
var fulllist=new Array();
var evaluator = new XPathEvaluator();
var akt=[true,true,true];
var rest=100;
var aktpage=0;
var sortacc=true;
var schritt=10;

if(!deakt){pruf();req(0);}

function pruf(){
	setTimeout(pruf, 1000);
	var ri= evaluator.evaluate("//h2[contains(., 'Activity')]", document.documentElement, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null);
	if(!document.getElementById('devfavbut')&&ri.singleNodeValue){
		if(location.href.indexOf("#view=feedback")!=-1){
			schritt=10;
		}else{
			if(location.href.indexOf("#view=activity")!=-1){
			schritt=20;
			}
		}
		butinit();
	}
}
function butinit(){
	var neutab = document.createElement("span");
	neutab.ClassName='stackSwitch';
	neutab.innerHTML='<div class="dvl"></div>'+
	'<a id="devfavbut" onclick="return false;" style="background-image:url('+devakt[0] +') !important;background-repeat:no-repeat;background-position:0px 0px 0px 0px;" title="Favs-Switch" href=""></a>'+
	'<a id="devllamabut" onclick="return false;" style="background-image:url('+devakt[1] +') !important;background-repeat:no-repeat;background-position:0px 0px 0px 0px;" title="Llamas-Switch" href=""></a>'+
	'<a id="devwatchbut" onclick="return false;" style="background-image:url('+devakt[2] +') !important;background-repeat:no-repeat;background-position:0px 0px 0px 0px;" title="Watches-Switch" href=""></a>';
	var mview=evaluator.evaluate("//h2[contains(., 'Activity')]/div[@class='mcviews']", document.documentElement, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null);
	mview.singleNodeValue.appendChild(neutab);
	binder();
}
function umschalt(i){
	if(akt[i]){
		akt[i]=false;
		document.getElementById(devnams[i]).style.setProperty('background-image','url('+devdeakt[i] +')',"important");
	}else{
		akt[i]=true;	
		document.getElementById(devnams[i]).style.setProperty('background-image','url('+devakt[i] +')',"important");
	}
	adlist();anzeiger();blatter(0);
}

function req(offset){
	GM_xmlhttpRequest({
        method: 'GET',
        url: 
		"http://www.deviantart.com/global/difi.php?c[]=MessageCenter;get_views;"+userid+",oq:fb_activity:"+offset+":100:f&t=json",
        onload: function (response) {		
			var res = eval('('+response.responseText+')');
			var coms = res.DiFi.response.calls[0].response.content[0].result.hits;
			// console.log(res);
			rest = res.DiFi.response.calls[0].response.content[0].result.matches - offset-100;
			for(var i=0;i< coms.length;i++){
				fulllist.push(coms[i]);
			}
			if(rest<0){adlist();anzeiger();}else{req(offset+100);}
		}
    });
}

function adlist(){
	hintlist=[];
	if((akt[0]==true)&&(akt[1]==true)&&(akt[2]==true)){hintlist=fulllist;}else{
		for(var i=0;i<fulllist.length;i++){
			if(
				!(!akt[0]&&(fulllist[i].display_class[0]=="collect"))&&
				!(!akt[1]&&(fulllist[i].display_class[0]=="badge"))&&
				!(!akt[2]&&(fulllist[i].display_class[0]=="watched"))
			){
				hintlist.push(fulllist[i]);
			}
		}
	}
}

function zeiter(milisecs){
	var dats = new Date(milisecs*1000);
	var mname=["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
	ruckdate= mname[dats.getMonth()]+" "+dats.getDate()+", "+dats.getFullYear()+", ";
	if(dats.getMinutes()<10){var mmin="0"+dats.getMinutes();}else{var mmin=dats.getMinutes();}
	if(dats.getHours()>11){ruckdate = ruckdate + (dats.getHours()-12) + ":" + mmin + " PM";}else{ ruckdate = ruckdate + dats.getHours() + ":" + mmin + " AM";}
	return ruckdate;
}

function binder(){
	if(document.getElementById('devfavbut')){
	document.getElementById('devfavbut').addEventListener('click', function(){umschalt(0)},false);
	document.getElementById('devllamabut').addEventListener('click', function(){umschalt(1)},false);
	document.getElementById('devwatchbut').addEventListener('click', function(){umschalt(2)},false);
	}else{return}

	var sortbut=evaluator.evaluate("//h2[contains(., 'Activity')]/div[@class='mcviews']/span[2]/a[1]", document.documentElement, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null);
	var sortbut2=evaluator.evaluate("//h2[contains(., 'Activity')]/div[@class='mcviews']/span[2]/a[2]", document.documentElement, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null);
	sortbut.singleNodeValue.setAttribute("onclick","return false;");
	sortbut.singleNodeValue.addEventListener('click',sorten,false);
	sortbut2.singleNodeValue.setAttribute("onclick","return false;");
	sortbut2.singleNodeValue.addEventListener('click',sorten,false);

	var selallbut = evaluator.evaluate("//h2[contains(., 'Activity')]/../div[2]/table/tbody/tr[2]/td[2]/a[3]", document.documentElement, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null);
	selallbut.singleNodeValue.className="gmbutton disabledbutton";
	selallbut.singleNodeValue.onclick="return false;";
	
	var zahlspan = evaluator.evaluate("//h2[contains(., 'Activity')]/..//span[@class='shadow']", document.documentElement, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null);
	if(!zahlspan.singleNodeValue){return}
	var zahlen = zahlspan.singleNodeValue.getElementsByTagName('a');
	for(var x=0;x<zahlen.length;x++){
		switch(zahlen[x].innerHTML){
			case "Previous Page":
				zahlen[x].addEventListener('click', function(){blatter(aktpage-1)},false);
				break;
			case "Next Page":
				zahlen[x].addEventListener('click', function(){blatter(aktpage+1)},false);
				break;
			default:
				zahlen[x].addEventListener('click', function(evt){blatter(evt.target.innerHTML.match(/\d*/)[0]-1)},false);
			}		
	}	
	
}

function sorten(){
	sortacc = !sortacc;

	var sortbut=evaluator.evaluate("//h2[contains(., 'Activity')]/div/span[2]/a[1]", document.documentElement, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null);
	var sortbut2=evaluator.evaluate("//h2[contains(., 'Activity')]/div/span[2]/a[2]", document.documentElement, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null);
	if(sortacc){
		sortbut.singleNodeValue.style.setProperty('background-position','-240px -42px',"important");
		sortbut.singleNodeValue.title="Switch to Oldest First";
		sortbut2.singleNodeValue.style.setProperty('background-position','-240px -42px',"important");
		sortbut2.singleNodeValue.title="Switch to Oldest First";
	}else{
		sortbut.singleNodeValue.style.setProperty('background-position','-216px -42px',"important");
		sortbut.singleNodeValue.title="Switch to Newest First";
		sortbut2.singleNodeValue.style.setProperty('background-position','-216px -42px',"important");
		sortbut2.singleNodeValue.title="Switch to Oldest First";
	}
	
	hintlist=hintlist.reverse();
	anzeiger();
}

function blatter(wohin){
	aktpage=wohin;
	anzeiger();
}

function butbrows(){
	var bbtext='';
	if((aktpage>1&&aktpage<=(Math.floor(hintlist.length/schritt)-4))){
		var anf=aktpage-1;
	}else{
		if(aktpage>(Math.floor(hintlist.length/schritt)-4)&&(Math.floor(hintlist.length/schritt)>4)){
			var anf=Math.floor(hintlist.length/schritt)-4;
		}else{
			var anf=0;}
		}
	if(hintlist.length>schritt){
	if(aktpage==0){bbtext='<del class="l">Previous Page</del>';}else{bbtext='<a href="" onclick="return false;" class="l">Previous Page</a>';}
	for(var x=anf;x<hintlist.length/schritt && x<anf+5;x++){
		if(x==aktpage){
			bbtext=bbtext + '<strong>'+(x+1)+'</strong>';
		}else{
			if((x!=Math.floor(hintlist.length/schritt))&&(x==anf+4||(x==anf&&aktpage>1))){var inpu='...';}else{var inpu='';}
				bbtext = bbtext + '<a htmlpage="'+(x)+'" href="" onclick="return false;">'+(x+1)+inpu+'</a>';
			}
		}
	if(aktpage==Math.floor(hintlist.length/schritt)){bbtext=bbtext+'<del class="r page">Next Page</del>';}else{bbtext=bbtext+'<a href="" onclick="return false;" class="r page">Next Page</a>';}
	}

	var zahlspan = evaluator.evaluate("//h2[contains(., 'Activity')]/..//span[@class='shadow']", document.documentElement, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null);
	if(zahlspan.singleNodeValue){zahlspan.singleNodeValue.innerHTML=bbtext;}
}
var notfallzeil=0;
var notfallpar=0;
function anzeiger(){
	// var nanz = evaluator.evaluate("//h2[contains(., 'Activity')]", document.documentElement, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null);
	// if(!nanz.singleNodeValue){return;}
	// nanz.singleNodeValue.innerHTML = nanz.singleNodeValue.innerHTML.replace(/^\d*/,hintlist.length);
	var titl=$("div#messages.messages table.messages tbody tr td.f div.messages-right div.mczone h2:contains('Activity Message')");
	if(titl.length==0)return;
	titl.html(titl.html().replace(/^\d*/,hintlist.length));
	// var el = evaluator.evaluate("//h2[contains(., 'Activity')]/../div[@class='mczone-inner']", document.documentElement, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null);
	
	var entrs=$("div#messages.messages table.messages tbody tr td.f div.messages-right div.mczone:contains('Activity Message') div.mczone-inner div.mcbox");
	if(entrs.length>0){notfallzeil=entrs.first().clone(true,true);notfallpar=entrs.parent();}
		else if(notfallzeil==0)return;
	var centr=notfallzeil;
	var pcentr=notfallpar;
	// while (el.singleNodeValue.childNodes[0]) {
    // el.singleNodeValue.removeChild(el.singleNodeValue.childNodes[0]);
	// }
	
	for(var i=aktpage*schritt;i< hintlist.length && i<(aktpage+1)*schritt;i++){
	
		var who ="<span class='mcb-who'>"+hintlist[i].who+"</span>";
		var title="<span class='mcb-title'>"+hintlist[i].title+"</span>";
		var collection="<span class='mcb-collection'>"+hintlist[i].collection+"</span>";
		var basetitle="<span class='mcb-base_title'>"+hintlist[i].base_title+"</span>"
		
		centr=centr.clone(true,true);
		centr.find("span.mcb-who").html(hintlist[i].who);
		centr.find("span.mcb-title").html(hintlist[i].who);
		centr.find("span.mcb-collection").html(hintlist[i].collection);
		centr.find("span.mcb-base_title").html(hintlist[i].base_title);
		centr.find("span.mcb-ts span").html(zeiter(hintlist[i].ts));
		centr.find("span.mcb-icon").html(hintlist[i].icon);
		centr.find("span.mcb-line").html(hintlist[i].line[1].replace("%who%",who).replace("%title%",title).replace("%collection%",collection).replace("%base_title%",basetitle).replace("%client:you%","you").replace("%pricepoints%",hintlist[i].pricepoints).replace("%source%",""));
		pcentr.append(centr);
		centr.click(function(){
			$("div.mcbox-sel").removeClass("mcbox-sel mcbox-sel-list mcbox-sel-list-generic");
			$(this).addClass("mcbox-sel mcbox-sel-list mcbox-sel-list-generic");
		});
		centr.find("span.mcx:not([hintlistid])").attr("hintlistid",i).attr("onclick","").click(function(event){
			event.stopPropagation()
			event.preventDefault();
			var lastakt=hintlist[$(this).attr("hintlistid")].msgid;
			var lastind=$(this).attr("hintlistid");
			// console.log(lastakt);
				unsafeWindow.DiFi.pushPost("MessageCenter", "trash_messages", [userid, "id:fb_activity:"+lastakt],function(a,s){
				// console.log(a);
				// console.log(s);				
				// console.log(hintlist.splice(parseInt(lastind),1),parseInt(lastind));
				anzeiger();
				// $(this).parent(".mcbox").remove();			
			});	
			unsafeWindow.DiFi.send();
		});
		// var zdiv=document.createElement("div");
		// zdiv.className='mcbox ch mcbox-list mcbox-list-generic';
		// zdiv.setAttribute("onmousedown","MessageBox.pubEvent(this, window.event || arguments[0])");
		// var texx='<div class="ch-ctrl mc-ctrl">'+'<span onclick="MessageBox.pubEvent(this, window.event || arguments[0], \'watch\')" class="mcdx" style="display: none;"></span>'+
			// '<span onclick="MessageBox.pubEvent(this, window.event || arguments[0], \'x\')" class="mcx" style="display: block;"></span>'+
			// '<div class="mcbox-inner mcbox-inner-list mcbox-inner-list-generic">'+'<span class="mcb-ts">'+'<span>'+zeiter(hintlist[i].ts)+'</span></span>'+
			// '<span class="mcb-icon">'+hintlist[i].icon+'</span><span class="mcb-line">'+
			// hintlist[i].line[1].replace("%who%",who).replace("%title%",title).replace("%collection%",collection).replace("%base_title%",basetitle).replace("%client:you%","you").replace("%source%","")+
			// '</span> </div></div>';
		// zdiv.innerHTML=texx;
		// el.singleNodeValue.appendChild(zdiv);
	}
	entrs.remove();
	butbrows();
	binder();
}
};

// {"DiFi":{"status":"SUCCESS","response":{"calls":[{"request":{"class":"MessageCenter","method":"trash_messages","args":["1305938","id:fb_activity:2:298766207:1965597:0"]},"response":{"status":"SUCCESS","content":"trashed"}}]}}}
// {"DiFi":{"status":"SUCCESS","response":{"calls":[{"request":{"class":"MessageCenter","method":"trash_messages","args":["1305938","id:fb_activity:2:298766207:7270611:0"]},"response":{"status":"SUCCESS","content":"trashed"}}

// "17:2486103:28390274:262"
// 17:2486103:24282845:255