Greasy Fork

Greasy Fork is available in English.

移除知乎、简书、freebuf标题

移除去掉知乎标题、简书标题、freebuf标题、在未登录时自动关闭知乎专栏的登录弹窗|方便划水!

当前为 2022-02-09 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        移除知乎、简书、freebuf标题
// @namespace   phant0ms.me
// @version      0.6.1
// @description  移除去掉知乎标题、简书标题、freebuf标题、在未登录时自动关闭知乎专栏的登录弹窗|方便划水!
// @author       phant0ms
// @include      *.zhihu.com/question/*
// @include      *zhuanlan.zhihu.com/p/*
// @include       *.freebuf.com/*
// @include       *.jianshu.com/*
// @grant        none
// @run-at document-end
// ==/UserScript==
(function() {
	'use strict';
	window.onload = function() {
		var url = window.location.href;
		if (url.search("zhihu.com/question") > -1) {
			//知乎标题移除
			// var title = document.querySelector(".PageHeader");
			var title = document.querySelector("#root > div > div:nth-child(2) > header");
			if (title) {
				title.remove();
				console.log("title removed success");
			} else {
				console.log("not found zhihu titile");
			}
            //移除登录提示框
            var loginDiv = document.querySelector("body > div:nth-child(26)");
            if(loginDiv){
                loginDiv.remove();
            }
        }

        else if (url.search("zhuanlan.zhihu.com") > -1) {
          //专栏页面下在未登录的情况下自动点击关闭登录弹窗
			var closeBtn = document.querySelector("button.Button.Modal-closeButton.Button--plain");
			if (closeBtn) {
				closeBtn.click();
				console.log("click close button")
			} else {
				console.log("not found close button in zhuanlan")
			}
		}

		else if (url.search("freebuf.com") > -1) {
			//freebuf标题移除
			var freebuf = document.querySelector("#artical-detail-page > div.page-header");
			if (freebuf) {
				freebuf.remove();
				console.log("title removed success");
			} else {
				console.log("not found freebuf title");
			}
		} else if (url.search("jianshu.com") > -1) {
			//简书
			var jianshu = document.querySelector('._1CSgtu');
			if (jianshu) {
				jianshu.remove();
				console.log("title removed success");
			} else {
				console.log("not found jianshu title");
			}
		}

	}

})();