Greasy Fork 还支持 简体中文。

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.0
  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. // Hide ads with class 'no-pop'
  16. let adElements = document.querySelectorAll('.no-pop');
  17. adElements.forEach(element => {
  18. element.style.display = 'none';
  19. });
  20.  
  21. // Hide ads with IDs starting with 'ec'
  22. let ecElements = document.querySelectorAll('div[id^="ec"]');
  23. ecElements.forEach(element => {
  24. element.style.display = 'none';
  25. });
  26.  
  27. // Hide "РЕКЛАМНЫЙ БЛОК:" text
  28. let adBlockElement = document.querySelector('#dle-content > div > article > div.full-story-header.wide-block.clr');
  29. if (adBlockElement) {
  30. let childNodes = adBlockElement.childNodes;
  31. for (let node of childNodes) {
  32. if (node.nodeType === Node.TEXT_NODE && node.textContent.trim().includes("РЕКЛАМНЫЙ БЛОК:")) {
  33. node.textContent = '';
  34. break;
  35. }
  36. }
  37. }
  38.  
  39. // Hide the sidebar block about Adblock
  40. let sidebarBlocks = document.querySelectorAll('.sidebar-block');
  41. sidebarBlocks.forEach(block => {
  42. if (block.textContent.includes("Если Вы хотите поддержать проект") ||
  43. block.textContent.includes("If you want to support the project")) {
  44. block.style.display = 'none';
  45. }
  46. });
  47.  
  48. // Hide the specified article element
  49. let articleElement = document.querySelector('div.article.fixed.clr');
  50. if (articleElement) {
  51. let parentArticle = articleElement.closest('article');
  52. if (parentArticle) {
  53. parentArticle.style.display = 'none';
  54. }
  55. }
  56. }
  57.  
  58. // Run the function when the page loads
  59. hideAds();
  60.  
  61. // Use a MutationObserver to handle dynamically loaded ads
  62. let observer = new MutationObserver(mutations => {
  63. for (let mutation of mutations) {
  64. if (mutation.type === 'childList') {
  65. hideAds();
  66. }
  67. }
  68. });
  69. observer.observe(document.body, {childList: true, subtree: true});
  70. })();