<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Squarespace Site Server v5.11.81 (http://www.squarespace.com/) on Wed, 30 May 2012 11:24:21 GMT--><?xml-stylesheet type="text/css" href="/universal/styles/feed.css"?><rss version="2.0"><channel><title>Jeff Martin's Musings - Comments</title><link>http://jeffmartin.com/journal/</link><description></description><copyright></copyright><language>en-US</language><generator>Squarespace Site Server v5.11.81 (http://www.squarespace.com/)</generator><item><title>Jeff Martin comments on A Custom Ellipsis Plug-in for JQuery</title><author>Jeff Martin</author><pubDate>Mon, 15 Aug 2011 11:03:03 +0000</pubDate><link>http://jeffmartin.com/journal/2009/11/9/a-custom-ellipsis-plug-in-for-jquery.html#comments</link><guid isPermaLink="false">339264:3583846:comment/14808332</guid><description><![CDATA[<p>Thanks for the info.  I will put this on my todo list to take a look at your suggestion</p>]]></description></item><item><title>Joel Berghoff comments on A Custom Ellipsis Plug-in for JQuery</title><author>Joel Berghoff</author><pubDate>Fri, 12 Aug 2011 21:43:34 +0000</pubDate><link>http://jeffmartin.com/journal/2009/11/9/a-custom-ellipsis-plug-in-for-jquery.html#comments</link><guid isPermaLink="false">339264:3583846:comment/14787761</guid><description><![CDATA[<p>It looks like there&#39;s a bug in your code, but I haven&#39;t tested extensively - I just know things didn&#39;t work correctly out of the box for me.</p><p>Line 37 (<code>t.append(&quot; &quot; + lessText + &quot;</a>&quot;);</code>) results in a &quot;less&quot; link appearing in every ellipsis element except for those where a &quot;more&quot; link should appear. Even if the moreText and lessText parameters are not specified, I get &quot;less&quot; links (which actually read &quot;undefined&quot;) on every element.</p><p>I am calling ellipsis() after some content has loaded dynamically, but I don&#39;t think it should matter. Line 37 has no conditionals around it so it&#39;s just getting called every time.</p><p>Anyway, now that I have removed that line everything seems to work great. Thanks for the code!</p>]]></description></item><item><title>David comments on A Custom Ellipsis Plug-in for JQuery</title><author>David</author><pubDate>Mon, 17 Jan 2011 01:34:13 +0000</pubDate><link>http://jeffmartin.com/journal/2009/11/9/a-custom-ellipsis-plug-in-for-jquery.html#comments</link><guid isPermaLink="false">339264:3583846:comment/11241963</guid><description><![CDATA[<p>@JeffMartin: thank you for making the ellipsis plugin work for multiple lines.</p><p>@Chris: thank you for pointing out where to check for undefined, and making this plugin more bullet-resistant.</p>]]></description></item><item><title>Jeff Martin comments on A Custom Ellipsis Plug-in for JQuery</title><author>Jeff Martin</author><pubDate>Wed, 01 Dec 2010 18:07:31 +0000</pubDate><link>http://jeffmartin.com/journal/2009/11/9/a-custom-ellipsis-plug-in-for-jquery.html#comments</link><guid isPermaLink="false">339264:3583846:comment/10696189</guid><description><![CDATA[<p>Yea... i guess I&#39;m going to say that the way this currently works, its probably not for use in tables of more than a few cells.  The way that it calculates the height is expensive.   It could certainly be adapted to some known height and widths so it doesn&#39;t do the binary search for the right size.  This was in the original design of the plugin not something I was interested in changing.  Would love to see a final result for one that works with tables better.</p>]]></description></item><item><title>Chris comments on A Custom Ellipsis Plug-in for JQuery</title><author>Chris</author><pubDate>Tue, 30 Nov 2010 08:38:05 +0000</pubDate><link>http://jeffmartin.com/journal/2009/11/9/a-custom-ellipsis-plug-in-for-jquery.html#comments</link><guid isPermaLink="false">339264:3583846:comment/10678454</guid><description><![CDATA[<p><code><br/>//ellipsis plugin http://devongovett.wordpress.com/2009/04/06/text-overflow-ellipsis-for-firefox-via-jquery/ + comments + custom mods<br/>(function ($) {<br/>	$.fn.ellipsis = function (lines, enableUpdating, moreText, lessText) {<br/>		return $(this).each(function () {<br/>			var el = $(this);<br/>			var resetDescription = function (height, originalText) {<br/>				el.html(originalText);<br/>				el.animate({ &quot;height&quot;: height }, &quot;normal&quot;, null, function () {<br/>					el.ellipsis(true, true, moreText, lessText);<br/>				});<br/>			}</p><p>			if (el.css(&quot;overflow&quot;) == &quot;hidden&quot;) {</p><p>				var originalText = el.html();<br/>				var availWidth = el.width();<br/>				var availHeight = el.height();</p><p>				var MoreLessTag;<br/>				if (moreText &amp;&amp; moreText != &#39;undefined&#39;) {<br/>					enableUpdating = true;<br/>					MoreLessTag = &quot; &quot; + moreText + &quot;</a>&quot;;<br/>				}<br/>				else MoreLessTag = &quot;&quot;;</p><p>				var t = $(this.cloneNode(true))<br/>                    .hide()<br/>                    .css({<br/>                    	&#39;position&#39;: &#39;absolute&#39;,<br/>                    	&#39;overflow&#39;: &#39;visible&#39;,<br/>                    	&#39;max-width&#39;: &#39;none&#39;,<br/>                    	&#39;max-height&#39;: &#39;none&#39;<br/>                    });<br/>				if (lines) t.css(&quot;height&quot;, &quot;auto&quot;).width(availWidth);<br/>				else t.css(&quot;width&quot;, &quot;auto&quot;);<br/>				el.after(t);<br/>				if(lessText &amp;&amp; lessText != &#39;undefined&#39;)<br/>					t.append(&quot; &quot; + lessText + &quot;</a>&quot;);</p><p>				var fullHeight = t.height();</p><p>				var avail = (lines) ? availHeight : availWidth;<br/>				var test = (lines) ? t.height() : t.width();<br/>				var foundMin = false, foundMax = false;<br/>				if (test &gt; avail) {<br/>					//Binary search style trimming of the temp element to find its optimal size<br/>					var min = 0;<br/>					var max = originalText.length;<br/>					while (min &lt;= max) {<br/>						var trimLocation = (min + max) / 2;<br/>						var text = originalText.substr(0, trimLocation);<br/>						t.html(text + &quot;…&quot; + MoreLessTag);</p><p>						test = (lines) ? t.height() : t.width();<br/>						if (test &gt; avail) {<br/>							if (foundMax)<br/>								foundMin = true;</p><p>							max = trimLocation - 1;<br/>							if (min &gt; max) {<br/>								//If we would be ending decrement the min and regenerate the text so we don&#39;t end with a<br/>								//slightly larger text than there is space for<br/>								trimLocation = (max + max - 2) / 2;<br/>								text = originalText.substr(0, trimLocation);<br/>								t.html(text + &quot;…&quot; + MoreLessTag);<br/>								break;<br/>							}<br/>						}<br/>						else if (test &quot; + lessText + &quot;</a>&quot;);<br/>						jQuery(&quot;.MoreLessTag&quot;, el).click(function (event) {<br/>							event.preventDefault();<br/>							resetDescription(availHeight, originalText);</p><p>						});<br/>					});<br/>				}<br/>				else {<br/>					var replaceTags = new RegExp(/&lt;\/?[^&gt;]+&gt;/gi);<br/>					el.attr(&quot;alt&quot;, originalText.replace(replaceTags, &#39;&#39;));<br/>					el.attr(&quot;title&quot;, originalText.replace(replaceTags, &#39;&#39;));<br/>				}</p><p>				if (enableUpdating == true) {<br/>					var oldW = el.width();<br/>					var oldH = el.height();<br/>					el.one(&quot;resize&quot;, function () {<br/>						if (el.width() != oldW || (lines &amp;&amp; el.height != oldH)) {<br/>							el.html(originalText);<br/>							el.ellipsis(lines, enableUpdating, moreText, lessText);<br/>						}<br/>					});<br/>				}<br/>			}</p><p>		});<br/>	};<br/>})(jQuery); <br/></code></p><p>I got the problem when applying it to a large table with lots of data (with the selector $(&quot;.tableHolder td&quot;)) that I got lots of undefined-links (More/less I guess), so I added some undefined-checks :)</p><p>And it got incredibly slow (took 11 seconds to load the page, 20 rows with 11 columns of data)</p>]]></description></item><item><title>Jeff Martin comments on A Custom Ellipsis Plug-in for JQuery</title><author>Jeff Martin</author><pubDate>Thu, 23 Sep 2010 15:37:30 +0000</pubDate><link>http://jeffmartin.com/journal/2009/11/9/a-custom-ellipsis-plug-in-for-jquery.html#comments</link><guid isPermaLink="false">339264:3583846:comment/9865116</guid><description><![CDATA[<p>@Jim, I will see what I can do.</p>]]></description></item><item><title>Jim comments on A Custom Ellipsis Plug-in for JQuery</title><author>Jim</author><pubDate>Thu, 23 Sep 2010 03:32:48 +0000</pubDate><link>http://jeffmartin.com/journal/2009/11/9/a-custom-ellipsis-plug-in-for-jquery.html#comments</link><guid isPermaLink="false">339264:3583846:comment/9860838</guid><description><![CDATA[<p>Jeff,</p><p>Could you post a demo? I am trying to get this to work and it seems to be more involved than calling your ellipsis function with the new parameters that you added , e.g., $(&quot;#myID&quot;).ellipsis(5, true, &#39;more...&#39;, &#39;less&#39;);</p><p>Any help is appreciated.</p><p>Jim</p>]]></description></item><item><title>Jeff Martin comments on A Custom Ellipsis Plug-in for JQuery</title><author>Jeff Martin</author><pubDate>Tue, 10 Aug 2010 20:08:35 +0000</pubDate><link>http://jeffmartin.com/journal/2009/11/9/a-custom-ellipsis-plug-in-for-jquery.html#comments</link><guid isPermaLink="false">339264:3583846:comment/9311121</guid><description><![CDATA[<p>not off the top of my head.  If I get a chance this weekend, I will try to take a look and see what I can figure out.</p>]]></description></item><item><title>Jeremy comments on A Custom Ellipsis Plug-in for JQuery</title><author>Jeremy</author><pubDate>Tue, 10 Aug 2010 07:34:38 +0000</pubDate><link>http://jeffmartin.com/journal/2009/11/9/a-custom-ellipsis-plug-in-for-jquery.html#comments</link><guid isPermaLink="false">339264:3583846:comment/9306588</guid><description><![CDATA[<p>Hey,</p><p>This doesn't seem to work inside of a table cell.  Any ideas?</p><p>Many thanks<br/>Jeremy</p>]]></description></item><item><title>Jeff Martin comments on A Custom Ellipsis Plug-in for JQuery</title><author>Jeff Martin</author><pubDate>Sun, 11 Jul 2010 14:29:52 +0000</pubDate><link>http://jeffmartin.com/journal/2009/11/9/a-custom-ellipsis-plug-in-for-jquery.html#comments</link><guid isPermaLink="false">339264:3583846:comment/8927259</guid><description><![CDATA[<p>@Jeremy - Glad you got it working.</p>]]></description></item></channel></rss>
