Qzone Cleaner

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

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

您需要先安裝使用者腳本管理器擴展,如 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.1
// @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";tokill[t].nextSibling.data="";}
            else
            {tokill[t].style.display="inline";tokill[t].nextSibling.data="、";}
        }
    }

    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";}
    }
    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"];
    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);
    if (document.querySelectorAll("#leftMenu").length)
    {
        document.getElementById("leftMenu").innerHTML="<p>以下用户的点赞将被屏蔽:</p><textarea id=\"name\" placeholder=\"屏蔽列表\" style=\"height:250px\"></textarea><button id=\"save\" style=\"width:140px;height:30px\">保存</button>";
        document.getElementById("leftMenu").innerHTML+="<br><input type=\"checkbox\" id=\"only\" style=\"zoom:120%\"><span>反向屏蔽</span>";
        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);
        }
    }
    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;}
        }
    }
})();