From 62adfb110f9cbad2f9dcda31aa6c6a688eb1a5f8 Mon Sep 17 00:00:00 2001 From: Chintan Shah Date: Tue, 18 Nov 2014 23:09:09 +0530 Subject: [PATCH 1/2] Added jquery.slimScroll typings and their test file. Updated CONTRIBUTORS.md. --- CONTRIBUTORS.md | 2 +- jquery.slimScroll/jquery.SlimScroll-tests.ts | 46 +++++++++++++++ jquery.slimScroll/jquery.slimScroll.d.ts | 60 ++++++++++++++++++++ 3 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 jquery.slimScroll/jquery.SlimScroll-tests.ts create mode 100644 jquery.slimScroll/jquery.slimScroll.d.ts diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 46c6ac095..3e72ff7b2 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -664,4 +664,4 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](scroller/easyscroller.d.ts) [Zynga EasyScroller](https://github.com/zynga/scroller) by [Boris Yankov](https://github.com/borisyankov) * [:link:](scroller/scroller.d.ts) [Zynga Scroller](https://github.com/zynga/scroller) by [Boris Yankov](https://github.com/borisyankov) * [:link:](viewporter/viewporter.d.ts) [Zynga Viewporter](https://github.com/zynga/viewporter) by [Boris Yankov](https://github.com/borisyankov) - +* [:link:](jquery.slimScroll/jquery.slimScroll.d.ts) [jquery.slimScroll](https://github.com/rochal/jQuery-slimScroll) by [Chintan Shah](https://github.com/Promact) \ No newline at end of file diff --git a/jquery.slimScroll/jquery.SlimScroll-tests.ts b/jquery.slimScroll/jquery.SlimScroll-tests.ts new file mode 100644 index 000000000..deb4f2406 --- /dev/null +++ b/jquery.slimScroll/jquery.SlimScroll-tests.ts @@ -0,0 +1,46 @@ +/// +/// + +$("div").slimScroll(); + +$("div").slimScroll({ + width: '300px', + height: '500px', + size: '10px', + position: 'left', + color: '#ffcc00', + alwaysVisible: true, + distance: '20px', + start: $('#child_image_element'), + railVisible: true, + railColor: '#222', + railOpacity: 0.3, + wheelStep: 10, + allowPageScroll: false, + disableFadeOut: false +}); + + +$(function(){ + $('#inner-content-div').slimScroll({ + height: '250px' + }); +}); + +$('#slimtest2').slimScroll({ + position: 'left', + height: '150px', + railVisible: true, + alwaysVisible: true +}); + +$('#slimtest3').slimScroll({ + color: '#00f', + size: '10px', + height: '180px', + alwaysVisible: true +}); + +$("div").slimScroll().bind('slimscroll', function(e){ + console.log("Reached " + e); +}); \ No newline at end of file diff --git a/jquery.slimScroll/jquery.slimScroll.d.ts b/jquery.slimScroll/jquery.slimScroll.d.ts new file mode 100644 index 000000000..30797f861 --- /dev/null +++ b/jquery.slimScroll/jquery.slimScroll.d.ts @@ -0,0 +1,60 @@ +// Type definitions for jQuery.slimScroll v1.3.3 +// Project: https://github.com/rochal/jQuery-slimScroll +// Definitions by: Chintan Shah +// Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + +interface IOptions { + // width in pixels of the visible scroll area + width? :string; + // height in pixels of the visible scroll area + height? :string; + // width in pixels of the scrollbar and rail + size? :string; + // scrollbar color, accepts any hex/color value + color?:string; + // scrollbar position - left/right + position?:string; + // distance in pixels between the side edge and the scrollbar + distance?:string; + // default scroll position on load - top / bottom / $('selector') + start?:any; + // sets scrollbar opacity + opacity? :number; + // enables always-on mode for the scrollbar + alwaysVisible?: boolean; + // check if we should hide the scrollbar when user is hovering over + disableFadeOut?: boolean; + // sets visibility of the rail + railVisible?: boolean; + // sets rail color + railColor?: string; + // sets rail opacity + railOpacity?:number; + // whether we should use jQuery UI Draggable to enable bar dragging + railDraggable?: boolean; + // defautlt CSS class of the slimscroll rail + railClass?: string; + // defautlt CSS class of the slimscroll bar + barClass?: string; + // defautlt CSS class of the slimscroll wrapper + wrapperClass?: string; + // check if mousewheel should scroll the window if we reach top/bottom + allowPageScroll?: boolean; + // scroll amount applied to each mouse wheel step + wheelStep?: number; + // scroll amount applied when user is using gestures + touchScrollStep?: number; + // sets border radius + borderRadius?: string; + // sets border radius of the rail + railBorderRadius?: string; +} + +interface JQuery { + slimScroll:{ + (): JQuery; + (options:IOptions): JQuery; + } +} + From eedb8b311f4d156790aa0f326406bd4c54883450 Mon Sep 17 00:00:00 2001 From: Chintan Shah Date: Thu, 20 Nov 2014 12:45:21 +0530 Subject: [PATCH 2/2] Changed IOption to IJquerySlimScrollOptions --- jquery.slimScroll/jquery.slimScroll.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.slimScroll/jquery.slimScroll.d.ts b/jquery.slimScroll/jquery.slimScroll.d.ts index 30797f861..d894828eb 100644 --- a/jquery.slimScroll/jquery.slimScroll.d.ts +++ b/jquery.slimScroll/jquery.slimScroll.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// -interface IOptions { +interface IJQuerySlimScrollOptions { // width in pixels of the visible scroll area width? :string; // height in pixels of the visible scroll area @@ -54,7 +54,7 @@ interface IOptions { interface JQuery { slimScroll:{ (): JQuery; - (options:IOptions): JQuery; + (options:IJQuerySlimScrollOptions): JQuery; } }