{"size": 1604, "ext": "js", "max_stars_repo_path": "src/js/jheatmap/components/FilterCheckBoxes.js", "max_stars_repo_name": "jheatmap/jheatmap", "max_stars_repo_stars_event_min_datetime": "2015-01-05T02:39:21.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-16T13:44:08.000Z", "max_issues_repo_path": "src/js/jheatmap/components/FilterCheckBoxes.js", "max_issues_repo_name": "jheatmap/jheatmap", "max_issues_repo_issues_event_min_datetime": "2015-06-01T02:21:39.000Z", "max_issues_repo_issues_event_max_datetime": "2015-08-17T09:35:19.000Z", "max_forks_repo_path": "src/js/jheatmap/components/FilterCheckBoxes.js", "max_forks_repo_name": "jheatmap/jheatmap", "max_forks_repo_forks_event_min_datetime": "2016-07-14T17:14:01.000Z", "max_forks_repo_forks_event_max_datetime": "2018-12-18T14:20:21.000Z"}
{"max_stars_count": 21, "max_issues_count": 3, "max_forks_count": 5, "avg_line_length": 38.1904761905, "max_line_length": 91, "alphanum_fraction": 0.5573566085}

jheatmap.components.FilterCheckBoxes = function(drawer, heatmap, container) {
    jheatmap.components._FilterCheckBox(drawer, container, heatmap, "rows");
    jheatmap.components._FilterCheckBox(drawer, container, heatmap, "columns");
};

jheatmap.components._FilterCheckBox = function(drawer, container, heatmap, dimensionType) {

    var dimension = (dimensionType == "rows" ? heatmap.rows : heatmap.cols);

    // Add row filters
    for (var f=0; f < dimension.filters.values.length; f++) {
        var filterDef = dimension.filters.values[f];

        if ($.inArray(heatmap.cells.selectedValue, filterDef.visible) > -1) {

            var checkInput = $('<input type="checkbox">');
            if ($.inArray(heatmap.cells.selectedValue, filterDef.enabled)>-1) {
                checkInput.prop('checked', 'true');
            }
            checkInput.click(function () {
                var checkbox = $(this);
                drawer.loading(function () {
                    if (checkbox.is(':checked')) {
                        filterDef.enabled.push(heatmap.cells.selectedValue);
                    } else {
                        filterDef.enabled.remove(heatmap.cells.selectedValue);
                    }
                    dimension.filters.filter(heatmap, dimensionType);
                    dimension.sorter.sort(heatmap, dimensionType);

                    drawer.paint();
                });
            });

            container.append($('<div>', {
                'class': 'filter'
            }).append(checkInput).append($('<span>').html(filterDef.title)));

        }
    }
};