Api and options

We detected that you are not using adblocker. We did so by running following little snippet:


            adblockDetect(function(adblockDetected) {

                $('.adblockDetectedText').text(
                    adblockDetected ? 'using adblocker' : 'not using adblocker'
                );

            });
        

Because of nature of ad blockers test has to be asynchronous. A user provided callback is called with parameter that is either true or false.

Options can be defined on invocation via second parameter:


            adblockDetect(function(adblockDetected) {

                if (adblockDetected) {
                    console.log('Ad blocker is detected');
                } else {
                    console.log('Ad blocker is not detected');
                }

            }, {
                testInterval: 40,
                testRuns: 5
            });
        

If you plan to run ad block check multiple times and want to define options before all that function calls you can alter library defaults in following namespace:


            adblockDetect.defaults = {
                testNodeClasses: 'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links',
                testNodeStyle: 'height: 10px !important; font-size: 20px; color: transparent; position: absolute; bottom: 0; left: -10000px;',
                testInterval: 51,
                testRuns: 4
            };