From 3419482ba9e00de124fb11157a4e9ad33a2898e9 Mon Sep 17 00:00:00 2001 From: Matt Wheatley Date: Fri, 25 Dec 2015 00:32:33 +0000 Subject: [PATCH 1/5] Added jquery.raty definition --- jquery.raty/jquery.raty.d.ts | 60 ++++++++++++++++++++++++++++++++ jquery.raty/jquery.raty.tests.ts | 54 ++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 jquery.raty/jquery.raty.d.ts create mode 100644 jquery.raty/jquery.raty.tests.ts diff --git a/jquery.raty/jquery.raty.d.ts b/jquery.raty/jquery.raty.d.ts new file mode 100644 index 0000000000..0f1bba2630 --- /dev/null +++ b/jquery.raty/jquery.raty.d.ts @@ -0,0 +1,60 @@ +// Type definitions for jQuery.raty 2.7.0 +// Definitions by: Matt Wheatley +/// + +interface JQuery { + raty(): JQuery; + raty(options: JQueryRatyOptions): JQuery; + raty(method: string, parameter: any): any; + raty(method: 'score', score: number): number; + raty(method: 'click', star: number): void; + raty(method: 'readonly', on: boolean): void; + raty(method: 'cancel', on: boolean): void; + raty(method: 'reload'): void; + raty(method: 'set', options: JQueryRatyOptions); + raty(method: 'destroy'): JQuery; + raty(method: 'move', number: number): void; +} + +interface JQueryRatyOptions { + cancel?: boolean, + cancelClass?: string, + cancelHint?: string, + cancelOff?: string, + cancelOn?: string, + cancelPlace?: string, + click?: (score: number, event: JQueryEventObject) => void, + half?: boolean, + halfShow?: boolean, + hints?: string[], + iconRange?: any[][], + mouseout?: (score: number, event: JQueryEventObject) => void, + mouseover?: (score: number, event: JQueryEventObject) => void, + noRatedMsg?: string, + number?: number, + numberMax?: number, + path?: string, + precision?: boolean, + readOnly?: boolean, + round?: JQueryRatyRoundingOptions, + score?: number, + scoreName?: string, + single?: boolean, + space?: boolean, + starHalf?: string, + starOff?: string, + starOn?: string, + target?: string, + targetFormat?: string, + targetKeep?: boolean, + targetScore?: string, + targetText?: string, + targetType?: string, + starType?: string, +} + +interface JQueryRatyRoundingOptions { + down: number, + full: number, + up: number, +} diff --git a/jquery.raty/jquery.raty.tests.ts b/jquery.raty/jquery.raty.tests.ts new file mode 100644 index 0000000000..e324e1ce34 --- /dev/null +++ b/jquery.raty/jquery.raty.tests.ts @@ -0,0 +1,54 @@ +/// +/// + + +var $element: JQuery = $('
'); + +$element.raty(); + +$element.raty({ + cancel: false, + cancelClass: 'raty-cancel', + cancelHint: 'Cancel this rating!', + cancelOff: 'cancel-off.png', + cancelOn: 'cancel-on.png', + cancelPlace: 'left', + click: undefined, + half: false, + halfShow: true, + hints: ['bad', 'poor', 'regular', 'good', 'gorgeous'], + iconRange: undefined, + mouseout: undefined, + mouseover: undefined, + noRatedMsg: 'Not rated yet!', + number: 5, + numberMax: 20, + path: undefined, + precision: false, + readOnly: false, + round: { down: .25, full: .6, up: .76 }, + score: undefined, + scoreName: 'score', + single: false, + space: true, + starHalf: 'star-half.png', + starOff: 'star-off.png', + starOn: 'star-on.png', + target: undefined, + targetFormat: '{score}', + targetKeep: false, + targetScore: undefined, + targetText: '', + targetType: 'hint', + starType: 'img', +}); + +$element.raty('score'); +$element.raty('score', 4); +$element.raty('click', 2); +$element.raty('readOnly', true); +$element.raty('cancel', true); +$element.raty('reload'); +$element.raty('set', { space: false }); +$element.raty('destroy'); +$element.raty('move', 3); From 516e0a1fc0c144af81899d1179725b849c8c415f Mon Sep 17 00:00:00 2001 From: Matt Wheatley Date: Fri, 25 Dec 2015 00:35:57 +0000 Subject: [PATCH 2/5] Added get score --- jquery.raty/jquery.raty.d.ts | 3 ++- jquery.raty/jquery.raty.tests.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/jquery.raty/jquery.raty.d.ts b/jquery.raty/jquery.raty.d.ts index 0f1bba2630..35e0f80ad7 100644 --- a/jquery.raty/jquery.raty.d.ts +++ b/jquery.raty/jquery.raty.d.ts @@ -6,7 +6,8 @@ interface JQuery { raty(): JQuery; raty(options: JQueryRatyOptions): JQuery; raty(method: string, parameter: any): any; - raty(method: 'score', score: number): number; + raty(method: 'score'): number; + raty(method: 'score', score: number): void; raty(method: 'click', star: number): void; raty(method: 'readonly', on: boolean): void; raty(method: 'cancel', on: boolean): void; diff --git a/jquery.raty/jquery.raty.tests.ts b/jquery.raty/jquery.raty.tests.ts index e324e1ce34..65a298bc32 100644 --- a/jquery.raty/jquery.raty.tests.ts +++ b/jquery.raty/jquery.raty.tests.ts @@ -43,7 +43,7 @@ $element.raty({ starType: 'img', }); -$element.raty('score'); +var score: number = $element.raty('score'); $element.raty('score', 4); $element.raty('click', 2); $element.raty('readOnly', true); From 1fcb19166ec6307152ace14a69f87d2e011333c0 Mon Sep 17 00:00:00 2001 From: Matt Wheatley Date: Fri, 25 Dec 2015 00:50:12 +0000 Subject: [PATCH 3/5] Updated files to comply with CI --- jquery.raty/{jquery.raty.tests.ts => jquery.raty-tests.ts} | 0 jquery.raty/jquery.raty.d.ts | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) rename jquery.raty/{jquery.raty.tests.ts => jquery.raty-tests.ts} (100%) diff --git a/jquery.raty/jquery.raty.tests.ts b/jquery.raty/jquery.raty-tests.ts similarity index 100% rename from jquery.raty/jquery.raty.tests.ts rename to jquery.raty/jquery.raty-tests.ts diff --git a/jquery.raty/jquery.raty.d.ts b/jquery.raty/jquery.raty.d.ts index 35e0f80ad7..cc9a1bc0cf 100644 --- a/jquery.raty/jquery.raty.d.ts +++ b/jquery.raty/jquery.raty.d.ts @@ -1,4 +1,5 @@ // Type definitions for jQuery.raty 2.7.0 +// Project: https://github.com/wbotelhos/raty // Definitions by: Matt Wheatley /// @@ -12,7 +13,7 @@ interface JQuery { raty(method: 'readonly', on: boolean): void; raty(method: 'cancel', on: boolean): void; raty(method: 'reload'): void; - raty(method: 'set', options: JQueryRatyOptions); + raty(method: 'set', options: JQueryRatyOptions): void; raty(method: 'destroy'): JQuery; raty(method: 'move', number: number): void; } From cb60271da952a9338b4999efa0f4aaf567611a4f Mon Sep 17 00:00:00 2001 From: Matt Wheatley Date: Fri, 25 Dec 2015 00:52:58 +0000 Subject: [PATCH 4/5] Contributor updates --- jquery.raty/jquery.raty-tests.ts => raty/raty-tests.ts | 0 jquery.raty/jquery.raty.d.ts => raty/raty.d.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename jquery.raty/jquery.raty-tests.ts => raty/raty-tests.ts (100%) rename jquery.raty/jquery.raty.d.ts => raty/raty.d.ts (100%) diff --git a/jquery.raty/jquery.raty-tests.ts b/raty/raty-tests.ts similarity index 100% rename from jquery.raty/jquery.raty-tests.ts rename to raty/raty-tests.ts diff --git a/jquery.raty/jquery.raty.d.ts b/raty/raty.d.ts similarity index 100% rename from jquery.raty/jquery.raty.d.ts rename to raty/raty.d.ts From 33b6ced4220f5c576109409fa7efac4b20f730fc Mon Sep 17 00:00:00 2001 From: Matt Wheatley Date: Fri, 25 Dec 2015 00:58:30 +0000 Subject: [PATCH 5/5] Added proper headers, updated reference to match new path, defined file names properly --- raty/raty-tests.ts | 2 +- raty/raty.d.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/raty/raty-tests.ts b/raty/raty-tests.ts index 65a298bc32..89efb79c3d 100644 --- a/raty/raty-tests.ts +++ b/raty/raty-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// var $element: JQuery = $('
'); diff --git a/raty/raty.d.ts b/raty/raty.d.ts index cc9a1bc0cf..bb02d94752 100644 --- a/raty/raty.d.ts +++ b/raty/raty.d.ts @@ -1,6 +1,8 @@ // Type definitions for jQuery.raty 2.7.0 // Project: https://github.com/wbotelhos/raty // Definitions by: Matt Wheatley +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + /// interface JQuery {