Greasy Fork is available in English.
知乎手机页面优化,自动展开,无APP提示
// ==UserScript==
// @name 知乎手机页面优化
// @namespace http://greasyfork.icu/users/439775
// @version 0.3.5
// @description 知乎手机页面优化,自动展开,无APP提示
// @author EricSong
// @include http*://www.zhihu.com/question/*
// @include http*://*.zhihu.com/p/*
// @grant 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';
});
// 回滚至页首
window.scrollTo(0, 0);
};
const intervalId = setInterval(() => {
// 移除App打开按钮
const openInAppButton = document.querySelector('.OpenInAppButton')
openInAppButton && openInAppButton.remove();
const mw = getModalWrap();
if (!mw) return;
clearInterval(intervalId);
goAway();
}, 500);
setTimeout(() => clearInterval(intervalId), 5000);
})();