Security update to Drupal 8.4.6
[yaffs-website] / web / core / modules / color / preview.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) {
9   Drupal.color = {
10     callback: function callback(context, settings, form, farb, height, width) {
11       var accum = void 0;
12       var delta = void 0;
13
14       form.find('.color-preview').css('backgroundColor', form.find('.color-palette input[name="palette[base]"]').val());
15
16       form.find('#text').css('color', form.find('.color-palette input[name="palette[text]"]').val());
17       form.find('#text a, #text h2').css('color', form.find('.color-palette input[name="palette[link]"]').val());
18
19       function gradientLineColor(i, element) {
20         for (var k in accum) {
21           if (accum.hasOwnProperty(k)) {
22             accum[k] += delta[k];
23           }
24         }
25         element.style.backgroundColor = farb.pack(accum);
26       }
27
28       var color_start = void 0;
29       var color_end = void 0;
30       for (var i in settings.gradients) {
31         if (settings.gradients.hasOwnProperty(i)) {
32           color_start = farb.unpack(form.find('.color-palette input[name="palette[' + settings.gradients[i].colors[0] + ']"]').val());
33           color_end = farb.unpack(form.find('.color-palette input[name="palette[' + settings.gradients[i].colors[1] + ']"]').val());
34           if (color_start && color_end) {
35             delta = [];
36             for (var j in color_start) {
37               if (color_start.hasOwnProperty(j)) {
38                 delta[j] = (color_end[j] - color_start[j]) / (settings.gradients[i].vertical ? height[i] : width[i]);
39               }
40             }
41             accum = color_start;
42
43             form.find('#gradient-' + i + ' > div').each(gradientLineColor);
44           }
45         }
46       }
47     }
48   };
49 })(jQuery, Drupal);