mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 18:43:21 +08:00
Merge pull request #4359 from EnableSoftware/master
New definition for jQuery Succinct plugin
This commit is contained in:
31
succinct/succinct-tests.ts
Normal file
31
succinct/succinct-tests.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/// <reference path="succinct.d.ts" />
|
||||
|
||||
// Call with no arguments (accepting defaults)
|
||||
$(".truncate").succinct();
|
||||
|
||||
// Specify size
|
||||
$(".truncate").succinct({
|
||||
size: 120
|
||||
});
|
||||
|
||||
// Specify ellipsis replacement
|
||||
$(".truncate").succinct({
|
||||
omission: "→"
|
||||
});
|
||||
|
||||
// Specify flag to leave trailing special characters
|
||||
$(".truncate").succinct({
|
||||
ignore: false
|
||||
});
|
||||
|
||||
// Combine options
|
||||
$(".truncate").succinct({
|
||||
size: 120,
|
||||
omission: '...',
|
||||
ignore: false
|
||||
});
|
||||
|
||||
// Can chain jQuery methods
|
||||
$(".truncate")
|
||||
.succinct()
|
||||
.removeClass("truncate");
|
||||
18
succinct/succinct.d.ts
vendored
Normal file
18
succinct/succinct.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// Type definitions for jQuery Succinct v1.1.0
|
||||
// Project: http://mikeking.io/succinct/
|
||||
// Definitions by: Matt Brooks <https://github.com/EnableSoftware>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module JQuerySuccinct {
|
||||
interface Options {
|
||||
size?: number;
|
||||
omission?: string;
|
||||
ignore?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
succinct(settings?: JQuerySuccinct.Options): JQuery;
|
||||
}
|
||||
Reference in New Issue
Block a user