Greasy Fork

Greasy Fork is available in English.

起点中文网去除推荐;百度去除搜索热点列表;网易云、B站去除评论

这个脚本的功能有:起点中文网去除推荐;百度去除搜索热点列表;网易云、B站去除评论插件

当前为 2019-04-06 提交的版本,查看 最新版本

// ==UserScript==
// @name         起点中文网去除推荐;百度去除搜索热点列表;网易云、B站去除评论
// @namespace    http://greasyfork.icu/
// @version      0.2.5
// @description  这个脚本的功能有:起点中文网去除推荐;百度去除搜索热点列表;网易云、B站去除评论插件
// @author       sanjie27
// @match        https://book.qidian.com/*/*
// @match        https://www.qidian.com/
// @match        https://www.baidu.com/*
// @match        https://music.163.com/*
// @match        https://www.bilibili.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==

//本脚本参考学习的脚本
//获取网易云封面链接参考了zszen的163 Music Downloader 网易云音乐下载助手
//

(function () {
    'use strict';
    class Date {
        constructor() {
        }
        insertDate() {
            var date = '<input type="text" id="datepicker" style = "color:dodgerblue;position:relative;z-index:99999">';
            $("div:first").after(date);
            $("#datepicker").datepicker();
        }
    }

    class Button {
        constructor() {
        }

        insertButton() {
            var mybutton = document.createElement("button");

            mybutton.innerHTML = '<button type = button id = "mybutton">是否显示推荐的列表?</button>';
            $("div:first").before(mybutton);

            $("button").toggle(
                function () {
                    $("li, th, h2, itm, ul, .opr-recommends-merge-content .cr-content, .rec-list").hide();
                    $("#live_recommand_report").hide();//隐藏B站右侧直播推荐
                    mybutton.innerHTML = '<button type = button>已隐藏(再次点击显示)</button>';
                    $("button").css("background-color", "yellow");
                },
                function () {
                    $("li, th, h2, itm, ul, .opr-recommends-merge-content .cr-content, .rec-list").show();
                    $("#live_recommand_report").show();
                    mybutton.innerHTML = '<button type = button>已显示(再次点击隐藏)</button>';
                    $("button").css("background-color", "#c0c0c0");
                },
            );

        }
    }

    class MouseEffect {
        constructor() {
        }

        creatMouseEffect() {
            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);
            };

        }
    }

    class Music {
        construtor() {
        }

        getId() {
            var id = window.location.href.split('=')[1];
            return id;
        }

        getUrl(id) {
            var str1 = "http://music.163.com/song/media/outer/url?id=";
            var str2 = ".mp3"
            return str1 + id + str2;
        }

        insert(url, elem) {
            var element = '<a href="' + url + '"><font color="red">歌曲下载</font></a>';
            $("#content-operation", iframe[0].contentWindow.document.body).append(element);

            var album = $("#g_iframe").contents().find(".u-cover.u-cover-6.f-fl>img");
            var element2 = '<a href="' + album.attr("data-src") + '"><font color="blue">封面下载</font></a>';
            $("#content-operation", iframe[0].contentWindow.document.body).append(element2);

        }

        hideComments() {
            $(".cmmts.j-flag").hide();//如果想要显示评论,请注释这一行
        }

        hideHead() {
            $(".head").hide();
        }

        hideTime() {
            $(".time.s-fc4").hide();
        }

        hideUsername() {
            $(".s-fc7").hide();
        }

        hideContents() {
            $(".cnt.f-brk, .que.f-brk.f-pr.s-fc3").hide();
        }

        hideReply() {
            $(".s-fc3").hide();
        }

        hideAgree() {
            $(".zan.u-icn2.u-icn2-12").hide();
        }
        get prop() {
            return 'getter';
        }
        set prop(value) {
            console.log('setter: '+value);
        }
    }

    class Bili{
        constructor(){}
        hideComments(){
            $(".comment*").hide();

        }
    }

    function addStyle(rules) {
        var styleElement = document.createElement('style');
        styleElement.type = 'text/css';
        document.getElementsByTagName('head')[0].appendChild(styleElement);
        styleElement.appendChild(document.createTextNode(rules));
    }

    var iframe = $("#g_iframe");
    var mymusic = new Music();
    iframe.on('load', function () {
        var url = mymusic.getUrl(mymusic.getId());
        if (window.location.href.search(".*://music\\.163\\.com/#/song\\?id=\\d+") != -1) {
            mymusic.insert(url, iframe);
        }
    });
    mymusic.hideComments();

    //addStyle('*{font-family : "方正瘦金书简体","FZShouJinShu-S10S" !important;' +
    //         'font-weight:900 !important;}');
    addStyle('a:hover{color: #00ff !important;' +
             'transition: all 0.25s ease-out;}')

    var button = new Button();
    button.insertButton();

    var bili = new Bili();
    bili.hideComments();
})();