sex169论坛广告去除 (sex 169 ads remove function)

used for http://bbs.sex169.org/

// ==UserScript==
// @name         sex169论坛广告去除 (sex 169 ads remove function)
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  used for http://bbs.sex169.org/
// @author       You
// @match        http://*/*
// @license      MIT
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    let rmList = ['fastlg cl','wp a2_h','a_2mu','a_pb'];
    let rmIDList = ['hd', 'toptb'];

    rmIDList.forEach(rmFunction2);
    rmList.forEach(rmFunction);

    if(document.getElementsByClassName('plc').length > 0){
        let plcNode = document.getElementsByClassName('plc')[1];
    plcNode.parentNode.removeChild(plcNode);
    }
    let stickthreadIds = [];
    if(document.querySelectorAll('[id^=stickthread]').length > 0){
        document.querySelectorAll('[id^=stickthread]').forEach(rmFunction3)
    }
    if(stickthreadIds.length > 0){
        //console.log(stickthreadIds);
        stickthreadIds.forEach(rmFunction2);
    }

    function rmFunction(item, index) {
        if(document.getElementsByClassName(item).length > 0){
            document.getElementsByClassName(item)[0].parentNode.removeChild(document.getElementsByClassName(item)[0]);
        }
    }

    function rmFunction2(item, index) {
        if(document.getElementById(item)!=null){
            document.getElementById(item).parentNode.removeChild(document.getElementById(item));
        }
    }

    function rmFunction3(item, index) {
        stickthreadIds.push(document.querySelectorAll('[id^=stickthread]')[index].id);
    }
    // Your code here...
})();