Greasy Fork镜像 支持简体中文。

Vim keybindings

You don't need to reach your hand over to the arrowkeys anymore

  1. // ==UserScript==
  2. // @name Vim keybindings
  3. // @namespace Violentmonkey Scripts
  4. // @match https://www.tiktok.com/*
  5. // @grant none
  6. // @version 1.1
  7. // @author Tom van Dijk
  8. // @description You don't need to reach your hand over to the arrowkeys anymore
  9. // @license GPL-3.0-or-later
  10. // ==/UserScript==
  11. function handler(e) {
  12. if (!(document.activeElement.contentEditable === 'true')) {
  13. switch (e.keyCode) {
  14. case 74:
  15. document.body.dispatchEvent(
  16. new KeyboardEvent(
  17. "keydown",
  18. {
  19. keyCode: 40,
  20. target: document.body,
  21. key: "ArrowDown",
  22. code: "ArrowDown",
  23. bubbles: true,
  24. cancelable: true,
  25. }
  26. )
  27. );
  28. break;
  29. case 75:
  30. document.body.dispatchEvent(
  31. new KeyboardEvent(
  32. "keydown",
  33. {
  34. keyCode: 38,
  35. target: document.body,
  36. key: "ArrowUp",
  37. code: "ArrowUp",
  38. bubbles: true,
  39. cancelable: true,
  40. }
  41. )
  42. );
  43. break;
  44. default:
  45. break;
  46. }
  47. }
  48. }
  49. document.addEventListener("keydown", handler, false);

QingJ © 2025

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