Sleazy Fork is available in English.

Cyanide and happiness page turner

1/14/2022, 11:47:58 PM

  1. // ==UserScript==
  2. // @name Cyanide and happiness page turner
  3. // @namespace Violentmonkey Scripts
  4. // @match https://explosm.net/comics/*
  5. // @grant none
  6. // @version 1.0
  7. // @author WolfyD
  8. // @license MIT
  9. // @description 1/14/2022, 11:47:58 PM
  10. // ==/UserScript==
  11.  
  12. /*jshint esversion: 6 */
  13.  
  14. let previous = null;
  15. let next = null;
  16.  
  17. function start(){
  18. setup();
  19. document.addEventListener("keydown", onKeyDown);
  20. }
  21.  
  22. function onKeyDown(e){
  23. let key = e.keyCode;
  24. switch(key){
  25. case 37:
  26. if(previous){ previous.click(); }
  27. break;
  28. case 32:
  29. case 39:
  30. if(next){ next.click(); }
  31. break;
  32. }
  33. }
  34.  
  35. function setup(){
  36. let boxes = [].slice.call(document.getElementsByTagName("div")).filter(x=>x.className.indexOf("ComicSelector__Container") === 0)[0].children;
  37. if(boxes.length === 3){
  38. previous = boxes[0];
  39. next = boxes[2];
  40. }
  41. }
  42.  
  43. document.addEventListener("load", start());