Greasy Fork

Greasy Fork is available in English.

网易漫画“猜你喜欢”侧边栏自动隐藏

按钮颜色变暗

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         网易漫画“猜你喜欢”侧边栏自动隐藏
// @namespace    http://greasyfork.icu/zh-CN/scripts/28950-%E7%BD%91%E6%98%93%E6%BC%AB%E7%94%BB-%E7%8C%9C%E4%BD%A0%E5%96%9C%E6%AC%A2-%E4%BE%A7%E8%BE%B9%E6%A0%8F%E8%87%AA%E5%8A%A8%E9%9A%90%E8%97%8F
// @version      0.3.1
// @description  按钮颜色变暗
// @author       MaiJZ
// @supportURL   http://github.com/maijz128
// @match        https://manhua.163.com/reader/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';
    var recommand = document.getElementById('J_BookRecommand');
    var panel_btns = document.getElementsByClassName('panel-btn');
    var btn = document.getElementById('J_RecommandTrigger');
    var mousePosition = { x: 0, y: 0 };
    document.body.onmousemove = function (e) {
        e = event || window.event;
        mousePosition.x = e.clientX;
        mousePosition.y = e.clientY;
    };


    function show() {
        recommand.style.left = '0px';
    }
    function hide() {
        recommand.style.left = '-132px';
        btn.style.padding = '0px';
        btn.style.color = '#333';
    }
    function isShow() {
        if (recommand) {
            if (recommand.style.left == '0px') {
                return true;
            }
        }
        return false;
    }
    function isMouseOnBar() {
        if (mousePosition.x < 132) {
            return true;
        }
        
        return false;
    }
    function autoHide() {
        setInterval(function () {
            if (isShow() && !isMouseOnBar()) {
                setTimeout(hide, 1000);
            }
        }, 1000);

    }

    var count = 0;
    var inter = setInterval(function () {
        recommand = document.getElementById('J_BookRecommand');
        panel_btns = document.getElementsByClassName('panel-btn');
        btn = document.getElementById('J_RecommandTrigger');


        if (panel_btns) {
            for (var i = 0; i < panel_btns.length; i++) {
                panel_btns[i].style.color = "#333";
                panel_btns[i].style.background = "transparent";
            }
        }

        if (btn) {
            btn.addEventListener('click', function () {
                console.log('click J_RecommandTrigger');
            });
            hide();
            autoHide();

            clearInterval(inter);
        }

        if (count > 100) {
            clearInterval(inter);
        } else {
            count++;
        }
    }, 50);

})();