Hide TopCoder problem archive categories

Hides the category list in the topcoder problem archive, because knowing the categories of a problem can spoil the solution! (The categories are replaced with '...', click on them to toggle hidden-ness.)

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        Hide TopCoder problem archive categories
// @namespace   kunaifirestuff
// @description Hides the category list in the topcoder problem archive, because knowing the categories of a problem can spoil the solution! (The categories are replaced with '...', click on them to toggle hidden-ness.)
// @include     http://community.topcoder.com/tc?module=ProblemArchive*
// @version     1
// @grant       none
// ==/UserScript==

var table = document.getElementsByTagName('b') [0].parentElement.parentElement.parentElement.parentElement;
var categoryArray = new Array(table.childElementCount - 9);
var hiddenText = '...';

for (var i = 3; i < table.childElementCount - 6; i++) {
  (function (i) {
    var cats = table.children[i].children[5];
    
    categoryArray[i - 3] = cats.textContent;
    cats.textContent = hiddenText;
    cats.setAttribute('align', 'center');
    
    cats.addEventListener('click', function () {
      if (cats.textContent == hiddenText) {
        cats.textContent = categoryArray[i - 3];
      } else {
        cats.textContent = hiddenText;
      }
    });
  }(i));
}