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

Blocked by uBlock Origin #9

@thomasjthomasj

Description

@thomasjthomasj

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions