梅花 - 更改网页默认显示字体

将网页的字体替换为你更喜欢的字体。停止使用 Segoe UI、Arial 与微软雅黑。将英文数字使用苹方的字体替换为 SF Pro 与 Inter。

目前為 2023-11-24 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name 梅花 - 更改网页默认显示字体
  3. // @version 1.0.9
  4. // @description 将网页的字体替换为你更喜欢的字体。停止使用 Segoe UI、Arial 与微软雅黑。将英文数字使用苹方的字体替换为 SF Pro 与 Inter。
  5. // @author Fibert Loyee
  6. // @run-at document-start
  7. // @match https://*.zhihu.com/*
  8. // @match https://*github.com/*
  9. // @match https://www.notion.so/*
  10. // @match https://*.bilibili.com/*
  11. // @match https://*.googlesource.com/*
  12. // @match https://*.google.com/*
  13. // @match https://*.google.com.*/*
  14. // @match https://*.python.org/*
  15. // @match https://*.youtube.com/*
  16. // @match https://docs.flutter.dev/*
  17. // @match https://*.chaoxing.com/*
  18. // @match https://dev.to/*
  19. // @match https://medium.com/*
  20. // @match https://www.reddit.com/*
  21. // @match https://juejin.cn/*
  22. // @match https://tauri.app/*
  23. // @match https://www.quora.com/*
  24. // @match https://vuejs.org/*
  25. // @match https://mybatis.org/*
  26. // @match https://grpc.io/*
  27. // @match https://*.chrome.com/*
  28. // @match https://web.dev/*
  29. // @match https://developer.android.com/*
  30. // @match https://huggingface.co/*
  31. // @match https://www.ithome.com/*
  32. // @match https://google.github.io/*
  33. // @match https://doc.rust-lang.org/*
  34. // @match https://www.infoq.cn/*
  35. // @match https://www.pixiv.net/*
  36. // @match https://gin-gonic.com/*
  37. // @match https://v2ex.com/*
  38. // @match https://*.vuejs.org/*
  39. // @match https://*.d2l.ai/*
  40. // @match https://course.rs/*
  41. // @match https://*.typescriptlang.org/*
  42. // @match https://*.authing.cn/*
  43. // @match https://gopl-zh.github.io/*
  44. // @match https://go.dev/*
  45. // @match https://typeorm.io/*
  46. // @match https://gorm.io/*
  47. // @match http://fxshu.top/*
  48. // @match http://fxshw.cc/*
  49. // @match https://*.cloudflare.com/*
  50. // @match https://*.loro.dev/*
  51. // @match https://www.upwork.com/*
  52.  
  53. // @namespace PlumFont
  54. // @license MIT
  55.  
  56. // ==/UserScript==
  57.  
  58.  
  59. let globalMonoFont = `ui-monospace, "SF Mono", "Google Sans Mono", "JetBrains Mono","Roboto Mono", monospace`;
  60. let globalSansFont = `ui-sans-serif, -apple-system, BlinkMacSystemFont, "Inter",'Segoe UI Variable Display','Google Sans Text', 'PingFang SC', "思源黑体", "Noto Sans CJK SC", "Noto Color Emoji", sans-serif`;
  61. let googleSansFont = `'Google Sans Text',"Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont,'Segoe UI Variable Display', "PingFang SC", "Source Han Sans SC", "Noto Sans CJK SC", "Noto Color Emoji", sans-serif`;
  62. let googleSansDisplayFont = `'Google Sans','Google Sans Display',"Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont,'Segoe UI Variable Display', "PingFang SC", "Source Han Sans SC", "Noto Sans CJK SC", "Noto Color Emoji", sans-serif`;
  63. let googleMonoFont = `"Google Sans Mono", "SF Mono", "JetBrains Mono","Roboto Mono",ui-monospace, monospace`;
  64.  
  65. let domain = window.location.host;
  66. console.log(domain);
  67.  
  68. /* Judge which language is used */
  69. let lang = "zh-CN";
  70. function judgeLanguage() {
  71. lang = document.documentElement.lang;
  72. if (lang === undefined) {
  73. lang = window.navigator.language;
  74. }
  75. }
  76. function judgePlatform() {
  77. let platform = "Not known";
  78. if (navigator.appVersion.indexOf("Win") != -1) platform =
  79. "Windows";
  80. if (navigator.appVersion.indexOf("Mac") != -1) platform =
  81. "macOS";
  82. if (navigator.appVersion.indexOf("X11") != -1) platform =
  83. "UNIX";
  84. if (navigator.appVersion.indexOf("Linux") != -1) platform =
  85. "Linux";
  86. return platform;
  87. }
  88.  
  89. judgeLanguage();
  90.  
  91. let styleList = {
  92. "general": `
  93. html,body, input, textarea, select, button,h1,h2,h3,h4,h5,h6,b, strong{
  94. font-family: ${globalSansFont} !important;
  95. }
  96.  
  97. code,pre{
  98. font-family: ${globalMonoFont} !important;
  99. } `,
  100. "github": `
  101. body {
  102. font-family:${googleSansFont} !important;
  103. }
  104.  
  105. .markdown-body, .f0-mktg, .f1-mktg, .f2-mktg, .f3-mktg, .f4-mktg, .f5-mktg, .f6-mktg {
  106. font-family:${googleSansFont} !important;
  107. } `,
  108.  
  109. "notion": `
  110. .notion-app-inner,.notion-selectable, .notion-page-block, div[placeholder*='Heading'] {
  111. font-family: ${globalSansFont} !important;
  112. }
  113.  
  114. span[spellcheck='false'], div[spellcheck='false']{
  115. font-family: ${globalMonoFont} !important;
  116. }`,
  117. "bilibili": `
  118. /* 用户详情页中,"主页、动态、投稿、合计和列表" 后的数字 字体 */
  119. .n .n-num{
  120. font-family:${googleSansFont}
  121. }
  122. .user-info .info-content .info-value[data-v-32ccf620]{ /* 用户详情页中,右下角 "个人资料 UID" 部分的字体 */
  123. font-family:${googleSansFont};
  124. }
  125. div {
  126. font-family: ${googleSansFont} !important;
  127. }
  128.  
  129. /* 首页 - 视频标题 */
  130. .bili-video-card .bili-video-card__info--tit>a {
  131. font-family: ${googleSansFont} !important;
  132. }
  133.  
  134. /* 视频标题 */
  135. .video-info-v1 .video-title{
  136. font-family: ${googleSansFont} !important;
  137. }
  138.  
  139. /* ‘评论’ 标题 */
  140. .reply-header .reply-navigation .nav-bar .nav-title .nav-title-text[data-v-4ccb5ad5]{
  141. font-family: ${googleSansFont} !important;
  142. }
  143.  
  144. /* 评论数字计数和评论内容 */
  145. .bili-comment.browser-pc *{
  146. font-family: ${googleSansFont} !important;
  147. }
  148.  
  149. /* 视频详情页 - 右侧推荐视频标题 */
  150. .video-page-card-small .card-box .info .title{
  151. font-family: ${googleSansFont} !important;
  152. }
  153.  
  154. /* 视频字幕 */
  155. .bpx-player-subtitle-panel-text{
  156. font-family: ${googleSansFont} !important;
  157. }
  158.  
  159. `,
  160. "googleSource": `
  161. .u-monospace {
  162. font-family: ${globalMonoFont} !important;
  163. }
  164.  
  165. .Site {
  166. font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Google Sans Text","Inter", "Segoe UI Variable Display","Apple Color Emoji", sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"!important;
  167. } `,
  168. "google": `
  169. .gsfi, .lst,.gb_2a:not(.gb_Xd),.YrbPuc, .qHx7jd,.wHYlTd, h1, h2, h3, h4, h5, h6, body, .gb_ne, .ynRric, .wwUB2c, .lh87ke:link, .lh87ke:visited, .sbdb, .kpbb, .kpgrb, .ksb, .OouJcb, .rzG2be, .gb_oe,.gb_gd,.gb_ld, .kno-ecr-pt,.ynRric,.mus_tt8,.g,body,html,input,.std{
  170. font-family: ${googleSansFont} !important;
  171. }
  172.  
  173. /* Pop-over - Personal Info After Clicking Avatar */
  174. .ZnExKf, .zpoCob{
  175. font: 400 12px/16px ${googleSansFont} !important;
  176. }
  177.  
  178.  
  179. /* Video Search Result */
  180. .WU6Mge {
  181. font-family: ${googleSansDisplayFont} !important;
  182. }
  183. .Z1UVNe, .N2M7ie, .ZkkK1e.ZkkK1e, .NJU16b{
  184. font-family: ${googleSansFont} !important;
  185. }
  186.  
  187.  
  188. /* Shopping */
  189. .aULzUe, .bONr3b, .sh-sp__pswtr, .iXEZD{
  190. font-family: ${googleSansFont} !important;
  191. }
  192.  
  193.  
  194. /* search result Counts */
  195. #result-stats{
  196. font-family: ${googleSansFont} !important;
  197. }
  198.  
  199.  
  200. /* Search ToolBar */
  201. .GLcBOb{
  202. font-family: ${googleSansFont} !important;
  203. }
  204.  
  205.  
  206. /* Related Search Item */
  207. .e9EfHf{
  208. font-family: ${googleSansFont} !important;
  209. }
  210.  
  211. /* Settings */
  212. .q0yked{
  213. font-family: ${googleSansFont} !important;
  214. }
  215.  
  216. body{
  217. font-family: ${googleSansFont} !important;
  218. }
  219. pre, code, kbd, samp{
  220. font-family: ${globalMonoFont} !important;
  221. }
  222.  
  223. .chr-copy {
  224. font-family: ${googleSansFont} !important;
  225. }
  226.  
  227. `,
  228.  
  229. "youtube": `
  230. html,body,
  231. .ytd-rich-grid-media,
  232. .ytd-video-meta-block,
  233. .ytd-active-account-header-renderer,
  234. .ytd-compact-link-renderer,
  235. tp-yt-paper-item,
  236. .ytd-video-renderer,
  237. .ytd-compact-video-renderer,
  238. .html5-video-player,
  239. .ytd-video-secondary-info-renderer,
  240. .ytp-caption-segment {
  241. font-family:${googleSansFont} !important;
  242. }
  243.  
  244. /* aria-label */
  245. button[aria-label]:focus:after,
  246. button[aria-label]:hover:after{
  247. font-family:${googleSansFont} !important;
  248. }
  249.  
  250. /* Channel - Text Above Banner */
  251. #primary-links.ytd-c4-tabbed-header-renderer yt-formatted-string.ytd-c4-tabbed-header-renderer{
  252. font-family:${googleSansFont} !important;
  253.  
  254. }
  255. /* Channel - Section Title */
  256. tp-yt-paper-tab{
  257. font-family:${googleSansFont} !important;
  258. }
  259.  
  260.  
  261. /* Logo - Country Short Name */
  262. .ytd-topbar-logo-renderer{
  263. font-family:${googleSansFont} !important;
  264. }
  265.  
  266. /* Short Video Title */
  267. #video-title.ytd-rich-grid-slim-media{
  268. font-family:${googleSansFont} !important;
  269. }
  270.  
  271.  
  272. /* Sidebar - Title */
  273. .title.ytd-guide-entry-renderer{
  274. font-family:${googleSansFont} !important;
  275. }
  276.  
  277.  
  278. /* Copyright */
  279. #copyright{
  280. font-family:${googleSansFont} !important;
  281. }
  282.  
  283.  
  284. /* Explore - Title */
  285. .ytd-destination-button-renderer{
  286. font-family:${googleSansFont} !important;
  287. }
  288.  
  289. /* Explore - New Creator - 创作者新秀 */
  290. .ytd-shelf-renderer{
  291. font-family:${googleSansFont} !important;
  292. }
  293.  
  294. /* Explorer - New Creator - Video Title */
  295. .ytd-grid-video-renderer{
  296. font-family:${googleSansFont} !important;
  297. }
  298.  
  299.  
  300. /* Shorts - Title */
  301. .title.ytd-reel-player-header-renderer{
  302. font-family:${googleSansFont} !important;
  303. }
  304. /* Shorts - Author/Channel Name */
  305. #channel-name.ytd-reel-player-header-renderer{
  306. font-family:${googleSansFont} !important;
  307. }
  308.  
  309. /* Shorts - Subscribe Button */
  310. tp-yt-paper-button{
  311. font-family:${googleSansFont} !important;
  312. }
  313.  
  314. /* Shorts - Comment Title & Comments Number */
  315. .ytd-engagement-panel-title-header-renderer{
  316. font-family:${googleSansFont} !important;
  317. }
  318.  
  319. /* Shorts - Comment Input Box */
  320. .ytd-comment-simplebox-renderer{
  321. font-family:${googleSansFont} !important;
  322. }
  323.  
  324. /* Shorts - Comment Author Name */
  325. tp-yt-paper-dialog{
  326. font-family:${googleSansFont} !important;
  327. }
  328.  
  329.  
  330. /* Comment - Pinned Comment Badge */
  331. ytd-pinned-comment-badge-renderer{
  332. font-family:${googleSansFont} !important;
  333. }
  334.  
  335. /* Comment - Comment Time */
  336. .published-time-text.ytd-comment-renderer{
  337. font-family:${googleSansFont} !important;
  338. }
  339.  
  340. /* Comment Content */
  341. #content-text.ytd-comment-renderer{
  342. font-family:${googleSansFont} !important;
  343. }
  344.  
  345. /* Comment - Upvote Number */
  346. #vote-count-middle.ytd-comment-action-buttons-renderer{
  347. font-family: ${googleSansFont} !important;
  348. }
  349.  
  350. /* Comment - Reply Button */
  351. ytd-comment-action-buttons-renderer:not([use-comment-icon]) #reply-button.ytd-comment-action-buttons-renderer ytd-button-renderer.ytd-comment-action-buttons-renderer:not([is-icon-button]).ytd-comment-action-buttons-renderer, ytd-comment-action-buttons-renderer:not([use-comment-icon]) #reply-button-end.ytd-comment-action-buttons-renderer ytd-button-renderer.ytd-comment-action-buttons-renderer:not([is-icon-button]).ytd-comment-action-buttons-renderer{
  352. font-family: ${googleSansFont} !important;
  353. }
  354.  
  355. /* Comment - Reply Number */
  356. #expander.ytd-comment-replies-renderer{
  357. font-family: ${googleSansFont} !important;
  358. }
  359.  
  360.  
  361. /* Channel - Featured Channel */
  362. .ytd-grid-channel-renderer{
  363. font-family:${googleSansFont} !important;
  364. }
  365.  
  366. /* Channel - About */
  367. .ytd-channel-about-metadata-renderer{
  368. font-family:${googleSansFont} !important;
  369. }
  370.  
  371.  
  372. /* Notification - Title */
  373. .message.ytd-notification-renderer{
  374. font-family: ${googleSansFont} !important;
  375. }
  376.  
  377. /* Notification - Time */
  378. .metadata.ytd-notification-renderer{
  379. font-family: ${googleSansFont} !important;
  380. }
  381.  
  382.  
  383. /* Settings - Page Introduction - H1: Name & Title & Text */
  384. .ytd-page-introduction-renderer{
  385. font-family: ${googleSansFont} !important;
  386. }
  387.  
  388. /* Settings - H2: Settings Section Title & Description */
  389. .ytd-item-section-header-renderer {
  390. font-family: ${googleSansFont} !important;
  391. }
  392.  
  393. /* Setting - H3: Options Title & Text */
  394. .ytd-settings-options-renderer{
  395. font-family: ${googleSansFont} !important;
  396. }
  397.  
  398. /* Settings - H4: Settings Item Title & Description */
  399. .ytd-settings-switch-renderer {
  400. font-family: ${googleSansFont} !important;
  401. }
  402.  
  403. /* Settings - Channel */
  404. .ytd-channel-options-renderer{
  405. font-family: ${googleSansFont} !important;
  406. }
  407.  
  408. /* Settings - Connected App */
  409. .ytd-connected-app-renderer{
  410. font-family: ${googleSansFont} !important;
  411. }
  412.  
  413. /* Settings - Advanced Settings - YouTube ID */
  414. .yt-copy-link-renderer{
  415. font-family: ${googleMonoFont} !important;
  416. }
  417.  
  418.  
  419. /* Others
  420.  
  421. Dropdown Menu,
  422. Radio Option,
  423. Right Click Menu
  424. Input Box,
  425. Alert with Button,
  426. Message,
  427. Icon Button,
  428.  
  429.  
  430. */
  431. .ytd-dropdown-item-renderer,
  432. .ytd-settings-radio-option-renderer,
  433. .ytd-menu-service-item-renderer,
  434. input,
  435. .ytd-alert-with-button-renderer,
  436. .ytd-message-renderer,
  437. .yt-icon-button,
  438. {
  439. font-family: ${googleSansFont} !important;
  440. }
  441.  
  442.  
  443. /* Visit History - History Filter Title */
  444. .ytd-sub-feed-selector-renderer{
  445. font-family: ${googleSansFont} !important;
  446. }
  447.  
  448. /* Visit History - Community History Title & Timestamp */
  449. .ytd-comment-history-entry-renderer{
  450. font-family: ${googleSansFont} !important;
  451. }
  452.  
  453.  
  454. /* Your Films - Page Introduction */
  455. #subscriber-count.ytd-c4-tabbed-header-renderer{
  456. font-family: ${googleSansFont} !important;
  457. }
  458.  
  459. /* Your Films - Video Title & Category & Timestamp */
  460. .ytd-grid-movie-renderer{
  461. font-family: ${googleSansFont} !important;
  462. }
  463.  
  464.  
  465. /* Media Library - Page Title & Playlist Owner */
  466. .ytd-playlist-sidebar-primary-info-renderer,
  467. .ytd-video-owner-renderer {
  468. font-family: ${googleSansFont} !important;
  469. }
  470.  
  471.  
  472. /* Playlist - Video Title & Timestamp */
  473. .ytd-playlist-video-renderer,
  474. .ytd-grid-playlist-renderer {
  475. font-family: ${googleSansFont} !important;
  476. }
  477.  
  478. /* Voice Search */
  479. .ytd-voice-search-dialog-renderer{
  480. font-family: ${googleSansFont} !important;
  481. }
  482.  
  483. `,
  484.  
  485. "dev.to": `
  486. html,body,dev{
  487.  
  488. font-family: ${globalSansFont} !important;
  489.  
  490. }
  491. .text-styles{
  492. font-family: ${globalSansFont} !important;
  493. } `,
  494. "medium": `
  495. .a,.bv,.bc {
  496. font-family:${globalSansFont} !important;
  497. } `,
  498. "reddit": `
  499. body,
  500. ._292iotee39Lmt0MkQZ2hPV,
  501. ._2ucWAzao-GLL6qRJ4USwVJ,
  502. ._1zPvgKHteTOub9dKkvrOl4,
  503. ._3Eyh3vRo5o4IfzVZXhaWAG,
  504. ._2baJGEALPiEMZpWB2iWQs7 .public-DraftEditor-content,
  505. ._1ra1vBLrjtHjhYDZ_gOy8F,
  506. ._2tU8R9NTqhvBrhoNAXWWcP,
  507. ._10BQ7pjWbeYP63SAPNS8Ts,
  508. ._6_44iTtZoeY6_XChKt5b0,
  509. ._3zbhtNO0bdck0oYbYRhjMC,
  510. ._10BQ7pjWbeYP63SAPNS8Ts,
  511. ._1sDtEhccxFpHDn2RUhxmSq,
  512. ._34dh2eyzMvJfjCBLeoWiDD {
  513. font-family: ${globalSansFont} !important;
  514. } `,
  515. "juejin": `
  516. body, html, .markdown-body{
  517. font-family: ${globalSansFont} !important;
  518. }
  519.  
  520. .markdown-body pre, .markdown-body code, code, pre {
  521. font-family: ${globalMonoFont} !important;
  522. } `,
  523.  
  524. "vuejs.org": `
  525. .line-number, code, kbd{
  526. font-family: ${globalMonoFont} !important;
  527. } `,
  528.  
  529. "grpc.io": `
  530. .td-search-input{
  531. font-family: "Font Awesome 5 Free", ${globalSansFont} !important;
  532. } `,
  533.  
  534. "developer.chrome.com": `
  535. .banner, .material-button, .skip-link, .toc__wrapper a, .type, .type ol:not([class])>li::before, .type--caption, .type--label, .type--small, :root{
  536. font-family: ${googleSansFont} !important;
  537. }
  538. .type code, .type pre{
  539. font-family: ${googleMonoFont} !important;
  540. }
  541.  
  542. `,
  543.  
  544.  
  545. "web.dev": `
  546. body{
  547. font-family: ${googleSansFont} !important;
  548. }
  549. code {
  550. font-family: ${googleMonoFont} !important;
  551. }
  552. `,
  553. "developer.android.com": `
  554. :root{
  555. --devsite-primary-font-family: ${googleSansFont} !important;
  556. --devsite-code-font-family: ${googleMonoFont} !important;
  557. }
  558. `,
  559. "infoq.cn": `
  560. html, body, button, input, select, textarea{
  561. font-family: ${googleSansFont} !important;
  562. }
  563.  
  564. .article-preview[data-type=doc]{
  565. font-family: ${googleSansFont} !important;
  566. }
  567.  
  568. code, pre, pre tt, .article-preview [data-type=codeline], [data-type=doc] code, .article-preview code {
  569. font-family: ${globalMonoFont} !important;
  570. }
  571. `,
  572. "mdBook": `
  573.  
  574. html, body, input, textarea, select, h1, h2, h3, h4, h5, h6, b, strong{
  575. font-family: ${googleSansFont} !important;
  576. }
  577.  
  578. code, pre, .ace_editor{
  579. font-family: ${globalMonoFont} !important;
  580. }
  581.  
  582. .menu-title{
  583. font-weight: 400;
  584. }
  585. `,
  586. "gin-gonic.com": `
  587. html, body {
  588. font-family: ${globalSansFont} !important;
  589. }
  590.  
  591. pre, code, kbd, samp{
  592. font-family: ${globalMonoFont} !important;
  593. }
  594. `,
  595. "vuejs.org": `
  596. pre, code, kbd, samp{
  597. font-family: ${globalMonoFont} !important;
  598. }
  599. `,
  600. "typescriptlang.org": `
  601. html{
  602. --body-font: ${globalSansFont} !important;
  603. }
  604. `,
  605. "authing.cn": `
  606. body{
  607. font-family: ${globalSansFont} !important;
  608. }
  609.  
  610. .styles_equityContainer__12r1u .styles_contextContainer__24onK .styles_contextText__3_t3U{
  611. font-family: ${globalSansFont} !important;
  612. }
  613. `,
  614. "go.dev": `
  615. body,html{
  616. font-family: ${globalSansFont} !important;
  617. }
  618. pre,code{
  619. font-family: ${globalMonoFont} !important;
  620. }
  621. `,
  622. "typeorm.io": `
  623. h1, h2, h3{
  624. font-family: ${globalSansFont} !important;
  625. }
  626.  
  627. code[class*="language-"], pre[class*="language-"]{
  628. font-family: ${globalMonoFont} !important;
  629. }
  630. `,
  631. "gorm.io": `
  632. .article-title{
  633. font-family: ${globalSansFont} !important;
  634. }
  635. body{
  636. font-family: ${globalSansFont} !important;
  637. }
  638.  
  639. pre,code{
  640. font-family: ${globalMonoFont} !important;
  641. }
  642.  
  643. .sidebar-title, .sidebar-link, .toc-link{
  644. font-family: ${globalSansFont} !important;
  645. }
  646.  
  647. .main-nav-link{
  648. font-family: ${googleSansFont} !important;
  649. }
  650. `,
  651. "cloudflare.com": `
  652. body, button{
  653. font-family: ${globalSansFont} !important;
  654. }
  655.  
  656. code, pre {
  657. font-family: ${globalMonoFont} !important;
  658. }
  659.  
  660.  
  661. .c_ei, .c_eo {
  662. font-family: ${globalSansFont} !important;
  663. }
  664.  
  665. .c_oi {
  666. font-family: ${globalMonoFont} !important;
  667. }
  668.  
  669. /* workers editor window - bottom bar */
  670. .windows {
  671. font-family: ${globalSansFont} !important;
  672. }
  673.  
  674.  
  675. /* Workders Editor: 下面修改的字体并未生效 */
  676.  
  677. /* workders editor window - left bar (code line number) */
  678. .margin-view-overlays{
  679. font-family: ${globalMonoFont} !important;
  680. }
  681.  
  682. /* workers editor window - code */
  683. .view-lines.monaco-mouse-cursor-text {
  684. font-family: ${globalMonoFont} !important;
  685. }
  686. .editor-instance{
  687. --testMessageDecorationFontFamily: ${globalMonoFont} !important;
  688. --code-editorInlayHintsFontFamily: ${globalMonoFont} !important;
  689.  
  690. }
  691. `,
  692. "upwork.com": `
  693. :root {
  694. --font-family-base: ${globalSansFont} !important;
  695. --font-family-monospace: ${globalMonoFont} !important;
  696. }
  697. `,
  698. };
  699.  
  700.  
  701. let rulesList = [{
  702. "domains": "github.com",
  703. "style": ["github"],
  704. },
  705. {
  706. "domains": "zhihu.com",
  707. "style": ["general"],
  708. },
  709. {
  710. "domains": "notion.so",
  711. "style": ["notion"],
  712. },
  713. {
  714. "domains": "bilibili.com",
  715. "style": ["bilibili"],
  716. },
  717. {
  718. "domains": "googlesource.com",
  719. "style": ["googleSource"],
  720. },
  721. {
  722. "domains": ["google.com", "google.com.hk", "google.com.jp", "google.com.tw", "google.com.sg", "google.com.kr", "google.com.au"],
  723. "style": ["google"],
  724. },
  725. {
  726. "domains": "youtube.com",
  727. "style": ["youtube"],
  728. },
  729. {
  730. "domains": "flutter.dev",
  731. "style": ["general"],
  732. },
  733. {
  734. "domains": "chaoxing.com",
  735. "style": ["general"],
  736. },
  737. {
  738. "domains": "dev.to",
  739. "style": ["dev.to"],
  740. },
  741. {
  742. "domains": "medium.com",
  743. "style": ["medium"],
  744. },
  745. {
  746. "domains": "reddit.com",
  747. "style": ["reddit"],
  748. },
  749. {
  750. "domains": "juejin.cn",
  751. "style": ["juejin"],
  752. },
  753. {
  754. "domains": "tauri.app",
  755. "style": ["general"],
  756. },
  757. {
  758. "domains": "quora.com",
  759. "style": ["general"],
  760. },
  761. {
  762. "domains": "vuejs.org",
  763. "style": ["vuejs.org"],
  764. },
  765. {
  766. "domains": "mybatis.org",
  767. "style": ["general"],
  768. },
  769. {
  770. "domains": "grpc.io",
  771. "style": ["general", "grpc.io"],
  772. },
  773. {
  774. "domains": "python.org",
  775. "style": ["general"],
  776. },
  777. {
  778. "domains": "developer.chrome.com",
  779. "style": ["developer.chrome.com"],
  780. },
  781. {
  782. "domains": "web.dev",
  783. "style": ["web.dev"],
  784. },
  785. {
  786. "domains": "developer.android.com",
  787. "style": ["developer.android.com"],
  788. },
  789. {
  790. "domains": "huggingface.co",
  791. "style": ["general"],
  792. },
  793. {
  794. "domains": "ithome.com",
  795. "style": ["general"],
  796. },
  797. {
  798. "domains": "google.github.io",
  799. "style": ["mdBook"],
  800. },
  801. {
  802. "domains": "doc.rust-lang.org",
  803. "style": ["general"],
  804. },
  805. {
  806. "domains": "www.infoq.cn",
  807. "style": ["infoq.cn"],
  808. },
  809. {
  810. "domains": "www.pixiv.net",
  811. "style": ["general"],
  812. "lang": ["zh-CN"],
  813. },
  814. {
  815. "domains": "gin-gonic.com",
  816. "style": ["gin-gonic.com"],
  817. },
  818. {
  819. "domains": "v2ex.com",
  820. "style": ["general"],
  821. },
  822. {
  823. "domains": "vuejs.org",
  824. "style": ["vuejs.org"],
  825. },
  826. {
  827. "domains": ["d2l.ai"],
  828. "style": ["general"],
  829. },
  830. {
  831. "domains": ["course.rs"],
  832. "style": ["mdBook"],
  833. },
  834. {
  835. "domains": ["www.typescriptlang.org"],
  836. "style": ["typescriptlang.org"]
  837. }, {
  838. "domains": ["authing.cn"],
  839. "style": ["authing.cn"]
  840. }, {
  841. "domains": ["gopl-zh.github.io"],
  842. "style": ["mdBook"]
  843. }, {
  844. "domains": ["go.dev"],
  845. "style": ["go.dev"]
  846. }, {
  847. "domains": ["typeorm.io"],
  848. "style": ["typeorm.io"]
  849. }, {
  850. "domains": ["gorm.io"],
  851. "style": ["gorm.io"]
  852. }, {
  853. "domains": ["fxshu.top", "fuxsw.cc"],
  854. "style": ["general"]
  855. }, {
  856. "domains": ["cloudflare.com"],
  857. "style": ["cloudflare.com"]
  858. }, {
  859. "domains": ["loro.dev"],
  860. "style": ["general"]
  861. }, {
  862. "domains": ["upwork.com"],
  863. "style": ["upwork.com"]
  864. }
  865. ];
  866.  
  867.  
  868.  
  869. // using filter to find the matched rule
  870. let filteredList = rulesList.filter(({ domains, lang }) => {
  871.  
  872. let isMatch = true;
  873.  
  874. if (domains instanceof RegExp) {
  875. isMatch = domains.test(domain);
  876. } else if (typeof domains === "string") {
  877. isMatch = domain.endsWith(domains);
  878. } else if (domains instanceof Array) {
  879. isMatch = domains.some((item) => domain.endsWith(item));
  880. } else {
  881. isMatch = false;
  882. }
  883.  
  884. // if the rule has a "lang" property
  885. // and the "lang" property doesn't contain current language => skip
  886. if (isMatch === true && lang !== undefined && !lang.includes(lang)) {
  887. console.log("language not match, skip this rule");
  888. isMatch = false;
  889. }
  890. return isMatch;
  891. });
  892.  
  893. const style = filteredList
  894. .flatMap(({ style: keyIndices }) => keyIndices.map(key => styleList[key]))
  895. .join('\n');
  896.  
  897. let css = document.createElement("style");
  898. let text = document.createTextNode(style);
  899. css.appendChild(text);
  900. let head = document.getElementsByTagName("head")[0];
  901. head.appendChild(css);

QingJ © 2025

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