Advertisement
Guest User

Untitled

a guest
Dec 26th, 2021
773
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Wykop bez różowych
  3. // @namespace wykop.pl
  4. // @version 0.1.1
  5. // @description Wykop wolny od różowych
  6. // @author Quzin
  7. // @match https://www.wykop.pl/*
  8. // @icon https://www.google.com/s2/favicons?domain=wykop.pl
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. const styles = `
  13. .show-female-content {
  14. color: #cdd9e2;
  15. text-align: center;
  16. }
  17. `
  18.  
  19.  
  20. const addGlobalStyle = (css) => {
  21. let head, style;
  22. head = document.getElementsByTagName('head')[0];
  23. if (!head) { return; }
  24. style = document.createElement('style');
  25. style.innerHTML = css;
  26. head.appendChild(style);
  27. }
  28.  
  29. const Warning = () => {
  30. const container = document.createElement('p');
  31. container.classList.add('show-female-content');
  32. container.innerText = 'Treść różowej została zablokowana :-)';
  33. return container;
  34. }
  35.  
  36. const femaleThreadsFilter = () => {
  37. const threads = document.querySelectorAll('.iC');
  38.  
  39. threads.forEach((thread) => {
  40. const avatar = thread.querySelector('.avatar');
  41.  
  42. if (avatar?.classList?.contains('female')) {
  43. thread.innerHTML = '';
  44. thread.appendChild(Warning());
  45. }
  46. })
  47. }
  48.  
  49. const femaleCommentsFilter = () => {
  50. const comments = document.querySelectorAll('.dC');
  51.  
  52. comments.forEach((comment) => {
  53. const avatar = comment.querySelector('.avatar');
  54.  
  55. if (avatar?.classList?.contains('female')) {
  56. comment.innerHTML = '';
  57. }
  58. })
  59. }
  60.  
  61. (() => {
  62. addGlobalStyle(styles);
  63. femaleThreadsFilter();
  64. femaleCommentsFilter();
  65. })();
  66.  
  67. $(document).ajaxComplete(function() {
  68. console.log('AJAX COMPLETE');
  69. femaleThreadsFilter();
  70. femaleCommentsFilter();
  71. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement