Qzone Cleaner

屏蔽QQ空间广告等,屏蔽/只看一些用户的点赞,点赞并隐藏一些用户的动态。

目前為 2020-08-22 提交的版本,檢視 最新版本

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Qzone Cleaner
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  屏蔽QQ空间广告等,屏蔽/只看一些用户的点赞,点赞并隐藏一些用户的动态。
// @author       H-OH
// @match        https://*.qzone.qq.com/*
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==


(function() {
    'use strict';
    var only=false;
    function killname()
    {
        var use=GM_getValue("killname","")+"\n";
        var add="";
        var name=new Array();
        for (var c=0;c<use.length;c++)
        {
            if (use[c]=="\n")
            {name[name.length]=add;add="";}
            else
            {add+=use[c];}
        }
        var tokill=document.querySelectorAll(".user-list > a");
        for (var t=0;t<tokill.length;t++)
        {
            var flag=false;
            for (var s=0;s<name.length;s++)
            {
                if (tokill[t].innerText==name[s])
                {flag=true;break;}
            }
            if (flag^only)
            {
                tokill[t].style.display="none";
                if (tokill[t].nextSibling!=null)
                {tokill[t].nextSibling.data="";}
            }
            else
            {
                tokill[t].style.display="inline";
                if (tokill[t].nextSibling!=null)
                {tokill[t].nextSibling.data="、";}
            }
        }
    }
    function killname1()
    {
        var use=GM_getValue("killname1","")+"\n";
        var add="";
        var name=new Array();
        for (var c=0;c<use.length;c++)
        {
            if (use[c]=="\n")
            {name[name.length]=add;add="";}
            else
            {add+=use[c];}
        }
        var tokill=document.getElementsByClassName("f-single f-s-s");
        for (var t=0;t<tokill.length;t++)
        {
            var flag=false;
            for (var s=0;s<name.length;s++)
            {
                if (tokill[t].children[0].children[3]!=undefined&&tokill[t].children[0].children[3].children[0].children[0].innerText==name[s])
                {flag=true;break;}
            }
            if (flag)
            {
                if (tokill[t].children[2].children[0].children[0].children[4].className=="item qz_like_btn_v3 ")
                {tokill[t].children[2].children[0].children[0].children[4].children[0].click();}
                tokill[t].style.display="none";
            }
            else
            {tokill[t].style.display="block";}
        }
    }


    //按class屏蔽
    var killclass=["user-vip-info","icon-vip","menu_item_2","menu_item_334","menu_item_1","menu_item_305","menu_item_more"];
    for (var I=0;I<killclass.length;I++)
    {
        var Tokill=document.querySelectorAll("."+killclass[I]);
        for (var J=0;J<Tokill.length;J++)
        {Tokill[J].style.display="none";}
    }

    //按id屏蔽
    var killid=["QM_Container_333","QM_Container_31","tb_index_li","tb_friend_li","tb_app_li","tb_dress_li","tb_music_li","qz-head-level","leftMenu"];
    for (var i=0;i<killid.length;i++)
    {
        var _Tokill=document.querySelectorAll("#"+killid[i]);
        for (var j=0;j<_Tokill.length;j++)
        {_Tokill[j].style.display="none";}
    }


    window.setInterval(killname,100);
    window.setInterval(killname1,100);
    if (document.querySelectorAll("#leftMenu").length)
    {
        var set=document.createElement("div");
        set.innerHTML="<p>屏蔽以下用户点赞:</p><textarea id=\"name\" placeholder=\"屏蔽列表\" style=\"height:250px\"></textarea><button id=\"save\" style=\"width:140px;height:30px\">保存</button>";
        set.innerHTML+="<br><input type=\"checkbox\" id=\"only\" style=\"zoom:120%\"><span>反向屏蔽</span>";
        set.innerHTML+="<br><br><p>点赞并隐藏以下用户动态:</p><textarea id=\"name1\" placeholder=\"屏蔽列表\" style=\"height:250px\"></textarea><button id=\"save1\" style=\"width:140px;height:30px\">保存</button>";
        document.getElementById("pageContent").appendChild(set);
        document.getElementById("name").value=GM_getValue("killname","");
        document.getElementById("save").onclick=function()
        {
            GM_setValue("killname",document.getElementById("name").value);
            document.getElementById("save").innerText="已保存";
            setTimeout(function(){document.getElementById("save").innerText="保存";},2000);
        }
        document.getElementById("name1").value=GM_getValue("killname1","");
        document.getElementById("save1").onclick=function()
        {
            GM_setValue("killname1",document.getElementById("name1").value);
            document.getElementById("save1").innerText="已保存";
            setTimeout(function(){document.getElementById("save1").innerText="保存";},2000);
        }
    }
    if (GM_getValue("killonly","false")=="true")
    {only=true;}
    if (document.querySelectorAll("#only").length)
    {
        if (only)
        {document.getElementById("only").checked=true;}
        document.getElementById("only").onclick=function()
        {
            if (document.getElementById("only").checked)
            {GM_setValue("killonly","true");only=true;}
            else
            {GM_setValue("killonly","false");only=false;}
        }
    }
})();