🏠 Home 

AGE 新页面播放视频

2025-02-21


安装此脚本?
  1. // ==UserScript==
  2. // @name AGE 新页面播放视频
  3. // @namespace https://github.com/11ze
  4. // @version 0.2.3
  5. // @description 2025-02-21
  6. // @author 11ze
  7. // @match https://www.agedm.org/play/*
  8. // @match https://age.tv/play/*
  9. // @match https://agefans.com/play/*
  10. // @match https://43.240.156.118:8443/*
  11. // @icon https://www.google.com/s2/favicons?sz=64&domain=agedm.org
  12. // @license MIT
  13. // ==/UserScript==
  14. /**
  15. # AGE 新页面播放并下载视频
  16. 1. 自动在播放页面的动漫名称旁边新增一个按钮
  17. 2. 点击按钮打开新标签页播放视频
  18. */
  19. (function () {
  20. ('use strict');
  21. let hasButton = false;
  22. let isCopied = false;
  23. function main() {
  24. if (hasButton) {
  25. return;
  26. }
  27. if (isCopied) {
  28. return;
  29. }
  30. const videoNameDom = document.querySelector('div.body_content_wrapper h5');
  31. if (videoNameDom) {
  32. const iframe = document.querySelector('#iframeForVideo');
  33. const newTabButton = document.createElement('button');
  34. newTabButton.class = '11ze-age-newTabButton';
  35. newTabButton.innerText = '📺';
  36. newTabButton.onclick = function () {
  37. const payingNumber = document
  38. .querySelector('.video_detail_spisode_playing')
  39. .parentElement.querySelector('a').textContent;
  40. const videoName =
  41. videoNameDom.textContent.replace(/\s+/g, '').replace(/🔍/g, '').replace(/📺/g, '') +
  42. payingNumber;
  43. // 保存视频名称到剪贴板
  44. navigator.clipboard.writeText(videoName);
  45. window.open(iframe.src);
  46. };
  47. videoNameDom.appendChild(newTabButton);
  48. hasButton = true;
  49. }
  50. const video = document.querySelector('video');
  51. if (video) {
  52. const videoUrl = video.src;
  53. navigator.clipboard.readText().then(function (text) {
  54. const downloadLink = document.createElement('a');
  55. downloadLink.href = videoUrl;
  56. downloadLink.download = text;
  57. downloadLink.click();
  58. document.title = text;
  59. });
  60. isCopied = true;
  61. return;
  62. }
  63. }
  64. // 增加节流控制
  65. function throttle(func, limit) {
  66. let inThrottle;
  67. return function () {
  68. if (!inThrottle) {
  69. func.apply(this, arguments);
  70. inThrottle = true;
  71. setTimeout(() => (inThrottle = false), limit);
  72. }
  73. };
  74. }
  75. setInterval(
  76. throttle(() => {
  77. main();
  78. }),
  79. 1000
  80. );
  81. })();