<commit_before>/*
Copyright (c) 2014, <NAME>. All rights reserved.
Use of this source code is governed by a BSD-style license
that can be found in the LICENSE.txt file.
*/

ebb.input = {
    pluginboxes: {},
    
    load: function () {
        var add_listener = [];
        var content = '';
        var pluginoptions_elems = [];
        for (var i = 0; i < ebb.plugins.length; i++) {
            content += '<tr>';
            content += '<td><input type="checkbox" class="pluginbox" id="pluginbox' + i + '" checked></td>';
            content += '<td><label for="pluginbox' + i + '">' + ebb.util.escHTML(ebb.plugins[i].name) + '</label></td>';
            ebb.input.pluginboxes[ebb.plugins[i].name] = "pluginbox" + i;
            if (ebb.plugins[i].options) {
                content += '<td><button type="button" id="pluginoptions' + i + '" data-i="' + i + '">Options</button></td>';
                pluginoptions_elems.push("pluginoptions" + i);
            }
            content += '</tr>';
        }
        document.getElementById("input_plugins").innerHTML = content;
        
        for (var j = 0; j < ebb.plugins.length; j++) {
            if (document.getElementById("pluginbox" + j) && localStorage.getItem("_DISABLED_" + ebb.plugins[j].name) == "YES") {
                document.getElementById("pluginbox" + j).checked = false;
            }
        }
        
        ebb.util.forEach(pluginoptions_elems, function (elem) {
            document.getElementById(elem).addEventListener("click", function (event) {
                event.preventDefault();
                ebb.options.show(ebb.plugins[Number(this.dataset.i)]);
            }, false);
        });
        
        document.getElementById("input_submit").addEventListener("click", function (event) {
            event.preventDefault();
            document.getElementById("input").style.display = "none";
            
            for (var i = 0; i < ebb.plugins.length; i++) {
                if (document.getElementById("pluginbox" + i)) {
                    localStorage.setItem("_DISABLED_" + ebb.plugins[i].name, document.getElementById("pluginbox" + i).checked ? "NO" : "YES");
                }
            }
            
            ebb.control.start();
        }, false);
        
        if (typeof ebb.util.browseFile != "function" || typeof btoa != "function") {
            document.getElementById("input_leo").style.display = "none";
        } else {
            document.getElementById("input_leo_import_btn").addEventListener("click", function (event) {
                event.preventDefault();
                ebb.util.browseFile("json", "leo", function (result) {
                    if (result.leo_version != EBB_LEO_FORMAT_VERSION) {
                        alert("Error reading file!\nDetails: This leo file was created using an incompatible version of the LBN Electronic Bulletin Board.");
                    } else if (result.plugins) {
                        for (var plugin in result.plugins) {
                            if (result.plugins.hasOwnProperty(plugin)) {
                                if (ebb.input.pluginboxes[plugin]) {
                                    document.getElementById(ebb.input.pluginboxes[plugin]).checked = result.plugins[plugin].enabled;
                                }
                                if (result.plugins[plugin].options) {
                                    ebb.util.forEach(result.plugins[plugin].options, function (option) {
                                        localStorage.setItem("_OPTION_" + plugin + "_" + option.name, option.value);
                                    });
                                    localStorage.setItem("_SAVE_TIME_" + plugin, (new Date()).getTime());
                                }
                            }
                        }
                    } else {
                        alert("Error reading file!\nDetails: No plugin data.");
                    }
                });
            }, false);
            
            document.getElementById("input_leo_export_btn").addEventListener("click", function (event) {<commit_msg>Updated file error messaging<commit_after>/*
Copyright (c) 2014, <NAME>. All rights reserved.
Use of this source code is governed by a BSD-style license
that can be found in the LICENSE.txt file.
*/

ebb.input = {
    pluginboxes: {},
    
    load: function () {
        var add_listener = [];
        var content = '';
        var pluginoptions_elems = [];
        for (var i = 0; i < ebb.plugins.length; i++) {
            content += '<tr>';
            content += '<td><input type="checkbox" class="pluginbox" id="pluginbox' + i + '" checked></td>';
            content += '<td><label for="pluginbox' + i + '">' + ebb.util.escHTML(ebb.plugins[i].name) + '</label></td>';
            ebb.input.pluginboxes[ebb.plugins[i].name] = "pluginbox" + i;
            if (ebb.plugins[i].options) {
                content += '<td><button type="button" id="pluginoptions' + i + '" data-i="' + i + '">Options</button></td>';
                pluginoptions_elems.push("pluginoptions" + i);
            }
            content += '</tr>';
        }
        document.getElementById("input_plugins").innerHTML = content;
        
        for (var j = 0; j < ebb.plugins.length; j++) {
            if (document.getElementById("pluginbox" + j) && localStorage.getItem("_DISABLED_" + ebb.plugins[j].name) == "YES") {
                document.getElementById("pluginbox" + j).checked = false;
            }
        }
        
        ebb.util.forEach(pluginoptions_elems, function (elem) {
            document.getElementById(elem).addEventListener("click", function (event) {
                event.preventDefault();
                ebb.options.show(ebb.plugins[Number(this.dataset.i)]);
            }, false);
        });
        
        document.getElementById("input_submit").addEventListener("click", function (event) {
            event.preventDefault();
            document.getElementById("input").style.display = "none";
            
            for (var i = 0; i < ebb.plugins.length; i++) {
                if (document.getElementById("pluginbox" + i)) {
                    localStorage.setItem("_DISABLED_" + ebb.plugins[i].name, document.getElementById("pluginbox" + i).checked ? "NO" : "YES");
                }
            }
            
            ebb.control.start();
        }, false);
        
        if (typeof ebb.util.browseFile != "function" || typeof btoa != "function") {
            document.getElementById("input_leo").style.display = "none";
        } else {
            document.getElementById("input_leo_import_btn").addEventListener("click", function (event) {
                event.preventDefault();
                ebb.util.browseFile("json", "leo", function (result) {
                    if (result.plugins) {
                        if (result.leo_version != EBB_LEO_FORMAT_VERSION) {
                            alert("Error reading file!\nDetails: This leo file was created using an incompatible version of the LBN Electronic Bulletin Board.");
                        } else {
                            for (var plugin in result.plugins) {
                                if (result.plugins.hasOwnProperty(plugin)) {
                                    if (ebb.input.pluginboxes[plugin]) {
                                        document.getElementById(ebb.input.pluginboxes[plugin]).checked = result.plugins[plugin].enabled;
                                    }
                                    if (result.plugins[plugin].options) {
                                        ebb.util.forEach(result.plugins[plugin].options, function (option) {
                                            localStorage.setItem("_OPTION_" + plugin + "_" + option.name, option.value);
                                        });
                                        localStorage.setItem("_SAVE_TIME_" + plugin, (new Date()).getTime());
                                    }
                                }
                            }
                        }
                    } else {
                        alert("Error reading file!\nDetails: No plugin data.");
                    }
                });
            }, false);
            
            document.getElementById("input_leo_export_btn").addEventListener("click", function (event) {
{'fraction_non_alphanumeric': 0.13399976198976557, 'fraction_numerical': 0.0016660716410805665, 'mean_word_length': 1.5716034271725827, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2435274', 'n_tokens_mistral': 2137, 'n_tokens_neox': 2060, 'n_words': 411}