<commit_before>var ClassificationEditor = new function()
{
    var self = this;
    var content_div_id = 'classification_editor_widget';
    var display_superclass_names = false;
    var display_edit_tools = true;
    var workspace_pid;

    /**
     * Initialization of the window.
     */
    this.init = function( pid )
    {
        // change to pid workspace if pid was passed
        if (pid) {
            self.change_workspace(pid, true);
        }
    };

    /**
     * Creates the base URL, needed for all classification requests and
     * appends the passed string to it. The combined result is returned.
     */
    this.get_cls_url = function( pid, sub_url ) {
        return django_url + pid + '/classification/' + self.workspace_pid + sub_url;
    };

    /**
     * Load the classification data.
     */
    this.load_classification = function(pid) {
        requestQueue.register(self.get_cls_url(pid, '/show'),
            'GET', undefined, self.create_error_aware_callback(
                function(status, data, text) {
                    var e = $.parseJSON(data);
                    if (e.error) {
                        alert(e.error);
                    } else {
                        var container = document.getElementById(content_div_id);
                        container.innerHTML = e.content;
                        self.handleContent( e.page, container, pid );
                    }
                }));
    }

    this.load_tree = function(pid, link_id) {
        // id of object tree
        var tree_id = '#classification_graph_object';
        var tree = $(tree_id);

        $("#refresh_classification_graph").click(function () {
            tree.jstree("refresh", -1);
        });

        $("#display_super_classes").click(function () {
            if ($("#display_super_classes").attr('checked')) {
                display_superclass_names = true;
            } else {
                display_superclass_names = false;
            }
            tree.jstree("refresh", -1);
        });

        if ($("#display_edit_tools").length === 0) {
            display_edit_tools = false;
        } else {
            $("#display_edit_tools").click(function () {
                if ($("#display_edit_tools").attr('checked')) {
                    display_edit_tools = true;
                } else {
                    display_edit_tools = false;
                }
                tree.jstree("refresh", -1);
            });
        }

        tree.bind("reload_nodes.jstree",
            function (event, data) {
                if (self.currentExpandRequest) {
                    openTreePath($(tree_id), self.currentExpandRequest);
                }
            });

        var url = self.get_cls_url(pid, '/list');
        if (link_id != null) {
            url += "/" + link_id;
        }

        tree.jstree({
            "core": {
              "html_titles": true,
              "load_open": true
            },
            "plugins": ["themes", "json_data", "ui", "crrm", "types", "contextmenu"],
            "json_data": {
              "ajax": {
                "url": url,
                "data": function (n) {
                  var expandRequest, parentName, parameters;
                  // depending on which type of node it is, display those
                  // the result is fed to the AJAX request `data` option
                  parameters = {
                    "pid": pid,
                    "parentid": n.attr ? n.attr("id").replace("node_", "") : 0,
                    "superclassnames": display_superclass_names ? 1 : 0,
                    "edittools": display_edit_tools ? 1 : 0
                  };
                  if (self.currentExpandRequest) {
                    parameters['expandtarget'] = self.currentExpandRequest.join(',');
                  }
                  if (n[0]) {
                    parameters['parentname'] = n[0].innerText;
                  }
                  return parameters;
                },
                "success": function (e) {
                  if (e.error) {
                    alert(e.error);
                  }
                }
              },
              "cache": false,
              "progressive_render": true
            },
            "ui": {
              "select_limit": 1,
              "select_multiple_modifier": "ctrl",
              "selected_parent_close": "deselect"
            },
            "themes": {
              "theme": "classic",
              "url": STATIC_URL_JS + "widgets/themes/kde/jsTree/classic/style.css",
              "dots": false,
              "icons": true
            },
            "contextmenu": {
                "items": function(obj) {
                    var node_id = obj.attr("id");
                    var node_type = obj.attr("rel");
                    if (node_type === "root" || node_type === "element") {
                        var child_groups = JSON.parse(obj.attr("child_groups"));
                        var menu = {};
                        if (display_edit_tools) {
                            // Add entries to create child class instances
                            for (group_name in child_groups) {<commit_msg>Classification editor: remove jsTree UI plugin to make ROI links work<commit_after>var ClassificationEditor = new function()
{
    var self = this;
    var content_div_id = 'classification_editor_widget';
    var display_superclass_names = false;
    var display_edit_tools = true;
    var workspace_pid;

    /**
     * Initialization of the window.
     */
    this.init = function( pid )
    {
        // change to pid workspace if pid was passed
        if (pid) {
            self.change_workspace(pid, true);
        }
    };

    /**
     * Creates the base URL, needed for all classification requests and
     * appends the passed string to it. The combined result is returned.
     */
    this.get_cls_url = function( pid, sub_url ) {
        return django_url + pid + '/classification/' + self.workspace_pid + sub_url;
    };

    /**
     * Load the classification data.
     */
    this.load_classification = function(pid) {
        requestQueue.register(self.get_cls_url(pid, '/show'),
            'GET', undefined, self.create_error_aware_callback(
                function(status, data, text) {
                    var e = $.parseJSON(data);
                    if (e.error) {
                        alert(e.error);
                    } else {
                        var container = document.getElementById(content_div_id);
                        container.innerHTML = e.content;
                        self.handleContent( e.page, container, pid );
                    }
                }));
    }

    this.load_tree = function(pid, link_id) {
        // id of object tree
        var tree_id = '#classification_graph_object';
        var tree = $(tree_id);

        $("#refresh_classification_graph").click(function () {
            tree.jstree("refresh", -1);
        });

        $("#display_super_classes").click(function () {
            if ($("#display_super_classes").attr('checked')) {
                display_superclass_names = true;
            } else {
                display_superclass_names = false;
            }
            tree.jstree("refresh", -1);
        });

        if ($("#display_edit_tools").length === 0) {
            display_edit_tools = false;
        } else {
            $("#display_edit_tools").click(function () {
                if ($("#display_edit_tools").attr('checked')) {
                    display_edit_tools = true;
                } else {
                    display_edit_tools = false;
                }
                tree.jstree("refresh", -1);
            });
        }

        tree.bind("reload_nodes.jstree",
            function (event, data) {
                if (self.currentExpandRequest) {
                    openTreePath($(tree_id), self.currentExpandRequest);
                }
            });

        var url = self.get_cls_url(pid, '/list');
        if (link_id != null) {
            url += "/" + link_id;
        }

        tree.jstree({
            "core": {
              "html_titles": true,
              "load_open": true
            },
            // The UI plugin isn't used, because it doesn't let click events go
            // through to the node. This, however, is needed to support ROI links.
            "plugins": ["themes", "json_data", "crrm", "types", "contextmenu"],
            "json_data": {
              "ajax": {
                "url": url,
                "data": function (n) {
                  var expandRequest, parentName, parameters;
                  // depending on which type of node it is, display those
                  // the result is fed to the AJAX request `data` option
                  parameters = {
                    "pid": pid,
                    "parentid": n.attr ? n.attr("id").replace("node_", "") : 0,
                    "superclassnames": display_superclass_names ? 1 : 0,
                    "edittools": display_edit_tools ? 1 : 0
                  };
                  if (self.currentExpandRequest) {
                    parameters['expandtarget'] = self.currentExpandRequest.join(',');
                  }
                  if (n[0]) {
                    parameters['parentname'] = n[0].innerText;
                  }
                  return parameters;
                },
                "success": function (e) {
                  if (e.error) {
                    alert(e.error);
                  }
                }
              },
              "cache": false,
              "progressive_render": true
            },
            "themes": {
              "theme": "classic",
              "url": STATIC_URL_JS + "widgets/themes/kde/jsTree/classic/style.css",
              "dots": false,
              "icons": true
            },
            "contextmenu": {
                "items": function(obj) {
                    var node_id = obj.attr("id");
                    var node_type = obj.attr("rel");
                    if (node_type === "root" || node_type === "element") {
                        var child_groups = JSON.parse(obj.attr("child_groups"));
                        var menu = {};
                        if (display_edit_tools) {
                            // Add entries to create child class instances
                            for (group_name in child_groups) {
{'fraction_non_alphanumeric': 0.11701618308915063, 'fraction_numerical': 0.0022024322512687925, 'mean_word_length': 1.3131782945736434, 'pattern_counts': {'":': 48, '<': 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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5012515', 'n_tokens_mistral': 2767, 'n_tokens_neox': 2603, 'n_words': 596}