| 1 |
(function ($) { |
| 2 |
"use strict"; |
| 3 |
|
| 4 |
function which_users() { |
| 5 |
var $this = $(this), |
| 6 |
$item = $this.parents('.widget').eq(0), |
| 7 |
$roles = $item.find('.widget_options-roles'); |
| 8 |
|
| 9 |
if ($this.val() == 'logged_in') { |
| 10 |
$roles.show(); |
| 11 |
} else { |
| 12 |
$roles.hide(); |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
|
| 17 |
function refresh_all_items() { |
| 18 |
$('.widget_options-which_users select').each(which_users); |
| 19 |
} |
| 20 |
|
| 21 |
$(document) |
| 22 |
.on('change', '.widget_options-which_users select', which_users) |
| 23 |
.on('widget-updated', refresh_all_items) |
| 24 |
.ready(refresh_all_items); |
| 25 |
|
| 26 |
}(jQuery)); |