Cold Network Questions

Hides the Hot Network Questions sidebar on Stack Exchange and Stack Overflow; it's just so distracting!

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Cold Network Questions
// @namespace   kunaifirestuff
// @description Hides the Hot Network Questions sidebar on Stack Exchange and Stack Overflow; it's just so distracting!
// @include     *
// @version     4
// @grant       none
// ==/UserScript==

// If the document contains an element with the id "hot-network-questions",
// and this element has a child which has a child which is a link
// the url of which contains "stackoverflow.com", then we are sure this
// is a stackexchange site.
// Is it too redundant? Probably.

var hot = document.getElementById("hot-network-questions");
var isItStackexchange = false;

Loopy:
for(var i = 0; i < hot.children.length; i++){
  if(hot.children[i].children.length > 0 && hot.children[i].children[0].tagName == "A"){
    if(hot.children[i].children[0].href.indexOf("stackexchange.com") > -1){
      isItStackexchange = true;
      break Loopy;
    }
  }
}

if(isItStackexchange){
  hot.outerHTML = "";
}