Raw Source
ExaPaw / Reddit comment vote between arrows

// ==UserScript==
// @name       Reddit comment vote between arrows
// @version    0.3
// @description  Displays the vote count of a comment between upvote/downvote arrows
// @copyright  2014, ExaPaw
// @website http://www.reddit.com/u/ExaPaw
// @include http://*.reddit.com/*/*/comments/*
// @updateURL http://exapawdevtest.bplaced.net/userscripts/us_reddit_comment_score_between_arrows.meta.js
// @downloadURL http://exapawdevtest.bplaced.net/userscripts/us_reddit_comment_score_between_arrows.js
// ==/UserScript==

var voteAreaElements = document.getElementsByClassName('midcol');

for (t=0; t<voteAreaElements.length; t++) {
    
    // get the correct upvote arrow element
    var arrowUpElement = voteAreaElements[t].getElementsByClassName('arrow')[0]; 
    
    var targetDiv = null; 
    var newDiv = null;  
    
    var stringScore = null;
    var integerScore = null;
    
    var className = null;
    var scoreColor = null;
    
    if (arrowUpElement.parentElement.nextSibling.lastChild != null && arrowUpElement.parentElement.nextSibling.lastChild.firstChild != null &&arrowUpElement.parentElement.nextSibling.className.indexOf('reddit-entry') > -1) {
        stringScore = arrowUpElement.parentElement.nextSibling.lastChild.firstChild.textContent;
        stringScore = stringScore.substring(0,stringScore.indexOf(' '));
    } else {
        if (arrowUpElement.parentElement.nextSibling.lastChild != null && arrowUpElement.parentElement.nextSibling.lastChild.firstChild != null && arrowUpElement.parentElement.nextSibling.lastChild.firstChild.className == "tagline") {
            stringScore = arrowUpElement.parentElement.nextSibling.lastChild.firstChild.getElementsByClassName('score')[0].textContent;
            stringScore = stringScore.substring(0,stringScore.indexOf(' '));
        } else {
            continue;
        }
    }
    
    for (i=0; i<3; i++) {
        
        switch (i) {
            case 0:
                integerScore = parseInt(stringScore);
                className = "score dislikes";
                scoreColor = "#9494ff";
                break;
            case 1:
                integerScore += 1;
                className = "score unvoted";
                scoreColor = "#636363";
                break;
            case 2:
                integerScore += 1;
                className = "score likes";
                scoreColor = "#ff8b60";
                break;
        }
        
        // create a new div element
        var newDiv = document.createElement("div"); 
        // create a new text node containing the score
        var newContent = document.createTextNode(integerScore); 
        // append the text node to the div element
        newDiv.appendChild(newContent);
        // set the attribute 'class' to 'score unvoted' and assign it
        var attribute = document.createAttribute("class");
        attribute.nodeValue = className;
        newDiv.setAttributeNode(attribute);
        
        newDiv.style.textAlign = "center";
        
        newDiv.style.fontWeight = "bold";
        newDiv.style.color = scoreColor;
        newDiv.style.zIndex = 100;
        arrowUpElement.parentNode.style.width = "inherit";
        
        // reference the correct arrowupelement
        targetDiv = arrowUpElement; 
        //determine the parent node
        var parentDiv = targetDiv.parentNode;
        //insert the div after the upvote arrow
        parentDiv.insertBefore(newDiv, targetDiv.nextSibling);
    }
}