<commit_before>var strain_table = null;
var specimen_table = null;
var sample_table = null;


function check_show_existing_items(organism_element_id, existing_items_element_id, url) {
    var selected_ids = $F(organism_element_id).join();
    if (selected_ids == '0') {
        if ($(existing_items_element_id + "_spinner") != null)
            Effect.Fade(existing_items_element_id + "_spinner");
        Effect.Fade(existing_items_element_id, { duration: 0.25 });
    }
    else {
        if (url != '') {
            request = new Ajax.Request(url,
                {
                    method: 'get',
                    parameters: {
                        organism_ids: selected_ids
                    },
                    onSuccess: function(transport) {
                        Effect.Appear(existing_items_element_id, { duration: 0.25 });
                    },
                    onFailure: function(transport) {
                        alert('Something went wrong, please try again...');
                    }
                });
        }
        else {
            Effect.Appear(existing_items_element_id, { duration: 0.25 });
        }
    }
}

function show_existing_specimens() {
    Effect.Appear('existing_specimens', { duration: 0.25 })
}
function hide_existing_specimens() {
    Effect.Fade('existing_specimens', { duration: 0.25 })
}

function show_existing_samples() {
    Effect.Appear('existing_samples', { duration: 0.25 })
}
function hide_existing_samples() {
    Effect.Fade('existing_samples', { duration: 0.25 })
}

function strain_form(strain_id, organism_id, action, url) {
    if (url != '') {
        request = new Ajax.Request(url,
            {
                method: 'get',
                parameters: {
                    id: strain_id,
                    organism_id:organism_id,
                    strain_action: action
                },
                onSuccess: function(transport) {
                },
                onFailure: function(transport) {
                    alert('Something went wrong, please try again...');
                }
            });
    }
}

function getSelectedStrains() {
    var strain_ids  = new Array();
    if (strain_table && strain_table.length != 0){
        var selected_strain_rows = fnGetSelected(strain_table);
        for (var i=0; i< selected_strain_rows.length; i++){
            var id_index = getAttributeColumn(strain_table,"Seek ID");
            strain_ids.push(strain_table.fnGetData(selected_strain_rows[i])[id_index+1]);
        }
    }
    return strain_ids.join(',');
}

function getSelectedSpecimens() {
    var specimen_ids  = new Array();
    if (specimen_table.length != 0){
        var selected_specimen_rows = fnGetSelected(specimen_table);
        for (var i=0; i< selected_specimen_rows.length; i++){
            var id_index = getAttributeColumn(specimen_table,"Seek ID");
            specimen_ids.push(specimen_table.fnGetData(selected_specimen_rows[i])[id_index+1]);
        }
    }
    return specimen_ids.join(',');
}
/*get the column number of attribute in the table*/
function getAttributeColumn( table,attribute){
    var th_columns =  document.evaluate('//table[@id="'+ table.fnSettings().sTableId +'"]/thead/tr/th',document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
    for (var l = 0; l < th_columns.snapshotLength; l++){
         if(th_columns.snapshotItem(l).innerHTML==attribute){
             return l;
         }
    }
}
/* Get the rows which are currently selected */
function fnGetSelected( oTableLocal )
{
	var aReturn = new Array();
	var aTrs = oTableLocal.fnGetNodes();

	for ( var i=0 ; i<aTrs.length ; i++ )
	{
		if (aTrs[i].cells[0].firstChild.checked == true)
		{
			aReturn.push( aTrs[i] );
		}
	}
	return aReturn;
}

function checkSelectOneStrain(){<commit_msg>dont use xpath to parse table columns, as it is not supported in IE 8<commit_after>var strain_table = null;
var specimen_table = null;
var sample_table = null;


function check_show_existing_items(organism_element_id, existing_items_element_id, url) {
    var selected_ids = $F(organism_element_id).join();
    if (selected_ids == '0') {
        if ($(existing_items_element_id + "_spinner") != null)
            Effect.Fade(existing_items_element_id + "_spinner");
        Effect.Fade(existing_items_element_id, { duration: 0.25 });
    }
    else {
        if (url != '') {
            request = new Ajax.Request(url,
                {
                    method: 'get',
                    parameters: {
                        organism_ids: selected_ids
                    },
                    onSuccess: function(transport) {
                        Effect.Appear(existing_items_element_id, { duration: 0.25 });
                    },
                    onFailure: function(transport) {
                        alert('Something went wrong, please try again...');
                    }
                });
        }
        else {
            Effect.Appear(existing_items_element_id, { duration: 0.25 });
        }
    }
}

function show_existing_specimens() {
    Effect.Appear('existing_specimens', { duration: 0.25 })
}
function hide_existing_specimens() {
    Effect.Fade('existing_specimens', { duration: 0.25 })
}

function show_existing_samples() {
    Effect.Appear('existing_samples', { duration: 0.25 })
}
function hide_existing_samples() {
    Effect.Fade('existing_samples', { duration: 0.25 })
}

function strain_form(strain_id, organism_id, action, url) {
    if (url != '') {
        request = new Ajax.Request(url,
            {
                method: 'get',
                parameters: {
                    id: strain_id,
                    organism_id:organism_id,
                    strain_action: action
                },
                onSuccess: function(transport) {
                },
                onFailure: function(transport) {
                    alert('Something went wrong, please try again...');
                }
            });
    }
}

function getSelectedStrains() {
    var strain_ids  = new Array();
    if (strain_table && strain_table.length != 0){
        var selected_strain_rows = fnGetSelected(strain_table);
        for (var i=0; i< selected_strain_rows.length; i++){
            var id_index = getAttributeColumn(strain_table,"Seek ID");
            strain_ids.push(strain_table.fnGetData(selected_strain_rows[i])[id_index+1]);
        }
    }
    return strain_ids.join(',');
}

function getSelectedSpecimens() {
    var specimen_ids  = new Array();
    if (specimen_table.length != 0){
        var selected_specimen_rows = fnGetSelected(specimen_table);
        for (var i=0; i< selected_specimen_rows.length; i++){
            var id_index = getAttributeColumn(specimen_table,"Seek ID");
            specimen_ids.push(specimen_table.fnGetData(selected_specimen_rows[i])[id_index+1]);
        }
    }
    return specimen_ids.join(',');
}
/*get the column number of attribute in the table*/
function getAttributeColumn( table,attribute){
var th_columns = $j('#'+table.fnSettings().sTableId+' thead tr th');
    
for (var l = 0; l < th_columns.length; l++){
         if(th_columns[l].innerHTML==attribute){
             return l;
         }
    }
}
/* Get the rows which are currently selected */
function fnGetSelected( oTableLocal )
{
	var aReturn = new Array();
	var aTrs = oTableLocal.fnGetNodes();

	for ( var i=0 ; i<aTrs.length ; i++ )
	{
		if (aTrs[i].cells[0].firstChild.checked == true)
		{
			aReturn.push( aTrs[i] );
		}
	}
	return aReturn;
}

function checkSelectOneStrain(){
{'fraction_non_alphanumeric': 0.12047077492726792, 'fraction_numerical': 0.00833112933086485, 'mean_word_length': 2.2265358361774745, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, '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': '6622926', 'n_tokens_mistral': 2338, 'n_tokens_neox': 2212, 'n_words': 443}