|
|
@ -127,50 +127,42 @@
|
|
|
|
}, 0);
|
|
|
|
}, 0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (!colorPickers.evt || off) {
|
|
|
|
$(window)[onOff]('mousedown.colorPicker', function(e) {
|
|
|
|
colorPickers.evt = true; // prevent new eventListener for window
|
|
|
|
var colorPicker = colorPickers.current,
|
|
|
|
|
|
|
|
$colorPicker = $(colorPicker ? colorPicker.nodes.colorPicker : undefined),
|
|
|
|
$(window)[onOff]('mousedown.colorPicker', function(e) {
|
|
|
|
animationSpeed = colorPicker ? colorPicker.color.options.animationSpeed : 0,
|
|
|
|
var colorPicker = colorPickers.current,
|
|
|
|
isColorPicker = $(e.target).closest('.cp-app')[0],
|
|
|
|
$colorPicker = $(colorPicker ? colorPicker.nodes.colorPicker : undefined),
|
|
|
|
inputIndex = $(that).index(e.target);
|
|
|
|
animationSpeed = colorPicker ? colorPicker.color.options.animationSpeed : 0,
|
|
|
|
|
|
|
|
isColorPicker = $(e.target).closest('.cp-app')[0],
|
|
|
|
if (isColorPicker && colorPicker && $(colorPickers).index(isColorPicker)) {
|
|
|
|
inputIndex = $(that).index(e.target);
|
|
|
|
if (e.target === colorPicker.nodes.exit) {
|
|
|
|
|
|
|
|
|
|
|
|
if (isColorPicker && colorPicker && $(colorPickers).index(isColorPicker)) {
|
|
|
|
|
|
|
|
if (e.target === colorPicker.nodes.exit) {
|
|
|
|
|
|
|
|
$colorPicker.hide(animationSpeed);
|
|
|
|
|
|
|
|
$(':focus').trigger('blur');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// buttons on colorPicker don't work any more
|
|
|
|
|
|
|
|
// $(document.body).append(isColorPicker);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (inputIndex !== -1) {
|
|
|
|
|
|
|
|
// input fireld
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$colorPicker.hide(animationSpeed);
|
|
|
|
$colorPicker.hide(animationSpeed);
|
|
|
|
|
|
|
|
$(':focus').trigger('blur');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// buttons on colorPicker don't work any more
|
|
|
|
|
|
|
|
// $(document.body).append(isColorPicker);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (inputIndex !== -1) {
|
|
|
|
}
|
|
|
|
// input fireld
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$colorPicker.hide(animationSpeed);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
that = this,
|
|
|
|
that = this,
|
|
|
|
colorPickers = this.colorPickers || [], // this is a way to prevent data binding on HTMLElements
|
|
|
|
colorPickers = $.fn.colorPicker.colorPickers || [], // this is a way to prevent data binding on HTMLElements
|
|
|
|
testColors = new window.Colors({
|
|
|
|
testColors = new window.Colors({
|
|
|
|
customBG: (config && config.customBG) || '#FFFFFF',
|
|
|
|
customBG: (config && config.customBG) || '#FFFFFF',
|
|
|
|
allMixDetails: true
|
|
|
|
allMixDetails: true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.colorPickers = colorPickers;
|
|
|
|
$.fn.colorPicker.colorPickers = colorPickers;
|
|
|
|
|
|
|
|
|
|
|
|
$(this).each(function(idx, elm) {
|
|
|
|
$(this).each(function(idx, elm) {
|
|
|
|
if (config === 'destroy') {
|
|
|
|
// doEventListeners(elm, (config && config.multipleInstances), true);
|
|
|
|
// doEventListeners(elm, (config && config.multipleInstances), true);
|
|
|
|
$(elm).off('.colorPicker');
|
|
|
|
$(elm).off('.colorPicker');
|
|
|
|
$(window).off('.colorPicker');
|
|
|
|
$(window).off('.colorPicker');
|
|
|
|
if (config !== 'destroy') {
|
|
|
|
if (colorPickers[idx]) {
|
|
|
|
|
|
|
|
colorPickers[idx].destroyAll();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
var value = elm.value.split('(');
|
|
|
|
var value = elm.value.split('(');
|
|
|
|
$(elm).data('colorMode', value[1] ? value[0].substr(0, 3) : 'HEX');
|
|
|
|
$(elm).data('colorMode', value[1] ? value[0].substr(0, 3) : 'HEX');
|
|
|
|
doEventListeners(elm, (config && config.multipleInstances), false);
|
|
|
|
doEventListeners(elm, (config && config.multipleInstances), false);
|
|
|
|