// ==UserScript== // @name 微信公众号文章PC阅读优化 // @namespace http://tampermonkey.net/ // @version 0.1 // @description 电脑端微信公众号文章阅读界面优化 // @author Even // @license Even // @match https://mp.weixin.qq.com/s* // @icon https://mp.weixin.qq.com/favicon.ico // @grant none // ==/UserScript== (function() { 'use strict'; // 定义自定义样式 const customStyles = ` .rich_media_area_primary_inner, .rich_media_area_extra_inner { max-width: 90%; /* 设置主内容和额外内容的最大宽度 */ font-size: 20px !important; /* 设置字体大小 */ } p, section, span[style] { font-size: 20px !important; /* 设置段落、节和特定样式标签的字体大小 */ } .not_in_mm .qr_code_pc_outer { display: block !important; /* 显示二维码容器 */ position: absolute; /* 设置二维码容器为绝对定位 */ z-index: 9; /* 设置二维码容器的堆叠顺序 */ } #js_content { color: #b8bfc6; /* 设置文章内容的颜色 */ } #page-content { background-color: #333; /* 设置页面背景颜色 */ } #activity-name { color: #b8bfc6; /* 设置活动名称颜色 */ text-align: center; /* 设置活动名称居中 */ } #meta_content { display: none; /* 隐藏元内容 */ } .qr_code_pc { display: none; /* 隐藏二维码图片 */ } #js_tags, #js_album_keep_read { background-color: gainsboro; /* 设置标签和专辑背景颜色 */ } .rich_media_area_extra { display: none; /* 隐藏额外内容区域 */ } `; // 创建并添加样式元素到头部 const styleEl = document.createElement('style'); styleEl.type = 'text/css'; styleEl.innerHTML = customStyles; document.head.appendChild(styleEl); // 调整 rich_media_area_primary_inner 的最大宽度 const primaryInner = document.getElementsByClassName('rich_media_area_primary_inner')[0]; if (primaryInner) { primaryInner.style.maxWidth = '1100px'; // 设置主内容区域的最大宽度 } })();