// ==UserScript==
// @name dA_ignore
// @namespace dA_ignore
// @author Dediggefedde
// @description ignores people on dA
// @match http://*.deviantart.com/*
// @match https://*.deviantart.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// @version 1.3.6
// @grant GM_setValue
// @grant GM_getValue
// @downloadURL none
// ==/UserScript==
// var $ = unsafeWindow.jQuery,holder,query,offset,fPage,pPage,lPage;
var ignorenames = [];
var settings = {
hidecomments: false,
hidemessages: true,
deletemessages: true,
hideprofile: true,
hidedeivations: true
};
function pruf() {
//dynamic browsing, check all 1s.
setTimeout(pruf, 500);
var foundindex=-1;
if (settings.hidedeivations){
var thumbs=$("div.tt-a.tt-fh:not(notignore)").filter(function(){
for (var i = 0; i < ignorenames.length; i++){
if ($(this).attr("username").toLowerCase() == ignorenames[i].toLowerCase().trim()){
foundindex=i;
return true;
}
}
return false;
}).attr("notignore","");
thumbs.remove();
}
var bnam = $('a.u:not(notignore)') .filter(function () {
for (var i = 0; i < ignorenames.length; i++){
if ($(this).html().toLowerCase() == ignorenames[i].toLowerCase().trim()){
foundindex=i;
return true;
}
}
return false;
}) .attr('notignore', '');
if (bnam.length == 0) return ;
if (settings.deletemessages && bnam.parents('div.mcbox') .length > 0){
console.log("s",bnam.parents('div.ch-ctrl').find('span.mcx'));
bnam.parents('div.ch-ctrl').find('span.mcx').get(0).click();
}
if (settings.hidemessages && bnam.parents('div.mcbox') .length > 0) bnam.parents('div.mcbox').first().remove();
if (settings.hidecomments && bnam.parents('div.ccomment') .length > 0) bnam.parents('div.ccomment').first().remove();
if (settings.hidecomments && bnam.parents('div.deviation-full-minipage').length > 0){
bnam.parents('div.deviation-full-minipage').prev("div.deviation-full-container").remove();
bnam.parents('div.deviation-full-minipage').remove();
} bnam.parents('div.ccomment').first().remove();
if (settings.hideprofile && bnam.parents('div.catbar').length > 0 && $("#da_unignore_but").length==0) {
$('#gmi-GPage').html('
You blocked this user! ');
$("#da_ignore_but").remove();
$("div.gmbutton2town.moarbuttons").prepend($('UnIgnore ').click(function(){
ignorenames.splice(foundindex,1);
setTimeout(function () {
GM_setValue('blocklist',ignorenames.join("\n") );
location.reload();
}, 0);
}));
}
}
if ($("#watch-form").length>0) {
if($("#da_ignore_but").length==0)
$("div.gmbutton2town.moarbuttons").prepend($('Ignore ').click(function(){
ignorenames.push($("#deviant a.u").html());
setTimeout(function () {
GM_setValue('blocklist',ignorenames.join("\n") );
}, 0);
}));
}
if (location.href.indexOf('https://www.deviantart.com/settings') == 0) {
var ignoremenu = $('Ignore User ');
$('#settings_public') .parent() .after(ignoremenu);
ignoremenu.find('a') .click(function () {
$('a.active') .removeClass('active');
$(this) .addClass('active');
$('div.settings_form') .html('' +
'' +
'
' +
'
Ignore Users ' +
'
Separate usernames by linebreaks! ' +
'
' +
'' +
' ' +
'
' +
'' +
'');
$('#da_ignore_saveblocklist') .click(function () {
ignorenames = $('#da_ignore_textarea') .val() .split('\n');
setTimeout(function () {
GM_setValue('blocklist', $('#da_ignore_textarea') .val());
}, 0);
alert('List saved!');
});
$('#da_ignore_savesettings') .click(function () {
settings.hidecomments = $('#da_ignore_hidecomments') .prop('checked');
settings.hidemessages = $('#da_ignore_hidemessages') .prop('checked');
settings.deletemessages = $('#da_ignore_deletemessages') .prop('checked');
settings.hideprofile = $('#da_ignore_hideprofile') .prop('checked');
settings.hidedeivations = $('#da_ignore_hidedeivations') .prop('checked');
setTimeout(function () {
GM_setValue('settings', JSON.stringify(settings));
}, 0);
alert('List saved!');
});
});
}
function loadsettings() {
if (typeof GM_getValue('blocklist') != 'undefined') ignorenames = GM_getValue('blocklist') .split('\n');
if (typeof GM_getValue('settings') != 'undefined') settings = $.parseJSON(GM_getValue('settings'));
if(typeof settings.hidecomments=="undefined")settings.hidecomments = true;
if(typeof settings.hidemessages=="undefined")settings.hidemessages = false;
if(typeof settings.deletemessages=="undefined")settings.deletemessages = true;
if(typeof settings.hideprofile=="undefined")settings.hideprofile = true;
if(typeof settings.hidedeivations=="undefined")settings.hidedeivations = true;
}
loadsettings();
pruf();