<commit_before>function Solution(posX, posY, id, raphael) {
    this.parseID(id);
    this.posX = posX;
    this.posY = posY;
    this.data = $.parseJSON(window.data).solutions[id];
    this.raphael = raphael;
    this.upvotes = $.parseJSON(window.data).solutions[this.id].upvotes;
    this.downvotes = $.parseJSON(window.data).solutions[this.id].downvotes;
    this.radius = 10 + (this.upvotes + this.downvotes);
    this.frameSprite = raphael.circle(posX, posY, this.radius + (this.radius * .1)).attr({fill: this.createVoteFrame(), stroke: 'none'});
    this.sprite = raphael.circle(posX, posY, this.radius).attr({fill: '#6DA2FF', stroke: "none", XXX: "SIGNIFIER"});
    this.sprite.node.id = id;
    this.textSprite = undefined;
    this.createText();
    this.frameColor = this.createVoteFrame();
}

Solution.prototype.createText = function () {

    this.textSprite = this.raphael.text(this.posX, (this.posY - 5)).attr({opacity: 0});

    var text = $.parseJSON(window.data).solutions[this.id].title || "Failure";
    if (text.length > 55) {
        text = text.substring(0, 45) + "...";
    };

    var words = text.split(" ");
    var tempText = "";
    for (var i = 0; i < words.length; i++) {
        this.textSprite.attr("text", tempText + " " + words[i]);
        if (this.textSprite.getBBox().width > (1.3 * this.radius)) {
            tempText += "\n" + words[i];
        } else {
            tempText += " " + words[i];
        }
    }

    this.textSprite.attr("text", tempText);
    this.textSprite.attr({ "font-size": ((this.radius * .15) + 3), "font-family": "Opificio", "fill": "#FFFFFF"});
    this.textSprite.node.setAttribute("pointer-events", "none");
};

Solution.prototype.animate = function (direction) { // only called during the initial wave of creates
    var scale = direction == "in" ? "s1.3" : "s1.0";
    var opacity = direction == "in" ? 1 : 0;
    this.sprite.animate({transform: scale}, 400);
    this.textSprite.animate({transform: scale}, 400);
    this.textSprite.animate({opacity: opacity}, 300);//.toFront();
    this.frameSprite.animate({transform: scale}, 400);
};

Solution.prototype.addEventListeners = function () {
    var delegate = this

    var target = delegate.original_id ? $("#" + this.original_id) : $('#' + this.id);

    target.bind({
        click: function () {
            if (!Percolator.isZooming) {
                if (Percolator.isDetailWindowOpen == false) {
                    delegate.original_id ? Percolator.zoomIn($("#" + delegate.original_id)[0]) : Percolator.zoomIn(this);
                    Percolator.currentState = "solution";
                    Comments.appendDiv("solutions", solutionNumber)
                }
                else
                {
                    Percolator.solutionNumber = delegate.id;
                    Percolator.zoomOutAndZoomInOnSolution()
                }
            }
        },
        mouseenter: function () {
            if (!Percolator.isZooming) {
                if (!delegate.original_id) {
                    BubbleGraph.solutions[this.id].animate("in")
                } else {
                    var parsedId = delegate.idParser(delegate.id)
                    BubbleMenu.solutions[parsedId].animate("in")
                }
            }
        },
        mouseleave: function () {
            if (!Percolator.isZooming) {
                if (!delegate.original_id) {
                    BubbleGraph.solutions[this.id].animate("out")
                } else {
                    var parsedId = delegate.idParser(delegate.id)
                    BubbleMenu.solutions[parsedId].animate("out")
                }
            }
        }
    });
};

Solution.prototype.createVoteFrame = function () {
    var upvoteRatio = this.upvotes / (this.upvotes + this.downvotes)
    var downvoteRatio = this.downvotes / (this.upvotes + this.downvotes)
    if (upvoteRatio > downvoteRatio) {
        var r = 255*downvoteRatio;
        var g = 255;
        var b = 0;
    } else {
        var r = 255;
        var g = 255*upvoteRatio;
        var b = 0;
    };
    return rgbToHex(r,g,b);
    function rgbToHex(r,g,b) {return "#"+toHex(r)+toHex(g)+toHex(b)}
    function toHex(n) {
        n = parseInt(n, 10);
        if (isNaN(n)) return "00";
        n = Math.max(0, Math.min(n, 255));
        return "0123456789ABCDEF".charAt((n - n % 16) / 16)
            + "0123456789ABCDEF".charAt(n % 16);
    }
};

Solution.prototype.idParser = function (id) {
    var stringId = id.replace(/_/g, '')
    var numId = parseInt(stringId, "10")
    return numId
}

Solution.prototype.parseID = function (id) {
    if (typeof id === "number") {
        this.id = id;
    } else {
        this.id = id.replace(/_/g, '');
        this.original_id = id
    }
}
<commit_msg>changed scaling for solutions<commit_after>function Solution(posX, posY, id, raphael) {
    this.parseID(id);
    this.posX = posX;
    this.posY = posY;
    this.data = $.parseJSON(window.data).solutions[id];
    this.raphael = raphael;
    this.upvotes = $.parseJSON(window.data).solutions[this.id].upvotes;
    this.downvotes = $.parseJSON(window.data).solutions[this.id].downvotes;
    this.radius = 10 + (this.upvotes + this.downvotes)/2;
    this.frameSprite = raphael.circle(posX, posY, this.radius + (this.radius * .1)).attr({fill: this.createVoteFrame(), stroke: 'none'});
    this.sprite = raphael.circle(posX, posY, this.radius).attr({fill: '#6DA2FF', stroke: "none", XXX: "SIGNIFIER"});
    this.sprite.node.id = id;
    this.textSprite = undefined;
    this.createText();
    this.frameColor = this.createVoteFrame();
}

Solution.prototype.createText = function () {

    this.textSprite = this.raphael.text(this.posX, (this.posY - 5)).attr({opacity: 0});

    var text = $.parseJSON(window.data).solutions[this.id].title || "Failure";
    if (text.length > 55) {
        text = text.substring(0, 45) + "...";
    };

    var words = text.split(" ");
    var tempText = "";
    for (var i = 0; i < words.length; i++) {
        this.textSprite.attr("text", tempText + " " + words[i]);
        if (this.textSprite.getBBox().width > (1.3 * this.radius)) {
            tempText += "\n" + words[i];
        } else {
            tempText += " " + words[i];
        }
    }

    this.textSprite.attr("text", tempText);
    this.textSprite.attr({ "font-size": ((this.radius * .15) + 3), "font-family": "Opificio", "fill": "#FFFFFF"});
    this.textSprite.node.setAttribute("pointer-events", "none");
};

Solution.prototype.animate = function (direction) { // only called during the initial wave of creates
    var scale = direction == "in" ? "s1.7" : "s1.0";
    var opacity = direction == "in" ? 1 : 0;
    this.sprite.animate({transform: scale}, 400);
    this.textSprite.animate({transform: scale}, 400);
    this.textSprite.animate({opacity: opacity}, 300);//.toFront();
    this.frameSprite.animate({transform: scale}, 400);
};

Solution.prototype.addEventListeners = function () {
    var delegate = this

    var target = delegate.original_id ? $("#" + this.original_id) : $('#' + this.id);

    target.bind({
        click: function () {
            if (!Percolator.isZooming) {
                if (Percolator.isDetailWindowOpen == false) {
                    delegate.original_id ? Percolator.zoomIn($("#" + delegate.original_id)[0]) : Percolator.zoomIn(this);
                    Percolator.currentState = "solution";
                    Comments.appendDiv("solutions", solutionNumber)
                }
                else
                {
                    Percolator.solutionNumber = delegate.id;
                    Percolator.zoomOutAndZoomInOnSolution()
                }
            }
        },
        mouseenter: function () {
            if (!Percolator.isZooming) {
                if (!delegate.original_id) {
                    BubbleGraph.solutions[this.id].animate("in")
                } else {
                    var parsedId = delegate.idParser(delegate.id)
                    BubbleMenu.solutions[parsedId].animate("in")
                }
            }
        },
        mouseleave: function () {
            if (!Percolator.isZooming) {
                if (!delegate.original_id) {
                    BubbleGraph.solutions[this.id].animate("out")
                } else {
                    var parsedId = delegate.idParser(delegate.id)
                    BubbleMenu.solutions[parsedId].animate("out")
                }
            }
        }
    });
};

Solution.prototype.createVoteFrame = function () {
    var upvoteRatio = this.upvotes / (this.upvotes + this.downvotes)
    var downvoteRatio = this.downvotes / (this.upvotes + this.downvotes)
    if (upvoteRatio > downvoteRatio) {
        var r = 255*downvoteRatio;
        var g = 255;
        var b = 0;
    } else {
        var r = 255;
        var g = 255*upvoteRatio;
        var b = 0;
    };
    return rgbToHex(r,g,b);
    function rgbToHex(r,g,b) {return "#"+toHex(r)+toHex(g)+toHex(b)}
    function toHex(n) {
        n = parseInt(n, 10);
        if (isNaN(n)) return "00";
        n = Math.max(0, Math.min(n, 255));
        return "0123456789ABCDEF".charAt((n - n % 16) / 16)
            + "0123456789ABCDEF".charAt(n % 16);
    }
};

Solution.prototype.idParser = function (id) {
    var stringId = id.replace(/_/g, '')
    var numId = parseInt(stringId, "10")
    return numId
}

Solution.prototype.parseID = function (id) {
    if (typeof id === "number") {
        this.id = id;
    } else {
        this.id = id.replace(/_/g, '');
        this.original_id = id
    }
}

{'fraction_non_alphanumeric': 0.15634804434218783, 'fraction_numerical': 0.018301610541727673, 'mean_word_length': 2.152983844378503, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5430160', 'n_tokens_mistral': 3242, 'n_tokens_neox': 3041, 'n_words': 557}