# user-access-manager/2.0.0/assets/js/functions.js

User Access Manager, version 2.0.0. 40 lines.

- Page: https://pluginprobe.com/plugins/user-access-manager/2.0.0/code/assets/js/functions.js
- Raw: https://pluginprobe.com/plugins/user-access-manager/2.0.0/raw/assets/js/functions.js
- Modified: 2017-04-23T10:38:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/user-access-manager/2.0.0/code/assets/js/functions.js#L10-L20`.

```javascript
jQuery(document).ready(function () {
    //Functions for the setting page
    var toggleGroup = function (groupName) {
        var $groups = jQuery(groupName);

        jQuery.each($groups, function (key, group) {
            var $group = jQuery(group);
            var $firstElements = jQuery('tr:first input', $group);

            var toggleElements = function (element) {
                var $element = jQuery(element);

                if ($element.val() === 'true') {
                    jQuery('tr:not(:first)', $group).hide();
                } else {
                    jQuery('tr:not(:first)', $group).show();
                }
            };

            $firstElements.change(function () {
                toggleElements(this);
            });

            toggleElements(jQuery('tr:first input:checked', $group));
        });
    };

    toggleGroup('.uam_settings_group_post_type');

    // Functions for the setup page
    jQuery('#uam_reset_confirm').on('change paste keyup', function () {
        var $button = jQuery('#uam_reset_submit');

        if (jQuery(this).val() === 'reset') {
            $button.removeAttr('disabled');
        } else if (typeof $button.attr('disabled') === 'undefined') {
            $button.attr('disabled', 'disabled');
        }
    })
});
```
