Index: colorpicker.html
===================================================================
--- colorpicker.html (revision 253)
+++ colorpicker.html (working copy)
@@ -1,28 +1,28 @@
-
Color picker
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
+
+
+
-
+
Index: ui.colorpicker.js
===================================================================
--- ui.colorpicker.js (revision 253)
+++ ui.colorpicker.js (working copy)
@@ -1,24 +1,27 @@
-;(function($) {
+;(function($) {
- $.fn.extend({
- colorpicker: function(options) {
- var args = Array.prototype.slice.call(arguments, 1);
- return this.each(function() {
- if (typeof options == "string") {
- var inst = $.data(this, "colorpicker");
- if(inst) inst[options].apply(inst, args);
- } else if(!$.data(this, "colorpicker"))
- new $.ui.colorpicker(this, options);
- });
- }
- });
-
- $.ui.colorpicker = function(element, options) {
+$.widget("ui.colorpicker", {
+ plugins: {},
+ ui: function(e) {
+ return {
+ options: this.options,
+ element: this.element,
+ rgb: this.currentColor,
+ hex: (this.toHex(this.currentColor.r) + this.toHex(this.currentColor.g) + this.toHex(this.currentColor.b)).toUpperCase()
+ };
+ },
+ propagate: function(n,e) {
+ $.ui.plugin.call(this, n, [e, this.ui()]);
+ return this.element.triggerHandler(n == "pick" ? n : "pick"+n, [e, this.ui()], this.options[n]);
+ },
+
+ init: function() {
+
//Initialize needed constants
var self = this;
- this.element = $(element);
- var o = this.options = $.extend({}, options);
+ var element = this.element;
+ var o = this.options = $.extend({}, self.options);
$.data(element, "colorpicker", this);
this.element.addClass("ui-colorpicker")
@@ -85,63 +88,48 @@
});
- };
+ },
+
+ destroy: function() {
+ if(!$.data(this.element[0], 'colorpicker')) return;
+ this.element
+ .removeClass("ui-colorpicker ui-colorpicker-disabled")
+ .removeData("colorpicker")
+ .unbind(".colorpicker");
+ },
+ enable: function() {
+ this.element.removeClass("ui-colorpicker-disabled");
+ this.options.disabled = false;
+ },
+ disable: function() {
+ this.element.addClass("ui-colorpicker-disabled");
+ this.options.disabled = true;
+ },
+ setVertColor: function(indic){
+ var n=256/6, j=256/n, C=indic, c=C%n;
+ this.baseColor = {
+ r : parseInt(C