BBG Hide Blocked GeekList Items

Collapses blocked geeklist items on BoardGameGeek.com and it's sister sites.

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        BBG Hide Blocked GeekList Items
// @namespace   dschachtler.dssr.ch
// @include     http://www.boardgamegeek.com/geeklist/*
// @include     http://boardgamegeek.com/geeklist/*
// @include     http://www.videogamegeek.com/geeklist/*
// @include     http://videogamegeek.com/geeklist/*
// @include     http://www.rpggeek.com/geeklist/*
// @include     http://rpggeek.com/geeklist/*
// @version     5
// @description Collapses blocked geeklist items on BoardGameGeek.com and it's sister sites.
// ==/UserScript==

//unsafeWindow.GL_HideAllComments();

var items = document.getElementsByClassName("mb5");
for (var i = 0; i < items.length; i++)
{
	var item = items[i];
	var cmd = item.getElementsByClassName('commands');
	if (cmd && cmd.length > 0)
	{
		if (cmd[0].innerHTML.indexOf("Unblock") >= 0)
		{
			hideItem(item);
		}
	}
}
scrollToAnchor();

function hideItem(item)
{
	var id = item.getAttribute('id').substr(4);
	
	var comments = document.getElementById('comments_' + id);
	if (comments) comments.style.display = "none";
	
	var body = document.getElementById('body_listitem' + id);
	if (body)
	{
		for (var c = 0; c < body.childNodes.length; c++)
		{
			var child = body.childNodes[c];
			if (child.nodeName == "DD" && child.style) child.style.display = "none";
		}
	}
}

function scrollToAnchor()
{
	if (window.location.href.indexOf("#") >= 0)
	{
		window.location.href = window.location.href;
	}
}