vitaminb16 / r/Second

// ==UserScript==
// @name         r/Second
// @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 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]
                bar2 = jQuery(document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector( 'afd2021-votes' ).shadowRoot.querySelector('#chart')).find('.votes-bar')[1]
                bar3 = jQuery(document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector( 'afd2021-votes' ).shadowRoot.querySelector('#chart')).find('.votes-bar')[2]
                if (bar1.className == "votes-bar winner")
                {
                    jQuery(document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector( 'afd2021-round').shadowRoot.querySelector( 'faceplate-form')).find('button')[0].click()
                }
                if (bar2.className == "votes-bar winner")
                {
                    jQuery(document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector( 'afd2021-round').shadowRoot.querySelector( 'faceplate-form')).find('button')[1].click()
                }
                if (bar3.className == "votes-bar winner")
                {
                    jQuery(document.querySelector("afd2021-app faceplate-alert-reporter afd2021-embed").shadowRoot.querySelector( 'afd2021-round').shadowRoot.querySelector( 'faceplate-form')).find('button')[2].click()
                }
            }
        }, 100);
        // Your code here...
    }, 3000); //0.4 seconds will elapse and Code will execute.




});