From 28388e15c38290ba920849883c91f827a257cb50 Mon Sep 17 00:00:00 2001 From: Alexandr Danilov Date: Tue, 23 Aug 2016 12:58:35 +0300 Subject: Replacement plugin dotdotdot (6.7 KB) on my tinydot (315 bytes) --- .../public/themes/material/js/jquery.tinydot.js | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/Wallabag/CoreBundle/Resources/public/themes/material/js/jquery.tinydot.js (limited to 'src/Wallabag/CoreBundle/Resources/public/themes/material/js/jquery.tinydot.js') 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 @@ +/* + * 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); + }); + +}); -- cgit v1.2.3