Created
September 4, 2025 14:19
-
-
Save chapmanjacobd/6c53e480eccf99188fde43301fb3b9f4 to your computer and use it in GitHub Desktop.
MangaPlus Spacebar Navigation
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 MangaPlus Spacebar Navigation | |
| // @namespace http://tampermonkey.net/ | |
| // @version 1.4 | |
| // @description Use space/shift+space to simulate clicks for MangaPlus navigation. | |
| // @author You | |
| // @match https://mangaplus.shueisha.co.jp/viewer/* | |
| // @grant none | |
| // ==/UserScript== | |
| let lastMouseX = 0; | |
| let lastMouseY = 0; | |
| document.addEventListener('mousemove', (event) => { | |
| lastMouseX = event.clientX; | |
| lastMouseY = event.clientY; | |
| }); | |
| document.addEventListener('keydown', (event) => { | |
| if (event.key === ' ') { | |
| event.preventDefault(); | |
| event.stopPropagation(); | |
| let x = lastMouseX; | |
| let y = lastMouseY; | |
| if (event.shiftKey) { | |
| // Flip horizontally across the viewport → simulate clicking on the other side | |
| x = window.innerWidth - lastMouseX; | |
| } | |
| const target = document.elementFromPoint(x, y); | |
| if (target) { | |
| const clickEvent = new MouseEvent('click', { | |
| bubbles: true, | |
| cancelable: true, | |
| view: window, | |
| clientX: x, | |
| clientY: y | |
| }); | |
| target.dispatchEvent(clickEvent); | |
| } | |
| } | |
| }, true); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
actually... this works better. the problem is that
bodyis blocking the real scroll container