知乎免登陆 - 新版

知乎免登陆

As of 2020-12-01. See the latest version.

// ==UserScript==
// @name         知乎免登陆 - 新版
// @description  知乎免登陆
// @namespace    https://www.zhihu.com/
// @match        *://www.zhihu.com/*
// @version 0.0.1.20201201063325
// ==/UserScript==

'use strict';
(function () {
    let removeLoginModal = e => {
        if (e.target.getElementsByClassName('Modal-wrapper').length > 0 && e.target.getElementsByClassName('Modal-closeButton').length === 0) {
            e.target.getElementsByClassName('Modal-wrapper')[0].remove();
            document.removeEventListener('DOMNodeInserted', removeLoginModal);
            setTimeout(() => {document.documentElement.style.overflowY = 'scroll';}, 0);
        }
    }
    document.addEventListener('DOMNodeInserted', removeLoginModal);
})();