Ruanyifeng No Block AdBlock

防止阮一峰博客屏蔽AdBlock

Install this script?
Author's suggested script

You may also like RemoveAds.

Install this script

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Author
Xzonn
Daily installs
0
Total installs
50
Ratings
0 0 0
Version
0.1
Created
2022-07-01
Updated
2022-07-01
Size
437 Bytes
License
WTFPL
Applies to

阮一峰博客检测广告的核心代码为:

  if (
    /*isAdblocker || */
    (img && window.getComputedStyle(img).display === 'none') ||
    (img && window.getComputedStyle(img.parentElement).display === 'none')
  )

注意到这段代码是通过setTimeout(checker, 1000);执行的,因此只需要把window.getComputedStyle这个函数修改掉就可以了。

核心代码:

window.getComputedStyle = function() { return { "display": "block" }; }