<commit_before>function something()
{
    var x = window.localStorage.getItem('aaa');//x=hh['aaa']
    x = x * 1 + 1;

    window.localStorage.setItem('aaa', x); //hh['aaa']=x

    alert(x);
}

function add_to_cart(id)
{
    var key = 'product_' + id;

    var x = window.localStorage.getItem(key);
    x = x * 1 + 1;

    window.localStorage.setItem(key, x);

    //вывод кол-во товара в корзине
    update_orders_input();
    update_orders_button
}

function cart_get_number_of_items()
{
    var cnt = 0;

    for(var i = 0; i < window.localStorage.length; i++)
    {
        var key = window.localStorage.key(i); //получаем ключ
        var value = window.localStorage.getItem(key); //получаем значение

        if(key.indexOf('product_') == 0)
        {
            cnt = cnt + value * 1;
        }
    }
    return cnt;
}

function update_orders_input()
{
    var orders = cart_get_orders();
    $('#orders_input').val(orders);

}

function update_orders_button()
{
    var text = 'Cart (' + cart_get_number_of_items() + ')';
    $('#orders_button').val(text);

}

function cart_get_orders()
{
    var orders = '';

    for(var i = 0; i < window.localStorage.length; i++)
    {
        var key = window.localStorage.key(i); //получаем ключ
        var value = window.localStorage.getItem(key); //получаем значение

        if(key.indexOf('product_') == 0)
        {
            orders = orders + key + '=' + value + ',';
        }
    }
    return orders;
}

function cancel_order()
{
    alert('aaa');
    return  false;
}<commit_msg>clear localStorage on cancel, update button<commit_after>function something()
{
    var x = window.localStorage.getItem('aaa');//x=hh['aaa']
    x = x * 1 + 1;

    window.localStorage.setItem('aaa', x); //hh['aaa']=x

    alert(x);
}

function add_to_cart(id)
{
    var key = 'product_' + id;

    var x = window.localStorage.getItem(key);
    x = x * 1 + 1;

    window.localStorage.setItem(key, x);

    //вывод кол-во товара в корзине
    update_orders_input();
    update_orders_button
}

function cart_get_number_of_items()
{
    var cnt = 0;

    for(var i = 0; i < window.localStorage.length; i++)
    {
        var key = window.localStorage.key(i); //получаем ключ
        var value = window.localStorage.getItem(key); //получаем значение

        if(key.indexOf('product_') == 0)
        {
            cnt = cnt + value * 1;
        }
    }
    return cnt;
}

function update_orders_input()
{
    var orders = cart_get_orders();
    $('#orders_input').val(orders);

}

function update_orders_button()
{
    var text = 'Cart (' + cart_get_number_of_items() + ')';
    $('#orders_button').val(text);

}

function cart_get_orders()
{
    var orders = '';

    for(var i = 0; i < window.localStorage.length; i++)
    {
        var key = window.localStorage.key(i); //получаем ключ
        var value = window.localStorage.getItem(key); //получаем значение

        if(key.indexOf('product_') == 0)
        {
            orders = orders + key + '=' + value + ',';
        }
    }
    return orders;
}

function cancel_order()
{
    window.localStorage.clear();

    update_orders_input();
    update_orders_button();
    
    return  false;
}
{'fraction_non_alphanumeric': 0.1522284996861268, 'fraction_numerical': 0.006277463904582548, 'mean_word_length': 2.533259423503326, 'pattern_counts': {'":': 0, '<': 7, '<?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': '53063', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1129, 'n_words': 227}