Created
June 28, 2024 17:54
-
-
Save sanjeed5/16998811c29e3e5e4413643f5196b8a3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Mangasee123 Fast Scroll | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.2 | |
| // @description Simulate Option + Down arrow when I just press down arrow on mangasee123.com with smooth scrolling. | |
| // @author You | |
| // @match https://mangasee123.com/* | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| function smoothScroll(duration, distance) { | |
| let start = null; | |
| const easeInOutQuad = (t) => t<.5 ? 2*t*t : 1-((t-1)*(t-1)*2); | |
| requestAnimationFrame(function step(timestamp) { | |
| if (!start) start = timestamp; | |
| const progress = timestamp - start; | |
| const easedProgress = easeInOutQuad(Math.min(progress / duration, 1)); | |
| window.scrollBy(0, distance * easedProgress); | |
| if (easedProgress < 1) { | |
| requestAnimationFrame(step); | |
| } | |
| }); | |
| } | |
| document.addEventListener('keydown', function(event) { | |
| if (event.keyCode === 40 && !event.ctrlKey && !event.shiftKey && !event.altKey) { | |
| // Down arrow pressed without modifiers (Ctrl, Shift, Alt) | |
| event.preventDefault(); | |
| smoothScroll(150, 300); // Adjust duration (ms) and scroll amount as needed | |
| } | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment