diff --git a/types/jquery.colorpicker/index.d.ts b/types/jquery.colorpicker/index.d.ts index a2098e1ef9..05ee2cf5d2 100644 --- a/types/jquery.colorpicker/index.d.ts +++ b/types/jquery.colorpicker/index.d.ts @@ -31,6 +31,7 @@ interface JQueryColorpickerOptions { closeOnOutside?: boolean; color?: string; colorFormat?: string; + disabled: boolean; draggable?: boolean; duration?: string; format?: string; @@ -38,7 +39,7 @@ interface JQueryColorpickerOptions { hsv?: boolean; inline?: boolean; inlineFrame?: boolean; - layout?: {[part: string]: number[];}; + layout?: { [part: string]: number[]; }; limit?: string; modal?: boolean; mode?: string; @@ -67,7 +68,7 @@ interface JQueryColorpickerStatic { regional: { [key: string]: string; }; swatches: { [swatch: string]: { [name: string]: JQueryColorpickerStatic.RGB; }; }; writers: { [name: string]: (color: any, that: any) => any; }; - Color: { new (r?: number, g?: number, b?: number, a?: number): JQueryColorpickerStatic.Color; }; + Color: { new(r?: number, g?: number, b?: number, a?: number): JQueryColorpickerStatic.Color; }; } declare namespace JQueryColorpickerStatic { @@ -162,6 +163,6 @@ interface JQuery { colorpicker(method: "open"): JQuery; colorpicker(method: string): JQuery; colorpicker(method: "setColor", color: any): JQuery; - colorpicker(method: string, param: any): JQuery; + colorpicker(method: string, ...params: any[]): JQuery; colorpicker(options?: JQueryColorpickerOptions): JQuery; } diff --git a/types/jquery.colorpicker/jquery.colorpicker-tests.ts b/types/jquery.colorpicker/jquery.colorpicker-tests.ts index 707e2dd7f9..4d2adfb69b 100644 --- a/types/jquery.colorpicker/jquery.colorpicker-tests.ts +++ b/types/jquery.colorpicker/jquery.colorpicker-tests.ts @@ -17,6 +17,7 @@ var colorpicker = $("").colorpicker({ closeOnOutside: true, // Close the dialog when clicking outside the dialog (not for inline) color: '#00FF00', // Initial color (for inline only) colorFormat: 'HEX', // Format string for output color format + disabled: false, draggable: true, // Make popup dialog draggable if header is visible. duration: 'fast', hsv: true, // Show HSV controls and modes @@ -67,6 +68,7 @@ colorpicker.colorpicker("open"); colorpicker.colorpicker("close"); colorpicker.colorpicker("destroy"); colorpicker.colorpicker("setColor", "#deadbeef"); +colorpicker.colorpicker("option", "disabled", true); // example plugins provided @@ -94,23 +96,23 @@ $.colorpicker.parts["memory"] = function (inst) { break; } }).bind('contextmenu', function (e) { - e.preventDefault(); - }); + e.preventDefault(); + }); container.append($node); }, getMemory = function () { return ((document.cookie.match(/\bcolorpicker-memory=([^;]*)/) || [0, ''])[1]).split(','); }, - setMemory = function () { - var colors = []; - $('> *', container).each(function () { - colors.push(encodeURIComponent($(this).css('backgroundColor'))); - }); - var expdate = new Date(); - expdate.setDate(expdate.getDate() + (365 * 10)); - document.cookie = 'colorpicker-memory=' + colors.join() + ";expires=" + expdate.toUTCString(); - }; + setMemory = function () { + var colors = []; + $('> *', container).each(function () { + colors.push(encodeURIComponent($(this).css('backgroundColor'))); + }); + var expdate = new Date(); + expdate.setDate(expdate.getDate() + (365 * 10)); + document.cookie = 'colorpicker-memory=' + colors.join() + ";expires=" + expdate.toUTCString(); + }; this.init = function () { container = $('
') @@ -195,7 +197,7 @@ $.colorpicker.parsers['CMYK'] = function (color) { parseInt(m[2], 10) / 255, parseInt(m[3], 10) / 255, parseInt(m[4], 10) / 255 - ); + ); } }; @@ -206,7 +208,7 @@ $.colorpicker.parsers["#HEX8"] = function (color) { parseInt(m[2], 16) / 255, parseInt(m[3], 16) / 255, parseInt(m[4], 16) / 255 - ).setAlpha(parseInt(m[1], 16) / 255); + ).setAlpha(parseInt(m[1], 16) / 255); } };