Skip to content

Instantly share code, notes, and snippets.

@cmho
Last active September 15, 2023 13:34
Show Gist options
  • Save cmho/8741a7d23cdb8b92280db306caac82e4 to your computer and use it in GitHub Desktop.
Save cmho/8741a7d23cdb8b92280db306caac82e4 to your computer and use it in GitHub Desktop.
Secret Numbers for Cohost
// ==UserScript==
// @name Secret Numbers
// @namespace https://cohost.org/
// @version 1.0
// @description dark cohost show me the forbidden interaction numbers
// @author veryroundbird @ cohost.org
// @match https://cohost.org/rc/project/notifications
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
const updateCounts = () => {
const allNodes = document.querySelectorAll('section div .text-notBlack div div .flex-wrap');
allNodes.forEach(function(item) {
if (item.childNodes[0].textContent.match("Several pages shared")) {
let count = item.parentNode.parentNode.nextSibling.querySelector('.flex-row .flex-row').childNodes.length;
item.childNodes[0].textContent = `Several (${count}) pages shared `;
}
if (item.childNodes[0].textContent.match("Several pages liked")) {
let count = item.parentNode.parentNode.nextSibling.querySelector('.flex-row .flex-row').childNodes.length;
item.childNodes[0].textContent = `Several (${count}) pages liked `;
}
if (item.childNodes[0].textContent.match("Several pages followed you")) {
let count = item.parentNode.parentNode.nextSibling.querySelector('.flex-row .flex-row').childNodes.length;
item.childNodes[0].textContent = `Several (${count}) pages followed you`;
}
});
};
(function() {
'use strict';
updateCounts();
setInterval(updateCounts, 5000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment