2 * DO NOT EDIT THIS FILE.
3 * See the following change record for more information,
4 * https://www.drupal.org/node/2815083
8 (function ($, Drupal) {
9 Drupal.behaviors.permissions = {
10 attach: function attach(context) {
12 $('table#permissions').once('permissions').each(function () {
14 var $ancestor = void 0;
16 if ($table.prev().length) {
17 $ancestor = $table.prev();
20 $ancestor = $table.parent();
25 var $dummy = $('<input type="checkbox" class="dummy-checkbox js-dummy-checkbox" disabled="disabled" checked="checked" />').attr('title', Drupal.t('This permission is inherited from the authenticated user role.')).hide();
27 $table.find('input[type="checkbox"]').not('.js-rid-anonymous, .js-rid-authenticated').addClass('real-checkbox js-real-checkbox').after($dummy);
29 $table.find('input[type=checkbox].js-rid-authenticated').on('click.permissions', self.toggle).each(self.toggle);
31 $ancestor[method]($table);
34 toggle: function toggle() {
35 var authCheckbox = this;
36 var $row = $(this).closest('tr');
38 $row.find('.js-real-checkbox').each(function () {
39 this.style.display = authCheckbox.checked ? 'none' : '';
41 $row.find('.js-dummy-checkbox').each(function () {
42 this.style.display = authCheckbox.checked ? '' : 'none';