// ==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 // @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js // @version 1.5.1 // @grant GM_setValue // @grant GM_getValue // @grant GM.setValue // @grant GM.getValue // @downloadURL none // ==/UserScript== /* globals $*/ /* Hide Tags/Description: DiFi.pushPost("DeviationView","getExtrasHTML",["501848540","",{},{"is_referred":0,"origin":"dynamic_nav_click","is_new_tab":1}],function(success, data){ console.log(data.response.content.html_col1.split("http://www.deviantart.com/tag/").length); //tag-count }); DiFi.send(); */ var ignorenames = []; var settings = { hidecomments: false, hidemessages: true, deletemessages: true, hideprofile: true, hidedeivations: true }; function inIgnoreList(name) { //n array of string var rex; for (var n of name) { if (n == "" || n == null) continue; for (var i of ignorenames) { if(i[0]=='#'){ rex = new RegExp(i.substr(1), "i"); if (rex.test(n.toLowerCase())) { return true;} }else{ if(n.toLowerCase()==i.toLowerCase()) return true; } } } return false; } function pruf() { //dynamic browsing, check all 1s. setTimeout(pruf, 500); if (settings.hidedeivations) { var thumbs = $("div.tt-a.tt-fh:not(notignore)").filter(function () { return inIgnoreList([$(this).attr("username")]); }).attr("notignore", ""); thumbs.remove(); } //eclipse: a.user-link:not(notignore) var bnam = $('a.u:not(notignore),a.user-link:not(notignore),div.tt-a:not(notignore),img.avatar:not(notignore)').filter(function () { return inIgnoreList([$(this).text(), $(this).attr("username"), $(this).attr("title")]); }).attr('notignore', ''); if (settings.hideprofile && $("#da_unignore_but").length == 0 && (bnam.parents('div.catbar').length > 0 || bnam.parents("div._3HAOe").length > 0)) { // && bnam.parents('div.catbar').length > 0 && $("#da_unignore_but").length==0 var replaceSite = '
user blocked

You blocked this user!

'; $('#gmi-GPage').html(replaceSite); $('div.Nvj6n').html(replaceSite); //eclipse $("#da_ignore_but").remove(); if ($("div.gmbutton2town.moarbuttons").length == 0) { $("div.catbar").append($('
')); } var al = $("div.gmbutton2town.moarbuttons"); var clicker = function () { var foundindex=ignorenames.indexOf($(this).attr("userid")); ignorenames.splice(foundindex, 1); setTimeout(() => { GM.setValue('blocklist', ignorenames.join("\n")); location.reload(); }, 0); }; var unignoreBut = $('UnIgnore').click(clicker); var tarn=$(".user-link._2diFW._2_8l-"); if(tarn.length==0){ tarn=$("#gmi-Gruser").attr("gmi-name").toLowerCase(); }else{ tarn=tarn.data("username").toLowerCase(); } unignoreBut.attr("userid",tarn);//eclipse al.prepend(unignoreBut); al = $("nav.cUIp3"); //eclipse al.append(unignoreBut); //eclipse al.find("#da_unignore_but").css("background-image", "linear-gradient(242deg,#f00,#ddef31)"); //eclipse al.find("#da_unignore_but").addClass("ucOYB _1jsZj"); //eclipse return; } if (bnam.length == 0) return; if (settings.deletemessages) { //&& bnam.parents('div.mcbox') .length > 0 if (bnam.parents('div.ch-ctrl').length > 0) bnam.parents('div.ch-ctrl').find('span.mcx').click(); if (bnam.closest("div.Ijp9_").length > 0) bnam.closest("div.Ijp9_").find('button[aria-label="Remove"]').click(); // } else if (bnam.filter("img.avatar").closest("div.grf-deviants").length > 0) { bnam.filter("img.avatar").closest("span.f").remove(); bnam.filter("img.avatar").closest("div.grf-deviants").remove(); } if (settings.hidedeivations) { bnam.parents("span.thumb").remove(); bnam.parents("div.sVdfP").parent().remove(); } if (bnam.filter("img.avatar").closest('a').length > 0) { bnam.filter("img.avatar").closest("a").remove(); } if (settings.hidemessages) { bnam.parents('div.mcbox').first().remove(); bnam.parents("div.Ijp9_").remove(); //eclipse } if (settings.hidecomments) { bnam.parents('div.ccomment').remove(); bnam.closest('div').remove(); //eclipse } 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(); } } if ($("div.catbar").length > 0 || $("nav.cUIp3").length > 0) { if ($("#da_ignore_but").length == 0) { if ($("div.gmbutton2town.moarbuttons").length == 0) { $("div.catbar").append($('
')); } var al = $("div.gmbutton2town.moarbuttons"); var ignoreBut = $('Ignore').click( function () { if ($("#deviant a.u").length > 0){ ignorenames.push($("#deviant a.u").html().toLowerCase()); }else{ ignorenames.push($("div.AEPha a.user-link").text().toLowerCase()); } setTimeout(() => { GM.setValue('blocklist', ignorenames.join("\n")); }, 0); }); al.prepend(ignoreBut); al = $("nav.cUIp3"); al.append(ignoreBut); //eclipse al.find("#da_ignore_but").css("background-image", "linear-gradient(242deg,#f00,#ddef31)"); //eclipse al.find("#da_ignore_but").addClass("ucOYB _1jsZj"); //eclipse } } 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!' + '
    ' + '' + '
    ' + '
    ' + '
    ' + 'Save' + '
    ' + '' + '
    ' + '
    ' + '

    Behavior

    ' + '
    ' + '
    ' + '' + '' + '
    This will automatically hide comments and replies made by a ignored user. This affects all Submissions. Other People can still see comments hidden like this.' + '
    ' + '
    ' + '' + '' + '
    This will automatically hide Replies and Comments given to you by ignored users. Hidden Comments are still existent and won\'t get removed.' + '
    ' + '
    ' + '' + '' + '
    This will automatically delete Replies and Comments given to you by ignored users.' + '
    ' + '
    ' + '' + '' + '
    This will automatically hide ignored user\'s profile-page. You can still visit them, but instead of their profile-content, there will be a notification.' + '
    ' + '
    ' + '' + '' + '
    Hide all submissions from a user that are displayed on deviantart\'s front-pages.' + '
    ' + '
    ' + '
    ' + 'Save' + '
    '); $('#da_ignore_saveblocklist').click(() => { ignorenames = $('#da_ignore_textarea').val().toLowerCase().split('\n'); setTimeout(() => { GM.setValue('blocklist', $('#da_ignore_textarea').val().toLowerCase()); }, 0); alert('List saved!'); }); $('#da_ignore_savesettings').click(() => { 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(() => { GM.setValue('settings', JSON.stringify(settings)); }, 0); alert('List saved!'); }); }); } async function loadsettings() { var Zignorenames = await GM.getValue('blocklist', null); if (Zignorenames != null) ignorenames = Zignorenames.split('\n'); var Zsettings = await GM.getValue('settings', null); if (Zsettings != null) settings = $.parseJSON(Zsettings); if (settings.hidecomments == null) settings.hidecomments = true; if (settings.hidemessages == null) settings.hidemessages = false; if (settings.deletemessages == null) settings.deletemessages = true; if (settings.hideprofile == null) settings.hideprofile = true; if (settings.hidedeivations == null) settings.hidedeivations = true; } var prom = loadsettings(); prom.then(pruf);