Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / color / color.js
index 5cc0b9be12d94d407f4ca737336601b70796e1ed..c92a0df36dcb78ac499b13b14b687e0aeab5f734 100644 (file)
       var height = [];
       var width = [];
 
-      Object.keys(settings.gradients || {}).forEach(function (i) {
-        $('.color-preview').once('color').append('<div id="gradient-' + i + '"></div>');
-        var gradient = $('.color-preview #gradient-' + i);
-
-        height.push(parseInt(gradient.css('height'), 10) / 10);
-
-        width.push(parseInt(gradient.css('width'), 10) / 10);
-
-        for (j = 0; j < (settings.gradients[i].direction === 'vertical' ? height[i] : width[i]); ++j) {
-          gradient.append('<div class="gradient-line"></div>');
-        }
-      });
-
-      form.find('#edit-scheme').on('change', function () {
-        var schemes = settings.color.schemes;
-        var colorScheme = this.options[this.selectedIndex].value;
-        if (colorScheme !== '' && schemes[colorScheme]) {
-          colors = schemes[colorScheme];
-          Object.keys(colors || {}).forEach(function (fieldName) {
-            callback($('#edit-palette-' + fieldName), colors[fieldName], false, true);
-          });
-          preview();
-        }
-      });
-
       function preview() {
         Drupal.color.callback(context, settings, form, farb, height, width);
       }
 
+      function resetScheme() {
+        form.find('#edit-scheme').each(function () {
+          this.selectedIndex = this.options.length - 1;
+        });
+      }
+
       function shiftColor(given, ref1, ref2) {
         var d = void 0;
 
         }
       }
 
-      function resetScheme() {
-        form.find('#edit-scheme').each(function () {
-          this.selectedIndex = this.options.length - 1;
-        });
-      }
+      Object.keys(settings.gradients || {}).forEach(function (i) {
+        $('.color-preview').once('color').append('<div id="gradient-' + i + '"></div>');
+        var gradient = $('.color-preview #gradient-' + i);
+
+        height.push(parseInt(gradient.css('height'), 10) / 10);
+
+        width.push(parseInt(gradient.css('width'), 10) / 10);
+
+        for (j = 0; j < (settings.gradients[i].direction === 'vertical' ? height[i] : width[i]); ++j) {
+          gradient.append('<div class="gradient-line"></div>');
+        }
+      });
+
+      form.find('#edit-scheme').on('change', function () {
+        var schemes = settings.color.schemes;
+        var colorScheme = this.options[this.selectedIndex].value;
+        if (colorScheme !== '' && schemes[colorScheme]) {
+          colors = schemes[colorScheme];
+          Object.keys(colors || {}).forEach(function (fieldName) {
+            callback($('#edit-palette-' + fieldName), colors[fieldName], false, true);
+          });
+          preview();
+        }
+      });
 
       function focus(e) {
         var input = e.target;