ArrowKey Page Navigation for Asura Websites

navigate left and right previous page and next page

  1. // ==UserScript==
  2. // @name ArrowKey Page Navigation for Asura Websites
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.8
  5. // @description navigate left and right previous page and next page
  6. // @author icycoldveins
  7. // @match *://*.asura.gg/*
  8. // @match *://*.asura.nacm.xyz/*
  9. // @match *://*.asuracomics.com/*
  10. // @match *://*.asuratoon.com/*
  11. // @match *://*.asuracomic.net/*
  12.  
  13.  
  14.  
  15.  
  16. // @license MIT
  17. // @icon none
  18. // @grant none
  19. // ==/UserScript==
  20.  
  21. (function () {
  22. "use strict";
  23.  
  24. // Your code here...
  25. // ch-next-btn
  26. // ch-prev-btn
  27. //next page-numbers
  28. //prev page-numbers
  29.  
  30. // navigate using arrow left key and arrow right key
  31. document.addEventListener("keydown", function (event) {
  32. if (event.key == "ArrowLeft") {
  33. // if class ch-prev-btn exists, click it else click prev page-numbers
  34. if (document.getElementsByClassName("ch-prev-btn")[0]) {
  35. document.getElementsByClassName("ch-prev-btn")[0].click();
  36. }
  37. else {
  38. document.getElementsByClassName("prev page-numbers")[0].click();
  39. }
  40. }
  41. if (event.key == "ArrowRight") {
  42. // if class ch-next-btn exists, click it else click next page-numbers
  43. if (document.getElementsByClassName("ch-next-btn")[0]) {
  44. document.getElementsByClassName("ch-next-btn")[0].click();
  45. }
  46. else {
  47. document.getElementsByClassName("next page-numbers")[0].click();
  48. }
  49. }
  50. });
  51. })();