AcWing Better!

AcWing界面美化,功能增强,视频时间点标记跳转,代码markdown一键复制

当前为 2023-09-17 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name AcWing Better!
  3. // @version 3.27
  4. // @description AcWing界面美化,功能增强,视频时间点标记跳转,代码markdown一键复制
  5. // @author 北极小狐
  6. // @match https://www.acwing.com/*
  7. // @icon https://aowuucdn.oss-cn-beijing.aliyuncs.com/acwing.png
  8. // @grant GM_xmlhttpRequest
  9. // @grant GM_info
  10. // @grant GM_setValue
  11. // @grant GM_getValue
  12. // @grant GM_addStyle
  13. // @grant GM_setClipboard
  14. // @connect gf.qytechs.cn
  15. // @run-at document-end
  16. // @require https://cdn.bootcdn.net/ajax/libs/turndown/7.1.1/turndown.min.js
  17. // @license MIT
  18. // @namespace https://gf.qytechs.cn/users/747162
  19. // ==/UserScript==
  20.  
  21. // 状态与初始化
  22. const getGMValue = (key, defaultValue) => {
  23. const value = GM_getValue(key);
  24. if (value === undefined) {
  25. GM_setValue(key, defaultValue);
  26. return defaultValue;
  27. }
  28. return value;
  29. };
  30.  
  31. const bottomBar = getGMValue("bottomBar", true);
  32. const bingWallpaper = getGMValue("bingWallpaper", true);
  33. const widthAdjustment = getGMValue("widthAdjustment", true);
  34. const autoPlay = getGMValue("autoPlay", true);
  35. const acTimer = getGMValue("acTimer", true);
  36.  
  37. // 常量
  38. const helpCircleHTML = '<div class="help-icon"><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592 0-42.944-14.08-76.736-42.24-101.376-28.16-25.344-65.472-37.312-111.232-37.312zm-12.672 406.208a54.272 54.272 0 0 0-38.72 14.784 49.408 49.408 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.848 54.848 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.968 51.968 0 0 0-15.488-38.016 55.936 55.936 0 0 0-39.424-14.784z"></path></svg></div>';
  39. const darkenPageStyle = `body::before { content: ""; display: block; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.4); z-index: 9999; }`;
  40.  
  41. // 样式
  42. if (bottomBar) {
  43. GM_addStyle(`
  44. .fs-gui-taskbar {
  45. height: 3.5vh !important;
  46. background-color: #dde1e5 !important;
  47. }
  48. .fs-gui-taskbar-widgets-apps-item > img {
  49. height: 2.2vh !important;
  50. width: 2.2vh !important;
  51. margin: 0.5vh 0.5vh 0.5vh 0.5vh !important;
  52. }
  53. .fs-gui-taskbar-widgets-clock{
  54. width: 0px !important;
  55. height: 0px !important;
  56. overflow: hidden !important;
  57. }
  58. .fs-gui-taskbar-widgets-apps-item {
  59. margin-right: 2vh !important;
  60. }
  61. #fs-gui-taskbar-search-field {
  62. font-size: 13px !important;
  63. }
  64. .fs-gui-taskbar-search-icon {
  65. font-size: 16px !important;
  66. top: 0.95vh !important;
  67. left: 4.3vh !important;
  68. }
  69. .fs-gui-taskbar-begin {
  70. height: 3vh !important;
  71. width: 3vh !important;
  72. margin: 0.2vh !important;
  73. border-radius: 60%;
  74. background-color: #fffefe80 !important;
  75. }
  76. button.fs-gui-taskbar-begin.pull-left.btn.btn-default img {
  77. width: 83% !important;
  78. }
  79. #fs-gui-taskbar-search-field {
  80. height: 90% !important;
  81. margin: 0.15vh;
  82. border-radius: 100px;
  83. border-width: 0.2vh;
  84. border-style: solid;
  85. border-color: #c7d2dd;
  86. }
  87. #fs-gui-taskbar-search-field:focus-visible {
  88. border-width: 0.2vh;
  89. border-style: solid;
  90. border-color: #8bb2d9;
  91. outline: -webkit-focus-ring-color auto 0px;
  92. }
  93. `);
  94. }
  95. if (bingWallpaper) {
  96. GM_addStyle(`
  97. #acwing_body {
  98. background: white url(https://bingw.jasonzeng.dev) fixed !important;
  99. }
  100. `);
  101. }
  102. if (widthAdjustment) {
  103. GM_addStyle(`
  104. .container {
  105. width: auto !important;
  106. margin: 0px 3px;
  107. }
  108. `);
  109. $(document).ready(function () {
  110. $('.base_body .container .row').children().removeClass(' col-sm-offset-2 col-sm-8 col-md-offset-2 col-md-9');
  111. $('.col-md-8').removeClass('col-md-8').addClass('col-md-12');
  112. })
  113. }
  114. GM_addStyle(`
  115. span.mdViewContent {
  116. white-space: pre-wrap;
  117. }
  118. .file-explorer-main-field-item.file-explorer-main-field-item-desktop {
  119. width: 0px;
  120. height: 0px;
  121. overflow: hidden;
  122. }
  123. .comment-conent {
  124. overflow-x: auto;
  125. }
  126. /* 页脚 */
  127. footer#acwing_footer .copyright {
  128. color: #fff;
  129. }
  130. footer#acwing_footer .copyright a, .links a, footer#acwing_footer .container {
  131. color: #fff;
  132. }
  133. /* 复制按钮 */
  134. pre.hljs {
  135. display: flex;
  136. justify-content: space-between;
  137. }
  138. span.copy-button {
  139. cursor: pointer;
  140. background-color: #e6e6e6;
  141. color: #727378;
  142. height: 20px;
  143. font-size: 13px;
  144. border-radius: 0.3rem;
  145. padding: 1px 5px;
  146. margin: 5px;
  147. box-shadow: 0 0 1px #0000004d;
  148. }
  149. span.copy-button.copied {
  150. background-color: #07e65196;
  151. color: #104f2b;
  152. }
  153. /* html2md */
  154. .html2md-panel {
  155. display: flex;
  156. justify-content: flex-end;
  157. }
  158. button.html2mdButton {
  159. height: 30px;
  160. width: 30px;
  161. }
  162. button.html2mdButton {
  163. display: flex;
  164. align-items: center;
  165. cursor: pointer;
  166. background-color: #ffffff;
  167. color: #606266;
  168. height: 22px;
  169. width: auto;
  170. font-size: 13px;
  171. border-radius: 0.3rem;
  172. padding: 1px 5px;
  173. margin: 5px;
  174. border: 1px solid #dcdfe6;
  175. }
  176. button.html2mdButton:hover {
  177. color: #409eff;
  178. border-color: #409eff;
  179. background-color: #f1f8ff;
  180. }
  181. button.html2mdButton.copied {
  182. background-color: #f0f9eb;
  183. color: #67c23e;
  184. border: 1px solid #b3e19d;
  185. }
  186. button.html2mdButton.html2md-view.mdViewed {
  187. background-color: #ff980057;
  188. color: #5a3a0c;
  189. }
  190. /* 打卡框 */
  191. .ui.bottom.attached.tab.segment.active {
  192. padding: 0px;
  193. }
  194. /* 视频bar */
  195. .embed-responsive {
  196. height: max-content;
  197. padding-bottom: 0px;
  198. }
  199. .player_bar {
  200. margin: 2px;
  201. display: flex;
  202. justify-content: space-between;
  203. }
  204. .player_bar_go {
  205. cursor: pointer;
  206. width: 50px;
  207. color: #999;
  208. height: auto;
  209. font-size: 13px;
  210. border-radius: 0.3rem;
  211. padding: 1px 5px;
  212. margin: 5px;
  213. border: none;
  214. background: linear-gradient(-225deg,#d5dbe4,#f8f8f8);
  215. box-shadow: inset 0 -2px 0 0 #cdcde6,inset 0 0 1px 1px #fff,0 1px 2px 1px rgba(30,35,90,.4);
  216. display: flex;
  217. justify-content: center;
  218. align-items: center;
  219. }
  220. button#player_bar_list_add_new_item_btn {
  221. height: 30px;
  222. width: 50px;
  223. background-color: #00aeec;
  224. color: #ffffff;
  225. font-size: 13px;
  226. border-radius: 0rem 0.5rem 0.5rem 0rem;
  227. padding: 1px 5px;
  228. margin: 5px 5px 5px 0px;
  229. border: none;
  230. box-shadow: 0 0 1px #0000004d;
  231. }
  232. div#player_bar_list {
  233. display: grid;
  234. width: 100%;
  235. border-radius: 0.3rem 0rem 0rem 0.3rem;
  236. margin: 5px 0px 5px 0px;
  237. border: 1px solid #00aeeccc;
  238. }
  239. div#player_bar_list input[type="radio"] {
  240. appearance: none;
  241. width: 0;
  242. height: 0;
  243. overflow: hidden;
  244. }
  245. div#player_bar_list input[type=radio]:focus {
  246. outline: 0px;
  247. }
  248. label.player_bar_ul_li_text {
  249. max-width: 100%;
  250. height: 90px;
  251. overflow-x: auto;
  252. font-weight: 400;
  253. margin: 0px 4px;
  254. border: 1px dashed #0000004d;
  255. padding: 3px;
  256. }
  257. ul#player_bar_ul li button {
  258. background-color: #e6e6e6;
  259. color: #727378;
  260. height: 23px;
  261. font-size: 14px;
  262. border-radius: 0.3rem;
  263. padding: 1px 5px;
  264. margin: 5px;
  265. border: none;
  266. box-shadow: 0 0 1px #0000004d;
  267. }
  268. ul#player_bar_ul {
  269. list-style-type: none;
  270. padding-inline-start: 0px;
  271. display: flex;
  272. overflow-x: auto;
  273. max-width: 100%;
  274. margin: 0px;
  275. }
  276. ul#player_bar_ul li {
  277. height: 100px;
  278. width: 80px;
  279. display: grid;
  280. overflow: hidden;
  281. margin: 4px 4px;
  282. min-width: 100px;
  283. }
  284. label.player_bar_ul_li_text:hover {
  285. background-color: #eae4dc24;
  286. }
  287. input[type="radio"]:checked + .player_bar_ul_li_text {
  288. background: #41e49930;
  289. border: 1px solid green;
  290. color: green;
  291. }
  292.  
  293. ul#player_bar_ul::-webkit-scrollbar {
  294. width: 5px;
  295. height: 8px;
  296. }
  297. ul#player_bar_ul::-webkit-scrollbar-thumb {
  298. border-radius: 2px;
  299. border: 1px solid rgba(56,56,56,.3411764706);
  300. background-clip: padding-box;
  301. background-color: #a29bb84a;
  302. background-image: -webkit-linear-gradient(45deg,hsla(0deg,0%,100%,.4) 25%,transparent 0,transparent 50%,hsla(0deg,0%,100%,.4) 0,hsla(0deg,0%,100%,.4) 75%,transparent 0,transparent);
  303. }
  304. ul#player_bar_ul::-webkit-scrollbar-track {
  305. background-color: #f1f1f1;
  306. border-radius: 5px;
  307. }
  308.  
  309. label.player_bar_ul_li_text::-webkit-scrollbar {
  310. width: 5px;
  311. height: 7px;
  312. background-color: #aaa;
  313. }
  314. label.player_bar_ul_li_text::-webkit-scrollbar-thumb {
  315. border: 1px solid rgba(56,56,56,.3411764706);
  316. background-clip: padding-box;
  317. background-color: #a29bb84a;
  318. }
  319. label.player_bar_ul_li_text::-webkit-scrollbar-track {
  320. background-color: #f1f1f1;
  321. }
  322. .player_bar_list_add_div {
  323. display: flex;
  324. height: 40px;
  325. margin: 4px 2px;
  326. }
  327. input#player_bar_list_add_input {
  328. width: 100%;
  329. height: 30px;
  330. background-color: #ffffff;
  331. color: #727378;
  332. font-size: 13px;
  333. border-radius: 0.3rem 0rem 0rem 0.3rem;
  334. padding: 1px 5px;
  335. margin: 5px 0px 5px 0px;
  336. border: 1px solid #00aeeccc;
  337. border-right: none;
  338. box-shadow: 0 0 1px #0000004d;
  339. }
  340. input#player_bar_list_add_input:focus-visible {
  341. border-width: 2px;
  342. border-style: solid;
  343. border-color: #8bb2d9;
  344. outline: -webkit-focus-ring-color auto 0px;
  345. }
  346. button#player_bar_list_add_new_item_btn.added {
  347. background-color: #07e65196;
  348. color: #104f2b;
  349. }
  350. div#player_bar_go.gone {
  351. color: #3f5a14;
  352. font-weight: 600;
  353. background: linear-gradient(-225deg,#9CCC65,#E6EE9C);
  354. box-shadow: inset 0 -2px 0 0 #cde3e6, inset 0 0 1px 1px #c6fd7d, 0 1px 2px 1px rgb(30 90 44 / 40%);
  355. }
  356. /* bar修改菜单 */
  357. div#player_bar_menu {
  358. position: absolute;
  359. border-width: 1px;
  360. border-style: solid;
  361. border-color: #8bb2d9;
  362. box-shadow: 1px 1px 4px 0px #0000004d;
  363. }
  364. div#player_bar_menu_edit {
  365. cursor: pointer;
  366. background-color: #ffffff;
  367. color: black;
  368. box-shadow: inset 0px 0px 0px 0px #8bb2d9;
  369. padding: 2px 6px;
  370. }
  371. div#player_bar_menu_delete {
  372. cursor: pointer;
  373. background-color: #ffff;
  374. box-shadow: inset 0px 1px 0px 0px #8bb2d9;
  375. color: black;
  376. padding: 2px 6px;
  377. }
  378. div#player_bar_menu_edit:hover {
  379. background-color: #00aeec;
  380. color: white;
  381. }
  382. div#player_bar_menu_delete:hover {
  383. background-color: #FF5722;
  384. color: white;
  385. }
  386. /*设置面板*/
  387. div#topNavBar {
  388. width: 80%;
  389. }
  390. nav.navbar.navbar-inverse.navbar-fixed-top.navbar-expand-lg .container {
  391. display: flex;
  392. align-items: center;
  393. justify-content: space-between;
  394. }
  395. button.html2mdButton.ACBetter_setting {
  396. background-color: #56aa56;
  397. color: white;
  398. white-space: nowrap;
  399. float: right;
  400. height: 30px;
  401. margin: 10px;
  402. border: 0px;
  403. }
  404. #ACwingBetter_setting_menu {
  405. z-index: 9999;
  406. border-radius: 0.5rem;
  407. box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  408. display: grid;
  409. position: fixed;
  410. top: 50%;
  411. left: 50%;
  412. width: 270px;
  413. transform: translate(-50%, -50%);
  414. border-radius: 16px;
  415. background-color: #ecf0ff;
  416. border: 6px solid #ffffff;
  417. color: #697e91;
  418. padding: 10px 20px 20px 20px;
  419. }
  420.  
  421. #ACwingBetter_setting_menu .tool-box {
  422. position: absolute;
  423. display: flex;
  424. align-items: center;
  425. justify-content: center;
  426. width: 2.5rem;
  427. height: 2.5rem;
  428. top: 3px;
  429. right: 3px;
  430. }
  431.  
  432. #ACwingBetter_setting_menu .btn-close {
  433. display: flex;
  434. align-items: center;
  435. justify-content: center;
  436. text-align: center;
  437. padding: 10px;
  438. width: 2rem;
  439. height: 2rem;
  440. color: transparent;
  441. font-size: 0;
  442. cursor: pointer;
  443. background-color: #ff000080;
  444. border: none;
  445. border-radius: 10px;
  446. transition: .2s ease all;
  447. }
  448.  
  449. #ACwingBetter_setting_menu .btn-close:hover {
  450. width: 2rem;
  451. height: 2rem;
  452. font-size: 1rem;
  453. color: #ffffff;
  454. background-color: #ff0000cc;
  455. box-shadow: 0 5px 5px 0 #00000026;
  456. }
  457.  
  458. #ACwingBetter_setting_menu .btn-close:active {
  459. width: .9rem;
  460. height: .9rem;
  461. font-size: .9rem;
  462. color: #ffffffde;
  463. --shadow-btn-close: 0 3px 3px 0 #00000026;
  464. box-shadow: var(--shadow-btn-close);
  465. }
  466.  
  467. .checkbox-con {
  468. margin: 10px;
  469. display: flex;
  470. align-items: center;
  471. color: white;
  472. }
  473.  
  474. #ACwingBetter_setting_menu input[type=checkbox]:focus {
  475. outline: 0px;
  476. }
  477.  
  478. .checkbox-con input[type="checkbox"] {
  479. margin: 0px;
  480. appearance: none;
  481. width: 48px;
  482. height: 24px;
  483. border: 2px solid #6b8092;
  484. border-radius: 20px;
  485. background: #f1e1e1;
  486. position: relative;
  487. box-sizing: border-box;
  488. }
  489.  
  490. .checkbox-con input[type="checkbox"]::before {
  491. content: "";
  492. width: 16px;
  493. height: 16px;
  494. background: #6b80927a;
  495. border: 2px solid #6b8092;
  496. border-radius: 50%;
  497. position: absolute;
  498. top: 0;
  499. left: 0;
  500. transform: translate(16%, 12%);
  501. transition: all 0.3s ease-in-out;
  502. }
  503.  
  504. .checkbox-con input[type="checkbox"]::after {
  505. content: url("data:image/svg+xml,%3Csvg xmlns='://www.w3.org/2000/svg' width='23' height='23' viewBox='0 0 23 23' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M6.55021 5.84315L17.1568 16.4498L16.4497 17.1569L5.84311 6.55026L6.55021 5.84315Z' fill='%23EA0707' fill-opacity='0.89'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M17.1567 6.55021L6.55012 17.1568L5.84302 16.4497L16.4496 5.84311L17.1567 6.55021Z' fill='%23EA0707' fill-opacity='0.89'/%3E%3C/svg%3E");
  506. position: absolute;
  507. top: 0;
  508. left: 24px;
  509. }
  510.  
  511. .checkbox-con input[type="checkbox"]:checked {
  512. border: 2px solid #02c202;
  513. background: #e2f1e1;
  514. }
  515.  
  516. .checkbox-con input[type="checkbox"]:checked::before {
  517. background: rgba(2, 194, 2, 0.5);
  518. border: 2px solid #02c202;
  519. transform: translate(160%, 13%);
  520. transition: all 0.3s ease-in-out;
  521. }
  522.  
  523. .checkbox-con input[type="checkbox"]:checked::after {
  524. content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='13' viewBox='0 0 15 13' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M14.8185 0.114533C15.0314 0.290403 15.0614 0.605559 14.8855 0.818454L5.00187 12.5L0.113036 6.81663C-0.0618274 6.60291 -0.0303263 6.2879 0.183396 6.11304C0.397119 5.93817 0.71213 5.96967 0.886994 6.18339L5.00187 11L14.1145 0.181573C14.2904 -0.0313222 14.6056 -0.0613371 14.8185 0.114533Z' fill='%2302C202' fill-opacity='0.9'/%3E%3C/svg%3E");
  525. position: absolute;
  526. top: 3px;
  527. left: 4px;
  528. }
  529.  
  530. .checkbox-con label {
  531. margin: 0px 0px 0px 10px;
  532. cursor: pointer;
  533. user-select: none;
  534. }
  535.  
  536. .ACBetter_setting_list {
  537. display: flex;
  538. align-items: center;
  539. margin-top: 18px;
  540. }
  541.  
  542. .checkbox-con button {
  543. cursor: pointer;
  544. display: inline-flex;
  545. padding: 0.5rem 1rem;
  546. background-color: #1aa06d;
  547. color: #ffffff;
  548. font-size: 1rem;
  549. line-height: 1.5rem;
  550. font-weight: 500;
  551. justify-content: center;
  552. width: 100%;
  553. border-radius: 0.375rem;
  554. border: none;
  555. box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  556. }
  557. /*设置面板-tip*/
  558. .help_tip {
  559. margin-right: auto;
  560. }
  561. span.input_label {
  562. font-size: 14px;
  563. }
  564. .help_tip .tip_text {
  565. display: none;
  566. position: absolute;
  567. color: #697e91;
  568. font-weight: 400;
  569. font-size: 14px;
  570. letter-spacing: 0px;
  571. background-color: #ffffff;
  572. padding: 10px;
  573. margin: 5px 0px;
  574. border-radius: 4px;
  575. border: 1px solid #e4e7ed;
  576. box-shadow: 0px 0px 12px rgba(0, 0, 0, .12);
  577. z-index: 999;
  578. }
  579. .help_tip .tip_text p {
  580. margin-bottom: 5px;
  581. }
  582. .help_tip .tip_text:before {
  583. content: "";
  584. position: absolute;
  585. top: -20px;
  586. right: -10px;
  587. bottom: -10px;
  588. left: -10px;
  589. z-index: -1;
  590. }
  591. .help-icon {
  592. display: flex;
  593. cursor: help;
  594. width: 15px;
  595. color: #b4b9d4;
  596. margin-left: 5px;
  597. }
  598. .AtBetter_setting_menu .AtBetter_setting_menu_label_text .help_tip .help-icon {
  599. color: #7fbeb2;
  600. }
  601. .help_tip .help-icon:hover + .tip_text, .help_tip .tip_text:hover {
  602. display: block;
  603. cursor: help;
  604. width: 250px;
  605. }
  606. /*更新检查*/
  607. div#update_panel {
  608. z-index: 9999;
  609. position: fixed;
  610. top: 50%;
  611. left: 50%;
  612. width: 240px;
  613. transform: translate(-50%, -50%);
  614. box-shadow: 0px 0px 4px 0px #0000004d;
  615. padding: 10px 20px 20px 20px;
  616. color: #444242;
  617. background-color: #f5f5f5;
  618. border: 1px solid #848484;
  619. border-radius: 8px;
  620. }
  621. div#update_panel #updating {
  622. cursor: pointer;
  623. display: inline-flex;
  624. padding: 0px;
  625. background-color: #1aa06d;
  626. color: #ffffff;
  627. font-size: 1rem;
  628. line-height: 1.5rem;
  629. font-weight: 500;
  630. justify-content: center;
  631. width: 100%;
  632. border-radius: 0.375rem;
  633. border: none;
  634. box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  635. }
  636. div#update_panel #updating a {
  637. text-decoration: none;
  638. color: white;
  639. display: flex;
  640. position: inherit;
  641. top: 0;
  642. left: 0;
  643. width: 100%;
  644. height: 22px;
  645. font-size: 14px;
  646. justify-content: center;
  647. align-items: center;
  648. }
  649. #skip_menu {
  650. display: flex;
  651. margin-top: 10px;
  652. justify-content: flex-end;
  653. align-items: center;
  654. }
  655. #skip_menu .help_tip {
  656. margin-right: 5px;
  657. margin-left: -5px;
  658. }
  659. #skip_menu .help-icon {
  660. color: #f44336;
  661. }
  662. `);
  663.  
  664. // 获取cookie
  665. function getCookie(name) {
  666. const cookies = document.cookie.split(";");
  667. for (let i = 0; i < cookies.length; i++) {
  668. const cookie = cookies[i].trim();
  669. const [cookieName, cookieValue] = cookie.split("=");
  670.  
  671. if (cookieName === name) {
  672. return decodeURIComponent(cookieValue);
  673. }
  674. }
  675. return "";
  676. }
  677.  
  678. // 防抖函数
  679. function debounce(callback) {
  680. let timer;
  681. let immediateExecuted = false;
  682. const delay = 500;
  683. return function () {
  684. clearTimeout(timer);
  685. if (!immediateExecuted) { callback.call(this); immediateExecuted = true; }
  686. timer = setTimeout(() => { immediateExecuted = false; }, delay);
  687. };
  688. }
  689.  
  690. // 为元素添加鼠标拖动
  691. function addDraggable(element) {
  692. let isDragging = false;
  693. let initialX, initialY; // 元素的初始位置
  694. let startX, startY, offsetX, offsetY; // 鼠标起始位置,移动偏移量
  695. let isSpecialMouseDown = false; // 选取某些元素时不拖动
  696.  
  697. element.on('mousedown', function (e) {
  698. var elem = $(this);
  699. var elemOffset = elem.offset();
  700. var centerX = elemOffset.left + elem.outerWidth() / 2;
  701. var centerY = elemOffset.top + elem.outerHeight() / 2;
  702. initialX = centerX - window.pageXOffset;
  703. initialY = centerY - window.pageYOffset;
  704.  
  705. isDragging = true;
  706. startX = e.clientX;
  707. startY = e.clientY;
  708.  
  709. isSpecialMouseDown = $(e.target).is('label, p, input, textarea, span');
  710.  
  711. $('body').css('cursor', 'all-scroll');
  712. });
  713.  
  714.  
  715. $(document).on('mousemove', function (e) {
  716. if (!isDragging) return;
  717. // 不执行拖动操作
  718. if ($(e.target).is('label, p, input, textarea, span') || isSpecialMouseDown && !$(e.target).is('input, textarea')) return;
  719. e.preventDefault();
  720. offsetX = e.clientX - startX;
  721. offsetY = e.clientY - startY;
  722. element.css({ top: initialY + offsetY + 'px', left: initialX + offsetX + 'px' });
  723. });
  724.  
  725. $(document).on('mouseup', function () {
  726. isDragging = false;
  727. isSpecialMouseDown = false;
  728. $('body').css('cursor', 'default');
  729. });
  730. }
  731.  
  732. // 更新检查
  733. (function checkScriptVersion() {
  734. function compareVersions(version1 = "0", version2 = "0") {
  735. const v1Array = String(version1).split(".");
  736. const v2Array = String(version2).split(".");
  737. const minLength = Math.min(v1Array.length, v2Array.length);
  738. let result = 0;
  739. for (let i = 0; i < minLength; i++) {
  740. const curV1 = Number(v1Array[i]);
  741. const curV2 = Number(v2Array[i]);
  742. if (curV1 > curV2) {
  743. result = 1;
  744. break;
  745. } else if (curV1 < curV2) {
  746. result = -1;
  747. break;
  748. }
  749. }
  750. if (result === 0 && v1Array.length !== v2Array.length) {
  751. const v1IsBigger = v1Array.length > v2Array.length;
  752. const maxLenArray = v1IsBigger ? v1Array : v2Array;
  753. for (let i = minLength; i < maxLenArray.length; i++) {
  754. const curVersion = Number(maxLenArray[i]);
  755. if (curVersion > 0) {
  756. v1IsBigger ? result = 1 : result = -1;
  757. break;
  758. }
  759. }
  760. }
  761. return result;
  762. }
  763.  
  764. GM_xmlhttpRequest({
  765. method: "GET",
  766. url: "https://gf.qytechs.cn/zh-CN/scripts/464981.json",
  767. timeout: 10 * 1e3,
  768. onload: function (response) {
  769. const scriptData = JSON.parse(response.responseText);
  770. const skipUpdate = getCookie("skipUpdate");
  771.  
  772. if (
  773. scriptData.name === GM_info.script.name &&
  774. compareVersions(scriptData.version, GM_info.script.version) === 1 &&
  775. skipUpdate !== "true"
  776. ) {
  777. const styleElement = GM_addStyle(darkenPageStyle);
  778. $("body").append(`
  779. <div id='update_panel'>
  780. <h3>${GM_info.script.name}有新版本!</h3>
  781. <hr>
  782. <div class='update_panel_menu'>
  783. <span class ='tip'>版本信息:${GM_info.script.version} ${scriptData.version}</span>
  784. </div>
  785. <br>
  786. <div id="skip_menu">
  787. <div class="help_tip">
  788. `+ helpCircleHTML + `
  789. <div class="tip_text">
  790. <p><b>更新遇到了问题?</b></p>
  791. <p>由于 Greasyfork 平台的原因,当新版本刚发布时,点击 Greasyfork 上的更新按钮<u>可能</u>会出现<u>实际更新/安装的却是上一个版本</u>的情况</p>
  792. <p>通常你只需要稍等几分钟,然后再次前往更新/安装即可</p>
  793. <p>你也可以<u>点击下方按钮,在本次浏览器会话期间将不再提示更新</u></p>
  794. <button id='skip_update' class='html2mdButton'>暂不更新</button>
  795. </div>
  796. </div>
  797. <button id='updating'><a target="_blank" href="${scriptData.url}">更新</a></button>
  798. </div>
  799. </div>
  800. `);
  801.  
  802. $("#skip_update").click(function () {
  803. document.cookie = "skipUpdate=true; expires=session; path=/";
  804. styleElement.remove();
  805. $("#update_panel").remove();
  806. });
  807. }
  808. }
  809. });
  810. })();
  811.  
  812. // 随机数生成
  813. function getRandomNumber(numDigits) {
  814. let min = Math.pow(10, numDigits - 1);
  815. let max = Math.pow(10, numDigits) - 1;
  816. return Math.floor(Math.random() * (max - min + 1)) + min;
  817. }
  818.  
  819. // 设置面板
  820. $(document).ready(function () {
  821. $("#topNavBar").after(
  822. "<button class='html2mdButton ACBetter_setting'>AcWingBetter设置</button>"
  823. );
  824. });
  825.  
  826. const ACwingBetterSettingMenuHTML = `
  827. <div class='checkbox-con' id='ACwingBetter_setting_menu'>
  828. <div class="tool-box">
  829. <button class="btn-close">×</button>
  830. </div>
  831. <h3>AcWingBetter设置</h3>
  832. <div class='ACBetter_setting_list'>
  833. <input type="checkbox" id="bottomBar" name="bottomBar" checked>
  834. <label for="bottomBar">美化底栏</label>
  835. </div>
  836. <div class='ACBetter_setting_list'>
  837. <input type="checkbox" id="bingWallpaper" name="bingWallpaper" checked>
  838. <label for="bingWallpaper">Bing每日壁纸</label>
  839. </div>
  840. <div class='ACBetter_setting_list'>
  841. <input type="checkbox" id="widthAdjustment" name="widthAdjustment" checked>
  842. <label for="widthAdjustment">页面宽屏</label>
  843. </div>
  844. <div class='ACBetter_setting_list'>
  845. <input type="checkbox" id="autoPlay" name="autoPlay" checked>
  846. <label for="autoPlay">不自动播放视频</label>
  847. </div>
  848. <div class='ACBetter_setting_list'>
  849. <input type="checkbox" id="acTimer" name="acTimer" checked>
  850. <label for="acTimer">开启AC计时器</label>
  851. </div>
  852. <br>
  853. <button id='save'>保存</button>
  854. </div>
  855. `;
  856.  
  857. $(document).ready(function () {
  858. $(".ACBetter_setting").click(function () {
  859. const styleElement = GM_addStyle(darkenPageStyle);
  860.  
  861. $(".ACBetter_setting").attr("disabled", true);
  862. $(".ACBetter_setting").css("background-color", "#e6e6e6");
  863. $(".ACBetter_setting").css("color", "#727378");
  864. $(".ACBetter_setting").css("cursor", "not-allowed");
  865. $("body").append(ACwingBetterSettingMenuHTML);
  866.  
  867. addDraggable($('#ACwingBetter_setting_menu'));
  868. $("#bottomBar").prop("checked", GM_getValue("bottomBar"));
  869. $("#bingWallpaper").prop("checked", GM_getValue("bingWallpaper"));
  870. $("#widthAdjustment").prop("checked", GM_getValue("widthAdjustment"));
  871. $("#autoPlay").prop("checked", GM_getValue("autoPlay"));
  872. $("#acTimer").prop("checked", GM_getValue("acTimer"));
  873.  
  874. $("#save").click(function () {
  875. GM_setValue("bottomBar", $("#bottomBar").prop("checked"));
  876. GM_setValue("bingWallpaper", $("#bingWallpaper").prop("checked"));
  877. GM_setValue("widthAdjustment", $("#widthAdjustment").prop("checked"));
  878. GM_setValue("autoPlay", $("#autoPlay").prop("checked"));
  879. GM_setValue("acTimer", $("#acTimer").prop("checked"));
  880. $(styleElement).remove();
  881. location.reload();
  882. });
  883. // 关闭
  884. $("#ACwingBetter_setting_menu .btn-close").click(function () {
  885. $("#ACwingBetter_setting_menu").remove();
  886. $(".ACBetter_setting").attr("disabled", false);
  887. $(".ACBetter_setting").css("background-color", "#56aa56");
  888. $(".ACBetter_setting").css("color", "white");
  889. $(".ACBetter_setting").css("cursor", "pointer");
  890. $(styleElement).remove();
  891. })
  892. });
  893. });
  894.  
  895. // html2md转换/处理规则
  896. let turndownService = new TurndownService();
  897.  
  898. turndownService.keep(['del']);
  899.  
  900. // 丢弃
  901. turndownService.addRule('remove-by-class', {
  902. filter: function (node) {
  903. return node.classList.contains('html2md-panel') ||
  904. node.classList.contains('html2mdButton');
  905. },
  906. replacement: function (content, node) {
  907. return "";
  908. }
  909. });
  910. turndownService.addRule('remove-script', {
  911. filter: function (node, options) {
  912. return node.tagName.toLowerCase() == "script" && node.type.startsWith("math/tex");
  913. },
  914. replacement: function (content, node) {
  915. return "";
  916. }
  917. });
  918.  
  919. // code block
  920. turndownService.addRule('pre', {
  921. filter: 'pre',
  922. replacement: function (content, node) {
  923. let t = $(node).attr("class").split(/\s+/).slice(-1);
  924. if (t == "hljs") t = "";
  925. return "```" + t + "\n" + content.trim() + "\n```";
  926. }
  927. });
  928.  
  929. // inline math
  930. turndownService.addRule('inline-math', {
  931. filter: function (node, options) {
  932. return node.tagName.toLowerCase() == "span" && node.className == "MathJax";
  933. },
  934. replacement: function (content, node) {
  935. return "$" + $(node).next().text() + "$";
  936. }
  937. });
  938.  
  939. // block math
  940. turndownService.addRule('block-math', {
  941. filter: function (node, options) {
  942. return node.tagName.toLowerCase() == "div" && node.className == "MathJax_Display";
  943. },
  944. replacement: function (content, node) {
  945. return "\n$$\n" + $(node).next().text() + "\n$$\n";
  946. }
  947. });
  948.  
  949. // 按钮面板
  950. function addButtonPanel(parent, suffix, type) {
  951. let htmlString = `<div class='html2md-panel'>
  952. <button class='html2mdButton html2md-view${suffix}'>MarkDown视图</button>
  953. <button class='html2mdButton html2md-cb${suffix}'>Copy</button>
  954. </div>`;
  955. if (type === "this_level") {
  956. $(parent).before(htmlString);
  957. } else if (type === "child_level") {
  958. $(parent).prepend(htmlString);
  959. }
  960. }
  961.  
  962. function addButtonWithHTML2MD(parent, suffix, type) {
  963. $(document).on("click", ".html2md-view" + suffix, function () {
  964. var target, removedChildren = $();
  965. if (type === "this_level") {
  966. target = $(".html2md-view" + suffix).parent().next().get(0);
  967. } else if (type === "child_level") {
  968. target = $(".html2md-view" + suffix).parent().parent().get(0);
  969. removedChildren = $(".html2md-view" + suffix).parent().parent().children(':first').detach();
  970. }
  971. if (target.viewmd) {
  972. target.viewmd = false;
  973. $(this).text("MarkDown视图");
  974. $(this).removeClass("mdViewed");
  975. $(target).html(target.original_html);
  976. } else {
  977. target.viewmd = true;
  978. if (!target.original_html) {
  979. target.original_html = $(target).html();
  980. }
  981. if (!target.markdown) {
  982. target.markdown = turndownService.turndown($(target).html());
  983. }
  984. $(this).text("原始内容");
  985. $(this).addClass("mdViewed");
  986. $(target).html(`<span class="mdViewContent" oninput="$(this).parent().get(0).markdown=this.value;" style="width:auto; height:auto;">${target.markdown}</span>`);
  987. }
  988. // 恢复删除的元素
  989. if (removedChildren) $(target).prepend(removedChildren);
  990. });
  991. }
  992.  
  993. function addButtonWithCopy(parent, suffix, type) {
  994. $(document).on("click", ".html2md-cb" + suffix, function () {
  995. let target, removedChildren, text;
  996. if (type === "this_level") {
  997. target = $(".html2md-cb" + suffix).parent().next().eq(0).clone();
  998. } else if (type === "child_level") {
  999. target = $(".html2md-cb" + suffix).parent().parent().eq(0).clone();
  1000. $(target).children(':first').remove();
  1001. }
  1002. if ($(target).find('.mdViewContent').length <= 0) {
  1003. text = turndownService.turndown($(target).html());
  1004. } else {
  1005. text = $(target).find('.mdViewContent').text();
  1006. }
  1007. GM_setClipboard(text);
  1008. $(this).addClass("copied");
  1009. $(this).text("Copied");
  1010. // 更新复制按钮文本
  1011. setTimeout(() => {
  1012. $(this).removeClass("copied");
  1013. $(this).text("Copy");
  1014. }, 2000);
  1015. $(target).remove();
  1016. });
  1017. }
  1018.  
  1019. // 代码块复制按钮
  1020. function codeCopy() {
  1021. $('.hljs code').each(function () {
  1022. let codeBlock = $(this);
  1023. let id = "_" + getRandomNumber(8);
  1024. let beforeButton = $('<button>').text("Copy").addClass(`html2mdButton copy-button${id}`);
  1025. let wrapperDiv = $('<div>').addClass('copy-div');
  1026. $(wrapperDiv).append(beforeButton);
  1027. $(wrapperDiv).css({
  1028. display: "flex",
  1029. justifyContent: "flex-end"
  1030. });
  1031. codeBlock.parent().before(wrapperDiv);
  1032.  
  1033. $(document).on("click", `.copy-button${id}`, debounce(function () {
  1034. GM_setClipboard(codeBlock.text().replace(/\n+$/, ''));
  1035. // 更新复制按钮文本
  1036. var self = this;
  1037. $(self).addClass('copied');
  1038. $(self).text("Copied");
  1039. var self = this;
  1040. setTimeout(function () {
  1041. $(self).removeClass('copied');
  1042. $(self).text("Copy");
  1043. }, 2000);
  1044. }));
  1045. });
  1046. }
  1047.  
  1048. function addConversionButton() {
  1049. // 添加按钮到content部分
  1050. if (!window.location.href.includes("code")) {
  1051. $('div[data-field-name="content"]').each(function () {
  1052. let id = "_question-oi-bd_" + getRandomNumber(8);
  1053. addButtonPanel(this, id, "this_level");
  1054. addButtonWithHTML2MD(this, id, "this_level");
  1055. addButtonWithCopy(this, id, "this_level");
  1056. });
  1057. }
  1058.  
  1059. // 为代码块添加复制按钮
  1060. codeCopy();
  1061. };
  1062.  
  1063. // 播放器添加节点标签功能
  1064. function addPlayerBar(player_bar_video) {
  1065. $('.prism-player').after(`
  1066. <div class='player_bar'>
  1067. <div class='player_bar_list' id='player_bar_list'>
  1068. <ul class='player_bar_ul' id='player_bar_ul'></ul>
  1069. </div>
  1070. <div class='player_bar_go' id='player_bar_go'>Go!</div>
  1071. </div>
  1072. <div class='player_bar_list_add_div'>
  1073. <input class='player_bar_list_add_input' type='text' id='player_bar_list_add_input' placeholder='在这里输入备注内容,点击Add添加一个时间点标记;选中一个标记,点击Go跳转;右键标记,修改或删除'>
  1074. </input>
  1075. <button class='player_bar_list_add_button' id='player_bar_list_add_new_item_btn'>Add</button>
  1076. </div>
  1077. `);
  1078.  
  1079. // 页面路径标识
  1080. const PAGE_IDENTIFIER = window.location.href;
  1081. // 计数器
  1082. let counter = 0;
  1083.  
  1084. // 获取数据
  1085. function getListData() {
  1086. let data = GM_getValue("cookieData");
  1087. if (!data) {
  1088. data = {};
  1089. } else {
  1090. data = JSON.parse(data);
  1091. }
  1092. if (!data[PAGE_IDENTIFIER]) {
  1093. data[PAGE_IDENTIFIER] = [];
  1094. }
  1095. return data[PAGE_IDENTIFIER];
  1096. }
  1097.  
  1098. // 保存数据
  1099. function saveListData(data) {
  1100. let cookieData = GM_getValue("cookieData");
  1101. if (cookieData) {
  1102. cookieData = JSON.parse(cookieData);
  1103. } else {
  1104. cookieData = {};
  1105. }
  1106. cookieData[PAGE_IDENTIFIER] = data;
  1107. GM_setValue("cookieData", JSON.stringify(cookieData));
  1108. }
  1109.  
  1110. // 创建新的li元素
  1111. function createListItemElement(text) {
  1112. const li = $("<li></li>");
  1113. const radio = $("<input type='radio' name='player_bar_ul'></input>").appendTo(li);
  1114. radio.attr("id", counter++);
  1115. const label = $("<label class='player_bar_ul_li_text'></label>").text(text).attr("for", radio.attr("id")).appendTo(li);
  1116.  
  1117. li.on("contextmenu", (event) => {
  1118. event.preventDefault();
  1119. const menu = $("#player_bar_menu");
  1120. menu.css({ display: "block", left: event.pageX, top: event.pageY });
  1121.  
  1122. const deleteItem = $("#player_bar_menu_delete");
  1123. const editItem = $("#player_bar_menu_edit");
  1124.  
  1125. function onDelete() {
  1126. deleteItem.off("click", onDelete);
  1127. const list = $("#player_bar_ul");
  1128. const index = Array.from(list.children()).indexOf(li.get(0));
  1129. const data = getListData();
  1130. data.splice(index, 1);
  1131. saveListData(data);
  1132. li.remove();
  1133. menu.css({ display: "none" });
  1134. }
  1135.  
  1136. function onEdit() {
  1137. editItem.off("click", onEdit);
  1138. const list = $("#player_bar_ul");
  1139. const index = Array.from(list.children()).indexOf(li.get(0));
  1140. const data = getListData();
  1141. label.text(data[index].text);
  1142. const text = prompt("请输入修改后的内容", label.text());
  1143. if (text !== undefined && text !== null) {
  1144. data[index].text = text.trim();
  1145. saveListData(data);
  1146. }
  1147. renderList();
  1148. menu.css({ display: "none" });
  1149. }
  1150.  
  1151. deleteItem.on("click", onDelete);
  1152. editItem.on("click", onEdit);
  1153.  
  1154. $(document).on("click", (event) => {
  1155. if (!menu.get(0).contains(event.target)) {
  1156. menu.css({ display: "none" });
  1157. deleteItem.off("click", onDelete);
  1158. editItem.off("click", onEdit);
  1159. }
  1160. });
  1161. });
  1162.  
  1163. return li;
  1164. }
  1165.  
  1166. // 渲染列表
  1167. function renderList() {
  1168. const listContainer = $("#player_bar_list");
  1169. const list = $("#player_bar_ul");
  1170. list.empty();
  1171. const data = getListData();
  1172. data.forEach((item) => {
  1173. list.append(createListItemElement(item.text));
  1174. });
  1175. }
  1176.  
  1177. // 新增列表项
  1178. function addNewItem() {
  1179. const input = $("#player_bar_list_add_input");
  1180. const text = input.val().trim();
  1181. if (text === "") {
  1182. alert("请输入内容");
  1183. return;
  1184. }
  1185. const data = getListData();
  1186. data.push({ text: text, time: player_bar_video.currentTime });
  1187. saveListData(data);
  1188. const list = $("#player_bar_ul");
  1189. list.append(createListItemElement(text));
  1190. input.val("");
  1191. }
  1192.  
  1193. // 为添加按钮添加事件处理程序
  1194. const player_bar_add_button = $("#player_bar_list_add_new_item_btn");
  1195. player_bar_add_button.on("click", () => {
  1196. addNewItem();
  1197. player_bar_add_button.addClass('added');
  1198. player_bar_add_button.text("Added");
  1199. setTimeout(() => {
  1200. player_bar_add_button.removeClass('added');
  1201. player_bar_add_button.text("Add");
  1202. }, 2000);
  1203. });
  1204.  
  1205. // 渲染列表
  1206. renderList();
  1207.  
  1208. // 跳转按钮
  1209. const click_player_bar_go = $("#player_bar_go");
  1210. click_player_bar_go.on("click", () => {
  1211. const selected = $('input[name="player_bar_ul"]:checked');
  1212. if (selected.length) {
  1213. const data = getListData();
  1214. const index = selected.parent().index();
  1215. player_bar_video.currentTime = data[index].time;
  1216. click_player_bar_go.addClass('gone');
  1217. click_player_bar_go.text("Gone");
  1218. setTimeout(() => {
  1219. click_player_bar_go.removeClass('gone');
  1220. click_player_bar_go.text("Go!");
  1221. }, 2000);
  1222. } else {
  1223. alert("请选择一项");
  1224. }
  1225. });
  1226.  
  1227. // 创建自定义菜单
  1228. const menu = $("<div id='player_bar_menu' style='display: none;'></div>");
  1229. menu.html(`
  1230. <div id='player_bar_menu_edit'>修改</div>
  1231. <div id='player_bar_menu_delete'>删除</div>
  1232. `);
  1233. $("body").append(menu);
  1234. }
  1235.  
  1236. function formatTime(time) {
  1237. var seconds = Math.floor((time / 1000) % 60);
  1238. var minutes = Math.floor((time / (1000 * 60)) % 60);
  1239. var hours = Math.floor((time / (1000 * 60 * 60)) % 24);
  1240. var days = Math.floor(time / (1000 * 60 * 60 * 24));
  1241.  
  1242. var timeString = '';
  1243.  
  1244. if (days > 0) {
  1245. timeString += days + '天';
  1246. }
  1247.  
  1248. if (hours > 0) {
  1249. timeString += hours + '小时';
  1250. }
  1251.  
  1252. if (minutes > 0) {
  1253. timeString += minutes + '分钟';
  1254. }
  1255.  
  1256. if (seconds > 0) {
  1257. timeString += seconds + '秒';
  1258. }
  1259.  
  1260. return timeString;
  1261. }
  1262.  
  1263. // AC计时器
  1264. function acTiming() {
  1265. var startTime = new Date();
  1266. var timer = setInterval(function () {
  1267. var status = $('#submit-code-status-value-id').text().trim();
  1268.  
  1269. if (status === 'Accepted') {
  1270. clearInterval(timer);
  1271.  
  1272. var endTime = new Date();
  1273. var totalTime = endTime - startTime;
  1274.  
  1275. var timeString = formatTime(totalTime);
  1276. $('#submit-code-status-value-id').after('<div class="time-info">耗时:' + timeString + ' 要重新开始计时请刷新页面</div>');
  1277. }
  1278. }, 500);
  1279. }
  1280.  
  1281. $(document).ready(function () {
  1282. if (acTimer && window.location.href.includes("/problem/content/")) acTiming();
  1283. // 让某些链接在新窗口打开
  1284. var regExps = [
  1285. /常用代码模板/,
  1286. /example/,
  1287. /test/
  1288. ];
  1289. var aTags = document.getElementsByTagName('a');
  1290. for (var i = 0; i < aTags.length; i++) {
  1291. for (var j = 0; j < regExps.length; j++) {
  1292. if (regExps[j].test(aTags[i].textContent)) {
  1293. aTags[i].setAttribute('target', '_blank');
  1294. break;
  1295. }
  1296. }
  1297. }
  1298. // 自动恢复进度条
  1299. (function checkAndPlay() {
  1300. if ($('.play-jump').length > 0) {
  1301. $('.play-jump').click();
  1302. if (GM_getValue("autoPlay") === true) {
  1303. let player_bar_video = document.querySelector('video');
  1304. if (!player_bar_video.paused) player_bar_video.pause();
  1305. }
  1306. } else {
  1307. setTimeout(checkAndPlay, 500);
  1308. }
  1309. })();
  1310. // 调整视频高度
  1311. $('.prism-player').height($('.prism-player').width() / 1.7);
  1312.  
  1313. // 添加按钮
  1314. addConversionButton();
  1315. // 移除广告元素
  1316. let ADidADList = ["1024-activity", "test"];
  1317. ADtraverseDom(document.body);
  1318. function ADtraverseDom(node) {
  1319. if (node.nodeType === Node.ELEMENT_NODE && ADidADList.includes(node.id)) {
  1320. node.parentNode.removeChild(node);
  1321. } else {
  1322. for (let i = 0; i < node.childNodes.length; i++) {
  1323. ADtraverseDom(node.childNodes[i]);
  1324. }
  1325. }
  1326. }
  1327. // 修改打卡页代码框默认高度
  1328. var element = document.getElementById("martor-content");
  1329. if (element) {
  1330. var style = window.getComputedStyle(element);
  1331. element.style.height = "55vh";
  1332. }
  1333.  
  1334. var player_bar_video = document.querySelector('video');
  1335. if (player_bar_video != null) addPlayerBar(player_bar_video);
  1336. });

QingJ © 2025

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