Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name HC Cleanup
- // @version 1.0
- // @grant none
- // @include https://alpha.human-conncetion.org/
- // ==/UserScript==
- window.onload = function () {
- var dudesToHide = [
- "Lothar J. Finger",
- "John Doe",
- "Wer auch immer",
- "" // Last entry without comma!
- ];
- var containerNode = document.getElementById('main').querySelector('.cards');
- var mutationObserver = new MutationObserver(function (mutations) {
- var cardsToCheck = containerNode.getElementsByClassName('card');
- for (var i = 0; i < cardsToCheck.length; i++) {
- var item = cardsToCheck.item(i);
- var header = item.getElementsByClassName('hc__author');
- var authorCollection = header.item(0).getElementsByClassName('title');
- var authorName = authorCollection.item(0).innerText
- // check whether author name is among the dudes
- if (dudesToHide.includes(authorName)) {
- item.parentNode.removeChild(item);
- console.log('(⌐■_■) Removed post from: ' + authorName + ' ¯\_(ツ)_/¯');
- }
- }
- });
- // Starts listening for changes in the content conatainer of the page.
- mutationObserver.observe(containerNode, {
- attributes: false,
- characterData: false,
- childList: true,
- subtree: true,
- attributeOldValue: false,
- characterDataOldValue: false
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement