Giter Site home page Giter Site logo

sitexw / blockadblock Goto Github PK

View Code? Open in Web Editor NEW
612.0 33.0 120.0 16 KB

Allows you to detect the extension AdBlock (and other)

Home Page: http://fuckadblock.sitexw.fr/blockadblock/

License: MIT License

JavaScript 100.00%
adblock adblocker blockadblock

blockadblock's People

Contributors

master3395 avatar sitexw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blockadblock's Issues

Example site fails to detect uBlock Origin

image

Google Chrome	55.0.2883.87 (Official Build) (64-bit)
Revision	ad0be09aa3ca814168d079b52825f6f80e22f0e8-refs/branch-heads/2883@{#723}
OS	        Linux 
JavaScript	V8 5.5.372.32

Using blockAdBlock.on strange behaviour

i want to display a special div depending on whatever adBlock is detected or not (in both case, i must passthru a function in other to make other things like logs, etc ). But the problem is when i use blockAdBlock.on(true, {function1}); blockAdBlock.on(false, {function2}); {function1} is still executed. Is there a way to not execute my {function1} if blockAdBlock.on is FALSE ?

if(typeof blockAdBlock === 'undefined') {
testIfUserFromFrance(); /* display div1|div2, if from France or Not */
} else {
blockAdBlock.on(true , testIfUserFromFrance() ); /* display div1|div2, if from France or Not */
blockAdBlock.on(false, adBlockDefault); /* display the div3, if AdBlock is false (default beheavior) */
}

uBlock Origin support

Hi, is there a way to detect also uBlock Origin, are you planning to make an updated version in the near future? Thank your for your work.

Adblock on hidden iframe

I am calling website A from website B in a hidden iframe, i have adblock checks in that hidden iframe and even though i have disabled adblocks it says they are active. Is there a way to fix this?

_destroyBait needs to check for existence of bait before trying to remove it

From looking at the errors in our Sentry setup I can see that there are cases where the bait has already been removed by someone before the library calls the _destroyBait method here:

window.document.body.removeChild(this._var.bait);

Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

Since the library theoretically emits the events after removing the bait, this will never happen in case the above throws.

Ideally the library would simply check if the bait is still in the DOM before trying to remove it.

False positives on low-zoom and/or high-pixel-ratio

Steps to replicate

  1. Go to https://fuckadblock.sitexw.fr/blockadblock/ without an adblocker enabled on Chrome (v70+)
  2. Ensure browser zoom level is 100% and note value of window.devicePixelRatio
  3. If window.devicePixelRatio == 1 then zoom out to 33% and refresh page.
    • Outcome: AdBlocker detected
    • Desired: AdBlocker should not be detected
    • N.b. If window.devicePixelRatio > 1 (i.e. testing on a retina screen) zoom level and window dimensions may differ slightly to above.

Technical issue

The above steps mean this._var.bait.offsetHeight, this._var.bait.offsetWidth, this._var.bait.clientHeight, this._var.bait.clientWidth all equal zero and flag detected.

Why does `check` method always return `true`?

Calling the check method on either the default blockAdBlock instance, or on a newly instantiated instance, will always return true, whether AdBlock is paused or unpaused. Why is that?

AdBlock for Mac Chrome version 3.8.4
Chrome for Mac version Version 55.0.2883.95
Mac OS X "El Capitan" (10.11.6)

Misleading Name

I think it is misleading that it is called blockadblock if it does not block adblock.

Thanks for reading!

By the way great script!

Multiple instances

Hey there.. first i want to say that your script is exactly what im looking for but, in my case it wont work as expected.

It blocks / replaces one entry fine but as soon as i add a secound id="..." to check again it fails..

testet the same behaviour on your site, seems like you cant have multiply requests at the same time..

(in my example i have 4 ads in a row that should be replaced with other images as soon as adb is detected, first one works fine, the other 3 get ignored)

what can i do?

Fails to detect changes in ad blocker's status.

If I visit the online example page, the page correctly displays the status of my ad blocker.

However if I pause the ad blocker and click the example page's "check again" button, the previous status is repeated.

Software versions:
AdBlock for Mac Chrome version 3.8.4
Chrome for Mac version Version 55.0.2883.95
Mac OS X "El Capitan" (10.11.6)

Console logs:

blockadblock.js:57 [BlockAdBlock][setOption] The option "debug" he was assigned to "true"
blockadblock.js:57 [BlockAdBlock][on] A type of event "detected" was added
blockadblock.js:57 [BlockAdBlock][on] A type of event "notDetected" was added
blockadblock.js:57 [BlockAdBlock][onload->eventCallback] A check loading is launched
blockadblock.js:57 [BlockAdBlock][_creatBait] Bait has been created
blockadblock.js:57 [BlockAdBlock][check] An audit was requested with a loop
blockadblock.js:57 [BlockAdBlock][check] A check is in progress ...
blockadblock.js:57 [BlockAdBlock][_checkBait] A check (1/5 ~1ms) was conducted and detection is positive
blockadblock.js:57 [BlockAdBlock][_stopLoop] A loop has been stopped
blockadblock.js:57 [BlockAdBlock][_destroyBait] Bait has been removed
blockadblock.js:57 [BlockAdBlock][emitEvent] An event with a positive detection was called
blockadblock.js:57 [BlockAdBlock][emitEvent] Call function 1/1
blockadblock.js:57 [BlockAdBlock][clearEvent] The event list has been cleared
// Pausing AdBlock and re-checking...
undefined
blockadblock.js:57 [BlockAdBlock][on] A type of event "detected" was added
blockadblock.js:57 [BlockAdBlock][on] A type of event "notDetected" was added
blockadblock.js:57 [BlockAdBlock][check] An audit was requested with a loop
blockadblock.js:57 [BlockAdBlock][_creatBait] Bait has been created
blockadblock.js:57 [BlockAdBlock][check] A check is in progress ...
blockadblock.js:57 [BlockAdBlock][_checkBait] A check (1/5 ~1ms) was conducted and detection is positive
blockadblock.js:57 [BlockAdBlock][_stopLoop] A loop has been stopped
blockadblock.js:57 [BlockAdBlock][_destroyBait] Bait has been removed
blockadblock.js:57 [BlockAdBlock][emitEvent] An event with a positive detection was called
blockadblock.js:57 [BlockAdBlock][emitEvent] Call function 1/1
blockadblock.js:57 [BlockAdBlock][clearEvent] The event list has been cleared

most basic adblock detection api

const adsEnabled = async () => {
 let ads = true;
    try {
      const url = `https://ads.google.com?=${new Date().getTime()}`;
      await fetch(url, { mode: "no-cors" });
    } catch (error) {
      if (error.message === "Failed to fetch") {
        ads = false;
      }
    }
return ads;
  };

// check 

const isAdEnabled = await adsEnabled();
console.log(isAdEnabled);

possible to have a toggle return ?

just wondering if it possible to return a simple true|false statement on test... it may be simplier to integrate with already custom js script.

example :

if(typeof blockAdBlock === 'undefined') {
            adb = 0; /* 0 = false */
        } else {
            adb = blockAdBlock.toggleTestReturn(); /* return 0 or 1 */
        }

Detect ADBlock dynamic

The BlockAdBlock would detect correctly only when page refresh.
I turn on and off adblock after a while, BlockAdBlock cannot detect.

It suppose to detect the correct result whenever I call BlockAdBlock.check()

bower install fuck-adblock

Bonjour!

You've still got bower install fuck-adblock on your demo site. Awesome lib, look forward to using and contributing!

Cliqz Browser

I tested the demo page with Cliqz Browser and it seems that this adblocker does not get detected from the script?

FuckAdBlock and BlockAdBlock vs uBlock

I understand that they're supposed to be the same, but FuckAdBlock works against uBlock, BlockAdBlock does not (according to the demo).

screen shot 2017-03-02 at 14 47 41

screen shot 2017-03-02 at 14 47 57

EDIT: I just noticed FuckAdBlock was running Beta V4.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.