diff --git a/common/js/plugins/ui.colorpicker/xe_colorpicker.js b/common/js/plugins/ui.colorpicker/xe_colorpicker.js index 8193845b9..a88aecb31 100644 --- a/common/js/plugins/ui.colorpicker/xe_colorpicker.js +++ b/common/js/plugins/ui.colorpicker/xe_colorpicker.js @@ -3,364 +3,364 @@ * @author mygony (http://mygony.com) **/ jQuery(function($){ - var ready = false; - var tmp = $('').hide(); - // var panel = null; - - $.fn.xe_colorpicker = function(settings){ - var selection = this; + var ready = false; + var tmp = $('').hide(); + // var panel = null; - if (!ready) { - ColorPicker.init(settings); - ready = true; - } - - this.each(function(){ - var col = color($(this).val()); + $.fn.xe_colorpicker = function(settings){ + var selection = this; - $(this).val( col ).css('background-color', col ); - setTextColor( $(this) ); - }).focus(function(event){ - var t = this; - $(this).select(); - - // show color picker - ColorPicker.show(this); - }).keypress(function(event){ - if (!ColorPicker.is(':visible')) return; - - if (/^#?[0-9a-f]{6}$/i.test( event.target.value )) { - ColorPicker.color( event.target.value ); - } - }); - - $(document).mousedown(function(event){ - var target = event.target; - - if (selection.index(target) > -1) return; - if ($(target).parents().add(target).index(ColorPicker.element) > -1) return; - if ($(target).parents().add(target).index(ColorPicker.buttons) > -1) return; - - ColorPicker.hide(); - }); + if (!ready) { + ColorPicker.init(settings); + ready = true; + } - return this; - }; - - var ColorPicker = { - element : null, - picker : null, - colpane: null, - buttons : null, - _target : null, - _backup : null, - _hsv : null, - _mode : 'none', + this.each(function(){ + var col = color($(this).val()); - init : function() { - var cp = this; - - this.element = $('
'); - - this.picker = this.element.find('> div.colorpicker'); - this.colpane = this.picker.find('div.colortable > div.background'); - this.colpoint = this.colpane.find('> .indicator'); - this.buttons = this.element.find('> div.buttons'); - this.huepane = this.element.find('div.huebar > .background'); - this.huepoint = this.huepane.find('> .indicator'); - - this._mousedown = method(this.onmousedown, this); - this._mousemove = method(this.onmousemove, this); - this._mouseup = method(this.onmouseup, this); - - this.picker.find('.background').mousedown(this._mousedown); - - this.buttons.find('button.ok').click(method(this.ok,this)); - this.buttons.find('button.cancel').click(method(this.cancel,this)); - this.buttons.find('button.none').click(method(this.none,this)); - - // only for IE6 - if ($.browser.msie && parseInt($.browser.version) < 7) { - this.element.append( $('