Beautify

美化<误>各网页界面

  1. // ==UserScript==
  2. // @name Beautify
  3. // @namespace https://github.com/symant233/PublicTools
  4. // @version 0.0.86
  5. // @description 美化<误>各网页界面
  6. // @author symant233
  7. // @icon https://cdn.jsdelivr.net/gh/symant233/PublicTools/Beautify/Bkela.png
  8. // @require https://cdn.jsdelivr.net/npm/jquery@3.6.4/dist/jquery.min.js
  9. // @match https://*.vuejs.org/*
  10. // @match https://www.runoob.com/*
  11. // @match https://blog.csdn.net/*
  12. // @match https://es6.ruanyifeng.com/*
  13. // @match https://wenku.baidu.com/*
  14. // @match https://didi.github.io/cube-ui/*
  15. // @match https://www.bilibili.com/*
  16. // @match https://space.bilibili.com/*
  17. // @match https://cn.bing.com/search?q=*
  18. // @match https://duckduckgo.com/?q=*
  19. // @match https://baike.baidu.com/*
  20. // @match https://yz.chsi.com.cn/sytj/tj/*
  21. // @match https://www.30secondsofcode.org/*
  22. // @match https://developer.mozilla.org/*
  23. // @match https://juejin.cn/editor/drafts/*
  24. // @match https://xui.ptlogin2.qq.com/cgi-bin/xlogin*
  25. // @match https://steamcommunity.com/*
  26. // @match https://www.pixiv.net/*
  27. // @match https://live.bilibili.com/*
  28. // @match https://frontendwingman.com/*
  29. // @match https://cloud.tencent.com/developer/*
  30. // @match https://www.npmjs.com/*
  31. // @match https://www.zhihu.com/*
  32. // @match https://fanyi.baidu.com/*
  33. // @match https://jiexi.8old.cn/*
  34. // @match https://read.qidian.com/*
  35. // @match https://*.taobao.com/*
  36. // @match https://s.taobao.com/search?q=*
  37. // @match https://*.tmall.com/*
  38. // @match https://caddyserver.com/docs/*
  39. // @match https://leetcode.cn/*
  40. // @match https://mooc1.chaoxing.com/work/*
  41. // @match https://mooc1.chaoxing.com/mooc2/work/*
  42. // @match https://*sci-hub.*/*
  43. // @match https://scholar.google.com/scholar?q=*
  44. // @match https://www.dlsite.com/*
  45. // @match https://preactjs.com/*
  46. // @match https://*.react.dev/*
  47. // @match https://basarat.gitbook.io/*
  48. // @match https://www.photopea.com/*
  49. // @match https://www.phind.com/*
  50. // @match https://hd.nowcoder.com/link.html?target=*
  51. // @match *://www.cesium.xin/*
  52. // @match https://message.bilibili.com/*
  53. // @match *://pan.baidu.com/share/*
  54. // @match https://x.com/*
  55. // @match https://*.xiaoeknow.com/*
  56. // @match https://nextjs.org/*
  57. // @grant GM_getValue
  58. // @grant GM_setValue
  59. // @grant GM_addStyle
  60. // @grant GM_registerMenuCommand
  61. // @grant unsafeWindow
  62. // @license GPL-3.0
  63. // @homepageURL https://gf.qytechs.cn/zh-CN/scripts/390421-beautify
  64. // @supportURL https://github.com/symant233/PublicTools/issues
  65. // ==/UserScript==
  66.  
  67. ;(function() {
  68. 'use strict';
  69. if (!$) { var $ = window.jQuery; }
  70. (function(left, right, color) {
  71. const arg = [
  72. `%c ${left} %c ${right} `,
  73. 'padding:1px;border-radius:3px 0 0 3px;color:#fff;background:#606060;',
  74. `padding:1px;border-radius:0 3px 3px 0;color:#fff;background:${color}`
  75. ];
  76. console.log(...arg);
  77. })('Loaded', 'Beautify', '#e99010');
  78. // console.log(`Domain: ${document.domain}\nHostname: ${location.hostname}`);
  79. switch (document.domain){
  80. case 'vuejs.org':
  81. function zhVue() {
  82. let url = location.href.replace('://vue', '://cn.vue');
  83. location.href = url;
  84. }
  85. const el = document.querySelector('a[href="/translations/"]');
  86. el.addEventListener("click", zhVue);
  87. el.href = '#';
  88. break;
  89. case 'www.runoob.com':
  90. //隐藏头部logo 移动搜索框位置到navbar
  91. $('#index-nav').append(`<form action="//www.runoob.com/" target="_blank" style="display: inline;float: right;">
  92. <input class="placeholder" id="s" name="s" placeholder="搜索……" autocomplete="off"></form>`);
  93. $('.pc-nav').append(`<form action="//www.runoob.com/" target="_blank" style="display: inline;position: absolute;right:0;">
  94. <input class="placeholder" id="s" name="s" placeholder="搜索……" autocomplete="off"></form>`);
  95. GM_addStyle(`#s{outline: 0; height: 2.3rem; margin-top: -1px; margin-right: 2rem; border: 0; border-radius: 4px;}`);
  96. $('.logo-search').remove();
  97. $('.col.nav').css("padding-top", "5px");
  98. $('#sidebar-right-re').parent().remove(); //右侧广告
  99. $('.feedback-btn').remove(); //反馈按钮
  100. $('.qrcode').remove; //右侧悬浮二维码
  101. $('.navigation').css("background", "grey");
  102. if (document.location.href.split('/')[3] == "try") {
  103. $('nav').remove();
  104. $("body").css("padding-top", "60px");
  105. $('footer').remove();
  106. }
  107. break;
  108. case 'csdn.net': {
  109. console.log('Beautify@ try to click');
  110. var r = $('.btn-readmore')[0].click();
  111. console.log('Beautify@ clicked:' + r);
  112. break;
  113. }
  114. case 'es6.ruanyifeng.com':
  115. $('#content').css("width", "63%");
  116. $('#content').css("padding-bottom", "0px");
  117. $('#back_to_top').css("right", "35px");
  118. $('#edit').css("right", "35px");
  119. $('#theme').css("right", "35px");
  120. $('#flip').css("right", "10px");
  121. break;
  122. case 'wenku.baidu.com':
  123. setTimeout(function() {
  124. console.log('show more');
  125. $('.btn-know').click();
  126. $('.moreBtn').click();
  127. }, 1500 );
  128. break;
  129. case 'didi.github.io':
  130. setTimeout(function() {
  131. document.getElementsByClassName('navigator')[0].style.height = "54px";
  132. document.getElementsByClassName('navigator')[0].style.lineHeight = "54px";
  133. document.getElementsByClassName('home-view')[0].style.paddingTop = "38px";
  134. }, 500 );
  135. break;
  136. case 'bilibili.com':
  137. case 'www.bilibili.com': {
  138. const enableWideScreen = GM_getValue('enableWideScreen', true); // 是否启用宽屏模式
  139. GM_registerMenuCommand('切换宽屏设置', () => GM_setValue('enableWideScreen', !enableWideScreen));
  140. // 宽屏模式 来自 https://github.com/bilibili-helper/bilibili-helper-o/blob/637d0741b0d81154c7bc330f8fce19b926f5a71b/src/js/modules/videoWiden/UI/index.js
  141. function setWide() {
  142. const btn = document.querySelector('.bpx-player-ctrl-wide:not(.bpx-state-entered)');
  143. if (btn) {
  144. btn.click();
  145. // 调整滚动位置
  146. setTimeout(() => {
  147. const player = document.querySelector('#bilibili-player');
  148. if (player) {
  149. const playerRect = player.getBoundingClientRect();
  150. const position = window.scrollY + playerRect.top - 75; // Navbar height
  151. window.scrollTo({ top: position });
  152. }
  153. }, 500);
  154. if (unsafeWindow.ob) unsafeWindow.ob.disconnect(); // 触发后停止监听
  155. }
  156. }
  157. new Promise(resolve => {
  158. const player = document.querySelector('#bilibili-player');
  159. if (player && enableWideScreen) {
  160. unsafeWindow.ob = new MutationObserver((mutationList) => {
  161. setWide();
  162. });
  163. unsafeWindow.ob.observe(player, {
  164. attributes: false,
  165. subtree: true,
  166. childList: true,
  167. });
  168. }
  169. resolve();
  170. });
  171. // PiP 画中画模式快捷键`p`
  172. document.addEventListener('keyup', function (e) {
  173. if (e.key === 'p' && e.altKey) {
  174. document.querySelector('video').requestPictureInPicture();
  175. } else if (e.key === 'ArrowRight' & e.altKey === true) {
  176. $('.bilibili-player-video-btn-next').click();
  177. }
  178. }, false);
  179. GM_addStyle(`html.gray {
  180. filter: grayscale(0) !important;
  181. -webkit-filter: grayscale(0) !important;
  182. }`);
  183. // start of the `spm_id_from` filter
  184. let listener = function (e) {
  185. let i = e.target;
  186. for (; i && i.tagName !== "A"; )
  187. i = i.parentNode;
  188. if ((i == null ? void 0 : i.tagName) !== "A")
  189. return;
  190. let o = i.getAttribute("href");
  191. if (!o || !/\/\//.test(o) || !/spm_id_from=/.test(o) || /^blob:/.test(o))
  192. return;
  193. i.setAttribute("href", o.split('?spm_id_from')[0]); // fuck bilibili spm_id
  194. }
  195. document.body.addEventListener("contextmenu", listener, false);
  196. break;
  197. }
  198. case 'cn.bing.com': {
  199. //$("head").append('<style>#b_content{padding-left: 85px;}</style>');
  200. break;
  201. }
  202. case 'duckduckgo.com': {
  203. $("head").append('<style>#links_wrapper{padding-left: 108px;}</style>');
  204. break;
  205. }
  206. case 'baike.baidu.com':
  207. $('.video-list-container').remove(); // 删除播放器容器
  208. GM_addStyle(`.lemmaWgt-searchHeader{height:55px;}
  209. div[class^="videoListWrap"], div[class^="knowledge-toolbar"], .J-knowledge-editor-toolbar {display: none;}
  210. .content-wrapper .content {font: unset;}
  211. .wgt-searchbar-new.wgt-searchbar .logo-container{padding: 6px 0;}
  212. .wgt-searchbar-new.wgt-searchbar .search{padding: 8px 0;}
  213. .wgt-navbar-hover {margin-top: 5px;}
  214. #J-lemma-video-list, #J-bottom-tashuo {display: none;}`);
  215. break;
  216. case 'yz.chsi.com.cn': {
  217. // 去除不符合不能调剂的信息
  218. function filter() {
  219. const tmp = $("#content-qecxList > table > tbody").children();
  220. for ( let i in tmp ) {
  221. if ( tmp[i].lastElementChild.innerText.includes("不符合") || tmp[i].lastElementChild.firstElementChild.title.includes('不符合') ) {
  222. tmp[i].remove();
  223. console.log(tmp[i].textContent + 'removed');
  224. }
  225. }
  226. }
  227. $('<button id="btn-filter" style="width: 50px;">过滤</button>').appendTo('.ewm-fix');
  228. $('#btn-filter').click(filter);
  229. document.addEventListener('keyup', function (e) {
  230. if (e.key === 'Enter' && e.ctrlKey) {
  231. $('.tj-seach-btn').click();
  232. }
  233. }, false);
  234. break;
  235. }
  236. case 'www.30secondsofcode.org':
  237. GM_addStyle('.nav-bar{height:auto;}');
  238. break;
  239. case 'developer.mozilla.org': {
  240. GM_addStyle(`
  241. .mdn-cta-container{display:none;}
  242. .page-header{padding:12px 24px;}
  243. .breadcrumb-locale-container,#license{margin:0px;}
  244. .logo{height:59px;}
  245. .localized-content-note.notecard.neutral{display:none;}
  246. .header-search{margin-bottom: 4px;}
  247. .top-banner.fallback{display:none;}`);
  248. break;
  249. }
  250. case 'juejin.cn':
  251. GM_addStyle('.header.editor-header{height:4rem;}.main .bytemd{height:calc(100vh - 4rem);}');
  252. break;
  253. case 'xui.ptlogin2.qq.com':
  254. // 自动启用账号密码登录(不可用) 去他大爷的扫码登录(不可用)
  255. // GM_addStyle('.web_qr_login{display:block !important;}.qlogin,#bottom_qlogin{display:none !important;}');
  256. break;
  257. case 'steamcommunity.com': {
  258. setInterval(()=>{
  259. try {
  260. document.getElementById('market_sell_dialog_accept_ssa').checked = true;
  261. } catch (err) {}
  262. try {
  263. document.getElementById('market_buyorder_dialog_accept_ssa').checked = true;
  264. } catch (err) {}
  265. }, 2000);
  266. break;
  267. }
  268. case 'www.pixiv.net':
  269. // 需要与脚本配合使用 https://gf.qytechs.cn/zh-CN/scripts/34153-pixiv-plus
  270. GM_addStyle(`
  271. select#select-ahao-favorites {
  272. font-size: 14px;
  273. line-height: 22px;
  274. flex: 1 1 auto;
  275. height: auto;
  276. margin: 0px -9px;
  277. padding: 9px 8px;
  278. border: none;
  279. border-radius: 4px;
  280. color: rgba(0, 0, 0, 0.64);
  281. background-color: rgba(0, 0, 0, 0.04);
  282. transition: background-color 0.2s ease 0s, color 0.2s ease 0s;
  283. }#select-ahao-favorites+div{gap: 0px;}`);
  284. break;
  285. case 'live.bilibili.com': {
  286. const enableSideFollow = GM_getValue('enableSideFollow', false); // 是否切换关注按钮全屏展示
  287. GM_registerMenuCommand('切换关注按钮全屏展示', () => GM_setValue('enableSideFollow', !enableSideFollow));
  288. GM_addStyle(`
  289. .side-bar-popup-cntr{bottom:5% !important;height:84% !important;}
  290. .anchor-list {height: calc(100% - 55px) !important}
  291. .anchor-list > div {height:unset !important; align-content: flex-start;}
  292. .follow-cntr{height:100%;}
  293. .shortcut-item .follow-cntr{height:unset;}
  294. .section-content-cntr{height: calc(100% - 64px) !important;}
  295. .title-length-limit{max-width:unset !important;}`);
  296. if (enableSideFollow) GM_addStyle(`
  297. .player-full-win .side-bar-cntr {display: block !important; height: 60px !important; padding: 4px !important;}
  298. .player-full-win .side-bar-cntr div[data-upgrade-intro="Laboratory"] {display: none;}
  299. .player-full-win .side-bar-cntr div[data-upgrade-intro="Top"] {display: none;}`);
  300. break;
  301. }
  302. case 'frontendwingman.com':
  303. try {
  304. // credit: github.com/invobzvr
  305. Object.defineProperty(document.querySelector('.theme-container').__vue__,'locked',{
  306. get:()=>true,
  307. set:function(val){this._data.locked=true}
  308. });
  309. document.querySelector('.theme-container').__vue__.locked = true;
  310. } catch (e) {
  311. console.warn('Beautify: 自动解锁失效.');
  312. }
  313. break;
  314. case 'cloud.tencent.com':
  315. GM_addStyle('.doc-main-hd {margin-bottom: 24px;padding-bottom: 28px;border-bottom: 1px solid #e5e5e5;}');
  316. break;
  317. case 'www.npmjs.com':
  318. GM_addStyle(`.center-ns {padding-bottom: unset;}
  319. pre.editor.editor-colors {overflow: overlay;}
  320. header > div:nth-child(2) {display: none;}`);
  321. break;
  322. case 'www.zhihu.com':
  323. if (window.location.href === "https://www.zhihu.com/hot") {
  324. document.querySelectorAll('.HotItem').forEach((e) => {
  325. if (!e.outerHTML.includes('HotItem-excerpt')) {e.remove();}
  326. if (!e.outerHTML.includes('HotItem-img')) {e.remove();}
  327. });
  328. }break;
  329. case 'fanyi.baidu.com':
  330. GM_addStyle(`
  331. .download-app,.doc-feedback-group{display:none;}
  332. .header{padding:3px 0 7px 0;}
  333. .doc-whole-container{height:100%;}
  334. .doc-trans-view-wrap{width: unset;height: 88%;margin-top: -38px;}`);
  335. break;
  336. case 'jiexi.8old.cn': {
  337. // https://jx.m3u8.tv/jiexi/?url=
  338. document.addEventListener('keyup', function (e) {
  339. if (e.key === 'f') {
  340. $('.dplayer-full-icon').click();
  341. }else if ([1,2,3,4].includes(parseInt(e.key))) {
  342. $('.dplayer-setting-speed-item').slice(1)[parseInt(e.key)].click();
  343. }
  344. }, false);
  345. break;
  346. }
  347. case 'qidian.com':
  348. GM_addStyle(`body{overflow-x:hidden !important;}
  349. .admire-wrap,.guide-btn-wrap,#j_navGameBtn,#navReward,#j_phoneRead{display:none;}`);
  350. break;
  351. case 'caddyserver.com':
  352. GM_addStyle(`pre > code.cmd {font-size: 1rem; overflow: overlay;}
  353. main > .sidebar:last-child {flex-shrink: 2;}
  354. main > nav.sidebar {font-size: 1.2rem; width: 20%;}
  355. article > :not(h1), dd, article p, article ol, article ul, article pre, article table {margin-bottom: 0.5rem;}
  356. pre {padding-bottom: 0.5rem !important;padding-top: 0.5rem !important;}
  357. pre.chroma {font-size: 1rem;}
  358. #paper1, #paper2 {display: none;}
  359. .paper3 {top: unset;left: unset;}
  360. hr {margin-top: 2.5rem; margin-bottom: 2.5rem !important;}`);
  361. break;
  362. case 'leetcode.cn':
  363. GM_addStyle(`
  364. ul[class*="NavbarList"] > li[class*="NavbarListItem"]:nth-child(2)::after{display:none !important}
  365. ul[class*="NavbarList"] > li[class*="NavbarListItem"]:nth-child(6)::after{display:none !important}
  366. [class*=TimeRemainContainer]{display:none;}
  367. section[class*=MainContainer] > div[class*=Container]:nth-child(1){display: none;}
  368. section[class*=MainContainer]{margin-top: 12px;}
  369. span[class*=BasicTag-StyledTag]{margin-right: 8px;}`);
  370. // 自动开启运行结果差别
  371. function enableDiff () {
  372. const btn = document.querySelector('label[class*="Label-StyledSwitch"]');
  373. if (btn && !btn.getAttribute('beautify-data')) {
  374. btn.setAttribute('beautify-data', true);
  375. btn.click();
  376. }
  377. }
  378. setTimeout(() => {
  379. $('div[class*=second-section-container] > div:last-child button').click();
  380. new Promise(resolve => {
  381. const container = document.querySelector('div[class*="CodeAreaContainer"]');
  382. if (container) {
  383. new MutationObserver((mutationList) => {
  384. mutationList.forEach((mutation) => {
  385. if (mutation.oldValue) enableDiff();
  386. });
  387. }).observe(container, {
  388. attributes: true,
  389. attributeOldValue: true,
  390. subtree: true,
  391. });
  392. }
  393. resolve();
  394. });
  395. }, 2600);
  396. // 控制台获取题解 Markdown 源码
  397. function getMarkdown() {
  398. const node = document.querySelector('div[class*="ContentContainer"]');
  399. const key = Object.keys(node).find(key=>{
  400. return key.startsWith("__reactEventHandlers$");
  401. });
  402. console.log(node[key].children[0].props.children);
  403. }
  404. globalThis.unsafeWindow.getMarkdown = getMarkdown;
  405. break;
  406. case 's.taobao.com':
  407. GM_addStyle(`.grid-total .grid-right {display: none !important;}
  408. .grid-total .grid-left {width: unset !important;}
  409. li#J_FeedbackExperience {display: none;}`);
  410. break;
  411. case 'mooc1.chaoxing.com':
  412. case 'chaoxing.com':
  413. GM_addStyle(`#edui1_iframeholder{height:530px !important;}`);
  414. break;
  415. case 'scholar.google.com':
  416. GM_addStyle(`.donate{display:none !important;}
  417. #arovswmd_panel{display:none;}
  418. #gs_hdr{margin:unset !important;}`);
  419. break;
  420. case 'www.dlsite.com':
  421. GM_addStyle('h1#work_name{user-select: text !important;} body{overflow-y: initial !important;}');
  422. break;
  423. case 'preactjs.com':
  424. GM_addStyle(`
  425. header > div[class^='banner'] , header > a[class^='corner'] { display: none !important; }
  426. #app > main { padding-top: 3.5rem; }
  427. #app > main > div[class^=tutorial] { top: 3.5rem; }
  428. #app > main > div[class^=repl] { top: 3.5rem; }
  429. `);
  430. break;
  431. case 'react.dev':
  432. function zhReact(event) {
  433. event.preventDefault();
  434. let url = location.href.replace('://react', '://zh-hans.react');
  435. location.href = url;
  436. } // 跳转到中文对应页面
  437. document.querySelector('a[href="/community/translations"]').addEventListener("click", zhReact);
  438. break;
  439. case 'www.photopea.com': {
  440. // code from https://chrome.google.com/webstore/detail/remove-ads-from-photopea/gjkjjhgjcalgefcimahpbacihndicccn
  441. const style = document.createElement('style');
  442. style.textContent = '.app > div:not(:first-child) { visibility: hidden; }';
  443. document.head.appendChild(style);
  444. function addCustomEvent() {
  445. const ADS_WIDTH = window.screen.width < 1180 ? 180 : 320;
  446. document.addEventListener('resizecanvas', () => {
  447. // push the ads container outside of the viewport
  448. window.innerWidth = document.documentElement.clientWidth + ADS_WIDTH;
  449. });
  450. }
  451. // inject our custom event listener into the "main world"
  452. document.documentElement.setAttribute('onreset', `(${addCustomEvent})()`);
  453. document.documentElement.dispatchEvent(new CustomEvent('reset'));
  454. document.documentElement.removeAttribute('onreset');
  455. function resize(event = {}) {
  456. if (!event.skip) {
  457. document.dispatchEvent(new CustomEvent('resizecanvas'));
  458.  
  459. // trigger another resize event to update any listeners with the new window.innerWidth
  460. const resizeEvent = new Event('resize');
  461. resizeEvent.skip = true;
  462. window.dispatchEvent(resizeEvent);
  463. }
  464. }
  465. let debounce;
  466. window.addEventListener('resize', event => {
  467. clearTimeout(debounce);
  468. debounce = setTimeout(() => resize(event), 100);
  469. });
  470. resize();
  471. break;
  472. }
  473. case 'www.phind.com':
  474. GM_addStyle(`
  475. body {overflow-y: initial !important;}
  476. `);
  477. let engines = localStorage.getItem('userSearchRules') || null;
  478. if (!engines) {
  479. localStorage.setItem('userSearchRules', '{"developer.mozilla.org":3,"github.com":2,"stackoverflow.com":2,"www.reddit.com":-1,\
  480. "www.quora.com":-2,"www.pinterest.com":-3,"wikipedia.com":1,"numpy.org":1,"vuejs.org":1,"reactjs.org":1,"csdn.net":-2}');
  481. }
  482. break;
  483. case 'hd.nowcoder.com':
  484. const link = location.href.split('?target=')[1];
  485. location.href = link;
  486. break;
  487. default:
  488. break;
  489. }
  490. switch (location.hostname) {
  491. case 'basarat.gitbook.io':
  492. GM_addStyle(`
  493. html {overflow: visible !important;}
  494. div.gitbook-root > div > div > header {height: 3.9rem;}
  495. div.gitbook-root > div header a[href^="https://youtube.com"] {display:none;}
  496. div.gitbook-root > div header a[href^="https://www.udemy.com"] {display:none;}
  497. div.gitbook-root div[data-testid="page.desktopTableOfContents"] {top: 62px !important; height: calc(100vh - 64px) !important;}
  498. `)
  499. break;
  500. case 'www.cesium.xin':
  501. GM_addStyle(`
  502. code[class*="language-"] { white-space: inherit; }
  503. footer { padding: 6px; }
  504. `);
  505. break;
  506. case 'message.bilibili.com':
  507. const callback = function(mutationList, observer) {
  508. if (document.querySelector('div.right .dialog:not(.hide)')) {
  509. const el = document.querySelector('div.right .dialog:not(.hide)')
  510. const mid = el.__vue__.userInfo.mid;
  511. if (mid) {
  512. el.querySelector('.title span').onclick = function() {
  513. window.open(`https://space.bilibili.com/${mid}/video`);
  514. }
  515. }
  516. }
  517. }
  518. const observer = new MutationObserver(callback);
  519. observer.observe(document.body, { childList: true, subtree: true });
  520. GM_addStyle(`
  521. div.right .dialog .title span { padding: 8px; cursor: pointer; }
  522. div.right .dialog .title span:hover { text-decoration: underline; }
  523. `);
  524. break;
  525. case 'pan.baidu.com':
  526. setInterval(() => {
  527. const el = document.querySelector('input#accessCode');
  528. if (el && el.value.length === 4) document.querySelector('#submitBtn').click();
  529. }, 1000)
  530. break;
  531. case 'x.com':
  532. $('head').append(`<link rel="shortcut icon" href="//abs.twimg.com/favicons/twitter.ico">"`);
  533. break;
  534. case 'nextjs.org':
  535. GM_addStyle(`
  536. main > div.relative { padding-top: 1rem; }
  537. main > div.relative > div.sticky { top: 5rem; }
  538. main > div.relative > nav > .sticky { top: 6.5rem; }
  539. `);
  540. break;
  541. }
  542. const aliList = [
  543. /^https:.+tmall.com\//,
  544. /^https:.+taobao.com\//,
  545. ];
  546. aliList.forEach((i) => {
  547. if (i.test(document.location.href)) {
  548. // 移除阴间字体 arial
  549. GM_addStyle('span,input,li,div,a{font-family:none;}');
  550. }
  551. });
  552. if (/.*sci-hub.+/.test(location.hostname)) {
  553. GM_addStyle('#rollback img{width:50px !important;height:50px;margin-left:12px;}');
  554. };
  555. if (location.hostname.endsWith('.xiaoeknow.com')) {
  556. document.addEventListener('keyup', function (e) {
  557. const video = document.querySelector('video');
  558. if (!video) return;
  559. if (e.key === ' ' && video.paused) {
  560. video.play();
  561. } else if (e.key === ' ') {
  562. video.pause();
  563. }
  564. if (e.key === 'f') {
  565. document.querySelector('.fullBtn').click();
  566. }
  567. if (e.key === 'ArrowLeft') {
  568. video.currentTime = video.currentTime - 5;
  569. } else if (e.key === 'ArrowRight') {
  570. video.currentTime = video.currentTime + 5;
  571. }
  572. }); // 快捷键控制视频
  573. }
  574. })();

QingJ © 2025

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