您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
2024/2/18 17:08:40
// ==UserScript== // @name 微信读书 宽度自适应 // @namespace Weread Width Adaptation // @match *://weread.qq.com/web/reader/* // @grant none // @version 2024.09.03.01 // @author James Wood // @description 2024/2/18 17:08:40 // @license MIT // ==/UserScript== (function () { 'use strict'; // 基础方法 function getCurrentMaxWidth(element) { let currentValue = window.getComputedStyle(element).maxWidth; currentValue = currentValue.substring(0, currentValue.indexOf('px')); currentValue = parseInt(currentValue); return currentValue; } function changeWidth() { const items = document.querySelectorAll(".readerContent .app_content, .readerTopBar"); const targetValue = window.innerWidth * 0.9; items.forEach(item => { const currentValue = getCurrentMaxWidth(item); if (currentValue !== targetValue) { item.style['max-width'] = targetValue + 'px'; } }); const myEvent = new Event('resize'); window.dispatchEvent(myEvent) } // 调整宽度 changeWidth(); // 将.readerControls元素距离右边10% const readerControls = document.querySelector('.readerControls'); readerControls.style.right = '6%'; readerControls.style.left = 'unset'; readerControls.style.marginLeft = 'unset'; })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址