Greasy Fork

Greasy Fork is available in English.

移除知乎、简书、freebuf标题

移除知乎、简书、freebuf标题|方便划水!

当前为 2021-01-07 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        移除知乎、简书、freebuf标题
// @namespace   phant0ms.me
// @version      0.3
// @description  移除知乎、简书、freebuf标题|方便划水!
// @author       phant0ms
// @include      *.zhihu.com/*
//@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")>-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");
            }
        }
        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");
            }
        }

    }

})();