Created
January 5, 2023 14:26
-
-
Save Slyyxp/70b831f1d1592dbcc7cf08ae8f27015e to your computer and use it in GitHub Desktop.
HideUploadBot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Hide Upload Bot in Unread Forum Posts | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @author jpopsuki | |
// @match *://*jpopsuki.eu/forums.php* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=jpopsuki.eu | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
if (!/\baction=viewunread\b/.test(location.search) ) { | |
return; | |
} | |
let hiddenRows = 0; | |
const tableRows = document.querySelectorAll('#content > div > table > tbody > tr'); | |
for (const tableRow of tableRows) { | |
const firstCellContent = tableRow.querySelector('td > p > a') | |
if(firstCellContent != null && firstCellContent.text === 'Upload Bot') { | |
tableRow.style.display = 'none'; | |
hiddenRows++; | |
} | |
} | |
if(hiddenRows > 0) { | |
const tableBody = document.querySelector('#content > div > table > tbody') | |
const hiddenRowsMessage = hiddenRows === 1 | |
? document.createTextNode(`Hid 1 post from Upload Bot`) | |
: document.createTextNode(`Hid ${hiddenRows} posts from Upload Bot`); | |
const addedCell = tableBody.insertRow() | |
.insertCell(); | |
addedCell.setAttribute('colspan', 3) | |
addedCell.appendChild(hiddenRowsMessage); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment