From fd687b0c1574ddba5e3cf21fce960f8a7b631c20 Mon Sep 17 00:00:00 2001 From: Jeffrey Lee Date: Wed, 2 Jul 2014 08:49:52 +0800 Subject: [PATCH 1/4] Add jquery.blockUI definition --- jquery.blockUI/jquery.blockUI-tests.ts | 9 ++ jquery.blockUI/jquery.blockUI.d.ts | 115 +++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 jquery.blockUI/jquery.blockUI-tests.ts create mode 100644 jquery.blockUI/jquery.blockUI.d.ts diff --git a/jquery.blockUI/jquery.blockUI-tests.ts b/jquery.blockUI/jquery.blockUI-tests.ts new file mode 100644 index 000000000..96f8c30e4 --- /dev/null +++ b/jquery.blockUI/jquery.blockUI-tests.ts @@ -0,0 +1,9 @@ +$.blockUI(); +var opt: JQBlockUIOptions = { + css: { border: "1px solid red" }, + message: "test" +}; +$.blockUI(opt); +$.unblockUI(); +$("#test").block().unblock(); +$("#test").block(opt); diff --git a/jquery.blockUI/jquery.blockUI.d.ts b/jquery.blockUI/jquery.blockUI.d.ts new file mode 100644 index 000000000..bea877d65 --- /dev/null +++ b/jquery.blockUI/jquery.blockUI.d.ts @@ -0,0 +1,115 @@ +// Type definitions for jQuery Cookie Plugin 1.3 +// Project: http://malsup.com/jquery/block/ +// Definitions by: Jeffrey Lee +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface JQBlockUIOptions { + /** message displayed when blocking (use null for no message) */ + message?: string; + /** title string; only used when theme == true */ + title?: string; + /** only used when theme == true (requires jquery-ui.js to be loaded) */ + draggable?: boolean; + /** set to true to use with jQuery UI themes */ + theme?: boolean; + + /** + * styles for the message when blocking; if you wish to disable + * these and use an external stylesheet then do this in your code: + * $.blockUI.defaults.css = {}; + */ + css?: any; + + /** minimal style set used when themes are used */ + themedCSS?: any; + + /** styles for the overlay */ + overlayCSS?: any; + + /** style to replace wait cursor before unblocking to correct issue of lingering wait cursor */ + cursorReset?: string; + + /** styles applied when using $.growlUI */ + growlCSS?: any; + /** ifreamSrc for IE */ + iframeSrc?: string; + + /** force usage of iframe in non-IE browsers (handy for blocking applets) */ + forceIframe?: boolean; + + /** z-index for the blocking overlay */ + baseZ?: number; + + + /** set true to have the message automatically centered for X */ + centerX?: boolean; + /** set true to have the message automatically centered for Y */ + centerY?: boolean; + + /** + * allow body element to be stetched in ie6; this makes blocking look better + * on "short" pages. disable if you wish to prevent changes to the body height + */ + allowBodyStretch?: boolean; + + /** enable if you want key and mouse events to be disabled for content that is blocked */ + bindEvents?: boolean; + + /** be default blockUI will supress tab navigation from leaving blocking content(if bindEvents is true) */ + constrainTabKey?: boolean; + + /** fadeIn time in millis; set to 0 to disable fadeIn on block */ + fadeIn?: number; + + /** fadeOut time in millis; set to 0 to disable fadeOut on unblock */ + fadeOut?: number; + + /** time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock */ + timeout?: number; + + /** disable if you don't want to show the overlay */ + showOverlay?: boolean; + + /** if true, focus will be placed in the first available input field when page blocking */ + focusInput?: boolean; + + /** callback method invoked when fadeIn has completed and blocking message is visible */ + onBlock?: boolean; + + /** + * callback method invoked when unblocking has completed; the callback is + * passed the element that has been unblocked (which is the window object for page + * blocks) and the options that were passed to the unblock call: + * onUnblock(element, options) + */ + onUnblock?: (element: any, options: any) => void; + + // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 + /** quirksmodeOffsetHack */ + quirksmodeOffsetHack?: number; + + /** class name of the message block */ + blockMsgClass?: string; + + /** if it is already blocked, then ignore it (don't unblock and reblock) */ + ignoreIfBlocked?: boolean; +} + +interface JQBlockUIStatic { + default?: JQBlockUIOptions; + (): void; + (option: JQBlockUIOptions): void; +} + +interface JQueryStatic { + blockUI?: JQBlockUIStatic; + unblockUI?: () => void; +} + +interface JQuery { + block(option?: JQBlockUIOptions): JQuery; + unblock(): JQuery; +} + From fe41b089657545ccf7c9be74c04431b08bbb8da9 Mon Sep 17 00:00:00 2001 From: Jeffrey Lee Date: Wed, 2 Jul 2014 09:06:03 +0800 Subject: [PATCH 2/4] Add reference to jquery.blockUI-tests --- jquery.blockUI/jquery.blockUI-tests.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jquery.blockUI/jquery.blockUI-tests.ts b/jquery.blockUI/jquery.blockUI-tests.ts index 96f8c30e4..746da7322 100644 --- a/jquery.blockUI/jquery.blockUI-tests.ts +++ b/jquery.blockUI/jquery.blockUI-tests.ts @@ -1,4 +1,7 @@ -$.blockUI(); +/// +/// + +$.blockUI(); var opt: JQBlockUIOptions = { css: { border: "1px solid red" }, message: "test" From 731e28d3bd537c25d6a4fd1f43b3fb2ee724aa34 Mon Sep 17 00:00:00 2001 From: Jeffrey Lee Date: Wed, 2 Jul 2014 09:14:52 +0800 Subject: [PATCH 3/4] for Travis CI Test --- jquery.blockUI/jquery.blockUI-tests.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jquery.blockUI/jquery.blockUI-tests.ts b/jquery.blockUI/jquery.blockUI-tests.ts index 746da7322..19372976f 100644 --- a/jquery.blockUI/jquery.blockUI-tests.ts +++ b/jquery.blockUI/jquery.blockUI-tests.ts @@ -1,5 +1,4 @@ -/// -/// +/// $.blockUI(); var opt: JQBlockUIOptions = { From d1e824b45d26ebdda83772c38420d15d4c56303b Mon Sep 17 00:00:00 2001 From: Jeffrey Lee Date: Thu, 3 Jul 2014 08:26:07 +0800 Subject: [PATCH 4/4] Fix wrong tile (embarrassed) and add some comments --- jquery.blockUI/jquery.blockUI.d.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/jquery.blockUI/jquery.blockUI.d.ts b/jquery.blockUI/jquery.blockUI.d.ts index bea877d65..112af0dcf 100644 --- a/jquery.blockUI/jquery.blockUI.d.ts +++ b/jquery.blockUI/jquery.blockUI.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jQuery Cookie Plugin 1.3 +// Type definitions for jQuery BlockUI Plugin // Project: http://malsup.com/jquery/block/ // Definitions by: Jeffrey Lee // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -98,18 +98,32 @@ interface JQBlockUIOptions { } interface JQBlockUIStatic { + /** default options */ default?: JQBlockUIOptions; + /** block user activity for the page */ (): void; + /** + * block user activity for the page + * @param options options + */ (option: JQBlockUIOptions): void; } interface JQueryStatic { + /** block user activity for the page */ blockUI?: JQBlockUIStatic; + /** unblock the page */ unblockUI?: () => void; } interface JQuery { + /** + * block the element(s) + * @param options block options + */ block(option?: JQBlockUIOptions): JQuery; + /** + * unblock the element(s) + */ unblock(): JQuery; -} - +} \ No newline at end of file