You are here: System » JQueryPlugin » JQueryShrinkUrls

JQueryShrinkUrls

Homepage: http://foswiki.org/Extensions/JQueryPlugin
Author(s): Michael Daum
Version: 2.0

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" data-size="25" data-whitespace="true">
   <a href="#">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vehicula est et felis imperdi</a>
</div>

Examples

Kontakt
Pädagogische Hochschule Schwyz
Zaystrasse 42
CH-6410 Goldau
T +41 41 859 05 90
info@phsz.ch Dies ist ein Wiki des Fachkerns Medien und Informatik der Pädagogischen Hochschule Schwyz. Für Fragen wenden Sie sich bitte an wikiadmin@phsz.ch
This page was cached on 31 Jan 2025 - 14:45.
This website is using cookies. More info. That's Fine