Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Blocked by uBlock Origin #9

Open
thomasjthomasj opened this issue Aug 19, 2016 · 0 comments
Open

Blocked by uBlock Origin #9

thomasjthomasj opened this issue Aug 19, 2016 · 0 comments

Comments

@thomasjthomasj
Copy link

The YAFA ads are being blocked on EG by uBlock Origin when used in Firefox, thanks to this addition: https://github.com/uBlockOrigin/uAssets/blob/10d0289b32549f1996df5983e518d5800e52c790/filters/filters.txt#L585

This is fixable using the MutationObserver class in JavaScript, but older versions of IE don't support it, and it also prevents people (like us!) from being able to edit styles via the element inspector, which could prove to be a pickle!

The basic code to do so looks something like this:

var observerOptions = {attributes: true, attributeFilter : ['style'], attributeOldValue: true}
    ,observer = (typeof MutationObserver !== 'undefined') ?
        new MutationObserver(function (mutations) {
            mutations.forEach(function (mutation) {
                if (mutation.attributeName == 'style') {
                    observer.disconnect();
                    mutation.target.setAttribute('style', mutation.oldValue);
                    observer.observe(mutation.target, observerOptions);
                }
            });
        }) : null
});
if (observer) {
    observer.observe(target, observerOptions);
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant