forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dotdotdot.d.ts
76 lines (65 loc) · 2.43 KB
/
dotdotdot.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Type definitions for dotdotdot v1.6.16
// Project: http://dotdotdot.frebsite.nl/
// Definitions by: Milan Jaros <https://github.com/milanjaros>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface JQuery {
/**
* jQuery.dotdotdot is an advanced cross-browser ellipsis for multiple line content plugin.
* @param options settings that could modify a behaviour.
*/
dotdotdot(options?: JQueryDotDotDot.IDotDotDotOptions): JQuery;
}
declare namespace JQueryDotDotDot {
interface IDotDotDotOptions {
/** The text to add as ellipsis.
* Default: '... '
*/
ellipsis?: string;
/** How to cut off the text/html: 'word'/'letter'/'children'
* Default: 'word'
*/
wrap?: string;
/** Wrap-option fallback to 'letter' for long words
* Default: true
*/
fallbackToLetter?: boolean;
/** jQuery-selector for the element to keep and put after the ellipsis.
* Default: null
*/
after?: string | JQuery;
/** Whether to update the ellipsis: true/'window'
* Default: false
*/
watch?: boolean;
/** Optionally set a max-height, if null, the height will be measured.
* Default: null
*/
height?: number;
/** Deviation for the height-option.
* Default: 0
*/
tolerance?: number; //
/** Callback function that is fired after the ellipsis is added,
* receives two parameters:
* @param isTruncated (boolean)
* @param orgContent (string) Documentation says it is string but it is object
* which has e.g.
* context: HTMLHtmlElement;
* length: number; // seems to be always 1
* [index] // this contains the text: orgContent[0].data
*/
callback? (isTruncated: boolean, orgContent: any): void;
lastCharacter?: IDotDotDotOptionsLastCharacter;
}
interface IDotDotDotOptionsLastCharacter {
/** Remove these characters from the end of the truncated text.
* Default: [' ', ',', ';', '.', '!', '?']
*/
remove?: string[];
/** Don't add an ellipsis if this array contains
* the last character of the truncated text.
* Default: []
*/
noEllipsis?: string[];
}
}