ACT.Pengpai.MO.Stay

Stay in web not app, browsing experience optimization.

当前为 2022-03-25 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name               ACT.Pengpai.MO.Stay
// @description        Stay in web not app, browsing experience optimization.
// @author             ACTCD
// @version            20220325.1
// @license            GPL-3.0-or-later
// @namespace          ACTCD/Userscripts
// @supportURL         https://github.com/ACTCD/Userscripts#contact
// @homepageURL        https://github.com/ACTCD/Userscripts
// @match              *://m.thepaper.cn/*
// @grant              none
// @run-at             document-start
// ==/UserScript==

(function () {
    'use strict';

    function cleaner() {
        document.querySelector("header")?.style.setProperty("position", "absolute"); // Release top space
        document.querySelector(".homepage_nav")?.style.setProperty("position", "absolute"); // Release top space
        document.querySelector("#clickForMore")?.click(); // Content collapse
        document.querySelector(".header_moblink")?.remove(); // Header App banner
        document.querySelector(".listen_btn")?.remove(); // Embed App banner
        document.querySelector("#moblink_moreread")?.remove(); // Embed App banner
        document.querySelector("#hotCommentsDiv")?.remove(); // Embed App banner
        document.querySelector("#bottomBanner")?.remove(); // Footer App banner
        document.querySelector("#recommend")?.remove(); // Recommended
        document.querySelector("#newDetailHotRecommend")?.remove(); // Recommended
    }

    new MutationObserver(cleaner).observe(document, { subtree: true, childList: true, attributes: true });

    function DOMContentLoaded() {
        cleaner();
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', DOMContentLoaded);
    } else {
        DOMContentLoaded();
    }

})();