<commit_before>/**
 * Module to render the consolidated files view. Reads addon configurations and
 * initializes an HGrid.
 */
this.Rubeus = (function($, HGrid, bootbox, window) {

    /////////////////////////
    // HGrid configuration //
    /////////////////////////

    // Custom folder icon indicating private component
    HGrid.Html.folderIconPrivate = '<img class="hg-addon-icon" src="/static/img/hgrid/fatcowicons/folder_delete.png">';
    // Override Name column folder view to allow for extra widgets, e.g. github branch picker
    HGrid.Col.Name.folderView = function(item) {
        var icon, opening, cssClass;
        if (item.iconUrl) {
            // use item's icon based on filetype
            icon = '<img class="hg-addon-icon" src="' + item.iconUrl + '">';
            cssClass = '';
        } else {
            if (!item.permissions.view) {
                icon = HGrid.Html.folderIconPrivate;
                cssClass = 'hg-folder-private';
            } else {
                icon = HGrid.Html.folderIcon;
                cssClass = 'hg-folder-public';
            }
        }
        opening = '<span class="hg-folder-text ' + cssClass + '">';
        var closing = '</span>';
        html = [icon, opening, item.name, closing].join('');
        if(item.extra) {
            html += '<span class="hg-extras">' + item.extra + '</span>';
        }
        return html;
    };

    HGrid.Col.Name.showExpander = function(row) {
        return row.kind === HGrid.FOLDER && row.permissions.view;
    };

    HGrid.Col.Name.itemView = function(item) {
        var ext = item.name.split('.').pop().toLowerCase();
        var tooltipMarkup = genTooltipMarkup('View file');

        var nameElement = ['<span ' + tooltipMarkup + ' >', item.name, '</span>'].join('');

        var icon = Rubeus.Extensions.indexOf(ext) === -1 ?
                        HGrid.Html.fileIcon :
                        Rubeus.ExtensionSkeleton.replace('{{ext}}', ext);
        return [icon, nameElement].join('');
    };

    /**
     * Generate the markup necessary for adding a tooltip to an element.
     */
    function genTooltipMarkup(title, maxLength) {
        var max = maxLength || 25;
        // Truncate title if necessary
        var cleanTitle;
        if (title.length >= max) {
            cleanTitle = title.slice(0, max) + '...';
        } else {
            cleanTitle = title;
        }
        return ' title="' + cleanTitle + '" data-placement="right" ' +
                                'data-toggle="tooltip" ';
    }

    HGrid.Col.ActionButtons.itemView = function(item) {

	var buttonDefs = [];
	if(item.permissions.download !== false){
	    buttonDefs.push({
		text: '<i class="icon-download-alt icon-white"></i>',
		action: 'download',
		cssClass: 'btn btn-primary btn-mini'
	    });
	}
	}
        if (item.permissions && item.permissions.edit) {
            var deleteTip = genTooltipMarkup('Delete ' + item.name, 20);
            buttonDefs.push({
              text: '&nbsp;<i class="icon-remove"' + deleteTip + '></i>',
              action: 'delete',
              cssClass: 'btn btn-link btn-mini btn-delete'<commit_msg>removing stray }<commit_after>/**
 * Module to render the consolidated files view. Reads addon configurations and
 * initializes an HGrid.
 */
this.Rubeus = (function($, HGrid, bootbox, window) {

    /////////////////////////
    // HGrid configuration //
    /////////////////////////

    // Custom folder icon indicating private component
    HGrid.Html.folderIconPrivate = '<img class="hg-addon-icon" src="/static/img/hgrid/fatcowicons/folder_delete.png">';
    // Override Name column folder view to allow for extra widgets, e.g. github branch picker
    HGrid.Col.Name.folderView = function(item) {
        var icon, opening, cssClass;
        if (item.iconUrl) {
            // use item's icon based on filetype
            icon = '<img class="hg-addon-icon" src="' + item.iconUrl + '">';
            cssClass = '';
        } else {
            if (!item.permissions.view) {
                icon = HGrid.Html.folderIconPrivate;
                cssClass = 'hg-folder-private';
            } else {
                icon = HGrid.Html.folderIcon;
                cssClass = 'hg-folder-public';
            }
        }
        opening = '<span class="hg-folder-text ' + cssClass + '">';
        var closing = '</span>';
        html = [icon, opening, item.name, closing].join('');
        if(item.extra) {
            html += '<span class="hg-extras">' + item.extra + '</span>';
        }
        return html;
    };

    HGrid.Col.Name.showExpander = function(row) {
        return row.kind === HGrid.FOLDER && row.permissions.view;
    };

    HGrid.Col.Name.itemView = function(item) {
        var ext = item.name.split('.').pop().toLowerCase();
        var tooltipMarkup = genTooltipMarkup('View file');

        var nameElement = ['<span ' + tooltipMarkup + ' >', item.name, '</span>'].join('');

        var icon = Rubeus.Extensions.indexOf(ext) === -1 ?
                        HGrid.Html.fileIcon :
                        Rubeus.ExtensionSkeleton.replace('{{ext}}', ext);
        return [icon, nameElement].join('');
    };

    /**
     * Generate the markup necessary for adding a tooltip to an element.
     */
    function genTooltipMarkup(title, maxLength) {
        var max = maxLength || 25;
        // Truncate title if necessary
        var cleanTitle;
        if (title.length >= max) {
            cleanTitle = title.slice(0, max) + '...';
        } else {
            cleanTitle = title;
        }
        return ' title="' + cleanTitle + '" data-placement="right" ' +
                                'data-toggle="tooltip" ';
    }

    HGrid.Col.ActionButtons.itemView = function(item) {

	var buttonDefs = [];
	if(item.permissions.download !== false){
	    buttonDefs.push({
		text: '<i class="icon-download-alt icon-white"></i>',
		action: 'download',
		cssClass: 'btn btn-primary btn-mini'
	    });
	}
        if (item.permissions && item.permissions.edit) {
            var deleteTip = genTooltipMarkup('Delete ' + item.name, 20);
            buttonDefs.push({
              text: '&nbsp;<i class="icon-remove"' + deleteTip + '></i>',
              action: 'delete',
              cssClass: 'btn btn-link btn-mini btn-delete'
{'fraction_non_alphanumeric': 0.16164817749603805, 'fraction_numerical': 0.001901743264659271, 'mean_word_length': 1.898943500229674, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6584434', 'n_tokens_mistral': 1886, 'n_tokens_neox': 1816, 'n_words': 411}