Issue #2927228 by drpal, mikejw, dawehner, webchick, xjm: 2/3 JS codestyle: camelcase

8.5.x
webchick 2017-12-03 08:04:02 -08:00
parent ce86e09d3a
commit 01576f24da
4 changed files with 27 additions and 27 deletions

View File

@ -91,10 +91,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: shift_color(c, a, b) === d, then
* shift_color(d, b, a) === c.
* It is also symmetrical. If: shiftColor(c, a, b) === d, then
* shiftColor(d, b, a) === c.
*
* @function Drupal.color~shift_color
* @function Drupal.color~shiftColor
*
* @param {string} given
* A hex color code to shift.
@ -106,7 +106,7 @@
* @return {string}
* A hex color, shifted.
*/
function shift_color(given, ref1, ref2) {
function shiftColor(given, ref1, ref2) {
let d;
// Convert to HSL.
given = farb.RGBToHSL(farb.unpack(given));
@ -177,14 +177,14 @@
if (!locks[j - 1] || $(locks[j - 1]).is('.is-unlocked')) {
break;
}
matched = shift_color(color, reference[input.key], reference[inputs[j].key]);
matched = shiftColor(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 = shift_color(color, reference[input.key], reference[inputs[j].key]);
matched = shiftColor(color, reference[input.key], reference[inputs[j].key]);
callback(inputs[j], matched, false);
}

View File

@ -67,7 +67,7 @@
Drupal.color.callback(context, settings, form, farb, height, width);
}
function shift_color(given, ref1, ref2) {
function shiftColor(given, ref1, ref2) {
var d = void 0;
given = farb.RGBToHSL(farb.unpack(given));
@ -116,14 +116,14 @@
if (!locks[j - 1] || $(locks[j - 1]).is('.is-unlocked')) {
break;
}
matched = shift_color(color, reference[input.key], reference[inputs[j].key]);
matched = shiftColor(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 = shift_color(color, reference[input.key], reference[inputs[j].key]);
matched = shiftColor(color, reference[input.key], reference[inputs[j].key]);
callback(inputs[j], matched, false);
}

View File

@ -47,20 +47,20 @@
}
// Set up gradients if there are some.
let color_start;
let color_end;
let colorStart;
let colorEnd;
for (const i in settings.gradients) {
if (settings.gradients.hasOwnProperty(i)) {
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) {
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) {
delta = [];
for (const j in color_start) {
if (color_start.hasOwnProperty(j)) {
delta[j] = (color_end[j] - color_start[j]) / (settings.gradients[i].vertical ? height[i] : width[i]);
for (const j in colorStart) {
if (colorStart.hasOwnProperty(j)) {
delta[j] = (colorEnd[j] - colorStart[j]) / (settings.gradients[i].vertical ? height[i] : width[i]);
}
}
accum = color_start;
accum = colorStart;
// Render gradient lines.
form.find(`#gradient-${i} > div`).each(gradientLineColor);
}

View File

@ -25,20 +25,20 @@
element.style.backgroundColor = farb.pack(accum);
}
var color_start = void 0;
var color_end = void 0;
var colorStart = void 0;
var colorEnd = void 0;
for (var i in settings.gradients) {
if (settings.gradients.hasOwnProperty(i)) {
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) {
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) {
delta = [];
for (var j in color_start) {
if (color_start.hasOwnProperty(j)) {
delta[j] = (color_end[j] - color_start[j]) / (settings.gradients[i].vertical ? height[i] : width[i]);
for (var j in colorStart) {
if (colorStart.hasOwnProperty(j)) {
delta[j] = (colorEnd[j] - colorStart[j]) / (settings.gradients[i].vertical ? height[i] : width[i]);
}
}
accum = color_start;
accum = colorStart;
form.find('#gradient-' + i + ' > div').each(gradientLineColor);
}