// ==UserScript== // @name Wykop bez females // @namespace wykop.pl // @version 0.1 // @description Wykop wolny od rozowych // @author Quzin // @match https://www.wykop.pl/* // @icon https://www.google.com/s2/favicons?domain=wykop.pl // @grant none // ==/UserScript== const styles = ` .show-female-content { color: #cdd9e2; text-align: center; } ` const addGlobalStyle = (css) => { let head, style; head = document.getElementsByTagName('head')[0]; if (!head) { return; } style = document.createElement('style'); style.innerHTML = css; head.appendChild(style); } const Warning = () => { const container = document.createElement('p'); container.classList.add('show-female-content'); container.innerText = 'Treść różowej została zablokowana :-)'; return container; } const femaleThreadsFilter = () => { const threads = document.querySelectorAll('.iC'); threads.forEach((thread) => { const avatar = thread.querySelector('.avatar'); if (avatar.classList.contains('female')) { thread.innerHTML = ''; thread.appendChild(Warning()); } }) } const femaleCommentsFilter = () => { const comments = document.querySelectorAll('.dC'); comments.forEach((comment) => { const avatar = comment.querySelector('.avatar'); if (avatar.classList.contains('female')) { comment.innerHTML = ''; } }) } (() => { addGlobalStyle(styles); femaleThreadsFilter(); femaleCommentsFilter(); })();