From 805c8a6e1162e80965714c27723d03a948f4bc7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Jaro=C5=A1?= Date: Sun, 30 Nov 2014 00:15:55 +0100 Subject: [PATCH 1/6] Added glide definitions. --- glide/glide.d.ts | 189 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 glide/glide.d.ts diff --git a/glide/glide.d.ts b/glide/glide.d.ts new file mode 100644 index 000000000..bbf35f7e8 --- /dev/null +++ b/glide/glide.d.ts @@ -0,0 +1,189 @@ +// Type definitions for Glide.js v1.0.6 +// Project: http://glide.jedrzejchalubek.com/ +// Definitions by: Milan Jaros +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface JQuery { + /** + * Glide is responsive and touch-friendly jQuery slider. + * Based on CSS3 transitions with fallback to older broswers. + * It's simple, lightweight and fast. Designed to slide, + * no less, no more. + */ + glide(options?: JQueryGlide.IGlideOptions): JQuery; +} + +declare module JQueryGlide { + interface IGlideOptions { + /** + * Default: 4000 + * {Int or Bool} False for turning off autoplay + */ + autoplay?: any; + /** + * Default: true {Bool} Pause autoplay on mouseover slider + */ + hoverpause?: boolean; + /** + * Default: true {Bool} Circular play (Animation continues without starting over once it reaches the last slide) + */ + circular?: boolean; + + /** + * Default: 500 + * Animation time in ms + * @type {Int} + */ + animationDuration?: number; + /** + * Default: cubic-bezier(0.165, 0.840, 0.440, 1.000) + * cubic-bezier(0.165, 0.840, 0.440, 1.000) + */ + animationTimingFunc?: string; + + /** + * Default: true + * {Bool or String} Show/hide/appendTo arrows + * True for append arrows to slider wrapper + * False for not appending arrows + * Id or class name (e.g. '.class-name') for appending to specific HTML markup + */ + arrows?: any; + /** + * Default: 'slider-arrows' + * {String} Arrows wrapper class + */ + arrowsWrapperClass?: string; + /** + * Default: 'slider-arrow' + * {String} Main class for both arrows + */ + arrowMainClass?: string; + /** + * Default: 'slider-arrow--right' + * {String} Right arrow + */ + arrowRightClass?: string; + /** + * Default: 'next' + * {String} Right arrow text + */ + arrowRightText?: string; + /** + * Default: 'slider-arrow--left' + * {String} Left arrow + */ + arrowLeftClass?: string; + /** + * Default: 'prev' + * {String} Left arrow text + */ + arrowLeftText?: string; + + /** + * Default: true + * {Bool or String} Show/hide/appendTo bullets navigation + * True for append arrows to slider wrapper + * False for not appending arrows + * Id or class name (e.g. '.class-name') for appending to specific HTML markup + */ + navigation?: any; + /** + * Default: true + * {Bool} Center bullet navigation + */ + navigationCenter?: boolean; + /** + * Default: 'slider-nav' + * {String} Navigation class + */ + navigationClass?: string; + /** + * Default: 'slider-nav__item' + * {String} Navigation item class + */ + navigationItemClass?: string; + /** + * Default: 'slider-nav__item--current' + * {String} Current navigation item class + */ + navigationCurrentItemClass?: string; + + /** + * Default: true + * {Bool} Slide on left / right keyboard arrows press + */ + keyboard?: boolean; + + /** + * Default: 60 + * {Int or Bool} Touch settings + */ + touchDistance?: any; + + /** + * Default: function () {} + * {Function} Callback before plugin init + */ + beforeInit?: Function; + /** + * Default: function () {} + * {Function} Callback after plugin init + */ + afterInit?: Function; + + /** + * Default: function () {} + * {Function} Callback before slide change + */ + beforeTransition?: Function; + /** + * Default: function() {} + * {Function} Callback after slide change + */ + afterTransition?: Function; + } + + interface IGlideApi { + /** + * Returning current slide number + */ + current(): number; + /** + * Rebuild and recalculate dimensions of slider elements + */ + reinit(): void; + /** + * Destroy and cleanup slider + */ + destroy(): void; + /** + * Starting autoplay + */ + play(): void; + /** + * Stopping autoplay + */ + pause(): void; + /** + * Slide one forward + */ + next(callback: Function): void; + /** + * Slide one backward + */ + prev(callback: Function): void; + /** + * Jump to current slide + */ + jump(distance: number, callback: Function): void; + /** + * Append navigation to specifed target (eq. 'body', '.class', '#id') + */ + nav(target: string): void; + /** + * Append arrows to specifed target (eq. 'body', '.class', '#id') + */ + arrows(target: string): void; + } +} From 6668a1a3207c8bfbd8e8a34d819dfd54074eee72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Jaro=C5=A1?= Date: Sun, 30 Nov 2014 00:17:16 +0100 Subject: [PATCH 2/6] Added glide definitions. --- glide/glide-tests.ts | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 glide/glide-tests.ts diff --git a/glide/glide-tests.ts b/glide/glide-tests.ts new file mode 100644 index 000000000..5fe3cf159 --- /dev/null +++ b/glide/glide-tests.ts @@ -0,0 +1,50 @@ +/// +/// + +// Copied from documentation +$('.slider').glide(); + +$('.slider').glide({ + autoplay: 5000, + arrows: 'body', + navigation: 'body' +}); + +var glide: JQueryGlide.IGlideApi = $('.slider').glide().data('api_glide'); +// Original line modified: glide.jump(3, console.log('Wooo!')); +glide.jump(3, function () { console.log('Wooo!'); }); + +// The rest of tests +glide.current(); +glide.reinit(); +glide.destroy(); +glide.play(); +glide.pause(); +glide.next(function () { }); +glide.prev(function () { }); +glide.nav("div"); +glide.arrows("div"); + +$(".slider").glide({ autoplay: 4000 }); +$(".slider").glide({ hoverpause: true }); +$(".slider").glide({ circular: true }); +$(".slider").glide({ animationDuration: 500 }); +$(".slider").glide({ animationTimingFunc: "cubic - bezier(0.165, 0.840, 0.440, 1.000)" }); +$(".slider").glide({ arrows: true }); +$(".slider").glide({ arrowsWrapperClass: "slider__arrows" }); +$(".slider").glide({ arrowMainClass: "slider__arrows-item" }); +$(".slider").glide({ arrowRightClass: "slider__arrows-item--right" }); +$(".slider").glide({ arrowLeftClass: "slider__arrows-item--left" }); +$(".slider").glide({ arrowRightText: "next" }); +$(".slider").glide({ arrowLeftText: "prev" }); +$(".slider").glide({ navigation: true }); +$(".slider").glide({ navigationCenter: true }); +$(".slider").glide({ navigationClass: "slider__nav" }); +$(".slider").glide({ navigationItemClass: "slider__nav-item" }); +$(".slider").glide({ navigationCurrentItemClass: "slider__nav-item--current" }); +$(".slider").glide({ keyboard: true }); +$(".slider").glide({ touchDistance: 60 }); +$(".slider").glide({ beforeInit: function () { } }); +$(".slider").glide({ afterInit: function () { } }); +$(".slider").glide({ beforeTransition: function () { } }); +$(".slider").glide({ afterTransition: function () { } }); From b0e3ebd3cd7d997c32d1a0d23e7072f1e7320d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Jaro=C5=A1?= Date: Sun, 30 Nov 2014 08:59:50 +0100 Subject: [PATCH 3/6] Rename glide-tests.ts to glidejs-tests.ts --- glide/{glide-tests.ts => glidejs-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename glide/{glide-tests.ts => glidejs-tests.ts} (100%) diff --git a/glide/glide-tests.ts b/glide/glidejs-tests.ts similarity index 100% rename from glide/glide-tests.ts rename to glide/glidejs-tests.ts From ba677613b6daf4cdcecaf850c2b6067fe6e8c752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Jaro=C5=A1?= Date: Sun, 30 Nov 2014 09:00:28 +0100 Subject: [PATCH 4/6] Rename glide.d.ts to glidejs.d.ts --- glide/{glide.d.ts => glidejs.d.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename glide/{glide.d.ts => glidejs.d.ts} (100%) diff --git a/glide/glide.d.ts b/glide/glidejs.d.ts similarity index 100% rename from glide/glide.d.ts rename to glide/glidejs.d.ts From 918589e6fbfc3eaf18872cfb2aac9c00ad0c2ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Jaro=C5=A1?= Date: Sun, 30 Nov 2014 09:37:06 +0100 Subject: [PATCH 5/6] Rename glide to glidejs --- {glide => glidejs}/glidejs-tests.ts | 0 {glide => glidejs}/glidejs.d.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {glide => glidejs}/glidejs-tests.ts (100%) rename {glide => glidejs}/glidejs.d.ts (100%) diff --git a/glide/glidejs-tests.ts b/glidejs/glidejs-tests.ts similarity index 100% rename from glide/glidejs-tests.ts rename to glidejs/glidejs-tests.ts diff --git a/glide/glidejs.d.ts b/glidejs/glidejs.d.ts similarity index 100% rename from glide/glidejs.d.ts rename to glidejs/glidejs.d.ts From 6c67d6eb35e7ed20fd06526968db58a436245103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Jaro=C5=A1?= Date: Sun, 30 Nov 2014 09:43:14 +0100 Subject: [PATCH 6/6] Rename glide.d.ts to glidejs.d.ts in tests. --- glidejs/glidejs-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glidejs/glidejs-tests.ts b/glidejs/glidejs-tests.ts index 5fe3cf159..67cd2bdbc 100644 --- a/glidejs/glidejs-tests.ts +++ b/glidejs/glidejs-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// // Copied from documentation