]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/Resources/public/themes/material/js/jquery.tinydot.js
4 * Copyright (c) Alexander Danilov
10 * Licensed under the MIT license.
11 * http://en.wikipedia.org/wiki/MIT_License
21 $.fn
.tinydot = function( o
) {
24 $dot
.child
= getChildOrDie($dot
);
25 $dot
.orgContent
= $($dot
.child
).html();
28 $dot
.watch = function()
30 $(window
).on('resize', function(){
33 clearInterval( watchInt
);
35 watchInt
= setTimeout(
46 var opts
= $.extend( true, {}, $.fn
.tinydot
.defaults
, o
),
56 $.fn
.tinydot
.defaults
= {
60 function getChildOrDie( $elem
)
62 var childrens
= $elem
.children();
63 if (childrens
.length
== 0) {
65 var data
= $($elem
).html();
67 $elem
.append('<span />');
68 return $elem
.children('span').html(data
);
74 function reinitialize( $elem
)
76 $($elem
.child
).html($elem
.orgContent
);
80 function ellipsis( $elem
) {
81 var divh
=$($elem
).height();
82 while ($($elem
.child
).outerHeight()>divh
) {
83 $($elem
.child
).html(function (index
, html
) {
84 return html
.replace(/\W*\s(\S)*$/, '...');
91 jQuery(document
).ready(function($) {
92 //We only invoke jQuery.tinydot on elements that have dot-ellipsis class
93 $(".dot-ellipsis").each(function(){
94 //Checking if update on window resize required
95 var watch_window
=$(this).hasClass("dot-resize-update");
97 //Invoking jQuery.tinydot