Commit 01576f24 authored by webchick's avatar webchick

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

parent ce86e09d
...@@ -91,10 +91,10 @@ ...@@ -91,10 +91,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: shift_color(c, a, b) === d, then * It is also symmetrical. If: shiftColor(c, a, b) === d, then
* shift_color(d, b, a) === c. * shiftColor(d, b, a) === c.
* *
* @function Drupal.color~shift_color * @function Drupal.color~shiftColor
* *
* @param {string} given * @param {string} given
* A hex color code to shift. * A hex color code to shift.
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
* @return {string} * @return {string}
* A hex color, shifted. * A hex color, shifted.
*/ */
function shift_color(given, ref1, ref2) { function shiftColor(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));
...@@ -177,14 +177,14 @@ ...@@ -177,14 +177,14 @@
if (!locks[j - 1] || $(locks[j - 1]).is('.is-unlocked')) { if (!locks[j - 1] || $(locks[j - 1]).is('.is-unlocked')) {
break; 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); 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 = 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); callback(inputs[j], matched, false);
} }
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
Drupal.color.callback(context, settings, form, farb, height, width); Drupal.color.callback(context, settings, form, farb, height, width);
} }
function shift_color(given, ref1, ref2) { function shiftColor(given, ref1, ref2) {
var d = void 0; var d = void 0;
given = farb.RGBToHSL(farb.unpack(given)); given = farb.RGBToHSL(farb.unpack(given));
...@@ -116,14 +116,14 @@ ...@@ -116,14 +116,14 @@
if (!locks[j - 1] || $(locks[j - 1]).is('.is-unlocked')) { if (!locks[j - 1] || $(locks[j - 1]).is('.is-unlocked')) {
break; 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); 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 = 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); callback(inputs[j], matched, false);
} }
......
...@@ -47,20 +47,20 @@ ...@@ -47,20 +47,20 @@
} }
// Set up gradients if there are some. // Set up gradients if there are some.
let color_start; let colorStart;
let color_end; let colorEnd;
for (const i in settings.gradients) { for (const i in settings.gradients) {
if (settings.gradients.hasOwnProperty(i)) { if (settings.gradients.hasOwnProperty(i)) {
color_start = farb.unpack(form.find(`.color-palette input[name="palette[${settings.gradients[i].colors[0]}]"]`).val()); colorStart = 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()); colorEnd = farb.unpack(form.find(`.color-palette input[name="palette[${settings.gradients[i].colors[1]}]"]`).val());
if (color_start && color_end) { if (colorStart && colorEnd) {
delta = []; delta = [];
for (const j in color_start) { for (const j in colorStart) {
if (color_start.hasOwnProperty(j)) { if (colorStart.hasOwnProperty(j)) {
delta[j] = (color_end[j] - color_start[j]) / (settings.gradients[i].vertical ? height[i] : width[i]); delta[j] = (colorEnd[j] - colorStart[j]) / (settings.gradients[i].vertical ? height[i] : width[i]);
} }
} }
accum = color_start; accum = colorStart;
// Render gradient lines. // Render gradient lines.
form.find(`#gradient-${i} > div`).each(gradientLineColor); form.find(`#gradient-${i} > div`).each(gradientLineColor);
} }
......
...@@ -25,20 +25,20 @@ ...@@ -25,20 +25,20 @@
element.style.backgroundColor = farb.pack(accum); element.style.backgroundColor = farb.pack(accum);
} }
var color_start = void 0; var colorStart = void 0;
var color_end = void 0; var colorEnd = void 0;
for (var i in settings.gradients) { for (var i in settings.gradients) {
if (settings.gradients.hasOwnProperty(i)) { if (settings.gradients.hasOwnProperty(i)) {
color_start = farb.unpack(form.find('.color-palette input[name="palette[' + settings.gradients[i].colors[0] + ']"]').val()); colorStart = 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()); colorEnd = farb.unpack(form.find('.color-palette input[name="palette[' + settings.gradients[i].colors[1] + ']"]').val());
if (color_start && color_end) { if (colorStart && colorEnd) {
delta = []; delta = [];
for (var j in color_start) { for (var j in colorStart) {
if (color_start.hasOwnProperty(j)) { if (colorStart.hasOwnProperty(j)) {
delta[j] = (color_end[j] - color_start[j]) / (settings.gradients[i].vertical ? height[i] : width[i]); 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); 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