summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/language/language.admin.js
blob: 4011af980c3efd00479e5ca39606e3ec7b6a3d5a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/

(function ($, Drupal) {
  Drupal.behaviors.negotiationLanguage = {
    attach: function attach() {
      var $configForm = $('#language-negotiation-configure-form');
      var inputSelector = 'input[name$="[configurable]"]';

      function toggleTable(checkbox) {
        var $checkbox = $(checkbox);
        $checkbox.closest('.table-language-group').find('table, .tabledrag-toggle-weight').toggle($checkbox.prop('checked'));
      }

      $configForm.once('negotiation-language-admin-bind').on('change', inputSelector, function (event) {
        toggleTable(event.target);
      });
      $configForm.find("".concat(inputSelector, ":not(:checked)")).each(function (index, element) {
        toggleTable(element);
      });
    }
  };
})(jQuery, Drupal);