vitaminb16 / r/Second (taken) bad

// ==UserScript==
// @name         r/Second (taken) bad
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://second-api.reddit.com/*
// @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 secondsLeft = 0;
        var bar1 = "";
        var bar2 = "";
        var bar3 = "";
        var minheight = 0;
        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
            if (secondsLeft < 29) {
                bar1 = jQuery(document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector('afd2021-votes').shadowRoot.querySelector('#chart')).find('.votes-bar')[0].style.height
                bar2 = jQuery(document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector('afd2021-votes').shadowRoot.querySelector('#chart')).find('.votes-bar')[1].style.height
                bar3 = jQuery(document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector('afd2021-votes').shadowRoot.querySelector('#chart')).find('.votes-bar')[2].style.height
                bar1 = parseFloat(bar1)
                bar2 = parseFloat(bar2)
                bar3 = parseFloat(bar3)
                if (bar1 == Math.min(bar1, bar2, bar3)) {
                    if (bar2 <= bar3 - 25) {
                        minheight = bar2
                    } else {
                        minheight = bar3
                    }
                } else if (bar2 == Math.min(bar1, bar2, bar3)) {
                    minheight = Math.min(bar1, bar3)
                } else if (bar3 == Math.min(bar1, bar2, bar3)) {
                    if (bar2 <= bar1 - 25) {
                        minheight = bar2
                    } else {
                        minheight = bar1
                    }
                }
            }
            if (secondsLeft < 5)
            {
                if (bar3 == minheight) {
                    jQuery(document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector('afd2021-round').shadowRoot.querySelector('faceplate-form')).find('button')[0].click()
                }
                if (bar1 == minheight) {
                    jQuery(document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector('afd2021-round').shadowRoot.querySelector('faceplate-form')).find('button')[2].click()
                }
                if (bar2 == minheight) {
                    jQuery(document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector('afd2021-round').shadowRoot.querySelector('faceplate-form')).find('button')[1].click()
                }
            }
        }, 100);
        // Your code here...
    }, 3000); //0.4 seconds will elapse and Code will execute.

});