不更改网站首页,让问题详情只留下问题和答案。
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;
}
}