Simplify view of BGG Math Trades Step 4
目前為
// ==UserScript==
// @name Simply Step 4
// @namespace http://userscripts.org
// @description Simplify view of BGG Math Trades Step 4
// @include http://bgg.activityclub.org/olwlg/mywants.cgi*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// @version 0.2
// @grant none
// ==/UserScript==
//hide lines that are associated with dummy itens
$('#wants .ondummy').each(function () {
$(this).hide();
});
//hide columns with green text. It hides based on index, and the last row is trick because it has on less td
$('#wants tr.head tt font[color="green"]') .each(function () {
var tt = $(this).parent().parent();
var tohideth = tt.index() + 1;
var tohidelr = tohideth - 1;
$('#wants tr:not(:last-child) td:nth-child(' + tohideth + ')').hide().addClass("dummyitemcontainer");
$('#wants th:nth-child(' + tohideth + ')') .hide().addClass("dummyitemcontainer");
$('#wants tr:last-child td:nth-child(' + tohidelr + ')') .hide().addClass("dummyitemcontainer");
});
//adjust table size
$('#wants tbody') .css('height', 'auto');
$('<td/>', {
id: "hideshow",
html: "Toggle Dummy Association"
}).insertAfter($('#tabofficial1'));
$('#hideshow').click(function () {
$('.dummyitemcontainer').toggle();
});