Greasy Fork

Greasy Fork is available in English.

NGA Red List

从https://nga.178.com/read.php?tid=23821517就能看出,论坛上NT太多,但是NGA自带的拉黑人数上限又太低。所以参考V2EX的RedList也做一个NGA版。

当前为 2020-10-22 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         NGA Red List
// @namespace    http://tampermonkey.net/
// @version      0.0.1
// @description  从https://nga.178.com/read.php?tid=23821517就能看出,论坛上NT太多,但是NGA自带的拉黑人数上限又太低。所以参考V2EX的RedList也做一个NGA版。
// @author       nyanpasus
// @match        *://nga.178.com/*
// @match        *://bbs.nga.cn/*
// @match        *://ngabbs.com/*
// @grant        GM_getValue
// @grant        GM_setValue
// @run-at       document-end
// ==/UserScript==
/* jshint esversion: 6 */
(function() {
    'use strict';

    let profileUid;
    let listName = 'nga-red-list';
    let uidList = GM_getValue(listName, "");
    let redList = uidList.split(';');
    let url = document.URL;
    let path = location.pathname;
    let buttonName = 'redButton';

    setTimeout(function() {
        function redsb() {
            let uidList = GM_getValue(listName, "");
            let redList = uidList.split(';');
            if (redList.indexOf(profileUid) >= 0) {
                GM_setValue(listName, uidList.replace(';' + profileUid, ''));
            } else {
                GM_setValue(listName, uidList + ';' + profileUid);
            }
            document.getElementById(buttonName).innerText = GM_getValue(listName, '').split(';').indexOf(profileUid) >= 0 ? '[取消拉红]' : '[拉红对方]';
        }

        if (path.startsWith('/thread.php')) {
            let homeList = document.getElementsByClassName('author');
            let len = homeList.length;
            for (let index = 0; index < len; index++) {
                let uid = homeList[index].title.split(' ')[1];
                if (redList.indexOf(uid) >= 0) {
                    homeList[index].parentElement.previousElementSibling.style.cssText += "background-image:url(https://i.loli.net/2019/06/09/5cfbebdfd083a19907.png);background-size:contain;";
                    homeList[index].parentElement.style.cssText += "background-image:url(https://i.loli.net/2019/06/09/5cfbebdfd083a19907.png);background-size:contain;";
                }
            }
        } else if (path.startsWith('/read.php')) {
            let commentList = document.getElementsByName('uid');
            let len = commentList.length;
            for (let index = 0; index < len; index++) {
                let uid = commentList[index].innerText;
                if (redList.indexOf(uid) >= 0) {
                    commentList[index].parentElement.parentElement.parentElement.style.cssText += "background-image:url(https://i.loli.net/2019/06/09/5cfbebdfd083a19907.png);background-size:contain;";
                    commentList[index].parentElement.parentElement.parentElement.nextElementSibling.style.cssText += "background-image:url(https://i.loli.net/2019/06/09/5cfbebdfd083a19907.png);background-size:contain;";
                }
            }
        } else if (path.startsWith('/nuke.php')) {
            console.info("abc");
            profileUid = document.getElementsByClassName('info')[0].firstElementChild.lastElementChild.innerText.split(':')[1].trim();
            let buttonContainer = document.getElementsByClassName('actions')[0];
            let constructLi = document.createElement('li');
            constructLi.setAttribute('style','padding-right: 5px;');
            let constructSpan = document.createElement('span');
            let constructA = document.createElement('a');
            constructA.setAttribute('href','javascript:void(0)');
            constructA.setAttribute('id', buttonName);
            constructA.innerText = redList.indexOf(profileUid) >= 0 ? '[取消拉红]' : '[拉红对方]';
            let lastDiv = document.getElementsByClassName(' clear')[4];
            constructSpan.appendChild(constructA);
            constructLi.appendChild(constructSpan);
            buttonContainer.insertBefore(constructLi, lastDiv);
            document.getElementById(buttonName).onclick= redsb;
        }
    }, 1000);
})();