Commit f7e2d52e authored by xjm's avatar xjm

Revert "Issue #2927228 by drpal, dawehner: 2/3 JS codestyle: camelcase"

This reverts commit 27253f72.
parent 59b1bac3
...@@ -85,10 +85,10 @@ ...@@ -85,10 +85,10 @@
* This algorithm ensures relative ordering on the saturation and * This algorithm ensures relative ordering on the saturation and
* luminance axes is preserved, and performs a simple hue shift. * luminance axes is preserved, and performs a simple hue shift.
* *
* It is also symmetrical. If: shiftColor(c, a, b) === d, then * It is also symmetrical. If: shift_color(c, a, b) === d, then
* shiftColor(d, b, a) === c. * shift_color(d, b, a) === c.
* *
* @function Drupal.color~shiftColor * @function Drupal.color~shift_color
* *
* @param {string} given * @param {string} given
* A hex color code to shift. * A hex color code to shift.
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
* @return {string} * @return {string}
* A hex color, shifted. * A hex color, shifted.
*/ */
function shiftColor(given, ref1, ref2) { function shift_color(given, ref1, ref2) {
let d; let d;
// Convert to HSL. // Convert to HSL.
given = farb.RGBToHSL(farb.unpack(given)); given = farb.RGBToHSL(farb.unpack(given));
...@@ -171,14 +171,14 @@ ...@@ -171,14 +171,14 @@
if (!locks[j - 1] || $(locks[j - 1]).is('.is-unlocked')) { if (!locks[j - 1] || $(locks[j - 1]).is('.is-unlocked')) {
break; break;
} }
matched = shiftColor(color, reference[input.key], reference[inputs[j].key]); matched = shift_color(color, reference[input.key], reference[inputs[j].key]);
callback(inputs[j], matched, false); callback(inputs[j], matched, false);
} }
for (j = i - 1; ; --j) { for (j = i - 1; ; --j) {
if (!locks[j] || $(locks[j]).is('.is-unlocked')) { if (!locks[j] || $(locks[j]).is('.is-unlocked')) {
break; break;
} }
matched = shiftColor(color, reference[input.key], reference[inputs[j].key]); matched = shift_color(color, reference[input.key], reference[inputs[j].key]);
callback(inputs[j], matched, false); callback(inputs[j], matched, false);
} }
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
Drupal.color.callback(context, settings, form, farb, height, width); Drupal.color.callback(context, settings, form, farb, height, width);
} }
function shiftColor(given, ref1, ref2) { function shift_color(given, ref1, ref2) {
var d = void 0; var d = void 0;
given = farb.RGBToHSL(farb.unpack(given)); given = farb.RGBToHSL(farb.unpack(given));
...@@ -110,14 +110,14 @@ ...@@ -110,14 +110,14 @@
if (!locks[j - 1] || $(locks[j - 1]).is('.is-unlocked')) { if (!locks[j - 1] || $(locks[j - 1]).is('.is-unlocked')) {
break; break;
} }
matched = shiftColor(color, reference[input.key], reference[inputs[j].key]); matched = shift_color(color, reference[input.key], reference[inputs[j].key]);
callback(inputs[j], matched, false); callback(inputs[j], matched, false);
} }
for (j = i - 1;; --j) { for (j = i - 1;; --j) {
if (!locks[j] || $(locks[j]).is('.is-unlocked')) { if (!locks[j] || $(locks[j]).is('.is-unlocked')) {
break; break;
} }
matched = shiftColor(color, reference[input.key], reference[inputs[j].key]); matched = shift_color(color, reference[input.key], reference[inputs[j].key]);
callback(inputs[j], matched, false); callback(inputs[j], matched, false);
} }
......
...@@ -45,17 +45,17 @@ ...@@ -45,17 +45,17 @@
} }
// Set up gradients if there are some. // Set up gradients if there are some.
let colorStart; let color_start;
let colorEnd; let color_end;
Object.keys(settings.gradients).forEach((i) => { Object.keys(settings.gradients).forEach((i) => {
colorStart = farb.unpack(form.find(`.color-palette input[name="palette[${settings.gradients[i].colors[0]}]"]`).val()); color_start = farb.unpack(form.find(`.color-palette input[name="palette[${settings.gradients[i].colors[0]}]"]`).val());
colorEnd = farb.unpack(form.find(`.color-palette input[name="palette[${settings.gradients[i].colors[1]}]"]`).val()); color_end = farb.unpack(form.find(`.color-palette input[name="palette[${settings.gradients[i].colors[1]}]"]`).val());
if (colorStart && colorEnd) { if (color_start && color_end) {
delta = []; delta = [];
Object.keys(colorStart).forEach((colorStartKey) => { Object.keys(color_start).forEach((colorStartKey) => {
delta[colorStartKey] = (colorEnd[colorStartKey] - colorStart[colorStartKey]) / (settings.gradients[i].vertical ? height[i] : width[i]); delta[colorStartKey] = (color_end[colorStartKey] - color_start[colorStartKey]) / (settings.gradients[i].vertical ? height[i] : width[i]);
}); });
accum = colorStart; accum = color_start;
// Render gradient lines. // Render gradient lines.
form.find(`#gradient-${i} > div`).each(gradientLineColor); form.find(`#gradient-${i} > div`).each(gradientLineColor);
} }
......
...@@ -23,17 +23,17 @@ ...@@ -23,17 +23,17 @@
element.style.backgroundColor = farb.pack(accum); element.style.backgroundColor = farb.pack(accum);
} }
var colorStart = void 0; var color_start = void 0;
var colorEnd = void 0; var color_end = void 0;
Object.keys(settings.gradients).forEach(function (i) { Object.keys(settings.gradients).forEach(function (i) {
colorStart = farb.unpack(form.find('.color-palette input[name="palette[' + settings.gradients[i].colors[0] + ']"]').val()); color_start = farb.unpack(form.find('.color-palette input[name="palette[' + settings.gradients[i].colors[0] + ']"]').val());
colorEnd = farb.unpack(form.find('.color-palette input[name="palette[' + settings.gradients[i].colors[1] + ']"]').val()); color_end = farb.unpack(form.find('.color-palette input[name="palette[' + settings.gradients[i].colors[1] + ']"]').val());
if (colorStart && colorEnd) { if (color_start && color_end) {
delta = []; delta = [];
Object.keys(colorStart).forEach(function (colorStartKey) { Object.keys(color_start).forEach(function (colorStartKey) {
delta[colorStartKey] = (colorEnd[colorStartKey] - colorStart[colorStartKey]) / (settings.gradients[i].vertical ? height[i] : width[i]); delta[colorStartKey] = (color_end[colorStartKey] - color_start[colorStartKey]) / (settings.gradients[i].vertical ? height[i] : width[i]);
}); });
accum = colorStart; accum = color_start;
form.find('#gradient-' + i + ' > div').each(gradientLineColor); form.find('#gradient-' + i + ' > div').each(gradientLineColor);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment