Hide BPL Trolls and other junk

Cleanup new BPL

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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;
            }
        }
     });

});