<commit_before>/**
 * Created by bacchus on 6/11/14.
 */

function init() {

    $('.barcode_input').unbind("keyup", car_ret_add_bc);
    $('.barcode_input').keyup(car_ret_add_bc);

}

function car_ret_add_bc(e) {
    var evt = e || window.event
    // Check if next sibling has a value of "" in its textfield.  If so, set focus to that instead of adding another field.
    if(evt.keyCode === 17 || evt.keyCode === 13) {
        addBarcodeInput();
    }
}


function addBarcodeInput() {

    /*
     <tr>
        <td>
            <input type="text" value="TEST1">
        </td>
        <td>
            <input type="checkbox" value="0">
        </td>
     </tr>
     */

    var barcodes_tbl = document.getElementById('barcodes_table');

    var new_table_row = document.createElement('tr');

    var new_table_textbox_cell = document.createElement('td');
    var new_table_textbox_cell_input = document.createElement('input');

    var new_table_checkbox_cell = document.createElement('td');
    var new_table_checkbox_cell_checkbox = document.createElement('input');

    /* This hidden input value is neccesary to carry the value of an unchecked checkbox upon submission */
    var new_table_hidden_cb_value_input = document.createElement('input');<commit_msg>fixed car_ret_add_bc.  Now it checks to see if there are any empty barcode inputs below its position before adding another input field.  If there are, it just sets the focus to them.<commit_after>/**
 * Created by bacchus on 6/11/14.
 */

function init() {

    $('.barcode_input').unbind("keyup", car_ret_add_bc);
    $('.barcode_input').keyup(car_ret_add_bc);

}

function car_ret_add_bc(e) {
    var evt = e || window.event
    // Check if next sibling has a value of "" in its textfield.  If so, set focus to that instead of adding another field.

    var row = $(this).parent().parent();

    // If return carriage is present in input (scanner done with input)...
    if(evt.keyCode == 17 || evt.keyCode == 13) {
        // Then ... if there are no empty inputs below us, add a new one
        if (row.index() == row.siblings().length) {
            addBarcodeInput();
        }
        // If there are empty inputs below us, go to the next one and set focus.
        else {
            var sib = row.next().find('.barcode_input');
            sib.focus();
        }
    }
}


function addBarcodeInput() {

    /*
     <tr>
        <td>
            <input type="text" value="TEST1">
        </td>
        <td>
            <input type="checkbox" value="0">
        </td>
     </tr>
     */

    var barcodes_tbl = document.getElementById('barcodes_table');

    var new_table_row = document.createElement('tr');

    var new_table_textbox_cell = document.createElement('td');
    var new_table_textbox_cell_input = document.createElement('input');

    var new_table_checkbox_cell = document.createElement('td');
    var new_table_checkbox_cell_checkbox = document.createElement('input');

    /* This hidden input value is neccesary to carry the value of an unchecked checkbox upon submission */
    var new_table_hidden_cb_value_input = document.createElement('input');
{'fraction_non_alphanumeric': 0.12237093690248566, 'fraction_numerical': 0.007010834926704908, 'mean_word_length': 2.846813725490196, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '2063994', 'n_tokens_mistral': 968, 'n_tokens_neox': 937, 'n_words': 270}