CoderCo / Heat Downloader

// ==UserScript==
// @name Heat Downloader
// @description Add Download Button 
// @version 1.1
// @author CoderCo
// @license MIT
// @match        https://www.patreon.com/heatgame/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=patreon.com
// @grant        none
// ==/UserScript==

function run() {
    var post_list = document.querySelectorAll('div[data-tag="post-card"]');
    if(post_list.length == 0) { setTimeout(run, 1000); return; }
    for (var i = 0; i < post_list.length; i++) {
        var post_title = post_list[i].querySelector('span[data-tag="post-title"]');
        var text = post_title.innerText.split(" ");
        if (text[0] != "Heat") { continue; }
        var link = "https://anthroheat.net/Anthro%20Heat%20"
        if (text[2] == "Milestone") {
            link += text[1] + "%20Milestone.7z";
        } else if (text[2] == "Test"){
            link += text[1] + ".7z";
        }
        post_list[i].innerHTML =
            "<a class=\"btn\" style=\" position: relative;top: 45px;left: -100px;border: 1px solid;border-radius: 5px;padding: 3px; \" target=\"_blank\" rel=\"noopener noreferrer\" href=\"" +
            link +
            "\">Download</a>" + post_list[i].innerHTML;
    }
}

(function() {
    setTimeout(run, 2000);
})();