Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

139
Visualizações
how to implement or improve a "killfile" for stack exchange?

SE doesn't have any killfile capability to hide posts by trolls and other abusive people. And, unfortunately, blocking such trolls can't be done with CSS hacks alone (because there's nothing in the CSS which distinguishes a troll from a normal person). Blocking trolls need to be done by matching their usernames in the actual text of the post or comment, so it requires javascript and a userscript manager like grease/tamper/violent-monkey.

I've come up with the following (based on the same code I've used for other sites to hide advertorial garbage hiding amongst actual articles - no obvious CSS differences, but with identifiable author By-Lines), which mostly works but it doesn't interact perfectly with posts that have lots of comments - it breaks the "Show more comments" link. Not a huge problem, but I'd rather it didn't do that.

Update: Actually, it breaks the "Show more" link no matter how many comments there are, a bigger problem than I thought.

Does anyone have any idea what's causing it to do that, or how to fix it? Is it the div class for comments div.comment-text.js-comment-text-and-form that I'm targeting?

// ==UserScript==
// @name         Killfile Userscript for Stack Exchange
// @namespace    MonkeyScripts
// @version      0.1
// @description  Hide posts by abusive/irritating users
// @author       cas
// @match        https://*.stackexchange.com/*
// @match        https://*.stackoverflow.com/*
// @match        https://*.serverfault.com/*
// @match        https://*.superuser.com/*
// @match        https://*.askubuntu.com/*
// @require      https://code.jquery.com/jquery-2.1.0.min.js
// @grant        none
// ==/UserScript==

// hide posts and comments by particular authors

(function() {
      let Trolls = ['Ned Trollton','Angry Stalker','loser12345'];

      let elements = ['li.comment',
                      'div.answercell.post-layout--right',
                      'div.postcell.post-layout--right'];

      for (let i = 0; i < Trolls.length; i++) {
          for (let j = 0; j < elements.length; j++) {
              $(elements[j] + ":contains(" + Trolls[i] + ")").hide();
          }
    }
})();
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda