如何在我的网站上禁用或隐藏所需的Disqus广告? [英] How do I disable or hide the unwanted Disqus ads on my website?

查看:281
本文介绍了如何在我的网站上禁用或隐藏所需的Disqus广告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


想象一下,有一天,突然,随机广告开始出现在您的网站上......

Imagine that one day, suddenly, random ads started appearing on your website...

最近我们开始在Disqus评论中强制推出不需要的广告,在您不知情的情况下在您的网站上展示那些讨厌的广告。他们似乎只定位每天流量足够大或使用其他任意标准的网站,因此广告不会出现在所有网站上,只会出现在相对繁忙的网站上。

Recently Disqus started forcing unwanted ads inside of the Disqus comments, displaying those nasty ads on your website(s) without your knowing. It seems that they only target the sites with "big enough" daily traffic or use some other arbitrary criteria, so the ads do not appear on all the websites, but only on relatively busy ones.

这种方式强迫您升级到付费订阅计划 - 对于付费用户,这些广告变为可选(即您可以在Disqus管理员面板中禁用它们)。

This way Disqus "forces" you to upgrade to the paid subscription plan - for the paid users these ads become optional (i.e. you can disable them in your Disqus admin panel).

如果您不想付款该怎么办?如何停用这些广告?
这是否有一个简单,快速解决的解决方案?

What to do if you don't want to pay? How to disable these ads? Is there an easy, quick-fix solution for this?

至少在我们有时间切换到另一个评论系统之前。

At least until we have the time to switch to another commenting system.

推荐答案

截至撰写本文时,流行的AdBlock浏览器扩展程序似乎成功阻止了广告。但是,并非所有网站访问者都使用adblock。

As of moment of writing, it seems that popular AdBlock browser extensions successfully block the ads. However, not all of your website visitors use adblock.

这是一个基于jQuery的快速隐藏广告的解决方案:

Here is a quick jQuery-based solution to hide the ads:

(function($){
    setInterval(() => {
        $.each($('iframe'), (arr,x) => {
            let src = $(x).attr('src');
            if (src && src.match(/(ads-iframe)|(disqusads)/gi)) {
                $(x).remove();
            }
        });
    }, 300);
})(jQuery);

只需在jQuery加载后,在每个出现Disqus评论的页面上将其插入您的网站。该代码会定期检查您网站上是否存在Disqus广告并删除其容器。你知道,万一他们会试图重新出现。

Just insert it on your website after jQuery loads, on every page where the Disqus comments appear. The code checks periodically if there are Disqus ads present on your website and removes their container whatsover. You know, just in case if they'll try to re-appear.

这篇关于如何在我的网站上禁用或隐藏所需的Disqus广告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆