// ==UserScript== // @name NFOHump Hidden Users // @namespace com.LeoNatan.hideusers // @version 1.5.7 // @description Adds proper ignore list in NFOHump forums, where posts actually disappear. // @author Leo Natan // @match *://nfohump.com/forum/* // @match *://www.nfohump.com/forum/* // @grant none // @downloadURL https://raw.githubusercontent.com/LeoNatan/NFOHump/master/IgnoreList/NFOHumpIgnoreList.user.js // @updateURL https://raw.githubusercontent.com/LeoNatan/NFOHump/master/IgnoreList/NFOHumpIgnoreList.user.js // @position 1 // @noframes // @run-at document-end // ==/UserScript== (() => { if(window.$ == undefined) { return; } const className = "hiddenByNFOHumpIgnore"; const supportClassName = "supportForNFOHumpIgnore"; if(localStorage.blocklist === null || localStorage.blocklist === undefined) { localStorage.blocklist = ""; } if(localStorage.isBlocklistEnabled === null || localStorage.isBlocklistEnabled === undefined) { localStorage.isBlocklistEnabled = "true"; } const anchor = $('Hidden users').click(function() { var q = prompt("Ignored users are hidden automatically.\n\nEnter a comma-separated list of additional users to hide:", localStorage.blocklist); if(q === null) { return; } if (q != localStorage.blocklist) { localStorage.blocklist = q; resetAndHideElements(); } }); const checkbox = $('').click(function () { localStorage.isBlocklistEnabled = (localStorage.isBlocklistEnabled == "true" ? "false" : "true"); resetAndHideElements(); }); const ul = $('#leftdiv > div.menuLeftContainer:first > ul'); const hiddenThreads = ul.find(".hiddethreadsli").first(); const newMenuItem = $('
  • ').append(anchor).append(checkbox); if(hiddenThreads[0] != undefined) { hiddenThreads.before(newMenuItem); } else { ul.append(newMenuItem); } const ignoreUser = $('
  • Hide User
  • ').click(function(e) { const clickedUserName = $(e.target).parent().parent().parent().parent().parent().parent().parent().parent().parent().find("a[title^='click to insert']").text(); var arr = $.grep($.map(localStorage.blocklist.split(','), function(v) { return $.trim(v); }), function(e) { return e !== clickedUserName; }); arr.push(clickedUserName); localStorage.blocklist = arr.join(', '); resetAndHideElements(); return false; }); const userParents = $("a:contains('Ignore User')").parent(); userParents.before(ignoreUser); const userParentsAlreadyIgnored = $("a:contains('Un-ignore User')").parent(); userParentsAlreadyIgnored.before(ignoreUser); function hideElements() { if(window.location.href.includes('/viewtopic.php') == false) { return; } let seed = Date.now(); $('#userav > b > i').each(function() { const x = $(this).parents('td:eq(0)').parent(); x.addClass(className); x.hide(); x.next().addClass(className); x.next().hide(); x.next().next().addClass(className); x.next().next().hide(); }); if(!(localStorage['blocklist'] && localStorage['blocklist'].length > 0)) { return; } $.each(localStorage.blocklist.split(','), function(k,v) { v = $.trim(v); $('span.genmed:contains("' + v + '")').each(function() { if($(this).text().startsWith(v) != true) { return; } const x = $(this).parent().parent().parent().parent(); if(x.hasClass(className)) { return; } x.addClass(className); if($(x[0]).parents('#userSig').length == 0) { const y = $('
    This is a quote of a hidden user
    '); y.addClass(supportClassName); y.insertBefore(x); } x.hide(); }); $('span.nav > b > a:contains("' + v + '")').each(function() { if($(this).text() !== v) { return; } const x = $(this).parents('td:eq(0)').parent(); if(x.hasClass(className)) { return; } x.addClass(className); x.hide(); x.next().addClass(className); x.next().hide(); x.next().next().addClass(className); x.next().next().hide(); }); }); } function resetHiddenElements() { $('.' + supportClassName).remove(); $('.' + className).each(function () { $(this).removeClass(className); $(this).show(); }); } function resetAndHideElements() { resetHiddenElements(); if (localStorage.isBlocklistEnabled == "true") { hideElements(); } //Rerun the video embedding script to fixup hidden posts. if(window.__api_applyEmbedding) { window.__api_applyEmbedding(); } } resetAndHideElements(); })();