Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / system / js / system.js
1 /**
2 * DO NOT EDIT THIS FILE.
3 * See the following change record for more information,
4 * https://www.drupal.org/node/2815083
5 * @preserve
6 **/
7
8 (function ($, Drupal, drupalSettings) {
9   var ids = [];
10
11   Drupal.behaviors.copyFieldValue = {
12     attach: function attach(context) {
13       for (var sourceId in drupalSettings.copyFieldValue) {
14         if (drupalSettings.copyFieldValue.hasOwnProperty(sourceId)) {
15           ids.push(sourceId);
16         }
17       }
18       if (ids.length) {
19         $('body').once('copy-field-values').on('value:copy', this.valueTargetCopyHandler);
20
21         $('#' + ids.join(', #')).once('copy-field-values').on('blur', this.valueSourceBlurHandler);
22       }
23     },
24     detach: function detach(context, settings, trigger) {
25       if (trigger === 'unload' && ids.length) {
26         $('body').removeOnce('copy-field-values').off('value:copy');
27         $('#' + ids.join(', #')).removeOnce('copy-field-values').off('blur');
28       }
29     },
30     valueTargetCopyHandler: function valueTargetCopyHandler(e, value) {
31       var $target = $(e.target);
32       if ($target.val() === '') {
33         $target.val(value);
34       }
35     },
36     valueSourceBlurHandler: function valueSourceBlurHandler(e) {
37       var value = $(e.target).val();
38       var targetIds = drupalSettings.copyFieldValue[e.target.id];
39       $('#' + targetIds.join(', #')).trigger('value:copy', value);
40     }
41   };
42 })(jQuery, Drupal, drupalSettings);