1var SchemaEditor = function () {
2    /**
3     * Handle tabs in the Schema Editor
4     */
5    jQuery('#plugin__struct_json, #plugin__struct_delete').hide();
6    jQuery('#plugin__struct_tabs').find('a').click(function (e) {
7        e.preventDefault();
8        e.stopPropagation();
9        var $me = jQuery(this);
10        if ($me.parent().hasClass('active')) return; // nothing to do
11
12        $me.parent().parent().find('li').removeClass('active');
13        $me.parent().addClass('active');
14        jQuery('#plugin__struct_json, #plugin__struct_editor, #plugin__struct_delete').hide();
15        jQuery($me.attr('href')).show();
16    });
17
18
19    /**
20     * Toggle the disabled class in the schema editor
21     */
22    jQuery('#plugin__struct_editor').find('td.isenabled input').change(function () {
23        var $checkbox = jQuery(this);
24        $checkbox.parents('tr').toggleClass('disabled', !$checkbox.prop('checked'));
25    });
26
27    /**
28     * Confirm Schema Deletion
29     */
30    jQuery('a.deleteSchema').click(function (event) {
31        var schema = jQuery(this).closest('tr').find('td:nth-child(2)').text();
32        var page = jQuery(this).closest('tr').find('td:nth-child(1)').text();
33        if (!window.confirm(formatString(LANG.plugins.struct['confirmAssignmentsDelete'], schema, page))) {
34            event.preventDefault();
35            event.stopPropagation();
36        }
37    });
38};
39