Skip to content Skip to sidebar Skip to footer

Domnodeinserted Event Loop

I am developing a chrome extension (my fourth question or so...) for facebook, which adds a custom button beside the 'like' button. Since posts are added automatically to the news

Solution 1:

Does this work? Providing that you don't insert any more .like_link elements, this should be a no-op when your element insertion happens, since it only looks for node insertions which contain a .like_link.

$(document).bind('DOMNodeInserted', function(event) {
    $(event.target).find(".like_link").after(
        '<span class="dot"> · </span>' +
        '<button class="taheles_link stat_elem as_link" title="תגיד תכל&acute;ס" type="submit" name="taheles" onclick="apply_taheles()" data-ft="{&quot;tn&quot;:&quot;&gt;&quot;,&quot;type&quot;:22}">' +
            '<span class="taheles_default_message">תכל&acute;ס</span><span class="taheles_saving_message">לא תכלס</span>' +
        '</button>'
    );
    $(event.target).find(".taheles_saving_message").hide();
});

Post a Comment for "Domnodeinserted Event Loop"