vitaminb16 / r/Second Win Rate

// ==UserScript==
// @name         r/Second Win Rate
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  try to take over the world!
// @author       You
// @match        https://second-api.reddit.com/*
// @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
  var score = 0;
  var i = 0;
  var L = [];
  var scoreStr = "";
  var secondsLeft = 0;
  setTimeout(function () {
    var intervalId = window.setInterval(function () {
      secondsLeft = jQuery(document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector('#wrapper')).find('afd2021-round-progress-bar')[0].secondsLeft
      score = 0;
      if (secondsLeft > 47 && secondsLeft < 48) {
        document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector('afd2021-bottom-links').shadowRoot.querySelector('.vote-history-link.button').click()
        setTimeout(function () {
          L = document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector('afd2021-bottom-links').shadowRoot.querySelector('afd2021-vote-history afd2021-vote-history').children
          for (i = 0; i < (L.length - 1); i++) {
            score = score + Math.max(0, Math.sign(parseInt(L[i].shadowRoot.querySelector('.round-score').textContent)))
          }
          score = String(score)
          document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector('afd2021-bottom-links').shadowRoot.querySelector('.close').click()

          scoreStr = String(document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector('#wrapper afd2021-header').totalScore)
          document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector('#wrapper afd2021-header').totalScore = scoreStr.concat(" (", score, "/10)")
        }, 1500);
      }
    }, 100);
    // Your code here...
  }, 3000)
}) //0.4 seconds will elapse and Code will execute.