├── README.md ├── mactype-en.user.js └── mactype.user.js /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 |

6 | 7 | 8 |

Mactype助手

9 | 10 |

11 | tampermonkey 12 | 13 | LICENSE 14 | 15 | chrome 16 | edge 17 | platform 18 | 19 | 20 | 21 |

22 | 23 |
24 | 👉 增强浏览器网页文字清晰度 👈
25 | 适用于 Linux,macOS,Windows 平台 26 |
27 |
28 | 29 | Windows 下的浏览器浏览网页时文字往往发虚,颜色很淡,看不清楚。**有了它可以让浏览器中显示的文字更加清晰**,支持 Chrome ,360 ,QQ ,Firfox ,Edge 等浏览器。 30 | 31 | 现已升级到 2.0 版本,功能更加强大,支持自定义清晰度设置。 32 | 33 | ## 🎨 效果演示 34 | 35 | ![](https://pic.rmb.bdstatic.com/bjh/cf4d231111806e99a2134c855a744b885926.gif) 36 | 37 | ## 💽 安装地址 38 | 39 | - **[安装地址(推荐)](https://www.youxiaohou.com/tool/install-mactype.html)** 40 | 41 | - **[English Version](https://github.com/syhyz1990/mactype/raw/master/mactype-en.user.js)** 42 | 43 | ## 📝 更新日志 44 | 45 | **v2.2.0** 加载逻辑重构,修复部分网站不生效或闪动后生效的问题。 46 | 47 | **v2.1.7** 清晰度调节的最小间隔由 0.1 改为 0.05。 48 | 49 | **v2.1.5** 修复了弹出多个窗口的问题。 50 | 51 | **v2.1.4** 修复了在 Edge 浏览器下无效的问题。 52 | 53 | **v2.1.3** 修正了在部分网站上样式无法加载的问题。 54 | 55 | **v2.1.0** 修正了在弹窗框在百度搜索上样式错乱的问题,优化加载速度。 56 | 57 | **v2.0.6** 修复了一系列 BUG,优化了对部分单页面网页的显示效果。 58 | 59 | **v2.0.4** 支持自定义白名单功能,支持网站启用和禁用功能。 60 | 61 | **v2.0.3** 修复选择文字时文字发虚的问题。 62 | 63 | **v2.0.2** 修正百度等网站搜索后失效的问题。弹框样式失效后刷新页面即可。 64 | 65 | ## 🎨 设置清晰度 66 | 67 | 首次安装后会自动弹出设置清晰度选项,滑动滑块可自行调整,数值越大,文字显示越清晰,默认为0.8,调节到0时恢复原始效果。 68 | 69 | 可以在助手设置中重新找到本弹框。 70 | 71 | ![](https://pic.rmb.bdstatic.com/bjh/8d2ef37efee3519f28b4ff6a466c27ec1105.png) 72 | 73 | ## 💻 增强显示 74 | 75 | 强烈建议配合 XHei 字体使用,效果极佳。 [字体下载地址](https://www.lanzoui.com/font) 76 | 77 | 字体安装完成后在 Chrome 设置中搜索 “字体”,找到 `自定义字体`,将选项里的四个字体均设置为 `XHei Intel` 78 | 79 | ![](https://pic.rmb.bdstatic.com/bjh/7aefd17636f94c350eec00251a2737697501.png) 80 | 81 | ## 👻 配合 Mactype 82 | 83 | 若想实现在 Windows 其他软件也实现相同的渲染效果,例如微信,QQ,文件管理器等软件等,可以参考 84 | 85 | [让 Windows 实现 macOS 渲染效果](https://mp.weixin.qq.com/s/uCBoHZkJiFbd42RyRvQoUA) 86 | 87 | ## 🐞 Bug 反馈 88 | 89 | 如果您在使用过程中遇到问题,请 [点击这里](https://wj.qq.com/s2/8150559/6c08/) 或 [发送邮件](mailto:mail@youxiaohou.com) 进行反馈。 90 | -------------------------------------------------------------------------------- /mactype-en.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Mactype Assistant 3 | // @namespace https://github.com/syhyz1990/mactype 4 | // @version 2.2.5 5 | // @description Workaround a blurry problem when browsing web pages in Chrome/360/QQ/Firefox/Edge when using MacType/ 6 | // @author YouXiaoHou 7 | // @license MIT 8 | // @homepage https://www.youxiaohou.com/tool/install-mactype.html 9 | // @supportURL https://github.com/syhyz1990/mactype 10 | // @require https://registry.npmmirror.com/sweetalert2/10.16.6/files/dist/sweetalert2.min.js 11 | // @resource swalStyle https://registry.npmmirror.com/sweetalert2/10.16.6/files/dist/sweetalert2.min.css 12 | // @updateURL https://www.youxiaohou.com/mactype.user.js 13 | // @downloadURL https://www.youxiaohou.com/mactype.user.js 14 | // @match *://*/* 15 | // @run-at document-start 16 | // @grant GM_getValue 17 | // @grant GM_setValue 18 | // @grant GM_registerMenuCommand 19 | // @grant GM_getResourceText 20 | // @icon data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48cGF0aCBkPSJNMTIwIDcuMWM0LjQgMCA4IDQuMSA4IDl2NzMuMmMwIDUtMy42IDktOCA5SDgwLjhsNy4yIDE2LjNjLjggMi4zIDAgNS0xLjYgNS45LS40LjUtMS4yLjUtMS42LjVINDMuNmMtMi40IDAtNC0xLjgtNC00LjUgMC0uOSAwLTEuNC40LTEuOGw3LjItMTYuM0g4Yy00LjQgMC04LTQuMS04LTlWMTYuMWMwLTUgMy42LTkgOC05aDExMnoiIGZpbGw9IiM0NDQiLz48cGF0aCBkPSJNMTAyLjMgMzQuN2ExNC4yOCAxNC4yOCAwIDAgMC02LjItNi4yYy0yLjctMS40LTUuMy0yLjItMTIuNi0yLjJINjkuMXY1NC42aDE0LjRjNy4zIDAgOS45LS44IDEyLjYtMi4yYTE1LjQyIDE1LjQyIDAgMCAwIDYuMi02LjJjMS40LTIuNyAyLjItNS4zIDIuMi0xMi42VjQ3LjNjMC03LjMtLjgtOS45LTIuMi0xMi42em0tOC43IDI4LjJjMCAyLjQtLjIgMy4zLS43IDQuMnMtMS4yIDEuNi0yLjEgMi4xYy0uOS40LTEuOC43LTQuMi43SDgwVjM3LjJoNi42YzIuNCAwIDMuMy4yIDQuMi43czEuNiAxLjIgMi4xIDIuMWMuNC45LjcgMS44LjcgNC4ydjE4Ljd6TTUwIDQ4LjFIMzYuM1YyNi4zSDI1LjR2NTQuNWgxMC45VjU5SDUwdjIxLjhoMTAuOVYyNi4zSDUwdjIxLjh6IiBmaWxsPSIjZmZmIi8+PC9zdmc+ 21 | // ==/UserScript== 22 | 23 | (function () { 24 | 'use strict'; 25 | 26 | let util = { 27 | getValue(name) { 28 | return GM_getValue(name); 29 | }, 30 | 31 | setValue(name, value) { 32 | GM_setValue(name, value); 33 | }, 34 | 35 | addStyle(id, tag, css) { 36 | tag = tag || 'style'; 37 | let doc = document, styleDom = doc.getElementById(id); 38 | if (styleDom) return; 39 | let style = doc.createElement(tag); 40 | style.rel = 'stylesheet'; 41 | style.id = id; 42 | tag === 'style' ? style.innerHTML = css : style.href = css; 43 | document.head.appendChild(style); 44 | }, 45 | 46 | removeElementById(eleId) { 47 | let ele = document.getElementById(eleId); 48 | ele && ele.parentNode.removeChild(ele); 49 | } 50 | }; 51 | 52 | let main = { 53 | /** 54 | * 配置默认值 55 | */ 56 | initValue() { 57 | let value = [{ 58 | name: 'current_val', 59 | value: 0 60 | }, { 61 | name: 'has_init', 62 | value: false 63 | }, { 64 | name: 'white_list', 65 | value: [] 66 | }]; 67 | 68 | value.forEach((v) => { 69 | util.getValue(v.name) === undefined && util.setValue(v.name, v.value); 70 | }); 71 | }, 72 | 73 | showSetting() { 74 | Swal.fire({ 75 | title: 'Configuration', 76 | icon: 'info', 77 | input: 'range', 78 | showCancelButton: true, 79 | confirmButtonText: 'Save', 80 | cancelButtonText: 'Cancel', 81 | showCloseButton: true, 82 | inputLabel: 'Slide to modify the display', 83 | customClass: { 84 | popup: 'mactype-popup', 85 | }, 86 | footer: '
Click to view the usage instruction. For recommended font, use San Francisco. Powered by 油小猴
', 87 | inputAttributes: { 88 | min: 0, 89 | max: 1, 90 | step: 0.05 91 | }, 92 | inputValue: util.getValue('current_val') 93 | }).then((res) => { 94 | util.setValue('has_init', true); 95 | if (res.isConfirmed) { 96 | util.setValue('current_val', res.value); 97 | this.changeStyle(); 98 | } 99 | if (res.isDismissed && res.dismiss === "cancel") { 100 | util.setValue('current_val', 0); 101 | this.changeStyle(); 102 | } 103 | }); 104 | 105 | document.getElementById('swal2-input').addEventListener('change', (e) => { 106 | util.setValue('current_val', e.target.value); 107 | this.changeStyle(); 108 | }); 109 | }, 110 | 111 | registerMenuCommand() { 112 | let whiteList = util.getValue('white_list'); 113 | let host = location.host; 114 | if (whiteList.includes(host)) { 115 | GM_registerMenuCommand('💡 Current Website:❌', () => { 116 | let index = whiteList.indexOf(host); 117 | whiteList.splice(index, 1); 118 | util.setValue('white_list', whiteList); 119 | history.go(0); 120 | }); 121 | } else { 122 | GM_registerMenuCommand('💡 Current Website:✔️', () => { 123 | whiteList.push(host); 124 | util.setValue('white_list', whiteList); 125 | history.go(0); 126 | }); 127 | } 128 | GM_registerMenuCommand('⚙️ Settings', () => { 129 | this.showSetting(); 130 | }); 131 | }, 132 | 133 | generateStyle() { 134 | let val = util.getValue('current_val'); 135 | return ` 136 | .mactype-popup { font-size: 14px!important } 137 | .swal2-range input { -webkit-appearance: auto!important; appearance: auto;!important } 138 | *:not(pre) { -webkit-text-stroke: ${val}px !important; text-stroke: ${val}px !important } 139 | ::selection { color: #fff;background: #338fff } 140 | `; 141 | }, 142 | 143 | changeStyle() { 144 | document.getElementById('mactype-style').innerHTML = this.generateStyle(); 145 | }, 146 | 147 | addPluginStyle() { 148 | let style = this.generateStyle(); 149 | 150 | if (document.head) { 151 | util.addStyle('swal-pub-style', 'style', GM_getResourceText('swalStyle')); 152 | util.addStyle('mactype-style', 'style', style); 153 | } 154 | const headObserver = new MutationObserver(() => { 155 | util.addStyle('swal-pub-style', 'style', GM_getResourceText('swalStyle')); 156 | util.addStyle('mactype-style', 'style', style); 157 | }); 158 | headObserver.observe(document.head, {childList: true, subtree: true}); 159 | }, 160 | 161 | isTopWindow() { 162 | return window.self === window.top; 163 | }, 164 | 165 | init() { 166 | this.initValue(); 167 | this.isTopWindow() && !util.getValue('has_init') && this.showSetting(); 168 | this.isTopWindow() && this.registerMenuCommand(); 169 | if (util.getValue('white_list').includes(location.host)) return; 170 | this.addPluginStyle(); 171 | } 172 | }; 173 | main.init(); 174 | })(); 175 | -------------------------------------------------------------------------------- /mactype.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Mactype助手 3 | // @namespace https://github.com/syhyz1990/mactype 4 | // @version 2.2.6 5 | // @description Windows下的浏览器浏览网页时文字往往发虚,颜色很淡,看不清楚。有了它可以让浏览器中显示的文字更加清晰,支持Chrome ,360 ,QQ ,Firfox ,Edge 等浏览器。 6 | // @author YouXiaoHou 7 | // @license MIT 8 | // @homepage https://www.youxiaohou.com/tool/install-mactype.html 9 | // @supportURL https://github.com/syhyz1990/mactype 10 | // @require https://unpkg.com/sweetalert2@10.16.6/dist/sweetalert2.min.js 11 | // @resource swalStyle https://unpkg.com/sweetalert2@10.16.6/dist/sweetalert2.min.css 12 | // @updateURL https://www.youxiaohou.com/mactype.user.js 13 | // @downloadURL https://www.youxiaohou.com/mactype.user.js 14 | // @match *://*/* 15 | // @run-at document-start 16 | // @grant GM_getValue 17 | // @grant GM_setValue 18 | // @grant GM_registerMenuCommand 19 | // @grant GM_getResourceText 20 | // @icon data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48cGF0aCBkPSJNMTIwIDcuMWM0LjQgMCA4IDQuMSA4IDl2NzMuMmMwIDUtMy42IDktOCA5SDgwLjhsNy4yIDE2LjNjLjggMi4zIDAgNS0xLjYgNS45LS40LjUtMS4yLjUtMS42LjVINDMuNmMtMi40IDAtNC0xLjgtNC00LjUgMC0uOSAwLTEuNC40LTEuOGw3LjItMTYuM0g4Yy00LjQgMC04LTQuMS04LTlWMTYuMWMwLTUgMy42LTkgOC05aDExMnoiIGZpbGw9IiM0NDQiLz48cGF0aCBkPSJNMTAyLjMgMzQuN2ExNC4yOCAxNC4yOCAwIDAgMC02LjItNi4yYy0yLjctMS40LTUuMy0yLjItMTIuNi0yLjJINjkuMXY1NC42aDE0LjRjNy4zIDAgOS45LS44IDEyLjYtMi4yYTE1LjQyIDE1LjQyIDAgMCAwIDYuMi02LjJjMS40LTIuNyAyLjItNS4zIDIuMi0xMi42VjQ3LjNjMC03LjMtLjgtOS45LTIuMi0xMi42em0tOC43IDI4LjJjMCAyLjQtLjIgMy4zLS43IDQuMnMtMS4yIDEuNi0yLjEgMi4xYy0uOS40LTEuOC43LTQuMi43SDgwVjM3LjJoNi42YzIuNCAwIDMuMy4yIDQuMi43czEuNiAxLjIgMi4xIDIuMWMuNC45LjcgMS44LjcgNC4ydjE4Ljd6TTUwIDQ4LjFIMzYuM1YyNi4zSDI1LjR2NTQuNWgxMC45VjU5SDUwdjIxLjhoMTAuOVYyNi4zSDUwdjIxLjh6IiBmaWxsPSIjZmZmIi8+PC9zdmc+ 21 | // ==/UserScript== 22 | 23 | (function () { 24 | 'use strict'; 25 | 26 | let util = { 27 | getValue(name) { 28 | return GM_getValue(name); 29 | }, 30 | 31 | setValue(name, value) { 32 | GM_setValue(name, value); 33 | }, 34 | 35 | addStyle(id, tag, css) { 36 | tag = tag || 'style'; 37 | let doc = document, styleDom = doc.getElementById(id); 38 | if (styleDom) return; 39 | let style = doc.createElement(tag); 40 | style.rel = 'stylesheet'; 41 | style.id = id; 42 | tag === 'style' ? style.innerHTML = css : style.href = css; 43 | document.head.appendChild(style); 44 | }, 45 | 46 | removeElementById(eleId) { 47 | let ele = document.getElementById(eleId); 48 | ele && ele.parentNode.removeChild(ele); 49 | } 50 | }; 51 | 52 | let main = { 53 | /** 54 | * 配置默认值 55 | */ 56 | initValue() { 57 | let value = [{ 58 | name: 'current_val', 59 | value: 0 60 | }, { 61 | name: 'has_init', 62 | value: false 63 | }, { 64 | name: 'white_list', 65 | value: [] 66 | }]; 67 | 68 | value.forEach((v) => { 69 | util.getValue(v.name) === undefined && util.setValue(v.name, v.value); 70 | }); 71 | }, 72 | 73 | showSetting() { 74 | Swal.fire({ 75 | title: '请选择清晰度', 76 | icon: 'info', 77 | input: 'range', 78 | showCancelButton: true, 79 | confirmButtonText: '保存', 80 | cancelButtonText: '还原', 81 | showCloseButton: true, 82 | inputLabel: '拖动滑块观察变化,数字越大字越清晰', 83 | customClass: { 84 | popup: 'mactype-popup', 85 | }, 86 | footer: '
点击查看 使用说明,配合 XHei字体 更清晰,Powered by 油小猴
', 87 | inputAttributes: { 88 | min: 0, 89 | max: 1, 90 | step: 0.05 91 | }, 92 | inputValue: util.getValue('current_val') 93 | }).then((res) => { 94 | util.setValue('has_init', true); 95 | if (res.isConfirmed) { 96 | util.setValue('current_val', res.value); 97 | this.changeStyle(); 98 | } 99 | if (res.isDismissed && res.dismiss === "cancel") { 100 | util.setValue('current_val', 0); 101 | this.changeStyle(); 102 | } 103 | }); 104 | 105 | document.getElementById('swal2-input').addEventListener('change', (e) => { 106 | util.setValue('current_val', e.target.value); 107 | this.changeStyle(); 108 | }); 109 | }, 110 | 111 | registerMenuCommand() { 112 | let whiteList = util.getValue('white_list'); 113 | let host = location.host; 114 | if (whiteList.includes(host)) { 115 | GM_registerMenuCommand('💡 当前网站:❌', () => { 116 | let index = whiteList.indexOf(host); 117 | whiteList.splice(index, 1); 118 | util.setValue('white_list', whiteList); 119 | history.go(0); 120 | }); 121 | } else { 122 | GM_registerMenuCommand('💡 当前网站:✔️', () => { 123 | whiteList.push(host); 124 | util.setValue('white_list', whiteList); 125 | history.go(0); 126 | }); 127 | } 128 | GM_registerMenuCommand('⚙️ 设置', () => { 129 | this.showSetting(); 130 | }); 131 | }, 132 | 133 | generateStyle() { 134 | let val = util.getValue('current_val'); 135 | return ` 136 | .mactype-popup { font-size: 14px!important } 137 | .swal2-range input { -webkit-appearance: auto!important; appearance: auto;!important } 138 | *:not(pre) { -webkit-text-stroke: ${val}px !important; text-stroke: ${val}px !important } 139 | ::selection { color: #fff;background: #338fff } 140 | `; 141 | }, 142 | 143 | changeStyle() { 144 | document.getElementById('mactype-style').innerHTML = this.generateStyle(); 145 | }, 146 | 147 | addPluginStyle() { 148 | let style = this.generateStyle(); 149 | 150 | if (document.head) { 151 | util.addStyle('swal-pub-style', 'style', GM_getResourceText('swalStyle')); 152 | util.addStyle('mactype-style', 'style', style); 153 | } 154 | const headObserver = new MutationObserver(() => { 155 | util.addStyle('swal-pub-style', 'style', GM_getResourceText('swalStyle')); 156 | util.addStyle('mactype-style', 'style', style); 157 | }); 158 | headObserver.observe(document.head, {childList: true, subtree: true}); 159 | }, 160 | 161 | isTopWindow() { 162 | return window.self === window.top; 163 | }, 164 | 165 | init() { 166 | this.initValue(); 167 | this.isTopWindow() && !util.getValue('has_init') && this.showSetting(); 168 | this.isTopWindow() && this.registerMenuCommand(); 169 | if (util.getValue('white_list').includes(location.host)) return; 170 | this.addPluginStyle(); 171 | } 172 | }; 173 | main.init(); 174 | })(); 175 | --------------------------------------------------------------------------------