Medium 简洁化

移除位于https://*.medium.com/*页面下方的注册提示,以及移除非必要的内容。

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Medium 簡潔化
// @name:es      Medium Simplify.
// @name:zh      Medium 简洁化
// @name:zh-CN   Medium 简洁化
// @name:zh-TW   Medium 簡潔化
// @description         移除位於https://*.medium.com/*頁面下方的註冊提示,以及移除非必要的內容。
// @description:es      Remove the registration prompt located at the bottom of the https://*.medium.com/* page and remove unnecessary content.
// @description:zh      移除位于https://*.medium.com/*页面下方的注册提示,以及移除非必要的内容。
// @description:zh-CN   移除位于https://*.medium.com/*页面下方的注册提示,以及移除非必要的内容。
// @description:zh-TW   移除位於https://*.medium.com/*頁面下方的註冊提示,以及移除非必要的內容。
// @author       TOC SH
// @license      MIT
// @namespace    none
// @match        *://*/*
// @icon         https://telegra.ph/file/6eb4ebf4ed38fa9f2b87c.png
// @grant        none
// @version      2.0
// ==/UserScript==

(function() {
    'use strict';

    const selectors = [
        '*.ab.q.cn.fi',
        '*.ab.ac',
        '*.l.bw',
        '*.l.sy'
    ];

    function removeElements() {
        selectors.forEach(selector => {
            const elements = document.querySelectorAll(selector);
            elements.forEach(element => element.remove());
        });
    }

    function checkForMediumLogo() {
        if (document.querySelector('[data-testid="headerMediumLogo"]')) {
            removeElements();
            const observer = new MutationObserver(removeElements);
            const config = { childList: true, subtree: true };
            observer.observe(document.body, config);
        }
    }

    const observer = new MutationObserver(checkForMediumLogo);
    const config = { childList: true, subtree: true };
    observer.observe(document.body, config);

    // Initial check
    checkForMediumLogo();
})();