Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Hide Low Rated Author Blogs and Contest Announcements Blogs in Recent Actions (Codeforces)
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Hide blog entries in the sidebar from authors with specific titles (e.g., "Newbie", "Pupil")
- // @author You
- // @match https://codeforces.com/*
- // @connect codeforces.com
- // ==/UserScript==
- (function() {
- 'use strict';
- const threshhold_title = ['Newbie', 'Pupil'];
- function hideblogs() {
- const list = document.querySelectorAll('.recent-actions ul li');
- list.forEach((action) => {
- const userlink = action.querySelector('a.rated-user');
- const curr_title = userlink.getAttribute('title');
- const tohide = threshhold_title.some(title => curr_title && curr_title.includes(title));
- if (tohide) {
- action.style.display = "none";
- }
- else {
- const blogTitleElement = action.querySelector('a[href^="/blog/entry"]');
- const blogTitle = blogTitleElement ? blogTitleElement.textContent : '';
- if (blogTitle.includes("Codeforces Round") | blogTitle.includes("cheater") | blogTitle.includes("ban") | blogTitle.includes("cheaters")) {
- action.style.display = "none";
- }
- }
- });
- }
- const observer = new MutationObserver(() => {
- hideblogs();
- });
- observer.observe(document.querySelector('.recent-actions'), {
- childList: true,
- subtree: true
- });
- hideblogs();
- })();
Add Comment
Please, Sign In to add comment