视频时间戳(支持everything和alist)

在视频链接后面加上后缀 ?t=30 ,那么进入视频链接就会自动跳转到30秒。(everthing默认端口80。alist默认端口5244)

  1. // ==UserScript==
  2. // @name 视频时间戳(支持everything和alist)
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.5
  5. // @description 在视频链接后面加上后缀 ?t=30 ,那么进入视频链接就会自动跳转到30秒。(everthing默认端口80。alist默认端口5244)
  6. // @author openAI
  7. // @match http://localhost/*
  8. // @match http://127.0.0.1/*
  9. // @match http://localhost:5244/*
  10. // @match http://127.0.0.1:5244/*
  11. // @icon https://img.icons8.com/?size=160&id=BiA4DdLOEKBN&format=png
  12. // @license MIT
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. class myclass{
  17. static start(){
  18. if(document.getElementsByTagName('video').length) {
  19. return myclass.modif_time()
  20. } else {
  21. return myclass.wait_video()
  22. }
  23. }
  24.  
  25. // 等待播放器加载
  26. static wait_video() {
  27. 'use strict';
  28. let wait_video_interval = setInterval(() => {
  29. if(document.getElementsByTagName('video').length) {
  30. clearInterval(wait_video_interval)
  31. return myclass.modif_time()
  32. }
  33. }, 500);
  34. }
  35.  
  36. static modif_time() {
  37. 'use strict';
  38. //获取url参数
  39. const paramsStr = window.location.search
  40. const params = new URLSearchParams(paramsStr)
  41. const seconds = parseInt(params.get('t'))
  42.  
  43. //进度条跳转
  44. let myVideo = document.getElementsByTagName("video")[0]
  45. if(seconds){
  46. myVideo.currentTime = seconds
  47. myVideo.play()
  48. }
  49. }
  50. }
  51.  
  52. // 相当于主函数
  53. (function() {
  54. 'use strict';
  55. myclass.start()
  56. })();

QingJ © 2025

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