netuoso / Unhide Downvoted Comments on SteemIt.com

// ==UserScript==
// @name         Unhide Downvoted Comments on SteemIt.com
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Unhide downvoted comments on SteemIt in order to help investigate the posts.
// @author       netuoso
// @match        https://steemit.com/*
// @grant        none
// ==/UserScript==

function unhideDownvoted() {
	revealCommentButtons = document.getElementsByClassName('marginLeft1rem');
	revealHiddenImagesButtons = document.getElementsByClassName('MarkdownViewer__negative_group');

	while (revealCommentButtons.length > 0) {
		for (i=0;i<revealCommentButtons.length;i++) {
			revealCommentButtons[i].parentElement.parentElement.className = [""];
			revealCommentButtons[i].parentElement.parentElement.style.color = "red";
			revealCommentButtons[i].click();
			for (j=0;j<revealHiddenImagesButtons.length;j++) {
				revealHiddenImagesButtons[j].click();
			}
		}
		revealCommentButtons = document.getElementsByClassName('marginLeft1rem');
	}
}

/*--- Note, gmMain () will fire under all these conditions:
    1) The page initially loads or does an HTML reload (F5, etc.).
    2) The scheme, host, or port change.  These all cause the browser to
       load a fresh page.
    3) AJAX changes the URL (even if it does not trigger a new HTML load).
*/
var fireOnHashChangesToo    = true;
var pageURLCheckTimer       = setInterval (
    function () {
        if ( this.lastPathStr  !== location.pathname || this.lastQueryStr !== location.search || (fireOnHashChangesToo && this.lastHashStr !== location.hash) ) {
            this.lastPathStr  = location.pathname;
            this.lastQueryStr = location.search;
            this.lastHashStr  = location.hash;
            gmMain ();
        }
    }, 111
);

function gmMain () {
    // Create a button called "Hide Resteemed Posts"
    var unhideWrapper = document.createElement("li");
    unhideWrapper.id = "unhideDownvotedLink";
    unhideWrapper.className = "unhideDownvotedScript";
    var enableLink = document.createElement("a");
    enableLink.innerHTML = "unhide downvoted comments";
    enableLink.onclick = function() { unhideDownvoted(); };
    enableLink.style.pointer = "cursor";
    unhideWrapper.appendChild(enableLink);

    try {
        // Append the link to the navigation bar on the top of the screen
        if (window.location.href.indexOf("@") > 0 && window.location.href.indexOf("feed") < 0) {
            if (document.getElementsByClassName("unhideDownvotedScript").length === 0) {
                document.getElementsByClassName('HorizontalMenu')[0].appendChild(unhideWrapper);
            } else {
                document.getElementsByClassName("unhideDownvotedScript")[0].style.display = "inline-block";
            }
        } else {
            if (document.getElementsByClassName("unhideDownvotedScript").length > 0) {
                for (i=0;document.getElementsByClassName("unhideDownvotedScript").length;i++) {
                    document.getElementsByClassName("unhideDownvotedScript")[i].style.display = "none";
                }
            }
        }
    } catch (e) {}
}