JavaGuide

【自用】【免关注、移除图片广告】阅读全文网站支持:JavaGuide<br>

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         JavaGuide
// @namespace    http://tampermonkey.net/
// @version      1.0
// @require      https://greasyfork.org/scripts/415668-zmquery3-5-1/code/zmQuery351.js?version=866815
// @description  【自用】【免关注、移除图片广告】阅读全文网站支持:JavaGuide<br>
// @author       xjg
// @match        *://javaguide.cn/*
// @grant        none
// ==/UserScript==

(function () {
  const TARGET_ID = '#markdown-content';

  function fixUnlock() {
    const el = document.querySelector(TARGET_ID);
    if (!el) return;
    el.setAttribute('data-unlock-target', 'false');
  }

  function removeAnnoyingElements() {
    // 1. 正常删除不需要的元素
    document.querySelectorAll('.article-footer-qrcode, .read-more-anchor').forEach(el => el.remove());

    // 2. 针对 .route-link,只删除其内部的 <img>,保留链接本身
    document.querySelectorAll('.route-link').forEach(link => {
      const img = link.querySelector('img');
      if (img) {
        img.remove();
      }
    });
  }

  const observer = new MutationObserver(() => {
    fixUnlock();
    removeAnnoyingElements();
  });

  observer.observe(document.body, {
    childList: true,
    subtree: true
  });

  // 首屏兜底
  setTimeout(() => {
    fixUnlock();
    removeAnnoyingElements();
  }, 300);
})();