1 # <a name="%TOPIC%"></a><a name=" %TOPIC%"></a> %TOPIC%
3 **A "twisty" is an interface toggle control to show and hide content.**
5 TwistyPlugin gives you several options to control the appearance of a twisty:
7 - use link text or buttons
8 - position an icon left or right
9 - remember the state at the next visit of the page
10 - start the Twisty open or closed
11 - start the Twisty open or closed for the first visit
12 - use a span or div for the content
13 - set a class for the content span or div
15 Twisty has a fallback mechanism in case JavaScript is not available: all content is displayed and the control buttons are hidden.
17 <div><span>On this page:</span><ul>
18 <li><a href="#Usage examples"> Usage examples</a><ul>
19 <li><a href="#Triad"> Triad</a></li>
20 <li><a href="#Shorthand"> Shorthand</a></li>
21 <li><a href="#Twisty with icons"> Twisty with icons</a></li>
22 <li><a href="#Make it remember"> Make it remember</a></li>
23 <li><a href="#Make it obey"> Make it obey</a></li>
24 <li><a href="#Make it obey only the first time"> Make it obey only the first time</a></li>
25 <li><a href="#Other use: hide interface parts"> Other use: hide interface parts in case of no JavaScript</a></li>
26 <li><a href="#Styling the Twisty"> Styling the Twisty</a></li>
27 <li><a href="#Twisty headers"> Twisty headers</a></li>
28 <li><a href="#All on, all off"> All on, all off</a></li>
31 <li><a href="#Special syntax: format tokens"> Special syntax: format tokens</a></li>
32 <li><a href="#Syntax"> Syntax</a><ul>
33 <li><a href="#TWISTY"> TWISTY</a></li>
34 <li><a href="#ENDTWISTY"> ENDTWISTY</a></li>
37 <li><a href="#Twisty components syntax"> Twisty components syntax</a><ul>
38 <li><a href="#TWISTYBUTTON"> TWISTYBUTTON</a></li>
39 <li><a href="#TWISTYSHOW"> TWISTYSHOW</a></li>
40 <li><a href="#TWISTYHIDE"> TWISTYHIDE</a></li>
41 <li><a href="#TWISTYTOGGLE"> TWISTYTOGGLE</a></li>
42 <li><a href="#ENDTWISTYTOGGLE"> ENDTWISTYTOGGLE</a></li>
45 <li><a href="#The Fine Print"> The Fine Print</a></li>
46 <li><a href="#Plugin Settings"> Plugin Settings</a></li>
47 <li><a href="#Plugin Installation Instructions"> Plugin Installation Instructions</a></li>
48 <li><a href="#Plugin Info"> Plugin Info</a></li>
52 ## <a name="Usage examples"></a> Usage examples
54 ### <a name="Triad"></a> Triad
56 A Twisty consists of 3 elements:
60 3. Collapsing content ('Toggle')
62 The typical TwistyPlugin triad will look like this (pseudo code):
64 %TWISTYSHOW{}% %TWISTYHIDE{}%
65 (there may be other things between buttons and content)
66 %TWISTYTOGGLE{}% my content %ENDTWISTYTOGGLE%
68 ### <a name="Shorthand"></a> Shorthand
70 The Twisty triad is conveniently packed into shorthand `%TWISTY{some parameters}% Collapsing content %ENDTWISTY%`:
78 <span><span>[<span></span>](#)</span><span>[<span></span>](#)</span></span>
80 <div style="display: inline"><span id="twistyId1toggle"> %GREEN% my twisty content %ENDCOLOR% </span></div>
82 You may have noticed that no parameters are passed to `%TWISTY{}%` but the show and hide links _do_ have text! The default values are fetched from plugin settings `TWISTYSHOWLINK` and `TWISTYHIDELINK`, see [[Plugin Settings|Main/WebHome#PluginSettings]] below.
84 ### <a name="Twisty with icons"></a> Twisty with icons
86 We will use `mode="div"` to put the collapsing content below the button (the default mode is `"span"`).
92 showimgleft="%ICONURLPATH{toggleopen-small}%"
93 hideimgleft="%ICONURLPATH{toggleclose-small}%"
98 It will look like this:
100 <span><span>[![](http://www.dementia.org/twiki//view/Main/WebHome/toggleopen-small.gif)<span>Show...</span>](#)</span><span>[![](http://www.dementia.org/twiki//view/Main/WebHome/toggleclose-small.gif)<span>Hide</span>](#)</span></span>
102 <div style="display: inline">
103 <div id="twistyId2toggle"> %GREEN% my twisty content %ENDCOLOR% </div>
106 To put icons at the right side, write
110 showlink="Show "
111 hidelink="Hide "
112 showimgright="%ICONURLPATH{toggleopen-small}%"
113 hideimgright="%ICONURLPATH{toggleclose-small}%"
118 <span><span>[<span>Show </span>![](http://www.dementia.org/twiki//view/Main/WebHome/toggleopen-small.gif)](#)</span><span>[<span>Hide </span>![](http://www.dementia.org/twiki//view/Main/WebHome/toggleclose-small.gif)](#)</span></span>
120 <div style="display: inline">
121 <div id="twistyId3toggle"> %GREEN% my twisty content %ENDCOLOR% </div>
124 ### <a name="Make it remember"></a> Make it remember
126 To store the last state in a TWIKIPREF cookie, add the parameter `remember="on"`.%BR% To test this, reload the page after toggling.
136 <span><span>[<span>Show...</span>](#)</span><span>[<span>Hide</span>](#)</span></span>
138 <div style="display: inline"><span id="twistyId4toggle"> %GREEN% my twisty content %ENDCOLOR% </span></div>
140 If a Twisty state has been stored in a TWIKIPREF cookie before, it can be cleared by using `remember="off"`:
150 <span><span>[<span>Show...</span>](#)</span><span>[<span>Hide</span>](#)</span></span>
152 <div style="display: inline"><span id="twistyId5toggle"> %GREEN% my twisty content %ENDCOLOR% </span></div>
154 **NOTE:** Twisty ids are generated automatically. If you need control over exactly _which_ Twisty should be remembered, add the parameter `id`:
157 id="currentCustomerList"
165 Note that `id` sets a sitewide cookie. To create a unique id, add topic or web variables:
167 id="%WEB%_%TOPIC%_currentCustomerList"
169 ### <a name="Make it obey"></a> Make it obey
171 To let the Twisty start with its content folded open, add parameter `start="show"`.
181 <span><span>[<span>Show...</span>](#)</span><span>[<span>Hide</span>](#)</span></span>
183 <div style="display: inline"><span id="twistyId6toggle"> %GREEN% my twisty content %ENDCOLOR% </span></div>
185 Likewise use `start="hide"` to start with hidden content.
195 <span><span>[<span>Show...</span>](#)</span><span>[<span>Hide start=</span>](#)</span></span>
197 <div style="display: inline"><span id="twistyId7toggle"> %GREEN% my twisty content %ENDCOLOR% </span></div>
199 ### <a name="Make it obey only the first time"></a> Make it obey only the first time
201 To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter `firststart="show"`. If `remember="on"` is used, subsequential visits to the page will display the Twisty according the cookie setting.
211 <span><span>[<span>Show...</span>](#)</span><span>[<span>Hide</span>](#)</span></span>
213 <div style="display: inline"><span id="twistyId8toggle"> %GREEN% my twisty content %ENDCOLOR% </span></div>
215 ### <a name="Other use: hide interface parts"></a><a name="Other use: hide interface parts "></a> Other use: hide interface parts in case of no JavaScript
217 You can use Twisty to show interface elements that should only be visible with JavaScript enabled. For instance the textbox control buttons in the edit screen need JavaScript to work. If a visitor does not have JavaScript on it would not make sense to show these buttons.
219 Put the "JavaScript content" in an almost bare bones Twisty. Write `showlink="" hidelink=""` to not display any default link texts.
226 <input type="submit" class="twikiButton" value="You surely have !JavaScript" />
229 <span><span>[<span></span>](#)</span><span>[<span></span>](#)</span></span>
231 <div style="display: inline"><span id="twistyId9toggle"><input type="submit" value="You surely have JavaScript" /> </span></div>
233 Do not forget to set `start="show"` to show the Twisty content at all.
235 When JavaScript is off, the button should be invisible.
237 This code will show the button when JavaScript is off:
243 <input type="submit" class="twikiButton" value="You might have !JavaScript" />
246 <span><span>[<span></span>](#)</span><span>[<span></span>](#)</span></span>
248 <div style="display: inline"><span id="twistyId10toggle"><input type="submit" value="You might have JavaScript" /> </span></div>
250 ### <a name="Styling the Twisty"></a> Styling the Twisty
252 Use parameter `class` to style the content div or class:
263 Generates: %BR% <span><span>[<span>Show...</span>](#)</span><span>[<span>Hide</span>](#)</span></span>
265 <div style="display: inline">
266 <div id="twistyId11toggle"> %GREEN% my twisty content %ENDCOLOR% </div>
269 ### <a name="Twisty headers"></a> Twisty headers
271 To be able to use header tags like `<h2>`, use the properties `prefix` and `suffix`. Because we have identical show and hide links we can use the shorthand property `link`.
277 showimgleft="%ICONURLPATH{toggleopen}%"
278 hideimgleft="%ICONURLPATH{toggleclose}%"
284 Add the `!!` to prevent the twisty header appear in the table of contents when you use `%TOC%`.
288 #### <a name="Header%_TWISTYSCRIPT{"TWiki._Twi"></a> <span><span>[![](http://www.dementia.org/twiki//view/Main/WebHome/toggleopen.gif)<span>Header</span>](#)</span><span>[![](http://www.dementia.org/twiki//view/Main/WebHome/toggleclose.gif)<span>Header</span>](#)</span></span>
290 <div style="display: inline"><span id="twistyId12toggle"> %GREEN% my twisty content %ENDCOLOR% </span></div>
292 ### <a name="All on, all off"></a> All on, all off
294 You can toggle all Twisties on or off at once by putting a link or button on the page with class `twistyExpandAll` or `twistyCollapseAll`.
296 <button class="twistyExpandAll twikiButton">Expand all</button> <button class="twistyCollapseAll twikiButton">Collapse all</button>
298 Creates these controls:
300 <button>Expand all</button>
302 <button>Collapse all</button>
304 When you want to use links, write:
308 <a href="#TOGGLE" class="twistyExpandAll">Expand all</a>
309 <a href="#TOGGLE" class="twistyCollapseAll">Collapse all</a>
311 <a name="VarTOGGLE"></a>
313 [Expand all](#TOGGLE) [Collapse all](#TOGGLE)
315 ## <a name="Special syntax: format tokens"></a> Special syntax: format tokens
317 If you use TWiki variables inside TWISTY parameters chances are it will mess up the variable, or the rendered html. Use format tokens to 'delay' rendering of these variables until the Twisty parameters are parsed.
319 The format tokens are the same as with [[FormattedSearch]]:
321 <table border="1" cellpadding="0" cellspacing="0">
323 <th bgcolor="#99CCCC"><strong> Escape: </strong></th>
324 <th bgcolor="#99CCCC"><strong> Expands To: </strong></th>
327 <td><code>$n</code> or <code>$n()</code></td>
328 <td> New line. Use <code>$n()</code> if followed by alphanumeric character, e.g. write <code>Foo$n()Bar</code> instead of <code>Foo$nBar</code></td>
331 <td><code>$nop</code> or <code>$nop()</code></td>
332 <td> Is a "no operation". </td>
335 <td><code>$quot</code></td>
336 <td> Double quote (<code>"</code>) </td>
339 <td><code>$percnt</code></td>
340 <td> Percent sign (<code>%</code>) </td>
343 <td><code>$dollar</code></td>
344 <td> Dollar sign (<code>$</code>) </td>
348 For example, to show an icon inside the link, do not write:
352 but use format tokens:
354 link="$percntY$percnt"
358 <span><span>[![](http://www.dementia.org/twiki//view/Main/WebHome/toggleopen-small.gif)<span>$percntY$percnt</span>](#)</span><span>[![](http://www.dementia.org/twiki//view/Main/WebHome/toggleclose-small.gif)<span>$percntY$percnt</span>](#)</span></span>
360 <div style="display: inline">
361 <div id="twistyId13toggle"> my twisty content </div>
364 Or a more complex example using [[SpreadsheetPlugin]]; do not write:
366 link="Count: (%CALC{"$GET(infoCount)"}%)"
368 but use format tokens:
370 link="Count: ($percntCALC{$quot$dollarGET(infoCount)$quot}$percnt)"
372 ## <a name="Syntax"></a> Syntax
374 <a name="VarTWISTY"></a>
376 ### <a name="TWISTY"></a> TWISTY
378 This renders the button as well as the toggled content section contained within this and the closing ENDTWISTY tag. %BR% Usage: `%TWISTY{ ... }% Toggable contents %ENDTWISTY%`
380 <table border="1" cellpadding="0" cellspacing="0">
382 <th bgcolor="#99CCCC"><strong> Parameter </strong></th>
383 <th bgcolor="#99CCCC"><strong> Value </strong></th>
384 <th bgcolor="#99CCCC"><strong> Description </strong></th>
385 <th bgcolor="#99CCCC"><strong> Remark </strong></th>
388 <td><code>id</code></td>
389 <td> Unique identifier </td>
390 <td> Used to link [[Main/WebHome#VarTWISTYBUTTON]] and [[Main/WebHome#VarTWISTYTOGGLE]]</td>
394 <td><code>link</code></td>
395 <td> Link label </td>
396 <td> Link label for both show and hide links </td>
400 <td><code>hidelink</code></td>
401 <td> Link label </td>
402 <td> Hide link label </td>
406 <td><code>showlink</code></td>
407 <td> Link label </td>
408 <td> Show link label </td>
412 <td><code>mode</code></td>
413 <td><code>"div"</code> or <code>"span"</code></td>
414 <td> Specify if the Twisty Toggle section will use a <code><div></code> or a <code><span></code> tag. </td>
415 <td> optional, defaults to <code><span></code></td>
418 <td><code>showimgleft</code></td>
420 <td> Specify the url of an image that will be displayed with the show link at the left side of the link. <br />You may use [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/TWikiDocGraphics]] icons. Alternatively use an image attached to the topic. </td>
421 <td> optional, defaults to no image </td>
424 <td><code>hideimgleft</code></td>
426 <td> Specify the url of an image that will be displayed with the hide link at the left side of the link. <br />You may use [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/TWikiDocGraphics]] icons. Alternatively use an image attached to the topic. </td>
427 <td> optional, defaults to no image </td>
430 <td><code>showimgright</code></td>
432 <td> Specify the url of an image that will be displayed with the show link at the right side of the link. <br />You may use [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/TWikiDocGraphics]] icons. Alternatively use an image attached to the topic. </td>
433 <td> optional, defaults to no image </td>
436 <td><code>hideimgright</code></td>
438 <td> Specify the url of an image that will be displayed with the hide link at the right side of the link. <br />You may use [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/TWikiDocGraphics]] icons. Alternatively use an image attached to the topic. </td>
439 <td> optional, defaults to no image </td>
442 <td><code>remember</code></td>
443 <td><code>"on"</code>, <code>"off"</code></td>
444 <td> If <code>"on"</code>, the Twisty state is remembered the next time the page is shown. If <code>"off"</code>, the stored setting will be cleared.<br /><strong>Note:</strong> when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked. </td>
445 <td> optional, no default </td>
448 <td><code>start</code></td>
449 <td><code>"hide"</code> or <code>"show"</code></td>
450 <td> Initial state of the Twisty; this will override any setting stored in a cookie (see <code>remember</code>). </td>
451 <td> optional, default no initial state </td>
454 <td><code>firststart</code></td>
455 <td><code>"hide"</code> or <code>"show"</code></td>
456 <td> Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see <code>remember</code>). </td>
457 <td> optional, default no initial state </td>
460 <td><code>noscript</code></td>
461 <td><code>"hide"</code></td>
462 <td> Make content hidden in case use does not have JavaScript on </td>
463 <td> optional, default content is shown in case JavaScript if off </td>
466 <td><code>class</code></td>
467 <td> CSS class name </td>
468 <td> Class for Twisty div or span </td>
469 <td> optional, default none </td>
472 <td><code>prefix</code></td>
474 <td> Text to display before the show/hide links </td>
475 <td> optional, default none </td>
478 <td><code>suffix</code></td>
480 <td> Text to display after the show/hide links </td>
481 <td> optional, default none </td>
484 <td><code>img</code></td>
486 <td> %GREEN%Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.%ENDCOLOR% </td>
487 <td> optional, defaults to no image </td>
490 <td><code>imgleft</code></td>
492 <td> %GREEN%Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.%ENDCOLOR% </td>
493 <td> optional, defaults to no image </td>
496 <td><code>imgright</code></td>
498 <td> %GREEN%Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.%ENDCOLOR% </td>
499 <td> optional, defaults to no image </td>
502 <td><code>hideimg</code></td>
504 <td> %GREEN%Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.%ENDCOLOR% </td>
505 <td> optional, defaults to no image </td>
508 <td><code>showimg</code></td>
510 <td> %GREEN%Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.%ENDCOLOR% </td>
511 <td> optional, defaults to no image </td>
515 - Related [[TWISTYBUTTON|Main/WebHome#VarTWISTYSHOW]] and [[TWISTYTOGGLE|Main/WebHome#VarTWISTYTOGGLE]]
517 <a name="VarENDTWISTY"></a>
519 ### <a name="ENDTWISTY"></a> ENDTWISTY
521 **Twisty closure, complements the opening TWISTY tag.**
523 - Syntax: `%ENDTWISTY%`
525 See [[ENDTWISTYTOGGLE|Main/WebHome#VarENDTWISTYTOGGLE]].
527 ## <a name="Twisty components syntax"></a> Twisty components syntax
529 <div style="background-color: #eee; padding: .5em; margin: -.5em">
530 <p> Ocassionally you might need to create a custom set of individual Twisty components: </p>
531 <p><a name="VarTWISTYBUTTON"></a></p>
532 <h3><a name="TWISTYBUTTON"></a> TWISTYBUTTON </h3><strong>Shorthand version for TWISTYSHOW & TWISTYHIDE</strong> This is useful if both the show and the hide button take the same arguments. <ul>
533 <li> Supported parameters: all parameters supported by [[Main/WebHome#VarTWISTYSHOW]], except for <code>noscript</code> and <code>class</code> (only used for 'toggle' content) </li>
534 <li> Parameter differences: <ul>
535 <li><code>mode</code>: button mode defaults to span </li>
538 <li> Syntax: <code>%TWISTYBUTTON{id="myid" ... }%</code></li>
539 <li> Supported parameters: <table border="1" cellpadding="0" cellspacing="0">
541 <th bgcolor="#99CCCC"><strong> Parameter </strong></th>
542 <th bgcolor="#99CCCC"><strong> Value </strong></th>
543 <th bgcolor="#99CCCC"><strong> Description </strong></th>
544 <th bgcolor="#99CCCC"><strong> Remark </strong></th>
547 <td><code>mode</code></td>
548 <td><code>"div"</code> or <code>"span"</code></td>
549 <td> Specify if the <strong>Twisty button</strong> will use a <code><div></code> or a <code><span></code> tag </td>
550 <td> optional, defaults to <code><span></code></td>
554 <li> Related: [[Main/WebHome#VarTWISTYSHOW]] and [[Main/WebHome#VarTWISTYHIDE]]</li>
556 <p><a name="VarTWISTYSHOW"></a></p>
557 <h3><a name="TWISTYSHOW"></a> TWISTYSHOW </h3><strong>Show/open link</strong><ul>
558 <li> Syntax: <code>%TWISTYSHOW{id="myid" ... }%</code></li>
559 <li> Supported parameters: <table border="1" cellpadding="0" cellspacing="0">
561 <th bgcolor="#99CCCC"><strong> Parameter </strong></th>
562 <th bgcolor="#99CCCC"><strong> Value </strong></th>
563 <th bgcolor="#99CCCC"><strong> Description </strong></th>
564 <th bgcolor="#99CCCC"><strong> Remark </strong></th>
567 <td><code>id</code></td>
568 <td> Unique identifier </td>
569 <td> Used to link [[Main/WebHome#VarTWISTYSHOW]], [[Main/WebHome#VarTWISTYHIDE]] and [[Main/WebHome#VarTWISTYTOGGLE]]</td>
573 <td><code>link</code></td>
574 <td> Link label </td>
575 <td> Show link label </td>
579 <td><code>mode</code></td>
580 <td><code>"div"</code> or <code>"span"</code></td>
581 <td> Specify if the Twisty Show link will use a <code><div></code> or a <code><span></code> tag </td>
582 <td> optional, defaults to <code><span></code></td>
585 <td><code>img</code></td>
587 <td> Specify the url of an image that will be displayed at the <strong>right side</strong> of the link. <br />You may use [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/TWikiDocGraphics]] icons. Alternatively use an image attached to the topic. </td>
588 <td> optional, defaults to no image </td>
591 <td><code>imgleft</code></td>
593 <td> Specify the url of an image that will be displayed at the left side of the link. <br />You may use [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/TWikiDocGraphics]] icons. Alternatively use an image attached to the topic. </td>
594 <td> optional, defaults to no image </td>
597 <td><code>imgright</code></td>
599 <td> Specify the url of an image that will be displayed at the right side of the link. <br />You may use [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/TWikiDocGraphics]] icons. Alternatively use an image attached to the topic. </td>
600 <td> optional, defaults to no image </td>
603 <td><code>remember</code></td>
604 <td><code>"on"</code>, <code>"off"</code></td>
605 <td> If <code>"on"</code>, the Twisty state is remembered the next time the page is shown. If <code>"off"</code>, the stored setting will be cleared.<br /><strong>Note:</strong> when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked. </td>
606 <td> optional, no default </td>
609 <td><code>start</code></td>
610 <td><code>"hide"</code> or <code>"show"</code></td>
611 <td> Initial state of the Twisty; this will override any setting stored in a cookie (see <code>remember</code>). </td>
612 <td> optional, default no initial state </td>
615 <td><code>firststart</code></td>
616 <td><code>"hide"</code> or <code>"show"</code></td>
617 <td> Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see <code>remember</code>). </td>
618 <td> optional, default no initial state </td>
622 <li> Example: <code>%TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%</code></li>
623 <li> Related: [[Main/WebHome#VarTWISTYHIDE]] and [[Main/WebHome#VarTWISTYTOGGLE]]</li>
625 <p><a name="VarTWISTYHIDE"></a></p>
626 <h3><a name="TWISTYHIDE"></a> TWISTYHIDE </h3><strong>Hide/close link</strong><ul>
627 <li> Syntax: <code>%TWISTYHIDE{id="myid" ... }%</code></li>
628 <li> Supported parameters: <table border="1" cellpadding="0" cellspacing="0">
630 <th bgcolor="#99CCCC"><strong> Parameter </strong></th>
631 <th bgcolor="#99CCCC"><strong> Value </strong></th>
632 <th bgcolor="#99CCCC"><strong> Description </strong></th>
633 <th bgcolor="#99CCCC"><strong> Remark </strong></th>
636 <td><code>id</code></td>
637 <td> Unique identifier </td>
638 <td> Used to link [[Main/WebHome#VarTWISTYSHOW]], [[Main/WebHome#VarTWISTYHIDE]] and [[Main/WebHome#VarTWISTYTOGGLE]]</td>
642 <td><code>link</code></td>
643 <td> Link label </td>
644 <td> Hide link label </td>
648 <td><code>mode</code></td>
649 <td><code>"div"</code> or <code>"span"</code></td>
650 <td> Specify if the Twisty Hide link will use a <code><div></code> or a <code><span></code> tag </td>
651 <td> optional, defaults to <code><span></code></td>
654 <td><code>img</code></td>
656 <td> Specify the url of an image that will be displayed at the <strong>right side</strong> of the link. <br />You may use [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/TWikiDocGraphics]] icons. Alternatively use an image attached to the topic. </td>
657 <td> optional, defaults to no image </td>
660 <td><code>remember</code></td>
661 <td><code>"on"</code>, <code>"off"</code></td>
662 <td> If <code>"on"</code>, the Twisty state is remembered the next time the page is shown. If <code>"off"</code>, the stored setting will be cleared.<br /><strong>Note:</strong> when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked. </td>
663 <td> optional, no default </td>
666 <td><code>start</code></td>
667 <td><code>"hide"</code> or <code>"show"</code></td>
668 <td> Initial state of the Twisty; this will override any setting stored in a cookie (see <code>remember</code>). </td>
669 <td> optional, default no initial state </td>
672 <td><code>firststart</code></td>
673 <td><code>"hide"</code> or <code>"show"</code></td>
674 <td> Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see <code>remember</code>). </td>
675 <td> optional, default no initial state </td>
679 <li> Example: <code>%TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%</code></li>
680 <li> Related: [[Main/WebHome#VarTWISTYSHOW]] and [[Main/WebHome#VarTWISTYTOGGLE]]</li>
682 <p><a name="VarTWISTYTOGGLE"></a></p>
683 <h3><a name="TWISTYTOGGLE"></a> TWISTYTOGGLE </h3><strong>Twisty Toggle contents section</strong><ul>
684 <li> Syntax: <code>%TWISTYTOGGLE{id="myid"}%</code></li>
685 <li> Supported parameters: <table border="1" cellpadding="0" cellspacing="0">
687 <th bgcolor="#99CCCC"><strong> Parameter </strong></th>
688 <th bgcolor="#99CCCC"><strong> Value </strong></th>
689 <th bgcolor="#99CCCC"><strong> Description </strong></th>
690 <th bgcolor="#99CCCC"><strong> Remark </strong></th>
693 <td><code>id</code></td>
694 <td> Unique identifier </td>
695 <td> Used to link [[Main/WebHome#VarTWISTYSHOW]], [[Main/WebHome#VarTWISTYHIDE]] and [[Main/WebHome#VarTWISTYTOGGLE]]. </td>
699 <td><code>mode</code></td>
700 <td><code>"div"</code> or <code>"span"</code></td>
701 <td> Specify if the Twisty Toggle section will use a <code><div></code> or a <code><span></code> tag. </td>
702 <td> optional, defaults to <code><span></code></td>
705 <td><code>class</code></td>
706 <td> CSS class name </td>
707 <td> Class for content div or span </td>
708 <td> optional, default none </td>
711 <td><code>remember</code></td>
712 <td><code>"on"</code>, <code>"off"</code></td>
713 <td> If <code>"on"</code>, the Twisty state is remembered the next time the page is shown. If <code>"off"</code>, the stored setting will be cleared.<br /><strong>Note:</strong> when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked. </td>
714 <td> optional, no default </td>
717 <td><code>start</code></td>
718 <td><code>"hide"</code> or <code>"show"</code></td>
719 <td> Initial state of the Twisty; this will override any setting stored in a cookie (see <code>remember</code>). </td>
720 <td> optional, default no initial state </td>
723 <td><code>firststart</code></td>
724 <td><code>"hide"</code> or <code>"show"</code></td>
725 <td> Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see <code>remember</code>). </td>
726 <td> optional, default no initial state </td>
729 <td><code>noscript</code></td>
730 <td><code>"hide"</code></td>
731 <td> Make content hidden in case use does not have JavaScript on </td>
732 <td> optional, default content is shown with no JavaScript </td>
736 <li> Example: <code>%TWISTYTOGGLE{id="demo" mode="div" remember="on"}%My content%ENDTWISTYTOGGLE%</code></li>
737 <li> Related: [[Main/WebHome#VarTWISTYHIDE]], [[Main/WebHome#VarTWISTYHIDE]] an [[Main/WebHome#VarENDTWISTYTOGGLE]]</li>
739 <p><a name="VarENDTWISTYTOGGLE"></a></p>
740 <h3><a name="ENDTWISTYTOGGLE"></a> ENDTWISTYTOGGLE </h3><strong>The Twisty closure</strong><ul>
741 <li> Syntax: <code>%ENDTWISTYTOGGLE%</code><ul>
742 <li> Will end the most inner unclosed Twisty Toggle section, using the proper tag </li>
745 <li> Example: <code>%ENDTWISTYTOGGLE%</code></li>
746 <li> Related: [[Main/WebHome#VarTWISTYTOGGLE]]</li>
750 ## <a name="The Fine Print"></a> The Fine Print
752 TwistyPlugin is a convenience plugin for TWiki:Plugins.TwistyContrib.
756 - When active, the Twisty JavaScript library is included in every topic
757 - Provides a convenience syntax to define Twisty areas
758 - Automatically generates ids
759 - Automatically fills in default values
760 - Global preference settings can be set in this topic or locally in individual topics
762 <a name="PluginSettings"></a>
764 ## <a name="Plugin Settings"></a> Plugin Settings
766 Plugin settings are stored as preferences variables. To reference a plugin setting write <code>**%<plugin>\_<setting>%**</code>, i.e. <code>**%TWISTYPLUGIN\_SHORTDESCRIPTION%**</code>
768 - Set TWISTYSHOWLINK = More...
769 - For example: `More...`
770 - Set TWISTYHIDELINK = Close
771 - For example: `Close`
773 - Either `div` or `span`; `span` if nothing set
774 - Set TWISTYREMEMBER =
775 - Either `on` or `off`; default is not specified. If set to `on` all Twisty states will be stored in a TWIKIPREF cookie; if set to `off` the TWIKIPREF cookie will be cleared
777 - Set SHORTDESCRIPTION = Twisty section JavaScript library to open/close content dynamically
780 ## <a name="Plugin Installation Instructions"></a> Plugin Installation Instructions
782 - Download the ZIP file from the Plugin web (see below)
783 - Unzip <code>**%TOPIC%.zip**</code> in your root ($TWIKI\_ROOT) directory. Content: <table border="1" cellpadding="0" cellspacing="0">
785 <th bgcolor="#99CCCC"><strong> File: </strong></th>
786 <th bgcolor="#99CCCC"><strong> Description: </strong></th>
789 <td><code><b>TwistyBundleTWiki04x02_installer</b></code></td>
793 <td><code><b>TwistyBundleTWiki04x02_installer.pl</b></code></td>
797 <td><code><b>data/TWiki/TwistyBundleTWiki04x02.txt</b></code></td>
801 <td><code><b>data/TWiki/BehaviourContrib.txt</b></code></td>
805 <td><code><b>data/TWiki/TwistyContrib.txt</b></code></td>
809 <td><code><b>data/TWiki/TwistyPlugin.txt</b></code></td>
813 <td><code><b>lib/TWiki/Contrib/BehaviourContrib.pm</b></code></td>
817 <td><code><b>lib/TWiki/Contrib/TwistyBundleTWiki04x02.pm</b></code></td>
821 <td><code><b>lib/TWiki/Contrib/TwistyContrib.pm</b></code></td>
825 <td><code><b>lib/TWiki/Plugins/TwistyPlugin.pm</b></code></td>
829 <td><code><b>pub/TWiki/BehaviourContrib/behaviour.compressed.js</b></code></td>
833 <td><code><b>pub/TWiki/BehaviourContrib/behaviour.compressed_src.js</b></code></td>
837 <td><code><b>pub/TWiki/BehaviourContrib/behaviour.js</b></code></td>
841 <td><code><b>pub/TWiki/BehaviourContrib/behaviour_src.js</b></code></td>
845 <td><code><b>pub/TWiki/BehaviourContrib/cssQuery/cssQuery-p.js</b></code></td>
849 <td><code><b>pub/TWiki/BehaviourContrib/cssQuery/src/cssQuery-level2.js</b></code></td>
853 <td><code><b>pub/TWiki/BehaviourContrib/cssQuery/src/cssQuery-level3.js</b></code></td>
857 <td><code><b>pub/TWiki/BehaviourContrib/cssQuery/src/cssQuery-standard.js</b></code></td>
861 <td><code><b>pub/TWiki/BehaviourContrib/cssQuery/src/cssQuery.js</b></code></td>
865 <td><code><b>pub/TWiki/BehaviourContrib/cssQuery/src/test.html</b></code></td>
869 <td><code><b>pub/TWiki/BehaviourContrib/cssQuery/test.html</b></code></td>
873 <td><code><b>pub/TWiki/TwistyContrib/twist.compressed.js</b></code></td>
877 <td><code><b>pub/TWiki/TwistyContrib/twist.compressed_src.js</b></code></td>
881 <td><code><b>pub/TWiki/TwistyContrib/twist.css</b></code></td>
885 <td><code><b>pub/TWiki/TwistyContrib/twist.js</b></code></td>
889 <td><code><b>pub/TWiki/TwistyContrib/twist_src.js</b></code></td>
894 - Optionally, if it exists, run <code>**%TOPIC%\_installer**</code> to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
895 - Alternatively, manually make sure the dependencies listed in the table below are resolved. None
896 - Visit `configure` in your TWiki installation, and enable the plugin in the \{Plugins\} section.
898 ## <a name="Plugin Info"></a> Plugin Info
900 <table border="1" cellpadding="0" cellspacing="0">
903 <td> TWiki:Main.RafaelAlvarez, TWiki:Main.ArthurClemens </td>
906 <td> Copyright ©: </td>
907 <td> 2005 Rafael Alvarez; 2006, 2007 Arthur Clemens </td>
911 <td><a href="http://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a></td>
914 <td> Dependencies: </td>
918 <td> Plugin Version: </td>
919 <td> 24 Nov 2007 (version 1.4.8) </td>
922 <td> Change History: </td>
926 <td> 24 Nov 2007 </td>
927 <td> 1.4.6 - 1.4.8 Arthur Clemens - Added format tokens. </td>
930 <td> 07 Oct 2007 </td>
931 <td> 1.4.5 Arthur Clemens - Fix html tag with show/hide controls. </td>
934 <td> 25 Sep 2007 </td>
935 <td> 1.4.4 Arthur Clemens - Fix rendering of headers when <code>prefix</code> is used. </td>
938 <td> 11 Jul 2007 </td>
939 <td> 1.4.3 Arthur Clemens - Fix invalid html when <code>prefix</code> and <code>suffix</code> is used. </td>
942 <td> 23 Jun 2007 </td>
943 <td> 1.4.2 Arthur Clemens - Fixed bugs with parameters <code>firststart</code> and <code>noscript</code> (since version 1.4). </td>
946 <td> 20 Jun 2007 </td>
947 <td> 1.4 Arthur Clemens - Updated to work without ugly inserted javascript 'init' calls. This will change nothing to the functionality, but it will produce cleaner HTML, while at the same time the twisty is still set immediately (not at page onload) and graceful fallback in case of no javascript is maintained. </td>
950 <td> 19 Jun 2006 </td>
951 <td> 1.3 Arthur Clemens - Updated with TWiki 4 JavaScript files. </td>
954 <td> 25 Oct 2006 </td>
955 <td> 1.2 New variables to set default values: <code>TWISTYSHOWLINK</code>, <code>TWISTYHIDELINK</code>, <code>TWISTYMODE</code>, <code>TWISTYREMEMBER</code>; property <code>id</code> is no longer required as this is automatically set (still recommended in some cases with <code>remember="on"</code>); property value <code>remember="off"</code> will clear a previously stored cookie; new properties <code>prefix</code> and <code>suffix</code>; JavaScript to collapse or expand all Twisties on the page. </td>
958 <td> 27 Sep 2006 </td>
959 <td> 1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set </td>
962 <td> 11 June 2006 </td>
963 <td> 1.100 Added parameters <code>start</code>, <code>firststart</code>, <code>noscript</code> and <code>class</code>; complete JavaScript rewrite for speed </td>
966 <td> 12 Sep 2005 </td>
967 <td> 1.000 First Version </td>
971 <td><a href="http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%" target="_top">http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%</a></td>
975 <td><a href="http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev" target="_top">http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev</a></td>
978 <td> Appraisal: </td>
979 <td><a href="http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Appraisal" target="_top">http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Appraisal</a></td>