<commit_before>(function ($) {
    //-----------------------+
    // Better val() function |
    //-----------------------+
    $.fn.valInternal = jQuery.fn.val;
    $.fn.val = function (val) {
        if (!this.length) {
            return;
        }

        var type = this.attr('type');
        type = type ? type : this.get(0).tagName.toLowerCase();
        switch (type) {
            case 'checkbox':
                if (arguments.length) {
                    this.prop('checked', !!val);
                } else {
                    return this.is(':checked') ? $.fn.valInternal.call(this) : '';
                }
                break;
            default:
                if (arguments.length) {
                    return $.fn.valInternal.call(this, val);
                } else {
                    return $.fn.valInternal.call(this);
                }
        }
    };

    //-------+
    // Setup |
    //-------+
    $.ajaxSetup({async: false});

    //-----------------+
    // Selects Command |
    //-----------------+
    $(document).on('mouseover', '#command', function () {
        // select text
        this.select();
    });
    $(document).on('mouseout', '#command', function () {
        // deselect text
        this.selectionStart = this.selectionEnd;
    });

    //------+
    // Init |
    //------+
    var URL = document.URL.replace(/(\/index.html.*)|(\/)$/, '');
    window.form = $('#form').get(0);
    form.values = {};
    form.options = $('#options').get(0);
    form.modules = {};
    form.task.onChange = [];
    form.command = '';

    //-----------+
    // Functions |
    //-----------+

    // Load form options
    form.options.load = function (name) {
        $.get(URL + '/' + name + '/~builder/options.html', function (response) {
            form.options.innerHTML += response;
        });
    };

    // Add command argument
    form.setCommand = function (cond, name, value) {
        form.command += cond ? ' -' + name + (value ? ' ' + value : '') : '';
    };

    // Invoke module update
    form.update = function (modules) {
        modules.forEach(function (module) {
            if (form.modules[module] && form.modules[module].onUpdate) {
                form.modules[module].onUpdate();
            }
        });
    };


    //--------------------+
    // Handle form update |
    //--------------------+
    var update = function (event) {
        if (event) {
            // task select
            if ($(event.target).is('[name=task]')) {
                change();
                return;
            }
        }

        // command update
        form.command = URL;
        var task = '/' + form.task.value;
        form.command += task + ' -qO- | sh -s --';

        // no interaction
        form.setCommand(form.no_interaction.checked, 'n');

        // environment
        form.setCommand(form.env.value, form.env.value);

        // switch support
        var support = $(form.support).val();
        console.log(form.support);
        console.log(support);
        if (support === "wbpo") {
            // support WBPO
            //form.setCommand(true, 'with-wbpo');
        }

        // support Webino
        if (support !== "webino") {
            //form.setCommand(true, 'without-webino');
        }

        // admin email
        form.setCommand(form.admin_email.value, 'admin-email', form.admin_email.value);

        // update module options
        if (form.modules[form.task.value] && form.modules[form.task.value].options) {
            form.update(form.modules[form.task.value].options);
        }

        // update command
        $('#command').val('wget ' + form.command);
    };
<commit_msg>Support WIP<commit_after>(function ($) {
    //-----------------------+
    // Better val() function |
    //-----------------------+
    $.fn.valInternal = jQuery.fn.val;
    $.fn.val = function (val) {
        if (!this.length) {
            return;
        }

        var type = this.attr('type');
        type = type ? type : this.get(0).tagName.toLowerCase();
        switch (type) {
            case 'checkbox':
                if (arguments.length) {
                    this.prop('checked', !!val);
                } else {
                    return this.is(':checked') ? $.fn.valInternal.call(this) : '';
                }
                break;
            default:
                if (arguments.length) {
                    return $.fn.valInternal.call(this, val);
                } else {
                    return $.fn.valInternal.call(this);
                }
        }
    };

    //-------+
    // Setup |
    //-------+
    $.ajaxSetup({async: false});

    //-----------------+
    // Selects Command |
    //-----------------+
    $(document).on('mouseover', '#command', function () {
        // select text
        this.select();
    });
    $(document).on('mouseout', '#command', function () {
        // deselect text
        this.selectionStart = this.selectionEnd;
    });

    //------+
    // Init |
    //------+
    var URL = document.URL.replace(/(\/index.html.*)|(\/)$/, '');
    window.form = $('#form').get(0);
    form.values = {};
    form.options = $('#options').get(0);
    form.modules = {};
    form.task.onChange = [];
    form.command = '';

    //-----------+
    // Functions |
    //-----------+

    // Load form options
    form.options.load = function (name) {
        $.get(URL + '/' + name + '/~builder/options.html', function (response) {
            form.options.innerHTML += response;
        });
    };

    // Add command argument
    form.setCommand = function (cond, name, value) {
        form.command += cond ? ' -' + name + (value ? ' ' + value : '') : '';
    };

    // Invoke module update
    form.update = function (modules) {
        modules.forEach(function (module) {
            if (form.modules[module] && form.modules[module].onUpdate) {
                form.modules[module].onUpdate();
            }
        });
    };


    //--------------------+
    // Handle form update |
    //--------------------+
    var update = function (event) {
        if (event) {
            // task select
            if ($(event.target).is('[name=task]')) {
                change();
                return;
            }
        }

        // command update
        form.command = URL;
        var task = '/' + form.task.value;
        form.command += task + ' -qO- | sh -s --';

        // no interaction
        form.setCommand(form.no_interaction.checked, 'n');

        // environment
        form.setCommand(form.env.value, form.env.value);

        // switch support
        // var support = $(form.support).val();
        console.log(form.support);
        console.log(form.support.value);
        // if (support === "wbpo") {
        //     // support WBPO
        //     //form.setCommand(true, 'with-wbpo');
        // }
        //
        // // support Webino
        // if (support !== "webino") {
        //     //form.setCommand(true, 'without-webino');
        // }

        // admin email
        form.setCommand(form.admin_email.value, 'admin-email', form.admin_email.value);

        // update module options
        if (form.modules[form.task.value] && form.modules[form.task.value].options) {
            form.update(form.modules[form.task.value].options);
        }

        // update command
        $('#command').val('wget ' + form.command);
    };

{'fraction_non_alphanumeric': 0.2109522524952792, 'fraction_numerical': 0.0008092797410304828, 'mean_word_length': 1.2878741129281086, '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': '1622149', 'n_tokens_mistral': 2107, 'n_tokens_neox': 2043, 'n_words': 363}