Re: Is there a way to refuse changes?

40 views
Skip to first unread message

Rafael Weinstein

unread,
Jan 8, 2015, 4:18:09 PM1/8/15
to mutation-sum...@googlegroups.com
No, there is no way to "reject" a change. You can attempt to undo the change by making further changes, but that is up to you to accomplish.

On Thu, Jan 8, 2015 at 7:53 AM, Ole Albers <olet...@gmail.com> wrote:

Scenario: Chrome Extension listens on content changes of a specific website.

When the Website adds a DIV with a specific class I want to reject that change and/or add additional content to that DIV.

I did not find a way to achieve this. This is my example code:

var observer = new MutationObserver(function (mutations) {
        mutations.forEach(function (mutation) {
            [].slice.call(mutation.addedNodes).forEach(function (addedNode) {
               StartFilter(addedNode);                    

            });
        });
    });

    observer.observe(document, {
        childList: true,
        subtree:true,
        characterData:true,
        attributes:true        
    });

function StartFilter(newNode) {
   $(newNode).find('.Xx.xJ:Contains("wham")').closest("[jsmodel='XNmfOc']").hide();
}

the content inside "newNode" is hidden but that does not appear to have any effect on the site itself.

--
You received this message because you are subscribed to the Google Groups "mutation-summary-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mutation-summary-d...@googlegroups.com.
To post to this group, send email to mutation-sum...@googlegroups.com.
Visit this group at http://groups.google.com/group/mutation-summary-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages