视频网站清爽模式

为腾讯、优酷、爱奇艺增加修改样式、视频播放便利、跳转解析网站播放视频的功能,对解析网站进行增强改造,以及避免一些不必要的误触。

  1. // ==UserScript==
  2. // @name 视频网站清爽模式
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3942
  5. // @description 为腾讯、优酷、爱奇艺增加修改样式、视频播放便利、跳转解析网站播放视频的功能,对解析网站进行增强改造,以及避免一些不必要的误触。
  6. // @author 果心豆腐酱
  7. // @match https://v.qq.com/*
  8. // @match https://m.v.qq.com/*
  9. // @match https://youku.com/*
  10. // @match https://v.youku.com/*
  11. // @match https://www.youku.com/*
  12. // @match https://m.youku.com/*
  13. // @match https://jx.xmflv.com/*
  14. // @match https://jx.xmflv.cc/*
  15. // @match *://*.iqiyi.com/*
  16. // @match *://*.youku.com/*
  17. // @match *://*v.qq.com/*
  18. // @match https://jx.xmflv.com/*
  19. // @match https://jx.xmflv.cc/*
  20. // @grant GM_xmlhttpRequest
  21. // @icon https://v.qq.com/favicon.ico
  22. // ==/UserScript==
  23. //全局变量配置
  24. // 创建按钮元素
  25. // var button = document.createElement('button');
  26. // button.innerHTML = '按钮';
  27.  
  28. // // 设置按钮样式
  29. // button.style.position = 'fixed';
  30. // button.style.top = '0';
  31. // button.style.left = '0';
  32. // button.style.zIndex = '9999';
  33. // button.addEventListener('click',function(event){
  34. // console.log(unsafewindow.__INITIAL_STATE__)
  35. // })
  36. // 将按钮添加到页面的body元素中
  37. // document.body.appendChild(button);
  38. console.log('页面加载完成');
  39. var 解析字体颜色 = 'green';
  40. if (!location.href.includes('.xmflv.')) {
  41. var 主题色;
  42. var 深主题色;
  43. var 浅主题色;
  44. var VIP主题色;
  45. var 备案字体颜色;
  46. var 浅色字体;
  47. var 亮色字体;
  48. var 深色字体;
  49. var 音量;
  50. //var 主题 = "青色"
  51. //初始化组件
  52.  
  53. 创建主设置组件();
  54. const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
  55. if (isMobile) {
  56. // 是手机设备
  57. 函数存放("窄版页面样式修改");
  58. } else {
  59. // 不是手机设备
  60. 函数存放("页面样式修改");
  61. }
  62. 侧边栏按钮创建();
  63. 判断视频网站视频组件加载();
  64. 去广告判断();
  65.  
  66.  
  67. window.addEventListener('load', function () {
  68. // 页面加载完成后执行的操作
  69. console.log('页面加载完成2');
  70.  
  71.  
  72. // 定时检测视频进度并执行操作
  73. if (localStorage.getItem('advertisement') === "true") {
  74. 函数存放("去除游戏栏目");
  75. 函数存放("轮播栏广告播放");
  76. }
  77. 函数存放("去除游戏栏目");
  78. 函数存放("加载时可删除广告");
  79. 函数存放("轮播栏广告小图");
  80. 函数存放("去除app提示");
  81. 元素样式创建();
  82. 监测全屏状态();
  83. 监测激活状态();
  84. 监测页面元素();
  85. 监测去除腾讯广告();
  86. });
  87. function 创建解析按钮() {
  88. let 图标 = 'https://community.image.video.qpic.cn/v_station_video_web_comment_fbd86c-1_1647929910_1703449373405659?imageView2/2/w/2000';
  89. //手机浏览器下载按钮旁
  90. let 优酷剧集按钮 = document.querySelector('[class="brief-btm"]')
  91. if (优酷剧集按钮) {
  92. let html = `
  93. <div class="解析视频" >
  94. <img src="${图标}" style="left: 0px;width: 37px;height: 40px;margin: 0px 15px;position: relative;top: -2px;align-content: space-around;">
  95. <span class="解析span" style="left: 22px;top: -5px;position: relative;font-size: 5px;font-weight: 600;">解析</span>
  96. </div>
  97. `;
  98. 解析字体颜色 = '#999999';
  99. 优酷剧集按钮.innerHTML += html
  100. }
  101. //PC版弹幕栏
  102. 优酷剧集按钮 = document.querySelector('[class="switch-img_12hDa setconfig_Ojkob"]');
  103. if (优酷剧集按钮) {
  104. let html = `<div class="解析视频" style="display: inline-block;left: -5px;margin: 0px 15px; position: relative;top: 2px;align-content: space-around;">
  105. <img src="${图标}" style="width: 28px;height: 31px;">
  106. <span class="解析span" style="/* font-size: 10px; */left: 2px;top: 23px;position: absolute;font-size: 11px;font-weight: 600;height:20px;line-height: 20px;">解析</span>
  107. </div>`;
  108. if (优酷剧集按钮) {
  109. 优酷剧集按钮.insertAdjacentHTML("afterend", html);
  110. } else {
  111. 优酷剧集按钮.insertAdjacentHTML("afterend", html);
  112. }
  113. }
  114. //全部 按钮
  115. let 腾讯顶栏上的按钮 = document.querySelector('[id="nav-all"]');
  116. if (腾讯顶栏上的按钮) {
  117. let html = `
  118. <div class="解析视频" >
  119. <img src="${图标}" class="解析视频 解析图片" style="; width: 30px; margin: 0px 15px; height: 30px;">
  120. </div>
  121. `;
  122. 腾讯顶栏上的按钮.insertAdjacentHTML("afterend", html);
  123.  
  124. }
  125. //追剧 按钮旁边,手机浏览器
  126. let 腾讯追剧边按钮 = document.querySelector('[class="open-app video-desc__chase"]');
  127. if (腾讯追剧边按钮) {
  128.  
  129. let html = `
  130. <div class="解析视频" style="background: white;border-radius: 20px;padding: 0px 10px 0px 10px;margin: 0px 10px 0px 10px;">
  131. <img src="${图标}" style="height: 32px;width: 40px;border-radius: 20px;">
  132. <span style="top: 2px;position: relative;font-size: 15px;font-weight: 600;width: 30px;margin: 0px 5px 0px 10px;height: 30px;">解析</span>
  133. </div>`;
  134. 腾讯追剧边按钮.insertAdjacentHTML("afterend", html);
  135. }
  136. let 爱奇艺追剧边按钮 = document.querySelector('[class="fun"]');
  137. if (爱奇艺追剧边按钮) {
  138. let html = `
  139. <div class="解析视频" style="position: relative;">
  140. <img src="${图标}" style="width: 28px;margin: 0px 15px 0px 10px;height: 37px;top: -2px;position: relative;">
  141. <span class="解析span" style="height: 20px;;left: -14px;top: 9px;position: relative;font-size: 5px;font-weight: 600;">解析</span>
  142. </div>
  143. <div class="border"></div>
  144. `;
  145. 解析字体颜色 = '#8ba9c1';
  146. 爱奇艺追剧边按钮.insertAdjacentHTML("beforeend", html);
  147. }
  148. let 爱奇艺追剧边按钮手机浏览器 = document.querySelector('[class="m-videoPlay-toolBar"]');
  149. if (爱奇艺追剧边按钮手机浏览器) {
  150. let html = `
  151. <div class="解析视频">
  152. <img src="${图标}" style="width: 28px;margin: 0px 20px 0px 20px;height: 30px;top: -2px;position: relative;">
  153. <span style="left: -49px;top: 24px;position: relative;font-size: 5px;font-weight: 600;">解析</span>
  154. </div>
  155. `;
  156. 爱奇艺追剧边按钮手机浏览器.insertAdjacentHTML("beforeend", html);
  157. }
  158. let 解析按钮 = document.querySelector('.解析视频');
  159. if (解析按钮) {
  160. 解析按钮.addEventListener('click', function (event) {
  161. 新窗口();
  162. })
  163. }
  164.  
  165.  
  166. }
  167.  
  168. function 元素样式创建() {
  169. let css = `
  170. .解析视频{
  171. user-select: none;
  172. cursor: pointer;
  173. color: ${解析字体颜色};
  174. transition: transform 0.3s ease;
  175. transition: transform .3s ease;
  176. }
  177. .解析视频:hover {
  178. color: #f5c000 !important;
  179. transform: scale(1.2);
  180. }
  181. #saveButton{
  182. color: #333333 ;
  183. width: 40px;
  184. height: 20px;
  185. border-radius: 10px;
  186. background: white;
  187. }
  188. #saveButton:hover{
  189. color: green ;
  190. }
  191. #saveButton:active{
  192. color: #610110 ;
  193. }
  194. .main_button:hover {
  195. color: green ;
  196. }
  197. `
  198. if (document.querySelector('.解析样式')) {
  199. document.querySelector('.解析样式').remove()
  200. }
  201. var style = document.createElement('style');
  202. style.type = 'text/css';
  203. style.textContent = css;
  204. style.className = "解析样式";
  205. document.head.appendChild(style);
  206. }
  207. function 创建主设置组件() {
  208. 'use strict';
  209. // 创建设置按钮
  210. var settingButton = document.createElement('div');
  211. settingButton.className = 'main_button';
  212. settingButton.style.top = '50%';
  213. settingButton.innerHTML = '设置';
  214. settingButton.style.color = '#376339';
  215. settingButton.style.borderRadius = '2px';
  216. settingButton.style.background = "linear-gradient(to right, #DCF0B0, rgba(252, 247, 224, 0.5))";
  217. settingButton.style.cursor = 'pointer';
  218. settingButton.style.zIndex = '9999';
  219. settingButton.addEventListener('mousedown', function (e) {
  220. dragMenu(settingButton, e);
  221. });
  222. settingButton.style.position = 'fixed';
  223. settingButton.style.width = '15px';
  224. settingButton.style.height = '50px';
  225. settingButton.style.lineHeight = '25px';
  226. settingButton.style.display = 'flex';
  227. settingButton.style.justifyContent = 'center';
  228. // 将按钮添加到页面的 body 元素中
  229. document.body.appendChild(settingButton);
  230. // setTimeout(function () {
  231. // // 获取按钮元素透明
  232. // selectButton.style.opacity = "0.1";
  233. // settingButton.style.opacity = "0.1";
  234. // }, 10000); // 10秒后执行
  235. // 创建设置界面
  236. var settingPanel = document.createElement('div');
  237. settingPanel.style.position = 'fixed';
  238. settingPanel.style.top = '47%';
  239. settingPanel.style.left = '20px';
  240. settingPanel.style.padding = '10px';
  241. settingPanel.style.color = '#376339';
  242. settingPanel.style.background = "linear-gradient(to right, #DCF0B0, #FCF7E0)";
  243. settingPanel.style.border = '1px solid #000';
  244. settingPanel.style.zIndex = '9999';
  245. settingPanel.style.display = 'none';
  246. settingPanel.innerHTML = `
  247. <input type="checkbox" class="percentage 选择 a" name="progressType" value="percentage" style=" -webkit-appearance: button;cursor:pointer;border:0px">
  248. <label for="percentage">使用百分比</label>
  249. <input type="number" id="percentageThreshold" value="85" style="width: 50px;border:0px">
  250. <br>
  251. <input type="checkbox" class="percentage 选择 b" name="progressType" value="time" style=" -webkit-appearance: button;cursor:pointer;border:0px">
  252. <label for="time">使用分秒时间</label>
  253. <input type="text" id="timeThreshold" placeholder="12:20" style="width: 50px;border:0px">
  254. <br>
  255. <input type="checkbox" id="removewatermark" style=" -webkit-appearance: button;cursor:pointer;border:0px">
  256. <label for="percentage">去除视频水印</label>
  257. <br>
  258. <input type="checkbox" class="closesidebar" style=" -webkit-appearance: button;cursor:pointer;border:0px">
  259. <label for="percentage">首次关闭侧边栏</label>
  260. <br>
  261. <input type="checkbox" class="advertisement" style=" -webkit-appearance: button;cursor:pointer;border:0px">
  262. <label for="percentage">屏蔽广告</label>
  263. <br>
  264. <input type="checkbox" id="htmlbackground" style=" -webkit-appearance: button;cursor:pointer;border:0px">
  265. <label for="percentage">替换背景</label>
  266. <form action="/submit-form" method="post">
  267. <select id="cars" name="cars">
  268. <option value="月光色">月光色</option>
  269. <option value="青色">青色</option>
  270. <option value="神秘森林">神秘森林</option>
  271. <option value="辣红色">辣红色</option>
  272. <option value="芒果色">芒果色</option>
  273. <option value="金黄色">金黄色</option>
  274. <option value="金色">金色</option>
  275. </select>
  276. </form>
  277. <br>
  278. <button id="saveButton" class="button" style="font-weight: bold;cursor:pointer;position: absolute;right: 10px;bottom: 10px;border:0px">保存</button>
  279. `;
  280.  
  281. // <br>
  282. // <div style="width: 100%; height: 1px;background-color: #5c6e32; margin-bottom: 2px;"></div>
  283. // <label for="percentage" style=" position: relative;top: 10px;">cookie:</label>
  284. // <textarea class="cookie_textrea" placeholder="填写你需要加载到浏览器的cookie。" style="width: 110px;resize: none; height: 60px;"></textarea>
  285. // <br>
  286. // <button id="tiquButton" class="button" style="font-weight: bold; color: #333333;cursor:pointer;position: relative;left: 95px;">提取</button>
  287. // <button id="jiazaiButton" class="button" style="font-weight: bold; color: #333333;cursor:pointer;position: relative;left: 100px;">加载</button>
  288. document.body.appendChild(settingPanel);
  289. document.querySelector('.选择.a').addEventListener('click', function (event) {
  290. if (document.querySelector('.选择.a').checked === true) {
  291. document.querySelector('.选择.b').checked = false;
  292. }
  293.  
  294. })
  295. document.querySelector('.选择.b').addEventListener('click', function (event) {
  296. if (document.querySelector('.选择.b').checked === true) {
  297. document.querySelector('.选择.a').checked = false;
  298. }
  299. })
  300. // settingPanel.addEventListener('mousedown', function (e) {
  301. // dragMenu(settingPanel, e);
  302. // });
  303. // 定义一个变量用于保存计时器的 ID
  304. var timerId;
  305. // 给设置按钮绑定鼠标移入事件
  306. settingButton.addEventListener('mouseenter', function () {
  307. // 显示设置面板
  308. settingPanel.style.display = 'block';
  309. // 清除计时器
  310. clearTimeout(timerId);
  311. });
  312. // 给设置面板绑定鼠标移入事件,避免鼠标移出设置按钮后立即隐藏设置面板
  313. settingPanel.addEventListener('mouseenter', function () {
  314. // 清除计时器
  315. clearTimeout(timerId);
  316. });
  317. // 给设置按钮绑定鼠标移出事件
  318. settingButton.addEventListener('mouseleave', function () {
  319. // 开始计时,500 毫秒后隐藏设置面板
  320. timerId = setTimeout(function () {
  321. settingPanel.style.display = 'none';
  322. }, 500);
  323. });
  324. // 给设置面板绑定鼠标移出事件,避免鼠标移入设置面板后立即隐藏设置面板
  325. settingPanel.addEventListener('mouseleave', function () {
  326. // 开始计时,500 毫秒后隐藏设置面板
  327. timerId = setTimeout(function () {
  328. settingPanel.style.display = 'none';
  329. }, 500);
  330. });
  331. // 显示/隐藏设置界面
  332. settingButton.addEventListener('click', function (event) {
  333. event.stopPropagation(); // 阻止事件冒泡
  334. event.preventDefault(); // 阻止默认行为
  335. if (settingPanel.style.display === 'none') {
  336. settingPanel.style.display = 'block';
  337. console.log('开始设置');
  338. const 进度选择Input = document.querySelectorAll('.选择');
  339. if (进度选择Input.length === 2) {
  340. for (let index = 0; index < 进度选择Input.length; index++) {
  341. 进度选择Input[index].style.cssText = 'width: 20px !important; cursor: pointer;';
  342. }
  343. }
  344. } else {
  345. settingPanel.style.display = 'none';
  346. }
  347. });
  348. var tiquButton = document.querySelector('#tiquButton');
  349. if (tiquButton) {
  350. tiquButton.addEventListener("click", function () {
  351. var cookieStr = document.querySelector('.cookie_textrea')
  352. if (cookieStr) {
  353. cookieStr.value = document.cookie
  354. }
  355. })
  356. }
  357. var jiazaiButton = document.querySelector('#jiazaiButton');
  358. if (jiazaiButton) {
  359. jiazaiButton.addEventListener("click", function () {
  360. 加载QQcookie();
  361. })
  362. }
  363. function 加载QQcookie() {
  364. var cookieDomain = ".qq.com"
  365. // 设置cookie字符串
  366. var cookieStr = document.querySelector('.cookie_textrea')
  367. if (cookieStr) {
  368. // 分割cookie字符串
  369. if (cookieStr.value != "") {
  370. var cookies = cookieStr.value.split(";");
  371. if (cookies.length != 0) {
  372. // 遍历每个cookie,并设置为对应的键值对
  373. cookies.forEach(function (cookie) {
  374. var keyValue = cookie.trim().split("=");
  375. var key = keyValue[0];
  376. var value = keyValue[1];
  377. // 设置cookie
  378. document.cookie = key + "=" + encodeURIComponent(value) + "; domain=" + cookieDomain + "; path=/;";
  379. });
  380. } else (showToast("请不包含有cookie信息。"))
  381.  
  382. } else (showToast("请填写cookie信息。"))
  383.  
  384. } else (showToast("编辑框元素丢失了。"))
  385. }
  386.  
  387. //取进度百分比的编辑框元素
  388. var percentageThresholdInput = document.getElementById('percentageThreshold');
  389. // 读取缓存percentageThreshold的值
  390. var savedPercentageThreshold = localStorage.getItem('percentageThreshold');
  391. //如果缓存没有内容就使用默认的数值
  392. if (savedPercentageThreshold) {
  393. percentageThresholdInput.value = savedPercentageThreshold;
  394. } else {
  395. percentageThresholdInput.value = '85'; // 默认值
  396. }
  397. // 读取缓存的timeThreshold的值
  398. var timeThresholdInput = document.getElementById('timeThreshold');
  399. var savedTimeThreshold = localStorage.getItem('timeThreshold');
  400. if (savedTimeThreshold) {
  401. timeThresholdInput.value = savedTimeThreshold;
  402. } else {
  403. timeThresholdInput.placeholder = '12:20'; // 默认值
  404. }
  405. var percentageValue = parseInt(localStorage.getItem('percentage'));
  406. if (isNaN(percentageValue) || percentageValue < 0) {
  407. document.querySelectorAll(".percentage")[0].checked = true
  408. } else {
  409. document.querySelectorAll(".percentage")[percentageValue].checked = true
  410. }
  411. var removewatermarkchecked = localStorage.getItem('removewatermark');
  412. if (removewatermarkchecked === "false") {
  413. document.querySelector("#removewatermark").checked = false;
  414. } else {
  415. document.querySelector("#removewatermark").checked = true;
  416. localStorage.setItem('removewatermark', true);
  417. }
  418. var closesidebarchecked = localStorage.getItem('closesidebar');
  419. if (closesidebarchecked === "false") {
  420. document.querySelector(".closesidebar").checked = false
  421. } else {
  422. document.querySelector(".closesidebar").checked = true
  423. localStorage.setItem('closesidebar', true);
  424. }
  425. if (closesidebarchecked === "false") {
  426. document.querySelector(".advertisement").checked = false
  427. } else {
  428. document.querySelector(".advertisement").checked = true
  429. localStorage.setItem('advertisement', true);
  430. }
  431. var htmlbackground = localStorage.getItem('htmlbackground');
  432. if (htmlbackground === "true") {
  433. document.querySelector("#htmlbackground").checked = true;
  434. var cars = localStorage.getItem('cars');
  435. document.querySelector("#cars").selectedIndex = cars;
  436. } else {
  437. document.querySelector("#htmlbackground").checked = false;
  438. localStorage.setItem('htmlbackground', false);
  439. }
  440.  
  441.  
  442. // 监听保存按钮的点击事件
  443. var saveButton = document.getElementById('saveButton');
  444. saveButton.addEventListener('click', function () {
  445. // 保存percentageThreshold的值到localStorage
  446. var percentageThresholdValue = percentageThresholdInput.value;
  447. localStorage.setItem('percentageThreshold', percentageThresholdValue);
  448. // 保存timeThreshold的值到localStorage
  449. var timeThresholdValue = timeThresholdInput.value;
  450. localStorage.setItem('timeThreshold', timeThresholdValue);
  451. //保存去水印设置
  452. localStorage.setItem('removewatermark', document.querySelector("#removewatermark")?.checked);
  453. //保存屏蔽广告设置
  454. localStorage.setItem('advertisement', document.querySelector(".advertisement")?.checked);
  455. //保存侧边栏设置
  456. localStorage.setItem('closesidebar', document.querySelector(".closesidebar")?.checked);
  457. //主题替换功能
  458. localStorage.setItem('htmlbackground', document.querySelector("#htmlbackground")?.checked);
  459. //主题配色选择
  460. localStorage.setItem('cars', document.querySelector("#cars")?.selectedIndex);
  461. // // 判断是否所有的percentage都被选中
  462. var percentageInputs = document.querySelectorAll(".percentage");
  463. for (var i = 0; i < percentageInputs.length; i++) {
  464. if (percentageInputs[i].checked) {
  465. localStorage.setItem('percentage', i);
  466. }
  467. }
  468. });
  469. //需要直接执行的代码
  470. // 使用正则表达式检测 userAgent
  471.  
  472. }
  473.  
  474. // 检测视频进度达到阈值时执行点击下一个视频
  475. function checkAndClickNext() {
  476. var jindu = document.querySelector(".txp_time_current");
  477. var changdu = document.querySelector(".txp_time_duration");
  478. // 解析进度和长度的分钟和秒钟
  479. if (jindu && changdu) {
  480. var progressParts = jindu.textContent.split(":");
  481. var durationParts = changdu.textContent.split(":");
  482. var progressMinutes = parseInt(progressParts[0]);
  483. var progressSeconds = parseInt(progressParts[1]);
  484. var durationMinutes = parseInt(durationParts[0]);
  485. var durationSeconds = parseInt(durationParts[1]);
  486. // 将分钟和秒钟转换为总秒数
  487. var progressTotalSeconds = progressMinutes * 60 + progressSeconds;
  488. var durationTotalSeconds = durationMinutes * 60 + durationSeconds;
  489. // 获取进度类型选择
  490. var progressType = parseInt(localStorage.getItem('percentage'));
  491. var nextButton = document.querySelector('.txp_btn.txp_btn_next_u');
  492. // 根据进度类型执行相应的进度判断
  493. if (progressType === 0) {
  494. // 获取百分比阈值
  495. var percentageThreshold = localStorage.getItem('percentageThreshold');
  496. // 计算百分比
  497. var percent = (progressTotalSeconds / durationTotalSeconds) * 100;
  498. //txp_tooltip txp_none
  499. // 如果进度达到阈值,则执行点击下一个视频的操作
  500. if (percent >= percentageThreshold) {
  501. if (nextButton) {
  502. nextButton.click();
  503. }
  504. }
  505. } else if (progressType === 1) {
  506. // 获取分秒时间阈值
  507. var timeThresholdParts = localStorage.getItem('timeThreshold');
  508. var timeParts = timeThresholdParts.split(":");
  509. var timeThresholdSeconds = parseInt(timeParts[0]) * 60 + parseInt(timeParts[1]);
  510. // 如果进度达到阈值时间,则执行点击下一个视频的操作
  511. if (progressTotalSeconds >= timeThresholdSeconds) {
  512. if (nextButton) {
  513. nextButton.click();
  514. }
  515. }
  516. }
  517. }
  518. //clearInterval(intervalId);
  519. }
  520. function 判断视频网站视频组件加载() {
  521. var intervalId = setInterval(function () {
  522.  
  523. let video = document.querySelectorAll('video')
  524. if (video) {
  525. clearInterval(intervalId);
  526.  
  527. 音量 = video.volume
  528. 创建解析按钮();
  529. 监测播放状态();
  530. 去广告判断();
  531. }
  532. for (let index = 0; index < video.length; index++) {
  533. if (video[index].src != '') {
  534.  
  535. 设置辅助功能(video[index]);
  536. }
  537. }
  538. }, 1000);
  539. }
  540. function 设置辅助功能(video) {
  541. let i = 1;
  542. let intervalId = setInterval(() => {
  543. let 腾讯PC = document.querySelector('.plugin_ctrl_txp_bottom');
  544. if (腾讯PC) {
  545. 腾讯PC.appendChild(添加辅助功能());
  546. 绑定热键();
  547. clearInterval(intervalId);
  548. } else {
  549. let 爱奇艺PC = document.querySelectorAll('[class="iqp-contrl"]');
  550. if (爱奇艺PC.length === 2) {
  551. 爱奇艺PC[0].parentElement?.querySelector('[data-player-hook="plgcontainer"]')?.remove()
  552. 爱奇艺PC[1].appendChild(添加辅助功能());
  553. 绑定热键();
  554. clearInterval(intervalId);
  555. } else {
  556. if (爱奇艺PC === 1) {
  557. 爱奇艺PC.appendChild(添加辅助功能());
  558. 绑定热键();
  559. clearInterval(intervalId);
  560. } else {
  561. let 优酷PC = document.querySelector('[class="kui-dashboard-rear-ctn"]');
  562. if (优酷PC) {
  563. 优酷PC.appendChild(添加辅助功能());
  564. 绑定热键();
  565. clearInterval(intervalId);
  566. }
  567. }
  568. }
  569. }
  570. i++;
  571. if (i === 10) {
  572. clearInterval(intervalId);
  573. }
  574. }, 1000);
  575. }
  576. //视频网站的
  577. function 监测播放状态() {
  578. let video = document.querySelector('video')
  579. if (video) {
  580. video.addEventListener("timeupdate", function () {
  581. var currentTime = Math.floor(video.currentTime); // 获取当前播放时间(秒)
  582. var duration = Math.floor(video.duration); // 获取视频总长度(秒)
  583. var progressType = parseInt(localStorage.getItem('percentage'));
  584. if (progressType === 0) {
  585. var percentageThreshold = localStorage.getItem('percentageThreshold');
  586. var percent = (currentTime / duration) * 100;
  587. if (percent >= percentageThreshold) {
  588. setTimeout(function () {
  589. 点击下一集(video);
  590. }, 1000);
  591. }
  592. } else if (progressType === 1) {
  593. var timeThresholdParts = localStorage.getItem('timeThreshold');
  594. var timeParts = timeThresholdParts.split(":");
  595. var timeThresholdSeconds = parseInt(timeParts[0]) * 60 + parseInt(timeParts[1]);
  596. if (currentTime >= timeThresholdSeconds) {
  597. setTimeout(function () {
  598. 点击下一集(video);
  599. }, 1000);
  600. }
  601. }
  602. });
  603. }
  604. }
  605. function 点击上一集() {
  606. window.history.back();
  607. }
  608. function 点击下一集() {
  609. if (location.hostname.includes('v.qq.')) {
  610. document.querySelector('.txp_btn.txp_btn_next_u')?.click();
  611. } else {
  612. if (location.hostname.includes('.youku.')) {
  613. document.querySelector('[class=" kui-next-icon-0"]')?.click();
  614. } else {
  615. if (location.hostname.includes('.iqiyi.')) {
  616. document.querySelector('[class="iqp-btn iqp-btn-next"]').click();
  617. }
  618. }
  619. }
  620. }
  621.  
  622. //监测页面元素
  623. function 监测页面元素() {
  624. var oldURL = document.URL;
  625. // 创建 Mutation Observer 实例
  626. var observer = new MutationObserver(function (mutationsList) {
  627. // console.log("蜀黍");
  628. for (var mutation of mutationsList) {
  629. // 遍历每个被添加的节点
  630. for (var addedNode of mutation.addedNodes) {
  631. // 判断是否为元素节点
  632. if (addedNode.nodeType === Node.ELEMENT_NODE) {
  633. 去广告判断()
  634.  
  635. let 当前剧集按钮 = document.querySelector('[class="c-album-item selected"]');
  636. if (当前剧集按钮) {
  637. if (!当前剧集按钮.querySelector('.覆盖按钮')) {
  638. 覆盖按钮(当前剧集按钮)
  639. }
  640. }
  641. }
  642. }
  643. }
  644. });
  645. // 监测整个文档树的变动
  646. observer.observe(document, { childList: true, subtree: true });
  647. }
  648. // if (addedNode) {
  649. // let 播放页面广告 = addedNode.querySelector('video[preload="auto"]')
  650. // if (播放页面广告.parentElement?.parentElement ){
  651. // 播放页面广告.parentElement?.parentElement?.remove()
  652. // //会员原播放界面
  653. // let 缩小视频 = document.querySelector('[class="iqp-player-videolayer"]')
  654. // 缩小视频.style.height = '100%';
  655. // 缩小视频.style.width = '100%';
  656. // 缩小视频.style.top = '0';
  657. // 缩小视频.style.left = '0';
  658.  
  659. // html=`<div class="cupid-pause-max-play-btn" ><span class="play-btn"></span>继续播放</div>`
  660. // 缩小视频.querySelector('[data-cupid="container"]')?.insertAdjacentHTML("afterend", html);
  661.  
  662. // css=`.cupid-pause-max-play-btn {
  663. // left: calc(50% - 128px);
  664. // top: calc(50% - 44px);
  665. // position: absolute;
  666. // width: 128px;
  667. // height: 44px;
  668. // font-size: 16px;
  669. // border-radius: 22.41px;
  670. // }`
  671. // if (document.querySelector('.继续播放')) {
  672. // document.querySelector('.继续播放').remove()
  673. // }
  674. // var style = document.createElement('style');
  675. // style.type = 'text/css';
  676. // style.textContent = css;
  677. // style.className = "继续播放";
  678. // document.head.appendChild(style);
  679. // }
  680.  
  681.  
  682. // }
  683. function 去广告判断() {
  684. if (localStorage.getItem('advertisement') === "true") {
  685. if (document.location.hostname.includes('v.qq.com')) {
  686. 监测去除腾讯广告();
  687. } else {
  688. if (document.location.hostname.includes('.iqiyi')) {
  689. //console.log('警察蜀黍',addedNode)
  690. 爱奇艺去广告()
  691. } else {
  692. if (document.location.hostname.includes('.youku.')) {
  693. 优酷去广告()
  694. }
  695. }
  696. }
  697. }
  698. }
  699.  
  700. var cartoonlistload;
  701. // 调用函数并打印
  702.  
  703. function 监测去除腾讯广告() {
  704. if (localStorage.getItem('advertisement') === "true") {
  705. //暂停视频的弹窗广告
  706. var video_material = document.querySelector('.txp_zt_video_material');
  707. if (video_material) {
  708. video_material.parentNode.removeChild(video_material);
  709. console.log("删除暂停视频的弹窗广告");
  710. } else {
  711. // 暂停视频的弹窗广告
  712. var pauseBanner = document.querySelector('.txp_zt_content.txp_ad_active_normal');
  713. if (pauseBanner) {
  714. pauseBanner.remove();
  715. console.log("删除暂停视频的弹窗广告");
  716. } else {
  717. // 推荐视频里的广告
  718. var pauseVideos = document.querySelectorAll(".video-card-module > div.card-wrap");
  719. if (pauseVideos.length > 0) {
  720. pauseVideos.forEach(function (video) {
  721. video.remove();
  722. });
  723. console.log("删除推荐视频里的广告");
  724. } else {
  725. // 推荐视频里的广告关闭按钮
  726. var close_btn = document.querySelectorAll(".close-btn SPAN");
  727. if (close_btn.length > 0) {
  728. close_btn.forEach(function (button) {
  729. if (button.textContent === "广告") {
  730. button.parentNode.parentNode.remove();
  731. }
  732. });
  733. console.log("删除推荐视频里的广告");
  734. } else {
  735. // 暂停视频的弹窗广告
  736. var pauselayer = document.querySelector('.creative-player-pause-layer');
  737. if (pauselayer) {
  738. pauselayer.remove();
  739. console.log("删除暂停视频的弹窗广告");
  740. } else {
  741. var 侧边栏广告 = document.querySelector(".game_switch_page_next_wrapper.game-switch-ad")
  742. if (侧边栏广告) {
  743. 侧边栏广告.remove();
  744. console.log("删除侧边栏广告");
  745. } else {
  746. var 挂件 = document.querySelector(".game_close_btn.svelte-a683jp")
  747. if (挂件) {
  748. 挂件.click();
  749. console.log("移除了挂件广告。");
  750. } else {
  751. var cartoonlist = document.querySelector(".card.vertical")
  752. if (cartoonlist) {
  753. // 在这里添加对应的删除操作
  754. } else {
  755. pauselayer = document.querySelector('[data-role="creative-player-full-screen-pause-layer"]')
  756. if (pauselayer) {
  757. pauselayer.remove();
  758. console.log("删除暂停视频的弹窗广告");
  759. } else {
  760. //内嵌的商品广告
  761. var data05e6c233 = document.querySelector('iframe[data-v-05e6c233]')
  762. if (data05e6c233) {
  763. data05e6c233.remove();
  764. console.log("删除内嵌的商品广告");
  765. }
  766. }
  767. }
  768. }
  769. }
  770. }
  771. }
  772. }
  773. }
  774. }
  775. }
  776.  
  777. var 悬浮播放器 = document.querySelector('[class="vue-portal-target"]');
  778. if (悬浮播放器) {
  779. 悬浮播放器.remove();
  780. console.log("删除悬浮播放器");
  781. }
  782. var desc__download = document.querySelector('[class="open-app video-desc__download"]');
  783. if (desc__download) {
  784. desc__download.remove();
  785. console.log("删除手机浏览器下载app按钮");
  786. }
  787. var 侧边广告 = document.querySelector('.player-side-ads__left');
  788. if (侧边广告) {
  789. 侧边广告.parentNode.removeChild(interactiframe);
  790. console.log("删除播放器左侧栏广告", "interactiframe");
  791. }
  792. var interactiframe = document.querySelector('.interact_entry.player__interact-iframe');
  793. if (interactiframe) {
  794. interactiframe.parentNode.removeChild(interactiframe);
  795. console.log("删除未知广告", "interactiframe");
  796. }
  797. var txpzt = document.querySelector('.txp_zt');
  798. if (txpzt) {
  799. txpzt.remove();
  800. console.log("删除未知广告", "txpzt");
  801. }
  802. // 去app查看
  803. var appBanner = document.querySelector('.at-app-banner__open-method.at-app-banner--button');
  804. if (appBanner) {
  805. appBanner.remove();
  806. }
  807.  
  808. // 去app查看2
  809. var appButton = document.querySelector('[dt-eid="open_app_bottom"]');
  810. if (appButton) {
  811. appButton.remove();
  812. }
  813.  
  814. // 播放器悬浮广告
  815. appButton = document.querySelector('[class="txp_ad_detail txp_ad_active_normal');
  816. if (appButton) {
  817. appButton.remove();
  818. }
  819.  
  820. }
  821. // 调用函数并打印
  822. function 爱奇艺去广告() {
  823. if (localStorage.getItem('advertisement') === "true") {
  824. //播放器右栏广告
  825. let 播放器右栏广告 = document.querySelector('[class="qy-plist-ad type-3 roll"]')
  826. if (播放器右栏广告) {
  827. 播放器右栏广告.remove();
  828. console.log("移除播放广告按钮");
  829. }
  830. //播放广告
  831. let 播放广告 = document.querySelector('[class="cupid-pause-max-close-btn"]');
  832. if (播放广告) {
  833. if (播放广告.parentElement.style.display != 'none') {
  834. 播放广告.click();
  835.  
  836. }
  837. }
  838. //播放广告2
  839. 播放广告 = document.querySelector('[class="skippable-after"]')
  840. if (播放广告) {
  841. if (播放广告.parentElement.style.display != 'none') {
  842. 播放广告.click();
  843.  
  844. }
  845. }
  846. //下载应用按钮
  847. const 下载应用按钮 = document.querySelector('[class="item tiicke-down"]');
  848. if (下载应用按钮) {
  849. 下载应用按钮.remove();
  850. console.log("移除下载应用按钮");
  851. }
  852. //手机浏览器下载应用按钮
  853. const 手机浏览器下载应用按钮 = document.querySelector('[class="c-videoPlayPage-icon c-videoPlayPage-down"]');
  854. if (手机浏览器下载应用按钮) {
  855. 手机浏览器下载应用按钮.parentElement?.parentElement?.parentElement?.remove();
  856. console.log("移除手机浏览器下载应用按钮");
  857. }
  858. //页面遮罩
  859. const 页面遮罩 = document.querySelector('[class="qy-popup-mask"]');
  860. if (页面遮罩) {
  861. 页面遮罩.remove();
  862. console.log("移除页面遮罩");
  863. }
  864. //打开app悬浮窗
  865. const guide = document.querySelector('.m-iqyGuide-layer');
  866. if (guide) {
  867. guide.remove();
  868. console.log("移除悬浮窗广告");
  869. }
  870. //打开app底部框
  871. const banner = document.querySelector('.ChannelHomeBanner_hbd_eiF93');
  872. if (banner) {
  873. banner.remove();
  874. console.log("移除底部框广告");
  875. }
  876. //应用推荐
  877. const recList = document.querySelector('[name="m-recList"]');
  878. if (recList) {
  879. recList.remove();
  880. console.log("移除应用推荐广告");
  881. }
  882. //播放页面打开app
  883. const boxItems = document.querySelector('[id="player_bottom"]');
  884. if (boxItems) {
  885. boxItems.parentElement?.parentElement?.parentElement?.remove();
  886. console.log("移除播放页面打开app广告");
  887. }
  888. //视频介绍
  889. const videoInfo = document.querySelector('[name="m-videoInfo"]');
  890. if (videoInfo) {
  891. if (videoInfo.style.paddingTop !== '15px') {
  892. videoInfo.style.paddingTop = '15px';
  893. console.log("修改视频介绍样式");
  894. }
  895. }
  896. //播放页面悬浮推荐
  897. const hotWords = document.querySelector('[class="m-hotWords-bottom"]');
  898. if (hotWords && hotWords.parentElement) {
  899. hotWords.parentElement.remove();
  900. console.log("移除播放页面悬浮推荐广告");
  901. }
  902. //播放页面视频详情下广告
  903. const qy_plist_ad = document.querySelector('[class="qy-plist-ad type-1 image"]');
  904. if (qy_plist_ad) {
  905. qy_plist_ad.remove();
  906. console.log("移除播放页面视频详情下广告");
  907. }
  908. //播放页面视频详情下广告
  909. const 试看提示 = document.querySelector('[id="cc_minimalism_popup"]');
  910. if (试看提示) {
  911. 试看提示.remove();
  912. console.log("移除播放页面试看提示广告");
  913. }
  914. //播放页面视频详情下广告
  915. const 登陆提示 = document.querySelector('[data-block-v2="bottom_denglu"]');
  916. if (登陆提示) {
  917. 登陆提示.remove();
  918. console.log("移除登陆提示");
  919. }
  920. //首页广告条
  921. const adtl = document.querySelectorAll('[class="ad-tl"]');
  922. for (let index = 0; index < adtl.length; index++) {
  923. adtl[index].remove();
  924. console.log("移除首页广告条提示");
  925. }
  926. //开通会员提示
  927. let bTest = document.querySelector('[class="header__promotion__popup bTest"]')
  928. if (bTest) {
  929. bTest.remove();
  930. console.log('爱奇艺开通会员提示广告去除执行完成')
  931. }
  932. //视频列表广告
  933. let adseed = document.querySelector('[class="ad-seed"]')
  934. if (adseed) {
  935. adseed.remove();
  936. console.log('爱奇艺视频列表广告去除执行完成')
  937. }
  938. //视频列表广告
  939. let adef = document.querySelector('[class="ad-ef"]')
  940. if (adef) {
  941. adef.remove();
  942. console.log('爱奇艺首页视频栏广告去除执行完成')
  943. }
  944. //播放页面广告
  945. let 播放页面广告 = document.querySelector('[class="cupid-pause-max-close-btn"]')
  946. if (播放页面广告) {
  947. 播放页面广告.click();
  948. console.log('爱奇艺播放页面广告去除执行完成')
  949. }
  950. //顶栏右侧游戏按钮
  951. let 顶栏右侧游戏按钮 = document.querySelector('[class="T-icon-game"]')
  952. if (顶栏右侧游戏按钮) {
  953. 顶栏右侧游戏按钮.remove();
  954. console.log('爱奇艺顶栏右侧游戏按钮游戏广告去除执行完成')
  955. }
  956. let 顶栏栏目选择 = document.querySelectorAll('[class="nav-link nav-index J-nav-channel"')
  957. for (let index = 0; index < 顶栏栏目选择.length; index++) {
  958. if (顶栏栏目选择[index].textContent === '游戏') {
  959. 顶栏栏目选择[index].remove();
  960. console.log('爱奇艺顶栏顶栏栏目选择按钮游戏广告去除执行完成')
  961. }
  962. }
  963. //轮播栏广告
  964. let 轮播栏广告 = document.querySelectorAll('[class="panel-item"][data-v-e765da72]')
  965. for (let index = 0; index < 轮播栏广告.length; index++) {
  966. let href = 轮播栏广告[index].querySelector('[href]')
  967. if (href) {
  968. href = href.getAttribute('href');
  969. // 提取域名
  970. const regex = /\/\/(.+)\//;
  971. // 匹配 URL 字符串中的域名
  972. const match = href.match(regex);
  973. // 提取匹配结果中的域名
  974. const domain = match && match[1];
  975. if (domain) {
  976. if (!domain.includes('.iqiyi') || domain.includes('game')) {
  977. 轮播栏广告[index].remove()
  978. console.log('爱奇艺轮播栏广告广告去除执行完成')
  979. }
  980. }
  981. }
  982. }
  983. let 轮播栏广告2 = document.querySelector('[class="qy20-h-carousel_con-gray"][data-v-e765da72]')?.querySelectorAll('a')
  984. for (let index = 0; index < 轮播栏广告.length; index++) {
  985. let href2 = 轮播栏广告2[index].getAttribute('href');
  986. if (href2) {
  987. // 提取域名
  988. const regex = /\/\/(.+)\//;
  989. // 匹配 URL 字符串中的域名
  990. const match = href2.match(regex);
  991. // 提取匹配结果中的域名
  992. const domain = match && match[1];
  993. if (domain) {
  994. if (!domain.includes('.iqiyi.') || domain.includes('game')) {
  995. 轮播栏广告2[index].setAttribute('href', '')
  996. console.log('爱奇艺轮播栏广告href去除执行完成')
  997. }
  998. }
  999.  
  1000. }
  1001.  
  1002. }
  1003. //轮播栏广告按钮
  1004. let 轮播栏广告按钮 = document.querySelector('[class="qy20-h-carousel__ad"]')
  1005. if (轮播栏广告按钮) {
  1006. 轮播栏广告按钮.style.display = 'none';
  1007. //console.log('爱奇艺轮播栏广告按钮去除执行完成',轮播栏广告按钮)
  1008. }
  1009. //console.log('爱奇艺广告去除执行完成')
  1010. }
  1011. }
  1012.  
  1013. function 优酷去广告() {
  1014. if (localStorage.getItem('advertisement') === "true") {
  1015.  
  1016. //底部打开app提示
  1017. let 底部打开app提示 = document.querySelector('[sourcetype="Sbanner_circle_0"]')
  1018. if (底部打开app提示) {
  1019. 底部打开app提示.remove();
  1020. console.log('优酷底部打开app提示去除执行完成')
  1021. }
  1022. //继续使用浏览器
  1023. let pause = document.querySelector('[id="youku-pause-container"]')
  1024. if (pause) {
  1025. pause.remove();
  1026. console.log('优酷继播放暂停广告去除执行完成')
  1027. }
  1028. //继续使用浏览器
  1029. let callEnd_box = document.querySelector('[class="callEnd_box "]')
  1030. if (callEnd_box) {
  1031. callEnd_box.remove();
  1032. console.log('优酷继续使用浏览器广告去除执行完成')
  1033. }
  1034. //下载app按钮
  1035. let download_clipboard = document.querySelector('[class="download clipboard"]')
  1036. if (download_clipboard) {
  1037. download_clipboard.parentElement.remove();
  1038. console.log('优酷下载app按钮去除执行完成')
  1039. }
  1040. //下载客户端按钮
  1041. let download = document.querySelector('[name="download"]')
  1042. if (download) {
  1043. download.remove();
  1044. console.log('优酷下载客户端去除执行完成')
  1045. }
  1046. //下载app
  1047. let downloadApp = document.querySelector('[class="icon downloadApp"]')
  1048. if (downloadApp) {
  1049. downloadApp.remove();
  1050. console.log('优酷下载app广告去除执行完成')
  1051. }
  1052. //领取会员
  1053. let guide = document.querySelector('[class="clipboard h5-detail-vip-guide"]')
  1054. if (guide) {
  1055. guide.remove();
  1056. console.log('优酷领取会员广告去除执行完成')
  1057. }
  1058. //继续使用浏览器
  1059. let promotelogin_infobottom = document.querySelector('[class="promotelogin_infobottom"]')
  1060. if (promotelogin_infobottom) {
  1061. promotelogin_infobottom.remove();
  1062. console.log('优酷继续使用浏览器2广告去除执行完成')
  1063. }
  1064. let 轮播栏广告 = document.querySelectorAll('[class=" newswiper_img_box"]')
  1065. for (let index = 0; index < 轮播栏广告.length; index++) {
  1066. let href = 轮播栏广告[index].getAttribute('href');
  1067. if (href) {
  1068. // 提取域名
  1069. //console.log(href)
  1070. const regex = /\/\/(.+)\//;
  1071. // 匹配 URL 字符串中的域名
  1072. const match = href.match(regex);
  1073. // 提取匹配结果中的域名
  1074. const domain = match && match[1];
  1075. if (domain) {
  1076. if (!domain.includes('.youku.') || domain.includes('game')) {
  1077. 轮播栏广告[index].parentElement.remove()
  1078. // console.log(轮播栏广告[index].parentElement)
  1079. }
  1080. }
  1081.  
  1082. }
  1083. }
  1084. //动画轮播
  1085. let 轮播栏广告2 = document.querySelectorAll('[class=" slideBox"][data-href]')
  1086. for (let index = 0; index < 轮播栏广告2.length; index++) {
  1087. let href = 轮播栏广告2[index].getAttribute('data-href');
  1088. if (href) {
  1089. // 提取域名
  1090. //console.log(href)
  1091. const regex = /\/\/(.+)\//;
  1092. // 匹配 URL 字符串中的域名
  1093. const match = href.match(regex);
  1094. // 提取匹配结果中的域名
  1095. const domain = match && match[1];
  1096. if (domain) {
  1097. if (!domain.includes('.youku.') || domain.includes('game')) {
  1098. 轮播栏广告2[index].parentElement.remove()
  1099. }
  1100. }
  1101. }
  1102. }
  1103. console.log('优酷广告去除执行完成')
  1104. }
  1105. }
  1106. //监测全屏状态
  1107. function 监测全屏状态() {
  1108. var targetNode = document.querySelector("body"); // 要监测的目标元素
  1109. // console.log("蜀黍", targetNode);
  1110. var observer = new MutationObserver(function (mutationsList) {
  1111. for (var mutation of mutationsList) {
  1112. if (mutation.type === 'attributes') {
  1113. // 如果发现目标元素的属性变化
  1114. if (mutation.attributeName === 'class') {
  1115. console.log('类名发生了变化:', targetNode.className);
  1116. const main_button = document.querySelector(".main_button");
  1117. const toggle_button = document.querySelector(".toggle_button");
  1118. if (targetNode.className === "tvplayer-fake-fullscreeen plugin_ctrl_fake_fullscreen") {
  1119. main_button.style.opacity = "0";
  1120. toggle_button.style.opacity = "0";
  1121. } else {
  1122. main_button.style.opacity = "1";
  1123. toggle_button.style.opacity = "1";
  1124. }
  1125. }
  1126. }
  1127. }
  1128. });
  1129. var config = { attributes: true, attributeFilter: ['class', 'dt-params'] };
  1130. observer.observe(targetNode, config);
  1131. }
  1132.  
  1133. function 侧边栏按钮创建() {
  1134. // 创建侧边栏开关按钮元素
  1135. if (!location.hostname.includes('v.qq.')) {
  1136. return;
  1137. }
  1138. const selectButton = document.createElement('div');
  1139. selectButton.className = 'toggle_button';
  1140. selectButton.textContent = '<';
  1141. // 设置按钮样式
  1142. selectButton.style.top = '40%';
  1143. selectButton.style.color = 'rgb(55, 99, 57)';
  1144. selectButton.style.background = 'linear-gradient(to right, rgb(220, 240, 176), rgba(252, 247, 224, 0.5))';
  1145. selectButton.style.cursor = 'pointer';
  1146. selectButton.style.zIndex = '9999';
  1147. selectButton.style.position = 'fixed';
  1148. selectButton.style.width = '15px';
  1149. selectButton.style.height = '50px';
  1150. selectButton.style.borderRadius = '2px';
  1151. selectButton.style.lineHeight = '50px';
  1152. selectButton.style.display = 'flex';
  1153. selectButton.style.justifyContent = 'center'
  1154. document.body.appendChild(selectButton);
  1155. 侧边栏调整()
  1156. }
  1157. //手动调整侧边剧集栏,初次打开网页,会自动收起侧边剧集栏
  1158. function 侧边栏调整() {
  1159. // 封装函数来处理侧边栏的显示和隐藏
  1160.  
  1161. function toggleSidebar(selectButton) {
  1162. var 展开侧边栏;
  1163. //新版侧边栏,没有自带按钮
  1164. const 自带收缩按钮 = document.querySelector('.player__wide-btn');
  1165. const sidebar = document.querySelector('.page-content__right');
  1166. if (自带收缩按钮) {
  1167. dinglan = document.querySelector('.site_head.dd.site_head_channel');
  1168. let 播放器 = document.querySelector('#player-container');
  1169. var episode = document.querySelectorAll(".container-episode").length
  1170. //判断自带的关闭侧边栏按钮
  1171. var wideBtn = 自带收缩按钮;
  1172. if (episode) {
  1173. if (wideBtn) {
  1174. wideBtn.click();
  1175. 展开侧边栏 = false;
  1176. }
  1177. } else {
  1178. if (wideBtn) {
  1179. wideBtn.click();
  1180. 展开侧边栏 = true;
  1181. }
  1182. }
  1183. return;
  1184. } else {
  1185. let 播放器 = document.querySelector('#player-container');
  1186. if (!播放器) {
  1187. return;
  1188. }
  1189.  
  1190. if (sidebar.style.display === 'none') {
  1191. // 恢复侧边栏
  1192. sidebar.style.display = '';
  1193. 展开侧边栏 = true;
  1194. } else {
  1195. // 关闭侧边栏
  1196. sidebar.style.display = 'none';
  1197. 展开侧边栏 = false;
  1198. }
  1199. }
  1200. //收缩展开侧边栏,并重新调整播放器大小
  1201. if (展开侧边栏 === true) {
  1202. selectButton.textContent = '<';
  1203. var 播放器框架 = document.querySelector(".container-main__left")
  1204. // 从元素中获取原始宽度和高度
  1205. const originalWidth = 播放器.style.width;
  1206. const originalHeight = 播放器.style.height;
  1207. //新的高度site_head dd site_head_channel top-nav-wrap head_inner
  1208. var dinglan = document.querySelector('.top-nav-wrap.head_inner');
  1209. var newVideoHeight = window.innerHeight - dinglan.offsetHeight - 30;
  1210. // 计算新的宽度
  1211. //const newWidth = (parseInt(originalWidth) / parseInt(originalHeight)) * newVideoHeight;
  1212. // 设置元素 player-container 的宽度
  1213. //播放器.style.width = `${newWidth}px`;
  1214.  
  1215. 播放器.style.height = `${newVideoHeight}px`;
  1216. console.log("新的播放器宽度", newVideoHeight)
  1217. // 将修改后的宽度和高度保存在浏览器缓存中
  1218. //localStorage.setItem('modifiedWidth', `${newWidth}px`);
  1219. localStorage.setItem('modifiedHeight', `${newVideoHeight}px`);
  1220. } else {
  1221. selectButton.textContent = '>';
  1222. // 从缓存中获取修改后的宽度和高度
  1223. //const cachedWidth = localStorage.getItem('modifiedWidth');
  1224. const cachedHeight = localStorage.getItem('modifiedHeight');
  1225. // 设置元素 player-container 的宽度和高度
  1226. //播放器.style.width = cachedWidth;
  1227. 播放器.style.height = cachedHeight;
  1228. }
  1229. }
  1230. //侧边栏按钮点击
  1231. const selectButton = document.querySelector('.toggle_button')
  1232. selectButton.addEventListener('click', function (event) {
  1233. event.stopPropagation(); // 阻止事件冒泡
  1234. event.preventDefault(); // 阻止默认行为
  1235. toggleSidebar(selectButton);
  1236. });
  1237. //绑定按钮元素移动
  1238. selectButton.addEventListener('mousedown', function (e) {
  1239. //dragMenu(selectButton, e);
  1240. });
  1241. if (localStorage.getItem('closesidebar') === "true") {
  1242. toggleSidebar(selectButton);
  1243.  
  1244. }
  1245. }
  1246. //元素移动函数
  1247.  
  1248. //提示弹幕
  1249. function showToast(message, isError) {
  1250. // 创建新的提示框
  1251. const toastContainer = document.createElement('div');
  1252. // 设置样式属性
  1253. toastContainer.style.position = 'fixed';
  1254. toastContainer.style.justifyContent = 'center';
  1255. toastContainer.style.top = '30%';
  1256. toastContainer.style.left = '50%';
  1257. toastContainer.style.width = '65vw';
  1258. toastContainer.style.transform = 'translate(-50%, -50%)';
  1259. toastContainer.style.display = 'flex';
  1260. toastContainer.style.padding = '5px';
  1261. toastContainer.style.fontSize = '20px';
  1262. toastContainer.style.background = '#e7f4ff';
  1263. toastContainer.style.zIndex = '999';
  1264. toastContainer.style.borderRadius = '15px';
  1265. toastContainer.classList.add('PopupMessage'); // 设置 class 名称为 PopupMessage
  1266. // 根据是否为错误提示框添加不同的样式
  1267. if (isError) {
  1268. toastContainer.classList.add('success');
  1269. toastContainer.style.color = '#3fc91d';
  1270. } else {
  1271. toastContainer.classList.add('error');
  1272. toastContainer.style.color = '#CC5500';
  1273. }
  1274. // 将提示框添加到页面中
  1275. document.body.appendChild(toastContainer);
  1276. // 获取页面高度的 20vh
  1277. const windowHeight = window.innerHeight;
  1278. //设置最低的高度。
  1279. const height = windowHeight * 0.2;
  1280. // 设置当前提示框的位置
  1281. toastContainer.style.top = `${height}px`;
  1282. // 在页面中插入新的信息
  1283. const toast = document.createElement('div');
  1284. // 使用 <br> 实现换行
  1285. toast.innerHTML = message.replace(/\n/g, '<br>');
  1286. toastContainer.appendChild(toast);
  1287. // 获取所有的弹出信息元素,包括新添加的元素
  1288. const popupMessages = document.querySelectorAll('.PopupMessage');
  1289. // 调整所有提示框的位置
  1290. let offset = 0;
  1291. popupMessages.forEach(popup => {
  1292. if (popup !== toastContainer) {
  1293. popup.style.top = `${parseInt(popup.style.top) - toast.offsetHeight - 5}px`;
  1294. }
  1295. offset += popup.offsetHeight;
  1296. });
  1297. // 在 3 秒后隐藏提示框
  1298. setTimeout(() => {
  1299. toastContainer.classList.add('hide');
  1300. // 过渡动画结束后移除提示框
  1301. setTimeout(() => {
  1302. toastContainer.parentNode.removeChild(toastContainer);
  1303. }, 300);
  1304. }, 3000);
  1305. }
  1306.  
  1307. //监测激活状态
  1308. function 监测激活状态() {
  1309. document.addEventListener("visibilitychange", function () {
  1310. if (document.visibilityState === "visible") {
  1311. // 浏览器窗口处于激活状态
  1312. console.log("浏览器已激活");
  1313. document.querySelector("body").click();
  1314. } else {
  1315. // 浏览器窗口处于非激活状态
  1316. console.log("浏览器已非激活");
  1317. }
  1318. });
  1319.  
  1320. }
  1321.  
  1322. function 函数存放(函数) {
  1323. // txp_videos_container
  1324. if (函数 === "轮播栏广告小图") {
  1325. if (localStorage.getItem('removewatermark') === "true") {
  1326. var elements = document.querySelectorAll(".focus-item");
  1327. elements.forEach(function (element) {
  1328. if (element.tagName === "A") {
  1329. // console.log("蜀黍", element.href);
  1330. if (element.href === "javascript:;") {
  1331. var 关闭广告 = document.querySelector(".close-creative");
  1332. if (关闭广告) {
  1333. if (关闭广告.title === "关闭广告") {
  1334. 关闭广告.click();
  1335. console.log("移除轮播栏的广告成功")
  1336. return;
  1337. } else {
  1338. console.log("删除轮播栏的广告成功")
  1339. element.remove();
  1340. 关闭广告 = document.querySelector(".close-creative");
  1341. if (关闭广告.title === "关闭广告") {
  1342. 关闭广告.click();
  1343. console.log("移除轮播栏的广告成功2")
  1344. return;
  1345. }
  1346. }
  1347. }
  1348. }
  1349. }
  1350. });
  1351. }
  1352. }
  1353. if (函数 === "轮播栏广告播放") {
  1354. if (localStorage.getItem('removewatermark') === "true") {
  1355. var 轮播广告栏 = document.querySelectorAll('.focus-wrap.large-focus')
  1356. if (轮播广告栏) {
  1357. var targetNode = document.querySelector(".close-creative");
  1358. if (targetNode) {
  1359. var adobserver = new MutationObserver(function (mutationsList, observer) {
  1360. for (var mutation of mutationsList) {
  1361. if (mutation.type === 'attributes' && mutation.attributeName === 'title') {
  1362. if (mutation.target.title === "关闭广告") {
  1363. mutation.target.click();
  1364. }
  1365. }
  1366. }
  1367. });
  1368. var config = { attributes: true };
  1369. adobserver.observe(targetNode, config);
  1370. }
  1371. }
  1372. }
  1373. }
  1374. if (函数 === "去除视频水印") {
  1375. if (localStorage.getItem('removewatermark') === "true") {
  1376. if (document.querySelector("#player > txpdiv")) {
  1377. document.querySelector("#player > txpdiv").remove();
  1378. console.log("视频水印已去除1")
  1379. }
  1380. var watermarkElement = document.querySelector('.txp-watermark');
  1381. if (watermarkElement) {
  1382. // 移除水印元素
  1383. watermarkElement.parentNode.removeChild(watermarkElement);
  1384. console.log("视频水印已去除2")
  1385. }
  1386. }
  1387. }
  1388. if (函数 === "页面样式修改") {
  1389. if (localStorage.getItem('htmlbackground') === "true") {
  1390. var 主题选择 = document.querySelector('#cars');
  1391. if (主题选择) {
  1392. 主题色选择(主题选择.value);
  1393. } else {
  1394. let 主题 = "月光色";
  1395. 主题色选择(主题);
  1396. }
  1397. if (location.hostname.includes('v.qq.')) {
  1398. var css = `
  1399. /*预约按钮*/
  1400. .video-subscribe-btn.order-normal-button {
  1401. background: rgb(251 128 2 / 75%) !important;
  1402. }
  1403. body {
  1404. background: ${主题色} url(//vm.gtimg.cn/z/static/vplay/child-bg.png) !important;
  1405. --background: ${主题色} !important;
  1406. }
  1407. /*视频列表*/
  1408. .list-page-wrap{
  1409. background: ${主题色} !important;
  1410. }
  1411. /*视频列表-返回*/
  1412. .list-page-wrap .kinds-list-wrap{
  1413. background: ${主题色} !important;
  1414. }
  1415. ._footer-wrap_yjuq2_1 {
  1416. background: ${主题色} !important;
  1417. }
  1418. /*顶栏设置*/
  1419. .top-nav-wrap.top-nav-wrap-black {
  1420. /*background: linear-gradient(to bottom,${深主题色} ,${主题色});*/
  1421. background: ${主题色};
  1422. }
  1423. /*播放界面顶栏设置*/
  1424. #ssi-header{
  1425. --background: rgb(12 76 125 / 80%) !important;
  1426. }
  1427. // .top-nav-wrap[data-v-063bf321]{
  1428. // background: ${主题色} ;
  1429. // }
  1430. .left-nav-wrap .logo-wrap{
  1431. /*background: linear-gradient(to bottom,${深主题色} ,${主题色});*/
  1432. background-image: linear-gradient(-90deg,rgba(20,20,20,0) 1%,rgba(20,20,20,0) 99%);
  1433. }
  1434. /*左侧菜单列表*/
  1435. .left-nav-wrap.let-nav-wrap-black{
  1436. background: ${主题色} !important;
  1437. }
  1438. // /*左侧菜单列表*/
  1439. // .left-nav-wrap .nav-wrap{
  1440. // background: ${主题色} ;
  1441. // }
  1442. .sub-nav-group{
  1443. background-color:${深主题色}d9 !important;
  1444. }
  1445. .video-card-wrap{
  1446. background: linear-gradient(to bottom, rgb(43, 43, 43), ${主题色}) !important;
  1447. }
  1448. /*视频图标变大*/
  1449. .video-card-wrap .video-card {
  1450. position: relative;
  1451. }
  1452. .video-card-wrap .video-card::before {
  1453. content: "";
  1454. border-radius: 16px;
  1455. position: absolute;
  1456. top: 0;
  1457. left: 0;
  1458. width: 100%;
  1459. height: 100%;
  1460. background-color: ${主题色}4d; /* 设置遮罩层的颜色和透明度 */
  1461. z-index: 1; /* 确保遮罩层位于元素之上 */
  1462. opacity: 0; /* 初始时遮罩层透明 */
  1463. transition: opacity 0.3s ease; /* 添加过渡效果 */
  1464. box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3); /* 添加内阴影效果 */
  1465. }
  1466. .video-card-wrap .video-card:hover::before {
  1467. opacity: 1; /* 鼠标悬停时遮罩层完全显示 */
  1468. }
  1469. .content.fixed{
  1470. background: ${主题色}d9 !important;
  1471. }
  1472. /*客户端下载*/
  1473. .pop_info_content.pop_client_wrap{
  1474. background: ${主题色}d9 !important;
  1475. }
  1476. /*视频分类详情列表*/
  1477. .list-base-wrap[data-v-b9f874bd]{
  1478. background: ${主题色} ;
  1479. }
  1480. /*返回*/
  1481. .list-page-wrap .back-btn-wrap[data-v-fda3d7da]{
  1482. background: ${主题色} ;
  1483. }
  1484. .list-base-wrap .kinds-list-wrap .kinds-list-content .abbreviat-filters[data-v-b9f874bd]{
  1485. background: ${主题色} ;
  1486. }
  1487. /*置顶按钮*/
  1488. .list-base-wrap .goToTop[data-v-b9f874bd]{
  1489. background: ${深主题色}cc ;
  1490. }
  1491. .list-base-wrap .goToTop[data-v-b9f874bd]:hover{
  1492. background: ${深主题色}e6 ;
  1493. }
  1494. /*播放页面*/
  1495. /*VIP提示*/
  1496. .vip-button__main-title--v2 {
  1497. color: ${VIP主题色} !important;
  1498. }
  1499. .playlist-side-fuild__container{
  1500. background: ${主题色}d9 !important;
  1501. }
  1502. .general-banner-adapt.filter-labels-wrap{
  1503. background: ${主题色}d9 !important;
  1504. }
  1505. .focus-wrap.large-focus {
  1506. box-shadow: 0px 0px 20px 21px rgb(3 21 26) !important;
  1507. }
  1508. /*分享列表*/
  1509. .playlist-intro__btns{
  1510. background: ${主题色} !important;
  1511. }
  1512. /*全集列表*/
  1513. .playlist-overlay{
  1514. background: ${主题色} !important;
  1515. }
  1516. /*历史记录*/
  1517. .quick_pop_tabs{
  1518. background: ${浅主题色} !important;
  1519. }
  1520. .mod_quick_videolist.mod_quick_videolist_history{
  1521. background: ${主题色} !important;
  1522. }
  1523. .quick_pop_footer{
  1524. background: ${浅主题色} !important;
  1525. }
  1526. /*旧播放界面背景*/
  1527. .container-main__wrapper[data-v-e54bf460] {
  1528. background: ${浅主题色} ;
  1529. }
  1530. /*提示框*/
  1531. .toast-wrap{
  1532. background: ${深主题色}d9 !important;
  1533. }
  1534. /*反馈按钮*/
  1535. .x_fixed_tool{
  1536. background: ${主题色}d9 !important;
  1537. }
  1538. /*备案字体颜色*/
  1539. ._footer-wrap_yjuq2_1 * {
  1540. color: ${备案字体颜色} !important;
  1541. }
  1542. /*旧播放器页面*/
  1543. /*评论背景*/
  1544. .container-bottom{
  1545. background: ${主题色} !important;
  1546. }
  1547. /*顶栏*/
  1548. .new_vs_header{
  1549. background: ${深主题色}d9 !important;
  1550. }
  1551. /*顶栏字体*/
  1552. .site_channel .channel_nav {
  1553. color: ${亮色字体} ;
  1554. }
  1555. /*顶栏右边图标*/
  1556. .mod_quick .quick_link{
  1557. color: ${亮色字体} ;
  1558. }
  1559. .site_channel .channel_more{
  1560. color: ${亮色字体} !important;
  1561. }
  1562. .site_head.dd.site_head_simple {
  1563. background: ${深主题色}d9 !important;
  1564. }
  1565. /*备案栏*/
  1566. ._footer-wrap_momhz_1{
  1567. background: ${主题色} !important;
  1568. }
  1569. ._footer-wrap_momhz_1 * {
  1570. color: ${备案字体颜色} !important;
  1571. }
  1572. /*长文本按钮*/
  1573. .at-feed-stream-tab {
  1574. color: ${浅色字体} !important;
  1575. }
  1576. /*评论颜色*/
  1577. .at-feed__date{
  1578. color: ${浅色字体} !important;
  1579. }
  1580. /*未选择颜色*/
  1581. .at-feed-stream-tab__nav-item{
  1582. color: ${浅色字体} !important;
  1583. }
  1584. /*登陆颜色*/
  1585. .at-feed-stream-post__login{
  1586. color: ${浅色字体} !important;
  1587. }
  1588. .t-feed__date{
  1589. color: ${备案字体颜色} !important;
  1590. }
  1591. /*无评论颜色*/
  1592. .at-feed-stream-tab .at-net-error__title{
  1593. color: ${浅色字体} !important;
  1594. }
  1595. /*长文本编写框*/
  1596. .mod-page__editor{
  1597. background: ${浅主题色} !important;
  1598. }
  1599. /*正文*/
  1600. .ql-container.ql-snow *{
  1601. background: ${浅主题色} !important;
  1602. }
  1603. /**/
  1604. .mod-page__action{
  1605. background: ${浅主题色}00 !important;
  1606. }
  1607. .mod-card{
  1608. background: ${浅主题色}00 !important;
  1609. }
  1610. .mod-button.disabled {
  1611. background: ${深主题色} !important;
  1612. }
  1613. /*备案栏配置*/
  1614. .contentinfo_title{
  1615. color: ${深色字体} !important;
  1616. }
  1617. .mod_footer_contentinfo .foot_link{
  1618. color: ${浅色字体} !important;
  1619. }
  1620. .mod_footer_contentinfo .dl_list .item{
  1621. color: ${浅色字体} !important;
  1622. }
  1623. .mod_footer *{
  1624. color: ${浅色字体} !important;
  1625. }
  1626. .cookie_textrea {
  1627. width: 0px;
  1628. /* 设置滚动条宽度 */
  1629. }
  1630. .cookie_textrea::-webkit-scrollbar {
  1631. width: 0px;
  1632. /* 设置滚动条宽度 */
  1633. }
  1634. .button:hover::after {
  1635. border-radius: 5px;
  1636. background-color: rgba(255, 255, 255, 0.3) !important;
  1637. }
  1638. .button:hover {
  1639. border-radius: 5px;
  1640. background-color: #70B9E8;
  1641. }
  1642. .button:active {
  1643. border-radius: 5px;
  1644. background: #2db628;
  1645. /* position: fixed; */
  1646. /* margin-bottom: 9px; */
  1647. text-shadow: none;
  1648. box-shadow: 10px 10px 10px rgba(0, 0, 0, .3) inset;
  1649. }
  1650. /*视频图标变大*/
  1651. .card.vertical {
  1652. transition: transform 0.3s ease; /* 添加过渡效果 */
  1653. }
  1654. .card.vertical:hover {
  1655. transform: scale(1.2); /* 鼠标悬停时放大1.2倍 */
  1656. }
  1657. `;
  1658. }
  1659.  
  1660. //优酷主题
  1661. if (location.hostname.includes('.youku.')) {
  1662. let css = `
  1663. #app{
  1664. background-color: ${主题色} ;
  1665. }
  1666. body {
  1667. background: ${主题色};
  1668. }
  1669. /*顶栏*/
  1670. .topheader_top_header_box{
  1671. background-color:${深主题色}ab !important;
  1672. }
  1673. /*轮播栏阴影*/
  1674. .focussidebarswiper_focus_wrap{
  1675. box-shadow: 0px 0px 20px 21px rgb(3 21 26) !important;
  1676. }
  1677. [data-theme=dark] .right-wrap{
  1678. background-color: ${主题色} ;
  1679. }
  1680. [class="preview_preview_wrap"]{
  1681. background-color:#deb406 ;
  1682. }
  1683. .preview_preview_wrap .preview_preview_pos .preview_preview_desc, .preview_preview_wrap_focus .preview_preview_pos .preview_preview_desc, .preview_preview_wrap_focus_out .preview_preview_pos .preview_preview_desc, .preview_preview_wrap_out .preview_preview_pos .preview_preview_desc{
  1684. color: #ffffff;
  1685. }
  1686. [data-theme=dark] .module-playbox-new .playbox-new .play-paction-wrap-new .nav-mamu-new{
  1687. background-color: ${深主题色}e0 ;
  1688. }
  1689. /*播放器左侧*/
  1690. .play-top-container-new{
  1691. background-color: ${主题色} ;
  1692. }
  1693. #app{
  1694. background-color: ${主题色} ;
  1695. }
  1696. /*播放页面视频介绍*/
  1697. [data-theme=dark] .bottom-area-wrap-new{
  1698. background-color: ${主题色} ;
  1699. }
  1700. /*主页顶栏*/
  1701. .topheader_topheaderwrap{
  1702. background-color:${深主题色}cf !important;
  1703. }
  1704. .modulelist_s_body{
  1705. background-color: ${主题色} ;
  1706. }
  1707. .g-box{
  1708. border-radius: 10px;
  1709. background: linear-gradient(to bottom, ${深主题色} , ${主题色}61);
  1710. }
  1711. .pack_yk_pack_focus .pack_info_list{
  1712. background-color: ${深主题色};
  1713. }
  1714. .newswiper_swiper_wrap{
  1715. box-shadow: 0px 0px 20px 21px rgb(3 21 26) !important;
  1716. }
  1717. .preview_preview_wrap_focus{
  1718. background-color: ${深主题色};
  1719. }
  1720. .preview_preview_wrap.preview_posright{
  1721. background-color: ${深主题色};
  1722. }
  1723. .pack_yk_pack_v .pack_pack_cover, .pack_yk_pack_v .pack_vip_cover{
  1724. background-color: ${深主题色};
  1725. }
  1726. /*轮播栏*/
  1727. .module_mod{
  1728. top: 70px;
  1729. }
  1730. /*轮播栏下选择按钮*/
  1731. .channelcommon_container{
  1732. top: 50px;
  1733. }
  1734. `
  1735.  
  1736. }
  1737. //爱奇艺主题
  1738. if (location.hostname.includes('.iqiyi.')) {
  1739. let css = `
  1740. .qy-header.home2020.qy-header-fixed.qy-header--bg .header-wrap{
  1741. background-color: ${深主题色}cc;
  1742. }
  1743. .content-wrap[data-v-5baba7d6]{
  1744. background: linear-gradient(180deg,transparent,${主题色} 150px);
  1745. }
  1746. .qy20-h-carousel-wrap[data-v-e765da72], .qy20-h-carousel[data-v-e765da72]{
  1747. background: ${主题色} !important;
  1748. }
  1749. .ch-res[data-v-bc0d88da]{
  1750. min-width: 100%;
  1751. }
  1752. .qy20-h-carousel__maskl{
  1753. background-image: linear-gradient(270deg, ${主题色} 0%, transparent) !important;
  1754. }
  1755. /*顶栏*/
  1756. .qy-header.home2020.qy-header--absolute .header-wrap{
  1757. background: linear-gradient(180deg,${主题色}c9,#ff000000 150px);
  1758. }
  1759. .qy20-h-carousel__maskr{
  1760. background-image: linear-gradient(270deg, ${主题色} 0%, transparent) !important;
  1761. }
  1762. .tl-layout[data-v-5ed27594] {
  1763. width: 94%;
  1764. left: 2%;
  1765. }
  1766. /**/
  1767. .qy-mod-list .qy-mod-li[data-v-5643dd65]{
  1768. border-radius: 10px;
  1769. background: linear-gradient(180deg,#e9182600,${深主题色} 150px);
  1770. }
  1771. .card-hover-animation{
  1772. background-color: ${深主题色} !important;
  1773. }
  1774. .qy-header.home2020 .header-wrap{
  1775. background-color: ${深主题色};
  1776. }
  1777. .abs[data-v-3da728c4], .side-cont[data-v-3da728c4]{
  1778. background-color: ${主题色} ;
  1779. }
  1780. .qy-footer[data-v-48b3cf8e]{
  1781. background-color:${主题色} ;
  1782. }
  1783. .qy-dark{
  1784. background:${主题色} ;
  1785. }
  1786. `
  1787. }
  1788.  
  1789. let style = document.createElement('style');
  1790. style.type = 'text/css';
  1791. style.textContent = css;
  1792. document.head.appendChild(style);
  1793. }
  1794. // // 主页第一个列表栏
  1795. // const parentElement = document.querySelector('[class="tl-layout"]');
  1796. // if (parentElement) {
  1797. // // 创建要添加的元素
  1798. // const newElement = document.createElement("div");
  1799. // // 设置新元素的样式
  1800. // newElement.style.position = "relative";
  1801. // newElement.style.margin = "0 auto";
  1802. // newElement.style.width = "994px";
  1803. // newElement.style.height = "20px";
  1804. // newElement.style.minWidth = "100vw";
  1805. // newElement.style.background = `linear-gradient(to bottom, #151515, ${主题色} )`;
  1806. // newElement.style.overflow = "hidden";
  1807. // newElement.style.pointerEvents = "auto";
  1808. // // 将新元素添加到父元素的后面
  1809. // parentElement.insertAdjacentElement('beforebegin', newElement);
  1810. // }
  1811. }
  1812. if (函数 === "窄版页面样式修改") {
  1813. if (localStorage.getItem('htmlbackground') === "true") {
  1814. let 主题选择 = document.querySelector('#cars');
  1815. if (主题选择) {
  1816. 主题色选择(主题选择.value);
  1817. } else {
  1818. let 主题 = "月光色";
  1819. 主题色选择(主题);
  1820. }
  1821.  
  1822. let css = `
  1823. /*视频展示背景图片框*/
  1824. .item_content {
  1825. border-radius: 9px;
  1826. }
  1827. `;
  1828. // css2=` /*顶栏背景*/
  1829. // .mod_channel .site_header {
  1830. // background: ${主题色};
  1831. // }
  1832. // /*视频预览区*/
  1833. // .mod_channel .container {
  1834. // background: ${主题色};
  1835. // }
  1836. // /*轮播栏背景*/
  1837. // .mod_channel .swiper {
  1838. // background: ${主题色};
  1839. // }
  1840. // /*轮播栏页面数提示*/
  1841. // .mod_channel .swiper-container .swiper_count {
  1842. // background: ${主题色};
  1843. // }`
  1844. var style = document.createElement('style');
  1845. style.type = 'text/css';
  1846. style.textContent = css;
  1847. document.head.appendChild(style);
  1848. }
  1849. }
  1850. if (函数 === "加载时可删除广告") {
  1851. // 顶栏的游戏广告关闭按钮
  1852. if (localStorage.getItem('removewatermark') === "true") {
  1853. var quick_games = document.querySelector('.quick_item.quick_games');
  1854. if (quick_games) {
  1855. quick_games.remove();
  1856. }
  1857. 爱奇艺去广告();
  1858. }
  1859. }
  1860. if (函数 === "去除游戏栏目") {
  1861. if (localStorage.getItem('removewatermark') === "true") {
  1862. removeElements();
  1863. function removeElements() {
  1864. var pauseVideos = document.querySelectorAll("._nav-item_ugz17_31");
  1865. if (pauseVideos.length > 0) {
  1866. pauseVideos.forEach(function (video) {
  1867. var span = video.querySelector('span').textContent.trim();
  1868. console.log(span);
  1869. if (span === "游戏" || span === "传奇游戏库" || span === "棋牌游戏库" || span === "游戏中心") {
  1870. video.remove();
  1871. // console.log(2, span);
  1872. }
  1873. });
  1874. }
  1875. }
  1876. var elementsWithDtCmd = document.querySelectorAll('[dt-cmd]');
  1877. // 遍历所有匹配的元素
  1878. elementsWithDtCmd.forEach(function (element) {
  1879. // 在这里对每个元素执行您的操作
  1880. var text = element.textContent.trim();
  1881. if (text === "游戏" || text === "传奇游戏库" || text === "棋牌游戏库" || text === "游戏中心") {
  1882. element.parentNode.remove();
  1883. // console.log(element);
  1884. }
  1885. });
  1886. // 顶栏的全部视频里的
  1887. var sub_nav_item = document.querySelectorAll(".sub-nav-item");
  1888. // 遍历所有匹配的元素
  1889. sub_nav_item.forEach(function (element) {
  1890. // 在这里对每个元素执行您的操作
  1891. var text = element.textContent.trim();
  1892. if (text === "游戏" || text === "传奇游戏库" || text === "棋牌游戏库" || text === "游戏中心") {
  1893. element.remove();
  1894. // console.log(element);
  1895. }
  1896. });
  1897. //顶栏上的
  1898. var nav_all_text = document.querySelectorAll(".nav-all-text");
  1899. // 遍历所有匹配的元素
  1900. nav_all_text.forEach(function (element) {
  1901. // 在这里对每个元素执行您的操作
  1902. var text = element.textContent.trim();
  1903. if (text === "游戏" || text === "传奇游戏库" || text === "棋牌游戏库" || text === "游戏中心") {
  1904. element.textContent = "体育"
  1905. console.log(element);
  1906. }
  1907. });
  1908. }
  1909. }
  1910. if (函数 === "轮播栏广告播放") {
  1911.  
  1912. }
  1913. if (函数 === "轮播栏广告播放") {
  1914.  
  1915. }
  1916. if (函数 === "轮播栏广告播放") {
  1917.  
  1918. }
  1919. if (函数 === "去除app提示") {
  1920. const open_app_bottom2 = document.querySelector('[dt-eid="open_app_bottom"]');
  1921. if (open_app_bottom2) {
  1922. open_app_bottom2.style.display = 'none'
  1923. console.log('警察蜀黍11')
  1924. }
  1925. //打开app
  1926. const openapp = document.querySelector('.site-top__open-app');
  1927. if (openapp) {
  1928. openapp.style.display = 'none'
  1929. console.log('警察蜀黍22')
  1930. }
  1931. //继续使用浏览器
  1932. const textbutton = document.querySelector('.at-app-banner--textbutton');
  1933. if (textbutton) {
  1934. textbutton.style.display = 'none'
  1935. console.log('警察蜀黍33')
  1936. }
  1937. var 花絮资讯 = document.querySelectorAll('.title')
  1938. for (let index = 0; index < 花絮资讯.length; index++) {
  1939. if (花絮资讯[index].textContent = '花絮资讯') {
  1940. 花絮资讯[index].remove()
  1941. }
  1942. }
  1943.  
  1944. var 相关视频 = document.querySelector('.bottom-wrapper')?.remove();
  1945. //var 预告视频=document.querySelector('.playlist.playlist--trival')?.remove()
  1946. var 打开看完整版 = document.querySelector('.open-app.old-open')?.remove();
  1947. //打开app播放
  1948.  
  1949. var banner = document.querySelector('.at-app-banner');
  1950. if (banner) {
  1951. banner.style.display = "none";
  1952. }
  1953.  
  1954. }
  1955. }
  1956. function 主题色选择(主题) {
  1957. if (主题 === "青色") {
  1958. 主题色 = "#083e4f";
  1959. 深主题色 = "#052935";
  1960. 浅主题色 = "#104353";
  1961. VIP主题色 = "#ffb300";
  1962. 备案字体颜色 = '#5c96a9';
  1963. 浅色字体 = '#5a8b9b';
  1964. 亮色字体 = "#006f93";
  1965. 深色字体 = "#002835";
  1966. } else {
  1967. if (主题 === "金色") {
  1968. 主题色 = "#9d5901";
  1969. 深主题色 = "#673b01";
  1970. 浅主题色 = "#673b01";
  1971. VIP主题色 = "#ffb300";
  1972. 备案字体颜色 = '#5c96a9';
  1973. 浅色字体 = '#5a8b9b';
  1974. 亮色字体 = "#22e56e";
  1975. 深色字体 = "#00210d";
  1976. } else {
  1977. if (主题 === "金黄色") {
  1978. 主题色 = "#ffa500";
  1979. 深主题色 = "#e59503";
  1980. 浅主题色 = "#e59503";
  1981. VIP主题色 = "#ffb300";
  1982. 备案字体颜色 = '#5c96a9';
  1983. 浅色字体 = '#5a8b9b';
  1984. 亮色字体 = "#22e56e";
  1985. 深色字体 = "#00210d";
  1986. } else {
  1987. if (主题 === "芒果色") {
  1988. 主题色 = "#F5CBA3";
  1989. 深主题色 = "#EB8F3B";
  1990. 浅主题色 = "#F8D8BA";
  1991. VIP主题色 = "#ffb300";
  1992. 备案字体颜色 = '#5c96a9';
  1993. 浅色字体 = '#5a8b9b';
  1994. 亮色字体 = "#22e56e";
  1995. 深色字体 = "#00210d";
  1996. } else {
  1997. if (主题 === "神秘森林") {
  1998. 主题色 = "#0F612F";
  1999. 深主题色 = "#0A3E1E";
  2000. 浅主题色 = "#5F9675";
  2001. VIP主题色 = "#ffb300";
  2002. 备案字体颜色 = "#8bc1a0";
  2003. 浅色字体 = '#5a8b9b';
  2004. 亮色字体 = "#1ed163";
  2005. 深色字体 = "#00210d";
  2006. } else {
  2007. if (主题 === "辣红色") {
  2008. 主题色 = "#A91721";
  2009. 深主题色 = "#6F0F15";
  2010. 浅主题色 = "#B17D81";
  2011. VIP主题色 = "#ffb300";
  2012. 备案字体颜色 = "#8bc1a0";
  2013. 浅色字体 = '#5a8b9b';
  2014. 亮色字体 = "#1ed163";
  2015. 深色字体 = "#00210d";
  2016. } else {
  2017. if (主题 === "月光色") {
  2018. 主题色 = "#0C4C7D";
  2019. 深主题色 = "#072B47";
  2020. 浅主题色 = "#98B3C8";
  2021. VIP主题色 = "#ffb300";
  2022. 备案字体颜色 = "#769dbb";
  2023. 浅色字体 = '#909ea9';
  2024. 亮色字体 = "#1ed163";
  2025. 深色字体 = "#00210d";
  2026. }
  2027. }
  2028. }
  2029. }
  2030. }
  2031. }
  2032. }
  2033. }
  2034. function 新窗口() {
  2035. var 页面链接 = window.location.href;
  2036. const iframeSrc = "https://jx.xmflv.com/?url=" + decodeURIComponent(页面链接);
  2037. document.querySelector('[class="video-item-episode video-item-episode--active video-item-episode--num playlist__item"]')?.textContent
  2038.  
  2039. window.open(iframeSrc);
  2040. console.log('播放器框架2');
  2041. let 播放器 = document.querySelectorAll('video')
  2042. for (let index = 0; index < 播放器.length; index++) {
  2043. 播放器[index].pause();
  2044. 播放器[index].remove();
  2045.  
  2046. }
  2047.  
  2048. }
  2049.  
  2050. function 覆盖按钮(需覆盖按钮) {
  2051. // 找到body下第一个span元素
  2052. //var firstSpan = document.querySelector('[class="c-album-item selected"]');
  2053. var firstSpan = 需覆盖按钮
  2054. // 创建一个透明的覆盖层
  2055. var overlay = document.createElement('div');
  2056. overlay.style.position = 'absolute';
  2057. overlay.className = '覆盖按钮';
  2058. overlay.style.top = '0';
  2059. overlay.style.left = '0';
  2060. overlay.style.width = '100%';
  2061. overlay.style.height = '100%';
  2062. overlay.style.background = 'transparent';
  2063. overlay.style.zIndex = '9999';
  2064. 新窗口()
  2065. // 绑定点击事件到覆盖层
  2066. overlay.addEventListener('click', function (event) {
  2067. event.stopPropagation(); // 阻止事件冒泡
  2068. event.preventDefault(); // 阻止默认行为
  2069. // 在这里可以添加您希望执行的代码
  2070.  
  2071. });
  2072.  
  2073. // 将覆盖层添加到第一个span元素上面
  2074. firstSpan.style.position = 'relative';
  2075. firstSpan.style.zIndex = '9999';
  2076. firstSpan.appendChild(overlay);
  2077. }
  2078. function 更新页面URL(url) {
  2079. window.history.pushState(null, null, url);
  2080.  
  2081. }
  2082. }
  2083.  
  2084. if (location.href.includes('.xmflv.')) {
  2085. var cid;
  2086. var 当前VID;
  2087. var 当前标题 = '酷炫解析';
  2088. 样式创建();
  2089. if (window.location.hostname.includes('xmflv.com')) {
  2090. var 解析域名 = 'https://jx.xmflv.com/?url='
  2091. } else {
  2092. 解析域名 = 'https://jx.xmflv.cc/?url='
  2093. }
  2094. 判断是否是手机设备();
  2095. 页面关闭监测();
  2096. 解析网站广告();
  2097. let 播放按钮 = document.querySelector('[class="art-icon art-icon-play"]')
  2098. if (播放按钮) {
  2099. if (播放按钮.style.display === 'none') {
  2100. if (document.querySelector('[class="art-icon art-icon-pause"]')) {
  2101. } document.querySelector('[class="art-icon art-icon-pause"]').click()
  2102. }
  2103. }
  2104. 创建视频列表主程序();
  2105. 判断视频组件加载();
  2106. 解析网站广告();
  2107. 监测解析网站全屏状态();
  2108. function 判断视频组件加载() {
  2109. var intervalId = setInterval(function () {
  2110. if (document.querySelector('video')) {
  2111. clearInterval(intervalId);
  2112. 监测播放状态();
  2113. 解析站创建主设置组件()
  2114. 判断历史记录();
  2115. //创建下一集按钮();
  2116. document.querySelector('[class="art-controls"]').appendChild(添加辅助功能());
  2117. 弹幕按钮状态();
  2118. 绑定热键();
  2119. 创建隐藏工具条按钮();
  2120. }
  2121. }, 1000);
  2122. }
  2123. function 创建视频列表主程序() {
  2124. (function () {
  2125. 'use strict';
  2126. var 解析地址 = decodeURIComponent(window.location.search);
  2127. var cid;
  2128. var vid;
  2129. // 使用正则表达式匹配cid=之后的字母数字部分
  2130. if (解析地址.includes('v.qq.')) {
  2131. let match = 解析地址.match(/cid=([\w]+)&vid=([\w]+)/);
  2132. if (match ? match[2] : '') {
  2133. cid = match[1];
  2134. vid = match[2];
  2135. 取腾讯视频列表(cid, vid);
  2136. } else {
  2137. match = 解析地址.match(/cover\/([\w]+)\/([\w]+)/);
  2138. if (match ? match[2] : '') {
  2139. cid = match[1];
  2140. vid = match[2];
  2141. 取腾讯视频列表(cid, vid);
  2142. }
  2143. }
  2144. } else {
  2145. if (解析地址.includes('.iqiyi.')) {
  2146. let match = 解析地址.match(/com\/([\w]+)/);
  2147. if (match ? match[1] : '') {
  2148. vid = match[1];
  2149. 取爱奇艺视频主页JSON_GM(match[1]);
  2150. } else {
  2151. match = 解析地址.match(/cover\/([\w]+)/);
  2152. if (match) {
  2153. vid = match[1];
  2154. 取爱奇艺视频主页JSON_GM(vid);
  2155. }
  2156. }
  2157. } else {
  2158. if (解析地址.includes('.youku.')) {
  2159. let match = 解析地址.match(/id_(.*?)\.html/);
  2160. if (match ? match[1] : '') {
  2161. vid = match[1];
  2162. 取优酷视频列表_GM(match[1]);
  2163. }
  2164. }
  2165. }
  2166. }
  2167.  
  2168. function 取腾讯视频列表(cid, vid) {
  2169. let 缓存剧集JSON = JSON.parse(localStorage.getItem('腾讯剧集JSON'))
  2170. if (缓存剧集JSON) {
  2171. if (缓存剧集JSON.cid === cid && 缓存剧集JSON.获取时间 === 取当日时间戳()) {
  2172. 缓存剧集JSON.vid = vid;
  2173. 创建视频列表(缓存剧集JSON)
  2174. return;
  2175. }
  2176. }
  2177. var page_context;
  2178. var 页数 = 0;
  2179. var 总页数;
  2180. var jsondata = {
  2181. "page_params": {
  2182. "req_from": "web_vsite",
  2183. "page_id": "vsite_episode_list",
  2184. "page_type": "detail_operation",
  2185. "id_type": "1",
  2186. "page_size": "",
  2187. "cid": "",
  2188. "vid": "",
  2189. "lid": "",
  2190. "page_num": "",
  2191. "page_context": "",
  2192. "detail_page_type": "1"
  2193. },
  2194. "has_cache": 1
  2195. };
  2196. jsondata.page_params.cid = cid;
  2197. jsondata.page_params.vid = vid;
  2198. var 剧集JSON = {};
  2199. 剧集JSON.列表 = [];
  2200. 剧集JSON.vid = vid;
  2201. function 发送请求() {
  2202. console.log('JSON数据', JSON.stringify(jsondata))
  2203. GM_xmlhttpRequest({
  2204. method: 'POST',
  2205. url: 'https://pbaccess.video.qq.com/trpc.universal_backend_service.page_server_rpc.PageServer/GetPageData?video_appid=3000010&vplatform=2&vversion_name=8.2.96',
  2206. data: JSON.stringify(jsondata),
  2207. headers: {
  2208. 'Content-Type': 'application/json',
  2209. 'accept': 'application/json, text/plain, */*',
  2210. 'accept-language': 'zh-CN,zh;q=0.9',
  2211. 'origin': 'https://v.qq.com',
  2212. 'referer': 'https://v.qq.com/',
  2213. 'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="102"',
  2214. 'sec-ch-ua-mobile': '?0',
  2215. 'sec-ch-ua-platform': '"Windows"',
  2216. 'sec-fetch-dest': 'empty',
  2217. 'sec-fetch-mode': 'cors',
  2218. 'sec-fetch-site': 'same-site',
  2219. 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36'
  2220. },
  2221. onload: function (response) {
  2222. // 处理响应
  2223. let 返回文本 = JSON.parse(response.responseText);
  2224. let post页数列表 = 返回文本.data.module_list_datas[0].module_datas[0].module_params.tabs;
  2225. let 视频列表 = 返回文本.data.module_list_datas[0].module_datas[0].item_data_lists.item_datas
  2226. for (let index = 0; index < 视频列表.length; index++) {
  2227. if (视频列表[index].item_params.union_title != '' && 视频列表[index].item_params.is_trailer === '0') {
  2228. let json = {
  2229. 集数: index + 1,
  2230. cid: cid,
  2231. vid: 视频列表[index].item_params.vid,
  2232. play_title: 视频列表[index].item_params.play_title,
  2233. url: 解析域名 + 'https://m.v.qq.com/x/m/play?cid=' + cid + '&vid=' + 视频列表[index].item_params.vid
  2234. }
  2235. 剧集JSON.列表.push(json)
  2236. }
  2237. }
  2238. if (post页数列表) {
  2239. 总页数 = JSON.parse(post页数列表);
  2240. } else {
  2241. 总页数 = []
  2242. }
  2243.  
  2244. 页数++;
  2245. if (页数 < 总页数.length) {
  2246. //page_context = URL参数转POST(总页数[页数].page_context);
  2247. page_context = 总页数[页数].page_context;
  2248. jsondata.page_params.cid = cid;
  2249. jsondata.page_params.page_context = page_context;
  2250. console.log(页数, page_context, jsondata);
  2251. // 继续发送请求
  2252. 发送请求();
  2253. } else {
  2254. // 所有页数都已获取,退出循环
  2255. console.log(剧集JSON)
  2256. console.log('所有页数已获取');
  2257. 剧集JSON.cid = cid;
  2258. 创建视频列表(剧集JSON)
  2259. 剧集JSON.获取时间 = 取当日时间戳();
  2260. localStorage.setItem('腾讯剧集JSON', JSON.stringify(剧集JSON))
  2261. }
  2262.  
  2263. },
  2264. onerror: function (error) {
  2265. alert(error);
  2266. }
  2267. });
  2268. }
  2269.  
  2270.  
  2271. // 开始第一次请求
  2272. 发送请求();
  2273. }
  2274. function 取爱奇艺视频列表_GM(cid, vid) {
  2275. let 缓存剧集JSON = JSON.parse(localStorage.getItem('爱奇艺剧集JSON'))
  2276. if (缓存剧集JSON) {
  2277. if (缓存剧集JSON.cid === cid && 缓存剧集JSON.获取时间 === 取当日时间戳()) {
  2278. 缓存剧集JSON.vid = vid
  2279. 创建视频列表(缓存剧集JSON)
  2280.  
  2281. return;
  2282. }
  2283. }
  2284. var 剧集JSON = {}
  2285. 剧集JSON.列表 = [];
  2286. 剧集JSON.页数 = 1;
  2287. 剧集JSON.cid = cid;
  2288. 剧集JSON.vid = vid;
  2289. function 发送请求() {
  2290. console.log('发送请求');
  2291. GM_xmlhttpRequest({
  2292. method: 'GET',
  2293. url: `https://pub.m.iqiyi.com/h5/main/videoList/album/?albumId=${cid}&size=50&page=${剧集JSON.页数}&needPrevue=true&needVipPrevue=true`,
  2294. headers: {
  2295. 'authority': 'pub.m.iqiyi.com',
  2296. 'accept': '*/*',
  2297. 'accept-language': 'zh-CN,zh;q=0.9',
  2298. 'sec-ch-ua': '"Not A;Brand";v="99", "Chromium";v="102"',
  2299. 'sec-ch-ua-mobile': '?0',
  2300. 'sec-ch-ua-platform': '"Windows"',
  2301. 'sec-fetch-dest': 'empty',
  2302. 'sec-fetch-mode': 'cors',
  2303. 'sec-fetch-site': 'same-site',
  2304. 'user-agent': 'jdapp;android;8.3.5;9.3.7;;network/wifi;model/Mi Note 2;osVer/26;appBuild/71043;psn/|7;psq/1;uid/;adk/;ads/;pap/JA2015_311210|8.4.2|ANDROID 8.0.0;osv/8.0.0;pv/2.23;jdv/;ref/com.jingdong.app.mall.WebActivity;partner/huawei;apprpd/Home_Main;Mozilla/5.0 (Linux; Android 8.0.0; Mi Note 2 Build/OPR1.170623.032; wv)) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.99 Mobile Safari/537.36'
  2305. },
  2306. onload: function (response) {
  2307. // 处理响应
  2308. if (爱奇艺视频列表数据处理(cid, JSON.parse(response.responseText), 剧集JSON)) {
  2309. 发送请求()
  2310. }
  2311. },
  2312. onerror: function (error) {
  2313. console.error(error);
  2314. }
  2315. });
  2316. }
  2317.  
  2318. // 开始第一次请求
  2319. 发送请求();
  2320. }
  2321. function 取优酷视频列表_GM(cid) {
  2322. let 缓存剧集JSON = JSON.parse(localStorage.getItem('优酷剧集JSON'))
  2323. if (缓存剧集JSON) {
  2324. if (缓存剧集JSON.cid === cid && 缓存剧集JSON.获取时间 === 取当日时间戳()) {
  2325. 缓存剧集JSON.vid = vid
  2326. 创建视频列表(缓存剧集JSON)
  2327. return;
  2328. }
  2329. }
  2330. 加载腾讯cookie()
  2331. var 剧集JSON = {}
  2332. 剧集JSON.列表 = [];
  2333. 剧集JSON.页数 = 1;
  2334. 剧集JSON.cid = cid;
  2335. 剧集JSON.vid = vid;
  2336. function 发送请求() {
  2337. console.log('发送请求');
  2338. GM_xmlhttpRequest({
  2339. method: 'GET',
  2340. url: `https://m.youku.com/video/id_${剧集JSON.cid}.html`,
  2341. headers: {
  2342. 'user-agent': ' Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Mobile Safari/537.36'
  2343. },
  2344. onloadstart: function (response) {
  2345. console.log('请求开始', response);
  2346. },
  2347. onload: function (response) {
  2348. // 处理响应
  2349. let 响应json = response.responseText.match(/window.__INITIAL_DATA__ =(.+?);window.__PLATOCONFIG__ =/)[1];
  2350. if (响应json) {
  2351. console.dir(JSON.parse(响应json))
  2352.  
  2353. }
  2354. if (优酷视频数据处理(剧集JSON.cid, response.responseText, 剧集JSON)) {
  2355. 发送请求()
  2356. }
  2357.  
  2358. },
  2359. onerror: function (error) {
  2360. console.error(error);
  2361. }
  2362. });
  2363. }
  2364.  
  2365. // 开始第一次请求
  2366. 发送请求();
  2367. }
  2368. function 加载腾讯cookie() {
  2369. var cookieDomain = "xmflv.com";
  2370. // 设置cookie字符串
  2371. var cookieStr = 'x5sec=7b22617365727665722d686579693b32223a226663383030616662316364303762656165313337636439383361323663633366434b4b7679617747454b2f4c375a37382f2f2f2f2f774577676f48777a766a2f2f2f2f2f41513d3d222c22733b32223a2261343236396338303436613431336364227d;';
  2372. if (cookieStr) {
  2373. // 分割cookie字符串
  2374. if (cookieStr.trim() !== "") {
  2375. var cookies = cookieStr.split(";");
  2376. if (cookies.length > 0) {
  2377. // 遍历每个cookie,并设置为对应的键值对
  2378. cookies.forEach(function (cookie) {
  2379. var keyValue = cookie.trim().split("=");
  2380. var key = keyValue[0];
  2381. var value = keyValue[1];
  2382. // 设置cookie
  2383. document.cookie = key + "=" + encodeURIComponent(value) + "; domain=" + cookieDomain + "; path=/;";
  2384. });
  2385. } else {
  2386. showToast("请不包含有cookie信息。");
  2387. }
  2388. } else {
  2389. showToast("请填写cookie信息。");
  2390. }
  2391. } else {
  2392. showToast("编辑框元素丢失了。");
  2393. }
  2394.  
  2395. }
  2396. function 优酷视频数据处理(vid, data, 剧集JSON) {
  2397. let 返回JSON = data.match(/window.__INITIAL_DATA__ =(.+?);window.__PLATOCONFIG__ =/)[1];
  2398. if (返回JSON !== null) {
  2399. 返回JSON = JSON.parse(返回JSON);
  2400. let 视频列表路径;
  2401. for (let index = 0; index < 返回JSON.componentList.length; index++) {
  2402. if (返回JSON.componentList[index].componentName === '播放页选集') {
  2403. 视频列表路径 = 返回JSON.componentList[index].dataNode;
  2404. } else {
  2405. }
  2406. }
  2407. // if(parseInt(视频列表路径[0].data.stage)!=1){
  2408. // 剧集JSON.cid = 视频列表路径[0].data.action.value;
  2409. // return true;
  2410. // }
  2411. for (let index = 0; index < 视频列表路径.length; index++) {
  2412. let 片子类型 = 视频列表路径[index].data.videoType
  2413. if (片子类型 === '正片') {
  2414. var isExist = 剧集JSON.列表.find(function (item) {
  2415. return item.vid === 视频列表路径[index].data.action.value;
  2416. });
  2417. // 如果不存在相同的cid和vid,则进行插入操作
  2418. if (!isExist) {
  2419. var json = {
  2420. 集数: 视频列表路径[index].data.stage,
  2421. cid: vid,
  2422. stage: 视频列表路径[index].data.stage,
  2423. vid: 视频列表路径[index].data.action.value,
  2424. play_title: `${返回JSON.videoMap.showName}_${视频列表路径[index].data.stage}_${视频列表路径[index].data.title}`,
  2425. url: 解析域名 + `https://v.youku.com/v_show/id_${视频列表路径[index].data.action.value}.html`
  2426. };
  2427. 剧集JSON.列表.push(json);
  2428. }
  2429. }
  2430. }
  2431.  
  2432. let 最后一集 = 返回JSON.videoMap.episodeLast;
  2433. if (parseInt(json.stage) === parseInt(最后一集)) {
  2434. console.dir('所有页数已获取', 剧集JSON)
  2435. 剧集JSON.cid = cid;
  2436. 剧集JSON.获取时间 = 取当日时间戳();
  2437. localStorage.setItem('优酷剧集JSON', JSON.stringify(剧集JSON))
  2438. 创建视频列表(剧集JSON)
  2439. return false;
  2440. } else {
  2441. 剧集JSON.cid = json.vid;
  2442. return true;
  2443. }
  2444. }
  2445. }
  2446. function 爱奇艺视频列表数据处理(cid, data, 剧集JSON) {
  2447. if (data.data?.videos) {
  2448. var 返回文本 = data;
  2449. let 视频列表 = 返回文本.data?.videos
  2450. console.log(返回文本, 视频列表)
  2451. for (let index = 0; index < 视频列表.length; index++) {
  2452. if (视频列表[index].type === 1) {
  2453. let json = {
  2454. 集数: index + 1,
  2455. cid: cid,
  2456. vid: 视频列表[index].pageUrl.match(/com\/([\w]+)/)[1],
  2457. play_title: 视频列表[index].shortTitle,
  2458. url: 解析域名 + 视频列表[index].pageUrl
  2459. }
  2460. 剧集JSON.列表.push(json)
  2461. }
  2462. }
  2463. 剧集JSON.页数++;
  2464. return true;
  2465. } else {
  2466. // 所有页数都已获取,退出循环
  2467. console.log(剧集JSON)
  2468. console.log('所有页数已获取');
  2469. 创建视频列表(剧集JSON)
  2470. 剧集JSON.获取时间 = 取当日时间戳();
  2471. localStorage.setItem('爱奇艺剧集JSON', JSON.stringify(剧集JSON))
  2472. return false;
  2473. }
  2474. }
  2475. function 创建视频列表(剧集JSON) {
  2476. 创建剧集选择按钮();
  2477. let 剧集盒子 = 剧集盒子创建();
  2478. let 当前页数 = 1;
  2479. let 每页数量 = 110;
  2480. let 总页数 = Math.ceil(剧集JSON.列表.length / 每页数量);
  2481. let 页数 = document.createElement('div');
  2482. 页数.className = '页数';
  2483. 页数.style.height = '50px';
  2484. 页数.style.width = '100%';
  2485. 页数.style.display = 'flex';
  2486. 页数.style.zIndex = '999';
  2487. 页数.style.borderRadius = '12px 12px 0px 0px';
  2488. 页数.style.background = 'rgb(0 0 0 / 18%)';
  2489. 剧集盒子.appendChild(页数);
  2490. let 当前集数 = 0;
  2491. let 添加数 = 0;
  2492. for (let i = 0; i < 总页数; i++) {
  2493. let 视频剧集列表 = 视频剧集列表创建(剧集盒子);
  2494. for (let j = i * 每页数量; j < Math.min((i + 1) * 每页数量, 剧集JSON.列表.length); j++) {
  2495. let 视频剧集 = document.createElement('div');
  2496. 视频剧集.className = '视频剧集';
  2497. 视频剧集.textContent = 剧集JSON.列表[j].集数;
  2498. 视频剧集.setAttribute('剧集名', 剧集JSON.列表[j].play_title);
  2499. 视频剧集.setAttribute('vid', 剧集JSON.列表[j].vid);
  2500. 视频剧集.setAttribute('cid', 剧集JSON.cid);
  2501. 视频剧集.setAttribute('url', 剧集JSON.列表[j].url);
  2502. 视频剧集.style.height = '30px';
  2503. 视频剧集.style.width = '30px';
  2504. 视频剧集.style.lineHeight = '30px';
  2505. 视频剧集.style.borderRadius = '12px';
  2506. 视频剧集.style.display = 'flex';
  2507. 视频剧集.style.justifyContent = 'center';
  2508. //视频剧集.style.background = '#ff6c00';
  2509. 视频剧集.style.margin = '3px';
  2510. 视频剧集列表.appendChild(视频剧集);
  2511. 添加数++;
  2512. 视频剧集.addEventListener('click', function () {
  2513. location.href = 视频剧集.getAttribute('url');
  2514. 剧集盒子.style.display = 'none';
  2515. })
  2516. }
  2517.  
  2518. let 页数子元素 = document.createElement('div');
  2519. console.log(i,)
  2520. 页数子元素.className = '页数子元素';
  2521. 页数子元素.textContent = (当前集数 + 1) + '-' + 添加数
  2522. 当前集数 = Math.min((i + 1) * 每页数量);
  2523. 页数子元素.style.height = '30px';
  2524. 页数子元素.style.width = '70px';
  2525. 页数子元素.style.lineHeight = '30px';
  2526. 页数子元素.style.display = 'flex';
  2527. 页数子元素.style.justifyContent = 'center';
  2528. 页数子元素.style.borderRadius = '12px';
  2529. 页数子元素.style.margin = '0px 3px 0px 3px';
  2530. 页数子元素.addEventListener('click', function () {
  2531. 切换视频剧集列表(i + 1);
  2532. });
  2533. 页数.appendChild(页数子元素);
  2534. }
  2535.  
  2536. // 默认显示第一页的视频剧集列表
  2537. 切换视频剧集列表(当前页数);
  2538. 创建下一集按钮();
  2539. 当前剧集(剧集JSON.vid);
  2540. }
  2541.  
  2542. function 取腾讯视频列表_废弃(cid, vid) {
  2543. let 缓存剧集JSON = JSON.parse(localStorage.getItem('腾讯剧集JSON'))
  2544. if (缓存剧集JSON) {
  2545. if (缓存剧集JSON.cid === cid && 缓存剧集JSON.获取时间 === 取当日时间戳()) {
  2546. 缓存剧集JSON.vid = vid;
  2547. 创建视频列表(缓存剧集JSON)
  2548. return;
  2549. }
  2550. }
  2551. var page_context;
  2552. var 页数 = 0;
  2553. var 总页数;
  2554. var jsondata = { "page_params": { "req_from": "web_mobile", "page_id": "vsite_episode_list", "page_type": "detail_operation", "id_type": "1", "cid": "omcczahf3t2sye4", "vid": "y0019zkakfv", "lid": "", "page_size": "50" }, "has_cache": 1 };
  2555. jsondata.page_params.cid = cid;
  2556. jsondata.page_params.vid = vid;
  2557. var 剧集JSON = {};
  2558. 剧集JSON.列表 = [];
  2559. 剧集JSON.vid = vid;
  2560. function 发送请求() {
  2561. console.log('JSON数据', JSON.stringify(jsondata))
  2562. GM_xmlhttpRequest({
  2563. method: 'POST',
  2564. url: 'https://pbaccess.video.qq.com/trpc.universal_backend_service.page_server_rpc.PageServer/GetPageData?video_appid=1200029&vplatform=2',
  2565. data: JSON.stringify(jsondata),
  2566. headers: {
  2567. 'Accept': 'application/json, text/plain, */*',
  2568. 'Accept-Encoding': 'gzip, deflate, br',
  2569. 'Accept-Language': 'zh-CN,zh;q=0.9',
  2570. 'Content-Type': 'application/json;charset=UTF-8',
  2571. 'Cookie': 'pgv_pvid=99f2863be9515d54; video_omgid=e05169a47f71dc12a87a4ec66d385f9e; vversion_name=8.5.50; _qimei_uuid42=17c1907091b1002cb915a0513ccfc4d871a0a846d1; video_platform=2',
  2572. 'Origin': 'https://m.v.qq.com',
  2573. 'Referer': 'https://m.v.qq.com/',
  2574. 'Sec-Fetch-Dest': 'empty',
  2575. 'Sec-Fetch-Mode': 'cors',
  2576. 'Sec-Fetch-Site': 'same-site',
  2577. 'User-Agent': 'jdapp;android;8.3.5;9.3.7;;network/wifi;model/Mi Note 2;osVer/26;appBuild/71043;psn/|7;psq/1;uid/;adk/;ads/;pap/JA2015_311210|8.4.2|ANDROID 8.0.0;osv/8.0.0;pv/2.23;jdv/;ref/com.jingdong.app.mall.WebActivity;partner/huawei;apprpd/Home_Main;Mozilla/5.0 (Linux; Android 8.0.0; Mi Note 2 Build/OPR1.170623.032; wv)) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.99 Mobile Safari/537.36'
  2578. },
  2579. onload: function (response) {
  2580. // 处理响应
  2581. let 返回文本 = JSON.parse(response.responseText);
  2582. let post页数列表 = 返回文本.data.module_list_datas[0].module_datas[0].module_params.tabs;
  2583. let 视频列表 = 返回文本.data.module_list_datas[0].module_datas[0].item_data_lists.item_datas
  2584. for (let index = 0; index < 视频列表.length; index++) {
  2585. if (视频列表[index].item_params.union_title != '' && 视频列表[index].item_params.is_trailer === '0') {
  2586. let json = {
  2587. cid: cid,
  2588. vid: 视频列表[index].item_params.vid,
  2589. play_title: 视频列表[index].item_params.play_title,
  2590. url: 解析域名 + 'https://m.v.qq.com/x/m/play?cid=' + cid + '&vid=' + 视频列表[index].item_params.vid
  2591. }
  2592. 剧集JSON.列表.push(json)
  2593. }
  2594. }
  2595. 总页数 = JSON.parse(post页数列表);
  2596. 页数++;
  2597. if (页数 < 总页数.length) {
  2598. //page_context = URL参数转POST(总页数[页数].page_context);
  2599. page_context = 总页数[页数].page_context;
  2600. jsondata.page_params.cid = cid;
  2601. jsondata.page_params.page_context = page_context;
  2602. console.log(页数, page_context, jsondata);
  2603. // 继续发送请求
  2604. 发送请求();
  2605. } else {
  2606. // 所有页数都已获取,退出循环
  2607. console.log(剧集JSON)
  2608. console.log('所有页数已获取');
  2609. 剧集JSON.cid = cid;
  2610. 创建视频列表(剧集JSON)
  2611. 剧集JSON.获取时间 = 取当日时间戳();
  2612. localStorage.setItem('腾讯剧集JSON', JSON.stringify(剧集JSON))
  2613. }
  2614.  
  2615. },
  2616. onerror: function (error) {
  2617. console.error(error);
  2618. }
  2619. });
  2620. }
  2621.  
  2622.  
  2623. // 开始第一次请求
  2624. 发送请求();
  2625. }
  2626. //创建爱奇艺视频列表(JS)
  2627.  
  2628. function 取爱奇艺视频主页JSON_GM(vid) {
  2629. var page_context;
  2630. var 页数 = 0;
  2631. var 总页数;
  2632.  
  2633. function 发送请求() {
  2634. console.log('发送请求');
  2635. GM_xmlhttpRequest({
  2636. method: 'GET',
  2637. url: `https://www.iqiyi.com/${vid}.html`,
  2638. headers: {
  2639. 'authority': ' m.iqiyi.com',
  2640. 'accept': ' text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
  2641. 'accept-language': 'zh-CN,zh;q=0.9',
  2642. 'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="102"',
  2643. 'sec-ch-ua-mobile': '?0',
  2644. 'sec-ch-ua-platform': '"Windows"',
  2645. 'sec-fetch-dest': 'empty',
  2646. 'sec-fetch-mode': 'cors',
  2647. 'sec-fetch-site': 'same-site',
  2648. 'user-agent': 'jdapp;android;8.3.5;9.3.7;;network/wifi;model/Mi Note 2;osVer/26;appBuild/71043;psn/|7;psq/1;uid/;adk/;ads/;pap/JA2015_311210|8.4.2|ANDROID 8.0.0;osv/8.0.0;pv/2.23;jdv/;ref/com.jingdong.app.mall.WebActivity;partner/huawei;apprpd/Home_Main;Mozilla/5.0 (Linux; Android 8.0.0; Mi Note 2 Build/OPR1.170623.032; wv)) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.99 Mobile Safari/537.36'
  2649. },
  2650. onload: function (response) {
  2651. // 处理响应 ;
  2652. var match = response.responseText.match(/albumId":(\d+)/);
  2653. if (match ? match[1] : '') {
  2654. 取爱奇艺视频列表_GM(match[1], vid);
  2655. }
  2656. },
  2657. onerror: function (error) {
  2658. console.error(error);
  2659. }
  2660. });
  2661. }
  2662.  
  2663. // 开始第一次请求
  2664. 发送请求();
  2665. }
  2666. })();
  2667. }
  2668. function 设置元素置顶位置(元素){
  2669. var viewportHeight = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
  2670. var calculatedValue = -1 * viewportHeight + 50;
  2671. 元素.style.top = calculatedValue + 'px'
  2672. }
  2673. function 创建隐藏工具条按钮() {
  2674. var 隐藏 = document.createElement('div')
  2675. 隐藏.className = '隐藏'
  2676. 隐藏.textContent = '隐藏'
  2677. 设置元素置顶位置(隐藏);
  2678. 隐藏.addEventListener('click', function (event) {
  2679. event.stopPropagation(); // 阻止事件冒泡
  2680. event.preventDefault(); // 阻止默认行为
  2681. if (document.querySelector("#xmflv > div")) {
  2682. document.querySelector("#xmflv > div").className = 'art-video-player art-subtitle-show art-layer-show art-backdrop art-mobile art-hide-cursor';
  2683. }
  2684.  
  2685. })
  2686. document.querySelector('[class="art-controls"]').appendChild(隐藏)
  2687.  
  2688. let css = `
  2689. .隐藏{
  2690. display: flex;
  2691. line-height: 20px;
  2692. color: black;
  2693. position: absolute;
  2694. right: 10px;
  2695. background: blanchedalmond;
  2696. width: 40px;
  2697. height: 20px;
  2698. z-index: 999;
  2699. justify-content: center;
  2700. }
  2701. .隐藏:hover{
  2702. background: #00aeec;
  2703. }
  2704. .隐藏:active{
  2705. background: #ff8100;
  2706. }
  2707. `
  2708. let css样式 = document.createElement('style')
  2709. css样式.textContent = css
  2710. css样式.type = "text/css"
  2711. document.head.appendChild(css样式)
  2712. }
  2713. function 弹幕按钮状态() {
  2714. let 弹幕开关 = document.querySelector('[class="art-icon art-icon-danmu-on"]');
  2715. if (弹幕开关) {
  2716. if (localStorage.getItem('弹幕开关') === 'true') {
  2717. if (弹幕开关.style.display === 'none') {
  2718. 弹幕开关.click();
  2719. }
  2720. } else {
  2721. if (弹幕开关.style.display != 'none') {
  2722. 弹幕开关.click();
  2723. }
  2724. }
  2725. }
  2726. }
  2727. function 判断历史记录() {
  2728. let 未登录(不可用) = document.querySelector('[class="record__unlogin __web-inspector-hide-shortcut__"]')
  2729. if (未登录(不可用)) {
  2730. 未登录(不可用).remove()
  2731. let 历史记录 = localStorage.getItem('历史记录')
  2732. if (!历史记录) {
  2733. 历史记录 = [];
  2734. }
  2735. let js = {
  2736. 标题: document.title,
  2737. url: location.href,
  2738. 日期: 取当前时间()
  2739. }
  2740. 历史记录.push(js)
  2741.  
  2742. }
  2743. }
  2744.  
  2745.  
  2746. function 创建下一集按钮() {
  2747. // 创建 div 元素
  2748. if (document.querySelector('[class="art-control art-control-btn-next hint--rounded hint--top"]')) {
  2749. return;
  2750. }
  2751. var div = document.createElement('div');
  2752. // 添加 class 属性
  2753. div.className = 'art-control art-control-btn-next hint--rounded hint--top';
  2754. // 添加 data-index 和 aria-label 属性
  2755. div.setAttribute('data-index', '25');
  2756. div.setAttribute('aria-label', '下一集');
  2757. // 创建 svg 元素
  2758. var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
  2759. svg.setAttribute('t', '1683908412710');
  2760. svg.setAttribute('class', 'icon');
  2761. svg.setAttribute('viewBox', '0 0 1024 1024');
  2762. svg.setAttribute('version', '1.1');
  2763. svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
  2764. svg.setAttribute('p-id', '1649');
  2765. svg.setAttribute('width', '32');
  2766. svg.setAttribute('height', '32');
  2767. // 创建 path 元素
  2768. var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
  2769. path.setAttribute('d', 'M665.47 417.65l-345.03-244.3c-69.8-49.42-166.29 0.49-166.29 86.01v502.27c0 85.52 96.49 135.43 166.29 86.01l345.03-244.31c64.02-45.34 64.02-140.34 0-185.68zM811.82 868.52c-30.38 0-55-24.62-55-55V207.46c0-30.38 24.62-55 55-55s55 24.62 55 55v606.07c0 30.37-24.62 54.99-55 54.99z');
  2770. path.setAttribute('p-id', '1650');
  2771. path.setAttribute('fill', '#ffffff');
  2772. // 将 path 元素添加到 svg 元素中
  2773. svg.appendChild(path);
  2774. // 将 svg 元素添加到 div 元素中
  2775. div.appendChild(svg);
  2776. div.addEventListener('click', function (event) {
  2777. event.stopPropagation(); // 阻止事件冒泡
  2778. event.preventDefault(); // 阻止默认行为
  2779. 点击下一集(document.querySelector('video'))
  2780. })
  2781. // 将创建的 div 元素添加到音量按钮后面
  2782. var count = 0;
  2783. var timeoutId = setTimeout(function checkVolumeControl() {
  2784. var volumeControl = document.querySelector('[class="art-control art-control-volume"]');
  2785. if (volumeControl) {
  2786. // 添加元素的逻辑
  2787. volumeControl.insertAdjacentElement('afterend', div);
  2788. clearTimeout(timeoutId); // 满足条件后停止 setTimeout
  2789. } else {
  2790. count++;
  2791. if (count < 5) {
  2792. setTimeout(checkVolumeControl, 1000);
  2793. }
  2794. }
  2795. }, 0);
  2796.  
  2797. }
  2798.  
  2799. document.title = 当前标题;
  2800. console.log("页面已经激活");
  2801. // 在这里执行你需要的操作
  2802. let intervalId = setInterval(function () {
  2803. document.title = 当前标题;
  2804. }, 1000); // 每秒更改一次标题
  2805.  
  2806.  
  2807. function 当前剧集(VID) {
  2808. 当前VID = VID;
  2809. let 剧集列表 = document.querySelectorAll('.视频剧集列表')
  2810. for (let i = 0; i < 剧集列表.length; i++) {
  2811. let 剧集 = 剧集列表[i].querySelectorAll('.视频剧集')
  2812. for (let index = 0; index < 剧集.length; index++) {
  2813. if (剧集[index].getAttribute('VID') === VID) {
  2814. 切换视频剧集列表(i + 1)
  2815. 剧集[index].style.background = 'green';
  2816. 剧集列表[i].scrollTop = 剧集[index].offsetTop - 剧集[index].offsetHeight - 30
  2817. 当前标题 = 剧集[index].getAttribute('剧集名');
  2818. document.title = 当前标题
  2819. break;
  2820. }
  2821. }
  2822.  
  2823. }
  2824. }
  2825. function 剧集盒子创建() {
  2826. document.querySelector('.剧集盒子')?.remove()
  2827. let 剧集盒子 = document.createElement('div');
  2828. 剧集盒子.className = '剧集盒子';
  2829. 剧集盒子.style.borderRadius = '12px';
  2830. 剧集盒子.style.background = 'rgb(0 0 0 / 50%)';
  2831. if (判断是否是手机设备()) {
  2832. 剧集盒子.style.left = '10px';
  2833. } else {
  2834. 剧集盒子.style.left = 'calc(100vw - 295px)';
  2835. }
  2836. 剧集盒子.style.position = 'absolute';
  2837. 剧集盒子.style.height = '310px';
  2838. 剧集盒子.style.width = '290px';
  2839. 剧集盒子.style.bottom = '70px';
  2840. 剧集盒子.style.zIndex = '999';
  2841. 剧集盒子.style.display = 'none';
  2842. //document.body.appendChild(剧集盒子);
  2843. document.querySelector('[class="art-controls"]').appendChild(剧集盒子);
  2844. 剧集盒子点击判断(剧集盒子);
  2845. return 剧集盒子;
  2846. }
  2847. function 视频剧集列表创建(剧集盒子, 集数) {
  2848. let 视频剧集列表 = document.createElement('div');
  2849. 视频剧集列表.className = '视频剧集列表';
  2850. 视频剧集列表.style.width = '100%';
  2851. 视频剧集列表.style.height = 'calc(100% - 60px)';
  2852. 视频剧集列表.style.display = 'flex';
  2853. 视频剧集列表.style.flexWrap = 'wrap';
  2854. 视频剧集列表.style.overflowY = 'auto';
  2855. 视频剧集列表.style.borderRadius = '0px 0px 12px 12px';
  2856. 视频剧集列表.style.alignContent = 'flex-start';
  2857. 视频剧集列表.setAttribute('集数', 集数)
  2858. 剧集盒子.appendChild(视频剧集列表);
  2859. return 视频剧集列表;
  2860. }
  2861. function 样式创建() {
  2862. let css = `
  2863. ..art-bottom .art-progress .art-control-progress{
  2864. height: 25px !important;
  2865. }
  2866. .art-control.art-control-progress{
  2867. height: 25px !important;
  2868. }
  2869. .视频剧集列表::-webkit-scrollbar {
  2870. width: 0px;
  2871. }
  2872. .剧集选择 {
  2873. color: rgba(0, 0, 0, 0.5);
  2874. }
  2875. @media (hover: none) and (max-width: 768px) {
  2876. .剧集选择 {
  2877. color:#ffc107;
  2878. /* 在移动设备上添加其他样式 */
  2879. }
  2880. .art-control.art-control-time{
  2881. top: -60px;
  2882. left: 0px;
  2883. position: absolute;
  2884. }
  2885. .art-video-player .art-layer-auto-playback{
  2886. bottom: 90px;
  2887. }
  2888. }
  2889. .剧集选择:hover {
  2890. user-select: none;
  2891. cursor: pointer;
  2892. border-radius: 25px;
  2893. color: green ;
  2894. }
  2895. .页数 {
  2896. overflow-x: scroll;
  2897. white-space: nowrap;
  2898. }
  2899. .页数::-webkit-scrollbar {
  2900. width: 0px;
  2901. }
  2902. .页数子元素 {
  2903. user-select: none;
  2904. background: green ;
  2905. padding: 0px 4px 0px 4px;
  2906. width: 60px;
  2907. height: 30px;
  2908. }
  2909.  
  2910. .页数子元素:hover {
  2911. cursor: pointer;
  2912. user-select: none;
  2913. border-radius: 5px;
  2914. background: #70B9E8 ;
  2915. }
  2916.  
  2917. .页数子元素:hover::after {
  2918. border-radius: 5px;
  2919. background: rgba(255, 255, 255, 0.3) ;
  2920. }
  2921. .视频剧集:active {
  2922. background: #b1a125;/* 点击时的颜色 */
  2923. }
  2924. .视频剧集{
  2925. user-select: none;
  2926. background: rgb(203 103 0);
  2927.  
  2928. }
  2929. .视频剧集:hover::after {
  2930. border-radius: 25px;
  2931. background: rgba(255, 255, 255, 0.3) ;
  2932. }
  2933.  
  2934. .视频剧集:hover {
  2935. user-select: none;
  2936. cursor: pointer;
  2937. border-radius: 25px;
  2938. background: #70B9E8 ;
  2939. }
  2940. .视频剧集:active {
  2941. background: #b1a125;/* 点击时的颜色 */
  2942. }
  2943. .main_button{
  2944. color: rgb(104 107 104) ;
  2945. background: white;
  2946. }
  2947. .设置面板:hover {
  2948. user-select: none;
  2949. cursor: pointer;
  2950. border-radius: 25px;
  2951. color: green ;
  2952. }
  2953. #saveButton{
  2954. color: #333333 ;
  2955. }
  2956. #saveButton:hover{
  2957. color: green ;
  2958. }
  2959. #saveButton:active{
  2960. color: #00b4f8 ;
  2961. }
  2962. .main_button:hover {
  2963. color: green ;
  2964. }
  2965. `;
  2966.  
  2967. if (document.querySelector('.custom')) {
  2968. document.querySelector('.custom').remove()
  2969. }
  2970. var style = document.createElement('style');
  2971. style.type = 'text/css';
  2972. style.textContent = css;
  2973. style.className = "custom";
  2974. document.head.appendChild(style);
  2975. }
  2976.  
  2977. function 创建剧集选择按钮() {
  2978. document.querySelector('.剧集选择')?.remove()
  2979. var interval = setInterval(function () {
  2980. var 工具条 = document.querySelector(".art-controls");
  2981. if (工具条) {
  2982. clearInterval(interval); // 停止循环
  2983. var selectButton = document.createElement('button');
  2984. selectButton.className = '剧集选择';
  2985. selectButton.style.width = '40px';
  2986. selectButton.style.height = '29px';
  2987. selectButton.style.borderRadius = '10px';
  2988. selectButton.textContent = 'V';
  2989. selectButton.style.border = '0';
  2990. var thirdChild = 工具条.children[2];
  2991. 工具条.insertBefore(selectButton, thirdChild);
  2992.  
  2993. selectButton.addEventListener('click', function () {
  2994. let 视频列表盒子 = document.querySelector('.剧集盒子')
  2995. if (视频列表盒子) {
  2996. if (视频列表盒子.style.display === 'none') {
  2997. 视频列表盒子.style.display = 'block';
  2998. 当前剧集(vid);
  2999. } else {
  3000. 视频列表盒子.style.display = 'none';
  3001. }
  3002. }
  3003. });
  3004. }
  3005. }, 1000);
  3006. }
  3007. function 取爱奇艺视频主页JSON(cid) {
  3008. var page_context;
  3009. var 页数 = 0;
  3010. var 总页数;
  3011. function 发送请求() {
  3012. console.log('发送请求');
  3013. fetch(`https://www.iqiyi.com/${cid}.html`, {
  3014. method: 'GET',
  3015. headers: {
  3016. 'authority': ' m.iqiyi.com',
  3017. 'accept': ' text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
  3018. 'accept-language': 'zh-CN,zh;q=0.9',
  3019. 'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="102"',
  3020. 'sec-ch-ua-mobile': '?0',
  3021. 'sec-ch-ua-platform': '"Windows"',
  3022. 'sec-fetch-dest': 'empty',
  3023. 'sec-fetch-mode': 'cors',
  3024. 'sec-fetch-site': 'same-site',
  3025. 'user-agent': 'jdapp;android;8.3.5;9.3.7;;network/wifi;model/Mi Note 2;osVer/26;appBuild/71043;psn/|7;psq/1;uid/;adk/;ads/;pap/JA2015_311210|8.4.2|ANDROID 8.0.0;osv/8.0.0;pv/2.23;jdv/;ref/com.jingdong.app.mall.WebActivity;partner/huawei;apprpd/Home_Main;Mozilla/5.0 (Linux; Android 8.0.0; Mi Note 2 Build/OPR1.170623.032; wv)) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.99 Mobile Safari/537.36'
  3026. }
  3027. })
  3028. .then(response => response.text())
  3029. .then(data => {
  3030. // 处理响应
  3031.  
  3032. let domObject = 元素转DOM对象(data);
  3033. //document.body.appendChild(domObject.documentElement);
  3034. let script = domObject.querySelectorAll('script')
  3035. for (let index = 0; index < script.length; index++) {
  3036.  
  3037. if (script[index].innerHTML.includes("window.__INITIAL_STATE__")) {
  3038.  
  3039. var script2 = document.createElement('script');
  3040. script2.innerHTML = script[index].innerHTML;
  3041. document.head.appendChild(script2);
  3042. if (window.__INITIAL_STATE__) {
  3043. //console.log("脚本内容包含 window.__INITIAL_STATE__", JSON.stringify(window.__INITIAL_STATE__));
  3044. 取爱奇艺视频列表_GM(window.__INITIAL_STATE__.play.videoInfo.aid)
  3045. }
  3046. script2.remove();
  3047. } else {
  3048. console.log("脚本内容不包含 window.__INITIAL_STATE__");
  3049. }
  3050. }
  3051.  
  3052.  
  3053. })
  3054. .catch(error => {
  3055. console.error(error);
  3056. });
  3057. }
  3058.  
  3059. // 开始第一次请求
  3060. 发送请求();
  3061. }
  3062. function 源码script处理(源码) {
  3063. let domObject = 元素转DOM对象(源码);
  3064. //document.body.appendChild(domObject.documentElement);
  3065. let script = domObject.querySelectorAll('script')
  3066. for (let index = 0; index < script.length; index++) {
  3067.  
  3068. if (script[index].innerHTML.includes("window.__INITIAL_STATE__")) {
  3069.  
  3070. var script2 = document.createElement('script');
  3071. script2.className = '临时加载'
  3072. script2.innerHTML = script[index].innerHTML;
  3073. //document.head.appendChild(script2);
  3074. unsafeWindow.document.head.appendChild(script2);
  3075. if (window.__INITIAL_STATE__) {
  3076. //console.log("脚本内容包含 window.__INITIAL_STATE__", JSON.stringify(window.__INITIAL_STATE__));
  3077. 取爱奇艺视频列表_GM(window.__INITIAL_STATE__.play.videoInfo.aid)
  3078. }
  3079. script2.remove();
  3080. } else {
  3081. console.log("脚本内容不包含 window.__INITIAL_STATE__");
  3082. }
  3083. }
  3084. }
  3085. function 取爱奇艺视频列表2(cid) {
  3086. var 页数 = 1;
  3087. var 总页数;
  3088. var js = {
  3089. 剧集JSON: [],
  3090. 页数: 1
  3091. }
  3092. function 发送请求() {
  3093. console.log('发起第一次请求')
  3094. fetch(`https://pub.m.iqiyi.com/h5/main/videoList/album/?albumId=${cid}&size=50&page=${页数}&needPrevue=true&needVipPrevue=true`, {
  3095. method: 'GET',
  3096. headers: {
  3097. 'authority': ' pub.m.iqiyi.com',
  3098. 'accept': ' */*',
  3099. 'accept-language': 'zh-CN,zh;q=0.9',
  3100. 'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="102"',
  3101. 'sec-ch-ua-mobile': '?0',
  3102. 'sec-ch-ua-platform': '"Windows"',
  3103. 'sec-fetch-dest': 'empty',
  3104. 'sec-fetch-mode': 'cors',
  3105. 'sec-fetch-site': 'same-site',
  3106. 'user-agent': 'jdapp;android;8.3.5;9.3.7;;network/wifi;model/Mi Note 2;osVer/26;appBuild/71043;psn/|7;psq/1;uid/;adk/;ads/;pap/JA2015_311210|8.4.2|ANDROID 8.0.0;osv/8.0.0;pv/2.23;jdv/;ref/com.jingdong.app.mall.WebActivity;partner/huawei;apprpd/Home_Main;Mozilla/5.0 (Linux; Android 8.0.0; Mi Note 2 Build/OPR1.170623.032; wv)) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.99 Mobile Safari/537.36'
  3107. }
  3108. })
  3109. .then(response => response.json())
  3110. .then(data => {
  3111. 爱奇艺视频列表数据处理(data, js)
  3112. })
  3113. .catch(error => {
  3114. console.error(error);
  3115. });
  3116. }
  3117.  
  3118. // 开始第一次请求
  3119. 发送请求();
  3120. }
  3121. function 解析网站广告() {
  3122. function 解析网站广告子程序() {
  3123. var 解析暂停广告 = document.getElementById('adv_wrap_hh');
  3124. if (解析暂停广告) {
  3125. 解析暂停广告.remove();
  3126. console.log("删除解析网站暂停广告", "interactiframe");
  3127. } else {
  3128. clearInterval(定时器);
  3129. }
  3130. }
  3131. var 定时器 = setInterval(解析网站广告子程序, 1000);
  3132. }
  3133. function 取当日时间戳() {
  3134. const currentDate = new Date();
  3135. currentDate.setHours(0, 0, 0, 0); // 将时间部分设置为0,只保留日期部分
  3136. const timestamp = currentDate.getTime() / 1000; // 获取时间戳(秒)
  3137. return timestamp;
  3138. }
  3139. function 解析站创建主设置组件() {
  3140. 'use strict';
  3141. // 创建设置按钮
  3142. var settingButton = document.createElement('button');
  3143. settingButton.className = 'main_button';
  3144. settingButton.style.top = '50%';
  3145. settingButton.innerHTML = '设置';
  3146.  
  3147. //settingButton.style.color = '#376339';
  3148. //settingButton.style.background = "linear-gradient(to right, #DCF0B0, rgba(252, 247, 224, 0.5))";
  3149. settingButton.style.cursor = 'pointer';
  3150. settingButton.style.zIndex = '9999';
  3151. settingButton.style.margin = '3px';
  3152. settingButton.style.border = '0';
  3153. settingButton.addEventListener('mousedown', function (e) {
  3154. // dragMenu(settingButton, e);
  3155. });
  3156. //https://jx.xmflv.com/
  3157. var 工具条 = document.querySelector(".art-controls");
  3158. if (工具条) {
  3159. settingButton.style.width = '40px';
  3160. settingButton.style.height = '29px';
  3161. settingButton.style.borderRadius = '10px';
  3162. settingButton.style.fontSize = '10px';
  3163. settingButton.style.padding = '4px';
  3164. // 将新元素插入父元素的第三个位置,如果没有子元素,添加为第一元素
  3165. var thirdChild = 工具条.children[2];
  3166. 工具条.insertBefore(settingButton, thirdChild);
  3167. }
  3168. var settingPanel = document.createElement('div');
  3169. settingPanel.className = '设置面板';
  3170. settingPanel.style.position = 'fixed';
  3171. settingPanel.style.top = '47%';
  3172. settingPanel.style.right = '20px';
  3173. settingPanel.style.padding = '10px';
  3174. settingPanel.style.borderRadius = '10px';
  3175. settingPanel.style.color = '#376339';
  3176. settingPanel.style.background = "linear-gradient(to right, #DCF0B0, #FCF7E0)";
  3177. settingPanel.style.border = '1px solid #000';
  3178. settingPanel.style.zIndex = '9999';
  3179. settingPanel.style.display = 'none';
  3180. settingPanel.innerHTML = `
  3181. <input type="checkbox" class="进度选择 选择 a" name="progressType" value="进度选择" style="cursor:pointer;20px !important">
  3182. <label for="进度选择">使用百分比</label>
  3183. <input type="number" id="百分比进度" value="85" style="width: 50px;">
  3184. <br>
  3185. <input type="checkbox" class="进度选择 选择 b" name="progressType" value="time" style="cursor:pointer;20px !important">
  3186. <label for="time">使用分秒时间</label>
  3187. <input type="text" id="时间进度" placeholder="12:20" style="width: 50px;background: #a5af74; border-radius: 5px;">
  3188. <br>
  3189. <br>
  3190. <button id="saveButton" class="button" style="font-weight: bold;cursor:pointer; position: absolute; left: 150px;bottom: 5px; border: 0; border-radius: 10px;">保存</button>
  3191. `;
  3192. function 弃用功能() {
  3193. // <br>
  3194. // <input type="checkbox" class="弹幕开关" name="progressType" value="弹幕开关" checked style="cursor:pointer;20px !important">
  3195. // <label for="弹幕开关">开启弹幕</label>
  3196. }
  3197. document.body.appendChild(settingPanel);
  3198.  
  3199. document.querySelector('.选择.a').addEventListener('click', function (event) {
  3200. if (document.querySelector('.选择.a').checked === true) {
  3201. document.querySelector('.选择.b').checked = false;
  3202. }
  3203.  
  3204. })
  3205. document.querySelector('.选择.b').addEventListener('click', function (event) {
  3206. if (document.querySelector('.选择.b').checked === true) {
  3207. document.querySelector('.选择.a').checked = false;
  3208. }
  3209. })
  3210. settingPanel.addEventListener('mousedown', function (e) {
  3211. //dragMenu(settingPanel, e);
  3212. });
  3213. // 定义一个变量用于保存计时器的 ID
  3214. var timerId;
  3215. // 给设置按钮绑定鼠标移入事件
  3216. settingButton.addEventListener('mouseenter', function () {
  3217. // 显示设置面板
  3218. settingPanel.style.display = 'block';
  3219. // 清除计时器
  3220. clearTimeout(timerId);
  3221. });
  3222. // 给设置面板绑定鼠标移入事件,避免鼠标移出设置按钮后立即隐藏设置面板
  3223. settingPanel.addEventListener('mouseenter', function () {
  3224. // 清除计时器
  3225. clearTimeout(timerId);
  3226. });
  3227. // 给设置按钮绑定鼠标移出事件
  3228. settingButton.addEventListener('mouseleave', function () {
  3229. // 开始计时,500 毫秒后隐藏设置面板
  3230. timerId = setTimeout(function () {
  3231. settingPanel.style.display = 'none';
  3232. }, 500);
  3233. });
  3234. // 给设置面板绑定鼠标移出事件,避免鼠标移入设置面板后立即隐藏设置面板
  3235. settingPanel.addEventListener('mouseleave', function () {
  3236. // 开始计时,500 毫秒后隐藏设置面板
  3237. timerId = setTimeout(function () {
  3238. settingPanel.style.display = 'none';
  3239. }, 500);
  3240. });
  3241. // 显示/隐藏设置界面
  3242. settingButton.addEventListener('click', function () {
  3243. if (settingPanel.style.display === 'none') {
  3244. settingPanel.style.display = 'block';
  3245. console.log('开始设置');
  3246. const 进度选择Input = document.querySelectorAll('.选择');
  3247. if (进度选择Input.length === 2) {
  3248. for (let index = 0; index < 进度选择Input.length; index++) {
  3249. 进度选择Input[index].style.cssText = 'width: 20px !important; cursor: pointer;';
  3250. }
  3251. }
  3252. } else {
  3253. settingPanel.style.display = 'none';
  3254. }
  3255. });
  3256. //取进度百分比的编辑框元素
  3257. var 百分比进度编辑框 = document.getElementById('百分比进度');
  3258. // 读取缓存进度选择Threshold的值
  3259. var 百分比进度缓存值 = localStorage.getItem('百分比进度');
  3260. //如果缓存没有内容就使用默认的数值
  3261. if (百分比进度缓存值) {
  3262. 百分比进度编辑框.value = 百分比进度缓存值;
  3263. } else {
  3264. 百分比进度编辑框.placeholder = '85'; // 默认值
  3265. }
  3266. // 读取缓存的timeThreshold的值
  3267. var 时间进度编辑框 = document.getElementById('时间进度');
  3268. var 时间进度缓存值 = localStorage.getItem('时间进度');
  3269. if (时间进度缓存值) {
  3270. 时间进度编辑框.value = 时间进度缓存值;
  3271. } else {
  3272. 时间进度编辑框.placeholder = '12:20'; // 默认值
  3273. }
  3274. var 进度选择Value = parseInt(localStorage.getItem('进度选择'));
  3275. if (isNaN(进度选择Value) || 进度选择Value < 0) {
  3276. document.querySelectorAll(".进度选择")[0].checked = true
  3277. } else {
  3278. document.querySelectorAll(".进度选择")[进度选择Value].checked = true
  3279. }
  3280. // var 弹幕开关 = localStorage.getItem('弹幕开关');
  3281. // if (弹幕开关='true') {
  3282. // if (document.querySelector(".弹幕开关")) {
  3283. // document.querySelector(".弹幕开关").checked = true;
  3284. // } else {
  3285. // document.querySelector(".弹幕开关").checked = false;
  3286. // }
  3287. // }
  3288.  
  3289. // 监听保存按钮的点击事件
  3290. var saveButton = document.getElementById('saveButton');
  3291. saveButton.addEventListener('click', function () {
  3292. // 保存进度选择Threshold的值到localStorage
  3293. var 百分比进度 = 百分比进度编辑框.value;
  3294. localStorage.setItem('百分比进度', 百分比进度);
  3295. // 保存timeThreshold的值到localStorage
  3296. var 时间进度 = 时间进度编辑框.value;
  3297. localStorage.setItem('时间进度', 时间进度);
  3298. //localStorage.setItem('弹幕开关', document.querySelector(".弹幕开关")?.checked);
  3299. // // 判断是否所有的进度选择都被选中
  3300. var 进度选择Inputs = document.querySelectorAll(".进度选择");
  3301. for (var i = 0; i < 进度选择Inputs.length; i++) {
  3302. if (进度选择Inputs[i].checked) {
  3303. localStorage.setItem('进度选择', i);
  3304. }
  3305. }
  3306. });
  3307. }
  3308. function 取腾讯视频源码JSON文本(content) {
  3309.  
  3310. var regex = /window\.__PINIA__=(.*?)(?=<\/script>)/s;
  3311. var match = regex.exec(content);
  3312. if (match && match.length >= 2) {
  3313. let initialStateText = match[1];
  3314. // 现在 initialStateText 中存储了 window.__INITIAL_STATE__ 和 </script> 之间的内容
  3315. initialStateText = initialStateText.replace(/:undefined/g, ':"undefined"');
  3316. return initialStateText;
  3317. }
  3318. }
  3319. function URL参数转POST(params) {
  3320. const searchParams = new URLSearchParams(params);
  3321. const json = {};
  3322. for (const [key, value] of searchParams) {
  3323. json[key] = value;
  3324. }
  3325. // return JSON.stringify(json);
  3326. return json;
  3327. }
  3328. function 读取当前视频() {
  3329. fetch('https://v.qq.com/x/cover/mzc00200no18bci/u003627s899.html')
  3330. .then(response => response.text())
  3331. .then(data => {
  3332. let domObject = 元素转DOM对象(data);
  3333. //document.body.appendChild(domObject.documentElement);
  3334. let script = domObject.querySelectorAll('script')
  3335. for (let index = 0; index < script.length; index++) {
  3336. if (script[index].innerHTML.includes("window.__PINIA__")) {
  3337. var script2 = document.createElement('script');
  3338. script2.innerHTML = script[index].innerHTML;
  3339. document.head.appendChild(script2);
  3340. if (window.__PINIA__) {
  3341. console.log("脚本内容包含 window.__PINIA__", JSON.stringify(window.__PINIA__));
  3342. console.log(window.__PINIA__?.episodeClips?.nextPageContext)
  3343. }
  3344. script2.remove();
  3345. } else {
  3346. console.log("脚本内容不包含 window.__PINIA__");
  3347. }
  3348. }
  3349. });
  3350. }
  3351. function 元素转DOM对象(data) {
  3352. let htmlString = data;
  3353. // 创建一个 DOMParser 实例
  3354. let parser = new DOMParser();
  3355. // 使用 DOMParser 的 parseFromString 方法将 HTML 文本解析为 DOM 对象
  3356. return parser.parseFromString(htmlString, 'text/html');
  3357. }
  3358. function 页面关闭监测() {
  3359. let 手机浏览器;
  3360. if (判断是否是手机设备()) {
  3361. 手机浏览器 = true;
  3362. // 创建一个每100毫秒运行一次的函数
  3363. const intervalId = setInterval(() => {
  3364. // 获取要删除的元素
  3365. const elementToRemove = document.querySelector('body span');
  3366.  
  3367. // 如果找到了要删除的元素,则执行删除操作
  3368. if (elementToRemove) {
  3369. elementToRemove.remove();
  3370. }
  3371. }, 1);
  3372. }
  3373. window.addEventListener('beforeunload', function (event) {
  3374. if (手机浏览器) {
  3375. event.preventDefault();
  3376. // 兼容旧版本浏览器
  3377. event.returnValue = '';
  3378. }
  3379. localStorage.setItem('后退', document.querySelector('[class="splitRowCount auxiliary_button input1"]').value)
  3380. localStorage.setItem('前进', document.querySelector('[class="splitRowCount auxiliary_button input2"]').value)
  3381. console.log(898798)
  3382. let 弹幕开关 = document.querySelector('[aria-label="弹幕开关"]')
  3383. if (弹幕开关) {
  3384. let 弹幕开关按钮 = 弹幕开关.querySelector('[class="art-icon art-icon-danmu-on"]')
  3385. if (弹幕开关按钮) {
  3386. if (弹幕开关按钮.style.display === 'none') {
  3387. localStorage.setItem('弹幕开关', 'false')
  3388. } else {
  3389. localStorage.setItem('弹幕开关', 'true')
  3390. }
  3391. }
  3392. }
  3393. });
  3394. }
  3395.  
  3396.  
  3397. function 剧集盒子点击判断(jujiBox) {
  3398. //绑定点击,点击页面其他区域,关闭剧集盒子
  3399. document.addEventListener("click", function (event) {
  3400. var jujiBox = document.querySelector(".剧集盒子"); // 获取剧集盒子元素
  3401. if (event.target !== jujiBox && event.target !== document.querySelector(".剧集选择")) {
  3402. // 点击的不是剧集盒子以内的元素,隐藏剧集盒子
  3403. jujiBox.style.display = "none";
  3404. }
  3405. });
  3406. // 当剧集盒子被点击时阻止事件冒泡
  3407. var jujiBox2 = document.querySelector(".剧集盒子");
  3408. jujiBox2.addEventListener("click", function (event) {
  3409. event.stopPropagation();
  3410. });
  3411. }
  3412.  
  3413. function 点击下一集(video) {
  3414. video.pause();
  3415. var episodes = document.querySelectorAll(".视频剧集");
  3416. for (let index = 0; index < episodes.length; index++) {
  3417. if (episodes[index].getAttribute('vid') === 当前VID) {
  3418. if (episodes[index + 1]) {
  3419. location.assign(episodes[index + 1].getAttribute('url'))
  3420.  
  3421. video.remove();
  3422. }
  3423. }
  3424. }
  3425. }
  3426. function 点击上一集(video) {
  3427. video.pause();
  3428. var episodes = document.querySelectorAll(".视频剧集");
  3429. for (let index = 0; index < episodes.length; index++) {
  3430. if (episodes[index].getAttribute('vid') === 当前VID) {
  3431. if (episodes[index + 1]) {
  3432. if (index - 1 > 0) {
  3433. location.assign(episodes[index - 1].getAttribute('url'))
  3434. video.remove();
  3435. }
  3436. }
  3437. }
  3438. }
  3439. }
  3440. function 监测播放状态() {
  3441. let video = document.querySelector('video')
  3442. let i = 0;
  3443.  
  3444. if (video) {
  3445. 监测视频暂停状态()
  3446. video.addEventListener("timeupdate", function () {
  3447. i++;
  3448. var currentTime = Math.floor(video.currentTime); // 获取当前播放时间(秒)
  3449. var duration = Math.floor(video.duration); // 获取视频总长度(秒)
  3450. var progressType = parseInt(localStorage.getItem('进度选择'));
  3451. if (progressType === 0) {
  3452. var 进度选择 = localStorage.getItem('百分比进度');
  3453. var percent = (currentTime / duration) * 100;
  3454. if (percent >= 进度选择) {
  3455. video.pause()
  3456. console.log(i)
  3457. if (i > 20) {
  3458. setTimeout(function () {
  3459. 点击下一集(video);
  3460. }, 1000);
  3461. }
  3462. }
  3463. } else if (progressType === 1) {
  3464. var 时间进度 = localStorage.getItem('时间进度');
  3465. var timeParts = 时间进度.split(":");
  3466. var timeThresholdSeconds = parseInt(timeParts[0]) * 60 + parseInt(timeParts[1]);
  3467. if (currentTime >= timeThresholdSeconds && i > 20) {
  3468. video.pause()
  3469. if (i > 20) {
  3470. setTimeout(function () {
  3471. 点击下一集(video);
  3472. }, 1000);
  3473. }
  3474. }
  3475. }
  3476. });
  3477. }
  3478. }
  3479. function 监测视频暂停状态() {
  3480. let video = document.querySelector('video')
  3481. if (video) {
  3482. video.addEventListener("pause", function () {
  3483. 解析网站广告()
  3484. })
  3485. }
  3486. }
  3487. //监测全屏状态
  3488. function 监测解析网站全屏状态() {
  3489. document.addEventListener('fullscreenchange', function () {
  3490. if (document.fullscreenElement) {
  3491. // 进入全屏状态
  3492. 设置元素置顶位置(document.querySelector('.隐藏'))
  3493. let 剧集盒子 = document.querySelector('.剧集盒子')
  3494. if (剧集盒子) {
  3495. 剧集盒子.style.height = '280px'
  3496. }
  3497. } else {
  3498. // 退出全屏状态
  3499. 设置元素置顶位置(document.querySelector('.隐藏'))
  3500. let 剧集盒子 = document.querySelector('.剧集盒子')
  3501. if (剧集盒子) {
  3502. 剧集盒子.style.height = '310px'
  3503. }
  3504. }
  3505. });
  3506. }
  3507. //解析网站函数结束点
  3508. }
  3509. function 绑定热键() {
  3510. document.addEventListener('keyup', function (event) {
  3511. var focusedElement = document.activeElement;
  3512. console.log(focusedElement);
  3513. if (focusedElement.className === 'splitRowCount auxiliary_button input2' || focusedElement.className === 'splitRowCount auxiliary_button input1') {
  3514. return;
  3515. }
  3516. var keyCode = event.keyCode || event.which;
  3517. if (keyCode === 33) {
  3518. // 执行操作
  3519. 点击上一集(document.querySelector('video'))
  3520. } else {
  3521. if (keyCode === 34) {
  3522. // 执行操作
  3523. 点击下一集(document.querySelector('video'))
  3524. } else {
  3525. if (keyCode === 99) {
  3526. // 快进
  3527. document.querySelector('.截图')?.click();
  3528. } else {
  3529. if (keyCode === 97) {
  3530. // 后退
  3531. document.querySelector('.后退')?.click();
  3532. } else {
  3533. if (keyCode === 98) {
  3534. // 前进
  3535. document.querySelector('.前进')?.click();
  3536. }
  3537. }
  3538. }
  3539. }
  3540. }
  3541. })
  3542. }
  3543. function dragMenu(menuObj, e) {
  3544. e = e ? e : window.event;
  3545. // || e.target.tagName === 'BUTTON' 判断是否为按钮元素
  3546. if (e.target.tagName === 'TEXTAREA' || e.target.tagName === 'INPUT' || e.target.tagName === 'SELECT') {
  3547. return;
  3548. }
  3549. let dragData = {
  3550. startX: e.clientX,
  3551. startY: e.clientY,
  3552. menuLeft: menuObj.offsetLeft,
  3553. menuTop: menuObj.offsetTop
  3554. };
  3555. document.onmousemove = function (e) { try { dragMenu(menuObj, e); } catch (err) { } };
  3556. document.onmouseup = function (e) { try { stopDrag(menuObj); } catch (err) { } };
  3557. doane(e);
  3558. function stopDrag(menuObj) {
  3559. document.onmousemove = null;
  3560. document.onmouseup = null;
  3561. }
  3562. function doane(e) {
  3563. if (e.stopPropagation) {
  3564. e.stopPropagation();
  3565. } else {
  3566. e.cancelBubble = true;
  3567. }
  3568. if (e.preventDefault) {
  3569. e.preventDefault();
  3570. } else {
  3571. e.returnValue = false;
  3572. }
  3573. }
  3574. document.onmousemove = function (e) {
  3575. let mouseX = e.clientX;
  3576. let mouseY = e.clientY;
  3577. let menuLeft = dragData.menuLeft + mouseX - dragData.startX;
  3578. let menuTop = dragData.menuTop + mouseY - dragData.startY;
  3579. menuObj.style.left = menuLeft + 'px';
  3580. menuObj.style.top = menuTop + 'px';
  3581. doane(e);
  3582. }
  3583. }
  3584.  
  3585. function 添加辅助功能() {
  3586. let video = document.querySelector('video')
  3587. //let video = document.createElement('video')
  3588. // 创建容器元素,并设置其id属性为 "buttons-container"
  3589. var buttonsContainer = document.createElement('div');
  3590. buttonsContainer.style.position = 'absolute';
  3591. if (判断是否是手机设备()) {
  3592. buttonsContainer.style.left = '10px';
  3593. buttonsContainer.style.opacity = '1';
  3594. buttonsContainer.style.bottom = '100px';
  3595. } else {
  3596. buttonsContainer.style.right = '10px';
  3597. buttonsContainer.style.bottom = '110px';
  3598. }
  3599. buttonsContainer.style.width = '267px';
  3600. buttonsContainer.style.height = '110px';
  3601.  
  3602. buttonsContainer.style.background = 'rgb(149 155 161 / 40%)';
  3603. buttonsContainer.style.zIndex = 99;
  3604. buttonsContainer.style.borderRadius = '10px';
  3605. buttonsContainer.style.outline = 'none';
  3606. buttonsContainer.id = 'buttons-container';
  3607. //document.body.appendChild(buttonsContainer);
  3608. // 创建Canvas元素,并设置其id属性为 "myCanvas"
  3609. var canvas = document.createElement('canvas');
  3610. canvas.className = 'myCanvas';
  3611. document.body.appendChild(canvas);
  3612. var clear = document.createElement('button');
  3613. clear.textContent = '清除缓存';
  3614. clear.className = '清除缓存 auxiliary_button';
  3615. clear.style.position = 'absolute';
  3616. clear.style.width = '90px';
  3617. clear.style.height = '28px';
  3618. clear.style.borderRadius = '10px';
  3619. clear.style.top = '25px';
  3620. clear.style.padding = '5px 19px';
  3621. clear.style.margin = '12px 5px 5px 5px';
  3622. clear.style.outline = 'none';
  3623. clear.addEventListener('click', function (event) {
  3624. event.stopPropagation(); // 阻止事件冒泡
  3625. event.preventDefault(); // 阻止默认行为
  3626. let 百分比进度 = localStorage.getItem('百分比进度')
  3627. let 时间进度 = localStorage.getItem('时间进度')
  3628. let 进度选择 = localStorage.getItem('进度选择')
  3629. let 弹幕开关 = localStorage.getItem('弹幕开关')
  3630. window.localStorage.clear();
  3631. localStorage.setItem('百分比进度',百分比进度)
  3632. localStorage.setItem('时间进度',时间进度)
  3633. localStorage.setItem('进度选择',进度选择)
  3634. localStorage.setItem('弹幕开关',弹幕开关)
  3635. })
  3636. buttonsContainer.appendChild(clear);
  3637.  
  3638.  
  3639. // 创建按钮并添加到容器中
  3640.  
  3641. var backwardButton = document.createElement('button');
  3642. backwardButton.textContent = '后退 -';
  3643. backwardButton.className = '后退 auxiliary_button'
  3644. backwardButton.style.outline = 'none';
  3645. backwardButton.addEventListener('click', function (event) {
  3646. event.stopPropagation(); // 阻止事件冒泡
  3647. event.preventDefault(); // 阻止默认行为
  3648. backward()
  3649. });
  3650.  
  3651. buttonsContainer.appendChild(backwardButton);
  3652. var input = document.createElement('input');
  3653. input.className = "splitRowCount auxiliary_button input1";
  3654. input.style.outline = 'none';
  3655. //input.style.left = '135px';
  3656. if (localStorage.getItem('后退')) {
  3657. input.value = localStorage.getItem('后退');
  3658. } else {
  3659. input.value = '0.1';
  3660. }
  3661. input.min = '0.01';
  3662. input.max = '100';
  3663. input.addEventListener('click', function (event) {
  3664. event.stopPropagation(); // 阻止事件冒泡
  3665. event.preventDefault(); // 阻止默认行为
  3666. })
  3667. buttonsContainer.appendChild(input);
  3668. var forwardButton = document.createElement('button');
  3669. forwardButton.textContent = '前进 +';
  3670. forwardButton.className = '前进 auxiliary_button'
  3671. forwardButton.style.outline = 'none';
  3672. forwardButton.addEventListener('click', function (event) {
  3673. event.stopPropagation(); // 阻止事件冒泡
  3674. event.preventDefault(); // 阻止默认行为
  3675. forward()
  3676. });
  3677. buttonsContainer.appendChild(forwardButton);
  3678. var input2 = document.createElement('input');
  3679. input2.className = "splitRowCount auxiliary_button input2";
  3680. input2.style.outline = 'none';
  3681. //input.style.left = '50px';
  3682. if (localStorage.getItem('前进')) {
  3683. input2.value = localStorage.getItem('前进');
  3684. } else {
  3685. input2.value = '0.1';
  3686. }
  3687. input2.min = '0.01';
  3688. input2.max = '100';
  3689. input2.addEventListener('click', function (event) {
  3690. event.stopPropagation(); // 阻止事件冒泡
  3691. event.preventDefault(); // 阻止默认行为
  3692. })
  3693. buttonsContainer.appendChild(input2);
  3694.  
  3695. var captureButton = document.createElement('button');
  3696. captureButton.textContent = '截图';
  3697. captureButton.className = '截图 auxiliary_button';
  3698. captureButton.style.outline = 'none';
  3699. captureButton.style.padding = '5px 20px 5px 20px';
  3700. captureButton.addEventListener('click', function (event) {
  3701. event.stopPropagation(); // 阻止事件冒泡
  3702. event.preventDefault(); // 阻止默认行为
  3703. capture()
  3704. });
  3705. buttonsContainer.appendChild(captureButton);
  3706. var p = document.createElement('p');
  3707. p.style.width = '250px';
  3708. p.style.height = '40px';
  3709. p.style.fontSize = '10px';
  3710. p.style.position = 'relative';
  3711. p.style.top = '40px';
  3712. p.style.left = '5px';
  3713. p.textContent = '热键:1(后退)、2(前进)、3(截图)、pgup(上一集)、pgdn(下一集)'
  3714. buttonsContainer.appendChild(p);
  3715.  
  3716. function backward() {
  3717. video.currentTime -= parseFloat(input.value);
  3718. }
  3719. function forward() {
  3720. video.currentTime += parseFloat(input2.value);
  3721. }
  3722. var ctx = canvas.getContext('2d');
  3723. function capture() {
  3724. canvas.width = video.videoWidth; // 设置Canvas的宽度为视频的实际宽度
  3725. canvas.height = video.videoHeight; // 设置Canvas的高度为视频的实际高度
  3726. ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
  3727. var dataURL = canvas.toDataURL(); // 获取截图的DataURL
  3728.  
  3729. var downloadLink = document.createElement('a');
  3730. downloadLink.href = dataURL;
  3731. var 片名 = '';
  3732. if (location.hostname.includes('v.qq.')) {
  3733. 片名 = document.querySelector('[class="txp-play-title__title"]').textContent
  3734. } else {
  3735. if (location.hostname.includes('.youku.')) {
  3736. 片名 = document.querySelector('[class="kui-toplayer-title"]').textContent
  3737. } else {
  3738. if (location.hostname.includes('.iqiyi.')) {
  3739. 片名 = document.querySelector('[class="iqp-top-title-wrap"]').textContent
  3740. } else {
  3741. 片名 = document.title
  3742. }
  3743. }
  3744. }
  3745.  
  3746. downloadLink.download = `screenshot_${片名}_${取当前时间2()}.png`;
  3747. downloadLink.textContent = 'Download';
  3748. downloadLink.style.display = 'none'; // 隐藏下载链接
  3749.  
  3750. // 将下载链接添加到容器中
  3751. buttonsContainer.appendChild(downloadLink);
  3752.  
  3753. // 模拟点击下载链接进行自动下载
  3754. downloadLink.click();
  3755. }
  3756. let css = `
  3757. #buttons-container.hide{
  3758. opacity: 0;
  3759. }
  3760. #buttons-container.hide:hover{
  3761. opacity: 1;
  3762. }
  3763. .auxiliary_button {
  3764. height: 28px;
  3765. background-color: #6f7275;
  3766. border: 0;
  3767. border-radius: 56px;
  3768. color: #fff;
  3769. cursor: pointer;
  3770. display: inline-block;
  3771. font-family: system-ui, -apple-system, system-ui, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;
  3772. font-size: 13px;
  3773. font-weight: 600;
  3774. padding: 5px 45px 5px 5px;
  3775. margin: 5px 2px 0px 5px;
  3776. position: relative;
  3777. text-align: center;
  3778. text-decoration: none;
  3779. transition: all .3s;
  3780. user-select: none;
  3781. -webkit-user-select: none;
  3782. touch-action: manipulation;
  3783. }
  3784. .auxiliary_button:active {
  3785. color: #24BFA5;
  3786. }
  3787. .auxiliary_button:before {
  3788. background-color: initial;
  3789. background-image: linear-gradient(#fff 0, rgba(255, 255, 255, 0) 100%);
  3790. border-radius: 125px;
  3791. content: "";
  3792. height: 50%;
  3793. left: 4%;
  3794. opacity: .5;
  3795. position: absolute;
  3796. top: 0;
  3797. transition: all .3s;
  3798. width: 92%;
  3799. outline: none;
  3800. }
  3801. .auxiliary_button:hover {
  3802. background-color: #ffd700;
  3803. box-shadow: rgba(255, 255, 255, .2) 0 3px 15px inset, rgba(0, 0, 0, .1) 0 3px 5px, rgba(0, 0, 0, .1) 0 10px 13px;
  3804. }
  3805. .splitRowCount {
  3806. outline: none;
  3807. width: 43px;
  3808. background-color: #6f7275;
  3809. border: 0;
  3810. border-radius: 20px;
  3811. color: #fff;
  3812. cursor: pointer;
  3813. display: inline-block;
  3814. font-family: system-ui, -apple-system, system-ui, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;
  3815. font-size: 13px;
  3816. font-weight: 600;
  3817. padding: 0px;
  3818. position: absolute;
  3819. text-align: center;
  3820. text-decoration: none;
  3821. transition: all .3s;
  3822. user-select: none;
  3823. -webkit-user-select: none;
  3824. touch-action: manipulation;
  3825. height: 28px;
  3826. }
  3827. .splitRowCount:active {
  3828. color: #24BFA5;
  3829. }
  3830. .splitRowCount:before {
  3831. background-color: initial;
  3832. background-image: linear-gradient(#fff 0, rgba(255, 255, 255, 0) 100%);
  3833. border-radius: 125px;
  3834. content: "";
  3835. height: 50%;
  3836. left: 4%;
  3837. opacity: .5;
  3838. position: absolute;
  3839. top: 0;
  3840. transition: all .3s;
  3841. width: 92%;
  3842. outline: none;
  3843. }
  3844. .splitRowCount:hover {
  3845. background-color: #f3b26b;
  3846. box-shadow: rgba(255, 255, 255, .2) 0 3px 15px inset, rgba(0, 0, 0, .1) 0 3px 5px, rgba(0, 0, 0, .1) 0 10px 13px;
  3847. }
  3848. .input1 {
  3849. left: 45px;
  3850. }
  3851. .input2 {
  3852. left: 139px;
  3853. }
  3854.  
  3855.  
  3856. `
  3857. if (document.querySelector('.辅助功能')) {
  3858. document.querySelector('.辅助功能').remove()
  3859. }
  3860. var style = document.createElement('style');
  3861. style.type = 'text/css';
  3862. style.textContent = css;
  3863. style.className = "辅助功能";
  3864. document.head.appendChild(style);
  3865. if (location.hostname.includes('.iqiyi.')) {
  3866. let count = 0;
  3867. const intervalId = setInterval(() => {
  3868. count++;
  3869. if (count === 10) {
  3870. clearInterval(intervalId);
  3871. buttonsContainer.classList.add('hide')
  3872. }
  3873. }, 1000);
  3874. }
  3875.  
  3876. return buttonsContainer;
  3877. }
  3878. // 切换显示对应视频剧集列表的代码
  3879. function 切换视频剧集列表(页数) {
  3880. let 所有视频剧集列表 = document.getElementsByClassName('视频剧集列表');
  3881. for (let i = 0; i < 所有视频剧集列表.length; i++) {
  3882. if (i === 页数 - 1) {
  3883. 所有视频剧集列表[i].style.display = 'flex';
  3884. } else {
  3885. 所有视频剧集列表[i].style.display = 'none';
  3886. }
  3887. }
  3888. }
  3889. function 监测点击元素() {
  3890. // 获取页面上所有元素
  3891. var allElements = document.getElementsByTagName("*");
  3892. // 为每个元素添加点击事件监听器
  3893. for (var i = 0; i < allElements.length; i++) {
  3894. allElements[i].addEventListener("click", function () {
  3895. // 输出该元素的 ID 或类名
  3896. console.log(this.id || this.className);
  3897. });
  3898. }
  3899. }
  3900. function 判断是否是手机设备() {
  3901. const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
  3902. if (isMobile) {
  3903. return true;
  3904. } else {
  3905. return false;
  3906. }
  3907. }
  3908.  
  3909. function 取当前时间() {
  3910. const now = new Date();
  3911. const year = now.getFullYear();
  3912. const month = String(now.getMonth() + 1).padStart(2, '0');
  3913. const date = String(now.getDate()).padStart(2, '0');
  3914. const hours = String(now.getHours()).padStart(2, '0');
  3915. const minutes = String(now.getMinutes()).padStart(2, '0');
  3916. const seconds = String(now.getSeconds()).padStart(2, '0');
  3917.  
  3918. const formattedTime = `${year}${month}${date} ${hours}:${minutes}:${seconds}`;
  3919. return formattedTime;
  3920. }
  3921.  
  3922. function 取当前时间2() {
  3923. const now = new Date();
  3924. const year = now.getFullYear();
  3925. const month = String(now.getMonth() + 1).padStart(2, '0');
  3926. const date = String(now.getDate()).padStart(2, '0');
  3927. const hours = String(now.getHours()).padStart(2, '0');
  3928. const minutes = String(now.getMinutes()).padStart(2, '0');
  3929. const seconds = String(now.getSeconds()).padStart(2, '0');
  3930. const milliseconds = String(now.getMilliseconds()).padStart(3, '0');
  3931.  
  3932. const formattedTime = `${year}-${month}-${date}_${hours}${minutes}${seconds}_${milliseconds}`;
  3933. return formattedTime;
  3934. }

QingJ © 2025

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