// ==UserScript== // @name 知乎手机页面优化 // @namespace https://greasyfork.org/users/439775 // @version 0.3.3 // @description 知乎手机页面优化,自动展开,无APP提示 // @author EricSong // @include http*://www.zhihu.com/question/* // @include http*://*.zhihu.com/p/* // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; const getModalWrap = () => document.querySelector(".ModalWrap"); const goAway = () => { // 移除遮罩层 getModalWrap().remove(); document.body.classList.remove("ModalWrap-body"); document.body.style.overflow = "auto"; // 展示所有内容 const richContents = document.querySelectorAll('.RichContent'); [...richContents].map(rc => { rc.classList.remove('is-collapsed'); rc.querySelector('.RichContent-inner').style.maxHeight = 'unset'; }); // 移除App打开按钮 document.querySelector('.OpenInAppButton').remove(); // 回滚至页首 window.scrollTo(0, 0); }; const intervalId = setInterval(() => { const mw = getModalWrap(); if (!mw) return; clearInterval(intervalId); goAway(); }, 500); setTimeout(() => clearInterval(intervalId), 5000); })();