// ==UserScript== // @name tbScroller // @namespace Scriptz (https://github.com/d3ward/scriptz) // @match *://*/* // @grant none // @version 1.0 // @author Eduard Ursu ( d3ward ) // @description Script to scrollBy to top/bottom // ==/UserScript== var position = "45%"; //Variable to set how much to scroll var sH = (window.innerHeight) - 100; var wrapper = document.createElement('div'); wrapper.style.cssText ='position:fixed;bottom:'+position+';right:10px;z-index:9999'; //top button var topBtn = document.createElement('span'); topBtn.innerHTML=''; topBtn.style.cssText ='display:block;text-align:center;background:#191919;border-radius:8px;color:#000000;cursor:pointer;width:36px;height:36px;margin-bottom:10px;'; topBtn.addEventListener('click', function(){window.scrollBy({top: -sH,behavior: 'smooth'})}, false); wrapper.appendChild(topBtn); //bottom button var bottomBtn = document.createElement('span'); bottomBtn.innerHTML=''; bottomBtn.style.cssText = 'display:block;text-align:center;background:#191919;border-radius:8px;color:#000000;cursor:pointer;width:36px;height:36px;'; bottomBtn.addEventListener('click', function(){ window.scrollBy({top: sH,behavior: 'smooth' });}, false); wrapper.appendChild(bottomBtn); document.querySelector('body').appendChild(wrapper);