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; +} +