# content-control/1.1.2/assets/scripts/widget-editor.js

Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks &amp; More, version 1.1.2. 26 lines.

- Page: https://pluginprobe.com/plugins/content-control/1.1.2/code/assets/scripts/widget-editor.js
- Raw: https://pluginprobe.com/plugins/content-control/1.1.2/raw/assets/scripts/widget-editor.js
- Modified: 2016-09-30T20:07:12+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/content-control/1.1.2/code/assets/scripts/widget-editor.js#L10-L20`.

```javascript
(function ($) {
    "use strict";

    function which_users() {
        var $this = $(this),
            $item = $this.parents('.widget').eq(0),
            $roles = $item.find('.widget_options-roles');

        if ($this.val() == 'logged_in') {
            $roles.show();
        } else {
            $roles.hide();
        }
    }


    function refresh_all_items() {
        $('.widget_options-which_users select').each(which_users);
    }

    $(document)
        .on('change', '.widget_options-which_users select', which_users)
        .on('widget-updated', refresh_all_items)
        .ready(refresh_all_items);

}(jQuery));
```
