上下滚动按钮

Script to scrollBy to top/bottom

Verze ze dne 30. 08. 2024. Zobrazit nejnovější verzi.

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

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 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   Violentmonkey Scripts
// @match       *://*/*
// @grant       none
// @version 1.0.0.7
// @author      人民的勤务员 <[email protected]>  & d3ward 
// @description Script to scrollBy  to top/bottom 
// @supportURL              https://github.com/ChinaGodMan/UserScripts/issues
// @homepageURL   https://github.com/ChinaGodMan/UserScripts
// ==/UserScript==

//Variable to set how much to scroll
var sH = (window.innerHeight) - 50

//top button
var topBtn = document.createElement('span')
topBtn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 444.8 444.8" fill="#adadad"><path d="M434 278.7L248.4 92.8c-7.4-7-16.1-10.6-26-10.6 -10.1 0-18.7 3.5-25.7 10.6L10.8 278.7C3.6 285.9 0 294.5 0 304.6c0 10.3 3.6 18.8 10.8 25.7l21.4 21.4c6.9 7.2 15.4 10.9 25.7 10.9 10.3 0 18.8-3.6 25.7-10.9L222.4 213.3 361.2 351.7c6.8 7.2 15.4 10.9 25.7 10.9 10.1 0 18.7-3.6 26-10.9l21.4-21.4c7-7 10.6-15.6 10.6-25.7C444.8 294.5 441.2 285.9 434 278.7z"/></svg>'
topBtn.style.cssText = 'text-align:center;background:#191919;border-radius:8px;color:#000000;cursor:pointer;position:fixed;bottom:50%;width:36px;height:36px;right:10px;z-index:9999'
topBtn.addEventListener('click', function () { window.scrollBy({ top: -sH, behavior: 'smooth' }) }, false)
document.body.appendChild(topBtn)

//bottom button
var bottomBtn = document.createElement('span')
bottomBtn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 444.8 444.8" fill="#adadad"><path d="M434.3 114.2l-21.4-21.4c-7.4-7-16.1-10.6-26-10.6 -10.1 0-18.7 3.5-25.7 10.6L222.4 231.5 83.7 92.8c-7-7-15.6-10.6-25.7-10.6 -9.9 0-18.6 3.5-26 10.6l-21.1 21.4C3.6 121.4 0 130.1 0 140.2c0 10.3 3.6 18.8 10.8 25.7l185.9 185.9c6.9 7.2 15.4 10.8 25.7 10.8 10.1 0 18.8-3.6 26-10.8l185.9-185.9c7-7 10.6-15.6 10.6-25.7C444.8 130.3 441.3 121.6 434.3 114.2z"/></svg>'
bottomBtn.style.cssText = 'text-align:center;background:#191919;border-radius:8px;color:#000000;cursor:pointer;position:fixed;bottom:45%;width:36px;height:36px;right:10px;z-index:9999'//top:52%;
bottomBtn.addEventListener('click', function () { window.scrollBy({ top: sH, behavior: 'smooth' }) }, false)
document.body.appendChild(bottomBtn)