Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Wykop bez różowych
- // @namespace wykop.pl
- // @version 0.1.1
- // @description Wykop wolny od różowych
- // @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();
- })();
- $(document).ajaxComplete(function() {
- console.log('AJAX COMPLETE');
- femaleThreadsFilter();
- femaleCommentsFilter();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement