<commit_before>/* Licensed under the MIT license:
 * http://www.opensource.org/licenses/mit-license.php
 * Copyright (c) 2010 Mr.doob, rhyolight, bebraw
 */
function brushes() {
    this.init();
}
brushes.prototype = {
    brushOptions: {'size': {'min': 1, 'max': 30, 'value': 1},
        'opacity': {'min': 0, 'max': 100, 'value': 50},
        'location': {}},
    init: function () {
        this.selected = BRUSHES[0];
    },
    initUI: function () {
        setUpPod("Brushes");

        $('#brushesPod').click(function() {
            $(this).css('visibility', 'hidden'); //hide();
            $('#brushesCheckbox').attr('checked', false);
            $('#brushesPanel').dialog('open');
        });

        // set up brushes panel
        panelWidth = 150;
        $("body").append(
            '<div class="panel" id="brushesPanel" title="Brushes"> \
                <div id="brushes" style="height:170px;overflow:auto;"></div> \
                <div id="brushOptions"></div> \
            </div>'
        );

        $("#brushesPanel").dialog({
            closeOnEscape: false, resizable: true,
            width: panelWidth, minWidth: panelWidth, maxWidth: 360,
            height: 370, minHeight: 410,
            autoOpen: false
        });

        $("#brushesPanel").dialog("option", "position", "left");
        $("#brushesPanel").bind("dialogclose", function(event, ui) {
            $("#brushesPod").css("visibility", "visible");}
        );

        for (var brushOptionName in this.brushOptions) {
            brushOptionValue = this.brushOptions[brushOptionName];

            $("#brushOptions").append('<div style="width:100%; margin-top:1em;">');

            optionTitle = capitalizeFirstLetter(brushOptionName);
            $("#brushOptions").append('<div style="float:left;">' + optionTitle + ':</div>');

            optionId = 'brush' + brushOptionName;
            if(brushOptionValue) {
                $("#brushOptions").append('<div style="float:right; width: 48%" id="' + optionId + '"></div>');

                $("#" + optionId).slider({
                    range: "max",
                    min: brushOptionValue.min,
                    max: brushOptionValue.max,
                    value: brushOptionValue.value,
                    slide: function(event, ui) {
                        // XXX: hack! figure out a nicer way to pass option name!
                        option = $(this).attr('id').replace('brush', '');
                        panels['brushes'].brushOptions[option].value = ui.value;
                        panels['brushes'].renderBrushPreviews();
                    }
                });
            }

            $("#brushOptions").append('<div style="clear:both;"></div>');

            jitterToggleId = optionId + 'JitterToggle';
            jitterAmountId = optionId + 'JitterAmount';
            $("#brushOptions").append(
                '<div class="jitter"> \
                    <input type="checkbox" style="float:left;" id="' +
                        jitterToggleId + '" /><label for="' + jitterToggleId +
                        '">Jitter</label> \
                    <div style="float:right; width: 48%; margin-top: 0.5em;" id="' + jitterAmountId + '"></div> \
                </div> \
                <div style="clear:both;"></div> \<commit_msg>Made sure slider does not get rendered for brush location.<commit_after>/* Licensed under the MIT license:
 * http://www.opensource.org/licenses/mit-license.php
 * Copyright (c) 2010 Mr.doob, rhyolight, bebraw
 */
function brushes() {
    this.init();
}
brushes.prototype = {
    brushOptions: {'size': {'min': 1, 'max': 30, 'value': 1},
        'opacity': {'min': 0, 'max': 100, 'value': 50},
        'location': {}},
    init: function () {
        this.selected = BRUSHES[0];
    },
    initUI: function () {
        setUpPod("Brushes");

        $('#brushesPod').click(function() {
            $(this).css('visibility', 'hidden'); //hide();
            $('#brushesCheckbox').attr('checked', false);
            $('#brushesPanel').dialog('open');
        });

        // set up brushes panel
        panelWidth = 150;
        $("body").append(
            '<div class="panel" id="brushesPanel" title="Brushes"> \
                <div id="brushes" style="height:170px;overflow:auto;"></div> \
                <div id="brushOptions"></div> \
            </div>'
        );

        $("#brushesPanel").dialog({
            closeOnEscape: false, resizable: true,
            width: panelWidth, minWidth: panelWidth, maxWidth: 360,
            height: 370, minHeight: 410,
            autoOpen: false
        });

        $("#brushesPanel").dialog("option", "position", "left");
        $("#brushesPanel").bind("dialogclose", function(event, ui) {
            $("#brushesPod").css("visibility", "visible");}
        );

        for (var brushOptionName in this.brushOptions) {
            brushOptionValue = this.brushOptions[brushOptionName];

            $("#brushOptions").append('<div style="width:100%; margin-top:1em;">');

            optionTitle = capitalizeFirstLetter(brushOptionName);
            $("#brushOptions").append('<div style="float:left;">' + optionTitle + ':</div>');

            optionId = 'brush' + brushOptionName;
            if('value' in brushOptionValue) {
                $("#brushOptions").append('<div style="float:right; width: 48%" id="' + optionId + '"></div>');

                $("#" + optionId).slider({
                    range: "max",
                    min: brushOptionValue.min,
                    max: brushOptionValue.max,
                    value: brushOptionValue.value,
                    slide: function(event, ui) {
                        // XXX: hack! figure out a nicer way to pass option name!
                        option = $(this).attr('id').replace('brush', '');
                        panels['brushes'].brushOptions[option].value = ui.value;
                        panels['brushes'].renderBrushPreviews();
                    }
                });
            }

            $("#brushOptions").append('<div style="clear:both;"></div>');

            jitterToggleId = optionId + 'JitterToggle';
            jitterAmountId = optionId + 'JitterAmount';
            $("#brushOptions").append(
                '<div class="jitter"> \
                    <input type="checkbox" style="float:left;" id="' +
                        jitterToggleId + '" /><label for="' + jitterToggleId +
                        '">Jitter</label> \
                    <div style="float:right; width: 48%; margin-top: 0.5em;" id="' + jitterAmountId + '"></div> \
                </div> \
                <div style="clear:both;"></div> \
{'fraction_non_alphanumeric': 0.1742831541218638, 'fraction_numerical': 0.011947431302270013, 'mean_word_length': 1.8953739731949848, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '323865', 'n_tokens_mistral': 1936, 'n_tokens_neox': 1769, 'n_words': 363}