屏蔽知乎不能关闭的登录框

屏蔽知乎进入网页即加载的登录框

// ==UserScript==
// @name         屏蔽知乎不能关闭的登录框
// @namespace    https://lab.wsl.moe/
// @version      0.2
// @description  屏蔽知乎进入网页即加载的登录框
// @author       You
// @match        http://*.zhihu.com/*
// @match        https://*.zhihu.com/*
// @run-at       document-end
// @grant        none
// @license      MIT
// ==/UserScript==

(() => {
    'use strict';

    const executeRemoveFunctionDelay = 500; // 执行延迟间隔(毫秒)
    const executeTimes = 11; // 进入页面以后重复执行次数

    const removeModalFunction = () => {
        const backgroundMasks = document.getElementsByClassName('Modal-backdrop');
        for (const i of backgroundMasks){
            i.className = '';
            i.innerHTML = '';
        }

        const loginModals = document.getElementsByClassName('Modal-enter-done');
        for (const i of loginModals){
            i.className = '';
            i.innerHTML = '';
        }

        document.getElementsByTagName('html')[0].style = '';
    };

    for (let i = 0; i <= executeTimes; i++) {
        setTimeout(removeModalFunction, executeRemoveFunctionDelay * i);
    }
})();