diff options
author | Alexandr Danilov <bitbucket@modos189.ru> | 2016-08-23 12:58:35 +0300 |
---|---|---|
committer | Alexandr Danilov <bitbucket@modos189.ru> | 2016-08-23 12:58:35 +0300 |
commit | 28388e15c38290ba920849883c91f827a257cb50 (patch) | |
tree | 1c79794858a83140aeecdcbde8b774f296cf1ff1 /src/Wallabag/CoreBundle/Resources/public/themes/material/js/jquery.tinydot.js | |
parent | 474b086656eb628684d11d2c187a086d65a0fdd0 (diff) | |
download | wallabag-28388e15c38290ba920849883c91f827a257cb50.tar.gz wallabag-28388e15c38290ba920849883c91f827a257cb50.tar.zst wallabag-28388e15c38290ba920849883c91f827a257cb50.zip |
Replacement plugin dotdotdot (6.7 KB) on my tinydot (315 bytes)
Diffstat (limited to 'src/Wallabag/CoreBundle/Resources/public/themes/material/js/jquery.tinydot.js')
-rw-r--r-- | src/Wallabag/CoreBundle/Resources/public/themes/material/js/jquery.tinydot.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Resources/public/themes/material/js/jquery.tinydot.js b/src/Wallabag/CoreBundle/Resources/public/themes/material/js/jquery.tinydot.js new file mode 100644 index 00000000..d2bf7fb6 --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/public/themes/material/js/jquery.tinydot.js | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * jQuery tinydot 0.1 | ||
3 | * | ||
4 | * Copyright (c) Alexander Danilov | ||
5 | * www.modos189.ru | ||
6 | * | ||
7 | * Plugin repository: | ||
8 | * https://gitlab.com/modos189/tinydot | ||
9 | * | ||
10 | * Licensed under the MIT license. | ||
11 | * http://en.wikipedia.org/wiki/MIT_License | ||
12 | */ | ||
13 | |||
14 | (function( $, undef ) | ||
15 | { | ||
16 | if ( $.fn.tinydot ) | ||
17 | { | ||
18 | return; | ||
19 | } | ||
20 | |||
21 | $.fn.tinydot = function( o ) { | ||
22 | var p=$(this).children('a'); | ||
23 | var divh=$(this).height(); | ||
24 | while ($(p).outerHeight()>divh) { | ||
25 | $(p).text(function (index, text) { | ||
26 | return text.replace(/\W*\s(\S)*$/, '...'); | ||
27 | }); | ||
28 | } | ||
29 | } | ||
30 | })( jQuery ); | ||
31 | |||
32 | jQuery(document).ready(function($) { | ||
33 | //We only invoke jQuery.tinydot on elements that have dot-ellipsis class | ||
34 | $(".dot-ellipsis").each(function(){ | ||
35 | var x = new Object(); | ||
36 | $(this).tinydot(x); | ||
37 | }); | ||
38 | |||
39 | }); | ||