Disqus Downvote Exposer

This is a port of the "Disqus Downvote Exposer"-addon for Chrome.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Disqus Downvote Exposer
// @namespace   MadeByXorok
// @include     *://*.disqus.com/*
// @include     *://disqus.com/*
// @version     1
// @grant       none
//
// @description This is a port of the "Disqus Downvote Exposer"-addon for Chrome.
// It can be found here: https://chrome.google.com/webstore/detail/disqus-downvote-exposer/onccocebmmmcfgipaappfpolojndnkce
//
// I ported it to ensure cross-browser-compatibility (in my case Firefox). The original code belongs to Yunku Daniel Kang.
// ==/UserScript==

setInterval(ShowDownvotes, 3000);

function ShowDownvotes()
{
	var downvotes = document.getElementsByClassName("vote-down");

	for (var i = 0; i < downvotes.length; i++)
	{
		var downvoteCount = downvotes[i].getElementsByClassName("downvote-count");

		if (downvoteCount.length == 0)
		{
			downvoteCount = document.createElement("span");
			downvoteCount.className = "downvote-count";
			downvoteCount.style.position = "relative";
			downvoteCount.style.top = "-3px";
			downvotes[i].insertBefore(downvoteCount, downvotes[i].firstChild);
		}
		else
			downvoteCount = downvoteCount[0];

		downvoteCount.innerHTML = downvotes[i].className.split(" ")[2].substring(6);

		if (downvoteCount.innerHTML == "0")
			downvoteCount.style.display = "none";
		else
			downvoteCount.style.display = "";
	}
}