Greasy Fork is available in English.

토끼 광고차단

마나토끼, 뉴토끼, 북토끼 광고차단

  1. // ==UserScript==
  2. // @name 토끼 광고차단
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.3
  5. // @description 마나토끼, 뉴토끼, 북토끼 광고차단
  6. // @author You
  7. // @match *://*/*
  8. // @grant none
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. // 마나토끼, 뉴토끼, 북토끼 광고차단
  15. const url = window.location.hostname;
  16. if (url.includes("newtoki") || url.includes("manatoki") || url.includes("booktoki")) {
  17. // URL차단은 안됨 브라우저가 스크립트보다 요청하는 속도가 더 빠름
  18. const blockedKeywordURL = "tokinbtoki"; // 차단할 키워드 URL
  19.  
  20. // 숨길 요소들 선택자 정의
  21. const selectors = [
  22. "#hd_pop",
  23. "#id_mbv",
  24. ".col-15.col-md-9.col-sm-9",
  25. ".board-tail-banner",
  26. ".basic-banner",
  27. "#main-banner-view"
  28. ];
  29.  
  30. // CSS 스타일로 요소 숨기기
  31. const addStyle = () => {
  32. const style = document.createElement("style");
  33. style.textContent = selectors.map(selector => `${selector} { display: none !important; visibility: hidden !important; }`).join("\n");
  34. (document.head || document.documentElement).appendChild(style);
  35. };
  36.  
  37. // DOM로드 확인
  38. if (document.head) {
  39. addStyle(); // DOM렌더링되기 전에 새로운 CSS삽입
  40. } else {
  41. document.addEventListener("DOMContentLoaded", addStyle); // 해당 스크립트 파일 실행 시점이 늦는 앱 대비용 코드(잠깐 광고 여백이 보임)
  42. }
  43.  
  44. }
  45. })();