Javascript called from a Div.. I think

Posting here is no longer possible, please use the forum of a filter list project, such as EasyList
Locked
pakennedy
Posts: 1
Joined: Thu Jan 21, 2016 12:51 am

Javascript called from a Div.. I think

Post by pakennedy »

My local newspaper just began blocking adblock. I'm trying to come up with a rule to get rid of it and not winning with adblock. NoScript obviously works but that prevents the JS that allows you to comment on an article.

An example page is http://www.dailyecho.co.uk/news/1421851 ... wer_block/


The relevant source seems to be as below. Any Ideas?


Code: Select all

<div class="adwarn adblock-warning hidden">
    <div class="adwarn-wrap">
        <p class="large">
            It looks like you have enabled software that blocks our advertising. Did you know that the revenue from advertising funds our local journalism? <a href="/ad-faq/#faq" target="_blank" class="semi-loud">Click here to learn more</a>.
        </p>

        <p class="medium">
            So we can continue producing great local journalism, we’d be grateful if you would disable your ad blocker, at least for this website. <a href="/ad-faq/#disable" target="_blank" class="semi-loud">How do I turn off my ad-blocker?</a>
        </p>
        <p class="medium">I’m afraid you’ll be unable to read our stories if your ad blocker remains on.</p>
    </div>
</div>

<div class="adwarn adwarn-article adblock-warning-severe hidden">
    <div class="adwarn-wrap">
        <h1 class="large">It looks like you have enabled software that blocks our advertising. Did you know that the revenue from advertising funds our local journalism? <a href="/ad-faq/#faq" target="_blank" class="semi-loud">Click here to learn more</a>.</h1>

        <p class="medium">
            So we can continue producing great local journalism, we’d be grateful if you would disable your ad blocker, at least for this website. <a href="/ad-faq/#disable" target="_blank" class="semi-loud">How do I turn off my ad-blocker?</a>
        </p>
        <p class="medium">I’m afraid you’ll be unable to read our stories if your ad blocker remains on.</p>
    </div>
</div>

<script type="text/javascript">
document.addEventListener('sp.blocking', function (e) {
    var articleId = '14218516';
    var events = "event70";
    var module = 'ArticleModule';
    var modulesBoth = ['ArticleModule', 'HomepageReplacementModule', 'PictureGalleryModule', 'StaticHtmlModule'];

    if ($.cookie('nqab') === 'false') {
        events += ',event74';
    }

    // Don't show warnings on the user module pages. Or on the /ad-faq/ page, obviously.
    if (module === 'UserModule' || module === 'BackboneUserModule' || module === 'AdBlockerFaqModule') {
        trackAdBlocks(events);
        return;
    }

    if ($.cookie('nqab') !== null && modulesBoth.indexOf(module) > -1) {
        if (articleId !== '') {
            $('.adblock-warning-severe').removeClass('hidden');
            $('.story-details > .nonstory-links').addClass('adblock-content');
            $('.story-details > .nonstory-links').empty();
        } else {
            $('.adblock-warning-severe').removeClass('adwarn-article');
            $('.adblock-warning-severe').removeClass('hidden');
        }

        events += ',event72';
        trackAdBlocks(events);
        $.cookie('nqab', 'true', { expires: 365, path: '/' });

        return;
    }

    // Show the basic banner if it's their first visit, or if they're on a page which doesn't get the second banner.
    $('.adblock-warning').removeClass('hidden');
    $.cookie('nqab', 'true', { expires: 365, path: '/' });

    events += ',event71';
    trackAdBlocks(events);
});

document.addEventListener('sp.not_blocking', function (e) {
    // If they have the cookie set, it means they saw the banner and now have disabled their adblocker.
    if ($.cookie('nqab') === 'true') {
        trackAdBlocks('event73');
        $.cookie('nqab', 'false', { expires: 365, path: '/' });
    }
});

function trackAdBlocks(events) {
    // Re-create the Omniture object so the data can be tracked.
    if (s === 's') {
        s = s_gi(omnitureShareAccount);
    }

    s.events = events;
    s.linkTrackEvents = events;
    s.linkTrackVars = "eVar2,eVar3,eVar4,eVar5,eVar6,evar7,evar8,evar9,eVar16,eVar19,eVar26,eVar43";
    s.suppressPageView = true;
    s.tl();
}
</script>
User avatar
Gingerbread Man
Posts: 1339
Joined: Fri Aug 12, 2011 5:28 am

Re: Javascript called from a Div.. I think

Post by Gingerbread Man »

pakennedy wrote:I'm trying to come up with a rule to get rid of it
I don't see any issues with the following.

Code: Select all

dailyecho.co.uk##.adwarn
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: Javascript called from a Div.. I think

Post by mapx »

add

Code: Select all

@@||dailyecho.co.uk^$generichide
@@||ad.doubleclick.net^$image,domain=dailyecho.co.uk
hiding adwarn does not work ==> the text in article is blurred
DowntimeAbbey
Posts: 2
Joined: Mon Jan 25, 2016 6:53 pm

Re: Javascript called from a Div.. I think

Post by DowntimeAbbey »

Warrington paper the same. Hit F12, find cookie for newspaper, check row - "nqab = true" delete row, F5 text displays. This is using Chrome - new page, new cookie, so just need a script to catch the cookie and strip the line automatically. :D
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: Javascript called from a Div.. I think

Post by mapx »

add these filters

Code: Select all

@@||warringtonguardian.co.uk^$generichide
@@||ad.doubleclick.net^$image,domain=warringtonguardian.co.uk
DowntimeAbbey
Posts: 2
Joined: Mon Jan 25, 2016 6:53 pm

Re: Javascript called from a Div.. I think

Post by DowntimeAbbey »

Oh cool mapx thank you!
Locked