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

This reverts commit 27253f7214.
8.5.x
xjm 2017-12-01 13:28:46 -06:00
parent 59b1bac3d6
commit f7e2d52e5c
4 changed files with 25 additions and 25 deletions

View File

@ -85,10 +85,10 @@
* This algorithm ensures relative ordering on the saturation and
* luminance axes is preserved, and performs a simple hue shift.
*
* It is also symmetrical. If: shiftColor(c, a, b) === d, then
* shiftColor(d, b, a) === c.
* It is also symmetrical. If: shift_color(c, a, b) === d, then
* shift_color(d, b, a) === c.
*
* @function Drupal.color~shiftColor
* @function Drupal.color~shift_color
*
* @param {string} given
* A hex color code to shift.
@ -100,7 +100,7 @@
* @return {string}
* A hex color, shifted.
*/
function shiftColor(given, ref1, ref2) {
function shift_color(given, ref1, ref2) {
let d;
// Convert to HSL.
given = farb.RGBToHSL(farb.unpack(given));
@ -171,14 +171,14 @@
if (!locks[j - 1] || $(locks[j - 1]).is('.is-unlocked')) {
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);
}
for (j = i - 1; ; --j) {
if (!locks[j] || $(locks[j]).is('.is-unlocked')) {
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);
}

View File

@ -61,7 +61,7 @@
Drupal.color.callback(context, settings, form, farb, height, width);
}
function shiftColor(given, ref1, ref2) {
function shift_color(given, ref1, ref2) {
var d = void 0;
given = farb.RGBToHSL(farb.unpack(given));
@ -110,14 +110,14 @@
if (!locks[j - 1] || $(locks[j - 1]).is('.is-unlocked')) {
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);
}
for (j = i - 1;; --j) {
if (!locks[j] || $(locks[j]).is('.is-unlocked')) {
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);
}

View File

@ -45,17 +45,17 @@
}
// Set up gradients if there are some.
let colorStart;
let colorEnd;
let color_start;
let color_end;
Object.keys(settings.gradients).forEach((i) => {
colorStart = 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());
if (colorStart && colorEnd) {
color_start = farb.unpack(form.find(`.color-palette input[name="palette[${settings.gradients[i].colors[0]}]"]`).val());
color_end = farb.unpack(form.find(`.color-palette input[name="palette[${settings.gradients[i].colors[1]}]"]`).val());
if (color_start && color_end) {
delta = [];
Object.keys(colorStart).forEach((colorStartKey) => {
delta[colorStartKey] = (colorEnd[colorStartKey] - colorStart[colorStartKey]) / (settings.gradients[i].vertical ? height[i] : width[i]);
Object.keys(color_start).forEach((colorStartKey) => {
delta[colorStartKey] = (color_end[colorStartKey] - color_start[colorStartKey]) / (settings.gradients[i].vertical ? height[i] : width[i]);
});
accum = colorStart;
accum = color_start;
// Render gradient lines.
form.find(`#gradient-${i} > div`).each(gradientLineColor);
}

View File

@ -23,17 +23,17 @@
element.style.backgroundColor = farb.pack(accum);
}
var colorStart = void 0;
var colorEnd = void 0;
var color_start = void 0;
var color_end = void 0;
Object.keys(settings.gradients).forEach(function (i) {
colorStart = 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());
if (colorStart && colorEnd) {
color_start = farb.unpack(form.find('.color-palette input[name="palette[' + settings.gradients[i].colors[0] + ']"]').val());
color_end = farb.unpack(form.find('.color-palette input[name="palette[' + settings.gradients[i].colors[1] + ']"]').val());
if (color_start && color_end) {
delta = [];
Object.keys(colorStart).forEach(function (colorStartKey) {
delta[colorStartKey] = (colorEnd[colorStartKey] - colorStart[colorStartKey]) / (settings.gradients[i].vertical ? height[i] : width[i]);
Object.keys(color_start).forEach(function (colorStartKey) {
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);
}