New Userscript

유동을 위한 고닉 차단법

  1. // ==UserScript==
  2. // @name New Userscript
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 유동을 위한 고닉 차단법
  6. // @author ㅇㅇ
  7. // @match https://gall.dcinside.com/mgallery/board/view/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=dcinside.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. //숨기길 원하는 고닉의 갤로그 ID를 넣어라. https://gallog.dcinside.com/{여기 올 것을 넣으면 됨}
  14. //예를 들어, 주딱을 예시로 차단한다면 damhiya를 "" 안에 넣는다.
  15. const nickList = new Set(["", "", ]);
  16.  
  17. function cleanBoard() {
  18. const cmtList = document.querySelector('.cmt_list');
  19. if (!cmtList) {
  20. return;
  21. }
  22. const liElements = cmtList.querySelectorAll('li');
  23. liElements.forEach(li => {
  24. const dataUid = li.querySelector('.cmt_nickbox [data-uid]');
  25. if (dataUid && nickList.has(dataUid.getAttribute('data-uid'))) {
  26. li.remove();
  27. }
  28. });
  29. }
  30.  
  31. function observeMutations() {
  32. const targetNode = document.body;
  33. const config = {
  34. childList: true,
  35. subtree: true,
  36. attributes: false,
  37. characterData: false
  38. };
  39. const observer = new MutationObserver(() => {
  40. cleanBoard();
  41. });
  42. observer.observe(targetNode, config);
  43. }
  44.  
  45. (function () {
  46. 'use strict';
  47. observeMutations();
  48. })();