<commit_before>var activities = [];

$(document).ready(function()
{
    var options =
    {
        el: '.app',
        data:
        {
            activities: activities
        }
    };

    var app = new Vue(options);

    $('body').on('click', '.create-activity', function()
    {
        var activity = prompt("Enter the name of your new activity");
        activities.push({'title': activity, 'tasks': []});
    });

    $('body').on('click', '.create-task', function()
    {
        var index = $(this).parents('.activity').index();
        var task = prompt("Enter the name of your new task");
        activities[index].tasks.push({'title': task});
    });
});<commit_msg>Automatically save / load data from localstorage<commit_after>var activities = [];

// Function to load data from local storage
function load()
{
    var data = localStorage.getItem('activities');

    if(data)
    {
        activities = JSON.parse(data);
    }
}

// Function to save data into local storage
function save()
{
    localStorage.setItem('activities', JSON.stringify(activities));
}

$(document).ready(function()
{
    load();

    var options =
    {
        el: '.app',
        data:
        {
            activities: activities
        }
    };

    var app = new Vue(options);

    $('body').on('click', '.create-activity', function()
    {
        var activity = prompt("Enter the name of your new activity");
        activities.push({'title': activity, 'tasks': []});
        save();
    });

    $('body').on('click', '.create-task', function()
    {
        var index = $(this).parents('.activity').index();
        var task = prompt("Enter the name of your new task");
        activities[index].tasks.push({'title': task});
        save();
    });
});
{'fraction_non_alphanumeric': 0.17559863169897377, 'fraction_numerical': 0.0, 'mean_word_length': 2.3945841392649903, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5670303', 'n_tokens_mistral': 498, 'n_tokens_neox': 497, 'n_words': 126}