Greasy Fork

Greasy Fork is available in English.

CSDN助手

隐藏CSDN的下载item

当前为 2021-08-01 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         CSDN助手
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  隐藏CSDN的下载item
// @author       You
// @match        https://blog.csdn.net/*/article/details/*
// @match        https://www.baidu.com/s?*
// @icon         https://www.google.com/s2/favicons?domain=csdn.net
// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    //隐藏CSDN的下载item
    $('.type_download').hide()

    // 3秒后执行  在百度搜索油猴插件渲染后执行
    setTimeout(findDownload, 3000);

    $(window).scroll(function () {
        //为了保证兼容性,这里取两个值,哪个有值取哪一个
        //scrollTop就是触发滚轮事件时滚轮的高度
        var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
        if (scrollTop > 300) {
            findDownload();
        }
        //console.log("滚动距离" + scrollTop);
    });

    // 找出百度搜索结果中的下载项
    // csdn 下载
    function findDownload() {
        // debugger; //开启调试
        let $blocks = $(".result .user-avatar");
        $blocks.each(function (index, item) {
            let href = $(this).children("a").attr("href");
            //console.log(`输出${index + 1}=>${href}`);
            if (href.includes("download.csdn")|| href.includes('iteye.com/resource')) {
                $(this).css("background", "red");
                //console.log(`标红了第${index + 1}个=>${href}`);
            }
        });
    }


})();