Greasy Fork

Greasy Fork is available in English.

起点中文网/百度/网易云去除推荐/搜索热点列表/评论插件

点击按钮屏蔽百度首页及搜索页面的新闻、热点;屏蔽起点中文网的书籍推荐。

当前为 2019-03-19 提交的版本,查看 最新版本

// ==UserScript==
// @name         起点中文网/百度/网易云去除推荐/搜索热点列表/评论插件
// @namespace    http://greasyfork.icu/
// @version      0.2.3
// @description  点击按钮屏蔽百度首页及搜索页面的新闻、热点;屏蔽起点中文网的书籍推荐。
// @author       sanjie27
// @match        https://book.qidian.com/*/*
// @match        https://www.qidian.com/
// @match        https://www.baidu.com/*
// @match        https://music.163.com/*
// @run-at       document_start
// @grant        unsafeWindow
// @grant        GM_setClipboard
// @grant        GM_addStyle
// @grant        GM_getResourceText
// @require      https://code.jquery.com/jquery-1.8.2.min.js
// @resource     http://jqueryui.com/resources/demos/style.css
// @resource     customCSS https://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    var newCSS = GM_getResourceText ("customCSS");
    GM_addStyle (newCSS);

    //创建按钮并插入
    var mybutton = document.createElement("button");
    mybutton.innerHTML = '<button type = button>是否显示推荐的列表?</button>';
    $("div:first").before(mybutton);

    $(".cmmts*").hide();//如果想要显示评论,请注释这一行



    //点击按钮切换
    $("button").toggle(
        function(){
            $("li").hide();
            $("th").hide();
            $("h2").hide();
            $(".itm").hide();
            $("ul").hide();
            $(".cmmts*").hide();


            $(".opr-recommends-merge-content").hide();
            $(".cr-content").hide();
            $(".itm").hide();
            $("ul").hide();

            mybutton.innerHTML = '<button type = button>已隐藏(再次点击显示)</button>';
            $("button").css("background-color","yellow");},
        function(){
            $("li").show();
            $("th").show();
            $("h2").show();
            $(".opr-recommends-merge-content").show();
            $(".cr-content").show();
            $(".itm").show();
            $("ul").show();
            $(".cmmts*").hide();



            mybutton.innerHTML = '<button type = button>已显示(再次点击隐藏)</button>';
            $("button").css("background-color","#c0c0c0");},
    );

    //创建日期选择框
    //var date = '<input type="text" id="datepicker" style = "color:red;position:relative;z-index:99999">';
    //$("div:first").after(date);
    //$( "#datepicker" ).datepicker();

    //实现鼠标点击特效
    var html = document.getElementsByTagName("html")[0];
    var body = document.getElementsByTagName("body")[0];
    var click_counts = 0;
    html.onclick = function(e) {
        var $elem = document.createElement("h3");
        $elem.style.color = "#87CEEB";
        $elem.style.zIndex = 9999;
        $elem.style.position = "absolute";
        var x = e.pageX;
        var y = e.pageY;
        $elem.style.left = (x - 20) + "px";//控制$elem距离屏幕左边和上边的距离,其实是为了让其离光标远一点,避免遮挡
        $elem.style.top = (y - 20) + "px";
        $elem.innerText = "Great!";//可以自定义显示内容
        switch (++click_counts) {
            case 2:
                $elem.innerText = "OωO";
                break;
            case 5:
                $elem.innerText = "(๑•́ ∀ •̀๑)";
                break;
            default:
                $elem.innerText = "Great!";
                break;
        }

        var increase = 0;
        setTimeout(function() {
            var anim = setInterval(function() {
                if (increase == 150) {//这个是控制去掉elem的时间
                    clearInterval(anim);
                    body.removeChild($elem);
                }
                else{
                    increase++;
                    $elem.style.opacity = (150 - increase) / 90;//透明度
                    $elem.style.top = y - 30 - increase + "px";//控制往上面的距离
                }
            }, 5);//控制函数调用的速度,单位是毫妙
        }, 70);//给定的毫秒后再调用setInternal函数
        body.appendChild($elem);
    };
})();