From 8dc82014e04c3eaeec9b751b35c9de7b5a01f481 Mon Sep 17 00:00:00 2001 From: rdeneau Date: Tue, 1 Mar 2016 11:46:32 +0100 Subject: [PATCH] Add bootpag definition files --- bootpag/bootpag-tests.ts | 17 ++++++ bootpag/bootpag.d.ts | 126 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 bootpag/bootpag-tests.ts create mode 100644 bootpag/bootpag.d.ts diff --git a/bootpag/bootpag-tests.ts b/bootpag/bootpag-tests.ts new file mode 100644 index 0000000000..a0986e74cc --- /dev/null +++ b/bootpag/bootpag-tests.ts @@ -0,0 +1,17 @@ +/// +/// + +var pagerSelector = ".bootpager"; +var $pager = $(pagerSelector); + +var pagerOptions: JqueryBootpag.Options = { + total: 15, + page: 1, + maxVisible: 5, + first: "", + last: "", + prev: "", + next: "" +}; + +$pager.bootpag(pagerOptions); \ No newline at end of file diff --git a/bootpag/bootpag.d.ts b/bootpag/bootpag.d.ts new file mode 100644 index 0000000000..c09c67b78c --- /dev/null +++ b/bootpag/bootpag.d.ts @@ -0,0 +1,126 @@ +// Type definitions for jQuery-Bootpag 1.0.7 +// Project: http://botmonster.com/jquery-bootpag/ +// Definitions by: MAF.DAP / Romain Deneau +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module JqueryBootpag { + /** + * Bootpag plugin interface options + */ + export interface Options { + /** + * number of pages + */ + total: number; + + /** + * maximum number of visible pages + */ + maxVisible: number; + + /** + * page to show on start + */ + page?: number; + + /** + * next/prev buttons move over one page or maximum visible pages (default true) + */ + leaps?: boolean; + + /** + * next button text (default "»") + */ + next?: string; + + /** + * prev button text (default "«") + */ + prev?: string; + + /** + * template for pagination links (default "javascript:void(0);") + */ + href?: string; + + /** + * variable name in href template for page number (default "{{number}}") + */ + hrefVariable?: string; + + /** + * do we ant first and last (default true) + */ + firstLastUse?: boolean; + + /** + * name of first (default 'FIRST') + */ + first?: string; + + /** + * name of last (default 'LAST') + */ + last?: string; + + /** + * css class for wrap (default 'pagination') + */ + wrapClass?: string; + + /** + * css class for active (default 'active') + */ + activeClass?: string; + + /** + * css class for disabled (default 'disabled') + */ + disabledClass?: string; + + /** + * css class for next (default 'next') + */ + nextClass?: string; + + /** + * css class for prev (default 'prev') + */ + prevClass?: string; + + /** + * css class for last (default 'last') + */ + lastClass?: string; + + /** + * css class for first (default 'first') + */ + firstClass?: string; + } + + /** + * Event handler on page click. + * @param event : JQueryEventObject + * @param pageNumber : number of the clicked page + */ + interface PageEventHandler { + (event: JQueryEventObject, pageNumber: number): any; + } +} + +interface JQuery { + /** + * jQuery Bootpag plugin main method + */ + bootpag(options: JqueryBootpag.Options): JQuery; + + /** + * jQuery Bootpag "page" event occurring on page click. + * @param eventName : always "page" + * @param handler : A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(eventName: "page", handler: JqueryBootpag.PageEventHandler): JQuery; +} \ No newline at end of file