HDPornComics Keyboard Support

Allows to change pages left and right by pressing the keys A/D

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
  1. // ==UserScript==
  2. // @name HDPornComics Keyboard Support
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-11-22
  5. // @description Allows to change pages left and right by pressing the keys A/D
  6. // @author Manu
  7. // @match https://hdporncomics.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=hdporncomics.com
  9. // @license MIT
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. window.addEventListener("keypress",(e)=>{
  16. const btnL = document.querySelector(".pswp__button--arrow--left");
  17. const btnR = document.querySelector(".pswp__button--arrow--right");
  18. if(!btnL || !btnR) return;
  19. switch (e.key) {
  20. case "a":
  21. console.log("KEY A PRESSED");
  22. btnL.click();
  23. break;
  24. case "d":
  25. console.log("KEY D PRESSED");
  26. btnR.click();
  27. break;
  28. default:
  29. console.log(e.key);
  30. break;
  31. }
  32. })
  33. })();