Sleazy Fork is available in English.

MissAvFixedPlay

固定播放

Version au 08/12/2024. Voir la dernière version.

  1. // ==UserScript==
  2. // @name MissAvFixedPlay
  3. // @version 2024-12-08
  4. // @author Jeffc
  5. // @match https://missav.com/*
  6. // @description 固定播放
  7. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  8. // @grant none
  9. // @license MIT
  10. // @namespace https://greasyfork.org/users/940013
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. var grow;
  16. var x;
  17. var video;
  18.  
  19. var findGrow = setInterval(function(){
  20. console.log("[MissAvFixedPlay] : 查找注入DOM | 查找目标Video")
  21. grow = document.querySelector(".grow");
  22. video = document.querySelector('.player');
  23. if(grow && video)
  24. {
  25. clearInterval(findGrow);
  26. init();
  27. }
  28. },200);
  29.  
  30.  
  31. function init(){
  32.  
  33. console.log("[MissAvFixedPlay] : 注入CSS样式")
  34.  
  35. const style = document.createElement('style');
  36. style.innerHTML = `
  37. .button-85 {
  38. magin-left:10px;
  39. padding: 5px 25px;
  40. font-size: 14px;
  41. border: none;
  42. outline: none;
  43. color: rgb(255, 255, 255);
  44. background: #111;
  45. cursor: pointer;
  46. position: relative;
  47. z-index: 0;
  48. border-radius: 10px;
  49. user-select: none;
  50. -webkit-user-select: none;
  51. touch-action: manipulation;
  52. }
  53.  
  54. .button-85:before {
  55. content: "";
  56. background: linear-gradient(
  57. 45deg,
  58. #ff0000,
  59. #ff7300,
  60. #fffb00,
  61. #48ff00,
  62. #00ffd5,
  63. #002bff,
  64. #7a00ff,
  65. #ff00c8,
  66. #ff0000
  67. );
  68. position: absolute;
  69. top: -2px;
  70. left: -2px;
  71. background-size: 400%;
  72. z-index: -1;
  73. filter: blur(5px);
  74. -webkit-filter: blur(5px);
  75. width: calc(100% + 4px);
  76. height: calc(100% + 4px);
  77. animation: glowing-button-85 20s linear infinite;
  78. transition: opacity 0.3s ease-in-out;
  79. border-radius: 10px;
  80. }
  81.  
  82. @keyframes glowing-button-85 {
  83. 0% {
  84. background-position: 0 0;
  85. }
  86. 50% {
  87. background-position: 400% 0;
  88. }
  89. 100% {
  90. background-position: 0 0;
  91. }
  92. }
  93.  
  94. .button-85:after {
  95. z-index: -1;
  96. content: "";
  97. position: absolute;
  98. width: 100%;
  99. height: 100%;
  100. background: #222;
  101. left: 0;
  102. top: 0;
  103. border-radius: 10px;
  104. }
  105. `;
  106. console.log("[MissAvFixedPlay] : 添加控制元素")
  107. document.head.appendChild(style);
  108. x = document.createElement("button");
  109. x.textContent="固定播放";
  110. x.className="FixedPlay button-85";
  111. x.addEventListener("click",addCustonEvent);
  112. document.querySelector(".grow").appendChild(x);
  113. }
  114.  
  115. var fixedPlayStatus = false;
  116. var fixedSetInterval;
  117.  
  118. function addCustonEvent()
  119. {
  120. if(fixedPlayStatus)
  121. {
  122. video.pause();
  123. clearInterval(fixedSetInterval);
  124. }
  125. else
  126. {
  127. fixedSetInterval = setInterval(() => {
  128. if (video.paused || video.played.length == 0) {
  129. video.play();
  130. }
  131. }, 2000);
  132. }
  133. fixedPlayStatus = !fixedPlayStatus;
  134.  
  135. x.textContent = fixedPlayStatus ? "取消固定" : "固定播放";
  136. }
  137.  
  138. })();