release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Search | Go
Wiki > System > JQueryPlugin > JQueryShrinkUrls

JQueryShrinkUrls

Homepage: http://michaeldaumconsulting.com
Author(s): Michael Daum
Version: 1.2

Shrinks all urls in a given container whose link text exceeds a given size and have no white spaces in it, that is don't wrap around nicely. If the text is skrunk, the original text is appended to the title attribute of the anchor.

Usage

JavaScript API

 $("#container a").shrinkUrls({
   size:<number>,           // max size (default 25)
   include:'<regex>'       // regular expression a link text must
                           // match to be considered
   exclude:'<regex>'       // regular expression a link text must
                           // not match to be considered
   whitespace:<boolean>,   // true: even shrink if there's whitespace
                           // in the link text (default false)
   trunc:<head|middle|tail> // position where to insert the ellipsis
 });

Foswiki integration

Add the class name jqShrinkUrls to a container to process all anchors inside.

%JQREQUIRE{"shrinkurls"}%
<div class="jqShrinkUrls {size:25, whitespace:true}">
   <a href="#">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vehicula est et felis imperdi</a>
</div>

Examples

r1 - 08 Sep 2011 - 11:00:54 - ProjectContributor

Parents: JQueryPlugin
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Wiki? Send feedback