美文网首页
Clear StackOverFlow

Clear StackOverFlow

作者: granton_zhuang | 来源:发表于2017-08-16 19:29 被阅读41次

    不更改网站首页,让问题详情只留下问题和答案。

    TamperMonkey

    // ==UserScript==
    // @name         Clear StackOverFlow
    // @namespace    http://tampermonkey.net/
    // @version      0.1
    // @description  try to take over the world!
    // @author       You
    // @match        https://stackoverflow.com/*
    // @grant        none
    // ==/UserScript==
    
    (function() {
        'use strict';
        let re = new RegExp('https:\/\/stackoverflow.com\/questions\/[0-9]+\/.*');
        if (!window.location.href.match(re)) {
            return;
        }
        function deleteEle (element) {
            return element && element.parentNode && element.parentNode.removeChild(element);
        }
        function $(target) {
            if (target[0] === '#') {
                return document.getElementById(target.replace('#', ''));
            } else if (target[0] === '.') {
                return document.getElementsByClassName(target.replace('.', ''))[0];
            } else {
                return document.getElementsByTagName(target)[0];
            }
        }
        deleteEle($('.so-header'));
        deleteEle($('#footer'));
        deleteEle($('#sidebar'));
        deleteEle($('#post-form'));
        deleteEle($('.bottom-notice'));
        deleteEle($('.aside-cta'));
        deleteEle($('#feed-link'));
    })();
    

    or

    stylish

    • chrome 需要指定 正则表达式匹配问题详情的网址

    https:\/\/stackoverflow.com\/questions\/[0-9]+\/.*

    #feed-link,
    #footer,
    #sidebar,
    #post-form,
    .so-header,
    .bottom-notice,
    .aside-cta,
    .everyonelovesstackoverflow {
        display: none;
    }
    
    • firefox 则不需要
    @-moz-document regexp('https:\/\/stackoverflow.com\/questions\/[0-9]+\/.*') {
        #feed-link, #footer, #sidebar, #post-form, .bottom-notice, .aside-cta, .so-header, .everyonelovesstackoverflow {
            display: none;
        }
    }
    

    相关文章

      网友评论

          本文标题:Clear StackOverFlow

          本文链接:https://www.haomeiwen.com/subject/irkwrxtx.html