Skip to content

Instantly share code, notes, and snippets.

@thallium
Last active November 2, 2021 04:51
Show Gist options
  • Save thallium/67953df271df12edb3007ece72a8a87e to your computer and use it in GitHub Desktop.
Save thallium/67953df271df12edb3007ece72a8a87e to your computer and use it in GitHub Desktop.
hide codeforces problem tags except difficulty
// ==UserScript==
// @name codeforces hide tags but difficulty
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Thallium
// @match https://codeforces.com/*
// @icon https://codeforces.org/s/74991/favicon-96x96.png
// @grant none
// ==/UserScript==
(function () {
'use strict';
const tags = document.getElementsByClassName('tag-box');
for (const tag of tags) {
if (tag.title !== 'Difficulty') {
tag.parentNode.style.display = 'none';
}
}
const handleClick = () => {
for (const tag of tags) {
if (tag.title !== 'Difficulty') {
tag.parentNode.style.display =
tag.parentNode.style.display==='block' ?
'none' : 'block';
}
}
};
const btn = document.createElement('button');
btn.innerHTML='toggle tags'
btn.style.fontSize="1.2rem"
btn.onclick=handleClick;
tags[0].parentNode.parentNode.previousSibling.previousSibling.appendChild(btn)
// Your code here...
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment