Hide BPL Trolls and other junk

Cleanup new BPL

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Hide BPL Trolls and other junk
// @namespace   ffmike
// @description Cleanup new BPL
// @include     https://bplight.wpengine.com/*
// @include     https://backpackinglight.com/*
// @grant       none
// @version     1
// @domain      www.backpackinglight.com
// @license        CC0 1.0; https://creativecommons.org/publicdomain/zero/1.0/
// ==/UserScript==

// In part shamelessly based on https://greasyfork.org/en/scripts/48-maximumpc-troll-remover/code
$(function () {
    function addGlobalStyle(css) {
      var head, style;
      head = document.getElementsByTagName('head')[0];
      if (!head) { return; }
      style = document.createElement('style');
      style.type = 'text/css';
      style.innerHTML = css;
      head.appendChild(style);
    }
  
    console.log('Hiding subscription block and how the forums work');
    $("#text-28").hide();
    $("#text-29").hide();
    $("#text-32").hide();
    $("#text-34").hide();
    $("#menu-item-15").hide();
  
    console.log('Hiding related posts');
    addGlobalStyle('div.zem_rp_content { display: none ! important; }');

  console.log('Hiding trolls');
    var joList = ["tipiwalter",
                  "rosyfinch",
                 ];
    
    var joLength = joList.length;
    var numJoComments = 0;
                  
    var thisJo, userName, ref;
        
    // Rinse and repeat
    $("a").each(function(index, value) 
    {
        ref = value.href;
        var pieces = ref.split('/');
        userName = pieces[pieces.length - 2];
        for(var i=0; i<joLength; i++) 
        {
            if(userName == joList[i])
            {
                //console.log('Hiding ' + userName);
                $(this).closest('.reply').hide();
                break;
            }
        }
     });

});