Narou Simple Hotkey

try to take over the world!

  1. // ==UserScript==
  2. // @name Narou Simple Hotkey
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://ncode.syosetu.com/*/*/
  8. // @grant none
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. // Your code here
  15. window.addEventListener( 'load', function() {
  16. let key = "novel_honbun"
  17. let elem = document.getElementsByTagName("body")[0]
  18. elem.setAttribute("tabindex", "-1")
  19. elem.click()
  20. elem.focus()
  21. })
  22. let story_move = function(n) {
  23. let patharr = location.pathname.split("/")
  24. if (patharr.length != 4) return
  25. if (!(patharr[2] % 1 == 0)) return
  26. let story_no = (patharr[2] - 0)
  27. let next_no = story_no + n
  28. if (next_no <= 0) return
  29. location.href = "/" + patharr[1] + "/" + next_no + "/"
  30. }
  31. let story_up = function() {
  32. let patharr = location.pathname.split("/")
  33. if (patharr.length != 4) return
  34. location.href = "/" + patharr[1] + "/"
  35. }
  36. document.addEventListener("keydown" , function(e) {
  37. // n
  38. if ( (!e.shiftKey) && e.keyCode == 78) {
  39. story_move(1)
  40. return
  41. }
  42. // p
  43. if ( (!e.shiftKey) && e.keyCode == 80) {
  44. story_move(-1)
  45. return
  46. }
  47. // u
  48. if ( (!e.shiftKey) && e.keyCode == 85) {
  49. story_up()
  50. return
  51. }
  52. // b
  53. if ((!e.shiftKey) && e.keyCode == 66) {
  54. let elems = document.getElementsByClassName("bookmark_now set_siori")
  55. if (elems.length > 0) {
  56. elems[0].click()
  57. }
  58. }
  59. })
  60. })();

QingJ © 2025

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