Skip to content

Instantly share code, notes, and snippets.

@ReactiioN1337
Last active December 22, 2019 16:14
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 ReactiioN1337/e012dd6108e48e96b123bc936c1a5518 to your computer and use it in GitHub Desktop.
Save ReactiioN1337/e012dd6108e48e96b123bc936c1a5518 to your computer and use it in GitHub Desktop.
Hides posts on unknowncheats.me that are below a certain reputation threshold or ignored.
// ==UserScript==
// @name Hide Noobs, make UC readable again!
// @namespace UnKnoWnCheaTs
// @match *://www.unknowncheats.me/*
// @grant none
// @version 0.2
// @author ReactiioN, Robater
// @description Hides posts on unknowncheats.me that are below a certain reputation threshold or ignored.
// ==/UserScript==
window.onload = () => {
const minReputation = 0
const ignoredUsers = []
const userUrlPattern = /\/members\/(\d+).html/m
const hasMinRep = post => {
const selector = post.querySelector('[id^=repinfoRep_]')
return selector === null
? false // user has been banned
: parseInt(selector.innerText) >= minReputation
}
const isIgnored = post => {
if (ignoredUsers.length > 0) {
const selector = post.querySelector('[id^=postmenu_] .bigusername')
if (selector) {
const match = userUrlPattern.exec(selector.getAttribute('href'))
if (match) {
return ignoredUsers.includes(parseInt(match[1]))
}
}
}
return false
}
const posts = document.querySelectorAll('#posts .page')
if (posts !== null) {
for (const post of posts) {
if (!hasMinRep(post) || isIgnored(post)) {
post.remove()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment