SkipTime

Adds a shortcut (CTRL + Arrow Left / Right) with which you can skip time in a video by a custom amount.

  1. // ==UserScript==
  2. // @name SkipTime
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Adds a shortcut (CTRL + Arrow Left / Right) with which you can skip time in a video by a custom amount.
  6. // @author idjawoo
  7. // @match *://*/*
  8. // @icon https://cdn.discordapp.com/attachments/816751871896453120/1023498342329757786/unknown.png
  9. // @grant none
  10. // @run-at document-end
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function () {
  15. "use strict";
  16.  
  17. // Amount of seconds to skip forward- adjust to your liking.
  18. const skipValue = 88;
  19.  
  20. function waitForElm(selector) {
  21. return new Promise((resolve) => {
  22. if (document.querySelector(selector)) {
  23. return resolve(document.querySelector(selector));
  24. }
  25.  
  26. const observer = new MutationObserver((mutations) => {
  27. if (document.querySelector(selector)) {
  28. resolve(document.querySelector(selector));
  29. observer.disconnect();
  30. }
  31. });
  32.  
  33. observer.observe(document.body, {
  34. childList: true,
  35. subtree: true,
  36. });
  37. });
  38. }
  39.  
  40. let video = undefined;
  41. waitForElm("video").then((elm) => {
  42. video = elm;
  43. document.onkeydown = function (e) {
  44. if (e.ctrlKey) {
  45. if (e.key == "ArrowRight")
  46. elm.currentTime = elm.currentTime + skipValue;
  47. if (e.key == "ArrowLeft") elm.currentTime = elm.currentTime - skipValue;
  48. }
  49. };
  50. });
  51. })();

QingJ © 2025

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