mirror of
https://github.com/PitPik/tinyColorPicker
synced 2025-07-03 08:04:30 -06:00
some code cleanup
This commit is contained in:
parent
1d6db268ad
commit
50f1f34c4e
@ -170,10 +170,10 @@
|
|||||||
isAlpha = colors.alpha !== 1,
|
isAlpha = colors.alpha !== 1,
|
||||||
alpha = Math.round(colors.alpha * 100) / 100,
|
alpha = Math.round(colors.alpha * 100) / 100,
|
||||||
RGBInnerText = RGB.r + ', ' + RGB.g + ', ' + RGB.b,
|
RGBInnerText = RGB.r + ', ' + RGB.g + ', ' + RGB.b,
|
||||||
RGBAText = 'rgba(' + RGBInnerText + ', ' + alpha + ')',
|
|
||||||
text = (colorMode === 'HEX' && !isAlpha ? '#' + colors.HEX :
|
text = (colorMode === 'HEX' && !isAlpha ? '#' + colors.HEX :
|
||||||
colorMode === 'rgb' || (colorMode === 'HEX' && isAlpha) ?
|
colorMode === 'rgb' || (colorMode === 'HEX' && isAlpha) ?
|
||||||
(!isAlpha ? 'rgb(' + RGBInnerText + ')' : RGBAText) :
|
(!isAlpha ? 'rgb(' + RGBInnerText + ')' :
|
||||||
|
'rgba(' + RGBInnerText + ', ' + alpha + ')') :
|
||||||
('hsl' + (isAlpha ? 'a(' : '(') + HSL.h + ', ' + HSL.s + '%, ' +
|
('hsl' + (isAlpha ? 'a(' : '(') + HSL.h + ', ' + HSL.s + '%, ' +
|
||||||
HSL.l + '%' + (isAlpha ? ', ' + alpha : '') + ')')),
|
HSL.l + '%' + (isAlpha ? ', ' + alpha : '') + ')')),
|
||||||
HUEContrast = colors.HUELuminance > 0.22 ? dark : light,
|
HUEContrast = colors.HUELuminance > 0.22 ? dark : light,
|
||||||
@ -248,8 +248,6 @@
|
|||||||
$.fn.colorPicker = function(options) {
|
$.fn.colorPicker = function(options) {
|
||||||
var noop = function(){};
|
var noop = function(){};
|
||||||
|
|
||||||
_instance = _instance ? _instance.add(this) : this;
|
|
||||||
|
|
||||||
options = $.extend({
|
options = $.extend({
|
||||||
animationSpeed: 150,
|
animationSpeed: 150,
|
||||||
GPU: true,
|
GPU: true,
|
||||||
@ -265,7 +263,10 @@
|
|||||||
// preventFocus: false
|
// preventFocus: false
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
|
_instance = _instance ? _instance.add(this) : this;
|
||||||
_selector += (_selector ? ', ' : '') + this.selector;
|
_selector += (_selector ? ', ' : '') + this.selector;
|
||||||
|
this.colorPicker = _colorPicker ||
|
||||||
|
(_colorPicker = new ColorPicker(options));
|
||||||
|
|
||||||
$(options.body).off('.a').
|
$(options.body).off('.a').
|
||||||
on('touchstart.a mousedown.a pointerdown.a', function(e) {
|
on('touchstart.a mousedown.a pointerdown.a', function(e) {
|
||||||
@ -283,9 +284,6 @@
|
|||||||
_instance.colorPicker.render();
|
_instance.colorPicker.render();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.colorPicker = _colorPicker ||
|
|
||||||
(_colorPicker = new ColorPicker(options));
|
|
||||||
|
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
var value = extractValue(this),
|
var value = extractValue(this),
|
||||||
mode = value.split('('),
|
mode = value.split('('),
|
||||||
|
File diff suppressed because one or more lines are too long
2
jqColorPicker.min.js
vendored
2
jqColorPicker.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user