百度删帖管理

try to take over the world!

目前为 2018-06-01 提交的版本。查看 最新版本

// ==UserScript==
// @name         百度删帖管理
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        *tieba.baidu.com/pmc*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var url = window.location.href.split("?")[0];
    if(url.length == url.indexOf("pmc") + 3){
        window.location.href = "http://tieba.baidu.com/pmc/recycle?tab=system";
    }
    // 0:都隐藏,1:不隐藏,2:隐藏已删除,3:隐藏恢复中
    // 读取cookie
    var hideNum = Number(getCookie("hideNum")) || 0;
    // 是否隐藏已删除(根据cookie)
    var hideCantSave = isNaN(hideNum) ? true : hideNum % 2 == 0;
    // 是否隐藏申诉中(根据cookie)
    var hideSaving = isNaN(hideNum) ? true : hideNum % 3 == 0;
    // 已删除列表(本地)
    var hideList = [
        "相信我,这东西销量一定不怎么好",
        "我在模拟器上也遇到过这种问题",
        "经常坐飞机的人就知道20100表示什么了",
        "回复 不单推百合娘ლ :",
        "看样子阁下不在国内",
        "在下试了很多威屁恩,所有11区节点全部",
        "我在模拟器上也遇到过这种问题,",
        "相信我,这东西销量一定不怎么好<br>然"
    ];
    function isInArray(array, item){
        if(array.length > 0){
            for(var i = 0; i < array.length; i++){
                if(item.indexOf(array[i]) > -1){
                    return true;
                }
            }
        }
        return false;
    }
    function addCookie(objName,objValue,objDays){ // objDays = 不填/数字/Infinity
        var str = objName + "=" + escape(objValue);
        if(objDays > 0){
            var date = new Date();
            var ms = objDays*24*3600*1000;
            date.setTime(date.getTime() + ms);
            str += "; expires=" + date.toGMTString();
        }
        if(objDays===Infinity){
            str += "; expires=Fri, 31 Dec 9999 23:59:59 GMT";
        }
        str += "; path=/";
        document.cookie = str;
    }
    function getCookie(name){
        var arr, reg = new RegExp("(^| )"+name+"=([^;]*)(;|$)");
        if((arr = document.cookie.match(reg))){
            return unescape(arr[2]);
        }else {
            return null;
        }
    }
    var btn1 = "<input id='hideCantSave' type='checkbox' " + (hideCantSave ? "checked" : "") + "/>隐藏已删除";
    var btn2 = "<input id='hideSaving' type='checkbox' " + (hideSaving ? "checked" : "") + "/>隐藏恢复中";
    $("div.panel_notice").after("<div class='panel_notice'>" + btn1 + "&nbsp;" + btn2 + "</div>");
    $("#hideCantSave").click(function(e){
        hideCantSave = e.target.checked;
        for(var i = 0; i < 4; i++){
            if(i % 2 != hideCantSave && i % 3 != hideSaving){
                addCookie("hideNum", i, Infinity);
                location.reload();
                break;
            }
        }
    });
    $("#hideSaving").click(function(e){
        hideSaving = e.target.checked;
        for(var i = 0; i < 4; i++){
            if(i % 2 != hideCantSave && i % 3 != hideSaving){
                addCookie("hideNum", i, Infinity);
                location.reload();
                break;
            }
        }
    });
    var eventId = setInterval(function(){
        if($("span.del-reason-sty").length){
            clearInterval(eventId);
            $("span.pm_post_content").each(function(i, o){
                var info = $(o).parent().next().next().html();
                if(hideSaving && $(o).parent().next().next().next().html().indexOf("等待人工恢复") > -1){
                    $(o).parent().parent().html("<td class='pm_recycle_content' colspan='6' style='height:20px;color:grey;'>此条消息等待恢复中 (" + info + ")</td>");
                }
                if(hideCantSave && isInArray(hideList, $(o).html())){
                    $(o).parent().parent().html("<td class='pm_recycle_content' colspan='6' style='height:20px;color:grey;'>此条消息主楼已删除 (" + info + ")</td>");
                }
            });
        }
    }, 100);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址