mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:37:51 +02:00
[Case 4315] ESLint Pass 5 resolves hex already defined issue (details below).
* var hex was declared both the hexToRGB and hexToHsb functions. * hexToRGB was updated to have a more explicit var name * hexToRGB & hexToHSB also had the function param name updated to clarify the expected object type. Also error statements and early returns were added should an unsupported object type be received. * Issue Count is now 28 Changes Committed: modified: scripts/system/html/js/colpick.js
This commit is contained in:
parent
ef1fd19a98
commit
83749b16c7
1 changed files with 15 additions and 5 deletions
|
@ -496,12 +496,22 @@ For usage and examples: colpick.com/plugin
|
||||||
};
|
};
|
||||||
}();
|
}();
|
||||||
// Color space convertions
|
// Color space convertions
|
||||||
var hexToRgb = function (hex) {
|
var hexToRgb = function (hexString) {
|
||||||
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
|
if (typeof hexString !== "string") {
|
||||||
return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
|
print("Error - ColPick.js::hexToRgb expects string object.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var hexNumber = parseInt(((hexString.indexOf('#') > -1) ? hexString.substring(1) : hexString), 16);
|
||||||
|
return { r: hexNumber >> 16, g: (hexNumber & 0x00FF00) >> 8, b: (hexNumber & 0x0000FF)};
|
||||||
};
|
};
|
||||||
var hexToHsb = function (hex) {
|
var hexToHsb = function (hexString) {
|
||||||
return rgbToHsb(hexToRgb(hex));
|
if (typeof hexString !== "string") {
|
||||||
|
print("Error - ColPick.js::hexToHsb expects string object.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rgbToHsb(hexToRgb(hexString));
|
||||||
};
|
};
|
||||||
var rgbToHsb = function (rgb) {
|
var rgbToHsb = function (rgb) {
|
||||||
var hsb = {h: 0, s: 0, b: 0};
|
var hsb = {h: 0, s: 0, b: 0};
|
||||||
|
|
Loading…
Reference in a new issue