xkcd Arrow Keys

Adds the ability to use arrow keys to move to the next or previous comic/article on xkcd.com.

  1. // ==UserScript==
  2. // @name xkcd Arrow Keys
  3. // @description Adds the ability to use arrow keys to move to the next or previous comic/article on xkcd.com.
  4. // @namespace https://gf.qytechs.cn/en/users/2556-pietu1998
  5. // @include http://xkcd.com/*
  6. // @include https://xkcd.com/*
  7. // @include http://*.xkcd.com/*
  8. // @include https://*.xkcd.com/*
  9. // @version 1.2.1
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. window.addEventListener("keydown", function(e) {
  14. var q = document.querySelector.bind(document);
  15. var el = false;
  16. if (e.keyCode == 37)
  17. el = q("a[rel=prev]") || q("li.nav-prev a");
  18. if (e.keyCode == 39)
  19. el = q("a[rel=next]") || q("li.nav-next a");
  20. el && el.click();
  21. });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址