blob: d2bf7fb64e5fa3094c2f4d06b9f5c4238ef2130b (
plain) (
blame)
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
|
/*
* jQuery tinydot 0.1
*
* Copyright (c) Alexander Danilov
* www.modos189.ru
*
* Plugin repository:
* https://gitlab.com/modos189/tinydot
*
* Licensed under the MIT license.
* http://en.wikipedia.org/wiki/MIT_License
*/
(function( $, undef )
{
if ( $.fn.tinydot )
{
return;
}
$.fn.tinydot = function( o ) {
var p=$(this).children('a');
var divh=$(this).height();
while ($(p).outerHeight()>divh) {
$(p).text(function (index, text) {
return text.replace(/\W*\s(\S)*$/, '...');
});
}
}
})( jQuery );
jQuery(document).ready(function($) {
//We only invoke jQuery.tinydot on elements that have dot-ellipsis class
$(".dot-ellipsis").each(function(){
var x = new Object();
$(this).tinydot(x);
});
});
|