vitaminb16 / r/Second leaderboard

// ==UserScript==
// @name         r/Second leaderboard
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://second-api.reddit.com/leaderboard?start_index=0&batch_size=100
// @require      https://code.jquery.com/jquery-3.4.1.min.js
// @grant        none
// @license      MIT
// ==/UserScript==

$(document).ready(function () { //When document has loaded

    //always selects the second highest picture at the very end of the first reveal

    setTimeout(function () {
        var i = 0;
        var name = "";
        var score = [];
        var scoreDiff1 = "";
        var scoreDiff0 = "";
        var scoreDiff10 = "";
        var avgDiff = "";
        for (i=0; i < 100; i++)
        {
            name = jQuery(document.querySelector('afd2021-app faceplate-csrf-provider afd2021-leaderboard').shadowRoot).find('.row  ').find('.user-info .user-name')[i].textContent
            score[i] = parseInt(jQuery(document.querySelector('afd2021-app faceplate-csrf-provider afd2021-leaderboard').shadowRoot).find('.row  ').find('.user-score')[i].textContent)
            scoreDiff1 = String(score[i-1] - score[i]);
            scoreDiff10 = String(score[9] - score[i]);
            scoreDiff0 = String(score[0] - score[i]);
            avgDiff = String(Math.floor(score.reduce((a, b)=> a + b)/(i+1) - score[i]));
            if (i > 9)
            {
                jQuery(document.querySelector('afd2021-app faceplate-csrf-provider afd2021-leaderboard').shadowRoot).find('.row  ').find('.user-score')[i].textContent = String(score[i]).concat(" (",scoreDiff1," || ",scoreDiff10," || ",scoreDiff0," || ",avgDiff,")")
            }
            if (i < 10 && i > 0)
            {
                jQuery(document.querySelector('afd2021-app faceplate-csrf-provider afd2021-leaderboard').shadowRoot).find('.row  ').find('.user-score')[i].textContent = String(score[i]).concat(" (",scoreDiff1," || ",scoreDiff0," || ",avgDiff,")")
            }
            //if (name == "u/VitaminB16") {break}
        }
    }, 100);

    setTimeout(function () {
        location.reload();
    }, 10000);

});