Eink-UpDown

Disable animation and add up and down button

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Eink-UpDown
// @namespace    https://greasyfork.org/users/169007
// @version      1.2.1
// @description  Disable animation and add up and down button
// @author       ZZYSonny
// @match        *://*/*
// @grant        none
// @run-at       document-body
// ==/UserScript==
(function () {
    'use strict';
    const body = document.body;
    const positionCSS = "bottom:0;right:0";
    const sizeCSS = "width:15vmin;height:30vmin";
    const scrollRatio = 0.9;

    const Container = document.createElement("div");
    Container.style.cssText = `
        ${sizeCSS};
        ${positionCSS};
        position:fixed;
        display:flex;
        flex-direction:column;
        border-style:dashed;
        z-index:2147483647;
        border-width:2px;
    `;

    const UpButton = document.createElement("div");
    UpButton.style.cssText = "flex:1";
    UpButton.addEventListener('click', () => { window.scrollBy(0, -scrollRatio * window.innerHeight) });

    const DownButton = document.createElement("div");
    DownButton.style.cssText = "flex:1;border-top-style:dashed;border-width:2px;";
    DownButton.addEventListener('click', () => { window.scrollBy(0, scrollRatio * window.innerHeight) });

    Container.appendChild(UpButton);
    Container.appendChild(DownButton);
    body.appendChild(Container);
})();