🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

微信读书 滑轮 翻页

鼠标滑轮翻页

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name         微信读书 滑轮 翻页
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  鼠标滑轮翻页
// @author       You
// @match        https://weread.qq.com/*
// @icon         https://rescdn.qqmail.com/node/wr/wrpage/style/images/independent/favicon/favicon_16h.png
// @grant        none
// @license MIT
// ==/UserScript==

// api           https://www.tampermonkey.net/documentation.php

(function () {
    "use strict";

    let scrollEnabled = true; // 控制滚轮监听的标志

    // 侦听滚轮事件
    window.addEventListener("wheel", (e) => {
        // 如果禁用了滚轮事件则不做任何处理
        if (!scrollEnabled) return;

        if (e.deltaY > 0) {
            document.querySelector(".renderTarget_pager_button_right").click();
        } else if (e.deltaY < 0) {
            document.querySelector(".renderTarget_pager_button").click();
        } else if (e.deltaX < 0) {
            // 向右滚动,尝试点击“上一页”按钮
            document.querySelector(".renderTarget_pager_button").click();
        } else if (e.deltaX > 0) {
            // 向左滚动,尝试点击“下一页”按钮
            document.querySelector(".renderTarget_pager_button_right").click();
        }
    });

    // 检查窗口是否已打开
    function isWindowOpen() {
        const panel = document.querySelector(".reviews_panel");
        // 判断该元素的display属性是否为none
        return window.getComputedStyle(panel).display !== "none";
    }

    // 定期检查窗口状态,启用或禁用滚轮事件
    setInterval(() => {
        if (isWindowOpen()) {
            scrollEnabled = false; // 窗口打开时禁用滚轮事件
        } else {
            scrollEnabled = true;  // 窗口关闭时启用滚轮事件
        }
    }, 100); // 每100毫秒检查一次窗口状态

    const style = document.createElement("style");
    style.innerText = ".reader_pdf_tool { display: none !important }";
    document.body.appendChild(style);
})();