extension/script.js
/**
 * Checks the page for all currently unprocessed tweets and applies our changes to it.
 */
Checks the page for all currently unprocessed tweets and applies our changes to it.
Checks the page for all currently unprocessed tweets and applies our changes to it .
function performCheck() {
    const {pathname} = document.location;
    const availableTweets = [...document.querySelectorAll(TWEET_SELECTOR)];
    if (regexTest(SINGLE_TWEET_PATTERN, pathname)) {
        const mainTweet = availableTweets.find(tweet => {
            return tweet.querySelectorAll(`a[href="${pathname}"]`).length !== 0;
        });
        const otherTweets = availableTweets.filter(t => t !== mainTweet);
        handleFeed(otherTweets);
    } else {
        handleFeed(availableTweets);
    }
}
function performCheck ( ) { const { pathname } = document . location ; const availableTweets = [ ... document . querySelectorAll ( TWEET_SELECTOR ) ] ; if ( regexTest ( SINGLE_TWEET_PATTERN , pathname ) ) { const mainTweet = availableTweets . find ( tweet => { return tweet . querySelectorAll ( ` ${ pathname } ` ) . length !== 0 ; } ) ; const otherTweets = availableTweets . filter ( t => t !== mainTweet ) ; handleFeed ( otherTweets ) ; } else { handleFeed ( availableTweets ) ; } }
Checks the page for all currently unprocessed tweets and applies our changes to it.
Checks the page for all currently unprocessed tweets and applies our changes to it .
// Query all tweets available on the page and wrap in properly iterable array. // Currently we cannot process the "main tweet" if on a status page. // The idea here is to extend this in the future so we can both: // a) Show ratio bar on the "main tweet" // b) Show if a reply outperforms the original tweet // Main tweet is identified by a contained link to the current url.