Streamline Asuracomic

Removes ad and other redundant ui sections.

// ==UserScript==
// @name        Streamline Asuracomic
// @namespace   Violentmonkey Scripts
// @match       https://asuracomic.net/*
// @grant       none
// @version     1.0
// @author      -
// @license MIT
// @description Removes ad and other redundant ui sections.
// ==/UserScript==
;(function () {
  "use strict"

  // --- Add CSS selectors for any elements you want to remove here ---
  const selectorsToRemove = [
    "body > div.flex.items-center.justify-center.flex-col",
    "body > div.max-w-\\[1220px\\].pt-2 > div > div > div > h2.text-center.md\\:text-center.py-4.text-sm.text-\\[\\#999999\\]",
    "body > div.max-w-\\[1220px\\].pt-2 > div > div > div > div.flex.items-center.justify-center.gap-1.py-2",
    "body > div.max-w-\\[1220px\\].pt-2 > div > div > div > div.space-y-4 > div.bg-\\[\\#222222\\].px-5.py-4.flex.items-center.md\\:text-start.justify-center.gap-x-2.w-full",
    "body > div.bottom-\\[-40px\\].sm\\:bottom-0",
  ]

  const applySelectorsToNode = (targetNode) => {
    for (const selector of selectorsToRemove) {
      try {
        targetNode.querySelectorAll(selector).forEach((el) => el.remove())
        if (targetNode.matches && targetNode.matches(selector)) {
          targetNode.remove()
        }
      } catch (e) {
        console.error(`Failed on selector: ${selector}`, e)
      }
    }
  }

  const observer = new MutationObserver((mutations) => {
    for (const mutation of mutations) {
      for (const node of mutation.addedNodes) {
        if (node.nodeType === Node.ELEMENT_NODE) {
          applySelectorsToNode(node)
        }
      }
    }
  })
  observer.observe(document.body, {
    childList: true,
    subtree: true,
  })

  applySelectorsToNode(document)
})()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址