chinahrt全自动刷课

chinahrt刷课,规则更改了,只能耗时间,可以把视频加入列表放置让自动切换。。

  1. // ==UserScript==
  2. // @name chinahrt全自动刷课
  3. // @namespace https://github.com/jsgang/chinahrt
  4. // @version 1.5
  5. // @description chinahrt刷课,规则更改了,只能耗时间,可以把视频加入列表放置让自动切换。。
  6. // @author jsgang yikuaibaiban https://www.jsgang.top
  7. // @icon https://www.google.com/s2/favicons?sz=64&domain=jsgang.top
  8. // @match http://*.chinahrt.com/*
  9. // @match https://*.chinahrt.com/*
  10. // @match http://videoadmin.chinahrt.com.cn/videoPlay/play*
  11. // @match http://videoadmin.chinahrt.com/videoPlay/play*
  12. // @match https://videoadmin.chinahrt.com.cn/videoPlay/play*
  13. // @match https://videoadmin.chinahrt.com/videoPlay/play*
  14. //
  15. // @grant unsafeWindow
  16. // @grant GM_setValue
  17. // @grant GM_getValue
  18. // @grant GM_addValueChangeListener
  19. // @grant GM_notification
  20. //
  21. // @license GPL
  22. // ==/UserScript==
  23. /**
  24. * 课程预览页面
  25. * @type {number}
  26. */
  27. const COURSE_PREVIEW = 0;
  28. /**
  29. * 课程播放页面
  30. * @type {number}
  31. */
  32. const COURSE_PALY = 1;
  33. /**
  34. * 视频播放页面
  35. * @type {number}
  36. */
  37. const VIDEO_PALY = 2;
  38. /**
  39. * VUE课程预览页面
  40. * @type {number}
  41. */
  42. const VUE_COURSE_PREVIEW = 3;
  43. /**
  44. * 未知页面
  45. * @type {number}
  46. */
  47. const UNKOWN_PAGE = 9999;
  48. /**
  49. * 课程存储关键字
  50. * @type {string}
  51. */
  52. const COURSES = "courses";
  53. /**
  54. * 自动播放
  55. * @type {string}
  56. */
  57. const AUTOPLAY = "autoPlay";
  58. /**
  59. * 静音
  60. * @type {string}
  61. */
  62. const MUTE = "mute";
  63. /**
  64. * 拖动
  65. * @type {string}
  66. */
  67. const DRAG = "drag";
  68. /**
  69. * 播放速度
  70. * @type {string}
  71. */
  72. const SPEED = "speed";
  73. /**
  74. * 播放模式
  75. * @type {string}
  76. */
  77. const PLAY_MODE = "play_mode";
  78. /**
  79. * 重复次数
  80. * @type {string}
  81. */
  82. const REAPT_NUM = "reapt_num";
  83. /**
  84. * 自刷切换
  85. * @type {string}
  86. */
  87. const REAPT_MODE = "reapt_mode";
  88. /**
  89. * 获取自动播放
  90. * @returns {*}
  91. */
  92. function getAutoPlay() {
  93. return GM_getValue(AUTOPLAY, true);
  94. }
  95.  
  96. /**
  97. * 获取静音
  98. * @returns {*}
  99. */
  100. function getMute() {
  101. return GM_getValue(MUTE, true);
  102. }
  103.  
  104. /**
  105. * 获取拖动
  106. * @returns {*}
  107. */
  108. function getDrag() {
  109. return GM_getValue(DRAG, 5);
  110. }
  111.  
  112. /**
  113. * 获取播放速度
  114. * @returns {*}
  115. */
  116. function getSpeed() {
  117. return GM_getValue(SPEED, 1);
  118. }
  119.  
  120. /**
  121. * 获取播放列表
  122. * @returns {*|*[]}
  123. */
  124. function getCourses() {
  125. var value = GM_getValue(COURSES, []);
  126. if (Array.isArray(value)) {
  127. return value;
  128. }
  129. return [];
  130. }
  131.  
  132. /**
  133. * 添加到播放列表
  134. * @param element
  135. * @returns {boolean}
  136. */
  137. function addCourse(element) {
  138. if (!element.title || !element.url) {
  139. console.error(element);
  140. alert("添加失败,缺少必要参数");
  141. return false;
  142. }
  143.  
  144. var oldValue = getCourses();
  145.  
  146. if (oldValue.findIndex(value => value.url == element.url) > -1) {
  147. alert("已经存在播放列表中");
  148. return false;
  149. }
  150.  
  151. oldValue.push({title: element.title, url: element.url});
  152.  
  153. GM_setValue(COURSES, oldValue);
  154.  
  155. return true;
  156. }
  157.  
  158. /**
  159. * 从播放列表移除
  160. * @param index
  161. */
  162. function removeCourse(index) {
  163. var courses = getCourses();
  164.  
  165. if (Number.isNaN(index)) {
  166. for (let i = courses.length; i >= 0; i--) {
  167. const element = courses[i];
  168. // 正则提取 href 中 sectionId courseId trainplanId
  169. var jsonHref = element.url;
  170. var jsonSectionId = jsonHref.match(/sectionId=([^&]*)/)[1];
  171. var jsonCourseId = jsonHref.match(/courseId=([^&]*)/)[1];
  172. var jsonTrainplanId = jsonHref.match(/trainplanId=([^&]*)/)[1];
  173.  
  174. // 正则提取 window.location.href 中 sectionId courseId trainplanId
  175. var href = window.location.href;
  176. var sectionId = href.match(/sectionId=([^&]*)/)[1];
  177. var courseId = href.match(/courseId=([^&]*)/)[1];
  178. var trainplanId = href.match(/trainplanId=([^&]*)/)[1];
  179.  
  180. if (jsonCourseId == courseId && jsonSectionId == sectionId && jsonTrainplanId == trainplanId) {
  181. courses.splice(i, 1);
  182. }
  183. }
  184. } else {
  185. courses.splice(index, 1);
  186. }
  187.  
  188. GM_setValue(COURSES, courses);
  189. }
  190.  
  191. /**
  192. * 生成可以添加到播放列表的容器
  193. * @returns {*|jQuery|HTMLElement}
  194. */
  195. function createCanPlayList() {
  196. // 生成容器
  197. var playListBox = $("<div>", {
  198. id: "canPlayBox",
  199. css: {
  200. width: "300px",
  201. height: "500px",
  202. position: "fixed",
  203. top: "100px",
  204. background: "rgba(255,255,255,1)",
  205. right: "20px",
  206. border: "1px solid #c1c1c1"
  207. }
  208. });
  209.  
  210. var status = $("<div></div>", {
  211. text: "获取中...",
  212. css: {
  213. height: "30px",
  214. "border-bottom": "1px solid",
  215. "text-align": "center",
  216. "line-height": "30px",
  217. "color": "#4bccf2",
  218. "font-weight": "bold"
  219. },
  220. click: function () {
  221. playListBox.trigger("clear");
  222. if (getPageNumber() == VUE_COURSE_PREVIEW) {
  223. vue_findCourses(playListBox);
  224. } else {
  225. findCourses(playListBox);
  226. }
  227. }
  228. });
  229. status.appendTo(playListBox);
  230.  
  231. var listBox = $("<div></div>", {
  232. css: {
  233. height: "470px",
  234. "overflow-y": "auto"
  235. }
  236. }).appendTo(playListBox);
  237.  
  238. playListBox.on("clear", function () {
  239. status.text("获取中...");
  240. listBox.empty();
  241. });
  242.  
  243. // 添加绑定事件
  244. playListBox.on("bind", function (e, data) {
  245. if (status.text() == "获取中...") {
  246. status.text("点击刷新");
  247. }
  248. var box = $("<div>", {
  249. css: {
  250. "border-bottom": "1px solid #c1c1c1",
  251. "padding": "8px",
  252. "line-height": "150%",
  253. "border-bottom": "1px solid #c1c1c1",
  254. "margin-bottom": "3px"
  255. }
  256. });
  257.  
  258. var ptitle = $("<p>", {
  259. text: data.title,
  260. title: data.title,
  261. css: {
  262. "font-size": "13px",
  263. "white-space": "nowrap",
  264. "overflow": "hidden",
  265. "text-overflow": "ellipsis",
  266. }
  267. });
  268. ptitle.appendTo(box);
  269.  
  270. var pstatus = $("<p>", {
  271. text: "学习状态: " + data.status,
  272. title: "学习状态: " + data.status,
  273. css: {
  274. "font-size": "12px",
  275. "white-space": "nowrap",
  276. "overflow": "hidden",
  277. "text-overflow": "ellipsis",
  278. "color": "#c1c1c1"
  279. }
  280. });
  281. pstatus.appendTo(box);
  282.  
  283. var disabled = getCourses().findIndex(value => value.url == data.url) > -1;
  284. var button = $("<button>", {
  285. text: disabled ? "已在列表中" : "添加到播放列表",
  286. type: "button",
  287. disabled: disabled,
  288. css: {
  289. color: disabled ? "#000" : "#FFF",
  290. backgroundColor: disabled ? "#c3c3c3" : "#4bccf2",
  291. border: "none",
  292. padding: "5px 10px",
  293. "margin-top": "4px"
  294. },
  295. click: function () {
  296. if (addCourse({title: data.title, url: data.url})) {
  297. $(this).attr("disabled", true);
  298. $(this).css({
  299. color: "#000",
  300. backgroundColor: "#c3c3c3",
  301. }).text("已在列表中");
  302. }
  303. }
  304. });
  305. button.appendTo(box);
  306.  
  307. box.appendTo(listBox);
  308. });
  309.  
  310. playListBox.appendTo('body');
  311.  
  312. return playListBox;
  313. }
  314.  
  315. /**
  316. * 显示通知
  317. * @param content
  318. */
  319. function showNotification(content) {
  320. GM_notification({
  321. text: content,
  322. title: "Chinahrt自动刷课",
  323. image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAArFJREFUWEftlttPE0EUxr+9ddtdYOXSSmmlFFoasSFemmg0qYkIMfGF/9J/wTeN0cSYGBHEBBIoLSIU0VrKpe1eagaySWVmutu+GJPO4+5cfvOdc745wkGl3sI/HEIf4L9ToHrqoHLi4LTRgmm1IAhAMCDgmi4ibEgQhe4SyncOFA9tFMoWaucO9wRJFDAZlpCeUKAq/kA8AY7PHKwWmqic+i8WRRaQTciIj8qeFB0Bjo4dvN9ooOX/7L8OnLshYybaWQouALn5m/XeD3dJ5qcCSEQkrhJcgLfrdabshV8mvtdsPEoEPeV1JzzOqhjSROZ8JsBO2cJa0WQueLFSQ6lqYWpYQT4ZQnSQfzt3g+iwhFw64B/g9VqDm+0uANlNkYB8UkMupnqqkc+qMBgqUAqQOiex5412AHdOJhzAUlqDpvBNIBOXMTtBJyQF0El+ciALgHwfUEUspjTMjrGzPmKIuJ+hlaIA1ksmtg+srhRon7wwE0IuTieoHhTwZJ7+TgGsbDexe2T3DJAdV/E8o1HriTMu3QlR3ymAz4UmSj96A1AkActzOqZH6DD4BtjYM7G5130IYkMynmV0jHHqfXRQxMObPnKg/NvGh81mVyG4HQ1gcVYH22out5oel3Fr0kcVOC3g5cdz2JxH72oVPE1ruDfh7QMPMirCBo3IdMIvRfPi6WUNF2BMl0Aynjii1yAGRIyINZgADRN4tVa/aDiujnfFOg5PbCykNAyp/roPYsPEjn0DkInfflr4tMV+D7xu3P4/eV1GNsFXqWM/sLVv4usuvyK8QGIjEu6m2I+Qu9azIyKt2OoOvyp4EF439w1AJpLmhHjDfoVvUO6GJOHSMZkb86vAngq0L6ieOSA+UalddsWWfZmkA0ERhi4iYkjMUusUqq4AvGLey/8+QF+BP0npcPDdfTv7AAAAAElFTkSuQmCC",
  324. });
  325. }
  326.  
  327. /**
  328. * 创建配置窗口
  329. */
  330. function createConfigBox() {
  331. var box = $("<div>", {
  332. css: {
  333. position: "fixed",
  334. right: 0,
  335. top: 0,
  336. width: "250px",
  337. height: "240px",
  338. "background-color": "#FFF",
  339. "z-index": 9999,
  340. border: "1px solid #ccc"
  341. }
  342. });
  343.  
  344. $("<div>", {
  345. text: "视频控制配置",
  346. css: {
  347. "border-bottom": "1px solid #ccc",
  348. padding: "5px",
  349. "font-weight": "bold"
  350. }
  351. }).appendTo(box);
  352.  
  353. var configBox = $("<div>", {
  354. css: {
  355. padding: "5px",
  356. "padding-bottom": "5px",
  357. "font-size": "12px",
  358. "line-height": "150%"
  359. }
  360. });
  361.  
  362. // 自动播放
  363. var autoPlayBox = $("<div>", {css: {"border-bottom": "1px dotted #ccc", "padding-bottom": "5px"}});
  364. $("<p>", {text: "是否自动播放:"}).appendTo(autoPlayBox);
  365. $("<input>", {
  366. type: "radio", name: "autoPlay", value: true, checked: getAutoPlay(), click: function () {
  367. GM_setValue(AUTOPLAY, true);
  368. }
  369. }).appendTo(autoPlayBox);
  370. $("<label>", {text: "是"}).appendTo(autoPlayBox);
  371. $("<input>", {
  372. type: "radio", name: "autoPlay", value: false, checked: !getAutoPlay(), click: function () {
  373. GM_setValue(AUTOPLAY, false);
  374. }
  375. }).appendTo(autoPlayBox);
  376. $("<label>", {text: "否"}).appendTo(autoPlayBox);
  377. autoPlayBox.appendTo(configBox);
  378.  
  379. // 是否静音
  380. var mutePlayBox = $("<div>", {css: {"border-bottom": "1px dotted #ccc", "padding-bottom": "5px"}});
  381. $("<p>", {text: "是否静音:"}).appendTo(mutePlayBox);
  382. $("<input>", {
  383. type: "radio", name: "mute", value: true, checked: getMute(), click: function () {
  384. GM_setValue(MUTE, true);
  385. }
  386. }).appendTo(mutePlayBox);
  387. $("<label>", {text: "是"}).appendTo(mutePlayBox);
  388. $("<input>", {
  389. type: "radio", name: "mute", value: false, checked: !getMute(), click: function () {
  390. GM_setValue(MUTE, false);
  391. }
  392. }).appendTo(mutePlayBox);
  393. $("<label>", {text: "否"}).appendTo(mutePlayBox);
  394. $("<p>", {
  395. text: "注意:不静音,视频可能会出现不会自动播放",
  396. css: {"font-size": "13px", "font-weight": "bold"}
  397. }).appendTo(mutePlayBox);
  398. mutePlayBox.appendTo(configBox);
  399.  
  400. // 启用拖放
  401. var dragPlayBox = $("<div>", {css: {"border-bottom": "1px dotted #ccc", "padding-bottom": "5px"}});
  402. $("<p>", {text: "启用拖放(慎用):"}).appendTo(dragPlayBox);
  403. $("<input>", {
  404. type: "radio", name: "drag", value: 5, checked: getDrag() == 5, click: function () {
  405. GM_setValue(DRAG, 5);
  406. }
  407. }).appendTo(dragPlayBox);
  408. $("<label>", {text: "还原"}).appendTo(dragPlayBox);
  409. $("<input>", {
  410. type: "radio", name: "drag", value: 1, checked: getDrag() == 1, click: function () {
  411. GM_setValue(DRAG, 1);
  412. }
  413. }).appendTo(dragPlayBox);
  414. $("<label>", {text: "启用"}).appendTo(dragPlayBox);
  415. dragPlayBox.appendTo(configBox);
  416. var playModeBox = $("<div>", {css: {"border-bottom": "1px dotted #ccc", "padding-bottom": "5px"}});
  417.  
  418. playModeBox.appendTo(configBox);
  419.  
  420. configBox.appendTo(box);
  421.  
  422. box.appendTo("body");
  423. }
  424.  
  425. /**
  426. * 创建播放列表窗口
  427. */
  428. function createPlayListBox() {
  429. var box = $("<div>", {
  430. id: "playListBox",
  431. css: {
  432. position: "fixed",
  433. right: 0,
  434. top: 250,
  435. width: "250px",
  436. height: "450px",
  437. "background-color": "#FFF",
  438. "z-index": 9999,
  439. border: "1px solid #ccc",
  440. "overflow-y": "auto"
  441. }
  442. });
  443.  
  444. $("<div>", {
  445. text: "视频列表",
  446. css: {
  447. "border-bottom": "1px solid #ccc",
  448. padding: "5px",
  449. "font-weight": "bold"
  450. }
  451. }).appendTo(box);
  452.  
  453. // 渲染课程列表
  454. var courses = getCourses();
  455. for (let index = 0; index < courses.length; index++) {
  456. const element = courses[index];
  457.  
  458. var ptitle = $("<p>", {
  459. text: element.title,
  460. title: element.title,
  461. css: {
  462. "font-size": "13px",
  463. "white-space": "nowrap",
  464. "overflow": "hidden",
  465. "text-overflow": "ellipsis",
  466. }
  467. });
  468. ptitle.appendTo(box);
  469.  
  470. var button = $("<button>", {
  471. text: "移除",
  472. type: "button",
  473. data: {index: index},
  474. css: {
  475. color: "#FFF",
  476. backgroundColor: "#fd1952",
  477. border: "none",
  478. padding: "5px 10px",
  479. "margin": "4px 0 10px 0",
  480. },
  481. click: function () {
  482. if (confirm("确定删除这个视频么?")) {
  483. removeCourse($(this).data("index"));
  484. }
  485. }
  486. });
  487. button.appendTo(box);
  488. }
  489.  
  490. box.appendTo("body");
  491. }
  492.  
  493. /**
  494. * 获取当前页面编号
  495. * @returns {number}
  496. */
  497. function getPageNumber() {
  498. var href = window.location.href;
  499. // 以下是Vue版的请求地址
  500. if (href.indexOf("/index.html#/v_courseDetails") > -1) {
  501. return VUE_COURSE_PREVIEW;
  502. }
  503. // 默认课程详情地址
  504. if (href.indexOf("/course/preview") > -1) {
  505. return COURSE_PREVIEW;
  506. }
  507. if (href.indexOf("/course/play_video") > -1) {
  508. return COURSE_PALY;
  509. }
  510. if (href.indexOf("/videoPlay/play") > -1) {
  511. return VIDEO_PALY;
  512. }
  513.  
  514. return UNKOWN_PAGE;
  515. }
  516.  
  517. /**
  518. * 获取课程信息
  519. * @param playListBox
  520. */
  521. function findCourses(playListBox) {
  522. // 提取所有链接
  523. var allLinks = document.querySelectorAll("a");
  524. // 提取所有可以播放的数据
  525. for (let i = 0; i < allLinks.length; i++) {
  526. const element = allLinks[i];
  527. if (element.href.indexOf("/course/play_video") > -1) {
  528. playListBox.trigger("bind", {
  529. title: element.innerText,
  530. url: element.href,
  531. status: $(element).prev().text()
  532. });
  533. }
  534. }
  535. }
  536.  
  537. /**
  538. * VUE版本获取课程信息
  539. * @param playListBox
  540. */
  541. function vue_findCourses(playListBox) {
  542. // 获取data
  543. var data = document.querySelector("article")?.__vue__?._data;
  544. if (!data) {
  545. return;
  546. }
  547.  
  548. // 获取页面信息
  549. var pageData = data?.pageData;
  550. if (!pageData) {
  551. return;
  552. }
  553.  
  554. // 获取所有章节信息
  555. var chapters = pageData?.course?.chapter_list;
  556.  
  557. // 循环获取章节信息
  558. if (chapters && chapters.length > 0) {
  559. for (let i = 0; i < chapters.length; i++) {
  560. const chapter = chapters[i];
  561. // 循环分段(课时)
  562. var sections = chapter?.section_list;
  563. if (sections && sections.length > 0) {
  564. for (let j = 0; j < sections.length; j++) {
  565. const section = sections[j];
  566. // 拼接课时网址
  567. var url = window.location.protocol + "//" + window.location.host + window.location.pathname + "#/v_video?platformId=" + data.platformId + "&trainplanId=" + data.trainplanId + "&courseId=" + data.courseId + "&sectionId=" + section.id;
  568. playListBox.trigger("bind", {
  569. title: section.name,
  570. url: url,
  571. status: section.study_status + "( " + section.studyTimeHHmmss + " )"
  572. });
  573. }
  574. }
  575. }
  576. }
  577. }
  578.  
  579. window.onload = function () {
  580. try {
  581. // 检测到是Vue
  582. if (Vue) {
  583. console.log("当前是Vue模式");
  584. // 创建播放列表
  585. var playListBox;
  586. // 循环检测
  587. setInterval(() => {
  588. if (getPageNumber() == VUE_COURSE_PREVIEW) {
  589. if (!playListBox) {
  590. playListBox = createCanPlayList();
  591. setTimeout(function () {
  592. vue_findCourses(playListBox);
  593. }, 1000);
  594. }
  595. } else {
  596. if (playListBox) {
  597. playListBox.remove();
  598. playListBox = undefined;
  599. }
  600. }
  601. }, 1000);
  602. }
  603. } catch (error) {
  604. console.log("当前不是Vue模式");
  605. }
  606.  
  607.  
  608. if (getPageNumber() == COURSE_PREVIEW) {
  609. $(document).ready(function () {
  610. // 创建播放列表
  611. var playListBox = createCanPlayList();
  612. findCourses(playListBox);
  613. });
  614. }
  615.  
  616. if (getPageNumber() == VIDEO_PALY) {
  617. $(document).ready(function () {
  618.  
  619. // 增加提示信息
  620. $('<div></div>', {
  621. html: "点课程详情页中的【添加到播放列表】按钮添加需要学习的课程。受到浏览器策略影响第一次可能无法自动播放,请手动点击播放。视频播放标签放置最前面",
  622. css: {
  623. "font-size": "14px",
  624. "font-weight": "bold",
  625. color: "red",
  626. background: "#FFF",
  627. position: "absolute",
  628. "line-height": "30px",
  629. "z-index": "99999",
  630. "left": "30px",
  631. bottom: "10px"
  632. }
  633. }).prependTo("#body");
  634.  
  635. $("video").prop("muted", "muted");
  636.  
  637. // 移除讨厌的事件
  638. removePauseBlur();
  639.  
  640. // 视频播放初始化
  641. function run() {
  642. // 总是显示播放进度
  643. player.changeControlBarShow(true);
  644.  
  645. // 拖动开关
  646. player.changeConfig('config', 'timeScheduleAdjust', getDrag());
  647.  
  648. // 静音
  649. if (getMute()) {
  650. player.videoMute();
  651. } else {
  652. +
  653. player.videoEscMute();
  654. }
  655.  
  656. // 播放速度
  657. player.changePlaybackRate(getSpeed());
  658.  
  659. // 自动播放
  660. if (getAutoPlay()) {
  661. player.videoPlay();
  662. }
  663. }
  664.  
  665. // 视频总长度
  666. var videoDuration = 0;
  667. var videocurrentTime=0;
  668. var startstaus=0;
  669. var actisok=0;
  670. var ctimes=0;
  671. var rtimes=0;
  672. var rtimess=0;
  673. var jumpas=0;
  674. var nonum=0;
  675. var nplay=0;
  676.  
  677. var tmp = setInterval(function () {
  678. if (player != undefined) {
  679. player.addListener('loadedmetadata', run);
  680. run();
  681. clearInterval(tmp);
  682.  
  683.  
  684. // 移除本课程学习完毕
  685. attrset.proxyUrl = "";
  686.  
  687. // 播放结束
  688. player.addListener('ended', function () {
  689. removeCourse(window.location.href);
  690. var courses = getCourses();
  691. if (courses.length == 0) {
  692. GM_setValue(REAPT_MODE, 0);
  693. GM_setValue(REAPT_NUM, 0);
  694. showNotification("所有视频已经播放完毕");
  695. } else {
  696. GM_setValue(REAPT_MODE, 0);
  697. GM_setValue(REAPT_NUM, 0);
  698. showNotification("即将播放下一个视频:" + courses[0].title);
  699. window.top.location.href = courses[0].url;
  700. }
  701. });
  702.  
  703.  
  704. player.addListener('time', function (t) {
  705. videoDuration = parseInt(player.getMetaDate().duration);
  706. videocurrentTime = parseInt(attrset.currentTime);
  707. // console.log(attrset.currentTime+"/"+videoDuration);
  708.  
  709. });
  710. }
  711. }, 1000);
  712.  
  713. // 创建配置窗口
  714. createConfigBox();
  715.  
  716. // 创建播放列表窗口
  717. createPlayListBox();
  718.  
  719.  
  720.  
  721. // 检测播放列表
  722. GM_addValueChangeListener(COURSES, function (name, oldValue, newValue, remote) {
  723. console.log("检测播放列表变动");
  724. $("#playListBox").remove();
  725. createPlayListBox();
  726. });
  727.  
  728. // 监测自动播放
  729. GM_addValueChangeListener(AUTOPLAY, function (name, oldValue, newValue, remote) {
  730. console.log("监测自动播放变动");
  731. if (newValue) {
  732. player.videoPlay();
  733. }
  734. });
  735.  
  736. // 检测静音
  737. GM_addValueChangeListener(MUTE, function (name, oldValue, newValue, remote) {
  738. console.log("检测静音变动");
  739. if (newValue) {
  740. player.videoMute();
  741. } else {
  742. player.videoEscMute();
  743. }
  744. });
  745.  
  746. // 检测拖动
  747. GM_addValueChangeListener(DRAG, function (name, oldValue, newValue, remote) {
  748. console.log("检测拖动变动");
  749. player.changeConfig('config', 'timeScheduleAdjust', newValue);
  750. });
  751.  
  752. // 检测速度
  753. GM_addValueChangeListener(SPEED, function (name, oldValue, newValue, remote) {
  754. console.log("检测速度变动");
  755. player.changePlaybackRate(newValue);
  756. });
  757. });
  758. }
  759. }

QingJ © 2025

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