Skip to content

Instantly share code, notes, and snippets.

@motatoes
Last active February 26, 2018 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save motatoes/81f9dee49923376b7ad032cd3957b797 to your computer and use it in GitHub Desktop.
Save motatoes/81f9dee49923376b7ad032cd3957b797 to your computer and use it in GitHub Desktop.
Tampermonkey Userscript to hide codeforces rankings
// ==UserScript==
// @name CF no ranks
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://codeforces.com/
// @grant none
// ==/UserScript==
// hides all elements occurunces of the given class name from the page
function hideAllElementsOf(selector) {
var elements = document.querySelectorAll(selector);
for (var i=0; i<elements.length; i++) {
elements[i].style.display = "none";
}
}
(function() {
'use strict';
// hide ratings in profile page
hideAllElementsOf('.info ul li:first-child'); // rating on profile page
hideAllElementsOf('#placeholder'); // graph
hideAllElementsOf('.user-rank');
// all pages (sidebar
hideAllElementsOf('.personal-sidebar ul li:first-child');
hideAllElementsOf('.sidebar .avatar div');
// remove all classes for rated users
var userLinks = document.querySelectorAll('.rated-user');
for (var i=0; i<userLinks.length; i++) {
userLinks[i].classList.remove('user-red');
userLinks[i].classList.remove('user-violet');
userLinks[i].classList.remove('user-orange');
userLinks[i].classList.remove('user-blue');
userLinks[i].classList.remove('user-gray');
if (userLinks[i].classList.contains('user-legendary')) {
if (userLinks[i].querySelector('span'))
userLinks[i].querySelector('span').classList.remove('legendary-user-first-letter');
userLinks[i].classList.remove('user-legendary');
}
userLinks[i].classList.add('user-green');
}
// contests
// >> rating change
hideAllElementsOf('.user-contests-table tr th:nth-child(5)');
hideAllElementsOf('.user-contests-table tr td:nth-child(5)');
// >> new rating
hideAllElementsOf('.user-contests-table tr th:nth-child(6)');
hideAllElementsOf('.user-contests-table tr td:nth-child(6)');
// >> updated rank
hideAllElementsOf('.user-contests-table tr th:nth-child(7)');
hideAllElementsOf('.user-contests-table tr td:nth-child(7)');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment