Simply Step 4

Simplify view of BGG Math Trades Step 4

当前为 2014-07-02 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Simply Step 4
  3. // @namespace http://userscripts.org
  4. // @description Simplify view of BGG Math Trades Step 4
  5. // @include http://bgg.activityclub.org/olwlg/mywants.cgi*
  6. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
  7. // @version 0.3
  8. // @grant none
  9. // ==/UserScript==
  10. //hide lines that are associated with dummy itens
  11.  
  12. $('#wants .ondummy').each(function () {
  13. $(this).addClass("dummyitemcontainer").hide();
  14. });
  15.  
  16. //hide columns with green text. It hides based on index, and the last row is trick because it has on less td
  17.  
  18. $('#wants tr.head tt font[color="green"]') .each(function () {
  19. var tt = $(this).parent().parent();
  20. var tohideth = tt.index() + 1;
  21. var tohidelr = tohideth - 1;
  22. $('#wants tr:not(:last-child) td:nth-child(' + tohideth + ')').hide().addClass("dummyitemcontainer");
  23. $('#wants th:nth-child(' + tohideth + ')') .hide().addClass("dummyitemcontainer");
  24. $('#wants tr:last-child td:nth-child(' + tohidelr + ')') .hide().addClass("dummyitemcontainer");
  25. });
  26.  
  27. //adjust table size
  28. $('#wants tbody') .css('height', 'auto');
  29.  
  30. $('<td/>', {
  31. id: "hideshow",
  32. html: "Toggle Dummy Association"
  33. }).insertAfter($('#tabofficial1'));
  34.  
  35. $('#hideshow').click(function () {
  36. $('.dummyitemcontainer').toggle();
  37. });