Olá, bem-vind@!

Quer participar e contribuir? Clique no botão "Registrar-se" se é sua primeira vez aqui. Se você já é um dos nossos, clique em "Entrar".

Fix for February changes

About: Facebook unsponsored

I managed to get the script working again after the February changes by adding a new selector and filtering out zero-opacity elements in preCompare, line 30-53:

        // Sponsored
        'selector': [
            'div[id^=feed_subtitle] > s div > a > div',
            'div[id^=feed_subtitle] > span > div > div > a > div',
            'div[id^=feed_subtitle] > span > a > div',
            'a.uiStreamSponsoredLink',
            'a[rel=dialog-post] > span > span'
        ],
        'preCompare': function(node) {
            var childIterator;
            var fontSize;
            var opacity;
            var toCompare = node[nodeContentKey];
            if(node.children.length) {
                toCompare = '';

                for(childIterator = 0; childIterator < node.children.length; childIterator++) {
                    fontSize = parseInt(window.getComputedStyle(node.children[childIterator], null).fontSize, 10);
                    opacity = parseInt(window.getComputedStyle(node.children[childIterator], null).opacity, 10);
                    if(fontSize > 0 && opacity > 0) {
                        toCompare += node.children[childIterator][nodeContentKey];
                    }
                }
            }

            return toCompare;
        },

Comentários

  • How do I try this change?
    Do I just copy and paste it on those lines?
    Sorry, I'm not used to editing scripts, I am just a user, but those sponsored posts really annoy me

  • Thanks, it worked!

  • @Thamiris Travassos said:
    How do I try this change?
    Do I just copy and paste it on those lines?
    Sorry, I'm not used to editing scripts, I am just a user, but those sponsored posts really annoy me

    If you edit the original script, you will see a very similar section that starts with:

    // Sponsored

    and ends with

    return toCompare;
    },

    Simply replace that section with the code provided by kimsey0.

  • I'm still seeing the Sponsored posts with the changes. I'm using v1.20. Is it possible for you to paste the entire script?

  • Here's the full script: https://pastebin.com/raw/LfXV9bmg
    If it doesn't work for you, I'm not sure there's much I can do.

  • They updated mine again. Here's another fix that worked for me:

            // Sponsored
            'selector': [
                'div[id^=feed_subtitle] > s div > a > div',
                'div[id^=feed_subtitle] > span > span > span > span > s',
                'div[id^=feed_subtitle] > span > div > div > a > div',
                'div[id^=feed_subtitle] > span > a > div',
                'a.uiStreamSponsoredLink',
                'a[rel=dialog-post] > span > span'
            ],
            'preCompare': function(node) {
                var toCompare = node[nodeContentKey];
                if(node.children.length) {
                    toCompare = '';
    
                    for(var childIterator = 0; childIterator < node.children.length; childIterator++) {
                        var child = node.children[childIterator];
                        if (child.childElementCount == 1) {
                            child = child.firstChild;
                        }
    
                        var computedStyle = window.getComputedStyle(child, null);
                        var fontSize = parseInt(computedStyle.fontSize, 10);
                        var opacity = parseInt(computedStyle.opacity, 10);
                        var display = computedStyle.display;
    
                        if(fontSize > 0 && opacity > 0 || display == "none") {
                            toCompare += node.children[childIterator][nodeContentKey];
                        }
                    }
                }
    
                return toCompare;
            },
    
  • Vielen Dank kimsey0! Bitte forke dieses Projekt, falls es inaktiv ist.

  • is there a way to add to this script so it hides this annoying "recommended people to follow"?

  • @thaliel: Better make a separate post about that.

Entre ou Registre-se para fazer um comentário.