Greasy Fork

Greasy Fork is available in English.

手机版移除知乎 App 下载

移除知乎 App 下载,自动取消下载提示

当前为 2023-06-25 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         手机版移除知乎 App 下载
// @namespace    http://tampermonkey.net/
// @version      0.3.7
// @description  移除知乎 App 下载,自动取消下载提示
// @author       sl00p
// @match        https://www.zhihu.com/*
// @match        https://zhuanlan.zhihu.com/*
// @grant        none
// @run-at       document-end
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    let autoClickBrowser = function() {
        let btnList = ["ModalWrap-itemBtn"];
        for(let idx = 0; idx < btnList.length; ++idx) {
            let btn = document.getElementsByClassName(btnList[idx]);
            if(btn && btn.length > 1 && window.location.pathname !== "/") {
                btn[1].click();
            }
        }
    };
    let autoClickReader = function() {
        let richContent = document.getElementsByClassName('RichContent-inner RichContent-inner--collapsed');
        let expandButton = document.getElementsByClassName('Button ContentItem-rightButton ContentItem-expandButton Button--plain');
        if(richContent && richContent.length > 0) {
            richContent[0].setAttribute("style", "max-height: 100%;");
            richContent[0].setAttribute("class", "null");
        }
        if(expandButton && expandButton.length > 0) {
            expandButton[0].remove();
        }
    };
    let removeAds = function() {
        let funList = ["Card DownloadGuide DownloadGuide-block", "DownloadGuide-inner",
                       "Card DownloadGuide DownloadGuide-block DownloadGuide-block--active", "Card ViewAllInappCard",
                       "OpenInAppButton OpenInApp is-shown", "Button Button--primary Button--blue", "Card TopstoryItem TopstoryItem--advertCard",
                       "MBannerAd", "OpenInAppButton OpenInApp css-1svfsgz-OpenInAppButton", "OpenInAppButton OpenInApp css-cazai8",
                       "OpenInAppButton  css-cazai8"];
        for(let idx = 0; idx < funList.length; ++idx) {
            let nodes = document.getElementsByClassName(funList[idx]);
            for(let jdx = 0; jdx < nodes.length; ++jdx) {
                if(nodes[jdx] !== undefined) {
                    nodes[jdx].remove();
                }
            }
        }
    };
    let inter = setInterval(function() {
        if(window.location.href.indexOf("oia") > 0) {
            // window.history.back()
        }
        let mainApp = document.getElementsByClassName("Button css-183aq3r Button--blue");
        for(let idx = 0; idx < mainApp.length; ++idx) {
            mainApp[idx].href = "";
            mainApp[idx].innerText = "不上知乎?";
        }
        removeAds();
        autoClickBrowser();
        autoClickReader();
    }, 500);
})();