Customer Rule help

dudale

New Member
I view a web site.
it include CSS, Javascript to detect ADBlock plugin
I can't write the rule
the site is:
www[.]ruanyifeng[.]com /blog/2018/12/async-api-design.html

CSS:
HTML:
<style>
body {
  background-color: #f5f5d5;
}

#container::before {
  display: block;
  width: 100%;
  padding: 10px;
  background: rgba(0,0,0,0.1);
  text-align: center;
  content: "本站显示不正常,可能因为您使用了广告拦截器。";
}

</style>
Javascript:
HTML:
<script type="text/javascript">

function checker() {
var img = document.querySelector('img[src^="http://www.ruanyifeng.com/blog/images"]');
  if (img && window.getComputedStyle(img).display === 'none'){
    var sponsor = document.querySelector('.entry-sponsor');
    var prompt = document.createElement('div');
    prompt.style = 'border: 1px solid #c6c6c6;border-radius: 4px;background-color: #f5f2f0;padding: 15px; font-size: 16px;';
  prompt.innerHTML = '<p>您使用了广告拦截器,导致本站内容无法显示。</p><p>请将 www.ruanyifeng.com 加入白名单,解除广告屏蔽后,刷新页面,谢谢。</p>';
    sponsor.parentNode.replaceChild(prompt, sponsor);
    document.querySelector('#main-content').innerHTML = '';
  }
}

setTimeout(checker, 1000);

</script>
I using two rules:
ruanyifeng.com$$script[tag-content="checker"][max-length="100"]
www.ruanyifeng.com/blog/checker.js

But fail.

Anyone can help me write the rule,
 

dudale

New Member
I try three rules, but still fail.
Code:
div.banner:properties(content: /.*/)
||ruanyifeng.com$$script[tag-content="checker"][max-length="100"]
www.ruanyifeng.com/blog/checker.js
additional:
Env: Windows, Chrome Plugin
 
Last edited:

Blaz

Moderator & Translator
Staff member
Moderator
URL block rule is not working as they have that content in their source code too.

Chrome Extension does not support $$ rules.

Please try these rules to hide ads and redefine adblock script:
Code:
ruanyifeng.com##div[style="display: inline-block ! important;width: 100%;"] a
ruanyifeng.com##.entry-sponsor
ruanyifeng.com#%#Object.defineProperty(window, 'checker', { get: function() { return -1; } });
Though I can not reproduce the adblock message.
 

dudale

New Member
It's work!
Thanks for your help. :)
URL block rule is not working as they have that content in their source code too.

Chrome Extension does not support $$ rules.

Please try these rules to hide ads and redefine adblock script:
Code:
ruanyifeng.com##div[style="display: inline-block ! important;width: 100%;"] a
ruanyifeng.com##.entry-sponsor
ruanyifeng.com#%#Object.defineProperty(window, 'checker', { get: function() { return -1; } });
Though I can not reproduce the adblock message.
It's work! thanks for your help.
and It's only one rule is needed?

Code:
ruanyifeng.com#%#Object.defineProperty(window, 'checker', { get: function() { return -1; } })
 
Top