diff --git a/nanoscroller/index.d.ts b/nanoscroller/index.d.ts new file mode 100644 index 0000000000..ede65fc283 --- /dev/null +++ b/nanoscroller/index.d.ts @@ -0,0 +1,126 @@ +// Type definitions for nanoScroller 0.8 +// Project: http://jamesflorentino.github.io/nanoScrollerJS/ +// Definitions by: Yannick Beauchamp-Hurtubise +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace JQueryNanoScroller { + interface NanoScrollerOptions { + /** + * To scroll at the top or bottom. + */ + scroll?: 'top' | 'bottom'; + /** + * To scroll at the top with an offset value. + */ + scrollTop?: number; + /** + * To scroll at the bottom with an offset value. + */ + scrollBottom?: number; + /** + * To scroll to an element. + */ + scrollTo?: JQuery; + /** + * To stop the operation. + * This option will tell the plugin to disable all event bindings and hide the gadget scrollbar from the UI. + */ + stop?: boolean; + /** + * Destroys nanoScroller and restores browser's native scrollbar. + */ + destroy?: boolean; + /** + * To flash the scrollbar gadget for an amount of time defined in plugin settings (defaults to 1,5s). + * Useful if you want to show the user that there is more content waiting for him. + */ + flash?: boolean; + /** + * Set to true if you want to use native scrolling in iOS 5+. + * This will disable your custom nanoScroller scrollbar in iOS 5+ and use the native one instead. + * While the native iOS scrollbar usually works much better, there could possibly be bugs in certain situations. + * @default false + */ + iOSNativeScrolling?: boolean; + /** + * Sets the minimum height of the slider element. + * @default 20 + */ + sliderMinHeight?: number; + /** + * Sets the maximum height of the slider element. + * @default null + */ + sliderMaxHeight?: number | null; + /** + * Set to true to prevent page scrolling when top or bottom inside the content div is reached. + * @default false + */ + preventPageScrolling?: boolean; + /** + * Set to true to disable the resize from nanoscroller. + * Useful if you want total control of the resize event. + * If you set this option to true remember to call the reset method so that the scroll don't have strange behavior. + * @default false + */ + disableResize?: boolean; + /** + * Set to true to stop the scrollbar from auto-hiding itself. + * @default false + */ + alwaysVisible?: boolean; + /** + * Use this setting to specify the scrollbar hide delay in milliseconds if you have enabled the flash option. + * @default 1500 + */ + flashDelay?: number; + /** + * A classname for scrollbar track element. + * If you change this setting, you also have to change it in the plugin's CSS file. + * @default 'nano-pane' + */ + paneClass?: string; + /** + * A classname for scrollbar thumb element. + * If you change this setting, you also have to change it in the plugin's CSS file. + * @default 'nano-slider' + */ + sliderClass?: string; + /** + * A classname for your content div. + * If you change this setting, you also have to change it in the plugin's CSS file. + * @default 'nano-content' + */ + contentClass?: string; + /** + * A classname for scrollbar enabled mode. + * If you change this setting, you also have to change it in the plugin's CSS file. + * @default 'has-scrollbar' + */ + enabledClass?: string; + /** + * A classname for scrollbar flashed mode. + * If you change this setting, you also have to change it in the plugin's CSS file. + * @default 'flashed' + */ + flashedClass?: string; + /** + * + * If you change this setting, you also have to change it in the plugin's CSS file. + * @default 'active' + */ + activeClass?: string; + /** + * Set the tab order of the scrollable content. + * Set to -1 to skip over the scrollable content when tabbing. + * @default 0 + */ + tabIndex?: number; + } +} + +interface JQuery { + nanoScroller(options?: JQueryNanoScroller.NanoScrollerOptions): JQuery; +} diff --git a/nanoscroller/nanoscroller-tests.ts b/nanoscroller/nanoscroller-tests.ts new file mode 100644 index 0000000000..3b9eeea820 --- /dev/null +++ b/nanoscroller/nanoscroller-tests.ts @@ -0,0 +1,8 @@ +/// + +$('.nano').nanoScroller(); + +$('.nano').nanoScroller({ + scroll: 'bottom', + flash: true +}); diff --git a/nanoscroller/tsconfig.json b/nanoscroller/tsconfig.json new file mode 100644 index 0000000000..9727a9e274 --- /dev/null +++ b/nanoscroller/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "nanoscroller-tests.ts" + ] +} \ No newline at end of file diff --git a/nanoscroller/tslint.json b/nanoscroller/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/nanoscroller/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file