mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Merge pull request #6356 from Pro/upstream
New definitions for jquery.highlight.js
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/// <reference path="jquery.highlight-bartaz.d.ts" />
|
||||
|
||||
|
||||
|
||||
$('#content').highlight('lorem');
|
||||
|
||||
// search for and highlight more terms at once
|
||||
// so you can save some time on traversing DOM
|
||||
$('#content').highlight(['lorem', 'ipsum']);
|
||||
$('#content').highlight('lorem ipsum');
|
||||
|
||||
// search only for entire word 'lorem'
|
||||
$('#content').highlight('lorem', { wordsOnly: true });
|
||||
|
||||
// don't ignore case during search of term 'lorem'
|
||||
$('#content').highlight('lorem', { caseSensitive: true });
|
||||
|
||||
// wrap every occurrance of term 'ipsum' in content
|
||||
// with <em class='important'>
|
||||
$('#content').highlight('ipsum', { element: 'em', className: 'important' });
|
||||
|
||||
// remove default highlight
|
||||
$('#content').unhighlight();
|
||||
|
||||
// remove custom highlight
|
||||
$('#content').unhighlight({ element: 'em', className: 'important' });
|
||||
@@ -0,0 +1,20 @@
|
||||
// Type definitions for jquery.highlight.js
|
||||
// Project: https://github.com/bartaz/sandbox.js/blob/master/jquery.highlight.js
|
||||
// Definitions by: Stefan Profanter <https://github.com/Pro/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
interface JQuery {
|
||||
unhighlight(options?: {
|
||||
element?: string,
|
||||
className?: string
|
||||
}): JQuery;
|
||||
highlight(words: string | string[], options?: {
|
||||
element?: string,
|
||||
className?: string
|
||||
caseSensitive?: boolean,
|
||||
wordsOnly?: boolean
|
||||
}): JQuery;
|
||||
}
|
||||
Reference in New Issue
Block a user