Hide Some Ads

Hide some ads on online-fix.me

目前为 2025-03-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Hide Some Ads
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Hide some ads on online-fix.me
  6. // @match https://online-fix.me/*
  7. // @grant none
  8. // @license MIT
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. function hideAds() {
  15. let adElements = document.querySelectorAll('.no-pop');
  16. adElements.forEach(element => {
  17. element.style.display = 'none';
  18. });
  19.  
  20. let adBlockElement = document.querySelector('#dle-content > div > article > div.full-story-header.wide-block.clr');
  21. if (adBlockElement) {
  22. let childNodes = adBlockElement.childNodes;
  23. for (let node of childNodes) {
  24. if (node.nodeType === Node.TEXT_NODE && node.textContent.trim().includes("РЕКЛАМНЫЙ БЛОК:")) {
  25. node.textContent = '';
  26. break;
  27. }
  28. }
  29. }
  30.  
  31. let sidebarBlocks = document.querySelectorAll('.sidebar-block');
  32. sidebarBlocks.forEach(block => {
  33. if (block.textContent.includes("Если Вы хотите поддержать проект") ||
  34. block.textContent.includes("If you want to support the project")) {
  35. block.style.display = 'none';
  36. }
  37. });
  38.  
  39. let articleElement = document.querySelector('div.article.fixed.clr');
  40. if (articleElement) {
  41. let parentArticle = articleElement.closest('article');
  42. if (parentArticle) {
  43. parentArticle.style.display = 'none';
  44. }
  45. }
  46. }
  47.  
  48. hideAds();
  49.  
  50. let observer = new MutationObserver(mutations => {
  51. for (let mutation of mutations) {
  52. if (mutation.type === 'childList') {
  53. hideAds();
  54. }
  55. }
  56. });
  57. observer.observe(document.body, {childList: true, subtree: true});
  58. })();