降低国内流氓软件站的威胁程度

移除在百度、360搜索下载软件时,搜索结果出现的“立即下载”模块,移除360搜索的“360软件宝库”;为百度、360搜索“官网”增加提示

目前為 2021-02-14 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         降低国内流氓软件站的威胁程度
// @namespace    https://blog.imyqs.com/
// @version      0.1.6
// @description  移除在百度、360搜索下载软件时,搜索结果出现的“立即下载”模块,移除360搜索的“360软件宝库”;为百度、360搜索“官网”增加提示
// @author       FrankYu
// @match        *://*.baidu.com/*
// @match        *://*.so.com/*
// @grant        unsafeWindow
// @require      https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js
// @run-at       document-idle
// @license      CC by-4.0
//
// ==/UserScript==

(function () {
    'use strict';
    /**
     * 用户自定义模块是否启用,启用为True,不启用为False,默认全部启用。
     */

    var enable_BaiduDownload = true;            //百度搜索结果出现的“立即下载”模块
    var enable_360Download = true;              //360搜索结果出现的“立即下载”模块
    var enable_360Software = true;              //360搜索结果出现的“360软件宝库”模块
    var enable_Official_Enhance = true;         //增强百度、360搜索结果中的“官方”标识

    //百度搜索界面“立即下载”模块移除
    function kill_baidu_download() {
        if (window.location.href.indexOf('baidu.com') != -1) {
            //每秒检测是否存在广告,如果存在广告,则删除广告。
            setInterval(function () {
                if ($("[class^='pc-down_']").length != 0) {
                    $("[class^='pc-down_']").hide(500)
                    console.log('执行成功!');
                } else {
                    console.log("该Baidu网页没有发现“立即下载”模块。");
                }
            }, 1000)
        } else {
            console.log('非百度搜索界面');
        }
    }

    //360搜索界面“立即下载”模块移除
    function kill_360_download() {
        if (window.location.href.indexOf('so.com') != -1) {
            //每秒检测是否存在广告,如果存在广告,则删除广告。
            setInterval(function () {
                if ($('#mohe-softbox').length != 0) {
                    $('#mohe-softbox').hide(500);
                    console.log('执行成功!');
                } else {
                    console.log("该360网页没有发现“立即下载”模块。");
                }
            }, 700)
        } else {
            console.log('非360搜索界面');
        }
    }

    //360搜索界面“360软件宝库”模块
    function kill_360_software() {
        if (window.location.href.indexOf('so.com') != -1) {
            setInterval(function () {
                if ($('#mohe-relation_soft').length != 0) {
                    $('#mohe-relation_soft').hide(500);
                    console.log('执行成功!');
                } else {
                    console.log("该360页面没有发现“360软件宝库”模块");
                }
            }, 700);
        } else {
            console.log('非360搜索界面');
        }
    }

    //为百度搜索和360搜索界面的“官网”的添加更显眼的标记
    function Official_Enhance() {
        if (window.location.href.indexOf('baidu.com') != -1) {
            setInterval(function () {
                if ($('#warning').length == 0) {
                    if ($('h3.t:first-child > a.OP_LOG_LINK.c-text.c-text-public.c-text-mult.c-gap-left-small:last-child').length != 0) {
                        $('h3.t:first-child > a.OP_LOG_LINK.c-text.c-text-public.c-text-mult.c-gap-left-small:last-child').after('<p id=\'warning\' style=\'border:1px solid red;border-radius:10px;background-color:red;' +
                            'font-size:large;text-align:center;padding:5px 0 5px 0;color:white\'>⚠&nbsp' +
                            '<strong style=\'font-style:italic\'>注意,这里是官方网站,如需下载软件,请选择该条目!</strong>&nbsp⚠</p>');
                        console.log('百度搜索“Official_Enhance”执行成功!');
                    } else {
                        console.log("该Baidu搜索结果没有发现“官网”标记。。。");
                    }
                } else {
                    console.log('已经添加了标记。');
                }
            }, 2000);
        } else if (window.location.href.indexOf('so.com') != -1) {
            setInterval(function () {
                if ($('#warning').length == 0) {
                    if ($('span.icon-official').length != 0) {
                        $('span.icon-official').after("<p id=\'warning\' style=\"border:1px solid red;border-radius:10px;background-color:red;" +
                            "font-size:large;text-align:center;padding:5px 0 5px 0;color:white\">⚠&nbsp" +
                            "<strong style=\"font-style:italic\">注意,这里是官方网站,如需下载软件,请选择该条目!</strong>&nbsp⚠</p>");
                        console.log('360搜索“Official_Enhance”执行成功!');
                    } else {
                        console.log("该360搜索结果没有发现“官网”标记。。。");
                    }
                } else {
                    console.log('已经添加了标记。');
                }
            }, 2000);
        } else {
            console.log('非Baidu、360界面。。。')
        }
    }

    //模块调用判定
    if (enable_BaiduDownload) {
        kill_baidu_download();
    }

    if (enable_360Download) {
        kill_360_download();
    }

    if (enable_360Software) {
        kill_360_software();
    }

    if (enable_Official_Enhance) {
        Official_Enhance();
    }

})();